From b347f2d4d4d41b2fef36eb7b9f07cd6678eca1af Mon Sep 17 00:00:00 2001 From: Giuseppe Lettieri Date: Mon, 8 Oct 2012 13:38:04 +0200 Subject: [PATCH] move remote-snapshot recipes to sliver-ovs --- planetlab/exp-tool/Makefile | 26 +++++++++++++------------- planetlab/scripts/sliver-ovs.in | 23 ++++++++++++++++++++++- 2 files changed, 35 insertions(+), 14 deletions(-) diff --git a/planetlab/exp-tool/Makefile b/planetlab/exp-tool/Makefile index eac14e234..2f251dff4 100644 --- a/planetlab/exp-tool/Makefile +++ b/planetlab/exp-tool/Makefile @@ -274,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 @@ -285,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.-@: diff --git a/planetlab/scripts/sliver-ovs.in b/planetlab/scripts/sliver-ovs.in index 2c9b062fa..50ecab855 100755 --- a/planetlab/scripts/sliver-ovs.in +++ b/planetlab/scripts/sliver-ovs.in @@ -286,6 +286,26 @@ function show () { ovs-vsctl --db=unix:$DB_SOCKET show } +function get_local_ip () { + + get_params "bridge" "$@" + + set -e + ovs-vsctl --db=unix:$DB_SOCKET br-exists "$bridge" || return + local ip=$(ovs-vsctl get interface "$bridge" options:local_ip) + local netmask=$(ovs-vsctl get interface "$bridge" options:local_netmask) + eval echo $ip/$netmask +} + +function get_local_links () { + + get_params "bridge" "$@" + + set -e + ovs-vsctl --db=unix:$DB_SOCKET br-exists "$bridge" || return + ovs-vsctl --db=unix:$DB_SOCKET list-ifaces "$bridge" +} + ### for demos - connect to an ndnmap deployment to visualize links bandwidth # this expects 3 arguments # an interface name, L- based on your ids in conf.mk @@ -338,7 +358,8 @@ SUPPORTED_SUBCOMMANDS="start stop status start_db stop_db start_switch stop_switch create_bridge create_port del_bridge del_port show get_local_endpoint set_remote_endpoint -set_controller del_controller gmap_probe" +set_controller del_controller gmap_probe +get_local_ip get_local_links" function main () { message="Usage: $COMMAND ... -- 2.43.0