General work on the Dynamips backend (need to finish and polish).

This commit is contained in:
grossmj committed 2014-01-31 16:31:34 -07:00
1 parent 2516bf80a8
commit cef29e53aa
74 files changed
+2762 -433

No files matched your search

+8 -1
View File
@@ -22,6 +22,9 @@ http://github.com/GNS3/dynamips/blob/master/README.hypervisor#L451
from ..dynamips_error import DynamipsError
import logging
log = logging.getLogger(__name__)
class NIO(object):
"""
@@ -55,6 +58,7 @@ class NIO(object):
"""
self._hypervisor.send("nio delete {}".format(self._name))
log.info("NIO {name} has been deleted".format(name=self._name))
def rename(self, new_name):
"""
@@ -65,6 +69,9 @@ class NIO(object):
self._hypervisor.send("nio rename {name} {new_name}".format(name=self._name,
new_name=new_name))
log.info("NIO {name} renamed to {new_name}".format(name=self._name,
new_name=new_name))
self._name = new_name
def debug(self, debug):
@@ -197,7 +204,7 @@ class NIO(object):
def set_bandwidth(self, bandwidth):
"""
Set bandwidth constraint.
Sets bandwidth constraint.
:param bandwidth: bandwidth integer value (in Kb/s)
"""
@@ -21,6 +21,9 @@ Interface for FIFO NIOs.
from .nio import NIO
import logging
log = logging.getLogger(__name__)
class NIO_FIFO(NIO):
"""
@@ -42,6 +45,16 @@ class NIO_FIFO(NIO):
self._hypervisor.send("nio create_fifo {}".format(self._name))
log.info("NIO FIFO {name} created.".format(name=self._name))
@classmethod
def reset(cls):
"""
Reset the instance count.
"""
cls._instance_count = 0
def crossconnect(self, nio):
"""
Establishes a cross-connect between this FIFO NIO and another one.
@@ -51,3 +64,5 @@ class NIO_FIFO(NIO):
self._hypervisor.send("nio crossconnect_fifo {name} {nio}".format(name=self._name,
nio=nio))
log.info("NIO FIFO {name} crossconnected with {nio_name}.".format(name=self._name, nio_name=nio.name))
@@ -21,6 +21,9 @@ Interface for generic Ethernet NIOs (PCAP library).
from .nio import NIO
import logging
log = logging.getLogger(__name__)
class NIO_GenericEthernet(NIO):
"""
@@ -45,6 +48,17 @@ class NIO_GenericEthernet(NIO):
self._hypervisor.send("nio create_gen_eth {name} {eth_device}".format(name=self._name,
eth_device=ethernet_device))
log.info("NIO Generic Ethernet {name} created with device {device}".format(name=self._name,
device=ethernet_device))
@classmethod
def reset(cls):
"""
Reset the instance count.
"""
cls._instance_count = 0
@property
def ethernet_device(self):
"""
@@ -21,6 +21,9 @@ Interface for Linux Ethernet NIOs (Linux only).
from .nio import NIO
import logging
log = logging.getLogger(__name__)
class NIO_LinuxEthernet(NIO):
"""
@@ -45,6 +48,17 @@ class NIO_LinuxEthernet(NIO):
self._hypervisor.send("nio create_linux_eth {name} {eth_device}".format(name=self._name,
eth_device=ethernet_device))
log.info("NIO Linux Ethernet {name} created with device {device}".format(name=self._name,
device=ethernet_device))
@classmethod
def reset(cls):
"""
Reset the instance count.
"""
cls._instance_count = 0
@property
def ethernet_device(self):
"""
+16 -1
View File
@@ -21,6 +21,9 @@ Interface for multicast NIOs.
from .nio import NIO
import logging
log = logging.getLogger(__name__)
class NIO_Mcast(NIO):
"""
@@ -49,6 +52,18 @@ class NIO_Mcast(NIO):
mgroup=group,
mport=port))
log.info("NIO Multicast {name} created with mgroup={group}, mport={port}".format(name=self._name,
group=group,
port=port))
@classmethod
def reset(cls):
"""
Reset the instance count.
"""
cls._instance_count = 0
@property
def group(self):
"""
@@ -82,7 +97,7 @@ class NIO_Mcast(NIO):
@ttl.setter
def ttl(self, ttl):
"""
Set the TTL for the multicast address
Sets the TTL for the multicast address
:param ttl: TTL value
"""
@@ -21,6 +21,9 @@ Interface for dummy NIOs (mostly for tests).
from .nio import NIO
import logging
log = logging.getLogger(__name__)
class NIO_Null(NIO):
"""
@@ -41,3 +44,12 @@ class NIO_Null(NIO):
self._name = 'nio_null' + str(self._id)
self._hypervisor.send("nio create_null {}".format(self._name))
log.info("NIO NULL {name} created.".format(name=self._name))
@classmethod
def reset(cls):
"""
Reset the instance count.
"""
cls._instance_count = 0
@@ -21,6 +21,9 @@ Interface for TAP NIOs (UNIX based OSes only).
from .nio import NIO
import logging
log = logging.getLogger(__name__)
class NIO_TAP(NIO):
"""
@@ -45,6 +48,17 @@ class NIO_TAP(NIO):
self._hypervisor.send("nio create_tap {name} {tap}".format(name=self._name,
tap=tap_device))
log.info("NIO TAP {name} created with device {device}".format(name=self._name,
device=tap_device))
@classmethod
def reset(cls):
"""
Reset the instance count.
"""
cls._instance_count = 0
@property
def tap_device(self):
"""
@@ -21,6 +21,9 @@ Interface for UDP NIOs.
from .nio import NIO
import logging
log = logging.getLogger(__name__)
class NIO_UDP(NIO):
"""
@@ -51,6 +54,19 @@ class NIO_UDP(NIO):
rhost=rhost,
rport=rport))
log.info("NIO UDP {name} created with lport={lport}, rhost={rhost}, rport={rport}".format(name=self._name,
lport=lport,
rhost=rhost,
rport=rport))
@classmethod
def reset(cls):
"""
Reset the instance count.
"""
cls._instance_count = 0
@property
def lport(self):
"""
@@ -21,6 +21,9 @@ Interface for automatic UDP NIOs.
from .nio import NIO
import logging
log = logging.getLogger(__name__)
class NIO_UDP_auto(NIO):
"""
@@ -48,9 +51,22 @@ class NIO_UDP_auto(NIO):
laddr=laddr,
lport_start=lport_start,
lport_end=lport_end))[0])
log.info("NIO UDP AUTO {name} created with laddr={laddr}, lport_start={start}, lport_end={end}".format(name=self._name,
laddr=laddr,
start=lport_start,
end=lport_end))
self._raddr = None
self._rport = None
@classmethod
def reset(cls):
"""
Reset the instance count.
"""
cls._instance_count = 0
@property
def laddr(self):
"""
@@ -104,3 +120,7 @@ class NIO_UDP_auto(NIO):
rport=rport))
self._raddr = raddr
self._rport = rport
log.info("NIO UDP AUTO {name} connected to {raddr}:{rport}".format(name=self._name,
raddr=raddr,
rport=rport))
@@ -21,6 +21,9 @@ Interface for UNIX NIOs (Unix based OSes only).
from .nio import NIO
import logging
log = logging.getLogger(__name__)
class NIO_UNIX(NIO):
"""
@@ -48,6 +51,18 @@ class NIO_UNIX(NIO):
local=local_file,
remote=remote_file))
log.info("NIO UNIX {name} created with local file {local} and remote file {remote}".format(name=self._name,
local=local_file,
remote=remote_file))
@classmethod
def reset(cls):
"""
Reset the instance count.
"""
cls._instance_count = 0
@property
def local_file(self):
"""
@@ -21,6 +21,9 @@ Interface for VDE (Virtual Distributed Ethernet) NIOs (Unix based OSes only).
from .nio import NIO
import logging
log = logging.getLogger(__name__)
class NIO_VDE(NIO):
"""
@@ -48,6 +51,18 @@ class NIO_VDE(NIO):
control=control_file,
local=local_file))
log.info("NIO VDE {name} created with control={control}, local={local}".format(name=self._name,
control=control_file,
local=local_file))
@classmethod
def reset(cls):
"""
Reset the instance count.
"""
cls._instance_count = 0
@property
def control_file(self):
"""