Bug 5968: Mandatory leaf enforcement does not work in some cases 80/47980/1
authorPeter Kajsa <pkajsa@cisco.com>
Thu, 28 Jul 2016 13:05:16 +0000 (15:05 +0200)
committerRobert Varga <nite@hq.sk>
Fri, 4 Nov 2016 10:05:29 +0000 (10:05 +0000)
commit655c13c48277155b02706b75c88554c4a05ce673
treea3f0ab18992c34efb05bc5a0ddc37bfde989d63a
parent7bb2274dfc9eaaa3fa185e92067721ca47e17ece
Bug 5968: Mandatory leaf enforcement does not work in some cases

When MapEntry nodes are directly written into datatree, mandatory leaf
enforcement works correctly. However, when a List, Container or any other
parent node containing MapEntry nodes as its children is written into datatree,
datatree does not check presence of mandatory nodes of in this way written
map entry nodes. This patch provides fix which ensures mandatory node validation
in all cases above.

In addition, full validation on unsealed modification was performed after each MERGE
operation performed on this modification, which may lead to undesirable results,
because unsealed modification does not have to contain all elements, which can be
added during next operations on this modification. This patch fixes this behavior of
MERGE operation and performs full validation during seal() method.

Change-Id: If653eeda5378cf1ed1418123eb33713ee80976d9
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
Signed-off-by: Robert Varga <rovarga@cisco.com>
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
(cherry picked from commit 5ec45595d85f7c42310707ea058dac8a6be62acb)
yang/yang-data-impl/src/main/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/AbstractNodeContainerModificationStrategy.java
yang/yang-data-impl/src/main/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/ListEntryModificationStrategy.java
yang/yang-data-impl/src/main/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/ModifiedNode.java
yang/yang-data-impl/src/main/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/OperationWithModification.java
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/Bug5968MergeTest.java [new file with mode: 0644]
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/Bug5968Test.java [new file with mode: 0644]
yang/yang-data-impl/src/test/resources/bug5968/foo.yang [new file with mode: 0644]