mirror of
https://github.com/GNS3/gns3-server.git
synced 2025-01-18 07:23:47 +02:00
Fix exception with short names for Dynamips interfaces. Fixes #1386.
This commit is contained in:
parent
aeb33024ca
commit
59ce105a50
@ -33,8 +33,8 @@ class ATMPort(SerialPort):
|
|||||||
"""
|
"""
|
||||||
return "ATM"
|
return "ATM"
|
||||||
|
|
||||||
@property
|
@staticmethod
|
||||||
def short_name_type(self):
|
def short_name_type():
|
||||||
"""
|
"""
|
||||||
Returns the short name type for this port.
|
Returns the short name type for this port.
|
||||||
|
|
||||||
@ -42,10 +42,6 @@ class ATMPort(SerialPort):
|
|||||||
"""
|
"""
|
||||||
return "a"
|
return "a"
|
||||||
|
|
||||||
@property
|
|
||||||
def short_name(self):
|
|
||||||
return "{}".format(self._port_number)
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def data_link_types(self):
|
def data_link_types(self):
|
||||||
"""
|
"""
|
||||||
|
@ -39,8 +39,8 @@ class EthernetPort(Port):
|
|||||||
|
|
||||||
return "Ethernet"
|
return "Ethernet"
|
||||||
|
|
||||||
@property
|
@staticmethod
|
||||||
def short_name_type(self):
|
def short_name_type():
|
||||||
"""
|
"""
|
||||||
Returns the short name type for this port.
|
Returns the short name type for this port.
|
||||||
|
|
||||||
|
@ -34,8 +34,8 @@ class FastEthernetPort(Port):
|
|||||||
|
|
||||||
return "FastEthernet"
|
return "FastEthernet"
|
||||||
|
|
||||||
@property
|
@staticmethod
|
||||||
def short_name_type(self):
|
def short_name_type():
|
||||||
"""
|
"""
|
||||||
Returns the short name type for this port.
|
Returns the short name type for this port.
|
||||||
|
|
||||||
|
@ -34,10 +34,6 @@ class FrameRelayPort(SerialPort):
|
|||||||
|
|
||||||
return "FrameRelay"
|
return "FrameRelay"
|
||||||
|
|
||||||
@property
|
|
||||||
def short_name(self):
|
|
||||||
return "{}".format(self._port_number)
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def data_link_types(self):
|
def data_link_types(self):
|
||||||
"""
|
"""
|
||||||
|
@ -34,8 +34,8 @@ class GigabitEthernetPort(Port):
|
|||||||
|
|
||||||
return "GigabitEthernet"
|
return "GigabitEthernet"
|
||||||
|
|
||||||
@property
|
@staticmethod
|
||||||
def short_name_type(self):
|
def short_name_type():
|
||||||
"""
|
"""
|
||||||
Returns the short name type for this port.
|
Returns the short name type for this port.
|
||||||
|
|
||||||
|
@ -67,9 +67,9 @@ class Port:
|
|||||||
if self._short_name:
|
if self._short_name:
|
||||||
return self._short_name
|
return self._short_name
|
||||||
elif '/' in self._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)):
|
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
|
return self._name
|
||||||
|
|
||||||
@short_name.setter
|
@short_name.setter
|
||||||
|
@ -191,7 +191,7 @@ class DynamipsPortFactory:
|
|||||||
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.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") and properties[name]:
|
||||||
@ -200,7 +200,7 @@ class DynamipsPortFactory:
|
|||||||
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)
|
||||||
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)
|
ports.append(port)
|
||||||
display_wic_port_number += 1
|
display_wic_port_number += 1
|
||||||
wic_port_number += 1
|
wic_port_number += 1
|
||||||
|
@ -33,8 +33,8 @@ class POSPort(SerialPort):
|
|||||||
"""
|
"""
|
||||||
return "POS"
|
return "POS"
|
||||||
|
|
||||||
@property
|
@staticmethod
|
||||||
def short_name_type(self):
|
def short_name_type():
|
||||||
"""
|
"""
|
||||||
Returns the short name type for this port.
|
Returns the short name type for this port.
|
||||||
|
|
||||||
|
@ -34,8 +34,8 @@ class SerialPort(Port):
|
|||||||
|
|
||||||
return "Serial"
|
return "Serial"
|
||||||
|
|
||||||
@property
|
@staticmethod
|
||||||
def short_name_type(self):
|
def short_name_type():
|
||||||
"""
|
"""
|
||||||
Returns the short name type for this port.
|
Returns the short name type for this port.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user