BUG-7262: Operational data tree should enforce mandatory nodes 72/48672/14
authorRobert Varga <rovarga@cisco.com>
Thu, 24 Nov 2016 16:00:57 +0000 (17:00 +0100)
committerRobert Varga <nite@hq.sk>
Wed, 16 Aug 2017 10:29:03 +0000 (10:29 +0000)
This flips the switch on enforcement of mandatory nodes in operational
data trees by default.

Change-Id: Id9c44d119a324ea711c36cea9a87728d0cbcc3ae
Signed-off-by: Robert Varga <rovarga@cisco.com>
yang/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/schema/tree/DataTreeConfiguration.java
yang/yang-data-api/src/test/java/org/opendaylight/yangtools/yang/data/api/schema/tree/DataTreeConfigurationTest.java

index b8eae24c3fdde405ea189f4918f5cc5d12f76dcc..3f8c52b85f2ff570eb8dd080366a911493e378ea 100644 (file)
@@ -42,7 +42,8 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 public class DataTreeConfiguration implements Immutable {
     public static final DataTreeConfiguration DEFAULT_CONFIGURATION = new Builder(TreeType.CONFIGURATION)
             .setMandatoryNodesValidation(true).build();
-    public static final DataTreeConfiguration DEFAULT_OPERATIONAL = new Builder(TreeType.OPERATIONAL).build();
+    public static final DataTreeConfiguration DEFAULT_OPERATIONAL = new Builder(TreeType.OPERATIONAL)
+            .setMandatoryNodesValidation(true).build();
 
     private final TreeType treeType;
     private final YangInstanceIdentifier rootPath;
index 0365aa163c81a49f6082d2187614afe5f4427c3d..b3688baadf550996a8a1223e74eb59c291c10fd2 100644 (file)
@@ -44,6 +44,6 @@ public class DataTreeConfigurationTest {
         dataTreeConfiguration = DataTreeConfiguration.getDefault(TreeType.OPERATIONAL);
         assertEquals(TreeType.OPERATIONAL, dataTreeConfiguration.getTreeType());
         assertFalse(dataTreeConfiguration.isUniqueIndexEnabled());
-        assertFalse(dataTreeConfiguration.isMandatoryNodesValidationEnabled());
+        assertTrue(dataTreeConfiguration.isMandatoryNodesValidationEnabled());
     }
 }