""" 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
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):
_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):
_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):
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)
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,
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):
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
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)
_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):
class LinuxRoute(LinuxApplication):
_rtype = "linux::Route"
_help = "Adds a route to the host using iptools "
- _backend = "linux"
@classmethod
def _register_attributes(cls):
class LinuxTap(LinuxApplication):
_rtype = "linux::Tap"
_help = "Creates a TAP device on a Linux host"
- _backend = "linux"
IFF_TUN = 0x0001
IFF_TAP = 0x0002
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)
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)
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):
# 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
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()
# 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)
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()
@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)
for OMF nodes, channels, applications, etc.
"""
_rtype = "abstract::omf::Resource"
+ _platform = "omf"
@classmethod
def _register_attributes(cls):
_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):
_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()
_rtype = "planetlab::OVSSwitch"
_help = "Runs an OpenVSwitch on a PlanetLab host"
- _backend = "planetlab"
+ _platform = "planetlab"
_authorized_connections = ["planetlab::Node", "planetla::OVSPort", "linux::Node"]
_rtype = "planetlab::OVSPort"
_help = "Runs an OpenVSwitch on a PlanetLab host"
- _backend = "planetlab"
+ _platform = "planetlab"
_authorized_connections = ["planetlab::OVSSwitch", "linux::UdpTunnel", "linux::Tunnel"]
_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):
class PlanetlabTap(LinuxApplication):
_rtype = "planetlab::Tap"
_help = "Creates a TAP device on a PlanetLab host"
- _backend = "planetlab"
+ _platform = "planetlab"
@classmethod
def _register_attributes(cls):
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)
class PlanetlabVroute(LinuxApplication):
_rtype = "planetlab::Vroute"
_help = "Creates a Vroute on a PlanetLab host"
- _backend = "planetlab"
+ _platform = "planetlab"
@classmethod
def _register_attributes(cls):