blob: 18ad8907f0c097a681f0442bc7a63b7e90fea579 [file] [log] [blame]
Matteo Scandolo48d3d2d2017-08-08 13:05:27 -07001
2# Copyright 2017-present Open Networking Foundation
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16
Chetan Gaonker93e302d2016-04-05 10:51:07 -070017#!/usr/bin/env bash
18bridge="$1"
19controller="$2"
20if [ x"$bridge" = "x" ]; then
Chetan Gaonkerb92e1532016-04-20 10:31:18 -070021 bridge="ovsbr0"
Chetan Gaonker93e302d2016-04-05 10:51:07 -070022fi
23if [ x"$controller" = "x" ]; then
A R Karthick2b93d6a2016-09-06 15:19:09 -070024 controller="$ONOS_CONTROLLER_IP"
Chetan Gaonker93e302d2016-04-05 10:51:07 -070025fi
A R Karthick4b72d4b2016-06-15 11:09:17 -070026pkill -9 ofdatapath
27pkill -9 ofprotocol
Chetan Gaonker93e302d2016-04-05 10:51:07 -070028service openvswitch-switch restart
29num_ports=200
30ports=$(($num_ports-1))
31for vports in $(seq 0 2 $ports); do
32 echo "Deleting veth$vports"
A R Karthick4b72d4b2016-06-15 11:09:17 -070033 ip link del veth$vports 2>/dev/null
Chetan Gaonker93e302d2016-04-05 10:51:07 -070034done
35for vports in $(seq 0 2 $ports); do
36 ip link add type veth
37 ifconfig veth$vports up
38 ifconfig veth$(($vports+1)) up
39done
40echo "Configuring ovs bridge $bridge"
41ovs-vsctl del-br $bridge
42ovs-vsctl add-br $bridge
Chetan Gaonkerb92e1532016-04-20 10:31:18 -070043#ovs-vsctl set bridge $bridge other-config:hwaddr=00:11:22:33:44:55
Chetan Gaonker93e302d2016-04-05 10:51:07 -070044for i in $(seq 1 2 $ports); do
45 ovs-vsctl add-port $bridge veth$i
46done
A R Karthick2b93d6a2016-09-06 15:19:09 -070047ctlr=""
48for ip in `echo $controller | tr ',' '\n'`; do
49 ctlr="$ctlr tcp:$ip:6653"
50done
51ovs-vsctl set-controller $bridge $ctlr
Chetan Gaonker93e302d2016-04-05 10:51:07 -070052ovs-vsctl set controller $bridge max_backoff=1000
53ovs-vsctl set bridge $bridge protocols=OpenFlow10,OpenFlow11,OpenFlow12,OpenFlow13
54ovs-vsctl show
55ovs-ofctl show $bridge