YMS migration to onos-yangtool 1.10

Change-Id: I22ddf23f813840e0afec1e7713a86891f2a52f28
diff --git a/apps/yms/app/src/main/java/org/onosproject/yms/app/ych/DefaultYangCodecHandler.java b/apps/yms/app/src/main/java/org/onosproject/yms/app/ych/DefaultYangCodecHandler.java
index 45eb37f..8847c41 100644
--- a/apps/yms/app/src/main/java/org/onosproject/yms/app/ych/DefaultYangCodecHandler.java
+++ b/apps/yms/app/src/main/java/org/onosproject/yms/app/ych/DefaultYangCodecHandler.java
@@ -30,14 +30,13 @@
 import org.onosproject.yms.ydt.YdtBuilder;
 import org.onosproject.yms.ydt.YdtContext;
 import org.onosproject.yms.ydt.YmsOperationType;
+import org.onosproject.yms.ysr.YangModuleLibrary;
 
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
-import static org.onosproject.yms.app.ych.defaultcodecs.utils.DefaultCodecUtils.isNonEmpty;
-
 
 /**
  * Represents implementation of YANG SBI broker interfaces.
@@ -54,6 +53,7 @@
      * Schema registry for driver.
      */
     private final YangSchemaRegistry schemaRegistry;
+    private YangModuleLibrary library;
 
     /**
      * Default codecs.
@@ -90,8 +90,9 @@
             YangProtocolEncodingFormat dataFormat) {
         YangDataTreeCodec codec = defaultCodecs.get(dataFormat);
 
+        int size = overrideCodecs.size();
         // Check over ridden codec handler is exist or not.
-        if (overrideCodecs != null) {
+        if (size != 0) {
             YangDataTreeCodec overrideCodec = overrideCodecs.get(dataFormat);
             if (overrideCodec != null) {
                 codec = overrideCodec;
@@ -103,6 +104,7 @@
     @Override
     public void addDeviceSchema(Class<?> yangModule) {
         schemaRegistry.registerApplication(null, yangModule);
+        schemaRegistry.processModuleLibrary(yangModule.getName(), library);
     }
 
     @Override
@@ -166,7 +168,6 @@
                                            opType,
                                            schemaRegistry);
 
-
         // Get the composite response from codec handler.
         return codec.encodeYdtToCompositeProtocolFormat(extBuilder);
     }
@@ -176,15 +177,20 @@
                                YangProtocolEncodingFormat dataFormat,
                                YmsOperationType opType) {
 
+        YdtBuilder ydtBuilder;
         YangDataTreeCodec codec = getAppropriateCodec(dataFormat);
         if (codec == null) {
             throw new YchException(E_DATA_TREE_CODEC);
         }
 
-        // Get the YANG data tree
-        YdtBuilder ydtBuilder = codec.decodeProtocolDataToYdt(inputString,
-                                                              schemaRegistry,
-                                                              opType);
+        try {
+            // Get the YANG data tree
+            ydtBuilder = codec.decodeProtocolDataToYdt(inputString,
+                                                       schemaRegistry,
+                                                       opType);
+        } catch (Exception e) {
+            throw new YchException(e.getLocalizedMessage());
+        }
 
         if (ydtBuilder != null) {
             return getObjectList(ydtBuilder.getRootNode());
@@ -210,10 +216,7 @@
 
         // Get the module object by using YANG data tree
         if (ydtBuilder != null) {
-            List<Object> objectList = getObjectList(ydtBuilder.getRootNode());
-            if (isNonEmpty(objectList)) {
-                return objectList.get(0);
-            }
+            return getObjectList(ydtBuilder.getRootNode());
         }
 
         return null;
@@ -260,4 +263,22 @@
 
         return objectList;
     }
+
+    /**
+     * Returns module library for YSR.
+     *
+     * @return module library for YSR
+     */
+    public YangModuleLibrary getLibrary() {
+        return library;
+    }
+
+    /**
+     * Sets module library for YSR.
+     *
+     * @param library module library for YSR
+     */
+    public void setLibrary(YangModuleLibrary library) {
+        this.library = library;
+    }
 }
diff --git a/apps/yms/app/src/main/java/org/onosproject/yms/app/ych/defaultcodecs/netconf/NetconfCodec.java b/apps/yms/app/src/main/java/org/onosproject/yms/app/ych/defaultcodecs/netconf/NetconfCodec.java
index 8b50d33..5e5d731 100644
--- a/apps/yms/app/src/main/java/org/onosproject/yms/app/ych/defaultcodecs/netconf/NetconfCodec.java
+++ b/apps/yms/app/src/main/java/org/onosproject/yms/app/ych/defaultcodecs/netconf/NetconfCodec.java
@@ -82,7 +82,6 @@
                 //TODO
             }
         }
-
     }
 
     /**
@@ -100,7 +99,9 @@
         try {
             validateOpType(elementName, opType);
             // If config tag name is found then set the root element node.
-            if (ALLOWABLE_NAMES.contains(elementName)) {
+            if (DATA.equals(elementName)
+                    || CONFIG.equals(elementName)
+                    || FILTER.equals(elementName)) {
                 return rootElement;
             }
 
@@ -113,7 +114,6 @@
                     retElement = getDataRootElement(childElement, opType);
                 }
             }
-
         } catch (Exception e) {
             // TODO
         }
diff --git a/apps/yms/app/src/main/java/org/onosproject/yms/app/ych/defaultcodecs/utils/DefaultCodecUtils.java b/apps/yms/app/src/main/java/org/onosproject/yms/app/ych/defaultcodecs/utils/DefaultCodecUtils.java
index 1d9e339..873d7bb 100644
--- a/apps/yms/app/src/main/java/org/onosproject/yms/app/ych/defaultcodecs/utils/DefaultCodecUtils.java
+++ b/apps/yms/app/src/main/java/org/onosproject/yms/app/ych/defaultcodecs/utils/DefaultCodecUtils.java
@@ -78,16 +78,6 @@
     }
 
     /**
-     * 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();
-    }
-
-    /**
      * Converts a list of path segments to a YDT builder tree.
      *
      * @param paths     the list of path segments split from URI
diff --git a/apps/yms/app/src/main/java/org/onosproject/yms/app/ych/defaultcodecs/xml/XmlCodecListener.java b/apps/yms/app/src/main/java/org/onosproject/yms/app/ych/defaultcodecs/xml/XmlCodecListener.java
index 6b6ba38..1c6536a 100644
--- a/apps/yms/app/src/main/java/org/onosproject/yms/app/ych/defaultcodecs/xml/XmlCodecListener.java
+++ b/apps/yms/app/src/main/java/org/onosproject/yms/app/ych/defaultcodecs/xml/XmlCodecListener.java
@@ -69,6 +69,10 @@
             nameSpace = element.getNamespace().getURI();
         }
 
+        if (nodeType == OBJECT_NODE && element.content() == null || element
+                .content().isEmpty()) {
+            nodeType = TEXT_NODE;
+        }
         if (nodeType == OBJECT_NODE) {
             if (ydtExtBuilder != null) {
                 ydtExtBuilder.addChild(element.getName(), nameSpace, opType);
diff --git a/apps/yms/app/src/main/java/org/onosproject/yms/app/ych/defaultcodecs/xml/XmlCodecSingleInstanceLeafHandler.java b/apps/yms/app/src/main/java/org/onosproject/yms/app/ych/defaultcodecs/xml/XmlCodecSingleInstanceLeafHandler.java
index f44f9b2..e7b786e 100644
--- a/apps/yms/app/src/main/java/org/onosproject/yms/app/ych/defaultcodecs/xml/XmlCodecSingleInstanceLeafHandler.java
+++ b/apps/yms/app/src/main/java/org/onosproject/yms/app/ych/defaultcodecs/xml/XmlCodecSingleInstanceLeafHandler.java
@@ -29,6 +29,9 @@
     @Override
     public void setXmlValue(YdtContext ydtContext,
                             Stack<Element> elementStack) {
-        elementStack.peek().setText(ydtContext.getValue());
+
+        if (ydtContext.getValue() != null) {
+            elementStack.peek().setText(ydtContext.getValue());
+        }
     }
 }
diff --git a/apps/yms/app/src/main/java/org/onosproject/yms/app/ydt/AppData.java b/apps/yms/app/src/main/java/org/onosproject/yms/app/ydt/AppData.java
index 8fee570..79d9581 100644
--- a/apps/yms/app/src/main/java/org/onosproject/yms/app/ydt/AppData.java
+++ b/apps/yms/app/src/main/java/org/onosproject/yms/app/ydt/AppData.java
@@ -17,9 +17,6 @@
 package org.onosproject.yms.app.ydt;
 
 import org.onosproject.yangutils.datamodel.YangSchemaNode;
-import org.onosproject.yms.ydt.YdtContext;
-
-import java.util.List;
 
 /**
  * Maintains application data, which will be used by Application broker to
@@ -28,48 +25,6 @@
 public interface AppData {
 
     /**
-     * Returns the list of nodes with operation type delete.
-     *
-     * @return list of nodes with operation type delete
-     */
-    List<YdtContext> getDeleteNodes();
-
-    /**
-     * Adds the ydt node with operation type delete in module delete node list.
-     *
-     * @param node ydt node with operation type delete/remove
-     */
-    void addDeleteNodes(YdtContext node);
-
-    /**
-     * Returns application's root ydtContext.
-     *
-     * @return YdtContext of application root node
-     */
-    YdtContext getModuleContext();
-
-    /**
-     * Sets the application's ydtContext.
-     *
-     * @param moduleNode application's ydtContext
-     */
-    void setModuleContext(YdtContext moduleNode);
-
-    /**
-     * Returns the YangSchemaNode of augmenting application.
-     *
-     * @return YangSchemaNode of augmenting application
-     */
-    YangSchemaNode getAugmentingSchemaNode();
-
-    /**
-     * Sets the YangSchemaNode of augmenting application root node.
-     *
-     * @param schemaNode YangSchemaNode of augmenting application module
-     */
-    void setAugmentingSchemaNode(YangSchemaNode schemaNode);
-
-    /**
      * Returns the schema node current context.
      *
      * @return schema node
diff --git a/apps/yms/app/src/main/java/org/onosproject/yms/app/ydt/AppNodeFactory.java b/apps/yms/app/src/main/java/org/onosproject/yms/app/ydt/AppNodeFactory.java
index 621eda6..98187aa 100644
--- a/apps/yms/app/src/main/java/org/onosproject/yms/app/ydt/AppNodeFactory.java
+++ b/apps/yms/app/src/main/java/org/onosproject/yms/app/ydt/AppNodeFactory.java
@@ -16,9 +16,6 @@
 
 package org.onosproject.yms.app.ydt;
 
-import static org.onosproject.yms.app.ydt.DefaultYdtAppContext.getAugmentAppContext;
-import static org.onosproject.yms.app.ydt.DefaultYdtAppContext.getModuleAppContext;
-
 /**
  * Represents an application tree node factory to create different types of
  * application tree node.
@@ -33,10 +30,11 @@
      * Returns the appropriate application context on the basis of provided
      * isAugmented flag for given request.
      *
-     * @param isAugmented true for augmented context; false for module context
+     * @param flag true for augmented context; false for module context
      * @return appContext application context
      */
-    public static DefaultYdtAppContext getAppContext(boolean isAugmented) {
-        return isAugmented ? getAugmentAppContext() : getModuleAppContext();
+    public static DefaultYdtAppContext getAppContext(boolean flag) {
+        return flag ? new DefaultYdtAppContext(new AugmentedSchemaData()) :
+                new DefaultYdtAppContext(new ModuleSchemaData());
     }
 }
diff --git a/apps/yms/app/src/main/java/org/onosproject/yms/app/ydt/AugmentAppData.java b/apps/yms/app/src/main/java/org/onosproject/yms/app/ydt/AugmentAppData.java
new file mode 100644
index 0000000..1a43cb7
--- /dev/null
+++ b/apps/yms/app/src/main/java/org/onosproject/yms/app/ydt/AugmentAppData.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yms.app.ydt;
+
+import org.onosproject.yangutils.datamodel.YangSchemaNode;
+
+/**
+ * Represents an augmented node in application tree.
+ */
+interface AugmentAppData extends AppData {
+
+    /**
+     * Returns the YangSchemaNode of augmenting application.
+     *
+     * @return YangSchemaNode of augmenting application
+     */
+    YangSchemaNode getAugmentingSchemaNode();
+
+    /**
+     * Sets the YangSchemaNode of augmenting application root node.
+     *
+     * @param schemaNode YangSchemaNode of augmenting application module
+     */
+    void setAugmentingSchemaNode(YangSchemaNode schemaNode);
+}
diff --git a/apps/yms/app/src/main/java/org/onosproject/yms/app/ydt/AugmentedSchemaData.java b/apps/yms/app/src/main/java/org/onosproject/yms/app/ydt/AugmentedSchemaData.java
index 6a45cad..dd4eabb 100644
--- a/apps/yms/app/src/main/java/org/onosproject/yms/app/ydt/AugmentedSchemaData.java
+++ b/apps/yms/app/src/main/java/org/onosproject/yms/app/ydt/AugmentedSchemaData.java
@@ -18,23 +18,12 @@
 
 import org.onosproject.yangutils.datamodel.YangNode;
 import org.onosproject.yangutils.datamodel.YangSchemaNode;
-import org.onosproject.yms.app.ydt.exceptions.YdtException;
-import org.onosproject.yms.ydt.YdtContext;
-
-import java.util.List;
 
 /**
  * Manages the application information required for schema nodes defined in
  * the module (sub-module).
  */
-public class AugmentedSchemaData implements AppData {
-
-    private static final String E_NOT_ROOTAPP =
-            "Augmented application depends on root app.";
-    private static final String E_NOT_EXIST =
-            "Augmented nodes are not part of the schema.";
-    private static final String E_NOT_MAINTAINED =
-            "Module context is not maintained.";
+public class AugmentedSchemaData implements AugmentAppData {
 
     /*
      * Reference for schema node of augmenting application.
@@ -42,25 +31,6 @@
     private YangSchemaNode augModSchema;
 
     @Override
-    public List<YdtContext> getDeleteNodes() {
-        throw new YdtException(E_NOT_ROOTAPP);
-    }
-
-    @Override
-    public void addDeleteNodes(YdtContext deletedNode) {
-    }
-
-    @Override
-    public YdtContext getModuleContext() {
-        throw new YdtException(E_NOT_EXIST);
-    }
-
-    @Override
-    public void setModuleContext(YdtContext moduleContext) {
-        throw new YdtException(E_NOT_MAINTAINED);
-    }
-
-    @Override
     public YangSchemaNode getAugmentingSchemaNode() {
         return augModSchema;
     }
diff --git a/apps/yms/app/src/main/java/org/onosproject/yms/app/ydt/DefaultYdtAppContext.java b/apps/yms/app/src/main/java/org/onosproject/yms/app/ydt/DefaultYdtAppContext.java
index f75fc9c..03502d4 100644
--- a/apps/yms/app/src/main/java/org/onosproject/yms/app/ydt/DefaultYdtAppContext.java
+++ b/apps/yms/app/src/main/java/org/onosproject/yms/app/ydt/DefaultYdtAppContext.java
@@ -16,26 +16,19 @@
 
 package org.onosproject.yms.app.ydt;
 
-import org.onosproject.yangutils.datamodel.YangAugment;
 import org.onosproject.yangutils.datamodel.YangSchemaNode;
-import org.onosproject.yangutils.datamodel.YangSchemaNodeContextInfo;
-import org.onosproject.yangutils.datamodel.YangSchemaNodeIdentifier;
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yms.app.ydt.exceptions.YdtException;
 import org.onosproject.yms.ydt.YdtContext;
 import org.onosproject.yms.ydt.YdtContextOperationType;
 
-import java.util.HashSet;
 import java.util.List;
-import java.util.Set;
 
 import static org.onosproject.yms.app.ydt.YdtAppNodeOperationType.BOTH;
-import static org.onosproject.yms.app.ydt.YdtNodeFactory.getAppOpTypeFromYdtOpType;
+import static org.onosproject.yms.app.ydt.YdtUtils.getAppOpTypeFromYdtOpType;
 
 /**
- * Represents YANG request work bench which contains all parameters for
- * request handling and methods to build and obtain YANG application data tree
- * which is data (sub)instance representation, abstract of protocol.
+ * Abstraction of an entity which represents YDT application context
+ * information. This context information will be used by protocol to obtain
+ * the information associated with YDT application tree node.
  */
 public final class DefaultYdtAppContext<T extends AppData>
         implements YdtAppContext {
@@ -68,35 +61,19 @@
     /*
      * YDT application tree extended information.
      */
-    private T appData;
+    private final T appData;
 
     /*
      * Reference for operation type for application root node.
      */
     private YdtAppNodeOperationType operationType;
 
-    /*
-     * Reference application node set.
-     */
-    private Set<YangSchemaNode> appSet;
-
     /**
      * Creates an instance of YANG application tree which is used by all node
      * needs delete list.
      */
-    private DefaultYdtAppContext() {
-        appSet = new HashSet<>();
-    }
-
-    /**
-     * Adds schema node of new requested augmented node in current context of
-     * application tree.
-     *
-     * @param schemaNode schema node of requested node
-     * @return addition result(true/false)
-     */
-    public boolean addSchemaToAppSet(YangSchemaNode schemaNode) {
-        return appSet.add(schemaNode);
+    DefaultYdtAppContext(T data) {
+        appData = data;
     }
 
     @Override
@@ -119,9 +96,9 @@
     @Override
     public void setAppData(YdtNode moduleNode, YangSchemaNode augmentNode) {
         if (augmentNode != null) {
-            appData.setAugmentingSchemaNode(augmentNode);
+            ((AugmentAppData) appData).setAugmentingSchemaNode(augmentNode);
         } else {
-            appData.setModuleContext(moduleNode);
+            ((ModuleAppData) appData).setModuleContext(moduleNode);
         }
     }
 
@@ -145,8 +122,12 @@
         return child;
     }
 
-    @Override
-    public void setChild(YdtAppContext child) {
+    /**
+     * Sets the context of first child.
+     *
+     * @param child node
+     */
+    private void setChild(YdtAppContext child) {
         this.child = child;
     }
 
@@ -156,8 +137,8 @@
     }
 
     @Override
-    public void setNextSibling(YdtAppContext nextSibling) {
-        this.nextSibling = nextSibling;
+    public void setNextSibling(YdtAppContext context) {
+        this.nextSibling = context;
     }
 
     @Override
@@ -166,8 +147,8 @@
     }
 
     @Override
-    public void setPreviousSibling(YdtAppContext previousSibling) {
-        this.previousSibling = previousSibling;
+    public void setPreviousSibling(YdtAppContext context) {
+        this.previousSibling = context;
     }
 
     @Override
@@ -182,61 +163,31 @@
 
     @Override
     public List<YdtContext> getDeleteNodes() {
-        return appData.getDeleteNodes();
+        return ((ModuleAppData) appData).getDeleteNodes();
     }
 
-
     @Override
     public void addDeleteNode(YdtNode node) {
         DefaultYdtAppContext<?> curNode = this;
         while (curNode.getParent().getParent() != null) {
             curNode = (DefaultYdtAppContext<?>) curNode.getParent();
         }
-
-        curNode.appData.addDeleteNodes(node);
+        ((ModuleAppData) curNode.appData).addDeleteNodes(node);
     }
 
     @Override
     public YdtContext getModuleContext() {
-        return appData.getModuleContext();
-    }
-
-    @Override
-    public void setModuleContext(YdtContext moduleNode) {
-        appData.setModuleContext(moduleNode);
+        return ((ModuleAppData) appData).getModuleContext();
     }
 
     @Override
     public YangSchemaNode getAugmentingSchemaNode() {
-        return appData.getAugmentingSchemaNode();
+        return ((AugmentAppData) appData).getAugmentingSchemaNode();
     }
 
     @Override
     public void setAugmentingSchemaNode(YangSchemaNode schemaNode) {
-        appData.setAugmentingSchemaNode(schemaNode);
-    }
-
-
-    @Override
-    public YangSchemaNode getAugmentingSchemaNode(
-            YangSchemaNodeIdentifier id,
-            YangSchemaNodeContextInfo contextInfo) {
-        YangSchemaNode lastAugMod = null;
-        YangSchemaNode switchedNode =
-                contextInfo.getContextSwitchedNode();
-
-        while (switchedNode != null) {
-            if (switchedNode instanceof YangAugment) {
-                lastAugMod = switchedNode;
-            }
-            try {
-                switchedNode = switchedNode.getChildSchema(id)
-                        .getContextSwitchedNode();
-            } catch (DataModelException e) {
-                throw new YdtException(e.getMessage());
-            }
-        }
-        return lastAugMod;
+        ((AugmentAppData) appData).setAugmentingSchemaNode(schemaNode);
     }
 
     @Override
@@ -244,9 +195,13 @@
         return lastChild;
     }
 
-    @Override
-    public void setLastChild(YdtAppContext lastChild) {
-        this.lastChild = lastChild;
+    /**
+     * Sets the context of last child.
+     *
+     * @param child node
+     */
+    private void setLastChild(YdtAppContext child) {
+        lastChild = child;
     }
 
     @Override
@@ -275,28 +230,4 @@
     public YangSchemaNode getYangSchemaNode() {
         return appData.getSchemaNode();
     }
-
-    /**
-     * Creates an instance of application tree context with module schema data.
-     *
-     * @return application tree context
-     */
-    public static DefaultYdtAppContext getModuleAppContext() {
-        DefaultYdtAppContext context =
-                new DefaultYdtAppContext<ModuleSchemaData>();
-        context.appData = new ModuleSchemaData();
-        return context;
-    }
-
-    /**
-     * Creates an instance of application tree context with augment schema data.
-     *
-     * @return application tree context
-     */
-    public static DefaultYdtAppContext getAugmentAppContext() {
-        DefaultYdtAppContext context =
-                new DefaultYdtAppContext<AugmentedSchemaData>();
-        context.appData = new AugmentedSchemaData();
-        return context;
-    }
 }
diff --git a/apps/yms/app/src/main/java/org/onosproject/yms/app/ydt/ModuleAppData.java b/apps/yms/app/src/main/java/org/onosproject/yms/app/ydt/ModuleAppData.java
new file mode 100644
index 0000000..5bafe24
--- /dev/null
+++ b/apps/yms/app/src/main/java/org/onosproject/yms/app/ydt/ModuleAppData.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.yms.app.ydt;
+
+import org.onosproject.yms.ydt.YdtContext;
+
+import java.util.List;
+
+/**
+ * Represents a module/sub-module node in application tree.
+ */
+interface ModuleAppData extends AppData {
+
+    /**
+     * Returns the list of nodes with operation type delete.
+     *
+     * @return list of nodes with operation type delete
+     */
+    List<YdtContext> getDeleteNodes();
+
+    /**
+     * Adds the ydt node with operation type delete in module delete node list.
+     *
+     * @param node ydt node with operation type delete/remove
+     */
+    void addDeleteNodes(YdtContext node);
+
+    /**
+     * Returns application's root ydtContext.
+     *
+     * @return YdtContext of application root node
+     */
+    YdtContext getModuleContext();
+
+    /**
+     * Sets the application's ydtContext.
+     *
+     * @param moduleNode application's ydtContext
+     */
+    void setModuleContext(YdtExtendedContext moduleNode);
+}
diff --git a/apps/yms/app/src/main/java/org/onosproject/yms/app/ydt/ModuleSchemaData.java b/apps/yms/app/src/main/java/org/onosproject/yms/app/ydt/ModuleSchemaData.java
index fd4f1b6..0823190 100644
--- a/apps/yms/app/src/main/java/org/onosproject/yms/app/ydt/ModuleSchemaData.java
+++ b/apps/yms/app/src/main/java/org/onosproject/yms/app/ydt/ModuleSchemaData.java
@@ -17,7 +17,6 @@
 package org.onosproject.yms.app.ydt;
 
 import org.onosproject.yangutils.datamodel.YangSchemaNode;
-import org.onosproject.yms.app.ydt.exceptions.YdtException;
 import org.onosproject.yms.ydt.YdtContext;
 
 import java.util.ArrayList;
@@ -27,20 +26,17 @@
  * Manages the application information required for schema nodes defined in
  * the module (sub-module).
  */
-public class ModuleSchemaData implements AppData {
-
-    private static final String E_NOT_MAINTAINED =
-            "Augmented info is not maintained.";
+public class ModuleSchemaData implements ModuleAppData {
 
     /*
      * Reference for application's root ydtContext.
      */
-    private YdtContext moduleContext;
+    private YdtExtendedContext moduleContext;
 
     /*
      * Reference for list of nodes with operation type delete.
      */
-    private List<YdtContext> deleteNodes = new ArrayList<>();
+    private final List<YdtContext> deleteNodes = new ArrayList<>();
 
     @Override
     public List<YdtContext> getDeleteNodes() {
@@ -59,27 +55,17 @@
     }
 
     @Override
-    public void setModuleContext(YdtContext moduleContext) {
+    public void setModuleContext(YdtExtendedContext moduleContext) {
         this.moduleContext = moduleContext;
     }
 
     @Override
-    public YangSchemaNode getAugmentingSchemaNode() {
-        throw new YdtException(E_NOT_MAINTAINED);
-    }
-
-    @Override
-    public void setAugmentingSchemaNode(YangSchemaNode schemaNode) {
-        throw new YdtException(E_NOT_MAINTAINED);
-    }
-
-    @Override
     public YangSchemaNode getSchemaNode() {
-        return ((YdtExtendedContext) moduleContext).getYangSchemaNode();
+        return moduleContext.getYangSchemaNode();
     }
 
     @Override
     public YangSchemaNode getRootSchemaNode() {
-        return getSchemaNode();
+        return moduleContext.getYangSchemaNode();
     }
 }
diff --git a/apps/yms/app/src/main/java/org/onosproject/yms/app/ydt/NameSpace.java b/apps/yms/app/src/main/java/org/onosproject/yms/app/ydt/NameSpace.java
new file mode 100644
index 0000000..b446457
--- /dev/null
+++ b/apps/yms/app/src/main/java/org/onosproject/yms/app/ydt/NameSpace.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yms.app.ydt;
+
+import org.onosproject.yangutils.datamodel.YangNamespace;
+
+class NameSpace implements YangNamespace {
+
+    /*
+     * Reference for namespace.
+     */
+    private final String nameSpace;
+
+    /**
+     * Creates an instance of namespace which is used to initialize the
+     * nameSpace for requested YDT node.
+     *
+     * @param nameSpace namespace of the requested node
+     */
+    public NameSpace(String nameSpace) {
+        this.nameSpace = nameSpace;
+    }
+
+    @Override
+    public String getModuleNamespace() {
+        return nameSpace;
+    }
+
+    @Override
+    public String getModuleName() {
+        return nameSpace;
+    }
+}
diff --git a/apps/yms/app/src/main/java/org/onosproject/yms/app/ydt/RequestedCallType.java b/apps/yms/app/src/main/java/org/onosproject/yms/app/ydt/RequestedCallType.java
index ace971b..4c1a16c 100644
--- a/apps/yms/app/src/main/java/org/onosproject/yms/app/ydt/RequestedCallType.java
+++ b/apps/yms/app/src/main/java/org/onosproject/yms/app/ydt/RequestedCallType.java
@@ -27,9 +27,9 @@
     LEAF,
 
     /**
-     * Requested Node is of type single/multi instance node.
+     * Requested Node is of type single/multi instance non leaf node.
      */
-    OTHER,
+    NON_LEAF,
 
     /**
      * Requested Node is of type multi instance leaf/node.
diff --git a/apps/yms/app/src/main/java/org/onosproject/yms/app/ydt/YangRequestWorkBench.java b/apps/yms/app/src/main/java/org/onosproject/yms/app/ydt/YangRequestWorkBench.java
index 625f1ed..dc36028 100644
--- a/apps/yms/app/src/main/java/org/onosproject/yms/app/ydt/YangRequestWorkBench.java
+++ b/apps/yms/app/src/main/java/org/onosproject/yms/app/ydt/YangRequestWorkBench.java
@@ -17,34 +17,42 @@
 package org.onosproject.yms.app.ydt;
 
 import com.google.common.collect.ImmutableMap;
+import org.onosproject.yangutils.datamodel.YangAugment;
+import org.onosproject.yangutils.datamodel.YangLeaf;
 import org.onosproject.yangutils.datamodel.YangList;
 import org.onosproject.yangutils.datamodel.YangSchemaNode;
 import org.onosproject.yangutils.datamodel.YangSchemaNodeContextInfo;
 import org.onosproject.yangutils.datamodel.YangSchemaNodeIdentifier;
+import org.onosproject.yms.app.ydt.exceptions.YdtException;
 import org.onosproject.yms.app.ysr.YangSchemaRegistry;
 import org.onosproject.yms.ydt.YdtContext;
 import org.onosproject.yms.ydt.YdtContextOperationType;
 import org.onosproject.yms.ydt.YdtType;
 import org.onosproject.yms.ydt.YmsOperationType;
 
+import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
-import static org.onosproject.yangutils.datamodel.YangSchemaNodeType.YANG_MULTI_INSTANCE_LEAF_NODE;
 import static org.onosproject.yms.app.ydt.AppNodeFactory.getAppContext;
 import static org.onosproject.yms.app.ydt.RequestedCallType.LEAF;
-import static org.onosproject.yms.app.ydt.RequestedCallType.OTHER;
+import static org.onosproject.yms.app.ydt.RequestedCallType.NON_LEAF;
 import static org.onosproject.yms.app.ydt.RequestedCardinality.MULTI_INSTANCE;
 import static org.onosproject.yms.app.ydt.RequestedCardinality.MULTI_INSTANCE_LEAF;
 import static org.onosproject.yms.app.ydt.RequestedCardinality.SINGLE_INSTANCE;
 import static org.onosproject.yms.app.ydt.RequestedCardinality.UNKNOWN;
 import static org.onosproject.yms.app.ydt.YdtConstants.errorMsg;
-import static org.onosproject.yms.app.ydt.YdtNodeFactory.getAppOpTypeFromYdtOpType;
-import static org.onosproject.yms.ydt.YdtContextOperationType.CREATE;
+import static org.onosproject.yms.app.ydt.YdtNodeFactory.getNode;
+import static org.onosproject.yms.app.ydt.YdtNodeFactory.getYangSchemaNodeTypeSpecificContext;
+import static org.onosproject.yms.app.ydt.YdtUtils.checkElementCount;
+import static org.onosproject.yms.app.ydt.YdtUtils.freeRestResources;
+import static org.onosproject.yms.app.ydt.YdtUtils.getAppOpTypeFromYdtOpType;
+import static org.onosproject.yms.app.ydt.YdtUtils.getAugmentingSchemaNode;
+import static org.onosproject.yms.app.ydt.YdtUtils.getNodeIdentifier;
+import static org.onosproject.yms.app.ydt.YdtUtils.getValidOpType;
 import static org.onosproject.yms.ydt.YdtContextOperationType.DELETE;
-import static org.onosproject.yms.ydt.YdtContextOperationType.MERGE;
 import static org.onosproject.yms.ydt.YdtContextOperationType.REMOVE;
 import static org.onosproject.yms.ydt.YdtType.MULTI_INSTANCE_LEAF_VALUE_NODE;
 import static org.onosproject.yms.ydt.YdtType.MULTI_INSTANCE_NODE;
@@ -56,45 +64,34 @@
  */
 public class YangRequestWorkBench implements YdtExtendedBuilder {
 
-    // ydt formatted error string
+    // Ydt formatted error string
     private static final String FMT_NOT_EXIST =
             "Application with name \"%s\" doesn't exist.";
-    private static final String E_USE_ADDLEAF =
-            "Requested Node should be created using addLeaf interface";
-    private static final String E_MULTI_INS =
-            "Adds an instance of type list or leaf-list node only";
-    private static final String E_CREATE =
-            "Create request is not allowed under delete operation";
-    private static final String E_DEL =
-            "Delete request is not allowed under create operation";
+
+    // Ydt error strings.
+    private static final String E_USE_ADD_LEAF =
+            "Requested Node should be created using addLeaf interface.";
+
     private static final String E_INVOKE_PARENT =
-            "Can't invoke get parent at logical root node";
-    private static final String FMT_TOO_FEW =
-            "Too few key parameters in %s. Expected %d; actual %d.";
-    private static final String FMT_TOO_MANY =
-            "Too many key parameters in %s. Expected %d; actual %d.";
+            "Can't invoke get parent at logical root node.";
 
     /*
-     * Current node in YANG data tree, kept to maintain the
-     * current context in YDT.
+     * Reference for the current context node in YANG data tree.
      */
     private YdtNode curNode;
 
     /*
-     * Root node in YANG data tree, kept to maintain the root context in
-     * YDT.
+     * Reference for the logical root node in YANG data tree.
      */
     private YdtNode rootNode;
 
     /*
-     * Current node in YANG data tree, kept to maintain the current context
-     * in ydt application tree.
+     * Reference for the current context in ydt application tree.
      */
     private YdtAppContext appCurNode;
 
     /*
-     * Root node in YANG data tree, kept to maintain the root context in ydt
-     * application tree.
+     * Reference for the logical root node context in ydt application tree.
      */
     private YdtAppContext appRootNode;
 
@@ -129,6 +126,13 @@
     // TODO validate need to be handle later with interaction type basis in
     // future when it will be supported
 
+    /*
+     * Reference for application tree node set.
+     * This set contains the method name's generated for an augmented
+     * target node to avoid the duplicate entries in YDT application tree for
+     * multiple augmented nodes under a single XPATH.
+     */
+    private Set<String> augGenMethodSet;
 
     /**
      * Creates an instance of YANG request work bench which is use to initialize
@@ -139,47 +143,27 @@
      * @param namespace  namespace of logical container
      * @param opType     type of operation done by using YANG
      *                   interface
-     * @param registry   Yang schema registry
+     * @param reg        Yang schema registry
      * @param isValidate Flag to identify data validation need to be
      *                   done by YDT or not
      */
     public YangRequestWorkBench(String name, String namespace,
                                 YmsOperationType opType,
-                                YangSchemaRegistry registry,
+                                YangSchemaRegistry reg,
                                 boolean isValidate) {
-        YdtNode newNode;
-        YangSchemaNodeIdentifier nodeIdentifier =
-                new YangSchemaNodeIdentifier();
-        nodeIdentifier.setName(name);
-        nodeIdentifier.setNameSpace(namespace);
-        newNode = new YdtSingleInstanceNode(nodeIdentifier);
-        setRootNode(newNode);
-        this.registry = registry;
+
+        setRootNode(new YdtLogicalNode(name, namespace));
+        registry = reg;
         ymsOperationType = opType;
         validate = isValidate;
-        // Set the logical root node for yang data app tree.
-        DefaultYdtAppContext appNode = getAppContext(true);
 
-        setAppRootNode(appNode);
+        setAppRootNode(getAppContext(true));
     }
 
     /**
-     * Creates an instance of YANG request work bench which is used to build YDT
-     * tree in YAB.
+     * Sets the logical root node for ydt.
      *
-     * @param curNode       current YDT node
-     * @param operationType YMS operation type
-     */
-    public YangRequestWorkBench(YdtNode curNode,
-                                YmsOperationType operationType) {
-        this.curNode = curNode;
-        ymsOperationType = operationType;
-    }
-
-    /**
-     * Sets the logical root context information available in YDT node.
-     *
-     * @param node logical root node
+     * @param node ydt logical root node
      */
     private void setRootNode(YdtNode node) {
         rootNode = node;
@@ -187,9 +171,9 @@
     }
 
     /**
-     * Sets the app context tree logical root node  for ydt application tree.
+     * Sets the logical root node for ydt application tree.
      *
-     * @param node application tree's logical root node
+     * @param node ydt application context logical root node
      */
     private void setAppRootNode(YdtAppContext node) {
         appRootNode = node;
@@ -207,37 +191,57 @@
     }
 
     /**
-     * Returns the app context tree root node for ydt application tree.
-     * This method will be used by yab.
+     * Returns the ydt app context tree logical root node.
+     * This method will be used by yab and ytb.
      *
-     * @return YdtAppContext refers to root node of ydt application tree
+     * @return YdtAppContext app tree logical root node
      */
     public YdtAppContext getAppRootNode() {
         return appRootNode;
     }
 
     /**
-     * Returns the data tree for given node identifier.
+     * Returns the ydt module node with requested node identifier.
      *
-     * @param id        Represents node identifier of YANG data tree node
-     * @param namespace namespace of the application requested by user
+     * @param id module/application node identifier
      * @return YANG data tree node
+     * @throws YdtException when user requested node schema doesn't exist or
+     *                      requested node is already part of the tree
      */
-    private YdtNode moduleHandler(YangSchemaNodeIdentifier id,
-                                  String namespace) {
+    private YdtNode moduleHandler(YangSchemaNodeIdentifier id)
+            throws YdtException {
 
-        YangSchemaNode node = registry
-                .getYangSchemaNodeUsingSchemaName(id.getName());
+        YangSchemaNode node =
+                registry.getYangSchemaNodeUsingSchemaName(id.getName());
 
-        if (node == null ||
-                namespace != null && !namespace.equals(node.getNameSpace())) {
-            curNode.errorHandler(errorMsg(
-                    FMT_NOT_EXIST, id.getName()), rootNode);
+        String namespace = id.getNameSpace().getModuleNamespace();
+
+        /*
+         * Checking received schema node is having same namespace as
+         * requested by user or not.
+         */
+        if (node == null || namespace != null &&
+                !namespace.equals(node.getYangSchemaNodeIdentifier()
+                                          .getNameSpace()
+                                          .getModuleNamespace())) {
+            throw new YdtException(errorMsg(FMT_NOT_EXIST, id.getName()));
         }
 
-        YdtNode newNode = new YdtSingleInstanceNode(id);
+        /*
+         * If yms operation is for query then no validation need to be
+         * performed.
+         */
+        if (ymsOperationType != YmsOperationType.QUERY_REQUEST) {
+            // Checking whether module node is already exits in YDT or not.
+            try {
+                curNode.getCollidingChild(id);
+            } catch (YdtException e) {
+                throw new YdtException(e.getLocalizedMessage());
+            }
+        }
+
+        YdtNode newNode = new YdtSingleInstanceNode(node);
         newNode.setYangSchemaNode(node);
-        id.setNameSpace(node.getNameSpace());
         return newNode;
     }
 
@@ -255,25 +259,29 @@
     }
 
     @Override
-    public void addChild(String name, String namespace) {
-        addChild(name, namespace, UNKNOWN, null, OTHER);
+    public void addChild(String name, String namespace)
+            throws IllegalArgumentException {
+        addChild(name, namespace, UNKNOWN, null, NON_LEAF);
     }
 
     @Override
-    public void addChild(String name, String namespace, YdtType ydtType) {
+    public void addChild(String name, String namespace, YdtType ydtType)
+            throws IllegalArgumentException {
         addChild(name, namespace, ydtType, null);
     }
 
     @Override
     public void addChild(String name, String namespace,
-                         YdtContextOperationType opType) {
-        addChild(name, namespace, UNKNOWN, opType, OTHER);
+                         YdtContextOperationType opType)
+            throws IllegalArgumentException {
+        addChild(name, namespace, UNKNOWN, opType, NON_LEAF);
     }
 
     @Override
     public void addChild(String name, String namespace, YdtType ydtType,
-                         YdtContextOperationType opType) {
-        RequestedCardinality cardinality = null;
+                         YdtContextOperationType opType)
+            throws IllegalArgumentException {
+        RequestedCardinality cardinality;
         switch (ydtType) {
             case MULTI_INSTANCE_NODE:
                 cardinality = MULTI_INSTANCE;
@@ -282,9 +290,9 @@
                 cardinality = SINGLE_INSTANCE;
                 break;
             default:
-                curNode.errorHandler(E_USE_ADDLEAF, rootNode);
+                throw new IllegalArgumentException(E_USE_ADD_LEAF);
         }
-        addChild(name, namespace, cardinality, opType, OTHER);
+        addChild(name, namespace, cardinality, opType, NON_LEAF);
     }
 
     /**
@@ -297,95 +305,108 @@
      * @param cardinality type of YANG data tree node operation
      * @param opType      type of requested operation over a node
      * @param callType    to identify the whether its a leaf or other node
+     * @throws IllegalArgumentException when method has been passed an illegal
+     *                                  or inappropriate argument.
      */
     private void addChild(String name, String namespace,
                           RequestedCardinality cardinality,
                           YdtContextOperationType opType,
-                          RequestedCallType callType) {
+                          RequestedCallType callType)
+            throws IllegalArgumentException {
 
-        YdtNode childNode;
-        boolean isContextSwitch = false;
-        YangSchemaNode schemaNode = null;
-        YangSchemaNodeContextInfo contextInfo;
+        YdtNode newNode;
+        boolean contextSwitch = false;
         YangSchemaNode augmentingSchema = null;
+        YangSchemaNodeIdentifier id = getNodeIdentifier(name, namespace);
 
-        YangSchemaNodeIdentifier id = new YangSchemaNodeIdentifier();
-        id.setName(name);
-
-        // Module/sub-module node handler.
-        if (curNode.equals(rootNode)) {
-            childNode = moduleHandler(id, namespace);
-        } else {
-
-            // If namespace given by user null, then take namespace from parent.
-            if (namespace == null) {
-                namespace = curNode.getYdtNodeIdentifier().getNameSpace();
-            }
-
-            id.setNameSpace(namespace);
-
-            /*
-             * Get the already exiting YDT node in YDT tree with same
-             * nodeIdentifier
-             */
-            childNode = curNode.getCollidingChild(id);
-
-            /*
-             * If colliding child doesn't exist ,
-             * then query yang data model for schema of given node.
-             */
-            if (childNode == null) {
-                /*
-                 * Get Yang Schema node context info which is having
-                 * YangSchemaNode and ContextSwitchedNode.
-                 */
-                contextInfo = curNode.getSchemaNodeContextInfo(id);
-
-                if (contextInfo.getContextSwitchedNode() != null) {
-                    augmentingSchema = appCurNode.getAugmentingSchemaNode(
-                            id, contextInfo);
-                    if (augmentingSchema != null) {
-                        /*
-                         * As two tree(YDT and YDT Application Tree) are getting
-                         * prepared in parallel, So  setting context switch
-                         * flag it will help ydt to keep the track whether
-                         * ydtApp tree also need to be traversed back to parent
-                         * or not with YDT tree traverse to parent call.
-                         */
-                        isContextSwitch = true;
-                    }
-                }
-                schemaNode = contextInfo.getSchemaNode();
+        try {
+            // Module/sub-module node handler.
+            if (curNode.equals(rootNode)) {
+                newNode = moduleHandler(id);
             } else {
-                /*
-                 * If colliding child exist , then will be leaf-list or list
-                 * If its leaf-list then return and add new requested
-                 * value/valueSet in same node else take yang data model
-                 * information from colliding child.
-                 */
-                if (childNode.getYdtType() == MULTI_INSTANCE_LEAF_VALUE_NODE) {
-                    curNode = childNode;
-                    return;
+
+                YangSchemaNode schemaNode;
+                YangSchemaNodeContextInfo contextInfo;
+
+                // If namespace given by user null, then take namespace from parent.
+                if (namespace == null) {
+                    id.setNameSpace(curNode.getYangSchemaNode().getNameSpace());
                 }
-                schemaNode = childNode.getYangSchemaNode();
+
+                /*
+                 * Get the already exiting YDT node in YDT tree with same
+                 * nodeIdentifier
+                 */
+                newNode = curNode.getCollidingChild(id);
+
+                /*
+                 * If colliding child doesn't exist ,
+                 * then query yang data model for schema of given node.
+                 */
+                if (newNode == null) {
+                    /*
+                     * Get Yang Schema node context info which is having
+                     * YangSchemaNode and ContextSwitchedNode.
+                     */
+                    contextInfo = curNode.getSchemaNodeContextInfo(id);
+
+                    if (contextInfo.getContextSwitchedNode() != null) {
+                        augmentingSchema = getAugmentingSchemaNode(
+                                id, contextInfo);
+                        if (augmentingSchema != null) {
+                            /*
+                             * As two tree(YDT and YDT Application Tree) are getting
+                             * prepared in parallel, So  setting context switch
+                             * flag it will help ydt to keep the track whether
+                             * ydtApp tree also need to be traversed back to parent
+                             * or not with YDT tree traverse to parent call.
+                             */
+                            contextSwitch = true;
+                        }
+                    }
+                    schemaNode = contextInfo.getSchemaNode();
+                } else {
+                    /*
+                     * If colliding child exist , then it will be leaf-list or list.
+                     * If its leaf-list then return and add new requested
+                     * value/valueSet in same node else take yang data model
+                     * information from colliding child.
+                     */
+                    if (newNode.getYdtType() == MULTI_INSTANCE_LEAF_VALUE_NODE) {
+                        curNode = newNode;
+                        return;
+                    }
+                    schemaNode = newNode.getYangSchemaNode();
+                }
+
+                /*
+                 * For yms query request node specific validation are not
+                 * required as rest-conf can call addChild api for leaf/leaf-list
+                 * node addition also in ydt.
+                 */
+                if (ymsOperationType == YmsOperationType.QUERY_REQUEST) {
+                    newNode = getYangSchemaNodeTypeSpecificContext(schemaNode);
+                } else {
+                    newNode = getNode(schemaNode, cardinality, callType);
+                }
             }
-            childNode = YdtNodeFactory.getNode(id, schemaNode, cardinality,
-                                               callType);
+
+            opType = getValidOpType(opType, ydtDefaultOpType, newNode, curNode);
+
+            newNode.setYdtContextOperationType(opType);
+
+            curNode.addChild(newNode, true);
+        } catch (YdtException e) {
+            freeRestResources(rootNode);
+            throw new IllegalArgumentException(e.getLocalizedMessage());
         }
 
-        opType = getValidOpType(opType, callType, schemaNode);
-
-        childNode.setYdtContextOperationType(opType);
-
-        curNode.addChild(childNode, true);
-
         // Update parent ydt node map.
-        curNode.updateYdtMap(id, childNode);
+        curNode.updateYdtMap(newNode);
 
-        processAppTree(opType, childNode, augmentingSchema, isContextSwitch);
+        processAppTree(opType, newNode, augmentingSchema, contextSwitch);
 
-        // Updating the curNode.
-        curNode = childNode;
+        curNode = newNode;
     }
 
     /**
@@ -394,18 +415,17 @@
      * @param opType           user requested operation type
      * @param childNode        requested ydt node
      * @param augmentingSchema schema of last augmenting node
-     * @param isContextSwitch  true, for module node call; false for modules
+     * @param contextSwitch    true, for module node call; false for modules
      *                         sub-node calls
      */
     private void processAppTree(
             YdtContextOperationType opType, YdtNode childNode,
-            YangSchemaNode augmentingSchema, boolean isContextSwitch) {
+            YangSchemaNode augmentingSchema, boolean contextSwitch) {
 
-        if (augmentingSchema != null) {
-            if (!appCurNode.addSchemaToAppSet(augmentingSchema)) {
-                return;
-            }
+        if (curNode == rootNode) {
+            augGenMethodSet = new HashSet<>();
         }
+
         if (opType == null) {
             opType = curNode.getYdtContextOperationType();
         } else {
@@ -414,13 +434,23 @@
         }
 
         /*
-         * Create entry of module node in ydt app tree.
-         * Or if context switch happened then also add entry for same ydt
-         * node in the ydt application tree.
+         * This is to avoid multiple entries of single augmented target.
          */
-        if (curNode.equals(rootNode) || isContextSwitch) {
+        if (augmentingSchema != null) {
+            if (!augGenMethodSet.add(((YangAugment) augmentingSchema)
+                                             .getSetterMethodName())) {
+                return;
+            }
+        }
+
+        /*
+         * Create entry of module node in ydt app tree.
+         * Or if context switch happened then also add entry for same
+         * augmented ydt node in the ydt application tree.
+         */
+        if (curNode.equals(rootNode) || contextSwitch) {
             addChildInAppTree(childNode, augmentingSchema, opType,
-                              isContextSwitch);
+                              contextSwitch);
 
             // Setting app tree node operation.
             appCurNode.setOperationType(getAppOpTypeFromYdtOpType(opType));
@@ -432,56 +462,6 @@
         }
     }
 
-    /**
-     * Returns the valid operation type for requested ydt node after performing
-     * validation.
-     *
-     * @param opType     user requested operation type
-     * @param callType   to identify the whether its a leaf or other node
-     * @param schemaNode schema node of user requested ydt node
-     * @return operation type
-     */
-    private YdtContextOperationType getValidOpType(
-            YdtContextOperationType opType, RequestedCallType callType,
-            YangSchemaNode schemaNode) {
-
-        // Operation type not supported for leaf node.
-        if (callType == LEAF || (callType == RequestedCallType.MULTI_INSTANCE &&
-                schemaNode.getYangSchemaNodeType() ==
-                        YANG_MULTI_INSTANCE_LEAF_NODE)) {
-            return null;
-        }
-
-        // Reference for parent node operation type.
-        YdtContextOperationType parentOpType = curNode
-                .getYdtContextOperationType();
-
-        if (opType != null && parentOpType != null) {
-            validateOperationType(parentOpType, opType);
-        } else if (opType == null) {
-            opType = getOperationType(parentOpType);
-        }
-        return opType;
-    }
-
-    /**
-     * Returns the operation type for non leaf node.
-     * When "operation" attribute for current node is not specified or null,
-     * then the operation applied to the parent data node of the
-     * configuration is used. If no parent data node is available,
-     * then the default-operation'value is used.
-     * If default operation type is not set, merge will be taken as default
-     * operation type.
-     *
-     * @param parentOpType operation type of parent node
-     * @return operation type for current non leaf node
-     */
-    private YdtContextOperationType getOperationType(
-            YdtContextOperationType parentOpType) {
-
-        return parentOpType != null ? parentOpType :
-                (ydtDefaultOpType != null ? ydtDefaultOpType : MERGE);
-    }
 
     /**
      * Adds a last child to YANG app data tree.this method is to be used
@@ -504,10 +484,9 @@
 
         // Add context switched child in ydt App tree.
         appCurNode.addChild(appContext);
-        //Updating the curNode.
+
         appCurNode = appContext;
 
-        // Get the app tree operation type from ydt operation type.
         opType = getAppOpTypeFromYdtOpType(childOpType);
 
         appCurNode.setAppData(childNode, schemaNode);
@@ -517,40 +496,15 @@
         childNode.setAppContextSwitch();
     }
 
-    /**
-     * Validates the various combination of operation type.
-     *
-     * @param parentOpType Reference for parent node operation type
-     * @param childOpType  type of YANG data tree node operation
-     */
-    private void validateOperationType(YdtContextOperationType parentOpType,
-                                       YdtContextOperationType childOpType) {
-
-        switch (parentOpType) {
-            case CREATE:
-                // Inside the create operation delete operation should not come.
-                if (childOpType == DELETE) {
-                    curNode.errorHandler(E_CREATE, rootNode);
-                }
-                break;
-            case DELETE:
-                // Inside the delete operation create operation should not come.
-                if (childOpType == CREATE) {
-                    curNode.errorHandler(E_DEL, rootNode);
-                }
-                break;
-            default:
-                //TODO check all possible scenario.
-        }
-    }
-
     @Override
-    public void addLeaf(String name, String namespace, String value) {
+    public void addLeaf(String name, String namespace, String value)
+            throws IllegalArgumentException {
         addLeaf(name, namespace, value, null, UNKNOWN);
     }
 
     @Override
-    public void addLeaf(String name, String namespace, Set<String> valueSet) {
+    public void addLeaf(String name, String namespace, Set<String> valueSet)
+            throws IllegalArgumentException {
         addLeaf(name, namespace, null, valueSet, MULTI_INSTANCE_LEAF);
     }
 
@@ -568,51 +522,66 @@
      * @param value       value of the child
      * @param valueSet    list of value of the child
      * @param cardinality type of YANG data tree node operation
+     * @throws IllegalArgumentException when method has been passed an illegal
+     *                                  or inappropriate argument.
      */
     private void addLeaf(String name, String namespace, String value,
                          Set<String> valueSet,
-                         RequestedCardinality cardinality) {
-        addChild(name, namespace, cardinality, null, LEAF);
+                         RequestedCardinality cardinality)
+            throws IllegalArgumentException {
+        try {
+            addChild(name, namespace, cardinality, null, LEAF);
 
-        // After successful addition of child node updating the values in same.
-        if (value != null) {
-            curNode.addValue(value);
-        } else if (valueSet != null) {
-            curNode.addValueSet(valueSet);
+            // After successful addition of child node updating the values in same.
+            if (value != null) {
+                curNode.addValue(value);
+            } else if (valueSet != null) {
+                curNode.addValueSet(valueSet);
+            }
+        } catch (YdtException e) {
+            freeRestResources(rootNode);
+            throw new IllegalArgumentException(e.getLocalizedMessage());
         }
     }
 
     @Override
-    public void traverseToParent() {
+    public void traverseToParent() throws IllegalStateException {
         // If traverse back to parent for logical root node comes
         if (curNode.equals(rootNode)) {
-            curNode.errorHandler(E_INVOKE_PARENT, rootNode);
+            freeRestResources(rootNode);
+            throw new IllegalStateException(E_INVOKE_PARENT);
         }
 
-        // If node is of multiInstanceNode type then check key uniqueness.
-        if (curNode.getYdtType() == MULTI_INSTANCE_NODE) {
-            curNode.createKeyNodeList();
-        }
+        try {
 
-        /*
-         * Check application switch for curNode if set,
-         * then traverseToParent in YDT application tree.
-         */
-        if (curNode.getParent().equals(rootNode) ||
-                curNode.getAppContextSwitch()) {
-            traverseToAppTreeParent();
-        }
+            // If node is of multiInstanceNode type then check key uniqueness.
+            if (curNode.getYdtType() == MULTI_INSTANCE_NODE) {
+                curNode.createKeyNodeList();
+            }
 
-        /*
-         * Validate all multi Instance inside current context,
-         * This is not valid for leaf and leaf-list node.
-         */
-        if (curNode instanceof YdtMultiInstanceNode ||
-                curNode instanceof YdtSingleInstanceNode) {
-            curNode.validateMultiInstanceNode();
-        }
+            /*
+             * Check application switch for curNode if set,
+             * then traverseToParent in YDT application tree.
+             */
+            if (curNode.getParent().equals(rootNode) ||
+                    curNode.getAppContextSwitch()) {
+                traverseToAppTreeParent();
+            }
 
-        curNode = curNode.getParent();
+            /*
+             * Validate all multi Instance inside current context,
+             * This is not valid for leaf and leaf-list node.
+             */
+            if (curNode instanceof YdtMultiInstanceNode ||
+                    curNode instanceof YdtSingleInstanceNode) {
+                curNode.validateMultiInstanceNode();
+            }
+
+            curNode = curNode.getParent();
+        } catch (YdtException e) {
+            freeRestResources(rootNode);
+            throw new IllegalStateException(e.getLocalizedMessage());
+        }
     }
 
     /**
@@ -647,59 +616,60 @@
     @Override
     public void addMultiInstanceChild(String name, String namespace,
                                       List<String> keysValueList,
-                                      YdtContextOperationType opType) {
+                                      YdtContextOperationType opType)
+            throws IllegalArgumentException {
+
         addChild(name, namespace, UNKNOWN, opType,
                  RequestedCallType.MULTI_INSTANCE);
         int inputCount = keysValueList.size();
-        int expectedCount;
-        if (curNode.getYdtType() == MULTI_INSTANCE_LEAF_VALUE_NODE) {
-            // After successful addition of child node updating
-            // the values in same.
-            // inputCount = curNode.getValueSet().size() + inputCount;
-            // checkElementCount(expectedCount, inputCount);
-            // TODO check the element count
-            for (String value : keysValueList) {
-                curNode.addValue(value);
-            }
-        } else if (curNode.getYdtType() == MULTI_INSTANCE_NODE) {
-            YangList yangListHolder = (YangList) curNode.getYangSchemaNode();
-            List<String> schemaKeyList = yangListHolder.getKeyList();
-            expectedCount = schemaKeyList.size();
-            checkElementCount(name, expectedCount, inputCount);
 
-            Iterator<String> sklIter = schemaKeyList.iterator();
-            Iterator<String> kvlIter = keysValueList.iterator();
-            String keyEleName;
-            while (kvlIter.hasNext()) {
-                String value = kvlIter.next();
-                keyEleName = sklIter.next();
-                addLeaf(keyEleName, namespace, value);
-                if (kvlIter.hasNext()) {
-                    traverseToParentWithoutValidation();
+        try {
+            if (curNode.getYdtType() == MULTI_INSTANCE_LEAF_VALUE_NODE) {
+
+            /*
+             * Calculating the current leaf-list node array size by adding
+             * existing elements count and new supplied elements by user for
+             * the same.
+             */
+                // TODO instance count for leaf list need to be handled.
+//            if (curNode.getValueSet().size() + inputCount > expectedCount) {
+//                curNode.errorHandler(
+//                        errorMsg(FMT_MANY_INS, name, expectedCount), rootNode);
+//            }
+
+            /*
+             * After successful addition of child node updating
+             * the values in same.
+             */
+                for (String value : keysValueList) {
+                    curNode.addValue(value);
                 }
-            }
-            curNode = curNode.getParent();
-        } else {
-            curNode.errorHandler(E_MULTI_INS, rootNode);
-        }
-    }
+            } else if (curNode.getYdtType() == MULTI_INSTANCE_NODE) {
 
-    /**
-     * Checks the user supplied list of argument match's the expected value
-     * or not.
-     *
-     * @param name     name of the parent list/leaf-list node
-     * @param expected count suppose to be
-     * @param actual   user supplied values count
-     */
-    private void checkElementCount(String name, int expected,
-                                   int actual) {
-        if (expected < actual) {
-            curNode.errorHandler(errorMsg(FMT_TOO_MANY, name, expected, actual),
-                                 rootNode);
-        } else if (expected > actual) {
-            curNode.errorHandler(errorMsg(FMT_TOO_FEW, name, expected, actual),
-                                 rootNode);
+                YangList yangListHolder = (YangList) curNode.getYangSchemaNode();
+                List<String> schemaKeyList = yangListHolder.getKeyList();
+                int expectedCount = schemaKeyList.size();
+                checkElementCount(name, expectedCount, inputCount);
+
+                //After validation adding the key nodes under the list node.
+                Iterator<String> sklIter = schemaKeyList.iterator();
+                Iterator<String> kvlIter = keysValueList.iterator();
+                String keyEleName;
+
+                while (kvlIter.hasNext()) {
+                    String value = kvlIter.next();
+                    keyEleName = sklIter.next();
+                    addLeaf(keyEleName, namespace, value);
+                    if (kvlIter.hasNext()) {
+                        traverseToParentWithoutValidation();
+                    }
+                }
+
+                curNode = curNode.getParent();
+            }
+        } catch (YdtException e) {
+            freeRestResources(rootNode);
+            throw new IllegalArgumentException(e.getLocalizedMessage());
         }
     }
 
@@ -713,15 +683,7 @@
     private YdtNode addExtendedChildNode(YdtContextOperationType opType,
                                          YangSchemaNode schemaNode) {
 
-        YdtNode childNode;
-        YangSchemaNodeIdentifier id =
-                schemaNode.getYangSchemaNodeIdentifier();
-
-        childNode = YdtNodeFactory
-                .getYangSchemaNodeTypeSpecificContext(
-                        id, schemaNode.getYangSchemaNodeType());
-
-        childNode.setId(id);
+        YdtNode childNode = getYangSchemaNodeTypeSpecificContext(schemaNode);
 
         childNode.setYangSchemaNode(schemaNode);
 
@@ -745,27 +707,53 @@
                                           YangSchemaNode schemaNode) {
         YdtNode childNode = addExtendedChildNode(null, schemaNode);
 
-        // After successful addition of child node updating the values in same.
+        /*
+         * After successful addition of child node updating the values in
+         * valueSet.
+         */
         childNode.addValueSetWithoutValidation(valueSet);
         return childNode;
     }
 
     @Override
-    public YdtExtendedContext addLeaf(String value,
-                                      YangSchemaNode schemaNode) {
+    public YdtExtendedContext addLeaf(String value, YangSchemaNode schemaNode) {
+
         YdtNode childNode = addExtendedChildNode(null, schemaNode);
 
         // After successful addition of child node updating the values in same.
-        childNode.addValueWithoutValidation(value);
+        childNode.addValueWithoutValidation(value, ((YangLeaf) schemaNode)
+                .isKeyLeaf());
         return childNode;
     }
 
     @Override
-    public void traverseToParentWithoutValidation() {
-        // If traverse back to parent for logical root node comes
+    public void traverseToParentWithoutValidation()
+            throws IllegalStateException {
+        // If traverse back to parent for logical root node comes.
         if (curNode.equals(rootNode)) {
-            curNode.errorHandler(E_INVOKE_PARENT, rootNode);
+            freeRestResources(rootNode);
+            throw new IllegalStateException(E_INVOKE_PARENT);
         }
         curNode = curNode.getParent();
     }
+
+    /**
+     * Returns the method name's set for an augmented target node in an
+     * application tree.
+     *
+     * @return augGenMethodSet set of method name's
+     */
+    public Set<String> getAugGenMethodSet() {
+        return augGenMethodSet;
+    }
+
+    /**
+     * Sets the method name's set for an augmented target node in an
+     * application tree.
+     *
+     * @param augGenMethodSet set of method name's
+     */
+    public void setAugGenMethodSet(Set<String> augGenMethodSet) {
+        this.augGenMethodSet = augGenMethodSet;
+    }
 }
diff --git a/apps/yms/app/src/main/java/org/onosproject/yms/app/ydt/YdtAppContext.java b/apps/yms/app/src/main/java/org/onosproject/yms/app/ydt/YdtAppContext.java
index c845221..d6879d7 100644
--- a/apps/yms/app/src/main/java/org/onosproject/yms/app/ydt/YdtAppContext.java
+++ b/apps/yms/app/src/main/java/org/onosproject/yms/app/ydt/YdtAppContext.java
@@ -17,8 +17,6 @@
 package org.onosproject.yms.app.ydt;
 
 import org.onosproject.yangutils.datamodel.YangSchemaNode;
-import org.onosproject.yangutils.datamodel.YangSchemaNodeContextInfo;
-import org.onosproject.yangutils.datamodel.YangSchemaNodeIdentifier;
 import org.onosproject.yms.ydt.YdtContext;
 import org.onosproject.yms.ydt.YdtContextOperationType;
 
@@ -55,13 +53,6 @@
     YdtAppContext getFirstChild();
 
     /**
-     * Sets the context of first child.
-     *
-     * @param child node
-     */
-    void setChild(YdtAppContext child);
-
-    /**
      * Returns the context of last child.
      *
      * @return context of last child
@@ -69,13 +60,6 @@
     YdtAppContext getLastChild();
 
     /**
-     * Sets the context of last child.
-     *
-     * @param child node
-     */
-    void setLastChild(YdtAppContext child);
-
-    /**
      * Returns the context of next sibling.
      *
      * @return context of next sibling
@@ -139,13 +123,6 @@
     YdtContext getModuleContext();
 
     /**
-     * Sets the application's ydtContext.
-     *
-     * @param moduleNode application's ydtContext
-     */
-    void setModuleContext(YdtContext moduleNode);
-
-    /**
      * Returns the YangSchemaNode of augmenting application.
      *
      * @return YangSchemaNode of augmenting application
@@ -167,19 +144,6 @@
     void addChild(YdtAppContext newChild);
 
     /**
-     * Returns augmenting node module yang schema node.
-     *
-     * @param id          schema node identifier
-     * @param contextInfo Yang Schema node context info
-     *                    which is having YangSchemaNode and
-     *                    ContextSwitchedNode
-     * @return augmenting node module yang schema node
-     */
-    YangSchemaNode getAugmentingSchemaNode(
-            YangSchemaNodeIdentifier id,
-            YangSchemaNodeContextInfo contextInfo);
-
-    /**
      * Updates the app tree operation type.
      * <p>
      * If earlier operation type was OTHER_EDIT and now operation type came as
@@ -212,12 +176,4 @@
      * @return schema node
      */
     YangSchemaNode getYangSchemaNode();
-
-    /**
-     * Adds the given schema node in to application set.
-     *
-     * @param schemaNode schema node to be added
-     * @return true for success; false otherwise
-     */
-    boolean addSchemaToAppSet(YangSchemaNode schemaNode);
 }
diff --git a/apps/yms/app/src/main/java/org/onosproject/yms/app/ydt/YdtExtendedBuilder.java b/apps/yms/app/src/main/java/org/onosproject/yms/app/ydt/YdtExtendedBuilder.java
index ea9c9f3d..19aacb5 100644
--- a/apps/yms/app/src/main/java/org/onosproject/yms/app/ydt/YdtExtendedBuilder.java
+++ b/apps/yms/app/src/main/java/org/onosproject/yms/app/ydt/YdtExtendedBuilder.java
@@ -64,8 +64,11 @@
      * Traverses up in YANG data tree to the parent node, it is to be used when
      * protocol is using extended context type and wanted to traverse
      * up the tree without doing any validation.
+     *
+     * @throws IllegalStateException when user request for traverse to logical
+     *                               root node parent
      */
-    void traverseToParentWithoutValidation();
+    void traverseToParentWithoutValidation() throws IllegalStateException;
 
     @Override
     YdtExtendedContext getRootNode();
diff --git a/apps/yms/app/src/main/java/org/onosproject/yms/app/ydt/YdtExtendedContext.java b/apps/yms/app/src/main/java/org/onosproject/yms/app/ydt/YdtExtendedContext.java
index 3668de8..79d9401 100644
--- a/apps/yms/app/src/main/java/org/onosproject/yms/app/ydt/YdtExtendedContext.java
+++ b/apps/yms/app/src/main/java/org/onosproject/yms/app/ydt/YdtExtendedContext.java
@@ -17,8 +17,6 @@
 package org.onosproject.yms.app.ydt;
 
 import org.onosproject.yangutils.datamodel.YangSchemaNode;
-import org.onosproject.yangutils.datamodel.YangSchemaNodeContextInfo;
-import org.onosproject.yangutils.datamodel.YangSchemaNodeIdentifier;
 import org.onosproject.yms.ydt.YdtContext;
 import org.onosproject.yms.ydt.YdtContextOperationType;
 
@@ -47,16 +45,6 @@
     void addAppInfo(AppType appType, Object object);
 
     /**
-     * Returns child schema node context information. It is used by YMS to
-     * obtain the child schema corresponding to data node identifier.
-     *
-     * @param id represents a identifier of YANG data tree node
-     * @return YANG data node context information
-     */
-    YangSchemaNodeContextInfo getSchemaNodeContextInfo(
-            YangSchemaNodeIdentifier id);
-
-    /**
      * Returns schema node from data model for curNode.
      *
      * @return yang schema node
diff --git a/apps/yms/app/src/main/java/org/onosproject/yms/app/ydt/YdtLogicalNode.java b/apps/yms/app/src/main/java/org/onosproject/yms/app/ydt/YdtLogicalNode.java
new file mode 100644
index 0000000..05de8b3
--- /dev/null
+++ b/apps/yms/app/src/main/java/org/onosproject/yms/app/ydt/YdtLogicalNode.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yms.app.ydt;
+
+import org.onosproject.yms.app.ydt.exceptions.YdtException;
+
+import static org.onosproject.yms.app.ydt.YdtConstants.FMT_DUP_ENTRY;
+import static org.onosproject.yms.app.ydt.YdtConstants.errorMsg;
+import static org.onosproject.yms.ydt.YdtType.LOGICAL_ROOT_NODE;
+
+/**
+ * Represents a logical YANG data tree node.
+ */
+class YdtLogicalNode extends YdtNode {
+
+    private final String name;
+    private final String namespace;
+
+    /**
+     * Creates a YANG logical node object.
+     */
+    public YdtLogicalNode(String name, String namespace) {
+        super(LOGICAL_ROOT_NODE);
+        this.name = name;
+        this.namespace = namespace;
+    }
+
+    @Override
+    public String getName() {
+        return name;
+    }
+
+    @Override
+    public String getNamespace() {
+        return namespace;
+    }
+
+    @Override
+    public String getModuleNameAsNameSpace() {
+        return namespace;
+    }
+
+    @Override
+    public void validDuplicateEntryProcessing() throws YdtException {
+        throw new YdtException(errorMsg(FMT_DUP_ENTRY, getName()));
+    }
+}
diff --git a/apps/yms/app/src/main/java/org/onosproject/yms/app/ydt/YdtMultiInstanceLeafNode.java b/apps/yms/app/src/main/java/org/onosproject/yms/app/ydt/YdtMultiInstanceLeafNode.java
index 955852d..24316ad 100644
--- a/apps/yms/app/src/main/java/org/onosproject/yms/app/ydt/YdtMultiInstanceLeafNode.java
+++ b/apps/yms/app/src/main/java/org/onosproject/yms/app/ydt/YdtMultiInstanceLeafNode.java
@@ -17,10 +17,10 @@
 package org.onosproject.yms.app.ydt;
 
 import com.google.common.collect.ImmutableSet;
-import org.onosproject.yangutils.datamodel.YangSchemaNodeIdentifier;
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
+import org.onosproject.yangutils.datamodel.YangSchemaNode;
+import org.onosproject.yms.app.ydt.exceptions.YdtException;
 
-import java.util.HashSet;
+import java.util.LinkedHashSet;
 import java.util.Set;
 
 import static org.onosproject.yms.app.ydt.YdtConstants.errorMsg;
@@ -39,15 +39,15 @@
     /**
      * Set of values.
      */
-    private final Set<String> valueSet = new HashSet<>();
+    private final Set<String> valueSet = new LinkedHashSet<>();
 
     /**
      * Creates a YANG multi instance leaf node.
      *
-     * @param id node identifier of YDT multi instance node
+     * @param node schema of YDT multi instance node
      */
-    protected YdtMultiInstanceLeafNode(YangSchemaNodeIdentifier id) {
-        super(MULTI_INSTANCE_LEAF_VALUE_NODE, id);
+    YdtMultiInstanceLeafNode(YangSchemaNode node) {
+        super(MULTI_INSTANCE_LEAF_VALUE_NODE, node);
     }
 
     @Override
@@ -56,13 +56,14 @@
     }
 
     @Override
-    public void addValue(String value) {
+    public void addValue(String value) throws YdtException {
         // check the value against corresponding data-type.
-        try {
-            getYangSchemaNode().isValueValid(value);
-        } catch (Exception e) {
-            errorHandler(e.getLocalizedMessage(), this);
-        }
+        //TODO validation need to be decided
+//        try {
+//            getYangSchemaNode().isValueValid(value);
+//        } catch (Exception e) {
+//            throw new YdtException(e.getLocalizedMessage());
+//        }
         addValueToValueSet(value);
     }
 
@@ -71,33 +72,33 @@
      * the value.
      *
      * @param value value to be added
+     * @throws YdtException when the duplicate entry found in leaf-list node
      */
-    private void addValueToValueSet(String value) {
-
+    private void addValueToValueSet(String value) throws YdtException {
         if (!valueSet.add(value)) {
-            errorHandler(errorMsg(FMT_DUP_ENTRY,
-                                  getYdtNodeIdentifier().getName()), this);
+            throw new YdtException(errorMsg(FMT_DUP_ENTRY, getName()));
         }
     }
 
     @Override
-    public void addValueSet(Set valueSet) {
-        String value = null;
+    public void addValueSet(Set valueSet) throws YdtException {
+        String value;
         // Check the value against corresponding data-type.
         for (Object aValueSet : valueSet) {
-
-            try {
-                value = String.valueOf(aValueSet);
-                getYangSchemaNode().isValueValid(value);
-            } catch (DataModelException e) {
-                errorHandler(e.getLocalizedMessage(), this);
-            }
+            value = String.valueOf(aValueSet);
+            //TODO validation need to be decided
+//            try {
+//                value = String.valueOf(aValueSet);
+//                getYangSchemaNode().isValueValid(value);
+//            } catch (DataModelException e) {
+//                throw new YdtException(e.getLocalizedMessage());
+//            }
             addValueToValueSet(value);
         }
     }
 
     @Override
-    public void addValueWithoutValidation(String value) {
+    public void addValueWithoutValidation(String value, boolean isKeyLeaf) {
         valueSet.add(value);
     }
 
diff --git a/apps/yms/app/src/main/java/org/onosproject/yms/app/ydt/YdtMultiInstanceNode.java b/apps/yms/app/src/main/java/org/onosproject/yms/app/ydt/YdtMultiInstanceNode.java
index a24772b..48bc9ef 100644
--- a/apps/yms/app/src/main/java/org/onosproject/yms/app/ydt/YdtMultiInstanceNode.java
+++ b/apps/yms/app/src/main/java/org/onosproject/yms/app/ydt/YdtMultiInstanceNode.java
@@ -18,12 +18,15 @@
 
 import com.google.common.collect.ImmutableList;
 import org.onosproject.yangutils.datamodel.YangList;
+import org.onosproject.yangutils.datamodel.YangSchemaNode;
 import org.onosproject.yangutils.datamodel.YangSchemaNodeIdentifier;
+import org.onosproject.yms.app.ydt.exceptions.YdtException;
 import org.onosproject.yms.ydt.YdtContext;
 
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Set;
 
 import static org.onosproject.yms.app.ydt.YdtConstants.errorMsg;
 import static org.onosproject.yms.ydt.YdtType.MULTI_INSTANCE_NODE;
@@ -34,9 +37,15 @@
  */
 public class YdtMultiInstanceNode extends YdtNode {
 
-    // ydt formatted error string
+    // YDT formatted error string
     private static final String FMT_MISSING_KEY =
             "%s is missing some of the keys of %s.";
+    private static final String FMT_UNI_KEY =
+            "Some of the key elements are not unique in %s.";
+    private static final String FMT_MANY_INS =
+            "Too many instances of %s. Expected maximum instances %d.";
+    private static final String FMT_FEW_INS =
+            "Too few instances of %s. Expected minimum instances %d.";
 
     /*
      * Reference for list of key element's ydtContext.
@@ -51,10 +60,10 @@
     /**
      * Creates a YANG multi instance node object.
      *
-     * @param id node identifier of YDT multi instance node .
+     * @param node schema of YDT multi instance node .
      */
-    protected YdtMultiInstanceNode(YangSchemaNodeIdentifier id) {
-        super(MULTI_INSTANCE_NODE, id);
+    YdtMultiInstanceNode(YangSchemaNode node) {
+        super(MULTI_INSTANCE_NODE, node);
     }
 
     /**
@@ -62,7 +71,7 @@
      *
      * @return composite key string
      */
-    public String getCompositeKey() {
+    private String getCompositeKey() {
         return compositeKey;
     }
 
@@ -76,7 +85,7 @@
     }
 
     @Override
-    public void createKeyNodeList() {
+    public void createKeyNodeList() throws YdtException {
         YangList yangListHolder = (YangList) getYangSchemaNode();
         List<String> schemaKeyList = yangListHolder.getKeyList();
 
@@ -96,30 +105,99 @@
         List<YdtContext> nodeList = new ArrayList<>();
 
         YangSchemaNodeIdentifier id = new YangSchemaNodeIdentifier();
-        id.setNameSpace(getYdtNodeIdentifier().getNameSpace());
+        id.setNameSpace(new NameSpace(getNamespace()));
         // This loop should run while schema key list is not finished
         while (sklItr.hasNext()) {
             String name = sklItr.next();
             id.setName(name);
-            List<YdtNode<YdtMultiInstanceNode>> collidingChild =
-                    (List<YdtNode<YdtMultiInstanceNode>>) ydtNodeMap.get(id);
+            YdtNode<YdtSingleInstanceLeafNode> collidingChild =
+                    (YdtNode<YdtSingleInstanceLeafNode>) ydtNodeMap.get(id);
 
             if (collidingChild == null) {
-                errorHandler(errorMsg(FMT_MISSING_KEY,
-                                      yangListHolder.getParent().getName(),
-                                      yangListHolder.getName()), this);
+                throw new YdtException(
+                        errorMsg(FMT_MISSING_KEY, yangListHolder.getParent()
+                                .getName(), yangListHolder.getName()));
             }
 
-            YdtNode<YdtMultiInstanceNode> ydtNode = collidingChild.get(0);
             /*
              * Preparing composite key string by concatenating values of
              * all the key leaf.
              */
-            ksb.append(ydtNode.getValue());
-            nodeList.add(ydtNode);
+            ksb.append(collidingChild.getValue());
+            nodeList.add(collidingChild);
         }
         //Setting te key object in List.
         keyNodeList = nodeList;
         compositeKey = ksb.toString();
     }
+
+    /**
+     * Validates the given list of instances by verifying the allowed
+     * instance count and key element uniqueness.
+     *
+     * @param keyStringSet set to validate the key element uniqueness
+     * @param list     list of instance's of same list
+     * @throws YdtException when user requested multi instance node instance's
+     *                      count doesn't fit into the allowed instance's limit
+     *                      or doesn't have unique key's
+     */
+    public void validateInstances(Set keyStringSet, List list)
+            throws YdtException {
+
+        // Clearing the set.
+        keyStringSet.clear();
+
+        /*
+         * Storing the number of multiInstance node for number
+         * if instance validation.
+         */
+        int instanceCount = list.size();
+
+        YangList listSchema = (YangList) ((YdtMultiInstanceNode) list.get(0))
+                .getYangSchemaNode();
+        validateInstanceCount(instanceCount, listSchema);
+        if (listSchema.isConfig() && instanceCount > 1) {
+
+            /*
+             * Iterating over values in ydtNodeList of
+             * multiInstanceNode and compare the key string.
+             */
+            for (YdtNode ydtNode : (List<YdtNode<YdtMultiInstanceNode>>) list) {
+                if (!keyStringSet.add(((YdtMultiInstanceNode) ydtNode)
+                                              .getCompositeKey())) {
+                    throw new YdtException(
+                            errorMsg(FMT_UNI_KEY, ydtNode.getName()));
+                }
+            }
+        }
+    }
+
+    /**
+     * Validates the instance count for given list entry.
+     *
+     * @param instanceCount actual count
+     * @param list          list entry for which instance count need
+     *                      to be validated
+     * @throws YdtException when user requested multi instance node instance's
+     *                      count doesn't fit into the allowed instance's limit
+     */
+    private void validateInstanceCount(int instanceCount, YangList list)
+            throws YdtException {
+
+        if (list.getMinElements() != null) {
+            int minElement = list.getMinElements().getMinElement();
+            if (instanceCount < minElement) {
+                throw new YdtException(errorMsg(FMT_FEW_INS, list.getName(),
+                                                minElement));
+            }
+        }
+
+        if (list.getMaxElements() != null) {
+            int maxElement = list.getMaxElements().getMaxElement();
+            if (instanceCount > maxElement) {
+                throw new YdtException(errorMsg(FMT_MANY_INS, list.getName(),
+                                                maxElement));
+            }
+        }
+    }
 }
diff --git a/apps/yms/app/src/main/java/org/onosproject/yms/app/ydt/YdtNode.java b/apps/yms/app/src/main/java/org/onosproject/yms/app/ydt/YdtNode.java
index c3d4b87..48cf53a 100644
--- a/apps/yms/app/src/main/java/org/onosproject/yms/app/ydt/YdtNode.java
+++ b/apps/yms/app/src/main/java/org/onosproject/yms/app/ydt/YdtNode.java
@@ -16,7 +16,6 @@
 
 package org.onosproject.yms.app.ydt;
 
-import org.onosproject.yangutils.datamodel.YangList;
 import org.onosproject.yangutils.datamodel.YangSchemaNode;
 import org.onosproject.yangutils.datamodel.YangSchemaNodeContextInfo;
 import org.onosproject.yangutils.datamodel.YangSchemaNodeIdentifier;
@@ -42,10 +41,8 @@
  */
 public abstract class YdtNode<T> implements YdtExtendedContext, Cloneable {
 
-    // ydt formatted error string
-    private static final String FMT_UNI_KEY =
-            "Some of the key elements are not unique in %s.";
-    private static final String FMT_KLIST_STR =
+    // YDT formatted error string
+    private static final String FMT_NON_LIST_STR =
             "List of key cannot be created for leaf and leaf-list %s node.";
     private static final String FMT_VAL_N =
             "Value cannot be set in non leaf %s node.";
@@ -55,12 +52,8 @@
             "Value cannot be invoke from non leaf %s node.";
     private static final String FMT_VAL_INS =
             "ValueSet cannot be invoke from non leaf-list %s node";
-    private static final String FMT_MANY_INS =
-            "Too many instances of %s. Expected maximum instances %d.";
-    private static final String FMT_FEW_INS =
-            "Too few instances of %s. Expected minimum instances %d.";
 
-    // ydt error string
+    // YDT error string
     private static final String E_EXIST = "Node is already part of a tree";
     private static final String E_ATOMIC =
             "Child to be added is not atomic, it already has a child";
@@ -99,7 +92,7 @@
     /*
      * Type of node.
      */
-    private YdtType ydtType;
+    private final YdtType ydtType;
 
     /*
      * Flag to keep the track of context switch,
@@ -118,9 +111,17 @@
     private YdtExtendedInfoType ydtExtendedInfoType;
 
     /*
-     * Ydt map to keep the track of node added in YDT.
+     * Ydt map to keep the track of node added under current parent node.
      */
-    final Map<YangSchemaNodeIdentifier, List<YdtNode<T>>> ydtNodeMap =
+    final Map<YangSchemaNodeIdentifier, YdtNode<T>> ydtNodeMap =
+            new HashMap<>();
+
+    /*
+     * Ydt map to keep the track of multi instance node added under current
+     * parent node.
+     */
+    private final Map<YangSchemaNodeIdentifier,
+            List<YdtNode<YdtMultiInstanceNode>>> ydtMultiInsMap =
             new HashMap<>();
 
     /*
@@ -134,11 +135,6 @@
     private YdtContextOperationType ydtContextOperationType;
 
     /*
-     * Key object for ydtNodeMap.
-     */
-    private YangSchemaNodeIdentifier id;
-
-    /*
      * Ydt map to keep the track of application information object
      * with respective type.
      */
@@ -147,6 +143,26 @@
     private YdtContext clonedNode;
 
     /**
+     * Creates a specific type of node.
+     *
+     * @param type of YDT node
+     * @param node schema node
+     */
+    YdtNode(YdtType type, YangSchemaNode node) {
+        ydtType = type;
+        yangSchemaNode = node;
+    }
+
+    /**
+     * Creates a specific type of node.
+     *
+     * @param type of YDT node
+     */
+    YdtNode(YdtType type) {
+        ydtType = type;
+    }
+
+    /**
      * Returns the cloned ydt node.
      *
      * @return clonedNode cloned ydt node
@@ -166,12 +182,17 @@
 
     @Override
     public String getName() {
-        return id.getName();
+        return yangSchemaNode.getName();
     }
 
     @Override
     public String getNamespace() {
-        return id.getNameSpace();
+        return yangSchemaNode.getNameSpace().getModuleNamespace();
+    }
+
+    @Override
+    public String getModuleNameAsNameSpace() {
+        return yangSchemaNode.getNameSpace().getModuleName();
     }
 
     @Override
@@ -223,15 +244,21 @@
         ydtAppInfoMap.put(appType, object);
     }
 
-    @Override
+    /**
+     * Returns child schema node context information. It is used by YMS to
+     * obtain the child schema corresponding to data node identifier.
+     *
+     * @param id represents a identifier of YANG data tree node
+     * @return YANG data node context information
+     * @throws YdtException when user requested node schema doesn't exist
+     */
     public YangSchemaNodeContextInfo getSchemaNodeContextInfo(
-            YangSchemaNodeIdentifier id) {
+            YangSchemaNodeIdentifier id) throws YdtException {
         try {
             return getYangSchemaNode().getChildSchema(id);
         } catch (DataModelException e) {
-            errorHandler(e.getLocalizedMessage(), this);
+            throw new YdtException(e.getLocalizedMessage());
         }
-        return null;
     }
 
     /**
@@ -243,18 +270,20 @@
      *
      * @param value value in a single instance node
      */
-    public void addValue(String value) {
-        errorHandler(
-                errorMsg(FMT_VAL_N, getYdtNodeIdentifier().getName()), this);
+    public void addValue(String value) throws YdtException {
+        throw new YdtException(errorMsg(FMT_VAL_N, getName()));
     }
 
     /**
      * Creates the list of key element's of multi instance node.
-     * this will not be applicable on leaf and leaf-list node.
+     * This will not be applicable on leaf and leaf-list node.
+     *
+     * @throws YdtException when user requested multi instance node is missing
+     *                      any of the key element in request or requested
+     *                      node is of type other then multi instance node
      */
-    public void createKeyNodeList() {
-        errorHandler(errorMsg(
-                FMT_KLIST_STR, getYdtNodeIdentifier().getName()), this);
+    public void createKeyNodeList() throws YdtException {
+        throw new YdtException(errorMsg(FMT_NON_LIST_STR, getName()));
     }
 
     /**
@@ -266,11 +295,12 @@
      * This will be applicable in case of call from SBI so no need
      * to validate the value.
      *
-     * @param value value in a single instance leaf node
+     * @param value     value in a single instance leaf node
+     * @param isKeyLeaf true, for key leaf; false non key leaf
      */
-    public void addValueWithoutValidation(String value) {
-        errorHandler(
-                errorMsg(FMT_VAL_N, getYdtNodeIdentifier().getName()), this);
+    public void addValueWithoutValidation(String value, boolean isKeyLeaf)
+            throws YdtException {
+        throw new YdtException(errorMsg(FMT_VAL_N, getName()));
     }
 
     /**
@@ -282,9 +312,8 @@
      *
      * @param valueSet valueSet in a multi instance leaf node
      */
-    public void addValueSet(Set<String> valueSet) {
-        errorHandler(
-                errorMsg(FMT_VAL_NS, getYdtNodeIdentifier().getName()), this);
+    public void addValueSet(Set<String> valueSet) throws YdtException {
+        throw new YdtException(errorMsg(FMT_VAL_NS, getName()));
     }
 
     /**
@@ -298,9 +327,9 @@
      *
      * @param valueSet valueSet in a multi instance leaf node
      */
-    public void addValueSetWithoutValidation(Set<String> valueSet) {
-        errorHandler(
-                errorMsg(FMT_VAL_NS, getYdtNodeIdentifier().getName()), this);
+    public void addValueSetWithoutValidation(Set<String> valueSet)
+            throws YdtException {
+        throw new YdtException(errorMsg(FMT_VAL_NS, getName()));
     }
 
     /**
@@ -310,7 +339,7 @@
      * the duplicate entry found. Subclasses may override this method
      * to provide the correct behavior for their specific implementation.
      */
-    public void validDuplicateEntryProcessing() {
+    void validDuplicateEntryProcessing() throws YdtException {
     }
 
     /**
@@ -318,36 +347,27 @@
      *
      * @param id represents a identifier of YANG data tree node
      * @return YDT node
+     * @throws YdtException when user requested node already part of YDT tree.
      */
-    public YdtNode getCollidingChild(YangSchemaNodeIdentifier id) {
+    public YdtNode getCollidingChild(YangSchemaNodeIdentifier id)
+            throws YdtException {
 
         // Find the key in YDT map for getting the colliding node.
-        List<YdtNode<T>> collidingChild = ydtNodeMap.get(id);
+        YdtNode collidingChild = ydtNodeMap.get(id);
 
         /*
          * If colliding child exist then process colliding node in respective
          * YDT node type.
          */
         if (collidingChild != null) {
-            collidingChild.get(0).validDuplicateEntryProcessing();
-            return collidingChild.get(0);
+            collidingChild.validDuplicateEntryProcessing();
+            return collidingChild;
         }
 
         return null;
     }
 
     /**
-     * Creates a specific type of node.
-     *
-     * @param type of YDT node
-     * @param id   node identifier of the YDT node
-     */
-    YdtNode(YdtType type, YangSchemaNodeIdentifier id) {
-        ydtType = type;
-        setId(id);
-    }
-
-    /**
      * Sets the parent of node.
      *
      * @param parent node
@@ -393,17 +413,13 @@
     }
 
     @Override
-    public String getValue() {
-        errorHandler(
-                errorMsg(FMT_VAL_IN, getYdtNodeIdentifier().getName()), this);
-        return null;
+    public String getValue() throws YdtException {
+        throw new YdtException(errorMsg(FMT_VAL_IN, getName()));
     }
 
     @Override
-    public Set<String> getValueSet() {
-        errorHandler(
-                errorMsg(FMT_VAL_INS, getYdtNodeIdentifier().getName()), this);
-        return null;
+    public Set<String> getValueSet() throws YdtException {
+        throw new YdtException(errorMsg(FMT_VAL_INS, getName()));
     }
 
     /**
@@ -424,23 +440,6 @@
         lastChild = child;
     }
 
-    /**
-     * Returns object node identifier.
-     *
-     * @return node identifier
-     */
-    public YangSchemaNodeIdentifier getYdtNodeIdentifier() {
-        return id;
-    }
-
-    /**
-     * Sets object node identifier.
-     *
-     * @param id node identifier
-     */
-    public void setId(YangSchemaNodeIdentifier id) {
-        this.id = id;
-    }
 
     /**
      * Adds a child node.
@@ -455,7 +454,7 @@
             throws YdtException {
 
         if (!(newChild instanceof YdtNode)) {
-            errorHandler(errorMsg(E_SUPPORT), this);
+            throw new YdtException(errorMsg(E_SUPPORT));
         }
 
         YdtNode node = (YdtNode) newChild;
@@ -463,19 +462,19 @@
         if (node.getParent() == null) {
             node.setParent(this);
         } else if (!node.getParent().equals(this)) {
-            errorHandler(errorMsg(E_EXIST), this);
+            throw new YdtException(E_EXIST);
         }
 
         if (node.getFirstChild() != null && isAtomic) {
-            errorHandler(errorMsg(E_ATOMIC), this);
+            throw new YdtException(E_ATOMIC);
         }
 
         if (node.getNextSibling() != null) {
-            errorHandler(errorMsg(E_SIB), this);
+            throw new YdtException(E_SIB);
         }
 
         if (node.getPreviousSibling() != null) {
-            errorHandler(errorMsg(E_PRE), this);
+            throw new YdtException(E_PRE);
         }
 
         // If new node needs to be added as first child.
@@ -507,16 +506,41 @@
     }
 
     /**
-     * Updates ydt map of current context parent node.
+     * Updates ydt maps of current context parent node.
+     *
+     * @param node ydt node for which map need to be updated
+     */
+    void updateYdtMap(YdtNode node) {
+
+        YangSchemaNodeIdentifier id = node.getYangSchemaNode()
+                .getYangSchemaNodeIdentifier();
+        /*
+         * If node to be added is of type multi instance node(list) then multi
+         * instance node to be updated
+         */
+        if (node.getYdtType() == YdtType.MULTI_INSTANCE_NODE) {
+            updateMultiInsMap(id, node);
+        }
+
+        /*
+         * If entry for multi instance node is already there with same id then
+         * existing entry will be overwritten by the new entry.
+         */
+        ydtNodeMap.put(id, node);
+    }
+
+    /**
+     * Updates ydt multi instance map of current context parent node.
      *
      * @param id   object node identifier
      * @param node ydt node for which map need to be updated
      */
-    public void updateYdtMap(YangSchemaNodeIdentifier id, YdtNode node) {
-        List<YdtNode<T>> list = ydtNodeMap.get(id);
+    private void updateMultiInsMap(YangSchemaNodeIdentifier id, YdtNode node) {
+
+        List<YdtNode<YdtMultiInstanceNode>> list = ydtMultiInsMap.get(id);
         if (list == null) {
             list = new ArrayList<>();
-            ydtNodeMap.put(id, list);
+            ydtMultiInsMap.put(id, list);
         }
         list.add(node);
     }
@@ -540,139 +564,45 @@
     }
 
     /**
-     * Validates all multi Instance inside current context.
+     * Validates all multi Instance nodes inside current context.
      */
-    public void validateMultiInstanceNode() {
+    public void validateMultiInstanceNode() throws YdtException {
 
         // Set for checking whether input string is unique or not.
         Set<String> keyStringSet = new HashSet<>();
 
-        // Iterating over values in map and find multi instance node list only.
-        for (List<YdtNode<T>> ydtNodeList : ydtNodeMap.values()) {
-            validateInstances(keyStringSet, ydtNodeList);
-        }
-    }
-
-    /**
-     * Checks for any duplicate list entries.
-     *
-     * @param keyStringSet set to validate the composite key of an instance
-     * @param ydtNodeList  list of entries
-     */
-    private void validateInstances(Set<String> keyStringSet,
-                                   List<YdtNode<T>> ydtNodeList) {
-        // Clearing the set.
-        keyStringSet.clear();
-
-        if (ydtNodeList.get(0) instanceof YdtMultiInstanceNode) {
-
-            // Storing the number of multiInstance node for number
-            // if instance validation.
-            int instanceCount = ydtNodeList.size();
-
-            YangList list = (YangList) ydtNodeList.get(0).getYangSchemaNode();
-            int minElement;
-            int maxElement;
-            if (list.getMinElements() != null) {
-                minElement = list.getMinElements().getMinElement();
-                if (instanceCount < minElement) {
-                    errorHandler(errorMsg(FMT_FEW_INS, list.getName(),
-                                          minElement), this);
-                }
-            }
-
-            if (list.getMaxElements() != null) {
-                maxElement = list.getMaxElements().getMaxElement();
-                if (instanceCount > maxElement) {
-                    errorHandler(errorMsg(FMT_MANY_INS, list.getName(),
-                                          maxElement), this);
-                }
-            }
-
-            if (list.isConfig() && instanceCount > 1) {
-                // Iterating over values in ydtNodeList of
-                // multiInstanceNode and compare the key string.
-                for (YdtNode ydtNode : ydtNodeList) {
-                    if (!keyStringSet.add(((YdtMultiInstanceNode) ydtNode)
-                                                  .getCompositeKey())) {
-                        errorHandler(errorMsg(
-                                FMT_UNI_KEY, ydtNode.getYdtNodeIdentifier()
-                                        .getName()), this);
-                    }
+        if (ydtMultiInsMap.size() != 0) {
+            /*
+             * Iterating over values in map and find multi instance node list
+             * only.
+             */
+            for (List<YdtNode<YdtMultiInstanceNode>> ydtNodeList :
+                    ydtMultiInsMap.values()) {
+                try {
+                    ydtNodeList.get(0).validateInstances(keyStringSet,
+                                                         ydtNodeList);
+                } catch (YdtException e) {
+                    throw new YdtException(e.getLocalizedMessage());
                 }
             }
         }
     }
 
     /**
-     * Walks in whole Ydt Tree and de-reference all the tree node.
-     * This will be called only when any exception occurs while processing
-     * the node in Ydt tree.
+     * Validates the given list of instances by verifying the allowed
+     * instance count and key element uniqueness.
+     * <p>
+     * This default implementation do nothing if requested node is of type
+     * other then multiInstanceNode. Subclasses may override this method
+     * to provide the correct behavior for their specific implementation.
      *
-     * @param node ydt node
+     * @param keyStringSet set to validate the key element uniqueness
+     * @param ydtNodeList  list of instance's of same list
      */
-    public void freeRestResources(YdtNode node) {
-        // Traversing to logical rootNode.
-        YdtNode rootNode = node;
-        while (rootNode.getParent() != null) {
-            rootNode = rootNode.getParent();
-        }
-        YdtNode currentNode = rootNode;
-        while (currentNode != null) {
+    void validateInstances(Set<String> keyStringSet,
+                           List<YdtNode<YdtMultiInstanceNode>>
+                                   ydtNodeList) throws YdtException {
 
-            // Move down to first child
-            YdtNode nextNode = currentNode.getFirstChild();
-            if (nextNode != null) {
-                currentNode = nextNode;
-                continue;
-            }
-
-            // No child nodes, so walk tree
-            while (currentNode != null) {
-                // To keep the track of last sibling.
-                YdtNode lastSibling = currentNode;
-
-                // Move to sibling if possible.
-                nextNode = currentNode.getNextSibling();
-
-                // free currentNode resources
-                free(lastSibling);
-
-                lastSibling.getNamespace();
-                if (nextNode != null) {
-                    currentNode = nextNode;
-                    break;
-                }
-
-                // Move up
-                if (currentNode.equals(rootNode)) {
-                    currentNode = null;
-                } else {
-                    currentNode = currentNode.getParent();
-                    lastSibling.setParent(null);
-                }
-            }
-        }
-    }
-
-    /**
-     * Free the give YDT node by de-referencing it to null.
-     *
-     * @param node node to be freed
-     */
-    private void free(YdtNode node) {
-        if (node.getParent() != null) {
-            YdtNode parent = node.getParent();
-            parent.setChild(null);
-            parent.setLastChild(null);
-            if (node.getNextSibling() != null) {
-                parent.setChild(node.getNextSibling());
-            }
-        }
-        YdtNode parentRef = node.getParent();
-        node = new YdtSingleInstanceNode(null);
-        node.ydtType = null;
-        node.setParent(parentRef);
     }
 
     /**
@@ -691,17 +621,4 @@
         clonedNode.setLastChild(null);
         return clonedNode;
     }
-
-    /**
-     * Handles an error scenario, freeing allocated resources for the given YTD
-     * node before throwing an exception with the specified error message.
-     *
-     * @param error   error message
-     * @param curNode ydt node
-     * @throws YdtException with the specified error message
-     */
-    public void errorHandler(String error, YdtNode curNode) {
-        curNode.freeRestResources(curNode);
-        throw new YdtException(error);
-    }
 }
diff --git a/apps/yms/app/src/main/java/org/onosproject/yms/app/ydt/YdtNodeFactory.java b/apps/yms/app/src/main/java/org/onosproject/yms/app/ydt/YdtNodeFactory.java
index 43680da..aa84cea 100644
--- a/apps/yms/app/src/main/java/org/onosproject/yms/app/ydt/YdtNodeFactory.java
+++ b/apps/yms/app/src/main/java/org/onosproject/yms/app/ydt/YdtNodeFactory.java
@@ -17,17 +17,14 @@
 package org.onosproject.yms.app.ydt;
 
 import org.onosproject.yangutils.datamodel.YangSchemaNode;
-import org.onosproject.yangutils.datamodel.YangSchemaNodeIdentifier;
 import org.onosproject.yangutils.datamodel.YangSchemaNodeType;
+import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
 import org.onosproject.yms.app.ydt.exceptions.YdtException;
-import org.onosproject.yms.ydt.YdtContextOperationType;
 
 import static org.onosproject.yangutils.datamodel.YangSchemaNodeType.YANG_MULTI_INSTANCE_LEAF_NODE;
 import static org.onosproject.yangutils.datamodel.YangSchemaNodeType.YANG_MULTI_INSTANCE_NODE;
 import static org.onosproject.yangutils.datamodel.YangSchemaNodeType.YANG_SINGLE_INSTANCE_LEAF_NODE;
 import static org.onosproject.yangutils.datamodel.YangSchemaNodeType.YANG_SINGLE_INSTANCE_NODE;
-import static org.onosproject.yms.app.ydt.YdtAppNodeOperationType.DELETE_ONLY;
-import static org.onosproject.yms.app.ydt.YdtAppNodeOperationType.OTHER_EDIT;
 import static org.onosproject.yms.app.ydt.YdtConstants.errorMsg;
 
 /**
@@ -36,9 +33,13 @@
  */
 final class YdtNodeFactory {
 
-    // ydt formatted error string
+    // YDT formatted error string
     private static final String FMT_NOT_EXIST =
             "Schema node with name %s doesn't exist.";
+    //TODO need to handle later
+    private static final String E_MULTI_INS =
+            "Requested interface adds an instance of type list or " +
+                    "leaf-list node only.";
 
     // No instantiation
     private YdtNodeFactory() {
@@ -48,64 +49,68 @@
      * Returns a YANG data tree node for a given name, set of values and
      * instance type.
      *
-     * @param id          dataNodeIdentifier of data tree node
-     * @param schemaNode  data node as per YANG schema metadata
+     * @param node        data node as per YANG schema metadata
      * @param cardinality requested cardinality of node
      * @param callType    identify the call type
      * @return YANG data tree node
+     * @throws YdtException when user requested node type doesn't exist
      */
-    protected static YdtNode getNode(YangSchemaNodeIdentifier id,
-                                     YangSchemaNode schemaNode,
-                                     RequestedCardinality cardinality,
-                                     RequestedCallType callType) {
+    static YdtNode getNode(
+            YangSchemaNode node, RequestedCardinality cardinality,
+            RequestedCallType callType) throws YdtException {
 
-        YdtNode newNode = null;
-        YangSchemaNodeType nodeType = schemaNode.getYangSchemaNodeType();
+        YdtNode newNode;
+        YangSchemaNodeType type = node.getYangSchemaNodeType();
 
-        switch (cardinality) {
+        try {
+            switch (cardinality) {
 
-            case UNKNOWN:
+                case UNKNOWN:
+                    /*
+                     * if requested node type is UNKNOWN, check corresponding
+                     * yang data node type and create respective type node.
+                     */
+                    newNode = getYangSchemaNodeTypeSpecificContext(node, type,
+                                                                   callType);
+                    break;
+
                 /*
-                 * if requested node type is UNKNOWN, check corresponding
-                 * yang data node type and create respective type node.
+                 * if requested node type is specified and it exist as node of
+                 * some other type in data model then throw exception
                  */
-                newNode = getYangSchemaNodeTypeSpecificContext(id, nodeType,
-                                                               callType);
-                break;
+                case SINGLE_INSTANCE:
+                    validateNodeType(node, type, YANG_SINGLE_INSTANCE_NODE);
+                    newNode = new YdtSingleInstanceNode(node);
+                    break;
 
-            /*
-             * if requested node type is specified and it exist as node of some
-             * other type in data model then throw exception
-             */
-            case SINGLE_INSTANCE:
-                validateNodeType(id, nodeType, YANG_SINGLE_INSTANCE_NODE);
-                newNode = new YdtSingleInstanceNode(id);
-                break;
+                case MULTI_INSTANCE:
 
-            case MULTI_INSTANCE:
+                    validateNodeType(node, type, YANG_MULTI_INSTANCE_NODE);
+                    newNode = new YdtMultiInstanceNode(node);
+                    break;
 
-                validateNodeType(id, nodeType, YANG_MULTI_INSTANCE_NODE);
-                newNode = new YdtMultiInstanceNode(id);
-                break;
+                case SINGLE_INSTANCE_LEAF:
 
-            case SINGLE_INSTANCE_LEAF:
+                    validateNodeType(node, type, YANG_SINGLE_INSTANCE_LEAF_NODE);
+                    newNode = new YdtSingleInstanceLeafNode(node);
+                    break;
 
-                validateNodeType(id, nodeType, YANG_SINGLE_INSTANCE_LEAF_NODE);
-                newNode = new YdtSingleInstanceLeafNode(id);
-                break;
+                case MULTI_INSTANCE_LEAF:
 
-            case MULTI_INSTANCE_LEAF:
+                    validateNodeType(node, type, YANG_MULTI_INSTANCE_LEAF_NODE);
+                    newNode = new YdtMultiInstanceLeafNode(node);
+                    break;
 
-                validateNodeType(id, nodeType, YANG_MULTI_INSTANCE_LEAF_NODE);
-                newNode = new YdtMultiInstanceLeafNode(id);
-                break;
-
-            default:
-                throwNotExistError(id);
+                default:
+                    newNode = null;
+            }
+        } catch (DataModelException | YdtException e) {
+            throw new YdtException(e.getLocalizedMessage());
         }
 
-        // set reference of yang data node in the requested node.
-        newNode.setYangSchemaNode(schemaNode);
+        if (newNode == null) {
+            throw new YdtException(errorMsg(FMT_NOT_EXIST, node.getName()));
+        }
 
         return newNode;
     }
@@ -114,15 +119,17 @@
      * Validates the requested ydt node type against the schema node type,
      * if it is not equal then it will throw warning.
      *
-     * @param id            dataNodeIdentifier of data tree node
+     * @param node          schema node
      * @param nodeType      actual node type
      * @param requestedType user requested node type
+     * @throws YdtException when user requested node type doesn't exist
      */
-    private static void validateNodeType(YangSchemaNodeIdentifier id,
-                                         YangSchemaNodeType nodeType,
-                                         YangSchemaNodeType requestedType) {
+    private static void validateNodeType(
+            YangSchemaNode node, YangSchemaNodeType nodeType,
+            YangSchemaNodeType requestedType) throws YdtException {
+
         if (nodeType != requestedType) {
-            throwNotExistError(id);
+            throw new YdtException(errorMsg(FMT_NOT_EXIST, node.getName()));
         }
     }
 
@@ -130,127 +137,87 @@
      * Creates Yang data tree node of YangSchemaNode type specific for
      * requestedCardinality of type UNKNOWN and returns the same.
      *
-     * @param id       node identifier of data tree node
+     * @param node     schema node
      * @param nodeType schema node type as per YANG schema metadata
      * @param callType identify the call type
      * @return YANG data tree node
+     * @throws YdtException when user requested node type doesn't exist
      */
     private static YdtNode getYangSchemaNodeTypeSpecificContext(
-            YangSchemaNodeIdentifier id,
-            YangSchemaNodeType nodeType,
-            RequestedCallType callType) {
+            YangSchemaNode node, YangSchemaNodeType nodeType,
+            RequestedCallType callType) throws YdtException, DataModelException {
         switch (callType) {
             case LEAF:
                 switch (nodeType) {
 
                     case YANG_SINGLE_INSTANCE_LEAF_NODE:
-                        return new YdtSingleInstanceLeafNode(id);
+                        return new YdtSingleInstanceLeafNode(node);
 
                     case YANG_MULTI_INSTANCE_LEAF_NODE:
-                        return new YdtMultiInstanceLeafNode(id);
+                        return new YdtMultiInstanceLeafNode(node);
 
                     default:
-                        throwNotExistError(id);
+                        return null;
                 }
 
-            case OTHER:
+            case NON_LEAF:
                 switch (nodeType) {
 
                     case YANG_SINGLE_INSTANCE_NODE:
-                        return new YdtSingleInstanceNode(id);
+                        return new YdtSingleInstanceNode(node);
 
                     case YANG_MULTI_INSTANCE_NODE:
-                        return new YdtMultiInstanceNode(id);
+                        return new YdtMultiInstanceNode(node);
 
                     default:
-                        throwNotExistError(id);
+                        return null;
                 }
 
             case MULTI_INSTANCE:
                 switch (nodeType) {
 
                     case YANG_MULTI_INSTANCE_LEAF_NODE:
-                        return new YdtMultiInstanceLeafNode(id);
+                        return new YdtMultiInstanceLeafNode(node);
 
                     case YANG_MULTI_INSTANCE_NODE:
-                        return new YdtMultiInstanceNode(id);
+                        return new YdtMultiInstanceNode(node);
 
                     default:
-                        throwNotExistError(id);
+                        throw new YdtException(E_MULTI_INS);
                 }
 
             default:
-                throwNotExistError(id);
+                return null;
         }
-
-        return null;
     }
 
     /**
      * Create Yang data tree node of YangSchemaNode type specific and
      * returns the same.
      *
-     * @param id       node identifier of data tree node
-     * @param nodeType schema node type as per YANG schema metadata
+     * @param node schema node
      * @return YANG data tree node
+     * @throws YdtException when user requested node type doesn't exist
      */
-    protected static YdtNode getYangSchemaNodeTypeSpecificContext(
-            YangSchemaNodeIdentifier id,
-            YangSchemaNodeType nodeType) {
+    static YdtNode getYangSchemaNodeTypeSpecificContext(YangSchemaNode node)
+            throws YdtException {
 
-        switch (nodeType) {
+        switch (node.getYangSchemaNodeType()) {
 
             case YANG_SINGLE_INSTANCE_LEAF_NODE:
-                return new YdtSingleInstanceLeafNode(id);
+                return new YdtSingleInstanceLeafNode(node);
 
             case YANG_MULTI_INSTANCE_LEAF_NODE:
-                return new YdtMultiInstanceLeafNode(id);
+                return new YdtMultiInstanceLeafNode(node);
 
             case YANG_SINGLE_INSTANCE_NODE:
-                return new YdtSingleInstanceNode(id);
+                return new YdtSingleInstanceNode(node);
 
             case YANG_MULTI_INSTANCE_NODE:
-                return new YdtMultiInstanceNode(id);
+                return new YdtMultiInstanceNode(node);
 
             default:
-                throwNotExistError(id);
+                throw new YdtException(errorMsg(FMT_NOT_EXIST, node.getName()));
         }
-
-        return null;
-    }
-
-    /**
-     * Returns the app tree operation type with the help of YdtOperation type.
-     *
-     * @param opType ydt operation type
-     * @return app tree operation type
-     */
-    protected static YdtAppNodeOperationType getAppOpTypeFromYdtOpType(
-            YdtContextOperationType opType) {
-        // Get the app tree operation type.
-        switch (opType) {
-            case CREATE:
-            case MERGE:
-            case REPLACE:
-                return OTHER_EDIT;
-
-            case DELETE:
-            case REMOVE:
-                return DELETE_ONLY;
-
-            default:
-                return null;
-            //TODO handle the default data type.
-        }
-    }
-
-    /**
-     * Throws exception for requested ydt node by preparing error message with
-     * given node identifier.
-     *
-     * @param id node identifier
-     */
-    private static void throwNotExistError(YangSchemaNodeIdentifier id) {
-        throw new YdtException(errorMsg(FMT_NOT_EXIST, id.getName()));
     }
 }
diff --git a/apps/yms/app/src/main/java/org/onosproject/yms/app/ydt/YdtSingleInstanceLeafNode.java b/apps/yms/app/src/main/java/org/onosproject/yms/app/ydt/YdtSingleInstanceLeafNode.java
index 0bd7036..44de72e 100644
--- a/apps/yms/app/src/main/java/org/onosproject/yms/app/ydt/YdtSingleInstanceLeafNode.java
+++ b/apps/yms/app/src/main/java/org/onosproject/yms/app/ydt/YdtSingleInstanceLeafNode.java
@@ -16,7 +16,8 @@
 
 package org.onosproject.yms.app.ydt;
 
-import org.onosproject.yangutils.datamodel.YangSchemaNodeIdentifier;
+import org.onosproject.yangutils.datamodel.YangSchemaNode;
+import org.onosproject.yms.app.ydt.exceptions.YdtException;
 
 import static org.onosproject.yms.app.ydt.YdtConstants.FMT_DUP_ENTRY;
 import static org.onosproject.yms.app.ydt.YdtConstants.errorMsg;
@@ -33,13 +34,27 @@
      */
     private String value;
 
+    /*
+     * Value of the leaf.
+     */
+    private Boolean isKeyLeaf = false;
+
     /**
      * Creates a YANG single instance leaf node.
      *
-     * @param id node identifier of YDT single instance leaf node
+     * @param node schema of YDT single instance leaf node
      */
-    protected YdtSingleInstanceLeafNode(YangSchemaNodeIdentifier id) {
-        super(SINGLE_INSTANCE_LEAF_VALUE_NODE, id);
+    YdtSingleInstanceLeafNode(YangSchemaNode node) {
+        super(SINGLE_INSTANCE_LEAF_VALUE_NODE, node);
+    }
+
+    /**
+     * Returns the flag indicating that requested leaf is key-leaf or not.
+     *
+     * @return isKeyLeaf true, for key leaf; false non key leaf
+     */
+    public Boolean isKeyLeaf() {
+        return isKeyLeaf;
     }
 
     @Override
@@ -48,13 +63,14 @@
     }
 
     @Override
-    public void addValue(String value) {
+    public void addValue(String value) throws YdtException {
         // Check the value against corresponding data-type.
-        try {
-            getYangSchemaNode().isValueValid(value);
-        } catch (Exception e) {
-            errorHandler(e.getLocalizedMessage(), this);
-        }
+        //TODO validation need to be decided
+//        try {
+//            getYangSchemaNode().isValueValid(value);
+//        } catch (Exception e) {
+//            throw new YdtException(e.getLocalizedMessage());
+//        }
 
         // After validation is successful then add value to node.
         this.value = value;
@@ -62,13 +78,13 @@
 
 
     @Override
-    public void addValueWithoutValidation(String value) {
+    public void addValueWithoutValidation(String value, boolean isKeyLeaf) {
         this.value = value;
+        this.isKeyLeaf = isKeyLeaf;
     }
 
     @Override
-    public void validDuplicateEntryProcessing() {
-        errorHandler(errorMsg(FMT_DUP_ENTRY, getYdtNodeIdentifier().getName()),
-                     this);
+    public void validDuplicateEntryProcessing() throws YdtException {
+        throw new YdtException(errorMsg(FMT_DUP_ENTRY, getName()));
     }
 }
diff --git a/apps/yms/app/src/main/java/org/onosproject/yms/app/ydt/YdtSingleInstanceNode.java b/apps/yms/app/src/main/java/org/onosproject/yms/app/ydt/YdtSingleInstanceNode.java
index b7f84b5..c8e66e6 100644
--- a/apps/yms/app/src/main/java/org/onosproject/yms/app/ydt/YdtSingleInstanceNode.java
+++ b/apps/yms/app/src/main/java/org/onosproject/yms/app/ydt/YdtSingleInstanceNode.java
@@ -16,7 +16,8 @@
 
 package org.onosproject.yms.app.ydt;
 
-import org.onosproject.yangutils.datamodel.YangSchemaNodeIdentifier;
+import org.onosproject.yangutils.datamodel.YangSchemaNode;
+import org.onosproject.yms.app.ydt.exceptions.YdtException;
 
 import static org.onosproject.yms.app.ydt.YdtConstants.FMT_DUP_ENTRY;
 import static org.onosproject.yms.app.ydt.YdtConstants.errorMsg;
@@ -30,15 +31,14 @@
     /**
      * Creates a YANG single instance node object.
      *
-     * @param id node identifier of YDT single instance node
+     * @param node schema of YDT single instance node
      */
-    protected YdtSingleInstanceNode(YangSchemaNodeIdentifier id) {
-        super(SINGLE_INSTANCE_NODE, id);
+    YdtSingleInstanceNode(YangSchemaNode node) {
+        super(SINGLE_INSTANCE_NODE, node);
     }
 
     @Override
-    public void validDuplicateEntryProcessing() {
-        errorHandler(errorMsg(FMT_DUP_ENTRY, getYdtNodeIdentifier().getName()),
-                     this);
+    public void validDuplicateEntryProcessing() throws YdtException {
+        throw new YdtException(errorMsg(FMT_DUP_ENTRY, getName()));
     }
 }
diff --git a/apps/yms/app/src/main/java/org/onosproject/yms/app/ydt/YdtUtils.java b/apps/yms/app/src/main/java/org/onosproject/yms/app/ydt/YdtUtils.java
new file mode 100644
index 0000000..a9f15f2
--- /dev/null
+++ b/apps/yms/app/src/main/java/org/onosproject/yms/app/ydt/YdtUtils.java
@@ -0,0 +1,303 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.onosproject.yms.app.ydt;
+
+import org.onosproject.yangutils.datamodel.YangAugment;
+import org.onosproject.yangutils.datamodel.YangSchemaNode;
+import org.onosproject.yangutils.datamodel.YangSchemaNodeContextInfo;
+import org.onosproject.yangutils.datamodel.YangSchemaNodeIdentifier;
+import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
+import org.onosproject.yms.app.ydt.exceptions.YdtException;
+import org.onosproject.yms.ydt.YdtContextOperationType;
+
+import static org.onosproject.yms.app.ydt.YdtAppNodeOperationType.DELETE_ONLY;
+import static org.onosproject.yms.app.ydt.YdtAppNodeOperationType.OTHER_EDIT;
+import static org.onosproject.yms.app.ydt.YdtConstants.errorMsg;
+import static org.onosproject.yms.ydt.YdtContextOperationType.CREATE;
+import static org.onosproject.yms.ydt.YdtContextOperationType.DELETE;
+import static org.onosproject.yms.ydt.YdtContextOperationType.MERGE;
+
+/**
+ * Utils to support yang data tree node creation.
+ */
+final class YdtUtils {
+
+    // YDT formatted error string
+    private static final String E_CREATE_OP =
+            "Create request is not allowed under delete operation.";
+    private static final String E_DELETE_OP =
+            "Delete request is not allowed under create operation.";
+    private static final String FMT_TOO_FEW =
+            "Too few key parameters in %s. Expected %d; actual %d.";
+    private static final String FMT_TOO_MANY =
+            "Too many key parameters in %s. Expected %d; actual %d.";
+
+    //No instantiation.
+    private YdtUtils() {
+    }
+
+    /**
+     * Returns the app tree operation type with the help of YdtOperation type.
+     *
+     * @param opType ydt operation type
+     * @return app tree operation type
+     */
+    static YdtAppNodeOperationType getAppOpTypeFromYdtOpType(
+            YdtContextOperationType opType) {
+        // Get the app tree operation type.
+        switch (opType) {
+            case CREATE:
+            case MERGE:
+            case REPLACE:
+                return OTHER_EDIT;
+
+            case DELETE:
+            case REMOVE:
+                return DELETE_ONLY;
+
+            default:
+                return null;
+            //TODO handle the default data type.
+        }
+    }
+
+    /**
+     * Validates the various combination of operation type.
+     *
+     * @param parentOpType Reference for parent node operation type
+     * @param childOpType  type of YANG data tree node operation
+     * @throws YdtException when user requested node operation type is
+     *                      not valid as per parent node operation type
+     */
+    private static void validateOperationType(YdtContextOperationType parentOpType,
+                                              YdtContextOperationType childOpType)
+            throws YdtException {
+
+        switch (parentOpType) {
+            case CREATE:
+                // Inside the create operation delete operation should not come.
+                if (childOpType == DELETE) {
+                    throw new YdtException(E_CREATE_OP);
+                }
+                break;
+            case DELETE:
+                // Inside the delete operation create operation should not come.
+                if (childOpType == CREATE) {
+                    throw new YdtException(E_DELETE_OP);
+                }
+                break;
+            default:
+                //TODO check all possible scenario.
+        }
+    }
+
+    /**
+     * Returns the operation type for non leaf node.
+     * When "operation" attribute for current node is not specified or null,
+     * then the operation applied to the parent data node of the
+     * configuration is used. If no parent data node is available,
+     * then the default-operation'value is used.
+     * If default operation type is not set, merge will be taken as default
+     * operation type.
+     *
+     * @param type    operation type of parent node
+     * @param defType YDT default operation type
+     * @return operation type for current non leaf node
+     */
+    private static YdtContextOperationType getOperationType(
+            YdtContextOperationType type, YdtContextOperationType defType) {
+        return type != null ? type : (defType != null ? defType : MERGE);
+    }
+
+    /**
+     * Returns the yang node identifier with requested name and namespace.
+     *
+     * @param name      name of the node
+     * @param namespace namespace of the node
+     * @return yang node identifier
+     */
+    static YangSchemaNodeIdentifier getNodeIdentifier(String name,
+                                                      String namespace) {
+        YangSchemaNodeIdentifier id = new YangSchemaNodeIdentifier();
+        id.setName(name);
+        id.setNameSpace(new NameSpace(namespace));
+        return id;
+    }
+
+    /**
+     * Checks the user supplied list of argument match's the expected value
+     * or not.
+     *
+     * @param name     name of the parent list/leaf-list node
+     * @param expected count suppose to be
+     * @param actual   user supplied values count
+     * @throws YdtException when user requested multi instance node instance's
+     *                      count doesn't fit into the allowed instance limit
+     */
+    static void checkElementCount(String name, int expected,
+                                  int actual) throws YdtException {
+        if (expected < actual) {
+            throw new YdtException(
+                    errorMsg(FMT_TOO_MANY, name, expected, actual));
+        } else if (expected > actual) {
+            throw new YdtException(
+                    errorMsg(FMT_TOO_FEW, name, expected, actual));
+        }
+    }
+
+    /**
+     * Returns the valid operation type for requested ydt node after performing
+     * validation.
+     *
+     * @param opType     user requested operation type
+     * @param newNode    new requested ydt node
+     * @param parentNode parent node under which new node to be added
+     * @return operation type
+     * @throws YdtException when user requested node operation type is
+     *                      not valid as per parent node operation type
+     */
+    static YdtContextOperationType getValidOpType(
+            YdtContextOperationType opType, YdtContextOperationType defOpType,
+            YdtNode newNode, YdtNode parentNode)
+            throws YdtException {
+
+        switch (newNode.getYdtType()) {
+
+            case SINGLE_INSTANCE_NODE:
+            case MULTI_INSTANCE_NODE:
+
+                // Reference for parent node operation type.
+                YdtContextOperationType parentOpType =
+                        parentNode.getYdtContextOperationType();
+
+                if (opType == null) {
+                    opType = getOperationType(parentOpType, defOpType);
+                } else if (parentOpType != null) {
+                    validateOperationType(parentOpType, opType);
+                }
+
+                return opType;
+
+            /*
+             * Nodes other then single/multi instance node does not support
+             * operation type so no need of validation for those.
+             */
+            default:
+                return null;
+        }
+    }
+
+    /**
+     * Returns augmenting node module yang schema node.
+     *
+     * @param id          schema node identifier
+     * @param contextInfo Yang Schema node context info
+     *                    which is having YangSchemaNode and
+     *                    ContextSwitchedNode
+     * @return augmenting node module yang schema node
+     * @throws YdtException when user requested node schema doesn't exist
+     */
+    public static YangSchemaNode getAugmentingSchemaNode(
+            YangSchemaNodeIdentifier id,
+            YangSchemaNodeContextInfo contextInfo) throws YdtException {
+        YangSchemaNode lastAugMod = null;
+        YangSchemaNode switchedNode =
+                contextInfo.getContextSwitchedNode();
+
+        // Finding the last augmenting schema for case/choice scenario.
+        while (switchedNode != null) {
+            if (switchedNode instanceof YangAugment) {
+                lastAugMod = switchedNode;
+            }
+            try {
+                switchedNode = switchedNode.getChildSchema(id)
+                        .getContextSwitchedNode();
+            } catch (DataModelException e) {
+                throw new YdtException(e.getMessage());
+            }
+        }
+        return lastAugMod;
+    }
+
+    /**
+     * De-reference all the tree node by walking the whole YDT from logical
+     * root node.
+     * This will be called only when any exception occurs while processing
+     * the node in Ydt tree.
+     *
+     * @param rootNode ydt logical root node
+     */
+    public static void freeRestResources(YdtNode rootNode) {
+
+        YdtNode currentNode = rootNode;
+        while (currentNode != null) {
+
+            // Move down to first child
+            YdtNode nextNode = currentNode.getFirstChild();
+            if (nextNode != null) {
+                currentNode = nextNode;
+                continue;
+            }
+
+            // No child nodes, so walk tree
+            while (currentNode != null) {
+                // To keep the track of last sibling.
+                YdtNode lastSibling = currentNode;
+
+                // Move to sibling if possible.
+                nextNode = currentNode.getNextSibling();
+
+                // free currentNode resources
+                free(lastSibling);
+
+                lastSibling.getNamespace();
+                if (nextNode != null) {
+                    currentNode = nextNode;
+                    break;
+                }
+
+                // Move up
+                if (currentNode.equals(rootNode)) {
+                    currentNode = null;
+                } else {
+                    currentNode = currentNode.getParent();
+                    lastSibling.setParent(null);
+                }
+            }
+        }
+    }
+
+    /**
+     * Free the give YDT node by de-referencing it to null.
+     *
+     * @param node node to be freed
+     */
+    private static void free(YdtNode node) {
+        if (node.getParent() != null) {
+            YdtNode parent = node.getParent();
+            parent.setChild(null);
+            parent.setLastChild(null);
+            if (node.getNextSibling() != null) {
+                parent.setChild(node.getNextSibling());
+            }
+        }
+        YdtNode parentRef = node.getParent();
+        node = new YdtLogicalNode(null, null);
+        node.setParent(parentRef);
+    }
+}
diff --git a/apps/yms/app/src/main/java/org/onosproject/yms/app/ydt/exceptions/YdtException.java b/apps/yms/app/src/main/java/org/onosproject/yms/app/ydt/exceptions/YdtException.java
index db21976..852ffd5 100644
--- a/apps/yms/app/src/main/java/org/onosproject/yms/app/ydt/exceptions/YdtException.java
+++ b/apps/yms/app/src/main/java/org/onosproject/yms/app/ydt/exceptions/YdtException.java
@@ -50,16 +50,4 @@
     public YdtException(Throwable cause) {
         super(cause);
     }
-
-    /**
-     * Creates a new YDT exception from given parameters.
-     *
-     * @param keyword identify error scenario whether it is many or few
-     * @param name    name of the node
-     * @param count   supported count value
-     */
-    public YdtException(String keyword, String name, int count) {
-        super("Too " + keyword + " key parameter in " + name + ". Expected " +
-                      "count " + count + ".");
-    }
 }
diff --git a/apps/yms/app/src/main/java/org/onosproject/yms/app/ymsm/YmsManager.java b/apps/yms/app/src/main/java/org/onosproject/yms/app/ymsm/YmsManager.java
index 475a67e..228dd02 100644
--- a/apps/yms/app/src/main/java/org/onosproject/yms/app/ymsm/YmsManager.java
+++ b/apps/yms/app/src/main/java/org/onosproject/yms/app/ymsm/YmsManager.java
@@ -33,6 +33,7 @@
 import org.onosproject.yms.app.ydt.YangRequestWorkBench;
 import org.onosproject.yms.app.ynh.YangNotificationExtendedService;
 import org.onosproject.yms.app.ynh.YangNotificationManager;
+import org.onosproject.yms.app.ysr.DefaultYangModuleLibrary;
 import org.onosproject.yms.app.ysr.DefaultYangSchemaRegistry;
 import org.onosproject.yms.app.ysr.YangSchemaRegistry;
 import org.onosproject.yms.ych.YangCodecHandler;
@@ -51,9 +52,11 @@
 
 import java.util.List;
 import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
 
+import static java.lang.String.valueOf;
+import static java.util.concurrent.Executors.newSingleThreadExecutor;
 import static org.onlab.util.Tools.groupedThreads;
+import static org.onosproject.yms.app.ych.defaultcodecs.YangCodecRegistry.initializeDefaultCodec;
 
 /**
  * Represents implementation of YANG management system manager.
@@ -72,8 +75,9 @@
     //module id generator should be used to generate a new module id for
     //each YSR instance. So YCH also should generate it.
     private IdGenerator moduleIdGenerator;
-    private ExecutorService schemaRegistryExecutor;
+    private ExecutorService executor;
     private YangNotificationExtendedService ynhExtendedService;
+    private YangModuleLibrary library;
 
     @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
     protected CoreService coreService;
@@ -82,23 +86,22 @@
     public void activate() {
         appId = coreService.registerApplication(APP_ID);
         moduleIdGenerator = coreService.getIdGenerator(MODULE_ID);
-        schemaRegistry = new DefaultYangSchemaRegistry(String.valueOf(
-                moduleIdGenerator.getNewId()));
-        schemaRegistryExecutor =
-                Executors.newSingleThreadExecutor(groupedThreads(
-                        "onos/apps/yang-management-system/schema-registry",
-                        "schema-registry-handler", log));
+        schemaRegistry = new DefaultYangSchemaRegistry();
+        library = new DefaultYangModuleLibrary(getNewModuleId());
+        executor = newSingleThreadExecutor(groupedThreads(
+                "onos/apps/yang-management-system/schema-registry",
+                "schema-registry-handler", log));
         ynhExtendedService = new YangNotificationManager(schemaRegistry);
-        //Initilize the default codecs
-        YangCodecRegistry.initializeDefaultCodec();
+        //Initialize the default codec
+        initializeDefaultCodec();
 
         log.info("Started");
     }
 
     @Deactivate
     public void deactivate() {
-        ((DefaultYangSchemaRegistry) schemaRegistry).flushYsrData();
-        schemaRegistryExecutor.shutdown();
+        schemaRegistry.flushYsrData();
+        executor.shutdown();
 
         // TODO implementation for other components.
         log.info("Stopped");
@@ -107,25 +110,23 @@
     @Override
     public YdtBuilder getYdtBuilder(String logicalRootName,
                                     String rootNamespace,
-                                    YmsOperationType operationType) {
+                                    YmsOperationType opType) {
         return new YangRequestWorkBench(logicalRootName, rootNamespace,
-                                        operationType, schemaRegistry, true);
+                                        opType, schemaRegistry, true);
     }
 
     @Override
     public YdtBuilder getYdtBuilder(String logicalRootName,
                                     String rootNamespace,
-                                    YmsOperationType operationType,
+                                    YmsOperationType opType,
                                     Object schemaRegistryForYdt) {
         if (schemaRegistryForYdt != null) {
-            return new YangRequestWorkBench(logicalRootName, rootNamespace,
-                                            operationType,
-                                            (YangSchemaRegistry)
-                                                    schemaRegistryForYdt,
-                                            false);
+            return new YangRequestWorkBench(
+                    logicalRootName, rootNamespace, opType,
+                    (YangSchemaRegistry) schemaRegistryForYdt, false);
         }
         return new YangRequestWorkBench(logicalRootName, rootNamespace,
-                                        operationType, schemaRegistry, true);
+                                        opType, schemaRegistry, true);
     }
 
     @Override
@@ -163,13 +164,13 @@
 
     @Override
     public YangModuleLibrary getYangModuleLibrary() {
-        return ((DefaultYangSchemaRegistry) schemaRegistry).getLibrary();
+        //TODO: get for YCH should be handled.
+        return library;
     }
 
     @Override
     public String getYangFile(YangModuleIdentifier moduleIdentifier) {
-        return ((DefaultYangSchemaRegistry) schemaRegistry)
-                .getYangFile(moduleIdentifier);
+        return schemaRegistry.getYangFile(moduleIdentifier);
     }
 
     @Override
@@ -181,9 +182,14 @@
     @Override
     public void registerService(Object manager, Class<?> service,
                                 List<String> features) {
-        schemaRegistryExecutor.execute(() -> {
+        //perform registration of service
+        executor.execute(() -> {
+
             schemaRegistry.registerApplication(manager, service);
-            processNotificationRegistration(service, manager);
+            //process notification registration.
+            processNotificationRegistration(manager, service);
+
+            schemaRegistry.processModuleLibrary(service.getName(), library);
         });
         // TODO implementation based on supported features.
     }
@@ -191,15 +197,15 @@
     /**
      * Process notification registration for manager class object.
      *
-     * @param service yang service
      * @param manager yang manager
+     * @param service service class
      */
-    private void processNotificationRegistration(Class<?> service,
-                                                 Object manager) {
-        if (manager != null && manager instanceof ListenerService) {
-            if (((DefaultYangSchemaRegistry) schemaRegistry)
-                    .verifyNotificationObject(service)) {
-                ynhExtendedService.registerAsListener((ListenerService) manager);
+    private void processNotificationRegistration(Object manager, Class<?> service) {
+        synchronized (service) {
+            if (manager != null && manager instanceof ListenerService) {
+                if (schemaRegistry.verifyNotificationObject(manager, service)) {
+                    ynhExtendedService.registerAsListener((ListenerService) manager);
+                }
             }
         }
     }
@@ -211,11 +217,10 @@
 
     @Override
     public YangCodecHandler getYangCodecHandler() {
-
-        YangSchemaRegistry yangSchemaRegistry =
-                new DefaultYangSchemaRegistry(
-                        String.valueOf(moduleIdGenerator.getNewId()));
-        return new DefaultYangCodecHandler(yangSchemaRegistry);
+        YangSchemaRegistry registry = new DefaultYangSchemaRegistry();
+        DefaultYangCodecHandler handler = new DefaultYangCodecHandler(registry);
+        handler.setLibrary(new DefaultYangModuleLibrary(getNewModuleId()));
+        return handler;
     }
 
     /**
@@ -226,4 +231,13 @@
     public YangSchemaRegistry getSchemaRegistry() {
         return schemaRegistry;
     }
+
+    /**
+     * Returns new generated module id.
+     *
+     * @return new module id
+     */
+    private String getNewModuleId() {
+        return valueOf(moduleIdGenerator.getNewId());
+    }
 }
diff --git a/apps/yms/app/src/main/java/org/onosproject/yms/app/ynh/YangNotificationManager.java b/apps/yms/app/src/main/java/org/onosproject/yms/app/ynh/YangNotificationManager.java
index 59da18c..a6d9f83 100644
--- a/apps/yms/app/src/main/java/org/onosproject/yms/app/ynh/YangNotificationManager.java
+++ b/apps/yms/app/src/main/java/org/onosproject/yms/app/ynh/YangNotificationManager.java
@@ -43,10 +43,22 @@
         implements YangNotificationExtendedService {
 
     private static final String YANG_NOTIFICATION = "yangnotification";
+
     private final Logger log = LoggerFactory.getLogger(getClass());
-    private final ExecutorService executor;
-    private final YnhAbstractListener listener;
-    private final YangSchemaRegistry schemaRegistry;
+
+    private ExecutorService executor;
+
+    /**
+     * YANG notification abstract listener. This listener will listens
+     * abstractly to all the notification from the application to which it
+     * has subscribed.
+     */
+    private YnhAbstractListener listener;
+
+    /**
+     * Maintains schema registry.
+     */
+    private YangSchemaRegistry schemaRegistry;
 
     /**
      * Creates an instance of YANG notification manager.
@@ -55,8 +67,8 @@
      */
     public YangNotificationManager(YangSchemaRegistry registry) {
         listener = new YnhAbstractListener();
-        executor = Executors.newSingleThreadExecutor(
-                groupedThreads("onos/yms", "event-handler-%d", log));
+        executor = Executors.newSingleThreadExecutor(groupedThreads(
+                "onos/yms", "event-handler-%d", log));
         schemaRegistry = registry;
     }
 
@@ -78,10 +90,12 @@
      */
     private class YnhAbstractListener<E extends Event> implements
             EventListener<E> {
+
         @Override
         public void event(Event event) {
             executor.execute(() -> {
                 try {
+                    log.info("Event received in ynh " + event.type());
                     /*
                      * Obtain YANG data tree corresponding to notification with
                      * logical root node as yangnotification, followed by
diff --git a/apps/yms/app/src/main/java/org/onosproject/yms/app/yob/YobUtils.java b/apps/yms/app/src/main/java/org/onosproject/yms/app/yob/YobUtils.java
index d72edc1..c8256c9 100644
--- a/apps/yms/app/src/main/java/org/onosproject/yms/app/yob/YobUtils.java
+++ b/apps/yms/app/src/main/java/org/onosproject/yms/app/yob/YobUtils.java
@@ -295,8 +295,8 @@
 
             }
 
-            Class<?> regClass = registry.getRegisteredClass(curSchemaNode,
-                                                            qualifiedClassName);
+            Class<?> regClass = registry.getRegisteredClass(curSchemaNode
+            );
             return regClass.getClassLoader();
 
         }
@@ -328,8 +328,7 @@
                     ((YangNode) augmentSchemaNode).getParent();
 
             Class<?> moduleClass = registry.getRegisteredClass(
-                    moduleNode, getCapitalCase(
-                            moduleNode.getJavaClassNameOrBuiltInType()));
+                    moduleNode);
             return moduleClass.getClassLoader();
         }
 
diff --git a/apps/yms/app/src/main/java/org/onosproject/yms/app/ysr/DefaultYangModuleIdentifier.java b/apps/yms/app/src/main/java/org/onosproject/yms/app/ysr/DefaultYangModuleIdentifier.java
index e98e982..8f0af27 100644
--- a/apps/yms/app/src/main/java/org/onosproject/yms/app/ysr/DefaultYangModuleIdentifier.java
+++ b/apps/yms/app/src/main/java/org/onosproject/yms/app/ysr/DefaultYangModuleIdentifier.java
@@ -26,7 +26,7 @@
 /**
  * Representation of default YANG module identifier.
  */
-class DefaultYangModuleIdentifier implements YangModuleIdentifier,
+public class DefaultYangModuleIdentifier implements YangModuleIdentifier,
         Comparator<YangModuleIdentifier> {
 
     private final String moduleName;
diff --git a/apps/yms/app/src/main/java/org/onosproject/yms/app/ysr/DefaultYangModuleInformation.java b/apps/yms/app/src/main/java/org/onosproject/yms/app/ysr/DefaultYangModuleInformation.java
index 79778f7..3fc656f 100644
--- a/apps/yms/app/src/main/java/org/onosproject/yms/app/ysr/DefaultYangModuleInformation.java
+++ b/apps/yms/app/src/main/java/org/onosproject/yms/app/ysr/DefaultYangModuleInformation.java
@@ -17,6 +17,7 @@
 package org.onosproject.yms.app.ysr;
 
 import com.google.common.collect.ImmutableList;
+import org.onosproject.yangutils.datamodel.YangNamespace;
 import org.onosproject.yms.ysr.YangModuleIdentifier;
 import org.onosproject.yms.ysr.YangModuleInformation;
 
@@ -32,7 +33,7 @@
 class DefaultYangModuleInformation implements YangModuleInformation {
 
     private final YangModuleIdentifier moduleIdentifier;
-    private final String nameSpace;
+    private final YangNamespace nameSpace;
     private final List<String> features;
     private final List<YangModuleIdentifier> subModuleIdentifiers;
 
@@ -43,7 +44,7 @@
      * @param nameSpace        name space of module
      */
     DefaultYangModuleInformation(YangModuleIdentifier moduleIdentifier,
-                                 String nameSpace) {
+                                 YangNamespace nameSpace) {
         this.moduleIdentifier = moduleIdentifier;
         this.nameSpace = nameSpace;
         subModuleIdentifiers = new ArrayList<>();
@@ -55,8 +56,7 @@
         return moduleIdentifier;
     }
 
-    @Override
-    public String namespace() {
+    public YangNamespace namespace() {
         return nameSpace;
     }
 
diff --git a/apps/yms/app/src/main/java/org/onosproject/yms/app/ysr/DefaultYangModuleLibrary.java b/apps/yms/app/src/main/java/org/onosproject/yms/app/ysr/DefaultYangModuleLibrary.java
index 4187746..5cb991b 100644
--- a/apps/yms/app/src/main/java/org/onosproject/yms/app/ysr/DefaultYangModuleLibrary.java
+++ b/apps/yms/app/src/main/java/org/onosproject/yms/app/ysr/DefaultYangModuleLibrary.java
@@ -29,7 +29,7 @@
 /**
  * Representation of default YANG module library.
  */
-class DefaultYangModuleLibrary implements YangModuleLibrary {
+public class DefaultYangModuleLibrary implements YangModuleLibrary {
 
     private final String moduleSetId;
     private final List<YangModuleInformation> moduleInformation;
@@ -39,7 +39,7 @@
      *
      * @param moduleSetId module id
      */
-    DefaultYangModuleLibrary(String moduleSetId) {
+    public DefaultYangModuleLibrary(String moduleSetId) {
         this.moduleSetId = moduleSetId;
         moduleInformation = new ArrayList<>();
     }
diff --git a/apps/yms/app/src/main/java/org/onosproject/yms/app/ysr/DefaultYangSchemaRegistry.java b/apps/yms/app/src/main/java/org/onosproject/yms/app/ysr/DefaultYangSchemaRegistry.java
index ce123e1..58d772c 100644
--- a/apps/yms/app/src/main/java/org/onosproject/yms/app/ysr/DefaultYangSchemaRegistry.java
+++ b/apps/yms/app/src/main/java/org/onosproject/yms/app/ysr/DefaultYangSchemaRegistry.java
@@ -16,7 +16,6 @@
 
 package org.onosproject.yms.app.ysr;
 
-import org.onosproject.yangutils.datamodel.RpcNotificationContainer;
 import org.onosproject.yangutils.datamodel.YangInclude;
 import org.onosproject.yangutils.datamodel.YangModule;
 import org.onosproject.yangutils.datamodel.YangNode;
@@ -26,34 +25,33 @@
 import org.onosproject.yms.ysr.YangModuleIdentifier;
 import org.onosproject.yms.ysr.YangModuleInformation;
 import org.onosproject.yms.ysr.YangModuleLibrary;
+import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
 import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 import java.io.File;
-import java.io.FileInputStream;
 import java.io.IOException;
-import java.io.ObjectInputStream;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
 import java.util.List;
-import java.util.Set;
+import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 import java.util.regex.Pattern;
 
+import static java.util.Collections.sort;
 import static org.apache.commons.io.FileUtils.deleteDirectory;
 import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.parseJarFile;
-import static org.onosproject.yangutils.utils.UtilConstants.DEFAULT;
-import static org.onosproject.yangutils.utils.UtilConstants.EMPTY_STRING;
 import static org.onosproject.yangutils.utils.UtilConstants.EVENT_STRING;
+import static org.onosproject.yangutils.utils.UtilConstants.HYPHEN;
 import static org.onosproject.yangutils.utils.UtilConstants.OP_PARAM;
 import static org.onosproject.yangutils.utils.UtilConstants.PERIOD;
+import static org.onosproject.yangutils.utils.UtilConstants.SERVICE;
+import static org.onosproject.yangutils.utils.UtilConstants.SLASH;
 import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.getCapitalCase;
 import static org.osgi.framework.FrameworkUtil.getBundle;
+import static org.slf4j.LoggerFactory.getLogger;
 
 
 /**
@@ -61,111 +59,344 @@
  * provides interface to an application to register its YANG schema
  * with YMS. It provides YANG schema nodes to YDT, YNB and YSB.
  */
-public class DefaultYangSchemaRegistry
-        implements YangSchemaRegistry {
+public class DefaultYangSchemaRegistry implements YangSchemaRegistry {
 
-    private static final String SYSTEM = File.separator + "system" +
-            File.separator;
+    private static final String SYSTEM = SLASH + "system" + SLASH;
     private static final String MAVEN = "mvn:";
-    private static final String HYPHEN = "-";
-    private static final String DELIMITER = ".";
-    private static final String SERVICE = "Service";
     private static final String JAR = ".jar";
     private static final String USER_DIRECTORY = "user.dir";
-    private static final String SLASH = File.separator;
     private static final String AT = "@";
     private static final String DATE_FORMAT = "yyyy-mm-dd";
-    private static final Logger log =
-            LoggerFactory.getLogger(DefaultYangSchemaRegistry.class);
-    private final ConcurrentMap<String, YsrAppContext> appObjectStore;
-    private final ConcurrentMap<String, YsrAppContext> yangSchemaStore;
-    private final ConcurrentMap<String, YsrAppContext>
-            yangSchemaStoreForRootInterface;
-    private final ConcurrentMap<String, YsrAppContext>
-            yangSchemaStoreForRootOpParam;
-    private final ConcurrentMap<String, YsrAppContext>
-            yangRootSchemaStoreForNotification;
+    private static final String ONOS = "org.onosproject";
+    private static final Logger log = getLogger(DefaultYangSchemaRegistry.class);
+
+    /*
+     * Map for storing app objects.
+     */
+    private final ConcurrentMap<String, Object> appObjectStore;
+
+    /*
+     * Map for storing YANG schema nodes.
+     */
+    private final ConcurrentMap<String, ConcurrentMap<String, YangSchemaNode>>
+            yangSchemaStore;
+
+    /*
+     * Map for storing YANG schema nodes with respect to root's generated
+     * interface file name.
+     */
+    private final ConcurrentMap<String, YangSchemaNode> interfaceNameKeyStore;
+
+    /*
+     * Map for storing YANG schema nodes root's generated op param file name.
+     */
+    private final ConcurrentMap<String, YangSchemaNode> opParamNameKeyStore;
+
+    /*
+     * Map for storing YANG schema nodes with respect to notifications.
+     */
+    private final ConcurrentMap<String, YangSchemaNode> eventNameKeyStore;
+
+    /*
+     * Map for storing YANG schema nodes with respect to app name.
+     */
+    private final ConcurrentMap<String, YangSchemaNode> appNameKeyStore;
+
+    /*
+     * Map for storing registered classes.
+     */
     private final ConcurrentMap<String, Class<?>> registerClassStore;
+
+    /*
+     * Map for storing YANG file details.
+     */
     private final ConcurrentMap<YangModuleIdentifier, String> yangFileStore;
-    private final YangModuleLibrary library;
-    private YsrAppContext ysrAppContext;
-    private YsrAppContext ysrContextForSchemaStore;
-    private YsrAppContext ysrContextForAppStore;
-    private ClassLoader classLoader;
+
+    private final ConcurrentMap<Object, Boolean> ynhRegistrationStore;
+    private final ConcurrentMap<String, String> jarPathStore;
 
     /**
      * Creates an instance of default YANG schema registry.
-     *
-     * @param moduleId module set id of YSR module library
      */
-    public DefaultYangSchemaRegistry(String moduleId) {
+    public DefaultYangSchemaRegistry() {
         appObjectStore = new ConcurrentHashMap<>();
         yangSchemaStore = new ConcurrentHashMap<>();
-        yangSchemaStoreForRootInterface = new ConcurrentHashMap<>();
-        yangSchemaStoreForRootOpParam = new ConcurrentHashMap<>();
-        yangRootSchemaStoreForNotification = new ConcurrentHashMap<>();
+        interfaceNameKeyStore = new ConcurrentHashMap<>();
+        opParamNameKeyStore = new ConcurrentHashMap<>();
+        eventNameKeyStore = new ConcurrentHashMap<>();
         registerClassStore = new ConcurrentHashMap<>();
         yangFileStore = new ConcurrentHashMap<>();
-        library = new DefaultYangModuleLibrary(moduleId);
+        appNameKeyStore = new ConcurrentHashMap<>();
+        ynhRegistrationStore = new ConcurrentHashMap<>();
+        jarPathStore = new ConcurrentHashMap<>();
     }
 
 
     @Override
     public void registerApplication(Object appObject, Class<?> serviceClass) {
+        synchronized (serviceClass) {
+            doPreProcessing(serviceClass, appObject);
+            if (!verifyIfApplicationAlreadyRegistered(serviceClass)) {
+                BundleContext context = getBundle(serviceClass).getBundleContext();
+                Bundle[] bundles = context.getBundles();
+                Bundle bundle;
+                int len = bundles.length;
+                List<YangNode> curNodes;
+                String jarPath;
+                for (int i = len - 1; i >= 0; i--) {
+                    bundle = bundles[i];
+                    if (bundle.getSymbolicName().contains(ONOS)) {
+                        jarPath = getJarPathFromBundleLocation(
+                                bundle.getLocation(), context.getProperty(USER_DIRECTORY));
+                        curNodes = processJarParsingOperations(jarPath);
+                        // process application registration.
+                        if (curNodes != null && !curNodes.isEmpty()) {
+                            jarPathStore.put(serviceClass.getName(), jarPath);
+                            processRegistration(serviceClass, jarPath,
+                                                curNodes, appObject, false);
+                        }
+                    }
+                }
+            }
+        }
+    }
 
-        BundleContext bundleContext = getBundle(serviceClass)
-                .getBundleContext();
-        String jarPath = getJarPathFromBundleLocation(
-                bundleContext.getBundle().getLocation(),
-                bundleContext.getProperty(USER_DIRECTORY));
-        processRegistration(serviceClass, appObject, jarPath);
+    @Override
+    public void unRegisterApplication(Object managerObject,
+                                      Class<?> serviceClass) {
+        synchronized (serviceClass) {
+            YangSchemaNode curNode;
+            String serviceName = serviceClass.getName();
+
+            //Check if service should be unregistered?
+            if (managerObject != null) {
+                verifyApplicationRegistration(managerObject, serviceClass);
+            }
+            //Remove registered class from store.
+            registerClassStore.remove(serviceName);
+            //check if service is in app store.
+            curNode = appNameKeyStore.get(serviceName);
+            if (curNode == null) {
+                curNode = interfaceNameKeyStore.get(serviceName);
+            }
+
+            if (curNode != null) {
+                removeSchemaNode(curNode);
+                eventNameKeyStore.remove(getEventClassName(curNode));
+                appObjectStore.remove(serviceName);
+                interfaceNameKeyStore.remove(getInterfaceClassName(curNode));
+                opParamNameKeyStore.remove(getOpParamClassName(curNode));
+                yangFileStore.remove(getModuleIdentifier(curNode));
+                appNameKeyStore.remove(serviceName);
+                removeYsrGeneratedTemporaryResources(jarPathStore.get(serviceName),
+                                                     serviceName);
+                log.info(" service {} is unregistered.",
+                         serviceClass.getSimpleName());
+            } else {
+                throw new RuntimeException(serviceClass.getSimpleName() +
+                                                   " service was not registered.");
+            }
+        }
+    }
+
+    @Override
+    public Object getRegisteredApplication(YangSchemaNode schemaNode) {
+        Object obj = null;
+        if (schemaNode != null) {
+            String name = getServiceName(schemaNode);
+            obj = appObjectStore.get(name);
+            if (obj == null) {
+                log.error("{} not found.", name);
+            }
+        }
+        return obj;
+    }
+
+    @Override
+    public YangSchemaNode getYangSchemaNodeUsingSchemaName(String schemaName) {
+        return getSchemaNodeUsingSchemaNameWithRev(schemaName);
+    }
+
+    @Override
+    public YangSchemaNode getYangSchemaNodeUsingAppName(String appName) {
+        YangSchemaNode node = appNameKeyStore.get(appName);
+        if (node == null) {
+            log.error("{} not found.", appName);
+        }
+        return node;
+    }
+
+    @Override
+    public YangSchemaNode
+    getYangSchemaNodeUsingGeneratedRootNodeInterfaceFileName(String name) {
+        YangSchemaNode node = interfaceNameKeyStore.get(name);
+        if (node == null) {
+            log.error("{} not found.", name);
+        }
+        return node;
+    }
+
+    @Override
+    public YangSchemaNode getYangSchemaNodeUsingGeneratedRootNodeOpPramFileName(
+            String name) {
+        YangSchemaNode node = opParamNameKeyStore.get(name);
+        if (node == null) {
+            log.error("{} not found.", name);
+        }
+        return node;
+    }
+
+    @Override
+    public YangSchemaNode getRootYangSchemaNodeForNotification(String name) {
+        YangSchemaNode node = eventNameKeyStore.get(name);
+        if (node == null) {
+            log.error("{} not found.", name);
+        }
+        return node;
+    }
+
+    @Override
+    public Class<?> getRegisteredClass(YangSchemaNode schemaNode) {
+        String interfaceName = getInterfaceClassName(schemaNode);
+        String serviceName = getServiceName(schemaNode);
+        Class<?> regClass = registerClassStore.get(serviceName);
+        if (regClass == null) {
+            regClass = registerClassStore.get(interfaceName);
+        }
+        return regClass;
+    }
+
+    @Override
+    public String getYangFile(YangModuleIdentifier moduleIdentifier) {
+        String file = yangFileStore.get(moduleIdentifier);
+        if (file == null) {
+            log.error("YANG files for corresponding module identifier {} not " +
+                              "found", moduleIdentifier);
+        }
+        return file;
+    }
+
+    @Override
+    public boolean verifyNotificationObject(Object appObj, Class<?> service) {
+        synchronized (service) {
+            YangSchemaNode node = appNameKeyStore.get(service.getName());
+            if (node == null) {
+                log.error("application is not registered with YMS {}",
+                          service.getName());
+                return false;
+            }
+            try {
+                if (node.isNotificationPresent()) {
+                    if (appObj != null) {
+                        Boolean ifPresent = ynhRegistrationStore.get(appObj);
+                        if (ifPresent == null) {
+                            ynhRegistrationStore.put(appObj, true);
+                            return true;
+                        }
+                    }
+                }
+            } catch (DataModelException e) {
+                log.error("notification registration error: {} {}", e
+                        .getLocalizedMessage(), e);
+            }
+            return false;
+        }
+    }
+
+    @Override
+    public void flushYsrData() {
+        appObjectStore.clear();
+        yangSchemaStore.clear();
+        eventNameKeyStore.clear();
+        opParamNameKeyStore.clear();
+        interfaceNameKeyStore.clear();
+        registerClassStore.clear();
+        yangFileStore.clear();
+    }
+
+    @Override
+    public void processModuleLibrary(String serviceName,
+                                     YangModuleLibrary library) {
+        synchronized (serviceName) {
+            YangSchemaNode node = appNameKeyStore.get(serviceName);
+            if (node != null) {
+                YangModuleInformation moduleInformation =
+                        new DefaultYangModuleInformation(getModuleIdentifier(node),
+                                                         node.getNameSpace());
+                addSubModuleIdentifier(node, (
+                        DefaultYangModuleInformation) moduleInformation);
+                //TODO: add feature list to module information.
+                ((DefaultYangModuleLibrary) library)
+                        .addModuleInformation(moduleInformation);
+            }
+        }
     }
 
     /**
-     * Process application registration.
+     * Process service class.
      *
      * @param serviceClass service class
      * @param appObject    application object
-     * @param jarPath      jar path
      */
-    void processRegistration(Class<?> serviceClass, Object appObject,
-                             String jarPath) {
 
-        // set class loader for service class.
-        setClassLoader(serviceClass.getClassLoader());
+    void doPreProcessing(Class<?> serviceClass, Object appObject) {
 
         //Check if service should be registered?
         if (appObject != null) {
             verifyApplicationRegistration(appObject, serviceClass);
         }
+        String name = serviceClass.getName();
         //Add app class to registered service store.
-        if (!registerClassStore.containsKey(serviceClass.getName())) {
-            updateServiceClass(serviceClass);
+        if (!registerClassStore.containsKey(name)) {
+            registerClassStore.put(name, serviceClass);
         }
+    }
+
+    void updateServiceClass(Class<?> service) {
+        registerClassStore.put(service.getName(), service);
+    }
+
+    /**
+     * Process application registration.
+     *
+     * @param service  service class
+     * @param jarPath  jar path
+     * @param nodes    YANG nodes
+     * @param appObj   application object
+     * @param isFromUt if registration is being called form unit test
+     */
+    void processRegistration(Class<?> service, String jarPath,
+                             List<YangNode> nodes,
+                             Object appObj, boolean isFromUt) {
 
         // process storing operations.
-        if (!verifyIfApplicationAlreadyRegistered(serviceClass)) {
-            List<YangNode> curNodes =
-                    processJarParsingOperations(jarPath);
+        YangNode schemaNode = findNodeWhichShouldBeReg(service.getName(), nodes);
+        if (schemaNode != null) {
+            if (appObj != null) {
+                appObjectStore.put(service.getName(), appObj);
+            }
+            //Process application context for registrations.
+            processApplicationContext(schemaNode, service.getName(), isFromUt);
+            //Update YANG file store.
+            updateYangFileStore(schemaNode, jarPath);
+        }
+    }
 
-            if (curNodes != null) {
-                for (YangNode schemaNode : curNodes) {
-                    //Process application context for registrations.
-                    processApplicationContext(schemaNode);
-                    //Update YANG file store.
-                    updateYangFileStore(schemaNode, jarPath);
-                    //Process module library operation for current node list.
-                    processModuleLibrary(schemaNode);
-                }
-                //Set jar path for app context.
-                ysrAppContext.jarPath(jarPath);
-                ysrContextForSchemaStore.jarPath(jarPath);
-                ysrContextForAppStore.jarPath(jarPath);
+    /**
+     * Returns the node for which corresponding class is generated.
+     *
+     * @param name  generated class name
+     * @param nodes list of yang nodes
+     * @return node for which corresponding class is generated
+     */
+    private YangNode findNodeWhichShouldBeReg(String name, List<YangNode> nodes) {
+        for (YangNode node : nodes) {
+            if (name.equals(getServiceName(node)) ||
+                    name.equals(getInterfaceClassName(node))) {
+                return node;
             }
         }
-
-        //Verifies if object is updated for app store.
-        updateApplicationObject(appObject, serviceClass);
+        return null;
     }
 
     /**
@@ -194,256 +425,9 @@
      * @return true if application already registered
      */
     private boolean verifyIfApplicationAlreadyRegistered(Class<?> appClass) {
-        String simpleName = appClass.getSimpleName();
         String appName = appClass.getName();
-        if (!appObjectStore.containsKey(appName)) {
-            if (simpleName.contains(OP_PARAM)) {
-                return yangSchemaStoreForRootOpParam
-                        .containsKey(appName);
-            } else {
-                return yangSchemaStoreForRootInterface
-                        .containsKey(appName);
-            }
-        }
-        return true;
-    }
-
-    /**
-     * Verifies if service is being implemented by some new object.
-     *
-     * @param appObject application's object
-     * @param appClass  application's class
-     */
-    private void updateApplicationObject(Object appObject, Class<?> appClass) {
-        YsrAppContext appContext =
-                appObjectStore.get(appClass.getName());
-        if (appContext != null) {
-            YangSchemaNode schemaNode = appContext.curNode();
-            String name = getInterfaceClassName(schemaNode);
-            if (appContext.appObject() == null) {
-                //update in application store.
-                appContext.appObject(appObject);
-                //Update app object for schema store for root interface.
-                appContext = yangSchemaStoreForRootInterface.get(name);
-                if (appContext != null) {
-                    appContext.appObject(appObject);
-                }
-                // Update app object for schema store for root op param
-                appContext = yangSchemaStoreForRootOpParam.get(name + OP_PARAM);
-                if (appContext != null) {
-                    appContext.appObject(appObject);
-                }
-            }
-        }
-    }
-
-    @Override
-    public void unRegisterApplication(Object managerObject,
-                                      Class<?> serviceClass) {
-        YangSchemaNode curNode = null;
-        String serviceName = serviceClass.getName();
-
-        //Check if service should be unregistered?
-        if (managerObject != null) {
-            verifyApplicationRegistration(managerObject, serviceClass);
-        }
-        //Remove registered class from store.
-        registerClassStore.remove(serviceName);
-
-        //check if service is in app store.
-        if (appObjectStore.containsKey(serviceName)) {
-            curNode = retrieveNodeForUnregister(serviceName, appObjectStore,
-                                                managerObject);
-        } else if (yangSchemaStoreForRootInterface.containsKey(serviceName)) {
-            //check if service is in interface store.
-            curNode = retrieveNodeForUnregister(serviceName,
-                                                yangSchemaStoreForRootInterface,
-                                                managerObject);
-        } else if (yangSchemaStoreForRootOpParam.containsKey(serviceName)) {
-            //check if service is in op param store.
-            curNode = retrieveNodeForUnregister(serviceName,
-                                                yangSchemaStoreForRootOpParam,
-                                                managerObject);
-        }
-        if (curNode != null) {
-            String javaName = getInterfaceClassName(curNode);
-            removeFromYangSchemaStore(curNode);
-            removeFromYangNotificationStore(curNode);
-            removeFromAppSchemaStore(serviceName);
-            removeFromYangSchemaNodeForRootInterface(javaName);
-            removeFromYangSchemaNodeForRootOpParam(javaName);
-            removeYangFileInfoFromStore(curNode);
-            log.info(" service {} is unregistered.",
-                     serviceClass.getSimpleName());
-        } else {
-            throw new RuntimeException(serviceClass.getSimpleName() +
-                                               " service was not registered.");
-        }
-    }
-
-    @Override
-    public Object getRegisteredApplication(YangSchemaNode schemaNode) {
-        if (schemaNode != null) {
-            String name = getInterfaceClassName(schemaNode);
-            if (yangSchemaStoreForRootInterface.containsKey(name)) {
-                return yangSchemaStoreForRootInterface.get(name)
-                        .appObject();
-            }
-            log.error("{} not found.", name);
-        }
-        return null;
-    }
-
-    @Override
-    public YangSchemaNode getYangSchemaNodeUsingSchemaName(String schemaName) {
-        return getSchemaNodeUsingSchemaNameWithRev(schemaName);
-    }
-
-    @Override
-    public YangSchemaNode getYangSchemaNodeUsingAppName(String appName) {
-        YsrAppContext appContext = appObjectStore.get(appName);
-        if (appContext != null) {
-            return appContext.curNode();
-        }
-        log.error("{} not found.", appName);
-        return null;
-    }
-
-    @Override
-    public YangSchemaNode
-    getYangSchemaNodeUsingGeneratedRootNodeInterfaceFileName(String name) {
-        YsrAppContext appContext = yangSchemaStoreForRootInterface.get(name);
-        if (appContext != null) {
-            return appContext.curNode();
-        }
-        log.error("{} not found.", name);
-        return null;
-    }
-
-    @Override
-    public YangSchemaNode getYangSchemaNodeUsingGeneratedRootNodeOpPramFileName(
-            String name) {
-        YsrAppContext appContext = yangSchemaStoreForRootOpParam.get(name);
-        if (appContext != null) {
-            return appContext.curNode();
-        }
-        log.error("{} not found.", name);
-        return null;
-    }
-
-    @Override
-    public YangSchemaNode getRootYangSchemaNodeForNotification(String name) {
-        YsrAppContext appContext = yangRootSchemaStoreForNotification.get(name);
-        if (appContext != null) {
-            return appContext.curNode();
-        }
-        log.error("{} not found.", name);
-        return null;
-    }
-
-    @Override
-    public Class<?> getRegisteredClass(YangSchemaNode schemaNode,
-                                       String appName) {
-        String interfaceName = getInterfaceClassName(schemaNode);
-        String serviceName = getServiceName(schemaNode);
-        String defaultClass;
-        if (schemaNode instanceof RpcNotificationContainer) {
-            defaultClass = getOpParamClassName(schemaNode);
-        } else {
-            defaultClass = getDefaultClassName(schemaNode);
-        }
-        //If application class is registered.
-        if (registerClassStore.containsKey(appName)) {
-            return registerClassStore.get(appName);
-        } else if (registerClassStore.containsKey(interfaceName)) {
-            //If interface class is registered.
-            return registerClassStore.get(interfaceName);
-        } else if (registerClassStore.containsKey(serviceName)) {
-            //If service class is registered.
-            return registerClassStore.get(serviceName);
-        } else if (registerClassStore.containsKey(defaultClass)) {
-            //If default class is registered.
-            return registerClassStore.get(defaultClass);
-        }
-        return null;
-    }
-
-    /**
-     * Returns YANG file path for module identifier.
-     *
-     * @param moduleIdentifier module identifier
-     * @return YANG file path for module identifier
-     */
-    public String getYangFile(YangModuleIdentifier moduleIdentifier) {
-        if (yangFileStore.containsKey(moduleIdentifier)) {
-            return yangFileStore.get(moduleIdentifier);
-        }
-        log.error("YANG files for corresponding module identifier {} not " +
-                          "found", moduleIdentifier);
-        return null;
-    }
-
-    /**
-     * Updates service class store.
-     *
-     * @param serviceClass service class
-     */
-    void updateServiceClass(Class<?> serviceClass) {
-        registerClassStore.put(serviceClass.getName(), serviceClass);
-    }
-
-    /**
-     * Updates application object store.
-     *
-     * @param appName application name
-     */
-    private void updateAppObjectStore(String appName) {
-        if (verifyClassExistence(appName)) {
-            appObjectStore.put(appName, ysrContextForAppStore);
-        }
-    }
-
-    /**
-     * Updates YANG schema object store.
-     *
-     * @param schemaNode application's schema node
-     */
-    private void updateYangSchemaStore(YangSchemaNode schemaNode) {
-        addSchemaNodeUsingSchemaNameWithRev(schemaNode);
-    }
-
-    /**
-     * Updates YANG schema notification object store.
-     *
-     * @param name application's notification name
-     */
-    private void updateYangNotificationStore(String name) {
-        if (verifyClassExistence(name)) {
-            yangRootSchemaStoreForNotification.put(name, ysrAppContext);
-        }
-    }
-
-    /**
-     * Updates YANG schema object store for root interface file name.
-     *
-     * @param name name of generated interface file for root
-     *             node
-     */
-    private void updateYangSchemaForRootInterfaceFileNameStore(String name) {
-        if (verifyClassExistence(name)) {
-            yangSchemaStoreForRootInterface.put(name, ysrAppContext);
-        }
-    }
-
-    /**
-     * Updates YANG schema object store  for root op param file name.
-     *
-     * @param name name of generated op param file for root node
-     */
-    private void updateYangSchemaForRootOpParamFileNameStore(String name) {
-        if (verifyClassExistence(name)) {
-            yangSchemaStoreForRootOpParam.put(name, ysrAppContext);
-        }
+        return appObjectStore.containsKey(appName) ||
+                interfaceNameKeyStore.containsKey(appName);
     }
 
     /**
@@ -453,9 +437,8 @@
      * @param jarPath jar file path
      */
     private void updateYangFileStore(YangNode node, String jarPath) {
-       //FIXME: fix when yang tools support for file name.
-       //yangFileStore.put(getModuleIdentifier(node),
-       //                   getYangFilePath(jarPath, node.getFileName()));
+        yangFileStore.put(getModuleIdentifier(node),
+                          getYangFilePath(jarPath, node.getFileName()));
     }
 
     /**
@@ -466,8 +449,8 @@
      * @return yang file path
      */
     private String getYangFilePath(String jarPath, String metaDataFileName) {
-       String[] metaData = metaDataFileName.split(SLASH);
-       return jarPath + SLASH + metaData[metaData.length - 1];
+        String[] metaData = metaDataFileName.split(SLASH);
+        return jarPath + SLASH + metaData[metaData.length - 1];
     }
 
     /**
@@ -478,8 +461,12 @@
      */
     private List<YangNode> processJarParsingOperations(String path) {
         //Deserialize data model and get the YANG node set.
+        String jar = path + JAR;
         try {
-            return parseJarFile(path + JAR, path);
+            File file = new File(jar);
+            if (file.exists()) {
+                return parseJarFile(path + JAR, path);
+            }
         } catch (IOException e) {
             log.error(" failed to parse the jar file in path {} : {} ", path,
                       e.getMessage());
@@ -490,30 +477,23 @@
     /**
      * Process an application an updates the maps for YANG schema registry.
      *
-     * @param appNode application YANG schema nodes
+     * @param appNode  application YANG schema nodes
+     * @param name     class name
+     * @param isFormUt if method is being called from unit tests
      */
-    void processApplicationContext(YangSchemaNode appNode) {
+    private void processApplicationContext(YangSchemaNode appNode, String name,
+                                           boolean isFormUt) {
 
-        String appName = getInterfaceClassName(appNode);
-
-        //Create a new instance of ysr app context for each node.
-        ysrAppContext = new YsrAppContext();
-        ysrContextForSchemaStore = new YsrAppContext();
-        ysrContextForAppStore = new YsrAppContext();
-
-        //add cur node to app context.
-        ysrAppContext.curNode(appNode);
-        ysrContextForAppStore.curNode(appNode);
-
-        //Updates maps wih schema nodes.
-        updateAppObjectStore(getServiceName(appNode));
+        //Update map for which registrations is being called.
+        appNameKeyStore.put(name, appNode);
 
         // Updates schema store.
-        updateYangSchemaStore(appNode);
+        addToSchemaStore(appNode);
         // update interface store.
-        updateYangSchemaForRootInterfaceFileNameStore(appName);
+        interfaceNameKeyStore.put(getInterfaceClassName(appNode), appNode);
+
         //update op param store.
-        updateYangSchemaForRootOpParamFileNameStore(getOpParamClassName(appNode));
+        opParamNameKeyStore.put(getOpParamClassName(appNode), appNode);
         //Checks if notification is present then update notification store map.
         String eventSubject = null;
         try {
@@ -525,10 +505,11 @@
                       e.getLocalizedMessage());
         }
         if (eventSubject != null) {
-            updateYangNotificationStore(eventSubject);
+            eventNameKeyStore.put(eventSubject, appNode);
         }
-        log.info("successfully registered this application {}{}", appName,
-                 SERVICE);
+        if (!isFormUt) {
+            log.info("successfully registered this application {}", name);
+        }
     }
 
     /**
@@ -540,62 +521,18 @@
     private String getJarPathFromBundleLocation(String mvnLocationPath,
                                                 String currentDirectory) {
         String path = currentDirectory + SYSTEM;
-        String[] strArray = mvnLocationPath.split(MAVEN);
-        String[] split = strArray[1].split(File.separator);
-        String[] groupId = split[0].split(Pattern.quote(DELIMITER));
-
-        return path + groupId[0] + SLASH + groupId[1] + SLASH + split[1] +
-                SLASH + split[2] + SLASH + split[1] + HYPHEN + split[2];
-    }
-
-    /**
-     * Returns de-serializes YANG data-model nodes.
-     *
-     * @param serializedFileInfo serialized File Info
-     * @return de-serializes YANG data-model nodes
-     */
-    Set<YangSchemaNode> deSerializeDataModel(String serializedFileInfo) {
-
-        Set<YangSchemaNode> nodes = new HashSet<>();
-        Object readValue;
-        try {
-            FileInputStream fileInputStream =
-                    new FileInputStream(serializedFileInfo);
-            ObjectInputStream objectInputStream =
-                    new ObjectInputStream(fileInputStream);
-            readValue = objectInputStream.readObject();
-            if (readValue instanceof Set<?>) {
-                for (Object obj : (Set<?>) readValue) {
-                    if (obj instanceof YangSchemaNode) {
-                        nodes.add((YangSchemaNode) obj);
-                    } else {
-                        throw new RuntimeException(
-                                "deserialize object is not an instance of " +
-                                        "YANG schema node" + obj);
-                    }
+        if (mvnLocationPath.contains(MAVEN)) {
+            String[] strArray = mvnLocationPath.split(MAVEN);
+            if (strArray[1].contains(File.separator)) {
+                String[] split = strArray[1].split(File.separator);
+                if (split[0].contains(PERIOD)) {
+                    String[] groupId = split[0].split(Pattern.quote(PERIOD));
+                    return path + groupId[0] + SLASH + groupId[1] + SLASH + split[1] +
+                            SLASH + split[2] + SLASH + split[1] + HYPHEN + split[2];
                 }
-            } else {
-                throw new RuntimeException(
-                        "deserialize object is not an instance of set of" +
-                                "YANG schema node" + readValue);
             }
-            objectInputStream.close();
-            fileInputStream.close();
-        } catch (IOException | ClassNotFoundException e) {
-            log.error(" {} not found.: {}", serializedFileInfo,
-                      e.getLocalizedMessage());
         }
-
-        return nodes;
-    }
-
-    /**
-     * Returns ysr app context.
-     *
-     * @return ysr app context
-     */
-    YsrAppContext ysrAppContext() {
-        return ysrAppContext;
+        return null;
     }
 
     /**
@@ -605,61 +542,62 @@
      * @return schema node based on the revision
      */
     private YangSchemaNode getSchemaNodeUsingSchemaNameWithRev(String name) {
-        YsrAppContext appContext;
+        ConcurrentMap<String, YangSchemaNode> revMap;
         YangSchemaNode schemaNode;
         if (name.contains(AT)) {
             String[] revArray = name.split(AT);
-            appContext = yangSchemaStore.get(revArray[0]);
-            schemaNode = appContext.getSchemaNodeForRevisionStore(name);
-            if (schemaNode != null) {
-                return schemaNode;
+            revMap = yangSchemaStore.get(revArray[0]);
+            schemaNode = revMap.get(name);
+            if (schemaNode == null) {
+                log.error("{} not found.", name);
             }
-            return appContext.curNode();
+            return schemaNode;
         }
         if (yangSchemaStore.containsKey(name)) {
-            appContext = yangSchemaStore.get(name);
-            if (appContext != null) {
-                Iterator<YangSchemaNode> iterator = appContext
-                        .getYangSchemaNodeForRevisionStore().values()
-                        .iterator();
-                if (iterator.hasNext()) {
-                    return appContext.getYangSchemaNodeForRevisionStore()
-                            .values().iterator().next();
-                } else {
-                    return null;
+            revMap = yangSchemaStore.get(name);
+            if (revMap != null && !revMap.isEmpty()) {
+                YangSchemaNode node = revMap.get(name);
+                if (node != null) {
+                    return node;
                 }
+                String revName = getLatestVersion(revMap);
+                return revMap.get(revName);
             }
         }
         log.error("{} not found.", name);
         return null;
     }
 
+    private String getLatestVersion(ConcurrentMap<String, YangSchemaNode> revMap) {
+        List<String> keys = new ArrayList<>();
+        for (Map.Entry<String, YangSchemaNode> entry : revMap.entrySet()) {
+            keys.add(entry.getKey());
+        }
+        sort(keys);
+        return keys.get(keys.size() - 1);
+    }
+
     /**
      * Adds schema node when different revision of node has received.
      *
      * @param schemaNode schema node
      */
-    private void addSchemaNodeUsingSchemaNameWithRev(
-            YangSchemaNode schemaNode) {
+    private void addToSchemaStore(YangSchemaNode schemaNode) {
 
         String date = getDateInStringFormat(schemaNode);
         String name = schemaNode.getName();
-        if (!date.equals(EMPTY_STRING)) {
-            name = name + AT + date;
+        String revName = name;
+        if (date != null) {
+            revName = name + AT + date;
         }
         //check if already present.
-        if (!yangSchemaStore.containsKey(schemaNode.getName())) {
-            ysrContextForSchemaStore.curNode(schemaNode);
-            //if revision is not present no need to add in revision store.
-            ysrContextForSchemaStore
-                    .addSchemaNodeWithRevisionStore(name, schemaNode);
-            yangSchemaStore.put(schemaNode.getName(),
-                                ysrContextForSchemaStore);
+        if (!yangSchemaStore.containsKey(name)) {
+            ConcurrentMap<String, YangSchemaNode> revStore =
+                    new ConcurrentHashMap<>();
+            revStore.put(revName, schemaNode);
+            yangSchemaStore.put(name, revStore);
         } else {
-            YsrAppContext appContext =
-                    yangSchemaStore.get(schemaNode.getName());
-            appContext.addSchemaNodeWithRevisionStore(name, schemaNode);
-            appContext.curNode(schemaNode);
+            yangSchemaStore.get(name).put(revName, schemaNode);
         }
     }
 
@@ -677,7 +615,7 @@
                                         .getRevDate());
             }
         }
-        return EMPTY_STRING;
+        return null;
     }
 
     /**
@@ -686,314 +624,21 @@
      * @param removableNode schema node which needs to be removed
      */
     private void removeSchemaNode(YangSchemaNode removableNode) {
-
         String name = removableNode.getName();
+        String revName = name;
         String date = getDateInStringFormat(removableNode);
-
-        if (!date.isEmpty()) {
-            name = removableNode.getName() + AT +
-                    getDateInStringFormat(removableNode);
+        if (date != null) {
+            revName = name + AT + date;
         }
-        YsrAppContext appContext = yangSchemaStore
-                .get(removableNode.getName());
-        if (appContext != null &&
-                !appContext.getYangSchemaNodeForRevisionStore().isEmpty() &&
-                appContext.getYangSchemaNodeForRevisionStore().size() != 1) {
-            appContext.removeSchemaNodeForRevisionStore(name);
+        ConcurrentMap<String, YangSchemaNode> revMap = yangSchemaStore.get(name);
+        if (revMap != null && !revMap.isEmpty() && revMap.size() != 1) {
+            revMap.remove(revName);
         } else {
             yangSchemaStore.remove(removableNode.getName());
         }
     }
 
     /**
-     * Verifies if the manager object is already registered with notification
-     * handler.
-     *
-     * @param serviceClass service class
-     * @return true if the manager object is already registered with
-     * notification handler
-     */
-    public boolean verifyNotificationObject(Class<?> serviceClass) {
-        YangSchemaNode schemaNode = null;
-        String serviceName = serviceClass.getName();
-        if (appObjectStore.containsKey(serviceName)) {
-            schemaNode = getYangSchemaNodeUsingAppName(serviceName);
-        } else if (yangSchemaStoreForRootInterface.containsKey(serviceName)) {
-            schemaNode =
-                    getYangSchemaNodeUsingGeneratedRootNodeInterfaceFileName(
-                            serviceName);
-        } else if (yangSchemaStoreForRootOpParam.containsKey(serviceName)) {
-            schemaNode = getYangSchemaNodeUsingGeneratedRootNodeOpPramFileName(
-                    serviceName);
-        }
-
-        if (schemaNode != null) {
-            String name = getEventClassName(schemaNode);
-
-            YsrAppContext appContext =
-                    yangRootSchemaStoreForNotification.get(name);
-            if (appContext != null && !appContext.isNotificationRegistered()) {
-                appContext.setNotificationRegistered(true);
-                return true;
-            }
-        }
-        return false;
-    }
-
-    /**
-     * Returns schema node's generated interface class name.
-     *
-     * @param schemaNode schema node
-     * @return schema node's generated interface class name
-     */
-    private String getInterfaceClassName(YangSchemaNode schemaNode) {
-        return schemaNode.getJavaPackage() + PERIOD +
-                getCapitalCase(schemaNode.getJavaClassNameOrBuiltInType());
-    }
-
-    /**
-     * Returns schema node's generated op param class name.
-     *
-     * @param schemaNode schema node
-     * @return schema node's generated op param class name
-     */
-    private String getOpParamClassName(YangSchemaNode schemaNode) {
-        return getInterfaceClassName(schemaNode) + OP_PARAM;
-    }
-
-    /**
-     * Returns schema node's generated op param class name.
-     *
-     * @param schemaNode schema node
-     * @return schema node's generated op param class name
-     */
-    private String getDefaultClassName(YangSchemaNode schemaNode) {
-        return schemaNode.getJavaPackage() + PERIOD + getCapitalCase(DEFAULT) +
-                getCapitalCase(schemaNode.getJavaClassNameOrBuiltInType());
-    }
-
-    /**
-     * Returns schema node's generated event class name.
-     *
-     * @param schemaNode schema node
-     * @return schema node's generated event class name
-     */
-    private String getEventClassName(YangSchemaNode schemaNode) {
-        return getInterfaceClassName(schemaNode).toLowerCase() + PERIOD +
-                getCapitalCase(schemaNode.getJavaClassNameOrBuiltInType()) +
-                EVENT_STRING;
-    }
-
-    /**
-     * Returns schema node's generated service class name.
-     *
-     * @param schemaNode schema node
-     * @return schema node's generated service class name
-     */
-    private String getServiceName(YangSchemaNode schemaNode) {
-        return getInterfaceClassName(schemaNode) + SERVICE;
-    }
-
-    /**
-     * Returns YSR application context for schema map.
-     *
-     * @return YSR application context for schema map
-     */
-    YsrAppContext ysrContextForSchemaStore() {
-        return ysrContextForSchemaStore;
-    }
-
-    /**
-     * Sets YSR application context for schema map.
-     *
-     * @param context YSR application context for
-     *                schema map
-     */
-    void ysrContextForSchemaStore(YsrAppContext context) {
-        ysrContextForSchemaStore = context;
-    }
-
-    /**
-     * Returns YSR app context for application store.
-     *
-     * @return YSR app context for application store
-     */
-    YsrAppContext ysrContextForAppStore() {
-        return ysrContextForAppStore;
-    }
-
-    /**
-     * Retrieves schema node from the store and deletes jar file path.
-     *
-     * @param appName   application name
-     * @param store     YSR stores
-     * @param appObject applications object
-     * @return schema node from the store
-     */
-    private YangSchemaNode retrieveNodeForUnregister(
-            String appName,
-            ConcurrentMap<String, YsrAppContext> store, Object appObject) {
-
-        YsrAppContext curContext = store.get(appName);
-        boolean isValidObject;
-        if (curContext != null) {
-            isValidObject = verifyAppObject(appObject, curContext.appObject());
-            if (isValidObject) {
-                YangSchemaNode curNode = curContext.curNode();
-                //Delete all the generated ysr information in application's
-                // package.
-                removeYsrGeneratedTemporaryResources(curContext.jarPath(),
-                                                     appName);
-                return curNode;
-            }
-        }
-        return null;
-    }
-
-    /**
-     * Verifies the application object which needs to be unregistered.
-     *
-     * @param appObject current received application object
-     * @param context   stored application object
-     * @return true if objects are equal
-     */
-    private boolean verifyAppObject(Object appObject, Object context) {
-        if (appObject != null && context != null) {
-            return appObject.equals(context);
-        }
-        return appObject == null && context == null;
-    }
-
-    /**
-     * Removes YSR generated temporary resources.
-     *
-     * @param rscPath resource path
-     * @param appName application name
-     */
-    private void removeYsrGeneratedTemporaryResources(String rscPath,
-                                                      String appName) {
-        if (rscPath != null) {
-            File jarPath = new File(rscPath);
-            if (jarPath.exists()) {
-                try {
-                    deleteDirectory(jarPath);
-                } catch (IOException e) {
-                    log.error("failed to delete ysr resources for {} : {}",
-                              appName, e.getLocalizedMessage());
-                }
-            }
-        }
-    }
-
-    /**
-     * Removes from YANG schema store.
-     *
-     * @param curNode schema node
-     */
-    private void removeFromYangSchemaStore(YangSchemaNode curNode) {
-        removeSchemaNode(curNode);
-    }
-
-    /**
-     * Removes from YANG schema  notification store.
-     *
-     * @param curNode schema node
-     */
-    private void removeFromYangNotificationStore(YangSchemaNode curNode) {
-        yangRootSchemaStoreForNotification
-                .remove(getEventClassName(curNode));
-    }
-
-    /**
-     * Removes from app store.
-     *
-     * @param appName application name
-     */
-    private void removeFromAppSchemaStore(String appName) {
-        appObjectStore.remove(appName);
-    }
-
-    /**
-     * Removes from interface store.
-     *
-     * @param appName application name
-     */
-    private void removeFromYangSchemaNodeForRootInterface(String appName) {
-        yangSchemaStoreForRootInterface.remove(appName);
-    }
-
-    /**
-     * Removes from op param store.
-     *
-     * @param appName application name
-     */
-    private void removeFromYangSchemaNodeForRootOpParam(String appName) {
-        yangSchemaStoreForRootOpParam.remove(appName + OP_PARAM);
-    }
-
-    /**
-     * Removes YANG file information from file store.
-     *
-     * @param schemaNode schema node
-     */
-    private void removeYangFileInfoFromStore(YangSchemaNode schemaNode) {
-        yangFileStore.remove(getModuleIdentifier(schemaNode));
-    }
-
-    /**
-     * Verifies if class with given name exists.
-     *
-     * @param appName application name
-     * @return true if class exists
-     */
-    boolean verifyClassExistence(String appName) {
-        try {
-            classLoader.loadClass(appName);
-            return true;
-        } catch (ClassNotFoundException e) {
-            return false;
-        }
-    }
-
-    /**
-     * Clears database for YSR.
-     */
-    public void flushYsrData() {
-        appObjectStore.clear();
-        yangSchemaStore.clear();
-        yangRootSchemaStoreForNotification.clear();
-        yangSchemaStoreForRootOpParam.clear();
-        yangSchemaStoreForRootInterface.clear();
-        registerClassStore.clear();
-        yangFileStore.clear();
-    }
-
-    /**
-     * Sets class loader of registered class.
-     *
-     * @param classLoader class loader of registered class
-     */
-    void setClassLoader(ClassLoader classLoader) {
-        this.classLoader = classLoader;
-    }
-
-    /**
-     * Process module library for a registered service.
-     *
-     * @param node YANG schema nodes
-     */
-    private void processModuleLibrary(YangNode node) {
-        YangModuleInformation moduleInformation =
-                new DefaultYangModuleInformation(getModuleIdentifier(node),
-                                                 node.getNameSpace());
-        addSubModuleIdentifier(node, (
-                DefaultYangModuleInformation) moduleInformation);
-        //TODO: add feature list to module information.
-        ((DefaultYangModuleLibrary) library)
-                .addModuleInformation(moduleInformation);
-    }
-
-    /**
      * Adds sub module identifier.
      *
      * @param node        schema node
@@ -1026,11 +671,66 @@
     }
 
     /**
-     * Returns module library.
+     * Returns schema node's generated interface class name.
      *
-     * @return module library
+     * @param schemaNode schema node
+     * @return schema node's generated interface class name
      */
-    public YangModuleLibrary getLibrary() {
-        return library;
+    String getInterfaceClassName(YangSchemaNode schemaNode) {
+        return schemaNode.getJavaPackage() + PERIOD +
+                getCapitalCase(schemaNode.getJavaClassNameOrBuiltInType());
     }
-}
+
+    /**
+     * Returns schema node's generated op param class name.
+     *
+     * @param schemaNode schema node
+     * @return schema node's generated op param class name
+     */
+    private String getOpParamClassName(YangSchemaNode schemaNode) {
+        return getInterfaceClassName(schemaNode) + OP_PARAM;
+    }
+
+    /**
+     * Returns schema node's generated event class name.
+     *
+     * @param schemaNode schema node
+     * @return schema node's generated event class name
+     */
+    private String getEventClassName(YangSchemaNode schemaNode) {
+        return getInterfaceClassName(schemaNode).toLowerCase() + PERIOD +
+                getCapitalCase(schemaNode.getJavaClassNameOrBuiltInType()) +
+                EVENT_STRING;
+    }
+
+    /**
+     * Returns schema node's generated service class name.
+     *
+     * @param schemaNode schema node
+     * @return schema node's generated service class name
+     */
+    String getServiceName(YangSchemaNode schemaNode) {
+        return getInterfaceClassName(schemaNode) + SERVICE;
+    }
+
+    /**
+     * Removes YSR generated temporary resources.
+     *
+     * @param rscPath resource path
+     * @param appName application name
+     */
+    private void removeYsrGeneratedTemporaryResources(String rscPath,
+                                                      String appName) {
+        if (rscPath != null) {
+            File jarPath = new File(rscPath);
+            if (jarPath.exists()) {
+                try {
+                    deleteDirectory(jarPath);
+                } catch (IOException e) {
+                    log.error("failed to delete ysr resources for {} : {}",
+                              appName, e.getLocalizedMessage());
+                }
+            }
+        }
+    }
+}
\ No newline at end of file
diff --git a/apps/yms/app/src/main/java/org/onosproject/yms/app/ysr/YangSchemaRegistry.java b/apps/yms/app/src/main/java/org/onosproject/yms/app/ysr/YangSchemaRegistry.java
index 8098188..ed5d95a 100644
--- a/apps/yms/app/src/main/java/org/onosproject/yms/app/ysr/YangSchemaRegistry.java
+++ b/apps/yms/app/src/main/java/org/onosproject/yms/app/ysr/YangSchemaRegistry.java
@@ -17,6 +17,8 @@
 package org.onosproject.yms.app.ysr;
 
 import org.onosproject.yangutils.datamodel.YangSchemaNode;
+import org.onosproject.yms.ysr.YangModuleIdentifier;
+import org.onosproject.yms.ysr.YangModuleLibrary;
 
 /**
  * Abstraction of entity which provides interfaces to YANG schema registry.
@@ -27,7 +29,8 @@
      * Registers applications to YMS.
      *
      * @param managerObject application's object
-     * @param serviceClass  service class to be registered
+     * @param serviceClass  service class which needs to be
+     *                      registered
      */
     void registerApplication(Object managerObject, Class<?> serviceClass);
 
@@ -96,9 +99,46 @@
      * Returns registered service class.
      *
      * @param schemaNode YANG schema node
-     * @param appName    application's name
      * @return registered service class
      */
-    Class<?> getRegisteredClass(YangSchemaNode schemaNode, String appName);
+    Class<?> getRegisteredClass(YangSchemaNode schemaNode);
+
+    /**
+     * Verifies if the manager object is already registered with notification
+     * handler.
+     *
+     * @param appObj  application object
+     * @param service service class
+     * @return true if the manager object is already registered with
+     * notification handler
+     */
+    boolean verifyNotificationObject(Object appObj, Class<?> service);
+
+    /**
+     * Clears database for YSR.
+     */
+    void flushYsrData();
+
+    /**
+     * Protocols like RESTCONF, use the definitions within the YANG modules
+     * advertised by the server are used to construct an RPC operation or
+     * data resource identifier.
+     * <p>
+     * Schema Resource:
+     * The server can optionally support retrieval of the YANG modules it
+     * supports.
+     *
+     * @param moduleIdentifier module's identifier
+     * @return YANG file contents of the requested YANG module.
+     */
+    String getYangFile(YangModuleIdentifier moduleIdentifier);
+
+    /**
+     * Process module library for a registered service.
+     *
+     * @param serviceName service class name
+     * @param library     YANG module library
+     */
+    void processModuleLibrary(String serviceName, YangModuleLibrary library);
 
 }
diff --git a/apps/yms/app/src/main/java/org/onosproject/yms/app/ysr/YsrAppContext.java b/apps/yms/app/src/main/java/org/onosproject/yms/app/ysr/YsrAppContext.java
deleted file mode 100644
index 4f076ab..0000000
--- a/apps/yms/app/src/main/java/org/onosproject/yms/app/ysr/YsrAppContext.java
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- * 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.ysr;
-
-import com.google.common.collect.ImmutableMap;
-import org.onosproject.yangutils.datamodel.YangSchemaNode;
-
-import java.util.Map;
-import java.util.Objects;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-
-/**
- * Represents registered application's context for YANG schema registry.
- */
-public class YsrAppContext {
-
-    /**
-     * Current application's YANG schema node.
-     */
-    private YangSchemaNode curNode;
-
-    /**
-     * Current application's YANG schema node with different revision store.
-     */
-    private final ConcurrentMap<String, YangSchemaNode>
-            multiRevisionSchemaNodeStore;
-
-    /**
-     * Current application's object.
-     */
-    private Object appObject;
-
-    /**
-     * Jar file path.
-     */
-    private String jarPath;
-
-    /**
-     * If for current object notification is registered.
-     */
-    private boolean isNotificationRegistered;
-
-    /**
-     * Creates an instance of YANG schema registry application context.
-     */
-    YsrAppContext() {
-        multiRevisionSchemaNodeStore = new ConcurrentHashMap<>();
-    }
-
-    /**
-     * Returns current application's object.
-     *
-     * @return current application's object
-     */
-    Object appObject() {
-        return appObject;
-    }
-
-    /**
-     * Sets current application's object.
-     *
-     * @param appObject current application's object
-     */
-    void appObject(Object appObject) {
-        this.appObject = appObject;
-    }
-
-    /**
-     * Returns current application's YANG schema node.
-     *
-     * @return current application's YANG schema node
-     */
-    YangSchemaNode curNode() {
-        return curNode;
-    }
-
-    /**
-     * Sets current application's schema node.
-     *
-     * @param node current schema's node
-     */
-    void curNode(YangSchemaNode node) {
-        curNode = node;
-    }
-
-    /**
-     * Returns jar file path.
-     *
-     * @return jar file path
-     */
-    String jarPath() {
-        return jarPath;
-    }
-
-    /**
-     * Sets jar file path.
-     *
-     * @param jarPath jar file path
-     */
-    void jarPath(String jarPath) {
-        this.jarPath = jarPath;
-    }
-
-    @Override
-    public int hashCode() {
-        return Objects.hash(curNode, appObject);
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (obj instanceof YsrAppContext) {
-            YsrAppContext that = (YsrAppContext) obj;
-            return Objects.equals(curNode, that.curNode) &&
-                    Objects.equals(appObject, that.appObject);
-        }
-        return false;
-    }
-
-    /**
-     * Returns true if for application object notification is registered.
-     *
-     * @return true if for application object notification is registered
-     */
-    boolean isNotificationRegistered() {
-        return isNotificationRegistered;
-    }
-
-    /**
-     * Sets true if for application object notification is registered.
-     *
-     * @param notificationRegistered true if for application object notification is registered
-     */
-    void setNotificationRegistered(boolean notificationRegistered) {
-        isNotificationRegistered = notificationRegistered;
-    }
-
-    /**
-     * Returns YANG schema node store for specific revision.
-     *
-     * @return YANG schema node store for specific revision
-     */
-    Map<String, YangSchemaNode> getYangSchemaNodeForRevisionStore() {
-        return ImmutableMap.copyOf(multiRevisionSchemaNodeStore);
-    }
-
-    /**
-     * Returns a schema node for specific revision from store.
-     *
-     * @param nodeNameWithRevision schema node name for specific revision
-     * @return schema node for specific revision.
-     */
-    YangSchemaNode getSchemaNodeForRevisionStore(String nodeNameWithRevision) {
-        return multiRevisionSchemaNodeStore.get(nodeNameWithRevision);
-    }
-
-    /**
-     * Removes a schema node of specific revision from store.
-     *
-     * @param nodeNameWithRevision schema node name for specific revision
-     */
-    void removeSchemaNodeForRevisionStore(String nodeNameWithRevision) {
-        multiRevisionSchemaNodeStore.remove(nodeNameWithRevision);
-    }
-
-    /**
-     * Adds schema node with revision from store.
-     *
-     * @param nodeNameWithRevision schema node name for specific revision
-     * @param schemaNode           schema node for specific revision
-     */
-    void addSchemaNodeWithRevisionStore(String nodeNameWithRevision, YangSchemaNode schemaNode) {
-        multiRevisionSchemaNodeStore.put(nodeNameWithRevision, schemaNode);
-    }
-}
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
index 8329c9f..b81743b 100644
--- 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
@@ -229,8 +229,8 @@
         YangNode moduleNode = curNode.getParent();
         String moduleName = moduleNode.getJavaClassNameOrBuiltInType();
         String modulePackage = moduleNode.getJavaPackage();
-        return registry.getRegisteredClass(moduleNode,
-                                           modulePackage + PERIOD + moduleName);
+        return registry.getRegisteredClass(moduleNode
+        );
     }
 
     /**