[ONOS-5081] YANG tree builder.
Change-Id: Id47015d0cec1a446efcae6c4f3e2ffe87a0f0e0e
diff --git a/apps/yms/app/src/main/java/org/onosproject/yms/app/ytb/DefaultYangTreeBuilder.java b/apps/yms/app/src/main/java/org/onosproject/yms/app/ytb/DefaultYangTreeBuilder.java
new file mode 100644
index 0000000..6f8df8e
--- /dev/null
+++ b/apps/yms/app/src/main/java/org/onosproject/yms/app/ytb/DefaultYangTreeBuilder.java
@@ -0,0 +1,122 @@
+/*
+ * 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.ytb;
+
+import org.onosproject.yms.app.ydt.YangRequestWorkBench;
+import org.onosproject.yms.app.ydt.YdtExtendedBuilder;
+import org.onosproject.yms.app.ydt.YdtExtendedContext;
+import org.onosproject.yms.app.ysr.YangSchemaRegistry;
+import org.onosproject.yms.ydt.YdtContext;
+import org.onosproject.yms.ydt.YmsOperationType;
+
+import java.util.List;
+
+import static org.onosproject.yms.app.ytb.YtbUtil.emptyObjErrMsg;
+import static org.onosproject.yms.ydt.YmsOperationType.NOTIFICATION;
+import static org.onosproject.yms.ydt.YmsOperationType.RPC_REPLY;
+
+/**
+ * Representation of YANG tree builder which generates YANG data tree from the
+ * class objects which are provided from the applications and return it to the
+ * protocol(s).
+ */
+public class DefaultYangTreeBuilder implements YangTreeBuilder {
+
+    private static final String OBJ_LIST = "object list";
+    private static final String EVENT_OBJ = "event object";
+    private static final String OUTPUT_OBJ = "output object";
+
+    /**
+     * Creates the YANG tree builder.
+     */
+    public DefaultYangTreeBuilder() {
+    }
+
+    @Override
+    public YdtExtendedBuilder getYdtBuilderForYo(
+            List<Object> moduleObj, String rootName,
+            String rootNameSpace, YmsOperationType opType,
+            YangSchemaRegistry registry) {
+
+        if (moduleObj == null || moduleObj.isEmpty()) {
+            throw new YtbException(emptyObjErrMsg(OBJ_LIST));
+        }
+
+        YdtExtendedBuilder ydtBuilder = new YangRequestWorkBench(
+                rootName, rootNameSpace, opType, registry, false);
+
+        for (Object yangObj : moduleObj) {
+            YdtBuilderFromYo moduleBuilder = new YdtBuilderFromYo(
+                    ydtBuilder, yangObj, registry);
+
+            moduleBuilder.getModuleNodeFromYsr(yangObj);
+            moduleBuilder.createYdtFromRootObject();
+        }
+        return ydtBuilder;
+    }
+
+    @Override
+    public YdtContext getYdtForNotification(Object object, String rootName,
+                                            YangSchemaRegistry registry) {
+
+        if (object == null) {
+            throw new YtbException(emptyObjErrMsg(EVENT_OBJ));
+        }
+
+        YdtExtendedBuilder extBuilder = new YangRequestWorkBench(
+                rootName, null, NOTIFICATION, registry, false);
+        YdtBuilderFromYo moduleBuilder = new YdtBuilderFromYo(
+                extBuilder, object, registry);
+
+        moduleBuilder.getRootNodeWithNotificationFromYsr(object);
+        /*
+         * Adds module to YDT, so that notification can further enhance the
+         * tree.
+         */
+        moduleBuilder.createModuleInYdt();
+        moduleBuilder.createYdtFromRootObject();
+        return extBuilder.getRootNode();
+    }
+
+    @Override
+    public YdtExtendedBuilder getYdtForRpcResponse(
+            Object outputObj, YangRequestWorkBench workBench) {
+
+        if (outputObj == null) {
+            throw new YtbException(emptyObjErrMsg(OUTPUT_OBJ));
+        }
+
+        // Gets the logical root node from RPC request work bench.
+        YdtExtendedContext rootNode = workBench.getRootNode();
+
+        /*
+         * Creates a new work bench for RPC reply from the contents of the
+         * request work bench
+         */
+        YdtExtendedBuilder ydtBuilder = new YangRequestWorkBench(
+                rootNode.getName(), rootNode.getNamespace(),
+                RPC_REPLY, workBench.getYangSchemaRegistry(), false);
+        YdtBuilderFromYo moduleBuilder = new YdtBuilderFromYo(
+                ydtBuilder, outputObj,
+                workBench.getYangSchemaRegistry());
+
+        // Forms YDT till RPC, so that output can further enhance the tree.
+        moduleBuilder.createModuleAndRpcInYdt(rootNode);
+        moduleBuilder.createYdtFromRootObject();
+        return ydtBuilder;
+    }
+}
diff --git a/apps/yms/app/src/main/java/org/onosproject/yms/app/ytb/YangTreeBuilder.java b/apps/yms/app/src/main/java/org/onosproject/yms/app/ytb/YangTreeBuilder.java
new file mode 100644
index 0000000..2c1df67
--- /dev/null
+++ b/apps/yms/app/src/main/java/org/onosproject/yms/app/ytb/YangTreeBuilder.java
@@ -0,0 +1,74 @@
+/*
+ * 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.ytb;
+
+import org.onosproject.yms.app.ydt.YangRequestWorkBench;
+import org.onosproject.yms.app.ydt.YdtExtendedBuilder;
+import org.onosproject.yms.app.ysr.YangSchemaRegistry;
+import org.onosproject.yms.ydt.YdtContext;
+import org.onosproject.yms.ydt.YmsOperationType;
+
+import java.util.List;
+
+/**
+ * Abstraction of an entity which provides interfaces to build YANG data tree
+ * from the object received from YNH, YAB or YCH.
+ */
+public interface YangTreeBuilder {
+
+    /**
+     * Returns the YDT builder after building the tree corresponding to the
+     * response YANG object received from any of the protocol such as YAB or
+     * YCH.
+     *
+     * @param moduleObj     application module object
+     * @param rootName      root node name
+     * @param rootNameSpace root node namespace
+     * @param opType        root node operation type
+     * @param registry      application schema registry
+     * @return YDT builder from the tree
+     */
+    YdtExtendedBuilder getYdtBuilderForYo(List<Object> moduleObj,
+                                          String rootName,
+                                          String rootNameSpace,
+                                          YmsOperationType opType,
+                                          YangSchemaRegistry registry);
+
+    /**
+     * Returns the YDT context after building the tree received from the
+     * protocol YNH.
+     *
+     * @param object   application notification object
+     * @param rootName root node name
+     * @param registry application schema registry
+     * @return YDT context from the tree
+     */
+    YdtContext getYdtForNotification(Object object, String rootName,
+                                     YangSchemaRegistry registry);
+
+    /**
+     * Returns the YDT context after building the RPC response tree. The input
+     * for building the tree is RPC request workbench, RPC output java object.
+     * These are received from the YSB protocol.
+     *
+     * @param outputObj application output object
+     * @param workBench RPC request workbench from YDT
+     * @return YDT builder where RPC response tree is created
+     */
+    YdtExtendedBuilder getYdtForRpcResponse(Object outputObj,
+                                            YangRequestWorkBench workBench);
+}
diff --git a/apps/yms/app/src/main/java/org/onosproject/yms/app/ytb/YdtBuilderFromYo.java b/apps/yms/app/src/main/java/org/onosproject/yms/app/ytb/YdtBuilderFromYo.java
new file mode 100644
index 0000000..a82eea2
--- /dev/null
+++ b/apps/yms/app/src/main/java/org/onosproject/yms/app/ytb/YdtBuilderFromYo.java
@@ -0,0 +1,906 @@
+/*
+ * 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.ytb;
+
+import org.onosproject.yangutils.datamodel.YangAugment;
+import org.onosproject.yangutils.datamodel.YangAugmentableNode;
+import org.onosproject.yangutils.datamodel.YangCase;
+import org.onosproject.yangutils.datamodel.YangChoice;
+import org.onosproject.yangutils.datamodel.YangLeaf;
+import org.onosproject.yangutils.datamodel.YangLeafList;
+import org.onosproject.yangutils.datamodel.YangLeavesHolder;
+import org.onosproject.yangutils.datamodel.YangNode;
+import org.onosproject.yangutils.datamodel.YangSchemaNode;
+import org.onosproject.yangutils.datamodel.YangSchemaNodeIdentifier;
+import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
+import org.onosproject.yms.app.utils.TraversalType;
+import org.onosproject.yms.app.ydt.YdtExtendedBuilder;
+import org.onosproject.yms.app.ydt.YdtExtendedContext;
+import org.onosproject.yms.app.ysr.YangSchemaRegistry;
+import org.onosproject.yms.ydt.YdtContextOperationType;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import static org.onosproject.yms.app.utils.TraversalType.CHILD;
+import static org.onosproject.yms.app.utils.TraversalType.PARENT;
+import static org.onosproject.yms.app.utils.TraversalType.ROOT;
+import static org.onosproject.yms.app.utils.TraversalType.SIBLING;
+import static org.onosproject.yms.app.ydt.AppType.YTB;
+import static org.onosproject.yms.app.ytb.YtbUtil.PERIOD;
+import static org.onosproject.yms.app.ytb.YtbUtil.STR_NULL;
+import static org.onosproject.yms.app.ytb.YtbUtil.getAttributeFromInheritance;
+import static org.onosproject.yms.app.ytb.YtbUtil.getAttributeOfObject;
+import static org.onosproject.yms.app.ytb.YtbUtil.getCapitalCase;
+import static org.onosproject.yms.app.ytb.YtbUtil.getClassLoaderForAugment;
+import static org.onosproject.yms.app.ytb.YtbUtil.getInterfaceClassFromImplClass;
+import static org.onosproject.yms.app.ytb.YtbUtil.getJavaName;
+import static org.onosproject.yms.app.ytb.YtbUtil.getOperationTypeOfTheNode;
+import static org.onosproject.yms.app.ytb.YtbUtil.getParentObjectOfNode;
+import static org.onosproject.yms.app.ytb.YtbUtil.getStringFromDataType;
+import static org.onosproject.yms.app.ytb.YtbUtil.isAugmentNode;
+import static org.onosproject.yms.app.ytb.YtbUtil.isMultiInstanceNode;
+import static org.onosproject.yms.app.ytb.YtbUtil.isNodeProcessCompleted;
+import static org.onosproject.yms.app.ytb.YtbUtil.isNonEmpty;
+import static org.onosproject.yms.app.ytb.YtbUtil.isNonProcessableNode;
+import static org.onosproject.yms.app.ytb.YtbUtil.isTypePrimitive;
+import static org.onosproject.yms.app.ytb.YtbUtil.isValueOrSelectLeafSet;
+import static org.onosproject.yms.ydt.YdtContextOperationType.NONE;
+
+/**
+ * Implements traversal of YANG node and its corresponding object, resulting
+ * in building of the YDT tree.
+ */
+public class YdtBuilderFromYo {
+
+    private static final String STR_TYPE = "type";
+    private static final String STR_SUBJECT = "subject";
+    private static final String TRUE = "true";
+    private static final String IS_LEAF_VALUE_SET_METHOD = "isLeafValueSet";
+    private static final String IS_SELECT_LEAF_SET_METHOD = "isSelectLeaf";
+    private static final String OUTPUT = "output";
+    private static final String YANG_AUGMENTED_INFO_MAP =
+            "yangAugmentedInfoMap";
+
+    /**
+     * Application YANG schema registry.
+     */
+    private final YangSchemaRegistry registry;
+
+    /**
+     * Current instance of the YDT builder where the tree is built.
+     */
+    private final YdtExtendedBuilder extBuilder;
+
+    /**
+     * YANG root object that is required for walking along with the YANG node.
+     */
+    private Object rootObj;
+
+    /**
+     * YANG root node that is required for walking along with the YANG object.
+     */
+    private YangSchemaNode rootSchema;
+
+    /**
+     * Creates YDT builder from YANG object by assigning the mandatory values.
+     *
+     * @param rootBuilder root node builder
+     * @param rootObj     root node object
+     * @param registry    application schema registry
+     */
+    public YdtBuilderFromYo(YdtExtendedBuilder rootBuilder, Object rootObj,
+                            YangSchemaRegistry registry) {
+        extBuilder = rootBuilder;
+        this.rootObj = rootObj;
+        this.registry = registry;
+    }
+
+    /**
+     * Returns schema root node, received from YSR, which searches based on
+     * the object received from YAB or YCH.
+     *
+     * @param object root node object
+     */
+    public void getModuleNodeFromYsr(Object object) {
+        Class interfaceClass = getInterfaceClassFromImplClass(object);
+        rootSchema = registry
+                .getYangSchemaNodeUsingGeneratedRootNodeInterfaceFileName(
+                        interfaceClass.getName());
+    }
+
+    /**
+     * Returns schema root node, received from YSR, which searches based on
+     * the object received from YNH.
+     *
+     * @param object notification event object
+     */
+    public void getRootNodeWithNotificationFromYsr(Object object) {
+        rootSchema = registry.getRootYangSchemaNodeForNotification(
+                object.getClass().getName());
+    }
+
+    /**
+     * Creates the module node for in YDT before beginning with notification
+     * root node traversal. Collects sufficient information to fill YDT with
+     * notification root node in the traversal.
+     */
+    public void createModuleInYdt() {
+        extBuilder.addChild(NONE, rootSchema);
+        rootSchema = getSchemaNodeOfNotification();
+        rootObj = getObjOfNotification();
+    }
+
+    /**
+     * Creates the module and RPC node, in YDT tree, from the logical root
+     * node received from request workbench. The output schema node is taken
+     * from the child schema of RPC YANG node.
+     *
+     * @param rootNode logical root node
+     */
+    public void createModuleAndRpcInYdt(YdtExtendedContext rootNode) {
+
+        YdtExtendedContext moduleNode =
+                (YdtExtendedContext) rootNode.getFirstChild();
+        extBuilder.addChild(NONE, moduleNode.getYangSchemaNode());
+
+        YdtExtendedContext rpcNode =
+                (YdtExtendedContext) moduleNode.getFirstChild();
+        YangSchemaNode rpcSchemaNode = rpcNode.getYangSchemaNode();
+        extBuilder.addChild(NONE, rpcSchemaNode);
+
+        // Defines a schema identifier for output node.
+        YangSchemaNodeIdentifier schemaId = new YangSchemaNodeIdentifier();
+        schemaId.setName(OUTPUT);
+        schemaId.setNameSpace(rpcSchemaNode.getNameSpace());
+        try {
+            // Gets the output schema node from RPC child schema.
+            rootSchema = rpcSchemaNode.getChildSchema(schemaId).getSchemaNode();
+        } catch (DataModelException e) {
+            throw new YtbException(e);
+        }
+    }
+
+    /**
+     * Creates YDT tree from the root object, by traversing through YANG data
+     * model node, and simultaneously checking the object nodes presence and
+     * walking the object.
+     */
+    public void createYdtFromRootObject() {
+        YangNode curNode = (YangNode) rootSchema;
+        TraversalType curTraversal = ROOT;
+        YtbNodeInfo listNodeInfo = null;
+        YtbNodeInfo augmentNodeInfo = null;
+
+        while (curNode != null) {
+            /*
+             * Processes the node, if it is being visited for the first time in
+             * the schema, also if the schema node is being retraced in a multi
+             * instance node.
+             */
+            if (curTraversal != PARENT || isMultiInstanceNode(curNode)) {
+
+                if (curTraversal == PARENT && isMultiInstanceNode(curNode)) {
+                    /*
+                     * If the schema is being retraced for a multi-instance
+                     * node, it has already entered for this multi-instance
+                     * node. Now this re-processes the same schema node for
+                     * any additional list object.
+                     */
+                    listNodeInfo = getCurNodeInfoAndTraverseBack();
+                }
+
+                if (curTraversal == ROOT && !isAugmentNode(curNode)) {
+                    /*
+                     * In case of RPC output, the root node is augmentative,
+                     * so when the root traversal is coming for augment this
+                     * flow is skipped. This adds only the root node in the YDT.
+                     */
+                    processApplicationRootNode();
+                } else {
+                    /*
+                     * Gets the object corresponding to current schema node.
+                     * If object exists, this adds the corresponding YDT node
+                     * to the tree and returns the object. Else returns null.
+                     */
+                    Object processedObject = processCurSchemaNodeAndAddToYdt(
+                            curNode, listNodeInfo);
+                    /*
+                     * Clears the list info of processed node. The next time
+                     * list info is taken newly and accordingly.
+                     */
+                    listNodeInfo = null;
+                    if (processedObject == null && !isAugmentNode(curNode)) {
+                        /*
+                         * Checks the presence of next sibling of the node, by
+                         * breaking the complete chain of the current node,
+                         * when the object value is not present, or when the
+                         * list entries are completely retraced. The augment
+                         * may have sibling, so this doesn't process for
+                         * augment.
+                         */
+                        YtbTraversalInfo traverseInfo =
+                                getProcessableInfo(curNode);
+                        curNode = traverseInfo.getYangNode();
+                        curTraversal = traverseInfo.getTraverseType();
+                        continue;
+                        /*
+                         * Irrespective of root or parent, sets the traversal
+                         * type as parent, when augment node doesn't have any
+                         * value. So, the other sibling augments can be
+                         * processed, if present.
+                         */
+                    } else if (processedObject == null &&
+                            isAugmentNode(curNode)) {
+                        curTraversal = PARENT;
+                        /*
+                         * The second content in the list will be having
+                         * parent traversal, in such case it cannot go to its
+                         * child in the flow, so it is made as child
+                         * traversal and proceeded to continue.
+                         */
+                    } else if (curTraversal == PARENT &&
+                            isMultiInstanceNode(curNode)) {
+                        curTraversal = CHILD;
+                    }
+                }
+            }
+            /*
+             * Checks for the sibling augment when the first augment node is
+             * getting completed. From the current augment node the previous
+             * node info is taken for augment and the traversal is changed to
+             * child, so as to check for the presence of sibling augment.
+             */
+            if (curTraversal == PARENT && isAugmentNode(curNode)) {
+                curNode = ((YangAugment) curNode).getAugmentedNode();
+                augmentNodeInfo = getParentYtbInfo();
+                curTraversal = CHILD;
+            }
+            /*
+             * Creates an augment iterator for the first time or takes the
+             * previous augment iterator for more than one time, whenever an
+             * augmentative node arrives. If augment is present it goes back
+             * for processing. If its null, the augmentative nodes process is
+             * continued.
+             */
+            if (curTraversal != PARENT &&
+                    curNode instanceof YangAugmentableNode) {
+                YangNode augmentNode = getAugmentInsideSchemaNode(
+                        curNode, augmentNodeInfo);
+                if (augmentNode != null) {
+                    curNode = augmentNode;
+                    continue;
+                }
+            }
+            /*
+             * Processes the child, after processing the node. If complete
+             * child depth is over, it takes up sibling and processes it.
+             * Once child and sibling is over, it is traversed back to the
+             * parent, without processing. In multi instance case, before
+             * going to parent or schema sibling, its own list sibling is
+             * processed. Skips the processing of RPC,notification and
+             * augment, as these nodes are dealt in a different flow.
+             */
+            if (curTraversal != PARENT && curNode.getChild() != null) {
+                augmentNodeInfo = null;
+                listNodeInfo = null;
+                curTraversal = CHILD;
+                curNode = curNode.getChild();
+                if (isNonProcessableNode(curNode)) {
+                    YtbTraversalInfo traverseInfo = getProcessableInfo(curNode);
+                    curNode = traverseInfo.getYangNode();
+                    curTraversal = traverseInfo.getTraverseType();
+                }
+            } else if (curNode.getNextSibling() != null) {
+                if (isNodeProcessCompleted(curNode, curTraversal)) {
+                    break;
+                }
+                if (isMultiInstanceNode(curNode)) {
+                    listNodeInfo = getCurNodeInfoAndTraverseBack();
+                    augmentNodeInfo = null;
+                    continue;
+                }
+                curTraversal = SIBLING;
+                traverseToParent(curNode);
+                curNode = curNode.getNextSibling();
+                if (isNonProcessableNode(curNode)) {
+                    YtbTraversalInfo traverseInfo = getProcessableInfo(curNode);
+                    curNode = traverseInfo.getYangNode();
+                    curTraversal = traverseInfo.getTraverseType();
+                }
+            } else {
+                if (isNodeProcessCompleted(curNode, curTraversal)) {
+                    break;
+                }
+                if (isMultiInstanceNode(curNode)) {
+                    listNodeInfo = getCurNodeInfoAndTraverseBack();
+                    augmentNodeInfo = null;
+                    continue;
+                }
+                curTraversal = PARENT;
+                traverseToParent(curNode);
+                curNode = curNode.getParent();
+            }
+        }
+    }
+
+    /**
+     * Processes root YANG node and adds it as a child to the YDT
+     * extended builder which is created earlier.
+     */
+    private void processApplicationRootNode() {
+
+        YtbNodeInfo nodeInfo = new YtbNodeInfo();
+        YangNode rootYang = (YangNode) rootSchema;
+        addChildNodeInYdt(rootObj, rootYang, nodeInfo);
+        // If root node has leaf or leaf-list those will be processed.
+        processLeaves(rootYang);
+        processLeavesList(rootYang);
+    }
+
+    /**
+     * Traverses to parent, based on the schema node that requires to be
+     * traversed. Skips traversal of parent for choice and case node, as they
+     * don't get added to the YDT tree.
+     *
+     * @param curNode current YANG node
+     */
+    private void traverseToParent(YangNode curNode) {
+        if (curNode instanceof YangCase || curNode instanceof YangChoice) {
+            return;
+        }
+        extBuilder.traverseToParentWithoutValidation();
+    }
+
+    /**
+     * Returns the current YTB info of the YDT builder, and then traverses back
+     * to parent. In case of multi instance node the previous node info is
+     * used for iterating through the list.
+     *
+     * @return current YTB app info
+     */
+    private YtbNodeInfo getCurNodeInfoAndTraverseBack() {
+        YtbNodeInfo appInfo = getParentYtbInfo();
+        extBuilder.traverseToParentWithoutValidation();
+        return appInfo;
+    }
+
+    /**
+     * Returns augment node for an augmented node. From the list of augment
+     * nodes it has, one of the nodes is taken and provided linearly. If the
+     * node is not augmented or the all the augment nodes are processed, then
+     * it returns null.
+     *
+     * @param curNode         current YANG node
+     * @param augmentNodeInfo previous augment node info
+     * @return YANG augment node
+     */
+    private YangNode getAugmentInsideSchemaNode(YangNode curNode,
+                                                YtbNodeInfo augmentNodeInfo) {
+        if (augmentNodeInfo == null) {
+            List<YangAugment> augmentList = ((YangAugmentableNode) curNode)
+                    .getAugmentedInfoList();
+            if (isNonEmpty(augmentList)) {
+                YtbNodeInfo parentNodeInfo = getParentYtbInfo();
+                Iterator<YangAugment> augmentItr = augmentList.listIterator();
+                parentNodeInfo.setAugmentIterator(augmentItr);
+                return augmentItr.next();
+            }
+        } else if (augmentNodeInfo.getAugmentIterator() != null) {
+            if (augmentNodeInfo.getAugmentIterator().hasNext()) {
+                return augmentNodeInfo.getAugmentIterator().next();
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Processes the current YANG node and if necessary adds it to the YDT
+     * builder tree by extracting the information from the corresponding
+     * class object.
+     *
+     * @param curNode      current YANG node
+     * @param listNodeInfo previous node info for list
+     * @return object of the schema node
+     */
+    private Object processCurSchemaNodeAndAddToYdt(YangNode curNode,
+                                                   YtbNodeInfo listNodeInfo) {
+        YtbNodeInfo curNodeInfo = new YtbNodeInfo();
+        Object nodeObj = null;
+        YtbNodeInfo parentNodeInfo = getParentYtbInfo();
+
+        switch (curNode.getYangSchemaNodeType()) {
+            case YANG_SINGLE_INSTANCE_NODE:
+                nodeObj = processSingleInstanceNode(curNode, curNodeInfo,
+                                                    parentNodeInfo);
+                break;
+            case YANG_MULTI_INSTANCE_NODE:
+                nodeObj = processMultiInstanceNode(
+                        curNode, curNodeInfo, listNodeInfo, parentNodeInfo);
+                break;
+            case YANG_CHOICE_NODE:
+                nodeObj = processChoiceNode(curNode, parentNodeInfo);
+                break;
+            case YANG_NON_DATA_NODE:
+                if (curNode instanceof YangCase) {
+                    nodeObj = processCaseNode(curNode, parentNodeInfo);
+                }
+                break;
+            case YANG_AUGMENT_NODE:
+                nodeObj = processAugmentNode(curNode, parentNodeInfo);
+                break;
+            default:
+                throw new YtbException(
+                        "Non processable schema node has arrived for adding " +
+                                "it in YDT tree");
+        }
+        // Processes leaf/leaf-list only when object has value, else it skips.
+        if (nodeObj != null) {
+            processLeaves(curNode);
+            processLeavesList(curNode);
+        }
+        return nodeObj;
+    }
+
+    /**
+     * Processes single instance node which is added to the YDT tree.
+     *
+     * @param curNode        current YANG node
+     * @param curNodeInfo    current YDT node info
+     * @param parentNodeInfo parent YDT node info
+     * @return object of the current node
+     */
+    private Object processSingleInstanceNode(YangNode curNode,
+                                             YtbNodeInfo curNodeInfo,
+                                             YtbNodeInfo parentNodeInfo) {
+        Object childObj = getChildObject(curNode, parentNodeInfo);
+        if (childObj != null) {
+            addChildNodeInYdt(childObj, curNode, curNodeInfo);
+        }
+        return childObj;
+    }
+
+    /**
+     * Processes multi instance node which has to be added to the YDT tree.
+     * For the first instance in the list, iterator is created and added to
+     * the list. For second instance or more the iterator from first instance
+     * is taken and iterated through to get the object of parent.
+     *
+     * @param curNode        current list node
+     * @param curNodeInfo    current node info for list
+     * @param listNodeInfo   previous instance node info of list
+     * @param parentNodeInfo parent node info of list
+     * @return object of the current instance
+     */
+    private Object processMultiInstanceNode(YangNode curNode,
+                                            YtbNodeInfo curNodeInfo,
+                                            YtbNodeInfo listNodeInfo,
+                                            YtbNodeInfo parentNodeInfo) {
+        Object childObj = null;
+        /*
+         * When YANG list comes to this flow for first time, its YTB node
+         * will be null. When it comes for the second or more content, then
+         * the list would have been already set for that node. According to
+         * set or not set this flow will be proceeded.
+         */
+        if (listNodeInfo == null) {
+            List<Object> childObjList = (List<Object>) getChildObject(
+                    curNode, parentNodeInfo);
+            if (isNonEmpty(childObjList)) {
+                Iterator<Object> listItr = childObjList.iterator();
+                if (!listItr.hasNext()) {
+                    return null;
+                    //TODO: Handle the subtree filtering with no list entries.
+                }
+                childObj = listItr.next();
+                /*
+                 * For that node the iterator is set. So the next time for
+                 * the list this iterator will be taken.
+                 */
+                curNodeInfo.setListIterator(listItr);
+            }
+        } else {
+            /*
+             * If the list value comes for second or more time, that list
+             * node will be having YTB node info, where iterator can be
+             * retrieved and check if any more contents are present. If
+             * present those will be processed.
+             */
+            curNodeInfo.setListIterator(listNodeInfo.getListIterator());
+            if (listNodeInfo.getListIterator().hasNext()) {
+                childObj = listNodeInfo.getListIterator().next();
+            }
+        }
+        if (childObj != null) {
+            addChildNodeInYdt(childObj, curNode, curNodeInfo);
+        }
+        return childObj;
+    }
+
+    /**
+     * Processes choice node which adds a map to the parent node info of
+     * choice name and the case object. The object taken for choice node is
+     * of case object with choice name. Also, this Skips the addition of choice
+     * to YDT.
+     *
+     * @param curNode        current choice node
+     * @param parentNodeInfo parent YTB node info
+     * @return object of the choice node
+     */
+    private Object processChoiceNode(YangNode curNode,
+                                     YtbNodeInfo parentNodeInfo) {
+        /*
+         * Retrieves the parent YTB info, to take the object of parent, so as
+         * to check the child attribute from the object.
+         */
+        Object childObj = getChildObject(curNode, parentNodeInfo);
+        if (childObj != null) {
+            Map<String, Object> choiceCaseMap = parentNodeInfo
+                    .getChoiceCaseMap();
+            if (choiceCaseMap == null) {
+                choiceCaseMap = new HashMap<>();
+                parentNodeInfo.setChoiceCaseMap(choiceCaseMap);
+            }
+            choiceCaseMap.put(curNode.getName(), childObj);
+        }
+        return childObj;
+    }
+
+    /**
+     * Processes case node from the map contents that is filled by choice
+     * nodes. Object of choice is taken when choice name and case class name
+     * matches. When the case node is not present in the map it returns null.
+     *
+     * @param curNode        current case node
+     * @param parentNodeInfo choice parent node info
+     * @return object of the case node
+     */
+    private Object processCaseNode(YangNode curNode,
+                                   YtbNodeInfo parentNodeInfo) {
+        Object childObj = null;
+        if (parentNodeInfo.getChoiceCaseMap() != null) {
+            childObj = getCaseObjectFromChoice(parentNodeInfo,
+                                               curNode);
+        }
+        if (childObj != null) {
+            /*
+             * Sets the case object in parent info, so that rest of the case
+             * children can use it as parent. Case is not added in YDT.
+             */
+            parentNodeInfo.setCaseObject(childObj);
+        }
+        return childObj;
+    }
+
+    /**
+     * Processes augment node, which is not added in the YDT, but binds
+     * itself to the parent YTB info, so rest of its child nodes can use for
+     * adding themselves to the YDT tree. If there is no augment node added
+     * in map or if the augment module is not registered, then it returns null.
+     *
+     * @param curNode        current augment node
+     * @param parentNodeInfo augment parent node info
+     * @return object of the augment node
+     */
+    private Object processAugmentNode(YangNode curNode,
+                                      YtbNodeInfo parentNodeInfo) {
+        String className = curNode.getJavaClassNameOrBuiltInType();
+        String pkgName = curNode.getJavaPackage();
+        Object parentObj = getParentObjectOfNode(parentNodeInfo,
+                                                 curNode.getParent());
+        Map augmentMap;
+        try {
+            augmentMap = (Map) getAttributeOfObject(parentObj,
+                                                    YANG_AUGMENTED_INFO_MAP);
+            /*
+             * Gets the registered module class. Loads the class and gets the
+             * augment class.
+             */
+            Class moduleClass = getClassLoaderForAugment(curNode, registry);
+            if (moduleClass == null) {
+                return null;
+            }
+            Class augmentClass = moduleClass.getClassLoader().loadClass(
+                    pkgName + PERIOD + className);
+            Object childObj = augmentMap.get(augmentClass);
+            parentNodeInfo.setAugmentObject(childObj);
+            return childObj;
+        } catch (ClassNotFoundException | NoSuchMethodException e) {
+            throw new YtbException(e);
+        }
+    }
+
+    /**
+     * Returns the YTB info from the parent node, so that its own bounded
+     * object can be taken out.
+     *
+     * @return parent node YTB node info
+     */
+    private YtbNodeInfo getParentYtbInfo() {
+        YdtExtendedContext parentExtContext =
+                (YdtExtendedContext) extBuilder.getCurNode();
+        return (YtbNodeInfo) parentExtContext.getAppInfo(YTB);
+    }
+
+    /**
+     * Returns the child object from the parent object. Uses java name of the
+     * current node to search the attribute in the parent object.
+     *
+     * @param curNode        current YANG node
+     * @param parentNodeInfo parent YTB node info
+     * @return object of the child node
+     */
+    private Object getChildObject(YangNode curNode,
+                                  YtbNodeInfo parentNodeInfo) {
+        String nodeJavaName = curNode.getJavaAttributeName();
+        Object parentObj = getParentObjectOfNode(parentNodeInfo,
+                                                 curNode.getParent());
+        try {
+            return getAttributeOfObject(parentObj, nodeJavaName);
+        } catch (NoSuchMethodException e) {
+            throw new YtbException(e);
+        }
+    }
+
+    /**
+     * Adds the child node to the YDT by taking operation type from the
+     * object. Also, binds the object to the YDT node through YTB node info.
+     *
+     * @param childObj    node object
+     * @param curNode     current YANG node
+     * @param curNodeInfo current YTB info
+     */
+    private void addChildNodeInYdt(Object childObj, YangNode curNode,
+                                   YtbNodeInfo curNodeInfo) {
+        YdtContextOperationType opType = getOperationTypeOfTheNode(childObj);
+        extBuilder.addChild(opType, curNode);
+        YdtExtendedContext curExtContext = (YdtExtendedContext) extBuilder
+                .getCurNode();
+        curNodeInfo.setYangObject(childObj);
+        curExtContext.addAppInfo(YTB, curNodeInfo);
+    }
+
+    /**
+     * Processes every leaf in a YANG node. Iterates through the leaf, takes
+     * value from the leaf and adds it to the YDT with value. If value is not
+     * present, and select leaf is set, adds it to the YDT without value.
+     *
+     * @param yangNode leaves holder node
+     */
+    private void processLeaves(YangNode yangNode) {
+        if (yangNode instanceof YangLeavesHolder) {
+            List<YangLeaf> leavesList = ((YangLeavesHolder) yangNode)
+                    .getListOfLeaf();
+            if (leavesList != null) {
+                for (YangLeaf yangLeaf : leavesList) {
+                    YtbNodeInfo parentYtbInfo = getParentYtbInfo();
+                    Object parentObj = getParentObjectOfNode(parentYtbInfo,
+                                                             yangNode);
+                    Object leafType;
+                    try {
+                        leafType = getAttributeOfObject(parentObj,
+                                                        getJavaName(yangLeaf));
+                    } catch (NoSuchMethodException e) {
+                        throw new YtbException(e);
+                    }
+
+                    addLeafWithValue(yangLeaf, parentObj, leafType);
+                    addLeafWithoutValue(yangLeaf, parentObj);
+                }
+            }
+        }
+    }
+
+    /**
+     * Processes every leaf-list in a YANG node. For each leaf-list, the list of
+     * objects are iterated, value from each object is put in a set of string,
+     * and is added to the YDT.
+     *
+     * @param yangNode list of leaf-list holder node
+     */
+    private void processLeavesList(YangNode yangNode) {
+        if (yangNode instanceof YangLeavesHolder) {
+            List<YangLeafList> listOfLeafList =
+                    ((YangLeavesHolder) yangNode).getListOfLeafList();
+
+            if (listOfLeafList != null) {
+                for (YangLeafList yangLeafList : listOfLeafList) {
+
+                    YtbNodeInfo ytbNodeInfo = getParentYtbInfo();
+                    Object parentObj = getParentObjectOfNode(ytbNodeInfo,
+                                                             yangNode);
+
+                    //TODO: Let the received object list be generic collection.
+                    List<Object> leafListObj;
+                    try {
+                        leafListObj = (List<Object>) getAttributeOfObject(
+                                parentObj, getJavaName(yangLeafList));
+                    } catch (NoSuchMethodException e) {
+                        throw new YtbException(e);
+                    }
+                    Set<String> leafListValue = new HashSet<>();
+                    /*
+                     * If list is present, then adds each object value in set.
+                     * Adds this set to the YDT, and traverse to parent.
+                     */
+                    if (leafListObj != null) {
+                        for (Object object : leafListObj) {
+                            String objValue = getStringFromDataType(
+                                    object, yangLeafList.getDataType());
+                            leafListValue.add(objValue);
+                        }
+                        extBuilder.addLeafList(leafListValue, yangLeafList);
+                        extBuilder.traverseToParentWithoutValidation();
+                    }
+                }
+            }
+        }
+    }
+
+    /**
+     * Returns the schema node of notification from the root node. Gets the
+     * enum value from event object and gives it to the root schema node for
+     * getting back the notification schema node.
+     *
+     * @return YANG schema node of notification
+     */
+    private YangSchemaNode getSchemaNodeOfNotification() {
+        Class parentClass = rootObj.getClass().getSuperclass();
+        Object eventObjType = getAttributeFromInheritance(
+                parentClass, rootObj, STR_TYPE);
+        String opTypeValue = String.valueOf(eventObjType);
+
+        if (opTypeValue.equals(STR_NULL) || opTypeValue.isEmpty()) {
+            throw new YtbException(
+                    "There is no notification present for the event. Invalid " +
+                            "input for notification.");
+        }
+        try {
+            return rootSchema.getNotificationSchemaNode(opTypeValue);
+        } catch (DataModelException e) {
+            throw new YtbException(e);
+        }
+    }
+
+    /**
+     * Returns the object of the notification by retrieving the attributes
+     * from the event class object.
+     *
+     * @return notification YANG object
+     */
+    private Object getObjOfNotification() {
+        Class parentClass = rootObj.getClass().getSuperclass();
+        Object eventSubjectObj = getAttributeFromInheritance(
+                parentClass, rootObj, STR_SUBJECT);
+        String notificationName = rootSchema.getJavaAttributeName();
+        try {
+            return getAttributeOfObject(eventSubjectObj, notificationName);
+        } catch (NoSuchMethodException e) {
+            throw new YtbException(e);
+        }
+    }
+
+    /**
+     * Returns case object from the map that is bound to the parent node
+     * info. For any case node, only when the key and value is matched the
+     * object of the case is provided. If a match is not found, null is
+     * returned.
+     *
+     * @param parentNodeInfo parent YTB node info
+     * @param caseNode       case schema node
+     * @return object of the case node
+     */
+    private Object getCaseObjectFromChoice(YtbNodeInfo parentNodeInfo,
+                                           YangSchemaNode caseNode) {
+        String javaName = getCapitalCase(
+                caseNode.getJavaClassNameOrBuiltInType());
+        String choiceName = ((YangNode) caseNode).getParent().getName();
+        Map<String, Object> mapObj = parentNodeInfo.getChoiceCaseMap();
+        Object caseObj = mapObj.get(choiceName);
+        Class<?> interfaceClass = getInterfaceClassFromImplClass(caseObj);
+        return interfaceClass.getSimpleName().equals(javaName) ? caseObj : null;
+    }
+
+    /**
+     * Adds leaf to YDT when value is present. For primitive types, in order
+     * to avoid default values, the value select is set or not is checked and
+     * then added.
+     *
+     * @param yangLeaf  YANG leaf node
+     * @param parentObj leaf holder object
+     * @param leafType  object of leaf type
+     */
+    private void addLeafWithValue(YangLeaf yangLeaf, Object parentObj,
+                                  Object leafType) {
+        String fieldValue = null;
+        if (isTypePrimitive(yangLeaf.getDataType())) {
+            fieldValue = getLeafValueFromValueSetFlag(parentObj, yangLeaf,
+                                                      leafType);
+            /*
+             * Checks the object is present or not, when type is
+             * non-primitive. And adds the value from the respective data type.
+             */
+        } else if (leafType != null) {
+            fieldValue = getStringFromDataType(leafType,
+                                               yangLeaf.getDataType());
+        }
+        if (isNonEmpty(fieldValue)) {
+            extBuilder.addLeaf(fieldValue, yangLeaf);
+            extBuilder.traverseToParentWithoutValidation();
+        }
+    }
+
+    /**
+     * Adds leaf without value, when the select leaf bit is set.
+     *
+     * @param yangLeaf  YANG leaf node
+     * @param parentObj leaf holder object
+     */
+    private void addLeafWithoutValue(YangLeaf yangLeaf, Object parentObj) {
+        String selectLeaf = isValueOrSelectLeafSet(
+                parentObj, getJavaName(yangLeaf), IS_SELECT_LEAF_SET_METHOD);
+        if (selectLeaf.equals(TRUE)) {
+            extBuilder.addLeaf(null, yangLeaf);
+            extBuilder.traverseToParentWithoutValidation();
+        }
+    }
+
+    /**
+     * Returns the value of type, after checking, the value leaf flag. If the
+     * flag is set, then it takes the value or returns null.
+     *
+     * @param parentObj parent object
+     * @param yangLeaf  YANG leaf node
+     * @param leafType  object of leaf type
+     * @return value of type
+     */
+    private String getLeafValueFromValueSetFlag(
+            Object parentObj, YangLeaf yangLeaf, Object leafType) {
+        String valueOfLeaf = isValueOrSelectLeafSet(
+                parentObj, getJavaName(yangLeaf), IS_LEAF_VALUE_SET_METHOD);
+        if (valueOfLeaf.equals(TRUE)) {
+            return getStringFromDataType(leafType, yangLeaf.getDataType());
+        }
+        return null;
+    }
+
+    /**
+     * Returns the node info which can be processed, by eliminating the nodes
+     * which need not to be processed at normal conditions such as RPC,
+     * notification and augment.
+     *
+     * @param curNode current node
+     * @return info of node which needs processing
+     */
+    private YtbTraversalInfo getProcessableInfo(YangNode curNode) {
+        if (curNode.getNextSibling() != null) {
+            YangNode sibling = curNode.getNextSibling();
+            while (isNonProcessableNode(sibling)) {
+                sibling = sibling.getNextSibling();
+            }
+            if (sibling != null) {
+                return new YtbTraversalInfo(sibling, SIBLING);
+            }
+        }
+        return new YtbTraversalInfo(curNode.getParent(), PARENT);
+    }
+
+}
diff --git a/apps/yms/app/src/main/java/org/onosproject/yms/app/ytb/YtbException.java b/apps/yms/app/src/main/java/org/onosproject/yms/app/ytb/YtbException.java
new file mode 100644
index 0000000..98f141a
--- /dev/null
+++ b/apps/yms/app/src/main/java/org/onosproject/yms/app/ytb/YtbException.java
@@ -0,0 +1,41 @@
+/*
+ * 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.ytb;
+
+/**
+ * Represents exception that needs to be handled by YTB.
+ */
+public class YtbException extends RuntimeException {
+
+    /**
+     * Creates YTB exception with an exception message.
+     *
+     * @param exceptionMessage message with which exception must be thrown
+     */
+    public YtbException(String exceptionMessage) {
+        super(exceptionMessage);
+    }
+
+    /**
+     * Creates YTB exception with the cause for it.
+     *
+     * @param cause cause of the exception
+     */
+    public YtbException(Throwable cause) {
+        super(cause);
+    }
+}
diff --git a/apps/yms/app/src/main/java/org/onosproject/yms/app/ytb/YtbNodeInfo.java b/apps/yms/app/src/main/java/org/onosproject/yms/app/ytb/YtbNodeInfo.java
new file mode 100644
index 0000000..6815bca
--- /dev/null
+++ b/apps/yms/app/src/main/java/org/onosproject/yms/app/ytb/YtbNodeInfo.java
@@ -0,0 +1,186 @@
+/*
+ * 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.ytb;
+
+import org.onosproject.yangutils.datamodel.YangAugment;
+
+import java.util.Iterator;
+import java.util.Map;
+
+/**
+ * Represents YTB node info for all the nodes that are added to the YDT
+ * builder tree.Contains the information which can be attached and retrieved
+ * back from YDT while walking.
+ */
+public class YtbNodeInfo {
+
+    /**
+     * Object of the corresponding YANG construct. This object is bound to
+     * each and every YDT node. So, whenever walk of parent and sibling
+     * happens, object can be retrieved from its YDT node.
+     */
+    private Object yangObject;
+
+    /**
+     * The list iterator since first content of the multi instance node is
+     * faced. With this iterator the node can be walked multiple times till
+     * it becomes empty.
+     */
+    private Iterator<Object> listIterator;
+
+    /**
+     * The current YTB node's, list of augments are iterated through this
+     * iterator. Every time an augment is built completely, this iterator
+     * gives the next augment node until it becomes empty.
+     */
+    private Iterator<YangAugment> augmentNodeItr;
+
+    /**
+     * The map with case object as value and choice node name as key is added
+     * for the current YTB info. Every time a case schema node comes, it takes
+     * this map and checks if it is present.
+     */
+    private Map<String, Object> choiceCaseMap;
+
+    /**
+     * When the case finds its object in map, it assigns it to case object of
+     * the YTB info, so when its child wants to take the parent object, they
+     * can take from the YTB info's case object.
+     */
+    private Object caseObject;
+
+    /**
+     * When the augment object is present, it assigns it to augment object of
+     * the YTB info, so when its child wants to take the parent object, they
+     * can take from the YTB info's augment object.
+     */
+    private Object augmentObject;
+
+    /**
+     * Constructs a default YTB node info.
+     */
+    public YtbNodeInfo() {
+    }
+
+    /**
+     * Returns the object of the YANG schema node.
+     *
+     * @return YANG node object
+     */
+    public Object getYangObject() {
+        return yangObject;
+    }
+
+    /**
+     * Sets the object of the YANG schema node.
+     *
+     * @param yangObject YANG node object
+     */
+    public void setYangObject(Object yangObject) {
+        this.yangObject = yangObject;
+    }
+
+    /**
+     * Returns the current list iterator of the YANG schema node.
+     *
+     * @return current list iterator for the schema node
+     */
+    public Iterator<Object> getListIterator() {
+        return listIterator;
+    }
+
+    /**
+     * Sets the current list iterator of the YANG schema node.
+     *
+     * @param listIterator current list iterator for the schema node
+     */
+    public void setListIterator(Iterator<Object> listIterator) {
+        this.listIterator = listIterator;
+    }
+
+    /**
+     * Returns the map of choice schema name and case object.
+     *
+     * @return choice name and case object map
+     */
+    public Map<String, Object> getChoiceCaseMap() {
+        return choiceCaseMap;
+    }
+
+    /**
+     * Sets the map of choice schema name and case object.
+     *
+     * @param choiceCaseMap choice name and case object map
+     */
+    public void setChoiceCaseMap(Map<String, Object> choiceCaseMap) {
+        this.choiceCaseMap = choiceCaseMap;
+    }
+
+    /**
+     * Returns the case object.
+     *
+     * @return case object
+     */
+    public Object getCaseObject() {
+        return caseObject;
+    }
+
+    /**
+     * Sets the case node object.
+     *
+     * @param caseObject case node object
+     */
+    public void setCaseObject(Object caseObject) {
+        this.caseObject = caseObject;
+    }
+
+    /**
+     * Returns the augment node object.
+     *
+     * @return augment node object
+     */
+    public Object getAugmentObject() {
+        return augmentObject;
+    }
+
+    /**
+     * Sets the augment node object.
+     *
+     * @param augmentObject augment node object
+     */
+    public void setAugmentObject(Object augmentObject) {
+        this.augmentObject = augmentObject;
+    }
+
+    /**
+     * Returns the current list iterator of the YANG augment node.
+     *
+     * @return augment node iterator
+     */
+    public Iterator<YangAugment> getAugmentIterator() {
+        return augmentNodeItr;
+    }
+
+    /**
+     * Sets the current list iterator of the YANG augment node.
+     *
+     * @param augmentNodeItr augment node iterator
+     */
+    public void setAugmentIterator(Iterator<YangAugment> augmentNodeItr) {
+        this.augmentNodeItr = augmentNodeItr;
+    }
+}
diff --git a/apps/yms/app/src/main/java/org/onosproject/yms/app/ytb/YtbTraversalInfo.java b/apps/yms/app/src/main/java/org/onosproject/yms/app/ytb/YtbTraversalInfo.java
new file mode 100644
index 0000000..4435c0a
--- /dev/null
+++ b/apps/yms/app/src/main/java/org/onosproject/yms/app/ytb/YtbTraversalInfo.java
@@ -0,0 +1,68 @@
+/*
+ * 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.ytb;
+
+import org.onosproject.yangutils.datamodel.YangNode;
+import org.onosproject.yms.app.utils.TraversalType;
+
+/**
+ * Represents YTB Traversal info which is needed every time the traversal of
+ * a YANG node happens. This contains YANG node and its corresponding traversal
+ * type information.
+ */
+public class YtbTraversalInfo {
+
+    /**
+     * YANG node of the current traversal.
+     */
+    private YangNode yangNode;
+
+    /**
+     * Traverse type of the current traversal.
+     */
+    private TraversalType traverseType;
+
+    /**
+     * Creates YTB traversal info by taking the traversal type and the YANG
+     * node.
+     *
+     * @param yangNode     YANG node
+     * @param traverseType traversal type
+     */
+    public YtbTraversalInfo(YangNode yangNode, TraversalType traverseType) {
+        this.yangNode = yangNode;
+        this.traverseType = traverseType;
+    }
+
+    /**
+     * Returns the YANG node of the current traversal.
+     *
+     * @return YANG node
+     */
+    public YangNode getYangNode() {
+        return yangNode;
+    }
+
+    /**
+     * Returns the traversal type of the current traversal.
+     *
+     * @return traversal type
+     */
+    public TraversalType getTraverseType() {
+        return traverseType;
+    }
+}
diff --git a/apps/yms/app/src/main/java/org/onosproject/yms/app/ytb/YtbUtil.java b/apps/yms/app/src/main/java/org/onosproject/yms/app/ytb/YtbUtil.java
new file mode 100644
index 0000000..8329c9f
--- /dev/null
+++ b/apps/yms/app/src/main/java/org/onosproject/yms/app/ytb/YtbUtil.java
@@ -0,0 +1,449 @@
+/*
+ * 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.ytb;
+
+import org.onosproject.yangutils.datamodel.YangAugment;
+import org.onosproject.yangutils.datamodel.YangCase;
+import org.onosproject.yangutils.datamodel.YangLeafRef;
+import org.onosproject.yangutils.datamodel.YangNode;
+import org.onosproject.yangutils.datamodel.YangNotification;
+import org.onosproject.yangutils.datamodel.YangOutput;
+import org.onosproject.yangutils.datamodel.YangRpc;
+import org.onosproject.yangutils.datamodel.YangType;
+import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes;
+import org.onosproject.yangutils.translator.tojava.javamodel.JavaLeafInfoContainer;
+import org.onosproject.yms.app.utils.TraversalType;
+import org.onosproject.yms.app.ysr.YangSchemaRegistry;
+import org.onosproject.yms.ydt.YdtContextOperationType;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.Arrays;
+import java.util.Base64;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import static org.onosproject.yangutils.datamodel.YangSchemaNodeType.YANG_AUGMENT_NODE;
+import static org.onosproject.yangutils.datamodel.YangSchemaNodeType.YANG_MULTI_INSTANCE_NODE;
+import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.BOOLEAN;
+import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.DECIMAL64;
+import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.EMPTY;
+import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.INT16;
+import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.INT32;
+import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.INT64;
+import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.INT8;
+import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.LEAFREF;
+import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.UINT16;
+import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.UINT32;
+import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.UINT64;
+import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.UINT8;
+import static org.onosproject.yms.app.utils.TraversalType.PARENT;
+
+/**
+ * Representation of utility for YANG tree builder.
+ */
+public final class YtbUtil {
+
+    /**
+     * Static attribute for string value having null.
+     */
+    public static final String STR_NULL = "null";
+
+    /**
+     * Static attribute for a dot string.
+     */
+    public static final String PERIOD = ".";
+
+    private static final int ONE = 1;
+    private static final String SCHEMA_NAME_IN_ENUM = "schemaName";
+    private static final String OPERATION_TYPE = "onosYangNodeOperationType";
+    private static final String STR_NONE = "NONE";
+    private static final String EQUALS = "=";
+    private static final String ENUM_LEAF_IDENTIFIER = "$LeafIdentifier";
+    private static final char CLOSE_BRACE = '}';
+    private static final Set<YangDataTypes> PRIMITIVE_TYPES =
+            new HashSet<>(Arrays.asList(INT8, INT16, INT32, INT64, UINT8,
+                                        UINT16, UINT32, UINT64, DECIMAL64,
+                                        BOOLEAN, EMPTY));
+
+    // No instantiation.
+    private YtbUtil() {
+    }
+
+    /**
+     * Returns the object of the node from the node info. Getting object for
+     * augment and case differs from other node.
+     *
+     * @param nodeInfo node info of the holder
+     * @param yangNode YANG node of the holder
+     * @return object of the parent
+     */
+    public static Object getParentObjectOfNode(YtbNodeInfo nodeInfo,
+                                               YangNode yangNode) {
+        Object object;
+        if (yangNode instanceof YangCase) {
+            object = nodeInfo.getCaseObject();
+        } else if (yangNode instanceof YangAugment) {
+            object = nodeInfo.getAugmentObject();
+        } else {
+            object = nodeInfo.getYangObject();
+        }
+        return object;
+    }
+
+    /**
+     * Returns the capital cased first letter of the given string.
+     *
+     * @param name string to be capital cased
+     * @return capital cased string
+     */
+    public static String getCapitalCase(String name) {
+        // TODO: It will be removed if common util is committed.
+        return name.substring(0, 1).toUpperCase() +
+                name.substring(1);
+    }
+
+    /**
+     * Returns the value of an attribute, in a class object. The attribute
+     * name is taken from the YANG node java name.
+     *
+     * @param nodeObj   object of the node
+     * @param fieldName name of the attribute
+     * @return object of the attribute
+     * @throws NoSuchMethodException method not found exception
+     */
+    public static Object getAttributeOfObject(Object nodeObj, String fieldName)
+            throws NoSuchMethodException {
+        Class<?> nodeClass = nodeObj.getClass();
+        Method getterMethod;
+        try {
+            getterMethod = nodeClass.getDeclaredMethod(fieldName);
+            return getterMethod.invoke(nodeObj);
+        } catch (InvocationTargetException | IllegalAccessException e) {
+            throw new YtbException(e);
+        }
+    }
+
+    /**
+     * Returns the object of the declared method in parent class by invoking
+     * through the child class object.
+     *
+     * @param parentClass parent class of the declared method
+     * @param childClass  child class which inherits the parent class
+     * @param methodName  name of the declared method
+     * @return value of the method
+     */
+    public static Object getAttributeFromInheritance(
+            Class<?> parentClass, Object childClass, String methodName) {
+        Method getterMethod;
+        try {
+            getterMethod = parentClass.getDeclaredMethod(methodName);
+            return getterMethod.invoke(childClass);
+        } catch (InvocationTargetException | NoSuchMethodException |
+                IllegalAccessException e) {
+            throw new YtbException(e);
+        }
+    }
+
+    /**
+     * Returns interface class from an implementation class object.
+     *
+     * @param implClassObj implementation class object
+     * @return interface class
+     */
+    public static Class<?> getInterfaceClassFromImplClass(Object implClassObj) {
+        Class<?> implClass = implClassObj.getClass();
+        Class<?>[] interfaces = implClass.getInterfaces();
+        if (interfaces.length > ONE) {
+            // TODO: Need to handle when impl class has more than one interface.
+            throw new YtbException("Implementation class having more than one" +
+                                           " interface is not handled");
+        }
+        return interfaces[0];
+    }
+
+    /**
+     * Returns the operation type value for a class object. If the operation
+     * type is not set, then none type is returned.
+     *
+     * @param nodeObj node object
+     * @return operation type of the class
+     */
+    public static YdtContextOperationType getOperationTypeOfTheNode(
+            Object nodeObj) {
+        Object opTypeObj;
+        try {
+            opTypeObj = getAttributeOfObject(nodeObj, OPERATION_TYPE);
+        } catch (NoSuchMethodException e) {
+            return YdtContextOperationType.valueOf(STR_NONE);
+        }
+        String opTypeValue = String.valueOf(opTypeObj);
+        if (opTypeValue.equals(STR_NULL)) {
+            opTypeValue = STR_NONE;
+        }
+        return YdtContextOperationType.valueOf(opTypeValue);
+    }
+
+    /**
+     * Returns true, if data type of leaf is primitive data type; false
+     * otherwise.
+     *
+     * @param yangType leaf type
+     * @return true if data type is primitive; false otherwise
+     */
+    public static boolean isTypePrimitive(YangType yangType) {
+        if (yangType.getDataType() == LEAFREF) {
+            YangLeafRef leafRef =
+                    (YangLeafRef) yangType.getDataTypeExtendedInfo();
+            return isPrimitiveDataType(leafRef.getEffectiveDataType()
+                                               .getDataType());
+        }
+        return isPrimitiveDataType(yangType.getDataType());
+    }
+
+    /**
+     * Returns the registered class from the YSR of the module node where
+     * augment is present.
+     *
+     * @param curNode  current augment node
+     * @param registry schema registry
+     * @return class loader of module
+     */
+    public static Class<?> getClassLoaderForAugment(
+            YangNode curNode, YangSchemaRegistry registry) {
+        YangNode moduleNode = curNode.getParent();
+        String moduleName = moduleNode.getJavaClassNameOrBuiltInType();
+        String modulePackage = moduleNode.getJavaPackage();
+        return registry.getRegisteredClass(moduleNode,
+                                           modulePackage + PERIOD + moduleName);
+    }
+
+    /**
+     * Returns the string true, if the leaf data is actually set; false
+     * otherwise.
+     *
+     * @param nodeObj    object if the node
+     * @param javaName   java name of the leaf
+     * @param methodName getter method name
+     * @return string value of the boolean method
+     */
+    public static String isValueOrSelectLeafSet(
+            Object nodeObj, String javaName, String methodName) {
+
+        Class<?> nodeClass = nodeObj.getClass();
+        Class<?> interfaceClass = getInterfaceClassFromImplClass(nodeObj);
+
+        // Appends the enum inner package to the interface class package.
+        String enumPackage = interfaceClass.getName() + ENUM_LEAF_IDENTIFIER;
+
+        ClassLoader classLoader = interfaceClass.getClassLoader();
+        Class leafEnum;
+        try {
+            leafEnum = classLoader.loadClass(enumPackage);
+            Method getterMethod = nodeClass.getMethod(methodName, leafEnum);
+            // Gets the value of the enum.
+            Enum<?> value = Enum.valueOf(leafEnum, javaName.toUpperCase());
+            // Invokes the method with the value of enum as param.
+            return String.valueOf(getterMethod.invoke(nodeObj, value));
+        } catch (IllegalAccessException | InvocationTargetException |
+                NoSuchMethodException | ClassNotFoundException e) {
+            throw new YtbException(e);
+        }
+    }
+
+    /**
+     * Returns the string value from the respective data types of the
+     * leaf/leaf-list.
+     * // TODO: Remove this method and append to the data model utils.
+     *
+     * @param fieldObj object of the leaf/leaf-list field
+     * @param dataType type of the leaf/leaf-list
+     * @return string value from the type
+     */
+    public static String getStringFromDataType(Object fieldObj,
+                                               YangType dataType) {
+        YangDataTypes type = dataType.getDataType();
+        switch (type) {
+            case INT8:
+            case INT16:
+            case INT32:
+            case INT64:
+            case UINT8:
+            case UINT16:
+            case UINT32:
+            case UINT64:
+            case EMPTY:
+            case IDENTITYREF:
+            case STRING:
+            case DECIMAL64:
+            case INSTANCE_IDENTIFIER:
+            case DERIVED:
+            case UNION:
+                //TODO: Generated code has to be changed, it must select
+                // the setting leaf and it must give back the corresponding
+                // toString of that type.
+            case BOOLEAN:
+            case BITS:
+                return getValueFromToStringHelper(String.valueOf(fieldObj));
+
+            case BINARY:
+                return Base64.getEncoder().encodeToString((byte[]) fieldObj);
+
+            case LEAFREF:
+                YangLeafRef leafRef =
+                        (YangLeafRef) dataType.getDataTypeExtendedInfo();
+                return getStringFromDataType(fieldObj,
+                                             leafRef.getEffectiveDataType());
+
+            case ENUMERATION:
+                Object value;
+                try {
+                    value = getAttributeOfObject(fieldObj, SCHEMA_NAME_IN_ENUM);
+                } catch (NoSuchMethodException e) {
+                    throw new YtbException(e);
+                }
+                return getValueFromToStringHelper(String.valueOf(value));
+
+            default:
+                throw new YtbException("Unsupported data type. Cannot be " +
+                                               "processed.");
+        }
+    }
+
+    /**
+     * Returns the value, from the toString value which uses toStringHelper.
+     * It gives values in non-usable format(e.g., {value = 5}). But the value
+     * that has to be returned is only 5.So it parses the string and returns
+     * only the value. In certain toString, to string helper is not used, so
+     * the original value is sent without parsing.
+     *
+     * @param rawString raw string
+     * @return parsed value
+     */
+    private static String getValueFromToStringHelper(String rawString) {
+        if (rawString.contains(EQUALS)) {
+            int index = rawString.lastIndexOf(EQUALS);
+            int braceIndex = rawString.indexOf(CLOSE_BRACE);
+            if (index != -1) {
+                return rawString.substring(index + 1, braceIndex);
+            }
+        }
+        return rawString;
+    }
+
+    /**
+     * Returns true, if the data type is primitive; false otherwise.
+     *
+     * @param dataType data type
+     * @return true if the data type is primitive; false otherwise
+     */
+    private static boolean isPrimitiveDataType(YangDataTypes dataType) {
+        return PRIMITIVE_TYPES.contains(dataType);
+    }
+
+    /**
+     * Returns true, if processing of the node is not required; false otherwise.
+     * For the nodes such as notification, RPC, augment there is a different
+     * flow, so these nodes are skipped in normal conditions.
+     *
+     * @param yangNode node to be checked
+     * @return true if node processing is not required; false otherwise.
+     */
+    public static boolean isNonProcessableNode(YangNode yangNode) {
+        return yangNode != null && (yangNode instanceof YangNotification) ||
+                (yangNode instanceof YangRpc) || (yangNode instanceof YangAugment);
+    }
+
+    /**
+     * Returns true, if multi instance node; false otherwise.
+     *
+     * @param yangNode YANG node
+     * @return true, if multi instance node; false otherwise.
+     */
+    public static boolean isMultiInstanceNode(YangNode yangNode) {
+        return yangNode.getYangSchemaNodeType() == YANG_MULTI_INSTANCE_NODE;
+    }
+
+    /**
+     * Returns true, if augment node; false otherwise.
+     *
+     * @param yangNode YANG node
+     * @return true, if augment node; false otherwise.
+     */
+    public static boolean isAugmentNode(YangNode yangNode) {
+        return yangNode.getYangSchemaNodeType() == YANG_AUGMENT_NODE;
+    }
+
+    /**
+     * Returns string for throwing error when empty object is given as input
+     * to YTB.
+     *
+     * @param objName name of the object
+     * @return error message
+     */
+    public static String emptyObjErrMsg(String objName) {
+        return "The " + objName + " given for tree creation cannot be null";
+    }
+
+    /**
+     * Returns the java name for the nodes, leaf/leaf-list.
+     *
+     * @param node YANG node
+     * @return node java name
+     */
+    public static String getJavaName(Object node) {
+        return ((JavaLeafInfoContainer) node).getJavaName(null);
+    }
+
+    /**
+     * Returns true, if the list is not null and non-empty; false otherwise.
+     *
+     * @param object list object
+     * @return true, if the list is not null and non-empty; false otherwise
+     */
+    public static boolean isNonEmpty(List object) {
+        return object != null && !object.isEmpty();
+    }
+
+    /**
+     * Returns true, if the string is not null and non-empty; false otherwise.
+     *
+     * @param str string value
+     * @return true, if the string is not null and non-empty; false otherwise.
+     */
+    public static boolean isNonEmpty(String str) {
+        return str != null && !str.isEmpty();
+    }
+
+    /**
+     * Returns true when the node processing of RPC and notification is
+     * completed; false otherwise. For RPC and notification, processing of
+     * other nodes are invalid, so once node gets completed, it must be stopped.
+     *
+     * @param curNode      current node
+     * @param curTraversal current traversal of the node
+     * @return true, if the node processing is completed; false otherwise.
+     */
+    public static boolean isNodeProcessCompleted(
+            YangNode curNode, TraversalType curTraversal) {
+        return (curTraversal == PARENT &&
+                curNode instanceof YangNotification) ||
+                curNode instanceof YangOutput;
+    }
+
+}
diff --git a/apps/yms/app/src/main/java/org/onosproject/yms/app/ytb/package-info.java b/apps/yms/app/src/main/java/org/onosproject/yms/app/ytb/package-info.java
new file mode 100644
index 0000000..1a4a827
--- /dev/null
+++ b/apps/yms/app/src/main/java/org/onosproject/yms/app/ytb/package-info.java
@@ -0,0 +1,21 @@
+/*
+ * 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.
+ */
+
+/**
+ * Provides implementation of YANG tree builder. YTB handles creation of YDT
+ * from YANG modeled objects.
+ */
+package org.onosproject.yms.app.ytb;
diff --git a/apps/yms/app/src/test/java/org/onosproject/yms/app/ytb/DefaultYangTreeBuilderTest.java b/apps/yms/app/src/test/java/org/onosproject/yms/app/ytb/DefaultYangTreeBuilderTest.java
new file mode 100644
index 0000000..b7bec31
--- /dev/null
+++ b/apps/yms/app/src/test/java/org/onosproject/yms/app/ytb/DefaultYangTreeBuilderTest.java
@@ -0,0 +1,1127 @@
+/*
+ * 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.ytb;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.onosproject.yang.gen.v1.yms.test.ytb.derived.type.with.bits.and.binary.rev20160826.YtbDerivedTypeWithBitsAndBinary;
+import org.onosproject.yang.gen.v1.yms.test.ytb.derived.type.with.bits.and.binary.rev20160826.YtbDerivedTypeWithBitsAndBinaryOpParam;
+import org.onosproject.yang.gen.v1.yms.test.ytb.derived.type.with.bits.and.binary.rev20160826.ytbderivedtypewithbitsandbinary.Derivedbinarya;
+import org.onosproject.yang.gen.v1.yms.test.ytb.derived.type.with.bits.and.binary.rev20160826.ytbderivedtypewithbitsandbinary.Derivedbinaryb;
+import org.onosproject.yang.gen.v1.yms.test.ytb.derived.type.with.bits.and.binary.rev20160826.ytbderivedtypewithbitsandbinary.Derivedbitsa;
+import org.onosproject.yang.gen.v1.yms.test.ytb.derived.type.with.bits.and.binary.rev20160826.ytbderivedtypewithbitsandbinary.Derivedbitsb;
+import org.onosproject.yang.gen.v1.yms.test.ytb.derived.type.with.bits.and.binary.rev20160826.ytbderivedtypewithbitsandbinary.ForunionUnion;
+import org.onosproject.yang.gen.v1.yms.test.ytb.module.with.container.rev20160826.YtbModuleWithContainer;
+import org.onosproject.yang.gen.v1.yms.test.ytb.module.with.container.rev20160826.YtbModuleWithContainerOpParam;
+import org.onosproject.yang.gen.v1.yms.test.ytb.module.with.container.rev20160826.ytbmodulewithcontainer.DefaultSched;
+import org.onosproject.yang.gen.v1.yms.test.ytb.module.with.container.rev20160826.ytbmodulewithcontainer.Sched;
+import org.onosproject.yang.gen.v1.yms.test.ytb.module.with.leaf.ietfschedule.rev20160826.YtbIetfSchedule;
+import org.onosproject.yang.gen.v1.yms.test.ytb.module.with.leaf.ietfschedule.rev20160826.YtbIetfScheduleOpParam;
+import org.onosproject.yang.gen.v1.yms.test.ytb.module.with.leaf.ietfschedule.rev20160826.ytbietfschedule.Enum1Enum;
+import org.onosproject.yang.gen.v1.yms.test.ytb.module.with.leaf.ietfschedule.rev20160826.ytbietfschedule.Enum2Enum;
+import org.onosproject.yang.gen.v1.yms.test.ytb.module.with.leaflist.rev20160826.YtbModuleWithLeafList;
+import org.onosproject.yang.gen.v1.yms.test.ytb.module.with.leaflist.rev20160826.YtbModuleWithLeafListOpParam;
+import org.onosproject.yang.gen.v1.yms.test.ytb.module.with.list.rev20160826.YtbModuleWithList;
+import org.onosproject.yang.gen.v1.yms.test.ytb.module.with.list.rev20160826.YtbModuleWithListOpParam;
+import org.onosproject.yang.gen.v1.yms.test.ytb.module.with.list.rev20160826.ytbmodulewithlist.DefaultYtblistlist;
+import org.onosproject.yang.gen.v1.yms.test.ytb.module.with.list.rev20160826.ytbmodulewithlist.Find;
+import org.onosproject.yang.gen.v1.yms.test.ytb.module.with.list.rev20160826.ytbmodulewithlist.Ytblistlist;
+import org.onosproject.yang.gen.v1.yms.test.ytb.multi.module.a.rev20160826.YtbMultiModulea;
+import org.onosproject.yang.gen.v1.yms.test.ytb.multi.module.a.rev20160826.YtbMultiModuleaOpParam;
+import org.onosproject.yang.gen.v1.yms.test.ytb.multi.module.a.rev20160826.ytbmultimodulea.DefaultYtbmultilist;
+import org.onosproject.yang.gen.v1.yms.test.ytb.multi.module.a.rev20160826.ytbmultimodulea.Ytbmultilist;
+import org.onosproject.yang.gen.v1.yms.test.ytb.multi.module.b.rev20160826.YtbMultiModuleb;
+import org.onosproject.yang.gen.v1.yms.test.ytb.multi.module.b.rev20160826.YtbMultiModulebOpParam;
+import org.onosproject.yang.gen.v1.yms.test.ytb.multi.module.b.rev20160826.ytbmultimoduleb.DefaultYtbmultilistb;
+import org.onosproject.yang.gen.v1.yms.test.ytb.multi.module.b.rev20160826.ytbmultimoduleb.Ytbmultilistb;
+import org.onosproject.yang.gen.v1.yms.test.ytb.multi.notification.with.container.rev20160826.ytbmultinotificationwithcontainer.DefaultFortesta;
+import org.onosproject.yang.gen.v1.yms.test.ytb.multi.notification.with.container.rev20160826.ytbmultinotificationwithcontainer.Fortesta;
+import org.onosproject.yang.gen.v1.yms.test.ytb.multi.notification.with.container.rev20160826.ytbmultinotificationwithcontainer.YtbMultiNotificationWithContainerEvent;
+import org.onosproject.yang.gen.v1.yms.test.ytb.multi.notification.with.container.rev20160826.ytbmultinotificationwithcontainer.YtbMultiNotificationWithContainerEventSubject;
+import org.onosproject.yang.gen.v1.yms.test.ytb.multi.notification.with.container.rev20160826.ytbmultinotificationwithcontainer.fortesta.DefaultYtbnot;
+import org.onosproject.yang.gen.v1.yms.test.ytb.multi.notification.with.container.rev20160826.ytbmultinotificationwithcontainer.fortesta.Ytbnot;
+import org.onosproject.yang.gen.v1.yms.test.ytb.tree.builder.yangautoprefixfor.list.having.list.rev20160826.YtbTreeBuilderForListHavingList;
+import org.onosproject.yang.gen.v1.yms.test.ytb.tree.builder.yangautoprefixfor.list.having.list.rev20160826.YtbTreeBuilderForListHavingListOpParam;
+import org.onosproject.yang.gen.v1.yms.test.ytb.tree.builder.yangautoprefixfor.list.having.list.rev20160826.ytbtreebuilderforlisthavinglist.Carrier;
+import org.onosproject.yang.gen.v1.yms.test.ytb.tree.builder.yangautoprefixfor.list.having.list.rev20160826.ytbtreebuilderforlisthavinglist.DefaultCarrier;
+import org.onosproject.yang.gen.v1.yms.test.ytb.tree.builder.yangautoprefixfor.list.having.list.rev20160826.ytbtreebuilderforlisthavinglist.carrier.DefaultMultiplexes;
+import org.onosproject.yang.gen.v1.yms.test.ytb.tree.builder.yangautoprefixfor.list.having.list.rev20160826.ytbtreebuilderforlisthavinglist.carrier.Multiplexes;
+import org.onosproject.yang.gen.v1.yms.test.ytb.tree.builder.yangautoprefixfor.list.having.list.rev20160826.ytbtreebuilderforlisthavinglist.carrier.multiplexes.ApplicationAreas;
+import org.onosproject.yang.gen.v1.yms.test.ytb.tree.builder.yangautoprefixfor.list.having.list.rev20160826.ytbtreebuilderforlisthavinglist.carrier.multiplexes.DefaultApplicationAreas;
+import org.onosproject.yang.gen.v1.yms.test.ytb.tree.builder.yangautoprefixfor.list.having.list.rev20160826.ytbtreebuilderforlisthavinglist.carrier.multiplexes.TypesEnum;
+import org.onosproject.yms.app.ydt.YdtExtendedBuilder;
+import org.onosproject.yms.app.ydt.YdtNode;
+import org.onosproject.yms.app.ysr.DefaultYangSchemaRegistry;
+import org.onosproject.yms.ydt.YdtBuilder;
+import org.onosproject.yms.ydt.YdtContext;
+import org.onosproject.yms.ydt.YdtContextOperationType;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.util.ArrayList;
+import java.util.BitSet;
+import java.util.List;
+import java.util.Set;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.Is.is;
+import static org.onosproject.yang.gen.v1.yms.test.ytb.module.with.leaf.ietfschedule.rev20160826.YtbIetfScheduleOpParam.OnosYangNodeOperationType;
+import static org.onosproject.yms.ydt.YdtContextOperationType.CREATE;
+import static org.onosproject.yms.ydt.YdtContextOperationType.DELETE;
+import static org.onosproject.yms.ydt.YdtContextOperationType.MERGE;
+import static org.onosproject.yms.ydt.YdtContextOperationType.NONE;
+import static org.onosproject.yms.ydt.YmsOperationType.EDIT_CONFIG_REQUEST;
+import static org.onosproject.yms.ydt.YmsOperationType.QUERY_CONFIG_REQUEST;
+import static org.onosproject.yms.ydt.YmsOperationType.QUERY_REQUEST;
+
+/**
+ * Unit test cases for YANG tree builder with different YANG object
+ * configuration.
+ */
+public class DefaultYangTreeBuilderTest extends YtbErrMsgAndConstants {
+
+
+    private static final String ONE = "1";
+    private static final String TWO = "2";
+    private static final String THREE = "3";
+    private static final String FOUR = "4";
+    private static final String FIVE = "5";
+    private static final String SIX = "6";
+    private static final String NINE = "9";
+    private static final String IETF_SCHEDULE = "YtbIetfSchedule";
+    private static final String TIME = "time";
+    private static final String MOD_LEAF_LIST = "YtbModuleWithLeafList";
+    private static final String ENUM_1 = "enum1";
+    private static final String ENUM_2 = "enum2";
+    private static final String HUNDRED = "hundred";
+    private static final String HUNDRED_100 = "hundred-100";
+    private static final String TEN_10 = "ten-10";
+    private static final String THOUSAND_1000 = "thousand-1000";
+    private static final String MOD_CONT = "YtbModuleWithContainer";
+    private static final String SCHED = "sched";
+    private static final String PREDICT_VAL = "98989";
+    private static final String MOD_LIST = "YtbModuleWithList";
+    private static final String LIST_LIST = "ytblistlist";
+    private static final String PREDICTION = "prediction";
+    private static final String TRUE = "true";
+    private static final String FALSE = "false";
+    private static final String MUL_NOTIFY =
+            "YtbMultiNotificationWithContainer";
+    private static final String NOTIFICATION = "notification";
+    private static final String NOTIFY = "fortesta";
+    private static final String YTB_NOTIFY_CONT = "ytbnot";
+    private static final String NOTIFY_LEAF = "notileaf";
+    private static final String ANT = "ant";
+    private static final String ANIMAL = "animal";
+    private static final String BIRD = "bird";
+    private static final String BALL = "ball";
+    private static final String BAT = "bat";
+    private static final String MUL_MOD_A = "YtbMultiModulea";
+    private static final String MUL_LIST_A = "ytbmultilist";
+    private static final String CHECK = "check";
+    private static final String MUL_MOD_B = "YtbMultiModuleb";
+    private static final String MUL_LIST_B = "ytbmultilistb";
+    private static final String CHECKIN = "checkin";
+    private static final String LIST_WITH_LIST =
+            "YtbTreeBuilderForListHavingList";
+    private static final String CONT_CARRIER = "carrier";
+    private static final String LIST_MULTIPLEXES = "multiplexes";
+    private static final String TYPES = "types";
+    private static final String TIME_DIVISION = "time-division";
+    private static final String APP_AREA_LIST = "application-areas";
+    private static final String DEST_AREA = "destination-areas";
+    private static final String FREQUENCY_DIV = "frequency-division";
+    private static final String MOD_BIT_BIN = "YtbDerivedTypeWithBitsAndBinary";
+    private static final String FOR_BINARY = "forbinary";
+    private static final String BIN_VAL_1 = "BQUF";
+    private static final String FOR_BITS = "forbits";
+    private static final String FOR_BINARY_LIST = "forbinarylist";
+    private static final String BIN_VAL_2 = "CQkA";
+    private static final String BIN_VAL_3 = "DAYA";
+    private static final String BIN_VAL_4 = "EB0Z";
+    private static final String FOR_BITS_LIST = "forbitslist";
+    private static final String FOR_UNION = "forunion";
+    private static final String ZERO = "0";
+
+    @Rule
+    public ExpectedException thrown = ExpectedException.none();
+
+    private static String emptyObjErrMsg(String objName) {
+        return "The " + objName + " given for tree creation cannot be null";
+    }
+
+    private static BigDecimal getBigDeci(int bigDecimal) {
+        return BigDecimal.valueOf(bigDecimal);
+    }
+
+    /**
+     * Processes an empty object list to the YTB and checks that the
+     * exception is thrown.
+     */
+    @Test
+    public void processInvalidListInput() {
+        thrown.expect(YtbException.class);
+        thrown.expectMessage(emptyObjErrMsg("object list"));
+        DefaultYangTreeBuilder treeBuilder = new DefaultYangTreeBuilder();
+        treeBuilder.getYdtBuilderForYo(null, ROOT_NAME, ROOT_NAME_SPACE,
+                                       EDIT_CONFIG_REQUEST, null);
+    }
+
+    /**
+     * Processes an empty notification object to the YTB and checks that the
+     * exception is thrown.
+     */
+    @Test
+    public void processInvalidInputForNotification() {
+        thrown.expect(YtbException.class);
+        thrown.expectMessage(emptyObjErrMsg("event object"));
+        DefaultYangTreeBuilder treeBuilder = new DefaultYangTreeBuilder();
+        treeBuilder.getYdtForNotification(null, ROOT_NAME, null);
+    }
+
+    /**
+     * Processes an empty rpc output object to the YTB and checks that the
+     * exception is thrown.
+     */
+    @Test
+    public void processInvalidInputForRpc() {
+        thrown.expect(YtbException.class);
+        thrown.expectMessage(emptyObjErrMsg("output object"));
+        DefaultYangTreeBuilder treeBuilder = new DefaultYangTreeBuilder();
+        treeBuilder.getYdtForRpcResponse(null, null);
+    }
+
+    /**
+     * Processes a YAB/YSB request to YTB with a leaf value being filled in
+     * the app object. Checks the constructed YDT tree for module and leaf
+     * and its value.
+     */
+    @Test
+    public void processModuleAndLeaf() {
+
+        schemaProvider.processSchemaRegistry(null);
+        DefaultYangSchemaRegistry registry = schemaProvider
+                .getDefaultYangSchemaRegistry();
+
+        // As an application, creates the object.
+        YtbIetfSchedule schedule = new YtbIetfScheduleOpParam
+                .YtbIetfScheduleBuilder()
+                .time((byte) 9)
+                .onosYangNodeOperationType(OnosYangNodeOperationType.MERGE)
+                .build();
+
+        // As YSB or YAB protocol sets the value for YTB.
+        List<Object> objectList = new ArrayList<>();
+        objectList.add(schedule);
+
+        // Builds YANG tree in YTB.
+        DefaultYangTreeBuilder treeBuilder = new DefaultYangTreeBuilder();
+        YdtExtendedBuilder ydtBuilder = treeBuilder.getYdtBuilderForYo(
+                objectList, ROOT_NAME, ROOT_NAME_SPACE,
+                EDIT_CONFIG_REQUEST, registry);
+
+        // Receives YDT context and checks the tree that is built.
+        YdtContext context = ydtBuilder.getRootNode();
+
+        // Gets the first module from logical root node.
+        YdtContext module = context.getFirstChild();
+        YdtContextOperationType opType = ((YdtNode) module)
+                .getYdtContextOperationType();
+        assertThat(getInCrtName(MODULE, IETF_SCHEDULE),
+                   module.getName(), is(IETF_SCHEDULE));
+        assertThat(getInCrtOpType(MODULE, IETF_SCHEDULE),
+                   opType, is(MERGE));
+
+        // Gets the first leaf from module IetfSchedule.
+        YdtContext leafContext = module.getFirstChild();
+        assertThat(getInCrtName(LEAF, TIME),
+                   leafContext.getName(), is(TIME));
+        assertThat(getInCrtLeafValue(TIME, NINE),
+                   leafContext.getValue(), is(NINE));
+    }
+
+    /**
+     * Processes a YAB/YSB request to YTB with a leaf-list value being filled
+     * in the app object. Checks the constructed YDT tree for module and
+     * leaf-list and its value.
+     */
+    @Test
+    public void processModuleAndLeafList() {
+
+        schemaProvider.processSchemaRegistry(null);
+        DefaultYangSchemaRegistry registry = schemaProvider
+                .getDefaultYangSchemaRegistry();
+
+        // As an application, creates the object.
+
+        // Creates list of type long for setting the leaf-list.
+        List<Long> longList = new ArrayList<>();
+        longList.add((long) 1);
+        longList.add((long) 2);
+        longList.add((long) 3);
+
+        YtbModuleWithLeafList leafListModule = new YtbModuleWithLeafListOpParam
+                .YtbModuleWithLeafListBuilder().time(longList).build();
+
+        // As YSB or YAB protocol sets the value for YTB.
+        List<Object> objectList = new ArrayList<>();
+        objectList.add(leafListModule);
+
+        // Builds YANG tree in YTB.
+        DefaultYangTreeBuilder treeBuilder = new DefaultYangTreeBuilder();
+        YdtBuilder ydtBuilder = treeBuilder.getYdtBuilderForYo(
+                objectList, ROOT_NAME, ROOT_NAME_SPACE, QUERY_REQUEST, registry);
+
+        // Receives YDT context and check the tree that is built.
+        YdtContext context = ydtBuilder.getRootNode();
+
+        // Gets the first module from logical root node.
+        YdtContext module = context.getFirstChild();
+        YdtContextOperationType opType = ((YdtNode) module)
+                .getYdtContextOperationType();
+        assertThat(getInCrtName(MODULE, MOD_LEAF_LIST),
+                   module.getName(), is(MOD_LEAF_LIST));
+        assertThat(getInCrtOpType(MODULE, MOD_LEAF_LIST), opType, is(NONE));
+
+        // Gets the first leaf-list from module.
+        YdtContext leafList = module.getFirstChild();
+        assertThat(getInCrtName(LEAF_LIST, TIME), leafList.getName(),
+                   is(TIME));
+        Set<String> value = leafList.getValueSet();
+        assertThat(getInCrtLeafListValue(TIME, ONE),
+                   value.contains(ONE), is(true));
+        assertThat(getInCrtLeafListValue(TIME, TWO),
+                   value.contains(TWO), is(true));
+        assertThat(getInCrtLeafListValue(TIME, THREE),
+                   value.contains(THREE), is(true));
+    }
+
+    /**
+     * Processes leaf and leaf-list with type enum under module. Checks the
+     * constructed YDT tree has YANG enum value.
+     */
+    @Test
+    public void processWithTypeEnum() {
+
+        schemaProvider.processSchemaRegistry(null);
+        DefaultYangSchemaRegistry registry = schemaProvider
+                .getDefaultYangSchemaRegistry();
+
+        // As an application, creates the object.
+
+        // Creates enum list for setting the leaf-list.
+        List<Enum2Enum> enumList = new ArrayList<>();
+        enumList.add(Enum2Enum.HUNDRED_100);
+        enumList.add(Enum2Enum.TEN_10);
+        enumList.add(Enum2Enum.THOUSAND_1000);
+
+        YtbIetfSchedule schedule = new YtbIetfScheduleOpParam
+                .YtbIetfScheduleBuilder()
+                .time((byte) 9)
+                .onosYangNodeOperationType(OnosYangNodeOperationType.MERGE)
+                .enum1(Enum1Enum.HUNDRED)
+                .enum2(enumList)
+                .build();
+
+
+        // As YSB or YAB protocol sets the value for YTB.
+        List<Object> objectList = new ArrayList<>();
+        objectList.add(schedule);
+
+        // Builds YANG tree in YTB.
+        DefaultYangTreeBuilder treeBuilder = new DefaultYangTreeBuilder();
+        YdtExtendedBuilder ydtBuilder = treeBuilder.getYdtBuilderForYo(
+                objectList, ROOT_NAME, ROOT_NAME_SPACE,
+                EDIT_CONFIG_REQUEST, registry);
+
+        // Receives YDT context and check the tree that is built.
+        YdtContext context = ydtBuilder.getRootNode();
+
+        // Gets the first module from logical root node.
+        YdtContext module = context.getFirstChild();
+        YdtContextOperationType opType =
+                ((YdtNode) module).getYdtContextOperationType();
+        assertThat(getInCrtName(MODULE, IETF_SCHEDULE),
+                   module.getName(), is(IETF_SCHEDULE));
+        assertThat(getInCrtOpType(MODULE, IETF_SCHEDULE), opType, is(MERGE));
+
+        // Checks the leaf and leaf-list values.
+        YdtContext timeLeaf = module.getFirstChild();
+        assertThat(getInCrtName(LEAF, TIME), timeLeaf.getName(), is(TIME));
+        assertThat(getInCrtLeafValue(TIME, NINE),
+                   timeLeaf.getValue(), is(NINE));
+
+        YdtContext enum1Leaf = timeLeaf.getNextSibling();
+        assertThat(getInCrtName(LEAF, ENUM_1), enum1Leaf.getName(), is(ENUM_1));
+        assertThat(getInCrtLeafValue(ENUM_1, HUNDRED),
+                   enum1Leaf.getValue(), is(HUNDRED));
+
+        YdtContext enum2LeafList = enum1Leaf.getNextSibling();
+        assertThat(getInCrtName(LEAF_LIST, ENUM_2),
+                   enum2LeafList.getName(), is(ENUM_2));
+        Set<String> valueSet = enum2LeafList.getValueSet();
+        assertThat(getInCrtLeafListValue(ENUM_2, HUNDRED_100),
+                   valueSet.contains(HUNDRED_100), is(true));
+        assertThat(getInCrtLeafListValue(ENUM_2, TEN_10),
+                   valueSet.contains(TEN_10), is(true));
+        assertThat(getInCrtLeafListValue(ENUM_2, THOUSAND_1000),
+                   valueSet.contains(THOUSAND_1000), is(true));
+    }
+
+    /**
+     * Processes a YAB/YSB request to YTB with a container having leaf value
+     * being filled in the app object. Checks the constructed YDT tree for
+     * module and container and leaf.
+     */
+    @Test
+    public void processModuleWithContainer() {
+
+        schemaProvider.processSchemaRegistry(null);
+        DefaultYangSchemaRegistry registry = schemaProvider
+                .getDefaultYangSchemaRegistry();
+
+        // As an application, creates the object.
+
+        // Creates container object with leaf of decimal type.
+        Sched sched = new DefaultSched.SchedBuilder()
+                .predict(getBigDeci(98989))
+                .onosYangNodeOperationType(
+                        DefaultSched.OnosYangNodeOperationType.DELETE)
+                .build();
+        // Creates module object with the container.
+        YtbModuleWithContainer contModule = new YtbModuleWithContainerOpParam
+                .YtbModuleWithContainerBuilder()
+                .sched(sched)
+                .onosYangNodeOperationType(
+                        YtbModuleWithContainerOpParam
+                                .OnosYangNodeOperationType.CREATE)
+                .build();
+
+        // As YSB or YAB protocol sets the value for YTB.
+        List<Object> objectList = new ArrayList<>();
+        objectList.add(contModule);
+
+        // Builds YANG tree in YTB.
+        DefaultYangTreeBuilder treeBuilder = new DefaultYangTreeBuilder();
+        YdtBuilder ydtBuilder = treeBuilder.getYdtBuilderForYo(
+                objectList, ROOT_NAME, ROOT_NAME_SPACE,
+                QUERY_CONFIG_REQUEST, registry);
+
+        // Receives YDT context and check the tree that is built.
+        YdtContext context = ydtBuilder.getRootNode();
+
+        // Gets the first module from logical root node.
+        YdtContext module = context.getFirstChild();
+        YdtContextOperationType opType = ((YdtNode) module)
+                .getYdtContextOperationType();
+
+        assertThat(getInCrtName(MODULE, MOD_CONT),
+                   module.getName(), is(MOD_CONT));
+        assertThat(getInCrtOpType(MODULE, MOD_CONT), opType, is(CREATE));
+
+        // Get the container from module.
+        YdtContext container = module.getFirstChild();
+        YdtContextOperationType opTypeOfCont = ((YdtNode) container)
+                .getYdtContextOperationType();
+
+        assertThat(getInCrtName(CONTAINER, SCHED),
+                   container.getName(), is("sched"));
+        assertThat(getInCrtOpType(CONTAINER, SCHED), opTypeOfCont, is(DELETE));
+
+        // Gets leaf from container.
+        YdtContext leafContext = container.getFirstChild();
+        assertThat(getInCrtName(LEAF, PREDICT),
+                   leafContext.getName(), is(PREDICT));
+        assertThat(getInCrtLeafValue(PREDICT, PREDICT_VAL),
+                   leafContext.getValue(), is(PREDICT_VAL));
+    }
+
+    /**
+     * Processes a YAB/YSB request to YTB with a list having leaf-list value
+     * being filled in the app object. Checks the constructed YDT tree for
+     * module and list and leaf-list.
+     */
+    @Test
+    public void processModuleWithList() {
+
+        schemaProvider.processSchemaRegistry(null);
+        DefaultYangSchemaRegistry registry = schemaProvider
+                .getDefaultYangSchemaRegistry();
+
+        // As an application, creates the object.
+
+        // Creates multi typedef values.
+        Find find1 = new Find(true);
+        Find find2 = new Find(false);
+        Find find3 = new Find(true);
+        Find find4 = new Find(false);
+
+        // Creates two lists, with the typedef values added.
+        List<Find> findList1 = new ArrayList<>();
+        List<Find> findList2 = new ArrayList<>();
+        findList1.add(find1);
+        findList1.add(find2);
+        findList2.add(find3);
+        findList2.add(find4);
+
+        // Creates two list contents.
+        Ytblistlist list1 = new DefaultYtblistlist
+                .YtblistlistBuilder().prediction(findList1).build();
+        Ytblistlist list2 = new DefaultYtblistlist
+                .YtblistlistBuilder().prediction(findList2).build();
+
+        List<Ytblistlist> ytbList = new ArrayList<>();
+        ytbList.add(list1);
+        ytbList.add(list2);
+
+        // Creates module having list.
+        YtbModuleWithList listModule = new YtbModuleWithListOpParam
+                .YtbModuleWithListBuilder().ytblistlist(ytbList).build();
+
+        // As YSB or YAB protocol sets the value for YTB.
+        List<Object> objectList = new ArrayList<>();
+        objectList.add(listModule);
+
+        // Builds YANG tree in YTB.
+        DefaultYangTreeBuilder treeBuilder = new DefaultYangTreeBuilder();
+        YdtBuilder ydtBuilder = treeBuilder.getYdtBuilderForYo(
+                objectList, ROOT_NAME, ROOT_NAME_SPACE,
+                EDIT_CONFIG_REQUEST, registry);
+
+        // Receives YDT context and check the tree that is built.
+        YdtContext context = ydtBuilder.getRootNode();
+
+        // Gets the first module from logical root node.
+        YdtContext module = context.getFirstChild();
+        YdtContextOperationType opType = ((YdtNode) module)
+                .getYdtContextOperationType();
+
+        assertThat(getInCrtName(MODULE, MOD_LIST),
+                   module.getName(), is(MOD_LIST));
+        assertThat(getInCrtOpType(MODULE, MOD_LIST), opType, is(NONE));
+
+        // Gets the first list from module YtbModuleWithList.
+        YdtContext firstList = module.getFirstChild();
+        YdtContextOperationType listOpType = ((YdtNode) firstList)
+                .getYdtContextOperationType();
+        // Checks the contents in the list.
+        assertThat(getInCrtName(LIST, LIST_LIST),
+                   firstList.getName(), is(LIST_LIST));
+        assertThat(getInCrtOpType(LIST, LIST_LIST), listOpType, is(NONE));
+
+        // Gets the contents of the leaf-list in the first list content.
+        YdtContext leafListInList1 = firstList.getFirstChild();
+
+        // Evaluates the leaf-list values.
+        Set leafListValue1 = leafListInList1.getValueSet();
+        assertThat(getInCrtName(LEAF_LIST, PREDICTION),
+                   leafListInList1.getName(), is(PREDICTION));
+        assertThat(getInCrtLeafListValue(PREDICTION, TRUE),
+                   leafListValue1.contains(TRUE), is(true));
+        assertThat(getInCrtLeafListValue(PREDICTION, FALSE),
+                   leafListValue1.contains(FALSE), is(true));
+
+        // Gets the second list from module YtbModuleWithList.
+        YdtContext secondList = firstList.getNextSibling();
+
+        // Gets the contents of the leaf-list in the second list content.
+        YdtContext leafListInList2 = secondList.getFirstChild();
+        // Evaluates the leaf-list values.
+        Set leafListValue2 = leafListInList2.getValueSet();
+        assertThat(getInCrtName(LEAF_LIST, PREDICTION),
+                   leafListInList2.getName(), is(PREDICTION));
+        assertThat(getInCrtLeafListValue(PREDICTION, TRUE),
+                   leafListValue2.contains(TRUE), is(true));
+        assertThat(getInCrtLeafListValue(PREDICTION, FALSE),
+                   leafListValue2.contains(FALSE), is(true));
+    }
+
+    /**
+     * Processes multi notification under module when request comes for one
+     * notification event in module.
+     */
+    @Test
+    public void processMultiNotificationWithContainer() {
+
+        schemaProvider.processSchemaRegistry(null);
+        DefaultYangSchemaRegistry registry = schemaProvider
+                .getDefaultYangSchemaRegistry();
+
+        // As an application, creates the object.
+
+        // Sets the bit value.
+        BitSet bitleaf = new BitSet();
+        bitleaf.set(5);
+        bitleaf.set(7);
+
+        // Creates container with the leaf.
+        Ytbnot ytbnot = new DefaultYtbnot.YtbnotBuilder().notileaf(bitleaf)
+                .build();
+        // Creates notification with container.
+        Fortesta testa = new DefaultFortesta.FortestaBuilder()
+                .ytbnot(ytbnot).build();
+        // Invokes event subject class with notification.
+        YtbMultiNotificationWithContainerEventSubject eventSubject = new
+                YtbMultiNotificationWithContainerEventSubject();
+        eventSubject.fortesta(testa);
+        // Invokes event class with the event type and the event subject obj.
+        YtbMultiNotificationWithContainerEvent event =
+                new YtbMultiNotificationWithContainerEvent(
+                        YtbMultiNotificationWithContainerEvent.Type.FORTESTA,
+                        eventSubject);
+
+        // Builds YANG tree in YTB.
+        DefaultYangTreeBuilder treeBuilder = new DefaultYangTreeBuilder();
+        YdtContext ydtContext = treeBuilder.getYdtForNotification(
+                event, ROOT_NAME, registry);
+
+        // Gets the first module from logical root node.
+        YdtContext context = ydtContext.getFirstChild();
+        YdtContextOperationType opType = ((YdtNode) context)
+                .getYdtContextOperationType();
+
+        assertThat(getInCrtName(MODULE, MUL_NOTIFY), context.getName(),
+                   is(MUL_NOTIFY));
+        assertThat(getInCrtOpType(MODULE, MUL_NOTIFY), opType, is(NONE));
+
+        // Gets the notification under module.
+        YdtContext notify = context.getFirstChild();
+        YdtContextOperationType notifyOpType = ((YdtNode) notify)
+                .getYdtContextOperationType();
+
+        // Checks the contents in the first notification.
+        assertThat(getInCrtName(NOTIFICATION, NOTIFY), notify.getName(),
+                   is(NOTIFY));
+        assertThat(getInCrtOpType(NOTIFICATION, NOTIFY), notifyOpType,
+                   is(NONE));
+
+        // Gets the container in notification
+        YdtContext container = notify.getFirstChild();
+        assertThat(getInCrtName(CONTAINER, YTB_NOTIFY_CONT),
+                   container.getName(), is(YTB_NOTIFY_CONT));
+
+        // Evaluates the leaf values.
+        YdtContext leafInCont = container.getFirstChild();
+        assertThat(getInCrtName(LEAF, NOTIFY_LEAF), leafInCont.getName(),
+                   is(NOTIFY_LEAF));
+        // TODO: check the bits to string.
+    }
+
+    /**
+     * Processes multi module with list in both the modules and checks the
+     * YANG data tree building.
+     */
+    @Test
+    public void processMultiModule() {
+
+        schemaProvider.processSchemaRegistry(null);
+        DefaultYangSchemaRegistry registry = schemaProvider
+                .getDefaultYangSchemaRegistry();
+
+        // As an application, creates the object.
+
+        // Creates list of big integer for leaf-list under list1.
+        List<BigInteger> bigIntegerList = new ArrayList<>();
+        bigIntegerList.add(BigInteger.valueOf(1));
+        bigIntegerList.add(BigInteger.valueOf(2));
+        bigIntegerList.add(BigInteger.valueOf(3));
+        // Creates list of big integer for leaf-list under list2.
+        List<BigInteger> bigIntegerList1 = new ArrayList<>();
+        bigIntegerList1.add(BigInteger.valueOf(4));
+        bigIntegerList1.add(BigInteger.valueOf(5));
+        bigIntegerList1.add(BigInteger.valueOf(6));
+
+        // Creates two list contents.
+        Ytbmultilist listContent1 = new DefaultYtbmultilist
+                .YtbmultilistBuilder().check(bigIntegerList).build();
+        Ytbmultilist listContent2 = new DefaultYtbmultilist
+                .YtbmultilistBuilder().check(bigIntegerList1).build();
+
+        List<Ytbmultilist> ytbmultilists = new ArrayList<>();
+        ytbmultilists.add(listContent1);
+        ytbmultilists.add(listContent2);
+
+        // Creates module-a with two list contents created.
+        YtbMultiModulea modulea = new YtbMultiModuleaOpParam
+                .YtbMultiModuleaBuilder().ytbmultilist(ytbmultilists).build();
+
+        // Creates list of string for leaf-list under list1.
+        List<String> stringList = new ArrayList<>();
+        stringList.add(ANT);
+        stringList.add(ANIMAL);
+        stringList.add(BIRD);
+
+        // Creates list of string for leaf-list under list2.
+        List<String> stringList1 = new ArrayList<>();
+        stringList1.add(CATCH);
+        stringList1.add(BALL);
+        stringList1.add(BAT);
+
+        // Creates two list contents.
+        Ytbmultilistb listContent3 = new DefaultYtbmultilistb
+                .YtbmultilistbBuilder().checkin(stringList).build();
+        Ytbmultilistb listContent4 = new DefaultYtbmultilistb
+                .YtbmultilistbBuilder().checkin(stringList1).build();
+
+        List<Ytbmultilistb> ytbMultiListb = new ArrayList<>();
+        ytbMultiListb.add(listContent3);
+        ytbMultiListb.add(listContent4);
+
+        // Creates module-b with two list contents created.
+        YtbMultiModuleb moduleb = new YtbMultiModulebOpParam
+                .YtbMultiModulebBuilder().ytbmultilistb(ytbMultiListb).build();
+
+        // As YSB or YAB protocol sets the value for YTB.
+        List<Object> listOfModules = new ArrayList<>();
+        listOfModules.add(modulea);
+        listOfModules.add(moduleb);
+
+        // Builds YANG tree in YTB.
+        DefaultYangTreeBuilder treeBuilder = new DefaultYangTreeBuilder();
+        YdtBuilder ydtBuilder = treeBuilder.getYdtBuilderForYo(
+                listOfModules, ROOT_NAME, ROOT_NAME_SPACE,
+                EDIT_CONFIG_REQUEST, registry);
+
+        // Receives YDT context and check the tree that is built.
+        YdtContext context = ydtBuilder.getRootNode();
+
+        // Checks module-a under root node.
+        YdtContext moduleA = context.getFirstChild();
+        assertThat(getInCrtName(MODULE, MUL_MOD_A), moduleA.getName(),
+                   is(MUL_MOD_A));
+
+        // Checks list-a in module-a and its respective leaf-list.
+        YdtContext list1InModuleA = moduleA.getFirstChild();
+        assertThat(getInCrtName(LIST, MUL_LIST_A), list1InModuleA.getName(),
+                   is(MUL_LIST_A));
+
+        YdtContext leafListA = list1InModuleA.getFirstChild();
+        assertThat(getInCrtName(LEAF_LIST, CHECK), leafListA.getName(),
+                   is(CHECK));
+
+        Set<String> valueA = leafListA.getValueSet();
+        assertThat(getInCrtLeafListValue(CHECK, ONE), valueA.contains(ONE),
+                   is(true));
+        assertThat(getInCrtLeafListValue(CHECK, TWO), valueA.contains(TWO),
+                   is(true));
+        assertThat(getInCrtLeafListValue(CHECK, THREE), valueA.contains(THREE),
+                   is(true));
+
+        // Checks list-b in module-a and its respective leaf-list.
+        YdtContext list2InModuleA = list1InModuleA.getNextSibling();
+        assertThat(getInCrtName(LIST, MUL_LIST_A), list2InModuleA.getName(),
+                   is(MUL_LIST_A));
+
+        YdtContext leafListB = list2InModuleA.getFirstChild();
+        assertThat(getInCrtName(LEAF_LIST, CHECK), leafListB.getName(),
+                   is(CHECK));
+
+        Set<String> valueB = leafListB.getValueSet();
+        assertThat(getInCrtLeafListValue(CHECK, FOUR), valueB.contains(FOUR),
+                   is(true));
+        assertThat(getInCrtLeafListValue(CHECK, FIVE), valueB.contains(FIVE),
+                   is(true));
+        assertThat(getInCrtLeafListValue(CHECK, SIX), valueB.contains(SIX),
+                   is(true));
+
+        // Checks module-b under root node.
+        YdtContext moduleB = moduleA.getNextSibling();
+        assertThat(getInCrtName(MODULE, MUL_MOD_B), moduleB.getName(),
+                   is(MUL_MOD_B));
+
+        // Checks list-a in module-b and its respective leaf-list.
+        YdtContext list1InModuleB = moduleB.getFirstChild();
+        assertThat(getInCrtName(LIST, MUL_LIST_B), list1InModuleB.getName(),
+                   is(MUL_LIST_B));
+
+        YdtContext leafListC = list1InModuleB.getFirstChild();
+        assertThat(getInCrtName(LEAF_LIST, CHECKIN), leafListC.getName(),
+                   is(CHECKIN));
+
+        Set<String> valueC = leafListC.getValueSet();
+        assertThat(getInCrtLeafListValue(CHECKIN, ANT), valueC.contains(ANT),
+                   is(true));
+        assertThat(getInCrtLeafListValue(CHECKIN, ANIMAL),
+                   valueC.contains(ANIMAL), is(true));
+        assertThat(getInCrtLeafListValue(CHECKIN, BIRD),
+                   valueC.contains(BIRD), is(true));
+
+        // Checks list-b in module-b and its respective leaf-list.
+        YdtContext list2InModuleB = list1InModuleB.getNextSibling();
+        assertThat(getInCrtName(LIST, MUL_LIST_B), list2InModuleB.getName(),
+                   is(MUL_LIST_B));
+
+        YdtContext leafListD = list2InModuleB.getFirstChild();
+        assertThat(getInCrtName(LEAF_LIST, CHECKIN), leafListD.getName(),
+                   is(CHECKIN));
+
+        Set<String> valueD = leafListD.getValueSet();
+        assertThat(getInCrtLeafListValue(CHECKIN, CATCH),
+                   valueD.contains(CATCH), is(true));
+        assertThat(getInCrtLeafListValue(CHECKIN, BALL),
+                   valueD.contains(BALL), is(true));
+        assertThat(getInCrtLeafListValue(CHECKIN, BAT),
+                   valueD.contains(BAT), is(true));
+    }
+
+    /**
+     * Processes tree building when a list node is having list inside it.
+     */
+    @Test
+    public void processTreeBuilderForListHavingList() {
+
+        schemaProvider.processSchemaRegistry(null);
+        DefaultYangSchemaRegistry registry = schemaProvider
+                .getDefaultYangSchemaRegistry();
+
+        // As an application, creates the object.
+
+        // Creates two binary leaf-lists for two list app areas.
+        List<byte[]> destArea1 = new ArrayList<>();
+        byte[] arr = new byte[]{1, 6, 3};
+        byte[] arr1 = new byte[]{2, 7, 4};
+        destArea1.add(arr);
+        destArea1.add(arr1);
+
+        List<byte[]> destArea2 = new ArrayList<>();
+        byte[] arr2 = new byte[]{3, 8, 4};
+        byte[] arr3 = new byte[]{5, 6, 1};
+        destArea2.add(arr2);
+        destArea2.add(arr3);
+
+        // Creates two app areas list.
+        ApplicationAreas appArea1 = new DefaultApplicationAreas
+                .ApplicationAreasBuilder().destinationAreas(destArea1).build();
+        ApplicationAreas appArea2 = new DefaultApplicationAreas
+                .ApplicationAreasBuilder().destinationAreas(destArea2).build();
+
+        List<ApplicationAreas> applicationAreasList = new ArrayList<>();
+        applicationAreasList.add(appArea1);
+        applicationAreasList.add(appArea2);
+
+        // Adds two lists under the multiplex list for content 1.
+        Multiplexes mpx1 = new DefaultMultiplexes.MultiplexesBuilder()
+                .types(TypesEnum.TIME_DIVISION)
+                .applicationAreas(applicationAreasList).build();
+
+        // Creates two binary leaf-lists for two list app areas.
+        List<byte[]> destArea3 = new ArrayList<>();
+        byte[] arrB = new byte[]{0, 0, 1};
+        byte[] arr1B = new byte[]{1, 0, 0};
+        destArea3.add(arrB);
+        destArea3.add(arr1B);
+
+        List<byte[]> destArea4 = new ArrayList<>();
+        byte[] arr2B = new byte[]{7, 7, 7};
+        byte[] arr3B = new byte[]{0, 1};
+        destArea4.add(arr2B);
+        destArea4.add(arr3B);
+
+        // Creates two app areas list.
+        ApplicationAreas appArea3 = new DefaultApplicationAreas
+                .ApplicationAreasBuilder().destinationAreas(destArea3).build();
+        ApplicationAreas appArea4 = new DefaultApplicationAreas
+                .ApplicationAreasBuilder().destinationAreas(destArea4).build();
+
+        List<ApplicationAreas> applicationAreasListB = new ArrayList<>();
+        applicationAreasListB.add(appArea3);
+        applicationAreasListB.add(appArea4);
+
+        // Adds two lists under the multiplex list for content 2.
+        Multiplexes mpx2 = new DefaultMultiplexes.MultiplexesBuilder()
+                .types(TypesEnum.FREQUENCY_DIVISION)
+                .applicationAreas(applicationAreasListB).build();
+
+        List<Multiplexes> multiplexList = new ArrayList<>();
+        multiplexList.add(mpx1);
+        multiplexList.add(mpx2);
+
+        // Sets it in the container carrier.
+        Carrier carrier = new DefaultCarrier.CarrierBuilder()
+                .multiplexes(multiplexList).build();
+
+        YtbTreeBuilderForListHavingList listWithList = new
+                YtbTreeBuilderForListHavingListOpParam
+                        .YtbTreeBuilderForListHavingListBuilder()
+                .carrier(carrier).build();
+
+        // As YSB or YAB protocol sets the value for YTB.
+        List<Object> objectList = new ArrayList<>();
+        objectList.add(listWithList);
+
+        DefaultYangTreeBuilder treeBuilder = new DefaultYangTreeBuilder();
+        YdtBuilder ydtBuilder = treeBuilder.getYdtBuilderForYo(
+                objectList, ROOT_NAME, ROOT_NAME_SPACE,
+                QUERY_CONFIG_REQUEST, registry);
+
+        // Receives YDT context and check the tree that is built.
+        YdtContext context = ydtBuilder.getRootNode();
+
+        // Gets the first module from logical root node.
+        YdtContext module = context.getFirstChild();
+        assertThat(getInCrtName(LIST, LIST_WITH_LIST), module.getName(),
+                   is(LIST_WITH_LIST));
+
+        // Checks the container node under module node.
+        YdtContext container = module.getFirstChild();
+        assertThat(getInCrtName(CONTAINER, CONT_CARRIER), container.getName(),
+                   is(CONT_CARRIER));
+
+        // Checks the list node with content 1 of multiplex.
+        YdtContext mtx1 = container.getFirstChild();
+        assertThat(getInCrtName(LIST, LIST_MULTIPLEXES), mtx1.getName(),
+                   is(LIST_MULTIPLEXES));
+
+        // Checks enum leaf under multiplex of content1.
+        YdtContext enumLeaf1 = mtx1.getFirstChild();
+        assertThat(getInCrtName(LEAF, TYPES), enumLeaf1.getName(), is(TYPES));
+        assertThat(getInCrtLeafValue(TYPES, TIME_DIVISION),
+                   enumLeaf1.getValue(), is(TIME_DIVISION));
+
+        // Checks list app area content 1 under multiplex content 1.
+        YdtContext appAreaList1 = enumLeaf1.getNextSibling();
+        assertThat(getInCrtName(LIST, APP_AREA_LIST), appAreaList1.getName(),
+                   is(APP_AREA_LIST));
+
+        YdtContext leafList1 = appAreaList1.getFirstChild();
+        assertThat(getInCrtName(LEAF_LIST, DEST_AREA), leafList1.getName(),
+                   is(DEST_AREA));
+        Set value1 = leafList1.getValueSet();
+        // TODO: check the leaf-list value.
+
+        // Checks list app area content 2 under multiplex content 1.
+        YdtContext appAreaList2 = appAreaList1.getNextSibling();
+        assertThat(getInCrtName(LIST, APP_AREA_LIST), appAreaList2.getName(),
+                   is(APP_AREA_LIST));
+
+        YdtContext leafList2 = appAreaList2.getFirstChild();
+        assertThat(getInCrtName(LEAF_LIST, DEST_AREA), leafList2.getName(),
+                   is(DEST_AREA));
+        Set value2 = leafList1.getValueSet();
+        // TODO: check the leaf-list value.
+
+        // Checks the list node with content 2 of multiplex.
+        YdtContext mtx2 = mtx1.getNextSibling();
+        assertThat(getInCrtName(LIST, LIST_MULTIPLEXES), mtx2.getName(),
+                   is(LIST_MULTIPLEXES));
+
+        // Checks enum leaf under multiplex of content2.
+        YdtContext enumLeaf2 = mtx2.getFirstChild();
+        assertThat(getInCrtName(LEAF, TYPES), enumLeaf2.getName(), is(TYPES));
+        assertThat(getInCrtLeafValue(TYPES, FREQUENCY_DIV),
+                   enumLeaf2.getValue(), is(FREQUENCY_DIV));
+
+        // Checks list app area content 1 under multiplex content 2.
+        YdtContext appAreaList3 = enumLeaf2.getNextSibling();
+        assertThat(getInCrtName(LIST, APP_AREA_LIST), appAreaList3.getName(),
+                   is(APP_AREA_LIST));
+
+        YdtContext leafList3 = appAreaList3.getFirstChild();
+        assertThat(getInCrtName(LEAF_LIST, DEST_AREA), leafList3.getName(),
+                   is(DEST_AREA));
+        Set value3 = leafList3.getValueSet();
+        // TODO: check the leaf-list value.
+
+        // Checks list app area content 2 under multiplex content 2.
+        YdtContext appAreaList4 = appAreaList3.getNextSibling();
+        assertThat(getInCrtName(LIST, APP_AREA_LIST), appAreaList4.getName(),
+                   is(APP_AREA_LIST));
+
+        YdtContext leafList4 = appAreaList4.getFirstChild();
+        assertThat(getInCrtName(LEAF_LIST, DEST_AREA), leafList4.getName(),
+                   is(DEST_AREA));
+        Set value4 = leafList4.getValueSet();
+        // TODO: check the leaf-list value.
+    }
+
+    /**
+     * Processes tree building from the derived type of leaf and leaf-list
+     * having binary and bits .
+     */
+    @Test
+    public void processTreeBuilderForBinaryAndBits() {
+        schemaProvider.processSchemaRegistry(null);
+        DefaultYangSchemaRegistry registry = schemaProvider
+                .getDefaultYangSchemaRegistry();
+
+        // As an application, creates the object.
+
+        // Creates a byte array for binary leaf.
+        byte[] binLeaf = new byte[]{5, 5, 5};
+
+        // Assigns the value in the chained loop of typedef.
+        Derivedbinaryb derBinb = new Derivedbinaryb(binLeaf);
+        Derivedbinarya derBina = new Derivedbinarya(derBinb);
+
+        // Creates bit set for bit leaf.
+        BitSet bitLeaf = new BitSet();
+        bitLeaf.set(1);
+        bitLeaf.set(100);
+
+        // Assigns the value in the chained loop of typedef.
+        Derivedbitsb derBitb = new Derivedbitsb(bitLeaf);
+        Derivedbitsa derBita = new Derivedbitsa(derBitb);
+
+        // Creates a byte array list for binary leaf-list.
+        byte[] binList1 = new byte[]{9, 9, 0};
+        byte[] binList2 = new byte[]{12, 6, 0};
+        byte[] binList3 = new byte[]{16, 29, 25};
+
+        // Assigns the value in the chained loop of typedef.
+        Derivedbinaryb derBinBList1 = new Derivedbinaryb(binList1);
+        Derivedbinaryb derBinBList2 = new Derivedbinaryb(binList2);
+        Derivedbinaryb derBinBList3 = new Derivedbinaryb(binList3);
+
+        Derivedbinarya derBinAList1 = new Derivedbinarya(derBinBList1);
+        Derivedbinarya derBinAList2 = new Derivedbinarya(derBinBList2);
+        Derivedbinarya derBinAList3 = new Derivedbinarya(derBinBList3);
+
+        List<Derivedbinarya> binAlist = new ArrayList<>();
+        binAlist.add(derBinAList1);
+        binAlist.add(derBinAList2);
+        binAlist.add(derBinAList3);
+
+        // Creates a bit set list for bit leaf-list.
+        BitSet bitList1 = new BitSet();
+        bitList1.set(1);
+        BitSet bitList2 = new BitSet();
+        bitList2.set(1);
+        bitList2.set(10);
+        BitSet bitList3 = new BitSet();
+        bitList3.set(1);
+        bitList3.set(10);
+        bitList3.set(100);
+
+        // Assigns the value in the chained loop of typedef.
+        Derivedbitsb bitBlist1 = new Derivedbitsb(bitList1);
+        Derivedbitsb bitBlist2 = new Derivedbitsb(bitList2);
+        Derivedbitsb bitBlist3 = new Derivedbitsb(bitList3);
+
+        Derivedbitsa bitAlist1 = new Derivedbitsa(bitBlist1);
+        Derivedbitsa bitAlist2 = new Derivedbitsa(bitBlist2);
+        Derivedbitsa bitAlist3 = new Derivedbitsa(bitBlist3);
+
+        List<Derivedbitsa> bitAlist = new ArrayList<>();
+        bitAlist.add(bitAlist1);
+        bitAlist.add(bitAlist2);
+        bitAlist.add(bitAlist3);
+
+        // Creates a module by assigning all the leaf and leaf-list.
+        YtbDerivedTypeWithBitsAndBinary bitsAndBinary = new
+                YtbDerivedTypeWithBitsAndBinaryOpParam
+                        .YtbDerivedTypeWithBitsAndBinaryBuilder()
+                .forbinary(derBina).forbits(derBita)
+                .forbinarylist(binAlist)
+                .forbitslist(bitAlist).build();
+
+        // As YSB or YAB protocol, sets the value for YTB.
+        List<Object> objectList = new ArrayList<>();
+        objectList.add(bitsAndBinary);
+
+        // Builds YANG tree in YTB.
+        DefaultYangTreeBuilder treeBuilder = new DefaultYangTreeBuilder();
+        YdtExtendedBuilder ydtBuilder = treeBuilder.getYdtBuilderForYo(
+                objectList, ROOT_NAME, ROOT_NAME_SPACE,
+                EDIT_CONFIG_REQUEST, registry);
+
+        // Receives YDT context and check the tree that is built.
+        YdtContext context = ydtBuilder.getRootNode();
+
+        // Gets the first module from logical root node.
+        YdtContext module = context.getFirstChild();
+        assertThat(getInCrtName(MODULE, MOD_BIT_BIN), module.getName(),
+                   is(MOD_BIT_BIN));
+
+        // Checks the leaf for binary.
+        YdtContext binaryLeaf = module.getFirstChild();
+        assertThat(getInCrtName(LEAF, FOR_BINARY), binaryLeaf.getName(),
+                   is(FOR_BINARY));
+        assertThat(getInCrtLeafValue(FOR_BINARY, BIN_VAL_1),
+                   binaryLeaf.getValue(), is(BIN_VAL_1));
+
+        // Checks the leaf for bits.
+        YdtContext bitsLeaf = binaryLeaf.getNextSibling();
+        assertThat(getInCrtName(LEAF, FOR_BITS), bitsLeaf.getName(),
+                   is(FOR_BITS));
+        // TODO: The bits is not done.
+        String value1 = bitsLeaf.getValue();
+
+        // Checks the leaf-list for binary.
+        YdtContext binaryLeafList = bitsLeaf.getNextSibling();
+        assertThat(getInCrtName(LEAF_LIST, FOR_BINARY_LIST),
+                   binaryLeafList.getName(), is(FOR_BINARY_LIST));
+
+        Set value2 = binaryLeafList.getValueSet();
+        assertThat(getInCrtLeafListValue(FOR_BINARY_LIST, BIN_VAL_2),
+                   value2.contains(BIN_VAL_2), is(true));
+        assertThat(getInCrtLeafListValue(FOR_BINARY_LIST, BIN_VAL_3),
+                   value2.contains(BIN_VAL_3), is(true));
+        assertThat(getInCrtLeafListValue(FOR_BINARY_LIST, BIN_VAL_4),
+                   value2.contains(BIN_VAL_4), is(true));
+
+        // Checks the leaf-list for bits.
+        YdtContext bitsLeafList = binaryLeafList.getNextSibling();
+        assertThat(getInCrtName(LEAF_LIST, FOR_BITS_LIST),
+                   bitsLeafList.getName(), is(FOR_BITS_LIST));
+        // TODO: The value of bits should be mapped text string.
+        Set value3 = bitsLeafList.getValueSet();
+    }
+
+    /**
+     * Processes tree building for the union type.
+     */
+    @Test
+    public void processYtbUnionType() {
+        schemaProvider.processSchemaRegistry(null);
+        DefaultYangSchemaRegistry registry = schemaProvider
+                .getDefaultYangSchemaRegistry();
+
+        // As an application, creates the object.
+
+        // Creates union with binary type.
+        byte[] binary = new byte[]{0, 0, 0};
+        ForunionUnion union = new ForunionUnion(binary);
+
+        // Creates module with union.
+        YtbDerivedTypeWithBitsAndBinary unionType = new
+                YtbDerivedTypeWithBitsAndBinaryOpParam
+                        .YtbDerivedTypeWithBitsAndBinaryBuilder()
+                .forunion(union)
+                .build();
+
+        // As YSB or YAB protocol, sets the value for YTB.
+        List<Object> objectList = new ArrayList<>();
+        objectList.add(unionType);
+
+        // Builds YANG tree in YTB.
+        DefaultYangTreeBuilder treeBuilder = new DefaultYangTreeBuilder();
+        YdtExtendedBuilder ydtBuilder = treeBuilder.getYdtBuilderForYo(
+                objectList, ROOT_NAME, ROOT_NAME_SPACE,
+                EDIT_CONFIG_REQUEST, registry);
+
+        // Receives YDT context and check the tree that is built.
+        YdtContext rootNode = ydtBuilder.getRootNode();
+        YdtContext module = rootNode.getFirstChild();
+        YdtContext unionChild = module.getFirstChild();
+        assertThat(getInCrtName(LEAF, FOR_UNION), unionChild.getName(),
+                   is(FOR_UNION));
+        //TODO: Correct it once union generated code is fixed.
+        assertThat(getInCrtLeafValue(FOR_UNION, ZERO), unionChild.getValue(),
+                   is(ZERO));
+    }
+}
diff --git a/apps/yms/app/src/test/java/org/onosproject/yms/app/ytb/YtbContextSwitchTest.java b/apps/yms/app/src/test/java/org/onosproject/yms/app/ytb/YtbContextSwitchTest.java
new file mode 100644
index 0000000..ef48954
--- /dev/null
+++ b/apps/yms/app/src/test/java/org/onosproject/yms/app/ytb/YtbContextSwitchTest.java
@@ -0,0 +1,1237 @@
+/*
+ * 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.ytb;
+
+import org.junit.Test;
+import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev20130715.ymsietfinettypes.Uri;
+import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev20151208.YmsIetfNetwork;
+import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev20151208.YmsIetfNetworkOpParam;
+import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev20151208.ymsietfnetwork.DefaultNetworks;
+import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev20151208.ymsietfnetwork.Networks;
+import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev20151208.ymsietfnetwork.NodeId;
+import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev20151208.ymsietfnetwork.networks.DefaultNetwork;
+import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev20151208.ymsietfnetwork.networks.Network;
+import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev20151208.ymsietfnetwork.networks.network.DefaultNode;
+import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev20151208.ymsietfnetwork.networks.network.Node;
+import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev20151208.ymsietfnetwork.networks.network.node.DefaultSupportingNode;
+import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev20151208.ymsietfnetwork.networks.network.node.SupportingNode;
+import org.onosproject.yang.gen.v1.yms.test.ytb.augment.from.another.file.rev20160826.ytbaugmentfromanotherfile.networks.network.node.AugmentedNdNode;
+import org.onosproject.yang.gen.v1.yms.test.ytb.augment.from.another.file.rev20160826.ytbaugmentfromanotherfile.networks.network.node.DefaultAugmentedNdNode;
+import org.onosproject.yang.gen.v1.yms.test.ytb.augment.from.another.file.rev20160826.ytbaugmentfromanotherfile.networks.network.node.augmentedndnode.DefaultTerminationPoint;
+import org.onosproject.yang.gen.v1.yms.test.ytb.augment.from.another.file.rev20160826.ytbaugmentfromanotherfile.networks.network.node.augmentedndnode.TerminationPoint;
+import org.onosproject.yang.gen.v1.yms.test.ytb.augment.from.another.file.rev20160826.ytbaugmentfromanotherfile.networks.network.node.augmentedndnode.terminationpoint.DefaultSupportingTerminationPoint;
+import org.onosproject.yang.gen.v1.yms.test.ytb.augment.from.another.file.rev20160826.ytbaugmentfromanotherfile.networks.network.node.augmentedndnode.terminationpoint.SupportingTerminationPoint;
+import org.onosproject.yang.gen.v1.yms.test.ytb.augment.yangautoprefixfor.rpc.input.rev20160826.ytbaugmentforrpcinput.activatesoftwareimage.output.AugmentedRpcOutput;
+import org.onosproject.yang.gen.v1.yms.test.ytb.augment.yangautoprefixfor.rpc.input.rev20160826.ytbaugmentforrpcinput.activatesoftwareimage.output.DefaultAugmentedRpcOutput;
+import org.onosproject.yang.gen.v1.yms.test.ytb.augment.yangautoprefixfor.rpc.input.rev20160826.ytbaugmentforrpcinput.activatesoftwareimage.output.augmentedrpcoutput.Selection;
+import org.onosproject.yang.gen.v1.yms.test.ytb.augment.yangautoprefixfor.rpc.input.rev20160826.ytbaugmentforrpcinput.activatesoftwareimage.output.augmentedrpcoutput.selection.DefaultValueIn;
+import org.onosproject.yang.gen.v1.yms.test.ytb.augment.yangautoprefixfor.rpc.input.rev20160826.ytbaugmentforrpcinput.activatesoftwareimage.output.augmentedrpcoutput.selection.valuein.ValueIn;
+import org.onosproject.yang.gen.v1.yms.test.ytb.augment.yangautoprefixfor.rpc.input.rev20160826.ytbaugmentforrpcinput2.activatesoftwareimage.output.AugmentedInputOutput;
+import org.onosproject.yang.gen.v1.yms.test.ytb.augment.yangautoprefixfor.rpc.input.rev20160826.ytbaugmentforrpcinput2.activatesoftwareimage.output.DefaultAugmentedInputOutput;
+import org.onosproject.yang.gen.v1.yms.test.ytb.augment.yangautoprefixfor.rpc.input.rev20160826.ytbaugmentforrpcinput2.activatesoftwareimage.output.augmentedinputoutput.DefaultFriction;
+import org.onosproject.yang.gen.v1.yms.test.ytb.augment.yangautoprefixfor.rpc.input.rev20160826.ytbaugmentforrpcinput2.activatesoftwareimage.output.augmentedinputoutput.Friction;
+import org.onosproject.yang.gen.v1.yms.test.ytb.choice.with.container.and.leaf.list.rev20160826.YtbChoiceWithContainerAndLeafList;
+import org.onosproject.yang.gen.v1.yms.test.ytb.choice.with.container.and.leaf.list.rev20160826.YtbChoiceWithContainerAndLeafListOpParam;
+import org.onosproject.yang.gen.v1.yms.test.ytb.choice.with.container.and.leaf.list.rev20160826.ytbchoicewithcontainerandleaflist.ContentTest;
+import org.onosproject.yang.gen.v1.yms.test.ytb.choice.with.container.and.leaf.list.rev20160826.ytbchoicewithcontainerandleaflist.CurrentValue;
+import org.onosproject.yang.gen.v1.yms.test.ytb.choice.with.container.and.leaf.list.rev20160826.ytbchoicewithcontainerandleaflist.contenttest.DefaultChoiceContainer;
+import org.onosproject.yang.gen.v1.yms.test.ytb.choice.with.container.and.leaf.list.rev20160826.ytbchoicewithcontainerandleaflist.contenttest.choicecontainer.ChoiceContainer;
+import org.onosproject.yang.gen.v1.yms.test.ytb.choice.with.container.and.leaf.list.rev20160826.ytbchoicewithcontainerandleaflist.contenttest.choicecontainer.choicecontainer.DefaultPredict;
+import org.onosproject.yang.gen.v1.yms.test.ytb.choice.with.container.and.leaf.list.rev20160826.ytbchoicewithcontainerandleaflist.contenttest.choicecontainer.choicecontainer.Predict;
+import org.onosproject.yang.gen.v1.yms.test.ytb.choice.with.container.and.leaf.list.rev20160826.ytbchoicewithcontainerandleaflist.contenttest.choicecontainer.choicecontainer.predict.DefaultReproduce;
+import org.onosproject.yang.gen.v1.yms.test.ytb.choice.with.container.and.leaf.list.rev20160826.ytbchoicewithcontainerandleaflist.contenttest.choicecontainer.choicecontainer.predict.Reproduce;
+import org.onosproject.yang.gen.v1.yms.test.ytb.choice.with.container.and.leaf.list.rev20160826.ytbchoicewithcontainerandleaflist.currentvalue.DefaultYtbAbsent;
+import org.onosproject.yang.gen.v1.yms.test.ytb.rpc.response.with.advanced.input.and.output.rev20160826.ytbrpcresponsewithadvancedinputandoutput.activatesoftwareimage.ActivateSoftwareImageOutput;
+import org.onosproject.yang.gen.v1.yms.test.ytb.rpc.response.with.advanced.input.and.output.rev20160826.ytbrpcresponsewithadvancedinputandoutput.activatesoftwareimage.DefaultActivateSoftwareImageOutput;
+import org.onosproject.yang.gen.v1.yms.test.ytb.rpc.response.with.advanced.input.and.output.rev20160826.ytbrpcresponsewithadvancedinputandoutput.activatesoftwareimage.activatesoftwareimageoutput.DefaultOutputList;
+import org.onosproject.yang.gen.v1.yms.test.ytb.rpc.response.with.advanced.input.and.output.rev20160826.ytbrpcresponsewithadvancedinputandoutput.activatesoftwareimage.activatesoftwareimageoutput.OutputList;
+import org.onosproject.yang.gen.v1.yms.test.ytb.rpc.response.with.advanced.input.and.output.rev20160826.ytbrpcresponsewithadvancedinputandoutput.activatesoftwareimage.activatesoftwareimageoutput.outputlist.ContentInside;
+import org.onosproject.yang.gen.v1.yms.test.ytb.rpc.response.with.advanced.input.and.output.rev20160826.ytbrpcresponsewithadvancedinputandoutput.activatesoftwareimage.activatesoftwareimageoutput.outputlist.DefaultContentInside;
+import org.onosproject.yang.gen.v1.yms.test.ytb.simple.augment.rev20160826.YtbSimpleAugment;
+import org.onosproject.yang.gen.v1.yms.test.ytb.simple.augment.rev20160826.YtbSimpleAugmentOpParam;
+import org.onosproject.yang.gen.v1.yms.test.ytb.simple.augment.rev20160826.ytbsimpleaugment.Cont1;
+import org.onosproject.yang.gen.v1.yms.test.ytb.simple.augment.rev20160826.ytbsimpleaugment.DefaultCont1;
+import org.onosproject.yang.gen.v1.yms.test.ytb.simple.augment.rev20160826.ytbsimpleaugment.cont1.DefaultCont2;
+import org.onosproject.yang.gen.v1.yms.test.ytb.simple.augment.rev20160826.ytbsimpleaugment.cont1.cont2.AugmentedCont2;
+import org.onosproject.yang.gen.v1.yms.test.ytb.simple.augment.rev20160826.ytbsimpleaugment.cont1.cont2.DefaultAugmentedCont2;
+import org.onosproject.yang.gen.v1.yms.test.ytb.simple.augment.rev20160826.ytbsimpleaugment.cont1.cont2.augmentedcont2.Cont1s;
+import org.onosproject.yang.gen.v1.yms.test.ytb.simple.augment.rev20160826.ytbsimpleaugment.cont1.cont2.augmentedcont2.DefaultCont1s;
+import org.onosproject.yang.gen.v1.yms.test.ytb.simple.choice.yangautoprefixcase.rev20160826.YtbSimpleChoiceCase;
+import org.onosproject.yang.gen.v1.yms.test.ytb.simple.choice.yangautoprefixcase.rev20160826.YtbSimpleChoiceCaseOpParam;
+import org.onosproject.yang.gen.v1.yms.test.ytb.simple.choice.yangautoprefixcase.rev20160826.ytbsimplechoicecase.DefaultYtbFood;
+import org.onosproject.yang.gen.v1.yms.test.ytb.simple.choice.yangautoprefixcase.rev20160826.ytbsimplechoicecase.YtbFood;
+import org.onosproject.yang.gen.v1.yms.test.ytb.simple.choice.yangautoprefixcase.rev20160826.ytbsimplechoicecase.ytbfood.YtbSnack;
+import org.onosproject.yang.gen.v1.yms.test.ytb.simple.choice.yangautoprefixcase.rev20160826.ytbsimplechoicecase.ytbfood.ytbsnack.DefaultYtbLateNight;
+import org.onosproject.yang.gen.v1.yms.test.ytb.simple.rpc.response.rev20160826.ytbsimplerpcresponse.rpc.DefaultRpcOutput;
+import org.onosproject.yang.gen.v1.yms.test.ytb.simple.rpc.response.rev20160826.ytbsimplerpcresponse.rpc.RpcOutput;
+import org.onosproject.yms.app.ydt.YangRequestWorkBench;
+import org.onosproject.yms.app.ydt.YdtExtendedBuilder;
+import org.onosproject.yms.app.ysr.DefaultYangSchemaRegistry;
+import org.onosproject.yms.ydt.YdtContext;
+
+import java.math.BigInteger;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.Is.is;
+import static org.hamcrest.core.IsNull.notNullValue;
+import static org.onosproject.yms.ydt.YdtContextOperationType.NONE;
+import static org.onosproject.yms.ydt.YmsOperationType.EDIT_CONFIG_REPLY;
+import static org.onosproject.yms.ydt.YmsOperationType.EDIT_CONFIG_REQUEST;
+import static org.onosproject.yms.ydt.YmsOperationType.QUERY_CONFIG_REPLY;
+import static org.onosproject.yms.ydt.YmsOperationType.RPC_REQUEST;
+
+/**
+ * Unit test cases for YANG tree builder for context switch for augment, RPC
+ * and case.
+ */
+public class YtbContextSwitchTest extends YtbErrMsgAndConstants {
+
+    private static final String RPC_ADV_NAME = "RPCAdvanced";
+    private static final String RPC_ADV_NAMESPACE = "RPCAdvancedSpace";
+    private static final String RPC_ADV_IO =
+            "YtbRpcResponseWithAdvancedInputAndOutput";
+    private static final String ACT_IMG = "activate-software-image";
+    private static final String INPUT = "input";
+    private static final String FINAL = "final";
+    private static final String AUG_NW_REF_1 = "network-ref-aug1";
+    private static final String AUG_NODE_REF_1 = "node-ref-aug1";
+    private static final String AUG_TP_REF_1 = "tp-ref-aug-1";
+    private static final String AUG_TP_ID_1 = "tp-id-aug-1";
+    private static final String AUG_NW_REF_B1 = "network-ref-augb1";
+    private static final String AUG_NODE_REF_B1 = "node-ref-augb1";
+    private static final String AUG_TP_REF_B1 = "tp-ref-aug-b1";
+    private static final String AUG_TP_ID_B1 = "tp-id-aug-1b";
+    private static final String NW_REF = "network-ref";
+    private static final String NODE_REF = "node-ref";
+    private static final String NW_REF_2 = "network-ref2";
+    private static final String NODE_REF_3 = "node-ref3";
+    private static final String NW_REF_B = "network-ref-b";
+    private static final String NODE_REF_B = "node-ref-b";
+    private static final String NW_REF_2B = "network-ref2-b";
+    private static final String NODE_REF_2B = "node-ref2-b";
+    private static final String NODE_REF_3B = "node-ref3-b";
+    private static final String CHOC = "choc";
+    private static final String CHOICE_CASE = "YtbSimpleChoiceCase";
+    private static final String FOOD = "YtbFood";
+    private static final String CHOCOLATE = "chocolate";
+    private static final String VAL = "val";
+    private static final String IND = "ind";
+    private static final String CHOICE_ROOT_NAME = "choiceContainerRootName";
+    private static final String CHOICE_ROOT_NAMESPACE =
+            "choiceContainerRootNamespace";
+    private static final String ROOT = "root";
+    private static final String CHOICE_CONT =
+            "YtbChoiceWithContainerAndLeafList";
+    private static final String CONT_CHOICE = "choice-container";
+    private static final String REPRODUCE = "reproduce";
+    private static final String NINETY = "90";
+    private static final String HUNDRED = "100";
+    private static final String RPC_RT_NAME = "rpcRootName";
+    private static final String RPC_RT_NAMESPACE = "rpcRootNameSpace";
+    private static final String OUTPUT_LEAF = "output-leaf";
+    private static final String FIVE_HUNDRED = "500";
+    private static final String OUTPUT_LIST = "output-list";
+    private static final String LIST_KEY = "list-key";
+    private static final String BIN_VAL_1 = "AAE=";
+    private static final String CONT_INSIDE = "content_inside";
+    private static final String BIN_VAL_2 = "CAk=";
+    private static final String AVAILABLE = "available";
+    private static final String EIGHTY_NINE = "89";
+    private static final String NINETY_EIGHT = "98";
+    private static final String BIN_VAL_3 = "AAA=";
+    private static final String SIM_AUG = "simpleAugment";
+    private static final String SIM_AUG_NAMESPACE = "simpleAugmentSpace";
+    private static final String SIMPLE_AUG = "YtbSimpleAugment";
+    private static final String CONT1 = "cont1";
+    private static final String CONT2 = "cont2";
+    private static final String LEAF4 = "leaf4";
+    private static final String CONT1S = "cont1s";
+    private static final String INTER_AUG = "inter-file-augment";
+    private static final String INTER_AUG_NAMESPACE =
+            "inter-file-augment-space";
+    private static final String IETF_NW = "yms-ietf-network";
+    private static final String NWS = "networks";
+    private static final String NW = "network";
+    private static final String NODE = "node";
+    private static final String NODE_ID = "node-id";
+    private static final String TERM_POINT = "termination-point";
+    private static final String TP_ID = "tp-id";
+    private static final String SUP_TERM_POINT = "supporting-termination-point";
+    private static final String TP_REF = "tp-ref";
+    private static final String SUP_NODE = "supporting-node";
+    private static final String KIN1 = "kin1";
+    private static final String KIN2 = "kin2";
+    private static final String VAL_IN = "value-in";
+    private static final String KINETIC = "kinetic";
+    private static final String FRICTION = "friction";
+    private static final String SPEED = "speed";
+    private static final String THOUSAND = "1000";
+
+    /**
+     * Creates object as like an application for RPC with list.
+     *
+     * @return object of RPC
+     */
+    private List<OutputList> createApplicationBuiltObjectForRpc() {
+
+        // Creates a empty container inside without leaf for list1.
+        ContentInside inside1 = new DefaultContentInside.ContentInsideBuilder()
+                .build();
+
+        // Creates a leaf list-key which is a leaf ref.
+        byte[] listKey1 = new byte[]{0, 1};
+
+        // Creates the list content 1.
+        OutputList output1 = new DefaultOutputList.OutputListBuilder()
+                .listKey(listKey1).contentInside(inside1).build();
+
+        // Creates a list of leaf for available.
+        List<Short> avail = new ArrayList<>();
+        avail.add((short) 89);
+        avail.add((short) 98);
+
+        // Adds the leaf list in the inside container.
+        ContentInside inside2 = new DefaultContentInside.ContentInsideBuilder()
+                .available(avail).build();
+
+        // Creates a leaf, list-key which is a leaf ref.
+        byte[] listKey2 = new byte[]{8, 9};
+
+        // Creates the list content 2.
+        OutputList outputList2 = new DefaultOutputList.OutputListBuilder()
+                .listKey(listKey2).contentInside(inside2).build();
+
+        // Creates only leaf, list-key which is a leaf ref.
+        byte[] arr3 = new byte[]{0, 0};
+
+        // Creates the list content 3.
+        OutputList outputList3 = new DefaultOutputList.OutputListBuilder()
+                .listKey(arr3).build();
+
+        // Adds all the list contents in array list and gives returns it.
+        List<OutputList> outputLists = new ArrayList<>();
+        outputLists.add(output1);
+        outputLists.add(outputList2);
+        outputLists.add(outputList3);
+        return outputLists;
+    }
+
+    /**
+     * Builds YANG request work bench for RPC with container input.
+     *
+     * @param registry schema registry
+     * @return YANG request work bench
+     */
+    private YangRequestWorkBench buildYangRequestWorkBenchForRpc(
+            DefaultYangSchemaRegistry registry) {
+
+        // Creates a request work bench and adds the input child into it.
+        YangRequestWorkBench workBench = new YangRequestWorkBench(
+                RPC_ADV_NAME, RPC_ADV_NAMESPACE, RPC_REQUEST,
+                registry, true);
+        Set<String> valueList = new HashSet<>();
+        valueList.add("800");
+        valueList.add("900");
+        workBench.addChild(RPC_ADV_IO, null, NONE);
+        workBench.addChild(ACT_IMG, null, NONE);
+        workBench.addChild(INPUT, null, NONE);
+        workBench.addChild(FINAL, null, NONE);
+        workBench.addLeaf("value", null, valueList);
+        return workBench;
+    }
+
+    /**
+     * Creates an application object for inter file augment.
+     *
+     * @return application object
+     */
+    private Object createObjectForInterFileAugment() {
+
+        // Creates leaf value for network-ref.
+        Uri nwkRef = new Uri(AUG_NW_REF_1);
+        Uri nwkRef2 = new Uri("network-ref-aug2");
+
+        // Creates leaf value for node-ref
+        Uri nodeRef = new Uri(AUG_NODE_REF_1);
+        NodeId nodeId = new NodeId(nodeRef);
+
+        Uri nodeRef2 = new Uri("node-ref-aug2");
+        NodeId nodeId2 = new NodeId(nodeRef2);
+
+        // Creates support termination list with the above two contents.
+        SupportingTerminationPoint point1 =
+                new DefaultSupportingTerminationPoint
+                        .SupportingTerminationPointBuilder()
+                        .networkRef(nwkRef).nodeRef(nodeId)
+                        .tpRef(AUG_TP_REF_1).build();
+        SupportingTerminationPoint point2 =
+                new DefaultSupportingTerminationPoint
+                        .SupportingTerminationPointBuilder()
+                        .networkRef(nwkRef2).nodeRef(nodeId2)
+                        .tpRef("tp-ref-aug-2").build();
+
+        List<SupportingTerminationPoint> pointList = new ArrayList<>();
+        pointList.add(point1);
+        pointList.add(point2);
+
+        // Adds the list created to the termination point content1.
+        TerminationPoint tPoint1 = new DefaultTerminationPoint
+                .TerminationPointBuilder()
+                .supportingTerminationPoint(pointList)
+                .tpId(AUG_TP_ID_1).build();
+
+        // Creates leaf value for network-ref.
+        Uri nwkRef3 = new Uri(AUG_NW_REF_B1);
+        Uri nwkRef4 = new Uri("network-ref-augb2");
+
+        // Creates leaf value for node-ref
+        Uri nodeRef3 = new Uri(AUG_NODE_REF_B1);
+        NodeId nodeId3 = new NodeId(nodeRef3);
+
+        Uri nodeRef4 = new Uri("node-ref-augb2");
+        NodeId nodeId4 = new NodeId(nodeRef4);
+
+        // Creates support termination list with the above two contents.
+        SupportingTerminationPoint point3 =
+                new DefaultSupportingTerminationPoint
+                        .SupportingTerminationPointBuilder()
+                        .networkRef(nwkRef3).nodeRef(nodeId3)
+                        .tpRef(AUG_TP_REF_B1).build();
+        SupportingTerminationPoint point4 =
+                new DefaultSupportingTerminationPoint
+                        .SupportingTerminationPointBuilder()
+                        .networkRef(nwkRef4).nodeRef(nodeId4)
+                        .tpRef("tp-ref-aug-b2").build();
+
+        List<SupportingTerminationPoint> pointList2 = new ArrayList<>();
+        pointList2.add(point3);
+        pointList2.add(point4);
+
+        // Adds the list created to the termination point content2.
+        TerminationPoint tPoint2 = new DefaultTerminationPoint
+                .TerminationPointBuilder()
+                .supportingTerminationPoint(pointList2)
+                .tpId(AUG_TP_ID_B1).build();
+
+        List<TerminationPoint> terminationPointList = new ArrayList<>();
+        terminationPointList.add(tPoint1);
+        terminationPointList.add(tPoint2);
+
+        // Adds all the above contents to the augment.
+        AugmentedNdNode augment = new DefaultAugmentedNdNode
+                .AugmentedNdNodeBuilder()
+                .terminationPoint(terminationPointList)
+                .build();
+
+        // Creates leaf value for network-ref in augmented node(ietf-network).
+        Uri nwRef5 = new Uri(NW_REF);
+
+        //Creates leaf value for node-ref in augmented node(ietf-network).
+        Uri nodeRef5 = new Uri(NODE_REF);
+        NodeId nodeId5 = new NodeId(nodeRef5);
+
+        // Creates supporting node list content 1 with above contents.
+        SupportingNode supNode1 = new DefaultSupportingNode
+                .SupportingNodeBuilder().nodeRef(nodeId5)
+                .networkRef(nwRef5).build();
+
+        // Creates leaf value for network-ref in augmented node(ietf-network).
+        Uri nwRef6 = new Uri(NW_REF_2);
+
+        //Creates leaf value for node-ref in augmented node(ietf-network).
+        Uri nodeRef6 = new Uri("node-ref2");
+        NodeId nodeId6 = new NodeId(nodeRef6);
+
+        // Creates supporting node list content 2 with above contents.
+        SupportingNode supNode2 = new DefaultSupportingNode
+                .SupportingNodeBuilder()
+                .nodeRef(nodeId6)
+                .networkRef(nwRef6).build();
+
+        List<SupportingNode> supNodeList = new ArrayList<>();
+        supNodeList.add(supNode1);
+        supNodeList.add(supNode2);
+
+        // Creates leaf value for node-id in augmented node(ietf-network).
+        Uri nodeId1 = new Uri(NODE_REF_3);
+        NodeId nodeIdForId = new NodeId(nodeId1);
+
+        // Creates node list with content 1 by adding augment also.
+        DefaultNode.NodeBuilder nodeBuilder = new DefaultNode.NodeBuilder();
+        nodeBuilder.addYangAugmentedInfo(
+                augment, AugmentedNdNode.class);
+        nodeBuilder.supportingNode(supNodeList);
+        nodeBuilder.nodeId(nodeIdForId);
+        Node node1 = nodeBuilder.build();
+
+        // Creates an augment node without any values set to it.
+        AugmentedNdNode augmentedNdNode2 = new DefaultAugmentedNdNode
+                .AugmentedNdNodeBuilder().build();
+
+        // Creates leaf value for network-ref in augmented node(ietf-network).
+        Uri nwRef7 = new Uri(NW_REF_B);
+
+        //Creates leaf value for node-ref in augmented node(ietf-network).
+        Uri nodeRef7 = new Uri(NODE_REF_B);
+        NodeId nodeId7 = new NodeId(nodeRef7);
+
+        // Creates supporting node list content 1 with above contents.
+        SupportingNode supNode3 = new DefaultSupportingNode
+                .SupportingNodeBuilder().nodeRef(nodeId7)
+                .networkRef(nwRef7).build();
+
+        // Creates leaf value for network-ref in augmented node(ietf-network).
+        Uri nwRef8 = new Uri(NW_REF_2B);
+
+        //Creates leaf value for node-ref in augmented node(ietf-network).
+        Uri nodeRef8 = new Uri(NODE_REF_2B);
+        NodeId nodeId8 = new NodeId(nodeRef8);
+
+        // Creates supporting node list content 1 with above contents.
+        SupportingNode supNode4 = new DefaultSupportingNode
+                .SupportingNodeBuilder()
+                .nodeRef(nodeId8)
+                .networkRef(nwRef8).build();
+
+        List<SupportingNode> supNodeList2 = new ArrayList<>();
+        supNodeList2.add(supNode3);
+        supNodeList2.add(supNode4);
+
+        // Creates leaf value for node-id in augmented node(ietf-network).
+        Uri nodeIdLeaf = new Uri(NODE_REF_3B);
+        NodeId nodeIdForId2 = new NodeId(nodeIdLeaf);
+
+        // Creates node list with content 2 by adding empty augment also.
+        DefaultNode.NodeBuilder nodeBuilder2 = new DefaultNode.NodeBuilder();
+        nodeBuilder2.addYangAugmentedInfo(
+                augmentedNdNode2, AugmentedNdNode.class);
+        nodeBuilder2.supportingNode(supNodeList2);
+        nodeBuilder2.nodeId(nodeIdForId2);
+        Node node2 = nodeBuilder2.build();
+
+        // Adds both nodes into the list.
+        List<Node> nodeList = new LinkedList<>();
+        nodeList.add(node1);
+        nodeList.add(node2);
+
+        // Adds the list into the network list.
+        Network nwkList = new DefaultNetwork.NetworkBuilder()
+                .node(nodeList).build();
+
+        List<Network> networkList = new ArrayList<>();
+        networkList.add(nwkList);
+
+        // Adds the network list into networks container.
+        Networks contNetworks = new DefaultNetworks.NetworksBuilder()
+                .network(networkList).build();
+
+        // Adds the container into the module.
+        YmsIetfNetwork opParam = new YmsIetfNetworkOpParam
+                .YmsIetfNetworkBuilder()
+                .networks(contNetworks).build();
+        return opParam;
+    }
+
+    /**
+     * Processes a simple choice case and builds the YDT.
+     */
+    @Test
+    public void processSimpleChoiceCase() {
+
+        schemaProvider.processSchemaRegistry(null);
+        DefaultYangSchemaRegistry registry = schemaProvider
+                .getDefaultYangSchemaRegistry();
+
+        // As an application, creates the object.
+
+        // Creates a choice snack with the case late night.
+        YtbSnack lateNight = new DefaultYtbLateNight.YtbLateNightBuilder()
+                .chocolate(CHOC).build();
+
+        // Creates container food with the created case.
+        YtbFood food = new DefaultYtbFood.YtbFoodBuilder()
+                .ytbSnack(lateNight).build();
+
+        // Creates module with the container food.
+        YtbSimpleChoiceCase choiceCase = new YtbSimpleChoiceCaseOpParam
+                .YtbSimpleChoiceCaseBuilder().ytbFood(food).build();
+
+        // As YSB or YAB protocol, sets the value for YTB.
+        List<Object> objectList = new ArrayList<>();
+        objectList.add(choiceCase);
+
+        // Builds YANG tree in YTB.
+        DefaultYangTreeBuilder treeBuilder = new DefaultYangTreeBuilder();
+        YdtExtendedBuilder ydtBuilder = treeBuilder.getYdtBuilderForYo(
+                objectList, ROOT_NAME, ROOT_NAME_SPACE,
+                EDIT_CONFIG_REPLY, registry);
+
+        // Receives YDT context and check the tree that is built.
+        YdtContext rootNode = ydtBuilder.getRootNode();
+
+        // Gets the first module from logical root node.
+        YdtContext module = rootNode.getFirstChild();
+        assertThat(getInCrtName(MODULE, CHOICE_CASE), module.getName(),
+                   is(CHOICE_CASE));
+
+        // Gets the container food from module.
+        YdtContext container = module.getFirstChild();
+        assertThat(getInCrtName(CONTAINER, FOOD), container.getName(),
+                   is(FOOD));
+
+        // Gets the case-leaf from container
+        YdtContext caseNode = container.getFirstChild();
+        assertThat(getInCrtName(LEAF, CHOCOLATE), caseNode.getName(),
+                   is(CHOCOLATE));
+        assertThat(getInCrtLeafValue(CHOCOLATE, CHOC), caseNode.getValue(),
+                   is(CHOC));
+    }
+
+    /**
+     * Processes module with two choices and a choice having node and a
+     * leaf-list.
+     */
+    @Test
+    public void processChoiceWithNodeAndLeafList() {
+
+        schemaProvider.processSchemaRegistry(null);
+        DefaultYangSchemaRegistry registry = schemaProvider
+                .getDefaultYangSchemaRegistry();
+
+        // As an application, creates the object.
+
+        // Creates reproduce container for list predict-1.
+        Reproduce reproduce1 = new DefaultReproduce.ReproduceBuilder()
+                .yangAutoPrefixCatch((short) 90).build();
+
+        // Assigns predict-1 with the container.
+        Predict predict1 = new DefaultPredict.PredictBuilder()
+                .reproduce(reproduce1).build();
+
+        // Creates reproduce container for list predict-2.
+        Reproduce reproduce2 = new DefaultReproduce.ReproduceBuilder()
+                .yangAutoPrefixCatch((short) 100).build();
+
+        // Assigns predict-2 with the container.
+        Predict predict2 = new DefaultPredict.PredictBuilder()
+                .reproduce(reproduce2).build();
+
+        List<Predict> predictList = new ArrayList<>();
+        predictList.add(predict1);
+        predictList.add(predict2);
+
+        // Case container is added to the choice content-test.
+        ChoiceContainer containerCase = new org.onosproject.yang.gen.v1.yms
+                .test.ytb.choice.with.container.and.leaf.list.rev20160826
+                .ytbchoicewithcontainerandleaflist.contenttest.choicecontainer
+                .DefaultChoiceContainer.ChoiceContainerBuilder()
+                .predict(predictList).build();
+
+        // Case container is added to the choice content-test.
+        ContentTest contentTest = new DefaultChoiceContainer
+                .ChoiceContainerBuilder().choiceContainer(containerCase).build();
+
+        // Creates string list for leaf-list final.
+        List<String> stringList = new ArrayList<>();
+        stringList.add(VAL);
+        stringList.add(IND);
+
+        // For choice current value, the leaf list gets added as case.
+        CurrentValue currentValue = new DefaultYtbAbsent.YtbAbsentBuilder()
+                .yangAutoPrefixFinal(stringList).build();
+
+        // Adds choice as child to the module.
+        YtbChoiceWithContainerAndLeafList choiceWithContainerAndLeafList =
+                new YtbChoiceWithContainerAndLeafListOpParam
+                        .YtbChoiceWithContainerAndLeafListBuilder()
+                        .contentTest(contentTest).currentValue(currentValue)
+                        .build();
+
+        // As YSB or YAB protocol, sets the value for YTB.
+        List<Object> objectList = new ArrayList<>();
+        objectList.add(choiceWithContainerAndLeafList);
+
+        // Builds YANG tree in YTB.
+        DefaultYangTreeBuilder treeBuilder = new DefaultYangTreeBuilder();
+        YdtExtendedBuilder ydtBuilder = treeBuilder.getYdtBuilderForYo(
+                objectList, CHOICE_ROOT_NAME, CHOICE_ROOT_NAMESPACE,
+                QUERY_CONFIG_REPLY, registry);
+
+        // Receives YDT context and check the tree that is built.
+        YdtContext context = ydtBuilder.getRootNode();
+        assertThat(getInCrtName(ROOT, CHOICE_ROOT_NAME), context.getName(),
+                   is(CHOICE_ROOT_NAME));
+        assertThat(getInCrtName(ROOT, CHOICE_ROOT_NAMESPACE), context.getNamespace(),
+                   is(CHOICE_ROOT_NAMESPACE));
+
+        // Gets the first module from logical root node.
+        YdtContext module = context.getFirstChild();
+        assertThat(getInCrtName(MODULE, CHOICE_CONT), module.getName(),
+                   is(CHOICE_CONT));
+
+        // Gets the first choice content under the module, as container.
+        YdtContext choice1 = module.getFirstChild();
+        assertThat(getInCrtName(CONTAINER, CONT_CHOICE), choice1.getName(),
+                   is(CONT_CHOICE));
+
+        // Gets the first content in the list predict.
+        YdtContext list1 = choice1.getFirstChild();
+        assertThat(getInCrtName(LIST, PREDICT), list1.getName(), is(PREDICT));
+
+        // Gets the container and its child leaf in the list predict.
+        YdtContext container1 = list1.getFirstChild();
+        assertThat(getInCrtName(CONTAINER, REPRODUCE), container1.getName(),
+                   is(REPRODUCE));
+        YdtContext leaf1 = container1.getFirstChild();
+        assertThat(getInCrtName(LEAF, CATCH), leaf1.getName(), is(CATCH));
+        assertThat(getInCrtLeafValue(CATCH, NINETY), leaf1.getValue(),
+                   is(NINETY));
+
+        // Gets the second content in the list predict.
+        YdtContext list2 = list1.getNextSibling();
+        assertThat(getInCrtName(LIST, PREDICT), list2.getName(), is(PREDICT));
+
+        // Gets the container and its child leaf in the list predict.
+        YdtContext container2 = list2.getFirstChild();
+        assertThat(getInCrtName(CONTAINER, REPRODUCE), container2.getName(),
+                   is(REPRODUCE));
+        YdtContext leaf2 = container2.getFirstChild();
+        assertThat(getInCrtName(LEAF, CATCH), leaf2.getName(), is(CATCH));
+        assertThat(getInCrtLeafValue(CATCH, HUNDRED), leaf2.getValue(),
+                   is(HUNDRED));
+
+        // Gets the second choice content under the module, as leaf-list.
+        YdtContext choice2 = choice1.getNextSibling();
+        assertThat(getInCrtName(LEAF_LIST, FINAL), choice2.getName(),
+                   is(FINAL));
+        Set value2 = choice2.getValueSet();
+        assertThat(getInCrtLeafListValue(FINAL, VAL), value2.contains(VAL),
+                   is(true));
+        assertThat(getInCrtLeafListValue(FINAL, IND), value2.contains(IND),
+                   is(true));
+    }
+
+    /**
+     * Processes RPC response of a simple output with only a leaf content
+     * inside.
+     */
+    @Test
+    public void processSimpleRpcResponse() {
+        schemaProvider.processSchemaRegistry(null);
+        DefaultYangSchemaRegistry registry = schemaProvider
+                .getDefaultYangSchemaRegistry();
+
+        // As an application, creates the object.
+        RpcOutput output = new DefaultRpcOutput.RpcOutputBuilder()
+                .outputLeaf(500).build();
+
+        // Creates request work bench of rpc.
+        YangRequestWorkBench workBench = new YangRequestWorkBench(
+                RPC_RT_NAME, RPC_RT_NAMESPACE, RPC_REQUEST, registry, true);
+        workBench.addChild(RPC_NAME, null, NONE);
+        workBench.addChild(RPC, null, NONE);
+        workBench.addChild(INPUT, null, NONE);
+
+        // Builds YANG tree in YTB.
+        DefaultYangTreeBuilder treeBuilder = new DefaultYangTreeBuilder();
+        YdtExtendedBuilder ydtBuilder = treeBuilder.getYdtForRpcResponse(
+                output, workBench);
+
+        // Receives YDT context and check the tree that is built.
+        YdtContext context = ydtBuilder.getRootNode();
+        assertThat(getInCrtName(ROOT, RPC_RT_NAME), context.getName(),
+                   is(RPC_RT_NAME));
+        assertThat(getInCrtName(ROOT, RPC_RT_NAMESPACE), context.getNamespace(),
+                   is(RPC_RT_NAMESPACE));
+
+        // Gets the first module from logical root node.
+        YdtContext module = context.getFirstChild();
+        assertThat(getInCrtName(MODULE, RPC_NAME), module.getName(),
+                   is(RPC_NAME));
+
+        // Gets the rpc node from the module.
+        YdtContext rpc = module.getFirstChild();
+        assertThat(getInCrtName(RPC, RPC), rpc.getName(), is(RPC));
+
+        // Gets the output node from the module.
+        // TODO: Change assert after YANG utils is merged.
+        YdtContext rpcOutput = rpc.getFirstChild();
+        //assertThat(rpcOutputNode.getName(), is("output"));
+
+        YdtContext outputLeaf = rpcOutput.getFirstChild();
+        assertThat(getInCrtName(LEAF, OUTPUT_LEAF), outputLeaf.getName(),
+                   is(OUTPUT_LEAF));
+        assertThat(getInCrtLeafValue(OUTPUT_LEAF, FIVE_HUNDRED),
+                   outputLeaf.getValue(), is(FIVE_HUNDRED));
+    }
+
+    /**
+     * Processes RPC response of an output defined with list.
+     */
+    @Test
+    public void processRpcResponseForAdvInputOutput() {
+        schemaProvider.processSchemaRegistry(null);
+        DefaultYangSchemaRegistry registry = schemaProvider
+                .getDefaultYangSchemaRegistry();
+
+        // As an application, creates the object.
+        List<OutputList> list = createApplicationBuiltObjectForRpc();
+        ActivateSoftwareImageOutput output =
+                new DefaultActivateSoftwareImageOutput
+                        .ActivateSoftwareImageOutputBuilder()
+                        .outputList(list).build();
+
+        // Creates request work bench of rpc.
+        YangRequestWorkBench workBench = buildYangRequestWorkBenchForRpc(
+                registry);
+
+        // Builds YANG tree in YTB.
+        DefaultYangTreeBuilder treeBuilder = new DefaultYangTreeBuilder();
+        YdtExtendedBuilder ydtBuilder = treeBuilder.getYdtForRpcResponse(
+                output, workBench);
+
+        // Receives YDT context and check the tree that is built.
+        YdtContext context = ydtBuilder.getRootNode();
+        assertThat(getInCrtName(ROOT, RPC_ADV_NAME), context.getName(),
+                   is(RPC_ADV_NAME));
+        assertThat(getInCrtName(ROOT, RPC_ADV_NAMESPACE), context.getNamespace(),
+                   is(RPC_ADV_NAMESPACE));
+
+        // Gets the first module from logical root node.
+        YdtContext module = context.getFirstChild();
+        assertThat(getInCrtName(MODULE, RPC_ADV_IO), module.getName(),
+                   is(RPC_ADV_IO));
+
+        // Gets the rpc node from module.
+        YdtContext rpc = module.getFirstChild();
+        assertThat(getInCrtName(RPC, ACT_IMG), rpc.getName(), is(ACT_IMG));
+
+        // Gets the output node from the module.
+        // TODO: Change assert after YANG utils is merged.
+        YdtContext rpcOutput = rpc.getFirstChild();
+        //assertThat(rpcOutputNode.getName(), is("output"));
+
+        // Gets the list content 1 as the node from output.
+        YdtContext outputList1 = rpcOutput.getFirstChild();
+        assertThat(getInCrtName(LIST, OUTPUT_LIST), outputList1.getName(),
+                   is(OUTPUT_LIST));
+
+        // Gets the leaf key-list from list content1.
+        YdtContext keyList1 = outputList1.getFirstChild();
+        assertThat(getInCrtName(LEAF, LIST_KEY), keyList1.getName(),
+                   is(LIST_KEY));
+        assertThat(getInCrtLeafValue(LIST_KEY, BIN_VAL_1), keyList1.getValue(),
+                   is(BIN_VAL_1));
+
+        // Gets the content inside container from list content 1.
+        YdtContext cont1 = keyList1.getNextSibling();
+        assertThat(getInCrtName(CONTAINER, CONT_INSIDE), cont1.getName(),
+                   is(CONT_INSIDE));
+
+        // Gets the list content 2 as the node from output.
+        YdtContext outputList2 = outputList1.getNextSibling();
+        assertThat(getInCrtName(LIST, OUTPUT_LIST), outputList2.getName(),
+                   is(OUTPUT_LIST));
+
+        // Gets the leaf-list key-list from list content2.
+        YdtContext keyList2 = outputList2.getFirstChild();
+        assertThat(getInCrtName(LEAF, LIST_KEY), keyList2.getName(),
+                   is(LIST_KEY));
+        assertThat(getInCrtLeafValue(LIST_KEY, BIN_VAL_2), keyList2.getValue(),
+                   is(BIN_VAL_2));
+
+        // Gets the content inside container from list content 2.
+        YdtContext cont2 = keyList2.getNextSibling();
+        assertThat(getInCrtName(CONTAINER, CONT_INSIDE), cont2.getName(),
+                   is(CONT_INSIDE));
+
+        // Gets the leaf-list available inside container.
+        YdtContext availLeafList = cont2.getFirstChild();
+        assertThat(getInCrtName(LEAF_LIST, AVAILABLE), availLeafList.getName(),
+                   is(AVAILABLE));
+        Set value1 = availLeafList.getValueSet();
+        assertThat(getInCrtLeafListValue(AVAILABLE, EIGHTY_NINE),
+                   value1.contains(EIGHTY_NINE), is(true));
+        assertThat(getInCrtLeafListValue(AVAILABLE, NINETY_EIGHT),
+                   value1.contains(NINETY_EIGHT), is(true));
+
+        // Gets the list content 3.
+        YdtContext outputList3 = outputList2.getNextSibling();
+        assertThat(getInCrtName(LIST, OUTPUT_LIST), outputList3.getName(),
+                   is(OUTPUT_LIST));
+
+        // Gets the leaf list-key in content 3 of list.
+        YdtContext keyList3 = outputList3.getFirstChild();
+        assertThat(getInCrtName(LEAF, LIST_KEY), keyList3.getName(),
+                   is(LIST_KEY));
+        assertThat(getInCrtLeafValue(LIST_KEY, BIN_VAL_3), keyList3.getValue(),
+                   is(BIN_VAL_3));
+    }
+
+    /**
+     * Processes simple self augment file with leaf and container inside
+     * augment.
+     */
+    @Test
+    public void processSimpleAugment() {
+        schemaProvider.processSchemaRegistry(null);
+        DefaultYangSchemaRegistry registry = schemaProvider
+                .getDefaultYangSchemaRegistry();
+
+        // As an application, creates the object.
+
+        // Creates container cont1s with the leaf.
+        org.onosproject.yang.gen.v1.yms.test.ytb.simple.augment.rev20160826
+                .ytbsimpleaugment.cont1.cont2.augmentedcont2.cont1s
+                .Cont1s cont1s1 = new org.onosproject.yang.gen.v1.yms.test
+                .ytb.simple.augment.rev20160826.ytbsimpleaugment.cont1.cont2
+                .augmentedcont2.cont1s.DefaultCont1s.Cont1sBuilder().build();
+
+        // Appends the created container into another container.
+        Cont1s cont1s = new DefaultCont1s.Cont1sBuilder()
+                .cont1s(cont1s1).build();
+
+        // Creates augment with the container and leaf.
+        AugmentedCont2 augment = new DefaultAugmentedCont2
+                .AugmentedCont2Builder().cont1s(cont1s).leaf4(500).build();
+
+        // Creates for the node which will be getting augmented.
+        // Creates cont2 where content will be augmented into.
+        DefaultCont2.Cont2Builder augCont2 = new DefaultCont2
+                .Cont2Builder();
+        augCont2.addYangAugmentedInfo(augment, AugmentedCont2.class);
+
+        // Creates cont1 where cont2 is added.
+        Cont1 cont1 = new DefaultCont1.Cont1Builder()
+                .cont2(augCont2.build()).build();
+
+        // Creates module with the nodes inside.
+        YtbSimpleAugment simpleAugment = new YtbSimpleAugmentOpParam
+                .YtbSimpleAugmentBuilder().cont1(cont1).build();
+
+        // As YSB or YAB protocol, sets the value for YTB.
+        List<Object> objectList = new ArrayList<>();
+        objectList.add(simpleAugment);
+
+        // Builds YANG tree in YTB.
+        DefaultYangTreeBuilder treeBuilder = new DefaultYangTreeBuilder();
+        YdtExtendedBuilder ydtBuilder = treeBuilder.getYdtBuilderForYo(
+                objectList, SIM_AUG, SIM_AUG_NAMESPACE,
+                EDIT_CONFIG_REQUEST, registry);
+
+        // Receives YDT context and check the tree that is built.
+        YdtContext context = ydtBuilder.getRootNode();
+        assertThat(getInCrtName(ROOT, SIM_AUG), context.getName(), is(SIM_AUG));
+        assertThat(getInCrtName(ROOT, SIM_AUG_NAMESPACE),
+                   context.getNamespace(), is(SIM_AUG_NAMESPACE));
+
+        // Gets the first module from logical root node.
+        YdtContext module = context.getFirstChild();
+        assertThat(getInCrtName(MODULE, SIMPLE_AUG), module.getName(),
+                   is(SIMPLE_AUG));
+
+        // Gets the cont1 under module.
+        YdtContext container1 = module.getFirstChild();
+        assertThat(getInCrtName(CONTAINER, CONT1), container1.getName(),
+                   is(CONT1));
+
+        // Gets the cont2 under cont1.
+        YdtContext container2 = container1.getFirstChild();
+        assertThat(getInCrtName(CONTAINER, CONT2), container2.getName(),
+                   is(CONT2));
+
+        // Gets the leaf4 which was augmented under cont2.
+        YdtContext leaf4 = container2.getFirstChild();
+        assertThat(getInCrtName(LEAF, LEAF4), leaf4.getName(), is(LEAF4));
+        assertThat(getInCrtLeafValue(LEAF4, FIVE_HUNDRED), leaf4.getValue(),
+                   is(FIVE_HUNDRED));
+
+        // Gets the cont1s which was augmented under cont2.
+        YdtContext container1s = leaf4.getNextSibling();
+        assertThat(getInCrtName(CONTAINER, CONT1S), container1s.getName(),
+                   is(CONT1S));
+
+        // Gets the cont2s which was augmented under cont1s.
+        YdtContext container2s = container1s.getFirstChild();
+        assertThat(getInCrtName(CONTAINER, CONT1S), container2s.getName(),
+                   is(CONT1S));
+    }
+
+    /**
+     * Processes inter file augment with augmented node as list and the
+     * augment having list.
+     */
+    @Test
+    public void processInterFileAugment() {
+        schemaProvider.processSchemaRegistry(null);
+        DefaultYangSchemaRegistry registry = schemaProvider
+                .getDefaultYangSchemaRegistry();
+
+        // As an application, creates the object.
+        Object opParam = createObjectForInterFileAugment();
+
+        // As YSB or YAB protocol, sets the value for YTB.
+        List<Object> objectList = new ArrayList<>();
+        objectList.add(opParam);
+
+        // Builds YANG tree in YTB.
+        DefaultYangTreeBuilder treeBuilder = new DefaultYangTreeBuilder();
+        YdtExtendedBuilder ydtBuilder = treeBuilder.getYdtBuilderForYo(
+                objectList, INTER_AUG, INTER_AUG_NAMESPACE,
+                EDIT_CONFIG_REQUEST, registry);
+
+        // Receives YDT context and check the tree that is built.
+        YdtContext context = ydtBuilder.getRootNode();
+        assertThat(getInCrtName(ROOT, INTER_AUG), context.getName(),
+                   is(INTER_AUG));
+        assertThat(getInCrtName(ROOT, INTER_AUG_NAMESPACE), context.getNamespace(),
+                   is(INTER_AUG_NAMESPACE));
+
+        // Checks the first module from logical root node.
+        YdtContext module = context.getFirstChild();
+        assertThat(getInCrtName(MODULE, IETF_NW), module.getName(),
+                   is(IETF_NW));
+
+        // Checks the container networks from module.
+        YdtContext nwksCont = module.getFirstChild();
+        assertThat(getInCrtName(CONTAINER, NWS), nwksCont.getName(), is(NWS));
+
+        // Checks the list network from container networks.
+        YdtContext nwrkList = nwksCont.getFirstChild();
+        assertThat(getInCrtName(LIST, NW), nwrkList.getName(), is(NW));
+
+        // Checks the node list content 1 under network list.
+        YdtContext node1 = nwrkList.getFirstChild();
+        assertThat(getInCrtName(LIST, NODE), node1.getName(), is(NODE));
+
+        // Checks the node-id leaf for list content 1.
+        YdtContext nodeId1 = node1.getFirstChild();
+        assertThat(getInCrtName(LEAF, NODE_ID), nodeId1.getName(), is(NODE_ID));
+        assertThat(getInCrtLeafValue(NODE_ID, NODE_REF_3), nodeId1.getValue(),
+                   is(NODE_REF_3));
+
+        // Checks termination list 1 under node 1, from augment.
+        YdtContext terList1 = nodeId1.getNextSibling();
+        assertThat(getInCrtName(LIST, TERM_POINT), terList1.getName(),
+                   is(TERM_POINT));
+
+        // Checks tp-id leaf from termination list content 1.
+        YdtContext tpId1 = terList1.getFirstChild();
+        assertThat(getInCrtName(LEAF, TP_ID), tpId1.getName(), is(TP_ID));
+        assertThat(getInCrtLeafValue(TP_ID, AUG_TP_ID_1), tpId1.getValue(),
+                   is(AUG_TP_ID_1));
+
+        // Checks supporting term point list content1 from term list content 1.
+        YdtContext supTerm1 = tpId1.getNextSibling();
+        assertThat(getInCrtName(LIST, SUP_TERM_POINT), supTerm1.getName(),
+                   is(SUP_TERM_POINT));
+
+        YdtContext nwkRefSupTerm1 = supTerm1.getFirstChild();
+        assertThat(getInCrtName(LEAF, NW_REF), nwkRefSupTerm1.getName(),
+                   is(NW_REF));
+        assertThat(getInCrtLeafValue(NW_REF, AUG_NW_REF_1),
+                   nwkRefSupTerm1.getValue(), is(AUG_NW_REF_1));
+
+        YdtContext nodeRefSupTerm1 = nwkRefSupTerm1.getNextSibling();
+        assertThat(getInCrtName(LEAF, NODE_REF), nodeRefSupTerm1.getName(),
+                   is(NODE_REF));
+        assertThat(getInCrtLeafValue(NODE_REF, AUG_NODE_REF_1),
+                   nodeRefSupTerm1.getValue(), is(AUG_NODE_REF_1));
+
+        YdtContext tpRefSupTerm1 = nodeRefSupTerm1.getNextSibling();
+        assertThat(getInCrtName(LEAF, TP_REF), tpRefSupTerm1.getName(),
+                   is(TP_REF));
+        assertThat(getInCrtLeafValue(TP_REF, AUG_TP_REF_1),
+                   tpRefSupTerm1.getValue(), is(AUG_TP_REF_1));
+
+        // Checks termination list 2 under node 1, from augment.
+        YdtContext terminationList2 = terList1.getNextSibling();
+        assertThat(getInCrtName(LIST, TERM_POINT), terminationList2.getName(),
+                   is(TERM_POINT));
+
+        YdtContext terList2 = terminationList2.getFirstChild();
+        assertThat(getInCrtName(LEAF, TP_ID), terList2.getName(), is(TP_ID));
+        assertThat(getInCrtLeafValue(TP_ID, AUG_TP_ID_B1), terList2.getValue(),
+                   is(AUG_TP_ID_B1));
+
+        // Checks supporting term point list content1 from term list content 2.
+        YdtContext supTerm2 = terList2.getNextSibling();
+        assertThat(getInCrtName(LIST, SUP_TERM_POINT), supTerm2.getName(),
+                   is(SUP_TERM_POINT));
+
+        YdtContext nwkRefSupTerm2 = supTerm2.getFirstChild();
+        assertThat(getInCrtName(LEAF, NW_REF), nwkRefSupTerm2.getName(),
+                   is(NW_REF));
+        assertThat(getInCrtLeafValue(NW_REF, AUG_NW_REF_B1),
+                   nwkRefSupTerm2.getValue(), is(AUG_NW_REF_B1));
+
+        YdtContext nodeRefSupTerm2 = nwkRefSupTerm2.getNextSibling();
+        assertThat(getInCrtName(LEAF, NODE_REF), nodeRefSupTerm2.getName(),
+                   is(NODE_REF));
+        assertThat(getInCrtLeafValue(NODE_REF, AUG_NODE_REF_B1),
+                   nodeRefSupTerm2.getValue(), is(AUG_NODE_REF_B1));
+
+        YdtContext tpRefSupTerm2 = nodeRefSupTerm2.getNextSibling();
+        assertThat(getInCrtName(LEAF, TP_REF), tpRefSupTerm2.getName(),
+                   is(TP_REF));
+        assertThat(getInCrtLeafValue(TP_REF, AUG_TP_REF_B1),
+                   tpRefSupTerm2.getValue(), is(AUG_TP_REF_B1));
+
+        // Checks the content of the supporting node list content 1 in node 1.
+        YdtContext supNode1 = terminationList2.getNextSibling();
+        assertThat(getInCrtName(LIST, SUP_NODE), supNode1.getName(),
+                   is(SUP_NODE));
+
+        YdtContext nwkRefSupNode1 = supNode1.getFirstChild();
+        assertThat(getInCrtName(LEAF, NW_REF), nwkRefSupNode1.getName(),
+                   is(NW_REF));
+        assertThat(getInCrtLeafValue(NW_REF, NW_REF), nwkRefSupNode1.getValue(),
+                   is(NW_REF));
+
+        YdtContext nodeRefSupNode1 = nwkRefSupNode1.getNextSibling();
+        assertThat(getInCrtName(LEAF, NODE_REF), nodeRefSupNode1.getName(),
+                   is(NODE_REF));
+        assertThat(getInCrtLeafValue(NODE_REF, NW_REF),
+                   nwkRefSupNode1.getValue(), is(NW_REF));
+
+        // Checks the content of the supporting node list content 2 in node 1.
+        YdtContext supNode2 = supNode1.getNextSibling();
+        assertThat(getInCrtName(LIST, SUP_NODE), supNode2.getName(),
+                   is(SUP_NODE));
+
+        YdtContext nwkRefSupNode2 = supNode2.getFirstChild();
+        assertThat(getInCrtName(LEAF, NW_REF), nwkRefSupNode2.getName(),
+                   is(NW_REF));
+        assertThat(getInCrtLeafValue(NW_REF, NW_REF_2),
+                   nwkRefSupNode2.getValue(), is(NW_REF_2));
+
+        YdtContext nodeRefSupNode2 = nwkRefSupNode2.getNextSibling();
+        assertThat(getInCrtName(LEAF, NODE_REF), nodeRefSupNode2.getName(),
+                   is(NODE_REF));
+        assertThat(getInCrtLeafValue(NODE_REF, NW_REF_2),
+                   nwkRefSupNode2.getValue(), is(NW_REF_2));
+
+        // Checks the node list content 2 under network list.
+        YdtContext node2 = node1.getNextSibling();
+        assertThat(getInCrtName(LIST, NODE), node2.getName(), is(NODE));
+
+        // Checks the node-id leaf for list content 2.
+        YdtContext nodeId2 = node2.getFirstChild();
+        assertThat(getInCrtName(LEAF, NODE_ID), nodeId2.getName(), is(NODE_ID));
+        assertThat(getInCrtLeafValue(NODE_ID, NODE_REF_3B), nodeId2.getValue(),
+                   is(NODE_REF_3B));
+
+        // Checks supporting term point list content1 from term list content 2.
+        YdtContext supNode3 = nodeId2.getNextSibling();
+        assertThat(getInCrtName(LIST, SUP_NODE), supNode3.getName(),
+                   is(SUP_NODE));
+
+        YdtContext nwkRefSupNode3 = supNode3.getFirstChild();
+        assertThat(getInCrtName(LEAF, NW_REF), nwkRefSupNode3.getName(),
+                   is(NW_REF));
+        assertThat(getInCrtLeafValue(NW_REF, NW_REF_B),
+                   nwkRefSupNode3.getValue(), is(NW_REF_B));
+
+        YdtContext nodeRefSupNode3 = nwkRefSupNode3.getNextSibling();
+        assertThat(getInCrtName(LEAF, NODE_REF), nodeRefSupNode3.getName(),
+                   is(NODE_REF));
+        assertThat(getInCrtLeafValue(NODE_REF, NODE_REF_B),
+                   nodeRefSupNode3.getValue(), is(NODE_REF_B));
+
+        // Checks supporting term point list content2 from term list content 2.
+        YdtContext supNode4 = supNode3.getNextSibling();
+        assertThat(getInCrtName(LIST, SUP_NODE), supNode4.getName(),
+                   is(SUP_NODE));
+
+        YdtContext nwkRefSupNode4 = supNode4.getFirstChild();
+        assertThat(getInCrtName(LEAF, NW_REF), nwkRefSupNode4.getName(),
+                   is(NW_REF));
+        assertThat(getInCrtLeafValue(NW_REF, NW_REF_2B),
+                   nwkRefSupNode4.getValue(), is(NW_REF_2B));
+
+        YdtContext nodeRefSupNode4 = nwkRefSupNode4.getNextSibling();
+        assertThat(getInCrtName(LEAF, NODE_REF), nodeRefSupNode4.getName(),
+                   is(NODE_REF));
+        assertThat(getInCrtLeafValue(NODE_REF, NODE_REF_2B),
+                   nodeRefSupNode4.getValue(), is(NODE_REF_2B));
+    }
+
+    /**
+     * Processes inter file augment with rpc output as its target node.
+     */
+    @Test
+    public void processInterFileAugmentWithRpcInputAsTarget() {
+        schemaProvider.processSchemaRegistry(null);
+        DefaultYangSchemaRegistry registry = schemaProvider
+                .getDefaultYangSchemaRegistry();
+
+        // Builds RPC request tree in YDT.
+        YangRequestWorkBench workBench =
+                buildYangRequestWorkBenchForRpc(registry);
+
+        // Creates augment code object.
+
+        // Creates the list of value in, case value in.
+        ValueIn valuein1 = new org.onosproject.yang.gen.v1.yms.test.ytb.augment
+                .yangautoprefixfor.rpc.input.rev20160826.ytbaugmentforrpcinput
+                .activatesoftwareimage.output.augmentedrpcoutput.selection
+                .valuein.DefaultValueIn.ValueInBuilder().kinetic(KIN1)
+                .build();
+        ValueIn valuein2 = new org.onosproject.yang.gen.v1.yms.test.ytb.augment
+                .yangautoprefixfor.rpc.input.rev20160826.ytbaugmentforrpcinput
+                .activatesoftwareimage.output.augmentedrpcoutput.selection
+                .valuein.DefaultValueIn.ValueInBuilder().kinetic(KIN2)
+                .build();
+
+        List<ValueIn> valueInList = new ArrayList<>();
+        valueInList.add(valuein1);
+        valueInList.add(valuein2);
+
+        // Adds the case value into the choice interface.
+        Selection selection = new DefaultValueIn.ValueInBuilder()
+                .valueIn(valueInList).build();
+
+        // Augment is created for the object.
+        AugmentedRpcOutput augmentRpcOutput = new DefaultAugmentedRpcOutput
+                .AugmentedRpcOutputBuilder().selection(selection).build();
+
+        // Create two list object of friction.
+        Friction friction1 = new DefaultFriction.FrictionBuilder()
+                .speed(BigInteger.valueOf(500)).build();
+        Friction friction2 = new DefaultFriction.FrictionBuilder()
+                .speed(BigInteger.valueOf(1000)).build();
+
+        List<Friction> fricList = new ArrayList<>();
+        fricList.add(friction1);
+        fricList.add(friction2);
+
+        // Create augment with the friction object created.
+        AugmentedInputOutput augmentedIO = new DefaultAugmentedInputOutput
+                .AugmentedInputOutputBuilder().friction(fricList).build();
+
+        // Creates RPC object.
+        List<OutputList> outputLists = createApplicationBuiltObjectForRpc();
+
+        // Adds the augment and the rps output values into the output.
+        DefaultActivateSoftwareImageOutput
+                .ActivateSoftwareImageOutputBuilder output =
+                new DefaultActivateSoftwareImageOutput
+                        .ActivateSoftwareImageOutputBuilder();
+        output.addYangAugmentedInfo(augmentRpcOutput, AugmentedRpcOutput.class);
+        output.addYangAugmentedInfo(augmentedIO, AugmentedInputOutput.class);
+        output.outputList(outputLists);
+
+        // Builds YANG tree in YTB.
+        DefaultYangTreeBuilder treeBuilder = new DefaultYangTreeBuilder();
+        YdtExtendedBuilder ydtBuilder = treeBuilder.getYdtForRpcResponse(
+                output, workBench);
+
+        // Receives YDT context and check the tree that is built.
+        YdtContext context = ydtBuilder.getRootNode();
+        assertThat(getInCrtName(ROOT, RPC_ADV_NAME), context.getName(),
+                   is(RPC_ADV_NAME));
+        assertThat(getInCrtName(ROOT, RPC_ADV_NAMESPACE),
+                   context.getNamespace(), is(RPC_ADV_NAMESPACE));
+
+        // Checks the first module from logical root node.
+        YdtContext module = context.getFirstChild();
+        assertThat(getInCrtName(MODULE, RPC_ADV_IO), module.getName(),
+                   is(RPC_ADV_IO));
+
+        // Gets the rpc under module.
+        YdtContext rpc = module.getFirstChild();
+        assertThat(getInCrtName(RPC, ACT_IMG), rpc.getName(), is(ACT_IMG));
+
+        // Gets the output value under rpc.
+        // TODO: Change assert after YANG utils is merged.
+        YdtContext rpcOutputNode = rpc.getFirstChild();
+        //assertThat(rpcOutputNode.getName(), is("output"));
+
+        YdtContext firstNode = rpcOutputNode.getFirstChild();
+        assertThat(firstNode, notNullValue());
+
+        YdtContext secondNode = firstNode.getNextSibling();
+        assertThat(secondNode, notNullValue());
+
+        YdtContext thirdNode = secondNode.getNextSibling();
+        assertThat(thirdNode, notNullValue());
+
+        YdtContext fourthNode = thirdNode.getNextSibling();
+        assertThat(fourthNode, notNullValue());
+
+        // Gets the list content 1 as the node from output.
+        YdtContext outputList1 = fourthNode.getNextSibling();
+        assertThat(getInCrtName(LIST, OUTPUT_LIST), outputList1.getName(),
+                   is(OUTPUT_LIST));
+
+        // Gets the leaf key-list from list content1.
+        YdtContext keyList1 = outputList1.getFirstChild();
+        assertThat(getInCrtName(LEAF, LIST_KEY), keyList1.getName(),
+                   is(LIST_KEY));
+        assertThat(getInCrtLeafValue(LIST_KEY, BIN_VAL_1), keyList1.getValue(),
+                   is(BIN_VAL_1));
+
+        // Gets the content inside container from list content 1.
+        YdtContext cont1 = keyList1.getNextSibling();
+        assertThat(getInCrtName(CONTAINER, CONT_INSIDE), cont1.getName(),
+                   is(CONT_INSIDE));
+
+        // Gets the list content 2 as the node from output.
+        YdtContext outputList2 = outputList1.getNextSibling();
+        assertThat(getInCrtName(LIST, OUTPUT_LIST), outputList2.getName(),
+                   is(OUTPUT_LIST));
+
+        // Gets the leaf-list key-list from list content2.
+        YdtContext keyList2 = outputList2.getFirstChild();
+        assertThat(getInCrtName(LEAF, LIST_KEY), keyList2.getName(),
+                   is(LIST_KEY));
+        assertThat(getInCrtLeafValue(LIST_KEY, BIN_VAL_2), keyList2.getValue(),
+                   is(BIN_VAL_2));
+
+        // Gets the content inside container from list content 2.
+        YdtContext cont2 = keyList2.getNextSibling();
+        assertThat(getInCrtName(CONTAINER, CONT_INSIDE), cont2.getName(),
+                   is(CONT_INSIDE));
+
+        // Gets the leaf-list available inside container.
+        YdtContext availLeafList = cont2.getFirstChild();
+        assertThat(getInCrtName(LEAF_LIST, AVAILABLE), availLeafList.getName(),
+                   is(AVAILABLE));
+        Set value1 = availLeafList.getValueSet();
+        assertThat(getInCrtLeafListValue(AVAILABLE, EIGHTY_NINE),
+                   value1.contains(EIGHTY_NINE), is(true));
+        assertThat(getInCrtLeafListValue(AVAILABLE, NINETY_EIGHT),
+                   value1.contains(NINETY_EIGHT), is(true));
+
+        // Gets the list content 3.
+        YdtContext outputList3 = outputList2.getNextSibling();
+        assertThat(getInCrtName(LIST, OUTPUT_LIST), outputList3.getName(),
+                   is(OUTPUT_LIST));
+
+        // Gets the leaf list-key in content 3 of list.
+        YdtContext keyList3 = outputList3.getFirstChild();
+        assertThat(getInCrtName(LEAF, LIST_KEY), keyList3.getName(),
+                   is(LIST_KEY));
+        assertThat(getInCrtLeafValue(LIST_KEY, BIN_VAL_3), keyList3.getValue(),
+                   is(BIN_VAL_3));
+    }
+}
diff --git a/apps/yms/app/src/test/java/org/onosproject/yms/app/ytb/YtbErrMsgAndConstants.java b/apps/yms/app/src/test/java/org/onosproject/yms/app/ytb/YtbErrMsgAndConstants.java
new file mode 100644
index 0000000..572a4be
--- /dev/null
+++ b/apps/yms/app/src/test/java/org/onosproject/yms/app/ytb/YtbErrMsgAndConstants.java
@@ -0,0 +1,150 @@
+/*
+ * 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.ytb;
+
+import org.onosproject.yms.app.ysr.TestYangSchemaNodeProvider;
+
+/**
+ * Represents the abstract class for ytb test classes having common methods
+ * and the constants.
+ */
+public abstract class YtbErrMsgAndConstants {
+
+    /**
+     * Static attribute of root name.
+     */
+    public static final String ROOT_NAME = "rootName";
+
+    /**
+     * Static attribute of root name space.
+     */
+    public static final String ROOT_NAME_SPACE = "rootNameSpace";
+
+    /**
+     * Static attribute of module which is YANG name.
+     */
+    public static final String MODULE = "module";
+
+    /**
+     * Static attribute of list which is YANG name.
+     */
+    public static final String LIST = "list";
+
+    /**
+     * Static attribute of leaf which is YANG name.
+     */
+    public static final String LEAF = "leaf";
+
+    /**
+     * Static attribute of leaf-list which is YANG name.
+     */
+    public static final String LEAF_LIST = "leaf-list";
+
+    /**
+     * Static attribute of container which is YANG name.
+     */
+    public static final String CONTAINER = "container";
+
+    /**
+     * Static attribute of name predict.
+     */
+    public static final String PREDICT = "predict";
+
+    /**
+     * Static attribute of name catch.
+     */
+    public static final String CATCH = "catch";
+
+    /**
+     * Static attribute of YANG file name.
+     */
+    public static final String RPC_NAME = "YtbSimpleRpcResponse";
+
+    /**
+     * Static attribute of name rpc.
+     */
+    public static final String RPC = "rpc";
+
+    /**
+     * Created a schema node provider, which will register the app.
+     */
+    public TestYangSchemaNodeProvider schemaProvider =
+            new TestYangSchemaNodeProvider();
+
+    /**
+     * Returns the error message for when leaf value doesn't match with the
+     * expected value. It takes name of leaf and expected value as its
+     * parameter, to throw the message.
+     *
+     * @param name  leaf name
+     * @param value expected value of leaf
+     * @return error message of leaf value as incorrect
+     */
+    public static String getInCrtLeafValue(String name, String value) {
+        return "The value of leaf " + name + " is not " + value;
+    }
+
+    /**
+     * Returns the error message, when node name doesn't match with the
+     * expected value. It takes YANG name of the node and the node name as
+     * parameter, to throw the message.
+     *
+     * @param node     YANG node name
+     * @param nodeName node name
+     * @return error message as the node name is incorrect
+     */
+    public static String getInCrtName(String node, String nodeName) {
+        return getCapitalCase(node) + "'s name " + nodeName + " is incorrect.";
+    }
+
+    /**
+     * Returns the error message, when operation type doesn't match with the
+     * expected value. It takes YANG name of the node and the node name as
+     * parameter, to throw the message.
+     *
+     * @param node     YANG node name
+     * @param nodeName node name
+     * @return error message as the operation type is incorrect
+     */
+    public static String getInCrtOpType(String node, String nodeName) {
+        return "The operation type of " + node + " " + nodeName + " is " +
+                "incorrect";
+    }
+
+    /**
+     * Returns the error message for when leaf-list value doesn't match with the
+     * expected value. It takes name of leaf-list and expected value as its
+     * parameter, to throw the message.
+     *
+     * @param name  leaf-list name
+     * @param value value in leaf-list
+     * @return error message as the value in the leaf-list is incorrect
+     */
+    public static String getInCrtLeafListValue(String name, String value) {
+        return "The leaf-list " + name + " does not have " + value + " in it.";
+    }
+
+    /**
+     * Returns the capital cased first letter of the given string.
+     *
+     * @param name string to be capital cased
+     * @return capital cased string
+     */
+    private static String getCapitalCase(String name) {
+        return name.substring(0, 1).toUpperCase() + name.substring(1);
+    }
+}
diff --git a/apps/yms/app/src/test/java/org/onosproject/yms/app/ytb/YtbInvalidNodeSkipTest.java b/apps/yms/app/src/test/java/org/onosproject/yms/app/ytb/YtbInvalidNodeSkipTest.java
new file mode 100644
index 0000000..019d958
--- /dev/null
+++ b/apps/yms/app/src/test/java/org/onosproject/yms/app/ytb/YtbInvalidNodeSkipTest.java
@@ -0,0 +1,104 @@
+/*
+ * 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.ytb;
+
+import org.junit.Test;
+import org.onosproject.yang.gen.v1.yms.test.ytb.simple.rpc.response.rev20160826.YtbSimpleRpcResponse;
+import org.onosproject.yang.gen.v1.yms.test.ytb.simple.rpc.response.rev20160826.YtbSimpleRpcResponseOpParam;
+import org.onosproject.yang.gen.v1.yms.test.ytb.simple.rpc.response.rev20160826.ytbsimplerpcresponse.Cumulative;
+import org.onosproject.yang.gen.v1.yms.test.ytb.simple.rpc.response.rev20160826.ytbsimplerpcresponse.DefaultCumulative;
+import org.onosproject.yms.app.ydt.YdtExtendedBuilder;
+import org.onosproject.yms.app.ysr.DefaultYangSchemaRegistry;
+import org.onosproject.yms.ydt.YdtContext;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.Is.is;
+import static org.onosproject.yms.ydt.YmsOperationType.EDIT_CONFIG_REQUEST;
+
+/**
+ * Unit test cases for invalid node skip in YANG tree builder.
+ */
+public class YtbInvalidNodeSkipTest extends YtbErrMsgAndConstants {
+
+    private static final String CUMULATIVE = "cumulative";
+    private static final String SUM = "sum";
+    private static final String FIVE = "5";
+    private static final String TEN = "10";
+
+    /**
+     * Processes RPC node which is the sibling to the empty current node.
+     */
+    @Test
+    public void processRpcSiblingWhenNodeIsEmpty() {
+
+        schemaProvider.processSchemaRegistry(null);
+        DefaultYangSchemaRegistry registry = schemaProvider
+                .getDefaultYangSchemaRegistry();
+
+        // As an application, creates the object.
+        Cumulative cumulative1 = new DefaultCumulative.CumulativeBuilder()
+                .sum((byte) 5).build();
+        Cumulative cumulative2 = new DefaultCumulative.CumulativeBuilder()
+                .sum((byte) 10).build();
+        List<Cumulative> list = new ArrayList<>();
+        list.add(cumulative1);
+        list.add(cumulative2);
+        YtbSimpleRpcResponse rpc = new YtbSimpleRpcResponseOpParam
+                .YtbSimpleRpcResponseBuilder().cumulative(list).build();
+
+        // As YSB or YAB protocol sets the value for YTB.
+        List<Object> objectList = new ArrayList<>();
+        objectList.add(rpc);
+
+        // Builds YANG tree in YTB.
+        DefaultYangTreeBuilder treeBuilder = new DefaultYangTreeBuilder();
+        YdtExtendedBuilder ydtBuilder = treeBuilder.getYdtBuilderForYo(
+                objectList, ROOT_NAME, ROOT_NAME_SPACE,
+                EDIT_CONFIG_REQUEST, registry);
+
+        // Receives YDT context and checks the tree that is built.
+        YdtContext context = ydtBuilder.getRootNode();
+
+        // Gets the first module from logical root node.
+        YdtContext module = context.getFirstChild();
+        assertThat(getInCrtName(MODULE, RPC_NAME), module.getName(),
+                   is(RPC_NAME));
+
+        // Gets the first list content of cumulative.
+        YdtContext list1 = module.getFirstChild();
+        assertThat(getInCrtName(LIST, CUMULATIVE), list1.getName(),
+                   is(CUMULATIVE));
+
+        YdtContext sum1 = list1.getFirstChild();
+        assertThat(getInCrtName(LEAF, SUM), sum1.getName(), is(SUM));
+        assertThat(getInCrtLeafValue(SUM, FIVE), sum1.getValue(), is(FIVE));
+
+        // Gets the second list content of cumulative.
+        YdtContext list2 = list1.getNextSibling();
+        assertThat(getInCrtName(LIST, CUMULATIVE), list2.getName(),
+                   is(CUMULATIVE));
+
+        YdtContext sum2 = list2.getFirstChild();
+        assertThat(getInCrtName(LEAF, SUM), sum2.getName(), is(SUM));
+        assertThat(getInCrtLeafValue(SUM, TEN), sum2.getValue(), is(TEN));
+    }
+
+
+}
diff --git a/apps/yms/app/src/test/resources/ytbTestYangFiles/YtbAugmentForRpcInput.yang b/apps/yms/app/src/test/resources/ytbTestYangFiles/YtbAugmentForRpcInput.yang
new file mode 100644
index 0000000..2e8d1b3
--- /dev/null
+++ b/apps/yms/app/src/test/resources/ytbTestYangFiles/YtbAugmentForRpcInput.yang
@@ -0,0 +1,20 @@
+module YtbAugmentForRpcInput {
+    yang-version 1;
+    namespace "yms:test:ytb:augment:for:rpc:input";
+    prefix "sch";
+    import YtbRpcResponseWithAdvancedInputAndOutput {
+        prefix rpc;
+    }
+    revision "2016-08-26";
+
+    augment "/rpc:activate-software-image/rpc:output/" {
+        choice selection {
+            list value-in {
+                key "kinetic";
+                leaf kinetic {
+                    type "string";
+                }
+            }
+        }
+    }
+}
\ No newline at end of file
diff --git a/apps/yms/app/src/test/resources/ytbTestYangFiles/YtbAugmentForRpcInput2.yang b/apps/yms/app/src/test/resources/ytbTestYangFiles/YtbAugmentForRpcInput2.yang
new file mode 100644
index 0000000..af59b47
--- /dev/null
+++ b/apps/yms/app/src/test/resources/ytbTestYangFiles/YtbAugmentForRpcInput2.yang
@@ -0,0 +1,17 @@
+module YtbAugmentForRpcInput2 {
+    yang-version 1;
+    namespace "yms:test:ytb:augment:for:rpc:input";
+    prefix "sch";
+    import YtbRpcResponseWithAdvancedInputAndOutput {
+        prefix input;
+    }
+    revision "2016-08-26";
+    augment "/input:activate-software-image/input:output/" {
+        list friction {
+            key "speed";
+            leaf speed {
+                type uint64;
+            }
+        }
+    }
+}
\ No newline at end of file
diff --git a/apps/yms/app/src/test/resources/ytbTestYangFiles/YtbAugmentFromAnotherFile.yang b/apps/yms/app/src/test/resources/ytbTestYangFiles/YtbAugmentFromAnotherFile.yang
new file mode 100644
index 0000000..8c183c45
--- /dev/null
+++ b/apps/yms/app/src/test/resources/ytbTestYangFiles/YtbAugmentFromAnotherFile.yang
@@ -0,0 +1,41 @@
+module YtbAugmentFromAnotherFile {
+    yang-version 1;
+    namespace "yms:test:ytb:augment:from:another:file";
+    prefix "sch";
+    import yms-ietf-network {
+        prefix nd;
+    }
+    revision "2016-08-26";
+
+    augment "/nd:networks/nd:network/nd:node" {
+        list termination-point {
+            key "tp-id";
+            leaf tp-id {
+                type string;
+            }
+            list supporting-termination-point {
+                key "network-ref node-ref tp-ref";
+                leaf network-ref {
+                    type leafref {
+                        path "../../../nd:supporting-node/nd:network-ref";
+                        require-instance false;
+                    }
+                }
+                leaf node-ref {
+                    type leafref {
+                        path "../../../nd:supporting-node/nd:node-ref";
+                        require-instance false;
+                    }
+                }
+                leaf tp-ref {
+                    type leafref {
+                        path "/nd:networks/nd:network[nd:network-id=current()/"+
+                            "../network-ref]/nd:node[nd:node-id=current()/../"+
+                            "node-ref]/termination-point/tp-id";
+                        require-instance false;
+                    }
+                }
+            }
+        }
+    }
+}
\ No newline at end of file
diff --git a/apps/yms/app/src/test/resources/ytbTestYangFiles/YtbChoiceWithContainerAndLeafList.yang b/apps/yms/app/src/test/resources/ytbTestYangFiles/YtbChoiceWithContainerAndLeafList.yang
new file mode 100644
index 0000000..9ae462e
--- /dev/null
+++ b/apps/yms/app/src/test/resources/ytbTestYangFiles/YtbChoiceWithContainerAndLeafList.yang
@@ -0,0 +1,76 @@
+module YtbChoiceWithContainerAndLeafList {
+    yang-version 1;
+    namespace "yms:test:ytb:choice:with:container:and:leaf:list";
+    prefix "sch";
+    revision "2016-08-26";
+    leaf refer {
+        type binary;
+    }
+    rpc invalid1 {
+        input {
+            leaf value {
+                type string;
+            }
+        }
+        output {
+            leaf value {
+                type string;
+            }
+        }
+    }
+    choice content-test {
+        leaf-list list-items {
+            type leafref {
+                path "/refer";
+            }
+        }
+        container choice-container {
+            list predict {
+                config "false";
+                container reproduce {
+                    leaf catch {
+                        type int16;
+                    }
+                }
+            }
+        }
+        case valid {
+            list validlistincase {
+                config "false";
+                leaf validity {
+                    type int32;
+                }
+            }
+        }
+        case invalid {
+            leaf create-invalid {
+                type uint16;
+            }
+        }
+    }
+    notification invalid {
+        leaf value {
+            type string;
+        }
+    }
+    notification invalid2 {
+        list node {
+            config false;
+            leaf value {
+                type string;
+            }
+        }
+    }
+    choice current-value {
+        case ytb-present {
+            leaf-list represent {
+                type uint32;
+            }
+        }
+        case ytb-absent {
+            leaf-list final {
+                type instance-identifier;
+            }
+        }
+    }
+}
diff --git a/apps/yms/app/src/test/resources/ytbTestYangFiles/YtbDerivedTypeWithBitsAndBinary.yang b/apps/yms/app/src/test/resources/ytbTestYangFiles/YtbDerivedTypeWithBitsAndBinary.yang
new file mode 100644
index 0000000..1ca30a4
--- /dev/null
+++ b/apps/yms/app/src/test/resources/ytbTestYangFiles/YtbDerivedTypeWithBitsAndBinary.yang
@@ -0,0 +1,56 @@
+module YtbDerivedTypeWithBitsAndBinary {
+    yang-version 1;
+    namespace "yms:test:ytb:derived:type:with:bits:and:binary";
+    prefix "sch";
+    revision "2016-08-26";
+
+    typedef derivedbinarya {
+        type derivedbinaryb;
+    }
+
+    typedef derivedbinaryb {
+        type binary;
+    }
+
+    typedef derivedbitsa {
+        type derivedbitsb;
+    }
+
+    typedef derivedbitsb {
+        type bits {
+            bit index {
+                position 1;
+            }
+            bit name {
+                position 10;
+            }
+            bit signature {
+                position 100;
+            }
+        }
+    }
+
+    leaf forbinary {
+        type derivedbinarya;
+    }
+
+    leaf forbits {
+        type derivedbitsa;
+    }
+
+    leaf-list forbinarylist {
+        type derivedbinarya;
+    }
+
+    leaf-list forbitslist {
+        type derivedbitsa;
+    }
+
+    leaf forunion {
+        type union {
+            type binary;
+            type int8;
+        }
+    }
+}
+
diff --git a/apps/yms/app/src/test/resources/ytbTestYangFiles/YtbIetfSchedule.yang b/apps/yms/app/src/test/resources/ytbTestYangFiles/YtbIetfSchedule.yang
new file mode 100644
index 0000000..84c908b
--- /dev/null
+++ b/apps/yms/app/src/test/resources/ytbTestYangFiles/YtbIetfSchedule.yang
@@ -0,0 +1,29 @@
+module YtbIetfSchedule {
+    yang-version 1;
+    namespace "yms:test:ytb:module:with:leaf:ietfschedule";
+    prefix "sch";
+    revision "2016-08-26";
+        leaf time {
+            type int8;
+        }
+        leaf enum1 {
+        type enumeration {
+                      enum ten { value "10";}
+                      enum hundred { value "100";}
+                      enum thousand { value "1000"; }
+                    }
+        }
+        leaf-list enum2 {
+        type enumeration {
+                      enum ten-10 { value "10";}
+                      enum hundred-100 { value "100";}
+                      enum thousand-1000 { value "1000"; }
+                    }
+        }
+    container monitor {
+        leaf check {
+            type uint8;
+        }
+    }
+}
+
diff --git a/apps/yms/app/src/test/resources/ytbTestYangFiles/YtbModuleWithContainer.yang b/apps/yms/app/src/test/resources/ytbTestYangFiles/YtbModuleWithContainer.yang
new file mode 100644
index 0000000..b0d19b8
--- /dev/null
+++ b/apps/yms/app/src/test/resources/ytbTestYangFiles/YtbModuleWithContainer.yang
@@ -0,0 +1,13 @@
+module YtbModuleWithContainer {
+    yang-version 1;
+    namespace "yms:test:ytb:module:with:container";
+    prefix "sch";
+    revision "2016-08-26";
+    container sched {
+        leaf predict {
+            type decimal64 {
+            fraction-digits 2;
+            }
+        }
+    }
+}
diff --git a/apps/yms/app/src/test/resources/ytbTestYangFiles/YtbModuleWithLeafList.yang b/apps/yms/app/src/test/resources/ytbTestYangFiles/YtbModuleWithLeafList.yang
new file mode 100644
index 0000000..3d02384
--- /dev/null
+++ b/apps/yms/app/src/test/resources/ytbTestYangFiles/YtbModuleWithLeafList.yang
@@ -0,0 +1,9 @@
+module YtbModuleWithLeafList {
+    yang-version 1;
+    namespace "yms:test:ytb:module:with:leaflist";
+    prefix "sch";
+    revision "2016-08-26";
+    leaf-list time {
+        type int64;
+    }
+}
diff --git a/apps/yms/app/src/test/resources/ytbTestYangFiles/YtbModuleWithList.yang b/apps/yms/app/src/test/resources/ytbTestYangFiles/YtbModuleWithList.yang
new file mode 100644
index 0000000..297a8f4
--- /dev/null
+++ b/apps/yms/app/src/test/resources/ytbTestYangFiles/YtbModuleWithList.yang
@@ -0,0 +1,15 @@
+module YtbModuleWithList {
+    yang-version 1;
+    namespace "yms:test:ytb:module:with:list";
+    prefix "sch";
+    revision "2016-08-26";
+    list ytblistlist {
+        config false;
+        leaf-list prediction {
+            type find;
+        }
+    }
+    typedef find {
+        type boolean;
+    }
+}
diff --git a/apps/yms/app/src/test/resources/ytbTestYangFiles/YtbMultiModulea.yang b/apps/yms/app/src/test/resources/ytbTestYangFiles/YtbMultiModulea.yang
new file mode 100644
index 0000000..523f400
--- /dev/null
+++ b/apps/yms/app/src/test/resources/ytbTestYangFiles/YtbMultiModulea.yang
@@ -0,0 +1,12 @@
+module YtbMultiModulea {
+    yang-version 1;
+    namespace "yms:test:ytb:multi:module:a";
+    prefix "sch";
+    revision "2016-08-26";
+    list ytbmultilist {
+        config false;
+        leaf-list check {
+            type uint64;
+        }
+    }
+}
diff --git a/apps/yms/app/src/test/resources/ytbTestYangFiles/YtbMultiModuleb.yang b/apps/yms/app/src/test/resources/ytbTestYangFiles/YtbMultiModuleb.yang
new file mode 100644
index 0000000..7c2c257
--- /dev/null
+++ b/apps/yms/app/src/test/resources/ytbTestYangFiles/YtbMultiModuleb.yang
@@ -0,0 +1,12 @@
+module YtbMultiModuleb {
+    yang-version 1;
+    namespace "yms:test:ytb:multi:module:b";
+    prefix "sch";
+    revision "2016-08-26";
+    list ytbmultilistb {
+        config false;
+        leaf-list checkin {
+            type string;
+        }
+    }
+}
diff --git a/apps/yms/app/src/test/resources/ytbTestYangFiles/YtbMultiNotificationWithContainer.yang b/apps/yms/app/src/test/resources/ytbTestYangFiles/YtbMultiNotificationWithContainer.yang
new file mode 100644
index 0000000..9a66110
--- /dev/null
+++ b/apps/yms/app/src/test/resources/ytbTestYangFiles/YtbMultiNotificationWithContainer.yang
@@ -0,0 +1,31 @@
+module YtbMultiNotificationWithContainer {
+    yang-version 1;
+    namespace "yms:test:ytb:multi:notification:with:container";
+    prefix "sch";
+    revision "2016-08-26";
+    notification fortesta {
+        container ytbnot {
+            leaf notileaf {
+                type bits {
+                    bit leaf1 {
+                        position 0;
+                    }
+                    bit leaf2 {
+                        position 1;
+                    }
+                }
+            }
+        }
+    }
+    list cumulative {
+        key "sum";
+        leaf sum {
+            type int8;
+        }
+    }
+    notification fortestb {
+        leaf-list notileaflist {
+            type empty;
+        }
+    }
+}
diff --git a/apps/yms/app/src/test/resources/ytbTestYangFiles/YtbRpcResponseWithAdvancedInputAndOutput.yang b/apps/yms/app/src/test/resources/ytbTestYangFiles/YtbRpcResponseWithAdvancedInputAndOutput.yang
new file mode 100644
index 0000000..c9f708e
--- /dev/null
+++ b/apps/yms/app/src/test/resources/ytbTestYangFiles/YtbRpcResponseWithAdvancedInputAndOutput.yang
@@ -0,0 +1,39 @@
+module YtbRpcResponseWithAdvancedInputAndOutput {
+    yang-version 1;
+    namespace "yms:test:ytb:rpc:response:with:advanced:input:and:output";
+    prefix "sch";
+    revision "2016-08-26";
+    leaf refer {
+        type binary;
+    }
+    rpc activate-software-image {
+        input {
+            container final {
+                leaf-list value {
+                    type uint16;
+                }
+            }
+        }
+        output {
+            list output-list {
+                key "list-key";
+                leaf list-key {
+                    type leafref {
+                        path "/refer";
+                    }
+                }
+                container content_inside {
+                    leaf-list available {
+                        type int16;
+                    }
+                }
+            }
+        }
+    }
+    list cumulative {
+        key "sum";
+        leaf sum {
+            type int8;
+        }
+    }
+}
\ No newline at end of file
diff --git a/apps/yms/app/src/test/resources/ytbTestYangFiles/YtbSimpleAugment.yang b/apps/yms/app/src/test/resources/ytbTestYangFiles/YtbSimpleAugment.yang
new file mode 100644
index 0000000..919d5ed
--- /dev/null
+++ b/apps/yms/app/src/test/resources/ytbTestYangFiles/YtbSimpleAugment.yang
@@ -0,0 +1,26 @@
+module YtbSimpleAugment {
+    yang-version 1;
+    namespace "yms:test:ytb:simple:augment";
+    prefix "sch";
+    revision "2016-08-26";
+    container cont1 {
+        container cont2 {
+            leaf fine {
+                type string;
+            }
+        }
+     }
+
+    augment /cont1/cont2 {
+        leaf leaf4 {
+            type int32;
+        }
+        container cont1s {
+            container cont1s {
+                leaf fine {
+                    type string;
+                }
+            }
+        }
+    }
+}
diff --git a/apps/yms/app/src/test/resources/ytbTestYangFiles/YtbSimpleChoiceCase.yang b/apps/yms/app/src/test/resources/ytbTestYangFiles/YtbSimpleChoiceCase.yang
new file mode 100644
index 0000000..818d04e
--- /dev/null
+++ b/apps/yms/app/src/test/resources/ytbTestYangFiles/YtbSimpleChoiceCase.yang
@@ -0,0 +1,23 @@
+module YtbSimpleChoiceCase {
+    yang-version 1;
+    namespace "yms:test:ytb:simple:choice:case";
+    prefix "sch";
+    revision "2016-08-26";
+    container YtbFood {
+       choice YtbSnack {
+           case ytb-sports-arena {
+               leaf pretzel {
+                   type string;
+               }
+               leaf beer {
+                   type string;
+               }
+           }
+           case ytb-late-night {
+               leaf chocolate {
+                   type string;
+               }
+           }
+       }
+    }
+}
diff --git a/apps/yms/app/src/test/resources/ytbTestYangFiles/YtbSimpleRpcResponse.yang b/apps/yms/app/src/test/resources/ytbTestYangFiles/YtbSimpleRpcResponse.yang
new file mode 100644
index 0000000..7aaa50f
--- /dev/null
+++ b/apps/yms/app/src/test/resources/ytbTestYangFiles/YtbSimpleRpcResponse.yang
@@ -0,0 +1,26 @@
+module YtbSimpleRpcResponse {
+    yang-version 1;
+    namespace "yms:test:ytb:simple:rpc:response";
+    prefix "sch";
+    revision "2016-08-26";
+    container ytb-rpc-cont {
+        leaf vary {
+            type uint8;
+        }
+    }
+    rpc rpc {
+        input {
+        }
+        output {
+            leaf output-leaf {
+                type uint32;
+            }
+        }
+    }
+    list cumulative {
+        key "sum";
+        leaf sum {
+            type int8;
+        }
+    }
+}
diff --git a/apps/yms/app/src/test/resources/ytbTestYangFiles/YtbTreeBuilderForListHavingList.yang b/apps/yms/app/src/test/resources/ytbTestYangFiles/YtbTreeBuilderForListHavingList.yang
new file mode 100644
index 0000000..bd58e30
--- /dev/null
+++ b/apps/yms/app/src/test/resources/ytbTestYangFiles/YtbTreeBuilderForListHavingList.yang
@@ -0,0 +1,26 @@
+module YtbTreeBuilderForListHavingList {
+    yang-version 1;
+    namespace "yms:test:ytb:tree:builder:for:list:having:list";
+    prefix "sch";
+    revision "2016-08-26";
+    container carrier {
+        list multiplexes {
+            key "types";
+            list application-areas {
+                config false;
+                leaf-list destination-areas {
+                    type binary;
+                }
+            }
+            leaf types {
+                type enumeration {
+                    enum space-division;
+                    enum frequency-division;
+                    enum time-division {
+                        value 3;
+                    }
+                }
+            }
+        }
+    }
+}