diff options
author | blsaws <bryan.sullivan@att.com> | 2016-04-01 16:36:30 -0700 |
---|---|---|
committer | Bryan Sullivan <bs3131@att.com> | 2016-04-01 23:42:11 +0000 |
commit | dd476b708e1f9d7501dc6c6b6f8c02f997d36afb (patch) | |
tree | 1e9a08bb593669e04bfb8ba7a8b739a81991c133 /tests/adhoc/dmz01-clean.sh | |
parent | 62b5815004e69a2ffd63beac3cd76eacbf9c7f4e (diff) |
Merge dmz01 test into one script; add parameter check, echo statements.
JIRA: COPPER-4
Change-Id: I7c33dfe1d66bc58c57eac8214d03693273756414
Signed-off-by: blsaws <bryan.sullivan@att.com>
(cherry picked from commit 392621ce7e9a72c0972f01fbac7ea4dddd21e60d)
Diffstat (limited to 'tests/adhoc/dmz01-clean.sh')
-rw-r--r-- | tests/adhoc/dmz01-clean.sh | 34 |
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 |