Fix mandatory enforcer failure on augmented nodes 47/96447/2
authorRobert Varga <robert.varga@pantheon.tech>
Tue, 18 May 2021 08:28:13 +0000 (10:28 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Tue, 8 Jun 2021 06:47:38 +0000 (08:47 +0200)
commit6bcc983bf8875a85e329991f60127b6a6d29cb57
tree0aec4ab9d854c8bd1cea51b03492d85848a885a3
parent9d74a74a9d46ff8c6878bc7d76994782d938cddc
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.

JIRA: YANGTOOLS-1276
Change-Id: Ifcc2e0d141e18f74173f15e293b16cbd297a5af6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Signed-off-by: Tibor Král <tibor.kral@pantheon.tech>
(cherry picked from commit 7862271a33b14d21ebf1e72aacd05d3e4687c6b1)
yang/yang-data-impl/src/main/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/MandatoryDescendant.java [new file with mode: 0644]
yang/yang-data-impl/src/main/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/MandatoryLeafEnforcer.java
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/YT1276Test.java [new file with mode: 0644]
yang/yang-data-impl/src/test/resources/yt1276.yang [new file with mode: 0644]