diff --git a/gns3server/controller/ports/port_factory.py b/gns3server/controller/ports/port_factory.py index 3b7547ae..5f8e27c1 100644 --- a/gns3server/controller/ports/port_factory.py +++ b/gns3server/controller/ports/port_factory.py @@ -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