blob: 609756a96dbf049c23300258b21078daaf83acb6 [file] [log] [blame]
Chetan Gaonker93e302d2016-04-05 10:51:07 -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 Gaonker93e302d2016-04-05 10:51:07 -07006fi
7if [ x"$controller" = "x" ]; then
A R Karthick2b93d6a2016-09-06 15:19:09 -07008 controller="$ONOS_CONTROLLER_IP"
Chetan Gaonker93e302d2016-04-05 10:51:07 -07009fi
A R Karthick4b72d4b2016-06-15 11:09:17 -070010pkill -9 ofdatapath
11pkill -9 ofprotocol
Chetan Gaonker93e302d2016-04-05 10:51:07 -070012service openvswitch-switch restart
13num_ports=200
14ports=$(($num_ports-1))
15for vports in $(seq 0 2 $ports); do
16 echo "Deleting veth$vports"
A R Karthick4b72d4b2016-06-15 11:09:17 -070017 ip link del veth$vports 2>/dev/null
Chetan Gaonker93e302d2016-04-05 10:51:07 -070018done
19for vports in $(seq 0 2 $ports); do
20 ip link add type veth
21 ifconfig veth$vports up
22 ifconfig veth$(($vports+1)) up
23done
24echo "Configuring ovs bridge $bridge"
25ovs-vsctl del-br $bridge
26ovs-vsctl add-br $bridge
Chetan Gaonkerb92e1532016-04-20 10:31:18 -070027#ovs-vsctl set bridge $bridge other-config:hwaddr=00:11:22:33:44:55
Chetan Gaonker93e302d2016-04-05 10:51:07 -070028for i in $(seq 1 2 $ports); do
29 ovs-vsctl add-port $bridge veth$i
30done
A R Karthick2b93d6a2016-09-06 15:19:09 -070031ctlr=""
32for ip in `echo $controller | tr ',' '\n'`; do
33 ctlr="$ctlr tcp:$ip:6653"
34done
35ovs-vsctl set-controller $bridge $ctlr
Chetan Gaonker93e302d2016-04-05 10:51:07 -070036ovs-vsctl set controller $bridge max_backoff=1000
37ovs-vsctl set bridge $bridge protocols=OpenFlow10,OpenFlow11,OpenFlow12,OpenFlow13
38ovs-vsctl show
39ovs-ofctl show $bridge