From c7e5161da9b470f6ee80b1d1956ad9e2ad72cc05 Mon Sep 17 00:00:00 2001 From: Giuseppe Lettieri Date: Fri, 5 Oct 2012 12:49:19 +0200 Subject: [PATCH] arbitary options to create-bridge One can put additional options for bridge creation on node x in BROPTIONS_x (defaults to BROPTIONS if not set). By setting BROPTIONS=set-controller $(BRIDGE) tcp:... we can create bridges that start already connected to a controller. --- planetlab/exp-tool/Makefile | 3 ++- planetlab/scripts/sliver-ovs.in | 8 +++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/planetlab/exp-tool/Makefile b/planetlab/exp-tool/Makefile index d58e9f18f..bda2b091f 100644 --- a/planetlab/exp-tool/Makefile +++ b/planetlab/exp-tool/Makefile @@ -161,7 +161,8 @@ cache/switch.%: | cache/db.% cache/bridge.%: | cache/db.% @echo "Creating bridge on $(call display,$*) - logs in $(call log,$@)" - @$(SSH) $(HOST_$*) $(SUDO) sliver-ovs create-bridge $(BRIDGE) $(IP_$*) &> $(call log,$@) \ + @$(SSH) $(HOST_$*) $(SUDO) \ + sliver-ovs create-bridge $(BRIDGE) $(IP_$*) $(call default,BROPTIONS,$*) &> $(call log,$@) \ && touch $@ cache/controller.%: cache/bridge.% diff --git a/planetlab/scripts/sliver-ovs.in b/planetlab/scripts/sliver-ovs.in index 0bf2fc337..804ec16fb 100755 --- a/planetlab/scripts/sliver-ovs.in +++ b/planetlab/scripts/sliver-ovs.in @@ -29,7 +29,7 @@ function error { function get_params { params=$1; shift err_msg="$COMMAND $SUBCOMMAND $(echo $params | perl -pe 's/\S+/<$&>/g')" - for p in $(echo $params); do + for p in $params; do [[ -z "$@" ]] && error "$err_msg" pname=$(echo -n $p|perl -pe 's/\W/_/g') eval $pname="$1"; shift @@ -157,7 +157,8 @@ function stop () { #################### create functions function create_bridge () { - get_params "bridge IP/PREFIX" "$@" + get_params "bridge IP/PREFIX" "$1" "$2" + shift; shift; IP=${IP_PREFIX%/*} PREFIX=${IP_PREFIX#*/} @@ -174,7 +175,8 @@ function create_bridge () { set -e ovs-vsctl --db=unix:$DB_SOCKET $W -- --may-exist add-br "$bridge" \ -- set bridge "$bridge" datapath_type=planetlab \ - -- set interface "$bridge" options:local_ip="$IP" option:local_netmask="$PREFIX" + -- set interface "$bridge" options:local_ip="$IP" option:local_netmask="$PREFIX" \ + -- "$@" } function create_port () { -- 2.43.0