mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-24 17:28:08 +00:00
Fix incorrect short port names in topology summary. Fixes https://github.com/GNS3/gns3-gui/issues/2562
This commit is contained in:
parent
12e71a2917
commit
e5d38811ca
@ -63,12 +63,12 @@ class Port:
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def short_name(self):
|
def short_name(self):
|
||||||
# If port name format has change we use the port name as the short name (1.X behavior)
|
# If port name format has changed we use the port name as the short name (1.X behavior)
|
||||||
if self._short_name:
|
if self._short_name:
|
||||||
return self._short_name
|
return self._short_name
|
||||||
elif not self._name.startswith("{}{}".format(self.long_name_type(), self._interface_number)):
|
elif '/' in self._name:
|
||||||
return self._name
|
return self.short_name_type + "{}/{}".format(self._interface_number, self._port_number)
|
||||||
return self.short_name_type + "{}/{}".format(self._interface_number, self._port_number)
|
return self._name
|
||||||
|
|
||||||
@short_name.setter
|
@short_name.setter
|
||||||
def short_name(self, val):
|
def short_name(self, val):
|
||||||
|
@ -64,7 +64,7 @@ class StandardPortFactory:
|
|||||||
for port_number in range(0, port_by_adapter):
|
for port_number in range(0, port_by_adapter):
|
||||||
if first_port_name and adapter_number == 0:
|
if first_port_name and adapter_number == 0:
|
||||||
port_name = first_port_name
|
port_name = first_port_name
|
||||||
port = PortFactory(port_name, segment_number, adapter_number, port_number, "ethernet")
|
port = PortFactory(port_name, segment_number, adapter_number, port_number, "ethernet", short_name=first_port_name)
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
port_name = port_name_format.format(
|
port_name = port_name_format.format(
|
||||||
@ -190,7 +190,9 @@ class DynamipsPortFactory:
|
|||||||
if port_class:
|
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)
|
||||||
ports.append(port_class(name, adapter_number, adapter_number, port_number))
|
port = port_class(name, adapter_number, adapter_number, port_number)
|
||||||
|
port.short_name = "{}{}/{}".format(port.short_name_type, adapter_number, port_number)
|
||||||
|
ports.append(port)
|
||||||
adapter_number += 1
|
adapter_number += 1
|
||||||
elif name.startswith("wic") and properties[name]:
|
elif name.startswith("wic") and properties[name]:
|
||||||
port_class = cls.WIC_MATRIX[properties[name]]["port"]
|
port_class = cls.WIC_MATRIX[properties[name]]["port"]
|
||||||
|
Loading…
Reference in New Issue
Block a user