1 ### $Id: stop_slice.py 17732 2010-04-19 21:10:45Z tmack $
2 ### $URL: https://svn.planet-lab.org/svn/sfa/trunk/sfa/methods/stop_slice.py $
4 from sfa.util.faults import *
5 from sfa.util.namespace import *
6 from sfa.util.method import Method
7 from sfa.util.parameter import Parameter, Mixed
8 from sfa.trust.auth import Auth
9 from sfa.trust.credential import Credential
13 Stop the specified slice
15 @param cred credential string specifying the rights of the caller
16 @param xrn human readable name of slice to instantiate (hrn or urn)
17 @return 1 is successful, faults otherwise
20 interfaces = ['aggregate', 'slicemgr', 'component']
23 Parameter(str, "Human readable name of slice to instantiate (hrn or urn)"),
24 Mixed(Parameter(str, "Credential string"),
25 Parameter(type([str]), "List of credentials")),
28 returns = Parameter(int, "1 if successful")
30 def call(self, xrn, creds):
31 hrn, type = urn_to_hrn(xrn)
32 valid_creds = self.api.auth.checkCredentials(creds, 'stopslice', hrn)
35 origin_hrn = Credential(string=valid_creds[0]).get_gid_caller().get_hrn()
36 self.api.logger.info("interface: %s\tcaller-hrn: %s\ttarget-hrn: %s\tmethod-name: %s"%(self.api.interface, origin_hrn, hrn, self.name))
38 manager = self.api.get_interface_manager()
39 manager.stop_slice(self.api, xrn, creds)