* Checked yang binding validity which lead to:

* Changed and enhanced several `bad-element` error replies to `unknown-element` with more detailed error-message.
This commit is contained in:
Olof hagsand 2020-07-25 16:09:24 +02:00
parent b56c0220c9
commit 57b104bc25
21 changed files with 106 additions and 70 deletions

View file

@ -291,8 +291,18 @@ main(int argc,
/* Validate XML as well */
if (yang_file_dir){
/* Populate */
if (xml_bind_yang(x0, YB_MODULE, yspec, NULL) < 0)
if ((ret = xml_bind_yang(x0, YB_MODULE, yspec, &xerr)) < 0)
goto done;
if (ret == 0){
if ((cb = cbuf_new()) ==NULL){
clicon_err(OE_XML, errno, "cbuf_new");
goto done;
}
if (netconf_err2cb(xerr, cbret) < 0)
goto done;
fprintf(stderr, "xml validation error: %s\n", cbuf_get(cbret));
goto done;
}
/* Sort */
if (xml_sort_recurse(x0) < 0)
goto done;