Scott Baker | 5042166 | 2016-06-27 22:09:48 -0700 | [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 |
Scott Baker | b08cd8d | 2016-10-12 09:56:34 -0700 | [diff] [blame] | 34 | cleanup_network management_hosts |
Scott Baker | 5042166 | 2016-06-27 22:09:48 -0700 | [diff] [blame] | 35 | |
| 36 | echo "Deleting networks" |
| 37 | # Delete all networks beginning with mysite_ |
| 38 | NETS=$( neutron net-list --all-tenants|grep mysite|awk '{print $2}' ) |
| 39 | for NET in $NETS |
| 40 | do |
| 41 | neutron net-delete $NET |
| 42 | done |
| 43 | |
| 44 | neutron net-delete lan_network || true |
| 45 | neutron net-delete subscriber_network || true |
| 46 | neutron net-delete public_network || true |
| 47 | neutron net-delete hpc_client_network || true |
| 48 | neutron net-delete ceilometer_network || true |
| 49 | neutron net-delete management || true |
Scott Baker | b08cd8d | 2016-10-12 09:56:34 -0700 | [diff] [blame] | 50 | neutron net-delete management_hosts || true |
Scott Baker | 5042166 | 2016-06-27 22:09:48 -0700 | [diff] [blame] | 51 | neutron net-delete mysite_vsg-access || true |
| 52 | neutron net-delete exampleservice-public || true |