mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-30 20:28:08 +00:00
Added NIO TAP support
This commit is contained in:
parent
a50c4c112e
commit
476a3c42b6
@ -182,13 +182,6 @@ class VPCS(IModule):
|
|||||||
self._current_console_port = self._console_start_port_range
|
self._current_console_port = self._console_start_port_range
|
||||||
self._current_udp_port = self._udp_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")
|
log.info("VPCS module has been reset")
|
||||||
|
|
||||||
@IModule.route("VPCS.settings")
|
@IModule.route("VPCS.settings")
|
||||||
|
@ -451,6 +451,10 @@ class VPCSDevice(object):
|
|||||||
command.extend(["-c", str(nio.rport)])
|
command.extend(["-c", str(nio.rport)])
|
||||||
command.extend(["-t", str(nio.rhost)])
|
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
|
command.extend(["-m", str(self._id)]) #The unique ID is used to set the mac address offset
|
||||||
if self._script_file:
|
if self._script_file:
|
||||||
command.extend([self._script_file])
|
command.extend([self._script_file])
|
||||||
|
@ -1,29 +1,29 @@
|
|||||||
from gns3server.modules.iou import IOUDevice
|
from gns3server.modules.vpcs import VPCSDevice
|
||||||
import os
|
import os
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(scope="session")
|
@pytest.fixture(scope="session")
|
||||||
def iou(request):
|
def vpcs(request):
|
||||||
|
|
||||||
cwd = os.path.dirname(os.path.abspath(__file__))
|
cwd = os.path.dirname(os.path.abspath(__file__))
|
||||||
iou_path = os.path.join(cwd, "i86bi_linux-ipbase-ms-12.4.bin")
|
vpcs_path = os.path.join(cwd, "vpcs")
|
||||||
iou_device = IOUDevice(iou_path, "/tmp")
|
vpcs_device = VPCSDevice(vpcs_path, "/tmp")
|
||||||
iou_device.start()
|
vpcs_device.start()
|
||||||
request.addfinalizer(iou_device.delete)
|
request.addfinalizer(vpcs_device.delete)
|
||||||
return iou_device
|
return vpcs_device
|
||||||
|
|
||||||
|
|
||||||
def test_iou_is_started(iou):
|
def test_vpcs_is_started(vpcs):
|
||||||
|
|
||||||
print(iou.command())
|
print(vpcs.command())
|
||||||
assert iou.id == 1 # we should have only one IOU running!
|
assert vpcs.id == 1 # we should have only one VPCS running!
|
||||||
assert iou.is_running()
|
assert vpcs.is_running()
|
||||||
|
|
||||||
|
|
||||||
def test_iou_restart(iou):
|
def test_vpcs_restart(vpcs):
|
||||||
|
|
||||||
iou.stop()
|
vpcs.stop()
|
||||||
assert not iou.is_running()
|
assert not vpcs.is_running()
|
||||||
iou.start()
|
vpcs.start()
|
||||||
assert iou.is_running()
|
assert vpcs.is_running()
|
||||||
|
Loading…
Reference in New Issue
Block a user