1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-11-24 17:28: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"):
if properties[name]:
port_class = cls.ADAPTER_MATRIX[properties[name]]["port"] port_class = cls.ADAPTER_MATRIX[properties[name]]["port"]
if port_class:
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"):
if properties[name]:
port_class = cls.WIC_MATRIX[properties[name]]["port"] port_class = cls.WIC_MATRIX[properties[name]]["port"]
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, 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)