{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "description": "A list of network links.",
    "items": {
        "$schema": "http://json-schema.org/draft-04/schema#",
        "description": "Describes a network link. A network link consists of two peers. Each peer in the link must be a network device, links between network devices and endpoints are not represented. Links are always bidirectional. That is, the order of the peers in this entity carries no special meaning.",
        "properties": {
            "id": {
                "description": "Globally unique identifier for the network link",
                "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
                "type": "string"
            },
            "peers": {
                "description": "List of peers in a link. Each peer is a network device (switch). There must be exactly two peers in the list.",
                "items": {
                    "properties": {
                        "device_id": {
                            "description": "Globally unique identifier of a network device.",
                            "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
                            "type": "string"
                        },
                        "port_id": {
                            "anyOf": [
                                {
                                    "description": "When the Port ID is a MAC address, use this format.",
                                    "pattern": "^([0-9a-f]{2}-){5}([0-9a-f]{2})$",
                                    "type": "string"
                                },
                                {
                                    "description": "When the Port ID is anything other than a MAC address, a freeform string may be used.",
                                    "pattern": "^.+$",
                                    "type": "string"
                                }
                            ],
                            "description": "Matches the port_id of the interface of the network device to which the link is connected."
                        }
                    },
                    "required": [
                        "device_id",
                        "port_id"
                    ],
                    "type": "object"
                },
                "maxItems": 2,
                "minItems": 2,
                "type": "array",
                "uniqueItems": true
            },
            "speed": {
                "description": "Speed of the link, formatted as a number followed by kbit/s, Mbit/s, Gbit/s. NB: Values should be formatted with no fraction component if possible, using the largest unit that allows that.",
                "pattern": "^(0|[1-9][0-9]*)(\\.[0-9]+)?[kMG]bit\\/s$",
                "type": "string"
            }
        },
        "required": [
            "id",
            "peers",
            "speed"
        ],
        "type": "object"
    },
    "minItems": 0,
    "title": "List of network links.",
    "type": "array",
    "uniqueItems": true
}
