{
    "id" : "pathComputation.json",
    "title" : "Path Computation RPC ",
    "$schema": "http://json-schema.org/draft-04/schema#",
    "$ref" : "#/definitions/pathComputationRequest",
    "links" : [
	{
	    "title" : "Path computation RPC",
	    "href" : "/",
	    "method" : "POST",
	    "rel" : "instance",
	    "schema"       : {"$ref" : "#/definitions/pathComputationRequests"},
            "targetSchema" : {"$ref" : "#/definitions/pathComputationResponses"}
	}       
    ],
    "definitions" : {
        "pathComputationRequests" : {
            "type" :"object",
	    "additionalProperties" : false,            
            "properties" : {
                "requests" :{
                    "type" : "array",
                    "minItems" : 1,
                    "maxItems" : 1000,
                    "items" : { "$ref" : "#/definitions/pathComputationRequest"}
                }
            }
        },        
        "pathComputationResponses" : {
            "type" :"object",
	    "additionalProperties" : false,            
            "properties" : {                
                "result"    : {"type" :"string","description": "Indicate the overall status of the computation","enum": ["partial","success","failure"]},
                "responses" : {
                    "type" : "array",
                    "minItems" : 1,
                    "maxItems" : 1000,
                    "items" : { "$ref" : "#/definitions/pathComputationResponse"}
                }
            }
        },
        "pathComputationRequest"  : {
            "type" :"object",
            "required" : ["from","to"],
            "properties" : {
                "from": {
                    "description": "tunnel source address, should reference an interface or a node, same for all TE-LSP of a tunnel",
                    "oneOf" : [{"$ref" : "link_v2.json#/definitions/ipReference"}]
                },				
                "to": {
                    "description": "destination of the tunnel, should reference an interface or a node, same for all TE-LSP of a tunnel",
                    "oneOf" : [{"$ref" : "link_v2.json#/definitions/ipReference"}]
                },
		"name": {
                    "description": "tunnel name, several TE-LSP may have the same name, they are part of the same tunnel",

                    "$ref": "common.json#/definitions/name64"
                },
                "bandwidth"       : {"$ref" : "common.json#/definitions/Bandwidth"},
                "design"            : {
                    "type" : "object",
                    "additionalProperties" : false,                    
                    "description": " Design parameters",
                    "properties" : {
                        "maxHop"        : {"description" : "Maximum Hop Count" , "type" : "integer", "minimum" : 0} ,
                        "maxDelay"      : {"description" : "Maximum Delay, unit :millisecond" , "type" : "integer", "minimum" : 0}
                    }
                },
                "exclusions" : {
                    "type" : "array",
                    "items": {"$ref" :"link_v2.json#/definitions/ipReference"}
                },
                "plannedProperties" : {
                    "description" : "For compatibility with the lsp creation request, this contains the LSP planned properties, only a subset of attributes are evaluated: bandwidth, setupPriority, holdingPriority, design (partial). The following design properties are handled: routingMethod, maxHop, maxDelay, maxCost, useProtectedLinks and adminGroups. The diversityLevel, diversityGroup and coroutedPairId are not handled",                    
                    "$ref" :"lsp.json#/definitions/lspPlannedPathPropertiesRouting"
                },
                "provisioningType" : {"description" : "Indicate the type of TE Path" , "type" : "string","enum":["RSVP","SR","SRv6"],"default":"RSVP"}
            }
        },
        "pathComputationResponse" : {
            "type" :"object",
            "properties" : {
                "path"   : {
                    "type" : "array",
                    "items": {"$ref" :"link_v2.json#/definitions/ipReference"}
                },
                "status" : {
                    "type" :"string","description": "Indicate the status of the path computation","enum": ["success","noPathAvailable","pathComputationFailed","pathComputationLoadNotAvailable"]
                }
            },
            "oneOf" : [
		{"$ref" :"#/definitions/pathComputationRequest"}
            ]   
        }
    }
}
