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