X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=planetlab%2Fexp-tool%2FMakefile;h=e13374f665131df381e933a3643cf1594ea832d2;hb=d1673b006d53fdea72c0744e835362ed1917f879;hp=dc5446664efaf23c77c1eb8d63ac4c25fcdbdd8a;hpb=e11741625af584cbc4eba13eea0a2ad1495fb4e0;p=sliver-openvswitch.git diff --git a/planetlab/exp-tool/Makefile b/planetlab/exp-tool/Makefile index dc5446664..e13374f66 100644 --- a/planetlab/exp-tool/Makefile +++ b/planetlab/exp-tool/Makefile @@ -3,6 +3,11 @@ # HOST_ and IP_ for all nodes involved, as well as # LINKS as a list of - elements +# should work with any shell, but we have only tested bash +SHELL=/bin/bash + +.DELETE_ON_ERROR: + # run make CONF=anotherconfig.mk if you need several configs CONF ?= conf.mk @@ -86,6 +91,9 @@ showslice: ++SLICE FORCE shownodes: @$(foreach id,$(ALL_NODE_IDS),echo $(id)=$(call display,$(id));) showhostnames: ++ALL_NODE_HOSTS +# xxx missing: something that outputs raw python stuff like +# SEND_IP="10.0.16.1" +# that would belong in the export to OF showips: @$(foreach id,$(ALL_NODE_IDS),echo $(id)=$(call display,$(id)) has ip/network set to $(IP_$(id));) showlinks: @@ -103,7 +111,8 @@ sshs: $(foreach id,$(ALL_NODE_IDS),ssh-$(id)) .PHONY: sshs showdpids: $(foreach id,$(ALL_NODE_IDS),showdpid-$(id)) .PHONY: showdpids - +showmacs: $(foreach id,$(ALL_NODE_IDS),showmac-$(id)) +.PHONY: showmacs showports: $(foreach id,$(ALL_NODE_IDS),showports-$(id)) .PHONY: showports @@ -138,7 +147,7 @@ del-controllers: $(foreach id,$(ALL_NODE_IDS),del-controller-$(id)) ### node-oriented targets # check ssh connectivity sshcheck-%: FORCE - @if $(SSH) $(HOST_$*) hostname &> /dev/null; then echo "ssh on" $(call display,$*) "OK" ; \ + @if $(SSH) $(HOST_$*) hostname > /dev/null 2>&1; then echo "ssh on" $(call display,$*) "OK" ; \ else echo "ssh on" $(call display,$*) "KO !!!"; fi ovsversion-%: FORCE @@ -150,11 +159,13 @@ ssh-%: FORCE showdpid-%: FORCE @echo $*_DPID=0x$$( $(SSH) $(HOST_$*) $(SUDO) ovs-vsctl get bridge $(BRIDGE) datapath_id | sed -e 's,",,g') +showmac-%: FORCE + @echo $*_MAC=\"$$( $(SSH) $(HOST_$*) $(SUDO) sliver-ovs show-mac)\" + showports-%: FORCE @$(SSH) $(HOST_$*) $(SUDO) ovs-ofctl show $(BRIDGE) \ | perl -nle '/(\d+)\(L(.*?)\Q$(SEP)\E(.*?)\):/ && \ print "PORT_".("$$2" eq "$*" ? "$$2_$$3" : "$$3_$$2")."=$$1"' - # should probably replace sshcheck cache/status.%: FORCE @echo "=== DB and SWITCH processes on $(call display,$*)" @@ -166,22 +177,24 @@ cache/host.%: cache/db.%: @echo "Starting db server on $(call display,$*) - logs in $(call log,$@)" - @$(SSH) $(HOST_$*) $(SUDO) sliver-ovs start-db &> $(call log,$@) && touch $@ + @$(SSH) $(HOST_$*) $(SUDO) sliver-ovs start-db > $(call log,$@) 2>&1 + @touch $@ cache/switch.%: | cache/db.% @echo "Starting vswitchd on $(call display,$*) - logs in $(call log,$@)" - @$(SSH) $(HOST_$*) $(SUDO) sliver-ovs start-switch &> $(call log,$@) && touch $@ + @$(SSH) $(HOST_$*) $(SUDO) sliver-ovs start-switch > $(call log,$@) 2>&1 + @touch $@ cache/bridge.%: | cache/db.% @echo "Creating bridge on $(call display,$*) - logs in $(call log,$@)" @$(SSH) $(HOST_$*) $(SUDO) \ - sliver-ovs create-bridge $(BRIDGE) $(IP_$*) $(call default,BROPTIONS,$*) &> $(call log,$@) \ - && { echo "IP_$*=$(IP_$*)"; echo "BROPTIONS_$*=$(call default,BROPTIONS,$*)"; } > $@ + sliver-ovs create-bridge $(BRIDGE) $(IP_$*) $(call default,BROPTIONS,$*) > $(call log,$@) 2>&1 + @{ echo "IP_$*=$(IP_$*)"; echo "BROPTIONS_$*=$(call default,BROPTIONS,$*)"; } > $@ cache/controller.%: cache/bridge.% @echo "Setting controller $(call default,CONTROLLER,$*) on $(call display,$*) - logs in $(call log,$@)" - @$(SSH) $(HOST_$*) $(SUDO) ovs-vsctl set-controller $(BRIDGE) $(call default,CONTROLLER,$*) &> $(call log,$@) \ - && echo "CONTROLLER_$*=$(call default,CONTROLLER,$*)" > $@ + @$(SSH) $(HOST_$*) $(SUDO) ovs-vsctl set-controller $(BRIDGE) $(call default,CONTROLLER,$*) > $(call log,$@) 2>&1 + @echo "CONTROLLER_$*=$(call default,CONTROLLER,$*)" > $@ # xxx this probably needs a more thorough cleanup in cache/ cache/stop.%: del-bridge.% @@ -215,7 +228,7 @@ U/%: del-iface.%@1 del-iface.%@2 # We invalidate the cache accordingly. del-bridge.%: | cache/db.% @echo "Deleting bridge on $(call display,$*)" - @$(SSH) $(HOST_$*) $(SUDO) sliver-ovs del-bridge $(BRIDGE); + @$(SSH) $(HOST_$*) $(SUDO) sliver-ovs del-bridge $(BRIDGE) @rm -f cache/bridge.$* \ cache/iface.$*$(SEP)*@1 cache/iface.*$(SEP)$*@2 \ cache/port.$*$(SEP)*@1 cache/port.*$(SEP)$*@2 \ @@ -293,13 +306,11 @@ remote-snapshot-links: $(addprefix cache/rsnap.links.,$(CONF_NODE_IDS)) cache/rsnap.ip.%: FORCE @$(SSH) $(HOST_$*) $(SUDO) \ - sliver-ovs get-local-ip $(BRIDGE) | sed 's/^/IP_$*=/' > $@ \ - || { rm $@; exit 1; } + sliver-ovs get-local-ip $(BRIDGE) | sed 's/^/IP_$*=/' > $@ cache/rsnap.links.%: FORCE @$(SSH) $(HOST_$*) $(SUDO) \ - sliver-ovs get-local-links $(BRIDGE) | sed -n 's/^L/LINKS += /p' > $@ \ - || { rm $@; exit 1; } + sliver-ovs get-local-links $(BRIDGE) | sed -n 's/^L/LINKS += /p' > $@ ### update sliver-ovs update: $(addprefix update-,$(CONF_NODE_IDS)) @@ -309,7 +320,7 @@ update-%: FORCE @[ -n "$(SLIVER_OVS)" ] || { echo "SLIVER_OVS not set" >&2; exit 1; } @[ -f "$(SLIVER_OVS)" ] || { echo "$(SLIVER_OVS) not found" >&2; exit 1; } @echo "Sending $(SLIVER_OVS) to $(call display,$*)" - @scp -q $(SLIVER_OVS) $(SLICE)@$(call solve,$*): + @scp $(SSH_KEY_OPTION) -q $(SLIVER_OVS) $(SLICE)@$(call solve,$*): @$(SSH) $(call solve,$*) $(SUDO) mv $(notdir $(SLIVER_OVS)) /usr/sbin/sliver-ovs .SECONDEXPANSION: @@ -349,8 +360,8 @@ del-iface.%: | cache/db.$$(call get,%) cache/iface.%: cache/bridge.$$(call get,%) | cache/db.$$(call get,%) @echo "Creating interface for link $(call linkpart,$(*F)) on $(call display,$(call get,$(*F))) - logs in $(call log,$@)" @$(SSH) $(call solve,$(call get,$(*F))) $(SUDO) sliver-ovs create-port $(BRIDGE) \ - L$(call linkpart,$(*F)) &> $(call log,$@) \ - && touch $@ + L$(call linkpart,$(*F)) > $(call log,$@) 2>&1 + @touch $@ # cache/port.-@: # Retrieves the local port of link - on @@ -363,8 +374,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) \ - sliver-ovs get-local-endpoint L$(call linkpart,$(*F)) > $@ 2> $(call log,$@) \ - || { rm $@; exit 1; } + sliver-ovs get-local-endpoint L$(call linkpart,$(*F)) > $@ 2> $(call log,$@) # linkid=$(call linkpart,%) @@ -382,8 +392,8 @@ cache/endpoint.%: cache/host.$$(call rget,%) cache/port.$$(call opp,%) cache/ifa @echo "Setting port number of link $(call linkpart,$(*F)) on $(call display,$(call get,$(*F))) - logs in $(call log,$@)" @$(SSH) $(call solve,$(call get,$(*F))) $(SUDO) sliver-ovs set-remote-endpoint L$(call linkpart,$(*F)) \ $$(cat cache/host.$(call rget,$(*F))) \ - $$(cat cache/port.$(call opp,$(*F))) 2> $(call log,$@) \ - && touch $@ + $$(cat cache/port.$(call opp,$(*F))) 2> $(call log,$@) + @touch $@ #################### CLEANTARGETS=$(addprefix del-,$(notdir $(wildcard cache/bridge.*)))