added del-controllers target
authorGiuseppe Lettieri <g.lettieri@iet.unipi.it>
Wed, 3 Oct 2012 09:47:09 +0000 (11:47 +0200)
committerGiuseppe Lettieri <g.lettieri@iet.unipi.it>
Wed, 3 Oct 2012 09:47:09 +0000 (11:47 +0200)
planetlab/exp-tool/Makefile
planetlab/scripts/sliver-ovs.in

index 2997c4a..bf66afb 100644 (file)
@@ -118,6 +118,9 @@ CONTROLLERS=$(foreach id,$(ALL_NODE_IDS),cache/controller.$(id))
 controllers: $(CONTROLLERS)
 .PHONY: controllers
 
+del-controllers: $(foreach id,$(ALL_NODE_IDS),del-controller-$(id))
+.PHONY: del-controllers
+
 ### node-oriented targets
 # check ssh connectivity
 cache/sshcheck.%: FORCE
@@ -183,6 +186,11 @@ del-db.%:
        @$(SSH) $(HOST_$*) $(SUDO) sliver-ovs stop-db
        @rm -f cache/db.$*
 
+del-controller.%:
+       @echo "Removing controller for $(call display,$*)"
+       @$(SSH) $(HOST_$*) $(SUDO) sliver-ovs del-controller $(BRIDGE)
+       @rm -f cache/controller.$*
+
 del-links: $(addprefix U/,$(notdir $(filter-out %.log,$(wildcard L/*))))
 
 del-switchs: $(addprefix del-,$(notdir $(filter-out %.log,$(wildcard cache/switch.*))))
index 9b74950..187fb04 100755 (executable)
@@ -208,6 +208,17 @@ function set_controller () {
     ovs-vsctl --db=unix:$DB_SOCKET set-controller "$bridge_name" "$controller"
 }
 
+function del_controller () {
+
+    get_params "bridge_name" "$@"
+
+    # ensure ovs-vswitchd is running
+    is_switch_running || { echo "ovs-vswitchd not running" >&2 ; exit 1 ; }
+
+    set -e
+    ovs-vsctl --db=unix:$DB_SOCKET del-controller "$bridge_name"
+}
+
 #################### del functions
 function del_bridge () {
     
@@ -252,7 +263,7 @@ function show () {
 SUPPORTED_SUBCOMMANDS="start stop status 
 start_db stop_db start_switch stop_switch
 create_bridge create_port del_bridge del_port
-show set_remote_endpoint"
+show set_remote_endpoint set_controller del_controller"
 
 function main () {
        message="Usage: $COMMAND <subcommand> ...