summaryrefslogtreecommitdiffstats
path: root/tests/adhoc/smoke01-clean.sh
blob: c50d667fbc5662817292f69c7f876ecb1e7a996f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/bash
set -x #echo on

instance=$(nova list | awk "/ cirros1 / { print \$2 }")
if [ "$instance" != "" ]; then nova delete $instance
fi

instance=$(nova list | awk "/ cirros2 / { print \$2 }")
if  [ "$instance" != "" ]; then nova delete $instance
fi

router=$(neutron router-list | awk "/ external / { print \$2 }")

internal_interface=$(neutron router-port-list $router | grep 10.0.0.1 | awk '{print $2}')

if [ "$internal_interface" != "" ]; then neutron router-interface-delete $router port=$internal_interface
fi

public_interface=$(neutron router-port-list $router | grep 191.168.10.2 | awk '{print $2}')

if [ "$public_interface" != "" ]; then neutron router-interface-delete $router port=$public_interface
fi

neutron router-interface-delete $router $internal_interface

neutron router-gateway-clear external

neutron router-delete external

port=$(neutron port-list | awk "/ 10.0.0.1 / { print \$2 }")

if [ "$port" != "" ]; then neutron port-delete $port
fi

port=$(neutron port-list | awk "/ 10.0.0.2 / { print \$2 }")

if [ "$port" != "" ]; then neutron port-delete $port
fi

neutron subnet-delete internal

neutron net-delete internal

neutron subnet-delete public

neutron net-delete public

set +x #echo off