Added NIO TAP support

This commit is contained in:
Joe Bowen 2014-05-06 10:42:38 -06:00
parent a50c4c112e
commit 476a3c42b6
3 changed files with 21 additions and 24 deletions

View File

@ -182,13 +182,6 @@ class VPCS(IModule):
self._current_console_port = self._console_start_port_range
self._current_udp_port = self._udp_start_port_range
if self._VPCSrc and os.path.isfile(self._VPCSrc):
try:
log.info("deleting VPCSrc file {}".format(self._VPCSrc))
os.remove(self._VPCSrc)
except OSError as e:
log.warn("could not delete VPCSrc file {}: {}".format(self._VPCSrc, e))
log.info("VPCS module has been reset")
@IModule.route("VPCS.settings")

View File

@ -450,7 +450,11 @@ class VPCSDevice(object):
command.extend(["-s", str(nio.lport)])
command.extend(["-c", str(nio.rport)])
command.extend(["-t", str(nio.rhost)])
elif isinstance(nio, NIO_TAP):
# TAP interface
command.extend(["-e"]) #, str(nio.tap_device)]) #TODO: Fix, currently vpcs doesn't allow specific tap_device
command.extend(["-m", str(self._id)]) #The unique ID is used to set the mac address offset
if self._script_file:
command.extend([self._script_file])

View File

@ -1,29 +1,29 @@
from gns3server.modules.iou import IOUDevice
from gns3server.modules.vpcs import VPCSDevice
import os
import pytest
@pytest.fixture(scope="session")
def iou(request):
def vpcs(request):
cwd = os.path.dirname(os.path.abspath(__file__))
iou_path = os.path.join(cwd, "i86bi_linux-ipbase-ms-12.4.bin")
iou_device = IOUDevice(iou_path, "/tmp")
iou_device.start()
request.addfinalizer(iou_device.delete)
return iou_device
vpcs_path = os.path.join(cwd, "vpcs")
vpcs_device = VPCSDevice(vpcs_path, "/tmp")
vpcs_device.start()
request.addfinalizer(vpcs_device.delete)
return vpcs_device
def test_iou_is_started(iou):
def test_vpcs_is_started(vpcs):
print(iou.command())
assert iou.id == 1 # we should have only one IOU running!
assert iou.is_running()
print(vpcs.command())
assert vpcs.id == 1 # we should have only one VPCS running!
assert vpcs.is_running()
def test_iou_restart(iou):
def test_vpcs_restart(vpcs):
iou.stop()
assert not iou.is_running()
iou.start()
assert iou.is_running()
vpcs.stop()
assert not vpcs.is_running()
vpcs.start()
assert vpcs.is_running()