blob: 0731bb7256ce0cbd90543478085c70c9f5af09c2 [file] [log] [blame]
Ubuntuf6ce96c2013-02-07 01:45:07 +00001#!/bin/bash
2VIP_ONOS1=10.0.1.217
3VIP_ONOS2=10.0.1.176
4VIP_ONOS3=10.0.1.173
5VIP_ONOS4=10.0.1.222
6VIP_ONOS5=10.0.1.191
7VIP_ONOS6=10.0.1.158
8VIP_ONOS9=10.0.1.29
9VIP_ONOS10=10.0.1.28
10VIP_ONOS11=10.0.1.62
11
12NW_ID="a"
13# [[tap_if_nr, tag, other_end],..]
14TUNNEL=("0 1 VIP_ONOS5")
15
16start () {
17 ## Modify ##
18 ulimit -c
19 for (( i = 0; i< ${#TUNNEL[@]}; i ++)); do
20 t=`echo ${TUNNEL[$i]}`
21 ifnr=`echo $t | awk '{print $1}'`
22 tun_tag=`echo $t | awk '{print $2}'`
23 tun_end_=`echo $t | awk '{print $3}'`
24 tun_end=`eval echo '$'$tun_end_`
25 ifconfig tap${NW_ID}${ifnr}
26 echo "ifconfig tap${NW_ID}${ifnr}"
27 if [ $? -ne 0 ]; then
28 echo "creating tap${NW_ID}${ifnr}"
29 sudo tunctl
30 fi
31 echo "./capsulator -v -d -t eth0 -f ${tun_end} -vb tap${NW_ID}${ifnr}#${tun_tag}"
32 sudo ifconfig tap${NW_ID}${ifnr} 0.0.0.0 up > /dev/null 2>&1
33 sudo ./capsulator -v -d -t eth0 -f ${tun_end} -vb tap${NW_ID}${ifnr}#${tun_tag} > /dev/null 2>&1 &
34 done
35}
36
37stop () {
38 sudo pkill capsulator
39}
40
41case "$1" in
42 start | restart)
43 stop
44 start
45 ;;
46 stop)
47 stop
48 ;;
49 status)
50 nr=`pgrep capsulator | wc -l`
51 if [ $nr -gt 0 ]; then
52 echo "$nr tunnel(s) is running"
53 else
54 echo "tunnel is not running"
55 fi
56 ;;
57 *)
58 echo "Usage: $0 {start|stop|restart|status}" >&2
59 exit 1
60 ;;
61esac