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 |
| 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 | c3d8800 | 2016-09-01 00:26:39 +0000 | [diff] [blame] | 38 | |
| 39 | echo "Deleting networks" |
| 40 | # Delete all networks beginning with mysite_ |
| 41 | NETS=$( neutron net-list --all-tenants|grep mysite|awk '{print $2}' ) |
| 42 | for NET in $NETS |
| 43 | do |
| 44 | neutron net-delete $NET |
| 45 | done |
| 46 | |
| 47 | neutron net-delete lan_network || true |
| 48 | neutron net-delete subscriber_network || true |
| 49 | neutron net-delete public_network || true |
| 50 | neutron net-delete hpc_client_network || true |
| 51 | neutron net-delete ceilometer_network || true |
| 52 | neutron net-delete management || true |
| 53 | neutron net-delete mysite_vsg-access || true |
| 54 | neutron net-delete exampleservice-public || true |