From 62b6fe80822a34182cccad23cb62c35434a95dd9 Mon Sep 17 00:00:00 2001 From: Thierry Parmentelat Date: Wed, 10 Oct 2012 09:17:00 +0200 Subject: [PATCH] make showmacs - for now this is very patchy --- planetlab/exp-tool/Makefile | 7 +++++-- planetlab/scripts/sliver-ovs.in | 21 ++++++++++++++++++++- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/planetlab/exp-tool/Makefile b/planetlab/exp-tool/Makefile index dc5446664..71e04d3b0 100644 --- a/planetlab/exp-tool/Makefile +++ b/planetlab/exp-tool/Makefile @@ -103,7 +103,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 @@ -150,11 +151,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,$*)" diff --git a/planetlab/scripts/sliver-ovs.in b/planetlab/scripts/sliver-ovs.in index 50ecab855..1a63bf02e 100755 --- a/planetlab/scripts/sliver-ovs.in +++ b/planetlab/scripts/sliver-ovs.in @@ -353,13 +353,32 @@ function gmap_probe () { echo $! > $pid_file } +#################### +# xxx tmp for a demo +# there *must* be a better way to do that +# the thing is the slice sees several tap devices at this point, which is odd... +# for now I'm searching the tapname based on some hint - the vnet ip range +VNET=10.0.16 +function show_mac () { + ifnames=$(grep : /proc/net/dev | cut -d: -f1 | awk '{print $1;}') + tapname="" + for ifname in $ifnames; do + ifconfig $ifname | grep -q "$VNET" && tapname=$ifname + done + if [ -z "$tapname" ] ; then + echo "no-tap-found-for$VNET" + exit 1 + fi + ifconfig $tapname | grep -i hwaddr | awk '{print $5;}' +} + #################### 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 -get_local_ip get_local_links" +get_local_ip get_local_links show_mac" function main () { message="Usage: $COMMAND ... -- 2.43.0