BUG-4355: mandatory node presence enforcement 66/28666/18
authorPeter Kajsa <pkajsa@cisco.com>
Tue, 1 Dec 2015 10:25:17 +0000 (11:25 +0100)
committerTony Tkacik <ttkacik@cisco.com>
Fri, 8 Jan 2016 08:44:03 +0000 (09:44 +0100)
commit5500c3ce51088ed6de1adedd35f52662a8304b1e
tree31b357210106de015bbf30784ea8f0578cc7bb9e
parent0f2fbdce65031716667d54c77804a992c8f4080f
BUG-4355: mandatory node presence enforcement

Introduce mandatory leaf validation as specified in RFC6020. Mandatory
node presence is enforced whenever a presence container, a list entry,
and a case node.

The presence of mandatory leaves which do not have any ancestors other
than structural containers are not enforced as mandatory. The reason for
this is that the first transaction on such a DataTree would have to
introduce all mandatory leaves, as their non-presence would make other
transactions fail consistency checks.

Change-Id: I19df441026854955fd37f6e1ff7b4ea3c48c60b8
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/CaseEnforcer.java
yang/yang-data-impl/src/main/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/ChoiceModificationStrategy.java
yang/yang-data-impl/src/main/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/ContainerModificationStrategy.java [new file with mode: 0644]
yang/yang-data-impl/src/main/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/InMemoryDataTree.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/MandatoryLeafEnforcer.java [new file with mode: 0644]
yang/yang-data-impl/src/main/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/PresenceContainerModificationStrategy.java
yang/yang-data-impl/src/main/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/StructuralContainerModificationStrategy.java
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/MandatoryLeafTest.java [new file with mode: 0644]
yang/yang-data-impl/src/test/resources/list-constraints-validation-test-model.yang
yang/yang-data-impl/src/test/resources/mandatory-leaf-test.yang [new file with mode: 0644]