Fix augment/deviate mechanics 50/104850/2
authorSangwook Ha <sangwook.ha@verizon.com>
Mon, 30 Jan 2023 21:50:33 +0000 (13:50 -0800)
committerRobert Varga <robert.varga@pantheon.tech>
Mon, 13 Mar 2023 17:06:17 +0000 (18:06 +0100)
commit8857c2188c71a363d876841bf4db57a86f70ce8e
treee0f6038741251cf19b362c607118f5c597abfc21
parent8c5647fe6bd4eaf2d2f8a3c3950f8483a40dd3db
Fix augment/deviate mechanics

Parsing of YANG models with a deviation fails if the deviation target
node is conditionally augmented based on a feature.

The problem is we are reusing are reusing setUnsupported() for two
cases: when the feature is not supported and when the target is not
available.

Separate the second case into a separate boolean, and if the target is
available, propagate children to target as unsupported -- which makes
namespace resolution work correctly and deviate properly sees the
children as unsupported.

JIRA: YANGTOOLS-1485
Change-Id: I954185dd0067667faae8073e222f07b65907e675
Signed-off-by: Sangwook Ha <sangwook.ha@verizon.com>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 46497a560b73b86f51936e3326881657e523185f)
parser/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/augment/AugmentInferenceAction.java
parser/yang-parser-rfc7950/src/test/java/org/opendaylight/yangtools/yang/stmt/YT1485Test.java [new file with mode: 0644]
parser/yang-parser-rfc7950/src/test/resources/bugs/YT1485/augment/bar.yang [new file with mode: 0644]
parser/yang-parser-rfc7950/src/test/resources/bugs/YT1485/augment/foo.yang [new file with mode: 0644]
parser/yang-parser-rfc7950/src/test/resources/bugs/YT1485/leaf/bar.yang [new file with mode: 0644]
parser/yang-parser-rfc7950/src/test/resources/bugs/YT1485/leaf/foo.yang [new file with mode: 0644]