Fix mandatory enforcer failure on augmented nodes 96/96596/12
authorTibor Král <tibor.kral@pantheon.tech>
Tue, 22 Jun 2021 14:28:27 +0000 (08:28 -0600)
committerRobert Varga <robert.varga@pantheon.tech>
Tue, 2 Nov 2021 07:52:10 +0000 (08:52 +0100)
commit2dc089483662040f90257da6e7ff36907aa23edf
treeb629201f336e1530425ab1cc9da93811f4887e01
parente22dcca6358a5117d459973334ace0ec4db3508d
Fix mandatory enforcer failure on augmented nodes

Changes the way mandatory nodes are extracted from the schema.
Previously all mandatory nodes were approached as direct children of
the parent node. Even if they came from an augmentation which caused
"missing mandatory descendant" exceptions. This patch preserves both
options of building data nodes containing augmented mandatory nodes:
- setting the mandatory node as a direct child of the parent node
- setting the mandatory node as an AugmentationNode to the parent node

However the former option seems to be incorrect and might be removed
in the future major release.

This patch also covers the case where the mandatory leaf is deeper in
the augmented subtree.

JIRA: YANGTOOLS-1276
Change-Id: Ic5cd1950b935720bf56f52cfbc24c0f9e776a474
Signed-off-by: Tibor Král <tibor.kral@pantheon.tech>
data/yang-data-impl/src/main/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/MandatoryDescendant.java
data/yang-data-impl/src/main/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/MandatoryLeafEnforcer.java
data/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/YT1276Test.java
data/yang-data-impl/src/test/resources/yt1276.yang