move remote-snapshot recipes to sliver-ovs
[sliver-openvswitch.git] / planetlab / exp-tool / Makefile
index 0d555a4..2f251df 100644 (file)
@@ -101,6 +101,8 @@ ovsversions: $(foreach id,$(ALL_NODE_IDS),ovsversion-$(id))
 # more general form; run with  make sshs SSH-COMMAND="bla bla bla"
 sshs: $(foreach id,$(ALL_NODE_IDS),ssh-$(id))
 .PHONY: sshs
+showdpids: $(foreach id,$(ALL_NODE_IDS),showdpid-$(id))
+.PHONY: showdpids
 
 DBS=$(foreach id,$(ALL_NODE_IDS),cache/db.$(id))
 dbs: $(DBS)
@@ -142,6 +144,9 @@ ovsversion-%: FORCE
 ssh-%: FORCE
        @$(SSH) $(HOST_$*) $(SUDO) $(SSH-COMMAND)
 
+showdpid-%: FORCE
+       @echo $*_DPID=0x$$( $(SSH) $(HOST_$*) $(SUDO) ovs-vsctl get bridge $(BRIDGE) datapath_id | sed -e 's,",,g')
+
 # should probably replace sshcheck
 cache/status.%: FORCE
        @echo "=== DB and SWITCH processes on $(call display,$*)"
@@ -197,8 +202,9 @@ U/%: del-iface.%@1 del-iface.%@2
 # Deleting a bridge also deletes all interfaces of the bridge
 # as a side effect. This in turn invalidates local tunnel
 # port numbers and endpoint info on both sides of each affected tunnel.
-# The corresponding links obviously go down. We invalidate the
-# cache accordingly.
+# The corresponding links obviously go down. 
+# Controller information is also lost.
+# We invalidate the cache accordingly.
 del-bridge.%: | cache/db.%
        @echo "Deleting bridge on $(call display,$*)"
        @$(SSH) $(HOST_$*) $(SUDO) sliver-ovs del-bridge $(BRIDGE);
@@ -206,7 +212,8 @@ del-bridge.%: | cache/db.%
              cache/iface.$*$(SEP)*@1 cache/iface.*$(SEP)$*@2 \
              cache/port.$*$(SEP)*@1  cache/port.*$(SEP)$*@2  \
              cache/endpoint.$*$(SEP)*@?  cache/endpoint.*$(SEP)$*@?  \
-             L/$*$(SEP)*             L/*$(SEP)$*
+             L/$*$(SEP)*             L/*$(SEP)$* \
+             cache/controller.$*
 
 # del-switch.<node_id>: Stops the switch daemon on <node_id>.
 #
@@ -214,6 +221,7 @@ del-bridge.%: | cache/db.%
 # are no longer valid (they will change when the daemon is restarted)
 # and, therefore, the endpoint info on the remote side of
 # the tunnels must be invalidated. The links also go down.
+# Controller information is also lost.
 # We invalidate the cache accordingly.
 del-switch.%:
        @echo "Shutting down switch on $(call display,$*)"
@@ -221,7 +229,8 @@ del-switch.%:
        @rm -f cache/switch.$* \
               cache/port.$*$(SEP)*@1  cache/port.*$(SEP)$*@2  \
               cache/endpoint.$*$(SEP)*@2  cache/endpoint.*$(SEP)$*@1  \
-              L/$*$(SEP)*            L/*$(SEP)$*
+              L/$*$(SEP)*            L/*$(SEP)$* \
+              cache/controller.$*
 
 # del-db.<node_id>: Stops the db daemon on <node_id>.
 #
@@ -265,6 +274,19 @@ remote-snapshot-ips: $(addprefix cache/rsnap.ip.,$(CONF_NODE_IDS))
 remote-snapshot-links: $(addprefix cache/rsnap.links.,$(CONF_NODE_IDS))
        @sort -u /dev/null $^
 
+.PHONY: remote-snapshot remote-snapshot-ips remote-snapshot-links
+
+
+cache/rsnap.ip.%: FORCE
+       @$(SSH) $(HOST_$*) $(SUDO) \
+               sliver-ovs get-local-ip $(BRIDGE) | sed 's/^/IP_$*=/' > $@ \
+        || { rm $@; exit 1; }
+
+cache/rsnap.links.%: FORCE
+       @$(SSH) $(HOST_$*) $(SUDO) \
+               sliver-ovs get-local-links $(BRIDGE) | sed -n 's/^L/LINKS += /p' > $@ \
+        || { rm $@; exit 1; }
+
 ### update sliver-ovs
 update: $(addprefix update-,$(CONF_NODE_IDS))
        @true
@@ -276,19 +298,6 @@ update-%: FORCE
        @scp -q $(SLIVER_OVS) $(SLICE)@$(call solve,$*):
        @$(SSH) $(call solve,$*) $(SUDO) mv $(notdir $(SLIVER_OVS)) /usr/sbin/sliver-ovs
 
-.PHONY: remote-snapshot remote-snapshot-ips remote-snapshot-links
-
-cache/rsnap.ip.%: 
-       @$(SSH) $(HOST_$*) $(SUDO) ovs-vsctl -- \
-               get interface $(BRIDGE) options:local_ip options:local_netmask |\
-               sed -n 's|"||g;1h;2{G;s|\(.*\)\n\(.*\)|IP_$* = \2/\1|p}' > $@ || \
-        { rm $@; exit 1; }
-
-cache/rsnap.links.%: 
-       @$(SSH) $(HOST_$*) $(SUDO) ovs-vsctl list-ifaces $(BRIDGE) | \
-        sed -n 's/^L/LINKS += /p' > $@ || \
-        { rm $@; exit 1; }
-
 .SECONDEXPANSION:
 
 # del-iface.<node_id>-<node_id>@<endpoint>:
@@ -340,7 +349,7 @@ cache/iface.%: cache/bridge.$$(call get,%) | cache/db.$$(call get,%)
 cache/port.%: cache/iface.% cache/switch.$$(call get,%)
        @echo "Getting port number for link $(call linkpart,$(*F)) on $(call display,$(call get,$(*F))) - logs in $(call log,$@)"
        @$(SSH) $(call solve,$(call get,$(*F))) $(SUDO) \
-               ovs-appctl netdev-tunnel/get-port L$(call linkpart,$(*F)) > $@ 2> $(call log,$@) \
+               sliver-ovs get-local-endpoint L$(call linkpart,$(*F)) > $@ 2> $(call log,$@) \
         || { rm $@; exit 1; }
 
 
@@ -404,6 +413,7 @@ stop.$(1): cache/stop.$(1) FORCE
 status.$(1): cache/status.$(1) FORCE
 bridge.$(1): cache/bridge.$(1) FORCE
 host.$(1): cache/host.$(1) FORCE
+controller.$(1): cache/controller.$(1) FORCE
 # switch already depends on db, but well
 cache/start.$(1): cache/db.$(1) cache/switch.$(1) FORCE
 endef