mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-04 14:31:13 +02:00
refactor: ruff autofixes
This commit is contained in:
455 files changed
+12322
-14762
No files matched your search
@@ -50,6 +50,5 @@ class ATMSwitchUpdate(ATMSwitchBase):
|
||||
|
||||
|
||||
class ATMSwitch(ATMSwitchBase):
|
||||
|
||||
project_id: UUID
|
||||
status: Optional[NodeStatus] = None
|
||||
@@ -23,19 +23,16 @@ from ..common import NodeStatus
|
||||
|
||||
|
||||
class HostInterfaceType(str, Enum):
|
||||
|
||||
ethernet = "ethernet"
|
||||
tap = "tap"
|
||||
|
||||
|
||||
class IPAddressFamily(str, Enum):
|
||||
|
||||
ipv4 = "ipv4"
|
||||
ipv6 = "ipv6"
|
||||
|
||||
|
||||
class InterfaceStatus(str, Enum):
|
||||
|
||||
up = "up"
|
||||
down = "down"
|
||||
|
||||
@@ -115,7 +112,6 @@ class UDPPort(BaseModel):
|
||||
|
||||
|
||||
class CloudConsoleType(str, Enum):
|
||||
|
||||
telnet = "telnet"
|
||||
ssh = "ssh"
|
||||
vnc = "vnc"
|
||||
@@ -160,7 +156,6 @@ class CloudUpdate(CloudBase):
|
||||
|
||||
|
||||
class Cloud(CloudBase):
|
||||
|
||||
project_id: UUID
|
||||
node_id: UUID
|
||||
ports_mapping: List[Union[EthernetPort, TAPPort, UDPPort]]
|
||||
|
||||
@@ -54,11 +54,15 @@ class DockerBase(BaseModel):
|
||||
usage: Optional[str] = Field(None, description="How to use the Docker container")
|
||||
start_command: Optional[str] = Field(None, description="Docker CMD entry")
|
||||
adapters: Optional[int] = Field(None, ge=0, le=99, description="Number of adapters")
|
||||
mac_address: Optional[str] = Field(None, description="Base MAC address", pattern="^([0-9a-fA-F]{2}[:]){5}([0-9a-fA-F]{2})$")
|
||||
mac_address: Optional[str] = Field(
|
||||
None, description="Base MAC address", pattern="^([0-9a-fA-F]{2}[:]){5}([0-9a-fA-F]{2})$"
|
||||
)
|
||||
environment: Optional[str] = Field(None, description="Docker environment variables")
|
||||
extra_hosts: Optional[str] = Field(None, description="Docker extra hosts (added to /etc/hosts)")
|
||||
extra_volumes: Optional[List[str]] = Field(None, description="Additional directories to make persistent")
|
||||
extra_configs: Optional[List[ExtraConfig]] = Field(None, description="Configuration files injected into the container (bind-mounted read-only)")
|
||||
extra_configs: Optional[List[ExtraConfig]] = Field(
|
||||
None, description="Configuration files injected into the container (bind-mounted read-only)"
|
||||
)
|
||||
startup_config_content: Optional[str] = Field(
|
||||
None, description="Startup-config content (IOL runner images: materialized into the node's NVRAM at start)"
|
||||
)
|
||||
@@ -76,10 +80,11 @@ class DockerCreate(DockerBase):
|
||||
None, ge=1, le=1022, description="IOL application ID for iol-runner images (allocated by the controller)"
|
||||
)
|
||||
image_digest: Optional[str] = Field(
|
||||
None, pattern=r"^sha256:[a-f0-9]{64}$",
|
||||
None,
|
||||
pattern=r"^sha256:[a-f0-9]{64}$",
|
||||
description="Image id the controller expects for 'image' (sha256:<hex>, resolved from the Docker "
|
||||
"daemon on the controller host). When set and the compute holds a different image "
|
||||
"under the same tag, the image is reported as missing so the controller re-syncs it"
|
||||
"daemon on the controller host). When set and the compute holds a different image "
|
||||
"under the same tag, the image is reported as missing so the controller re-syncs it",
|
||||
)
|
||||
|
||||
|
||||
@@ -93,7 +98,6 @@ class DockerUpdate(DockerBase):
|
||||
|
||||
|
||||
class Docker(DockerBase):
|
||||
|
||||
container_id: str = Field(
|
||||
..., min_length=12, max_length=64, pattern="^[a-f0-9]+$", description="Docker container ID (read only)"
|
||||
)
|
||||
|
||||
@@ -189,7 +189,6 @@ class DynamipsUpdate(DynamipsBase):
|
||||
|
||||
|
||||
class Dynamips(DynamipsBase):
|
||||
|
||||
name: str
|
||||
node_id: UUID
|
||||
project_id: UUID
|
||||
|
||||
@@ -22,7 +22,6 @@ from ..common import NodeStatus
|
||||
|
||||
|
||||
class EthernetHubPort(BaseModel):
|
||||
|
||||
name: str
|
||||
port_number: int
|
||||
|
||||
@@ -55,7 +54,6 @@ class EthernetHubUpdate(EthernetHubBase):
|
||||
|
||||
|
||||
class EthernetHub(EthernetHubBase):
|
||||
|
||||
name: str
|
||||
node_id: UUID
|
||||
project_id: UUID
|
||||
|
||||
@@ -23,14 +23,12 @@ from ..common import NodeStatus
|
||||
|
||||
|
||||
class EthernetSwitchPortType(str, Enum):
|
||||
|
||||
access = "access"
|
||||
dot1q = "dot1q"
|
||||
qinq = "qinq"
|
||||
|
||||
|
||||
class EthernetSwitchEtherType(str, Enum):
|
||||
|
||||
ethertype_8021q = "0x8100"
|
||||
ethertype_qinq = "0x88A8"
|
||||
ethertype_8021q9100 = "0x9100"
|
||||
@@ -38,12 +36,13 @@ class EthernetSwitchEtherType(str, Enum):
|
||||
|
||||
|
||||
class EthernetSwitchPort(BaseModel):
|
||||
|
||||
name: str
|
||||
port_number: int
|
||||
type: EthernetSwitchPortType = Field(..., description="Port type")
|
||||
vlan: int = Field(..., ge=1, le=4094, description="VLAN number")
|
||||
ethertype: Optional[EthernetSwitchEtherType] = Field(EthernetSwitchEtherType.ethertype_8021q, description="QinQ Ethertype")
|
||||
ethertype: Optional[EthernetSwitchEtherType] = Field(
|
||||
EthernetSwitchEtherType.ethertype_8021q, description="QinQ Ethertype"
|
||||
)
|
||||
|
||||
@model_validator(mode="after")
|
||||
def check_ethertype(self) -> "EthernetSwitchPort":
|
||||
@@ -92,7 +91,6 @@ class EthernetSwitchUpdate(EthernetSwitchBase):
|
||||
|
||||
|
||||
class EthernetSwitch(EthernetSwitchBase):
|
||||
|
||||
name: str
|
||||
node_id: UUID
|
||||
project_id: UUID
|
||||
|
||||
@@ -50,6 +50,5 @@ class FrameRelaySwitchUpdate(FrameRelaySwitchBase):
|
||||
|
||||
|
||||
class FrameRelaySwitch(FrameRelaySwitchBase):
|
||||
|
||||
project_id: UUID
|
||||
status: Optional[NodeStatus] = None
|
||||
@@ -66,7 +66,6 @@ class IOUUpdate(IOUBase):
|
||||
|
||||
|
||||
class IOU(IOUBase):
|
||||
|
||||
project_id: UUID = Field(..., description="Project ID")
|
||||
node_directory: str = Field(..., description="Path to the node working directory (read only)")
|
||||
command_line: str = Field(..., description="Last command line used to start IOU (read only)")
|
||||
@@ -74,6 +73,5 @@ class IOU(IOUBase):
|
||||
|
||||
|
||||
class IOUStart(BaseModel):
|
||||
|
||||
iourc_content: Optional[str] = Field(None, description="Content of the iourc file")
|
||||
license_check: Optional[bool] = Field(None, description="Whether the IOU license should be checked")
|
||||
@@ -23,7 +23,6 @@ from ..common import NodeStatus
|
||||
|
||||
|
||||
class HostInterfaceType(str, Enum):
|
||||
|
||||
ethernet = "ethernet"
|
||||
tap = "tap"
|
||||
|
||||
@@ -115,7 +114,6 @@ class NATUpdate(NATBase):
|
||||
|
||||
|
||||
class NAT(NATBase):
|
||||
|
||||
project_id: UUID
|
||||
node_id: UUID
|
||||
ports_mapping: List[Union[EthernetPort, TAPPort, UDPPort]]
|
||||
|
||||
@@ -21,7 +21,6 @@ from enum import Enum
|
||||
|
||||
|
||||
class UDPNIOType(str, Enum):
|
||||
|
||||
udp = "nio_udp"
|
||||
|
||||
|
||||
@@ -40,7 +39,6 @@ class UDPNIO(BaseModel):
|
||||
|
||||
|
||||
class EthernetNIOType(str, Enum):
|
||||
|
||||
ethernet = "nio_ethernet"
|
||||
|
||||
|
||||
@@ -54,7 +52,6 @@ class EthernetNIO(BaseModel):
|
||||
|
||||
|
||||
class TAPNIOType(str, Enum):
|
||||
|
||||
tap = "nio_tap"
|
||||
|
||||
|
||||
|
||||
@@ -23,7 +23,6 @@ from ..common import NodeStatus, CustomAdapter
|
||||
|
||||
|
||||
class QemuPlatform(str, Enum):
|
||||
|
||||
aarch64 = "aarch64"
|
||||
alpha = "alpha"
|
||||
arm = "arm"
|
||||
@@ -94,7 +93,6 @@ class QemuOnCloseAction(str, Enum):
|
||||
|
||||
|
||||
class QemuProcessPriority(str, Enum):
|
||||
|
||||
realtime = "realtime"
|
||||
very_high = "very high"
|
||||
high = "high"
|
||||
@@ -236,7 +234,6 @@ class QemuUpdate(QemuBase):
|
||||
|
||||
|
||||
class Qemu(QemuBase):
|
||||
|
||||
project_id: UUID = Field(..., description="Project ID")
|
||||
node_directory: str = Field(..., description="Path to the node working directory (read only)")
|
||||
command_line: str = Field(..., description="Last command line used to start IOU (read only)")
|
||||
@@ -244,6 +241,5 @@ class Qemu(QemuBase):
|
||||
|
||||
|
||||
class QemuBinaryPath(BaseModel):
|
||||
|
||||
path: str
|
||||
version: str
|
||||
@@ -43,7 +43,6 @@ class VirtualBoxOnCloseAction(str, Enum):
|
||||
|
||||
|
||||
class VirtualBoxAdapterType(str, Enum):
|
||||
|
||||
pcnet_pci_ii = ("PCnet-PCI II (Am79C970A)",)
|
||||
pcnet_fast_iii = ("PCNet-FAST III (Am79C973)",)
|
||||
intel_pro_1000_mt_desktop = ("Intel PRO/1000 MT Desktop (82540EM)",)
|
||||
@@ -92,7 +91,6 @@ class VirtualBoxUpdate(VirtualBoxBase):
|
||||
|
||||
|
||||
class VirtualBox(VirtualBoxBase):
|
||||
|
||||
project_id: UUID = Field(..., description="Project ID")
|
||||
node_directory: Optional[str] = Field(None, description="Path to the node working directory (read only)")
|
||||
status: NodeStatus = Field(..., description="Container status (read only)")
|
||||
@@ -97,7 +97,6 @@ class VMwareUpdate(VMwareBase):
|
||||
|
||||
|
||||
class VMware(VMwareBase):
|
||||
|
||||
project_id: UUID = Field(..., description="Project ID")
|
||||
node_directory: Optional[str] = Field(None, description="Path to the node working directory (read only)")
|
||||
status: NodeStatus = Field(..., description="Container status (read only)")
|
||||
@@ -62,7 +62,6 @@ class VPCSUpdate(VPCSBase):
|
||||
|
||||
|
||||
class VPCS(VPCSBase):
|
||||
|
||||
project_id: UUID = Field(..., description="Project ID")
|
||||
node_directory: str = Field(..., description="Path to the node working directory (read only)")
|
||||
status: NodeStatus = Field(..., description="Container status (read only)")
|
||||
|
||||
Reference in new issue
Block a user