1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-11-25 01:38:08 +00:00
gns3-server/gns3server/schemas/vmware.py

173 lines
5.5 KiB
Python
Raw Normal View History

# -*- 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": {
2016-05-13 01:07:25 +00:00
"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": {
2016-05-13 01:07:25 +00:00
"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": {
2016-05-13 01:07:25 +00:00
"description": "Path to the vmx file",
"type": "string",
"minLength": 1,
},
"console": {
2016-05-13 01:07:25 +00:00
"description": "Console TCP port",
"minimum": 1,
"maximum": 65535,
2018-03-24 11:11:21 +00:00
"type": ["integer", "null"]
},
"console_type": {
"description": "Console type",
2018-03-24 11:11:21 +00:00
"enum": ["telnet", "none"]
},
"headless": {
2016-05-13 01:07:25 +00:00
"description": "Headless mode",
"type": "boolean"
},
"on_close": {
"description": "Action to execute on the VM is closed",
"enum": ["power_off", "shutdown_signal", "save_vm_state"],
},
2015-05-15 02:11:57 +00:00
"adapters": {
2016-05-13 01:07:25 +00:00
"description": "Number of adapters",
2015-05-15 02:11:57 +00:00
"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": {
2016-05-13 01:07:25 +00:00
"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": {
2016-05-13 01:07:25 +00:00
"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}$"
},
2016-05-17 17:51:06 +00:00
"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": {
2016-05-13 01:07:25 +00:00
"description": "Path to the vmx file",
"type": "string",
"minLength": 1,
},
"headless": {
2016-05-13 01:07:25 +00:00
"description": "Headless mode",
"type": "boolean"
},
"on_close": {
"description": "Action to execute on the VM is closed",
"enum": ["power_off", "shutdown_signal", "save_vm_state"],
},
2015-05-15 02:11:57 +00:00
"adapters": {
2016-05-13 01:07:25 +00:00
"description": "Number of adapters",
2015-05-15 02:11:57 +00:00
"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": {
2016-05-13 01:07:25 +00:00
"description": "Allow GNS3 to use any VMware adapter",
"type": "boolean",
},
"console": {
2016-05-13 01:07:25 +00:00
"description": "Console TCP port",
"minimum": 1,
"maximum": 65535,
2018-03-24 11:11:21 +00:00
"type": ["integer", "null"]
},
"console_type": {
"description": "Console type",
2018-03-24 11:11:21 +00:00
"enum": ["telnet", "none"]
},
2016-07-12 14:29:58 +00:00
"linked_clone": {
"description": "Whether the VM is a linked clone or not",
"type": "boolean"
},
"custom_adapters": CUSTOM_ADAPTERS_ARRAY_SCHEMA
},
2016-07-12 14:29:58 +00:00
"additionalProperties": False
}