- if Callids().already_handled(call_id): return ""
-
- # get slice's hrn from options
- slice_xrn = options.get('geni_slice_urn', None)
- # pass None if no slice is specified
- if not slice_xrn:
- slice_hrn, slice_urn = None, None
- else:
- xrn = Xrn(slice_xrn)
- slice_urn=xrn.get_urn()
- slice_hrn=xrn.get_hrn()
- return self.driver.list_resources (slice_urn, slice_hrn, creds, options)
-
- def SliverStatus (self, api, xrn, creds, options):
+ if Callids().already_handled(call_id):
+ return ""
+
+ # get the rspec's return format from options
+ version_manager = VersionManager()
+ rspec_version = version_manager.get_version(
+ options.get('geni_rspec_version'))
+ version_string = self.get_rspec_version_string(rspec_version, options)
+
+ # look in cache first
+ cached_requested = options.get('cached', True)
+ if cached_requested and api.driver.cache:
+ rspec = api.driver.cache.get(version_string)
+ if rspec:
+ logger.debug("%s.ListResources returning cached advertisement" % (
+ api.driver.__module__))
+ return rspec
+
+ rspec = api.driver.list_resources(rspec_version, options)
+ if api.driver.cache:
+ logger.debug("%s.ListResources stores advertisement in cache" % (
+ api.driver.__module__))
+ api.driver.cache.add(version_string, rspec)
+ return rspec
+
+ def Describe(self, api, creds, urns, options):
+ call_id = options.get('call_id')
+ if Callids().already_handled(call_id):
+ return ""
+
+ version_manager = VersionManager()
+ rspec_version = version_manager.get_version(
+ options.get('geni_rspec_version'))
+ return api.driver.describe(urns, rspec_version, options)
+
+ def Status(self, api, urns, creds, options):
+ call_id = options.get('call_id')
+ if Callids().already_handled(call_id):
+ return {}
+ return api.driver.status(urns, options=options)
+
+ def Allocate(self, api, xrn, creds, rspec_string, expiration, options):
+ """
+ Allocate resources as described in a request RSpec argument
+ to a slice with the named URN.
+ """