mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-05 23:01:15 +02:00
18 files changed
+184
-78
No files matched your search
@@ -19,43 +19,31 @@
|
||||
ATM port for ATM link end points.
|
||||
"""
|
||||
|
||||
from .port import Port
|
||||
from .serial_port import SerialPort
|
||||
|
||||
|
||||
class ATMPort(Port):
|
||||
class ATMPort(SerialPort):
|
||||
|
||||
@staticmethod
|
||||
def longNameType():
|
||||
def long_name_type():
|
||||
"""
|
||||
Returns the long name type for this port.
|
||||
|
||||
:returns: string
|
||||
"""
|
||||
|
||||
return "ATM"
|
||||
|
||||
@staticmethod
|
||||
def shortNameType():
|
||||
@property
|
||||
def short_name_type(self):
|
||||
"""
|
||||
Returns the short name type for this port.
|
||||
|
||||
:returns: string
|
||||
"""
|
||||
|
||||
return "a"
|
||||
|
||||
@staticmethod
|
||||
def linkType():
|
||||
"""
|
||||
Returns the link type to be used to connect this port.
|
||||
|
||||
:returns: string
|
||||
"""
|
||||
|
||||
return "Serial"
|
||||
|
||||
@staticmethod
|
||||
def dataLinkTypes():
|
||||
@property
|
||||
def data_link_types(self):
|
||||
"""
|
||||
Returns the supported PCAP DLTs.
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ class EthernetPort(Port):
|
||||
"""
|
||||
|
||||
@staticmethod
|
||||
def longNameType():
|
||||
def long_name_type():
|
||||
"""
|
||||
Returns the long name type for this port.
|
||||
|
||||
@@ -39,8 +39,8 @@ class EthernetPort(Port):
|
||||
|
||||
return "Ethernet"
|
||||
|
||||
@staticmethod
|
||||
def shortNameType():
|
||||
@property
|
||||
def short_name_type(self):
|
||||
"""
|
||||
Returns the short name type for this port.
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ from .port import Port
|
||||
class FastEthernetPort(Port):
|
||||
|
||||
@staticmethod
|
||||
def longNameType():
|
||||
def long_name_type():
|
||||
"""
|
||||
Returns the long name type for this port.
|
||||
|
||||
@@ -34,8 +34,8 @@ class FastEthernetPort(Port):
|
||||
|
||||
return "FastEthernet"
|
||||
|
||||
@staticmethod
|
||||
def shortNameType():
|
||||
@property
|
||||
def short_name_type(self):
|
||||
"""
|
||||
Returns the short name type for this port.
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ from .serial_port import SerialPort
|
||||
class FrameRelayPort(SerialPort):
|
||||
|
||||
@staticmethod
|
||||
def longNameType():
|
||||
def long_name_type():
|
||||
"""
|
||||
Returns the long name type for this port.
|
||||
|
||||
@@ -34,8 +34,8 @@ class FrameRelayPort(SerialPort):
|
||||
|
||||
return "FrameRelay"
|
||||
|
||||
@staticmethod
|
||||
def dataLinkTypes():
|
||||
@property
|
||||
def data_link_types(self):
|
||||
"""
|
||||
Returns the supported PCAP DLTs.
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ from .port import Port
|
||||
class GigabitEthernetPort(Port):
|
||||
|
||||
@staticmethod
|
||||
def longNameType():
|
||||
def long_name_type():
|
||||
"""
|
||||
Returns the long name type for this port.
|
||||
|
||||
@@ -34,8 +34,8 @@ class GigabitEthernetPort(Port):
|
||||
|
||||
return "GigabitEthernet"
|
||||
|
||||
@staticmethod
|
||||
def shortNameType():
|
||||
@property
|
||||
def short_name_type(self):
|
||||
"""
|
||||
Returns the short name type for this port.
|
||||
|
||||
|
||||
@@ -27,8 +27,16 @@ class Port:
|
||||
self._port_number = port_number
|
||||
self._name = name
|
||||
|
||||
@staticmethod
|
||||
def dataLinkTypes():
|
||||
@property
|
||||
def adapter_number(self):
|
||||
return self._adapter_number
|
||||
|
||||
@property
|
||||
def port_number(self):
|
||||
return self._port_number
|
||||
|
||||
@property
|
||||
def data_link_types(self):
|
||||
"""
|
||||
Returns the supported PCAP DLTs.
|
||||
|
||||
@@ -36,16 +44,16 @@ class Port:
|
||||
"""
|
||||
return {"Ethernet": "DLT_EN10MB"}
|
||||
|
||||
@staticmethod
|
||||
def linkType():
|
||||
return "Ethernet"
|
||||
@property
|
||||
def link_type(self):
|
||||
return "ethernet"
|
||||
|
||||
def __json__(self):
|
||||
return {
|
||||
"name": self._name,
|
||||
"short_name": self.shortNameType() + "{}/{}".format(self._interface_number, self._port_number),
|
||||
"data_link_types": self.dataLinkTypes(),
|
||||
"short_name": self.short_name_type + "{}/{}".format(self._interface_number, self._port_number),
|
||||
"data_link_types": self.data_link_types,
|
||||
"port_number": self._port_number,
|
||||
"adapter_number": self._adapter_number,
|
||||
"link_type": self.linkType().lower()
|
||||
"link_type": self.link_type
|
||||
}
|
||||
@@ -183,7 +183,7 @@ class DynamipsPortFactory:
|
||||
interface_numbers.setdefault(port_class, 0)
|
||||
interface_number = interface_numbers[port_class]
|
||||
for port_number in range(0, cls.ADAPTER_MATRIX[properties[name]]["nb_ports"]):
|
||||
name = "{}{}/{}".format(port_class.longNameType(), interface_number, port_number)
|
||||
name = "{}{}/{}".format(port_class.long_name_type(), interface_number, port_number)
|
||||
ports.append(port_class(name, interface_number, adapter_number, port_number))
|
||||
interface_numbers[port_class] += 1
|
||||
adapter_number += 1
|
||||
@@ -191,7 +191,7 @@ class DynamipsPortFactory:
|
||||
port_class = cls.WIC_MATRIX[properties[name]]["port"]
|
||||
if port_class:
|
||||
for port_number in range(0, cls.WIC_MATRIX[properties[name]]["nb_ports"]):
|
||||
name = "{}{}/{}".format(port_class.longNameType(), 0, wic_port_number)
|
||||
name = "{}{}/{}".format(port_class.long_name_type(), 0, wic_port_number)
|
||||
ports.append(port_class(name, 0, 0, wic_port_number))
|
||||
wic_port_number += 1
|
||||
return ports
|
||||
@@ -19,43 +19,31 @@
|
||||
POS port for Packet over SONET link end points.
|
||||
"""
|
||||
|
||||
from .port import Port
|
||||
from .serial_port import SerialPort
|
||||
|
||||
|
||||
class POSPort(Port):
|
||||
class POSPort(SerialPort):
|
||||
|
||||
@staticmethod
|
||||
def longNameType():
|
||||
def long_name_type():
|
||||
"""
|
||||
Returns the long name type for this port.
|
||||
|
||||
:returns: string
|
||||
"""
|
||||
|
||||
return "POS"
|
||||
|
||||
@staticmethod
|
||||
def shortNameType():
|
||||
@property
|
||||
def short_name_type(self):
|
||||
"""
|
||||
Returns the short name type for this port.
|
||||
|
||||
:returns: string
|
||||
"""
|
||||
|
||||
return "p"
|
||||
|
||||
@staticmethod
|
||||
def linkType():
|
||||
"""
|
||||
Returns the link type to be used to connect this port.
|
||||
|
||||
:returns: string
|
||||
"""
|
||||
|
||||
return "Serial"
|
||||
|
||||
@staticmethod
|
||||
def dataLinkTypes():
|
||||
@property
|
||||
def data_link_types(self):
|
||||
"""
|
||||
Returns the supported PCAP DLTs.
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ from .port import Port
|
||||
class SerialPort(Port):
|
||||
|
||||
@staticmethod
|
||||
def longNameType():
|
||||
def long_name_type():
|
||||
"""
|
||||
Returns the long name type for this port.
|
||||
|
||||
@@ -34,8 +34,8 @@ class SerialPort(Port):
|
||||
|
||||
return "Serial"
|
||||
|
||||
@staticmethod
|
||||
def shortNameType():
|
||||
@property
|
||||
def short_name_type(self):
|
||||
"""
|
||||
Returns the short name type for this port.
|
||||
|
||||
@@ -44,18 +44,18 @@ class SerialPort(Port):
|
||||
|
||||
return "s"
|
||||
|
||||
@staticmethod
|
||||
def linkType():
|
||||
@property
|
||||
def link_type(self):
|
||||
"""
|
||||
Returns the link type to be used to connect this port.
|
||||
|
||||
:returns: string
|
||||
"""
|
||||
|
||||
return "Serial"
|
||||
return "serial"
|
||||
|
||||
@staticmethod
|
||||
def dataLinkTypes():
|
||||
@property
|
||||
def data_link_types(self):
|
||||
"""
|
||||
Returns the supported PCAP DLTs.
|
||||
|
||||
|
||||
Reference in new issue
Block a user