From de1b539fb68fc49324fc7a2d0003f6b54c659932 Mon Sep 17 00:00:00 2001 From: Cristi Date: Tue, 17 Mar 2026 15:29:58 +0200 Subject: [PATCH] Enhancement Added link type support on the server side --- gns3server/schemas/controller/links.py | 3 +++ tests/controller/test_link.py | 37 ++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/gns3server/schemas/controller/links.py b/gns3server/schemas/controller/links.py index cdcf6047f..606d267af 100644 --- a/gns3server/schemas/controller/links.py +++ b/gns3server/schemas/controller/links.py @@ -47,6 +47,9 @@ class LinkStyle(BaseModel): color: Optional[str] = None width: Optional[int] = None type: Optional[int] = None + link_type: Optional[str] = None + bezier_curviness: Optional[int] = None + flowchart_roundness: Optional[int] = None class LinkBase(BaseModel): diff --git a/tests/controller/test_link.py b/tests/controller/test_link.py index 1448585e3..88091e12b 100644 --- a/tests/controller/test_link.py +++ b/tests/controller/test_link.py @@ -381,3 +381,40 @@ async def test_available_filters(project, compute): node2._ports = [EthernetPort("E0", 0, 0, 4)] await link.add_node(node2, 0, 4) assert len(link.available_filters()) > 0 + + +@pytest.mark.asyncio +async def test_update_link_style(project, compute): + + node1 = Node(project, compute, "node1", node_type="qemu") + node1._ports = [EthernetPort("E0", 0, 0, 4)] + node2 = Node(project, compute, "node2", node_type="qemu") + node2._ports = [EthernetPort("E0", 0, 1, 3)] + + link = Link(project) + link.create = AsyncioMagicMock() + link._project.emit_notification = MagicMock() + project.dump = MagicMock() + + await link.add_node(node1, 0, 4) + await link.add_node(node2, 1, 3) + + await link.update_link_style({ + "color": "#00ff00", + "width": 3, + "type": 1, + "link_type": "flowchart", + "bezier_curviness": 150, + "flowchart_roundness": 20, + }) + + assert link.asdict()["link_style"] == { + "color": "#00ff00", + "width": 3, + "type": 1, + "link_type": "flowchart", + "bezier_curviness": 150, + "flowchart_roundness": 20, + } + link._project.emit_notification.assert_called_with("link.updated", link.asdict()) + assert project.dump.called