1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-11-28 11:18:11 +00:00

Fix Serial interface not available for IOU

Fix https://github.com/GNS3/gns3-gui/issues/1512
This commit is contained in:
Julien Duponchelle 2016-09-15 11:49:41 +02:00
parent ba148df159
commit 5d12a91268
No known key found for this signature in database
GPG Key ID: CE8B29639E07F5E8
2 changed files with 25 additions and 17 deletions

View File

@ -51,7 +51,7 @@ class StandardPortFactory:
"""
def __new__(cls, properties, port_by_adapter, first_port_name, port_name_format, port_segment_size):
ports = []
interface_number = segment_number = 0
adapter_number = interface_number = segment_number = 0
if "serial_adapters" in properties:
for adapter_number in range(0, properties["serial_adapters"]):
for port_number in range(0, port_by_adapter):
@ -62,22 +62,30 @@ class StandardPortFactory:
else:
ethernet_adapters = properties.get("adapters", 1)
for adapter_number in range(0, ethernet_adapters):
if len(ports):
adapter_number += 1
for adapter_number in range(adapter_number, ethernet_adapters + adapter_number):
for port_number in range(0, port_by_adapter):
if first_port_name and adapter_number == 0:
port_name = first_port_name
port = PortFactory(port_name, segment_number, adapter_number, port_number, "ethernet")
else:
port_name = port_name_format.format(
interface_number,
segment_number,
adapter=adapter_number,
**cls._generate_replacement(interface_number, segment_number))
port = PortFactory(port_name, segment_number, adapter_number, port_number, "ethernet")
interface_number += 1
if port_segment_size and interface_number % port_segment_size == 0:
if port_segment_size:
if interface_number % port_segment_size == 0:
segment_number += 1
interface_number = 0
else:
segment_number += 1
interface_number = 0
ports.append(PortFactory(port_name, adapter_number, adapter_number, port_number, "ethernet"))
ports.append(port)
return ports
@staticmethod

View File

@ -268,7 +268,7 @@ def test_list_ports_iou(compute, project):
"short_name": "e0/0",
"data_link_types": {"Ethernet": "DLT_EN10MB"},
"port_number": 0,
"adapter_number": 0,
"adapter_number": 2,
"link_type": "ethernet"
},
{
@ -276,7 +276,7 @@ def test_list_ports_iou(compute, project):
"short_name": "e0/1",
"data_link_types": {"Ethernet": "DLT_EN10MB"},
"port_number": 1,
"adapter_number": 0,
"adapter_number": 2,
"link_type": "ethernet"
},
{
@ -284,7 +284,7 @@ def test_list_ports_iou(compute, project):
"short_name": "e0/2",
"data_link_types": {"Ethernet": "DLT_EN10MB"},
"port_number": 2,
"adapter_number": 0,
"adapter_number": 2,
"link_type": "ethernet"
},
{
@ -292,7 +292,7 @@ def test_list_ports_iou(compute, project):
"short_name": "e0/3",
"data_link_types": {"Ethernet": "DLT_EN10MB"},
"port_number": 3,
"adapter_number": 0,
"adapter_number": 2,
"link_type": "ethernet"
},
{
@ -300,7 +300,7 @@ def test_list_ports_iou(compute, project):
"short_name": "e1/0",
"data_link_types": {"Ethernet": "DLT_EN10MB"},
"port_number": 0,
"adapter_number": 1,
"adapter_number": 3,
"link_type": "ethernet"
},
{
@ -308,7 +308,7 @@ def test_list_ports_iou(compute, project):
"short_name": "e1/1",
"data_link_types": {"Ethernet": "DLT_EN10MB"},
"port_number": 1,
"adapter_number": 1,
"adapter_number": 3,
"link_type": "ethernet"
},
{
@ -316,7 +316,7 @@ def test_list_ports_iou(compute, project):
"short_name": "e1/2",
"data_link_types": {"Ethernet": "DLT_EN10MB"},
"port_number": 2,
"adapter_number": 1,
"adapter_number": 3,
"link_type": "ethernet"
},
{
@ -324,7 +324,7 @@ def test_list_ports_iou(compute, project):
"short_name": "e1/3",
"data_link_types": {"Ethernet": "DLT_EN10MB"},
"port_number": 3,
"adapter_number": 1,
"adapter_number": 3,
"link_type": "ethernet"
},
{
@ -332,7 +332,7 @@ def test_list_ports_iou(compute, project):
"short_name": "e2/0",
"data_link_types": {"Ethernet": "DLT_EN10MB"},
"port_number": 0,
"adapter_number": 2,
"adapter_number": 4,
"link_type": "ethernet"
},
{
@ -340,7 +340,7 @@ def test_list_ports_iou(compute, project):
"short_name": "e2/1",
"data_link_types": {"Ethernet": "DLT_EN10MB"},
"port_number": 1,
"adapter_number": 2,
"adapter_number": 4,
"link_type": "ethernet"
},
{
@ -348,7 +348,7 @@ def test_list_ports_iou(compute, project):
"short_name": "e2/2",
"data_link_types": {"Ethernet": "DLT_EN10MB"},
"port_number": 2,
"adapter_number": 2,
"adapter_number": 4,
"link_type": "ethernet"
},
{
@ -356,7 +356,7 @@ def test_list_ports_iou(compute, project):
"short_name": "e2/3",
"data_link_types": {"Ethernet": "DLT_EN10MB"},
"port_number": 3,
"adapter_number": 2,
"adapter_number": 4,
"link_type": "ethernet"
}
]