blob: d60ead11decacffbefd6b5584beb3fd482b1c5d2 [file] [log] [blame]
Pingping Linc3d88002016-09-01 00:26:39 +00001#!/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
Pingping Lin073cdc42016-09-26 14:04:35 -070033#cleanup_network management
Pingping Lin434cf8f2016-09-23 17:03:40 +000034cleanup_network lan_rru_network
35cleanup_network lan_3gpp_s5s8_pgw_network
36cleanup_network lan_3gpp_s1u_network
37cleanup_network lan_3gpp_s1mme_network
Pingping Linc3d88002016-09-01 00:26:39 +000038
39echo "Deleting networks"
40# Delete all networks beginning with mysite_
41NETS=$( neutron net-list --all-tenants|grep mysite|awk '{print $2}' )
42for NET in $NETS
43do
44 neutron net-delete $NET
45done
46
47neutron net-delete lan_network || true
48neutron net-delete subscriber_network || true
49neutron net-delete public_network || true
50neutron net-delete hpc_client_network || true
51neutron net-delete ceilometer_network || true
Pingping Lin073cdc42016-09-26 14:04:35 -070052#neutron net-delete management || true
Pingping Linc3d88002016-09-01 00:26:39 +000053neutron net-delete mysite_vsg-access || true
54neutron net-delete exampleservice-public || true