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 |
| 37 | #cleanup_network lan_rru_network |
| 38 | #cleanup_network lan_3gpp_s5s8_pgw_network |
| 39 | #cleanup_network lan_3gpp_s1u_network |
| 40 | #cleanup_network lan_3gpp_s1mme_network |
Pingping Lin | 26e696e | 2016-11-09 16:09:59 -0800 | [diff] [blame] | 41 | cleanup_network lan_taas_test_network1 |
| 42 | cleanup_network lan_taas_public_network |
Pingping Lin | c3d8800 | 2016-09-01 00:26:39 +0000 | [diff] [blame] | 43 | |
| 44 | echo "Deleting networks" |
| 45 | # Delete all networks beginning with mysite_ |
| 46 | NETS=$( neutron net-list --all-tenants|grep mysite|awk '{print $2}' ) |
| 47 | for NET in $NETS |
| 48 | do |
| 49 | neutron net-delete $NET |
| 50 | done |
| 51 | |
| 52 | neutron net-delete lan_network || true |
| 53 | neutron net-delete subscriber_network || true |
| 54 | neutron net-delete public_network || true |
| 55 | neutron net-delete hpc_client_network || true |
| 56 | neutron net-delete ceilometer_network || true |
Gabe Black | 8746a93 | 2016-10-28 19:36:15 +0000 | [diff] [blame] | 57 | neutron net-delete management || true |
Pingping Lin | 6fcfbe0 | 2017-01-24 02:31:47 +0000 | [diff] [blame] | 58 | neutron net-delete management_host || true |
| 59 | neutron net-delete shared_network || true |
Pingping Lin | f90e2c3 | 2017-01-29 00:16:34 +0000 | [diff] [blame] | 60 | neutron net-delete vsg_network || true |
Pingping Lin | c3d8800 | 2016-09-01 00:26:39 +0000 | [diff] [blame] | 61 | neutron net-delete mysite_vsg-access || true |
| 62 | neutron net-delete exampleservice-public || true |
Pingping Lin | 26e696e | 2016-11-09 16:09:59 -0800 | [diff] [blame] | 63 | neutron net-delete lan_taas_test_network1 || true |
| 64 | neutron net-delete lan_taas_public_network || true |