mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-03 14:01:15 +02:00
Prevent connect a node to himself
Fix https://github.com/GNS3/gns3-gui/issues/1553
This commit is contained in:
7 files changed
+79
-7
No files matched your search
@@ -131,6 +131,22 @@ def test_add_node_cloud_to_cloud(async_run, project, compute):
|
||||
async_run(link.add_node(node2, 0, 4))
|
||||
|
||||
|
||||
def test_add_node_same_node(async_run, project, compute):
|
||||
"""
|
||||
Connection to the same node is not allowed
|
||||
"""
|
||||
node1 = Node(project, compute, "node1", node_type="qemu")
|
||||
node1._ports = [EthernetPort("E0", 0, 0, 4), EthernetPort("E1", 0, 0, 5)]
|
||||
|
||||
link = Link(project)
|
||||
link.create = AsyncioMagicMock()
|
||||
link._project.controller.notification.emit = MagicMock()
|
||||
|
||||
async_run(link.add_node(node1, 0, 4))
|
||||
with pytest.raises(aiohttp.web.HTTPConflict):
|
||||
async_run(link.add_node(node1, 0, 5))
|
||||
|
||||
|
||||
def test_add_node_serial_to_ethernet(async_run, project, compute):
|
||||
"""
|
||||
Serial to ethernet connection is not allowed
|
||||
|
||||
@@ -187,10 +187,15 @@ def test_capture(async_run, project):
|
||||
def test_read_pcap_from_source(project, async_run):
|
||||
compute1 = MagicMock()
|
||||
|
||||
node_vpcs = Node(project, compute1, "V1", node_type="vpcs")
|
||||
node_vpcs._ports = [EthernetPort("E0", 0, 0, 4)]
|
||||
node_iou = Node(project, compute1, "I1", node_type="iou")
|
||||
node_iou._ports = [EthernetPort("E0", 0, 3, 1)]
|
||||
|
||||
link = UDPLink(project)
|
||||
link.create = AsyncioMagicMock()
|
||||
async_run(link.add_node(compute1, 0, 4))
|
||||
async_run(link.add_node(compute1, 3, 1))
|
||||
async_run(link.add_node(node_vpcs, 0, 4))
|
||||
async_run(link.add_node(node_iou, 3, 1))
|
||||
|
||||
capture = async_run(link.start_capture())
|
||||
assert link._capture_node is not None
|
||||
|
||||
Reference in new issue
Block a user