trimmed useless imports, unstarred all imports
[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(str, "call_id"),
18         ]
19     returns = Parameter(dict, "Status details")
20
21     def call(self, slice_xrn, creds, call_id=""):
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         manager = self.api.get_interface_manager()
28         status = manager.SliverStatus(self.api, hrn, valid_creds, call_id)
29
30         return status
31