Bug 5968: Mandatory leaf enforcement does not work in some cases 33/44233/10
authorPeter Kajsa <pkajsa@cisco.com>
Thu, 28 Jul 2016 13:05:16 +0000 (15:05 +0200)
committerPeter Kajsa <pkajsa@cisco.com>
Thu, 3 Nov 2016 15:00:28 +0000 (16:00 +0100)
commit5ec45595d85f7c42310707ea058dac8a6be62acb
tree6bb4d178e0eacab35755e799e20cf92c800f22a2
parent5babaa4fc00be0a587748c17b11f523ba8d61498
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>
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]