* [Adding feature to top level container doesn't work](https://github.com/clicon/clixon/issues/322)

* Instead of removing YANG which is disabled by `if-feature`, replace it with an yang `anydata` node.
  * This means XML specified by such YANG is ignored, and it is not an error to access it
  * Note the similarity with `CLICON_YANG_UNKNOWN_ANYDATA`
This commit is contained in:
Olof hagsand 2022-04-06 14:04:11 +02:00
parent 4dd71c671f
commit f1300d7a12
6 changed files with 180 additions and 34 deletions

View file

@ -264,6 +264,8 @@ yang_augment_node(clicon_handle h,
/* The target node MUST be either a container, list, choice, case, input, output, or notification node.
* which means it is slightly different than a schema-nodeid ? */
targetkey = yang_keyword_get(ytarget);
if (targetkey == Y_ANYDATA)
goto ok;
/* Find when statement, if present */
if ((ywhen = yang_find(ys, Y_WHEN, NULL)) != NULL){
@ -615,6 +617,9 @@ yang_expand_uses_node(yang_stmt *yn,
/* Not found, try next */
if (yrt == NULL)
continue;
/* Refine ANYDATA does not make sense */
if (yang_keyword_get(yrt) == Y_ANYDATA || yang_keyword_get(yrt) == Y_ANYXML)
continue;
/* Do the actual refinement */
if (ys_do_refine(yr, yrt) < 0)
goto done;