mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-06 15:21:13 +02:00
Use black with -l 120 param.
This commit is contained in:
1 parent
f928738bd5
commit
c021e21309
194 files changed
+6034
-4564
No files matched your search
@@ -61,5 +61,5 @@ from .dynamips_templates import (
|
||||
C3600DynamipsTemplate,
|
||||
C3725DynamipsTemplate,
|
||||
C3745DynamipsTemplate,
|
||||
C7200DynamipsTemplate
|
||||
C7200DynamipsTemplate,
|
||||
)
|
||||
@@ -107,7 +107,9 @@ class CloudBase(BaseModel):
|
||||
remote_console_port: Optional[int] = Field(None, gt=0, le=65535, description="Console TCP port")
|
||||
remote_console_type: Optional[CloudConsoleType] = Field(None, description="Console type")
|
||||
remote_console_http_path: Optional[str] = Field(None, description="Path of the remote web interface")
|
||||
ports_mapping: Optional[List[Union[EthernetPort, TAPPort, UDPPort]]] = Field(None, description="List of port mappings")
|
||||
ports_mapping: Optional[List[Union[EthernetPort, TAPPort, UDPPort]]] = Field(
|
||||
None, description="List of port mappings"
|
||||
)
|
||||
interfaces: Optional[List[HostInterface]] = Field(None, description="List of interfaces")
|
||||
|
||||
|
||||
|
||||
@@ -54,13 +54,7 @@ class ComputeCreate(ComputeBase):
|
||||
|
||||
class Config:
|
||||
schema_extra = {
|
||||
"example": {
|
||||
"name": "My compute",
|
||||
"host": "127.0.0.1",
|
||||
"port": 3080,
|
||||
"user": "user",
|
||||
"password": "password"
|
||||
}
|
||||
"example": {"name": "My compute", "host": "127.0.0.1", "port": 3080, "user": "user", "password": "password"}
|
||||
}
|
||||
|
||||
@validator("name", always=True)
|
||||
@@ -142,10 +136,4 @@ class AutoIdlePC(BaseModel):
|
||||
ram: int = Field(..., description="Amount of RAM in MB")
|
||||
|
||||
class Config:
|
||||
schema_extra = {
|
||||
"example": {
|
||||
"platform": "c7200",
|
||||
"image": "/path/to/c7200_image.bin",
|
||||
"ram": 256
|
||||
}
|
||||
}
|
||||
schema_extra = {"example": {"platform": "c7200", "image": "/path/to/c7200_image.bin", "ram": 256}}
|
||||
@@ -141,13 +141,13 @@ class ServerSettings(BaseModel):
|
||||
@validator("additional_images_paths", pre=True)
|
||||
def split_additional_images_paths(cls, v):
|
||||
if v:
|
||||
return v.split(';')
|
||||
return v.split(";")
|
||||
return list()
|
||||
|
||||
@validator("allowed_interfaces", pre=True)
|
||||
def split_allowed_interfaces(cls, v):
|
||||
if v:
|
||||
return v.split(',')
|
||||
return v.split(",")
|
||||
return list()
|
||||
|
||||
@validator("console_end_port_range")
|
||||
@@ -188,7 +188,7 @@ class ServerSettings(BaseModel):
|
||||
|
||||
class ServerConfig(BaseModel):
|
||||
|
||||
Server: ServerSettings= ServerSettings()
|
||||
Server: ServerSettings = ServerSettings()
|
||||
Controller: ControllerSettings = ControllerSettings()
|
||||
VPCS: VPCSSettings = VPCSSettings()
|
||||
Dynamips: DynamipsSettings = DynamipsSettings()
|
||||
|
||||
@@ -66,7 +66,9 @@ class DockerUpdate(DockerBase):
|
||||
|
||||
class Docker(DockerBase):
|
||||
|
||||
container_id: str = Field(..., min_length=12, max_length=64, regex="^[a-f0-9]+$", description="Docker container ID (read only)")
|
||||
container_id: str = Field(
|
||||
..., min_length=12, max_length=64, regex="^[a-f0-9]+$", description="Docker container ID (read only)"
|
||||
)
|
||||
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)")
|
||||
@@ -34,10 +34,19 @@ class DockerTemplate(TemplateBase):
|
||||
environment: Optional[str] = Field("", description="Docker environment variables")
|
||||
console_type: Optional[ConsoleType] = Field("telnet", description="Console type")
|
||||
aux_type: Optional[AuxType] = Field("none", description="Auxiliary console type")
|
||||
console_auto_start: Optional[bool] = Field(False, description="Automatically start the console when the node has started")
|
||||
console_http_port: Optional[int] = Field(80, gt=0, le=65535, description="Internal port in the container for the HTTP server")
|
||||
console_http_path: Optional[str] = Field("/", description="Path of the web interface",)
|
||||
console_resolution: Optional[str] = Field("1024x768", regex="^[0-9]+x[0-9]+$", description="Console resolution for VNC")
|
||||
console_auto_start: Optional[bool] = Field(
|
||||
False, description="Automatically start the console when the node has started"
|
||||
)
|
||||
console_http_port: Optional[int] = Field(
|
||||
80, gt=0, le=65535, description="Internal port in the container for the HTTP server"
|
||||
)
|
||||
console_http_path: Optional[str] = Field(
|
||||
"/",
|
||||
description="Path of the web interface",
|
||||
)
|
||||
console_resolution: Optional[str] = Field(
|
||||
"1024x768", regex="^[0-9]+x[0-9]+$", description="Console resolution for VNC"
|
||||
)
|
||||
extra_hosts: Optional[str] = Field("", description="Docker extra hosts (added to /etc/hosts)")
|
||||
extra_volumes: Optional[List] = Field([], description="Additional directories to make persistent")
|
||||
memory: Optional[int] = Field(0, description="Maximum amount of memory the container can use in MB")
|
||||
|
||||
@@ -112,7 +112,7 @@ class DynamipsMidplane(str, Enum):
|
||||
vxr = "vxr"
|
||||
|
||||
|
||||
#TODO: improve schema for Dynamips (match platform specific options, e.g. NPE allowd only for c7200)
|
||||
# TODO: improve schema for Dynamips (match platform specific options, e.g. NPE allowd only for c7200)
|
||||
class DynamipsBase(BaseModel):
|
||||
"""
|
||||
Common Dynamips node properties.
|
||||
@@ -144,7 +144,9 @@ class DynamipsBase(BaseModel):
|
||||
console_type: Optional[DynamipsConsoleType] = Field(None, description="Console type")
|
||||
aux: Optional[int] = Field(None, gt=0, le=65535, description="Auxiliary console TCP port")
|
||||
aux_type: Optional[DynamipsConsoleType] = Field(None, description="Auxiliary console type")
|
||||
mac_addr: Optional[str] = Field(None, description="Base MAC address", regex="^([0-9a-fA-F]{4}\\.){2}[0-9a-fA-F]{4}$")
|
||||
mac_addr: Optional[str] = Field(
|
||||
None, description="Base MAC address", regex="^([0-9a-fA-F]{4}\\.){2}[0-9a-fA-F]{4}$"
|
||||
)
|
||||
system_id: Optional[str] = Field(None, description="System ID")
|
||||
slot0: Optional[DynamipsAdapters] = Field(None, description="Network module slot 0")
|
||||
slot1: Optional[DynamipsAdapters] = Field(None, description="Network module slot 1")
|
||||
|
||||
@@ -21,7 +21,7 @@ from .dynamips_nodes import (
|
||||
DynamipsAdapters,
|
||||
DynamipsWics,
|
||||
DynamipsNPE,
|
||||
DynamipsMidplane
|
||||
DynamipsMidplane,
|
||||
)
|
||||
|
||||
from pydantic import Field
|
||||
@@ -38,7 +38,9 @@ class DynamipsTemplate(TemplateBase):
|
||||
image: str = Field(..., description="Path to the IOS image")
|
||||
exec_area: Optional[int] = Field(64, description="Exec area value")
|
||||
mmap: Optional[bool] = Field(True, description="MMAP feature")
|
||||
mac_addr: Optional[str] = Field("", description="Base MAC address", regex="^([0-9a-fA-F]{4}\\.){2}[0-9a-fA-F]{4}$|^$")
|
||||
mac_addr: Optional[str] = Field(
|
||||
"", description="Base MAC address", regex="^([0-9a-fA-F]{4}\\.){2}[0-9a-fA-F]{4}$|^$"
|
||||
)
|
||||
system_id: Optional[str] = Field("FTX0945W0MY", description="System ID")
|
||||
startup_config: Optional[str] = Field("ios_base_startup-config.txt", description="IOS startup configuration file")
|
||||
private_config: Optional[str] = Field("", description="IOS private configuration file")
|
||||
@@ -49,7 +51,9 @@ class DynamipsTemplate(TemplateBase):
|
||||
disk1: Optional[int] = Field(0, description="Disk1 size in MB")
|
||||
auto_delete_disks: Optional[bool] = Field(False, description="Automatically delete nvram and disk files")
|
||||
console_type: Optional[DynamipsConsoleType] = Field("telnet", description="Console type")
|
||||
console_auto_start: Optional[bool] = Field(False, description="Automatically start the console when the node has started")
|
||||
console_auto_start: Optional[bool] = Field(
|
||||
False, description="Automatically start the console when the node has started"
|
||||
)
|
||||
aux_type: Optional[DynamipsConsoleType] = Field("none", description="Auxiliary console type")
|
||||
slot0: Optional[DynamipsAdapters] = Field(None, description="Network module slot 0")
|
||||
slot1: Optional[DynamipsAdapters] = Field(None, description="Network module slot 1")
|
||||
|
||||
@@ -30,7 +30,7 @@ DEFAULT_PORTS = [
|
||||
dict(port_number=4, name="Ethernet4"),
|
||||
dict(port_number=5, name="Ethernet5"),
|
||||
dict(port_number=6, name="Ethernet6"),
|
||||
dict(port_number=7, name="Ethernet7")
|
||||
dict(port_number=7, name="Ethernet7"),
|
||||
]
|
||||
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ DEFAULT_PORTS = [
|
||||
dict(port_number=4, name="Ethernet4", vlan=1, type="access", ethertype="0x8100"),
|
||||
dict(port_number=5, name="Ethernet5", vlan=1, type="access", ethertype="0x8100"),
|
||||
dict(port_number=6, name="Ethernet6", vlan=1, type="access", ethertype="0x8100"),
|
||||
dict(port_number=7, name="Ethernet7", vlan=1, type="access", ethertype="0x8100")
|
||||
dict(port_number=7, name="Ethernet7", vlan=1, type="access", ethertype="0x8100"),
|
||||
]
|
||||
|
||||
|
||||
|
||||
@@ -37,5 +37,6 @@ class IOUTemplate(TemplateBase):
|
||||
private_config: Optional[str] = Field("", description="Private-config of IOU")
|
||||
l1_keepalives: Optional[bool] = Field(False, description="Always keep up Ethernet interface (does not always work)")
|
||||
console_type: Optional[ConsoleType] = Field("telnet", description="Console type")
|
||||
console_auto_start: Optional[bool] = Field(False, description="Automatically start the console when the node has started")
|
||||
|
||||
console_auto_start: Optional[bool] = Field(
|
||||
False, description="Automatically start the console when the node has started"
|
||||
)
|
||||
@@ -53,7 +53,13 @@ class Link(BaseModel):
|
||||
suspend: Optional[bool] = None
|
||||
filters: Optional[dict] = None
|
||||
capturing: Optional[bool] = Field(None, description="Read only property. True if a capture running on the link")
|
||||
capture_file_name: Optional[str] = Field(None, description="Read only property. The name of the capture file if a capture is running")
|
||||
capture_file_path: Optional[str] = Field(None, description="Read only property. The full path of the capture file if a capture is running")
|
||||
capture_compute_id: Optional[str] = Field(None, description="Read only property. The compute identifier where a capture is running")
|
||||
capture_file_name: Optional[str] = Field(
|
||||
None, description="Read only property. The name of the capture file if a capture is running"
|
||||
)
|
||||
capture_file_path: Optional[str] = Field(
|
||||
None, description="Read only property. The full path of the capture file if a capture is running"
|
||||
)
|
||||
capture_compute_id: Optional[str] = Field(
|
||||
None, description="Read only property. The compute identifier where a capture is running"
|
||||
)
|
||||
link_type: Optional[LinkType] = None
|
||||
@@ -93,7 +93,9 @@ class NATBase(BaseModel):
|
||||
name: str
|
||||
node_id: Optional[UUID] = None
|
||||
usage: Optional[str] = None
|
||||
ports_mapping: Optional[List[Union[EthernetPort, TAPPort, UDPPort]]] = Field(None, description="List of port mappings")
|
||||
ports_mapping: Optional[List[Union[EthernetPort, TAPPort, UDPPort]]] = Field(
|
||||
None, description="List of port mappings"
|
||||
)
|
||||
|
||||
|
||||
class NATCreate(NATBase):
|
||||
|
||||
@@ -65,4 +65,3 @@ class TAPNIO(BaseModel):
|
||||
|
||||
type: TAPNIOType
|
||||
tap_device: str = Field(..., description="TAP device name e.g. tap0")
|
||||
|
||||
@@ -153,13 +153,20 @@ class Node(BaseModel):
|
||||
node_type: NodeType
|
||||
project_id: Optional[UUID] = None
|
||||
node_id: Optional[UUID] = None
|
||||
template_id: Optional[UUID] = Field(None, description="Template UUID from which the node has been created. Read only")
|
||||
template_id: Optional[UUID] = Field(
|
||||
None, description="Template UUID from which the node has been created. Read only"
|
||||
)
|
||||
node_directory: Optional[str] = Field(None, description="Working directory of the node. Read only")
|
||||
command_line: Optional[str] = Field(None, description="Command line use to start the node")
|
||||
console: Optional[int] = Field(None, gt=0, le=65535, description="Console TCP port")
|
||||
console_host: Optional[str] = Field(None, description="Console host. Warning if the host is 0.0.0.0 or :: (listen on all interfaces) you need to use the same address you use to connect to the controller")
|
||||
console_host: Optional[str] = Field(
|
||||
None,
|
||||
description="Console host. Warning if the host is 0.0.0.0 or :: (listen on all interfaces) you need to use the same address you use to connect to the controller",
|
||||
)
|
||||
console_type: Optional[ConsoleType] = None
|
||||
console_auto_start: Optional[bool] = Field(None, description="Automatically start the console when the node has started")
|
||||
console_auto_start: Optional[bool] = Field(
|
||||
None, description="Automatically start the console when the node has started"
|
||||
)
|
||||
aux: Optional[int] = Field(None, gt=0, le=65535, description="Auxiliary console TCP port")
|
||||
aux_type: Optional[ConsoleType]
|
||||
properties: Optional[dict] = Field(None, description="Properties specific to an emulator")
|
||||
@@ -172,7 +179,9 @@ class Node(BaseModel):
|
||||
y: Optional[int] = None
|
||||
z: Optional[int] = None
|
||||
locked: Optional[bool] = Field(None, description="Whether the element locked or not")
|
||||
port_name_format: Optional[str] = Field(None, description="Formatting for port name {0} will be replace by port number")
|
||||
port_name_format: Optional[str] = Field(
|
||||
None, description="Formatting for port name {0} will be replace by port number"
|
||||
)
|
||||
port_segment_size: Optional[int] = Field(None, description="Size of the port segment")
|
||||
first_port_name: Optional[str] = Field(None, description="Name of the first port")
|
||||
custom_adapters: Optional[List[CustomAdapter]] = None
|
||||
|
||||
@@ -45,7 +45,7 @@ class QemuPlatform(str, Enum):
|
||||
s390x = "s390x"
|
||||
sh4 = "sh4"
|
||||
sh4eb = "sh4eb"
|
||||
sparc = "sparc"
|
||||
sparc = "sparc"
|
||||
sparc64 = "sparc64"
|
||||
tricore = "tricore"
|
||||
unicore32 = "unicore32"
|
||||
@@ -192,10 +192,16 @@ class QemuBase(BaseModel):
|
||||
maxcpus: Optional[int] = Field(None, ge=1, le=255, description="Maximum number of hotpluggable vCPUs")
|
||||
adapters: Optional[int] = Field(None, ge=0, le=275, description="Number of adapters")
|
||||
adapter_type: Optional[QemuAdapterType] = Field(None, description="QEMU adapter type")
|
||||
mac_address: Optional[str] = Field(None, description="QEMU MAC address", regex="^([0-9a-fA-F]{2}[:]){5}([0-9a-fA-F]{2})$")
|
||||
mac_address: Optional[str] = Field(
|
||||
None, description="QEMU MAC address", regex="^([0-9a-fA-F]{2}[:]){5}([0-9a-fA-F]{2})$"
|
||||
)
|
||||
legacy_networking: Optional[bool] = Field(None, description="Use QEMU legagy networking commands (-net syntax)")
|
||||
replicate_network_connection_state: Optional[bool] = Field(None, description="Replicate the network connection state for links in Qemu")
|
||||
create_config_disk: Optional[bool] = Field(None, description="Automatically create a config disk on HDD disk interface (secondary slave)")
|
||||
replicate_network_connection_state: Optional[bool] = Field(
|
||||
None, description="Replicate the network connection state for links in Qemu"
|
||||
)
|
||||
create_config_disk: Optional[bool] = Field(
|
||||
None, description="Automatically create a config disk on HDD disk interface (secondary slave)"
|
||||
)
|
||||
on_close: Optional[QemuOnCloseAction] = Field(None, description="Action to execute on the VM is closed")
|
||||
cpu_throttling: Optional[int] = Field(None, ge=0, le=800, description="Percentage of CPU allowed for QEMU")
|
||||
process_priority: Optional[QemuProcessPriority] = Field(None, description="Process priority for QEMU")
|
||||
|
||||
@@ -24,7 +24,7 @@ from .qemu_nodes import (
|
||||
QemuBootPriority,
|
||||
QemuDiskInterfaceType,
|
||||
QemuProcessPriority,
|
||||
CustomAdapter
|
||||
CustomAdapter,
|
||||
)
|
||||
|
||||
from pydantic import Field
|
||||
@@ -44,12 +44,21 @@ class QemuTemplate(TemplateBase):
|
||||
maxcpus: Optional[int] = Field(1, ge=1, le=255, description="Maximum number of hotpluggable vCPUs")
|
||||
adapters: Optional[int] = Field(1, ge=0, le=275, description="Number of adapters")
|
||||
adapter_type: Optional[QemuAdapterType] = Field("e1000", description="QEMU adapter type")
|
||||
mac_address: Optional[str] = Field("", description="QEMU MAC address", regex="^([0-9a-fA-F]{2}[:]){5}([0-9a-fA-F]{2})$|^$")
|
||||
mac_address: Optional[str] = Field(
|
||||
"", description="QEMU MAC address", regex="^([0-9a-fA-F]{2}[:]){5}([0-9a-fA-F]{2})$|^$"
|
||||
)
|
||||
first_port_name: Optional[str] = Field("", description="Optional name of the first networking port example: eth0")
|
||||
port_name_format: Optional[str] = Field("Ethernet{0}", description="Optional formatting of the networking port example: eth{0}")
|
||||
port_segment_size: Optional[int] = Field(0, description="Optional port segment size. A port segment is a block of port. For example Ethernet0/0 Ethernet0/1 is the module 0 with a port segment size of 2")
|
||||
port_name_format: Optional[str] = Field(
|
||||
"Ethernet{0}", description="Optional formatting of the networking port example: eth{0}"
|
||||
)
|
||||
port_segment_size: Optional[int] = Field(
|
||||
0,
|
||||
description="Optional port segment size. A port segment is a block of port. For example Ethernet0/0 Ethernet0/1 is the module 0 with a port segment size of 2",
|
||||
)
|
||||
console_type: Optional[QemuConsoleType] = Field("telnet", description="Console type")
|
||||
console_auto_start: Optional[bool] = Field(False, description="Automatically start the console when the node has started")
|
||||
console_auto_start: Optional[bool] = Field(
|
||||
False, description="Automatically start the console when the node has started"
|
||||
)
|
||||
aux_type: Optional[QemuConsoleType] = Field("none", description="Auxiliary console type")
|
||||
boot_priority: Optional[QemuBootPriority] = Field("c", description="QEMU boot priority")
|
||||
hda_disk_image: Optional[str] = Field("", description="QEMU hda disk image path")
|
||||
@@ -66,8 +75,12 @@ class QemuTemplate(TemplateBase):
|
||||
bios_image: Optional[str] = Field("", description="QEMU bios image path")
|
||||
kernel_command_line: Optional[str] = Field("", description="QEMU kernel command line")
|
||||
legacy_networking: Optional[bool] = Field(False, description="Use QEMU legagy networking commands (-net syntax)")
|
||||
replicate_network_connection_state: Optional[bool] = Field(True, description="Replicate the network connection state for links in Qemu")
|
||||
create_config_disk: Optional[bool] = Field(False, description="Automatically create a config disk on HDD disk interface (secondary slave)")
|
||||
replicate_network_connection_state: Optional[bool] = Field(
|
||||
True, description="Replicate the network connection state for links in Qemu"
|
||||
)
|
||||
create_config_disk: Optional[bool] = Field(
|
||||
False, description="Automatically create a config disk on HDD disk interface (secondary slave)"
|
||||
)
|
||||
on_close: Optional[QemuOnCloseAction] = Field("power_off", description="Action to execute on the VM is closed")
|
||||
cpu_throttling: Optional[int] = Field(0, ge=0, le=800, description="Percentage of CPU allowed for QEMU")
|
||||
process_priority: Optional[QemuProcessPriority] = Field("normal", description="Process priority for QEMU")
|
||||
|
||||
@@ -24,10 +24,7 @@ from .drawings import Drawing
|
||||
from .links import Link
|
||||
from .nodes import Node
|
||||
|
||||
from .projects import (
|
||||
Supplier,
|
||||
Variable
|
||||
)
|
||||
from .projects import Supplier, Variable
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
from typing import Optional, List
|
||||
@@ -81,5 +78,5 @@ def main():
|
||||
Topology.parse_obj(data)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -43,11 +43,11 @@ 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)",
|
||||
intel_pro_1000_t_server = "Intel PRO/1000 T Server (82543GC)",
|
||||
intel_pro_1000_mt_server = "Intel PRO/1000 MT Server (82545EM)",
|
||||
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)",)
|
||||
intel_pro_1000_t_server = ("Intel PRO/1000 T Server (82543GC)",)
|
||||
intel_pro_1000_mt_server = ("Intel PRO/1000 MT Server (82545EM)",)
|
||||
paravirtualized_network = "Paravirtualized Network (virtio-net)"
|
||||
|
||||
|
||||
|
||||
@@ -15,12 +15,7 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from .templates import Category, TemplateBase
|
||||
from .virtualbox_nodes import (
|
||||
VirtualBoxConsoleType,
|
||||
VirtualBoxAdapterType,
|
||||
VirtualBoxOnCloseAction,
|
||||
CustomAdapter
|
||||
)
|
||||
from .virtualbox_nodes import VirtualBoxConsoleType, VirtualBoxAdapterType, VirtualBoxOnCloseAction, CustomAdapter
|
||||
|
||||
from pydantic import Field
|
||||
from typing import Optional, List
|
||||
@@ -34,14 +29,27 @@ class VirtualBoxTemplate(TemplateBase):
|
||||
vmname: str = Field(..., description="VirtualBox VM name (in VirtualBox itself)")
|
||||
ram: Optional[int] = Field(256, gt=0, description="Amount of RAM in MB")
|
||||
linked_clone: Optional[bool] = Field(False, description="Whether the VM is a linked clone or not")
|
||||
adapters: Optional[int] = Field(1, ge=0, le=36, description="Number of adapters") # 36 is the maximum given by the ICH9 chipset in VirtualBox
|
||||
adapters: Optional[int] = Field(
|
||||
1, ge=0, le=36, description="Number of adapters"
|
||||
) # 36 is the maximum given by the ICH9 chipset in VirtualBox
|
||||
use_any_adapter: Optional[bool] = Field(False, description="Allow GNS3 to use any VirtualBox adapter")
|
||||
adapter_type: Optional[VirtualBoxAdapterType] = Field("Intel PRO/1000 MT Desktop (82540EM)", description="VirtualBox adapter type")
|
||||
adapter_type: Optional[VirtualBoxAdapterType] = Field(
|
||||
"Intel PRO/1000 MT Desktop (82540EM)", description="VirtualBox adapter type"
|
||||
)
|
||||
first_port_name: Optional[str] = Field("", description="Optional name of the first networking port example: eth0")
|
||||
port_name_format: Optional[str] = Field("Ethernet{0}", description="Optional formatting of the networking port example: eth{0}")
|
||||
port_segment_size: Optional[int] = Field(0, description="Optional port segment size. A port segment is a block of port. For example Ethernet0/0 Ethernet0/1 is the module 0 with a port segment size of 2")
|
||||
port_name_format: Optional[str] = Field(
|
||||
"Ethernet{0}", description="Optional formatting of the networking port example: eth{0}"
|
||||
)
|
||||
port_segment_size: Optional[int] = Field(
|
||||
0,
|
||||
description="Optional port segment size. A port segment is a block of port. For example Ethernet0/0 Ethernet0/1 is the module 0 with a port segment size of 2",
|
||||
)
|
||||
headless: Optional[bool] = Field(False, description="Headless mode")
|
||||
on_close: Optional[VirtualBoxOnCloseAction] = Field("power_off", description="Action to execute on the VM is closed")
|
||||
on_close: Optional[VirtualBoxOnCloseAction] = Field(
|
||||
"power_off", description="Action to execute on the VM is closed"
|
||||
)
|
||||
console_type: Optional[VirtualBoxConsoleType] = Field("none", description="Console type")
|
||||
console_auto_start: Optional[bool] = Field(False, description="Automatically start the console when the node has started")
|
||||
console_auto_start: Optional[bool] = Field(
|
||||
False, description="Automatically start the console when the node has started"
|
||||
)
|
||||
custom_adapters: Optional[List[CustomAdapter]] = Field(default_factory=list, description="Custom adapters")
|
||||
@@ -16,12 +16,7 @@
|
||||
|
||||
|
||||
from .templates import Category, TemplateBase
|
||||
from .vmware_nodes import (
|
||||
VMwareConsoleType,
|
||||
VMwareAdapterType,
|
||||
VMwareOnCloseAction,
|
||||
CustomAdapter
|
||||
)
|
||||
from .vmware_nodes import VMwareConsoleType, VMwareAdapterType, VMwareOnCloseAction, CustomAdapter
|
||||
|
||||
from pydantic import Field
|
||||
from typing import Optional, List
|
||||
@@ -35,13 +30,22 @@ class VMwareTemplate(TemplateBase):
|
||||
vmx_path: str = Field(..., description="Path to the vmx file")
|
||||
linked_clone: Optional[bool] = Field(False, description="Whether the VM is a linked clone or not")
|
||||
first_port_name: Optional[str] = Field("", description="Optional name of the first networking port example: eth0")
|
||||
port_name_format: Optional[str] = Field("Ethernet{0}", description="Optional formatting of the networking port example: eth{0}")
|
||||
port_segment_size: Optional[int] = Field(0, description="Optional port segment size. A port segment is a block of port. For example Ethernet0/0 Ethernet0/1 is the module 0 with a port segment size of 2")
|
||||
adapters: Optional[int] = Field(1, ge=0, le=10, description="Number of adapters") # 10 is the maximum adapters support by VMware VMs
|
||||
port_name_format: Optional[str] = Field(
|
||||
"Ethernet{0}", description="Optional formatting of the networking port example: eth{0}"
|
||||
)
|
||||
port_segment_size: Optional[int] = Field(
|
||||
0,
|
||||
description="Optional port segment size. A port segment is a block of port. For example Ethernet0/0 Ethernet0/1 is the module 0 with a port segment size of 2",
|
||||
)
|
||||
adapters: Optional[int] = Field(
|
||||
1, ge=0, le=10, description="Number of adapters"
|
||||
) # 10 is the maximum adapters support by VMware VMs
|
||||
adapter_type: Optional[VMwareAdapterType] = Field("e1000", description="VMware adapter type")
|
||||
use_any_adapter: Optional[bool] = Field(False, description="Allow GNS3 to use any VMware adapter")
|
||||
headless: Optional[bool] = Field(False, description="Headless mode")
|
||||
on_close: Optional[VMwareOnCloseAction] = Field("power_off", description="Action to execute on the VM is closed")
|
||||
console_type: Optional[VMwareConsoleType] = Field("none", description="Console type")
|
||||
console_auto_start: Optional[bool] = Field(False, description="Automatically start the console when the node has started")
|
||||
console_auto_start: Optional[bool] = Field(
|
||||
False, description="Automatically start the console when the node has started"
|
||||
)
|
||||
custom_adapters: Optional[List[CustomAdapter]] = Field(default_factory=list, description="Custom adapters")
|
||||
@@ -29,4 +29,6 @@ class VPCSTemplate(TemplateBase):
|
||||
symbol: Optional[str] = ":/symbols/vpcs_guest.svg"
|
||||
base_script_file: Optional[str] = Field("vpcs_base_config.txt", description="Script file")
|
||||
console_type: Optional[ConsoleType] = Field("telnet", description="Console type")
|
||||
console_auto_start: Optional[bool] = Field(False, description="Automatically start the console when the node has started")
|
||||
console_auto_start: Optional[bool] = Field(
|
||||
False, description="Automatically start the console when the node has started"
|
||||
)
|
||||
Reference in new issue
Block a user