blob: bb15d30a9b2845d5b53cbe1a883227f77a41efa8 [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
Gabe Black8746a932016-10-28 19:36:15 +000033cleanup_network management
Pingping Lin6fcfbe02017-01-24 02:31:47 +000034cleanup_network management_host
35cleanup_network shared_network
Pingping Linf90e2c32017-01-29 00:16:34 +000036cleanup_network vsg_network
37#cleanup_network lan_rru_network
38#cleanup_network lan_3gpp_s5s8_pgw_network
39#cleanup_network lan_3gpp_s1u_network
40#cleanup_network lan_3gpp_s1mme_network
Pingping Lin26e696e2016-11-09 16:09:59 -080041cleanup_network lan_taas_test_network1
42cleanup_network lan_taas_public_network
Pingping Linc3d88002016-09-01 00:26:39 +000043
44echo "Deleting networks"
45# Delete all networks beginning with mysite_
46NETS=$( neutron net-list --all-tenants|grep mysite|awk '{print $2}' )
47for NET in $NETS
48do
49 neutron net-delete $NET
50done
51
52neutron net-delete lan_network || true
53neutron net-delete subscriber_network || true
54neutron net-delete public_network || true
55neutron net-delete hpc_client_network || true
56neutron net-delete ceilometer_network || true
Gabe Black8746a932016-10-28 19:36:15 +000057neutron net-delete management || true
Pingping Lin6fcfbe02017-01-24 02:31:47 +000058neutron net-delete management_host || true
59neutron net-delete shared_network || true
Pingping Linf90e2c32017-01-29 00:16:34 +000060neutron net-delete vsg_network || true
Pingping Linc3d88002016-09-01 00:26:39 +000061neutron net-delete mysite_vsg-access || true
62neutron net-delete exampleservice-public || true
Pingping Lin26e696e2016-11-09 16:09:59 -080063neutron net-delete lan_taas_test_network1 || true
64neutron net-delete lan_taas_public_network || true