From: Alina Quereilhac Date: Sat, 20 Dec 2014 01:36:02 +0000 (+0100) Subject: Replacing _backend for _platform class attribute in ResourceManager X-Git-Tag: nepi-3.2.0~33 X-Git-Url: http://git.onelab.eu/?p=nepi.git;a=commitdiff_plain;h=23d041fe2f0d9badf6d637009e2d42a4794325c1 Replacing _backend for _platform class attribute in ResourceManager --- diff --git a/src/nepi/execution/resource.py b/src/nepi/execution/resource.py index d868c262..f1669d09 100644 --- a/src/nepi/execution/resource.py +++ b/src/nepi/execution/resource.py @@ -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): diff --git a/src/nepi/resources/all/collector.py b/src/nepi/resources/all/collector.py index 6742fc80..4837feb6 100644 --- a/src/nepi/resources/all/collector.py +++ b/src/nepi/resources/all/collector.py @@ -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): diff --git a/src/nepi/resources/linux/application.py b/src/nepi/resources/linux/application.py index 861bf1e5..23108e54 100644 --- a/src/nepi/resources/linux/application.py +++ b/src/nepi/resources/linux/application.py @@ -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): diff --git a/src/nepi/resources/linux/channel.py b/src/nepi/resources/linux/channel.py index 2cd3573e..11361863 100644 --- a/src/nepi/resources/linux/channel.py +++ b/src/nepi/resources/linux/channel.py @@ -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) diff --git a/src/nepi/resources/linux/gretunnel.py b/src/nepi/resources/linux/gretunnel.py index 0d4962fa..0fcaa132 100644 --- a/src/nepi/resources/linux/gretunnel.py +++ b/src/nepi/resources/linux/gretunnel.py @@ -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, diff --git a/src/nepi/resources/linux/interface.py b/src/nepi/resources/linux/interface.py index af527b9b..b166d4c0 100644 --- a/src/nepi/resources/linux/interface.py +++ b/src/nepi/resources/linux/interface.py @@ -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): diff --git a/src/nepi/resources/linux/netns/netnsemulation.py b/src/nepi/resources/linux/netns/netnsemulation.py index c2d65d37..5d6aae43 100644 --- a/src/nepi/resources/linux/netns/netnsemulation.py +++ b/src/nepi/resources/linux/netns/netnsemulation.py @@ -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) diff --git a/src/nepi/resources/linux/node.py b/src/nepi/resources/linux/node.py index 7092a672..e63a92e9 100644 --- a/src/nepi/resources/linux/node.py +++ b/src/nepi/resources/linux/node.py @@ -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): diff --git a/src/nepi/resources/linux/route.py b/src/nepi/resources/linux/route.py index b0127097..8eff5d56 100644 --- a/src/nepi/resources/linux/route.py +++ b/src/nepi/resources/linux/route.py @@ -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): diff --git a/src/nepi/resources/linux/tap.py b/src/nepi/resources/linux/tap.py index 685db9ee..d5c3d619 100644 --- a/src/nepi/resources/linux/tap.py +++ b/src/nepi/resources/linux/tap.py @@ -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 diff --git a/src/nepi/resources/linux/tun.py b/src/nepi/resources/linux/tun.py index b9537b12..22a5dead 100644 --- a/src/nepi/resources/linux/tun.py +++ b/src/nepi/resources/linux/tun.py @@ -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) diff --git a/src/nepi/resources/linux/tunnel.py b/src/nepi/resources/linux/tunnel.py index 961d50c4..43c7f997 100644 --- a/src/nepi/resources/linux/tunnel.py +++ b/src/nepi/resources/linux/tunnel.py @@ -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) diff --git a/src/nepi/resources/linux/udptunnel.py b/src/nepi/resources/linux/udptunnel.py index 628f7b59..e0755bd1 100644 --- a/src/nepi/resources/linux/udptunnel.py +++ b/src/nepi/resources/linux/udptunnel.py @@ -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): diff --git a/src/nepi/resources/netns/netnsapplication.py b/src/nepi/resources/netns/netnsapplication.py index b7904166..5ffff92c 100644 --- a/src/nepi/resources/netns/netnsapplication.py +++ b/src/nepi/resources/netns/netnsapplication.py @@ -18,10 +18,8 @@ # Author: Alina Quereilhac 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() diff --git a/src/nepi/resources/netns/netnsbase.py b/src/nepi/resources/netns/netnsbase.py index 32214600..8dddc75c 100644 --- a/src/nepi/resources/netns/netnsbase.py +++ b/src/nepi/resources/netns/netnsbase.py @@ -18,14 +18,14 @@ # Author: Alina Quereilhac 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() diff --git a/src/nepi/resources/ns3/ns3base.py b/src/nepi/resources/ns3/ns3base.py index 3c4906f9..93751764 100644 --- a/src/nepi/resources/ns3/ns3base.py +++ b/src/nepi/resources/ns3/ns3base.py @@ -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) diff --git a/src/nepi/resources/omf/omf_resource.py b/src/nepi/resources/omf/omf_resource.py index 9b760e14..30482f1a 100644 --- a/src/nepi/resources/omf/omf_resource.py +++ b/src/nepi/resources/omf/omf_resource.py @@ -49,6 +49,7 @@ class OMFResource(ResourceManager): for OMF nodes, channels, applications, etc. """ _rtype = "abstract::omf::Resource" + _platform = "omf" @classmethod def _register_attributes(cls): diff --git a/src/nepi/resources/omf/wilabt_node.py b/src/nepi/resources/omf/wilabt_node.py index c29e8538..4b6daa20 100644 --- a/src/nepi/resources/omf/wilabt_node.py +++ b/src/nepi/resources/omf/wilabt_node.py @@ -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): diff --git a/src/nepi/resources/planetlab/node.py b/src/nepi/resources/planetlab/node.py index 01b8a859..6687a0fd 100644 --- a/src/nepi/resources/planetlab/node.py +++ b/src/nepi/resources/planetlab/node.py @@ -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() diff --git a/src/nepi/resources/planetlab/openvswitch/ovs.py b/src/nepi/resources/planetlab/openvswitch/ovs.py index 178b5013..171750fe 100644 --- a/src/nepi/resources/planetlab/openvswitch/ovs.py +++ b/src/nepi/resources/planetlab/openvswitch/ovs.py @@ -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"] diff --git a/src/nepi/resources/planetlab/openvswitch/ovsport.py b/src/nepi/resources/planetlab/openvswitch/ovsport.py index db2609fc..4d863d51 100644 --- a/src/nepi/resources/planetlab/openvswitch/ovsport.py +++ b/src/nepi/resources/planetlab/openvswitch/ovsport.py @@ -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"] diff --git a/src/nepi/resources/planetlab/sfa_node.py b/src/nepi/resources/planetlab/sfa_node.py index b2d30725..0fce8371 100644 --- a/src/nepi/resources/planetlab/sfa_node.py +++ b/src/nepi/resources/planetlab/sfa_node.py @@ -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): diff --git a/src/nepi/resources/planetlab/tap.py b/src/nepi/resources/planetlab/tap.py index 2f2975ac..0066b90f 100644 --- a/src/nepi/resources/planetlab/tap.py +++ b/src/nepi/resources/planetlab/tap.py @@ -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): diff --git a/src/nepi/resources/planetlab/tun.py b/src/nepi/resources/planetlab/tun.py index 6b4ff610..c5d56876 100644 --- a/src/nepi/resources/planetlab/tun.py +++ b/src/nepi/resources/planetlab/tun.py @@ -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) diff --git a/src/nepi/resources/planetlab/vroute.py b/src/nepi/resources/planetlab/vroute.py index b2568b3d..699c6391 100644 --- a/src/nepi/resources/planetlab/vroute.py +++ b/src/nepi/resources/planetlab/vroute.py @@ -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):