dd15f5dfad83b1463108d151318e8af54fcc8b77
[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
7 class Status(Method):
8     """
9     Get the status of a sliver
10
11     @param slice_urn (string) URN of slice to allocate to
12
13     """
14     interfaces = ['aggregate', 'slicemgr', 'component']
15     accepts = [
16         Parameter(type([str]), "Slice or sliver URNs"),
17         Parameter(type([dict]), "credentials"),
18         Parameter(dict, "Options")
19     ]
20     returns = Parameter(dict, "Status details")
21
22     def call(self, xrns, creds, options):
23         valid_creds = self.api.auth.checkCredentialsSpeaksFor(creds, 'sliverstatus', xrns,
24                                                               check_sliver_callback=self.api.driver.check_sliver_credentials,
25                                                               options=options)
26
27         self.api.logger.info("interface: %s\ttarget-hrn: %s\tmethod-name: %s" %
28                              (self.api.interface, xrns, self.name))
29         return self.api.manager.Status(self.api, xrns, creds, options)