add set-remote-endpoint action to sliver-ovs
[sliver-openvswitch.git] / planetlab / exp-tool / Makefile
index a9af02d..8049182 100644 (file)
@@ -36,7 +36,8 @@ else
 SSH_KEY_OPTION ?= -i $(SSH_KEY)
 endif
 
-SSH_OPTIONS ?= $(SSH_KEY_OPTION) -l $(SLICE) -t
+#SSH_OPTIONS ?= $(SSH_KEY_OPTION) -l $(SLICE) -t
+SSH_OPTIONS ?= $(SSH_KEY_OPTION) -l $(SLICE)
 SSH = ssh $(SSH_OPTIONS)
 
 SUDO ?= sudo -S
@@ -63,7 +64,9 @@ showslice: ++SLICE FORCE
 
 shownodes:
        @$(foreach id,$(ALL_NODE_IDS),echo $(id)=$(call display,$(id));)
-.PHONY: shownodes
+showips:
+       @$(foreach id,$(ALL_NODE_IDS),echo $(id)=$(call display,$(id)) has ip/network set to $(IP_$(id));)
+.PHONY: shownodes showips
 
 sshchecks: $(foreach id,$(ALL_NODE_IDS),cache/sshcheck.$(id))
 .PHONY: sshchecks
@@ -108,7 +111,7 @@ cache/switch.%: cache/db.%
 
 cache/bridge.%: cache/switch.%
        @echo "Creating bridge on $(call display,$*) - logs in $@.log"
-       @$(SSH) $(HOST_$*) $(SUDO) sliver-ovs create-bridge $(IP_$*) > $@.log && touch $@
+       @$(SSH) $(HOST_$*) $(SUDO) sliver-ovs create-bridge $(IP_$*) > $@ 2> $@.log || { rm $@; exit 1; }
 
 # xxx this probably needs a more thorough cleanup in cache/
 cache/stop.%: del-bridge.%
@@ -137,14 +140,14 @@ del-bridge.%: cache/db.%
 del-switch.%: del-bridge.%
        @echo "Shutting down switch on $(call display,$*)"
        @if [ -f cache/switch.$* ]; then \
-               $(SSH) $(HOST_$*) $(SUDO) ovs-appctl exit;\
+               $(SSH) $(HOST_$*) $(SUDO) sliver-ovs stop-switch
         fi
        @rm -f cache/switch.$*
 
 del-db.%:
        @echo "Shutting down db on $(call display,$*)"
        @if [ -f cache/db.$* ]; then \
-               $(SSH) $(HOST_$*) $(SUDO) ovs-appctl --target=$(VARRUN)/ovsdb-server.$$(cat cache/db.$*).ctl exit;\
+               $(SSH) $(HOST_$*) $(SUDO) sliver-ovs stop-db
         fi
        @rm -f cache/db.$*
 
@@ -190,11 +193,31 @@ cache/iface.%: cache/bridge.$$(call get,%)
 cache/link.%: cache/host.$$(call rget,$$*) cache/iface.% cache/iface.$$(call opp,$$*)
        @echo "Setting port number of link $(call proj1,$*) on $(call get,$*)"
        @$(SSH) $(HOST_$(call get,$*)) \
-               $(SUDO) ovs-vsctl set interface L$(call proj1,$*) \
-                       options:remote_ip=$$(cat cache/host.$(call rget,$*)) \
-                       options:remote_port=$$(cat cache/iface.$(call opp,$*)) \
+               $(SUDO) sliver-ovs set-remote-endpoint L$(call proj1,$*) \
+                       $$(cat cache/host.$(call rget,$*)) \
+                       $$(cat cache/iface.$(call opp,$*)) \
         && touch $@
 
+####################
+# 'virtual' targets in that there's no real file attached
+define node_shortcuts
+sshcheck.$(1): cache/sshcheck.$(1) FORCE
+db.$(1): cache/db.$(1) FORCE
+switch.$(1): cache/switch.$(1) FORCE
+start.$(1): cache/start.$(1) FORCE
+stop.$(1): cache/stop.$(1) FORCE
+status.$(1): cache/status.$(1) FORCE
+bridge.$(1): cache/bridge.$(1) FORCE
+# switch already depends on db, but well
+cache/start.$(1): cache/db.$(1) cache/switch.$(1) FORCE
+endef
+
+$(foreach id,$(ALL_NODE_IDS), $(eval $(call node_shortcuts,$(id))))
+
+#define link_shortcuts
+#
+#endef
+
 #################### convenience, for debugging only
 # make +foo : prints the value of $(foo)
 # make ++foo : idem but verbose, i.e. foo=$(foo)