X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sfa%2Fmethods%2FSliverStatus.py;h=842c3e454690bbcd0f2e63baf648a96f652ade80;hb=06b330f0ee047bdb107e43e82b1d7356c876bc15;hp=24d6ff2ab1bdc37be6d1dd4b35174414646cccb0;hpb=952322d76247f8991f3c2688ed7e1f5a22ca4572;p=sfa.git diff --git a/sfa/methods/SliverStatus.py b/sfa/methods/SliverStatus.py index 24d6ff2a..842c3e45 100644 --- a/sfa/methods/SliverStatus.py +++ b/sfa/methods/SliverStatus.py @@ -1,7 +1,7 @@ from sfa.util.faults import * -from sfa.util.namespace import * +from sfa.util.xrn import urn_to_hrn from sfa.util.method import Method -from sfa.util.parameter import Parameter +from sfa.util.parameter import Parameter, Mixed class SliverStatus(Method): """ @@ -10,26 +10,22 @@ class SliverStatus(Method): @param slice_urn (string) URN of slice to allocate to """ - interfaces = ['geni_am'] + interfaces = ['aggregate', 'slicemgr', 'component'] accepts = [ Parameter(str, "Slice URN"), + Mixed(Parameter(str, "Credential string"), + Parameter(type([str]), "List of credentials")), ] - returns = Parameter(bool, "Success or Failure") + returns = Parameter(dict, "Status details") def call(self, slice_xrn, creds): hrn, type = urn_to_hrn(slice_xrn) - - ValidCreds = self.api.auth.checkCredentials(creds, 'sliverstatus', hrn) + valid_creds = self.api.auth.checkCredentials(creds, 'sliverstatus', hrn) self.api.logger.info("interface: %s\ttarget-hrn: %s\tmethod-name: %s"%(self.api.interface, hrn, self.name)) + + manager = self.api.get_interface_manager() + status = manager.slice_status(self.api, hrn, valid_creds) - manager_base = 'sfa.managers' - - if self.api.interface in ['geni_am']: - mgr_type = self.api.config.SFA_GENI_AGGREGATE_TYPE - manager_module = manager_base + ".geni_am_%s" % mgr_type - manager = __import__(manager_module, fromlist=[manager_base]) - return manager.SliverStatus(self.api, slice_xrn, ValidCreds) - - return '' + return status