1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-11-12 19:38:57 +00:00

Fix exception with short names for Dynamips interfaces. Fixes #1386.

This commit is contained in:
grossmj 2018-08-21 19:46:14 +07:00
parent aeb33024ca
commit 59ce105a50
9 changed files with 16 additions and 24 deletions

View File

@ -33,8 +33,8 @@ class ATMPort(SerialPort):
"""
return "ATM"
@property
def short_name_type(self):
@staticmethod
def short_name_type():
"""
Returns the short name type for this port.
@ -42,10 +42,6 @@ class ATMPort(SerialPort):
"""
return "a"
@property
def short_name(self):
return "{}".format(self._port_number)
@property
def data_link_types(self):
"""

View File

@ -39,8 +39,8 @@ class EthernetPort(Port):
return "Ethernet"
@property
def short_name_type(self):
@staticmethod
def short_name_type():
"""
Returns the short name type for this port.

View File

@ -34,8 +34,8 @@ class FastEthernetPort(Port):
return "FastEthernet"
@property
def short_name_type(self):
@staticmethod
def short_name_type():
"""
Returns the short name type for this port.

View File

@ -34,10 +34,6 @@ class FrameRelayPort(SerialPort):
return "FrameRelay"
@property
def short_name(self):
return "{}".format(self._port_number)
@property
def data_link_types(self):
"""

View File

@ -34,8 +34,8 @@ class GigabitEthernetPort(Port):
return "GigabitEthernet"
@property
def short_name_type(self):
@staticmethod
def short_name_type():
"""
Returns the short name type for this port.

View File

@ -67,9 +67,9 @@ class Port:
if self._short_name:
return self._short_name
elif '/' in self._name:
return self._name.replace(self.long_name_type(), self.short_name_type)
return self._name.replace(self.long_name_type(), self.short_name_type())
elif self._name.startswith("{}{}".format(self.long_name_type(), self._interface_number)):
return self.short_name_type + "{}".format(self._interface_number)
return self.short_name_type() + "{}".format(self._interface_number)
return self._name
@short_name.setter

View File

@ -191,7 +191,7 @@ class DynamipsPortFactory:
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.short_name_type, 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]:
@ -200,7 +200,7 @@ class DynamipsPortFactory:
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)
port.short_name = "{}{}/{}".format(port.short_name_type, 0, display_wic_port_number)
port.short_name = "{}{}/{}".format(port_class.short_name_type(), 0, display_wic_port_number)
ports.append(port)
display_wic_port_number += 1
wic_port_number += 1

View File

@ -33,8 +33,8 @@ class POSPort(SerialPort):
"""
return "POS"
@property
def short_name_type(self):
@staticmethod
def short_name_type():
"""
Returns the short name type for this port.

View File

@ -34,8 +34,8 @@ class SerialPort(Port):
return "Serial"
@property
def short_name_type(self):
@staticmethod
def short_name_type():
"""
Returns the short name type for this port.