1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-11-12 03:18:55 +00:00
gns3-server/gns3server/schemas/dynamips_vm.py

763 lines
22 KiB
Python
Raw Normal View History

2015-02-10 01:24:13 +00:00
# -*- 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/>.
DYNAMIPS_ADAPTERS = {
"description": "Dynamips Network Module",
"enum": ["C7200-IO-2FE",
"C7200-IO-FE",
"C7200-IO-GE-E",
"NM-16ESW",
"NM-1E",
"NM-1FE-TX",
"NM-4E",
"NM-4T",
"PA-2FE-TX",
"PA-4E",
"PA-4T+",
"PA-8E",
"PA-8T",
"PA-A1",
"PA-FE-TX",
"PA-GE",
"PA-POS-OC3",
"C2600-MB-2FE",
"C2600-MB-1E",
"C1700-MB-1FE",
"C2600-MB-2E",
"C2600-MB-1FE",
"C1700-MB-WIC1",
"GT96100-FE",
"Leopard-2FE",
""]
}
DYNAMIPS_WICS = {
"description": "Dynamips WIC",
"enum": ["WIC-1ENET",
"WIC-1T",
"WIC-2T",
""]
}
#TODO: improve schema for Dynamips (match platform specific options, e.g. NPE allowd only for c7200)
2015-02-12 02:21:34 +00:00
VM_CREATE_SCHEMA = {
2015-02-10 01:24:13 +00:00
"$schema": "http://json-schema.org/draft-04/schema#",
2015-02-12 02:21:34 +00:00
"description": "Request validation to create a new Dynamips VM instance",
2015-02-10 01:24:13 +00:00
"type": "object",
"properties": {
"node_id": {
2016-05-13 01:07:25 +00:00
"description": "Node UUID",
2015-02-12 02:21:34 +00:00
"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
]
},
"dynamips_id": {
2016-05-13 01:07:25 +00:00
"description": "Dynamips ID",
"type": ["integer", "null"]
2015-02-12 02:21:34 +00:00
},
2015-02-10 01:24:13 +00:00
"name": {
2015-02-12 02:21:34 +00:00
"description": "Dynamips VM instance name",
2015-02-10 01:24:13 +00:00
"type": "string",
"minLength": 1,
},
"usage": {
"description": "How to use the Dynamips VM",
"type": "string",
},
2015-02-10 01:24:13 +00:00
"platform": {
2016-05-13 01:07:25 +00:00
"description": "Cisco router platform",
2015-02-10 01:24:13 +00:00
"type": "string",
"minLength": 1,
"pattern": "^c[0-9]{4}$"
},
2015-02-13 22:11:14 +00:00
"chassis": {
2016-05-13 01:07:25 +00:00
"description": "Cisco router chassis model",
2015-02-13 22:11:14 +00:00
"type": "string",
"minLength": 1,
"pattern": "^[0-9]{4}(XM)?$"
},
2015-02-12 02:21:34 +00:00
"image": {
2016-05-13 01:07:25 +00:00
"description": "Path to the IOS image",
2015-02-12 02:21:34 +00:00
"type": "string",
"minLength": 1,
},
"image_md5sum": {
2016-05-13 01:07:25 +00:00
"description": "Checksum of the IOS image",
2015-06-19 14:38:22 +00:00
"type": ["string", "null"],
"minLength": 1,
},
"startup_config_content": {
"description": "Content of IOS startup configuration file",
"type": "string",
},
"private_config_content": {
"description": "Content of IOS private configuration file",
"type": "string",
},
2015-02-10 01:24:13 +00:00
"ram": {
2016-05-13 01:07:25 +00:00
"description": "Amount of RAM in MB",
2015-02-10 01:24:13 +00:00
"type": "integer"
},
2015-02-12 02:21:34 +00:00
"nvram": {
2016-05-13 01:07:25 +00:00
"description": "Amount of NVRAM in KB",
2015-02-12 02:21:34 +00:00
"type": "integer"
},
"mmap": {
"description": "MMAP feature",
"type": "boolean"
},
"sparsemem": {
2016-05-13 01:07:25 +00:00
"description": "Sparse memory feature",
2015-02-12 02:21:34 +00:00
"type": "boolean"
},
"clock_divisor": {
2016-05-13 01:07:25 +00:00
"description": "Clock divisor",
2015-02-12 02:21:34 +00:00
"type": "integer"
},
"idlepc": {
"description": "Idle-PC value",
"type": "string",
"pattern": "^(0x[0-9a-fA-F]+)?$"
},
"idlemax": {
2016-05-13 01:07:25 +00:00
"description": "Idlemax value",
2015-02-12 02:21:34 +00:00
"type": "integer",
},
"idlesleep": {
2016-05-13 01:07:25 +00:00
"description": "Idlesleep value",
2015-02-12 02:21:34 +00:00
"type": "integer",
},
"exec_area": {
2016-05-13 01:07:25 +00:00
"description": "Exec area value",
2015-02-12 02:21:34 +00:00
"type": "integer",
},
"disk0": {
2016-05-13 01:07:25 +00:00
"description": "Disk0 size in MB",
2015-02-12 02:21:34 +00:00
"type": "integer"
},
"disk1": {
2016-05-13 01:07:25 +00:00
"description": "Disk1 size in MB",
2015-02-12 02:21:34 +00:00
"type": "integer"
},
"auto_delete_disks": {
2016-05-13 01:07:25 +00:00
"description": "Automatically delete nvram and disk files",
"type": "boolean"
},
2015-02-10 01:24:13 +00:00
"console": {
2016-05-13 01:07:25 +00:00
"description": "Console TCP port",
2018-03-24 11:11:21 +00:00
"type": ["integer", "null"],
2015-02-10 01:24:13 +00:00
"minimum": 1,
"maximum": 65535
},
2016-03-15 09:45:05 +00:00
"console_type": {
2016-05-13 01:07:25 +00:00
"description": "Console type",
2018-03-24 11:11:21 +00:00
"enum": ["telnet", "none"]
2016-03-15 09:45:05 +00:00
},
2015-02-10 01:24:13 +00:00
"aux": {
2016-05-13 01:07:25 +00:00
"description": "Auxiliary console TCP port",
"type": ["null", "integer"],
2015-02-10 01:24:13 +00:00
"minimum": 1,
"maximum": 65535
},
"mac_addr": {
2016-05-13 01:07:25 +00:00
"description": "Base MAC address",
"type": ["null", "string"],
2015-02-10 01:24:13 +00:00
"minLength": 1,
"pattern": "^([0-9a-fA-F]{4}\\.){2}[0-9a-fA-F]{4}$"
},
2015-02-12 02:21:34 +00:00
"system_id": {
2016-05-13 01:07:25 +00:00
"description": "System ID",
2015-02-10 01:24:13 +00:00
"type": "string",
2015-02-12 02:21:34 +00:00
"minLength": 1,
},
"slot0": {
"description": "Network module slot 0",
"oneOf": [
{"type": "string"},
{"type": "null"}
]
},
"slot1": {
"description": "Network module slot 1",
"oneOf": [
{"type": "string"},
{"type": "null"}
]
},
"slot2": {
"description": "Network module slot 2",
"oneOf": [
{"type": "string"},
{"type": "null"}
]
},
"slot3": {
"description": "Network module slot 3",
"oneOf": [
{"type": "string"},
{"type": "null"}
]
},
"slot4": {
"description": "Network module slot 4",
"oneOf": [
{"type": "string"},
{"type": "null"}
]
},
"slot5": {
"description": "Network module slot 5",
"oneOf": [
{"type": "string"},
{"type": "null"}
]
},
"slot6": {
"description": "Network module slot 6",
"oneOf": [
{"type": "string"},
{"type": "null"}
]
},
"wic0": {
"description": "Network module WIC slot 0",
"oneOf": [
{"type": "string"},
{"type": "null"}
]
},
"wic1": {
"description": "Network module WIC slot 0",
"oneOf": [
{"type": "string"},
{"type": "null"}
]
},
"wic2": {
"description": "Network module WIC slot 0",
"oneOf": [
{"type": "string"},
{"type": "null"}
]
},
# C7200 properties
"npe": {
"description": "NPE model",
"enum": ["npe-100",
"npe-150",
"npe-175",
"npe-200",
"npe-225",
"npe-300",
"npe-400",
"npe-g2"]
},
"midplane": {
"description": "Midplane model",
"enum": ["std", "vxr"]
},
"sensors": {
"description": "Temperature sensors",
"type": "array"
},
"power_supplies": {
"description": "Power supplies status",
"type": "array"
},
# I/O memory property for all platforms but C7200
"iomem": {
"description": "I/O memory percentage",
"type": "integer",
"minimum": 0,
"maximum": 100
},
2015-02-10 01:24:13 +00:00
},
"additionalProperties": False,
"required": ["name", "platform", "image", "ram"]
}
2015-02-12 02:21:34 +00:00
VM_UPDATE_SCHEMA = {
2015-02-10 01:24:13 +00:00
"$schema": "http://json-schema.org/draft-04/schema#",
2015-02-12 02:21:34 +00:00
"description": "Request validation to update a Dynamips VM instance",
2015-02-10 01:24:13 +00:00
"type": "object",
"properties": {
"name": {
2015-02-12 02:21:34 +00:00
"description": "Dynamips VM instance name",
"type": "string",
"minLength": 1,
},
"usage": {
"description": "How to use the Dynamips VM",
"type": "string",
},
2015-02-12 02:21:34 +00:00
"platform": {
2016-05-13 01:07:25 +00:00
"description": "Cisco router platform",
2015-02-12 02:21:34 +00:00
"type": "string",
"minLength": 1,
"pattern": "^c[0-9]{4}$"
},
2015-02-13 22:11:14 +00:00
"chassis": {
2016-05-13 01:07:25 +00:00
"description": "Cisco router chassis model",
2015-02-13 22:11:14 +00:00
"type": "string",
"minLength": 1,
"pattern": "^[0-9]{4}(XM)?$"
},
2015-02-12 02:21:34 +00:00
"image": {
2016-05-13 01:07:25 +00:00
"description": "Path to the IOS image",
2015-02-12 02:21:34 +00:00
"type": "string",
"minLength": 1,
},
"image_md5sum": {
2016-05-13 01:07:25 +00:00
"description": "Checksum of the IOS image",
2015-06-19 14:38:22 +00:00
"type": ["string", "null"],
"minLength": 1,
},
"dynamips_id": {
"description": "Dynamips ID",
"type": "integer"
},
2015-02-12 02:21:34 +00:00
"ram": {
2016-05-13 01:07:25 +00:00
"description": "Amount of RAM in MB",
2015-02-12 02:21:34 +00:00
"type": "integer"
},
"nvram": {
2016-05-13 01:07:25 +00:00
"description": "Amount of NVRAM in KB",
2015-02-12 02:21:34 +00:00
"type": "integer"
},
"mmap": {
"description": "MMAP feature",
"type": "boolean"
},
"sparsemem": {
2016-05-13 01:07:25 +00:00
"description": "Sparse memory feature",
2015-02-12 02:21:34 +00:00
"type": "boolean"
},
"clock_divisor": {
2016-05-13 01:07:25 +00:00
"description": "Clock divisor",
2015-02-12 02:21:34 +00:00
"type": "integer"
},
"idlepc": {
"description": "Idle-PC value",
"type": "string",
"pattern": "^(0x[0-9a-fA-F]+)?$"
},
"idlemax": {
2016-05-13 01:07:25 +00:00
"description": "Idlemax value",
2015-02-12 02:21:34 +00:00
"type": "integer",
},
"idlesleep": {
2016-05-13 01:07:25 +00:00
"description": "Idlesleep value",
2015-02-12 02:21:34 +00:00
"type": "integer",
},
"exec_area": {
2016-05-13 01:07:25 +00:00
"description": "Exec area value",
2015-02-12 02:21:34 +00:00
"type": "integer",
},
"disk0": {
2016-05-13 01:07:25 +00:00
"description": "Disk0 size in MB",
2015-02-12 02:21:34 +00:00
"type": "integer"
},
"disk1": {
2016-05-13 01:07:25 +00:00
"description": "Disk1 size in MB",
2015-02-12 02:21:34 +00:00
"type": "integer"
},
"auto_delete_disks": {
2016-05-13 01:07:25 +00:00
"description": "Automatically delete nvram and disk files",
"type": "boolean"
},
2015-02-12 02:21:34 +00:00
"console": {
2016-05-13 01:07:25 +00:00
"description": "Console TCP port",
2018-03-24 11:11:21 +00:00
"type": ["integer", "null"],
2015-02-12 02:21:34 +00:00
"minimum": 1,
"maximum": 65535
},
2016-03-15 09:45:05 +00:00
"console_type": {
2016-05-13 01:07:25 +00:00
"description": "Console type",
2018-03-24 11:11:21 +00:00
"enum": ["telnet", "none"]
2016-03-15 09:45:05 +00:00
},
2015-02-12 02:21:34 +00:00
"aux": {
2016-05-13 01:07:25 +00:00
"description": "Auxiliary console TCP port",
2015-02-12 02:21:34 +00:00
"type": "integer",
"minimum": 1,
"maximum": 65535
},
"mac_addr": {
2016-05-13 01:07:25 +00:00
"description": "Base MAC address",
"type": ["null", "string"],
2015-02-10 01:24:13 +00:00
"minLength": 1,
2015-02-12 02:21:34 +00:00
"pattern": "^([0-9a-fA-F]{4}\\.){2}[0-9a-fA-F]{4}$"
},
"system_id": {
2016-05-13 01:07:25 +00:00
"description": "System ID",
2015-02-12 02:21:34 +00:00
"type": "string",
"minLength": 1,
},
"slot0": {
"description": "Network module slot 0",
"oneOf": [
{"type": "string"},
{"type": "null"}
]
},
"slot1": {
"description": "Network module slot 1",
"oneOf": [
{"type": "string"},
{"type": "null"}
]
},
"slot2": {
"description": "Network module slot 2",
"oneOf": [
{"type": "string"},
{"type": "null"}
]
},
"slot3": {
"description": "Network module slot 3",
"oneOf": [
{"type": "string"},
{"type": "null"}
]
},
"slot4": {
"description": "Network module slot 4",
"oneOf": [
{"type": "string"},
{"type": "null"}
]
},
"slot5": {
"description": "Network module slot 5",
"oneOf": [
{"type": "string"},
{"type": "null"}
]
},
"slot6": {
"description": "Network module slot 6",
"oneOf": [
{"type": "string"},
{"type": "null"}
]
},
"wic0": {
"description": "Network module WIC slot 0",
"oneOf": [
{"type": "string"},
{"type": "null"}
]
},
"wic1": {
"description": "Network module WIC slot 0",
"oneOf": [
{"type": "string"},
{"type": "null"}
]
},
"wic2": {
"description": "Network module WIC slot 0",
"oneOf": [
{"type": "string"},
{"type": "null"}
]
},
# C7200 properties
"npe": {
"description": "NPE model",
"enum": ["npe-100",
"npe-150",
"npe-175",
"npe-200",
"npe-225",
"npe-300",
"npe-400",
"npe-g2"]
},
"midplane": {
"description": "Midplane model",
"enum": ["std", "vxr"]
},
"sensors": {
"description": "Temperature sensors",
"type": "array"
},
"power_supplies": {
"description": "Power supplies status",
"type": "array"
},
# I/O memory property for all platforms but C7200
"iomem": {
"description": "I/O memory percentage",
"type": "integer",
"minimum": 0,
"maximum": 100
},
},
"additionalProperties": False,
}
2015-02-13 22:41:56 +00:00
2015-02-12 02:21:34 +00:00
VM_OBJECT_SCHEMA = {
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "Dynamips VM instance",
"type": "object",
"properties": {
"dynamips_id": {
"description": "ID to use with Dynamips",
"type": "integer"
2015-02-10 01:24:13 +00:00
},
"node_id": {
2016-05-13 01:07:25 +00:00
"description": "Node UUID",
2015-02-10 01:24:13 +00:00
"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"
},
2015-02-10 01:24:13 +00:00
"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}$"
},
2015-02-12 02:21:34 +00:00
"name": {
"description": "Dynamips VM instance name",
"type": "string",
"minLength": 1,
},
"usage": {
"description": "How to use the Dynamips VM",
"type": "string",
},
2016-05-17 17:51:06 +00:00
"status": {
"description": "VM status",
"enum": ["started", "stopped", "suspended"]
},
2015-02-12 02:21:34 +00:00
"platform": {
2016-05-13 01:07:25 +00:00
"description": "Cisco router platform",
2015-02-12 02:21:34 +00:00
"type": "string",
"minLength": 1,
"pattern": "^c[0-9]{4}$"
},
2015-02-13 22:11:14 +00:00
"chassis": {
2016-05-13 01:07:25 +00:00
"description": "Cisco router chassis model",
2015-02-13 22:11:14 +00:00
"type": "string",
"minLength": 1,
"pattern": "^[0-9]{4}(XM)?$"
},
2015-02-12 02:21:34 +00:00
"image": {
2016-05-13 01:07:25 +00:00
"description": "Path to the IOS image",
2015-02-12 02:21:34 +00:00
"type": "string",
"minLength": 1,
},
"image_md5sum": {
2016-05-13 01:07:25 +00:00
"description": "Checksum of the IOS image",
2015-06-19 14:38:22 +00:00
"type": ["string", "null"],
"minLength": 1,
},
2015-02-12 02:21:34 +00:00
"ram": {
2016-05-13 01:07:25 +00:00
"description": "Amount of RAM in MB",
2015-02-12 02:21:34 +00:00
"type": "integer"
},
"nvram": {
2016-05-13 01:07:25 +00:00
"description": "Amount of NVRAM in KB",
2015-02-12 02:21:34 +00:00
"type": "integer"
},
"mmap": {
"description": "MMAP feature",
"type": "boolean"
},
"sparsemem": {
2016-05-13 01:07:25 +00:00
"description": "Sparse memory feature",
2015-02-12 02:21:34 +00:00
"type": "boolean"
},
"clock_divisor": {
2016-05-13 01:07:25 +00:00
"description": "Clock divisor",
2015-02-12 02:21:34 +00:00
"type": "integer"
},
"idlepc": {
"description": "Idle-PC value",
"type": "string",
"pattern": "^(0x[0-9a-fA-F]+)?$"
},
"idlemax": {
2016-05-13 01:07:25 +00:00
"description": "Idlemax value",
2015-02-12 02:21:34 +00:00
"type": "integer",
},
"idlesleep": {
2016-05-13 01:07:25 +00:00
"description": "Idlesleep value",
2015-02-12 02:21:34 +00:00
"type": "integer",
},
"exec_area": {
2016-05-13 01:07:25 +00:00
"description": "Exec area value",
2015-02-12 02:21:34 +00:00
"type": "integer",
},
"disk0": {
2016-05-13 01:07:25 +00:00
"description": "Disk0 size in MB",
2015-02-12 02:21:34 +00:00
"type": "integer"
},
"disk1": {
2016-05-13 01:07:25 +00:00
"description": "Disk1 size in MB",
2015-02-12 02:21:34 +00:00
"type": "integer"
},
"auto_delete_disks": {
2016-05-13 01:07:25 +00:00
"description": "Automatically delete nvram and disk files",
"type": "boolean"
},
2015-02-12 02:21:34 +00:00
"console": {
2016-05-13 01:07:25 +00:00
"description": "Console TCP port",
2018-03-24 11:11:21 +00:00
"type": ["integer", "null"],
2015-02-12 02:21:34 +00:00
"minimum": 1,
"maximum": 65535
},
2016-03-15 09:45:05 +00:00
"console_type": {
2016-05-13 01:07:25 +00:00
"description": "Console type",
2018-03-24 11:11:21 +00:00
"enum": ["telnet", "none"]
2016-03-15 09:45:05 +00:00
},
2015-02-12 02:21:34 +00:00
"aux": {
2016-05-13 01:07:25 +00:00
"description": "Auxiliary console TCP port",
"type": ["integer", "null"],
2015-02-12 02:21:34 +00:00
"minimum": 1,
"maximum": 65535
},
"mac_addr": {
2016-05-13 01:07:25 +00:00
"description": "Base MAC address",
"type": ["null", "string"]
2015-02-12 02:21:34 +00:00
#"minLength": 1,
#"pattern": "^([0-9a-fA-F]{4}\\.){2}[0-9a-fA-F]{4}$"
},
"system_id": {
2016-05-13 01:07:25 +00:00
"description": "System ID",
2015-02-12 02:21:34 +00:00
"type": "string",
"minLength": 1,
},
"slot0": {
"description": "Network module slot 0",
"oneOf": [
{"type": "string"},
{"type": "null"}
]
},
"slot1": {
"description": "Network module slot 1",
"oneOf": [
{"type": "string"},
{"type": "null"}
]
},
"slot2": {
"description": "Network module slot 2",
"oneOf": [
{"type": "string"},
{"type": "null"}
]
},
"slot3": {
"description": "Network module slot 3",
"oneOf": [
{"type": "string"},
{"type": "null"}
]
},
"slot4": {
"description": "Network module slot 4",
"oneOf": [
{"type": "string"},
{"type": "null"}
]
},
"slot5": {
"description": "Network module slot 5",
"oneOf": [
{"type": "string"},
{"type": "null"}
]
},
"slot6": {
"description": "Network module slot 6",
"oneOf": [
{"type": "string"},
{"type": "null"}
]
},
"wic0": {
"description": "Network module WIC slot 0",
"oneOf": [
{"type": "string"},
{"type": "null"}
]
},
"wic1": {
"description": "Network module WIC slot 0",
"oneOf": [
{"type": "string"},
{"type": "null"}
]
},
"wic2": {
"description": "Network module WIC slot 0",
"oneOf": [
{"type": "string"},
{"type": "null"}
]
},
# C7200 properties
"npe": {
"description": "NPE model",
"enum": ["npe-100",
"npe-150",
"npe-175",
"npe-200",
"npe-225",
"npe-300",
"npe-400",
"npe-g2"]
},
"midplane": {
"description": "Midplane model",
"enum": ["std", "vxr"]
},
"sensors": {
"description": "Temperature sensors",
"type": "array"
},
"power_supplies": {
"description": "Power supplies status",
"type": "array"
},
# I/O memory property for all platforms but C7200
"iomem": {
"description": "I/O memory percentage",
"type": "integer",
"minimum": 0,
"maximum": 100
},
2015-02-10 01:24:13 +00:00
},
"additionalProperties": False,
"required": ["name", "node_id", "project_id", "dynamips_id", "console", "console_type"]
2015-02-10 01:24:13 +00:00
}