Merge from trunk
[plcapi.git] / trunk / PLC / Methods / GetSliceInstantiations.py
diff --git a/trunk/PLC/Methods/GetSliceInstantiations.py b/trunk/PLC/Methods/GetSliceInstantiations.py
new file mode 100644 (file)
index 0000000..174c209
--- /dev/null
@@ -0,0 +1,21 @@
+from PLC.Faults import *
+from PLC.Method import Method
+from PLC.Parameter import Parameter, Mixed
+from PLC.SliceInstantiations import SliceInstantiation, SliceInstantiations
+from PLC.Auth import Auth
+
+class GetSliceInstantiations(Method):
+    """
+    Returns an array of all valid slice instantiation states.
+    """
+
+    roles = ['admin', 'pi', 'user', 'tech', 'node']
+
+    accepts = [
+        Auth()
+        ]
+
+    returns = [SliceInstantiation.fields['instantiation']]
+
+    def call(self, auth):
+        return [slice_instantiation['instantiation'] for slice_instantiation in SliceInstantiations(self.api)]