diff --git a/gns3server/compute/dynamips/nodes/ethernet_hub.py b/gns3server/compute/dynamips/nodes/ethernet_hub.py index e2377b50..df811e7e 100644 --- a/gns3server/compute/dynamips/nodes/ethernet_hub.py +++ b/gns3server/compute/dynamips/nodes/ethernet_hub.py @@ -49,7 +49,7 @@ class EthernetHub(Bridge): if ports is None: # create 8 ports by default self._ports = [] - for port_number in range(1, 9): + for port_number in range(0, 8): self._ports.append({"port_number": port_number, "name": "Ethernet{}".format(port_number)}) else: diff --git a/gns3server/compute/dynamips/nodes/ethernet_switch.py b/gns3server/compute/dynamips/nodes/ethernet_switch.py index 298d718e..482e8bc3 100644 --- a/gns3server/compute/dynamips/nodes/ethernet_switch.py +++ b/gns3server/compute/dynamips/nodes/ethernet_switch.py @@ -52,7 +52,7 @@ class EthernetSwitch(Device): if ports is None: # create 8 ports by default self._ports = [] - for port_number in range(1, 9): + for port_number in range(0, 8): self._ports.append({"port_number": port_number, "name": "Ethernet{}".format(port_number), "type": "access", diff --git a/gns3server/controller/topology.py b/gns3server/controller/topology.py index 1ea40cb3..b94dcff5 100644 --- a/gns3server/controller/topology.py +++ b/gns3server/controller/topology.py @@ -204,8 +204,8 @@ def _convert_1_3_later(topo, topo_path): node["properties"]["ports_mapping"] = [] for port in old_node["ports"]: node["properties"]["ports_mapping"].append({ - "name": "Ethernet{}".format(port["port_number"]), - "port_number": port["port_number"] + "name": "Ethernet{}".format(port["port_number"] - 1), + "port_number": port["port_number"] - 1 }) elif old_node["type"] == "EthernetSwitch": node["node_type"] = "ethernet_switch" @@ -214,8 +214,8 @@ def _convert_1_3_later(topo, topo_path): node["properties"]["ports_mapping"] = [] for port in old_node["ports"]: node["properties"]["ports_mapping"].append({ - "name": "Ethernet{}".format(port["port_number"]), - "port_number": port["port_number"], + "name": "Ethernet{}".format(port["port_number"] - 1), + "port_number": port["port_number"] - 1, "type": port["type"], "vlan": port["vlan"] }) diff --git a/tests/topologies/1_5_builtins/after/builtins.gns3 b/tests/topologies/1_5_builtins/after/builtins.gns3 index 0c0c5f22..7cdf6b1c 100644 --- a/tests/topologies/1_5_builtins/after/builtins.gns3 +++ b/tests/topologies/1_5_builtins/after/builtins.gns3 @@ -62,6 +62,10 @@ "first_port_name": null, "properties": { "ports_mapping": [ + { + "name": "Ethernet0", + "port_number": 0 + }, { "name": "Ethernet1", "port_number": 1 @@ -89,10 +93,6 @@ { "name": "Ethernet7", "port_number": 7 - }, - { - "name": "Ethernet8", - "port_number": 8 } ] }, @@ -120,6 +120,12 @@ "first_port_name": null, "properties": { "ports_mapping": [ + { + "name": "Ethernet0", + "port_number": 0, + "type": "access", + "vlan": 1 + }, { "name": "Ethernet1", "port_number": 1, @@ -161,12 +167,6 @@ "port_number": 7, "type": "access", "vlan": 1 - }, - { - "name": "Ethernet8", - "port_number": 8, - "type": "access", - "vlan": 1 } ] },