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

Fix port numbering for Wic slot 1 & 2

This commit is contained in:
Julien Duponchelle 2017-05-12 14:12:24 +02:00
parent 19a6157f64
commit 5721dd3f30
No known key found for this signature in database
GPG Key ID: CE8B29639E07F5E8
2 changed files with 11 additions and 5 deletions

View File

@ -181,7 +181,9 @@ class DynamipsPortFactory:
ports = [] ports = []
adapter_number = 0 adapter_number = 0
wic_port_number = 16 wic_slot = 1
wic_port_number = wic_slot * 16
display_wic_port_number = 0
for name in sorted(properties.keys()): for name in sorted(properties.keys()):
if name.startswith("slot") and properties[name]: if name.startswith("slot") and properties[name]:
port_class = cls.ADAPTER_MATRIX[properties[name]]["port"] port_class = cls.ADAPTER_MATRIX[properties[name]]["port"]
@ -194,9 +196,13 @@ class DynamipsPortFactory:
port_class = cls.WIC_MATRIX[properties[name]]["port"] port_class = cls.WIC_MATRIX[properties[name]]["port"]
if port_class: if port_class:
for port_number in range(0, cls.WIC_MATRIX[properties[name]]["nb_ports"]): for port_number in range(0, cls.WIC_MATRIX[properties[name]]["nb_ports"]):
name = "{}{}/{}".format(port_class.long_name_type(), 0, wic_port_number - 16) name = "{}{}/{}".format(port_class.long_name_type(), 0, display_wic_port_number)
port = port_class(name, 0, 0, wic_port_number) port = port_class(name, 0, 0, wic_port_number)
port.short_name = "{}{}/{}".format(port.short_name_type, 0, wic_port_number - 16) port.short_name = "{}{}/{}".format(port.short_name_type, 0, display_wic_port_number)
ports.append(port) ports.append(port)
display_wic_port_number += 1
wic_port_number += 1 wic_port_number += 1
wic_slot += 1
wic_port_number = wic_slot * 16
return ports return ports

View File

@ -576,7 +576,7 @@ def test_list_ports_dynamips(project, compute):
"Cisco HDLC": "DLT_C_HDLC", "Cisco HDLC": "DLT_C_HDLC",
"Cisco PPP": "DLT_PPP_SERIAL", "Cisco PPP": "DLT_PPP_SERIAL",
"Frame Relay": "DLT_FRELAY"}, "Frame Relay": "DLT_FRELAY"},
"port_number": 18, "port_number": 32,
"adapter_number": 0, "adapter_number": 0,
"link_type": "serial" "link_type": "serial"
}, },
@ -587,7 +587,7 @@ def test_list_ports_dynamips(project, compute):
"Cisco HDLC": "DLT_C_HDLC", "Cisco HDLC": "DLT_C_HDLC",
"Cisco PPP": "DLT_PPP_SERIAL", "Cisco PPP": "DLT_PPP_SERIAL",
"Frame Relay": "DLT_FRELAY"}, "Frame Relay": "DLT_FRELAY"},
"port_number": 19, "port_number": 33,
"adapter_number": 0, "adapter_number": 0,
"link_type": "serial" "link_type": "serial"
} }