blob: 29571601b3b6a5f87114ca7ad0ca180f6ab210c6 [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
8 controller=$ONOS_CONTROLLER_IP
9fi
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
31my_ip=`ifconfig eth0 | grep "inet addr" | tr -s ' ' | cut -d":" -f2 |cut -d" " -f1`
A R Karthick4682c762016-07-20 18:56:05 -070032#ovs-vsctl set-controller $bridge ptcp:6653:$my_ip tcp:$controller:6633
33ovs-vsctl set-controller $bridge tcp:$controller:6653
Chetan Gaonker93e302d2016-04-05 10:51:07 -070034ovs-vsctl set controller $bridge max_backoff=1000
35ovs-vsctl set bridge $bridge protocols=OpenFlow10,OpenFlow11,OpenFlow12,OpenFlow13
36ovs-vsctl show
37ovs-ofctl show $bridge