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