blob: f931eca0bdbde353d244a11912ff84df47689591 [file] [log] [blame]
Jon Hall685359e2015-08-28 11:11:47 -07001#!/bin/bash
Jon Hall6e709752016-02-01 13:38:46 -08002# -----------------------------------------------------------------------------
Jon Hall3a440102015-07-06 14:47:26 -07003# This script will kill any TestON, ssh, and Mininet sessions that are running.
Jon Hall6e709752016-02-01 13:38:46 -08004# -----------------------------------------------------------------------------
5
6# TODO: Add help to this file, and some more options?
7# Maybe kill/uninstall ONOS?
Jon Hall3a440102015-07-06 14:47:26 -07008sudo kill -9 `ps -ef | grep "./cli.py" | grep -v grep | awk '{print $2}'`
Jon Hallf632d202015-07-30 15:45:11 -07009sudo kill -9 `ps -ef | grep "bin/teston" | grep -v grep | awk '{print $2}'`
Jon Hall3a440102015-07-06 14:47:26 -070010sudo kill -9 `ps -ef | grep "ssh -X" | grep -v grep | awk '{print $2}'`
11sudo mn -c
Jon Hall685359e2015-08-28 11:11:47 -070012sudo pkill -f mn.pid
pingping-lin90dfe2f2015-09-28 10:57:42 -070013sudo pkill bgpd
14sudo pkill zebra
pingping-lin5f964c62015-12-16 11:35:08 -080015sudo pkill vrrpd
pingping-lin90dfe2f2015-09-28 10:57:42 -070016sudo kill -9 `ps -ef | grep "bird" | grep -v grep | awk '{print $2}'`
Jon Hall6e709752016-02-01 13:38:46 -080017
18
19# Restore persistent firewall rules
20if [ "$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
33fi