blob: 6d1970f78b59ad2eb3f6aed4dc0c8d5048b9a9e5 [file] [log] [blame]
Ray Milkeye0827772015-09-11 16:49:21 -07001#! /usr/bin/env python
2
3import requests
4import sys
5import urllib
6
7from requests.auth import HTTPBasicAuth
8
9if len(sys.argv) != 4:
10 print "usage: find-topo-infrastructure onos-node name connect-point"
11 sys.exit(1)
12
13node = sys.argv[1]
14name = sys.argv[2]
15id = sys.argv[3]
16
17infrastructureRequest = requests.get('http://' + node + ':8181/onos/v1/topology/infrastructure/' +
18 urllib.quote_plus(id),
19 auth=HTTPBasicAuth('onos', 'rocks'))
20
21if infrastructureRequest.status_code != 200:
22 print infrastructureRequest.text
23 sys.exit(1)
24
25infrastructureJson = infrastructureRequest.json()
26
27print "@stc " + name + "Infrastructure=" + str(infrastructureJson["infrastructure"])
28
29sys.exit(0)
30
31
32
33
34