Matteo Scandolo | 3896c47 | 2017-08-01 13:31:42 -0700 | [diff] [blame] | 1 | |
| 2 | # Copyright 2017-present Open Networking Foundation |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | # you may not use this file except in compliance with the License. |
| 6 | # You may obtain a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
| 15 | |
| 16 | |
Matteo Scandolo | 9e557c6 | 2017-03-15 11:03:13 -0700 | [diff] [blame] | 17 | #!/bin/bash |
| 18 | |
| 19 | function cleanup_network { |
| 20 | NETWORK=$1 |
| 21 | SUBNETS=`neutron net-show $NETWORK | grep -i subnets | awk '{print $4}'` |
| 22 | if [[ $SUBNETS != "" ]]; then |
| 23 | PORTS=`neutron port-list | grep -i $SUBNETS | awk '{print $2}'` |
| 24 | for PORT in $PORTS; do |
| 25 | echo "Deleting port $PORT" |
| 26 | neutron port-delete $PORT |
| 27 | done |
| 28 | fi |
| 29 | neutron net-delete $NETWORK |
| 30 | } |
| 31 | |
Zack Williams | a88041c | 2017-09-13 10:11:55 -0700 | [diff] [blame] | 32 | source /opt/cord_profile/admin-openrc.sh |
Matteo Scandolo | 9e557c6 | 2017-03-15 11:03:13 -0700 | [diff] [blame] | 33 | |
| 34 | echo "Deleting VMs" |
| 35 | # Delete all VMs |
| 36 | VMS=$( nova list --all-tenants|grep mysite|awk '{print $2}' ) |
| 37 | for VM in $VMS |
| 38 | do |
| 39 | nova delete $VM |
| 40 | done |
| 41 | |
| 42 | echo "Waiting 5 seconds..." |
| 43 | sleep 5 |
| 44 | |
| 45 | cleanup_network lan_network |
| 46 | cleanup_network wan_network |
| 47 | cleanup_network mysite_vcpe-private |
| 48 | cleanup_network mysite_vsg-access |
Scott Baker | d25f0e9 | 2017-10-13 14:27:37 -0700 | [diff] [blame] | 49 | cleanup_network mysite_veg-access |
Matteo Scandolo | 9e557c6 | 2017-03-15 11:03:13 -0700 | [diff] [blame] | 50 | cleanup_network management |
| 51 | cleanup_network management_hosts |
| 52 | |
| 53 | echo "Deleting networks" |
| 54 | # Delete all networks beginning with mysite_ |
| 55 | NETS=$( neutron net-list --all-tenants|grep mysite|awk '{print $2}' ) |
| 56 | for NET in $NETS |
| 57 | do |
| 58 | neutron net-delete $NET |
| 59 | done |
| 60 | |
| 61 | neutron net-delete lan_network || true |
| 62 | neutron net-delete subscriber_network || true |
| 63 | neutron net-delete public_network || true |
| 64 | neutron net-delete hpc_client_network || true |
| 65 | neutron net-delete ceilometer_network || true |
| 66 | neutron net-delete management || true |
| 67 | neutron net-delete management_hosts || true |
| 68 | neutron net-delete mysite_vsg-access || true |
Scott Baker | d25f0e9 | 2017-10-13 14:27:37 -0700 | [diff] [blame] | 69 | neutron net-delete mysite_veg-access || true |
Matteo Scandolo | 9e557c6 | 2017-03-15 11:03:13 -0700 | [diff] [blame] | 70 | neutron net-delete public || true |
| 71 | neutron net-delete exampleservice_network || true |
Andy Bavier | 0b6f111 | 2017-11-20 17:10:47 -0700 | [diff] [blame^] | 72 | neutron net-delete spgw_network || true |
| 73 | neutron net-delete s11_network || true |
| 74 | neutron net-delete s1u_network || true |
| 75 | neutron net-delete sgi_network || true |