X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sfa%2Fmethods%2FPerformOperationalAction.py;h=1081b0e1797fd777eaf6b8a5a789fd6c3e59d788;hb=3e6097e2d50ff322b45f53fcb22d07fc16adbdb6;hp=01d853d40a1ee9af023b1e59f997679e7c8851c8;hpb=96df4d7d52e14ea85055813121a07bb3e798d98e;p=sfa.git diff --git a/sfa/methods/PerformOperationalAction.py b/sfa/methods/PerformOperationalAction.py index 01d853d4..1081b0e1 100644 --- a/sfa/methods/PerformOperationalAction.py +++ b/sfa/methods/PerformOperationalAction.py @@ -5,6 +5,7 @@ from sfa.util.sfatablesRuntime import run_sfatables from sfa.trust.credential import Credential from sfa.storage.parameter import Parameter, Mixed + class PerformOperationalAction(Method): """ Request that the named geni_allocated slivers be made @@ -17,7 +18,7 @@ class PerformOperationalAction(Method): @param slice urns ([string]) URNs of slivers to provision to @param credentials (dict) of credentials @param options (dict) options - + """ interfaces = ['aggregate', 'slicemgr'] accepts = [ @@ -25,16 +26,22 @@ class PerformOperationalAction(Method): Parameter(type([dict]), "Credentials"), Parameter(str, "Action"), Parameter(dict, "Options"), - ] + ] returns = Parameter(dict, "Provisioned Resources") def call(self, xrns, creds, action, options): - self.api.logger.info("interface: %s\ttarget-hrn: %s\tmethod-name: %s"%(self.api.interface, xrns, self.name)) + self.api.logger.info("interface: %s\ttarget-hrn: %s\tmethod-name: %s" % + (self.api.interface, xrns, self.name)) + + (speaking_for, _) = urn_to_hrn(options.get('geni_speaking_for')) # Find the valid credentials - valid_creds = self.api.auth.checkCredentials(creds, 'createsliver', xrns, - check_sliver_callback = self.api.driver.check_sliver_credentials) + valid_creds = self.api.auth.checkCredentialsSpeaksFor(creds, 'createsliver', xrns, + check_sliver_callback=self.api.driver.check_sliver_credentials, + options=options) origin_hrn = Credential(cred=valid_creds[0]).get_gid_caller().get_hrn() - self.api.logger.info("interface: %s\tcaller-hrn: %s\ttarget-hrn: %s\tmethod-name: %s"%(self.api.interface, origin_hrn, xrns, self.name)) - result = self.api.manager.PerformOperationalAction(self.api, xrns, creds, action, options) + self.api.logger.info("interface: %s\tcaller-hrn: %s\ttarget-hrn: %s\tmethod-name: %s" % + (self.api.interface, origin_hrn, xrns, self.name)) + result = self.api.manager.PerformOperationalAction( + self.api, xrns, creds, action, options) return result