Jon Hall | 685359e | 2015-08-28 11:11:47 -0700 | [diff] [blame] | 1 | #!/bin/bash |
Jon Hall | 6e70975 | 2016-02-01 13:38:46 -0800 | [diff] [blame] | 2 | # ----------------------------------------------------------------------------- |
Jon Hall | 3a44010 | 2015-07-06 14:47:26 -0700 | [diff] [blame] | 3 | # This script will kill any TestON, ssh, and Mininet sessions that are running. |
Jon Hall | 6e70975 | 2016-02-01 13:38:46 -0800 | [diff] [blame] | 4 | # ----------------------------------------------------------------------------- |
| 5 | |
| 6 | # TODO: Add help to this file, and some more options? |
| 7 | # Maybe kill/uninstall ONOS? |
Jon Hall | 3a44010 | 2015-07-06 14:47:26 -0700 | [diff] [blame] | 8 | sudo kill -9 `ps -ef | grep "./cli.py" | grep -v grep | awk '{print $2}'` |
Jon Hall | f632d20 | 2015-07-30 15:45:11 -0700 | [diff] [blame] | 9 | sudo kill -9 `ps -ef | grep "bin/teston" | grep -v grep | awk '{print $2}'` |
Jon Hall | 3a44010 | 2015-07-06 14:47:26 -0700 | [diff] [blame] | 10 | sudo kill -9 `ps -ef | grep "ssh -X" | grep -v grep | awk '{print $2}'` |
| 11 | sudo mn -c |
Jon Hall | 685359e | 2015-08-28 11:11:47 -0700 | [diff] [blame] | 12 | sudo pkill -f mn.pid |
pingping-lin | 90dfe2f | 2015-09-28 10:57:42 -0700 | [diff] [blame] | 13 | sudo pkill bgpd |
| 14 | sudo pkill zebra |
pingping-lin | 5f964c6 | 2015-12-16 11:35:08 -0800 | [diff] [blame] | 15 | sudo pkill vrrpd |
pingping-lin | 90dfe2f | 2015-09-28 10:57:42 -0700 | [diff] [blame] | 16 | sudo kill -9 `ps -ef | grep "bird" | grep -v grep | awk '{print $2}'` |
Jon Hall | 6e70975 | 2016-02-01 13:38:46 -0800 | [diff] [blame] | 17 | |
| 18 | |
| 19 | # Restore persistent firewall rules |
| 20 | if [ "$1" = "-f" ]; then |
| 21 | |
| 22 | OCIS=( $(env | sed -ne 's:OC[0-9]\{1,\}=\(.*\):\1 :g p' | sort -k1) ) |
| 23 | if [ -z "$OCIS" ]; then |
| 24 | printf "no ONOS nodes set in your cell, Don't know where to look" >&2 && exit 0 |
| 25 | fi |
| 26 | |
| 27 | # TODO: Make the file configurable |
| 28 | for i in ${OCIS[@]}; do |
| 29 | echo "Restoring iptables rules on ${i}" |
| 30 | ssh sdn@$i "sudo iptables -F" |
| 31 | ssh sdn@$i "sudo iptables-restore < /etc/iptables/rules.v4" |
| 32 | done |
| 33 | fi |