4 from sfa.util.faults import *
5 from sfa.util.misc 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
11 from sfa.plc.slices import Slices
13 class delete_slice(Method):
15 Remove the slice from all nodes.
17 @param cred credential string specifying the rights of the caller
18 @param hrn human readable name specifying the slice to delete
19 @return 1 if successful, faults otherwise
22 interfaces = ['aggregate', 'slicemgr']
25 Parameter(str, "Credential string"),
26 Parameter(str, "Human readable name of slice to delete"),
29 returns = Parameter(int, "1 if successful")
31 def call(self, cred, hrn, caller_cred=None):
36 self.api.logger.info("interface: %s\tcaller-hrn: %s\ttarget-hrn: %s\tmethod-name: %s"%(self.api.interface, Credential(string=caller_cred).get_gid_caller().get_hrn(), hrn, self.name))
38 self.api.auth.check(cred, 'deleteslice')
39 slices = Slices(self.api, caller_cred=caller_cred)
40 slices.delete_slice(hrn)