2a0ac5dc316ff3cc56436d519493e69d43e9dbe2
[sfa.git] / sfa / methods / SliverStatus.py
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
5 class SliverStatus(Method):
6     """
7     Get the status of a sliver
8     
9     @param slice_urn (string) URN of slice to allocate to
10     
11     """
12     interfaces = ['aggregate', 'slicemgr', 'component']
13     accepts = [
14         Parameter(str, "Slice URN"),
15         Mixed(Parameter(str, "Credential string"),
16               Parameter(type([str]), "List of credentials")),
17         Parameter(dict, "Options")
18         ]
19     returns = Parameter(dict, "Status details")
20
21     def call(self, slice_xrn, creds, options={}):
22         hrn, type = urn_to_hrn(slice_xrn)
23         valid_creds = self.api.auth.checkCredentials(creds, 'sliverstatus', hrn)
24
25         self.api.logger.info("interface: %s\ttarget-hrn: %s\tmethod-name: %s"%(self.api.interface, hrn, self.name))
26     
27         status = self.api.manager.SliverStatus(self.api, hrn, valid_creds, options)
28
29         return status
30