[ONOS-5076] YANG data tree Builder
Change-Id: I25160b651c26e614d29d7fad85e63f77a262d77c
diff --git a/apps/yms/app/src/test/java/org/onosproject/yms/app/ydt/AugmentTest.java b/apps/yms/app/src/test/java/org/onosproject/yms/app/ydt/AugmentTest.java
new file mode 100644
index 0000000..8fd5580
--- /dev/null
+++ b/apps/yms/app/src/test/java/org/onosproject/yms/app/ydt/AugmentTest.java
@@ -0,0 +1,528 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yms.app.ydt;
+
+import org.junit.Test;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import static org.junit.Assert.assertNull;
+import static org.onosproject.yms.app.ydt.YdtAppNodeOperationType.BOTH;
+import static org.onosproject.yms.app.ydt.YdtAppNodeOperationType.DELETE_ONLY;
+import static org.onosproject.yms.app.ydt.YdtAppNodeOperationType.OTHER_EDIT;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.A1;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.A2;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.A2L;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.A3;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.A4;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.A5;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.A5L;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.A6;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.A6L;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.AUG1;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.AUG2;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.AUG3;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.AUG4;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.AUG5;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.AUG6;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.AUG7;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.AUG8;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.AUG9;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.IETF;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.SLINK;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.STP;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.TOPONS;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.augmentNetworkYdt;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateAppLogicalNodeContents;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateAppModuleNodeContents;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateAppNodeContents;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateLeafContents;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateLeafListContents;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateNodeContents;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.walkINTree;
+import static org.onosproject.yms.ydt.YdtContextOperationType.DELETE;
+import static org.onosproject.yms.ydt.YdtContextOperationType.MERGE;
+
+public class AugmentTest {
+
+ private Set<String> valueSet = new HashSet();
+
+ private static final String[] EXPECTED = {
+ "Entry Node is yms-ietf-network.",
+ "Entry Node is yms-ietf-network.",
+ "Entry Node is networks.",
+ "Entry Node is network.",
+ "Entry Node is network-id.",
+ "Exit Node is network-id.",
+ "Entry Node is link.",
+ "Entry Node is link-id.",
+ "Exit Node is link-id.",
+ "Entry Node is source.",
+ "Entry Node is source-node.",
+ "Exit Node is source-node.",
+ "Entry Node is source-tp.",
+ "Exit Node is source-tp.",
+ "Exit Node is source.",
+
+ "Entry Node is destination.",
+ "Entry Node is dest-node.",
+ "Exit Node is dest-node.",
+ "Entry Node is dest-tp.",
+ "Exit Node is dest-tp.",
+ "Exit Node is destination.",
+
+ "Entry Node is supporting-link.",
+ "Entry Node is network-ref.",
+ "Exit Node is network-ref.",
+ "Entry Node is link-ref.",
+ "Exit Node is link-ref.",
+ "Exit Node is supporting-link.",
+
+ "Entry Node is supporting-link.",
+ "Entry Node is network-ref.",
+ "Exit Node is network-ref.",
+ "Entry Node is link-ref.",
+ "Exit Node is link-ref.",
+ "Exit Node is supporting-link.",
+
+ "Entry Node is augment1.",
+ "Entry Node is value1.",
+ "Exit Node is value1.",
+ "Exit Node is augment1.",
+
+ "Entry Node is augment2.",
+ "Entry Node is key1.",
+ "Exit Node is key1.",
+ "Entry Node is key2.",
+ "Exit Node is key2.",
+
+ "Entry Node is augment5.",
+
+ "Entry Node is augment6leafList.",
+ "Exit Node is augment6leafList.",
+
+ "Entry Node is value5.",
+ "Exit Node is value5.",
+ "Exit Node is augment5.",
+
+ "Entry Node is augment5leafList.",
+ "Exit Node is augment5leafList.",
+
+ "Entry Node is augment3.",
+
+ "Entry Node is augment4.",
+ "Entry Node is value4.",
+ "Exit Node is value4.",
+ "Exit Node is augment4.",
+
+ "Entry Node is augment5.",
+
+ "Entry Node is leaf6.",
+ "Exit Node is leaf6.",
+
+ "Entry Node is value5.",
+ "Exit Node is value5.",
+ "Exit Node is augment5.",
+
+ "Entry Node is augment6.",
+ "Entry Node is value6.",
+ "Exit Node is value6.",
+ "Exit Node is augment6.",
+
+ "Entry Node is value3.",
+ "Exit Node is value3.",
+ "Exit Node is augment3.",
+
+ "Entry Node is augment3leaf.",
+ "Exit Node is augment3leaf.",
+
+ "Exit Node is augment2.",
+
+ "Entry Node is augment2leafList.",
+ "Exit Node is augment2leafList.",
+
+ "Exit Node is link.",
+
+ "Entry Node is supporting-network.",
+ "Entry Node is network-ref.",
+ "Exit Node is network-ref.",
+ "Exit Node is supporting-network.",
+ "Entry Node is node.",
+ "Entry Node is node-id.",
+ "Exit Node is node-id.",
+ "Entry Node is t-point.",
+ "Entry Node is tp-id.",
+ "Exit Node is tp-id.",
+
+ "Entry Node is supporting-termination-point.",
+ "Entry Node is network-ref.",
+ "Exit Node is network-ref.",
+ "Entry Node is node-ref.",
+ "Exit Node is node-ref.",
+ "Entry Node is tp-ref.",
+ "Exit Node is tp-ref.",
+
+ "Entry Node is augment1.",
+ "Entry Node is value1.",
+ "Exit Node is value1.",
+ "Exit Node is augment1.",
+
+ "Entry Node is augment1-leaf.",
+ "Exit Node is augment1-leaf.",
+
+ "Entry Node is augment2.",
+
+ "Entry Node is augment3.",
+ "Entry Node is value3.",
+ "Exit Node is value3.",
+ "Exit Node is augment3.",
+
+ "Entry Node is augment4leaf.",
+ "Exit Node is augment4leaf.",
+
+ "Entry Node is value2.",
+ "Exit Node is value2.",
+ "Exit Node is augment2.",
+ "Entry Node is augment2leafList.",
+ "Exit Node is augment2leafList.",
+ "Entry Node is augment2leaf.",
+ "Exit Node is augment2leaf.",
+
+ "Exit Node is supporting-termination-point.",
+ "Exit Node is t-point.",
+ "Entry Node is supporting-node.",
+ "Entry Node is network-ref.",
+ "Exit Node is network-ref.",
+ "Entry Node is node-ref.",
+ "Exit Node is node-ref.",
+ "Exit Node is supporting-node.",
+
+ "Exit Node is node.",
+ // last augmented sibling in network
+ "Entry Node is link-id.",
+ "Exit Node is link-id.",
+
+ "Exit Node is network.",
+ "Exit Node is networks.",
+ "Entry Node is networks-state.",
+ "Entry Node is network.",
+ "Entry Node is network-ref.",
+ "Exit Node is network-ref.",
+ "Entry Node is server-provided.",
+ "Exit Node is server-provided.",
+ "Exit Node is network.",
+ "Exit Node is networks-state.",
+ "Exit Node is yms-ietf-network.",
+ "Exit Node is yms-ietf-network."
+ };
+
+ /**
+ * Creates and validates ietf network augment ydt.
+ */
+ @Test
+ public void augmentTest() {
+ YangRequestWorkBench ydtBuilder = augmentNetworkYdt();
+ validateTree(ydtBuilder);
+ validateAppTree(ydtBuilder);
+ walkINTree(ydtBuilder, EXPECTED);
+ }
+
+ /**
+ * Validates the given built ydt.
+ */
+ private void validateTree(YangRequestWorkBench ydtBuilder) {
+
+ // Assign root node to ydtNode for validating purpose.
+ YdtNode ydtNode = (YdtNode) ydtBuilder.getRootNode();
+ // Logical root node does not have operation type
+ validateNodeContents(ydtNode, "yms-ietf-network", null);
+ ydtNode = ydtNode.getFirstChild();
+ validateNodeContents(ydtNode, "yms-ietf-network", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateNodeContents(ydtNode, "networks", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateNodeContents(ydtNode, "network", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "network-id", "network1");
+ ydtNode = ydtNode.getNextSibling();
+
+ // Validating augmented child
+ validateNodeContents(ydtNode, "link", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "link-id", "id1");
+ ydtNode = ydtNode.getNextSibling();
+
+ // Inside source node
+ validateNodeContents(ydtNode, "source", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "source-node", "source1");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "source-tp", "source2");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+
+ //Inside destination node
+ validateNodeContents(ydtNode, "destination", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "dest-node", "dest1");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "dest-tp", "dest2");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+
+ //Inside supporting links
+ validateNodeContents(ydtNode, SLINK, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "network-ref", "network1");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "link-ref", "id2");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+
+ //Inside another supporting links instance
+ validateNodeContents(ydtNode, SLINK, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "network-ref", "network2");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "link-ref", "id3");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+
+ validateNodeContents(ydtNode, "augment1", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "value1", "1");
+ ydtNode = ydtNode.getParent();
+
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, "augment2", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "key1", "1");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "key2", "2");
+
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, "augment5", DELETE);
+ ydtNode = ydtNode.getFirstChild();
+ valueSet.add("1");
+ valueSet.add("2");
+ validateLeafListContents(ydtNode, A6L, valueSet);
+ ydtNode = ydtNode.getNextSibling();
+
+ validateLeafContents(ydtNode, "value5", "5");
+ ydtNode = ydtNode.getParent();
+
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafListContents(ydtNode, A5L, valueSet);
+
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, "augment3", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+
+ validateNodeContents(ydtNode, "augment4", DELETE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "value4", "4");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+
+ validateNodeContents(ydtNode, "augment5", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+
+ validateLeafContents(ydtNode, "leaf6", "6");
+ ydtNode = ydtNode.getNextSibling();
+
+ validateLeafContents(ydtNode, "value5", "5");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+
+ validateNodeContents(ydtNode, "augment6", DELETE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "value6", "6");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+
+ validateLeafContents(ydtNode, "value3", "3");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "augment3leaf", "3");
+
+ ydtNode = ydtNode.getParent();
+
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafListContents(ydtNode, A2L, valueSet);
+
+ ydtNode = ydtNode.getParent();
+
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, "supporting-network", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "network-ref", "network2");
+ ydtNode = ydtNode.getParent();
+
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, "node", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "node-id", "node1");
+ ydtNode = ydtNode.getNextSibling();
+
+ //Inside termination-point
+ validateNodeContents(ydtNode, "t-point", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "tp-id", "tp_id1");
+ ydtNode = ydtNode.getNextSibling();
+
+ validateTerminationPointAugment(ydtNode);
+ }
+
+ /**
+ * Validates the termination point node in given built ydt.
+ */
+ private void validateTerminationPointAugment(YdtNode ydtNode) {
+
+ //Inside supporting-termination-point
+ validateNodeContents(ydtNode, STP, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "network-ref", "network-ref");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "node-ref", "node-ref");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "tp-ref", "tp-ref");
+
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, "augment1", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "value1", "1");
+ ydtNode = ydtNode.getParent();
+
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "augment1-leaf", "1");
+
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, "augment2", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+
+ validateNodeContents(ydtNode, "augment3", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "value3", "3");
+ ydtNode = ydtNode.getParent();
+
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "augment4leaf", "4");
+
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "value2", "2");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafListContents(ydtNode, A2L, valueSet);
+
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "augment2leaf", "2");
+
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getParent();
+
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, "supporting-node", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "network-ref", "network3");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "node-ref", "network4");
+
+ ydtNode = ydtNode.getParent().getParent();
+
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "link-id", "id1");
+ ydtNode = ydtNode.getParent().getParent();
+
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, "networks-state", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateNodeContents(ydtNode, "network", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "network-ref", "network5");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "server-provided", "true");
+ }
+
+ /**
+ * Validates the given built ydt application tree.
+ */
+ private void validateAppTree(YangRequestWorkBench ydtBuilder) {
+
+ // Assign root node to ydtNode for validating purpose.
+ YdtAppContext ydtAppContext = ydtBuilder.getAppRootNode();
+ // Logical root node does not have operation type
+ validateAppLogicalNodeContents(ydtAppContext);
+ ydtAppContext = ydtAppContext.getFirstChild();
+ validateAppModuleNodeContents(ydtAppContext, IETF, BOTH);
+ ydtAppContext = ydtAppContext.getFirstChild();
+
+ //Inside link node
+ validateAppNodeContents(ydtAppContext, AUG1, TOPONS, BOTH);
+ ydtAppContext = ydtAppContext.getFirstChild();
+ validateAppNodeContents(ydtAppContext, AUG3, A1, OTHER_EDIT);
+ assertNull(ydtAppContext.getFirstChild());
+ assertNull(ydtAppContext.getPreviousSibling());
+ ydtAppContext = ydtAppContext.getNextSibling();
+ validateAppNodeContents(ydtAppContext, AUG3, A2, BOTH);
+
+ ydtAppContext = ydtAppContext.getFirstChild();
+ validateAppNodeContents(ydtAppContext, AUG5, A5, DELETE_ONLY);
+
+ ydtAppContext = ydtAppContext.getFirstChild();
+ validateAppNodeContents(ydtAppContext, AUG9, A6, DELETE_ONLY);
+ ydtAppContext = ydtAppContext.getParent();
+
+ ydtAppContext = ydtAppContext.getNextSibling();
+ validateAppNodeContents(ydtAppContext, AUG5, A3, BOTH);
+
+ ydtAppContext = ydtAppContext.getFirstChild();
+ validateAppNodeContents(ydtAppContext, AUG7, A4, DELETE_ONLY);
+
+ ydtAppContext = ydtAppContext.getNextSibling();
+ validateAppNodeContents(ydtAppContext, AUG7, A5, OTHER_EDIT);
+
+ ydtAppContext = ydtAppContext.getFirstChild();
+ validateAppNodeContents(ydtAppContext, AUG8, A6, OTHER_EDIT);
+ ydtAppContext = ydtAppContext.getParent();
+
+ ydtAppContext = ydtAppContext.getNextSibling();
+ validateAppNodeContents(ydtAppContext, AUG7, A6, DELETE_ONLY);
+
+ ydtAppContext = ydtAppContext.getParent();
+ ydtAppContext = ydtAppContext.getParent();
+ ydtAppContext = ydtAppContext.getParent();
+
+ ydtAppContext = ydtAppContext.getNextSibling();
+
+ validateAppNodeContents(ydtAppContext, AUG2, TOPONS, OTHER_EDIT);
+ ydtAppContext = ydtAppContext.getFirstChild();
+ validateAppNodeContents(ydtAppContext, AUG4, A1, OTHER_EDIT);
+ assertNull(ydtAppContext.getFirstChild());
+ assertNull(ydtAppContext.getPreviousSibling());
+ ydtAppContext = ydtAppContext.getNextSibling();
+ validateAppNodeContents(ydtAppContext, AUG4, A2, OTHER_EDIT);
+ assertNull(ydtAppContext.getNextSibling());
+ ydtAppContext = ydtAppContext.getFirstChild();
+ validateAppNodeContents(ydtAppContext, AUG6, A3, OTHER_EDIT);
+
+ ydtAppContext = ydtAppContext.getNextSibling();
+ validateAppNodeContents(ydtAppContext, AUG6, A4, OTHER_EDIT);
+ assertNull(ydtAppContext.getFirstChild());
+ assertNull(ydtAppContext.getNextSibling());
+ }
+}
diff --git a/apps/yms/app/src/test/java/org/onosproject/yms/app/ydt/FoodArenaTest.java b/apps/yms/app/src/test/java/org/onosproject/yms/app/ydt/FoodArenaTest.java
new file mode 100644
index 0000000..7f058a9
--- /dev/null
+++ b/apps/yms/app/src/test/java/org/onosproject/yms/app/ydt/FoodArenaTest.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yms.app.ydt;
+
+import org.junit.Test;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.onosproject.yms.app.ydt.YdtTestUtils.foodArenaYdt;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateLeafContents;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateNodeContents;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.walkINTree;
+import static org.onosproject.yms.ydt.YdtContextOperationType.MERGE;
+
+public class FoodArenaTest {
+
+ // Logger list is used for walker testing.
+ private final List<String> logger = new ArrayList<>();
+
+ private static final String[] EXPECTED = {
+ "Entry Node is foodarena.",
+ "Entry Node is food.",
+ "Entry Node is food.",
+ "Entry Node is chocolate.",
+ "Exit Node is chocolate.",
+ "Exit Node is food.",
+ "Exit Node is food.",
+ "Exit Node is foodarena."
+ };
+
+ /**
+ * Creates and validates food arena ydt.
+ */
+ @Test
+ public void foodArenaTest() throws IOException {
+
+ YangRequestWorkBench ydtBuilder = foodArenaYdt();
+ validateTree(ydtBuilder);
+ walkINTree(ydtBuilder, EXPECTED);
+ }
+
+ /**
+ * Validates the given built ydt.
+ */
+ private void validateTree(YangRequestWorkBench ydtBuilder) {
+ // Assign root node to ydtNode for validating purpose.
+ YdtNode ydtNode = (YdtNode) ydtBuilder.getRootNode();
+ // Logical root node does not have operation type
+ validateNodeContents(ydtNode, "foodarena", null);
+ ydtNode = ydtNode.getFirstChild();
+ validateNodeContents(ydtNode, "food", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateNodeContents(ydtNode, "food", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "chocolate", "dark");
+ }
+}
diff --git a/apps/yms/app/src/test/java/org/onosproject/yms/app/ydt/IetfNetworkTest.java b/apps/yms/app/src/test/java/org/onosproject/yms/app/ydt/IetfNetworkTest.java
new file mode 100644
index 0000000..0befc4d
--- /dev/null
+++ b/apps/yms/app/src/test/java/org/onosproject/yms/app/ydt/IetfNetworkTest.java
@@ -0,0 +1,120 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yms.app.ydt;
+
+import org.junit.Test;
+
+import static org.onosproject.yms.app.ydt.YdtTestUtils.ietfNetwork1Ydt;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateLeafContents;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateNodeContents;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.walkINTree;
+import static org.onosproject.yms.ydt.YdtContextOperationType.MERGE;
+
+public class IetfNetworkTest {
+
+ private static final String[] EXPECTED = {
+ "Entry Node is yms-ietf-network.",
+ "Entry Node is yms-ietf-network.",
+ "Entry Node is networks.",
+ "Entry Node is network.",
+ "Entry Node is network-id.",
+ "Exit Node is network-id.",
+ "Entry Node is supporting-network.",
+ "Entry Node is network-ref.",
+ "Exit Node is network-ref.",
+ "Exit Node is supporting-network.",
+ "Entry Node is node.",
+ "Entry Node is node-id.",
+ "Exit Node is node-id.",
+ "Entry Node is supporting-node.",
+ "Entry Node is network-ref.",
+ "Exit Node is network-ref.",
+ "Entry Node is node-ref.",
+ "Exit Node is node-ref.",
+ "Exit Node is supporting-node.",
+ "Exit Node is node.",
+ "Exit Node is network.",
+ "Exit Node is networks.",
+ "Entry Node is networks-state.",
+ "Entry Node is network.",
+ "Entry Node is network-ref.",
+ "Exit Node is network-ref.",
+ "Entry Node is server-provided.",
+ "Exit Node is server-provided.",
+ "Exit Node is network.",
+ "Exit Node is networks-state.",
+ "Exit Node is yms-ietf-network.",
+ "Exit Node is yms-ietf-network."
+ };
+
+ /**
+ * Creates and validates ietf network ydt.
+ */
+ @Test
+ public void ietfNetwork1Test() {
+ YangRequestWorkBench ydtBuilder = ietfNetwork1Ydt();
+ validateTree(ydtBuilder);
+ walkINTree(ydtBuilder, EXPECTED);
+ }
+
+ /**
+ * Validates the given built ydt.
+ */
+ private void validateTree(YangRequestWorkBench ydtBuilder) {
+
+ // Assign root node to ydtNode for validating purpose.
+ YdtNode ydtNode = (YdtNode) ydtBuilder.getRootNode();
+ // Logical root node does not have operation type
+ validateNodeContents(ydtNode, "yms-ietf-network", null);
+ ydtNode = ydtNode.getFirstChild();
+ validateNodeContents(ydtNode, "yms-ietf-network", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateNodeContents(ydtNode, "networks", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateNodeContents(ydtNode, "network", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "network-id", "network1");
+
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, "supporting-network", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "network-ref", "network2");
+ ydtNode = ydtNode.getParent();
+
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, "node", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "node-id", "node1");
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, "supporting-node", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "network-ref", "network3");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "node-ref", "network4");
+
+ ydtNode = ydtNode.getParent().getParent().getParent().getParent();
+
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, "networks-state", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateNodeContents(ydtNode, "network", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "network-ref", "network5");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "server-provided", "true");
+ }
+}
diff --git a/apps/yms/app/src/test/java/org/onosproject/yms/app/ydt/IetfTopologyTest.java b/apps/yms/app/src/test/java/org/onosproject/yms/app/ydt/IetfTopologyTest.java
new file mode 100644
index 0000000..c757b0c
--- /dev/null
+++ b/apps/yms/app/src/test/java/org/onosproject/yms/app/ydt/IetfTopologyTest.java
@@ -0,0 +1,268 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yms.app.ydt;
+
+import org.junit.Test;
+
+import static org.onosproject.yms.app.ydt.YdtAppNodeOperationType.OTHER_EDIT;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.AUG1;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.AUG2;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.IETF;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.SLINK;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.STP;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.TOPONS;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.ietfNetworkTopologyYdt;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateAppLogicalNodeContents;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateAppModuleNodeContents;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateAppNodeContents;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateLeafContents;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateNodeContents;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.walkINTree;
+import static org.onosproject.yms.ydt.YdtContextOperationType.MERGE;
+
+public class IetfTopologyTest {
+
+ private static final String[] EXPECTED = {
+ "Entry Node is yms-ietf-network.",
+ "Entry Node is yms-ietf-network.",
+ "Entry Node is networks.",
+ "Entry Node is network.",
+ "Entry Node is network-id.",
+ "Exit Node is network-id.",
+ "Entry Node is link.",
+ "Entry Node is link-id.",
+ "Exit Node is link-id.",
+ "Entry Node is source.",
+ "Entry Node is source-node.",
+ "Exit Node is source-node.",
+ "Entry Node is source-tp.",
+ "Exit Node is source-tp.",
+ "Exit Node is source.",
+
+ "Entry Node is destination.",
+ "Entry Node is dest-node.",
+ "Exit Node is dest-node.",
+ "Entry Node is dest-tp.",
+ "Exit Node is dest-tp.",
+ "Exit Node is destination.",
+
+ "Entry Node is supporting-link.",
+ "Entry Node is network-ref.",
+ "Exit Node is network-ref.",
+ "Entry Node is link-ref.",
+ "Exit Node is link-ref.",
+ "Exit Node is supporting-link.",
+
+ "Entry Node is supporting-link.",
+ "Entry Node is network-ref.",
+ "Exit Node is network-ref.",
+ "Entry Node is link-ref.",
+ "Exit Node is link-ref.",
+ "Exit Node is supporting-link.",
+ "Exit Node is link.",
+
+ "Entry Node is supporting-network.",
+ "Entry Node is network-ref.",
+ "Exit Node is network-ref.",
+ "Exit Node is supporting-network.",
+ "Entry Node is node.",
+ "Entry Node is node-id.",
+ "Exit Node is node-id.",
+ "Entry Node is t-point.",
+ "Entry Node is tp-id.",
+ "Exit Node is tp-id.",
+
+ "Entry Node is supporting-termination-point.",
+ "Entry Node is network-ref.",
+ "Exit Node is network-ref.",
+ "Entry Node is node-ref.",
+ "Exit Node is node-ref.",
+ "Entry Node is tp-ref.",
+ "Exit Node is tp-ref.",
+
+ "Exit Node is supporting-termination-point.",
+ "Exit Node is t-point.",
+ "Entry Node is supporting-node.",
+ "Entry Node is network-ref.",
+ "Exit Node is network-ref.",
+ "Entry Node is node-ref.",
+ "Exit Node is node-ref.",
+ "Exit Node is supporting-node.",
+
+ "Exit Node is node.",
+ // last augmented sibling in network
+ "Entry Node is link-id.",
+ "Exit Node is link-id.",
+
+ "Exit Node is network.",
+ "Exit Node is networks.",
+ "Entry Node is networks-state.",
+ "Entry Node is network.",
+ "Entry Node is network-ref.",
+ "Exit Node is network-ref.",
+ "Entry Node is server-provided.",
+ "Exit Node is server-provided.",
+ "Exit Node is network.",
+ "Exit Node is networks-state.",
+ "Exit Node is yms-ietf-network.",
+ "Exit Node is yms-ietf-network."
+ };
+
+ /**
+ * Creates and validates ietf network ydt.
+ */
+ @Test
+ public void ietfNetwork1Test() {
+ YangRequestWorkBench ydtBuilder = ietfNetworkTopologyYdt();
+ validateTree(ydtBuilder);
+ validateAppTree(ydtBuilder);
+ walkINTree(ydtBuilder, EXPECTED);
+ }
+
+ /**
+ * Validates the given built ydt.
+ */
+ private void validateTree(YangRequestWorkBench ydtBuilder) {
+
+ // Assign root node to ydtNode for validating purpose.
+ YdtNode ydtNode = (YdtNode) ydtBuilder.getRootNode();
+ // Logical root node does not have operation type
+ validateNodeContents(ydtNode, "yms-ietf-network", null);
+ ydtNode = ydtNode.getFirstChild();
+ validateNodeContents(ydtNode, "yms-ietf-network", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateNodeContents(ydtNode, "networks", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateNodeContents(ydtNode, "network", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "network-id", "network1");
+ ydtNode = ydtNode.getNextSibling();
+
+ // Validating augmented child
+ validateNodeContents(ydtNode, "link", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "link-id", "id1");
+ ydtNode = ydtNode.getNextSibling();
+
+ // Inside source node
+ validateNodeContents(ydtNode, "source", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "source-node", "source1");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "source-tp", "source2");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+
+ //Inside destination node
+ validateNodeContents(ydtNode, "destination", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "dest-node", "dest1");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "dest-tp", "dest2");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+
+ //Inside supporting links
+ validateNodeContents(ydtNode, SLINK, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "network-ref", "network1");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "link-ref", "id2");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+
+ //Inside another supporting links instance
+ validateNodeContents(ydtNode, SLINK, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "network-ref", "network2");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "link-ref", "id3");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getParent();
+
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, "supporting-network", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "network-ref", "network2");
+ ydtNode = ydtNode.getParent();
+
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, "node", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "node-id", "node1");
+ ydtNode = ydtNode.getNextSibling();
+
+ //Inside termination-point
+ validateNodeContents(ydtNode, "t-point", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "tp-id", "tp_id1");
+ ydtNode = ydtNode.getNextSibling();
+
+ //Inside supporting-termination-point
+ validateNodeContents(ydtNode, STP, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "network-ref", "network-ref");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "node-ref", "node-ref");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "tp-ref", "tp-ref");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getParent();
+
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, "supporting-node", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "network-ref", "network3");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "node-ref", "network4");
+
+ ydtNode = ydtNode.getParent().getParent();
+
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "link-id", "id1");
+ ydtNode = ydtNode.getParent().getParent();
+
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, "networks-state", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateNodeContents(ydtNode, "network", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "network-ref", "network5");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "server-provided", "true");
+ }
+
+ /**
+ * Validates the given built ydt application tree.
+ */
+ private void validateAppTree(YangRequestWorkBench ydtBuilder) {
+
+ // Assign root node to ydtNode for validating purpose.
+ YdtAppContext ydtAppContext = ydtBuilder.getAppRootNode();
+ // Logical root node does not have operation type
+ validateAppLogicalNodeContents(ydtAppContext);
+ ydtAppContext = ydtAppContext.getFirstChild();
+ validateAppModuleNodeContents(ydtAppContext, IETF, OTHER_EDIT);
+ ydtAppContext = ydtAppContext.getFirstChild();
+
+ //Inside link node
+ validateAppNodeContents(ydtAppContext, AUG1, TOPONS, OTHER_EDIT);
+ ydtAppContext = ydtAppContext.getNextSibling();
+
+ validateAppNodeContents(ydtAppContext, AUG2, TOPONS, OTHER_EDIT);
+ }
+}
diff --git a/apps/yms/app/src/test/java/org/onosproject/yms/app/ydt/ListTest.java b/apps/yms/app/src/test/java/org/onosproject/yms/app/ydt/ListTest.java
new file mode 100644
index 0000000..711f882
--- /dev/null
+++ b/apps/yms/app/src/test/java/org/onosproject/yms/app/ydt/ListTest.java
@@ -0,0 +1,450 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yms.app.ydt;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.onosproject.yangutils.datamodel.utils.builtindatatype.DataTypeException;
+import org.onosproject.yms.app.ydt.exceptions.YdtException;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import static org.junit.Assert.assertEquals;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.E_LEAF;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.E_LIST;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.E_TOPARENT;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.INV;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.LISTNS;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.LWC;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.getTestYdtBuilder;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.getYdtBuilder;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.listWithContainer1Ydt;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.listWithContainer2Ydt;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.listWithContainerYdt;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.listWithoutContainerYdt;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateLeafContents;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateLeafListContents;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateNodeContents;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.walkINTree;
+import static org.onosproject.yms.ydt.YdtContextOperationType.MERGE;
+
+public class ListTest {
+
+ @Rule
+ public ExpectedException thrown = ExpectedException.none();
+
+ private Set<String> valueSet = new HashSet();
+
+ private static final String[] ERROR = {
+ "rootlist is missing some of the keys of listwithcontainer.",
+ "Duplicate entry with name invalid.",
+ "Some of the key elements are not unique in listwithcontainer.",
+ "Too few key parameters in listwithcontainer." +
+ " Expected 2; actual 1.",
+ "Too many key parameters in listwithcontainer." +
+ " Expected 2; actual 3.",
+ "Application with name \"" + "invalid\" doesn't exist.",
+ "Too many instances of listwithcontainer. Expected maximum " +
+ "instances 3.",
+ "Duplicate entry found under invalidinterval leaf-list node.",
+ "YANG file error : Input value \"string\" is not a valid uint16."
+ };
+
+ private static final String[] EXPECTED = {
+ "Entry Node is list.",
+ "Entry Node is rootlist.",
+ "Entry Node is listwithoutcontainer.",
+ "Entry Node is invalidinterval.",
+ "Exit Node is invalidinterval.",
+ "Exit Node is listwithoutcontainer.",
+ "Exit Node is rootlist.",
+ "Exit Node is list."
+ };
+
+ List<String> keysValueList = new ArrayList<>();
+
+ /**
+ * Creates and validates rootlist module with listwithoutcontainer node.
+ */
+ @Test
+ public void listwithoutcontainerTest() throws YdtException {
+ YangRequestWorkBench ydtBuilder = listWithoutContainerYdt();
+ validateTree(ydtBuilder);
+ // walker test
+ walkINTree(ydtBuilder, EXPECTED);
+ }
+
+ /**
+ * Creates and validates rootlist module with listwithcontainer node
+ * using addMultiInstanceChild interface for adding multi instance node.
+ */
+ @Test
+ public void listwithcontainerTest() throws YdtException {
+ YangRequestWorkBench ydtBuilder = listWithContainerYdt();
+ validateListwithcontainerTree(ydtBuilder);
+ }
+
+ /**
+ * Creates and validates rootlist module with listwithcontainer
+ * node using addChild interface for adding multi instance node.
+ */
+ @Test
+ public void listwithcontainer1Test() throws YdtException {
+ YangRequestWorkBench ydtBuilder = listWithContainer1Ydt();
+ validateListwithcontainerTree(ydtBuilder);
+ }
+
+ /**
+ * Creates and validates rootlist module with multiple instances of
+ * listwithcontainer node using addMultiInstanceChild interface for adding
+ * multi instance node.
+ */
+ @Test
+ public void listwithcontainer2Test() throws YdtException {
+ YangRequestWorkBench ydtBuilder = listWithContainer2Ydt();
+ }
+
+ /**
+ * Validates the given built ydt.
+ */
+ private void validateTree(YangRequestWorkBench ydtBuilder) {
+
+ // assign root node to ydtNode for validating purpose.
+ YdtNode ydtNode = (YdtNode) ydtBuilder.getRootNode();
+ // Logical root node does not have operation type
+ validateNodeContents(ydtNode, "list", null);
+
+ ydtNode = ydtNode.getFirstChild();
+ validateNodeContents(ydtNode, "rootlist", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateNodeContents(ydtNode, "listwithoutcontainer", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, INV, "12");
+ }
+
+ /**
+ * Validates the given list with container built ydt.
+ */
+ private void validateListwithcontainerTree(
+ YangRequestWorkBench ydtBuilder) {
+
+ valueSet.add("1");
+ valueSet.add("2");
+ // assign root node to ydtNode for validating purpose.
+ YdtNode ydtNode = (YdtNode) ydtBuilder.getRootNode();
+ // Logical root node does not have operation type
+ validateNodeContents(ydtNode, "list", null);
+
+ ydtNode = ydtNode.getFirstChild();
+ validateNodeContents(ydtNode, "rootlist", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateNodeContents(ydtNode, LWC, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "invalid", "12");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "invalid1", "12");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafListContents(ydtNode, INV, valueSet);
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, "interface", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, INV, "12");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "invalid", "121");
+ }
+
+ /**
+ * Tests the negative error scenario when application name for ydt is
+ * invalid.
+ */
+ @Test
+ public void negative1Test() {
+ thrown.expect(YdtException.class);
+ thrown.expectMessage(ERROR[5]);
+ getYdtBuilder("list", "invalid", "ydt.invalid", MERGE);
+ }
+
+ /**
+ * Tests the negative error scenario when list node is not having all
+ * key elements.
+ */
+ @Test
+ public void negative2Test() throws YdtException {
+
+ YangRequestWorkBench ydtBuilder = getTestYdtBuilder(LISTNS);
+ ydtBuilder.addChild(LWC, LISTNS);
+ ydtBuilder.addLeaf("invalid", LISTNS, "12");
+ ydtBuilder.traverseToParent();
+
+ traversToParentErrorMsgValidator(ydtBuilder, ERROR[0]);
+ }
+
+ /**
+ * Tests the negative error scenario when duplicate entry of list node
+ * is created.
+ */
+ @Test
+ public void negative3Test() throws YdtException {
+ YangRequestWorkBench ydtBuilder = getTestYdtBuilder(LISTNS);
+ ydtBuilder.addChild(LWC, LISTNS);
+ ydtBuilder.addLeaf("invalid", LISTNS, "12");
+ ydtBuilder.traverseToParent();
+ leafErrorMsgValidator(ydtBuilder, "invalid", "12", ERROR[1]);
+ }
+
+ /**
+ * Tests the negative error scenario when key elements of list node
+ * are not unique.
+ */
+ @Test
+ public void negative4Test() throws YdtException {
+ YangRequestWorkBench ydtBuilder = getTestYdtBuilder(LISTNS);
+ ydtBuilder.addChild(LWC, LISTNS);
+ ydtBuilder.addLeaf("invalid", LISTNS, "12");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("invalid1", LISTNS, "12");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addChild(LWC, LISTNS);
+ ydtBuilder.addLeaf("invalid", LISTNS, "12");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("invalid1", LISTNS, "12");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ traversToParentErrorMsgValidator(ydtBuilder, ERROR[2]);
+ }
+
+ /**
+ * Tests the negative error scenario when all key elements of list node
+ * are not supplied.
+ */
+ @Test
+ public void negative5Test() throws YdtException {
+ keysValueList.clear();
+ keysValueList.add("1");
+ keysValueList.add("2");
+ keysValueList.add("2");
+ YangRequestWorkBench ydtBuilder = getTestYdtBuilder(LISTNS);
+ listNodeErrorMsgValidator(ydtBuilder, keysValueList, ERROR[4]);
+
+ keysValueList.clear();
+ keysValueList.add("1");
+ ydtBuilder = getTestYdtBuilder(LISTNS);
+ listNodeErrorMsgValidator(ydtBuilder, keysValueList, ERROR[3]);
+ }
+
+ /**
+ * Tests the negative error scenario when instances of a list node are
+ * created above the allowed limit.
+ */
+ @Test
+ public void negative6Test() throws YdtException {
+ keysValueList.clear();
+ keysValueList.add("1");
+ keysValueList.add("1");
+ YangRequestWorkBench ydtBuilder = getTestYdtBuilder(LISTNS);
+ ydtBuilder.addMultiInstanceChild(LWC, LISTNS, keysValueList, null);
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addChild(LWC, LISTNS);
+ ydtBuilder.addLeaf("invalid", LISTNS, "12");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("invalid1", LISTNS, "121");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addChild(LWC, LISTNS);
+ ydtBuilder.addLeaf("invalid", LISTNS, "12");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("invalid1", LISTNS, "1211");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addChild(LWC, LISTNS);
+ ydtBuilder.addLeaf("invalid", LISTNS, "12");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("invalid1", LISTNS, "21");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ traversToParentErrorMsgValidator(ydtBuilder, ERROR[6]);
+ }
+
+ /**
+ * Tests the negative error scenario when list node is not having all
+ * key elements.
+ */
+ @Test
+ public void negative7Test() throws YdtException {
+ YangRequestWorkBench ydtBuilder = getTestYdtBuilder(LISTNS);
+ ydtBuilder.addChild(LWC, LISTNS);
+ traversToParentErrorMsgValidator(ydtBuilder, ERROR[0]);
+ }
+
+ /**
+ * Tests the negative error scenario when duplicate key entry is created
+ * inside leaf-list node.
+ */
+ @Test
+ public void negative8Test() throws YdtException {
+ YangRequestWorkBench ydtBuilder = getTestYdtBuilder(LISTNS);
+ ydtBuilder.addChild(LWC, LISTNS);
+ ydtBuilder.addLeaf("invalid", LISTNS, "12");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("invalid1", LISTNS, "12");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf(INV, LISTNS, "12");
+ ydtBuilder.traverseToParent();
+ leafErrorMsgValidator(ydtBuilder, INV, "12", ERROR[7]);
+ }
+
+ /**
+ * Tests the negative error scenario when string is passed for uint16 type
+ * leaf node.
+ */
+ @Test
+ public void negative9Test() throws YdtException {
+ YangRequestWorkBench ydtBuilder = getTestYdtBuilder(LISTNS);
+ ydtBuilder.addChild(LWC, LISTNS);
+ ydtBuilder.addLeaf("invalid", LISTNS, "12");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("invalid1", LISTNS, "12");
+ ydtBuilder.traverseToParent();
+ leafErrorMsgValidator(ydtBuilder, INV, "string", ERROR[8]);
+ }
+
+ /**
+ * Tests the negative error scenario when duplicate key entry created
+ * inside a leaf-list node.
+ */
+ @Test
+ public void negative10Test() throws YdtException {
+ valueSet.clear();
+ valueSet.add("1");
+ valueSet.add("2");
+ valueSet.add("12");
+ YangRequestWorkBench ydtBuilder = getTestYdtBuilder(LISTNS);
+ ydtBuilder.addChild(LWC, LISTNS);
+ ydtBuilder.addLeaf("invalid", LISTNS, "12");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("invalid1", LISTNS, "12");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf(INV, LISTNS, "12");
+ ydtBuilder.traverseToParent();
+ thrown.expect(YdtException.class);
+ thrown.expectMessage(ERROR[7]);
+ ydtBuilder.addLeaf(INV, LISTNS, valueSet);
+ }
+
+ /**
+ * Tests the negative error scenario when string is passed for uint16 type
+ * key entry inside a leaf-list node.
+ */
+ @Test
+ public void negative11Test() throws YdtException {
+ valueSet.clear();
+ valueSet.add("string");
+ YangRequestWorkBench ydtBuilder = getTestYdtBuilder(LISTNS);
+ ydtBuilder.addChild(LWC, LISTNS);
+ ydtBuilder.addLeaf("invalid", LISTNS, "12");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("invalid1", LISTNS, "12");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf(INV, LISTNS, "12");
+ ydtBuilder.traverseToParent();
+ thrown.expect(DataTypeException.class);
+ thrown.expectMessage(ERROR[8]);
+ ydtBuilder.addLeaf(INV, LISTNS, valueSet);
+ }
+
+ /**
+ * Validate the error message obtained by adding multi instance node in
+ * current context against the given error string.
+ *
+ * @param bldr ydt builder
+ * @param list list of key values
+ * @param error error string
+ */
+ private void listNodeErrorMsgValidator(YangRequestWorkBench bldr,
+ List<String> list, String error) {
+ /*
+ * This try catch is explicitly written to use as utility in other
+ * test cases.
+ */
+ boolean isExpOccurred = false;
+ try {
+ bldr.addMultiInstanceChild(LWC, LISTNS, list, null);
+ } catch (YdtException e) {
+ isExpOccurred = true;
+ assertEquals(e.getMessage(), error);
+ }
+ assertEquals(E_LIST + LWC, isExpOccurred, true);
+ }
+
+ /**
+ * Validate the error message obtained by traversing back to parent of
+ * current context against the given error string.
+ *
+ * @param ydtBuilder ydt builder
+ * @param error error string
+ */
+ private void traversToParentErrorMsgValidator(
+ YangRequestWorkBench ydtBuilder, String error) {
+ /*
+ * This try catch is explicitly written to use as utility in other
+ * test cases.
+ */
+ boolean isExpOccurred = false;
+ try {
+ ydtBuilder.traverseToParent();
+ } catch (YdtException e) {
+ isExpOccurred = true;
+ assertEquals(e.getMessage(), error);
+ }
+ assertEquals(E_TOPARENT, isExpOccurred, true);
+ }
+
+ /**
+ * Validate the error message obtained by adding leaf node in
+ * current context against the given error string.
+ *
+ * @param bldr ydt builder
+ * @param name name of the leaf
+ * @param val leaf value
+ * @param error error string
+ */
+ private void leafErrorMsgValidator(
+ YangRequestWorkBench bldr, String name, String val, String error) {
+ /*
+ * This try catch is explicitly written to use as utility in other
+ * test cases.
+ */
+ boolean isExpOccurred = false;
+ try {
+ bldr.addLeaf(name, LISTNS, val);
+ } catch (YdtException e) {
+ isExpOccurred = true;
+ assertEquals(e.getMessage(), error);
+ }
+ assertEquals(E_LEAF + name, isExpOccurred, true);
+ }
+}
diff --git a/apps/yms/app/src/test/java/org/onosproject/yms/app/ydt/LogisticsManagerTest.java b/apps/yms/app/src/test/java/org/onosproject/yms/app/ydt/LogisticsManagerTest.java
new file mode 100644
index 0000000..a64c4c4
--- /dev/null
+++ b/apps/yms/app/src/test/java/org/onosproject/yms/app/ydt/LogisticsManagerTest.java
@@ -0,0 +1,179 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yms.app.ydt;
+
+import org.junit.Test;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import static org.onosproject.yms.app.ydt.YdtTestUtils.logisticsManagerYdt;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateLeafContents;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateLeafListContents;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateNodeContents;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.walkINTree;
+import static org.onosproject.yms.ydt.YdtContextOperationType.MERGE;
+
+public class LogisticsManagerTest {
+
+ // Logger list is used for walker testing.
+ private final List<String> logger = new ArrayList<>();
+
+ private Set<String> valueSet = new HashSet();
+
+ private static final String[] EXPECTED = {
+ "Entry Node is logisticsmanager.",
+ "Entry Node is customssupervisor.",
+ "Entry Node is supervisor.",
+ "Exit Node is supervisor.",
+ "Exit Node is customssupervisor.",
+ "Entry Node is merchandisersupervisor.",
+ "Entry Node is supervisor.",
+ "Exit Node is supervisor.",
+ "Exit Node is merchandisersupervisor.",
+ "Entry Node is materialsupervisor.",
+ "Entry Node is supervisor.",
+ "Entry Node is name.",
+ "Exit Node is name.",
+ "Entry Node is departmentId.",
+ "Exit Node is departmentId.",
+ "Exit Node is supervisor.",
+ "Entry Node is supervisor.",
+ "Entry Node is name.",
+ "Exit Node is name.",
+ "Entry Node is departmentId.",
+ "Exit Node is departmentId.",
+ "Exit Node is supervisor.",
+ "Exit Node is materialsupervisor.",
+ "Entry Node is purchasingsupervisor.",
+ "Entry Node is supervisor.",
+ "Entry Node is purchasing-specialist.",
+ "Exit Node is purchasing-specialist.",
+ "Entry Node is support.",
+ "Exit Node is support.",
+ "Exit Node is supervisor.",
+ "Exit Node is purchasingsupervisor.",
+ "Entry Node is warehousesupervisor.",
+ "Entry Node is supervisor.",
+ "Exit Node is supervisor.",
+ "Exit Node is warehousesupervisor.",
+ "Entry Node is tradingsupervisor.",
+ "Entry Node is supervisor.",
+ "Exit Node is supervisor.",
+ "Exit Node is tradingsupervisor.",
+ "Entry Node is employeeid.",
+ "Entry Node is employeeid.",
+ "Exit Node is employeeid.",
+ "Exit Node is employeeid.",
+ "Exit Node is logisticsmanager."
+ };
+
+ /**
+ * Creates and validates logistics manager ydt.
+ */
+ @Test
+ public void logisticsManagerTest() {
+ YangRequestWorkBench ydtBuilder = logisticsManagerYdt();
+ validateTree(ydtBuilder);
+ // walker test
+ walkINTree(ydtBuilder, EXPECTED);
+ }
+
+ /**
+ * Validates the given built ydt.
+ */
+ private void validateTree(YangRequestWorkBench ydtBuilder) {
+ valueSet.add("1");
+ valueSet.add("2");
+ valueSet.add("3");
+ valueSet.add("4");
+ valueSet.add("5");
+ // assign root node to ydtNode for validating purpose.
+ YdtNode ydtNode = (YdtNode) ydtBuilder.getRootNode();
+ // Logical root node does not have operation type
+ validateNodeContents(ydtNode, "logisticsmanager", null);
+
+ ydtNode = ydtNode.getFirstChild();
+ // Logical root node does not have operation type
+ validateNodeContents(ydtNode, "customssupervisor", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "supervisor", "abc");
+
+ ydtNode = ydtNode.getParent();
+
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, "merchandisersupervisor", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "supervisor", "abc");
+
+ ydtNode = ydtNode.getParent();
+
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, "materialsupervisor", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateNodeContents(ydtNode, "supervisor", MERGE);
+
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "name", "abc");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "departmentId", "xyz");
+
+ ydtNode = ydtNode.getParent();
+
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, "supervisor", MERGE);
+
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "name", "ab");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "departmentId", "xy");
+
+ ydtNode = ydtNode.getParent().getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, "purchasingsupervisor", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateNodeContents(ydtNode, "supervisor", MERGE);
+
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "purchasing-specialist", "abc");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "support", "xyz");
+
+ ydtNode = ydtNode.getParent().getParent();
+
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, "warehousesupervisor", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafListContents(ydtNode, "supervisor", valueSet);
+
+ ydtNode = ydtNode.getParent();
+
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, "tradingsupervisor", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "supervisor", "abc");
+
+ ydtNode = ydtNode.getParent();
+
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, "employeeid", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafListContents(ydtNode, "employeeid", valueSet);
+ }
+}
diff --git a/apps/yms/app/src/test/java/org/onosproject/yms/app/ydt/MockYangSchemaRegistry.java b/apps/yms/app/src/test/java/org/onosproject/yms/app/ydt/MockYangSchemaRegistry.java
new file mode 100644
index 0000000..8df66e9
--- /dev/null
+++ b/apps/yms/app/src/test/java/org/onosproject/yms/app/ydt/MockYangSchemaRegistry.java
@@ -0,0 +1,101 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yms.app.ydt;
+
+import org.onosproject.yangutils.datamodel.YangSchemaNode;
+import org.onosproject.yms.app.ynh.YangNotificationExtendedService;
+import org.onosproject.yms.app.ysr.DefaultYangSchemaRegistry;
+import org.onosproject.yms.app.ysr.TestYangSchemaNodeProvider;
+import org.onosproject.yms.app.ysr.YangSchemaRegistry;
+
+import static org.junit.Assert.assertEquals;
+
+
+/**
+ * Represent Yang schema registry. Yang schema registry provides
+ * interface to an application to register its YANG
+ * schema with YMS. It provides YANG schema nodes to YDT, YNB and YSB.
+ */
+public class MockYangSchemaRegistry implements YangSchemaRegistry {
+
+
+ @Override
+ public void registerApplication(
+ Object managerObject,
+ Class<?> serviceClass,
+ YangNotificationExtendedService notificationExtendedService) {
+ }
+
+ @Override
+ public void unRegisterApplication(Object managerObject,
+ Class<?> serviceClass) {
+ }
+
+ @Override
+ public Object getRegisteredApplication(YangSchemaNode yangSchemaNode) {
+ return null;
+ }
+
+ @Override
+ public YangSchemaNode getYangSchemaNodeUsingAppName(String schemaName) {
+ return null;
+ }
+
+ @Override
+ public YangSchemaNode getYangSchemaNodeUsingSchemaName(String appName) {
+
+ final String target = "target/TestYangSchemaNodeProvider";
+ TestYangSchemaNodeProvider testYangSchemaNodeProvider =
+ new TestYangSchemaNodeProvider();
+
+ String searchDir = "src/test/resources/ydtTestYangFiles/";
+
+ testYangSchemaNodeProvider.processSchemaRegistry(null);
+
+ DefaultYangSchemaRegistry registry = testYangSchemaNodeProvider
+ .getDefaultYangSchemaRegistry();
+ YangSchemaNode yangNode = registry
+ .getYangSchemaNodeUsingSchemaName(appName);
+ assertEquals(appName, yangNode.getName());
+ return yangNode;
+ }
+
+ @Override
+ public YangSchemaNode
+ getYangSchemaNodeUsingGeneratedRootNodeInterfaceFileName(
+ String rootInterfaceFileName) {
+ return null;
+ }
+
+ @Override
+ public YangSchemaNode getYangSchemaNodeUsingGeneratedRootNodeOpPramFileName(
+ String rootOpParamFileName) {
+ return null;
+ }
+
+ @Override
+ public YangSchemaNode getRootYangSchemaNodeForNotification(
+ String eventSubject) {
+ return null;
+ }
+
+ @Override
+ public Class<?> getRegisteredClass(YangSchemaNode schemaNode,
+ String appName) {
+ return null;
+ }
+}
diff --git a/apps/yms/app/src/test/java/org/onosproject/yms/app/ydt/RpcTest.java b/apps/yms/app/src/test/java/org/onosproject/yms/app/ydt/RpcTest.java
new file mode 100644
index 0000000..8ca52c1
--- /dev/null
+++ b/apps/yms/app/src/test/java/org/onosproject/yms/app/ydt/RpcTest.java
@@ -0,0 +1,93 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yms.app.ydt;
+
+import org.junit.Test;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.onosproject.yms.app.ydt.YdtTestUtils.helloOnos;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateLeafContents;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateNodeContents;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.walkINTree;
+import static org.onosproject.yms.ydt.YdtContextOperationType.MERGE;
+
+public class RpcTest {
+
+ // Logger list is used for walker testing.
+ private final List<String> logger = new ArrayList<>();
+
+ private static final String[] EXPECTED = {
+ "Entry Node is Hello-ONOS.",
+ "Entry Node is Hello_ONOS.",
+ "Entry Node is hello-world.",
+ "Entry Node is input.",
+ "Entry Node is name.",
+ "Exit Node is name.",
+ "Entry Node is surName.",
+ "Exit Node is surName.",
+ "Entry Node is stringList.",
+ "Entry Node is string1.",
+ "Exit Node is string1.",
+ "Entry Node is string2.",
+ "Exit Node is string2.",
+ "Exit Node is stringList.",
+ "Exit Node is input.",
+ "Exit Node is hello-world.",
+ "Exit Node is Hello_ONOS.",
+ "Exit Node is Hello-ONOS."
+ };
+
+ /**
+ * Creates and validates hello onos ydt.
+ */
+ @Test
+ public void rpc1Test() {
+ YangRequestWorkBench ydtBuilder = helloOnos();
+ validateTree(ydtBuilder);
+ // walker test
+ walkINTree(ydtBuilder, EXPECTED);
+ }
+
+ /**
+ * Validates the given built ydt.
+ */
+ private void validateTree(YangRequestWorkBench ydtBuilder) {
+
+ // assign root node to ydtNode for validating purpose.
+ YdtNode ydtNode = (YdtNode) ydtBuilder.getRootNode();
+ // Logical root node does not have operation type
+ validateNodeContents(ydtNode, "Hello-ONOS", null);
+ ydtNode = ydtNode.getFirstChild();
+ validateNodeContents(ydtNode, "Hello_ONOS", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateNodeContents(ydtNode, "hello-world", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateNodeContents(ydtNode, "input", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "name", "onos");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "surName", "yang");
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, "stringList", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "string1", "ON");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "string2", "LAB");
+ }
+}
diff --git a/apps/yms/app/src/test/java/org/onosproject/yms/app/ydt/YdtBitTest.java b/apps/yms/app/src/test/java/org/onosproject/yms/app/ydt/YdtBitTest.java
new file mode 100644
index 0000000..5446b51
--- /dev/null
+++ b/apps/yms/app/src/test/java/org/onosproject/yms/app/ydt/YdtBitTest.java
@@ -0,0 +1,94 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yms.app.ydt;
+
+import org.junit.Test;
+
+import static org.onosproject.yms.app.ydt.YdtTestConstants.BIT;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.BITNS;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.bitYdt;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateErrMsg;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateLeafContents;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateNodeContents;
+import static org.onosproject.yms.ydt.YdtContextOperationType.MERGE;
+
+public class YdtBitTest {
+
+ /*
+ BINARY
+
+ Positive scenario
+ input with position 0
+ input with position 1
+ input with position 2
+ */
+
+ /**
+ * Creates and validates bit ydt covering different positive scenario.
+ */
+ @Test
+ public void positiveTest() {
+ YangRequestWorkBench ydtBuilder = bitYdt();
+ validateTree(ydtBuilder);
+ }
+
+ /**
+ * Validates the given built ydt.
+ */
+ private void validateTree(YangRequestWorkBench ydtBuilder) {
+
+ // assign root node to ydtNode for validating purpose.
+ YdtNode ydtNode = (YdtNode) ydtBuilder.getRootNode();
+ // Logical root node does not have operation type
+ validateNodeContents(ydtNode, "builtInType", null);
+ ydtNode = ydtNode.getFirstChild();
+ validateNodeContents(ydtNode, "bit", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateNodeContents(ydtNode, "bitList", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "bit", "disable-nagle");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, "bitList", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "bit", "auto-sense-speed");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, "bitList", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "bit", "ten-Mb-only");
+ }
+
+ /*
+ Negative scenario
+
+ input with position 0
+ input with position 1
+ input with position 2
+ */
+
+ /**
+ * Tests all the negative scenario's for bit data type.
+ */
+ @Test
+ public void negativeTest() {
+ validateErrMsg("bit", BITNS, "0", BIT, "bitList");
+ validateErrMsg("bit", BITNS, "default", BIT, "bitList");
+ validateErrMsg("bit", BITNS, "1", BIT, "bitList");
+ validateErrMsg("bit", BITNS, "", BIT, "bitList");
+ }
+}
diff --git a/apps/yms/app/src/test/java/org/onosproject/yms/app/ydt/YdtBooleanTest.java b/apps/yms/app/src/test/java/org/onosproject/yms/app/ydt/YdtBooleanTest.java
new file mode 100644
index 0000000..505c640
--- /dev/null
+++ b/apps/yms/app/src/test/java/org/onosproject/yms/app/ydt/YdtBooleanTest.java
@@ -0,0 +1,88 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yms.app.ydt;
+
+import org.junit.Test;
+
+import static org.onosproject.yms.app.ydt.YdtTestConstants.BOOL;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.BOOLNS;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.booleanYdt;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateErrMsg;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateLeafContents;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateNodeContents;
+import static org.onosproject.yms.ydt.YdtContextOperationType.MERGE;
+
+public class YdtBooleanTest {
+
+ /*
+ BOOLEAN
+ Positive scenario
+ input with in "booleanList" and false
+ */
+
+ /**
+ * Creates and validates boolean ydt covering different positive scenario.
+ */
+ @Test
+ public void positiveTest() {
+ YangRequestWorkBench ydtBuilder = booleanYdt();
+ validateTree(ydtBuilder);
+ }
+
+ /**
+ * Validates the given built ydt.
+ */
+ private void validateTree(YangRequestWorkBench ydtBuilder) {
+
+ // assign root node to ydtNode for validating purpose.
+ YdtNode ydtNode = (YdtNode) ydtBuilder.getRootNode();
+ // Logical root node does not have operation type
+ validateNodeContents(ydtNode, "builtInType", null);
+ ydtNode = ydtNode.getFirstChild();
+ validateNodeContents(ydtNode, "bool", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateNodeContents(ydtNode, "booleanList", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "boolean", "true");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, "booleanList", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "boolean", "false");
+ }
+
+ /*
+ Negative scenario
+
+ input with in non zero value in case of "booleanList"
+ input with zero value in case of false
+ input with empty value in case of false
+ */
+
+ /**
+ * Tests all the negative scenario's for boolean data type.
+ */
+ @Test
+ public void negativeTest() {
+ validateErrMsg("boolean", BOOLNS, "10", BOOL, "booleanList");
+ validateErrMsg("boolean", BOOLNS, "0", BOOL, "booleanList");
+ validateErrMsg("boolean", BOOLNS, "", BOOL, "booleanList");
+ validateErrMsg("boolean", BOOLNS, "-1", BOOL, "booleanList");
+ validateErrMsg("boolean", BOOLNS, "tru", BOOL, "booleanList");
+ validateErrMsg("boolean", BOOLNS, "boolean", BOOL, "booleanList");
+ }
+}
diff --git a/apps/yms/app/src/test/java/org/onosproject/yms/app/ydt/YdtDecimal64Test.java b/apps/yms/app/src/test/java/org/onosproject/yms/app/ydt/YdtDecimal64Test.java
new file mode 100644
index 0000000..1d15d04
--- /dev/null
+++ b/apps/yms/app/src/test/java/org/onosproject/yms/app/ydt/YdtDecimal64Test.java
@@ -0,0 +1,193 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yms.app.ydt;
+
+import org.junit.Test;
+import org.onosproject.yms.app.ydt.exceptions.YdtException;
+
+import static org.onosproject.yms.app.ydt.YdtTestConstants.A;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.B;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.C;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.E;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.F;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.G;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.H;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MAXIWR;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MIDIWR;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MINIWR;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MRV;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.NIWMF;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.NWF;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.PIWMF;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.PWF;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.TYPE;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.decimal64Ydt;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateLeafContents;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateNodeContents;
+import static org.onosproject.yms.ydt.YdtContextOperationType.MERGE;
+
+public class YdtDecimal64Test {
+
+ /*
+
+ Positive scenario
+
+ input at boundry for decimal64 with fraction 2
+ i. min value
+ ii. max value
+
+ input at boundry for decimal64 with minimum fraction
+ i. min value
+ ii. mid value
+ iii. max value
+
+ input at boundry for decimal64 with maximum fraction
+ i. min value
+ ii. mid value
+ iii. max value
+
+ input with in range
+ if range is 10 to 100 for integer
+ i.1. input 11
+ i.2. min value 10
+ i.3. max value 100
+
+ input with multi interval range
+ if range is 10..40 | 50..100 for decimal64
+ i.1. input 11
+ i.2. input 10
+ i.3. input 40
+ i.4. input 50
+ i.5. input 55
+ i.6. input 100
+
+ if range is "min .. 3.14 | 10 | 20..max" for decimal64
+ i.1. input min
+ i.2. input 2.505
+ i.3. input 3.14
+ i.4. input 10
+ i.5. input 20
+ i.6. input 92233720368547757
+ i.7. input 92233720368547758.07
+
+ */
+
+ /**
+ * Creates and validates decimal64 ydt covering different positive scenario.
+ */
+ @Test
+ public void positiveTest() throws YdtException {
+ YangRequestWorkBench ydtBuilder = decimal64Ydt();
+ validateTree(ydtBuilder);
+ }
+
+ /**
+ * Validates the given built ydt.
+ */
+ private void validateTree(YangRequestWorkBench ydtBuilder) {
+
+ // assign root node to ydtNode for validating purpose.
+ YdtNode ydtNode = (YdtNode) ydtBuilder.getRootNode();
+ // Logical root node does not have operation type
+ validateNodeContents(ydtNode, TYPE, null);
+
+ ydtNode = ydtNode.getFirstChild();
+ validateNodeContents(ydtNode, "decimal64", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "negInt", C);
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "posInt", A);
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, NIWMF, F);
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, PIWMF, G);
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, NWF, H);
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, PWF, E);
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, MIDIWR, "11");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, MINIWR, "10");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, MAXIWR, "100");
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "decimal", "11");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "decimal", "10");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "decimal", "40");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "decimal", "50");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "decimal", "55");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "decimal", "100");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "revDecimal", C);
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "revDecimal", "2.505");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "revDecimal", "3.14");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "revDecimal", "10");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "revDecimal", "20");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "revDecimal", B);
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "revDecimal", A);
+ }
+}
diff --git a/apps/yms/app/src/test/java/org/onosproject/yms/app/ydt/YdtEmptyTest.java b/apps/yms/app/src/test/java/org/onosproject/yms/app/ydt/YdtEmptyTest.java
new file mode 100644
index 0000000..ea5ee34
--- /dev/null
+++ b/apps/yms/app/src/test/java/org/onosproject/yms/app/ydt/YdtEmptyTest.java
@@ -0,0 +1,83 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yms.app.ydt;
+
+import org.junit.Test;
+import org.onosproject.yms.app.ydt.exceptions.YdtException;
+
+import static org.onosproject.yms.app.ydt.YdtTestConstants.EMPTY;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.EMPTYNS;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.TYPE;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.emptyTypeYdt;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateErrMsg;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateLeafContents;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateNodeContents;
+import static org.onosproject.yms.ydt.YdtContextOperationType.MERGE;
+
+public class YdtEmptyTest {
+
+ /*
+ EMPTY
+ Positive scenario
+ input with in empty.
+ */
+
+ /**
+ * Creates and validates empty ydt covering different positive scenario.
+ */
+ @Test
+ public void positiveTest() throws YdtException {
+ YangRequestWorkBench ydtBuilder = emptyTypeYdt();
+ validateTree(ydtBuilder);
+ }
+
+ /**
+ * Validates the given built ydt.
+ */
+ private void validateTree(YangRequestWorkBench ydtBuilder) {
+
+ // assign root node to ydtNode for validating purpose.
+ YdtNode ydtNode = (YdtNode) ydtBuilder.getRootNode();
+ // Logical root node does not have operation type
+ validateNodeContents(ydtNode, TYPE, null);
+
+ ydtNode = ydtNode.getFirstChild();
+ validateNodeContents(ydtNode, "emptydata", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateNodeContents(ydtNode, "emptyList", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "empty", "");
+ }
+
+ /*
+ Negative scenario
+
+ input with " "
+ input with "tab"
+ input with """"
+ */
+
+ /**
+ * Tests all the negative scenario's for empty data type.
+ */
+ @Test
+ public void negativeTest() throws YdtException {
+ validateErrMsg("empty", EMPTYNS, " ", EMPTY, "emptyList");
+ validateErrMsg("empty", EMPTYNS, " ", EMPTY, "emptyList");
+ validateErrMsg("empty", EMPTYNS, " ", EMPTY, "emptyList");
+ }
+}
diff --git a/apps/yms/app/src/test/java/org/onosproject/yms/app/ydt/YdtEnumTest.java b/apps/yms/app/src/test/java/org/onosproject/yms/app/ydt/YdtEnumTest.java
new file mode 100644
index 0000000..77c2f81
--- /dev/null
+++ b/apps/yms/app/src/test/java/org/onosproject/yms/app/ydt/YdtEnumTest.java
@@ -0,0 +1,97 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yms.app.ydt;
+
+import org.junit.Test;
+import org.onosproject.yms.app.ydt.exceptions.YdtException;
+
+import static org.onosproject.yms.app.ydt.YdtTestConstants.ENUM;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.ENUMNS;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.TYPE;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.enumYdt;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateErrMsg;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateLeafContents;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateNodeContents;
+import static org.onosproject.yms.ydt.YdtContextOperationType.MERGE;
+
+public class YdtEnumTest {
+
+/*
+ ENUM
+
+ Positive scenario
+
+ input with in enum
+ input with "ten"
+ input with "hundred"
+ input with "thousand"
+*/
+
+ /**
+ * Creates and validates enum ydt covering different positive scenario.
+ */
+ @Test
+ public void positiveTest() throws YdtException {
+ YangRequestWorkBench ydtBuilder = enumYdt();
+ validateTree(ydtBuilder);
+ }
+
+ /**
+ * Validates the given built ydt.
+ */
+ private void validateTree(YangRequestWorkBench ydtBuilder) {
+
+ // assign root node to ydtNode for validating purpose.
+ YdtNode ydtNode = (YdtNode) ydtBuilder.getRootNode();
+ // Logical root node does not have operation type
+ validateNodeContents(ydtNode, TYPE, null);
+
+ ydtNode = ydtNode.getFirstChild();
+ validateNodeContents(ydtNode, "enumtest", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateNodeContents(ydtNode, "enumList", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "enumleaf", "ten");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, "enumList", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "enumleaf", "hundred");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, "enumList", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "enumleaf", "thousand");
+ }
+
+ /*
+ Negative scenario
+
+ input with "10"
+ input with "thousands"
+ */
+
+ /**
+ * Tests all the negative scenario's for enum data type.
+ */
+ @Test
+ public void negativeTest() throws YdtException {
+ validateErrMsg("enumleaf", ENUMNS, "10", ENUM, "enumList");
+ validateErrMsg("enumleaf", ENUMNS, "thousands", ENUM, "enumList");
+ validateErrMsg("enumleaf", ENUMNS, "enumeration", ENUM, "enumList");
+ }
+}
diff --git a/apps/yms/app/src/test/java/org/onosproject/yms/app/ydt/YdtInteger16Test.java b/apps/yms/app/src/test/java/org/onosproject/yms/app/ydt/YdtInteger16Test.java
new file mode 100644
index 0000000..172732b
--- /dev/null
+++ b/apps/yms/app/src/test/java/org/onosproject/yms/app/ydt/YdtInteger16Test.java
@@ -0,0 +1,392 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yms.app.ydt;
+
+import org.junit.Test;
+import org.onosproject.yms.app.ydt.exceptions.YdtException;
+
+import static org.onosproject.yms.app.ydt.YdtTestConstants.CAPSINT16;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.CAPSUINT16;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.INT16NS;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MAXIWR;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MAXUINT16;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MAXUIWR;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MIDIWR;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MIDUIWR;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MINIWR;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MINUIWR;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MINVALUE;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MRV;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.RUI;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.SINT16;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.SUINT16;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.TYPE;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.integer16Ydt;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateErrMsg;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateLeafContents;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateNodeContents;
+import static org.onosproject.yms.ydt.YdtContextOperationType.MERGE;
+
+public class YdtInteger16Test {
+
+ /*
+ Positive scenario
+
+ input at boundry for integer
+ i. min value
+ ii. max value
+
+ input at boundry for uinteger
+ i. min value
+ ii. max value
+
+ input with in range
+ if range is 10 to 100 for integer
+ i.1. input 11
+ i.2. min value 10
+ i.3. max value 100
+
+ if range is 10 to 100 for uinteger
+ i.1. input 11
+ i.2. min value 10
+ i.3. max value 100
+
+ input with multi interval range
+ if range is 10..40 | 50..100 for integer
+ i.1. input 11
+ i.2. input 10
+ i.3. input 40
+ i.4. input 50
+ i.5. input 55
+ i.6. input 100
+
+ if range is 10..40 | 50..100 for uinteger
+ i.1. input 11
+ i.2. input 10
+ i.3. input 40
+ i.4. input 50
+ i.5. input 55
+ i.6. input 100
+
+ if range is "min .. 2 | 10 | 20..max" for integer
+ i.1. input -32768
+ i.2. input 1
+ i.3. input 2
+ i.4. input 10
+ i.5. input 20
+ i.6. input 100
+ i.7. input 32767
+
+ if range is "min .. 2 | 10 | 20..max" for uInteger
+ i.1. input 0
+ i.2. input 1
+ i.3. input 2
+ i.4. input 10
+ i.5. input 20
+ i.6. input 100
+ i.7. input 65535
+ */
+
+ /**
+ * Creates and validates integer16 ydt covering different positive scenario.
+ */
+ @Test
+ public void positiveTest() throws YdtException {
+ YangRequestWorkBench ydtBuilder = integer16Ydt();
+ validateTree(ydtBuilder);
+ }
+
+ /**
+ * Validates the given built ydt.
+ */
+ private void validateTree(YangRequestWorkBench ydtBuilder) {
+
+ // assign root node to ydtNode for validating purpose.
+ YdtNode ydtNode = (YdtNode) ydtBuilder.getRootNode();
+ // Logical root node does not have operation type
+ validateNodeContents(ydtNode, TYPE, null);
+
+ ydtNode = ydtNode.getFirstChild();
+ validateNodeContents(ydtNode, "integer16", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "negInt", "-32768");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "posInt", "32767");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "minUInt", "0");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "maxUInt", "65535");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, MIDIWR, "11");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, MINIWR, "10");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, MAXIWR, "100");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, MIDUIWR, "11");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, MINUIWR, "10");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, MAXUIWR, "100");
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "integer", "11");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "integer", "10");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "integer", "40");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "integer", "50");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "integer", "55");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "integer", "100");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "UnInteger", "11");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "UnInteger", "10");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "UnInteger", "40");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "UnInteger", "50");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "UnInteger", "55");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "UnInteger", "100");
+
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "revInteger", "-32768");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "revInteger", "1");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+
+ validate1Tree(ydtNode);
+ }
+
+ /**
+ * Validates the given built ydt.
+ */
+ private void validate1Tree(YdtNode ydtNode) {
+
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "revInteger", "2");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "revInteger", "10");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "revInteger", "20");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "revInteger", "100");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "revInteger", "32767");
+
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, RUI, "0");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, RUI, "1");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, RUI, "2");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, RUI, "10");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, RUI, "20");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, RUI, "100");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, RUI, "65535");
+ }
+
+ /*
+ Negative scenario
+
+ wrong type input
+ i. input string instead of integer
+ ii. input string instead of uinteger
+
+ input out of range
+ i. input for int 8 range -32768 to 32767
+ i.1. input -32769
+ i.2. input 32768
+
+ ii. input for uint 8 range 0 to 65535
+ ii.1. input -32769
+ ii.2. input 65536
+
+ input out of range parameter
+ if range is 10 to 100 for int
+ i.1. input 9
+ i.2. input 101
+
+ if range is 10 to 100 for uInt
+ i.1. input 9
+ i.2. input 101
+
+ input with multi interval range
+ if range is 10..40 | 50..100 for integer
+ i.1. input 9
+ i.2. input 41
+ i.3. input 49
+ i.4. input 101
+
+ if range is 10..40 | 50..100 for uinteger
+ i.1. input 9
+ i.2. input 41
+ i.3. input 49
+ i.4. input 101
+
+ input with multi interval range
+ if range is min .. | 10 | 20..max for integer
+ i.1. input -32769
+ i.2. input 4
+ i.3. input 9
+ i.4. input 11
+ i.5. input 19
+ i.6. input 32768
+
+ if range is min .. 3 | 10 | 20..max for uinteger
+ i.1. input -32769
+ i.2. input 4
+ i.3. input 9
+ i.4. input 11
+ i.5. input 19
+ i.6. input 65536
+
+ */
+
+ /**
+ * Tests all the negative scenario's for integer8 data type.
+ */
+ @Test
+ public void negative1Test() throws YdtException {
+ validateErrMsg("posInt", INT16NS, "integer", SINT16, null);
+ validateErrMsg("posInt", INT16NS, "integer", SINT16, null);
+ validateErrMsg("posInt", INT16NS, "127.0", SINT16, null);
+ validateErrMsg("maxUInt", INT16NS, "integer", SUINT16, null);
+ validateErrMsg("maxUInt", INT16NS, "127.0", SUINT16, null);
+ validateErrMsg("negInt", INT16NS, "-32769", SINT16, null);
+ validateErrMsg("posInt", INT16NS, "32768", SINT16, null);
+ validateErrMsg("minUInt", INT16NS, "-32769", MINVALUE, null);
+ validateErrMsg("maxUInt", INT16NS, "65536", MAXUINT16, null);
+ validateErrMsg(MINIWR, INT16NS, "9", CAPSINT16, null);
+ validateErrMsg(MAXIWR, INT16NS, "101", CAPSINT16, null);
+ validateErrMsg(MINUIWR, INT16NS, "9", CAPSUINT16, null);
+ validateErrMsg(MAXUIWR, INT16NS, "101", CAPSUINT16, null);
+
+ validateErrMsg("integer", INT16NS, "9", CAPSINT16, MRV);
+ validateErrMsg("integer", INT16NS, "41", CAPSINT16, MRV);
+ validateErrMsg("integer", INT16NS, "49", CAPSINT16, MRV);
+ validateErrMsg("integer", INT16NS, "101", CAPSINT16, MRV);
+ validateErrMsg("UnInteger", INT16NS, "9", CAPSUINT16, MRV);
+ validateErrMsg("UnInteger", INT16NS, "41", CAPSUINT16, MRV);
+ validateErrMsg("UnInteger", INT16NS, "49", CAPSUINT16, MRV);
+ validateErrMsg("UnInteger", INT16NS, "101", CAPSUINT16, MRV);
+ validateErrMsg("UnInteger", INT16NS, "9", CAPSUINT16, MRV);
+ validateErrMsg("UnInteger", INT16NS, "41", CAPSUINT16, MRV);
+ validateErrMsg("UnInteger", INT16NS, "49", CAPSUINT16, MRV);
+ validateErrMsg("UnInteger", INT16NS, "101", CAPSUINT16, MRV);
+ validateErrMsg("UnInteger", INT16NS, "9", CAPSUINT16, MRV);
+ validateErrMsg("UnInteger", INT16NS, "41", CAPSUINT16, MRV);
+ validateErrMsg("UnInteger", INT16NS, "49", CAPSUINT16, MRV);
+ validateErrMsg("UnInteger", INT16NS, "101", CAPSUINT16, MRV);
+ validateErrMsg("revInteger", INT16NS, "-32769", SINT16, MRV);
+ validateErrMsg("revInteger", INT16NS, "19", CAPSINT16, MRV);
+ validateErrMsg("revInteger", INT16NS, "4", CAPSINT16, MRV);
+ validateErrMsg("revInteger", INT16NS, "32768", SINT16, MRV);
+ validateErrMsg("revInteger", INT16NS, "9", CAPSINT16, MRV);
+ validateErrMsg("revInteger", INT16NS, "11", CAPSINT16, MRV);
+ validateErrMsg(RUI, INT16NS, "-32769", MINVALUE, MRV);
+ validateErrMsg(RUI, INT16NS, "4", CAPSUINT16, MRV);
+ validateErrMsg(RUI, INT16NS, "9", CAPSUINT16, MRV);
+ validateErrMsg(RUI, INT16NS, "11", CAPSUINT16, MRV);
+ validateErrMsg(RUI, INT16NS, "19", CAPSUINT16, MRV);
+ validateErrMsg(RUI, INT16NS, "65536", MAXUINT16, MRV);
+ }
+}
diff --git a/apps/yms/app/src/test/java/org/onosproject/yms/app/ydt/YdtInteger32Test.java b/apps/yms/app/src/test/java/org/onosproject/yms/app/ydt/YdtInteger32Test.java
new file mode 100644
index 0000000..dd40ef5
--- /dev/null
+++ b/apps/yms/app/src/test/java/org/onosproject/yms/app/ydt/YdtInteger32Test.java
@@ -0,0 +1,390 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yms.app.ydt;
+
+import org.junit.Test;
+import org.onosproject.yms.app.ydt.exceptions.YdtException;
+
+import static org.onosproject.yms.app.ydt.YdtTestConstants.CAPSINT32;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.CAPSUINT32;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.INT32NS;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MAXIWR;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MAXUINT32;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MAXUIWR;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MIDIWR;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MIDUIWR;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MINIWR;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MINUIWR;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MINVALUE;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MRV;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.RUI;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.SINT32;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.SUINT32;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.TYPE;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.integer32Ydt;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateErrMsg;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateLeafContents;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateNodeContents;
+import static org.onosproject.yms.ydt.YdtContextOperationType.MERGE;
+
+public class YdtInteger32Test {
+
+ /*
+ Positive scenario
+
+ input at boundry for integer
+ i. min value
+ ii. max value
+
+ input at boundry for uinteger
+ i. min value
+ ii. max value
+
+ input with in range
+ if range is 10 to 100 for integer
+ i.1. input 11
+ i.2. min value 10
+ i.3. max value 100
+
+ if range is 10 to 100 for uinteger
+ i.1. input 11
+ i.2. min value 10
+ i.3. max value 100
+
+ input with multi interval range
+ if range is 10..40 | 50..100 for integer
+ i.1. input 11
+ i.2. input 10
+ i.3. input 40
+ i.4. input 50
+ i.5. input 55
+ i.6. input 100
+
+ if range is 10..40 | 50..100 for uinteger
+ i.1. input 11
+ i.2. input 10
+ i.3. input 40
+ i.4. input 50
+ i.5. input 55
+ i.6. input 100
+
+ if range is "min .. 2 | 10 | 20..max" for integer
+ i.1. input -2147483648
+ i.2. input 1
+ i.3. input 2
+ i.4. input 10
+ i.5. input 20
+ i.6. input 100
+ i.7. input 2147483647
+
+ if range is "min .. 2 | 10 | 20..max" for uInteger
+ i.1. input 0
+ i.2. input 1
+ i.3. input 2
+ i.4. input 10
+ i.5. input 20
+ i.6. input 100
+ i.7. input 4294967295
+ */
+
+ /**
+ * Creates and validates integer32 ydt covering different positive scenario.
+ */
+ @Test
+ public void positiveTest() throws YdtException {
+ YangRequestWorkBench ydtBuilder = integer32Ydt();
+ validateTree(ydtBuilder);
+ }
+
+ /**
+ * Validates the given built ydt.
+ */
+ private void validateTree(YangRequestWorkBench ydtBuilder) {
+
+ // assign root node to ydtNode for validating purpose.
+ YdtNode ydtNode = (YdtNode) ydtBuilder.getRootNode();
+ // Logical root node does not have operation type
+ validateNodeContents(ydtNode, TYPE, null);
+
+ ydtNode = ydtNode.getFirstChild();
+ validateNodeContents(ydtNode, "integer32", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "negInt", "-2147483648");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "posInt", "2147483647");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "minUInt", MINVALUE);
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "maxUInt", MAXUINT32);
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, MIDIWR, "11");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, MINIWR, "10");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, MAXIWR, "100");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, MIDUIWR, "11");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, MINUIWR, "10");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, MAXUIWR, "100");
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "integer", "11");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "integer", "10");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "integer", "40");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "integer", "50");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "integer", "55");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "integer", "100");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "UnInteger", "11");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "UnInteger", "10");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "UnInteger", "40");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "UnInteger", "50");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "UnInteger", "55");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "UnInteger", "100");
+
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "revInteger", "-2147483648");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "revInteger", "1");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "revInteger", "2");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "revInteger", "10");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "revInteger", "20");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+
+ validate1Tree(ydtNode);
+ }
+
+ /**
+ * Validates the given built ydt.
+ */
+ private void validate1Tree(YdtNode ydtNode) {
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "revInteger", "100");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "revInteger", "2147483647");
+
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, RUI, MINVALUE);
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, RUI, "1");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, RUI, "2");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, RUI, "10");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, RUI, "20");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, RUI, "100");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, RUI, MAXUINT32);
+ }
+
+ /*
+ Negative scenario
+
+ wrong type input
+ i. input string instead of integer
+ ii. input string instead of uinteger
+
+ input out of range
+ i. input for int 8 range -2147483648 to 2147483647
+ i.1. input -2147483649
+ i.2. input 2147483648
+
+ ii. input for uint 8 range 0 to 4294967295
+ ii.1. input -2147483649
+ ii.2. input 4294967296
+
+ input out of range parameter
+ if range is 10 to 100 for int
+ i.1. input 9
+ i.2. input 101
+
+ if range is 10 to 100 for uInt
+ i.1. input 9
+ i.2. input 101
+
+ input with multi interval range
+ if range is 10..40 | 50..100 for integer
+ i.1. input 9
+ i.2. input 41
+ i.3. input 49
+ i.4. input 101
+
+ if range is 10..40 | 50..100 for uinteger
+ i.1. input 9
+ i.2. input 41
+ i.3. input 49
+ i.4. input 101
+
+ input with multi interval range
+ if range is min .. | 10 | 20..max for integer
+ i.1. input -2147483649
+ i.2. input 4
+ i.3. input 9
+ i.4. input 11
+ i.5. input 19
+ i.6. input 256
+
+ if range is min .. 3 | 10 | 20..max for uinteger
+ i.1. input -2147483649
+ i.2. input 4
+ i.3. input 9
+ i.4. input 11
+ i.5. input 19
+ i.6. input 4294967296
+
+ */
+
+ /**
+ * Tests all the negative scenario's for integer8 data type.
+ */
+ @Test
+ public void negativeTest() throws YdtException {
+ validateErrMsg("posInt", INT32NS, "integer", SINT32, null);
+ validateErrMsg("posInt", INT32NS, "127.0", SINT32, null);
+ validateErrMsg("maxUInt", INT32NS, "integer", SUINT32, null);
+ validateErrMsg("maxUInt", INT32NS, "127.0", SUINT32, null);
+ validateErrMsg("negInt", INT32NS, "-2147483649", SINT32, null);
+ validateErrMsg("posInt", INT32NS, "2147483648", SINT32, null);
+ validateErrMsg("minUInt", INT32NS, "-2147483649", MINVALUE, null);
+ validateErrMsg("maxUInt", INT32NS, "4294967296", MAXUINT32, null);
+ validateErrMsg(MINIWR, INT32NS, "9", CAPSINT32, null);
+ validateErrMsg(MAXIWR, INT32NS, "101", CAPSINT32, null);
+ validateErrMsg(MINUIWR, INT32NS, "9", CAPSUINT32, null);
+ validateErrMsg(MAXUIWR, INT32NS, "101", CAPSUINT32, null);
+
+ validateErrMsg("integer", INT32NS, "9", CAPSINT32, MRV);
+ validateErrMsg("integer", INT32NS, "41", CAPSINT32, MRV);
+ validateErrMsg("integer", INT32NS, "49", CAPSINT32, MRV);
+ validateErrMsg("integer", INT32NS, "101", CAPSINT32, MRV);
+ validateErrMsg("UnInteger", INT32NS, "9", CAPSUINT32, MRV);
+ validateErrMsg("UnInteger", INT32NS, "41", CAPSUINT32, MRV);
+ validateErrMsg("UnInteger", INT32NS, "49", CAPSUINT32, MRV);
+ validateErrMsg("UnInteger", INT32NS, "101", CAPSUINT32, MRV);
+ validateErrMsg("UnInteger", INT32NS, "9", CAPSUINT32, MRV);
+ validateErrMsg("UnInteger", INT32NS, "41", CAPSUINT32, MRV);
+ validateErrMsg("UnInteger", INT32NS, "49", CAPSUINT32, MRV);
+ validateErrMsg("UnInteger", INT32NS, "101", CAPSUINT32, MRV);
+ validateErrMsg("UnInteger", INT32NS, "9", CAPSUINT32, MRV);
+ validateErrMsg("UnInteger", INT32NS, "41", CAPSUINT32, MRV);
+ validateErrMsg("UnInteger", INT32NS, "49", CAPSUINT32, MRV);
+ validateErrMsg("UnInteger", INT32NS, "101", CAPSUINT32, MRV);
+ validateErrMsg("revInteger", INT32NS, "-2147483649", SINT32, MRV);
+ validateErrMsg("revInteger", INT32NS, "4", CAPSINT32, MRV);
+ validateErrMsg("revInteger", INT32NS, "9", CAPSINT32, MRV);
+ validateErrMsg("revInteger", INT32NS, "11", CAPSINT32, MRV);
+ validateErrMsg("revInteger", INT32NS, "19", CAPSINT32, MRV);
+ validateErrMsg("revInteger", INT32NS, "2147483648", SINT32, MRV);
+ validateErrMsg(RUI, INT32NS, "-2147483649", MINVALUE, MRV);
+ validateErrMsg(RUI, INT32NS, "4", CAPSUINT32, MRV);
+ validateErrMsg(RUI, INT32NS, "9", CAPSUINT32, MRV);
+ validateErrMsg(RUI, INT32NS, "11", CAPSUINT32, MRV);
+ validateErrMsg(RUI, INT32NS, "19", CAPSUINT32, MRV);
+ validateErrMsg(RUI, INT32NS, "4294967296", MAXUINT32, MRV);
+ }
+}
diff --git a/apps/yms/app/src/test/java/org/onosproject/yms/app/ydt/YdtInteger64Test.java b/apps/yms/app/src/test/java/org/onosproject/yms/app/ydt/YdtInteger64Test.java
new file mode 100644
index 0000000..136381d
--- /dev/null
+++ b/apps/yms/app/src/test/java/org/onosproject/yms/app/ydt/YdtInteger64Test.java
@@ -0,0 +1,397 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yms.app.ydt;
+
+import org.junit.Test;
+import org.onosproject.yms.app.ydt.exceptions.YdtException;
+
+import static org.onosproject.yms.app.ydt.YdtTestConstants.CAPSINT64;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.CAPSUINT64;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.I;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.INT64NS;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.J;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.K;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.L;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.M;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MAXIWR;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MAXUINT64;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MAXUIWR;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MIDIWR;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MIDUIWR;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MINIWR;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MINUIWR;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MINVALUE;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MRV;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.RUI;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.SMALLINT64;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.SMALLUINT64;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.TYPE;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.integer64Ydt;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateErrMsg;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateLeafContents;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateNodeContents;
+import static org.onosproject.yms.ydt.YdtContextOperationType.MERGE;
+
+public class YdtInteger64Test {
+
+ /*
+
+ Positive scenario
+
+ input at boundry for integer
+ i. min value
+ ii. max value
+
+ input at boundry for uinteger
+ i. min value
+ ii. max value
+
+ input with in range
+ if range is 10 to 100 for integer
+ i.1. input 11
+ i.2. min value 10
+ i.3. max value 100
+
+ if range is 10 to 100 for uinteger
+ i.1. input 11
+ i.2. min value 10
+ i.3. max value 100
+
+ input with multi interval range
+ if range is 10..40 | 50..100 for integer
+ i.1. input 11
+ i.2. input 10
+ i.3. input 40
+ i.4. input 50
+ i.5. input 55
+ i.6. input 100
+
+ if range is 10..40 | 50..100 for uinteger
+ i.1. input 11
+ i.2. input 10
+ i.3. input 40
+ i.4. input 50
+ i.5. input 55
+ i.6. input 100
+
+ if range is "min .. 2 | 10 | 20..max" for integer
+ i.1. input -9223372036854775808
+ i.2. input 1
+ i.3. input 2
+ i.4. input 10
+ i.5. input 20
+ i.6. input 100
+ i.7. input 9223372036854775807
+
+ if range is "min .. 2 | 10 | 20..max" for uInteger
+ i.1. input 0
+ i.2. input 1
+ i.3. input 2
+ i.4. input 10
+ i.5. input 20
+ i.6. input 100
+ i.7. input 18446744073709551615
+ */
+
+ /**
+ * Creates and validates integer64 ydt covering different positive scenario.
+ */
+ @Test
+ public void positiveTest() throws YdtException {
+ YangRequestWorkBench ydtBuilder = integer64Ydt();
+ validateTree(ydtBuilder);
+ }
+
+ /**
+ * Validates the given built ydt.
+ */
+ private void validateTree(YangRequestWorkBench ydtBuilder) {
+
+ // assign root node to ydtNode for validating purpose.
+ YdtNode ydtNode = (YdtNode) ydtBuilder.getRootNode();
+ // Logical root node does not have operation type
+ validateNodeContents(ydtNode, TYPE, null);
+
+ ydtNode = ydtNode.getFirstChild();
+ validateNodeContents(ydtNode, "integer64", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "negInt", K);
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "posInt", J);
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "minUInt", MINVALUE);
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "maxUInt", MAXUINT64);
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, MIDIWR, "11");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, MINIWR, "10");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, MAXIWR, "100");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, MIDUIWR, "11");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, MINUIWR, "10");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, MAXUIWR, "100");
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "integer", "11");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "integer", "10");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "integer", "40");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "integer", "50");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "integer", "55");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "integer", "100");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "UnInteger", "11");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "UnInteger", "10");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "UnInteger", "40");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "UnInteger", "50");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "UnInteger", "55");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "UnInteger", "100");
+
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "revInteger", K);
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "revInteger", "1");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "revInteger", "2");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "revInteger", "10");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+
+ validate1Tree(ydtNode);
+ }
+
+ /**
+ * Validates the given built ydt.
+ */
+ private void validate1Tree(YdtNode ydtNode) {
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "revInteger", "20");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "revInteger", "100");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "revInteger", J);
+
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, RUI, MINVALUE);
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, RUI, "1");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, RUI, "2");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, RUI, "10");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, RUI, "20");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, RUI, "100");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, RUI, MAXUINT64);
+ }
+
+ /*
+ Negative scenario
+
+ wrong type input
+ i. input string instead of integer
+ ii. input string instead of uinteger
+
+ input out of range
+ i. input for int 8 range -9223372036854775808 to 9223372036854775807
+ i.1. input -9223372036854775809
+ i.2. input 9223372036854775808
+
+ ii. input for uint 8 range 0 to 18446744073709551615
+ ii.1. input -9223372036854775809
+ ii.2. input 18446744073709551616
+
+ input out of range parameter
+ if range is 10 to 100 for int
+ i.1. input 9
+ i.2. input 101
+
+ if range is 10 to 100 for uInt
+ i.1. input 9
+ i.2. input 101
+
+ input with multi interval range
+ if range is 10..40 | 50..100 for integer
+ i.1. input 9
+ i.2. input 41
+ i.3. input 49
+ i.4. input 101
+
+ if range is 10..40 | 50..100 for uinteger
+ i.1. input 9
+ i.2. input 41
+ i.3. input 49
+ i.4. input 101
+
+ input with multi interval range
+ if range is min .. | 10 | 20..max for integer
+ i.1. input -9223372036854775809
+ i.2. input 4
+ i.3. input 9
+ i.4. input 11
+ i.5. input 19
+ i.6. input 9223372036854775808
+
+ if range is min .. 3 | 10 | 20..max for uinteger
+ i.1. input -9223372036854775809
+ i.2. input 4
+ i.3. input 9
+ i.4. input 11
+ i.5. input 19
+ i.6. input 18446744073709551616
+
+ */
+
+ /**
+ * Tests all the negative scenario's for integer8 data type.
+ */
+ @Test
+ public void negativeTest() throws YdtException {
+ validateErrMsg("posInt", INT64NS, "integer", SMALLINT64, null);
+ validateErrMsg("posInt", INT64NS, "integer", SMALLINT64, null);
+ validateErrMsg("posInt", INT64NS, "127.0", SMALLINT64, null);
+ validateErrMsg("maxUInt", INT64NS, "integer", SMALLUINT64, null);
+ validateErrMsg("maxUInt", INT64NS, "127.0", SMALLUINT64, null);
+ validateErrMsg("negInt", INT64NS, L, SMALLINT64, null);
+ validateErrMsg("posInt", INT64NS, I, SMALLINT64, null);
+ validateErrMsg("minUInt", INT64NS, L, MINVALUE, null);
+ validateErrMsg("maxUInt", INT64NS, M, MAXUINT64, null);
+ validateErrMsg(MINIWR, INT64NS, "9", CAPSINT64, null);
+ validateErrMsg(MAXIWR, INT64NS, "101", CAPSINT64, null);
+ validateErrMsg(MINUIWR, INT64NS, "9", CAPSUINT64, null);
+ validateErrMsg(MAXUIWR, INT64NS, "101", CAPSUINT64, null);
+
+ validateErrMsg("integer", INT64NS, "9", CAPSINT64, MRV);
+ validateErrMsg("integer", INT64NS, "41", CAPSINT64, MRV);
+ validateErrMsg("integer", INT64NS, "49", CAPSINT64, MRV);
+ validateErrMsg("integer", INT64NS, "101", CAPSINT64, MRV);
+ validateErrMsg("UnInteger", INT64NS, "9", CAPSUINT64, MRV);
+ validateErrMsg("UnInteger", INT64NS, "41", CAPSUINT64, MRV);
+ validateErrMsg("UnInteger", INT64NS, "49", CAPSUINT64, MRV);
+ validateErrMsg("UnInteger", INT64NS, "101", CAPSUINT64, MRV);
+ validateErrMsg("UnInteger", INT64NS, "9", CAPSUINT64, MRV);
+ validateErrMsg("UnInteger", INT64NS, "41", CAPSUINT64, MRV);
+ validateErrMsg("UnInteger", INT64NS, "49", CAPSUINT64, MRV);
+ validateErrMsg("UnInteger", INT64NS, "101", CAPSUINT64, MRV);
+ validateErrMsg("UnInteger", INT64NS, "9", CAPSUINT64, MRV);
+ validateErrMsg("UnInteger", INT64NS, "41", CAPSUINT64, MRV);
+ validateErrMsg("UnInteger", INT64NS, "49", CAPSUINT64, MRV);
+ validateErrMsg("UnInteger", INT64NS, "101", CAPSUINT64, MRV);
+ validateErrMsg("revInteger", INT64NS, L, SMALLINT64, MRV);
+ validateErrMsg("revInteger", INT64NS, "11", CAPSINT64, MRV);
+ validateErrMsg("revInteger", INT64NS, "4", CAPSINT64, MRV);
+ validateErrMsg("revInteger", INT64NS, "9", CAPSINT64, MRV);
+ validateErrMsg("revInteger", INT64NS, "19", CAPSINT64, MRV);
+ validateErrMsg("revInteger", INT64NS, I, SMALLINT64, MRV);
+ validateErrMsg(RUI, INT64NS, L, MINVALUE, MRV);
+ validateErrMsg(RUI, INT64NS, "4", CAPSUINT64, MRV);
+ validateErrMsg(RUI, INT64NS, "9", CAPSUINT64, MRV);
+ validateErrMsg(RUI, INT64NS, "11", CAPSUINT64, MRV);
+ validateErrMsg(RUI, INT64NS, "19", CAPSUINT64, MRV);
+ validateErrMsg(RUI, INT64NS, M, MAXUINT64, MRV);
+ }
+}
diff --git a/apps/yms/app/src/test/java/org/onosproject/yms/app/ydt/YdtInteger8Test.java b/apps/yms/app/src/test/java/org/onosproject/yms/app/ydt/YdtInteger8Test.java
new file mode 100644
index 0000000..0658f26
--- /dev/null
+++ b/apps/yms/app/src/test/java/org/onosproject/yms/app/ydt/YdtInteger8Test.java
@@ -0,0 +1,389 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yms.app.ydt;
+
+import org.junit.Test;
+import org.onosproject.yms.app.ydt.exceptions.YdtException;
+
+import static org.onosproject.yms.app.ydt.YdtTestConstants.CAPSINT8;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.CAPSUINT8;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.INT8NS;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MAXIWR;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MAXUINT8;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MAXUIWR;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MIDIWR;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MIDUIWR;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MINIWR;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MINUIWR;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MINVALUE;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MRV;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.RUI;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.SMALLINT8;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.SMALLUINT8;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.TYPE;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.integer8Ydt;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateErrMsg;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateLeafContents;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateNodeContents;
+import static org.onosproject.yms.ydt.YdtContextOperationType.MERGE;
+
+public class YdtInteger8Test {
+
+ /*
+ Positive scenario
+
+ input at boundry for integer
+ i. min value
+ ii. max value
+
+ input at boundry for uinteger
+ i. min value
+ ii. max value
+
+ input with in range
+ if range is 10 to 100 for integer
+ i.1. input 11
+ i.2. min value 10
+ i.3. max value 100
+
+ if range is 10 to 100 for uinteger
+ i.1. input 11
+ i.2. min value 10
+ i.3. max value 100
+
+ input with multi interval range
+ if range is 10..40 | 50..100 for integer
+ i.1. input 11
+ i.2. input 10
+ i.3. input 40
+ i.4. input 50
+ i.5. input 55
+ i.6. input 100
+
+ if range is 10..40 | 50..100 for uinteger
+ i.1. input 11
+ i.2. input 10
+ i.3. input 40
+ i.4. input 50
+ i.5. input 55
+ i.6. input 100
+
+ if range is "min .. 2 | 10 | 20..max" for integer
+ i.1. input -128
+ i.2. input 1
+ i.3. input 2
+ i.4. input 10
+ i.5. input 20
+ i.6. input 100
+ i.7. input 127
+
+ if range is "min .. 2 | 10 | 20..max" for uInteger
+ i.1. input 0
+ i.2. input 1
+ i.3. input 2
+ i.4. input 10
+ i.5. input 20
+ i.6. input 100
+ i.7. input 255
+ */
+
+ /**
+ * Creates and validates integer8 ydt covering different positive scenario.
+ */
+ @Test
+ public void positiveTest() throws YdtException {
+ YangRequestWorkBench ydtBuilder = integer8Ydt();
+ validateTree(ydtBuilder);
+ }
+
+ /**
+ * Validates the given built ydt.
+ */
+ private void validateTree(YangRequestWorkBench ydtBuilder) {
+
+ // assign root node to ydtNode for validating purpose.
+ YdtNode ydtNode = (YdtNode) ydtBuilder.getRootNode();
+ // Logical root node does not have operation type
+ validateNodeContents(ydtNode, TYPE, null);
+
+ ydtNode = ydtNode.getFirstChild();
+ validateNodeContents(ydtNode, "integer8", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "negInt", "-128");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "posInt", "127");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "minUInt", MINVALUE);
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "maxUInt", MAXUINT8);
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, MIDIWR, "11");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, MINIWR, "10");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, MAXIWR, "100");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, MIDUIWR, "11");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, MINUIWR, "10");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, MAXUIWR, "100");
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "integer", "11");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "integer", "10");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "integer", "40");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "integer", "50");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "integer", "55");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "integer", "100");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "UnInteger", "11");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "UnInteger", "10");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "UnInteger", "40");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "UnInteger", "50");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "UnInteger", "55");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "UnInteger", "100");
+
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "revInteger", "-128");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "revInteger", "1");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "revInteger", "2");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "revInteger", "10");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ validate1Tree(ydtNode);
+ }
+
+ /**
+ * Validates the given built ydt.
+ */
+ private void validate1Tree(YdtNode ydtNode) {
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "revInteger", "20");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "revInteger", "100");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "revInteger", "127");
+
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, RUI, MINVALUE);
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, RUI, "1");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, RUI, "2");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, RUI, "10");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, RUI, "20");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, RUI, "100");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, RUI, MAXUINT8);
+ }
+
+ /*
+ Negative scenario
+
+ wrong type input
+ i. input string instead of integer
+ ii. input string instead of uinteger
+
+ input out of range
+ i. input for int 8 range -128 to 127
+ i.1. input -129
+ i.2. input 128
+
+ ii. input for uint 8 range 0 to 255
+ ii.1. input -128
+ ii.2. input 256
+
+ input out of range parameter
+ if range is 10 to 100 for int
+ i.1. input 9
+ i.2. input 101
+
+ if range is 10 to 100 for uInt
+ i.1. input 9
+ i.2. input 101
+
+ input with multi interval range
+ if range is 10..40 | 50..100 for integer
+ i.1. input 9
+ i.2. input 41
+ i.3. input 49
+ i.4. input 101
+
+ if range is 10..40 | 50..100 for uinteger
+ i.1. input 9
+ i.2. input 41
+ i.3. input 49
+ i.4. input 101
+
+ input with multi interval range
+ if range is min .. | 10 | 20..max for integer
+ i.1. input -129
+ i.2. input 4
+ i.3. input 9
+ i.4. input 11
+ i.5. input 19
+ i.6. input 128
+
+ if range is min .. 3 | 10 | 20..max for uinteger
+ i.1. input -129
+ i.2. input 4
+ i.3. input 9
+ i.4. input 11
+ i.5. input 19
+ i.6. input 256
+
+ */
+
+ /**
+ * Tests all the negative scenario's for integer8 data type.
+ */
+ @Test
+ public void negativeTest() throws YdtException {
+ validateErrMsg("posInt", INT8NS, "integer", SMALLINT8, null);
+ validateErrMsg("posInt", INT8NS, "127.0", SMALLINT8, null);
+ validateErrMsg("maxUInt", INT8NS, "integer", SMALLUINT8, null);
+ validateErrMsg("maxUInt", INT8NS, "127.0", SMALLUINT8, null);
+ validateErrMsg("negInt", INT8NS, "-129", SMALLINT8, null);
+ validateErrMsg("posInt", INT8NS, "128", SMALLINT8, null);
+ validateErrMsg("minUInt", INT8NS, "-128", MINVALUE, null);
+ validateErrMsg("maxUInt", INT8NS, "256", MAXUINT8, null);
+ validateErrMsg(MINIWR, INT8NS, "9", CAPSINT8, null);
+ validateErrMsg(MAXIWR, INT8NS, "101", CAPSINT8, null);
+ validateErrMsg(MINUIWR, INT8NS, "9", CAPSUINT8, null);
+ validateErrMsg(MAXUIWR, INT8NS, "101", CAPSUINT8, null);
+
+ validateErrMsg("integer", INT8NS, "9", CAPSINT8, MRV);
+ validateErrMsg("integer", INT8NS, "41", CAPSINT8, MRV);
+ validateErrMsg("integer", INT8NS, "49", CAPSINT8, MRV);
+ validateErrMsg("integer", INT8NS, "101", CAPSINT8, MRV);
+ validateErrMsg("UnInteger", INT8NS, "9", CAPSUINT8, MRV);
+ validateErrMsg("UnInteger", INT8NS, "41", CAPSUINT8, MRV);
+ validateErrMsg("UnInteger", INT8NS, "49", CAPSUINT8, MRV);
+ validateErrMsg("UnInteger", INT8NS, "101", CAPSUINT8, MRV);
+ validateErrMsg("UnInteger", INT8NS, "9", CAPSUINT8, MRV);
+ validateErrMsg("UnInteger", INT8NS, "41", CAPSUINT8, MRV);
+ validateErrMsg("UnInteger", INT8NS, "49", CAPSUINT8, MRV);
+ validateErrMsg("UnInteger", INT8NS, "101", CAPSUINT8, MRV);
+ validateErrMsg("UnInteger", INT8NS, "9", CAPSUINT8, MRV);
+ validateErrMsg("UnInteger", INT8NS, "41", CAPSUINT8, MRV);
+ validateErrMsg("UnInteger", INT8NS, "49", CAPSUINT8, MRV);
+ validateErrMsg("UnInteger", INT8NS, "101", CAPSUINT8, MRV);
+ validateErrMsg("revInteger", INT8NS, "-129", SMALLINT8, MRV);
+ validateErrMsg("revInteger", INT8NS, "128", SMALLINT8, MRV);
+ validateErrMsg("revInteger", INT8NS, "4", CAPSINT8, MRV);
+ validateErrMsg("revInteger", INT8NS, "11", CAPSINT8, MRV);
+ validateErrMsg("revInteger", INT8NS, "9", CAPSINT8, MRV);
+ validateErrMsg("revInteger", INT8NS, "19", CAPSINT8, MRV);
+ validateErrMsg(RUI, INT8NS, "-129", MINVALUE, MRV);
+ validateErrMsg(RUI, INT8NS, "4", CAPSUINT8, MRV);
+ validateErrMsg(RUI, INT8NS, "9", CAPSUINT8, MRV);
+ validateErrMsg(RUI, INT8NS, "11", CAPSUINT8, MRV);
+ validateErrMsg(RUI, INT8NS, "19", CAPSUINT8, MRV);
+ validateErrMsg(RUI, INT8NS, "256", MAXUINT8, MRV);
+ }
+}
diff --git a/apps/yms/app/src/test/java/org/onosproject/yms/app/ydt/YdtTestConstants.java b/apps/yms/app/src/test/java/org/onosproject/yms/app/ydt/YdtTestConstants.java
new file mode 100644
index 0000000..daa5ce3
--- /dev/null
+++ b/apps/yms/app/src/test/java/org/onosproject/yms/app/ydt/YdtTestConstants.java
@@ -0,0 +1,138 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yms.app.ydt;
+
+/**
+ * Represents common constant utility for YANG data tree UT framework.
+ */
+final class YdtTestConstants {
+
+ // No instantiation.
+ private YdtTestConstants() {
+ }
+
+ public static final String BACKSLASH = "\"";
+ public static final String PERIOD = ".";
+ public static final String A = "92233720368547758.07";
+ public static final String B = "92233720368547757";
+ public static final String C = "-92233720368547758.08";
+ public static final String D = "92233720368547757";
+ public static final String E = "9.223372036854775807";
+ public static final String F = "-922337203685477580.8";
+ public static final String G = "922337203685477580.7";
+ public static final String H = "-9.223372036854775808";
+ public static final String I = "9223372036854775808";
+ public static final String J = "9223372036854775807";
+ public static final String K = "-9223372036854775808";
+ public static final String L = "-9223372036854775809";
+ public static final String M = "18446744073709551616";
+ public static final String NWF = "negIntWithMaxFraction";
+ public static final String PWF = "posIntWithMaxFraction";
+ public static final String NIWMF = "negIntWithMinFraction";
+ public static final String PIWMF = "posIntWithMinFraction";
+ public static final String CAPSUINT8 = "UINT8";
+ public static final String CAPSINT8 = "INT8";
+ public static final String SMALLUINT8 = "uint8.";
+ public static final String SMALLINT8 = "int8.";
+ public static final String MAXUINT8 = "255";
+ public static final String CAPSUINT16 = "UINT16";
+ public static final String CAPSINT16 = "INT16";
+ public static final String SUINT16 = "uint16.";
+ public static final String SINT16 = "int16.";
+ public static final String MAXUINT16 = "65535";
+ public static final String CAPSUINT32 = "UINT32";
+ public static final String CAPSINT32 = "INT32";
+ public static final String SUINT32 = "uint32.";
+ public static final String SINT32 = "int32.";
+ public static final String MAXUINT32 = "4294967295";
+ public static final String CAPSUINT64 = "UINT64";
+ public static final String CAPSINT64 = "INT64";
+ public static final String SMALLUINT64 = "uint64.";
+ public static final String SMALLINT64 = "int64.";
+ public static final String MAXUINT64 = "18446744073709551615";
+ public static final String MINVALUE = "0";
+ public static final String MINIWR = "minIntWithRange";
+ public static final String MIDIWR = "midIntWithRange";
+ public static final String MAXIWR = "maxIntWithRange";
+ public static final String MINUIWR = "minUIntWithRange";
+ public static final String MIDUIWR = "midUIntWithRange";
+ public static final String MAXUIWR = "maxUIntWithRange";
+ public static final String MRV = "multiRangeValidation";
+ public static final String RUI = "revUnInteger";
+ public static final String TYPE = "builtInType";
+ public static final String INT8NS = "ydt.integer8";
+ public static final String BIT = "BITS";
+ public static final String BOOL = "BOOLEAN";
+ public static final String EMPTY = "";
+ public static final String ENUM = "ENUMERATION";
+ public static final String LIST = "List";
+ public static final String LWC = "listwithcontainer";
+ public static final String INV = "invalidinterval";
+ public static final String INT16NS = "ydt.integer16";
+ public static final String INT32NS = "ydt.integer32";
+ public static final String INT64NS = "ydt.integer64";
+ public static final String BITNS = "ydt.bit";
+ public static final String BOOLNS = "ydt.boolean";
+ public static final String EMPTYNS = "ydt.emptydata";
+ public static final String ENUMNS = "ydt.enumtest";
+ public static final String LISTNS = "ydt.rootlist";
+ public static final String A1 = "ydt.augment-topology1";
+ public static final String A2 = "ydt.augment-topology2";
+ public static final String A3 = "ydt.augment-topology3";
+ public static final String A4 = "ydt.augment-topology4";
+ public static final String A5 = "ydt.augment-topology5";
+ public static final String A6 = "ydt.augment-topology6";
+ public static final String A2L = "augment2leafList";
+ public static final String A5L = "augment5leafList";
+ public static final String A6L = "augment6leafList";
+ public static final String MATERIALNS = "ydt.material-supervisor";
+ public static final String PURCHASNS = "ydt.purchasing-supervisor";
+ public static final String WAREHNS = "ydt.warehouse-supervisor";
+ public static final String TRADNS = "ydt.trading-supervisor";
+ public static final String EMPNS = "ydt.employee-id";
+ public static final String COUSTOMNS = "ydt.customs-supervisor";
+ public static final String MERCHNS = "ydt.Merchandiser-supervisor";
+ public static final String STP = "supporting-termination-point";
+ public static final String SLINK = "supporting-link";
+ public static final String AUG1 = "/nd:networks/nd:network";
+ public static final String AUG2 = "/nd:networks/nd:network/nd:node";
+ public static final String AUG3 = "/nd:networks/nd:network/topo:link";
+ public static final String AUG4 = "/nd:networks/nd:network/nd:node/" +
+ "topo:t-point/supporting-termination-point";
+ public static final String AUG5 = "/nd:networks/nd:network/topo:link/" +
+ "aug2:augment2";
+ public static final String AUG6 = "/nd:networks/nd:network/nd:node/" +
+ "topo:t-point/supporting-termination-point/aug2:augment2";
+ public static final String AUG7 = "/nd:networks/nd:network/topo:link/" +
+ "aug2:augment2/aug3:augment3";
+ public static final String AUG8 = "/nd:networks/nd:network/topo:link/" +
+ "aug2:augment2/aug3:augment3/aug5:augment5";
+ public static final String AUG9 = "/nd:networks/nd:network/topo:link/" +
+ "aug2:augment2/aug5:augment5";
+ public static final String NETNS = "ydt.augmentNetwork";
+ public static final String IETFNS =
+ "urn:ietf:params:xml:ns:yang:ietf-network";
+ public static final String IETF = "yms-ietf-network";
+ public static final String TOPONS =
+ "urn:ietf:params:xml:ns:yang:ietf-network-topology";
+ public static final String E_LEAF = "Exception has not occurred for " +
+ "invalid leaf value with name ";
+ public static final String E_LIST = "Exception has not occurred for " +
+ "invalid node addition with the name ";
+ public static final String E_TOPARENT = "Exception has not occurred " +
+ "in traverse back to parent for multi instance node.";
+}
diff --git a/apps/yms/app/src/test/java/org/onosproject/yms/app/ydt/YdtTestUtils.java b/apps/yms/app/src/test/java/org/onosproject/yms/app/ydt/YdtTestUtils.java
new file mode 100644
index 0000000..f375c1a
--- /dev/null
+++ b/apps/yms/app/src/test/java/org/onosproject/yms/app/ydt/YdtTestUtils.java
@@ -0,0 +1,1792 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.yms.app.ydt;
+
+import org.junit.Rule;
+import org.junit.rules.ExpectedException;
+import org.onosproject.yms.app.ydt.exceptions.YdtException;
+import org.onosproject.yms.app.ysr.TestYangSchemaNodeProvider;
+import org.onosproject.yms.app.ysr.YangSchemaRegistry;
+import org.onosproject.yms.ydt.YdtContext;
+import org.onosproject.yms.ydt.YdtContextOperationType;
+import org.onosproject.yms.ydt.YdtListener;
+import org.onosproject.yms.ydt.YdtType;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.A1;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.A2;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.A2L;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.A3;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.A4;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.A5;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.A5L;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.A6;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.A6L;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.BACKSLASH;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.BIT;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.BITNS;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.BOOL;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.BOOLNS;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.CAPSINT16;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.CAPSINT32;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.CAPSINT64;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.CAPSINT8;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.CAPSUINT16;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.CAPSUINT32;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.CAPSUINT64;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.CAPSUINT8;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.COUSTOMNS;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.EMPNS;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.EMPTY;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.EMPTYNS;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.ENUM;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.ENUMNS;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.E_LEAF;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.IETF;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.IETFNS;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.INT16NS;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.INT32NS;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.INT64NS;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.INT8NS;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.INV;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.LIST;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.LISTNS;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.LWC;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MATERIALNS;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MAXUINT16;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MAXUINT32;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MAXUINT64;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MAXUINT8;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MERCHNS;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MINVALUE;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MRV;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.NIWMF;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.NWF;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.PERIOD;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.PIWMF;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.PURCHASNS;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.PWF;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.SINT16;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.SINT32;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.SLINK;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.SMALLINT64;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.SMALLINT8;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.SMALLUINT64;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.SMALLUINT8;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.STP;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.SUINT16;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.SUINT32;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.TOPONS;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.TRADNS;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.TYPE;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.WAREHNS;
+import static org.onosproject.yms.ydt.YdtContextOperationType.DELETE;
+import static org.onosproject.yms.ydt.YdtContextOperationType.MERGE;
+
+public class YdtTestUtils implements YdtListener {
+
+ private static List<String> kValList = new ArrayList<>();
+
+ @Rule
+ public ExpectedException thrown = ExpectedException.none();
+
+ private static YangSchemaRegistry schemaRegistry;
+
+ private static TestYangSchemaNodeProvider schemaProvider =
+ new TestYangSchemaNodeProvider();
+
+ // Logger list is used for walker testing.
+ private static final List<String> LOGGER = new ArrayList<>();
+
+ /**
+ * Returns the LOGGER with log for testing the YDT walker.
+ *
+ * @return list of logs
+ */
+ public static List<String> getLogger() {
+ return LOGGER;
+ }
+
+ /**
+ * Clear the LOGGER array.
+ */
+ public static void resetLogger() {
+ LOGGER.clear();
+ }
+
+ @Override
+ public void enterYdtNode(YdtContext ydtContext) {
+ LOGGER.add("Entry Node is " + ydtContext.getName() + PERIOD);
+ }
+
+ @Override
+ public void exitYdtNode(YdtContext ydtContext) {
+ LOGGER.add("Exit Node is " + ydtContext.getName() + PERIOD);
+ }
+
+ /**
+ * Returns schema registry of YDT.
+ *
+ * @return schema registry
+ */
+ public static YangSchemaRegistry getSchemaRegistry() {
+ return schemaRegistry;
+ }
+
+ /**
+ * Sets the ydt schema registry.
+ *
+ * @param registry schema registry
+ */
+ public static void setSchemaRegistry(YangSchemaRegistry registry) {
+ schemaRegistry = registry;
+ }
+
+ /**
+ * Returns the ydt builder for food module.
+ *
+ * @return ydt builder
+ */
+ public static YangRequestWorkBench foodArenaYdt() {
+
+ YangRequestWorkBench ydtBuilder;
+ ydtBuilder = getYdtBuilder("foodarena", "food", "ydt.food", MERGE);
+ ydtBuilder.addChild("food", "ydt.food");
+// ydtBuilder.addChild("snack", null, "ydt.food");
+// ydtBuilder.addChild("latenight", null, "ydt.food");
+ ydtBuilder.addLeaf("chocolate", "ydt.food", "dark");
+
+ return ydtBuilder;
+ }
+
+ /**
+ * Returns the ydt builder for yms-ietf-network module.
+ *
+ * @return ydt builder
+ */
+ public static YangRequestWorkBench ietfNetwork1Ydt() {
+
+ YangRequestWorkBench ydtBuilder;
+ ydtBuilder = getYdtBuilder(IETF, IETF, IETFNS, MERGE);
+ // Adding container
+ ydtBuilder.addChild("networks", null);
+ // Adding list inside container
+ ydtBuilder.addChild("network", null);
+ // Adding key element network Id
+ ydtBuilder.addLeaf("network-id", null, "network1");
+ ydtBuilder.traverseToParent();
+
+ // Adding list inside list
+ ydtBuilder.addChild("supporting-network", null);
+ // Adding key element network-ref
+ ydtBuilder.addLeaf("network-ref", null, "network2");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ // Adding list inside list
+ ydtBuilder.addChild("node", null);
+ // Adding key element node-id
+ ydtBuilder.addLeaf("node-id", null, "node1");
+ ydtBuilder.traverseToParent();
+
+ // Adding list inside list
+ ydtBuilder.addChild("supporting-node", null);
+ // Adding key element network-ref
+ ydtBuilder.addLeaf("network-ref", null, "network3");
+ ydtBuilder.traverseToParent();
+
+ // Adding key element node-ref
+ ydtBuilder.addLeaf("node-ref", null, "network4");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ // Adding container
+ ydtBuilder.addChild("networks-state", null);
+ // Adding list inside container
+ ydtBuilder.addChild("network", null);
+ // Adding key element network-ref
+ ydtBuilder.addLeaf("network-ref", null, "network5");
+ ydtBuilder.traverseToParent();
+ // Adding leaf server-provided
+ ydtBuilder.addLeaf("server-provided", null, "true");
+
+ return ydtBuilder;
+ }
+
+ /**
+ * Returns the ydt builder for yms-ietf-network-topology module.
+ *
+ * @return ydt builder
+ */
+ public static YangRequestWorkBench ietfNetworkTopologyYdt() {
+
+ YangRequestWorkBench ydtBuilder;
+ ydtBuilder = getYdtBuilder(IETF, IETF, IETFNS, MERGE);
+ // Adding container
+ ydtBuilder.addChild("networks", IETFNS, MERGE);
+ // Adding list inside container
+ ydtBuilder.addChild("network", IETFNS, MERGE);
+
+ // Adding key element network Id
+ ydtBuilder.addLeaf("network-id", null, "network1");
+ ydtBuilder.traverseToParent();
+
+ kValList.clear();
+ kValList.add("id1");
+ // adding the augmented node
+ ydtBuilder.addMultiInstanceChild("link", TOPONS, kValList, MERGE);
+ // container source
+ ydtBuilder.addChild("source", TOPONS, MERGE);
+ ydtBuilder.addLeaf("source-node", null, "source1");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("source-tp", null, "source2");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ // container destination
+ ydtBuilder.addChild("destination", TOPONS, MERGE);
+ ydtBuilder.addLeaf("dest-node", null, "dest1");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("dest-tp", null, "dest2");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ kValList.clear();
+ kValList.add("network1");
+ kValList.add("id2");
+ // adding the supporting-link list node
+ ydtBuilder.addMultiInstanceChild(SLINK, TOPONS, kValList, MERGE);
+ ydtBuilder.traverseToParent();
+
+ kValList.clear();
+ kValList.add("network2");
+ kValList.add("id3");
+ // adding the supporting-link list another instance
+ ydtBuilder.addMultiInstanceChild(SLINK, TOPONS, kValList, MERGE);
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ // Adding list inside list
+ ydtBuilder.addChild("supporting-network", null);
+ // Adding key element network-ref
+ ydtBuilder.addLeaf("network-ref", null, "network2");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ // Adding list inside list
+ ydtBuilder.addChild("node", null);
+ // Adding key element node-id
+ ydtBuilder.addLeaf("node-id", null, "node1");
+ ydtBuilder.traverseToParent();
+
+ kValList.clear();
+ kValList.add("tp_id1");
+ //adding augmented termination-point list
+ ydtBuilder.addMultiInstanceChild("t-point", TOPONS,
+ kValList, MERGE);
+ kValList.clear();
+ kValList.add("network-ref");
+ kValList.add("node-ref");
+ kValList.add("tp-ref");
+ //adding supporting-termination-point
+ ydtBuilder.addMultiInstanceChild(STP, TOPONS, kValList, MERGE);
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ // Adding list inside list
+ ydtBuilder.addChild("supporting-node", null);
+ // Adding key element network-ref
+ ydtBuilder.addLeaf("network-ref", null, "network3");
+ ydtBuilder.traverseToParent();
+
+ // Adding key element node-ref
+ ydtBuilder.addLeaf("node-ref", null, "network4");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addLeaf("link-id", TOPONS, "id1");
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ // Adding container
+ ydtBuilder.addChild("networks-state", null);
+ // Adding list inside container
+ ydtBuilder.addChild("network", null);
+ // Adding key element network-ref
+ ydtBuilder.addLeaf("network-ref", null, "network5");
+ ydtBuilder.traverseToParent();
+ // Adding leaf server-provided
+ ydtBuilder.addLeaf("server-provided", null, "true");
+
+ return ydtBuilder;
+ }
+
+ /**
+ * Returns the ydt builder for augmented module.
+ *
+ * @return ydt builder
+ */
+ public static YangRequestWorkBench augmentNetworkYdt() {
+
+ YangRequestWorkBench ydtBuilder;
+ ydtBuilder = getYdtBuilder(IETF, IETF, IETFNS, MERGE);
+ // Adding container
+ ydtBuilder.addChild("networks", IETFNS, MERGE);
+ // Adding list inside container
+ ydtBuilder.addChild("network", IETFNS, MERGE);
+
+ // Adding key element network Id
+ ydtBuilder.addLeaf("network-id", null, "network1");
+ ydtBuilder.traverseToParent();
+
+ kValList.clear();
+ kValList.add("id1");
+ // adding the augmented node
+ ydtBuilder.addMultiInstanceChild("link", TOPONS, kValList, MERGE);
+ // container source
+ ydtBuilder.addChild("source", TOPONS, MERGE);
+ ydtBuilder.addLeaf("source-node", null, "source1");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("source-tp", null, "source2");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ // container destination
+ ydtBuilder.addChild("destination", TOPONS, MERGE);
+ ydtBuilder.addLeaf("dest-node", null, "dest1");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("dest-tp", null, "dest2");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ kValList.clear();
+ kValList.add("network1");
+ kValList.add("id2");
+ // adding the supporting-link list node
+ ydtBuilder.addMultiInstanceChild(SLINK, TOPONS, kValList, MERGE);
+ ydtBuilder.traverseToParent();
+
+ kValList.clear();
+ kValList.add("network2");
+ kValList.add("id3");
+ // adding the supporting-link list another instance
+ ydtBuilder.addMultiInstanceChild(SLINK, TOPONS, kValList, MERGE);
+ ydtBuilder.traverseToParent();
+
+ kValList.clear();
+ kValList.add("1");
+ ydtBuilder.addMultiInstanceChild("augment1", A1, kValList, MERGE);
+ ydtBuilder.traverseToParent();
+
+ kValList.clear();
+ kValList.add("1");
+ kValList.add("2");
+ ydtBuilder.addMultiInstanceChild("augment2", A2, kValList, MERGE);
+
+ ydtBuilder.addChild("augment5", A5, DELETE);
+
+ ydtBuilder.addMultiInstanceChild(A6L, A6, kValList, DELETE);
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addLeaf("value5", null, "5");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addMultiInstanceChild(A5L, A5, kValList, DELETE);
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addChild("augment3", A3, MERGE);
+
+ ydtBuilder.addChild("augment4", A4, DELETE);
+ ydtBuilder.addLeaf("value4", null, "4");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addChild("augment5", A5, MERGE);
+
+ ydtBuilder.addLeaf("leaf6", A6, "6");
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addLeaf("value5", null, "5");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addChild("augment6", A6, DELETE);
+ ydtBuilder.addLeaf("value6", null, "6");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addLeaf("value3", null, "3");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addLeaf("augment3leaf", A3, "3");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addMultiInstanceChild(A2L, A2, kValList, MERGE);
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.traverseToParent();
+
+ // Adding list inside list
+ ydtBuilder.addChild("supporting-network", null);
+ // Adding key element network-ref
+ ydtBuilder.addLeaf("network-ref", null, "network2");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ // Adding list inside list
+ ydtBuilder.addChild("node", null);
+ // Adding key element node-id
+ ydtBuilder.addLeaf("node-id", null, "node1");
+ ydtBuilder.traverseToParent();
+
+ kValList.clear();
+ kValList.add("tp_id1");
+ //adding augmented termination-point list
+ ydtBuilder.addMultiInstanceChild("t-point", TOPONS,
+ kValList, MERGE);
+ kValList.clear();
+ kValList.add("network-ref");
+ kValList.add("node-ref");
+ kValList.add("tp-ref");
+ //adding supporting-termination-point
+ ydtBuilder.addMultiInstanceChild(STP, TOPONS, kValList, MERGE);
+
+ // Adding augmented container1 inside supporting-termination-point
+ augmentTerminationPointYdt(ydtBuilder);
+
+ return ydtBuilder;
+ }
+
+ /**
+ * Adds augments inside supporting-termination-point in augmented module.
+ *
+ * @param ydtBuilder ydt builder which need to be updated
+ */
+ private static void augmentTerminationPointYdt(YangRequestWorkBench ydtBuilder) {
+
+ ydtBuilder.addChild("augment1", A1);
+ ydtBuilder.addLeaf("value1", null, "1");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("augment1-leaf", A1, "1");
+
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addChild("augment2", A2, MERGE);
+
+ ydtBuilder.addChild("augment3", A3, MERGE);
+ ydtBuilder.addLeaf("value3", null, "3");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addLeaf("augment4leaf", A4, "4");
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addLeaf("value2", null, "2");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ kValList.clear();
+ kValList.add("1");
+ kValList.add("2");
+ ydtBuilder.addMultiInstanceChild(A2L, A2, kValList, MERGE);
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addLeaf("augment2leaf", A2, "2");
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ // Adding list inside list
+ ydtBuilder.addChild("supporting-node", null);
+ // Adding key element network-ref
+ ydtBuilder.addLeaf("network-ref", null, "network3");
+ ydtBuilder.traverseToParent();
+
+ // Adding key element node-ref
+ ydtBuilder.addLeaf("node-ref", null, "network4");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addLeaf("link-id", TOPONS, "id1");
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ // Adding container
+ ydtBuilder.addChild("networks-state", null);
+ // Adding list inside container
+ ydtBuilder.addChild("network", null);
+ // Adding key element network-ref
+ ydtBuilder.addLeaf("network-ref", null, "network5");
+ ydtBuilder.traverseToParent();
+ // Adding leaf server-provided
+ ydtBuilder.addLeaf("server-provided", null, "true");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ }
+
+ /**
+ * Returns the ydt builder for rootlist module with listwithcontainer node
+ * using addMultiInstanceChild interface for adding multi instance node.
+ *
+ * @return ydt builder
+ */
+ public static YangRequestWorkBench listWithContainerYdt() {
+
+ YangRequestWorkBench ydtBuilder;
+ ydtBuilder = getYdtBuilder("list", "rootlist", "ydt.rootlist", MERGE);
+ kValList.clear();
+ kValList.add("12");
+ kValList.add("12");
+ ydtBuilder.addMultiInstanceChild(LWC, null, kValList, MERGE);
+ ydtBuilder.addLeaf(INV, null, "1");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf(INV, null, "2");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild("interface", null);
+ ydtBuilder.addLeaf(INV, null, "12");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("invalid", null, "121");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ return ydtBuilder;
+ }
+
+ /**
+ * Returns the ydt builder for rootlist module with listwithcontainer
+ * node using addChild interface for adding multi instance node.
+ *
+ * @return ydt builder
+ */
+ public static YangRequestWorkBench listWithContainer1Ydt() {
+
+ YangRequestWorkBench ydtBuilder;
+ ydtBuilder = getYdtBuilder("list", "rootlist", "ydt.rootlist", MERGE);
+ ydtBuilder.addChild(LWC, null);
+ ydtBuilder.addLeaf("invalid", null, "12");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("invalid1", null, "12");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf(INV, null, "1");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf(INV, null, "2");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild("interface", null);
+ ydtBuilder.addLeaf(INV, null, "12");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("invalid", null, "121");
+ ydtBuilder.traverseToParent();
+
+ return ydtBuilder;
+ }
+
+ /**
+ * Returns the ydt builder for rootlist module with multiple instances of
+ * listwithcontainer node using addMultiInstanceChild interface for adding
+ * multi instance node.
+ *
+ * @return ydt builder
+ */
+ public static YangRequestWorkBench listWithContainer2Ydt() {
+
+ YangRequestWorkBench ydtBuilder;
+ ydtBuilder = getYdtBuilder("list", "rootlist", "ydt.rootlist", MERGE);
+ kValList.clear();
+ kValList.add("1222");
+ kValList.add("1212");
+ ydtBuilder.addMultiInstanceChild(LWC, null, kValList, MERGE);
+
+ kValList.clear();
+ kValList.add("12");
+ kValList.add("1");
+ ydtBuilder.addMultiInstanceChild(INV, null, kValList, MERGE);
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf(INV, null, "122");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf(INV, null, "2222");
+ ydtBuilder.traverseToParent();
+
+ kValList.clear();
+ kValList.add("1222");
+ kValList.add("1212");
+ ydtBuilder.addMultiInstanceChild(INV, null, kValList, MERGE);
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addChild("interface", null);
+ ydtBuilder.addLeaf(INV, null, "12");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ return ydtBuilder;
+ }
+
+ /**
+ * Returns the ydt builder for rootlist module with listwithoutcontainer
+ * node.
+ *
+ * @return ydt builder
+ */
+ public static YangRequestWorkBench listWithoutContainerYdt() {
+
+ YangRequestWorkBench ydtBuilder;
+ ydtBuilder = getYdtBuilder("list", "rootlist", "ydt.rootlist", MERGE);
+ ydtBuilder.addChild("listwithoutcontainer", null);
+ ydtBuilder.addLeaf(INV, null, "12");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ return ydtBuilder;
+ }
+
+ /**
+ * Returns the ydt builder for logisticsmanager module.
+ *
+ * @return ydt builder
+ */
+ public static YangRequestWorkBench logisticsManagerYdt() {
+
+ Set<String> valueSet = new HashSet();
+ valueSet.add("1");
+ valueSet.add("2");
+ valueSet.add("3");
+ valueSet.add("4");
+ valueSet.add("5");
+
+ YangRequestWorkBench ydtBuilder;
+ ydtBuilder = getYdtBuilder("logisticsmanager", "customssupervisor",
+ null, MERGE);
+ ydtBuilder.addLeaf("supervisor", COUSTOMNS, "abc");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addChild("merchandisersupervisor", MERCHNS, MERGE);
+ ydtBuilder.addLeaf("supervisor", MERCHNS, "abc");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addChild("materialsupervisor", MATERIALNS, MERGE);
+ ydtBuilder.addChild("supervisor", MATERIALNS);
+ ydtBuilder.addLeaf("name", MATERIALNS, "abc");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("departmentId", MATERIALNS, "xyz");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addChild("supervisor", MATERIALNS);
+ ydtBuilder.addLeaf("name", MATERIALNS, "ab");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("departmentId", MATERIALNS, "xy");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addChild("purchasingsupervisor", PURCHASNS, MERGE);
+ ydtBuilder.addChild("supervisor", PURCHASNS);
+ ydtBuilder.addLeaf("purchasing-specialist", PURCHASNS, "abc");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("support", "ydt.purchasing-supervisor", "xyz");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addChild("warehousesupervisor", WAREHNS, MERGE);
+ ydtBuilder.addLeaf("supervisor", WAREHNS, valueSet);
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addChild("tradingsupervisor", TRADNS, MERGE);
+ ydtBuilder.addLeaf("supervisor", TRADNS, "abc");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addChild("employeeid", EMPNS, MERGE);
+ ydtBuilder.addLeaf("employeeid", EMPNS, valueSet);
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ return ydtBuilder;
+ }
+
+ /**
+ * Returns the ydt builder for bit module.
+ *
+ * @return ydt builder
+ */
+ public static YangRequestWorkBench bitYdt() {
+ YangRequestWorkBench ydtBuilder;
+ ydtBuilder = getYdtBuilder("builtInType", "bit", "ydt.bit", MERGE);
+ ydtBuilder.addChild("bitList", null);
+ ydtBuilder.addLeaf("bit", null, "disable-nagle");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild("bitList", null);
+ ydtBuilder.addLeaf("bit", null, "auto-sense-speed");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild("bitList", null);
+ ydtBuilder.addLeaf("bit", null, "ten-Mb-only");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild("bitList", null);
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ return ydtBuilder;
+ }
+
+ /**
+ * Returns the ydt builder for bool module.
+ *
+ * @return ydt builder
+ */
+ public static YangRequestWorkBench booleanYdt() {
+
+ YangRequestWorkBench ydtBuilder;
+ ydtBuilder = getYdtBuilder("builtInType", "bool", "ydt.boolean", MERGE);
+ ydtBuilder.addChild("booleanList", null);
+ ydtBuilder.addLeaf("boolean", null, "true");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild("booleanList", null);
+ ydtBuilder.addLeaf("boolean", null, "false");
+ ydtBuilder.traverseToParent();
+
+ return ydtBuilder;
+ }
+
+ /**
+ * Returns the ydt builder for emptydata module.
+ *
+ * @return ydt builder
+ */
+ public static YangRequestWorkBench emptyTypeYdt() {
+
+ YangRequestWorkBench ydtBuilder;
+ ydtBuilder = getYdtBuilder(
+ "builtInType", "emptydata", "ydt.emptydata", MERGE);
+ ydtBuilder.addChild("emptyList", null);
+ ydtBuilder.addLeaf("empty", null, "");
+
+ return ydtBuilder;
+ }
+
+ /**
+ * Returns the ydt builder for enumtest module.
+ *
+ * @return ydt builder
+ */
+ public static YangRequestWorkBench enumYdt() {
+
+ YangRequestWorkBench ydtBuilder;
+ ydtBuilder = getYdtBuilder(
+ "builtInType", "enumtest", "ydt.enumtest", MERGE);
+ ydtBuilder.addChild("enumList", null);
+ ydtBuilder.addLeaf("enumleaf", null, "ten");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild("enumList", null);
+ ydtBuilder.addLeaf("enumleaf", null, "hundred");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild("enumList", null);
+ ydtBuilder.addLeaf("enumleaf", null, "thousand");
+
+ return ydtBuilder;
+ }
+
+ /**
+ * Returns the ydt builder for builtin type integer8 module.
+ *
+ * @return ydt builder
+ */
+ public static YangRequestWorkBench integer8Ydt() {
+
+ YangRequestWorkBench ydtBuilder;
+ ydtBuilder = getYdtBuilder(
+ "builtInType", "integer8", "ydt.integer8", MERGE);
+ ydtBuilder.addLeaf("negInt", null, "-128");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("posInt", null, "127");
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addLeaf("minUInt", null, "0");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("maxUInt", null, "255");
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addLeaf("midIntWithRange", null, "11");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("minIntWithRange", null, "10");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("maxIntWithRange", null, "100");
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addLeaf("midUIntWithRange", null, "11");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("minUIntWithRange", null, "10");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("maxUIntWithRange", null, "100");
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("integer", null, "11");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("integer", null, "10");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("integer", null, "40");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("integer", null, "50");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("integer", null, "55");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("integer", null, "100");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addChild(MRV, null);
+ ydtBuilder.addLeaf("UnInteger", null, "11");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("UnInteger", null, "10");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("UnInteger", null, "40");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("UnInteger", null, "50");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("UnInteger", null, "55");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("UnInteger", null, "100");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addChild(MRV, null);
+ ydtBuilder.addLeaf("revInteger", null, "-128");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revInteger", null, "1");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revInteger", null, "2");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revInteger", null, "10");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revInteger", null, "20");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revInteger", null, "100");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revInteger", null, "127");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revUnInteger", null, "0");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revUnInteger", null, "1");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revUnInteger", null, "2");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revUnInteger", null, "10");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revUnInteger", null, "20");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revUnInteger", null, "100");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revUnInteger", null, "255");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ return ydtBuilder;
+ }
+
+ /**
+ * Returns the ydt builder for builtin type integer16 module.
+ *
+ * @return ydt builder
+ */
+ public static YangRequestWorkBench integer16Ydt() {
+
+ YangRequestWorkBench ydtBuilder;
+ ydtBuilder = getYdtBuilder(
+ "builtInType", "integer16", "ydt.integer16", MERGE);
+ ydtBuilder.addLeaf("negInt", null, "-32768");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("posInt", null, "32767");
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addLeaf("minUInt", null, "0");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("maxUInt", null, "65535");
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addLeaf("midIntWithRange", null, "11");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("minIntWithRange", null, "10");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("maxIntWithRange", null, "100");
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addLeaf("midUIntWithRange", null, "11");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("minUIntWithRange", null, "10");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("maxUIntWithRange", null, "100");
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("integer", null, "11");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("integer", null, "10");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("integer", null, "40");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("integer", null, "50");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("integer", null, "55");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("integer", null, "100");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addChild(MRV, null);
+ ydtBuilder.addLeaf("UnInteger", null, "11");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("UnInteger", null, "10");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("UnInteger", null, "40");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("UnInteger", null, "50");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("UnInteger", null, "55");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("UnInteger", null, "100");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addChild(MRV, null);
+ ydtBuilder.addLeaf("revInteger", null, "-32768");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revInteger", null, "1");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revInteger", null, "2");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revInteger", null, "10");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revInteger", null, "20");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revInteger", null, "100");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revInteger", null, "32767");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revUnInteger", null, "0");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revUnInteger", null, "1");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revUnInteger", null, "2");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revUnInteger", null, "10");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revUnInteger", null, "20");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revUnInteger", null, "100");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revUnInteger", null, "65535");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ return ydtBuilder;
+ }
+
+ /**
+ * Returns the ydt builder for builtin type integer32 module.
+ *
+ * @return ydt builder
+ */
+ public static YangRequestWorkBench integer32Ydt() {
+
+ YangRequestWorkBench ydtBuilder;
+ ydtBuilder = getYdtBuilder(
+ "builtInType", "integer32", "ydt.integer32", MERGE);
+ ydtBuilder.addLeaf("negInt", null, "-2147483648");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("posInt", null, "2147483647");
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addLeaf("minUInt", null, "0");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("maxUInt", null, "4294967295");
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addLeaf("midIntWithRange", null, "11");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("minIntWithRange", null, "10");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("maxIntWithRange", null, "100");
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addLeaf("midUIntWithRange", null, "11");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("minUIntWithRange", null, "10");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("maxUIntWithRange", null, "100");
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("integer", null, "11");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("integer", null, "10");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("integer", null, "40");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("integer", null, "50");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("integer", null, "55");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("integer", null, "100");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addChild(MRV, null);
+ ydtBuilder.addLeaf("UnInteger", null, "11");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("UnInteger", null, "10");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("UnInteger", null, "40");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("UnInteger", null, "50");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("UnInteger", null, "55");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("UnInteger", null, "100");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addChild(MRV, null);
+ ydtBuilder.addLeaf("revInteger", null, "-2147483648");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revInteger", null, "1");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revInteger", null, "2");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revInteger", null, "10");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revInteger", null, "20");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revInteger", null, "100");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revInteger", null, "2147483647");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revUnInteger", null, "0");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revUnInteger", null, "1");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revUnInteger", null, "2");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revUnInteger", null, "10");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revUnInteger", null, "20");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revUnInteger", null, "100");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revUnInteger", null, "4294967295");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ return ydtBuilder;
+ }
+
+ /**
+ * Returns the ydt builder for builtin type integer64 module.
+ *
+ * @return ydt builder
+ */
+ public static YangRequestWorkBench integer64Ydt() {
+
+ YangRequestWorkBench ydtBuilder;
+ ydtBuilder = getYdtBuilder(
+ "builtInType", "integer64", "ydt.integer64", MERGE);
+ ydtBuilder.addLeaf("negInt", null, "-9223372036854775808");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("posInt", null, "9223372036854775807");
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addLeaf("minUInt", null, "0");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("maxUInt", null, "18446744073709551615");
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addLeaf("midIntWithRange", null, "11");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("minIntWithRange", null, "10");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("maxIntWithRange", null, "100");
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addLeaf("midUIntWithRange", null, "11");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("minUIntWithRange", null, "10");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("maxUIntWithRange", null, "100");
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("integer", null, "11");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("integer", null, "10");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("integer", null, "40");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("integer", null, "50");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("integer", null, "55");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("integer", null, "100");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addChild(MRV, null);
+ ydtBuilder.addLeaf("UnInteger", null, "11");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("UnInteger", null, "10");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("UnInteger", null, "40");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("UnInteger", null, "50");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("UnInteger", null, "55");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("UnInteger", null, "100");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addChild(MRV, null);
+ ydtBuilder.addLeaf("revInteger", null, "-9223372036854775808");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revInteger", null, "1");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revInteger", null, "2");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revInteger", null, "10");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revInteger", null, "20");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revInteger", null, "100");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revInteger", null, "9223372036854775807");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revUnInteger", null, "0");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revUnInteger", null, "1");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revUnInteger", null, "2");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revUnInteger", null, "10");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revUnInteger", null, "20");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revUnInteger", null, "100");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revUnInteger", null, "18446744073709551615");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ return ydtBuilder;
+ }
+
+ /**
+ * Returns the ydt builder for builtin type decimal64 module.
+ *
+ * @return ydt builder
+ */
+ public static YangRequestWorkBench decimal64Ydt() {
+
+ YangRequestWorkBench ydtBuilder;
+ ydtBuilder = getYdtBuilder(
+ "builtInType", "decimal64", "ydt.decimal64", MERGE);
+ ydtBuilder.addLeaf("negInt", null, "-92233720368547758.08");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("posInt", null, "92233720368547758.07");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf(NIWMF, null, "-922337203685477580.8");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf(PIWMF, null, "922337203685477580.7");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf(NWF, null, "-9.223372036854775808");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf(PWF, null, "9.223372036854775807");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("midIntWithRange", null, "11");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("minIntWithRange", null, "10");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("maxIntWithRange", null, "100");
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addChild(MRV, null);
+ ydtBuilder.addLeaf("decimal", null, "11");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null);
+ ydtBuilder.addLeaf("decimal", null, "10");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null);
+ ydtBuilder.addLeaf("decimal", null, "40");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null);
+ ydtBuilder.addLeaf("decimal", null, "50");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null);
+ ydtBuilder.addLeaf("decimal", null, "55");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null);
+ ydtBuilder.addLeaf("decimal", null, "100");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null);
+ ydtBuilder.addLeaf("revDecimal", null, "-92233720368547758.08");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null);
+ ydtBuilder.addLeaf("revDecimal", null, "2.505");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null);
+ ydtBuilder.addLeaf("revDecimal", null, "3.14");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null);
+ ydtBuilder.addLeaf("revDecimal", null, "10");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null);
+ ydtBuilder.addLeaf("revDecimal", null, "20");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null);
+ ydtBuilder.addLeaf("revDecimal", null, "92233720368547757");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null);
+ ydtBuilder.addLeaf("revDecimal", null, "92233720368547758.07");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ return ydtBuilder;
+ }
+
+ /**
+ * Returns the ydt builder with requested logical root name and module name.
+ *
+ * @param rootName logical rootNode name
+ * @param moduleName application(module) name
+ * @param nameSpace namespace of module
+ * @param opType operation type
+ * @return ydt builder
+ */
+ public static YangRequestWorkBench getYdtBuilder(String rootName, String
+ moduleName, String nameSpace, YdtContextOperationType opType) {
+ setSchemaRegistry(schemaProvider.getDefaultYangSchemaRegistry());
+ YangRequestWorkBench ydtBuilder;
+ schemaProvider.processSchemaRegistry(null);
+ ydtBuilder = new YangRequestWorkBench(
+ rootName, null, null, schemaProvider
+ .getDefaultYangSchemaRegistry(), true);
+ ydtBuilder.addChild(moduleName, nameSpace, opType);
+ return ydtBuilder;
+ }
+
+ /**
+ * Compares the two value sets.
+ */
+ public static void compareValueSet(Set<String> valueSet,
+ Set<String> userInputValueSet) {
+ // Check the value against user input.
+ assertTrue("Expected 'valueSet' and 'userInputValueSet' to be equal.",
+ valueSet.containsAll(userInputValueSet));
+ }
+
+ /**
+ * Returns the ydt builder for Hello_ONOS module.
+ *
+ * @return ydt builder
+ */
+ public static YangRequestWorkBench helloOnos() {
+
+ YangRequestWorkBench ydtBuilder;
+ ydtBuilder = getYdtBuilder(
+ "Hello-ONOS", "Hello_ONOS", "ydt:hello_onos", MERGE);
+ ydtBuilder.addChild("hello-world", null);
+ ydtBuilder.addChild("input", null);
+ ydtBuilder.addLeaf("name", null, "onos");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("surName", null, "yang");
+ ydtBuilder.traverseToParent();
+
+ kValList.clear();
+ kValList.add("ON");
+ kValList.add("LAB");
+ ydtBuilder.addMultiInstanceChild("stringList", null, kValList,
+ MERGE);
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ return ydtBuilder;
+ }
+
+ /**
+ * Returns the error message for requested node.
+ *
+ * @param value value in string format
+ * @param dataType requested data type
+ * @return error string
+ */
+ static String getErrorString(String value, String dataType) {
+ StringBuilder msg = new StringBuilder();
+ switch (dataType) {
+ case SINT16:
+ case SINT32:
+ case SMALLINT8:
+ case SMALLINT64:
+ case SMALLUINT8:
+ case SMALLUINT64:
+ case SUINT16:
+ case SUINT32:
+ case CAPSINT8:
+ case CAPSINT16:
+ case CAPSINT32:
+ case CAPSINT64:
+ case CAPSUINT8:
+ case CAPSUINT16:
+ case CAPSUINT32:
+ case CAPSUINT64:
+ case BIT:
+ case BOOL:
+ case ENUM:
+ msg.append("YANG file error : Input value ").append(BACKSLASH)
+ .append(value).append(BACKSLASH)
+ .append(" is not a valid ").append(dataType);
+ break;
+ case EMPTY:
+ msg.append("YANG file error : Input value ").append(BACKSLASH)
+ .append(value).append(BACKSLASH).append(
+ " is not allowed for a data type EMPTY");
+ break;
+ case MINVALUE:
+ msg.append("YANG file error : ").append(value)
+ .append(" is lesser than minimum value ")
+ .append(MINVALUE).append(PERIOD);
+ break;
+ case MAXUINT8:
+ case MAXUINT16:
+ case MAXUINT32:
+ case MAXUINT64:
+ msg.append("YANG file error : ").append(value)
+ .append(" is greater than maximum value ")
+ .append(dataType).append(PERIOD);
+ break;
+ default:
+ return null;
+ }
+ return msg.toString();
+ }
+
+ /**
+ * Validates the error message which is obtained by checking the given
+ * value against its data type restrictions.
+ *
+ * @param name leaf name
+ * @param nameSpace leaf namespace
+ * @param val leaf value
+ * @param type data type suffix string for exception message
+ * @param childName child name
+ */
+ public static void validateErrMsg(String name, String nameSpace,
+ String val, String type, String childName) {
+ YangRequestWorkBench ydtBuilder = getTestYdtBuilder(nameSpace);
+ boolean isExpOccurred = false;
+ /*
+ * If childName exist then leaf need to be added under the
+ * child node with the given childName
+ */
+ if (childName != null) {
+ ydtBuilder.addChild(childName, nameSpace);
+ }
+ /*
+ * This try catch is explicitly written to use as utility in other
+ * test cases.
+ */
+ try {
+ ydtBuilder.addLeaf(name, nameSpace, val);
+ } catch (YdtException e) {
+ isExpOccurred = true;
+ assertEquals(e.getMessage(), getErrorString(val, type));
+ }
+ assertEquals(E_LEAF + name, isExpOccurred, true);
+ }
+
+ /**
+ * Returns ydt builder for requested namespace.
+ *
+ * @param namespace namespace of the requested yang data tree
+ * @return ydt builder
+ */
+ public static YangRequestWorkBench getTestYdtBuilder(String namespace) {
+
+ switch (namespace) {
+ case INT8NS:
+ return getYdtBuilder(TYPE, "integer8", INT8NS, MERGE);
+ case INT16NS:
+ return getYdtBuilder(TYPE, "integer16", INT16NS, MERGE);
+ case INT32NS:
+ return getYdtBuilder(TYPE, "integer32", INT32NS, MERGE);
+ case INT64NS:
+ return getYdtBuilder(TYPE, "integer64", INT64NS, MERGE);
+ case BITNS:
+ return getYdtBuilder(TYPE, "bit", BITNS, MERGE);
+ case BOOLNS:
+ return getYdtBuilder(TYPE, "bool", BOOLNS, MERGE);
+ case EMPTYNS:
+ return getYdtBuilder(TYPE, "emptydata", EMPTYNS, MERGE);
+ case ENUMNS:
+ return getYdtBuilder(TYPE, "enumtest", ENUMNS, MERGE);
+ case LISTNS:
+ return getYdtBuilder(LIST, "rootlist", LISTNS, MERGE);
+ default:
+ return null;
+ }
+ }
+
+ /**
+ * Validates the contents of node like name, namespace and operation type.
+ *
+ * @param ydtNode node need to be validate
+ * @param name name of the node
+ * @param opType operation type of the node
+ */
+ public static void validateNodeContents(YdtNode ydtNode, String name,
+ YdtContextOperationType opType) {
+ assertEquals(ydtNode.getName(), name);
+ assertEquals(ydtNode.getYdtContextOperationType(), opType);
+ }
+
+ /**
+ * Validates the contents of leaf node like name, namespace and operation
+ * type.
+ *
+ * @param ydtNode node need to be validate
+ * @param name name of the node
+ * @param value value of the leaf node
+ */
+ public static void validateLeafContents(YdtNode ydtNode, String name,
+ String value) {
+ validateNodeContents(ydtNode, name, null);
+ assertEquals(ydtNode.getValue(), value);
+ }
+
+ /**
+ * Validates the contents of leaf-list node like name, namespace and
+ * operation type.
+ *
+ * @param ydtNode node need to be validate
+ * @param name name of the node
+ * @param valueSet value of the leaf node
+ */
+ public static void validateLeafListContents(YdtNode ydtNode, String name,
+ Set<String> valueSet) {
+ validateNodeContents(ydtNode, name, null);
+ compareValueSet(ydtNode.getValueSet(), valueSet);
+ }
+
+ /**
+ * Validates the contents of ydt application logical node.
+ *
+ * @param ydtAppNode node need to be validate
+ */
+ public static void validateAppLogicalNodeContents(
+ YdtAppContext ydtAppNode) {
+
+ assertNull(ydtAppNode.getOperationType());
+ assertNull(ydtAppNode.getParent());
+ assertNull(ydtAppNode.getNextSibling());
+ assertNull(ydtAppNode.getPreviousSibling());
+ assertNotNull(ydtAppNode.getFirstChild());
+ assertNotNull(ydtAppNode.getLastChild());
+ }
+
+ /**
+ * Validates the contents of ydt application module node.
+ *
+ * @param ydtAppNode node need to be validate
+ * @param name name of the node
+ * @param opType operation type of the app node
+ */
+ public static void validateAppModuleNodeContents(
+ YdtAppContext ydtAppNode, String name,
+ YdtAppNodeOperationType opType) {
+
+ assertEquals(ydtAppNode.getModuleContext().getName(), name);
+ assertEquals(ydtAppNode.getOperationType(), opType);
+ }
+
+ /**
+ * Validates the contents of ydt application node like name, namespace
+ * and operation type.
+ *
+ * @param ydtAppNode node need to be validate
+ * @param name name of the schema node
+ * @param ns namespace of the schema node
+ * @param opType operation type of the app node
+ */
+ public static void validateAppNodeContents(
+ YdtAppContext ydtAppNode, String name, String ns,
+ YdtAppNodeOperationType opType) {
+ assertEquals(ydtAppNode.getAugmentingSchemaNode().getName(), name);
+ assertEquals(ydtAppNode.getAugmentingSchemaNode().getNameSpace(), ns);
+ assertEquals(ydtAppNode.getOperationType(), opType);
+ }
+
+ /**
+ * Walks in the given built ydt and validates it.
+ */
+ public static void walkINTree(YangRequestWorkBench ydtBuilder,
+ String[] expected) {
+ DefaultYdtWalker ydtWalker = new DefaultYdtWalker();
+ resetLogger();
+
+ YdtTestUtils utils = new YdtTestUtils();
+ // Assign root node as starting node to walk the whole tree.
+ ydtWalker.walk(utils, ydtBuilder.getRootNode());
+ // Logger list is used for walker testing.
+ List<String> logger = getLogger();
+
+ for (int i = 0; i < expected.length; i++) {
+ assertEquals(expected[i], logger.get(i));
+ }
+ }
+}
diff --git a/apps/yms/app/src/test/resources/ydtTestYangFiles/Hello_ONOS.yang b/apps/yms/app/src/test/resources/ydtTestYangFiles/Hello_ONOS.yang
new file mode 100644
index 0000000..d5eafbe
--- /dev/null
+++ b/apps/yms/app/src/test/resources/ydtTestYangFiles/Hello_ONOS.yang
@@ -0,0 +1,57 @@
+module Hello_ONOS {
+ yang-version 1;
+ namespace "ydt:hello_onos";
+ prefix "hello";
+
+ revision "2016-09-03" {
+ description "Initial revision of hello model";
+ }
+
+ grouping greeting {
+ leaf name {
+ type string;
+ }
+
+ leaf surName {
+ type string;
+ }
+ }
+
+ rpc hello-world {
+ input {
+
+ // uses greeting;
+
+ leaf name {
+ type string;
+ }
+
+ leaf surName {
+ type string;
+ }
+
+ leaf inputDefault {
+ type string;
+ }
+
+ list stringList {
+ key "string1 string2";
+ unique "string3";
+ leaf string1 {
+ type string;
+ }
+ leaf string2 {
+ type string;
+ }
+ leaf string3 {
+ type string;
+ }
+ }
+ }
+ output {
+ leaf greetingOut {
+ type string;
+ }
+ }
+ }
+}
diff --git a/apps/yms/app/src/test/resources/ydtTestYangFiles/Logistics-manager.yang b/apps/yms/app/src/test/resources/ydtTestYangFiles/Logistics-manager.yang
new file mode 100644
index 0000000..3cd4321
--- /dev/null
+++ b/apps/yms/app/src/test/resources/ydtTestYangFiles/Logistics-manager.yang
@@ -0,0 +1,66 @@
+module Logistics-manager {
+
+ yang-version 1;
+
+ namespace "ydt.root";
+
+ prefix "root";
+
+ organization "ON-LAB";
+
+ description "This module defines for organisation.";
+
+ revision "2016-05-24" {
+ description "Initial revision.";
+ }
+
+ leaf Customs-supervisor {
+ type string;
+ description "name of the customs-supervisor.";
+ }
+
+ leaf Merchandiser-supervisor {
+ type string;
+ description "name of merchandiser-supervisor";
+ }
+
+ list Material-supervisor {
+ key "name";
+ leaf name {
+ type string;
+ description "name of logistics-supervisor";
+ }
+
+ leaf departmentId {
+ type string;
+ description "name of department";
+ }
+ }
+
+ container Purchasing-supervisor {
+ leaf purchasing-specialist {
+ type string;
+ description "name of the purchasing-specialist person";
+ }
+
+ leaf support {
+ type string;
+ description "name of the support person";
+ }
+ }
+
+ leaf-list Warehouse-supervisor {
+ type string;
+ description "name of the warehouse-supervisor's";
+ }
+
+ leaf trading-supervisor {
+ type string;
+ description "name of the trading-supervisor";
+ }
+
+ leaf-list employee-id {
+ type string;
+ description "list of the employee id";
+ }
+}
\ No newline at end of file
diff --git a/apps/yms/app/src/test/resources/ydtTestYangFiles/augment-topology1.yang b/apps/yms/app/src/test/resources/ydtTestYangFiles/augment-topology1.yang
new file mode 100644
index 0000000..6736063
--- /dev/null
+++ b/apps/yms/app/src/test/resources/ydtTestYangFiles/augment-topology1.yang
@@ -0,0 +1,51 @@
+module augment-topology1 {
+
+ yang-version 1;
+
+ namespace "ydt.augment-topology1";
+
+ prefix "aug1";
+
+ import yms-ietf-network {
+ prefix nd;
+ }
+
+ import yms-network-topology {
+ prefix topo;
+ }
+
+ organization "ON-LAB";
+
+ description "This module defines for augment-topology1 classifier.";
+
+ revision "2016-05-24" {
+ description "Initial revision.";
+ }
+
+ augment "/nd:networks/nd:network/topo:link" {
+ description
+ "Add augment1 to the link model.";
+ list augment1 {
+ key "value1";
+ leaf value1 {
+ type int8;
+ }
+ }
+ }
+
+ augment "/nd:networks/nd:network/nd:node/topo:t-point" +
+ "/supporting-termination-point" {
+ description
+ "Add augment1 to the termination-point model.";
+ container augment1 {
+ leaf value1 {
+ type int8;
+ }
+ }
+
+ leaf augment1-leaf {
+ type string;
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/apps/yms/app/src/test/resources/ydtTestYangFiles/augment-topology2.yang b/apps/yms/app/src/test/resources/ydtTestYangFiles/augment-topology2.yang
new file mode 100644
index 0000000..82a19d7
--- /dev/null
+++ b/apps/yms/app/src/test/resources/ydtTestYangFiles/augment-topology2.yang
@@ -0,0 +1,63 @@
+module augment-topology2 {
+
+ yang-version 1;
+
+ namespace "ydt.augment-topology2";
+
+ prefix "aug2";
+
+ import yms-ietf-network {
+ prefix nd;
+ }
+
+ import yms-network-topology {
+ prefix topo;
+ }
+
+ organization "ON-LAB";
+
+ description "This module defines for augment-topology2 classifier.";
+
+ revision "2016-05-24" {
+ description "Initial revision.";
+ }
+
+ augment "/nd:networks/nd:network/topo:link" {
+ description
+ "Add augment2 to the link model.";
+ list augment2 {
+ key "key1 key2";
+ leaf key1 {
+ type int8;
+ }
+ leaf key2 {
+ type int8;
+ }
+ }
+
+ leaf-list augment2leafList {
+ type string;
+ }
+ }
+
+ augment "/nd:networks/nd:network/nd:node/topo:t-point/" +
+ "supporting-termination-point" {
+ description
+ "Add augment2 to the supporting-termination-point model.";
+ container augment2 {
+ config false;
+ leaf value2 {
+ type int8;
+ }
+ }
+
+ leaf-list augment2leafList {
+ type string;
+ }
+
+ leaf augment2leaf {
+ type string;
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/apps/yms/app/src/test/resources/ydtTestYangFiles/augment-topology3.yang b/apps/yms/app/src/test/resources/ydtTestYangFiles/augment-topology3.yang
new file mode 100644
index 0000000..d2c58ce
--- /dev/null
+++ b/apps/yms/app/src/test/resources/ydtTestYangFiles/augment-topology3.yang
@@ -0,0 +1,59 @@
+module augment-topology3 {
+
+ yang-version 1;
+
+ namespace "ydt.augment-topology3";
+
+ prefix "aug3";
+
+ import yms-ietf-network {
+ prefix nd;
+ }
+
+ import augment-topology1 {
+ prefix aug1;
+ }
+
+ import augment-topology2 {
+ prefix aug2;
+ }
+
+ import yms-network-topology {
+ prefix topo;
+ }
+
+ organization "ON-LAB";
+
+ description "This module defines for augment-topology3 classifier.";
+
+ revision "2016-05-24" {
+ description "Initial revision.";
+ }
+
+ augment "/nd:networks/nd:network/topo:link/aug2:augment2" {
+ description
+ "Add augment3 to the augment2 model.";
+ container augment3 {
+ config false;
+ leaf value3 {
+ type int8;
+ }
+ }
+
+ leaf augment3leaf {
+ type string;
+ }
+ }
+
+ augment "/nd:networks/nd:network/nd:node/topo:t-point/" +
+ "supporting-termination-point/aug2:augment2" {
+ description
+ "Add augment3 to the augment2 model.";
+ container augment3 {
+ config false;
+ leaf value3 {
+ type int8;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/apps/yms/app/src/test/resources/ydtTestYangFiles/augment-topology4.yang b/apps/yms/app/src/test/resources/ydtTestYangFiles/augment-topology4.yang
new file mode 100644
index 0000000..b8cea93
--- /dev/null
+++ b/apps/yms/app/src/test/resources/ydtTestYangFiles/augment-topology4.yang
@@ -0,0 +1,58 @@
+module augment-topology4 {
+
+ yang-version 1;
+
+ namespace "ydt.augment-topology4";
+
+ prefix "aug4";
+
+ import yms-ietf-network {
+ prefix nd;
+ }
+
+ import augment-topology1 {
+ prefix aug1;
+ }
+
+ import augment-topology2 {
+ prefix aug2;
+ }
+
+ import augment-topology3 {
+ prefix aug3;
+ }
+
+ import yms-network-topology {
+ prefix topo;
+ }
+
+ organization "ON-LAB";
+
+ description "This module defines for augment-topology4 classifier.";
+
+ revision "2016-05-24" {
+ description "Initial revision.";
+ }
+
+ augment "/nd:networks/nd:network/topo:link/aug2:augment2/aug3:augment3" {
+ description
+ "Add augment4 to the augment3 model.";
+ container augment4 {
+ config false;
+ leaf value4 {
+ type int8;
+ }
+ }
+ }
+
+ augment "/nd:networks/nd:network/nd:node/topo:t-point/" +
+ "supporting-termination-point/aug2:augment2" {
+ description
+ "Add augment4leaf to the augment2 model.";
+
+ leaf augment4leaf{
+ type string;
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/apps/yms/app/src/test/resources/ydtTestYangFiles/augment-topology5.yang b/apps/yms/app/src/test/resources/ydtTestYangFiles/augment-topology5.yang
new file mode 100644
index 0000000..a13a688
--- /dev/null
+++ b/apps/yms/app/src/test/resources/ydtTestYangFiles/augment-topology5.yang
@@ -0,0 +1,66 @@
+module augment-topology5 {
+
+ yang-version 1;
+
+ namespace "ydt.augment-topology5";
+
+ prefix "aug5";
+
+ import yms-ietf-network {
+ prefix nd;
+ }
+
+ import augment-topology1 {
+ prefix aug1;
+ }
+
+ import augment-topology2 {
+ prefix aug2;
+ }
+
+ import augment-topology3 {
+ prefix aug3;
+ }
+
+ import augment-topology4 {
+ prefix aug4;
+ }
+
+ import yms-network-topology {
+ prefix topo;
+ }
+
+ organization "ON-LAB";
+
+ description "This module defines for augment-topology5 classifier.";
+
+ revision "2016-05-24" {
+ description "Initial revision.";
+ }
+
+ augment "/nd:networks/nd:network/topo:link/aug2:augment2" {
+ description
+ "Add container to the augment2 model.";
+ container augment5 {
+ config false;
+ leaf value5 {
+ type int8;
+ }
+ }
+
+ leaf-list augment5leafList {
+ type string;
+ }
+ }
+
+ augment "/nd:networks/nd:network/topo:link/aug2:augment2/aug3:augment3" {
+ description
+ "Add augment5 to the augment3 model.";
+ container augment5 {
+ config false;
+ leaf value5 {
+ type int8;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/apps/yms/app/src/test/resources/ydtTestYangFiles/augment-topology6.yang b/apps/yms/app/src/test/resources/ydtTestYangFiles/augment-topology6.yang
new file mode 100644
index 0000000..15bd3d5
--- /dev/null
+++ b/apps/yms/app/src/test/resources/ydtTestYangFiles/augment-topology6.yang
@@ -0,0 +1,73 @@
+module augment-topology6 {
+
+ yang-version 1;
+
+ namespace "ydt.augment-topology6";
+
+ prefix "aug5";
+
+ import yms-ietf-network {
+ prefix nd;
+ }
+
+ import augment-topology1 {
+ prefix aug1;
+ }
+
+ import augment-topology2 {
+ prefix aug2;
+ }
+
+ import augment-topology3 {
+ prefix aug3;
+ }
+
+ import augment-topology4 {
+ prefix aug4;
+ }
+
+ import augment-topology5 {
+ prefix aug5;
+ }
+
+ import yms-network-topology {
+ prefix topo;
+ }
+
+ organization "ON-LAB";
+
+ description "This module defines for augment-topology6 classifier.";
+
+ revision "2016-05-24" {
+ description "Initial revision.";
+ }
+
+ augment "/nd:networks/nd:network/topo:link/aug2:augment2/aug3:augment3" {
+ description
+ "Add augment6 to the augment3 model.";
+ container augment6 {
+ config true;
+ leaf value6 {
+ type int8;
+ }
+ }
+ }
+
+ augment "/nd:networks/nd:network/topo:link/aug2:augment2/aug3:augment3/" +
+ "aug5:augment5" {
+ description
+ "Add leaf6 to the augment5 model.";
+ leaf leaf6 {
+ type string;
+ }
+
+ }
+
+ augment "/nd:networks/nd:network/topo:link/aug2:augment2/aug5:augment5" {
+ description
+ "Add list to the augment5 model.";
+ leaf-list augment6leafList {
+ type string;
+ }
+ }
+}
\ No newline at end of file
diff --git a/apps/yms/app/src/test/resources/ydtTestYangFiles/augmentNetwork.yang b/apps/yms/app/src/test/resources/ydtTestYangFiles/augmentNetwork.yang
new file mode 100644
index 0000000..315bc44
--- /dev/null
+++ b/apps/yms/app/src/test/resources/ydtTestYangFiles/augmentNetwork.yang
@@ -0,0 +1,33 @@
+module augmentNetwork {
+
+ yang-version 1;
+
+ namespace "ydt.augmentNetwork";
+
+ prefix "aug";
+
+ import yms-ietf-network {
+ prefix nd;
+ }
+
+
+ organization "ON-LAB";
+
+ description "This module defines for augmentNetwork classifier.";
+
+ revision "2016-05-24" {
+ description "Initial revision.";
+ }
+
+ augment "/nd:networks/nd:network" {
+ description
+ "Add container to the network model.";
+ container cont1s {
+ container cont1s {
+ leaf fine {
+ type string;
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/apps/yms/app/src/test/resources/ydtTestYangFiles/binarytest.yang b/apps/yms/app/src/test/resources/ydtTestYangFiles/binarytest.yang
new file mode 100644
index 0000000..71ada48
--- /dev/null
+++ b/apps/yms/app/src/test/resources/ydtTestYangFiles/binarytest.yang
@@ -0,0 +1,33 @@
+module binarytest {
+
+ yang-version 1;
+
+ namespace "ydt.binarytest";
+
+ prefix "binarytest";
+
+ organization "ON-LAB";
+
+ description "This module defines for binarytest classifier.";
+
+ revision "2016-05-24" {
+ description "Initial revision.";
+ }
+
+ list binaryList {
+ config false;
+ leaf binary {
+ type binary;
+ }
+ leaf binaryWithRange {
+ type binary {
+ length "2 .. 10";
+ }
+ }
+ leaf binaryWithMultiRange {
+ type binary {
+ length "min..10 | 20 | 30..max";
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/apps/yms/app/src/test/resources/ydtTestYangFiles/bit.yang b/apps/yms/app/src/test/resources/ydtTestYangFiles/bit.yang
new file mode 100644
index 0000000..6d97ccc
--- /dev/null
+++ b/apps/yms/app/src/test/resources/ydtTestYangFiles/bit.yang
@@ -0,0 +1,51 @@
+module bit {
+
+ yang-version 1;
+
+ namespace "ydt.bit";
+
+ prefix "bit";
+
+ organization "ON-LAB";
+
+ description "This module defines for bit classifier.";
+
+ revision "2016-05-24" {
+ description "Initial revision.";
+ }
+/*
+ leaf mybits {
+ type bits {
+ bit disable-nagle {
+ position 0;
+ }
+ bit auto-sense-speed {
+ position 1;
+ }
+ bit 10-Mb-only {
+ position 2;
+ }
+ }
+ default "auto-sense-speed";
+ }
+ */
+
+ list bitList {
+ config false;
+ leaf bit {
+ type bits {
+ bit disable-nagle {
+ position 0;
+ }
+ bit auto-sense-speed {
+ position 1;
+ }
+ bit ten-Mb-only {
+ position 2;
+ }
+ }
+ default "auto-sense-speed";
+
+ }
+ }
+}
\ No newline at end of file
diff --git a/apps/yms/app/src/test/resources/ydtTestYangFiles/bool.yang b/apps/yms/app/src/test/resources/ydtTestYangFiles/bool.yang
new file mode 100644
index 0000000..1bb6181
--- /dev/null
+++ b/apps/yms/app/src/test/resources/ydtTestYangFiles/bool.yang
@@ -0,0 +1,23 @@
+module bool {
+
+ yang-version 1;
+
+ namespace "ydt.boolean";
+
+ prefix "bool";
+
+ organization "ON-LAB";
+
+ description "This module defines for bool classifier.";
+
+ revision "2016-05-24" {
+ description "Initial revision.";
+ }
+
+ list booleanList {
+ key boolean;
+ leaf boolean {
+ type boolean;
+ }
+ }
+}
\ No newline at end of file
diff --git a/apps/yms/app/src/test/resources/ydtTestYangFiles/customssupervisor.yang b/apps/yms/app/src/test/resources/ydtTestYangFiles/customssupervisor.yang
new file mode 100644
index 0000000..73aa806
--- /dev/null
+++ b/apps/yms/app/src/test/resources/ydtTestYangFiles/customssupervisor.yang
@@ -0,0 +1,21 @@
+module customssupervisor {
+
+ yang-version 1;
+
+ namespace "ydt.customs-supervisor";
+
+ prefix "customs";
+
+ organization "ON-LAB";
+
+ description "This module defines for customs-supervisor.";
+
+ revision "2016-05-24" {
+ description "Initial revision.";
+ }
+
+ leaf supervisor {
+ type string;
+ description "name of the customs-supervisor.";
+ }
+}
\ No newline at end of file
diff --git a/apps/yms/app/src/test/resources/ydtTestYangFiles/decimal64.yang b/apps/yms/app/src/test/resources/ydtTestYangFiles/decimal64.yang
new file mode 100644
index 0000000..6470e8a
--- /dev/null
+++ b/apps/yms/app/src/test/resources/ydtTestYangFiles/decimal64.yang
@@ -0,0 +1,90 @@
+module decimal64 {
+
+ yang-version 1;
+
+ namespace "ydt.decimal64";
+
+ prefix "decimal64";
+
+ organization "ON-LAB";
+
+ description "This module defines for decimal64 classifier.";
+
+ revision "2016-05-24" {
+ description "Initial revision.";
+ }
+ leaf negInt {
+ type decimal64 {
+ fraction-digits 2;
+ }
+ }
+
+ leaf negIntWithMaxFraction {
+ type decimal64 {
+ fraction-digits 18;
+ }
+ }
+
+ leaf negIntWithMinFraction {
+ type decimal64 {
+ fraction-digits 1;
+ }
+ }
+
+ leaf posInt {
+ type decimal64 {
+ fraction-digits 2;
+ }
+ }
+
+ leaf posIntWithMaxFraction {
+ type decimal64 {
+ fraction-digits 18;
+ }
+
+ }
+
+ leaf posIntWithMinFraction {
+ type decimal64 {
+ fraction-digits 1;
+ }
+
+ }
+
+ leaf minIntWithRange {
+ type decimal64 {
+ fraction-digits 2;
+ range "10 .. 100";
+ }
+ }
+
+ leaf midIntWithRange {
+ type decimal64 {
+ fraction-digits 2;
+ range "10 .. 100";
+ }
+ }
+
+ leaf maxIntWithRange {
+ type decimal64 {
+ fraction-digits 2;
+ range "10 .. 100";
+ }
+ }
+
+ list multiRangeValidation {
+ config false;
+ leaf decimal {
+ type decimal64 {
+ fraction-digits 2;
+ range "10..40 | 50..100";
+ }
+ }
+ leaf revDecimal {
+ type decimal64 {
+ fraction-digits 2;
+ range "min .. 3.14 | 10 | 20..max";
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/apps/yms/app/src/test/resources/ydtTestYangFiles/employeeid.yang b/apps/yms/app/src/test/resources/ydtTestYangFiles/employeeid.yang
new file mode 100644
index 0000000..be27c70
--- /dev/null
+++ b/apps/yms/app/src/test/resources/ydtTestYangFiles/employeeid.yang
@@ -0,0 +1,21 @@
+module employeeid {
+
+ yang-version 1;
+
+ namespace "ydt.employee-id";
+
+ prefix "id";
+
+ organization "ON-LAB";
+
+ description "This module defines for employee-id.";
+
+ revision "2016-05-24" {
+ description "Initial revision.";
+ }
+
+ leaf-list employeeid {
+ type string;
+ description "list of the employee id";
+ }
+}
\ No newline at end of file
diff --git a/apps/yms/app/src/test/resources/ydtTestYangFiles/emptydata.yang b/apps/yms/app/src/test/resources/ydtTestYangFiles/emptydata.yang
new file mode 100644
index 0000000..33f58b3
--- /dev/null
+++ b/apps/yms/app/src/test/resources/ydtTestYangFiles/emptydata.yang
@@ -0,0 +1,23 @@
+module emptydata {
+
+ yang-version 1;
+
+ namespace "ydt.emptydata";
+
+ prefix "emptydata";
+
+ organization "ON-LAB";
+
+ description "This module defines for emptydata classifier.";
+
+ revision "2016-05-24" {
+ description "Initial revision.";
+ }
+
+ list emptyList {
+ config false;
+ leaf empty {
+ type empty;
+ }
+ }
+}
\ No newline at end of file
diff --git a/apps/yms/app/src/test/resources/ydtTestYangFiles/enumtest.yang b/apps/yms/app/src/test/resources/ydtTestYangFiles/enumtest.yang
new file mode 100644
index 0000000..a9255c5
--- /dev/null
+++ b/apps/yms/app/src/test/resources/ydtTestYangFiles/enumtest.yang
@@ -0,0 +1,27 @@
+module enumtest {
+
+ yang-version 1;
+
+ namespace "ydt.enumtest";
+
+ prefix "enumtest";
+
+ organization "ON-LAB";
+
+ description "This module defines for enumtest classifier.";
+
+ revision "2016-05-24" {
+ description "Initial revision.";
+ }
+
+ list enumList {
+ key enumleaf;
+ leaf enumleaf {
+ type enumeration {
+ enum ten { value "10";}
+ enum hundred { value "100";}
+ enum thousand { value "1000"; }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/apps/yms/app/src/test/resources/ydtTestYangFiles/food.yang b/apps/yms/app/src/test/resources/ydtTestYangFiles/food.yang
new file mode 100644
index 0000000..202d11f
--- /dev/null
+++ b/apps/yms/app/src/test/resources/ydtTestYangFiles/food.yang
@@ -0,0 +1,39 @@
+module food {
+
+ yang-version 1;
+
+ namespace "ydt.food";
+
+ prefix "foodType";
+
+ organization "ON-LAB";
+
+ description "This module defines for food.";
+
+ revision "2016-06-24" {
+ description "Initial revision.";
+ }
+
+ container food {
+ choice snack {
+ case sportsarena {
+
+ leaf pretzel {
+ type empty;
+ }
+ leaf beer {
+ type empty;
+ }
+ }
+ case latenight {
+ leaf chocolate {
+ type enumeration {
+ enum dark;
+ enum milk;
+ enum first-available;
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/apps/yms/app/src/test/resources/ydtTestYangFiles/ietf-inet-types.yang b/apps/yms/app/src/test/resources/ydtTestYangFiles/ietf-inet-types.yang
new file mode 100644
index 0000000..6b994bb
--- /dev/null
+++ b/apps/yms/app/src/test/resources/ydtTestYangFiles/ietf-inet-types.yang
@@ -0,0 +1,454 @@
+ module yms-ietf-inet-types {
+
+ yang-version 1;
+
+ namespace
+ "urn:ietf:params:xml:ns:yang:ietf-inet-types";
+
+ prefix inet;
+
+ organization
+ "IETF NETMOD (NETCONF Data Modeling Language) Working Group";
+
+ contact
+ "WG Web: <http://tools.ietf.org/wg/netmod/>
+ WG List: <mailto:netmod@ietf.org>
+
+ WG Chair: David Kessens
+ <mailto:david.kessens@nsn.com>
+
+ WG Chair: Juergen Schoenwaelder
+ <mailto:j.schoenwaelder@jacobs-university.de>
+
+ Editor: Juergen Schoenwaelder
+ <mailto:j.schoenwaelder@jacobs-university.de>";
+
+ description
+ "This module contains a collection of generally useful derived
+ YANG data types for Internet addresses and related things.
+
+ Copyright (c) 2013 IETF Trust and the persons identified as
+ authors of the code. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or
+ without modification, is permitted pursuant to, and subject
+ to the license terms contained in, the Simplified BSD License
+ set forth in Section 4.c of the IETF Trust's Legal Provisions
+ Relating to IETF Documents
+ (http://trustee.ietf.org/license-info).
+
+ This version of this YANG module is part of RFC 6991; see
+ the RFC itself for full legal notices.";
+
+ revision "2013-07-15" {
+ description
+ "This revision adds the following new data types:
+ - ip-address-no-zone
+ - ipv4-address-no-zone
+ - ipv6-address-no-zone";
+ reference
+ "RFC 6991: Common YANG Data Types";
+
+ }
+
+ revision "2010-09-24" {
+ description "Initial revision.";
+ reference
+ "RFC 6021: Common YANG Data Types";
+
+ }
+
+
+ typedef ip-version {
+ type enumeration {
+ enum "unknown" {
+ value 0;
+ description
+ "An unknown or unspecified version of the Internet
+ protocol.";
+ }
+ enum "ipv4" {
+ value 1;
+ description
+ "The IPv4 protocol as defined in RFC 791.";
+ }
+ enum "ipv6" {
+ value 2;
+ description
+ "The IPv6 protocol as defined in RFC 2460.";
+ }
+ }
+ description
+ "This value represents the version of the IP protocol.
+
+ In the value set and its semantics, this type is equivalent
+ to the InetVersion textual convention of the SMIv2.";
+ reference
+ "RFC 791: Internet Protocol
+ RFC 2460: Internet Protocol, Version 6 (IPv6) Specification
+ RFC 4001: Textual Conventions for Internet Network Addresses";
+
+ }
+
+ typedef dscp {
+ type uint8 {
+ range "0..63";
+ }
+ description
+ "The dscp type represents a Differentiated Services Code Point
+ that may be used for marking packets in a traffic stream.
+ In the value set and its semantics, this type is equivalent
+ to the Dscp textual convention of the SMIv2.";
+ reference
+ "RFC 3289: Management Information Base for the Differentiated
+ Services Architecture
+ RFC 2474: Definition of the Differentiated Services Field
+ (DS Field) in the IPv4 and IPv6 Headers
+ RFC 2780: IANA Allocation Guidelines For Values In
+ the Internet Protocol and Related Headers";
+
+ }
+
+ typedef ipv6-flow-label {
+ type uint32 {
+ range "0..1048575";
+ }
+ description
+ "The ipv6-flow-label type represents the flow identifier or Flow
+ Label in an IPv6 packet header that may be used to
+ discriminate traffic flows.
+
+ In the value set and its semantics, this type is equivalent
+ to the IPv6FlowLabel textual convention of the SMIv2.";
+ reference
+ "RFC 3595: Textual Conventions for IPv6 Flow Label
+ RFC 2460: Internet Protocol, Version 6 (IPv6) Specification";
+
+ }
+
+ typedef port-number {
+ type uint16 {
+ range "0..65535";
+ }
+ description
+ "The port-number type represents a 16-bit port number of an
+ Internet transport-layer protocol such as UDP, TCP, DCCP, or
+ SCTP. Port numbers are assigned by IANA. A current list of
+ all assignments is available from <http://www.iana.org/>.
+
+ Note that the port number value zero is reserved by IANA. In
+ situations where the value zero does not make sense, it can
+ be excluded by subtyping the port-number type.
+ In the value set and its semantics, this type is equivalent
+ to the InetPortNumber textual convention of the SMIv2.";
+ reference
+ "RFC 768: User Datagram Protocol
+ RFC 793: Transmission Control Protocol
+ RFC 4960: Stream Control Transmission Protocol
+ RFC 4340: Datagram Congestion Control Protocol (DCCP)
+ RFC 4001: Textual Conventions for Internet Network Addresses";
+
+ }
+
+ typedef as-number {
+ type uint32;
+ description
+ "The as-number type represents autonomous system numbers
+ which identify an Autonomous System (AS). An AS is a set
+ of routers under a single technical administration, using
+ an interior gateway protocol and common metrics to route
+ packets within the AS, and using an exterior gateway
+ protocol to route packets to other ASes. IANA maintains
+ the AS number space and has delegated large parts to the
+ regional registries.
+
+ Autonomous system numbers were originally limited to 16
+ bits. BGP extensions have enlarged the autonomous system
+ number space to 32 bits. This type therefore uses an uint32
+ base type without a range restriction in order to support
+ a larger autonomous system number space.
+
+ In the value set and its semantics, this type is equivalent
+ to the InetAutonomousSystemNumber textual convention of
+ the SMIv2.";
+ reference
+ "RFC 1930: Guidelines for creation, selection, and registration
+ of an Autonomous System (AS)
+ RFC 4271: A Border Gateway Protocol 4 (BGP-4)
+ RFC 4001: Textual Conventions for Internet Network Addresses
+ RFC 6793: BGP Support for Four-Octet Autonomous System (AS)
+ Number Space";
+
+ }
+
+ typedef ip-address {
+ type union {
+ type ipv4-address;
+ type ipv6-address;
+ }
+ description
+ "The ip-address type represents an IP address and is IP
+ version neutral. The format of the textual representation
+ implies the IP version. This type supports scoped addresses
+ by allowing zone identifiers in the address format.";
+ reference
+ "RFC 4007: IPv6 Scoped Address Architecture";
+
+ }
+
+ typedef ipv4-address {
+ type string {
+ pattern
+ '(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(%[\p{N}\p{L}]+)?';
+ }
+ description
+ "The ipv4-address type represents an IPv4 address in
+ dotted-quad notation. The IPv4 address may include a zone
+ index, separated by a % sign.
+
+ The zone index is used to disambiguate identical address
+ values. For link-local addresses, the zone index will
+ typically be the interface index number or the name of an
+ interface. If the zone index is not present, the default
+ zone of the device will be used.
+
+ The canonical format for the zone index is the numerical
+ format";
+ }
+
+ typedef ipv6-address {
+ type string {
+ pattern
+ '((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))(%[\p{N}\p{L}]+)?';
+ pattern
+ '(([^:]+:){6}(([^:]+:[^:]+)|(.*\..*)))|((([^:]+:)*[^:]+)?::(([^:]+:)*[^:]+)?)(%.+)?';
+ }
+ description
+ "The ipv6-address type represents an IPv6 address in full,
+ mixed, shortened, and shortened-mixed notation. The IPv6
+ address may include a zone index, separated by a % sign.
+
+ The zone index is used to disambiguate identical address
+ values. For link-local addresses, the zone index will
+ typically be the interface index number or the name of an
+ interface. If the zone index is not present, the default
+ zone of the device will be used.
+
+
+
+ The canonical format of IPv6 addresses uses the textual
+ representation defined in Section 4 of RFC 5952. The
+ canonical format for the zone index is the numerical
+ format as described in Section 11.2 of RFC 4007.";
+ reference
+ "RFC 4291: IP Version 6 Addressing Architecture
+ RFC 4007: IPv6 Scoped Address Architecture
+ RFC 5952: A Recommendation for IPv6 Address Text
+ Representation";
+
+ }
+
+ typedef ip-address-no-zone {
+ type union {
+ type ipv4-address-no-zone;
+ type ipv6-address-no-zone;
+ }
+ description
+ "The ip-address-no-zone type represents an IP address and is
+ IP version neutral. The format of the textual representation
+ implies the IP version. This type does not support scoped
+ addresses since it does not allow zone identifiers in the
+ address format.";
+ reference
+ "RFC 4007: IPv6 Scoped Address Architecture";
+
+ }
+
+ typedef ipv4-address-no-zone {
+ type ipv4-address {
+ pattern '[0-9\.]*';
+ }
+ description
+ "An IPv4 address without a zone index. This type, derived from
+ ipv4-address, may be used in situations where the zone is
+ known from the context and hence no zone index is needed.";
+ }
+
+ typedef ipv6-address-no-zone {
+ type ipv6-address {
+ pattern '[0-9a-fA-F:\.]*';
+ }
+ description
+ "An IPv6 address without a zone index. This type, derived from
+ ipv6-address, may be used in situations where the zone is
+ known from the context and hence no zone index is needed.";
+ reference
+ "RFC 4291: IP Version 6 Addressing Architecture
+ RFC 4007: IPv6 Scoped Address Architecture
+ RFC 5952: A Recommendation for IPv6 Address Text
+ Representation";
+
+ }
+
+ typedef ip-prefix {
+ type union {
+ type ipv4-prefix;
+ type ipv6-prefix;
+ }
+ description
+ "The ip-prefix type represents an IP prefix and is IP
+ version neutral. The format of the textual representations
+ implies the IP version.";
+ }
+
+ typedef ipv4-prefix {
+ type string {
+ pattern
+ '(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])/(([0-9])|([1-2][0-9])|(3[0-2]))';
+ }
+ description
+ "The ipv4-prefix type represents an IPv4 address prefix.
+ The prefix length is given by the number following the
+ slash character and must be less than or equal to 32.
+
+ A prefix length value of n corresponds to an IP address
+ mask that has n contiguous 1-bits from the most
+ significant bit (MSB) and all other bits set to 0.
+
+ The canonical format of an IPv4 prefix has all bits of
+ the IPv4 address set to zero that are not part of the
+ IPv4 prefix.";
+ }
+
+ typedef ipv6-prefix {
+ type string {
+ pattern
+ '((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))(/(([0-9])|([0-9]{2})|(1[0-1][0-9])|(12[0-8])))';
+ pattern
+ '(([^:]+:){6}(([^:]+:[^:]+)|(.*\..*)))|((([^:]+:)*[^:]+)?::(([^:]+:)*[^:]+)?)(/.+)';
+ }
+ description
+ "The ipv6-prefix type represents an IPv6 address prefix.
+ The prefix length is given by the number following the
+ slash character and must be less than or equal to 128.
+
+ A prefix length value of n corresponds to an IP address
+ mask that has n contiguous 1-bits from the most
+ significant bit (MSB) and all other bits set to 0.
+
+ The IPv6 address should have all bits that do not belong
+ to the prefix set to zero.
+
+ The canonical format of an IPv6 prefix has all bits of
+ the IPv6 address set to zero that are not part of the
+ IPv6 prefix. Furthermore, the IPv6 address is represented
+ as defined in Section 4 of RFC 5952.";
+ reference
+ "RFC 5952: A Recommendation for IPv6 Address Text
+ Representation";
+
+ }
+
+ typedef domain-name {
+ type string {
+ length "1..253";
+ pattern
+ '((([a-zA-Z0-9_]([a-zA-Z0-9\-_]){0,61})?[a-zA-Z0-9]\.)*([a-zA-Z0-9_]([a-zA-Z0-9\-_]){0,61})?[a-zA-Z0-9]\.?)|\.';
+ }
+ description
+ "The domain-name type represents a DNS domain name. The
+ name SHOULD be fully qualified whenever possible.
+
+ Internet domain names are only loosely specified. Section
+ 3.5 of RFC 1034 recommends a syntax (modified in Section
+ 2.1 of RFC 1123). The pattern above is intended to allow
+ for current practice in domain name use, and some possible
+ future expansion. It is designed to hold various types of
+ domain names, including names used for A or AAAA records
+ (host names) and other records, such as SRV records. Note
+ that Internet host names have a stricter syntax (described
+ in RFC 952) than the DNS recommendations in RFCs 1034 and
+ 1123, and that systems that want to store host names in
+ schema nodes using the domain-name type are recommended to
+ adhere to this stricter standard to ensure interoperability.
+
+ The encoding of DNS names in the DNS protocol is limited
+ to 255 characters. Since the encoding consists of labels
+ prefixed by a length bytes and there is a trailing NULL
+ byte, only 253 characters can appear in the textual dotted
+ notation.
+
+ The description clause of schema nodes using the domain-name
+ type MUST describe when and how these names are resolved to
+ IP addresses. Note that the resolution of a domain-name value
+ may require to query multiple DNS records (e.g., A for IPv4
+ and AAAA for IPv6). The order of the resolution process and
+ which DNS record takes precedence can either be defined
+ explicitly or may depend on the configuration of the
+ resolver.
+
+ Domain-name values use the US-ASCII encoding. Their canonical
+ format uses lowercase US-ASCII characters. Internationalized
+ domain names MUST be A-labels as per RFC 5890.";
+ reference
+ "RFC 952: DoD Internet Host Table Specification
+ RFC 1034: Domain Names - Concepts and Facilities
+ RFC 1123: Requirements for Internet Hosts -- Application
+ and Support
+ RFC 2782: A DNS RR for specifying the location of services
+ (DNS SRV)
+ RFC 5890: Internationalized Domain Names in Applications
+ (IDNA): Definitions and Document Framework";
+
+ }
+
+ typedef host {
+ type union {
+ type ip-address;
+ type domain-name;
+ }
+ description
+ "The host type represents either an IP address or a DNS
+ domain name.";
+ }
+
+ typedef uri {
+ type string;
+ description
+ "The uri type represents a Uniform Resource Identifier
+ (URI) as defined by STD 66.
+
+ Objects using the uri type MUST be in US-ASCII encoding,
+ and MUST be normalized as described by RFC 3986 Sections
+ 6.2.1, 6.2.2.1, and 6.2.2.2. All unnecessary
+ percent-encoding is removed, and all case-insensitive
+ characters are set to lowercase except for hexadecimal
+ digits, which are normalized to uppercase as described in
+ Section 6.2.2.1.
+
+ The purpose of this normalization is to help provide
+ unique URIs. Note that this normalization is not
+ sufficient to provide uniqueness. Two URIs that are
+ textually distinct after this normalization may still be
+ equivalent.
+
+ Objects using the uri type may restrict the schemes that
+ they permit. For example, 'data:' and 'urn:' schemes
+ might not be appropriate.
+
+ A zero-length URI is not a valid URI. This can be used to
+ express 'URI absent' where required.
+
+ In the value set and its semantics, this type is equivalent
+ to the Uri SMIv2 textual convention defined in RFC 5017.";
+ reference
+ "RFC 3986: Uniform Resource Identifier (URI): Generic Syntax
+ RFC 3305: Report from the Joint W3C/IETF URI Planning Interest
+ Group: Uniform Resource Identifiers (URIs), URLs,
+ and Uniform Resource Names (URNs): Clarifications
+ and Recommendations
+ RFC 5017: MIB Textual Conventions for Uniform Resource
+ Identifiers (URIs)";
+
+ }
+ } // module ietf-inet-types
diff --git a/apps/yms/app/src/test/resources/ydtTestYangFiles/ietf-network.yang b/apps/yms/app/src/test/resources/ydtTestYangFiles/ietf-network.yang
new file mode 100644
index 0000000..b56f6cf
--- /dev/null
+++ b/apps/yms/app/src/test/resources/ydtTestYangFiles/ietf-network.yang
@@ -0,0 +1,216 @@
+ module yms-ietf-network {
+ yang-version 1;
+ namespace "urn:ietf:params:xml:ns:yang:ietf-network";
+ prefix nd;
+
+ import yms-ietf-inet-types {
+ prefix inet;
+ }
+
+ organization
+ "IETF I2RS (Interface to the Routing System) Working Group";
+
+ contact
+ "WG Web: <http://tools.ietf.org/wg/i2rs/>
+ WG List: <mailto:i2rs@ietf.org>
+
+ WG Chair: Susan Hares
+ <mailto:shares@ndzh.com>
+
+ WG Chair: Jeffrey Haas
+ <mailto:jhaas@pfrc.org>
+
+ Editor: Alexander Clemm
+ <mailto:alex@cisco.com>
+
+ Editor: Jan Medved
+ <mailto:jmedved@cisco.com>
+
+ Editor: Robert Varga
+ <mailto:rovarga@cisco.com>
+
+ Editor: Tony Tkacik
+ <mailto:ttkacik@cisco.com>
+
+ Editor: Nitin Bahadur
+ <mailto:nitin_bahadur@yahoo.com>
+
+ Editor: Hariharan Ananthakrishnan
+ <mailto:hari@packetdesign.com>";
+
+ description
+ "This module defines a common base model for a collection
+ of nodes in a network. Node definitions are further used
+ in network topologies and inventories.
+
+ Copyright (c) 2015 IETF Trust and the persons identified as
+ authors of the code. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or
+ without modification, is permitted pursuant to, and subject
+ to the license terms contained in, the Simplified BSD License
+ set forth in Section 4.c of the IETF Trust's Legal Provisions
+ Relating to IETF Documents
+ (http://trustee.ietf.org/license-info).
+
+ This version of this YANG module is part of
+ draft-ietf-i2rs-yang-network-topo-02;
+ see the RFC itself for full legal notices.
+
+ NOTE TO RFC EDITOR: Please replace above reference to
+ draft-ietf-i2rs-yang-network-topo-02 with RFC
+ number when published (i.e. RFC xxxx).";
+
+ revision 2015-12-08 {
+ description
+ "Initial revision.
+ NOTE TO RFC EDITOR: Please replace the following reference
+ to draft-ietf-i2rs-yang-network-topo-02 with
+ RFC number when published (i.e. RFC xxxx).";
+ reference
+ "draft-ietf-i2rs-yang-network-topo-02";
+ }
+
+ typedef node-id {
+ type inet:uri;
+ description
+ "Identifier for a node.";
+ }
+
+ typedef network-id {
+ type inet:uri;
+ description
+ "Identifier for a network.";
+ }
+ grouping network-ref {
+ description
+ "Contains the information necessary to reference a network,
+ for example an underlay network.";
+ leaf network-ref {
+ type leafref {
+ path "/nd:networks/nd:network/nd:network-id";
+ require-instance false;
+ }
+ description
+ "Used to reference a network, for example an underlay
+ network.";
+ }
+ }
+
+ grouping node-ref {
+ description
+ "Contains the information necessary to reference a node.";
+ leaf node-ref {
+ type leafref {
+ path "/nd:networks/nd:network[nd:network-id=current()/../"+
+ "network-ref]/nd:node/nd:node-id";
+ require-instance false;
+ }
+ description
+ "Used to reference a node.
+ Nodes are identified relative to the network they are
+ contained in.";
+ }
+ uses network-ref;
+ }
+
+ container networks {
+ description
+ "Serves as top-level container for a list of networks.";
+ list network {
+ key "network-id";
+ description
+ "Describes a network.
+ A network typically contains an inventory of nodes,
+ topological information (augmented through
+ network-topology model), as well as layering
+ information.";
+ container network-types {
+ description
+ "Serves as an augmentation target.
+ The network type is indicated through corresponding
+ presence containers augmented into this container.";
+ }
+ leaf network-id {
+ type inet:uri;
+ description
+ "Identifies a network.";
+ }
+ list supporting-network {
+ key "network-ref";
+ description
+ "An underlay network, used to represent layered network
+ topologies.";
+ leaf network-ref {
+ type leafref {
+ path "/networks/network/network-id";
+ require-instance false;
+ }
+ description
+ "References the underlay network.";
+ }
+ }
+ list node {
+ key "node-id";
+ description
+ "The inventory of nodes of this network.";
+ leaf node-id {
+ type node-id;
+ description
+ "Identifies a node uniquely within the containing
+ network.";
+ }
+ list supporting-node {
+ key "network-ref node-ref";
+ description
+ "Represents another node, in an underlay network, that
+ this node is supported by. Used to represent layering
+ structure.";
+ leaf network-ref {
+ type leafref {
+ path "../../../supporting-network/network-ref";
+ require-instance false;
+ }
+ description
+ "References the underlay network that the
+ underlay node is part of.";
+ }
+ leaf node-ref {
+ type leafref {
+ path "/networks/network/node/node-id";
+ require-instance false;
+ }
+ description
+ "References the underlay node itself.";
+ }
+ }
+ }
+ }
+ }
+ container networks-state {
+ config false;
+ description
+ "Serves as top-level container for a list of state information
+ for networks";
+ list network {
+ key "network-ref";
+ description
+ "Data nodes representing operational data and state of
+ networks.
+ An instance is automatically created for every network
+ in the corresponding list under the networks container.";
+ uses network-ref;
+ leaf server-provided {
+ type boolean;
+ description
+ "Indicates whether the information concerning this
+ particular network is populated by the server
+ (server-provided true, the general case for network
+ information discovered from the server),
+ or whether it is configured by a client
+ (server-provided true, possible e.g. for
+ service overlays managed through a controller).";
+ }
+ }
+ }
+ }
diff --git a/apps/yms/app/src/test/resources/ydtTestYangFiles/integer16.yang b/apps/yms/app/src/test/resources/ydtTestYangFiles/integer16.yang
new file mode 100644
index 0000000..8db77be
--- /dev/null
+++ b/apps/yms/app/src/test/resources/ydtTestYangFiles/integer16.yang
@@ -0,0 +1,98 @@
+module integer16 {
+
+ yang-version 1;
+
+ namespace "ydt.integer16";
+
+ prefix "integer16";
+
+ organization "ON-LAB";
+
+ description "This module defines for integer16 classifier.";
+
+ revision "2016-05-24" {
+ description "Initial revision.";
+ }
+
+ list multiRangeValidation {
+ config false;
+ leaf integer {
+ type int16 {
+ range "10..40 | 50..100";
+ }
+ }
+ leaf UnInteger {
+ type uint16 {
+ range "10..40 | 50..100";
+ }
+ }
+
+ leaf revInteger {
+ type int16 {
+ range "min .. 2 | 10 | 20..max";
+ }
+ }
+
+ leaf revUnInteger {
+ type uint16 {
+ range "min .. 2 | 10 | 20..max";
+ }
+ }
+ }
+
+ leaf negInt {
+ type int16 {
+ }
+ }
+
+ leaf posInt {
+ type int16 {
+ }
+ }
+
+ leaf minIntWithRange {
+ type int16 {
+ range "10 .. 100";
+ }
+ }
+
+ leaf midIntWithRange {
+ type int16 {
+ range "10 .. 100";
+ }
+ }
+
+ leaf maxIntWithRange {
+ type int16 {
+ range "10 .. 100";
+ }
+ }
+
+ leaf minUInt {
+ type uint16 {
+ }
+ }
+
+ leaf maxUInt {
+ type uint16 {
+ }
+ }
+
+ leaf minUIntWithRange {
+ type uint16 {
+ range "10 .. 100";
+ }
+ }
+
+ leaf midUIntWithRange {
+ type uint16 {
+ range "10 .. 100";
+ }
+ }
+
+ leaf maxUIntWithRange {
+ type uint16 {
+ range "10 .. 100";
+ }
+ }
+}
diff --git a/apps/yms/app/src/test/resources/ydtTestYangFiles/integer32.yang b/apps/yms/app/src/test/resources/ydtTestYangFiles/integer32.yang
new file mode 100644
index 0000000..fb596cf
--- /dev/null
+++ b/apps/yms/app/src/test/resources/ydtTestYangFiles/integer32.yang
@@ -0,0 +1,98 @@
+module integer32 {
+
+ yang-version 1;
+
+ namespace "ydt.integer32";
+
+ prefix "integer32";
+
+ organization "ON-LAB";
+
+ description "This module defines for integer32 classifier.";
+
+ revision "2016-05-24" {
+ description "Initial revision.";
+ }
+
+ list multiRangeValidation {
+ config false;
+ leaf integer {
+ type int32 {
+ range "10..40 | 50..100";
+ }
+ }
+ leaf UnInteger {
+ type uint32 {
+ range "10..40 | 50..100";
+ }
+ }
+
+ leaf revInteger {
+ type int32 {
+ range "min .. 2 | 10 | 20..max";
+ }
+ }
+
+ leaf revUnInteger {
+ type uint32 {
+ range "min .. 2 | 10 | 20..max";
+ }
+ }
+ }
+
+ leaf negInt {
+ type int32 {
+ }
+ }
+
+ leaf posInt {
+ type int32 {
+ }
+ }
+
+ leaf minIntWithRange {
+ type int32 {
+ range "10 .. 100";
+ }
+ }
+
+ leaf midIntWithRange {
+ type int32 {
+ range "10 .. 100";
+ }
+ }
+
+ leaf maxIntWithRange {
+ type int32 {
+ range "10 .. 100";
+ }
+ }
+
+ leaf minUInt {
+ type uint32 {
+ }
+ }
+
+ leaf maxUInt {
+ type uint32 {
+ }
+ }
+
+ leaf minUIntWithRange {
+ type uint32 {
+ range "10 .. 100";
+ }
+ }
+
+ leaf midUIntWithRange {
+ type uint32 {
+ range "10 .. 100";
+ }
+ }
+
+ leaf maxUIntWithRange {
+ type uint32 {
+ range "10 .. 100";
+ }
+ }
+}
diff --git a/apps/yms/app/src/test/resources/ydtTestYangFiles/integer64.yang b/apps/yms/app/src/test/resources/ydtTestYangFiles/integer64.yang
new file mode 100644
index 0000000..39479c6
--- /dev/null
+++ b/apps/yms/app/src/test/resources/ydtTestYangFiles/integer64.yang
@@ -0,0 +1,98 @@
+module integer64 {
+
+ yang-version 1;
+
+ namespace "ydt.integer64";
+
+ prefix "integer64";
+
+ organization "ON-LAB";
+
+ description "This module defines for integer64 classifier.";
+
+ revision "2016-05-24" {
+ description "Initial revision.";
+ }
+
+ list multiRangeValidation {
+ config false;
+ leaf integer {
+ type int64 {
+ range "10..40 | 50..100";
+ }
+ }
+ leaf UnInteger {
+ type uint64 {
+ range "10..40 | 50..100";
+ }
+ }
+
+ leaf revInteger {
+ type int64 {
+ range "min .. 2 | 10 | 20..max";
+ }
+ }
+
+ leaf revUnInteger {
+ type uint64 {
+ range "min .. 2 | 10 | 20..max";
+ }
+ }
+ }
+
+ leaf negInt {
+ type int64 {
+ }
+ }
+
+ leaf posInt {
+ type int64 {
+ }
+ }
+
+ leaf minIntWithRange {
+ type int64 {
+ range "10 .. 100";
+ }
+ }
+
+ leaf midIntWithRange {
+ type int64 {
+ range "10 .. 100";
+ }
+ }
+
+ leaf maxIntWithRange {
+ type int64 {
+ range "10 .. 100";
+ }
+ }
+
+ leaf minUInt {
+ type uint64 {
+ }
+ }
+
+ leaf maxUInt {
+ type uint64 {
+ }
+ }
+
+ leaf minUIntWithRange {
+ type uint64 {
+ range "10 .. 100";
+ }
+ }
+
+ leaf midUIntWithRange {
+ type uint64 {
+ range "10 .. 100";
+ }
+ }
+
+ leaf maxUIntWithRange {
+ type uint64 {
+ range "10 .. 100";
+ }
+ }
+}
diff --git a/apps/yms/app/src/test/resources/ydtTestYangFiles/integer8.yang b/apps/yms/app/src/test/resources/ydtTestYangFiles/integer8.yang
new file mode 100644
index 0000000..e05c235
--- /dev/null
+++ b/apps/yms/app/src/test/resources/ydtTestYangFiles/integer8.yang
@@ -0,0 +1,99 @@
+module integer8 {
+
+ yang-version 1;
+
+ namespace "ydt.integer8";
+
+ prefix "integer8";
+
+ organization "ON-LAB";
+
+ description "This module defines for integer8 classifier.";
+
+ revision "2016-05-24" {
+ description "Initial revision.";
+ }
+
+ list multiRangeValidation {
+ config false;
+ leaf integer {
+ type int8 {
+ range "10..40 | 50..100";
+ }
+ }
+ leaf UnInteger {
+ type uint8 {
+ range "10..40 | 50..100";
+ }
+ }
+
+ leaf revInteger {
+ type int8 {
+ range "min .. 2 | 10 | 20..max";
+ }
+ }
+
+ leaf revUnInteger {
+ type uint8 {
+ range "min .. 2 | 10 | 20..max";
+ }
+ }
+ }
+
+
+ leaf negInt {
+ type int8 {
+ }
+ }
+
+ leaf posInt {
+ type int8 {
+ }
+ }
+
+ leaf minIntWithRange {
+ type int8 {
+ range "10 .. 100";
+ }
+ }
+
+ leaf midIntWithRange {
+ type int8 {
+ range "10 .. 100";
+ }
+ }
+
+ leaf maxIntWithRange {
+ type int8 {
+ range "10 .. 100";
+ }
+ }
+
+ leaf minUInt {
+ type uint8 {
+ }
+ }
+
+ leaf maxUInt {
+ type uint8 {
+ }
+ }
+
+ leaf minUIntWithRange {
+ type uint8 {
+ range "10 .. 100";
+ }
+ }
+
+ leaf midUIntWithRange {
+ type uint8 {
+ range "10 .. 100";
+ }
+ }
+
+ leaf maxUIntWithRange {
+ type uint8 {
+ range "10 .. 100";
+ }
+ }
+}
\ No newline at end of file
diff --git a/apps/yms/app/src/test/resources/ydtTestYangFiles/logisticsmanager.yang b/apps/yms/app/src/test/resources/ydtTestYangFiles/logisticsmanager.yang
new file mode 100644
index 0000000..7198611
--- /dev/null
+++ b/apps/yms/app/src/test/resources/ydtTestYangFiles/logisticsmanager.yang
@@ -0,0 +1,16 @@
+module logisticsmanager {
+
+ yang-version 1;
+
+ namespace "ydt.logistics-manager";
+
+ prefix "root";
+
+ organization "ON-LAB";
+
+ description "This module defines for logistics-manager.";
+
+ revision "2016-05-24" {
+ description "Initial revision.";
+ }
+}
\ No newline at end of file
diff --git a/apps/yms/app/src/test/resources/ydtTestYangFiles/materialsupervisor.yang b/apps/yms/app/src/test/resources/ydtTestYangFiles/materialsupervisor.yang
new file mode 100644
index 0000000..6ab16ea
--- /dev/null
+++ b/apps/yms/app/src/test/resources/ydtTestYangFiles/materialsupervisor.yang
@@ -0,0 +1,29 @@
+module materialsupervisor {
+
+ yang-version 1;
+
+ namespace "ydt.material-supervisor";
+
+ prefix "material";
+
+ organization "ON-LAB";
+
+ description "This module defines for material-supervisor.";
+
+ revision "2016-05-24" {
+ description "Initial revision.";
+ }
+
+ list supervisor {
+ key "name";
+ leaf name {
+ type string;
+ description "name of material-supervisor";
+ }
+
+ leaf departmentId {
+ type string;
+ description "name of department";
+ }
+ }
+}
\ No newline at end of file
diff --git a/apps/yms/app/src/test/resources/ydtTestYangFiles/merchandisersupervisor.yang b/apps/yms/app/src/test/resources/ydtTestYangFiles/merchandisersupervisor.yang
new file mode 100644
index 0000000..db40c7e
--- /dev/null
+++ b/apps/yms/app/src/test/resources/ydtTestYangFiles/merchandisersupervisor.yang
@@ -0,0 +1,21 @@
+module merchandisersupervisor {
+
+ yang-version 1;
+
+ namespace "ydt.Merchandiser-supervisor";
+
+ prefix "merchandiser";
+
+ organization "ON-LAB";
+
+ description "This module defines for Merchandiser-supervisor.";
+
+ revision "2016-05-24" {
+ description "Initial revision.";
+ }
+
+ leaf supervisor {
+ type string;
+ description "name of the Merchandiser-supervisor.";
+ }
+}
\ No newline at end of file
diff --git a/apps/yms/app/src/test/resources/ydtTestYangFiles/purchasingsupervisor.yang b/apps/yms/app/src/test/resources/ydtTestYangFiles/purchasingsupervisor.yang
new file mode 100644
index 0000000..a52b4c5
--- /dev/null
+++ b/apps/yms/app/src/test/resources/ydtTestYangFiles/purchasingsupervisor.yang
@@ -0,0 +1,27 @@
+module purchasingsupervisor {
+
+ yang-version 1;
+
+ namespace "ydt.purchasing-supervisor";
+
+ prefix "purchasing";
+
+ organization "ON-LAB";
+
+ description "This module defines for purchasing-supervisor.";
+
+ revision "2016-05-24" {
+ description "Initial revision.";
+ }
+
+ container supervisor {
+ leaf purchasing-specialist {
+ type string;
+ description "name of the purchasing-specialist person";
+ }
+ leaf support {
+ type string;
+ description "name of the support person";
+ }
+ }
+}
\ No newline at end of file
diff --git a/apps/yms/app/src/test/resources/ydtTestYangFiles/rootlist.yang b/apps/yms/app/src/test/resources/ydtTestYangFiles/rootlist.yang
new file mode 100644
index 0000000..ef5a0a0
--- /dev/null
+++ b/apps/yms/app/src/test/resources/ydtTestYangFiles/rootlist.yang
@@ -0,0 +1,111 @@
+module rootlist {
+
+ yang-version 1;
+
+ namespace "ydt.rootlist";
+
+ prefix "rootlist";
+
+ organization "ON-LAB";
+
+ description "This submodule defines for root.";
+
+ revision "2016-06-24" {
+ description "Initial revision.";
+ }
+/*
+ +--------------+---------+-------------+
+ | substatement | section | cardinality |
+ +--------------+---------+-------------+
+ | anyxml | 7.10 | 0..n |
+ | choice | 7.9 | 0..n |
+ | config | 7.19.1 | 0..1 |
+ | container | 7.5 | 0..n |
+ | description | 7.19.3 | 0..1 |
+ | grouping | 7.11 | 0..n |
+ | if-feature | 7.18.2 | 0..n |
+ | key | 7.8.2 | 0..1 |
+ | leaf | 7.6 | 0..n |
+ | leaf-list | 7.7 | 0..n |
+ | list | 7.8 | 0..n |
+ | max-elements | 7.7.4 | 0..1 |
+ | min-elements | 7.7.3 | 0..1 |
+ | must | 7.5.3 | 0..n |
+ | ordered-by | 7.7.5 | 0..1 |
+ | reference | 7.19.4 | 0..1 |
+ | status | 7.19.2 | 0..1 |
+ | typedef | 7.3 | 0..n |
+ | unique | 7.8.3 | 0..n |
+ | uses | 7.12 | 0..n |
+ | when | 7.19.5 | 0..1 |
+ +--------------+---------+-------------+
+*/
+
+ list listwithoutcontainer {
+ key "invalidinterval";
+ min-elements 1; //-- comment
+ leaf invalidinterval {
+ type "uint16";
+ units "seconds";
+ description "Interval before a route is declared invalid";
+ config true;
+ mandatory true;
+ status current;
+ reference "RFC 6020";
+ }
+ }
+
+ list listwithcontainer {
+ key "invalid invalid1";
+ max-elements 3;
+ min-elements 1;
+ reference "list reference";
+ unique "invalid";
+ leaf-list invalidinterval {
+ type "uint16";
+ units "seconds";
+ description "Interval before a route is declared invalid";
+ config false;
+ status current;
+ reference "RFC 6020";
+ }
+
+ container interface {
+ leaf invalidinterval {
+ type "uint16";
+ units "seconds";
+ status current;
+ mandatory true;
+ reference "RFC 6020";
+ }
+
+ leaf invalid {
+ type "uint16";
+ units "seconds";
+ description "Interval before a route is declared invalid";
+ default "16";
+ status current;
+ reference "RFC 6020";
+ }
+
+ }
+
+ leaf invalid {
+ type "uint16";
+ units "seconds";
+ description "Interval before a route is declared invalid";
+ mandatory true;
+ status current;
+ reference "RFC 6020";
+ }
+
+ leaf invalid1 {
+ type "uint16";
+ units "seconds";
+ description "Interval before a route is declared invalid";
+ mandatory true;
+ status current;
+ reference "RFC 6020";
+ }
+ }
+}
diff --git a/apps/yms/app/src/test/resources/ydtTestYangFiles/tradingsupervisor.yang b/apps/yms/app/src/test/resources/ydtTestYangFiles/tradingsupervisor.yang
new file mode 100644
index 0000000..a6c8681
--- /dev/null
+++ b/apps/yms/app/src/test/resources/ydtTestYangFiles/tradingsupervisor.yang
@@ -0,0 +1,21 @@
+module tradingsupervisor {
+
+ yang-version 1;
+
+ namespace "ydt.trading-supervisor";
+
+ prefix "trading";
+
+ organization "ON-LAB";
+
+ description "This module defines for trading-supervisor.";
+
+ revision "2016-05-24" {
+ description "Initial revision.";
+ }
+
+ leaf supervisor {
+ type string;
+ description "name of the trading-supervisor";
+ }
+}
\ No newline at end of file
diff --git a/apps/yms/app/src/test/resources/ydtTestYangFiles/warehousesupervisor.yang b/apps/yms/app/src/test/resources/ydtTestYangFiles/warehousesupervisor.yang
new file mode 100644
index 0000000..5145824
--- /dev/null
+++ b/apps/yms/app/src/test/resources/ydtTestYangFiles/warehousesupervisor.yang
@@ -0,0 +1,21 @@
+module warehousesupervisor {
+
+ yang-version 1;
+
+ namespace "ydt.warehouse-supervisor";
+
+ prefix "warehouse";
+
+ organization "ON-LAB";
+
+ description "This module defines for warehouse-supervisor.";
+
+ revision "2016-05-24" {
+ description "Initial revision.";
+ }
+
+ leaf-list supervisor {
+ type string;
+ description "name of the warehouse-supervisor's";
+ }
+}
\ No newline at end of file
diff --git a/apps/yms/app/src/test/resources/ydtTestYangFiles/yms-network-topology.yang b/apps/yms/app/src/test/resources/ydtTestYangFiles/yms-network-topology.yang
new file mode 100644
index 0000000..6b9452c
--- /dev/null
+++ b/apps/yms/app/src/test/resources/ydtTestYangFiles/yms-network-topology.yang
@@ -0,0 +1,304 @@
+ module yms-network-topology {
+ yang-version 1;
+ namespace "urn:ietf:params:xml:ns:yang:ietf-network-topology";
+ prefix lnk;
+
+ import yms-ietf-inet-types {
+ prefix inet;
+ }
+ import yms-ietf-network {
+ prefix nd;
+ }
+
+ organization
+ "IETF I2RS (Interface to the Routing System) Working Group";
+
+ contact
+ "WG Web: <http://tools.ietf.org/wg/i2rs/>
+ WG List: <mailto:i2rs@ietf.org>
+
+ WG Chair: Susan Hares
+ <mailto:shares@ndzh.com>
+
+ WG Chair: Jeffrey Haas
+ <mailto:jhaas@pfrc.org>
+
+ Editor: Alexander Clemm
+ <mailto:alex@cisco.com>
+
+ Editor: Jan Medved
+ <mailto:jmedved@cisco.com>
+
+ Editor: Robert Varga
+ <mailto:rovarga@cisco.com>
+
+ Editor: Tony Tkacik
+ <mailto:ttkacik@cisco.com>
+
+ Editor: Nitin Bahadur
+ <mailto:nitin_bahadur@yahoo.com>
+
+ Editor: Hariharan Ananthakrishnan
+ <mailto:hari@packetdesign.com>";
+
+ description
+ "This module defines a common base model for network topology,
+ augmenting the base network model with links to connect nodes,
+ as well as termination points to terminate links on nodes.
+
+ Copyright (c) 2015 IETF Trust and the persons identified as
+ authors of the code. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or
+ without modification, is permitted pursuant to, and subject
+ to the license terms contained in, the Simplified BSD License
+ set forth in Section 4.c of the IETF Trust's Legal Provisions
+ Relating to IETF Documents
+ (http://trustee.ietf.org/license-info).
+
+ This version of this YANG module is part of
+ draft-ietf-i2rs-yang-network-topo-02;
+ see the RFC itself for full legal notices.
+
+ NOTE TO RFC EDITOR: Please replace above reference to
+ draft-ietf-i2rs-yang-network-topo-02 with RFC
+ number when published (i.e. RFC xxxx).";
+
+ revision 2015-12-08 {
+ description
+ "Initial revision.
+ NOTE TO RFC EDITOR: Please replace the following reference
+ to draft-ietf-i2rs-yang-network-topo-02 with
+ RFC number when published (i.e. RFC xxxx).";
+ reference
+ "draft-ietf-i2rs-yang-network-topo-02.";
+ }
+
+ typedef link-id {
+ type inet:uri;
+ description
+ "An identifier for a link in a topology.
+ The identifier SHOULD be chosen such that the same link in a
+ real network topology will always be identified through the
+ same identifier, even if the model is instantiated in
+ separate datastores. An implementation MAY choose to capture
+ semantics in the identifier, for example to indicate the type
+ of link and/or the type of topology that the link is a part
+ of.";
+ }
+
+ typedef tp-id {
+ type inet:uri;
+ description
+ "An identifier for termination points on a node.
+ The identifier SHOULD be chosen such that the same TP in a
+ real network topology will always be identified through the
+ same identifier, even if the model is instantiated in
+ separate datastores. An implementation MAY choose to capture
+ semantics in the identifier, for example to indicate the type
+ of TP and/or the type of node and topology that the TP is a
+ part of.";
+ }
+ grouping link-ref {
+ description
+ "References a link in a specific network.";
+ leaf link-ref {
+ type leafref {
+ path "/nd:networks/nd:network[nd:network-id=current()/../"+
+ "network-ref]/lnk:link/lnk:link-id";
+ require-instance false;
+ }
+ description
+ "A type for an absolute reference a link instance.
+ (This type should not be used for relative references.
+ In such a case, a relative path should be used instead.)";
+ }
+ uses nd:network-ref;
+ }
+
+ grouping tp-ref {
+ description
+ "References a termination point in a specific node.";
+ leaf tp-ref {
+ type leafref {
+ path "/nd:networks/nd:network[nd:network-id=current()/../"+
+ "network-ref]/nd:node[nd:node-id=current()/../"+
+ "node-ref]/lnk:termination-point/lnk:tp-id";
+ require-instance false;
+ }
+ description
+ "A type for an absolute reference to a termination point.
+ (This type should not be used for relative references.
+ In such a case, a relative path should be used instead.)";
+ }
+ uses nd:node-ref;
+ }
+
+ augment "/nd:networks/nd:network" {
+ description
+ "Add links to the network model.";
+ list link {
+ key "link-id";
+ description
+ "A Network Link connects a by Local (Source) node and
+ a Remote (Destination) Network Nodes via a set of the
+ nodes' termination points.
+ As it is possible to have several links between the same
+ source and destination nodes, and as a link could
+ potentially be re-homed between termination points, to
+ ensure that we would always know to distinguish between
+ links, every link is identified by a dedicated link
+ identifier.
+ Note that a link models a point-to-point link, not a
+ multipoint link.
+ Layering dependencies on links in underlay topologies are
+ not represented as the layering information of nodes and of
+ termination points is sufficient.";
+ container source {
+ description
+ "This container holds the logical source of a particular
+ link.";
+ leaf source-node {
+ type leafref {
+ path "../../../nd:node/nd:node-id";
+ }
+ mandatory true;
+ description
+ "Source node identifier, must be in same topology.";
+ }
+ leaf source-tp {
+ type leafref {
+ path "../../../nd:node[nd:node-id=current()/../"+
+ "source-node]/t-point/tp-id";
+ }
+ description
+ "Termination point within source node that terminates
+ the link.";
+ }
+ }
+ container destination {
+ description
+ "This container holds the logical destination of a
+ particular link.";
+ leaf dest-node {
+ type leafref {
+ path "../../../nd:node/nd:node-id";
+ }
+ mandatory true;
+ description
+ "Destination node identifier, must be in the same
+ network.";
+ }
+ leaf dest-tp {
+ type leafref {
+ path "../../../nd:node[nd:node-id=current()/../"+
+ "dest-node]/t-point/tp-id";
+ }
+ description
+ "Termination point within destination node that
+ terminates the link.";
+ }
+ }
+ leaf link-id {
+ type link-id;
+ description
+ "The identifier of a link in the topology.
+ A link is specific to a topology to which it belongs.";
+ }
+ list supporting-link {
+ key "network-ref link-ref";
+ description
+ "Identifies the link, or links, that this link
+ is dependent on.";
+ leaf network-ref {
+ type leafref {
+ path "../../../nd:supporting-network/nd:network-ref";
+ require-instance false;
+ }
+ description
+ "This leaf identifies in which underlay topology
+ supporting link is present.";
+ }
+ leaf link-ref {
+ type leafref {
+ path "/nd:networks/nd:network[nd:network-id=current()/"+
+ "../network-ref]/link/link-id";
+ require-instance false;
+ }
+ description
+ "This leaf identifies a link which is a part
+ of this link's underlay. Reference loops, in which
+ a link identifies itself as its underlay, either
+ directly or transitively, are not allowed.";
+ }
+ }
+ }
+
+ leaf link-id {
+ type link-id;
+ description
+ "The identifier of a link in the topology.
+ A link is specific to a topology to which it belongs.";
+ }
+ }
+ augment "/nd:networks/nd:network/nd:node" {
+ description
+ "Augment termination points which terminate links.
+ Termination points can ultimately be mapped to interfaces.";
+ list t-point {
+ key "tp-id";
+ description
+ "A termination point can terminate a link.
+ Depending on the type of topology, a termination point
+ could, for example, refer to a port or an interface.";
+ leaf tp-id {
+ type tp-id;
+ description
+ "Termination point identifier.";
+ }
+ list supporting-termination-point {
+ key "network-ref node-ref tp-ref";
+ description
+ "The leaf list identifies any termination points that
+ the termination point is dependent on, or maps onto.
+ Those termination points will themselves be contained
+ in a supporting node.
+ This dependency information can be inferred from
+ the dependencies between links. For this reason,
+ this item is not separately configurable. Hence no
+ corresponding constraint needs to be articulated.
+ The corresponding information is simply provided by the
+ implementing system.";
+ leaf network-ref {
+ type leafref {
+ path "../../../nd:supporting-node/nd:network-ref";
+ require-instance false;
+ }
+ description
+ "This leaf identifies in which topology the
+ supporting termination point is present.";
+ }
+ leaf node-ref {
+ type leafref {
+ path "../../../nd:supporting-node/nd:node-ref";
+ require-instance false;
+ }
+ description
+ "This leaf identifies in which node the supporting
+ termination point is present.";
+ }
+ leaf tp-ref {
+ type leafref {
+ path "/nd:networks/nd:network[nd:network-id=current()/"+
+ "../network-ref]/nd:node[nd:node-id=current()/../"+
+ "node-ref]/t-point/tp-id";
+ require-instance false;
+ }
+ description
+ "Reference to the underlay node, must be in a
+ different topology";
+ }
+ }
+ }
+ }
+ }