Improved netconf error handling for data-not-unique and missing-choice

* Follows RFC7950 Sec 15.1 and 15.6 more closely
* Fixed: [When multiple lists have same key name, need more elaborate error message in case of configuration having duplicate keys](https://github.com/clicon/clixon/issues/362)
This commit is contained in:
Olof hagsand 2022-09-19 14:33:44 +02:00
parent e579d959fa
commit 51d1a2d41c
11 changed files with 143 additions and 65 deletions

View file

@ -540,7 +540,7 @@ text_modify(clicon_handle h,
/* RFC 8040 4.6 PATCH:
* If the target resource instance does not exist, the server MUST NOT create it.
*/
if (netconf_data_missing(cbret, NULL,
if (netconf_data_missing(cbret,
"RFC 8040 4.6. PATCH: If the target resource instance does not exist, the server MUST NOT create it") < 0)
goto done;
goto fail;
@ -714,7 +714,7 @@ text_modify(clicon_handle h,
break;
case OP_DELETE:
if (x0==NULL){
if (netconf_data_missing(cbret, NULL, "Data does not exist; cannot delete resource") < 0)
if (netconf_data_missing(cbret, "Data does not exist; cannot delete resource") < 0)
goto done;
goto fail;
}
@ -735,7 +735,7 @@ text_modify(clicon_handle h,
}
else {
if (op == OP_DELETE){
if (netconf_data_missing(cbret, NULL, "Data does not exist; cannot delete resource") < 0)
if (netconf_data_missing(cbret, "Data does not exist; cannot delete resource") < 0)
goto done;
goto fail;
}
@ -941,7 +941,7 @@ text_modify(clicon_handle h,
break;
case OP_DELETE:
if (x0==NULL){
if (netconf_data_missing(cbret, NULL, "Data does not exist; cannot delete resource") < 0)
if (netconf_data_missing(cbret, "Data does not exist; cannot delete resource") < 0)
goto done;
goto fail;
}
@ -1060,7 +1060,7 @@ text_modify_top(clicon_handle h,
I.e., curl -u andy:bar -sS -X DELETE http://localhost/restconf/data
*/
case OP_DELETE:
if (netconf_data_missing(cbret, NULL, "Data does not exist; cannot delete resource") < 0)
if (netconf_data_missing(cbret, "Data does not exist; cannot delete resource") < 0)
goto done;
goto fail;
break;