[NETCONF-442] Deleting non existing data using PATCH should return 404 Created: 24/Jul/17  Updated: 15/Mar/19  Resolved: 09/Aug/17

Status: Resolved
Project: netconf
Component/s: restconf-nb
Affects Version/s: None
Fix Version/s: None

Type: Bug
Reporter: Tomas Olvecky Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: All
Platform: All


Issue Links:
Duplicate
duplicates NETCONF-429 Status code for patch error response ... Resolved
External issue ID: 8878

 Description   

According to rfc8072, section 2.5., delete operation should return error when the data does not exist.
Steps to reproduce:
feature:install odl-restconf odl-clustering-test-app

Run curl:
curl -X PATCH --user admin:admin ${ODL_HOST}:8181/restconf/config/car:cars -v -H "Content-Type: application/yang.patch+json" -H "Accept: application/yang.patch-status+json" -d '
{
"ietf-restconf:yang-patch" : {
"patch-id" : "0",
"edit" : [

{ "edit-id" : "edit2", "operation" : "delete", "target" : "/car:car-entry[car:id=\"1\"]" }

]
}
}
'

With no data in car:cars, returns 200 but outputs:
{"ietf-yang-patch:yang-patch-status":{"patch-id":"0","errors":{"error":[

{"error-type":"application","error-tag":"operation-failed","error-message":"Data did not pass validation."}

]},"edit-status":{"edit":[

{"edit-id":"edit2","ok":[null]}

]}}}

This is probably the same issue reported as NETCONF-429 .

However adding a car:
curl -v --user admin:admin $ODL_HOST:8181/restconf/config/car:cars/ -H "Content-Type: application/yang.data+json" -X PUT -d '
{ "cars" :
{"car-entry": [

{ "id": "1", "category": "coupe", "model": "mustang", "manufacturer": "ford", "year": "2013" }

]
}
}
'

And then executing PATCH delete operation multiple times will always result in status code 200 and output:
{"ietf-yang-patch:yang-patch-status":{"patch-id":"0","ok":[null]}}

Expected behavior:
According to the RFC the first delete operation should succeed with 200, all subsequent delete operations must fail with status code 404.


Generated at Wed Feb 07 20:15:02 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.