diff options
author | blsaws <bryan.sullivan@att.com> | 2016-08-09 10:21:07 -0700 |
---|---|---|
committer | blsaws <bryan.sullivan@att.com> | 2016-08-09 10:21:07 -0700 |
commit | 60a43e0ec19066230ce5f18c559b4677553f999f (patch) | |
tree | d7efdbe00c53359f4d19c6bfdebe238eefc06a8d /tests | |
parent | 0e241989f438afbeb439f122b3765e2742fc54ab (diff) |
Fix external network search method
JIRA: COPPER-4
Change-Id: I9e4ee1e89cd18e3ab1ff8fa311acd41be3d2be94
Signed-off-by: blsaws <bryan.sullivan@att.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/dmz.sh | 17 | ||||
-rw-r--r-- | tests/smtp_ingress.sh | 17 |
2 files changed, 12 insertions, 22 deletions
diff --git a/tests/dmz.sh b/tests/dmz.sh index 666c285..5bf2ebd 100644 --- a/tests/dmz.sh +++ b/tests/dmz.sh @@ -61,17 +61,12 @@ fi # Find external network if any, and details function get_external_net () { - echo "Find external network" - LINE=4 - ID=$(openstack network list | awk "NR==$LINE{print \$2}") - while [[ $ID ]] - do - if [[ $(openstack network show $ID | awk "/ router/ { print \$4 }") == "External" ]]; then break; fi - ((LINE+=1)) - ID=$(openstack network list | awk "NR==$LINE{print \$2}") - done - if [[ $ID ]]; then - EXTERNAL_NETWORK_NAME=$(openstack network show $ID | awk "/ name / { print \$4 }") + network_ids=($(neutron net-list|grep -v "+"|grep -v name|awk '{print $2}')) + for id in ${network_ids[@]}; do + [[ $(neutron net-show ${id}|grep 'router:external'|grep -i "true") != "" ]] && ext_net_id=${id} + done + if [[ $ext_net_id ]]; then + EXTERNAL_NETWORK_NAME=$(openstack network show $ext_net_id | awk "/ name / { print \$4 }") EXTERNAL_SUBNET_ID=$(openstack network show $EXTERNAL_NETWORK_NAME | awk "/ subnets / { print \$4 }") else echo "External network not found" diff --git a/tests/smtp_ingress.sh b/tests/smtp_ingress.sh index c950f8a..860803f 100644 --- a/tests/smtp_ingress.sh +++ b/tests/smtp_ingress.sh @@ -55,17 +55,12 @@ fi # Find external network if any, and details function get_external_net () { - echo "Find external network" - LINE=4 - ID=$(openstack network list | awk "NR==$LINE{print \$2}") - while [[ $ID ]] - do - if [[ $(openstack network show $ID | awk "/ router/ { print \$4 }") == "External" ]]; then break; fi - ((LINE+=1)) - ID=$(openstack network list | awk "NR==$LINE{print \$2}") - done - if [[ $ID ]]; then - EXTERNAL_NETWORK_NAME=$(openstack network show $ID | awk "/ name / { print \$4 }") + network_ids=($(neutron net-list|grep -v "+"|grep -v name|awk '{print $2}')) + for id in ${network_ids[@]}; do + [[ $(neutron net-show ${id}|grep 'router:external'|grep -i "true") != "" ]] && ext_net_id=${id} + done + if [[ $ext_net_id ]]; then + EXTERNAL_NETWORK_NAME=$(openstack network show $ext_net_id | awk "/ name / { print \$4 }") EXTERNAL_SUBNET_ID=$(openstack network show $EXTERNAL_NETWORK_NAME | awk "/ subnets / { print \$4 }") else echo "External network not found" |