Fix augment/deviate mechanics 49/104849/1
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 16:36:28 +0000 (17:36 +0100)
commit1848115fa424b618ff166897e5d64f5b086b0f7b
treef4448cb4bd3aa47ae90b61591519f07eaf011514
parent38ab9e9ed021305bdf3d8eea1718d8599ed87f3b
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]