#
RPC validate
The external application stores the intended configuration under nodes in the UniConfig topology. The configuration can be checked for validity. This RPC is the trigger for validating a configuration.
RPC input contains a list of UniConfig nodes whose configuration should be validated. RPC output describes the result of the validation and matches all input nodes.
If the RPC is called with an empty list of target nodes, all nodes modified in the UniConfig transaction are validated.
The configuration of nodes follows these steps:
- Open transaction to device
- Write configuration
- Validate configuration
- Close transaction
If any node fails in step 3 (validation), the entire RPC also fails.
Validation (step 3) only applies to nodes that support this operation.
The diagram below illustrates the RPC:
#
RPC examples
#
Successful example
RPC input has two target nodes. RPC output describes the result of successful validation.
curl --location --request POST 'http://localhost:8181/rests/operations/uniconfig-manager:validate' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data-raw '{
"input": {
"target-nodes": {
"node": ["R1","R2]
}
}
}'
#
Successful example
If RPC input does not specify any target nodes, all nodes touched in the transaction are validated.
curl --location --request POST 'http://localhost:8181/rests/operations/uniconfig-manager:validate' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data-raw '{
"input": {
"target-nodes": {
}
}
}'
#
Failed example
RPC input has one target node. RPC output describes the result of the validation. In this case, the node has failed because validation has failed.
curl --location --request POST 'http://localhost:8181/rests/operations/uniconfig-manager:validate' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data-raw '{
"input": {
"target-nodes": {
"node": ["R1"]
}
}
}'
{
"errors": {
"node-result": [
{
"error-type": "application",
"error-tag": "validation-failed",
"error-message": "RemoteDevice{R1}: Validate failed. illegal reference /orgs/org[name='TESTING-PROVIDER']/traffic-identification/using-networks\n",
"error-info": {
"node-id": "R1"
}
}
]
}
}
#
Failed example
RPC input contains two nodes. Node R1 is valid and R2 is not installed. If at least one node is invalid, the entire operation fails.
curl --location --request POST 'http://localhost:8181/rests/operations/uniconfig-manager:is-in-sync' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data-raw '{
"input": {
"target-nodes": {
"node": ["R1","R2"]
}
}
}'
{
"errors": {
"error": [
{
"error-type": "application",
"error-tag": "data-missing",
"error-message": "Node 'R2' hasn't been installed in Uniconfig database",
"error-info": {
"node-id": "R2"
}
}
]
}
}
#
Failed example
If RPC input does not contain any target nodes and there are no touched nodes, the request results in an error.
curl --location --request POST 'http://localhost:8181/rests/operations/uniconfig-manager:validate' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data-raw '{
"input": {
"target-nodes": {
}
}
}'
{
"errors": {
"error": [
{
"error-type": "application",
"error-tag": "missing-element",
"error-message": "There aren't any nodes specified in input RPC and there aren't any touched nodes."
}
]
}
}