David K. Bainbridge | f307101 | 2016-08-04 09:29:55 -0700 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | J=$(which juju) |
| 4 | |
| 5 | if [ ! -z $J ]; then |
| 6 | juju remove-machine --force 12 |
| 7 | juju remove-machine --force 11 |
| 8 | juju remove-machine --force 10 |
| 9 | |
| 10 | RETRY=30 |
| 11 | while [ $RETRY -gt 0 -a $(juju status --format=tabular | grep "^10\|^11\|^12" | wc -l) -ne 0 ]; do |
| 12 | echo -n "." |
| 13 | RETRY=$(expr $RETRY - 1) |
| 14 | sleep 2 |
| 15 | done |
| 16 | echo |
| 17 | fi |
| 18 | |
| 19 | UVT=$(which uvt-kvm) |
| 20 | test -z $UVT || uvt-kvm list | xargs uvt-kvm destroy |
| 21 | |
David K. Bainbridge | 8b17904 | 2016-11-30 15:38:42 -0800 | [diff] [blame] | 22 | LXC=$(which lxc) |
| 23 | test -z $LXC || lxc delete --force $(lxc list | grep "^| [^ ]" | awk '{print $2}') |
| 24 | |
David K. Bainbridge | 7ae4f19 | 2016-09-29 09:01:38 -0700 | [diff] [blame] | 25 | sudo apt-get remove --purge -y $(dpkg --get-selections | grep "nagioas\|juju\|nova\|neutron" | awk '{print $1}') &&sudo apt-get autoremove -y && sudo rm -rf /etc/juju /etc/neutron /home/ubuntu/.juju && sudo find / -name "*juju*" -exec rm -r \{\} \; && sudo rm -f /var/lib/uvtool/libvirt/images/* |
David K. Bainbridge | f307101 | 2016-08-04 09:29:55 -0700 | [diff] [blame] | 26 | |
David K. Bainbridge | 0a7cdbb | 2017-07-14 11:36:13 -0700 | [diff] [blame] | 27 | sudo rm -rf \ |
| 28 | /opt/cord* \ |
| 29 | /opt/onos_* \ |
| 30 | /opt/credentials \ |
| 31 | /opt/images |
| 32 | |
David K. Bainbridge | f307101 | 2016-08-04 09:29:55 -0700 | [diff] [blame] | 33 | OVS=$(which ovs-vsctl) |
| 34 | |
| 35 | if [ ! -z $OVS ]; then |
| 36 | sudo ovs-vsctl del-br br-int |
| 37 | fi |
| 38 | |
| 39 | sudo ifdown fabric |
| 40 | sleep 3 |
| 41 | sudo ifup eth0 |
| 42 | sleep 3 |
| 43 | |
| 44 | IP=$(ifconfig fabric | grep "inet addr" | awk '{print $2}' | cut -d: -f2) |
| 45 | |
| 46 | case $(echo "$IP" | cut -d. -f3) in |
| 47 | 1) |
| 48 | TO=$(echo "$IP" | awk -F. '{printf("%s.%s.2.0/24", $1, $2)}') |
| 49 | GW=$(echo "$IP" | awk -F. '{printf("%s.%s.%s.254", $1, $2, $3)}') |
| 50 | ;; |
| 51 | 2) |
| 52 | TO=$(echo "$IP" | awk -F. '{printf("%s.%s.1.0/24", $1, $2)}') |
| 53 | GW=$(echo "$IP" | awk -F. '{printf("%s.%s.%s.254", $1, $2, $3)}') |
| 54 | ;; |
| 55 | esac |
| 56 | |
| 57 | sudo route add -net $TO gw $GW |