the big cleanup: deprecate federica driver
authorThierry Parmentelat <thierry.parmentelat@inria.fr>
Sun, 27 May 2018 12:19:02 +0000 (14:19 +0200)
committerThierry Parmentelat <thierry.parmentelat@inria.fr>
Mon, 28 May 2018 09:21:17 +0000 (11:21 +0200)
config/default_config.xml
config/sfa-config-tty
setup.py
sfa.spec
sfa/federica/__init__.py [deleted file]
sfa/federica/fddriver.py [deleted file]
sfa/federica/fdshell.py [deleted file]
sfa/generic/fd.py [deleted file]
sfa/managers/v2_to_v3_adapter.py
sfa/rspecs/versions/federica.py [deleted file]

index 499bd6e..2e86601 100644 (file)
@@ -258,20 +258,6 @@ Thierry Parmentelat
       </variablelist>
     </category>
 
-    <!-- ======================================== -->
-    <category id="sfa_federica">
-      <name></name>
-      <description>The settings that tell this SFA instance how to interact with the FEDERICA testbed.</description>
-
-      <variablelist>
-       <variable id="url" type="string">
-         <name>XMLRPC URL</name>
-         <value>https://root:password@federica.sfa.wrapper.com:8443/fedewrapper/xmlrpc/</value>
-         <description>URL for the federica xmlrpc API; login and password need to be set like in http://login:password@hostname:port/the/path </description>
-       </variable>
-      </variablelist>
-    </category>
-
     <!-- ======================================== -->
     <category id="sfa_nova">
       <name>SFA Flash Policy</name>
index 252c77d..5b65de5 100755 (executable)
@@ -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',
 }
index c98d71e..bdeeb48 100755 (executable)
--- a/setup.py
+++ b/setup.py
@@ -56,7 +56,6 @@ packages = [
     'sfa/nitos',
     'sfa/dummy',
     'sfa/openstack',
-    'sfa/federica',
     'sfa/iotlab',
     'sfatables',
     'sfatables/commands',
index ce705ab..376f0a7 100644 (file)
--- 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 (file)
index e69de29..0000000
diff --git a/sfa/federica/fddriver.py b/sfa/federica/fddriver.py
deleted file mode 100644 (file)
index 0307506..0000000
+++ /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 (file)
index 179c851..0000000
+++ /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 (file)
index 60f172b..0000000
+++ /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
index 15c89e0..e37c2c8 100644 (file)
@@ -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 (file)
index 4e24587..0000000
+++ /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'