hope I got the merge wright...
[monitor.git] / tools / testapi.py
diff --git a/tools/testapi.py b/tools/testapi.py
new file mode 100755 (executable)
index 0000000..530677f
--- /dev/null
@@ -0,0 +1,20 @@
+#!/usr/bin/python
+
+import sys
+import traceback
+
+from monitor.wrapper import plc
+
+api = plc.getAuthAPI()
+
+try:
+       # Just try the first site returned by the call
+       site = api.GetSites()[0]
+       site_nodes = api.GetNodes(site['node_ids'])
+       site_people = api.GetPersons(site['person_ids'])
+       for node in site_nodes:
+               network = api.GetInterfaces(node['interface_ids'])
+       print "ok"
+except:
+       sys.stderr.write(traceback.format_exc())
+       print "fail"