blob: 0cac7ac342166b4fa7095458f780cfec8837f0df [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: query-cluster onos-node name cluster-number"
11 sys.exit(1)
12
13node = sys.argv[1]
14name = sys.argv[2]
15cluster = sys.argv[3]
16
17topoRequest = requests.get('http://' + node + ':8181/onos/v1/topology/clusters/'
18 + cluster,
19 auth=HTTPBasicAuth('onos', 'rocks'))
20
21if topoRequest.status_code != 200:
22 print topoRequest.text
23 sys.exit(1)
24
25topoJson = topoRequest.json()
26
27print "@stc " + name + "Id=" + str(topoJson["id"])
28print "@stc " + name + "DeviceCount=" + str(topoJson["deviceCount"])
29print "@stc " + name + "LinkCount=" + str(topoJson["linkCount"])
30print "@stc " + name + "Root=" + topoJson["root"]
31
32sys.exit(0)
33
34
35
36
37