Fixed: [NETCONF error reply from failed leafref rquire-instance does not comply to RFC 7950](https://github.com/clicon/clixon/issues/53

This commit is contained in:
Olof hagsand 2024-07-22 09:17:13 +02:00
parent 07a1fa164f
commit 816238029d
10 changed files with 96 additions and 47 deletions

View file

@ -133,7 +133,6 @@ validate_leafref(cxobj *xt,
cvec *nsc = NULL;
cbuf *cberr = NULL;
char *path_arg;
yang_stmt *ymod;
cg_var *cv;
int require_instance = 1;
@ -179,13 +178,12 @@ validate_leafref(cxobj *xt,
clixon_err(OE_UNIX, errno, "cbuf_new");
goto done;
}
ymod = ys_module(ys);
cprintf(cberr, "Leafref validation failed: No leaf %s matching path %s in %s.yang:%d",
leafrefbody,
path_arg,
yang_argument_get(ymod),
yang_linenum_get(ys));
if (xret && netconf_bad_element_xml(xret, "application", leafrefbody, cbuf_get(cberr)) < 0)
/* RFC 7950 15.5 requires:
error-tag: data-missing
error-app-tag: instance-required
error-path: Path to the instance-identifier or leafref leaf.
*/
if (xret && netconf_missing_yang_xml(xret, path_arg, "instance-required", leafrefbody, NULL) < 0)
goto done;
goto fail;
}