diff options
-rw-r--r-- | tests/adhoc/smoke01.sh | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/tests/adhoc/smoke01.sh b/tests/adhoc/smoke01.sh index a7790d5..60fb878 100644 --- a/tests/adhoc/smoke01.sh +++ b/tests/adhoc/smoke01.sh @@ -53,17 +53,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" |