methods="""
create_gid
+create_slice
+delete_slice
get_credential
get_ticket
list
register
remove
+reset_slice
resolve
resources
slices
+start_slice
+stop_slice
update
""".split()
--- /dev/null
+from geni.util.faults import *
+from geni.util.excep import *
+from geni.util.misc import *
+from geni.util.method import Method
+from geni.util.parameter import Parameter, Mixed
+from geni.util.auth import Auth
+from geni.util.slices import Slices
+
+class create_slices(Method):
+ """
+ Instantiate the specified slice according to whats defined in the specified rspec
+
+ @param cred credential string specifying the rights of the caller
+ @param hrn human readable name of slice to instantiate
+ @param rspec resource specification
+ @return 1 is successful, faults otherwise
+ """
+
+ interfaces = ['aggregate', 'slicemgr']
+
+ accepts = [
+ Parameter(str, "Credential string"),
+ Parameter(str, "Human readable name of slice to instantiate"),
+ Parameter(str, "Resource specification"),
+ ]
+
+ returns = [Parameter(int, "1 if successful")]
+
+ def call(self, cred, hrn, rspec):
+
+ self.api.auth.check(cred, 'createslice')
+ slices = Slices(self.api)
+ slices.create_slice(hrn, rspec):
+
+ return 1
--- /dev/null
+from geni.util.faults import *
+from geni.util.excep import *
+from geni.util.misc import *
+from geni.util.method import Method
+from geni.util.parameter import Parameter, Mixed
+from geni.util.auth import Auth
+from geni.aggregate import Aggregates
+from geni.util.slices import Slices
+
+class delete_slice(Method):
+ """
+ Remove the slice from all nodes.
+
+ @param cred credential string specifying the rights of the caller
+ @param hrn human readable name specifying the slice to delete
+ @return 1 if successful, faults otherwise
+ """
+
+ interfaces = ['aggregate', 'slicemgr']
+
+ accepts = [
+ Parameter(str, "Credential string"),
+ Parameter(str, "Human readable name of slice to delete"),
+ ]
+
+ returns = [Parameter(int, "1 if successful")]
+
+ def call(self, cred, hrn):
+
+ self.api.auth.check(cred, 'deleteslice')
+ slices = Slices(self.api)
+ slices.delete_slice(hrn)
+ return 1
--- /dev/null
+from geni.util.faults import *
+from geni.util.excep import *
+from geni.util.misc import *
+from geni.util.method import Method
+from geni.util.parameter import Parameter, Mixed
+from geni.util.auth import Auth
+from geni.util.slices import Slices
+
+class reset_slices(Method):
+ """
+ Reset the specified slice
+
+ @param cred credential string specifying the rights of the caller
+ @param hrn human readable name of slice to instantiate
+ @return 1 is successful, faults otherwise
+ """
+
+ interfaces = ['aggregate', 'slicemgr']
+
+ accepts = [
+ Parameter(str, "Credential string"),
+ Parameter(str, "Human readable name of slice to instantiate"),
+ ]
+
+ returns = [Parameter(int, "1 if successful")]
+
+ def call(self, cred, hrn):
+
+ self.api.auth.check(cred, 'resetslice')
+ ## XX Not yet implemented
+
+ return 1
from geni.util.method import Method
from geni.util.parameter import Parameter, Mixed
from geni.util.auth import Auth
-from geni.aggregate import Aggregates
+from geni.util.slices import Slices
class slices(Method):
"""
def call(self, cred):
self.api.auth.check(cred, 'listslices')
- slice_hrns = []
-
- if self.api.interface in ['aggregate']:
- slices = self.api.plshell.GetSlices(self.api.plauth, {}, ['name'])
- slice_hrns = [slicename_to_hrn(self.api.hrn, slice['name']) for slice in slices]
-
- else:
- aggregates = Aggregates()
- credential = self.api.getCredential()
- for aggregate in aggregates:
- slices = aggregates[aggregate].slices(credential)
- slice_hrns.extend(slices)
-
- return slice_hrns
+ slices = Slices(self.api)
+ slices.refresh()
+ return slices['hrn']
--- /dev/null
+from geni.util.faults import *
+from geni.util.excep import *
+from geni.util.misc import *
+from geni.util.method import Method
+from geni.util.parameter import Parameter, Mixed
+from geni.util.auth import Auth
+from geni.util.slices import Slices
+
+class start_slices(Method):
+ """
+ Start the specified slice
+
+ @param cred credential string specifying the rights of the caller
+ @param hrn human readable name of slice to instantiate
+ @return 1 is successful, faults otherwise
+ """
+
+ interfaces = ['aggregate', 'slicemgr']
+
+ accepts = [
+ Parameter(str, "Credential string"),
+ Parameter(str, "Human readable name of slice to instantiate"),
+ ]
+
+ returns = [Parameter(int, "1 if successful")]
+
+ def call(self, cred, hrn):
+
+ self.api.auth.check(cred, 'startslice')
+ slices = Slices(self.api)
+ slices.stop_slice(hrn):
+
+ return 1
--- /dev/null
+from geni.util.faults import *
+from geni.util.excep import *
+from geni.util.misc import *
+from geni.util.method import Method
+from geni.util.parameter import Parameter, Mixed
+from geni.util.auth import Auth
+from geni.util.slices import Slices
+
+class stop_slice(Method):
+ """
+ Stop the specified slice
+
+ @param cred credential string specifying the rights of the caller
+ @param hrn human readable name of slice to instantiate
+ @return 1 is successful, faults otherwise
+ """
+
+ interfaces = ['aggregate', 'slicemgr']
+
+ accepts = [
+ Parameter(str, "Credential string"),
+ Parameter(str, "Human readable name of slice to instantiate"),
+ ]
+
+ returns = [Parameter(int, "1 if successful")]
+
+ def call(self, cred, hrn):
+
+ self.api.auth.check(cred, 'startslice')
+ slices = Slices(self.api)
+ slices.stop_slice(hrn):
+
+ return 1