{
    "additionalProperties": false,
    "$schema": "http://json-schema.org/draft-04/schema#",
    "description": "The topology",
    "type": "object",
    "properties": {
        "auto_close": {
            "description": "Close the topology when no client is connected",
            "type": "boolean"
        },
        "scene_width": {
            "description": "Width of the drawing area",
            "type": "integer"
        },
        "revision": {
            "description": "Version of the .gns3 specification.",
            "type": "integer"
        },
        "version": {
            "description": "Version of the GNS3 software which have update the file for the last time",
            "type": "string"
        },
        "scene_height": {
            "description": "Height of the drawing area",
            "type": "integer"
        },
        "auto_open": {
            "description": "Open the topology with GNS3",
            "type": "boolean"
        },
        "type": {
            "description": "Type of file. It's always topology",
            "enum": [
                "topology"
            ]
        },
        "topology": {
            "description": "The topology content",
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "computes": {
                    "description": "Computes servers",
                    "type": "array",
                    "items": {
                        "additionalProperties": false,
                        "$schema": "http://json-schema.org/draft-04/schema#",
                        "description": "Request validation to a GNS3 compute object instance",
                        "type": "object",
                        "properties": {
                            "memory_usage_percent": {
                                "description": "RAM usage of the compute. Read only",
                                "type": [
                                    "number",
                                    "null"
                                ],
                                "maximum": 100,
                                "minimum": 0
                            },
                            "user": {
                                "description": "User for authentication",
                                "type": [
                                    "string",
                                    "null"
                                ]
                            },
                            "port": {
                                "description": "Server port",
                                "type": "integer"
                            },
                            "protocol": {
                                "description": "Server protocol",
                                "enum": [
                                    "http",
                                    "https"
                                ]
                            },
                            "cpu_usage_percent": {
                                "description": "CPU usage of the compute. Read only",
                                "type": [
                                    "number",
                                    "null"
                                ],
                                "maximum": 100,
                                "minimum": 0
                            },
                            "connected": {
                                "description": "Whether the controller is connected to the compute server or not",
                                "type": "boolean"
                            },
                            "host": {
                                "description": "Server host",
                                "type": "string"
                            },
                            "name": {
                                "description": "Server name",
                                "type": "string"
                            },
                            "compute_id": {
                                "description": "Server identifier",
                                "type": "string"
                            },
                            "capabilities": {
                                "additionalProperties": false,
                                "$schema": "http://json-schema.org/draft-04/schema#",
                                "description": "Get what a server support",
                                "type": "object",
                                "properties": {
                                    "platform": {
                                        "description": "Platform where the compute is running",
                                        "type": "string"
                                    },
                                    "version": {
                                        "description": "Version number",
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    },
                                    "node_types": {
                                        "description": "Node type supported by the compute",
                                        "type": "array",
                                        "items": {
                                            "description": "Type of node",
                                            "enum": [
                                                "cloud",
                                                "nat",
                                                "ethernet_hub",
                                                "ethernet_switch",
                                                "frame_relay_switch",
                                                "atm_switch",
                                                "docker",
                                                "dynamips",
                                                "vpcs",
                                                "virtualbox",
                                                "vmware",
                                                "iou",
                                                "qemu"
                                            ]
                                        }
                                    }
                                },
                                "required": [
                                    "version",
                                    "node_types"
                                ]
                            }
                        },
                        "required": [
                            "compute_id",
                            "protocol",
                            "host",
                            "port",
                            "name"
                        ]
                    }
                },
                "drawings": {
                    "description": "Drawings elements",
                    "type": "array",
                    "items": {
                        "description": "An drawing object",
                        "type": "object",
                        "$schema": "http://json-schema.org/draft-04/schema#",
                        "additionalProperties": false,
                        "properties": {
                            "y": {
                                "description": "Y property",
                                "type": "integer"
                            },
                            "rotation": {
                                "description": "Rotation of the element",
                                "type": "integer",
                                "maximum": 360,
                                "minimum": -359
                            },
                            "drawing_id": {
                                "minLength": 36,
                                "description": "Drawing UUID",
                                "type": "string",
                                "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}$",
                                "maxLength": 36
                            },
                            "z": {
                                "description": "Z property",
                                "type": "integer"
                            },
                            "x": {
                                "description": "X property",
                                "type": "integer"
                            },
                            "project_id": {
                                "minLength": 36,
                                "description": "Project UUID",
                                "type": "string",
                                "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}$",
                                "maxLength": 36
                            },
                            "svg": {
                                "description": "SVG content of the drawing",
                                "type": "string"
                            }
                        }
                    }
                },
                "links": {
                    "description": "Link elements",
                    "type": "array",
                    "items": {
                        "additionalProperties": false,
                        "$schema": "http://json-schema.org/draft-04/schema#",
                        "description": "A link object",
                        "type": "object",
                        "properties": {
                            "project_id": {
                                "minLength": 36,
                                "description": "Project UUID",
                                "type": "string",
                                "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}$",
                                "maxLength": 36
                            },
                            "nodes": {
                                "description": "List of the VMS",
                                "type": "array",
                                "items": {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                        "port_number": {
                                            "description": "Port number",
                                            "type": "integer"
                                        },
                                        "adapter_number": {
                                            "description": "Adapter number",
                                            "type": "integer"
                                        },
                                        "label": {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                                "text": {
                                                    "type": "string"
                                                },
                                                "y": {
                                                    "description": "Relative Y position of the label",
                                                    "type": "integer"
                                                },
                                                "style": {
                                                    "description": "SVG style attribute",
                                                    "type": "string"
                                                },
                                                "x": {
                                                    "description": "Relative X position of the label. If null center it",
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ]
                                                },
                                                "rotation": {
                                                    "description": "Rotation of the label",
                                                    "type": "integer",
                                                    "maximum": 360,
                                                    "minimum": -359
                                                }
                                            },
                                            "required": [
                                                "text",
                                                "x",
                                                "y"
                                            ]
                                        },
                                        "node_id": {
                                            "minLength": 36,
                                            "description": "Node UUID",
                                            "type": "string",
                                            "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}$",
                                            "maxLength": 36
                                        }
                                    },
                                    "required": [
                                        "node_id",
                                        "adapter_number",
                                        "port_number"
                                    ]
                                }
                            },
                            "capture_file_path": {
                                "description": "Read only property. The full path of the capture file if capture is running",
                                "type": [
                                    "string",
                                    "null"
                                ]
                            },
                            "link_id": {
                                "minLength": 36,
                                "description": "Link UUID",
                                "type": "string",
                                "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}$",
                                "maxLength": 36
                            },
                            "capture_file_name": {
                                "description": "Read only property. The name of the capture file if capture is running",
                                "type": [
                                    "string",
                                    "null"
                                ]
                            },
                            "capturing": {
                                "description": "Read only property. True if a capture running on the link",
                                "type": "boolean"
                            },
                            "link_type": {
                                "description": "Type of link",
                                "enum": [
                                    "ethernet",
                                    "serial"
                                ]
                            }
                        },
                        "required": [
                            "nodes"
                        ]
                    }
                },
                "nodes": {
                    "description": "Nodes elements",
                    "type": "array",
                    "items": {
                        "additionalProperties": false,
                        "$schema": "http://json-schema.org/draft-04/schema#",
                        "description": "A node object",
                        "type": "object",
                        "properties": {
                            "node_directory": {
                                "description": "Working directory of the node. Read only",
                                "type": [
                                    "null",
                                    "string"
                                ]
                            },
                            "label": {
                                "type": "object",
                                "additionalProperties": false,
                                "properties": {
                                    "text": {
                                        "type": "string"
                                    },
                                    "y": {
                                        "description": "Relative Y position of the label",
                                        "type": "integer"
                                    },
                                    "style": {
                                        "description": "SVG style attribute",
                                        "type": "string"
                                    },
                                    "x": {
                                        "description": "Relative X position of the label. If null center it",
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    },
                                    "rotation": {
                                        "description": "Rotation of the label",
                                        "type": "integer",
                                        "maximum": 360,
                                        "minimum": -359
                                    }
                                },
                                "required": [
                                    "text",
                                    "x",
                                    "y"
                                ]
                            },
                            "width": {
                                "description": "Width of the node (Read only)",
                                "type": "integer"
                            },
                            "project_id": {
                                "minLength": 36,
                                "description": "Project UUID",
                                "type": "string",
                                "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}$",
                                "maxLength": 36
                            },
                            "first_port_name": {
                                "description": "Name of the first port",
                                "type": [
                                    "string",
                                    "null"
                                ]
                            },
                            "ports": {
                                "description": "List of node ports READ only",
                                "type": "array",
                                "items": {
                                    "description": "A node port",
                                    "type": "object",
                                    "properties": {
                                        "port_number": {
                                            "description": "Port slot",
                                            "type": "integer"
                                        },
                                        "short_name": {
                                            "description": "Short version of port name",
                                            "type": "string"
                                        },
                                        "adapter_number": {
                                            "description": "Adapter slot",
                                            "type": "integer"
                                        },
                                        "name": {
                                            "description": "Port name",
                                            "type": "string"
                                        },
                                        "link_type": {
                                            "description": "Type of link",
                                            "enum": [
                                                "ethernet",
                                                "serial"
                                            ]
                                        },
                                        "data_link_types": {
                                            "description": "Available PCAP type for capture",
                                            "type": "object",
                                            "properties": {}
                                        }
                                    },
                                    "additionalProperties": false
                                }
                            },
                            "node_type": {
                                "description": "Type of node",
                                "enum": [
                                    "cloud",
                                    "nat",
                                    "ethernet_hub",
                                    "ethernet_switch",
                                    "frame_relay_switch",
                                    "atm_switch",
                                    "docker",
                                    "dynamips",
                                    "vpcs",
                                    "virtualbox",
                                    "vmware",
                                    "iou",
                                    "qemu"
                                ]
                            },
                            "port_segment_size": {
                                "description": "Size of the port segment",
                                "type": "integer",
                                "minimum": 0
                            },
                            "z": {
                                "description": "Z position of the node",
                                "type": "integer"
                            },
                            "x": {
                                "description": "X position of the node",
                                "type": "integer"
                            },
                            "console_type": {
                                "description": "Console type",
                                "enum": [
                                    "serial",
                                    "vnc",
                                    "telnet",
                                    "http",
                                    null
                                ]
                            },
                            "name": {
                                "minLength": 1,
                                "description": "Node name",
                                "type": "string"
                            },
                            "status": {
                                "description": "Status of the node",
                                "enum": [
                                    "stopped",
                                    "started",
                                    "suspended"
                                ]
                            },
                            "command_line": {
                                "description": "Command line use to start the node",
                                "type": [
                                    "null",
                                    "string"
                                ]
                            },
                            "compute_id": {
                                "description": "Compute identifier",
                                "type": "string"
                            },
                            "node_id": {
                                "minLength": 36,
                                "description": "Node UUID",
                                "type": "string",
                                "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}$",
                                "maxLength": 36
                            },
                            "height": {
                                "description": "Height of the node (Read only)",
                                "type": "integer"
                            },
                            "port_name_format": {
                                "description": "Formating for port name {0} will be replace by port number",
                                "type": "string"
                            },
                            "y": {
                                "description": "Y position of the node",
                                "type": "integer"
                            },
                            "console_host": {
                                "minLength": 1,
                                "description": "Console host. Warning if the host is 0.0.0.0 or :: (listen on all interfaces) you need to use the same address you use to connect to the controller.",
                                "type": "string"
                            },
                            "symbol": {
                                "minLength": 1,
                                "description": "Symbol of the node",
                                "type": [
                                    "string",
                                    "null"
                                ]
                            },
                            "console": {
                                "description": "Console TCP port",
                                "type": [
                                    "integer",
                                    "null"
                                ],
                                "maximum": 65535,
                                "minimum": 1
                            },
                            "properties": {
                                "description": "Properties specific to an emulator",
                                "type": "object"
                            }
                        }
                    }
                }
            },
            "required": [
                "nodes",
                "links",
                "drawings",
                "computes"
            ]
        },
        "name": {
            "description": "Name of the project",
            "type": "string"
        },
        "project_id": {
            "minLength": 36,
            "description": "Project UUID",
            "type": "string",
            "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}$",
            "maxLength": 36
        },
        "auto_start": {
            "description": "Start the topology when opened",
            "type": "boolean"
        }
    },
    "required": [
        "project_id",
        "type",
        "revision",
        "version",
        "name",
        "topology"
    ]
}