Replacing _backend for _platform class attribute in ResourceManager
authorAlina Quereilhac <alina.quereilhac@inria.fr>
Sat, 20 Dec 2014 01:36:02 +0000 (02:36 +0100)
committerAlina Quereilhac <alina.quereilhac@inria.fr>
Sat, 20 Dec 2014 01:36:02 +0000 (02:36 +0100)
25 files changed:
src/nepi/execution/resource.py
src/nepi/resources/all/collector.py
src/nepi/resources/linux/application.py
src/nepi/resources/linux/channel.py
src/nepi/resources/linux/gretunnel.py
src/nepi/resources/linux/interface.py
src/nepi/resources/linux/netns/netnsemulation.py
src/nepi/resources/linux/node.py
src/nepi/resources/linux/route.py
src/nepi/resources/linux/tap.py
src/nepi/resources/linux/tun.py
src/nepi/resources/linux/tunnel.py
src/nepi/resources/linux/udptunnel.py
src/nepi/resources/netns/netnsapplication.py
src/nepi/resources/netns/netnsbase.py
src/nepi/resources/ns3/ns3base.py
src/nepi/resources/omf/omf_resource.py
src/nepi/resources/omf/wilabt_node.py
src/nepi/resources/planetlab/node.py
src/nepi/resources/planetlab/openvswitch/ovs.py
src/nepi/resources/planetlab/openvswitch/ovsport.py
src/nepi/resources/planetlab/sfa_node.py
src/nepi/resources/planetlab/tap.py
src/nepi/resources/planetlab/tun.py
src/nepi/resources/planetlab/vroute.py

index d868c26..f1669d0 100644 (file)
@@ -127,19 +127,19 @@ class ResourceManager(Logger):
     """ Base clase for all ResourceManagers. 
     
     A ResourceManger is specific to a resource type (e.g. Node, 
-    Switch, Application, etc) on a specific backend (e.g. PlanetLab, 
+    Switch, Application, etc) on a specific platform (e.g. PlanetLab, 
     OMF, etc).
 
     The ResourceManager instances are responsible for interacting with
     and controlling concrete (physical or virtual) resources in the 
-    experimental backends.
+    experimental platforms.
     
     """
     _rtype = "Resource"
     _attributes = None
     _traces = None
     _help = None
-    _backend = None
+    _platform = None
     _reschedule_delay = "0.5s"
 
     @classmethod
@@ -290,12 +290,12 @@ class ResourceManager(Logger):
         return cls._help
 
     @classmethod
-    def get_backend(cls):
-        """ Returns the identified of the backend (i.e. testbed, environment)
+    def get_platform(cls):
+        """ Returns the identified of the platform (i.e. testbed type)
         for the Resource
 
         """
-        return cls._backend
+        return cls._platform
 
     @classmethod
     def get_global(cls, name):
index 6742fc8..4837feb 100644 (file)
@@ -43,7 +43,7 @@ class Collector(ResourceManager):
     _help = "A Collector can be attached to a trace name on another " \
         "ResourceManager and will retrieve and store the trace content " \
         "in a local file at the end of the experiment"
-    _backend_type = "all"
+    _platform = "all"
 
     @classmethod
     def _register_attributes(cls):
index 861bf1e..23108e5 100644 (file)
@@ -83,7 +83,7 @@ class LinuxApplication(ResourceManager):
 
     _rtype = "linux::Application"
     _help = "Runs an application on a Linux host with a BASH command "
-    _backend_type = "linux"
+    _platform = "linux"
 
     @classmethod
     def _register_attributes(cls):
index 2cd3573..1136186 100644 (file)
@@ -25,7 +25,7 @@ from nepi.execution.resource import ResourceManager, clsinit_copy, \
 class LinuxChannel(ResourceManager):
     _rtype = "linux::Channel"
     _help = "Represents a wireless channel on a network of Linux hosts"
-    _backend = "linux"
+    _platform = "linux"
 
     def __init__(self, ec, guid):
         super(LinuxChannel, self).__init__(ec, guid)
index 0d4962f..0fcaa13 100644 (file)
@@ -32,7 +32,6 @@ import os
 class LinuxGRETunnel(LinuxTunnel):
     _rtype = "linux::GRETunnel"
     _help = "Constructs a tunnel between two Linux endpoints using a UDP connection "
-    _backend = "linux"
 
     def log_message(self, msg):
         return " guid %d - GRE tunnel %s - %s - %s " % (self.guid, 
index af527b9..b166d4c 100644 (file)
@@ -38,7 +38,7 @@ import time
 class LinuxInterface(ResourceManager):
     _rtype = "linux::Interface"
     _help = "Controls network devices on Linux hosts through the ifconfig tool"
-    _backend = "linux"
+    _platform = "linux"
 
     @classmethod
     def _register_attributes(cls):
index c2d65d3..5d6aae4 100644 (file)
@@ -20,7 +20,7 @@
 from nepi.execution.attribute import Attribute, Flags, Types
 from nepi.execution.trace import Trace, TraceAttr
 from nepi.execution.resource import ResourceManager, clsinit_copy, \
-        ResourceState, ResourceFactory, reschedule_delay
+        ResourceState
 from nepi.resources.linux.application import LinuxApplication
 from nepi.util.timefuncs import tnow, tdiffsec
 from nepi.resources.netns.netnsemulation import NetNSEmulation
@@ -140,7 +140,7 @@ class LinuxNetNSEmulation(LinuxApplication, NetNSEmulation):
             self.debug("---- RESCHEDULING DEPLOY ---- node state %s " % self.node.state )
             
             # ccnd needs to wait until node is deployed and running
-            self.ec.schedule(reschedule_delay, self.deploy)
+            self.ec.schedule(self.reschedule_delay, self.deploy)
         else:
             if not self.get("command"):
                 self.set("command", self._start_command)
index 7092a67..e63a92e 100644 (file)
@@ -145,7 +145,7 @@ class LinuxNode(ResourceManager):
     _rtype = "linux::Node"
     _help = "Controls Linux host machines ( either localhost or a host " \
             "that can be accessed using a SSH key)"
-    _backend_type = "linux"
+    _platform = "linux"
 
     @classmethod
     def _register_attributes(cls):
index b012709..8eff5d5 100644 (file)
@@ -27,7 +27,6 @@ import os
 class LinuxRoute(LinuxApplication):
     _rtype = "linux::Route"
     _help = "Adds a route to the host using iptools "
-    _backend = "linux"
 
     @classmethod
     def _register_attributes(cls):
index 685db9e..d5c3d61 100644 (file)
@@ -32,7 +32,6 @@ PYTHON_VSYS_VERSION = "1.0"
 class LinuxTap(LinuxApplication):
     _rtype = "linux::Tap"
     _help = "Creates a TAP device on a Linux host"
-    _backend = "linux"
 
     IFF_TUN = 0x0001
     IFF_TAP = 0x0002
index b9537b1..22a5dea 100644 (file)
@@ -26,7 +26,6 @@ import os
 class LinuxTun(LinuxTap):
     _rtype = "linux::Tun"
     _help = "Creates a TUN device on a Linux host"
-    _backend = "linux"
 
     def __init__(self, ec, guid):
         super(LinuxTun, self).__init__(ec, guid)
index 961d50c..43c7f99 100644 (file)
@@ -30,7 +30,6 @@ state_check_delay = 0.5
 class LinuxTunnel(LinuxApplication):
     _rtype = "abstract::linux::Tunnel"
     _help = "Constructs a tunnel between two Linux endpoints"
-    _backend = "linux"
 
     def __init__(self, ec, guid):
         super(LinuxTunnel, self).__init__(ec, guid)
index 628f7b5..e0755bd 100644 (file)
@@ -31,7 +31,7 @@ import time
 class LinuxUdpTunnel(LinuxTunnel):
     _rtype = "linux::UdpTunnel"
     _help = "Constructs a tunnel between two Linux endpoints using a UDP connection "
-    _backend = "linux"
+    _platform = "linux"
 
     @classmethod
     def _register_attributes(cls):
index b790416..5ffff92 100644 (file)
 # Author: Alina Quereilhac <alina.quereilhac@inria.fr>
 
 from nepi.execution.attribute import Attribute, Flags, Types
-from nepi.execution.resource import clsinit_copy
 from nepi.resources.netns.netnsbase import NetNSBase
-from nepi.execution.resource import clsinit_copy, ResourceState, \
-        reschedule_delay
+from nepi.execution.resource import clsinit_copy, ResourceState
 
 import shlex
 
@@ -61,7 +59,7 @@ class NetNSApplication(NetNSBase):
     def do_start(self):
         if self.simulation.state < ResourceState.STARTED:
             self.debug("---- RESCHEDULING START ----" )
-            self.ec.schedule(reschedule_delay, self.start)
+            self.ec.schedule(self.reschedule_delay, self.start)
         else:
             self._configure_traces()
 
index 3221460..8dddc75 100644 (file)
 # Author: Alina Quereilhac <alina.quereilhac@inria.fr>
 
 from nepi.execution.resource import ResourceManager, clsinit_copy, \
-        ResourceState, reschedule_delay
+        ResourceState
 from nepi.execution.attribute import Flags
 from nepi.execution.trace import TraceAttr
 
 @clsinit_copy
 class NetNSBase(ResourceManager):
     _rtype = "abstract::netns::Object"
-    _backend_type = "netns"
+    _platform = "netns"
 
     def __init__(self, ec, guid):
         super(NetNSBase, self).__init__(ec, guid)
@@ -85,7 +85,7 @@ class NetNSBase(ResourceManager):
     def do_deploy(self):
         if self._wait_rms():
             self.debug("---- RESCHEDULING DEPLOY ----" )
-            self.ec.schedule(reschedule_delay, self.deploy)
+            self.ec.schedule(self.reschedule_delay, self.deploy)
         else:
             self.do_discover()
             self.do_provision()
index 3c4906f..9375176 100644 (file)
@@ -25,7 +25,7 @@ from nepi.execution.trace import TraceAttr
 @clsinit_copy
 class NS3Base(ResourceManager):
     _rtype = "abstract::ns3::Object"
-    _backend_type = "ns3"
+    _platform = "ns3"
 
     def __init__(self, ec, guid):
         super(NS3Base, self).__init__(ec, guid)
index 9b760e1..30482f1 100644 (file)
@@ -49,6 +49,7 @@ class OMFResource(ResourceManager):
     for OMF nodes, channels, applications, etc.
     """
     _rtype = "abstract::omf::Resource"
+    _platform = "omf"
 
     @classmethod
     def _register_attributes(cls):
index c29e853..4b6daa2 100644 (file)
@@ -38,7 +38,7 @@ class WilabtSfaNode(OMFNode):
     _rtype = "wilabt::sfa::Node"
     _help = "Controls a Wilabt host accessible using a SSH key " \
             "and provisioned using SFA"
-    _backend = "omf"
+    _platform = "omf"
 
     @classmethod
     def _register_attributes(cls):
index 01b8a85..6687a0f 100644 (file)
@@ -40,7 +40,7 @@ class PlanetlabNode(LinuxNode):
     _rtype = "planetlab::Node"
     _help = "Controls a PlanetLab host accessible using a SSH key " \
             "associated to a PlanetLab user account"
-    _backend = "planetlab"
+    _platform = "planetlab"
 
     lock = threading.Lock()
 
index 178b501..171750f 100644 (file)
@@ -41,7 +41,7 @@ class OVSSwitch(LinuxApplication):
 
     _rtype = "planetlab::OVSSwitch"
     _help = "Runs an OpenVSwitch on a PlanetLab host"
-    _backend = "planetlab"
+    _platform = "planetlab"
 
     _authorized_connections = ["planetlab::Node", "planetla::OVSPort", "linux::Node"]       
 
index db2609f..4d863d5 100644 (file)
@@ -42,7 +42,7 @@ class OVSPort(LinuxApplication):
     
     _rtype = "planetlab::OVSPort"
     _help = "Runs an OpenVSwitch on a PlanetLab host"
-    _backend = "planetlab"
+    _platform = "planetlab"
 
     _authorized_connections = ["planetlab::OVSSwitch", "linux::UdpTunnel", "linux::Tunnel"]      
 
index b2d3072..0fce837 100644 (file)
@@ -39,7 +39,7 @@ class PlanetlabSfaNode(LinuxNode):
     _rtype = "planetlab::sfa::Node"
     _help = "Controls a PlanetLab host accessible using a SSH key " \
             "and provisioned using SFA"
-    _backend = "planetlab"
+    _platform = "planetlab"
 
     @classmethod
     def _register_attributes(cls):
index 2f2975a..0066b90 100644 (file)
@@ -32,7 +32,7 @@ PYTHON_VSYS_VERSION = "1.0"
 class PlanetlabTap(LinuxApplication):
     _rtype = "planetlab::Tap"
     _help = "Creates a TAP device on a PlanetLab host"
-    _backend = "planetlab"
+    _platform = "planetlab"
 
     @classmethod
     def _register_attributes(cls):
index 6b4ff61..c5d5687 100644 (file)
@@ -26,7 +26,7 @@ import os
 class PlanetlabTun(PlanetlabTap):
     _rtype = "planetlab::Tun"
     _help = "Creates a TUN device on a PlanetLab host"
-    _backend = "planetlab"
+    _platform = "planetlab"
 
     def __init__(self, ec, guid):
         super(PlanetlabTun, self).__init__(ec, guid)
index b2568b3..699c639 100644 (file)
@@ -33,7 +33,7 @@ PYTHON_VSYS_VERSION = "1.0"
 class PlanetlabVroute(LinuxApplication):
     _rtype = "planetlab::Vroute"
     _help = "Creates a Vroute on a PlanetLab host"
-    _backend = "planetlab"
+    _platform = "planetlab"
 
     @classmethod
     def _register_attributes(cls):