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

Fix issue when cannot skip slots for Dynamips routers. Fixes https://github.com/GNS3/gns3-gui/issues/3000

This commit is contained in:
grossmj 2020-06-29 20:00:30 +09:30
parent 850c30f958
commit ea17cc2565

View File

@ -197,24 +197,23 @@ class DynamipsPortFactory:
def __new__(cls, properties): def __new__(cls, properties):
ports = [] ports = []
adapter_number = 0 adapter_number = 0
wic_slot = 1 wic_slot = 1
wic_port_number = wic_slot * 16 wic_port_number = wic_slot * 16
display_wic_port_number = 0 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"):
port_class = cls.ADAPTER_MATRIX[properties[name]]["port"] if properties[name]:
if port_class: port_class = cls.ADAPTER_MATRIX[properties[name]]["port"]
for port_number in range(0, cls.ADAPTER_MATRIX[properties[name]]["nb_ports"]): for port_number in range(0, cls.ADAPTER_MATRIX[properties[name]]["nb_ports"]):
name = "{}{}/{}".format(port_class.long_name_type(), adapter_number, port_number) name = "{}{}/{}".format(port_class.long_name_type(), adapter_number, port_number)
port = port_class(name, adapter_number, adapter_number, port_number) port = port_class(name, adapter_number, adapter_number, port_number)
port.short_name = "{}{}/{}".format(port_class.short_name_type(), adapter_number, port_number) port.short_name = "{}{}/{}".format(port_class.short_name_type(), adapter_number, port_number)
ports.append(port) ports.append(port)
adapter_number += 1 adapter_number += 1
elif name.startswith("wic") and properties[name]: elif name.startswith("wic"):
port_class = cls.WIC_MATRIX[properties[name]]["port"] if properties[name]:
if port_class: port_class = cls.WIC_MATRIX[properties[name]]["port"]
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, display_wic_port_number) 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)
@ -222,7 +221,7 @@ class DynamipsPortFactory:
ports.append(port) ports.append(port)
display_wic_port_number += 1 display_wic_port_number += 1
wic_port_number += 1 wic_port_number += 1
wic_slot += 1 wic_slot += 1
wic_port_number = wic_slot * 16 wic_port_number = wic_slot * 16
return ports return ports