[ONOS-5099] Framework in YANG utils to provide functions for YMS optimization

Change-Id: I7dd1ce9327367e7846fba89b7b5f300323e86c43
diff --git a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangAugment.java b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangAugment.java
index 13e43ac..84c3698 100644
--- a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangAugment.java
+++ b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangAugment.java
@@ -17,7 +17,6 @@
 
 import java.util.LinkedList;
 import java.util.List;
-
 import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
 import org.onosproject.yangutils.datamodel.utils.Parsable;
 import org.onosproject.yangutils.datamodel.utils.ResolvableStatus;
@@ -152,6 +151,11 @@
         resolvableStatus = ResolvableStatus.UNRESOLVED;
     }
 
+    @Override
+    public YangSchemaNodeType getYangSchemaNodeType() {
+        return YangSchemaNodeType.YANG_NON_DATA_NODE;
+    }
+
     /**
      * Returns the augmented node.
      *
diff --git a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangCase.java b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangCase.java
index e1e037a..9e93a58 100644
--- a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangCase.java
+++ b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangCase.java
@@ -18,7 +18,6 @@
 import java.util.ArrayList;
 import java.util.LinkedList;
 import java.util.List;
-
 import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
 import org.onosproject.yangutils.datamodel.utils.Parsable;
 import org.onosproject.yangutils.datamodel.utils.YangConstructType;
@@ -153,6 +152,11 @@
         listOfLeafList = new LinkedList<>();
     }
 
+    @Override
+    public YangSchemaNodeType getYangSchemaNodeType() {
+        return YangSchemaNodeType.YANG_NON_DATA_NODE;
+    }
+
     /**
      * Returns the when.
      *
diff --git a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangChoice.java b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangChoice.java
index aa37ed0..b549d6c 100644
--- a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangChoice.java
+++ b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangChoice.java
@@ -18,7 +18,6 @@
 import java.util.ArrayList;
 import java.util.LinkedList;
 import java.util.List;
-
 import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
 import org.onosproject.yangutils.datamodel.utils.Parsable;
 import org.onosproject.yangutils.datamodel.utils.YangConstructType;
@@ -90,21 +89,21 @@
 
     /**
      * Reference RFC 6020.
-     *
+     * <p>
      * The "mandatory" statement, which is optional, takes as an argument the
      * string "true" or "false", and puts a constraint on valid data. If
      * "mandatory" is "true", at least one node from exactly one of the choice's
      * case branches MUST exist.
-     *
+     * <p>
      * If not specified, the default is "false".
-     *
+     * <p>
      * The behavior of the constraint depends on the type of the choice's
      * closest ancestor node in the schema tree which is not a non-presence
      * container:
-     *
+     * <p>
      * o If this ancestor is a case node, the constraint is enforced if any
      * other node from the case exists.
-     *
+     * <p>
      * o Otherwise, it is enforced if the ancestor node exists.
      */
     private String mandatory;
@@ -173,6 +172,11 @@
         yangAppErrorInfo.setErrorAppPath(ERROR_PATH_MISSING_CHOICE);
     }
 
+    @Override
+    public YangSchemaNodeType getYangSchemaNodeType() {
+        return YangSchemaNodeType.YANG_NON_DATA_NODE;
+    }
+
     /**
      * Returns the when.
      *
@@ -370,7 +374,7 @@
 
             if (!matched) {
                 throw new DataModelException("YANG file error: default string \"" + defaultValueInString
-                                                     + "\" not matching choice \"" + getName() + "\" case.");
+                        + "\" not matching choice \"" + getName() + "\" case.");
             }
         }
     }
diff --git a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangContainer.java b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangContainer.java
index ddace18..940d598 100644
--- a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangContainer.java
+++ b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangContainer.java
@@ -19,7 +19,6 @@
 import java.util.ArrayList;
 import java.util.LinkedList;
 import java.util.List;
-
 import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
 import org.onosproject.yangutils.datamodel.utils.Parsable;
 import org.onosproject.yangutils.datamodel.utils.YangConstructType;
@@ -162,6 +161,11 @@
         listOfLeafList = new LinkedList<>();
     }
 
+    @Override
+    public YangSchemaNodeType getYangSchemaNodeType() {
+        return YangSchemaNodeType.YANG_SINGLE_INSTANCE_NODE;
+    }
+
     /**
      * Returns the when.
      *
diff --git a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangDataNode.java b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangDataNode.java
deleted file mode 100644
index 80dede4..0000000
--- a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangDataNode.java
+++ /dev/null
@@ -1,24 +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.yangutils.datamodel;
-
-/**
- * Abstraction of YANG data node, used by YMS to abstractly refer the data
- * nodes in YANG data tree.
- */
-public interface YangDataNode {
-}
diff --git a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangEnumeration.java b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangEnumeration.java
index cf23464..b230b88 100644
--- a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangEnumeration.java
+++ b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangEnumeration.java
@@ -18,7 +18,6 @@
 
 import java.util.SortedSet;
 import java.util.TreeSet;
-
 import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
 import org.onosproject.yangutils.datamodel.utils.Parsable;
 import org.onosproject.yangutils.datamodel.utils.YangConstructType;
@@ -51,6 +50,11 @@
         setEnumSet(new TreeSet<YangEnum>());
     }
 
+    @Override
+    public YangSchemaNodeType getYangSchemaNodeType() {
+        return YangSchemaNodeType.YANG_NON_DATA_NODE;
+    }
+
     /**
      * Returns the ENUM set.
      *
diff --git a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangGrouping.java b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangGrouping.java
index bf85835..08fc4bd 100644
--- a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangGrouping.java
+++ b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangGrouping.java
@@ -17,7 +17,6 @@
 
 import java.util.LinkedList;
 import java.util.List;
-
 import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
 import org.onosproject.yangutils.datamodel.utils.Parsable;
 import org.onosproject.yangutils.datamodel.utils.YangConstructType;
@@ -122,6 +121,11 @@
         listOfLeafList = new LinkedList<YangLeafList>();
     }
 
+    @Override
+    public YangSchemaNodeType getYangSchemaNodeType() {
+        return YangSchemaNodeType.YANG_NON_DATA_NODE;
+    }
+
     /**
      * Returns YANG grouping name.
      *
diff --git a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangIdentity.java b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangIdentity.java
index 5e57012..dc252b5 100644
--- a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangIdentity.java
+++ b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangIdentity.java
@@ -15,12 +15,11 @@
  */
 package org.onosproject.yangutils.datamodel;
 
+import java.io.Serializable;
 import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
 import org.onosproject.yangutils.datamodel.utils.Parsable;
 import org.onosproject.yangutils.datamodel.utils.YangConstructType;
 
-import java.io.Serializable;
-
 /*-
  * Reference RFC 6020.
  *
@@ -71,6 +70,11 @@
         super(YangNodeType.IDENTITY_NODE);
     }
 
+    @Override
+    public YangSchemaNodeType getYangSchemaNodeType() {
+        return YangSchemaNodeType.YANG_NON_DATA_NODE;
+    }
+
     /**
      * Returns the name of identity.
      *
diff --git a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangIdentityRef.java b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangIdentityRef.java
index 2019339..f6d4128 100644
--- a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangIdentityRef.java
+++ b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangIdentityRef.java
@@ -15,13 +15,12 @@
  */
 package org.onosproject.yangutils.datamodel;
 
+import java.io.Serializable;
 import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
 import org.onosproject.yangutils.datamodel.utils.Parsable;
 import org.onosproject.yangutils.datamodel.utils.ResolvableStatus;
 import org.onosproject.yangutils.datamodel.utils.YangConstructType;
 
-import java.io.Serializable;
-
 /*-
  * Reference RFC 6020.
  *
@@ -70,6 +69,11 @@
     }
 
     @Override
+    public YangSchemaNodeType getYangSchemaNodeType() {
+        return YangSchemaNodeType.YANG_NON_DATA_NODE;
+    }
+
+    @Override
     public ResolvableStatus getResolvableStatus() {
         return resolvableStatus;
     }
diff --git a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangInput.java b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangInput.java
index 272a6e2..d3714be 100644
--- a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangInput.java
+++ b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangInput.java
@@ -102,6 +102,11 @@
     }
 
     @Override
+    public YangSchemaNodeType getYangSchemaNodeType() {
+        return YangSchemaNodeType.YANG_SINGLE_INSTANCE_NODE;
+    }
+
+    @Override
     public void detectCollidingChild(String identifierName, YangConstructType dataType)
             throws DataModelException {
         // Detect colliding child.
diff --git a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangLeaf.java b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangLeaf.java
index 3060fd4..bfdec10 100644
--- a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangLeaf.java
+++ b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangLeaf.java
@@ -19,6 +19,8 @@
 import java.io.Serializable;
 import java.util.LinkedList;
 import java.util.List;
+import java.util.Map;
+import java.util.Set;
 import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
 import org.onosproject.yangutils.datamodel.utils.Parsable;
 import org.onosproject.yangutils.datamodel.utils.YangConstructType;
@@ -62,7 +64,7 @@
  */
 public class YangLeaf
         implements YangCommonInfo, Parsable, Cloneable, Serializable,
-        YangMustHolder, YangIfFeatureHolder, YangWhenHolder, YangDataNode {
+        YangMustHolder, YangIfFeatureHolder, YangWhenHolder, YangSchemaNode {
 
     private static final long serialVersionUID = 806201635L;
 
@@ -420,4 +422,28 @@
     public void setIfFeatureList(List<YangIfFeature> ifFeatureList) {
         this.ifFeatureList = ifFeatureList;
     }
+
+    @Override
+    public YangSchemaNodeContextInfo getChildSchema(YangSchemaNodeIdentifier dataNodeIdentifier) {
+        // Returns null as there is no child to leaf.
+        return null;
+    }
+
+    @Override
+    public Set<YangSchemaNode> getMandatoryChildSet(YangSchemaNodeIdentifier dataNodeIdentifier) {
+        // Returns null as there is no child to leaf.
+        return null;
+    }
+
+    @Override
+    public Map<YangSchemaNodeIdentifier, YangSchemaNode> getDefaultChild(YangSchemaNodeIdentifier dataNodeIdentifier) {
+        // Returns null as there is no child to leaf.
+        return null;
+    }
+
+    @Override
+    public YangSchemaNodeType getYangSchemaNodeType() {
+        return YangSchemaNodeType.YANG_SINGLE_INSTANCE_LEAF_NODE;
+    }
+
 }
diff --git a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangLeafList.java b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangLeafList.java
index cbb2038..358fc32 100644
--- a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangLeafList.java
+++ b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangLeafList.java
@@ -19,6 +19,8 @@
 import java.io.Serializable;
 import java.util.LinkedList;
 import java.util.List;
+import java.util.Map;
+import java.util.Set;
 import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
 import org.onosproject.yangutils.datamodel.utils.Parsable;
 import org.onosproject.yangutils.datamodel.utils.YangConstructType;
@@ -58,7 +60,7 @@
  */
 public class YangLeafList
         implements YangCommonInfo, Parsable, Cloneable, Serializable,
-        YangMustHolder, YangWhenHolder, YangIfFeatureHolder, YangDataNode {
+        YangMustHolder, YangWhenHolder, YangIfFeatureHolder, YangSchemaNode {
 
     private static final long serialVersionUID = 806201637L;
 
@@ -79,32 +81,32 @@
 
     /**
      * Reference:RFC 6020.
-     *
+     * <p>
      * The "max-elements" statement, which is optional, takes as an argument a
      * positive integer or the string "unbounded", which puts a constraint on
      * valid list entries. A valid leaf-list or list always has at most
      * max-elements entries.
-     *
+     * <p>
      * If no "max-elements" statement is present, it defaults to "unbounded".
      */
     private YangMaxElement maxElement;
 
     /**
      * Reference:RFC 6020.
-     *
+     * <p>
      * The "min-elements" statement, which is optional, takes as an argument a
      * non-negative integer that puts a constraint on valid list entries. A
      * valid leaf-list or list MUST have at least min-elements entries.
-     *
+     * <p>
      * If no "min-elements" statement is present, it defaults to zero.
-     *
+     * <p>
      * The behavior of the constraint depends on the type of the leaf-list's or
      * list's closest ancestor node in the schema tree that is not a non-
      * presence container:
-     *
+     * <p>
      * o If this ancestor is a case node, the constraint is enforced if any
      * other node from the case exists.
-     *
+     * <p>
      * o Otherwise, it is enforced if the ancestor node exists.
      */
     private YangMinElement minElements;
@@ -438,4 +440,27 @@
         }
         getListOfMust().add(must);
     }
+
+    @Override
+    public YangSchemaNodeContextInfo getChildSchema(YangSchemaNodeIdentifier dataNodeIdentifier) {
+        // Returns null as there is no child to leaf list.
+        return null;
+    }
+
+    @Override
+    public Set<YangSchemaNode> getMandatoryChildSet(YangSchemaNodeIdentifier dataNodeIdentifier) {
+        // Returns null as there is no child to leaf list.
+        return null;
+    }
+
+    @Override
+    public Map<YangSchemaNodeIdentifier, YangSchemaNode> getDefaultChild(YangSchemaNodeIdentifier dataNodeIdentifier) {
+        // Returns null as there is no child to leaf list.
+        return null;
+    }
+
+    @Override
+    public YangSchemaNodeType getYangSchemaNodeType() {
+        return YangSchemaNodeType.YANG_MULTI_INSTANCE_LEAF_NODE;
+    }
 }
diff --git a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangList.java b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangList.java
index 9571c90..683a492 100644
--- a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangList.java
+++ b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangList.java
@@ -19,7 +19,6 @@
 import java.util.ArrayList;
 import java.util.LinkedList;
 import java.util.List;
-
 import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
 import org.onosproject.yangutils.datamodel.utils.Parsable;
 import org.onosproject.yangutils.datamodel.utils.YangConstructType;
@@ -72,7 +71,7 @@
 public class YangList
         extends YangNode
         implements YangLeavesHolder, YangCommonInfo, Parsable, CollisionDetector,
-        YangAugmentableNode, YangMustHolder, YangWhenHolder, YangIfFeatureHolder, YangDataNode,
+        YangAugmentableNode, YangMustHolder, YangWhenHolder, YangIfFeatureHolder, YangSchemaNode,
         YangIsFilterContentNodes {
 
     private static final long serialVersionUID = 806201609L;
@@ -165,20 +164,20 @@
 
     /**
      * Reference RFC 6020.
-     *
+     * <p>
      * The "min-elements" statement, which is optional, takes as an argument a
      * non-negative integer that puts a constraint on valid list entries. A
      * valid leaf-list or list MUST have at least min-elements entries.
-     *
+     * <p>
      * If no "min-elements" statement is present, it defaults to zero.
-     *
+     * <p>
      * The behavior of the constraint depends on the type of the leaf-list's or
      * list's closest ancestor node in the schema tree that is not a non-
      * presence container:
-     *
+     * <p>
      * o If this ancestor is a case node, the constraint is enforced if any
      * other node from the case exists.
-     *
+     * <p>
      * o Otherwise, it is enforced if the ancestor node exists.
      */
     private YangMinElement minElements;
@@ -222,6 +221,11 @@
         listOfLeafList = new LinkedList<>();
     }
 
+    @Override
+    public YangSchemaNodeType getYangSchemaNodeType() {
+        return YangSchemaNodeType.YANG_MULTI_INSTANCE_LEAF_NODE;
+    }
+
     /**
      * Returns the compiler annotation.
      *
diff --git a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangModule.java b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangModule.java
index 5d246a4..be59305 100644
--- a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangModule.java
+++ b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangModule.java
@@ -261,6 +261,11 @@
         extensionList = new LinkedList<>();
     }
 
+    @Override
+    public YangSchemaNodeType getYangSchemaNodeType() {
+        return YangSchemaNodeType.YANG_SINGLE_INSTANCE_NODE;
+    }
+
     /**
      * Returns name of the module.
      *
diff --git a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangNode.java b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangNode.java
index ced0910..6e470b3 100644
--- a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangNode.java
+++ b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangNode.java
@@ -16,6 +16,8 @@
 package org.onosproject.yangutils.datamodel;
 
 import java.io.Serializable;
+import java.util.Map;
+import java.util.Set;
 import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
 import org.onosproject.yangutils.datamodel.utils.Parsable;
 
@@ -29,7 +31,7 @@
  * Represents base class of a node in data model tree.
  */
 public abstract class YangNode
-        implements Cloneable, Serializable, YangDataNode, Comparable<YangNode> {
+        implements Cloneable, Serializable, YangSchemaNode, Comparable<YangNode> {
 
     private static final long serialVersionUID = 806201601L;
 
@@ -69,6 +71,21 @@
     private boolean isToTranslate = true;
 
     /**
+     * Map of YANG context information. It is to be consumed by YMS.
+     */
+    private Map<YangSchemaNodeIdentifier, YangSchemaNodeContextInfo> ysnContextInfoMap;
+
+    /**
+     * Set of mandatory YANG schema nodes.
+     */
+    private Set<YangSchemaNode> mandatoryChildSet;
+
+    /**
+     * Map of default schema nodes.
+     */
+    private Map<YangSchemaNodeIdentifier, YangSchemaNode> defaultChildMap;
+
+    /**
      * Returns the priority of the node.
      *
      * @return priority of the node
@@ -471,4 +488,72 @@
             throw new DataModelException("Sibling to be added is not atomic, it already has a next sibling");
         }
     }
+
+    @Override
+    public YangSchemaNodeContextInfo getChildSchema(YangSchemaNodeIdentifier dataNodeIdentifier) {
+        return ysnContextInfoMap.get(dataNodeIdentifier);
+    }
+
+    @Override
+    public Set<YangSchemaNode> getMandatoryChildSet(YangSchemaNodeIdentifier dataNodeIdentifier) {
+        return mandatoryChildSet;
+    }
+
+    @Override
+    public Map<YangSchemaNodeIdentifier, YangSchemaNode> getDefaultChild(YangSchemaNodeIdentifier dataNodeIdentifier) {
+        return defaultChildMap;
+    }
+
+    /**
+     * Adds child schema in child schema map.
+     *
+     * @param schemaNodeIdentifier      YANG schema node identifier
+     * @param yangSchemaNodeContextInfo YANG data node context information
+     */
+    public void addToChildSchemaMap(YangSchemaNodeIdentifier schemaNodeIdentifier,
+                                    YangSchemaNodeContextInfo yangSchemaNodeContextInfo) {
+        getYsnContextInfoMap().put(schemaNodeIdentifier, yangSchemaNodeContextInfo);
+    }
+
+    /**
+     * Adds mandatory child information to set.
+     *
+     * @param yangSchemaNode YANG schema node
+     */
+    public void addToMandatoryChildSet(YangSchemaNode yangSchemaNode) {
+        mandatoryChildSet.add(yangSchemaNode);
+    }
+
+    /**
+     * Adds default child information to map.
+     *
+     * @param yangSchemaNodeIdentifier YANG schema node identifier
+     * @param yangSchemaNode           YANG schema node
+     */
+    public void addToDefaultChildMap(YangSchemaNodeIdentifier yangSchemaNodeIdentifier, YangSchemaNode yangSchemaNode) {
+        getDefaultChildMap().put(yangSchemaNodeIdentifier, yangSchemaNode);
+    }
+
+    /**
+     * Returns default child map.
+     *
+     * @return default child map
+     */
+    public Map<YangSchemaNodeIdentifier, YangSchemaNode> getDefaultChildMap() {
+        return defaultChildMap;
+    }
+
+    /**
+     * Returns YANG schema node context info map.
+     *
+     * @return YANG schema node context info map
+     */
+    public Map<YangSchemaNodeIdentifier, YangSchemaNodeContextInfo> getYsnContextInfoMap() {
+        return ysnContextInfoMap;
+    }
+
+    @Override
+    public abstract YangSchemaNodeType getYangSchemaNodeType();
+
+
 }
diff --git a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangNotification.java b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangNotification.java
index 0484b0e..a3302b7 100644
--- a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangNotification.java
+++ b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangNotification.java
@@ -129,6 +129,11 @@
     }
 
     @Override
+    public YangSchemaNodeType getYangSchemaNodeType() {
+        return YangSchemaNodeType.YANG_SINGLE_INSTANCE_NODE;
+    }
+
+    @Override
     public void detectCollidingChild(String identifierName, YangConstructType dataType)
             throws DataModelException {
         // Detect colliding child.
diff --git a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangOutput.java b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangOutput.java
index 0e496bb..8340601 100644
--- a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangOutput.java
+++ b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangOutput.java
@@ -19,7 +19,6 @@
 import java.util.ArrayList;
 import java.util.LinkedList;
 import java.util.List;
-
 import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
 import org.onosproject.yangutils.datamodel.utils.Parsable;
 import org.onosproject.yangutils.datamodel.utils.YangConstructType;
@@ -101,6 +100,11 @@
     }
 
     @Override
+    public YangSchemaNodeType getYangSchemaNodeType() {
+        return YangSchemaNodeType.YANG_SINGLE_INSTANCE_NODE;
+    }
+
+    @Override
     public void detectCollidingChild(String identifierName, YangConstructType dataType)
             throws DataModelException {
         // Detect colliding child.
diff --git a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangRpc.java b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangRpc.java
index 72060ad..d6e71d3 100644
--- a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangRpc.java
+++ b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangRpc.java
@@ -96,6 +96,11 @@
     }
 
     @Override
+    public YangSchemaNodeType getYangSchemaNodeType() {
+        return YangSchemaNodeType.YANG_SINGLE_INSTANCE_NODE;
+    }
+
+    @Override
     public String getName() {
         return name;
     }
diff --git a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangSchemaNode.java b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangSchemaNode.java
new file mode 100644
index 0000000..3c5241c
--- /dev/null
+++ b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangSchemaNode.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.yangutils.datamodel;
+
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Abstraction of YANG data node, used by YMS to abstractly refer the data
+ * nodes in YANG data tree.
+ */
+public interface YangSchemaNode {
+
+    /**
+     * Returns type of YANG schema node.
+     *
+     * @return type of YANG schema node
+     */
+    YangSchemaNodeType getYangSchemaNodeType();
+
+    /**
+     * Returns child schema information. It is used by YMS to obtain the child
+     * schema corresponding to data node identifier.
+     *
+     * @param dataNodeIdentifier YANG data node identifier
+     * @return YANG data node context information
+     */
+    YangSchemaNodeContextInfo getChildSchema(YangSchemaNodeIdentifier dataNodeIdentifier);
+
+    /**
+     * Returns set of mandatory child nodes, this is used by YMS to identify whether
+     * in request all mandatory child nodes are available.
+     *
+     * @param dataNodeIdentifier YANG data node identifier
+     * @return set of YANG schema nodes
+     */
+    Set<YangSchemaNode> getMandatoryChildSet(YangSchemaNodeIdentifier dataNodeIdentifier);
+
+    /**
+     * Returns map of default child nodes, this is used by YMS to identify whether
+     * in request all default child nodes are available.
+     *
+     * @param dataNodeIdentifier YANG data node identifier
+     * @return map of default child nodes
+     */
+    Map<YangSchemaNodeIdentifier, YangSchemaNode> getDefaultChild(YangSchemaNodeIdentifier dataNodeIdentifier);
+}
diff --git a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangSchemaNodeContextInfo.java b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangSchemaNodeContextInfo.java
new file mode 100644
index 0000000..bbec4b7
--- /dev/null
+++ b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangSchemaNodeContextInfo.java
@@ -0,0 +1,78 @@
+/*
+ * 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.yangutils.datamodel;
+
+import java.io.Serializable;
+
+/**
+ * Abstraction of YANG data node context information, used by YMS to abstractly
+ * refer the YANG data nodes schema context information.
+ */
+public class YangSchemaNodeContextInfo implements Serializable {
+
+    private static final long serialVersionUID = 806201613L;
+
+    // Current schema node
+    YangSchemaNode schemaNode;
+
+    /*
+     * Context switched schema node, it will be non null only for the scenarios
+     * in which context switch is there like augment, choice etc, in this case
+     * this node will point to context switched node like YangAugmentInfo.
+     */
+    YangSchemaNode contextSwitchedNode;
+
+    // Default instance of YangSchemaNodeContextInfo.
+    YangSchemaNodeContextInfo() {
+    }
+
+    /**
+     * Returns the YANG schema node.
+     *
+     * @return YANG schema node
+     */
+    public YangSchemaNode getSchemaNode() {
+        return schemaNode;
+    }
+
+    /**
+     * Sets YANG schema node.
+     *
+     * @param schemaNode YANG schema node
+     */
+    public void setSchemaNode(YangSchemaNode schemaNode) {
+        this.schemaNode = schemaNode;
+    }
+
+    /**
+     * Returns context switched node.
+     *
+     * @return context switched node
+     */
+    public YangSchemaNode getContextSwitchedNode() {
+        return contextSwitchedNode;
+    }
+
+    /**
+     * Set context switched node.
+     *
+     * @param contextSwitchedNode context switched node
+     */
+    public void setContextSwitchedNode(YangSchemaNode contextSwitchedNode) {
+        this.contextSwitchedNode = contextSwitchedNode;
+    }
+}
diff --git a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangSchemaNodeIdentifier.java b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangSchemaNodeIdentifier.java
new file mode 100644
index 0000000..acdb61e
--- /dev/null
+++ b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangSchemaNodeIdentifier.java
@@ -0,0 +1,76 @@
+/*
+ * 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.yangutils.datamodel;
+
+import java.io.Serializable;
+
+/**
+ * Represents YANG data node identifier which is a combination of name and namespace.
+ * Namespace will be present only if node is module/sub-module or augmented node.
+ */
+public class YangSchemaNodeIdentifier implements Serializable {
+
+    private static final long serialVersionUID = 806201648L;
+
+    // Name of YANG data node.
+    String name;
+
+    // Namespace of YANG data node.
+    String namespace;
+
+    /**
+     * Creates an instance of YANG data node identifier.
+     */
+    public YangSchemaNodeIdentifier() {
+    }
+
+    /**
+     * Returns the name of the node.
+     *
+     * @return name of the node
+     */
+    public String getName() {
+        return name;
+    }
+
+    /**
+     * Sets name of the node.
+     *
+     * @param name name of the node
+     */
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    /**
+     * Returns namespace of the node.
+     *
+     * @return namespace of the node
+     */
+    public String getNamespace() {
+        return namespace;
+    }
+
+    /**
+     * Sets namespace of the node.
+     *
+     * @param namespace namespace of the node
+     */
+    public void setNamespace(String namespace) {
+        this.namespace = namespace;
+    }
+}
diff --git a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangSchemaNodeType.java b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangSchemaNodeType.java
new file mode 100644
index 0000000..03d0c6f
--- /dev/null
+++ b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangSchemaNodeType.java
@@ -0,0 +1,55 @@
+/*
+ * 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.yangutils.datamodel;
+
+/**
+ * Represents the nature of YANG node, it is used by YMS to abstractly
+ * understand the nature of node without knowing details of the YANG
+ * construct.
+ */
+public enum YangSchemaNodeType {
+
+    /**
+     * Represents single instance of YANG node like YANG container, YANG module,
+     * YANG sub-module. This is used by YMS to abstractly understand the nature
+     * of node.
+     */
+    YANG_SINGLE_INSTANCE_NODE,
+
+    /**
+     * Represents multi instance of YANG node i.e. YANG list.
+     * This is used by YMS to abstractly understand the nature of node.
+     */
+    YANG_MULTI_INSTANCE_NODE,
+
+    /**
+     * Represents single instance of YANG leaf node i.e. YANG leaf
+     * This is used by YMS to abstractly understand the nature of node.
+     */
+    YANG_SINGLE_INSTANCE_LEAF_NODE,
+
+    /**
+     * Represents multi instance of YANG leaf node i.e. YANG leaflist
+     * This is used by YMS to abstractly understand the nature of node.
+     */
+    YANG_MULTI_INSTANCE_LEAF_NODE,
+
+    /**
+     * Represents node which is not a data node.
+     */
+    YANG_NON_DATA_NODE
+}
diff --git a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangSubModule.java b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangSubModule.java
index 717ea1a..fb0316a 100644
--- a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangSubModule.java
+++ b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangSubModule.java
@@ -19,7 +19,6 @@
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Set;
-
 import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
 import org.onosproject.yangutils.datamodel.utils.Parsable;
 import org.onosproject.yangutils.datamodel.utils.YangConstructType;
@@ -259,6 +258,11 @@
         compilerAnnotationList = new LinkedList<>();
     }
 
+    @Override
+    public YangSchemaNodeType getYangSchemaNodeType() {
+        return YangSchemaNodeType.YANG_SINGLE_INSTANCE_NODE;
+    }
+
     /**
      * Returns the YANG name of the sub module.
      *
diff --git a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangTypeDef.java b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangTypeDef.java
index 085a5c8..cda165e 100644
--- a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangTypeDef.java
+++ b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangTypeDef.java
@@ -17,7 +17,6 @@
 
 import java.util.LinkedList;
 import java.util.List;
-
 import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
 import org.onosproject.yangutils.datamodel.utils.Parsable;
 import org.onosproject.yangutils.datamodel.utils.YangConstructType;
@@ -107,6 +106,11 @@
         typeList = new LinkedList<>();
     }
 
+    @Override
+    public YangSchemaNodeType getYangSchemaNodeType() {
+        return YangSchemaNodeType.YANG_NON_DATA_NODE;
+    }
+
     /**
      * Returns the default value.
      *
diff --git a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangUnion.java b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangUnion.java
index f20d5cc..49a4fc9 100644
--- a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangUnion.java
+++ b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangUnion.java
@@ -18,7 +18,6 @@
 
 import java.util.LinkedList;
 import java.util.List;
-
 import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
 import org.onosproject.yangutils.datamodel.utils.Parsable;
 import org.onosproject.yangutils.datamodel.utils.YangConstructType;
@@ -72,6 +71,11 @@
     }
 
     @Override
+    public YangSchemaNodeType getYangSchemaNodeType() {
+        return YangSchemaNodeType.YANG_NON_DATA_NODE;
+    }
+
+    @Override
     public List<YangType<?>> getTypeList() {
         return typeList;
     }
diff --git a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangUses.java b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangUses.java
index 957000d..855b7d1 100644
--- a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangUses.java
+++ b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangUses.java
@@ -17,7 +17,6 @@
 
 import java.util.LinkedList;
 import java.util.List;
-
 import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
 import org.onosproject.yangutils.datamodel.utils.Parsable;
 import org.onosproject.yangutils.datamodel.utils.ResolvableStatus;
@@ -153,6 +152,11 @@
         resolvedGroupingLeafLists = new LinkedList<List<YangLeafList>>();
     }
 
+    @Override
+    public YangSchemaNodeType getYangSchemaNodeType() {
+        return YangSchemaNodeType.YANG_NON_DATA_NODE;
+    }
+
     /**
      * Returns the list of entity to resolve.
      *