From 1505f3a42ea06ef30959e9e54fa7298eb55d83ee Mon Sep 17 00:00:00 2001 From: Thierry Parmentelat Date: Sun, 27 May 2018 14:19:02 +0200 Subject: [PATCH] the big cleanup: deprecate federica driver --- config/default_config.xml | 14 ---- config/sfa-config-tty | 1 - setup.py | 1 - sfa.spec | 11 --- sfa/federica/__init__.py | 0 sfa/federica/fddriver.py | 126 ------------------------------- sfa/federica/fdshell.py | 42 ----------- sfa/generic/fd.py | 14 ---- sfa/managers/v2_to_v3_adapter.py | 5 +- sfa/rspecs/versions/federica.py | 25 ------ 10 files changed, 1 insertion(+), 238 deletions(-) delete mode 100644 sfa/federica/__init__.py delete mode 100644 sfa/federica/fddriver.py delete mode 100644 sfa/federica/fdshell.py delete mode 100644 sfa/generic/fd.py delete mode 100644 sfa/rspecs/versions/federica.py diff --git a/config/default_config.xml b/config/default_config.xml index 499bd6e7..2e86601b 100644 --- a/config/default_config.xml +++ b/config/default_config.xml @@ -258,20 +258,6 @@ Thierry Parmentelat - - - - The settings that tell this SFA instance how to interact with the FEDERICA testbed. - - - - XMLRPC URL - https://root:password@federica.sfa.wrapper.com:8443/fedewrapper/xmlrpc/ - URL for the federica xmlrpc API; login and password need to be set like in http://login:password@hostname:port/the/path - - - - SFA Flash Policy diff --git a/config/sfa-config-tty b/config/sfa-config-tty index 252c77d5..5b65de5d 100755 --- a/config/sfa-config-tty +++ b/config/sfa-config-tty @@ -35,7 +35,6 @@ usual_variables = [ flavour_xml_section_hash = { 'pl': 'sfa_plc', 'openstack': 'sfa_nova', - 'fd': 'sfa_federica', 'nitos': 'sfa_nitos', 'dummy': 'sfa_dummy', } diff --git a/setup.py b/setup.py index c98d71e0..bdeeb489 100755 --- a/setup.py +++ b/setup.py @@ -56,7 +56,6 @@ packages = [ 'sfa/nitos', 'sfa/dummy', 'sfa/openstack', - 'sfa/federica', 'sfa/iotlab', 'sfatables', 'sfatables/commands', diff --git a/sfa.spec b/sfa.spec index ce705abf..376f0a79 100644 --- a/sfa.spec +++ b/sfa.spec @@ -62,11 +62,6 @@ Summary: the SFA layer around MyPLC Group: Applications/System Requires: sfa -%package federica -Summary: the SFA layer around Federica -Group: Applications/System -Requires: sfa - %package nitos Summary: the SFA layer around NITOS Group: Applications/System @@ -108,9 +103,6 @@ sfi.py, together with other utilities. This package implements the SFA interface which serves as a layer between the existing PlanetLab interfaces and the SFA API. -%description federica -The SFA driver for FEDERICA. - %description nitos The SFA driver for NITOS. @@ -194,9 +186,6 @@ rm -rf $RPM_BUILD_ROOT /etc/sfa/protogeni-rspec-common.xsd /etc/sfa/topology -%files federica -%{python_sitelib}/sfa/federica - %files nitos %{python_sitelib}/sfa/nitos diff --git a/sfa/federica/__init__.py b/sfa/federica/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/sfa/federica/fddriver.py b/sfa/federica/fddriver.py deleted file mode 100644 index 0307506d..00000000 --- a/sfa/federica/fddriver.py +++ /dev/null @@ -1,126 +0,0 @@ -from sfa.util.sfalogging import logger -from sfa.util.faults import SfaFault - -# this is probably too big to swallow but for a starting point.. -from sfa.planetlab.pldriver import PlDriver - -from sfa.federica.fdshell import FdShell - -# hardwired for now -# this could/should be obtained by issuing getRSpecVersion -federica_version_string = "RSpecV2" - -# avail. methods on the federica side as of 2012/02/13 -# listAvailableResources(String credentials, String rspecVersion) -# listSliceResources(String credentials, String rspecVersion, String sliceUrn) -# createSlice(String credentials, String sliceUrn, String rspecVersion, String rspecString) -# deleteSlice(String credentials, String sliceUrn) -# listSlices() -# getRSpecVersion() -# all return -# Result: {'code': 0, 'value': RSpec} if success -# {'code': code_id, 'output': Error message} if error - - -class FdDriver (PlDriver): - - def __init__(self, api): - PlDriver.__init__(self, api) - config = api.config - self.shell = FdShell(config) - - # the agreement with the federica driver is for them to expose results in a way - # compliant with the avpi v2 return code, i.e. a dict with 'code' 'value' 'output' - # essentially, either 'code'==0, then 'value' is set to the actual result - # otherwise, 'code' is set to an error code and 'output' holds an error - # message - def response(self, from_xmlrpc): - if isinstance(from_xmlrpc, dict) and 'code' in from_xmlrpc: - if from_xmlrpc['code'] == 0: - return from_xmlrpc['value'] - else: - raise SfaFault(from_xmlrpc['code'], from_xmlrpc['output']) - else: - logger.warning("unexpected result from federica xmlrpc api") - return from_xmlrpc - - def aggregate_version(self): - result = {} - federica_version_string_api = self.response( - self.shell.getRSpecVersion()) - result['federica_version_string_api'] = federica_version_string_api - if federica_version_string_api != federica_version_string: - result['WARNING'] = "hard-wired rspec version %d differs from what the API currently exposes" %\ - federica_version_string - return result - - def testbed_name(self): - return "federica" - - def list_slices(self, creds, options): - # the issue is that federica returns the list of slice's urn in a string format - # this is why this dirty hack is needed until federica fixes it. - slices_str = self.shell.listSlices()['value'][1:-1] - slices_list = slices_str.split(", ") - return slices_list - - def sliver_status(self, slice_urn, slice_hrn): - return "fddriver.sliver_status: undefined/todo for slice %s" % slice_hrn - - def list_resources(self, slice_urn, slice_hrn, creds, options): - # right now rspec_version is ignored on the federica side - # we normally derive it from options - # look in cache if client has requested so - cached_requested = options.get('cached', True) - # global advertisement - if not slice_hrn: - # self.cache is initialized unless the global config has it turned - # off - if cached_requested and self.cache: - # using federica_version_string as the key into the cache - rspec = self.cache.get(federica_version_string) - if rspec: - logger.debug( - "FdDriver.ListResources: returning cached advertisement") - return self.response(rspec) - # otherwise, need to get it - # java code expects creds as a String -# rspec = self.shell.listAvailableResources (creds, federica_version_string) - rspec = self.shell.listAvailableResources( - "", federica_version_string) -# rspec = self.shell.listAvailableResources (federica_version_string) - # cache it for future use - if self.cache: - logger.debug( - "FdDriver.ListResources: stores advertisement in cache") - self.cache.add(federica_version_string, rspec) - return self.response(rspec) - # about a given slice : don't cache - else: - # java code expects creds as a String - # return self.response(self.shell.listSliceResources(creds, - # federica_version_string, slice_urn)) - return self.response(self.shell.listSliceResources("", federica_version_string, slice_urn)) - - def create_sliver(self, slice_urn, slice_hrn, creds, rspec_string, users, options): - # right now version_string is ignored on the federica side - # we normally derive it from options - # java code expects creds as a String - # return self.response(self.shell.createSlice(creds, slice_urn, - # federica_version_string, rspec_string)) - return self.response(self.shell.createSlice("", slice_urn, federica_version_string, rspec_string)) - - def delete_sliver(self, slice_urn, slice_hrn, creds, options): - # right now version_string is ignored on the federica side - # we normally derive it from options - # xxx not sure if that's currentl supported at all - # java code expects creds as a String - # return self.response(self.shell.deleteSlice(creds, slice_urn)) - return self.response(self.shell.deleteSlice("", slice_urn)) - - # for the the following methods we use what is provided by the default driver class - # def renew_sliver (self, slice_urn, slice_hrn, creds, expiration_time, options): - # def start_slice (self, slice_urn, slice_xrn, creds): - # def stop_slice (self, slice_urn, slice_xrn, creds): - # def reset_slice (self, slice_urn, slice_xrn, creds): - # def get_ticket (self, slice_urn, slice_xrn, creds, rspec, options): diff --git a/sfa/federica/fdshell.py b/sfa/federica/fdshell.py deleted file mode 100644 index 179c8516..00000000 --- a/sfa/federica/fdshell.py +++ /dev/null @@ -1,42 +0,0 @@ -from sfa.util.sfalogging import logger -from sfa.util.py23 import xmlrpc_client - - -class FdShell: - """ - A simple xmlrpc shell to a federica API server - This class can receive the XMLRPC calls to the federica testbed - For safety this is limited to a set of hard-coded calls - """ - - direct_calls = ['listAvailableResources', - 'listSliceResources', - 'createSlice', - 'deleteSlice', - 'getRSpecVersion', - 'listSlices', - ] - - def __init__(self, config): - url = config.SFA_FEDERICA_URL - # xxx not sure if java xmlrpc has support for None - # self.proxy = xmlrpc_client.ServerProxy(url, verbose = False, allow_none = True) - # xxx turn on verbosity - self.proxy = xmlrpc_client.ServerProxy(url, verbose=True) - - # xxx get credentials from the config ? - # right now basic auth data goes into the URL - # so do *not* add any credential at that point - def __getattr__(self, name): - def func(*args, **kwds): - if name not in FdShell.direct_calls: - raise Exception( - "Illegal method call %s for FEDERICA driver" % (name)) - logger.info("Issuing %s args=%s kwds=%s to federica" % - (name, args, kwds)) -# result=getattr(self.proxy, "AggregateManager.%s"%name)(credential, *args, **kwds) - result = getattr(self.proxy, "AggregateManager.%s" % - name)(*args, **kwds) - logger.debug('FdShell %s (%s) returned ... ' % (name, name)) - return result - return func diff --git a/sfa/generic/fd.py b/sfa/generic/fd.py deleted file mode 100644 index 60f172bd..00000000 --- a/sfa/generic/fd.py +++ /dev/null @@ -1,14 +0,0 @@ -# -from sfa.generic.pl import pl - -import sfa.federica.fddriver - -# the federica flavour behaves like pl, except for -# the driver - - -class fd (pl): - - def driver_class(self): - import sfa.managers.v2_to_v3_adapter - return sfa.managers.v2_to_v3_adapter.V2ToV3Adapter diff --git a/sfa/managers/v2_to_v3_adapter.py b/sfa/managers/v2_to_v3_adapter.py index 15c89e08..e37c2c82 100644 --- a/sfa/managers/v2_to_v3_adapter.py +++ b/sfa/managers/v2_to_v3_adapter.py @@ -18,12 +18,9 @@ class V2ToV3Adapter: if flavour == "nitos": from sfa.nitos.nitosdriver import NitosDriver self.driver = NitosDriver(api) - elif flavour == "fd": - from sfa.federica.fddriver import FdDriver - self.driver = FdDriver(api) else: logger.error( - "V2ToV3Adapter: Unknown Flavour !!!\n Supported Flavours: nitos, fd") + "V2ToV3Adapter: Unknown Flavour !!!\n Supported Flavours: nitos") # Caching if config.SFA_AGGREGATE_CACHING: diff --git a/sfa/rspecs/versions/federica.py b/sfa/rspecs/versions/federica.py deleted file mode 100644 index 4e245872..00000000 --- a/sfa/rspecs/versions/federica.py +++ /dev/null @@ -1,25 +0,0 @@ -from sfa.rspecs.versions.pgv2 import PGv2 - - -class FedericaAd (PGv2): - enabled = True - type = 'Fedrica' - content_type = 'ad' - schema = 'http://sorch.netmode.ntua.gr/ws/RSpec/ad.xsd' - namespace = 'http://sorch.netmode.ntua.gr/ws/RSpec' - - -class FedericaRequest (PGv2): - enabled = True - type = 'Fedrica' - content_type = 'request' - schema = 'http://sorch.netmode.ntua.gr/ws/RSpec/request.xsd' - namespace = 'http://sorch.netmode.ntua.gr/ws/RSpec' - - -class FedericaManifest (PGv2): - enabled = True - type = 'Fedrica' - content_type = 'manifest' - schema = 'http://sorch.netmode.ntua.gr/ws/RSpec/manifest.xsd' - namespace = 'http://sorch.netmode.ntua.gr/ws/RSpec' -- 2.43.0