Migration to FastAPI

This commit is contained in:
grossmj committed 2020-10-02 16:07:50 +09:30
1 parent c12b675691
commit eb3cb8a41f
224 files changed
+11254 -13517

No files matched your search

-94
View File
@@ -1,94 +0,0 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2016 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import copy
ATM_SWITCH_CREATE_SCHEMA = {
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "Request validation to create a new ATM switch instance",
"type": "object",
"properties": {
"name": {
"description": "ATM switch name",
"type": "string",
"minLength": 1,
},
"usage": {
"description": "How to use the ATM switch",
"type": "string",
},
"node_id": {
"description": "Node UUID",
"oneOf": [
{"type": "string",
"minLength": 36,
"maxLength": 36,
"pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"}
]
},
"mappings": {
"description": "ATM mappings",
"type": "object",
},
},
"additionalProperties": False,
"required": ["name"]
}
ATM_SWITCH_OBJECT_SCHEMA = {
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "ATM switch instance",
"type": "object",
"properties": {
"name": {
"description": "ATM switch name",
"type": "string",
"minLength": 1,
},
"usage": {
"description": "How to use the ATM switch",
"type": "string",
},
"node_id": {
"description": "Node UUID",
"type": "string",
"minLength": 36,
"maxLength": 36,
"pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
},
"project_id": {
"description": "Project UUID",
"type": "string",
"minLength": 36,
"maxLength": 36,
"pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
},
"mappings": {
"description": "ATM mappings",
"type": "object",
},
"status": {
"description": "Node status",
"enum": ["started", "stopped", "suspended"]
},
},
"additionalProperties": False,
"required": ["name", "node_id", "project_id"]
}
ATM_SWITCH_UPDATE_SCHEMA = copy.deepcopy(ATM_SWITCH_OBJECT_SCHEMA)
del ATM_SWITCH_UPDATE_SCHEMA["required"]
-185
View File
@@ -1,185 +0,0 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2016 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import copy
from .port import PORT_OBJECT_SCHEMA
HOST_INTERFACE_SCHEMA = {
"description": "Interfaces on this host",
"properties": {
"name": {
"description": "Interface name",
"type": "string",
"minLength": 1,
},
"type": {
"description": "Interface type",
"enum": ["ethernet", "tap"]
},
"special": {
"description": "If true the interface is non standard (firewire for example)",
"type": "boolean"
}
},
"required": ["name", "type", "special"],
"additionalProperties": False
}
CLOUD_CREATE_SCHEMA = {
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "Request validation to create a new cloud instance",
"type": "object",
"definitions": {
"HostInterfaces": HOST_INTERFACE_SCHEMA
},
"properties": {
"name": {
"description": "Cloud name",
"type": "string",
"minLength": 1,
},
"usage": {
"description": "How to use the cloud",
"type": "string",
},
"node_id": {
"description": "Node UUID",
"oneOf": [
{"type": "string",
"minLength": 36,
"maxLength": 36,
"pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"}
]
},
"remote_console_host": {
"description": "Remote console host or IP",
"type": ["string"]
},
"remote_console_port": {
"description": "Console TCP port",
"minimum": 1,
"maximum": 65535,
"type": ["integer", "null"]
},
"remote_console_type": {
"description": "Console type",
"enum": ["telnet", "vnc", "spice", "http", "https", "none"]
},
"remote_console_http_path": {
"description": "Path of the remote web interface",
"type": "string",
},
"ports_mapping": {
"type": "array",
"items": [
PORT_OBJECT_SCHEMA
]
},
"interfaces": {
"type": "array",
"items": [
{"type": "object",
"oneOf": [
{"$ref": "#/definitions/HostInterfaces"}
]},
]
}
},
"additionalProperties": False,
"required": ["name"]
}
CLOUD_OBJECT_SCHEMA = {
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "Cloud instance",
"type": "object",
"definitions": {
"HostInterfaces": HOST_INTERFACE_SCHEMA
},
"properties": {
"name": {
"description": "Cloud name",
"type": "string",
"minLength": 1,
},
"usage": {
"description": "How to use the cloud",
"type": "string",
},
"node_id": {
"description": "Node UUID",
"type": "string",
"minLength": 36,
"maxLength": 36,
"pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
},
"project_id": {
"description": "Project UUID",
"type": "string",
"minLength": 36,
"maxLength": 36,
"pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
},
"remote_console_host": {
"description": "Remote console host or IP",
"type": ["string"]
},
"remote_console_port": {
"description": "Console TCP port",
"minimum": 1,
"maximum": 65535,
"type": ["integer", "null"]
},
"remote_console_type": {
"description": "Console type",
"enum": ["telnet", "vnc", "spice", "http", "https", "none"]
},
"remote_console_http_path": {
"description": "Path of the remote web interface",
"type": "string",
},
"ports_mapping": {
"type": "array",
"items": [
PORT_OBJECT_SCHEMA
]
},
"interfaces": {
"type": "array",
"items": [
{"type": "object",
"oneOf": [
{"$ref": "#/definitions/HostInterfaces"}
]},
]
},
"node_directory": {
"description": "Path to the VM working directory",
"type": "string"
},
"status": {
"description": "Node status",
"enum": ["started", "stopped", "suspended"]
},
},
"additionalProperties": False,
"required": ["name", "node_id", "project_id", "ports_mapping"]
}
CLOUD_UPDATE_SCHEMA = copy.deepcopy(CLOUD_OBJECT_SCHEMA)
del CLOUD_UPDATE_SCHEMA["required"]
-271
View File
@@ -1,271 +0,0 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from .custom_adapters import CUSTOM_ADAPTERS_ARRAY_SCHEMA
DOCKER_CREATE_SCHEMA = {
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "Request validation to create a new Docker container",
"type": "object",
"properties": {
"node_id": {
"description": "Node UUID",
"type": "string",
"minLength": 36,
"maxLength": 36,
"pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
},
"name": {
"description": "Docker container name",
"type": "string",
"minLength": 1,
},
"console": {
"description": "Console TCP port",
"minimum": 1,
"maximum": 65535,
"type": ["integer", "null"]
},
"console_type": {
"description": "Console type",
"enum": ["telnet", "vnc", "http", "https", "none"]
},
"console_resolution": {
"description": "Console resolution for VNC",
"type": ["string", "null"],
"pattern": "^[0-9]+x[0-9]+$"
},
"console_http_port": {
"description": "Internal port in the container for the HTTP server",
"type": "integer",
},
"console_http_path": {
"description": "Path of the web interface",
"type": "string",
},
"aux": {
"description": "Auxiliary TCP port",
"minimum": 1,
"maximum": 65535,
"type": ["integer", "null"]
},
"aux_type": {
"description": "Auxiliary console type",
"enum": ["telnet", "none"]
},
"usage": {
"description": "How to use the Docker container",
"type": "string",
},
"start_command": {
"description": "Docker CMD entry",
"type": ["string", "null"],
"minLength": 0,
},
"image": {
"description": "Docker image name",
"type": "string",
"minLength": 1,
},
"adapters": {
"description": "Number of adapters",
"type": ["integer", "null"],
"minimum": 0,
"maximum": 99,
},
"environment": {
"description": "Docker environment variables",
"type": ["string", "null"],
"minLength": 0,
},
"extra_hosts": {
"description": "Docker extra hosts (added to /etc/hosts)",
"type": ["string", "null"],
"minLength": 0,
},
"extra_volumes": {
"description": "Additional directories to make persistent",
"type": "array",
"minItems": 0,
"items": {
"type": "string"
}
},
"memory": {
"description": "Maximum amount of memory the container can use in MB",
"type": "integer",
},
"cpus": {
"description": "Maximum amount of CPU resources the container can use",
"type": "number",
},
"container_id": {
"description": "Docker container ID Read only",
"type": "string",
"minLength": 12,
"maxLength": 64,
"pattern": "^[a-f0-9]+$"
},
"custom_adapters": CUSTOM_ADAPTERS_ARRAY_SCHEMA
},
"additionalProperties": False,
"required": ["name", "image"]
}
DOCKER_OBJECT_SCHEMA = {
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "Docker container instance",
"type": "object",
"properties": {
"name": {
"description": "Docker container name",
"type": "string",
"minLength": 1,
},
"node_id": {
"description": "Node UUID",
"type": "string",
"minLength": 36,
"maxLength": 36,
"pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
},
"aux": {
"description": "Auxiliary TCP port",
"minimum": 1,
"maximum": 65535,
"type": ["integer", "null"]
},
"console": {
"description": "Console TCP port",
"minimum": 1,
"maximum": 65535,
"type": ["integer", "null"]
},
"console_resolution": {
"description": "Console resolution for VNC",
"type": "string",
"pattern": "^[0-9]+x[0-9]+$"
},
"console_type": {
"description": "Console type",
"enum": ["telnet", "vnc", "http", "https", "none"]
},
"aux_type": {
"description": "Auxiliary console type",
"enum": ["telnet", "none"]
},
"console_http_port": {
"description": "Internal port in the container for the HTTP server",
"type": "integer",
},
"console_http_path": {
"description": "Path of the web interface",
"type": "string",
},
"container_id": {
"description": "Docker container ID Read only",
"type": "string",
"minLength": 12,
"maxLength": 64,
"pattern": "^[a-f0-9]+$"
},
"project_id": {
"description": "Project UUID Read only",
"type": "string",
"minLength": 36,
"maxLength": 36,
"pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
},
"image": {
"description": "Docker image name Read only",
"type": "string",
"minLength": 1,
},
"adapters": {
"description": "number of adapters",
"type": ["integer", "null"],
"minimum": 0,
"maximum": 99,
},
"usage": {
"description": "How to use the Docker container",
"type": "string",
},
"start_command": {
"description": "Docker CMD entry",
"type": ["string", "null"],
"minLength": 0,
},
"environment": {
"description": "Docker environment",
"type": ["string", "null"],
"minLength": 0,
},
"extra_hosts": {
"description": "Docker extra hosts (added to /etc/hosts)",
"type": ["string", "null"],
"minLength": 0,
},
"extra_volumes": {
"description": "Additional directories to make persistent",
"type": "array",
"minItems": 0,
"items": {
"type": "string",
}
},
"memory": {
"description": "Maximum amount of memory the container can use in MB",
"type": "integer",
},
"cpus": {
"description": "Maximum amount of CPU resources the container can use",
"type": "number",
},
"node_directory": {
"description": "Path to the node working directory Read only",
"type": "string"
},
"status": {
"description": "VM status Read only",
"enum": ["started", "stopped", "suspended"]
},
"custom_adapters": CUSTOM_ADAPTERS_ARRAY_SCHEMA
},
"additionalProperties": False,
}
DOCKER_LIST_IMAGES_SCHEMA = {
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "Docker list of images",
"type": "array",
"items": [
{
"type": "object",
"properties": {
"image": {
"description": "Docker image name",
"type": "string",
"minLength": 1
}
}
}
]
}
-142
View File
@@ -1,142 +0,0 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2016 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import copy
ETHERNET_HUB_CREATE_SCHEMA = {
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "Request validation to create a new Ethernet hub instance",
"type": "object",
"definitions": {
"EthernetHubPort": {
"description": "Ethernet port",
"properties": {
"name": {
"description": "Port name",
"type": "string",
"minLength": 1,
},
"port_number": {
"description": "Port number",
"type": "integer",
"minimum": 0
},
},
"required": ["name", "port_number"],
"additionalProperties": False
},
},
"properties": {
"name": {
"description": "Ethernet hub name",
"type": "string",
"minLength": 1,
},
"usage": {
"description": "How to use the hub",
"type": "string",
},
"node_id": {
"description": "Node UUID",
"oneOf": [
{"type": "string",
"minLength": 36,
"maxLength": 36,
"pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"}
]
},
"ports_mapping": {
"type": "array",
"items": [
{"type": "object",
"oneOf": [
{"$ref": "#/definitions/EthernetHubPort"}
]},
]
},
},
"additionalProperties": False,
"required": ["name"]
}
ETHERNET_HUB_OBJECT_SCHEMA = {
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "Ethernet hub instance",
"type": "object",
"definitions": {
"EthernetHubPort": {
"description": "Ethernet port",
"properties": {
"name": {
"description": "Port name",
"type": "string",
"minLength": 1,
},
"port_number": {
"description": "Port number",
"type": "integer",
"minimum": 0
},
},
"required": ["name", "port_number"],
"additionalProperties": False
},
},
"properties": {
"name": {
"description": "Ethernet hub name",
"type": "string",
"minLength": 1,
},
"usage": {
"description": "How to use the hub",
"type": "string",
},
"node_id": {
"description": "Node UUID",
"type": "string",
"minLength": 36,
"maxLength": 36,
"pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
},
"project_id": {
"description": "Project UUID",
"type": "string",
"minLength": 36,
"maxLength": 36,
"pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
},
"ports_mapping": {
"type": "array",
"items": [
{"type": "object",
"oneOf": [
{"$ref": "#/definitions/EthernetHubPort"}
]},
]
},
"status": {
"description": "Node status",
"enum": ["started", "stopped", "suspended"]
},
},
"additionalProperties": False,
"required": ["name", "node_id", "project_id", "ports_mapping"]
}
ETHERNET_HUB_UPDATE_SCHEMA = copy.deepcopy(ETHERNET_HUB_OBJECT_SCHEMA)
del ETHERNET_HUB_UPDATE_SCHEMA["required"]
-186
View File
@@ -1,186 +0,0 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2016 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import copy
ETHERNET_SWITCH_CREATE_SCHEMA = {
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "Request validation to create a new Ethernet switch instance",
"type": "object",
"definitions": {
"EthernetSwitchPort": {
"description": "Ethernet port",
"properties": {
"name": {
"description": "Port name",
"type": "string",
"minLength": 1,
},
"port_number": {
"description": "Port number",
"type": "integer",
"minimum": 0
},
"type": {
"description": "Port type",
"enum": ["access", "dot1q", "qinq"],
},
"vlan": {"description": "VLAN number",
"type": "integer",
"minimum": 1
},
"ethertype": {
"description": "QinQ Ethertype",
"enum": ["", "0x8100", "0x88A8", "0x9100", "0x9200"],
},
},
"required": ["name", "port_number", "type"],
"additionalProperties": False
},
},
"properties": {
"name": {
"description": "Ethernet switch name",
"type": "string",
"minLength": 1,
},
"usage": {
"description": "How to use the switch",
"type": "string",
},
"console": {
"description": "Console TCP port",
"minimum": 1,
"maximum": 65535,
"type": ["integer", "null"]
},
"console_type": {
"description": "Console type",
"enum": ["telnet", "none"]
},
"node_id": {
"description": "Node UUID",
"oneOf": [
{"type": "string",
"minLength": 36,
"maxLength": 36,
"pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"}
]
},
"ports_mapping": {
"type": "array",
"items": [
{"type": "object",
"oneOf": [
{"$ref": "#/definitions/EthernetSwitchPort"}
]},
]
},
},
"additionalProperties": False,
"required": ["name"]
}
ETHERNET_SWITCH_OBJECT_SCHEMA = {
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "Ethernet switch instance",
"type": "object",
"definitions": {
"EthernetSwitchPort": {
"description": "Ethernet port",
"properties": {
"name": {
"description": "Port name",
"type": "string",
"minLength": 1,
},
"port_number": {
"description": "Port number",
"type": "integer",
"minimum": 0
},
"type": {
"description": "Port type",
"enum": ["access", "dot1q", "qinq"],
},
"vlan": {"description": "VLAN number",
"type": "integer",
"minimum": 1
},
"ethertype": {
"description": "QinQ Ethertype",
"enum": ["", "0x8100", "0x88A8", "0x9100", "0x9200"],
},
},
"required": ["name", "port_number", "type"],
"additionalProperties": False
},
},
"properties": {
"name": {
"description": "Ethernet switch name",
"type": "string",
"minLength": 1,
},
"usage": {
"description": "How to use the switch",
"type": "string",
},
"node_id": {
"description": "Node UUID",
"type": "string",
"minLength": 36,
"maxLength": 36,
"pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
},
"project_id": {
"description": "Project UUID",
"type": "string",
"minLength": 36,
"maxLength": 36,
"pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
},
"ports_mapping": {
"type": "array",
"items": [
{"type": "object",
"oneOf": [
{"$ref": "#/definitions/EthernetSwitchPort"}
]},
]
},
"status": {
"description": "Node status",
"enum": ["started", "stopped", "suspended"]
},
"console": {
"description": "Console TCP port",
"minimum": 1,
"maximum": 65535,
"type": ["integer", "null"]
},
"console_type": {
"description": "Console type",
"enum": ["telnet", "none"]
},
},
"additionalProperties": False,
"required": ["name", "node_id", "project_id"]
}
ETHERNET_SWITCH_UPDATE_SCHEMA = copy.deepcopy(ETHERNET_SWITCH_OBJECT_SCHEMA)
del ETHERNET_SWITCH_UPDATE_SCHEMA["required"]
-94
View File
@@ -1,94 +0,0 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2016 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import copy
FRAME_RELAY_SWITCH_CREATE_SCHEMA = {
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "Request validation to create a new Frame Relay switch instance",
"type": "object",
"properties": {
"name": {
"description": "Frame Relay switch name",
"type": "string",
"minLength": 1,
},
"usage": {
"description": "How to use the Frame Relay switch",
"type": "string",
},
"node_id": {
"description": "Node UUID",
"oneOf": [
{"type": "string",
"minLength": 36,
"maxLength": 36,
"pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"}
]
},
"mappings": {
"description": "Frame Relay mappings",
"type": "object",
},
},
"additionalProperties": False,
"required": ["name"]
}
FRAME_RELAY_SWITCH_OBJECT_SCHEMA = {
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "Frame Relay switch instance",
"type": "object",
"properties": {
"name": {
"description": "Frame Relay switch name",
"type": "string",
"minLength": 1,
},
"usage": {
"description": "How to use the Frame Relay switch",
"type": "string",
},
"node_id": {
"description": "Node UUID",
"type": "string",
"minLength": 36,
"maxLength": 36,
"pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
},
"project_id": {
"description": "Project UUID",
"type": "string",
"minLength": 36,
"maxLength": 36,
"pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
},
"mappings": {
"description": "Frame Relay mappings",
"type": "object",
},
"status": {
"description": "Node status",
"enum": ["started", "stopped", "suspended"]
},
},
"additionalProperties": False,
"required": ["name", "node_id", "project_id"]
}
FRAME_RELAY_SWITCH_UPDATE_SCHEMA = copy.deepcopy(FRAME_RELAY_SWITCH_OBJECT_SCHEMA)
del FRAME_RELAY_SWITCH_UPDATE_SCHEMA["required"]
-60
View File
@@ -1,60 +0,0 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2016 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
GNS3VM_SETTINGS_SCHEMA = {
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "Settings of the GNS3VM",
"type": "object",
"properties": {
"enable": {
"type": "boolean",
"description": "Enable the VM"
},
"vmname": {
"type": "string",
"description": "The name of the VM"
},
"when_exit": {
"description": "What to do with the VM when GNS3 exit",
"enum": ["stop", "suspend", "keep"]
},
"headless": {
"type": "boolean",
"description": "Start the VM GUI or not",
},
"engine": {
"description": "The engine to use for the VM. Null to disable",
"enum": ["vmware", "virtualbox", None]
},
"vcpus": {
"description": "Number of vCPUS affected to the VM",
"type": "integer"
},
"ram": {
"description": "Amount of ram affected to the VM",
"type": "integer"
},
"port": {
"description": "Server port",
"type": "integer",
"minimum": 1,
"maximum": 65535
}
},
"additionalProperties": False
}
-208
View File
@@ -1,208 +0,0 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
IOU_CREATE_SCHEMA = {
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "Request validation to create a new IOU instance",
"type": "object",
"properties": {
"name": {
"description": "IOU VM name",
"type": "string",
"minLength": 1,
},
"node_id": {
"description": "Node UUID",
"oneOf": [
{"type": "string",
"minLength": 36,
"maxLength": 36,
"pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"},
{"type": "integer"} # for legacy projects
]
},
"usage": {
"description": "How to use the IOU VM",
"type": "string",
},
"console": {
"description": "Console TCP port",
"minimum": 1,
"maximum": 65535,
"type": ["integer", "null"]
},
"console_type": {
"description": "Console type",
"enum": ["telnet", "none"]
},
"path": {
"description": "Path of iou binary",
"type": "string"
},
"md5sum": {
"description": "Checksum of iou binary",
"type": ["string", "null"]
},
"serial_adapters": {
"description": "How many serial adapters are connected to the IOU",
"type": "integer"
},
"ethernet_adapters": {
"description": "How many ethernet adapters are connected to the IOU",
"type": "integer"
},
"ram": {
"description": "Allocated RAM MB",
"type": ["integer", "null"]
},
"nvram": {
"description": "Allocated NVRAM KB",
"type": ["integer", "null"]
},
"l1_keepalives": {
"description": "Always up ethernet interface",
"type": ["boolean", "null"]
},
"use_default_iou_values": {
"description": "Use default IOU values",
"type": ["boolean", "null"]
},
"startup_config_content": {
"description": "Startup-config of IOU",
"type": ["string", "null"]
},
"private_config_content": {
"description": "Private-config of IOU",
"type": ["string", "null"]
},
"application_id": {
"description": "Application ID for running IOU image",
"type": ["integer", "null"]
},
},
"additionalProperties": False,
"required": ["application_id", "name", "path"]
}
IOU_START_SCHEMA = {
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "Request validation to start an IOU instance",
"type": "object",
"properties": {
"iourc_content": {
"description": "Content of the iourc file. Ignored if Null",
"type": ["string", "null"]
},
"license_check": {
"description": "Whether the license should be checked",
"type": "boolean"
}
}
}
IOU_OBJECT_SCHEMA = {
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "IOU instance",
"type": "object",
"properties": {
"name": {
"description": "IOU VM name",
"type": "string",
"minLength": 1,
},
"node_id": {
"description": "IOU VM UUID",
"type": "string",
"minLength": 36,
"maxLength": 36,
"pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
},
"usage": {
"description": "How to use the IOU VM",
"type": "string",
},
"node_directory": {
"description": "Path to the node working directory",
"type": "string"
},
"status": {
"description": "VM status",
"enum": ["started", "stopped", "suspended"]
},
"console": {
"description": "Console TCP port",
"minimum": 1,
"maximum": 65535,
"type": ["integer", "null"]
},
"console_type": {
"description": "Console type",
"enum": ["telnet", "none"]
},
"project_id": {
"description": "Project UUID",
"type": "string",
"minLength": 36,
"maxLength": 36,
"pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
},
"path": {
"description": "Path of iou binary",
"type": "string"
},
"md5sum": {
"description": "Checksum of iou binary",
"type": ["string", "null"]
},
"serial_adapters": {
"description": "How many serial adapters are connected to the IOU",
"type": "integer"
},
"ethernet_adapters": {
"description": "How many ethernet adapters are connected to the IOU",
"type": "integer"
},
"ram": {
"description": "Allocated RAM MB",
"type": "integer"
},
"nvram": {
"description": "Allocated NVRAM KB",
"type": "integer"
},
"l1_keepalives": {
"description": "Always up ethernet interface",
"type": "boolean"
},
"use_default_iou_values": {
"description": "Use default IOU values",
"type": ["boolean", "null"]
},
"command_line": {
"description": "Last command line used by GNS3 to start IOU",
"type": "string"
},
"application_id": {
"description": "Application ID for running IOU image",
"type": "integer"
},
},
"additionalProperties": False
}
-33
View File
@@ -1,33 +0,0 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2018 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
IOU_LICENSE_SETTINGS_SCHEMA = {
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "IOU license",
"type": "object",
"properties": {
"iourc_content": {
"type": "string",
"description": "Content of iourc file"
},
"license_check": {
"type": "boolean",
"description": "Whether the license must be checked or not",
},
},
"additionalProperties": False
}
-69
View File
@@ -1,69 +0,0 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2016 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from .port import PORT_OBJECT_SCHEMA
NAT_OBJECT_SCHEMA = {
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "Nat instance",
"type": "object",
"properties": {
"name": {
"description": "Nat name",
"type": "string",
"minLength": 1,
},
"usage": {
"description": "How to use the Nat instance",
"type": "string",
},
"node_id": {
"description": "Node UUID",
"type": "string",
"minLength": 36,
"maxLength": 36,
"pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
},
"project_id": {
"description": "Project UUID",
"type": "string",
"minLength": 36,
"maxLength": 36,
"pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
},
"status": {
"description": "Node status",
"enum": ["started", "stopped", "suspended"]
},
"ports_mapping": {
"type": "array",
"items": [
PORT_OBJECT_SCHEMA
]
},
},
"additionalProperties": False,
"required": ["name", "node_id", "project_id"]
}
NAT_CREATE_SCHEMA = NAT_OBJECT_SCHEMA
NAT_CREATE_SCHEMA["required"] = ["name"]
NAT_UPDATE_SCHEMA = NAT_OBJECT_SCHEMA
del NAT_UPDATE_SCHEMA["required"]
-162
View File
@@ -1,162 +0,0 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2018 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
TRACENG_CREATE_SCHEMA = {
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "Request validation to create a new TraceNG instance",
"type": "object",
"properties": {
"name": {
"description": "TraceNG VM name",
"type": "string",
"minLength": 1,
},
"node_id": {
"description": "Node UUID",
"oneOf": [
{"type": "string",
"minLength": 36,
"maxLength": 36,
"pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"}
]
},
"console": {
"description": "Console TCP port",
"minimum": 1,
"maximum": 65535,
"type": ["integer", "null"]
},
"console_type": {
"description": "Console type",
"enum": ["none"]
},
"ip_address": {
"description": "Source IP address for tracing",
"type": ["string"]
},
"default_destination": {
"description": "Default destination IP address or hostname for tracing",
"type": ["string"]
}
},
"additionalProperties": False,
"required": ["name"]
}
TRACENG_UPDATE_SCHEMA = {
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "Request validation to update a TraceNG instance",
"type": "object",
"properties": {
"name": {
"description": "TraceNG VM name",
"type": ["string", "null"],
"minLength": 1,
},
"console": {
"description": "Console TCP port",
"minimum": 1,
"maximum": 65535,
"type": ["integer", "null"]
},
"console_type": {
"description": "Console type",
"enum": ["none"]
},
"ip_address": {
"description": "Source IP address for tracing",
"type": ["string"]
},
"default_destination": {
"description": "Default destination IP address or hostname for tracing",
"type": ["string"]
}
},
"additionalProperties": False,
}
TRACENG_START_SCHEMA = {
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "Request validation to start a TraceNG instance",
"type": "object",
"properties": {
"destination": {
"description": "Host or IP address to trace",
"type": ["string"]
}
},
}
TRACENG_OBJECT_SCHEMA = {
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "TraceNG instance",
"type": "object",
"properties": {
"name": {
"description": "TraceNG VM name",
"type": "string",
"minLength": 1,
},
"node_id": {
"description": "Node UUID",
"type": "string",
"minLength": 36,
"maxLength": 36,
"pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
},
"node_directory": {
"description": "Path to the VM working directory",
"type": "string"
},
"status": {
"description": "VM status",
"enum": ["started", "stopped", "suspended"]
},
"console": {
"description": "Console TCP port",
"minimum": 1,
"maximum": 65535,
"type": ["integer", "null"]
},
"console_type": {
"description": "Console type",
"enum": ["none"]
},
"project_id": {
"description": "Project UUID",
"type": "string",
"minLength": 36,
"maxLength": 36,
"pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
},
"command_line": {
"description": "Last command line used by GNS3 to start TraceNG",
"type": "string"
},
"ip_address": {
"description": "Source IP address for tracing",
"type": ["string"]
},
"default_destination": {
"description": "Default destination IP address or hostname for tracing",
"type": ["string"]
}
},
"additionalProperties": False,
"required": ["name", "node_id", "status", "console", "console_type", "project_id", "command_line", "ip_address", "default_destination"]
}
-188
View File
@@ -1,188 +0,0 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from .custom_adapters import CUSTOM_ADAPTERS_ARRAY_SCHEMA
VBOX_CREATE_SCHEMA = {
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "Request validation to create a new VirtualBox VM instance",
"type": "object",
"properties": {
"node_id": {
"description": "Node UUID",
"oneOf": [
{"type": "string",
"minLength": 36,
"maxLength": 36,
"pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"},
{"type": "integer"} # for legacy projects
]
},
"linked_clone": {
"description": "Whether the VM is a linked clone or not",
"type": "boolean"
},
"name": {
"description": "VirtualBox VM instance name",
"type": "string",
"minLength": 1,
},
"usage": {
"description": "How to use the VirtualBox VM",
"type": "string",
},
"vmname": {
"description": "VirtualBox VM name (in VirtualBox itself)",
"type": "string",
"minLength": 1,
},
"adapters": {
"description": "Number of adapters",
"type": "integer",
"minimum": 0,
"maximum": 36, # maximum given by the ICH9 chipset in VirtualBox
},
"use_any_adapter": {
"description": "Allow GNS3 to use any VirtualBox adapter",
"type": "boolean",
},
"adapter_type": {
"description": "VirtualBox adapter type",
"type": "string",
"minLength": 1,
},
"console": {
"description": "Console TCP port",
"minimum": 1,
"maximum": 65535,
"type": ["integer", "null"]
},
"console_type": {
"description": "Console type",
"enum": ["telnet", "none"]
},
"ram": {
"description": "Amount of RAM",
"minimum": 0,
"maximum": 65535,
"type": "integer"
},
"headless": {
"description": "Headless mode",
"type": "boolean"
},
"on_close": {
"description": "Action to execute on the VM is closed",
"enum": ["power_off", "shutdown_signal", "save_vm_state"],
},
"custom_adapters": CUSTOM_ADAPTERS_ARRAY_SCHEMA
},
"additionalProperties": False,
"required": ["name", "vmname"],
}
VBOX_OBJECT_SCHEMA = {
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "VirtualBox VM instance",
"type": "object",
"properties": {
"name": {
"description": "VirtualBox VM instance name",
"type": "string",
"minLength": 1,
},
"node_id": {
"description": "Node UUID",
"type": "string",
"minLength": 36,
"maxLength": 36,
"pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
},
"project_id": {
"description": "Project UUID",
"type": "string",
"minLength": 36,
"maxLength": 36,
"pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
},
"usage": {
"description": "How to use the VirtualBox VM",
"type": "string",
},
"vmname": {
"description": "VirtualBox VM name (in VirtualBox itself)",
"type": "string",
"minLength": 1,
},
"status": {
"description": "VM status",
"enum": ["started", "stopped", "suspended"]
},
"node_directory": {
"description": "Path to the VM working directory",
"type": ["string", "null"]
},
"headless": {
"description": "Headless mode",
"type": "boolean"
},
"on_close": {
"description": "Action to execute on the VM is closed",
"enum": ["power_off", "shutdown_signal", "save_vm_state"],
},
"adapters": {
"description": "Number of adapters",
"type": "integer",
"minimum": 0,
"maximum": 36, # maximum given by the ICH9 chipset in VirtualBox
},
"use_any_adapter": {
"description": "Allow GNS3 to use any VirtualBox adapter",
"type": "boolean",
},
"adapter_type": {
"description": "VirtualBox adapter type",
"type": "string",
"minLength": 1,
},
"console": {
"description": "Console TCP port",
"minimum": 1,
"maximum": 65535,
"type": ["integer", "null"]
},
"console_type": {
"description": "Console type",
"enum": ["telnet", "none"]
},
"ram": {
"description": "Amount of RAM",
"minimum": 0,
"maximum": 65535,
"type": "integer"
},
"linked_clone": {
"description": "Whether the VM is a linked clone or not",
"type": "boolean"
},
"custom_adapters": CUSTOM_ADAPTERS_ARRAY_SCHEMA
},
"additionalProperties": False,
}
-172
View File
@@ -1,172 +0,0 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from .custom_adapters import CUSTOM_ADAPTERS_ARRAY_SCHEMA
VMWARE_CREATE_SCHEMA = {
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "Request validation to create a new VMware VM instance",
"type": "object",
"properties": {
"node_id": {
"description": "Node UUID",
"type": "string",
"minLength": 36,
"maxLength": 36,
"pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
},
"linked_clone": {
"description": "Whether the VM is a linked clone or not",
"type": "boolean"
},
"name": {
"description": "VMware VM instance name",
"type": "string",
"minLength": 1,
},
"usage": {
"description": "How to use the VMware VM",
"type": "string",
},
"vmx_path": {
"description": "Path to the vmx file",
"type": "string",
"minLength": 1,
},
"console": {
"description": "Console TCP port",
"minimum": 1,
"maximum": 65535,
"type": ["integer", "null"]
},
"console_type": {
"description": "Console type",
"enum": ["telnet", "none"]
},
"headless": {
"description": "Headless mode",
"type": "boolean"
},
"on_close": {
"description": "Action to execute on the VM is closed",
"enum": ["power_off", "shutdown_signal", "save_vm_state"],
},
"adapters": {
"description": "Number of adapters",
"type": "integer",
"minimum": 0,
"maximum": 10, # maximum adapters support by VMware VMs
},
"adapter_type": {
"description": "VMware adapter type",
"type": "string",
"minLength": 1,
},
"use_any_adapter": {
"description": "Allow GNS3 to use any VMware adapter",
"type": "boolean",
},
"custom_adapters": CUSTOM_ADAPTERS_ARRAY_SCHEMA
},
"additionalProperties": False,
"required": ["name", "vmx_path", "linked_clone"],
}
VMWARE_OBJECT_SCHEMA = {
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "VMware VM instance",
"type": "object",
"properties": {
"name": {
"description": "VMware VM instance name",
"type": "string",
"minLength": 1,
},
"usage": {
"description": "How to use the VMware VM",
"type": "string",
},
"node_id": {
"description": "Node UUID",
"type": "string",
"minLength": 36,
"maxLength": 36,
"pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
},
"status": {
"description": "VM status",
"enum": ["started", "stopped", "suspended"]
},
"node_directory": {
"description": "Path to the node working directory",
"type": ["string", "null"]
},
"project_id": {
"description": "Project UUID",
"type": "string",
"minLength": 36,
"maxLength": 36,
"pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
},
"vmx_path": {
"description": "Path to the vmx file",
"type": "string",
"minLength": 1,
},
"headless": {
"description": "Headless mode",
"type": "boolean"
},
"on_close": {
"description": "Action to execute on the VM is closed",
"enum": ["power_off", "shutdown_signal", "save_vm_state"],
},
"adapters": {
"description": "Number of adapters",
"type": "integer",
"minimum": 0,
"maximum": 10, # maximum adapters support by VMware VMs
},
"adapter_type": {
"description": "VMware adapter type",
"type": "string",
"minLength": 1,
},
"use_any_adapter": {
"description": "Allow GNS3 to use any VMware adapter",
"type": "boolean",
},
"console": {
"description": "Console TCP port",
"minimum": 1,
"maximum": 65535,
"type": ["integer", "null"]
},
"console_type": {
"description": "Console type",
"enum": ["telnet", "none"]
},
"linked_clone": {
"description": "Whether the VM is a linked clone or not",
"type": "boolean"
},
"custom_adapters": CUSTOM_ADAPTERS_ARRAY_SCHEMA
},
"additionalProperties": False
}
-143
View File
@@ -1,143 +0,0 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
VPCS_CREATE_SCHEMA = {
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "Request validation to create a new VPCS instance",
"type": "object",
"properties": {
"name": {
"description": "VPCS VM name",
"type": "string",
"minLength": 1,
},
"usage": {
"description": "How to use the VPCS VM",
"type": "string",
},
"node_id": {
"description": "Node UUID",
"oneOf": [
{"type": "string",
"minLength": 36,
"maxLength": 36,
"pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"},
{"type": "integer"} # for legacy projects
]
},
"console": {
"description": "Console TCP port",
"minimum": 1,
"maximum": 65535,
"type": ["integer", "null"]
},
"console_type": {
"description": "Console type",
"enum": ["telnet", "none"]
},
"startup_script": {
"description": "Content of the VPCS startup script",
"type": ["string", "null"]
},
},
"additionalProperties": False,
"required": ["name"]
}
VPCS_UPDATE_SCHEMA = {
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "Request validation to update a VPCS instance",
"type": "object",
"properties": {
"name": {
"description": "VPCS VM name",
"type": ["string", "null"],
"minLength": 1,
},
"usage": {
"description": "How to use the VPCS VM",
"type": "string",
},
"console": {
"description": "Console TCP port",
"minimum": 1,
"maximum": 65535,
"type": ["integer", "null"]
},
"console_type": {
"description": "Console type",
"enum": ["telnet", "none"]
},
},
"additionalProperties": False,
}
VPCS_OBJECT_SCHEMA = {
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "VPCS instance",
"type": "object",
"properties": {
"name": {
"description": "VPCS VM name",
"type": "string",
"minLength": 1,
},
"usage": {
"description": "How to use the VPCS VM",
"type": "string",
},
"node_id": {
"description": "Node UUID",
"type": "string",
"minLength": 36,
"maxLength": 36,
"pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
},
"node_directory": {
"description": "Path to the VM working directory",
"type": "string"
},
"status": {
"description": "VM status",
"enum": ["started", "stopped", "suspended"]
},
"console": {
"description": "Console TCP port",
"minimum": 1,
"maximum": 65535,
"type": ["integer", "null"]
},
"console_type": {
"description": "Console type",
"enum": ["telnet", "none"]
},
"project_id": {
"description": "Project UUID",
"type": "string",
"minLength": 36,
"maxLength": 36,
"pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
},
"command_line": {
"description": "Last command line used by GNS3 to start VPCS",
"type": "string"
}
},
"additionalProperties": False,
"required": ["name", "node_id", "status", "console", "console_type", "project_id", "command_line"]
}