FORGE: Added including script
[myslice.git] / forge / script / PlcApi / deleteSlice.py
diff --git a/forge/script/PlcApi/deleteSlice.py b/forge/script/PlcApi/deleteSlice.py
new file mode 100755 (executable)
index 0000000..b54665a
--- /dev/null
@@ -0,0 +1,22 @@
+#!/usr/bin/python
+
+import xmlrpclib
+import Auth
+import sys
+
+plc_host='www.planet-lab.eu'
+slice_pref='upmc_'
+
+api_url='https://%s:443/PLCAPI/'%plc_host
+plc_api=xmlrpclib.ServerProxy(api_url, allow_none=True)
+
+slice_name = slice_pref+raw_input('Give the name of the slice : ')
+
+try:
+       returnCode = plc_api.DeleteSlice(Auth.auth, slice_name)
+except Exception, why:
+       print "An error occured while trying to delete the slice "+slice_name
+       print why
+       sys.exit(2)
+if returnCode != 1:
+       print "An error occured while trying to delete the slice "+slice_name