summaryrefslogtreecommitdiffstats
path: root/tests/dmz-clean.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tests/dmz-clean.sh')
-rw-r--r--tests/dmz-clean.sh34
1 files changed, 19 insertions, 15 deletions
diff --git a/tests/dmz-clean.sh b/tests/dmz-clean.sh
index 0823cad..dcb53b8 100644
--- a/tests/dmz-clean.sh
+++ b/tests/dmz-clean.sh
@@ -24,7 +24,7 @@
# Install Congress test server per https://wiki.opnfv.org/copper/academy
# # Create Congress policy and resources that exercise policy
# $ bash dmz.sh
-# After test, cleanup
+# # After test, cleanup
# $ bash dmz-clean.sh
if [ $# -eq 1 ]; then
@@ -46,10 +46,27 @@ echo "Delete cirros1 instance"
instance=$(nova list | awk "/ cirros1 / { print \$2 }")
if [ "$instance" != "" ]; then nova delete $instance; fi
+# FLOATING_IP_ID was saved by dmz.sh
+source /tmp/TEST_VARS.sh
+rm /tmp/TEST_VARS.sh
+echo "Delete floating ip"
+neutron floatingip-delete $FLOATING_IP_ID
+
echo "Delete cirros2 instance"
instance=$(nova list | awk "/ cirros2 / { print \$2 }")
if [ "$instance" != "" ]; then nova delete $instance; fi
+echo "Wait for cirros1 and cirros2 to terminate"
+COUNTER=5
+RESULT="Wait!"
+until [[ $COUNTER -eq 0 || $RESULT == "Go!" ]]; do
+ cirros1_id=$(openstack server list | awk "/ cirros1 / { print \$4 }")
+ cirros2_id=$(openstack server list | awk "/ cirros2 / { print \$4 }")
+ if [[ "$cirros1_id" == "" && "$cirros2_id" == "" ]]; then RESULT="Go!"; fi
+ let COUNTER-=1
+ sleep 5
+done
+
echo "Delete 'dmz' security group"
sg=$(neutron security-group-list | awk "/ dmz / { print \$2 }")
neutron security-group-delete $sg
@@ -63,15 +80,6 @@ test_internal_interface=$(neutron router-port-list $router | grep 10.0.0.1 | awk
echo "If found, delete the port with subnet 10.0.0.1 on 'test_router'"
if [ "$test_internal_interface" != "" ]; then neutron router-interface-delete $router port=$test_internal_interface; fi
-echo "Get public port ID with fixed_ip 192.168.10.2 on 'test_router'"
-test_public_interface=$(neutron router-port-list $router | grep 192.168.10.2 | awk '{print $2}')
-
-echo "If found, delete the port with fixed_ip 192.168.10.2 on 'test_router'"
-if [ "$test_public_interface" != "" ]; then neutron router-interface-delete $router port=$test_public_interface; fi
-
-echo "Delete the router internal interface"
-neutron router-interface-delete $router $test_internal_interface
-
echo "Clear the router gateway"
neutron router-gateway-clear test_router
@@ -92,9 +100,5 @@ neutron subnet-delete test_internal
echo "Delete internal network"
neutron net-delete test_internal
-echo "Delete public subnet"
-neutron subnet-delete test_public
-
-echo "Delete public network"
-neutron net-delete test_public
+set +x #echo off