From 0d8c502d5ede80349764103f580c4000a8fce97a Mon Sep 17 00:00:00 2001 From: Thierry Parmentelat Date: Tue, 13 Dec 2011 17:16:32 +0100 Subject: [PATCH] drop support for API v1, hard-wired v2 as per v2, GetVersion now accepts an optional option (which is ignored) --- config/default_config.xml | 6 ------ sfa/client/sfaserverproxy.py | 1 + sfa/managers/aggregate_manager.py | 4 ++-- sfa/managers/aggregate_manager_eucalyptus.py | 4 ++-- sfa/managers/component_manager_pl.py | 2 +- sfa/managers/registry_manager.py | 2 +- sfa/managers/slice_manager.py | 4 ++-- sfa/methods/GetVersion.py | 9 ++++++--- sfa/server/sfaapi.py | 5 ++--- 9 files changed, 17 insertions(+), 20 deletions(-) diff --git a/config/default_config.xml b/config/default_config.xml index 9a0a8878..e074865e 100644 --- a/config/default_config.xml +++ b/config/default_config.xml @@ -164,12 +164,6 @@ Thierry Parmentelat The port where the aggregate is to be found. - - Aggregate Manager API Version - 1 - The Aggregate API version - - diff --git a/sfa/client/sfaserverproxy.py b/sfa/client/sfaserverproxy.py index 141d57c0..b348126e 100644 --- a/sfa/client/sfaserverproxy.py +++ b/sfa/client/sfaserverproxy.py @@ -82,6 +82,7 @@ class XMLRPCTransport(xmlrpclib.Transport): class XMLRPCServerProxy(xmlrpclib.ServerProxy): def __init__(self, url, transport, allow_none=True, verbose=False): # remember url for GetVersion + # xxx not sure this is still needed as SfaServerProxy has this too self.url=url xmlrpclib.ServerProxy.__init__(self, url, transport, allow_none=allow_none, verbose=verbose) diff --git a/sfa/managers/aggregate_manager.py b/sfa/managers/aggregate_manager.py index 2a27b6cf..995e694a 100644 --- a/sfa/managers/aggregate_manager.py +++ b/sfa/managers/aggregate_manager.py @@ -30,13 +30,13 @@ class AggregateManager: # essentially a union of the core version, the generic version (this code) and # whatever the driver needs to expose - def GetVersion(self, api): + def GetVersion(self, api, options): xrn=Xrn(api.hrn) version = version_core() version_generic = {'interface':'aggregate', 'sfa': 2, - 'geni_api': api.config.SFA_AGGREGATE_API_VERSION, + 'geni_api': 2, 'hrn':xrn.get_hrn(), 'urn':xrn.get_urn(), } diff --git a/sfa/managers/aggregate_manager_eucalyptus.py b/sfa/managers/aggregate_manager_eucalyptus.py index 588f090f..aa803acc 100644 --- a/sfa/managers/aggregate_manager_eucalyptus.py +++ b/sfa/managers/aggregate_manager_eucalyptus.py @@ -682,7 +682,7 @@ class AggregateManagerEucalyptus: f.write("%s %s %s\n" % (instId, ipaddr, hrn)) f.close() - def GetVersion(api): + def GetVersion(api, options): version_manager = VersionManager() ad_rspec_versions = [] @@ -695,7 +695,7 @@ class AggregateManagerEucalyptus: xrn=Xrn(api.hrn) version_more = {'interface':'aggregate', 'sfa': 1, - 'geni_api': api.config.SFA_AGGREGATE_API_VERSION, + 'geni_api': '2', 'testbed':'myplc', 'hrn':xrn.get_hrn(), 'geni_request_rspec_versions': request_rspec_versions, diff --git a/sfa/managers/component_manager_pl.py b/sfa/managers/component_manager_pl.py index 69929714..96304790 100644 --- a/sfa/managers/component_manager_pl.py +++ b/sfa/managers/component_manager_pl.py @@ -5,7 +5,7 @@ from sfa.util.plxrn import PlXrn from sfa.trust.sfaticket import SfaTicket from sfa.util.version import version_core -def GetVersion(api): +def GetVersion(api, options): return version_core({'interface':'component', 'testbed':'myplc'}) diff --git a/sfa/managers/registry_manager.py b/sfa/managers/registry_manager.py index 98c537b3..0659431d 100644 --- a/sfa/managers/registry_manager.py +++ b/sfa/managers/registry_manager.py @@ -26,7 +26,7 @@ class RegistryManager: def __init__ (self): pass # The GENI GetVersion call - def GetVersion(self, api): + def GetVersion(self, api, options): peers = dict ( [ (hrn,interface.get_url()) for (hrn,interface) in api.registries.iteritems() if hrn != api.hrn]) xrn=Xrn(api.hrn) diff --git a/sfa/managers/slice_manager.py b/sfa/managers/slice_manager.py index b82ac665..ee082c71 100644 --- a/sfa/managers/slice_manager.py +++ b/sfa/managers/slice_manager.py @@ -25,7 +25,7 @@ class SliceManager: # self.caching=False self.caching=True - def GetVersion(self, api): + def GetVersion(self, api, options): # peers explicitly in aggregates.xml peers =dict ([ (peername,interface.get_url()) for (peername,interface) in api.aggregates.iteritems() if peername != api.hrn]) @@ -40,7 +40,7 @@ class SliceManager: xrn=Xrn(api.hrn, 'authority+sa') version_more = {'interface':'slicemgr', 'sfa': 2, - 'geni_api': api.config.SFA_AGGREGATE_API_VERSION, + 'geni_api': 2, 'hrn' : xrn.get_hrn(), 'urn' : xrn.get_urn(), 'peers': peers, diff --git a/sfa/methods/GetVersion.py b/sfa/methods/GetVersion.py index e8e4eead..cb682e44 100644 --- a/sfa/methods/GetVersion.py +++ b/sfa/methods/GetVersion.py @@ -9,9 +9,12 @@ class GetVersion(Method): @return version """ interfaces = ['registry','aggregate', 'slicemgr', 'component'] - accepts = [] + accepts = [ + Parameter(dict, "Options") + ] returns = Parameter(dict, "Version information") - def call(self): + # API v2 specifies options is optional, so.. + def call(self, options={}): self.api.logger.info("interface: %s\tmethod-name: %s" % (self.api.interface, self.name)) - return self.api.manager.GetVersion(self.api) + return self.api.manager.GetVersion(self.api, options) diff --git a/sfa/server/sfaapi.py b/sfa/server/sfaapi.py index 79a5540d..c18452b9 100644 --- a/sfa/server/sfaapi.py +++ b/sfa/server/sfaapi.py @@ -249,9 +249,8 @@ class SfaApi (XmlrpcApi): Converts the specified result into a standard GENI compliant response """ + # as of dec 13 2011 we only support API v2 if self.interface.lower() in ['aggregate', 'slicemgr']: - if hasattr(self.config, 'SFA_AGGREGATE_API_VERSION') and \ - self.config.SFA_AGGREGATE_API_VERSION == 2: - result = self.prepare_response_v2_am(result) + result = self.prepare_response_v2_am(result) return XmlrpcApi.prepare_response(self, result, method) -- 2.43.0