* Added sorting of YANG statements

* Some openconfig specs seem to have use/when before a "config" which it depends on. This leads to XML encoding being in the "wrong order.
  * When parsing, clixon now sorts container/list statements so that sub-statements with WHEN are put last.
  * See [Statements given in "load set" are order dependent](https://github.com/clicon/clixon/issues/287)
* Fixed: [Statements given in "load set" are order dependent](https://github.com/clicon/clixon/issues/287)
This commit is contained in:
Olof hagsand 2021-11-16 14:28:16 +01:00
parent a64464beda
commit acc9c083a4
11 changed files with 181 additions and 39 deletions

View file

@ -249,12 +249,14 @@ yang_parse_exit(clixon_yang_yacc *yy)
int
ystack_pop(clixon_yang_yacc *yy)
{
struct ys_stack *ystack;
struct ys_stack *ystack;
if ((ystack = yy->yy_stack) == NULL){
clicon_err(OE_YANG, 0, "ystack is NULL");
return -1;
}
if (yang_sort_subelements(ystack->ys_node) < 0)
return -1;
yy->yy_stack = ystack->ys_next;
free(ystack);
return 0;