blob: 1375fb5e0de1dde5f841602e1d7db2d416b2e32a [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
10service openvswitch-switch restart
11num_ports=200
12ports=$(($num_ports-1))
13for vports in $(seq 0 2 $ports); do
14 echo "Deleting veth$vports"
15 ip link del veth$vports
16done
17for vports in $(seq 0 2 $ports); do
18 ip link add type veth
19 ifconfig veth$vports up
20 ifconfig veth$(($vports+1)) up
21done
22echo "Configuring ovs bridge $bridge"
23ovs-vsctl del-br $bridge
24ovs-vsctl add-br $bridge
Chetan Gaonkerb92e1532016-04-20 10:31:18 -070025#ovs-vsctl set bridge $bridge other-config:hwaddr=00:11:22:33:44:55
Chetan Gaonker93e302d2016-04-05 10:51:07 -070026for i in $(seq 1 2 $ports); do
27 ovs-vsctl add-port $bridge veth$i
28done
29my_ip=`ifconfig eth0 | grep "inet addr" | tr -s ' ' | cut -d":" -f2 |cut -d" " -f1`
30ovs-vsctl set-controller $bridge ptcp:6653:$my_ip tcp:$controller:6633
31ovs-vsctl set controller $bridge max_backoff=1000
32ovs-vsctl set bridge $bridge protocols=OpenFlow10,OpenFlow11,OpenFlow12,OpenFlow13
33ovs-vsctl show
34ovs-ofctl show $bridge