summaryrefslogtreecommitdiffstats
path: root/tests/adhoc/dmz01-clean.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tests/adhoc/dmz01-clean.sh')
-rw-r--r--tests/adhoc/dmz01-clean.sh34
1 files changed, 29 insertions, 5 deletions
diff --git a/tests/adhoc/dmz01-clean.sh b/tests/adhoc/dmz01-clean.sh
index 5a6ca7e..c218ef2 100644
--- a/tests/adhoc/dmz01-clean.sh
+++ b/tests/adhoc/dmz01-clean.sh
@@ -24,58 +24,82 @@
# After test, cleanup with
# $ source ~/git/copper/tests/adhoc/dmz01-clean.sh
-set -x #echo on
+if [ $1 == "debug" ]; then set -x #echo on
+fi
source ~/admin-openrc.sh <<EOF
openstack
EOF
+echo "Get Congress policy 'test' ID"
+test_policy_ID=$(openstack congress policy show test | awk "/ id / { print \$4 }")
+
+echo "Delete Congress policy 'test' if it exists"
+if [ "$test_policy_ID" != "" ]; then
+ openstack congress policy delete $test_policy_ID
+ echo "Existing policy 'test' deleted"
+fi
+
+echo "Delete cirros1 instance"
instance=$(nova list | awk "/ cirros1 / { print \$2 }")
if [ "$instance" != "" ]; then nova delete $instance
fi
+echo "Delete cirros2 instance"
instance=$(nova list | awk "/ cirros2 / { print \$2 }")
if [ "$instance" != "" ]; then nova delete $instance
fi
+echo "Delete 'dmz' security group"
sg=$(neutron security-group-list | awk "/ dmz / { print \$2 }")
-
neutron security-group-delete $sg
+echo "Get 'test_router' ID"
router=$(neutron router-list | awk "/ test_router / { print \$2 }")
+echo "Get internal port ID with subnet 10.0.0.1 on 'test_router'"
test_internal_interface=$(neutron router-port-list $router | grep 10.0.0.1 | awk '{print $2}')
+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
-test_public_interface=$(neutron router-port-list $router | grep 191.168.10.2 | awk '{print $2}')
+echo "Get public port ID with subnet 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 subnet 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
+echo "Delete the router"
neutron router-delete test_router
+echo "Delete neutron port on subnet 10.0.0.1"
port=$(neutron port-list | awk "/ 10.0.0.1 / { print \$2 }")
-
if [ "$port" != "" ]; then neutron port-delete $port
fi
+echo "Delete neutron port on subnet 10.0.0.2"
port=$(neutron port-list | awk "/ 10.0.0.2 / { print \$2 }")
-
if [ "$port" != "" ]; then neutron port-delete $port
fi
+echo "Delete internal subnet"
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