FORGE: Added including script
[myslice.git] / forge / script / PlcApi / getSites.py
diff --git a/forge/script/PlcApi/getSites.py b/forge/script/PlcApi/getSites.py
new file mode 100755 (executable)
index 0000000..43fc4be
--- /dev/null
@@ -0,0 +1,27 @@
+#!/usr/bin/python
+import xmlrpclib
+import getpass
+import Auth
+
+plc_host='www.planet-lab.eu'
+
+api_url="https://%s:443/PLCAPI/"%plc_host
+plc_api= xmlrpclib.ServerProxy(api_url, allow_none=True)
+
+siteId = raw_input("Give me the id of the site : ")
+try:
+       siteId = int(siteId)
+except Exception, why:
+       pass
+print type(siteId)
+sites = plc_api.GetSites(Auth.auth, [siteId], ['site_id', 'name', 'max_slices', 'slice_ids', 'node_ids', 'ext_consortium_id', 'login_base'])
+
+i = j = 0
+for site in sites:
+       if i <= 5:
+               print site
+               i+=1
+       else:
+               j+=1
+
+print "i = ",i," j = ",j