{
  "id": "route.json",
  "$schema": "http://json-schema.org/draft-04/schema#",
  "$ref": "#/definitions/route",
  "links": [
    {
      "title": "get a summary of the route entries in all nodes",
      "href": "/",
      "method": "GET",
      "rel": "self",
      "schema": {
        "$ref": "#/definitions/summaryList"
      }
    },
    {
      "title": "get all route entries from a node",
      "href": "/{nodeIndex}",
      "method": "GET",
      "rel": "self",
      "schema": {
        "$ref": "#/definitions/routeList"
      }
    }
  ],
  "definitions": {
    "routeList": {
      "type": "array",
      "items": {
        "$ref": "#/definitions/route"
      }
    },
    "summaryList": {
      "type": "array",
      "items": {
        "$ref": "#/definitions/routeSummary"
      }
    },
    "ipv4Reference": {
      "type": "object",
      "description": "A numbered reference, not correlated to any object type",
      "required": [
        "address",
        "topoObjectType"
      ],
      "properties": {
        "topoObjectType": {
          "type": "string",
          "enum": [
            "ipv4"
          ]
        },
        "address": {
          "type": "string"
        },
        "linkIndex": {
          "description": "Optional attribute, refer to the link index",
          "type": "integer"
        }
      }
    },
    "SIDList": {
      "type": "array",
      "items": {
        "$ref": "#/definitions/adjacencySegmentIdentifiers"
      }
    },
    "adjacencySegmentIdentifiers": {
      "type": "object",
      "properties": {
        "weight": {
          "type": "number",
          "description": ""
        },
        "sid": {
          "type": "number",
          "description": ""
        },
        "flags": {
          "type": "number",
          "description": "ISIS-Flags, the OSPF are mapped to the ISIS "
        }
      }
    },
    "routeSummary": {
      "description": "Summary view of the routing entries learned from PRPD client",
      "type": "object",
      "required": [
        "topologyIndex",
        "topologyObjectType",
        "node",
        "entries"
      ],
      "properties": {
        "topoObjectType": {
          "type": "string",
          "enum": ["routeSummary"]
        },
        "topologyIndex": {"$ref": "topology.json#/definitions/topologyIndex"},
        "table": {
          "description": "Name of the routing table the route belongs to",
          "type": "string"
        },
        "prefix" : {
          "type" : "object",
          "oneOf" : [
            {"$ref" : "common.json#/definitions/ipv4Prefix"},
            {"$ref" : "common.json#/definitions/ipv6Prefix"}
          ]
        },
        "node": {"$ref" : "node_v2.json#/definitions/node"},
        "entries": {
          "type": "integer",
          "minimum": 0,
          "description": "Number of route entries in received"
        }

      }
    },
    "route": {
      "description": "Represents a single route entry",
      "type": "object",
      "required": [
        "topologyIndex",
        "prefix",
        "topologyObjectType",
        "node"
      ],
      "properties": {
        "topoObjectType": {
          "type": "string",
          "enum": ["route"]
        },
        "topologyIndex": {"$ref": "topology.json#/definitions/topologyIndex"},
        "table": {
          "description": "Name of the routing table the route belongs to",
          "type": "string"
        },
        "prefix" : {
            "type" : "object",
            "oneOf" : [
              {"$ref" : "common.json#/definitions/ipv4Prefix"},
              {"$ref" : "common.json#/definitions/ipv6Prefix"}
            ]
        },
        "node": {"$ref" : "node_v2.json#/definitions/node"},
        "pathCookie": {
          "type": "integer",
          "description": "Unique value used to differentiate routes with the same destination prefix"
        },
        "communities": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "protocol": {
          "type": "string",
          "enum": ["BGP", "BGP-STATIC", "UNSPECIFIED"],
          "description": "Originating protocol"
        },
        "asPaths": {
          "type": "array",
          "items": {
            "type": "integer"
          }
        },
        "protocolNextHops": {
          "type": "array",
          "items": {
            "type": "string",
            "format": "ipv4"
          }
        },
        "localPreference": {
          "type": "integer",
          "description": "Route Preference or administrative distance",
          "minimum": 0,
          "maximum": 4294967295
        },
        "routePreference": {
          "type": "integer",
          "minimum": 0,
          "maximum": 4294967295
        },
        "vpnLabel": {
          "type": "integer",
          "minimum": 0,
          "maximum": 1048576
        },
        "labelStack": {
          "type": "array",
          "items": {
            "type": "object",
            "required": ["labelOperation", "labelEntry"],
            "properties": {
              "labelOperation": {
                "type": "number"
              },
              "labelEntry": {
                "type": "object"
              }
            }
          }
        }
      }
    }
  }
}
