arbitary options to create-bridge
authorGiuseppe Lettieri <g.lettieri@iet.unipi.it>
Fri, 5 Oct 2012 10:49:19 +0000 (12:49 +0200)
committerGiuseppe Lettieri <g.lettieri@iet.unipi.it>
Fri, 5 Oct 2012 11:33:56 +0000 (13:33 +0200)
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
planetlab/scripts/sliver-ovs.in

index d58e9f1..bda2b09 100644 (file)
@@ -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.%
index 0bf2fc3..804ec16 100755 (executable)
@@ -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 () {