03-15-2023 03:27 PM
I am noticing the difference in the RESTCONF "GET" response if the service does not exist in the CDB. The older NSO version (5.3.4.1) was returning different results than what we are seeing in the current NSO version (5.7.5.1). Can someone tell me what the correct response is? If this was a defect in the 5.3.x release, then in which release did this get fixed?
Sample requests
================
//NSO 5.7.5.1
[root@user]# curl -kiu xxx:xxxxx https://xxxxxxxx/restconf/data/service-path=keys?depth=unbounded&with-defaults=report-all&content=config -X GET -H "accept: application/yang-data+json"
HTTP/1.1 404 Not Found
Date: Wed, 15 Mar 2023 07:16:14 GMT
Cache-Control: private, no-cache, must-revalidate, proxy-revalidate
Content-Length: 197
Content-Type: application/yang-data+json
X-Cisco-NSO-Trace-ID: 9c1a9ca9-ec82-44d0-9523-09dcf22929a8
Pragma: no-cache
Content-Security-Policy: default-src 'self'; block-all-mixed-content; base-uri 'self'; frame-ancestors 'none';
Strict-Transport-Security: max-age=15552000; includeSubDomains
X-Content-Type-Options: nosniff
X-Frame-Options: DENY
X-XSS-Protection: 1; mode=block
{
"ietf-restconf:errors": {
"error": [
{
"error-type": "application",
"error-tag": "invalid-value",
"error-message": "uri keypath not found"
}
]
}
}
//NSO 5.3.4.1
[root@user]# curl -kiu xxx:xxxxx https://xxxxxxxx/restconf/data/service-path=keys?depth=unbounded&with-defaults=report-all&content=config -X GET -H "accept: application/yang-data+json"
HTTP/1.1 404 Not Found
Date: Wed, 15 Mar 2023 07:11:32 GMT
Cache-Control: private, no-cache, must-revalidate, proxy-revalidate
Content-Length: 0
Content-Type: text/html; charset=UTF-8
Pragma: no-cache
Content-Security-Policy: default-src 'self'; block-all-mixed-content; base-uri 'self'; frame-ancestors 'none';
Strict-Transport-Security: max-age=15552000; includeSubDomains
X-Content-Type-Options: nosniff
X-Frame-Options: DENY
X-XSS-Protection: 1; mode=block
03-15-2023 04:25 PM
Hello,
it was introduced in NSO 5.6. You can check the CHANGE file
- restconf: A request towards an instance which does not exist did not
emit an error payload, only an HTTP 404 status code. Now a corresponding
error payload is emitted when instances are not found.
Error payloads were also not emitted for missing API resource, DELETE of
non-existent data, or non-existent list instance in action input. Now
error payloads are emitted for these cases as well.
03-16-2023 01:34 AM
The error-tag was introduced to comply with the RFC:
https://www.rfc-editor.org/rfc/rfc8040.html#page-44
If a retrieval request for a data resource represents an instance
that does not exist, then an error response containing a "404 Not
Found" status-line MUST be returned by the server. The error-tag
value "invalid-value" is used in this case.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide