1 from sfa.util.xrn import urn_to_hrn
2 from sfa.util.method import Method
3 from sfa.util.parameter import Parameter, Mixed
4 from sfa.trust.credential import Credential
8 Stop the specified slice
10 @param cred credential string specifying the rights of the caller
11 @param xrn human readable name of slice to instantiate (hrn or urn)
12 @return 1 is successful, faults otherwise
15 interfaces = ['aggregate', 'slicemgr', 'component']
18 Parameter(str, "Human readable name of slice to instantiate (hrn or urn)"),
19 Mixed(Parameter(str, "Credential string"),
20 Parameter(type([str]), "List of credentials")),
23 returns = Parameter(int, "1 if successful")
25 def call(self, xrn, creds):
26 hrn, type = urn_to_hrn(xrn)
27 valid_creds = self.api.auth.checkCredentials(creds, 'stopslice', hrn)
30 origin_hrn = Credential(string=valid_creds[0]).get_gid_caller().get_hrn()
31 self.api.logger.info("interface: %s\tcaller-hrn: %s\ttarget-hrn: %s\tmethod-name: %s"%(self.api.interface, origin_hrn, hrn, self.name))
33 manager = self.api.get_interface_manager()
34 manager.stop_slice(self.api, xrn, creds)