Move the generation of the list of ports to the server

Ref #676
This commit is contained in:
Julien Duponchelle committed 2016-09-14 15:21:37 +02:00
1 parent f06c00fdb8
commit 2f0e2260ab
50 files changed
+1347 -240

No files matched your search

+3 -3
View File
@@ -56,7 +56,7 @@ CLOUD_CREATE_SCHEMA = {
"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": {
"ports_mapping": {
"type": "array",
"items": [
PORT_OBJECT_SCHEMA
@@ -103,7 +103,7 @@ CLOUD_OBJECT_SCHEMA = {
"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": {
"ports_mapping": {
"type": "array",
"items": [
PORT_OBJECT_SCHEMA
@@ -124,7 +124,7 @@ CLOUD_OBJECT_SCHEMA = {
},
},
"additionalProperties": False,
"required": ["name", "node_id", "project_id", "ports"]
"required": ["name", "node_id", "project_id", "ports_mapping"]
}
CLOUD_UPDATE_SCHEMA = CLOUD_OBJECT_SCHEMA
+3 -3
View File
@@ -54,7 +54,7 @@ ETHERNET_HUB_CREATE_SCHEMA = {
"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": {
"ports_mapping": {
"type": "array",
"items": [
{"type": "object",
@@ -111,7 +111,7 @@ ETHERNET_HUB_OBJECT_SCHEMA = {
"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": {
"ports_mapping": {
"type": "array",
"items": [
{"type": "object",
@@ -126,7 +126,7 @@ ETHERNET_HUB_OBJECT_SCHEMA = {
},
},
"additionalProperties": False,
"required": ["name", "node_id", "project_id", "ports"]
"required": ["name", "node_id", "project_id", "ports_mapping"]
}
ETHERNET_HUB_UPDATE_SCHEMA = ETHERNET_HUB_OBJECT_SCHEMA
+2 -2
View File
@@ -66,7 +66,7 @@ ETHERNET_SWITCH_CREATE_SCHEMA = {
"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": {
"ports_mapping": {
"type": "array",
"items": [
{"type": "object",
@@ -135,7 +135,7 @@ ETHERNET_SWITCH_OBJECT_SCHEMA = {
"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": {
"ports_mapping": {
"type": "array",
"items": [
{"type": "object",
+1 -1
View File
@@ -46,7 +46,7 @@ NAT_OBJECT_SCHEMA = {
"description": "Node status",
"enum": ["started", "stopped", "suspended"]
},
"ports": {
"ports_mapping": {
"type": "array",
"items": [
PORT_OBJECT_SCHEMA
+49
View File
@@ -168,6 +168,55 @@ NODE_OBJECT_SCHEMA = {
"z": {
"description": "Z position of the node",
"type": "integer"
},
"port_name_format": {
"description": "Formating for port name {0} will be replace by port number",
"type": "string"
},
"port_segment_size": {
"description": "Size of the port segment",
"type": "integer",
"minimum": 0
},
"first_port_name": {
"description": "Name of the first port",
"type": ["string", "null"],
},
"ports": {
"description": "List of node ports READ only",
"type": "array",
"items": {
"type": "object",
"description": "A node port",
"properties": {
"name": {
"type": "string",
"description": "Port name",
},
"short_name": {
"type": "string",
"description": "Short version of port name",
},
"adapter_number": {
"type": "integer",
"description": "Adapter slot"
},
"port_number": {
"type": "integer",
"description": "Port slot"
},
"link_type": {
"description": "Type of link",
"enum": ["ethernet", "serial"]
},
"data_link_types": {
"type": "object",
"description": "Available PCAP type for capture",
"properties": {}
},
},
"additionalProperties": False
}
}
},
"additionalProperties": False,
+1 -43
View File
@@ -199,19 +199,6 @@ QEMU_CREATE_SCHEMA = {
"options": {
"description": "Additional QEMU options",
"type": ["string", "null"],
},
"port_name_format": {
"description": "Formating for port name {0} will be replace by port number",
"type": "string"
},
"port_segment_size": {
"description": "Size of the port segment",
"type": "integer",
"minimum": 0
},
"first_port_name": {
"description": "Name of the first port",
"type": ["string", "null"],
}
},
"additionalProperties": False,
@@ -389,19 +376,6 @@ QEMU_UPDATE_SCHEMA = {
"options": {
"description": "Additional QEMU options",
"type": ["string", "null"],
},
"port_name_format": {
"description": "Formating for port name {0} will be replace by port number",
"type": "string"
},
"port_segment_size": {
"description": "Size of the port segment",
"type": "integer",
"minimum": 0
},
"first_port_name": {
"description": "Name of the first port",
"type": ["string", "null"],
}
},
"additionalProperties": False,
@@ -595,19 +569,6 @@ QEMU_OBJECT_SCHEMA = {
"command_line": {
"description": "Last command line used by GNS3 to start QEMU",
"type": "string"
},
"port_name_format": {
"description": "Formating for port name {0} will be replace by port number",
"type": "string"
},
"port_segment_size": {
"description": "Size of the port segment",
"type": "integer",
"minimum": 0
},
"first_port_name": {
"description": "Name of the first port",
"type": "string",
}
},
"additionalProperties": False,
@@ -651,10 +612,7 @@ QEMU_OBJECT_SCHEMA = {
"options",
"node_directory",
"command_line",
"status",
"port_name_format",
"first_port_name",
"port_segment_size"]
"status"]
}
QEMU_BINARY_FILTER_SCHEMA = {
+3 -1
View File
@@ -103,10 +103,12 @@ TOPOLOGY_SCHEMA = {
def main():
import jsonschema
import json
import sys
with open(sys.argv[1]) as f:
jsonschema.validate(f.read(), TOPOLOGY_SCHEMA)
data = json.load(f)
jsonschema.validate(data, TOPOLOGY_SCHEMA)
if __name__ == '__main__':
-26
View File
@@ -83,19 +83,6 @@ VBOX_CREATE_SCHEMA = {
"acpi_shutdown": {
"description": "ACPI shutdown",
"type": "boolean"
},
"port_name_format": {
"description": "Formating for port name {0} will be replace by port number",
"type": "string"
},
"port_segment_size": {
"description": "Size of the port segment",
"type": "integer",
"minimum": 0
},
"first_port_name": {
"description": "Name of the first port",
"type": ["string", "null"]
}
},
"additionalProperties": False,
@@ -182,19 +169,6 @@ VBOX_OBJECT_SCHEMA = {
"linked_clone": {
"description": "Whether the VM is a linked clone or not",
"type": "boolean"
},
"port_name_format": {
"description": "Formating for port name {0} will be replace by port number",
"type": "string"
},
"port_segment_size": {
"description": "Size of the port segment",
"type": "integer",
"minimum": 0
},
"first_port_name": {
"description": "Name of the first port",
"type": ["string", "null"]
}
},
"additionalProperties": False,
-26
View File
@@ -74,19 +74,6 @@ VMWARE_CREATE_SCHEMA = {
"use_any_adapter": {
"description": "Allow GNS3 to use any VMware adapter",
"type": "boolean",
},
"port_name_format": {
"description": "Formating for port name {0} will be replace by port number",
"type": "string"
},
"port_segment_size": {
"description": "Size of the port segment",
"type": "integer",
"minimum": 0
},
"first_port_name": {
"description": "Name of the first port",
"type": ["string", "null"]
}
},
"additionalProperties": False,
@@ -167,19 +154,6 @@ VMWARE_OBJECT_SCHEMA = {
"linked_clone": {
"description": "Whether the VM is a linked clone or not",
"type": "boolean"
},
"port_name_format": {
"description": "Formating for port name {0} will be replace by port number",
"type": "string"
},
"port_segment_size": {
"description": "Size of the port segment",
"type": "integer",
"minimum": 0
},
"first_port_name": {
"description": "Name of the first port",
"type": ["string", "null"]
}
},
"additionalProperties": False