summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGary Wu <gary.i.wu@huawei.com>2017-10-19 12:39:19 -0700
committerGary Wu <gary.i.wu@huawei.com>2017-10-19 12:39:19 -0700
commita867833d0943b36f431b869c630959aa23abaf0f (patch)
tree686e4bda2eb8676e668eb60415a629b2b5a56ae6
parent6b0ec7edef83ba5097a675c42779bd831523ee5f (diff)
Script to get floating IP for a server name
Change-Id: I6608c075c6c1adfa1a088f5da70619ebd773ffa5 Issue-ID: INT-278 Signed-off-by: Gary Wu <gary.i.wu@huawei.com>
-rw-r--r--test/ete/scripts/get-floating-ip.sh6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/ete/scripts/get-floating-ip.sh b/test/ete/scripts/get-floating-ip.sh
new file mode 100644
index 000000000..55854e73f
--- /dev/null
+++ b/test/ete/scripts/get-floating-ip.sh
@@ -0,0 +1,6 @@
+#!/bin/sh
+# Get floating IP assigned to a server name
+
+PORT_ID=$(openstack server show -f json $1 | python -c 'import sys, json; print json.load(sys.stdin)["wrs-if:nics"][0]["nic1"]["port_id"]')
+FLOATING_IP=$(openstack floating ip list -f json --port $PORT_ID | python -c 'import sys, json; print json.load(sys.stdin)[0]["Floating IP Address"]')
+echo $FLOATING_IP