{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "description": "Describes a network device or switch.",
    "properties": {
        "chassis_id": {
            "anyOf": [
                {
                    "description": "When the Chassis ID is a MAC address, use this format.",
                    "pattern": "^([0-9a-f]{2}-){5}([0-9a-f]{2})$",
                    "type": "string"
                },
                {
                    "description": "When the Chassis ID is anything other than a MAC address, a freeform string may be used.",
                    "pattern": "^.+$",
                    "type": "string"
                }
            ],
            "description": "A persistent identifier of the network device, often the MAC address. Where LLDP is implemented on the network device interfaces, the LLDP Chassis ID should match this value."
        },
        "id": {
            "description": "Globally unique identifier for the 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"
        },
        "interfaces": {
            "items": {
                "properties": {
                    "admin_status": {
                        "description": "The administrative status of the interface.",
                        "enum": [
                            "up",
                            "down"
                        ]
                    },
                    "mtu": {
                        "description": "Optional. The MTU of the interface.",
                        "type": "integer"
                    },
                    "oper_status": {
                        "description": "The operational status of the interface.",
                        "enum": [
                            "up",
                            "down"
                        ]
                    },
                    "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": "A persistent identifier of the interface on the network device, often the ifAlias. Where LLDP is implemented on the network device interfaces, the LLDP Port ID should match this value."
                    },
                    "speed": {
                        "description": "The reported active speed of the interface.",
                        "enum": [
                            "100Mbit/s",
                            "1Gbit/s",
                            "10Gbit/s",
                            "25Gbit/s",
                            "40Gbit/s",
                            "50Gbit/s",
                            "100Gbit/s",
                            "200Gbit/s",
                            "400Gbit/s"
                        ]
                    }
                },
                "required": [
                    "port_id",
                    "admin_status",
                    "oper_status",
                    "speed"
                ],
                "type": "object"
            },
            "type": "array"
        },
        "label": {
            "description": "Optional. Freeform string label for the network device",
            "type": "string"
        },
        "mgmt_ip": {
            "anyOf": [
                {
                    "format": "ipv4"
                },
                {
                    "format": "ipv6"
                }
            ],
            "description": "The management IP address of the network device.",
            "type": "string"
        },
        "mtu": {
            "description": "The device level MTU. If interface MTU is not present this will be used as the default value.",
            "type": "integer"
        }
    },
    "required": [
        "id",
        "chassis_id",
        "mgmt_ip",
        "mtu",
        "interfaces"
    ],
    "type": "object"
}
