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