aboutsummaryrefslogtreecommitdiffstats
path: root/contrail-agent/scripts/vhost-phys.sh
diff options
context:
space:
mode:
authorStuart Mackie <wsmackie@juniper.net>2017-07-25 10:37:57 -0700
committerStuart Mackie <wsmackie@juniper.net>2017-07-25 10:37:57 -0700
commit711967ae9639095ce41500bb0e6f80c8b80fab95 (patch)
tree07f598b35664ddbd269b76f21cf587f5679cab86 /contrail-agent/scripts/vhost-phys.sh
parentefd4f1414b79dd51c6316a73893ade33bc9f668e (diff)
Contrail charms
Change-Id: I2d259d03f63fce38348b8384e26ac23e3fce44a8 Signed-off-by: Stuart Mackie <wsmackie@juniper.net>
Diffstat (limited to 'contrail-agent/scripts/vhost-phys.sh')
-rwxr-xr-xcontrail-agent/scripts/vhost-phys.sh7
1 files changed, 7 insertions, 0 deletions
diff --git a/contrail-agent/scripts/vhost-phys.sh b/contrail-agent/scripts/vhost-phys.sh
new file mode 100755
index 0000000..7177eca
--- /dev/null
+++ b/contrail-agent/scripts/vhost-phys.sh
@@ -0,0 +1,7 @@
+#!/bin/sh -e
+#
+# Script used to determine physical interface of vhost0
+
+iface="$1"
+mac=$(cat /sys/class/net/$iface/address)
+vif --list | awk -v mac=$mac -v iface=$iface 'BEGIN { RS="\n\n" }; $3 != iface && $0 ~ "HWaddr:" mac { print $3; exit 0 }'