From 81391595dca425ae58e2294898f09f11d9a32dbc Mon Sep 17 00:00:00 2001 From: Ashlee Young Date: Tue, 22 Sep 2015 12:49:09 -0700 Subject: bringing src to commit tag 65d551b50e782b0c1ea76c1a9ed1c5a801a5a7e4 Change-Id: Ib2da78962eaef856f418636c31b0f5c84286244f --- .../test/scenarios/bin/find-topo-infrastructure.py | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100755 framework/src/onos/tools/test/scenarios/bin/find-topo-infrastructure.py (limited to 'framework/src/onos/tools/test/scenarios/bin/find-topo-infrastructure.py') diff --git a/framework/src/onos/tools/test/scenarios/bin/find-topo-infrastructure.py b/framework/src/onos/tools/test/scenarios/bin/find-topo-infrastructure.py new file mode 100755 index 00000000..6d1970f7 --- /dev/null +++ b/framework/src/onos/tools/test/scenarios/bin/find-topo-infrastructure.py @@ -0,0 +1,34 @@ +#! /usr/bin/env python + +import requests +import sys +import urllib + +from requests.auth import HTTPBasicAuth + +if len(sys.argv) != 4: + print "usage: find-topo-infrastructure onos-node name connect-point" + sys.exit(1) + +node = sys.argv[1] +name = sys.argv[2] +id = sys.argv[3] + +infrastructureRequest = requests.get('http://' + node + ':8181/onos/v1/topology/infrastructure/' + + urllib.quote_plus(id), + auth=HTTPBasicAuth('onos', 'rocks')) + +if infrastructureRequest.status_code != 200: + print infrastructureRequest.text + sys.exit(1) + +infrastructureJson = infrastructureRequest.json() + +print "@stc " + name + "Infrastructure=" + str(infrastructureJson["infrastructure"]) + +sys.exit(0) + + + + + -- cgit 1.2.3-korg