Do not suppress 'uses' node effects 34/103734/1
authorSangwook Ha <sangwook.ha@verizon.com>
Sun, 4 Dec 2022 06:00:47 +0000 (22:00 -0800)
committerRobert Varga <robert.varga@pantheon.tech>
Fri, 23 Dec 2022 11:28:15 +0000 (12:28 +0100)
commit3d3cd8719491b8bdbdcfc18b66e390cc46d01abd
tree47a24dafc8a390afa5a67031348a2d8c0e37f54e
parentfef7b7364c5bf46d3736d7a86bc5ff7f51c7b536
Do not suppress 'uses' node effects

Parser tries to process an 'augment' statement with 'if-feature' and
fails when the feature is not supported and the 'augment' statement
targets a node defined with a nested grouping and dependent on the
feature.

Add a test case (4th one) to reproduce the issue. The other test cases
show that there is no parsing issue if the augmentation target node is
defined with a single grouping or feature is supported.

The problem here is not AugmentStatementSupport, but rather
UsesStatementSupport, which fails to propagate children when if-feature
is in effect -- hence those children never make it to the schema tree,
and hence fail to be looked up.

Use 'uses' statement's if-feature to mark any children as unsupporte,
hence they are reflected in namespaces, but they will not be built.

JIRA: YANGTOOLS-1471
Change-Id: Ibd86530388a99ed3c8ade7bf9af109c6a0cfb80a
Signed-off-by: Sangwook Ha <sangwook.ha@verizon.com>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 4ad4e83aa9150c6c32af1e04fc879e844edae5cd)
parser/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/uses/UsesStatementSupport.java
parser/yang-parser-rfc7950/src/test/java/org/opendaylight/yangtools/yang/stmt/AbstractYangTest.java
parser/yang-parser-rfc7950/src/test/java/org/opendaylight/yangtools/yang/stmt/TestUtils.java
parser/yang-parser-rfc7950/src/test/java/org/opendaylight/yangtools/yang/stmt/YT1471Test.java [new file with mode: 0644]
parser/yang-parser-rfc7950/src/test/resources/bugs/YT1471/nested/foo.yang [new file with mode: 0644]
parser/yang-parser-rfc7950/src/test/resources/bugs/YT1471/single/foo.yang [new file with mode: 0644]