* YANG unique: added single descendant node ids as special case

* This means that two variants are supported:
    * unique "a b c", ie multiple direct chidlren
    * unique "a/b/c", ie single descendants
  * RFC 7950 Sec 7.8.3 is somewhat unclear
  * The combination is not supported
* Netconf data-not-unique info changed to return schema nodes instead of XML for RFC7950 compliance
This commit is contained in:
Olof hagsand 2022-03-08 09:18:10 +01:00
parent dfeb7cef75
commit 23b466a854
7 changed files with 349 additions and 27 deletions

View file

@ -1275,7 +1275,7 @@ netconf_malformed_message_xml(cxobj **xret,
* "unique" constraint is invalidated.
* @param[out] xret Error XML tree. Free with xml_free after use
* @param[in] x List element containing duplicate
* @param[in] cvk List of comonents in x that are non-unique
* @param[in] cvk List of components in x that are non-unique
* @see RFC7950 Sec 15.1
*/
int
@ -1321,13 +1321,9 @@ netconf_data_not_unique_xml(cxobj **xret,
goto done;
}
while ((cvi = cvec_each(cvk, cvi)) != NULL){
if ((xi = xml_find(x, cv_string_get(cvi))) == NULL)
continue; /* ignore, shouldnt happen */
clicon_xml2cbuf(cb, xi, 0, 0, -1);
if (clixon_xml_parse_va(YB_NONE, NULL, &xinfo, NULL,
"<non-unique>%s</non-unique>", cbuf_get(cb)) < 0)
"<non-unique>%s</non-unique>", cv_string_get(cvi)) < 0)
goto done;
cbuf_reset(cb);
}
}
retval = 0;