{
  "id": "demands.json",
  "title": "demands API",
  "$schema": "http://json-schema.org/draft-04/schema#",
  "$ref": "#/definitions/demand",
  "links": [
    {
      "title": "get all demands",
      "href": "/",
      "method": "GET",
      "rel": "instances",
      "schema": {"$ref": "#/definitions/demandList"}
    },
    {
      "title": "get demand based on filter",
      "href": "/search?name={nameFilter}&from={fromIpV4}&operStatus={operationalStatus}&queryType=OR",
      "description": "do a server-side lookup on the Demand, by default the AND from all the attributes is done, unless queryType is set to OR",
      "method": "GET",
      "rel": "search",
      "schema": {"$ref": "#/definitions/demandList"}
    },
    {
      "title": "get an Demand",
      "href": "/{demandIndex}",
      "method": "GET",
      "rel": "self",
      "schema": {"$ref": "#/definitions/demand"}
    },
      {"title" : "get SSE notification stream", "href" : "/stream","method" : "GET"},
    {
      "title": "get a Demand event history",
      "href": "/{demandIndex}/history?start={startTimeStamp}&end={endTimeStamp}",
      "description": "Provide the history of NorthStar action for the Demand, it can be optionally filtered by start (inclusive) and end (exclusive) timestamp",
      "method": "GET",
      "rel": "self",
      "schema": {"$ref": "#/definitions/demandHistoryEventList"}
    },
    {
      "title": "create a new Demand",
      "description": "Create a new Demand schema on request is #/definitions/createDemand",
      "href": "/",
      "method": "POST",
      "rel": "create",
      "schema": {"$ref": "#/definitions/createDemand"},
      "targetSchema": {"$ref": "#/definitions/createDemandOrResponse"}
    },
    {
      "title": "update an Demand",
      "href": "/{demandIndex}",
      "description": "Update an existing te-demand, schema on request is #/definitions/updateDemand",
      "method": "PUT",
      "rel": "self",
        "schema": {"$ref": "#/definitions/updateDemand"},
        "targetSchema" : {"$ref" : "#/definitions/demand"}
    },
    {
      "title": "Patch  a  Demands",
      "description": "update a  Demands using and RFC6902 document producing a  #/definitions/updateDemand",
      "href": "/{demandIndex}",
      "method": "PATCH",
      "schema" : {"$ref" : "json-patch.json"},
      "targetSchema" : {"$ref" : "#/definitions/demand"}
    },
    {
      "title": "delete an Demand",
      "href": "/{demandIndex}",
      "method": "DELETE"
    },
    {
      "title": "Create a set of  new Demand",
      "description": "Create a set of new Demand, return code only indicate the acceptance of the request, response contains a list of demand indexes",
      "href": "/bulk/",
      "method": "POST",
      "rel": "create",
        "schema": {"$ref": "#/definitions/createDemandList"},
        "targetSchema" : {"$ref": "#/definitions/demandList"}
    },
    {
      "title": "update a set of Demand",
      "description": "update a set of Demand, return code only indicate the acceptance of the request",
      "href": "/bulk",
      "method": "PUT",
      "schema": {"$ref": "#/definitions/demandListUpdate"},
      "targetSchema" : {"$ref": "#/definitions/demandList"}

    },
    {
      "title": "Patch  a set of Demands",
      "description": "update a set of Demans, return code only indicate the acceptance of the request",
      "href": "/bulk",
      "method": "PATCH",
      "schema": {"$ref": "#/definitions/demandListPatch"},
      "targetSchema" : {"$ref": "#/definitions/demandList"}
    },    
    {
      "title": "delete a set of Demands",
      "description": "delete a set of Demands, return code only indicate the acceptance of the request",
      "href": "/bulk",
      "method": "DELETE",
      "schema": {"$ref": "#/definitions/demandListDelete"}
    }
  ],
  "definitions": {
    "demandListPatch": {
      "type": "array",
      "minItems": 1,
      "maxItems": 10000,
      "items": {
        "type": "object",
        "required": ["demandIndex", "patch"],
        "properties": {
          "demandIndex": {"description": "Program ID for demand", "$ref": "common.json#/definitions/index"},
          "patch": {"$ref": "json-patch.json"}
        }
      }
    },
    "createDemandList": {
      "description": "schema for bulk Demand creation, the number of entries that can be modified at a time is limited",
      "type": "array",
      "minItems": 1,
      "maxItems": 10000,
      "items": {"$ref": "#/definitions/createDemand"}
    },
    "demandListUpdate": {
      "description": "schema for bulk Demand update, the number of entries that can be modified at a time is limited",
      "type": "array",
      "minItems": 1,
      "maxItems": 10000,
      "items": {"$ref": "#/definitions/updateDemand"}
    },
    "demandListDelete": {
      "description": "schema for bulk Demand delete, the number of entries that can be modified at a time is limited",
      "type": "array",
      "minItems": 1,
      "maxItems": 10000,
      "items": {
        "description": "define the set of attributes that can be provided on demand update (PUT) message.",
        "type": "object",
        "additionalProperties": true,
        "required": ["demandIndex"],
        "properties": {
          "demandIndex": {"description": "Program ID for demand", "$ref": "common.json#/definitions/index"}
        }
      }
    },
    "createDemandOrResponse": {
      "anyOf": [
        {
          "$ref": "#/definitions/demand",
          "required": ["from", "to", "name"]
        },
        {
          "type": "object",
          "properties": {
            "error": {
              "description": "error string, either free text or defined error",
              "oneOf": [
                {"type": "string"},
                {"type": "string", "enum": ["Bad request : the provided demandIndex does not match the addressed resource"]}
              ]
            }
          }
        }
      ]
    },
    "demandHistoryEvent": {
      "description": "entry in the history of an Demand, which consists of the actions made by NorthStar",
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "controlType": {
          "descriptions": "indicates who controls the Demand, PCC controlled Demands are completly under PCC control and delegated Demands are created by the PCC and controlled by the PCE, while PCEInitiated are created and controlled by the PCE",
          "type": "string",
          "enum": ["PCC", "Delegated", "PCEInitiated"]
        },
        "plannedProperties": {
          "description": "planned path state, this attribute is read-write, those attributes can be modified in an update",
          "additionalProperties": false,
          "$ref": "#/definitions/demandPlannedPathProperties"
        },
        "eventStatusString": {
          "description": "A description of the event",
          "type": "string"
        },
        "timestamp": {
          "description": "Event Timestamp.",
          "type": "integer"
        },
        "operation": {
          "description": "Type of operation.",
          "type": "string",
          "enum": ["Add", "Remove", "Update", "Query", "State Change", "Failed"]
        }
      }
    },
    "demandHistoryEventList": {
      "type": "array",
      "items": {"$ref": "#/definitions/demandHistoryEvent"}
    },
    "demandList": {
      "type": "array",
      "items": {"$ref": "#/definitions/demand"}
    },
    "EROHop": {
      "description": "an Demand ERO Hop, not correlated",
      "properties": {
        "loose": {"description": "indicates if the Hop is a loose Hop", "type": "boolean", "default": "false"}
      },
      "oneOf": [
        {"$ref": "link.json#/definitions/ipv4Reference"},
        {"$ref": "link.json#/definitions/hopIdReference"},
        {"$ref": "link.json#/definitions/unnumberedIfReference"}
      ]
    },
    "RROHop": {
      "description": "An Demand RRO Hop",
      "type": "object",
      "properties": {
        "protectionInUse": {
          "description": "for RRO Hops only, indicate if the protection is active",
          "type": "boolean",
          "default": "false"
        },
        "protectionAvailable": {
          "description": "for RRO Hops only, indicate if the protection is available",
          "type": "boolean",
          "default": "false"
        }
      },
      "oneOf": [
        {"$ref": "link.json#/definitions/ipv4Reference"},
        {"$ref": "link.json#/definitions/unnumberedIfReference"}
      ]
    },
    "demandLivePathProperties": {
      "description": "define the live-only tunnel properties, some properties are duplicated on purpose with plannedProperties, because of schema limitation (additionalProperties not expressed well with oneOf",
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "setupPriority": {
          "description": "Setup priority",
          "type": "integer",
          "minimum": 0,
          "maximum": 7
        },
        "holdingPriority": {
          "description": "Holding priority",
          "type": "integer",
          "minimum": 0,
          "maximum": 7
        },
        "pathName": {"description": "Optional path name, fixed once Demand created", "$ref": "common.json#/definitions/name"},
        "bandwidth": {"$ref": "common.json#/definitions/Bandwidth"},
        "adminStatus": {"$ref": "common.json#/definitions/adminStatus"},
        "metric": {"type": "integer", "description": "resulting IGP metric of the tunnel"},
        "ero": {
          "type": "array",
          "description": "required explicit path",
          "minItems": 0,
          "maxItems": 255,
          "items": {
            "$ref": "#/definitions/EROHop"
          }
        },
        "rro": {
          "type": "array",
          "minItems": 0,
          "maxItems": 255,
          "items": {
            "$ref": "#/definitions/RROHop"
          }
        },
        "options": {
          "type": "object",
          "description": "the object carries a set of optional properties",
          "additionalProperties": false,
          "properties": {
            "autoBandwidth": {
              "type": "boolean",
              "description": "Read-only parameter, indicates if auto-bandwidth is activated on the Demand. Valid only on Juniper Routers. When set the bandwidth is controlled by the PCC, bandwidth set from REST or UI is ignored."
            },
            "TEPlusPlusId": {
              "type": "integer",
              "description": "Read-only parameter, indicates if the TE-Demand is part of a TE++ Demand setup. All TE-Demands in the same TE++Group share the same TE++Id"
            }
          }
        }
      }
    },
    "demandPlannedPathPropertiesSecondary": {
      "description": "define the non-tunnel attributes of an secondary or standby TE-Demand, the one that may be modified. ",
      "type": "object",
      "additionalProperties": false,
      "required": ["pathName"],
      "properties": {
        "comment": {"description": "Comment", "type": "string"},
        "setupPriority": {
          "description": "Setup priority",
          "type": "integer",
          "minimum": 0,
          "maximum": 7
        },
        "holdingPriority": {
          "description": "Holding priority",
          "type": "integer",
          "minimum": 0,
          "maximum": 7
        },
        "pathName": {
          "description": "Optional path name, fixed once Demand created",
          "$ref": "common.json#/definitions/name",
          "minLength": 1,
          "maxLength": 60
        },
        "bandwidth": {"$ref": "common.json#/definitions/Bandwidth"},
        "adminStatus": {"$ref": "common.json#/definitions/adminStatus"},
        "owner": {"$ref": "common.json#/definitions/name64"},
        "routingStatus": {
          "description": "routing operational status, when Down it means that no route has been found. Not valid on POST/PUT ",
          "$ref": "common.json#/definitions/operStatus"
        },
        "correlatedRROHopCount": {
          "description": "Hop count derived from RRO correlated to topology information. If the RRO contains a mix of node and link IP address, NorthStar is using its correlation to provide this number. This attribute is ignored on PUT or POST requests. Not valid on POST/PUT.",
          "type": "integer",
          "minimum": 0
        },
        "metric": {"type": "integer", "description": "resulting IGP metric of the tunnel"},
        "bandwidthCalendar": {"$ref": "common.json#/definitions/calendarSchema"},
        "design": {
          "type": "object",
          "additionalProperties": false,
          "description": " Design parameters",
          "properties": {
            "routingMethod": {
              "description": "",
              "type": "string",
              "enum": ["default", "adminWeight", "delay", "constant", "distance", "ISIS", "OSPF"],
              "default": "default"
            },
            "maxHop": {
              "description": "Maximum Hop Count",
              "type": "integer",
              "minimum": 0
            },
            "maxDelay": {
              "description": "Maximum Delay, unit :millisecond",
              "type": "integer",
              "minimum": 0
            },
            "maxCost": {
              "description": "Maximum Cost",
              "type": "integer",
              "minimum": 0
            },
            "diversityLevel": {
              "description": "Level of diversity",
              "type": "string",
              "enum": ["site", "srlg", "link"]
            },
            "diversityGroup": {"description": "Diversity group", "type": "string"},
            "useProtectedLinks": {
              "description": "If set, the path will prefer protected links",
              "type": "string",
              "enum": ["Protected"]
            },
            "adminGroups": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "attributeIncludeAll": {
                  "description": "TE-Color Include all mask",
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 4294967295
                },
                "attributeIncludeAny": {
                  "description": "TE-Color Include any mask",
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 4294967295
                },
                "attributeExclude": {
                  "description": "TE-Color exlude  mask",
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 4294967295
                }
              }
            },
            "coroutedPairId": {"description": "Id to associate two unidirectional co-routed Demands", "type": "string"}
          }
        },
        "operationalStatus": {
          "description": "routing operational status, when Down it means that no route has been found.",
          "$ref": "common.json#/definitions/operStatus"
        },
        "calculatedEro": {
          "type": "array",
          "description": "the path calculated by NorthStar, it does not include node ids",
          "minItems": 0,
          "maxItems": 255,
          "items": {"$ref": "#/definitions/EROHop"}
        },
        "ero": {
          "type": "array",
          "description": "required explicit path",
          "minItems": 0,
          "maxItems": 255,
          "items": {"$ref": "#/definitions/EROHop"}
        },
        "preferredEro": {
          "description": "the desired explicit path--if the path is not feasible NorthStar will calculate another path",
          "type": "array",
          "minItems": 0,
          "maxItems": 255,
          "items": {
            "$ref": "#/definitions/EROHop"}},
        "lastStatusString": {
          "descrition": "last status for the Demand",
          "type": "string"
        },
        "controllerStatus": {
          "type": "object",
          "descrition": "current controller status for the Demand.",
          "attributes": {
            "status": {
              "type": "string",
              "description": "String representing the Path Computation Server status"
            },
            "time": {"type": "string", "description": "Indication when the next action will be done"},
            "trigger": {"type": "string", "description": "Optional indication of which event triggered the current status"}
          }
        },
        "preference": {
          "type": "integer",
          "minimum": 10,
          "default": 10,
          "description": "parameter indicates the order (lowest first) in which secondary/standby te-demands path are tried in case of active Demand failure, active Demands before down Demands"
        }
      }
    },
    "demandPlannedPathProperties": {
      "description": "define the non-tunnel attributes of an TE-Demand, the one that may be modified",
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "comment": {"description": "Comment", "type": "string"},
        "setupPriority": {
          "description": "Setup priority",
          "type": "integer",
          "minimum": 0,
          "maximum": 7
        },
        "holdingPriority": {
          "description": "Holding priority",
          "type": "integer",
          "minimum": 0,
          "maximum": 7
        },
        "pathName": {"description": "Optional path name, fixed once Demand created", "$ref": "common.json#/definitions/name"},
        "bandwidth": {"$ref": "common.json#/definitions/Bandwidth"},
        "adminStatus": {"$ref": "common.json#/definitions/adminStatus"},
        "metric": {"type": "integer", "description": "resulting IGP metric of the tunnel"},
        "owner": {"$ref": "common.json#/definitions/name64"},
        "bindingLSP": {"$ref": "common.json#/definitions/name64"},
        "color": {"$ref": "common.json#/definitions/lspColor"},
        "routingStatus": {
          "description": "routing operational status, when Down it means that no route has been found. Not valid on POST/PUT ",
          "$ref": "common.json#/definitions/operStatus"
        },
        "correlatedRROHopCount": {
          "description": "Hop count derived from RRO correlated to topology information. If the RRO contains a mix of node and link IP address, NorthStar is using its correlation to provide this number. This attribute is ignored on PUT or POST requests. Not valid on POST/PUT.",
          "type": "integer",
          "minimum": 0
        },
        "bandwidthCalendar": {"$ref": "common.json#/definitions/calendarSchema"},
        "design": {
          "type": "object",
          "additionalProperties": false,
          "description": " Design parameters",
          "properties": {
            "routingMethod": {
              "description": "",
              "type": "string",
              "enum": ["default", "adminWeight", "delay", "constant", "distance", "ISIS", "OSPF"],
              "default": "default"
            },
            "maxHop": {
              "description": "Maximum Hop Count",
              "type": "integer",
              "minimum": 0
            },
            "maxDelay": {
              "description": "Maximum Delay, unit :millisecond",
              "type": "integer",
              "minimum": 0
            },
            "maxCost": {
              "description": "Maximum Cost",
              "type": "integer",
              "minimum": 0
            },
            "diversityLevel": {
              "description": "Level of diversity",
              "type": "string",
              "enum": ["site", "srlg", "link"]
            },
            "diversityGroup": {"description": "Diversity group", "type": "string"},
            "useProtectedLinks": {
              "description": "If set, the path will prefer protected links",
              "type": "string",
              "enum": ["Protected"]
            },
            "adminGroups": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "attributeIncludeAll": {
                  "description": "TE-Color Include all mask",
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 4294967295
                },
                "attributeIncludeAny": {
                  "description": "TE-Color Include any mask",
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 4294967295
                },
                "attributeExclude": {
                  "description": "TE-Color exlude  mask",
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 4294967295
                }
              }
            },
            "coroutedPairId": {"description": "Id to associate two unidirectional co-routed Demands", "type": "string"}
          }
        },
        "operationalStatus": {
          "description": "routing operational status, when Down it means that no route has been found.",
          "$ref": "common.json#/definitions/operStatus"
        },
        "calculatedEro": {
          "type": "array",
          "description": "path calculated by NorthStar, it does not include node ids",
          "minItems": 0,
          "maxItems": 255,
          "items": {"$ref": "#/definitions/EROHop"}
        },
        "ero": {
          "type": "array",
          "description": "required explicit path",
          "minItems": 0,
          "maxItems": 255,
          "items": {"$ref": "#/definitions/EROHop"}
        },
        "preferredEro": {
          "description": "desired explicit path--if not feasible NorthStar will calculate another path",
          "type": "array",
          "minItems": 0,
          "maxItems": 255,
          "items": {"$ref": "#/definitions/EROHop"}
        },
        "lastStatusString": {"descrition": "The last status for the Demand", "type": "string"},
        "controllerStatus": {
          "type": "object",
          "descrition": "current controller status for the Demand.",
          "attributes": {
            "status": {"type": "string", "description": "String representing the Path Computation Server status"},
            "time": {"type": "string", "description": "Indication when the next action will be done"},
            "trigger": {"type": "string", "description": "Optional indication of which event triggered the current status"}
          }
        },
        "preference": {
          "type": "integer",
          "minimum": 10,
          "default": 10,
          "description": "parameter indicates the order (lowest first) in which secondary/standby te-demands path are tried in case of active Demand failure, active Demands before down Demands"
        }
      }
    },
    "demandExtendedOperStatus": {
      "description": "Demand additional operation status",
      "type": "string",
      "enum": ["GoingUp", "GoingDown", "Active"]
    },
    "createDemandPrimary": {
      "description": "defines the set of attributes that can be provided on demand Create (POST) message",
      "type": "object",
      "additionalProperties": false,
      "required": ["name", "from", "to"],
      "properties": {
        "name": {
          "description": "tunnel name, several TE-Demand may have the same name, they are part of the same tunnel",
          "$ref": "common.json#/definitions/demandName",
          "maxLength": 255,
          "minLength": 1
        },
        "from": {
          "description": "tunnel source address, should reference an interface or a node, same for all TE-Demand of a tunnel",
          "oneOf": [{"$ref": "link.json#/definitions/ipv4Reference"}]
        },
        "to": {
          "description": "destination of the tunnel, should reference an interface or a node, same for all TE-Demand of a tunnel",
          "oneOf": [
            {"$ref": "link.json#/definitions/ipv4Reference"},
            {"$ref": "common.json#/definitions/ipv4Prefix"}
          ]
        },
        "demandType": {
          "enum": ["IP", "IPv6", "VPN", "VPNv6", "OTHER"],
          "description": "Type of traffic carried by the demand"
        },
        "prefix": {
          "description": "Destination prefix",
          "oneOf": [{"$ref": "link.json#/definitions/ipv4Reference"}, {"$ref": "common.json#/definitions/ipv4Prefix"}]
        },
        "pathType": {
          "description": "The role of the path",
          "type": "string",
          "enum": ["primary"],
          "default": "primary"
        },
        "provisioningType": {
          "description": "Indicate the type of TE Path",
          "type": "string",
          "enum": ["RSVP", "SR"],
          "default": "RSVP"
        },
        "plannedProperties": {
          "description": "planned path state, this attribute is read-write, those attributes can be modified in an update",
          "$ref": "#/definitions/demandPlannedPathProperties"
        }
      }
    },
    "createDemandSecondary": {
      "description": "defines the attribute set that can be provided on demand Create (POST) message",
      "type": "object",
      "additionalProperties": false,
      "required": ["name", "from", "to", "pathType"],
      "properties": {
        "name": {
          "description": "tunnel name, several TE-Demand may have the same name, they are part of the same tunnel",
          "$ref": "common.json#/definitions/demandName",
          "maxLength": 80,
          "minLength": 1
        },
        "from": {
          "description": "tunnel source address, should reference an interface or a node, same for all TE-Demand of a tunnel",
          "oneOf": [{"$ref": "link.json#/definitions/ipv4Reference"}]
        },
        "to": {
          "description": "tunnel destination, should reference an interface or a node, same for all TE-Demand of a tunnel",
          "oneOf": [
            {"$ref": "link.json#/definitions/ipv4Reference"},
            {"$ref": "common.json#/definitions/ipv4Prefix"}
          ]
        },
        "pathType": {
          "description": "The role of the path",
          "type": "string",
          "enum": ["secondary", "standby"]
        },
        "provisioningType": {
          "description": "Indicate the type of TE Path",
          "type": "string",
          "enum": ["RSVP", "SR"],
          "default": "RSVP"
        },
        "plannedProperties": {
          "description": "planned path state, this attribute is read-write, those attributes can be modified in an update",
          "$ref": "#/definitions/demandPlannedPathPropertiesSecondary"
        }
      }
    },
    "createDemand": {
      "oneOf": [
        {"$ref": "#/definitions/createDemandPrimary"},
        {"$ref": "#/definitions/createDemandSecondary"}
      ]
    },
    "updateDemandPrimary": {
      "description": "define the set of attributes that can be provided on demand update (PUT) message",
      "type": "object",
      "additionalProperties": false,
      "required": ["demandIndex", "pathType"],
      "properties": {
        "demandIndex": {
          "description": " Program ID for demand",
          "$ref": "common.json#/definitions/index"
        },
        "name": {
          "description": "tunnel name--several TE-Demand may have the same name, they are part of the same tunnel. This cannot be changed once the path has been created",
          "$ref": "common.json#/definitions/demandName",
          "maxLength": 80,
          "minLength": 1
        },
        "from": {
          "description": "tunnel source address, should reference an interface or a node, same for all TE-Demand of a tunnel. This cannot be changed once the path has been created",
          "oneOf": [{"$ref": "link.json#/definitions/ipv4Reference"}]
        },
        "to": {
          "description": "destination of the tunnel, should reference an interface or a node, same for all TE-Demand of a tunnel. This cannot be changed once the path has been created",
          "oneOf": [
            {"$ref": "link.json#/definitions/ipv4Reference"},
            {"$ref": "common.json#/definitions/ipv4Prefix"}
          ]
        },
        "demandType": {
          "enum": ["IP", "IPv6", "VPN", "VPNv6", "OTHER"],
          "description": "Type of traffic carried by the demand"
        },
        "prefix": {
          "description": "Destination prefix",
          "oneOf": [{"$ref": "link.json#/definitions/ipv4Reference"}, {"$ref": "common.json#/definitions/ipv4Prefix"}]
        },
        "ingressPE": {
          "description": "Device where the sampling that created the demand is done.",
          "oneOf": [
            {"$ref": "node_v2.json#/definitions/namedNodeReference"}
          ]
        },
        "pathType": {
          "description": "path role, which cannot be changed once the path is created",
          "type": "string",
          "enum": ["primary"],
          "default": "primary"
        },
        "provisioningType": {
          "description": "Indicate the type of TE Path",
          "type": "string",
          "enum": ["RSVP", "SPRING"],
          "default": "RSVP"
        },
        "plannedProperties": {
          "description": "planned path state, this attribute is read-write, those attributes can be modified in an update",
          "$ref": "#/definitions/demandPlannedPathProperties"
        },
        "controller": {
          "descriptions": "Current controller",
          "type": "string",
          "enum": ["NorthStar", "External"]
        }
      }
    },
    "updateDemandSecondary": {
      "description": "define the set of attributes that can be provided on demand update (PUT) message.",
      "type": "object",
      "additionalProperties": false,
      "required": ["demandIndex", "pathType"],
      "properties": {
        "demandIndex": {"description": " Program ID for demand", "$ref": "common.json#/definitions/index"},
        "name": {
          "description": "tunnel name, several TE-Demand may have the same name, they are part of the same tunnel. This cannot be changed once the path has been created",
          "$ref": "common.json#/definitions/demandName",
          "maxLength": 80,
          "minLength": 1
        },
        "from": {
          "description": "tunnel source address, should reference an interface or a node, same for all TE-Demand of a tunnel. This cannot be changed once the path has been created",
          "oneOf": [{"$ref": "link.json#/definitions/ipv4Reference"}]
        },
        "to": {
          "description": "tunnel destination, should reference an interface or a node, same for all TE-Demand of a tunnel. This cannot be changed once the path has been created",
          "oneOf": [
            {"$ref": "link.json#/definitions/ipv4Reference"},
            {"$ref": "common.json#/definitions/ipv4Prefix"}
          ]
        },
        "pathType": {
          "description": "path role, which cannot be changed once the path has been created",
          "type": "string",
          "enum": ["secondary", "standby"]
        },
        "provisioningType": {
          "description": "Indicate the type of TE Path",
          "type": "string",
          "enum": ["RSVP", "SR"],
          "default": "RSVP"
        },
        "plannedProperties": {
          "description": "planned path state, this attribute is read-write, those attributes can be modified in an update",
          "$ref": "#/definitions/demandPlannedPathPropertiesSecondary"
        },
        "controller": {
          "descriptions": "Current controller, .",
          "type": "string",
          "enum": ["NorthStar", "External"]
        }
      }
    },
    "updateDemand": {
      "oneOf": [
        {"$ref": "#/definitions/updateDemandPrimary"},
        {"$ref": "#/definitions/updateDemandSecondary"}
      ]
    },
    "demand": {
      "description": "define a te-demand of a tunnel",
      "type": "object",
      "additionalProperties": false,
      "required": ["demandIndex"],
      "properties": {
        "demandIndex": {"description": " Program ID for demand", "$ref": "common.json#/definitions/index"},
        "layer": {
          "type": "string",
          "enum": ["IP", "Transport"],
          "default": "IP",
          "description": "indicate if the Demand is a real Demand or the representation of a transport path"
        },
        "name": {
          "description": "tunnel name, several TE-Demand may have the same name, they are part of the same tunnel",
          "$ref": "common.json#/definitions/demandName",
          "maxLength": 80,
          "minLength": 1
        },
        "from": {
          "description": "tunnel source address, should reference an interface or a node, same for all TE-Demand of a tunnel",
          "oneOf": [{"$ref": "link.json#/definitions/ipv4Reference"}]
        },
        "to": {
          "description": "tunnel destination, should reference an interface or a node, same for all TE-Demand of a tunnel",
          "oneOf": [
            {"$ref": "link.json#/definitions/ipv4Reference"},
            {"$ref": "common.json#/definitions/ipv4Prefix"}
          ]
        },
        "demandType": {
          "enum": ["IP", "IPv6", "VPN", "VPNv6", "OTHER"],
          "description": "Type of traffic carried by the demand"
        },
        "ingressPE": {
          "description": "Device where the sampling that created the demand is done.",
          "oneOf": [
            {"$ref": "node_v2.json#/definitions/namedNodeReference"}
          ]
        },
        "prefix": {
          "description": "Destination prefix",
          "oneOf": [{"$ref": "link.json#/definitions/ipv4Reference"}, {"$ref": "common.json#/definitions/ipv4Prefix"}]
        },
        "tunnelId": {
          "description": "signaling protocol tunnel id, can be left empty, same for all TE-Demand of a tunnel",
          "type": "integer"
        },
        "p2mpIndex": {
          "description": "signaling protocol p2mp tunnel id, may be empty, same for all TE-Demand of a p2mp tree",
          "type": "integer"
        },
        "p2mpName": {"description": "node configured P2MP name", "type": "string"},
        "operationalStatus": {"oneOf": [{"$ref": "common.json#/definitions/operStatus"}, {"$ref": "#/definitions/demandExtendedOperStatus"}]},
        "controlType": {
          "descriptions": "indicates who controls the Demand, PCC controlled Demands are completly under PCC control, Delegated Demands are created by the PCC and controlled by the PCE, PCEInitiated are created and controlled by the PCE.",
          "type": "string",
          "enum": ["Transport", "PCC", "Delegated", "PCEInitiated"]
        },
        "initiator": {
          "descriptions": "indicates which entity created the Demand, Only PCE created Demands and under NorthStar control can be deleted from NorthStar.",
          "type": "string"
        },
        "controller": {
          "descriptions": "Current controller, .",
          "type": "string",
          "enum": ["NorthStar", "External"]
        },
        "pathType": {
          "description": "path role",
          "type": "string",
          "enum": ["primary", "secondary", "standby"],
          "default": "primary"
        },
        "provisioningType": {
          "description": "Indicate the type of TE Path",
          "type": "string",
          "enum": ["RSVP", "SR"],
          "default": "RSVP"
        },
        "liveProperties": {
          "description": "state of the path in the PCC, which is read-only",
          "$ref": "#/definitions/demandLivePathProperties"
        },
        "plannedProperties": {
          "description": "planned path state, this attribute is read-write, can be modified in an update",
          "additionalProperties": false,
          "$ref": "#/definitions/demandPlannedPathProperties"
        },
          "lastUpdate" : {"type" : "string","description" : "ISO 8101 timestamp","format" : "datetime"}
      }
    },
    "tunnelProperties": {"type": "object", "properties": {}}
  }
}
