Merge Master in geni-v3 conflict resolution
[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.checkCredentials(creds, 'sliverstatus', xrns,
23                       check_sliver_callback = self.api.manager.driver.check_sliver_credentials)
24
25         self.api.logger.info("interface: %s\ttarget-hrn: %s\tmethod-name: %s"%(self.api.interface, xrns, self.name))
26         return self.api.manager.Status(self.api, xrns, creds, options)
27