Do not suppress 'uses' node effects 55/103555/9
authorSangwook Ha <sangwook.ha@verizon.com>
Sun, 4 Dec 2022 06:00:47 +0000 (22:00 -0800)
committerRobert Varga <nite@hq.sk>
Wed, 21 Dec 2022 23:37:25 +0000 (23:37 +0000)
commit4ad4e83aa9150c6c32af1e04fc879e844edae5cd
tree338f0d58f152434e0afa06762d119f88706a216d
parent7e849648fed0d0a195f83d43d1a7d015478ad1eb
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>
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]