diff options
-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" |