68d928e64e4c19133b62f8fd12176c1f6dc6ea7a
[sfa.git] / sfa / methods / Status.py
1 from sfa.util.xrn import urn_to_hrn
2 from sfa.util.method import Method
3
4 from sfa.storage.parameter import Parameter, Mixed
5
6 class Status(Method):
7     """
8     Get the status of a sliver
9     
10     @param slice_urn (string) URN of slice to allocate to
11     
12     """
13     interfaces = ['aggregate', 'slicemgr', 'component']
14     accepts = [
15         Parameter(type([str]), "Slice or sliver URNs"),
16         Parameter(type([dict]), "credentials"),
17         Parameter(dict, "Options")
18         ]
19     returns = Parameter(dict, "Status details")
20
21     def call(self, xrns, creds, options):
22         valid_creds = self.api.auth.checkCredentialsSpeaksFor(creds, 'sliverstatus', xrns,
23                                                               check_sliver_callback = self.api.driver.check_sliver_credentials,
24                                                               options=options)
25
26         self.api.logger.info("interface: %s\ttarget-hrn: %s\tmethod-name: %s"%(self.api.interface, xrns, self.name))
27         return self.api.manager.Status(self.api, xrns, creds, options)
28