blob: 749d02eaeb633ba7f12965a162e08ba9243cf383 [file] [log] [blame]
Chetan Gaonker93e302d2016-04-05 10:51:07 -07001#!/usr/bin/env bash
2bridge="$1"
3controller="$2"
4if [ x"$bridge" = "x" ]; then
5 bridge="br0"
6fi
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
25for i in $(seq 1 2 $ports); do
26 ovs-vsctl add-port $bridge veth$i
27done
28my_ip=`ifconfig eth0 | grep "inet addr" | tr -s ' ' | cut -d":" -f2 |cut -d" " -f1`
29ovs-vsctl set-controller $bridge ptcp:6653:$my_ip tcp:$controller:6633
30ovs-vsctl set controller $bridge max_backoff=1000
31ovs-vsctl set bridge $bridge protocols=OpenFlow10,OpenFlow11,OpenFlow12,OpenFlow13
32ovs-vsctl show
33ovs-ofctl show $bridge