Chetan Gaonker | 93e302d | 2016-04-05 10:51:07 -0700 | [diff] [blame] | 1 | #!/usr/bin/env bash |
| 2 | bridge="$1" |
| 3 | controller="$2" |
| 4 | if [ x"$bridge" = "x" ]; then |
Chetan Gaonker | b92e153 | 2016-04-20 10:31:18 -0700 | [diff] [blame] | 5 | bridge="ovsbr0" |
Chetan Gaonker | 93e302d | 2016-04-05 10:51:07 -0700 | [diff] [blame] | 6 | fi |
| 7 | if [ x"$controller" = "x" ]; then |
| 8 | controller=$ONOS_CONTROLLER_IP |
| 9 | fi |
A R Karthick | 4b72d4b | 2016-06-15 11:09:17 -0700 | [diff] [blame] | 10 | pkill -9 ofdatapath |
| 11 | pkill -9 ofprotocol |
Chetan Gaonker | 93e302d | 2016-04-05 10:51:07 -0700 | [diff] [blame] | 12 | service openvswitch-switch restart |
| 13 | num_ports=200 |
| 14 | ports=$(($num_ports-1)) |
| 15 | for vports in $(seq 0 2 $ports); do |
| 16 | echo "Deleting veth$vports" |
A R Karthick | 4b72d4b | 2016-06-15 11:09:17 -0700 | [diff] [blame] | 17 | ip link del veth$vports 2>/dev/null |
Chetan Gaonker | 93e302d | 2016-04-05 10:51:07 -0700 | [diff] [blame] | 18 | done |
| 19 | for vports in $(seq 0 2 $ports); do |
| 20 | ip link add type veth |
| 21 | ifconfig veth$vports up |
| 22 | ifconfig veth$(($vports+1)) up |
| 23 | done |
| 24 | echo "Configuring ovs bridge $bridge" |
| 25 | ovs-vsctl del-br $bridge |
| 26 | ovs-vsctl add-br $bridge |
Chetan Gaonker | b92e153 | 2016-04-20 10:31:18 -0700 | [diff] [blame] | 27 | #ovs-vsctl set bridge $bridge other-config:hwaddr=00:11:22:33:44:55 |
Chetan Gaonker | 93e302d | 2016-04-05 10:51:07 -0700 | [diff] [blame] | 28 | for i in $(seq 1 2 $ports); do |
| 29 | ovs-vsctl add-port $bridge veth$i |
| 30 | done |
| 31 | my_ip=`ifconfig eth0 | grep "inet addr" | tr -s ' ' | cut -d":" -f2 |cut -d" " -f1` |
A R Karthick | 4682c76 | 2016-07-20 18:56:05 -0700 | [diff] [blame^] | 32 | #ovs-vsctl set-controller $bridge ptcp:6653:$my_ip tcp:$controller:6633 |
| 33 | ovs-vsctl set-controller $bridge tcp:$controller:6653 |
Chetan Gaonker | 93e302d | 2016-04-05 10:51:07 -0700 | [diff] [blame] | 34 | ovs-vsctl set controller $bridge max_backoff=1000 |
| 35 | ovs-vsctl set bridge $bridge protocols=OpenFlow10,OpenFlow11,OpenFlow12,OpenFlow13 |
| 36 | ovs-vsctl show |
| 37 | ovs-ofctl show $bridge |