FORGE: Added including script
[myslice.git] / forge / script / PlcApi / testRequest.py
diff --git a/forge/script/PlcApi/testRequest.py b/forge/script/PlcApi/testRequest.py
new file mode 100755 (executable)
index 0000000..584450b
--- /dev/null
@@ -0,0 +1,20 @@
+#!/usr/bin/python
+import xmlrpclib
+import Auth
+
+plc_host='www.planet-lab.eu'
+slice_pref='upmc_'
+
+slice_name=slice_pref+raw_input('Give me the name of the slice : ')
+
+api_url="https://%s:443/PLCAPI/"%plc_host
+plc_api= xmlrpclib.ServerProxy(api_url, allow_none=True)
+
+# The slice's node ids
+node_ids = plc_api.GetSlices(Auth.auth, slice_name,['node_ids'])[0]['node_ids']
+
+# Get Hostname for these nodes
+slice_nodes = plc_api.GetNodes(Auth.auth, node_ids, ['hostname', 'run_level'])
+
+for node in slice_nodes:
+       print node