blob: 6e6970c2e4a18fa6d4698aa94771204885346275 [file] [log] [blame]
Scott Baker50421662016-06-27 22:09:48 -07001#!/bin/bash
2
3function 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
16source ./admin-openrc.sh
17
18echo "Deleting VMs"
19# Delete all VMs
20VMS=$( nova list --all-tenants|grep mysite|awk '{print $2}' )
21for VM in $VMS
22do
23 nova delete $VM
24done
25
26echo "Waiting 5 seconds..."
27sleep 5
28
29cleanup_network lan_network
30cleanup_network wan_network
31cleanup_network mysite_vcpe-private
32cleanup_network mysite_vsg-access
33cleanup_network management
Scott Bakerb08cd8d2016-10-12 09:56:34 -070034cleanup_network management_hosts
Scott Baker50421662016-06-27 22:09:48 -070035
36echo "Deleting networks"
37# Delete all networks beginning with mysite_
38NETS=$( neutron net-list --all-tenants|grep mysite|awk '{print $2}' )
39for NET in $NETS
40do
41 neutron net-delete $NET
42done
43
44neutron net-delete lan_network || true
45neutron net-delete subscriber_network || true
46neutron net-delete public_network || true
47neutron net-delete hpc_client_network || true
48neutron net-delete ceilometer_network || true
49neutron net-delete management || true
Scott Bakerb08cd8d2016-10-12 09:56:34 -070050neutron net-delete management_hosts || true
Scott Baker50421662016-06-27 22:09:48 -070051neutron net-delete mysite_vsg-access || true
52neutron net-delete exampleservice-public || true