X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sfa%2Fmethods%2FShutdown.py;h=7b086af3c80a285160ad935ab70cc372f8b34207;hb=3e6097e2d50ff322b45f53fcb22d07fc16adbdb6;hp=60e2dd34981c485ee099b71ec0483ab6a3d996ed;hpb=f5f5269fbbb8d3eb2bde937355604ebac5a8a197;p=sfa.git diff --git a/sfa/methods/Shutdown.py b/sfa/methods/Shutdown.py index 60e2dd34..7b086af3 100644 --- a/sfa/methods/Shutdown.py +++ b/sfa/methods/Shutdown.py @@ -1,10 +1,9 @@ -from sfa.util.faults import * -from sfa.util.namespace import * +from sfa.storage.parameter import Parameter +from sfa.trust.credential import Credential from sfa.util.method import Method -from sfa.util.parameter import Parameter -from sfa.methods.Stop import Stop -class Shutdown(Stop): + +class Shutdown(Method): """ Perform an emergency shut down of a sliver. This operation is intended for administrative use. The sliver is shut down but remains available for further forensics. @@ -12,14 +11,20 @@ class Shutdown(Stop): @param slice_urn (string) URN of slice to renew @param credentials ([string]) of credentials """ - interfaces = ['aggregate', 'slicemgr', 'geni_am'] + interfaces = ['aggregate', 'slicemgr'] accepts = [ Parameter(str, "Slice URN"), - Parameter(type([str]), "List of credentials"), - ] + Parameter(type([dict]), "Credentials"), + ] returns = Parameter(bool, "Success or Failure") - def call(self, slice_xrn, creds): + def call(self, xrn, creds): + + valid_creds = self.api.auth.checkCredentials(creds, 'stopslice', xrn, + check_sliver_callback=self.api.driver.check_sliver_credentials) + # log the call + 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, xrn, self.name)) - return Stop.call(self, slice_xrn, creds) - + return self.api.manager.Shutdown(self.api, xrn, creds)