2015-02-11 16:37:05 +02:00
|
|
|
# -*- 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,
|
|
|
|
},
|
2016-05-11 20:35:36 +03:00
|
|
|
"node_id": {
|
2016-05-13 04:07:25 +03:00
|
|
|
"description": "Node UUID",
|
2015-02-11 16:37:05 +02: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
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"console": {
|
2016-05-13 04:07:25 +03:00
|
|
|
"description": "Console TCP port",
|
2015-02-11 16:37:05 +02:00
|
|
|
"minimum": 1,
|
|
|
|
"maximum": 65535,
|
|
|
|
"type": ["integer", "null"]
|
|
|
|
},
|
2016-06-10 17:39:54 +03:00
|
|
|
"console_type": {
|
|
|
|
"description": "Console type",
|
|
|
|
"enum": ["telnet", None]
|
|
|
|
},
|
2015-02-12 16:20:47 +02:00
|
|
|
"path": {
|
2015-02-11 16:37:05 +02:00
|
|
|
"description": "Path of iou binary",
|
|
|
|
"type": "string"
|
|
|
|
},
|
2015-06-19 17:18:43 +03:00
|
|
|
"md5sum": {
|
|
|
|
"description": "Checksum of iou binary",
|
2015-06-19 17:38:22 +03:00
|
|
|
"type": ["string", "null"]
|
2015-06-19 17:18:43 +03:00
|
|
|
},
|
2015-02-12 22:02:52 +02:00
|
|
|
"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"]
|
2015-02-13 17:57:35 +02:00
|
|
|
},
|
|
|
|
"l1_keepalives": {
|
|
|
|
"description": "Always up ethernet interface",
|
|
|
|
"type": ["boolean", "null"]
|
2015-02-13 23:16:43 +02:00
|
|
|
},
|
2015-03-07 15:27:09 +02:00
|
|
|
"use_default_iou_values": {
|
|
|
|
"description": "Use default IOU values",
|
|
|
|
"type": ["boolean", "null"]
|
|
|
|
},
|
2015-06-07 00:15:03 +03:00
|
|
|
"startup_config_content": {
|
|
|
|
"description": "Startup-config of IOU",
|
|
|
|
"type": ["string", "null"]
|
|
|
|
},
|
|
|
|
"private_config_content": {
|
|
|
|
"description": "Private-config of IOU",
|
2015-02-13 23:16:43 +02:00
|
|
|
"type": ["string", "null"]
|
2015-03-17 17:31:45 +02:00
|
|
|
},
|
2017-06-27 11:09:21 +03:00
|
|
|
"application_id": {
|
|
|
|
"description": "Application ID for running IOU image",
|
|
|
|
"type": ["integer", "null"]
|
|
|
|
},
|
2015-02-11 16:37:05 +02:00
|
|
|
},
|
|
|
|
"additionalProperties": False,
|
2015-02-12 18:03:01 +02:00
|
|
|
"required": ["name", "path"]
|
2015-02-11 16:37:05 +02:00
|
|
|
}
|
|
|
|
|
2015-07-09 17:06:52 +03:00
|
|
|
|
|
|
|
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"]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-02-11 16:37:05 +02:00
|
|
|
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,
|
|
|
|
},
|
2016-05-11 20:35:36 +03:00
|
|
|
"node_id": {
|
2015-02-11 16:37:05 +02:00
|
|
|
"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}$"
|
|
|
|
},
|
2016-05-12 11:39:50 +03:00
|
|
|
"node_directory": {
|
2016-05-13 04:07:25 +03:00
|
|
|
"description": "Path to the node working directory",
|
2015-06-25 12:17:32 +03:00
|
|
|
"type": "string"
|
|
|
|
},
|
2016-05-17 20:51:06 +03:00
|
|
|
"status": {
|
|
|
|
"description": "VM status",
|
|
|
|
"enum": ["started", "stopped", "suspended"]
|
|
|
|
},
|
2015-02-11 16:37:05 +02:00
|
|
|
"console": {
|
2016-05-13 04:07:25 +03:00
|
|
|
"description": "Console TCP port",
|
2015-02-11 16:37:05 +02:00
|
|
|
"minimum": 1,
|
|
|
|
"maximum": 65535,
|
|
|
|
"type": "integer"
|
|
|
|
},
|
2016-05-17 20:51:06 +03:00
|
|
|
"console_type": {
|
|
|
|
"description": "Console type",
|
|
|
|
"enum": ["telnet"]
|
|
|
|
},
|
2015-02-11 16:37:05 +02: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 16:20:47 +02:00
|
|
|
"path": {
|
2015-02-11 16:37:05 +02:00
|
|
|
"description": "Path of iou binary",
|
|
|
|
"type": "string"
|
|
|
|
},
|
2015-06-17 18:11:25 +03:00
|
|
|
"md5sum": {
|
|
|
|
"description": "Checksum of iou binary",
|
2015-06-19 17:38:22 +03:00
|
|
|
"type": ["string", "null"]
|
2015-06-17 18:11:25 +03:00
|
|
|
},
|
2015-02-12 22:02:52 +02:00
|
|
|
"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"
|
2015-02-13 17:57:35 +02:00
|
|
|
},
|
|
|
|
"l1_keepalives": {
|
|
|
|
"description": "Always up ethernet interface",
|
|
|
|
"type": "boolean"
|
2015-02-13 23:16:43 +02:00
|
|
|
},
|
2015-03-07 15:27:09 +02:00
|
|
|
"use_default_iou_values": {
|
|
|
|
"description": "Use default IOU values",
|
|
|
|
"type": ["boolean", "null"]
|
2015-03-17 17:31:45 +02:00
|
|
|
},
|
2016-02-02 19:25:17 +02:00
|
|
|
"command_line": {
|
|
|
|
"description": "Last command line used by GNS3 to start QEMU",
|
|
|
|
"type": "string"
|
2017-06-27 11:09:21 +03:00
|
|
|
},
|
|
|
|
"application_id": {
|
|
|
|
"description": "Application ID for running IOU image",
|
2017-06-27 12:14:34 +03:00
|
|
|
"type": "integer"
|
2017-06-27 11:09:21 +03:00
|
|
|
},
|
2015-02-11 16:37:05 +02:00
|
|
|
},
|
2016-07-18 19:43:55 +03:00
|
|
|
"additionalProperties": False
|
2015-02-11 16:37:05 +02:00
|
|
|
}
|