blob: da946dc2e3c94ea9e87a3f50f99348e616ce1af3 [file] [log] [blame]
Chetan Gaonker4ca5cca2016-04-11 13:59:35 -07001#!/usr/bin/env bash
2bridge="$1"
3controller="$2"
4if [ x"$bridge" = "x" ]; then
Chetan Gaonkerb92e1532016-04-20 10:31:18 -07005 bridge="ovsbr0"
Chetan Gaonker4ca5cca2016-04-11 13:59:35 -07006fi
7if [ x"$controller" = "x" ]; then
A R Karthick2b93d6a2016-09-06 15:19:09 -07008 controller="$ONOS_CONTROLLER_IP"
Chetan Gaonker4ca5cca2016-04-11 13:59:35 -07009fi
A R Karthickb7e80902016-05-17 09:38:31 -070010pkill -9 ofdatapath
11pkill -9 ofprotocol
A R Karthicka013a272016-08-16 16:40:19 -070012service openvswitch-switch restart
A.R Karthick88e80b92016-12-05 20:23:45 -080013bridges=()
14num_bridges=1
15if [[ $bridge =~ ^[0-9]+$ ]]; then
16 num_bridges=$bridge
17 if [ $num_bridges -eq 0 ]; then
18 num_bridges=1
19 fi
20 for num in $(seq $num_bridges); do
21 if [ $num -eq 1 ]; then
22 br=br-int
23 else
24 br=br-int$num
25 fi
26 n=$(($num-1))
27 bridges[$n]=$br
28 done
29else
30 bridges[0]=$bridge
31fi
32
A R Karthick2b93d6a2016-09-06 15:19:09 -070033ctlr=""
34for ip in `echo $controller | tr ',' '\n'`; do
35 ctlr="$ctlr tcp:$ip:6653"
36done
A.R Karthick88e80b92016-12-05 20:23:45 -080037
38#Delete existing bridges if any
39for br in "${bridges[@]}"; do
40 ovs-vsctl del-br $br
41done
42
43for br in "${bridges[@]}"; do
44 echo "Configuring OVS bridge:$br"
45 ovs-vsctl add-br $br
46 ovs-vsctl set-controller $br $ctlr
47 ovs-vsctl set controller $br max_backoff=1000
48 ovs-vsctl set bridge $br protocols=OpenFlow10,OpenFlow11,OpenFlow12,OpenFlow13
49done
50
51for br in "${bridges[@]}"; do
52 ovs-vsctl show
53 ovs-ofctl show $br
54done