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/verify-topo-devices.py | 51 ++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100755 framework/src/onos/tools/test/scenarios/bin/verify-topo-devices.py (limited to 'framework/src/onos/tools/test/scenarios/bin/verify-topo-devices.py') diff --git a/framework/src/onos/tools/test/scenarios/bin/verify-topo-devices.py b/framework/src/onos/tools/test/scenarios/bin/verify-topo-devices.py new file mode 100755 index 00000000..be834b9b --- /dev/null +++ b/framework/src/onos/tools/test/scenarios/bin/verify-topo-devices.py @@ -0,0 +1,51 @@ +#! /usr/bin/env python + +import requests +import sys +import urllib + +from requests.auth import HTTPBasicAuth + +if len(sys.argv) != 5: + print "usage: verify-topo-links onos-node cluster-id first-index last-index" + sys.exit(1) + +node = sys.argv[1] +cluster = sys.argv[2] +first = int(sys.argv[3]) +last = int(sys.argv[4]) + +found = 0 + +topoRequest = requests.get('http://' + node + ':8181/onos/v1/topology/clusters/' + + cluster + + "/devices", + auth=HTTPBasicAuth('onos', 'rocks')) + +if topoRequest.status_code != 200: + print topoRequest.text + sys.exit(1) + +topoJson = topoRequest.json() + +for deviceIndex in range(first, last+1): + lookingFor = "of:" + format(deviceIndex, '016x') + print lookingFor + for arrayIndex in range(0, len(topoJson["devices"])): + device = topoJson["devices"][arrayIndex] + if device == lookingFor: + found = found + 1 + print "Match found for " + device + break + + +if found == last - first: + sys.exit(0) + +print "Found " + str(found) + " matches, need " + str(last - first) +sys.exit(2) + + + + + -- cgit 1.2.3-korg