From dc40b0296e8f32f16f74231f8bf820796f1f36e1 Mon Sep 17 00:00:00 2001 From: Julien Duponchelle Date: Mon, 23 Jan 2017 13:34:11 +0100 Subject: [PATCH] Correct link are not connected to the correct ethernet switch port after conversion Fix https://github.com/GNS3/gns3-gui/issues/1797 --- gns3server/controller/topology.py | 2 ++ .../1_5_builtins/after/builtins.gns3 | 18 +++++++++++++++++- .../1_5_builtins/before/builtins.gns3 | 10 ++++++++++ 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/gns3server/controller/topology.py b/gns3server/controller/topology.py index 7456a1bc..7842c536 100644 --- a/gns3server/controller/topology.py +++ b/gns3server/controller/topology.py @@ -341,6 +341,8 @@ def _convert_1_3_later(topo, topo_path): node_id_to_node_uuid[old_node["id"]] = node["node_id"] for port in old_node.get("ports", []): + if node["node_type"] in ("ethernet_hub", "ethernet_switch"): + port["port_number"] -= 1 ports[port["id"]] = port new_topo["topology"]["nodes"].append(node) diff --git a/tests/topologies/1_5_builtins/after/builtins.gns3 b/tests/topologies/1_5_builtins/after/builtins.gns3 index 643f69b2..581556da 100644 --- a/tests/topologies/1_5_builtins/after/builtins.gns3 +++ b/tests/topologies/1_5_builtins/after/builtins.gns3 @@ -14,7 +14,23 @@ } ], "drawings": [], - "links": [], + "links": [ + { + "link_id": "ANYUUID", + "nodes": [ + { + "port_number": 1, + "node_id": "ANYUUID", + "adapter_number": 0 + }, + { + "port_number": 1, + "node_id": "ANYUUID", + "adapter_number": 0 + } + ] + } + ], "nodes": [ { "compute_id": "local", diff --git a/tests/topologies/1_5_builtins/before/builtins.gns3 b/tests/topologies/1_5_builtins/before/builtins.gns3 index 24eac2a2..6f879f73 100644 --- a/tests/topologies/1_5_builtins/before/builtins.gns3 +++ b/tests/topologies/1_5_builtins/before/builtins.gns3 @@ -4,6 +4,16 @@ "project_id": "644e3892-4a50-4457-9601-2234d4842169", "revision": 4, "topology": { + "links": [ + { + "description": "", + "destination_node_id": 3, + "destination_port_id": 10, + "id": 1, + "source_node_id": 2, + "source_port_id": 2 + } + ], "nodes": [ { "description": "ATM switch",