Added option to treat unknown XML (wrt YANG) as anydata.

This commit is contained in:
Olof hagsand 2020-05-03 22:03:33 +02:00
parent 12d1b67250
commit dafc6d10e0
15 changed files with 80 additions and 8 deletions

View file

@ -1091,15 +1091,17 @@ xml_yang_validate_all(clicon_handle h,
and !Node has a config sub-statement and it is false */
ys=xml_spec(xt);
if (ys==NULL){
if (clicon_option_bool(h, "CLICON_YANG_UNKNOWN_ANYDATA") == 1)
goto ok;
if ((cb = cbuf_new()) == NULL){
clicon_err(OE_UNIX, errno, "cbuf_new");
goto done;
}
if (xml2ns(xt, xml_prefix(xt), &namespace) < 0)
goto done;
cprintf(cb, "Failed to find YANG spec of XML node: %s", xml_name(xt));
if ((xp = xml_parent(xt)) != NULL)
cprintf(cb, " with parent: %s", xml_name(xp));
if (xml2ns(xt, xml_prefix(xt), &namespace) < 0)
goto done;
if (namespace)
cprintf(cb, " in namespace: %s", namespace);
if (netconf_unknown_element_xml(xret, "application", xml_name(xt), cbuf_get(cb)) < 0)