1 from geni.util.faults import *
2 from geni.util.excep import *
3 from geni.util.method import Method
4 from geni.util.parameter import Parameter, Mixed
5 from geni.util.auth import Auth
6 from geni.util.nodes import Nodes
8 class get_resources(Method):
10 Get an resource specification (rspec). The rspec may describe the resources
11 available at an authority or the resources being used by a slice.
13 @param cred credential string specifying the rights of the caller
14 @param hrn human readable name of the slice we are interesed in or None
18 interfaces = ['aggregate', 'slicemgr']
21 Parameter(str, "Credential string"),
22 Mixed(Parameter(str, "Human readable name (hrn)"),
23 Parameter(None, "hrn not specified"))
26 returns = Parameter(str, "String representatin of an rspec")
28 def call(self, cred, hrn=None):
30 self.api.auth.check(cred, 'listnodes')
31 nodes = Nodes(self.api)
33 rspec = nodes.get_rspec(hrn)
36 rspec = nodes['rspec']