From ea34fd483d755265eb42bff02ee3de96f191886c Mon Sep 17 00:00:00 2001 From: Tony Mack Date: Mon, 20 Aug 2012 15:42:47 -0400 Subject: [PATCH] fix Describe --- sfa/managers/aggregate_manager.py | 11 +++-------- sfa/methods/Describe.py | 8 ++++---- sfa/openstack/nova_driver.py | 4 ++-- sfa/planetlab/pldriver.py | 11 ++++++++--- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/sfa/managers/aggregate_manager.py b/sfa/managers/aggregate_manager.py index d328c1b5..20c3d730 100644 --- a/sfa/managers/aggregate_manager.py +++ b/sfa/managers/aggregate_manager.py @@ -115,20 +115,15 @@ class AggregateManager: call_id = options.get('call_id') 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')) - return self.driver.describe(creds, urns, rspec, options) + return self.driver.describe(creds, urns, rspec_version, options) - def SliverStatus (self, api, xrn, creds, options): + def Status (self, api, urns, creds, options): call_id = options.get('call_id') if Callids().already_handled(call_id): return {} - - xrn = Xrn(xrn,'slice') - slice_urn=xrn.get_urn() - slice_hrn=xrn.get_hrn() - return self.driver.sliver_status (slice_urn, slice_hrn) + return self.driver.status (urns, options=options) def CreateSliver(self, api, xrn, creds, rspec_string, users, options): """ diff --git a/sfa/methods/Describe.py b/sfa/methods/Describe.py index 7a03085c..546be22e 100644 --- a/sfa/methods/Describe.py +++ b/sfa/methods/Describe.py @@ -43,7 +43,7 @@ class Describe(Method): origin_hrn = options.get('origin_hrn', None) if not origin_hrn: origin_hrn = Credential(string=valid_creds[0]).get_gid_caller().get_hrn() - rspec = self.api.manager.ListResources(self.api, creds, options) + desc = self.api.manager.Describe(self.api, creds, urns, options) # filter rspec through sfatables if self.api.interface in ['aggregate']: @@ -51,11 +51,11 @@ class Describe(Method): elif self.api.interface in ['slicemgr']: chain_name = 'FORWARD-OUTGOING' self.api.logger.debug("ListResources: sfatables on chain %s"%chain_name) - filtered_rspec = run_sfatables(chain_name, '', origin_hrn, rspec) + desc['geni_rspec'] = run_sfatables(chain_name, '', origin_hrn, desc['geni_rspec']) if options.has_key('geni_compressed') and options['geni_compressed'] == True: - filtered_rspec = zlib.compress(filtered_rspec).encode('base64') + desc['geni_rspec'] = zlib.compress(desc['geni_rspec']).encode('base64') - return filtered_rspec + return desc diff --git a/sfa/openstack/nova_driver.py b/sfa/openstack/nova_driver.py index 275e4bb8..af9ce4df 100644 --- a/sfa/openstack/nova_driver.py +++ b/sfa/openstack/nova_driver.py @@ -337,9 +337,9 @@ class NovaDriver(Driver): aggregate = OSAggregate(self) return aggregate.describe(urns, version=version, options=options) - def status (self, urns): + def status (self, urns, options={}): aggregate = OSAggregate(self) - desc = aggregate.describe(urns, version=version, options=options) + desc = aggregate.describe(urns) return desc['geni_slivers'] def create_sliver (self, slice_urn, slice_hrn, creds, rspec_string, users, options): diff --git a/sfa/planetlab/pldriver.py b/sfa/planetlab/pldriver.py index 8388ea2a..f73410e3 100644 --- a/sfa/planetlab/pldriver.py +++ b/sfa/planetlab/pldriver.py @@ -576,10 +576,15 @@ class PlDriver (Driver): rspec = aggregate.list_resources(version=rspec_version, options=options) return rspec - def describe(self, creds, urns, options): - return {} + def describe(self, creds, urns, version, options): + aggregate = PlAggregate(self) + return aggregate.describe(urns, version=version, options=options) - def status (self, slice_urn, slice_hrn): + def status (self, urns, options={}): + aggregate = PlAggregate(self) + desc = aggregate.describe(urns) + return desc['geni_slivers'] + # find out where this slice is currently running slicename = hrn_to_pl_slicename(slice_hrn) -- 2.47.0