[ONOS-4753] Identity/identityref implementation and UT

Change-Id: I40148fa228465555be3bdf410cc294ffc0f34c18
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/ResolvableType.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/ResolvableType.java
index 80ee4a0..ad00cae 100644
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/ResolvableType.java
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/ResolvableType.java
@@ -39,5 +39,15 @@
     /**
      * Identifies the leafref.
      */
-    YANG_LEAFREF
+    YANG_LEAFREF,
+
+    /**
+     * Identifies the base.
+     */
+    YANG_BASE,
+
+    /**
+     * Identifies the identityref.
+     */
+    YANG_IDENTITYREF
 }
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangBase.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangBase.java
new file mode 100644
index 0000000..40c2293
--- /dev/null
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangBase.java
@@ -0,0 +1,114 @@
+/*
+ * 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 org.onosproject.yangutils.datamodel.exceptions.DataModelException;
+import org.onosproject.yangutils.datamodel.utils.ResolvableStatus;
+
+import java.io.Serializable;
+
+/**
+ * Reference RFC 6020.
+ *
+ * Represents data model node to maintain information defined in YANG base.
+ *  The "base" statement, which is optional, takes as an argument a
+ * string that is the name of an existing identity, from which the new
+ * identity is derived.  If no "base" statement is present, the identity
+ * is defined from scratch.
+ *
+ * If a prefix is present on the base name, it refers to an identity
+ * defined in the module that was imported with that prefix, or the
+ * local module if the prefix matches the local module's prefix.
+ * Otherwise, an identity with the matching name MUST be defined in the
+ * current module or an included submodule.
+ */
+
+/**
+ * Represents data model node to maintain information defined in YANG base.
+ */
+ public class YangBase implements Resolvable, Serializable {
+
+    private static final long serialVersionUID = 806201693L;
+
+    // YANG node identifier.
+    private YangNodeIdentifier baseIdentifier;
+
+    // Referred identity parent information.
+    private YangIdentity referredIdentity;
+
+     /**
+     * Status of resolution. If completely resolved enum value is "RESOLVED",
+     * if not enum value is "UNRESOLVED", in case reference of grouping/typedef/base/identityref
+     * is added to uses/type/base/identityref but it's not resolved value of enum should be
+     * "INTRA_FILE_RESOLVED".
+     */
+    private ResolvableStatus resolvableStatus;
+
+    // Creates a base type of node.
+    public YangBase() {
+        resolvableStatus = ResolvableStatus.UNRESOLVED;
+    }
+
+    /**
+     * Returns the YANG node identifier.
+     *
+     * @return the YANG node identifier
+     */
+    public YangNodeIdentifier getBaseIdentifier() {
+        return baseIdentifier;
+    }
+
+    /**
+     * Sets the YANG node identifier.
+     *
+     * @param baseIdentifier the YANG node identifier to set
+     */
+    public void setBaseIdentifier(YangNodeIdentifier baseIdentifier) {
+        this.baseIdentifier = baseIdentifier;
+    }
+
+    /**
+     * Returns the parent identity node.
+     *
+     * @return the parent identity node
+     */
+    public YangIdentity getReferredIdentity() {
+        return referredIdentity;
+    }
+
+    /**
+     * Sets the parent identity node.
+     *
+     * @param referredIdentity the parent identity node to set
+     */
+    public void setReferredIdentity(YangIdentity referredIdentity) {
+        this.referredIdentity = referredIdentity;
+    }
+
+    @Override
+    public ResolvableStatus getResolvableStatus() {
+        return resolvableStatus;
+    }
+
+    @Override
+    public void setResolvableStatus(ResolvableStatus resolvableStatus) {
+        this.resolvableStatus = resolvableStatus;
+    }
+
+    @Override
+    public void resolve() throws DataModelException {
+    }
+}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangDerivedInfo.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangDerivedInfo.java
index 640aa64..1661d96 100644
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangDerivedInfo.java
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangDerivedInfo.java
@@ -334,7 +334,7 @@
                     return RESOLVED;
                 }
             }
-        } else if (baseType.getDataType() == LEAFREF) {
+        } else if ((baseType.getDataType() == LEAFREF) || (baseType.getDataType() == IDENTITYREF)) {
             setEffectiveBuiltInType(baseType.getDataType());
             return RESOLVED;
         } else {
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangIdentity.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangIdentity.java
new file mode 100644
index 0000000..5e57012
--- /dev/null
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangIdentity.java
@@ -0,0 +1,152 @@
+/*
+ * 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 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.
+ *
+ *  The "identity" statement is used to define a new globally unique,
+ *  abstract, and untyped identity.  Its only purpose is to denote its
+ *  name, semantics, and existence.  An identity can either be defined
+ *  from scratch or derived from a base identity.  The identity's
+ *  argument is an identifier that is the name of the identity.  It is
+ *  followed by a block of substatements that holds detailed identity
+ *  information.
+ *
+ *  The identity's Substatements
+ *
+ *                +--------------+---------+-------------+-----------------------+
+ *                | substatement | section | cardinality |  data model mapping   |
+ *                +--------------+---------+-------------+-----------------------+
+ *                | base         | 7.16.2  | 0..1        |  -YangNodeIdentifier  |
+ *                | description  | 7.19.3  | 0..1        |  -string              |
+ *                | reference    | 7.19.4  | 0..1        |  -string              |
+ *                | status       | 7.19.2  | 0..1        |  -YangStatus          |
+ *                +--------------+---------+-------------+-----------------------+
+ */
+
+/**
+ * Represents data model node to maintain information defined in YANG identity.
+ */
+public class YangIdentity extends YangNode implements YangCommonInfo, Parsable, Serializable {
+
+    private static final long serialVersionUID = 806201691L;
+
+    //Name of the identity.
+    private String name;
+
+    //Base node of identity.
+    private YangBase baseNode;
+
+    //Status of YANG identity.
+    private YangStatusType status;
+
+    //Description of YANG identity.
+    private String description;
+
+    //YANG reference of the identity.
+    private String reference;
+
+    //Creates a identity type of node.
+    public YangIdentity() {
+        super(YangNodeType.IDENTITY_NODE);
+    }
+
+    /**
+     * Returns the name of identity.
+     *
+     * @return the identity name
+     */
+    public String getName() {
+        return name;
+    }
+
+    /**
+     * Sets the name of identity.
+     *
+     * @param name the identity name to set
+     */
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    @Override
+    public YangStatusType getStatus() {
+        return status;
+    }
+
+    @Override
+    public void setStatus(YangStatusType status) {
+        this.status = status;
+    }
+
+    @Override
+    public String getDescription() {
+        return description;
+    }
+
+    @Override
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    @Override
+    public String getReference() {
+        return reference;
+    }
+
+    @Override
+    public void setReference(String reference) {
+        this.reference = reference;
+    }
+
+    @Override
+    public YangConstructType getYangConstructType() {
+        return YangConstructType.IDENTITY_DATA;
+    }
+
+    @Override
+    public void validateDataOnEntry() throws DataModelException {
+    }
+
+    @Override
+    public void validateDataOnExit() throws DataModelException {
+    }
+
+    /**
+     * Returns base node of identity.
+     *
+     * @return the base node of identity
+     */
+    public YangBase getBaseNode() {
+        return baseNode;
+    }
+
+    /**
+     * Sets the base node.
+     *
+     * @param baseNode the base node to set
+     */
+    public void setBaseNode(YangBase baseNode) {
+        this.baseNode = baseNode;
+    }
+}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangIdentityRef.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangIdentityRef.java
new file mode 100644
index 0000000..d03fcf4
--- /dev/null
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangIdentityRef.java
@@ -0,0 +1,196 @@
+/*
+ * 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 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.
+ *
+ * The identityref type is used to reference an existing identity.
+ *
+ *  The identityref's base Statement :
+ *       The "base" statement, which is a substatement to the "type"
+ *  statement, MUST be present if the type is "identityref".  The
+ *  argument is the name of an identity, as defined by an "identity"
+ *  statement.  If a prefix is present on the identity name, it refers to
+ *  an identity defined in the module that was imported with that prefix.
+ *  Otherwise, an identity with the matching name MUST be defined in the
+ *  current module or an included submodule.
+ *  Valid values for an identityref are any identities derived from the
+ *  identityref's base identity.  On a particular server, the valid
+ *  values are further restricted to the set of identities defined in the
+ *  modules supported by the server.
+ */
+
+/**
+ * Represents data model node to maintain information defined in YANG identityref.
+ */
+public class YangIdentityRef extends YangNode implements Parsable, Resolvable, Serializable {
+
+    private static final long serialVersionUID = 806201692L;
+
+    // Get referred identity parent information.
+    private YangIdentity referredIdentity;
+
+    // YANG node identifier.
+    private YangNodeIdentifier baseIdentity;
+
+    /**
+     * Status of resolution. If completely resolved enum value is "RESOLVED",
+     * if not enum value is "UNRESOLVED", in case reference of grouping/typedef/identityref/base
+     * is added to uses/type/identityref/base but it's not resolved value of enum should be
+     * "INTRA_FILE_RESOLVED".
+     */
+    private ResolvableStatus resolvableStatus;
+
+    // Creates a specific identityref of node.
+    public YangIdentityRef() {
+        super(YangNodeType.IDENTITYREF_NODE);
+        baseIdentity = new YangNodeIdentifier();
+        resolvableStatus = ResolvableStatus.UNRESOLVED;
+    }
+
+    @Override
+    public ResolvableStatus getResolvableStatus() {
+        return resolvableStatus;
+    }
+
+    @Override
+    public void setResolvableStatus(ResolvableStatus resolvableStatus) {
+        this.resolvableStatus = resolvableStatus;
+    }
+
+    @Override
+    public void resolve() throws DataModelException {
+
+        // Check if the derived info is present.
+        YangIdentity identity = getReferredIdentity();
+
+        if (identity == null) {
+            throw new DataModelException("Linker Error: Identity information is missing.");
+        }
+
+        while (identity.getBaseNode() != null) {
+            if (identity.getBaseNode().getResolvableStatus() != ResolvableStatus.RESOLVED) {
+                setResolvableStatus(ResolvableStatus.INTRA_FILE_RESOLVED);
+                return;
+            }
+            identity = identity.getBaseNode().getReferredIdentity();
+        }
+    }
+
+    /**
+     * Returns the YANG base node identifier.
+     *
+     * @return the YANG base node identifier
+     */
+    public YangNodeIdentifier getBaseIdentity() {
+        return baseIdentity;
+    }
+
+    /**
+     * Sets the YANG node identifier.
+     *
+     * @param baseIdentity the YANG node identifier to set
+     */
+    public void setBaseIdentity(YangNodeIdentifier baseIdentity) {
+        this.baseIdentity = baseIdentity;
+    }
+
+    /**
+     * Returns the name of identity.
+     *
+     * @return the identity name
+     */
+    @Override
+    public String getName() {
+        return baseIdentity.getName();
+    }
+
+    /**
+     * Sets the name of identity.
+     *
+     * @param name the identity name to set
+     */
+    @Override
+    public void setName(String name) {
+        baseIdentity.setName(name);
+    }
+
+    /**
+     * Sets node identifier.
+     *
+     * @param nodeIdentifier the node identifier
+     */
+    public void setNodeIdentifier(YangNodeIdentifier nodeIdentifier) {
+        this.baseIdentity = nodeIdentifier;
+    }
+
+    /**
+     * Returns prefix associated with base.
+     *
+     * @return prefix associated with base
+     */
+    public String getPrefix() {
+        return baseIdentity.getPrefix();
+    }
+
+    /**
+     * Sets prefix associated with base.
+     *
+     * @param prefix prefix associated with base
+     */
+    public void setPrefix(String prefix) {
+        baseIdentity.setPrefix(prefix);
+    }
+
+    @Override
+    public YangConstructType getYangConstructType() {
+        return YangConstructType.IDENTITYREF_DATA;
+    }
+
+    @Override
+    public void validateDataOnEntry() throws DataModelException {
+    }
+
+    @Override
+    public void validateDataOnExit() throws DataModelException {
+    }
+
+    /**
+     * Returns the parent identity node.
+     *
+     * @return the parent identity node
+     */
+    public YangIdentity getReferredIdentity() {
+        return referredIdentity;
+    }
+
+    /**
+     * Sets the parent identity node.
+     *
+     * @param referredIdentity the parent identity node to set
+     */
+    public void setReferredIdentity(YangIdentity referredIdentity) {
+        this.referredIdentity = referredIdentity;
+    }
+}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangModule.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangModule.java
index ec25d65..6e515ad 100644
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangModule.java
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangModule.java
@@ -216,6 +216,17 @@
     private List<YangResolutionInfo> leafrefResolutionList;
 
     /**
+     * base resolution list.
+     */
+    private List<YangResolutionInfo> baseResolutionList;
+
+    /**
+     * identityref resolution list.
+     */
+    private List<YangResolutionInfo> identityrefResolutionList;
+
+
+    /**
      * Creates a YANG node of module type.
      */
     public YangModule() {
@@ -225,6 +236,8 @@
         usesResolutionList = new LinkedList<>();
         ifFeatureResolutionList = new LinkedList<>();
         leafrefResolutionList = new LinkedList<>();
+        baseResolutionList = new LinkedList<>();
+        identityrefResolutionList = new LinkedList<>();
         importList = new LinkedList<YangImport>();
         includeList = new LinkedList<YangInclude>();
         listOfLeaf = new LinkedList<YangLeaf>();
@@ -597,8 +610,12 @@
             return usesResolutionList;
         } else if (type == ResolvableType.YANG_IF_FEATURE) {
             return ifFeatureResolutionList;
-        } else {
+        } else if (type == ResolvableType.YANG_LEAFREF) {
             return leafrefResolutionList;
+        } else if (type == ResolvableType.YANG_BASE) {
+            return baseResolutionList;
+        } else {
+            return identityrefResolutionList;
         }
     }
 
@@ -611,8 +628,12 @@
             usesResolutionList.add(resolutionInfo);
         } else if (type == ResolvableType.YANG_IF_FEATURE) {
             ifFeatureResolutionList.add(resolutionInfo);
-        } else {
+        } else if (type == ResolvableType.YANG_LEAFREF) {
             leafrefResolutionList.add(resolutionInfo);
+        } else if (type == ResolvableType.YANG_BASE) {
+            baseResolutionList.add(resolutionInfo);
+        } else if (type == ResolvableType.YANG_IDENTITYREF) {
+            identityrefResolutionList.add(resolutionInfo);
         }
     }
 
@@ -627,6 +648,10 @@
             ifFeatureResolutionList.add((YangResolutionInfo) resolutionList);
         } else if (type == ResolvableType.YANG_LEAFREF) {
             leafrefResolutionList = resolutionList;
+        } else if (type == ResolvableType.YANG_BASE) {
+            baseResolutionList = resolutionList;
+        } else if (type == ResolvableType.YANG_IDENTITYREF) {
+            identityrefResolutionList = resolutionList;
         }
 
     }
@@ -650,11 +675,8 @@
         while (includeInfoIterator.hasNext()) {
             YangInclude yangInclude = includeInfoIterator.next();
             YangSubModule subModule = null;
-            try {
-                subModule = yangInclude.addReferenceToInclude(yangNodeSet);
-            } catch (DataModelException e) {
-                throw e;
-            }
+            subModule = yangInclude.addReferenceToInclude(yangNodeSet);
+
             // Check if the referred sub-modules parent is self
             if (!(subModule.getBelongsTo().getModuleNode() == this)) {
                 yangInclude.reportIncludeError();
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangNodeType.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangNodeType.java
index 35fe918..c6108c7 100644
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangNodeType.java
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangNodeType.java
@@ -102,5 +102,15 @@
     /**
      * Node contains "YANG's list" information.
      */
-    LIST_NODE
+    LIST_NODE,
+
+    /**
+     * Identity node.
+     */
+    IDENTITY_NODE,
+
+    /**
+     * Identityref node.
+     */
+    IDENTITYREF_NODE
 }
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangSubModule.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangSubModule.java
index 5a5d52f..498f5e7 100644
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangSubModule.java
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangSubModule.java
@@ -214,6 +214,16 @@
     private List<YangResolutionInfo> leafrefResolutionList;
 
     /**
+     * base resolution list.
+     */
+    private List<YangResolutionInfo> baseResolutionList;
+
+    /**
+     * identityref resolution list.
+     */
+    private List<YangResolutionInfo> identityrefResolutionList;
+
+    /**
      * Creates a sub module node.
      */
     public YangSubModule() {
@@ -222,6 +232,8 @@
         usesResolutionList = new LinkedList<>();
         ifFeatureResolutionList = new LinkedList<>();
         leafrefResolutionList = new LinkedList<>();
+        baseResolutionList = new LinkedList<>();
+        identityrefResolutionList = new LinkedList<>();
         importList = new LinkedList<YangImport>();
         includeList = new LinkedList<YangInclude>();
         listOfLeaf = new LinkedList<YangLeaf>();
@@ -559,8 +571,12 @@
             return usesResolutionList;
         } else if (type == ResolvableType.YANG_IF_FEATURE) {
             return ifFeatureResolutionList;
-        } else {
+        } else if (type == ResolvableType.YANG_LEAFREF) {
             return leafrefResolutionList;
+        } else if (type == ResolvableType.YANG_BASE) {
+            return baseResolutionList;
+        } else {
+            return identityrefResolutionList;
         }
     }
 
@@ -573,8 +589,12 @@
             usesResolutionList.add(resolutionInfo);
         } else if (type == ResolvableType.YANG_IF_FEATURE) {
             ifFeatureResolutionList.add(resolutionInfo);
-        } else {
+        } else if (type == ResolvableType.YANG_LEAFREF) {
             leafrefResolutionList.add(resolutionInfo);
+        } else if (type == ResolvableType.YANG_BASE) {
+            baseResolutionList.add(resolutionInfo);
+        } else if (type == ResolvableType.YANG_IDENTITYREF) {
+            identityrefResolutionList.add(resolutionInfo);
         }
     }
 
@@ -589,6 +609,10 @@
             ifFeatureResolutionList.add((YangResolutionInfo) resolutionList);
         } else if (type == ResolvableType.YANG_LEAFREF) {
             leafrefResolutionList = resolutionList;
+        } else if (type == ResolvableType.YANG_BASE) {
+            baseResolutionList = resolutionList;
+        } else if (type == ResolvableType.YANG_IDENTITYREF) {
+            identityrefResolutionList = resolutionList;
         }
 
     }
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/DataModelUtils.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/DataModelUtils.java
index 3007ffa..489ac5c 100644
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/DataModelUtils.java
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/DataModelUtils.java
@@ -22,6 +22,8 @@
 import org.onosproject.yangutils.datamodel.CollisionDetector;
 import org.onosproject.yangutils.datamodel.ResolvableType;
 import org.onosproject.yangutils.datamodel.YangIfFeature;
+import org.onosproject.yangutils.datamodel.YangBase;
+import org.onosproject.yangutils.datamodel.YangIdentityRef;
 import org.onosproject.yangutils.datamodel.YangLeaf;
 import org.onosproject.yangutils.datamodel.YangLeafList;
 import org.onosproject.yangutils.datamodel.YangLeafRef;
@@ -176,6 +178,10 @@
                 .getEntityToResolve() instanceof YangLeafRef) {
             resolutionNode.addToResolutionList(resolutionInfo,
                     ResolvableType.YANG_LEAFREF);
+        } else if (resolutionInfo.getEntityToResolveInfo().getEntityToResolve() instanceof YangBase) {
+            resolutionNode.addToResolutionList(resolutionInfo, ResolvableType.YANG_BASE);
+        } else if (resolutionInfo.getEntityToResolveInfo().getEntityToResolve() instanceof YangIdentityRef) {
+            resolutionNode.addToResolutionList(resolutionInfo, ResolvableType.YANG_IDENTITYREF);
         }
     }