Pingping Lin | c3d8800 | 2016-09-01 00:26:39 +0000 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | function cleanup_network { |
| 4 | NETWORK=$1 |
| 5 | SUBNETS=`neutron net-show $NETWORK | grep -i subnets | awk '{print $4}'` |
| 6 | if [[ $SUBNETS != "" ]]; then |
| 7 | PORTS=`neutron port-list | grep -i $SUBNETS | awk '{print $2}'` |
| 8 | for PORT in $PORTS; do |
| 9 | echo "Deleting port $PORT" |
| 10 | neutron port-delete $PORT |
| 11 | done |
| 12 | fi |
| 13 | neutron net-delete $NETWORK |
| 14 | } |
| 15 | |
| 16 | source ./admin-openrc.sh |
| 17 | |
| 18 | echo "Deleting VMs" |
| 19 | # Delete all VMs |
| 20 | VMS=$( nova list --all-tenants|grep mysite|awk '{print $2}' ) |
| 21 | for VM in $VMS |
| 22 | do |
| 23 | nova delete $VM |
| 24 | done |
| 25 | |
| 26 | echo "Waiting 5 seconds..." |
| 27 | sleep 5 |
| 28 | |
| 29 | cleanup_network lan_network |
| 30 | cleanup_network wan_network |
| 31 | cleanup_network mysite_vcpe-private |
| 32 | cleanup_network mysite_vsg-access |
Gabe Black | 8746a93 | 2016-10-28 19:36:15 +0000 | [diff] [blame] | 33 | cleanup_network management |
Pingping Lin | 6fcfbe0 | 2017-01-24 02:31:47 +0000 | [diff] [blame] | 34 | cleanup_network management_host |
| 35 | cleanup_network shared_network |
Pingping Lin | f90e2c3 | 2017-01-29 00:16:34 +0000 | [diff] [blame] | 36 | cleanup_network vsg_network |
Pingping Lin | 26e696e | 2016-11-09 16:09:59 -0800 | [diff] [blame] | 37 | cleanup_network lan_taas_test_network1 |
| 38 | cleanup_network lan_taas_public_network |
Pingping Lin | c3d8800 | 2016-09-01 00:26:39 +0000 | [diff] [blame] | 39 | |
| 40 | echo "Deleting networks" |
| 41 | # Delete all networks beginning with mysite_ |
| 42 | NETS=$( neutron net-list --all-tenants|grep mysite|awk '{print $2}' ) |
| 43 | for NET in $NETS |
| 44 | do |
| 45 | neutron net-delete $NET |
| 46 | done |
| 47 | |
| 48 | neutron net-delete lan_network || true |
| 49 | neutron net-delete subscriber_network || true |
| 50 | neutron net-delete public_network || true |
| 51 | neutron net-delete hpc_client_network || true |
| 52 | neutron net-delete ceilometer_network || true |
Gabe Black | 8746a93 | 2016-10-28 19:36:15 +0000 | [diff] [blame] | 53 | neutron net-delete management || true |
Pingping Lin | 6fcfbe0 | 2017-01-24 02:31:47 +0000 | [diff] [blame] | 54 | neutron net-delete management_host || true |
| 55 | neutron net-delete shared_network || true |
Pingping Lin | f90e2c3 | 2017-01-29 00:16:34 +0000 | [diff] [blame] | 56 | neutron net-delete vsg_network || true |
Pingping Lin | c3d8800 | 2016-09-01 00:26:39 +0000 | [diff] [blame] | 57 | neutron net-delete mysite_vsg-access || true |
| 58 | neutron net-delete exampleservice-public || true |
Pingping Lin | 26e696e | 2016-11-09 16:09:59 -0800 | [diff] [blame] | 59 | neutron net-delete lan_taas_test_network1 || true |
| 60 | neutron net-delete lan_taas_public_network || true |