[ONOS-4941][ONOS-4883][ONOS-4979]Grouping and uses interfile linking issue + defect fix

Change-Id: I5e8145f05d3ef570d4ecbbe885c93de172de0ea3
diff --git a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangAppDataStructure.java b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangAppDataStructure.java
new file mode 100644
index 0000000..80ea6c6
--- /dev/null
+++ b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangAppDataStructure.java
@@ -0,0 +1,125 @@
+/*
+ * 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.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;
+
+/**
+ * Represents data model node to maintain information defined in YANG app-data-structure.
+ */
+public class YangAppDataStructure implements Parsable {
+
+    /**
+     * Data structure information.
+     */
+    private YangDataStructure dataStructure;
+
+    /**
+     * List of key names.
+     */
+    private List<String> keyList;
+
+    /**
+     * Prefix of app-data-structure.
+     */
+    private String prefix;
+
+    /**
+     * Returns the YANG data structure information.
+     *
+     * @return the YANG data structure information
+     */
+    public YangDataStructure getDataStructure() {
+        return dataStructure;
+    }
+
+    /**
+     * Sets the YANG data structure information.
+     *
+     * @param dataStructure the YANG data structure to set
+     */
+    public void setDataStructure(YangDataStructure dataStructure) {
+        this.dataStructure = dataStructure;
+    }
+
+    /**
+     * Returns the list of key field names.
+     *
+     * @return the list of key field names
+     */
+    public List<String> getKeyList() {
+        return keyList;
+    }
+
+    /**
+     * Sets the list of key field names.
+     *
+     * @param keyList the list of key field names
+     */
+    public void setKeyList(List<String> keyList) {
+        this.keyList = keyList;
+    }
+
+    /**
+     * Adds a key field name.
+     *
+     * @param key key field name
+     */
+    public void addKey(String key) {
+        if (getKeyList() == null) {
+            setKeyList(new LinkedList<>());
+        }
+        getKeyList().add(key);
+    }
+
+    /**
+     * Returns the prefix.
+     *
+     * @return the prefix
+     */
+    public String getPrefix() {
+        return prefix;
+    }
+
+    /**
+     * Sets the prefix information.
+     *
+     * @param prefix the prefix to set
+     */
+    public void setPrefix(String prefix) {
+        this.prefix = prefix;
+    }
+
+    @Override
+    public YangConstructType getYangConstructType() {
+        return YangConstructType.APP_DATA_STRUCTURE;
+    }
+
+    @Override
+    public void validateDataOnEntry() throws DataModelException {
+        // TODO : to be implemented
+    }
+
+    @Override
+    public void validateDataOnExit() throws DataModelException {
+        // TODO : to be implemented
+    }
+}
diff --git a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangAppExtendedName.java b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangAppExtendedName.java
new file mode 100644
index 0000000..2ab743e
--- /dev/null
+++ b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangAppExtendedName.java
@@ -0,0 +1,88 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yangutils.datamodel;
+
+import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
+import org.onosproject.yangutils.datamodel.utils.Parsable;
+import org.onosproject.yangutils.datamodel.utils.YangConstructType;
+
+/**
+ * Represents data model node to maintain information defined in YANG extended name.
+ */
+public class YangAppExtendedName implements Parsable {
+
+    /**
+     * App extended name information.
+     */
+    private String yangAppExtendedName;
+
+    /**
+     * Prefix of extended name.
+     */
+    private String prefix;
+
+    /**
+     * Returns the YANG app extended name information.
+     *
+     * @return the YANG app extended name information
+     */
+    public String getYangAppExtendedName() {
+        return yangAppExtendedName;
+    }
+
+    /**
+     * Sets the YANG app extended name information.
+     *
+     * @param yangAppExtendedName the YANG app extended name to set
+     */
+    public void setYangAppExtendedName(String yangAppExtendedName) {
+        this.yangAppExtendedName = yangAppExtendedName;
+    }
+
+    /**
+     * Returns the prefix.
+     *
+     * @return the prefix
+     */
+    public String getPrefix() {
+        return prefix;
+    }
+
+    /**
+     * Sets the prefix information.
+     *
+     * @param prefix the prefix to set
+     */
+    public void setPrefix(String prefix) {
+        this.prefix = prefix;
+    }
+
+    @Override
+    public YangConstructType getYangConstructType() {
+        return YangConstructType.APP_EXTENDED_NAME_DATA;
+    }
+
+    @Override
+    public void validateDataOnEntry() throws DataModelException {
+        // TODO : to be implemented
+    }
+
+    @Override
+    public void validateDataOnExit() throws DataModelException {
+        // TODO : to be implemented
+    }
+}
diff --git a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangCompilerAnnotation.java b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangCompilerAnnotation.java
new file mode 100644
index 0000000..4d0c2ce
--- /dev/null
+++ b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangCompilerAnnotation.java
@@ -0,0 +1,134 @@
+/*
+ * 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;
+
+/**
+ * Represents data model node to maintain information defined in YANG compiler-annotation.
+ */
+public class YangCompilerAnnotation implements Parsable {
+
+    /**
+     * App data structure information.
+     */
+    private YangAppDataStructure yangAppDataStructure;
+
+    /**
+     * App extended name information.
+     */
+    private YangAppExtendedName yangAppExtendedName;
+
+    /**
+     * Prefix of compiler-annotation.
+     */
+    private String prefix;
+
+    /**
+     * Path of compiler-annotation.
+     */
+    private String path;
+
+    /**
+     * Returns the YANG app data structure information.
+     *
+     * @return the YANG app data structure information
+     */
+    public YangAppDataStructure getYangAppDataStructure() {
+        return yangAppDataStructure;
+    }
+
+    /**
+     * Sets the YANG app data structure information.
+     *
+     * @param yangAppDataStructure the YANG app data structure to set
+     */
+    public void setYangAppDataStructure(YangAppDataStructure yangAppDataStructure) {
+        this.yangAppDataStructure = yangAppDataStructure;
+    }
+
+    /**
+     * Returns the prefix.
+     *
+     * @return the prefix
+     */
+    public String getPrefix() {
+        return prefix;
+    }
+
+    /**
+     * Sets the prefix information.
+     *
+     * @param prefix the prefix to set
+     */
+    public void setPrefix(String prefix) {
+        this.prefix = prefix;
+    }
+
+    /**
+     * Returns the path.
+     *
+     * @return the path
+     */
+    public String getPath() {
+        return path;
+    }
+
+    /**
+     * Sets the path.
+     *
+     * @param path the path to set
+     */
+    public void setPath(String path) {
+        this.path = path;
+    }
+
+    /**
+     * Returns the YANG app extended name information.
+     *
+     * @return the YANG app extended name information
+     */
+    public YangAppExtendedName getYangAppExtendedName() {
+        return yangAppExtendedName;
+    }
+
+    /**
+     * Sets the YANG app extended name information.
+     *
+     * @param yangAppExtendedName the YANG app extended name to set
+     */
+    public void setYangAppExtendedName(YangAppExtendedName yangAppExtendedName) {
+        this.yangAppExtendedName = yangAppExtendedName;
+    }
+
+    @Override
+    public YangConstructType getYangConstructType() {
+        return YangConstructType.COMPILER_ANNOTATION_DATA;
+    }
+
+    @Override
+    public void validateDataOnEntry() throws DataModelException {
+        // TODO : to be implemented
+    }
+
+    @Override
+    public void validateDataOnExit() throws DataModelException {
+        // TODO : to be implemented
+    }
+}
diff --git a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangDataStructure.java b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangDataStructure.java
new file mode 100644
index 0000000..785d460
--- /dev/null
+++ b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangDataStructure.java
@@ -0,0 +1,45 @@
+/*
+ * 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 ENUM to identify the YANG data type.
+ */
+public enum YangDataStructure {
+
+    MAP,
+
+    LIST,
+
+    SET;
+
+    /**
+     * Returns YANG data structure type for corresponding data structure name.
+     *
+     * @param name data structure name from YANG file.
+     * @return YANG data structure for corresponding data structure name.
+     */
+    public static YangDataStructure getType(String name) {
+        name = name.replace("\"", "");
+        for (YangDataStructure dataStructure : values()) {
+            if (dataStructure.name().toLowerCase().equals(name)) {
+                return dataStructure;
+            }
+        }
+        return null;
+    }
+}
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 2b2426a..b86911a 100644
--- a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangList.java
+++ b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangList.java
@@ -16,15 +16,14 @@
 
 package org.onosproject.yangutils.datamodel;
 
+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;
 import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes;
 
-import java.util.ArrayList;
-import java.util.LinkedList;
-import java.util.List;
-
 import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.detectCollidingChildUtil;
 
 /*
@@ -72,7 +71,7 @@
 public class YangList
         extends YangNode
         implements YangLeavesHolder, YangCommonInfo, Parsable, CollisionDetector,
-        YangAugmentableNode, YangMustHolder, YangIfFeatureHolder, YangDataNode {
+        YangAugmentableNode, YangMustHolder, YangWhenHolder, YangIfFeatureHolder, YangDataNode {
 
     private static final long serialVersionUID = 806201609L;
 
@@ -219,6 +218,7 @@
      *
      * @return the when
      */
+    @Override
     public YangWhen getWhen() {
         return when;
     }
@@ -228,6 +228,7 @@
      *
      * @param when the when to set
      */
+    @Override
     public void setWhen(YangWhen when) {
         this.when = when;
     }
@@ -624,7 +625,6 @@
      * Validates key statement of list.
      *
      * @param leaves    list of leaf attributes of list
-     * @param leafLists list of leaf-list attributes of list
      * @param keys      list of key attributes of list
      * @throws DataModelException a violation of data model rules
      */
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 f9b1e87..8e5de36 100644
--- a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangModule.java
+++ b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangModule.java
@@ -231,7 +231,12 @@
     private List<YangResolutionInfo> augmentResolutionList;
 
     /**
-     * extension list.
+     * Compiler annotation list.
+     */
+    private List<YangCompilerAnnotation> compilerAnnotationList;
+
+    /**
+     * Extension list.
      */
     private List<YangExtension> extensionList;
 
@@ -248,6 +253,7 @@
         leafrefResolutionList = new LinkedList<>();
         baseResolutionList = new LinkedList<>();
         identityrefResolutionList = new LinkedList<>();
+        compilerAnnotationList = new LinkedList<>();
         importList = new LinkedList<YangImport>();
         includeList = new LinkedList<YangInclude>();
         listOfLeaf = new LinkedList<YangLeaf>();
@@ -563,6 +569,33 @@
     }
 
     /**
+     * Adds compiler annotation in compiler-annotation list.
+     *
+     * @param compilerAnnotation the compiler-annotation to be added
+     */
+    public void addCompilerAnnotation(YangCompilerAnnotation compilerAnnotation) {
+        getCompilerAnnotationList().add(compilerAnnotation);
+    }
+
+    /**
+     * Returns the compiler annotation list.
+     *
+     * @return the compiler annotation list
+     */
+    public List<YangCompilerAnnotation> getCompilerAnnotationList() {
+        return compilerAnnotationList;
+    }
+
+    /**
+     * Sets the compiler-annotation list.
+     *
+     * @param compilerAnnotationList the list of compiler-annotation
+     */
+    public void setCompilerAnnotationList(List<YangCompilerAnnotation> compilerAnnotationList) {
+        this.compilerAnnotationList = compilerAnnotationList;
+    }
+
+    /**
      * Adds extension in extension list.
      *
      * @param extension the extension to be added
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 f8bec7c..800e062 100644
--- a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangSubModule.java
+++ b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangSubModule.java
@@ -224,6 +224,11 @@
     private List<YangResolutionInfo> identityrefResolutionList;
 
     /**
+     * Compiler annotation list.
+     */
+    private List<YangCompilerAnnotation> compilerAnnotationList;
+
+    /**
      * extension list.
      */
     private List<YangExtension> extensionList;
@@ -245,6 +250,7 @@
         leafrefResolutionList = new LinkedList<>();
         baseResolutionList = new LinkedList<>();
         identityrefResolutionList = new LinkedList<>();
+        compilerAnnotationList = new LinkedList<>();
         importList = new LinkedList<YangImport>();
         includeList = new LinkedList<YangInclude>();
         listOfLeaf = new LinkedList<YangLeaf>();
@@ -692,6 +698,34 @@
     }
 
     /**
+     * Adds compiler annotation in compiler annotation list.
+     *
+     * @param compilerAnnotation the compiler annotation to be added
+     */
+    public void addCompilerAnnotation(YangCompilerAnnotation compilerAnnotation) {
+        getCompilerAnnotationList().add(compilerAnnotation);
+    }
+
+    /**
+     * Returns the compiler annotation list.
+     *
+     * @return the compiler annotation list
+     */
+    public List<YangCompilerAnnotation> getCompilerAnnotationList() {
+        return compilerAnnotationList;
+    }
+
+    /**
+     * Sets the compiler annotation list.
+     *
+     * @param compilerAnnotationList the list of compiler annotation
+     */
+    public void setCompilerAnnotationList(List<YangCompilerAnnotation> compilerAnnotationList) {
+        this.compilerAnnotationList = compilerAnnotationList;
+    }
+
+
+    /**
      * Adds extension in extension list.
      *
      * @param extension the extension to be added
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 5cd1e7a..6b76dfd 100644
--- a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangUses.java
+++ b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangUses.java
@@ -17,17 +17,20 @@
 
 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;
 import org.onosproject.yangutils.datamodel.utils.YangConstructType;
 
+import static org.onosproject.yangutils.datamodel.TraversalType.CHILD;
+import static org.onosproject.yangutils.datamodel.TraversalType.PARENT;
+import static org.onosproject.yangutils.datamodel.TraversalType.ROOT;
+import static org.onosproject.yangutils.datamodel.TraversalType.SIBILING;
 import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.detectCollidingChildUtil;
 import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.getParentNodeInGenCode;
-import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.updateClonedLeavesUnionEnumRef;
 import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.resolveLeafrefUnderGroupingForLeaf;
 import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.resolveLeafrefUnderGroupingForLeafList;
+import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.updateClonedLeavesUnionEnumRef;
 
 /*-
  * Reference RFC 6020.
@@ -365,6 +368,14 @@
 
         if (referredGrouping == null) {
             throw new DataModelException("YANG uses linker error, cannot resolve uses");
+        } else {
+            /*
+             * if referredGrouping has uses which is not resolved then set the status
+             * as Intra file resolved and return
+             */
+            if (checkIsUnresolvedRecursiveUsesInGrouping(referredGrouping)) {
+                return null;
+            }
         }
 
         YangNode usesParentNode = getParentNodeInGenCode(this);
@@ -405,7 +416,7 @@
                     clonedLeafList = leafList.clone();
                     if (getCurrentGroupingDepth() == 0) {
                         YangEntityToResolveInfoImpl resolveInfo =
-                                    resolveLeafrefUnderGroupingForLeafList(clonedLeafList, usesParentLeavesHolder);
+                                resolveLeafrefUnderGroupingForLeafList(clonedLeafList, usesParentLeavesHolder);
                         if (resolveInfo != null) {
                             addEntityToResolve(resolveInfo);
                         }
@@ -429,6 +440,49 @@
     }
 
     /**
+     * Checks if referred grouping has uses which is not resolved then it set the
+     * status of current uses as intra file resolved and returns true.
+     *
+     * @param referredGrouping referred grouping node of uses
+     * @return true if referred grouping has unresolved uses
+     */
+    private boolean checkIsUnresolvedRecursiveUsesInGrouping(YangGrouping referredGrouping) {
+
+        /**
+         * Search the grouping node's children for presence of uses node.
+         */
+        TraversalType curTraversal = ROOT;
+        YangNode curNode = referredGrouping.getChild();
+        while (curNode != null) {
+            if (curNode.getName().equals(referredGrouping.getName())) {
+                // if we have traversed all the child nodes, then exit from loop
+                return false;
+            }
+
+            // if child nodes has uses, then add it to resolution stack
+            if (curNode instanceof YangUses) {
+                if (((YangUses) curNode).getResolvableStatus() != ResolvableStatus.RESOLVED) {
+                    setResolvableStatus(ResolvableStatus.INTRA_FILE_RESOLVED);
+                    return true;
+                }
+            }
+
+            // Traversing all the child nodes of grouping
+            if (curTraversal != PARENT && curNode.getChild() != null) {
+                curTraversal = CHILD;
+                curNode = curNode.getChild();
+            } else if (curNode.getNextSibling() != null) {
+                curTraversal = SIBILING;
+                curNode = curNode.getNextSibling();
+            } else {
+                curTraversal = PARENT;
+                curNode = curNode.getParent();
+            }
+        }
+        return false;
+    }
+
+    /**
      * Clone the resolved uses contained in grouping to the uses of grouping.
      *
      * @param usesInGrouping resolved uses in grouping
diff --git a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/YangConstructType.java b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/YangConstructType.java
index e0dd8e3..fc0fbd7 100644
--- a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/YangConstructType.java
+++ b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/YangConstructType.java
@@ -385,6 +385,21 @@
     ANYXML_DATA,
 
     /**
+     * Identifies the YANG compiler annotation element parsed data.
+     */
+    COMPILER_ANNOTATION_DATA,
+
+    /**
+     * Identifies the YANG app data structure element parsed data.
+     */
+    APP_DATA_STRUCTURE,
+
+    /**
+     * Identifies the YANG app extended element parsed data.
+     */
+    APP_EXTENDED_NAME_DATA,
+
+    /**
      * Identifies the YANG argument element parsed data.
      */
     ARGUMENT_DATA;
@@ -544,6 +559,12 @@
                 return "deviation";
             case ANYXML_DATA:
                 return "anyxml";
+            case COMPILER_ANNOTATION_DATA:
+                return "compiler-annotation";
+            case APP_DATA_STRUCTURE:
+                return "app-data-structure";
+            case APP_EXTENDED_NAME_DATA:
+                return "app-extended-name";
             case ARGUMENT_DATA:
                 return "argument";
             default:
diff --git a/plugin/src/main/java/org/onosproject/yangutils/linker/impl/YangLinkerManager.java b/plugin/src/main/java/org/onosproject/yangutils/linker/impl/YangLinkerManager.java
index 508ec54..754801b 100644
--- a/plugin/src/main/java/org/onosproject/yangutils/linker/impl/YangLinkerManager.java
+++ b/plugin/src/main/java/org/onosproject/yangutils/linker/impl/YangLinkerManager.java
@@ -172,7 +172,7 @@
                 ((YangReferenceResolver) yangNode)
                         .resolveInterFileLinking(ResolvableType.YANG_USES);
                 ((YangReferenceResolver) yangNode)
-                .resolveInterFileLinking(ResolvableType.YANG_AUGMENT);
+                        .resolveInterFileLinking(ResolvableType.YANG_AUGMENT);
                 ((YangReferenceResolver) yangNode)
                         .resolveInterFileLinking(ResolvableType.YANG_DERIVED_DATA_TYPE);
                 ((YangReferenceResolver) yangNode)
diff --git a/plugin/src/main/java/org/onosproject/yangutils/linker/impl/YangResolutionInfoImpl.java b/plugin/src/main/java/org/onosproject/yangutils/linker/impl/YangResolutionInfoImpl.java
index 5c680cd..d7f0428 100644
--- a/plugin/src/main/java/org/onosproject/yangutils/linker/impl/YangResolutionInfoImpl.java
+++ b/plugin/src/main/java/org/onosproject/yangutils/linker/impl/YangResolutionInfoImpl.java
@@ -1594,11 +1594,7 @@
             if (linkedNode != null) {
                 // Add the link to external entity.
                 addReferredEntityLink(linkedNode, INTER_FILE_LINKED);
-                /*
-                 * Update the current reference resolver to external
-                 * module/sub-module containing the referred typedef/grouping.
-                 */
-                setCurReferenceResolver((YangReferenceResolver) yangInclude.getIncludedNode());
+
                 // Add the type/uses of referred typedef/grouping to the stack.
                 addUnresolvedRecursiveReferenceToStack(linkedNode);
                 return true;
@@ -1641,12 +1637,7 @@
                 if (linkedNode != null) {
                     // Add the link to external entity.
                     addReferredEntityLink(linkedNode, INTER_FILE_LINKED);
-                    /*
-                     * Update the current reference resolver to external
-                     * module/sub-module containing the referred
-                     * typedef/grouping.
-                     */
-                    setCurReferenceResolver((YangReferenceResolver) yangImport.getImportedNode());
+
                     // Add the type/uses of referred typedef/grouping to the
                     // stack.
                     addUnresolvedRecursiveReferenceToStack(linkedNode);
diff --git a/plugin/src/main/java/org/onosproject/yangutils/parser/antlrgencode/GeneratedYangListener.java b/plugin/src/main/java/org/onosproject/yangutils/parser/antlrgencode/GeneratedYangListener.java
index 5e55e15..72e7995 100644
--- a/plugin/src/main/java/org/onosproject/yangutils/parser/antlrgencode/GeneratedYangListener.java
+++ b/plugin/src/main/java/org/onosproject/yangutils/parser/antlrgencode/GeneratedYangListener.java
@@ -1835,136 +1835,94 @@
     void exitCompilerAnnotationStatement(GeneratedYangParser.CompilerAnnotationStatementContext currentContext);
 
     /**
-     * Enters a parse tree produced by GeneratedYangParser for grammar rule annotation statement.
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule compiler annotation body statement.
      *
      * @param currentContext current context in the parsed tree
      */
-    void enterAnnotationStatement(GeneratedYangParser.AnnotationStatementContext currentContext);
-
-    /**
-     * Exits a parse tree produced by GeneratedYangParser for grammar rule annotation statement.
-     *
-     * @param currentContext current context in the parsed tree
-     */
-    void exitAnnotationStatement(GeneratedYangParser.AnnotationStatementContext currentContext);
-
-    /**
-     * Enters a parse tree produced by GeneratedYangParser for grammar rule annotation type.
-     *
-     * @param currentContext current context in the parsed tree
-     */
-    void enterAnnotationType(GeneratedYangParser.AnnotationTypeContext currentContext);
-
-    /**
-     * Exits a parse tree produced by GeneratedYangParser for grammar rule annotation type.
-     *
-     * @param currentContext current context in the parsed tree
-     */
-    void exitAnnotationType(GeneratedYangParser.AnnotationTypeContext currentContext);
-
-    /**
-     * Enters a parse tree produced by GeneratedYangParser for grammar rule
-     * annotation parameter specification.
-     *
-     * @param currentContext current context in the parsed tree
-     */
-    void enterAnnotationParameterSpecification(GeneratedYangParser.AnnotationParameterSpecificationContext
-                                                       currentContext);
-
-    /**
-     * Exits a parse tree produced by GeneratedYangParser for grammar rule
-     * annotation parameter specification.
-     *
-     * @param currentContext current context in the parsed tree
-     */
-    void exitAnnotationParameterSpecification(GeneratedYangParser.AnnotationParameterSpecificationContext
+    void enterCompilerAnnotationBodyStatement(GeneratedYangParser.CompilerAnnotationBodyStatementContext
                                                       currentContext);
 
     /**
-     * Enters a parse tree produced by GeneratedYangParser for grammar rule
-     * annotation parameter specification argument.
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule compiler annotation body statement.
      *
      * @param currentContext current context in the parsed tree
      */
-    void enterAnnotationParameterSpecificationArg(GeneratedYangParser.AnnotationParameterSpecificationArgContext
-                                                          currentContext);
+    void exitCompilerAnnotationBodyStatement(GeneratedYangParser.CompilerAnnotationBodyStatementContext
+                                                     currentContext);
 
     /**
-     * Exits a parse tree produced by GeneratedYangParser for grammar rule
-     * annotation parameter specification argument.
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule app data structure statement.
      *
      * @param currentContext current context in the parsed tree
      */
-    void exitAnnotationParameterSpecificationArg(GeneratedYangParser.AnnotationParameterSpecificationArgContext
-                                                         currentContext);
+    void enterAppDataStructureStatement(GeneratedYangParser.AppDataStructureStatementContext
+                                                currentContext);
 
     /**
-     * Enters a parse tree produced by GeneratedYangParser for grammar rule annotation parameter instance.
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule app data structure statement.
      *
      * @param currentContext current context in the parsed tree
      */
-    void enterAnnotationParaInstance(GeneratedYangParser.AnnotationParaInstanceContext
-                                             currentContext);
+    void exitAppDataStructureStatement(GeneratedYangParser.AppDataStructureStatementContext currentContext);
 
     /**
-     * Exits a parse tree produced by GeneratedYangParser for grammar rule annotation parameter instance.
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule app data structure.
      *
      * @param currentContext current context in the parsed tree
      */
-    void exitAnnotationParaInstance(GeneratedYangParser.AnnotationParaInstanceContext
-                                            currentContext);
+    void enterAppDataStructure(GeneratedYangParser.AppDataStructureContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule app data strcuture.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitAppDataStructure(GeneratedYangParser.AppDataStructureContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule app extended statement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterAppExtendedStatement(GeneratedYangParser.AppExtendedStatementContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule app extended statement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitAppExtendedStatement(GeneratedYangParser.AppExtendedStatementContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule extended name.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterExtendedName(GeneratedYangParser.ExtendedNameContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule extended name.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitExtendedName(GeneratedYangParser.ExtendedNameContext currentContext);
+
 
     /**
      * Enters a parse tree produced by GeneratedYangParser for grammar rule
-     * annotation parameter type identifier.
+     * data structure key statement.
      *
      * @param currentContext current context in the parsed tree
      */
-    void enterAnnotationParaTypeIdentifier(GeneratedYangParser.AnnotationParaTypeIdentifierContext
-                                                   currentContext);
+    void enterDataStructureKeyStatement(GeneratedYangParser.DataStructureKeyStatementContext currentContext);
 
     /**
      * Exits a parse tree produced by GeneratedYangParser for grammar rule
-     * annotation parameter type identifier.
+     * data structure key statement.
      *
      * @param currentContext current context in the parsed tree
      */
-    void exitAnnotationParaTypeIdentifier(GeneratedYangParser.AnnotationParaTypeIdentifierContext
-                                                  currentContext);
-
-    /**
-     * Enters a parse tree produced by GeneratedYangParser for grammar rule
-     * annotation parameter type value.
-     *
-     * @param currentContext current context in the parsed tree
-     */
-    void enterAnnotationParaTypeValue(GeneratedYangParser.AnnotationParaTypeValueContext
-                                              currentContext);
-
-    /**
-     * Exits a parse tree produced by GeneratedYangParser for grammar rule
-     * annotation parameter type value.
-     *
-     * @param currentContext current context in the parsed tree
-     */
-    void exitAnnotationParaTypeValue(GeneratedYangParser.AnnotationParaTypeValueContext
-                                             currentContext);
-
-    /**
-     * Enters a parse tree produced by GeneratedYangParser for grammar rule annotation identifier.
-     *
-     * @param currentContext current context in the parsed tree
-     */
-    void enterAnnotationIdentifier(GeneratedYangParser.AnnotationIdentifierContext
-                                           currentContext);
-
-    /**
-     * Exits a parse tree produced by GeneratedYangParser for grammar rule annotation identifier.
-     *
-     * @param currentContext current context in the parsed tree
-     */
-    void exitAnnotationIdentifier(GeneratedYangParser.AnnotationIdentifierContext
-                                          currentContext);
+    void exitDataStructureKeyStatement(GeneratedYangParser.DataStructureKeyStatementContext currentContext);
 
     /**
      * Enters a parse tree produced by GeneratedYangParser for grammar rule require instance.
diff --git a/plugin/src/main/java/org/onosproject/yangutils/parser/impl/TreeWalkListener.java b/plugin/src/main/java/org/onosproject/yangutils/parser/impl/TreeWalkListener.java
index 2b9021b..116f06d 100644
--- a/plugin/src/main/java/org/onosproject/yangutils/parser/impl/TreeWalkListener.java
+++ b/plugin/src/main/java/org/onosproject/yangutils/parser/impl/TreeWalkListener.java
@@ -24,6 +24,8 @@
 import org.onosproject.yangutils.datamodel.utils.YangConstructType;
 import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangListener;
 import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
+import org.onosproject.yangutils.parser.impl.listeners.AppDataStructureListener;
+import org.onosproject.yangutils.parser.impl.listeners.AppExtendedNameListener;
 import org.onosproject.yangutils.parser.impl.listeners.ArgumentListener;
 import org.onosproject.yangutils.parser.impl.listeners.AugmentListener;
 import org.onosproject.yangutils.parser.impl.listeners.BaseFileListener;
@@ -33,9 +35,11 @@
 import org.onosproject.yangutils.parser.impl.listeners.BitsListener;
 import org.onosproject.yangutils.parser.impl.listeners.CaseListener;
 import org.onosproject.yangutils.parser.impl.listeners.ChoiceListener;
+import org.onosproject.yangutils.parser.impl.listeners.CompilerAnnotationListener;
 import org.onosproject.yangutils.parser.impl.listeners.ConfigListener;
 import org.onosproject.yangutils.parser.impl.listeners.ContactListener;
 import org.onosproject.yangutils.parser.impl.listeners.ContainerListener;
+import org.onosproject.yangutils.parser.impl.listeners.DataStructureKeyListener;
 import org.onosproject.yangutils.parser.impl.listeners.Decimal64Listener;
 import org.onosproject.yangutils.parser.impl.listeners.DefaultListener;
 import org.onosproject.yangutils.parser.impl.listeners.DescriptionListener;
@@ -1428,95 +1432,72 @@
 
     @Override
     public void enterCompilerAnnotationStatement(GeneratedYangParser.CompilerAnnotationStatementContext ctx) {
-        // TODO: implement the method.
+        CompilerAnnotationListener.processCompilerAnnotationEntry(this, ctx);
     }
 
     @Override
     public void exitCompilerAnnotationStatement(GeneratedYangParser.CompilerAnnotationStatementContext ctx) {
-        // TODO: implement the method.
+        CompilerAnnotationListener.processCompilerAnnotationExit(this, ctx);
     }
 
     @Override
-    public void enterAnnotationStatement(GeneratedYangParser.AnnotationStatementContext ctx) {
-        // TODO: implement the method.
+    public void enterCompilerAnnotationBodyStatement(GeneratedYangParser.CompilerAnnotationBodyStatementContext ctx) {
+        // do nothing
     }
 
     @Override
-    public void exitAnnotationStatement(GeneratedYangParser.AnnotationStatementContext ctx) {
-        // TODO: implement the method.
+    public void exitCompilerAnnotationBodyStatement(GeneratedYangParser.CompilerAnnotationBodyStatementContext ctx) {
+        // do nothing
     }
 
     @Override
-    public void enterAnnotationType(GeneratedYangParser.AnnotationTypeContext ctx) {
-        // TODO: implement the method.
+    public void enterAppDataStructureStatement(GeneratedYangParser.AppDataStructureStatementContext ctx) {
+        AppDataStructureListener.processAppDataStructureEntry(this, ctx);
     }
 
     @Override
-    public void exitAnnotationType(GeneratedYangParser.AnnotationTypeContext ctx) {
-        // TODO: implement the method.
+    public void exitAppDataStructureStatement(GeneratedYangParser.AppDataStructureStatementContext ctx) {
+        AppDataStructureListener.processAppDataStructureExit(this, ctx);
     }
 
     @Override
-    public void enterAnnotationParameterSpecification(GeneratedYangParser.AnnotationParameterSpecificationContext
-                                                              ctx) {
-        // TODO: implement the method.
+    public void enterAppDataStructure(GeneratedYangParser.AppDataStructureContext currentContext) {
+        // do nothing
     }
 
     @Override
-    public void exitAnnotationParameterSpecification(GeneratedYangParser.AnnotationParameterSpecificationContext ctx) {
-        // TODO: implement the method.
+    public void exitAppDataStructure(GeneratedYangParser.AppDataStructureContext currentContext) {
+        // do nothing
     }
 
     @Override
-    public void enterAnnotationParameterSpecificationArg(GeneratedYangParser.AnnotationParameterSpecificationArgContext
-                                                                 ctx) {
-        // TODO: implement the method.
+    public void enterAppExtendedStatement(GeneratedYangParser.AppExtendedStatementContext currentContext) {
+        AppExtendedNameListener.processAppExtendedNameEntry(this, currentContext);
     }
 
     @Override
-    public void exitAnnotationParameterSpecificationArg(GeneratedYangParser.AnnotationParameterSpecificationArgContext
-                                                                ctx) {
-        // TODO: implement the method.
+    public void exitAppExtendedStatement(GeneratedYangParser.AppExtendedStatementContext currentContext) {
+        // TODO : to be implemented
     }
 
     @Override
-    public void enterAnnotationParaInstance(GeneratedYangParser.AnnotationParaInstanceContext ctx) {
-        // TODO: implement the method.
+    public void enterExtendedName(GeneratedYangParser.ExtendedNameContext currentContext) {
+        // do nothing
     }
 
     @Override
-    public void exitAnnotationParaInstance(GeneratedYangParser.AnnotationParaInstanceContext ctx) {
-        // TODO: implement the method.
+    public void exitExtendedName(GeneratedYangParser.ExtendedNameContext currentContext) {
+        // do nothing
     }
 
     @Override
-    public void enterAnnotationParaTypeIdentifier(GeneratedYangParser.AnnotationParaTypeIdentifierContext ctx) {
-        // TODO: implement the method.
+    public void enterDataStructureKeyStatement(GeneratedYangParser.DataStructureKeyStatementContext ctx) {
+        DataStructureKeyListener.processDataStructureKeyEntry(this, ctx);
     }
 
     @Override
-    public void exitAnnotationParaTypeIdentifier(GeneratedYangParser.AnnotationParaTypeIdentifierContext ctx) {
-        // TODO: implement the method.
-    }
-
-    @Override
-    public void enterAnnotationParaTypeValue(GeneratedYangParser.AnnotationParaTypeValueContext ctx) {
-        // TODO: implement the method.
-    }
-
-    @Override
-    public void exitAnnotationParaTypeValue(GeneratedYangParser.AnnotationParaTypeValueContext ctx) {
-        // TODO: implement the method.
-    }
-
-    @Override
-    public void enterAnnotationIdentifier(GeneratedYangParser.AnnotationIdentifierContext ctx) {
-        // TODO: implement the method.
-    }
-
-    @Override
-    public void exitAnnotationIdentifier(GeneratedYangParser.AnnotationIdentifierContext ctx) {
-        // TODO: implement the method.
+    public void exitDataStructureKeyStatement(GeneratedYangParser.DataStructureKeyStatementContext ctx) {
+        // do nothing
     }
 
     @Override
diff --git a/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/AppDataStructureListener.java b/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/AppDataStructureListener.java
new file mode 100644
index 0000000..e6628b3
--- /dev/null
+++ b/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/AppDataStructureListener.java
@@ -0,0 +1,112 @@
+/*
+ * 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.parser.impl.listeners;
+
+import org.onosproject.yangutils.datamodel.YangAppDataStructure;
+import org.onosproject.yangutils.datamodel.YangCompilerAnnotation;
+import org.onosproject.yangutils.datamodel.YangDataStructure;
+import org.onosproject.yangutils.datamodel.utils.Parsable;
+import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
+import org.onosproject.yangutils.parser.exceptions.ParserException;
+import org.onosproject.yangutils.parser.impl.TreeWalkListener;
+
+import static org.onosproject.yangutils.datamodel.YangDataStructure.getType;
+import static org.onosproject.yangutils.datamodel.utils.YangConstructType.APP_DATA_STRUCTURE;
+import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
+import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.EXIT;
+import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
+import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
+import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.MISSING_CURRENT_HOLDER;
+import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
+import static org.onosproject.yangutils.parser.impl.parserutils.ListenerUtil.getValidPrefix;
+import static org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
+
+/*
+ * Reference: RFC6020 and YANG ANTLR Grammar
+ *
+ * ABNF grammar as per RFC6020
+ *   app-data-structure-stmt = prefix:app-data-structure-keyword string
+ *                         (";" /
+ *                          "{"
+ *                              [data-structure-key-stmt stmtsep]
+ *                          "}")
+ *
+ * ANTLR grammar rule
+ *   appDataStructureStatement : APP_DATA_STRUCTURE appDataStructure (STMTEND | (LEFT_CURLY_BRACE
+ *       dataStructureKeyStatement? RIGHT_CURLY_BRACE));
+ */
+
+/**
+ * Represents listener based call back function corresponding to the "app-data-structure"
+ * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
+ */
+public final class AppDataStructureListener {
+
+    /**
+     * Creates a new app-data-structure listener.
+     */
+    private AppDataStructureListener() {
+    }
+
+    /**
+     * Performs validation and updates the data model tree. It is called when parser receives an
+     * input matching the grammar rule(app-data-structure).
+     *
+     * @param listener listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processAppDataStructureEntry(TreeWalkListener listener,
+                                                    GeneratedYangParser.AppDataStructureStatementContext ctx) {
+
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, APP_DATA_STRUCTURE, "", ENTRY);
+
+        String prefix = getValidPrefix(ctx.APP_DATA_STRUCTURE().getText(), APP_DATA_STRUCTURE, ctx);
+        YangDataStructure dataStructure = getType(ctx.appDataStructure().getText());
+
+        YangAppDataStructure appDataStructure = new YangAppDataStructure();
+        appDataStructure.setPrefix(prefix);
+        appDataStructure.setDataStructure(dataStructure);
+
+        Parsable curData = listener.getParsedDataStack().peek();
+        if (curData instanceof YangCompilerAnnotation) {
+            YangCompilerAnnotation compilerAnnotation = ((YangCompilerAnnotation) curData);
+            compilerAnnotation.setYangAppDataStructure(appDataStructure);
+            listener.getParsedDataStack().push(appDataStructure);
+        } else {
+            throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, APP_DATA_STRUCTURE,
+                    "", ENTRY));
+        }
+    }
+
+    /**
+     * Performs validation and updates the data model tree. It is called when parser
+     * exits from grammar rule (app-data-structure).
+     *
+     * @param listener listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processAppDataStructureExit(TreeWalkListener listener,
+                                                   GeneratedYangParser.AppDataStructureStatementContext ctx) {
+
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, APP_DATA_STRUCTURE, "", EXIT);
+        if (!(listener.getParsedDataStack().peek() instanceof YangAppDataStructure)) {
+            throw new ParserException(constructListenerErrorMessage(MISSING_CURRENT_HOLDER, APP_DATA_STRUCTURE,
+                    "", EXIT));
+        }
+        listener.getParsedDataStack().pop();
+    }
+}
diff --git a/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/AppExtendedNameListener.java b/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/AppExtendedNameListener.java
new file mode 100644
index 0000000..3ec31c7
--- /dev/null
+++ b/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/AppExtendedNameListener.java
@@ -0,0 +1,83 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yangutils.parser.impl.listeners;
+
+import org.onosproject.yangutils.datamodel.YangAppExtendedName;
+import org.onosproject.yangutils.datamodel.YangCompilerAnnotation;
+import org.onosproject.yangutils.datamodel.utils.Parsable;
+import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
+import org.onosproject.yangutils.parser.exceptions.ParserException;
+import org.onosproject.yangutils.parser.impl.TreeWalkListener;
+
+import static org.onosproject.yangutils.datamodel.utils.YangConstructType.APP_EXTENDED_NAME_DATA;
+import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
+import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
+import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
+import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
+import static org.onosproject.yangutils.parser.impl.parserutils.ListenerUtil.getValidPrefix;
+import static org.onosproject.yangutils.parser.impl.parserutils.ListenerUtil.removeQuotesAndHandleConcat;
+import static org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
+
+/*
+ * Reference: RFC6020 and YANG ANTLR Grammar
+ *
+ * ABNF grammar as per RFC6020
+ *   app-extended-stmt = prefix:app-extended-name-keyword string ";"
+ *
+ * ANTLR grammar rule
+ * appExtendedStatement : APP_EXTENDED extendedName STMTEND;
+ */
+
+/**
+ * Represents listener based call back function corresponding to the "app-extended-name"
+ * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
+ */
+public final class AppExtendedNameListener {
+
+    /**
+     * Creates a new app-extended-name listener.
+     */
+    private AppExtendedNameListener() {
+    }
+
+    /**
+     * Performs validation and updates the data model tree. It is called when parser receives an
+     * input matching the grammar rule(app-extended-name).
+     *
+     * @param listener listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processAppExtendedNameEntry(TreeWalkListener listener,
+                                                   GeneratedYangParser.AppExtendedStatementContext ctx) {
+
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, APP_EXTENDED_NAME_DATA, ctx.extendedName().getText(), ENTRY);
+
+        String prefix = getValidPrefix(ctx.APP_EXTENDED().getText(), APP_EXTENDED_NAME_DATA, ctx);
+        YangAppExtendedName extendedName = new YangAppExtendedName();
+        extendedName.setPrefix(prefix);
+        extendedName.setYangAppExtendedName(removeQuotesAndHandleConcat(ctx.extendedName().getText()));
+
+        Parsable curData = listener.getParsedDataStack().peek();
+        if (curData instanceof YangCompilerAnnotation) {
+            YangCompilerAnnotation compilerAnnotation = ((YangCompilerAnnotation) curData);
+            compilerAnnotation.setYangAppExtendedName(extendedName);
+        } else {
+            throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, APP_EXTENDED_NAME_DATA,
+                    ctx.extendedName().getText(), ENTRY));
+        }
+    }
+}
diff --git a/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/CompilerAnnotationListener.java b/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/CompilerAnnotationListener.java
new file mode 100644
index 0000000..c89e99a
--- /dev/null
+++ b/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/CompilerAnnotationListener.java
@@ -0,0 +1,118 @@
+/*
+ * 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.parser.impl.listeners;
+
+import org.onosproject.yangutils.datamodel.YangCompilerAnnotation;
+import org.onosproject.yangutils.datamodel.YangModule;
+import org.onosproject.yangutils.datamodel.YangSubModule;
+import org.onosproject.yangutils.datamodel.utils.Parsable;
+import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
+import org.onosproject.yangutils.parser.exceptions.ParserException;
+import org.onosproject.yangutils.parser.impl.TreeWalkListener;
+
+import static org.onosproject.yangutils.datamodel.utils.YangConstructType.COMPILER_ANNOTATION_DATA;
+import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
+import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.EXIT;
+import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
+import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
+import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.MISSING_CURRENT_HOLDER;
+import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
+import static org.onosproject.yangutils.parser.impl.parserutils.ListenerUtil.getValidPrefix;
+import static org.onosproject.yangutils.parser.impl.parserutils.ListenerUtil.removeQuotesAndHandleConcat;
+import static org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
+
+/*
+ * Reference: RFC6020 and YANG ANTLR Grammar
+ *
+ * ABNF grammar as per RFC6020
+ *   compiler-annotation-stmt = prefix:compiler-annotation-keyword string
+ *                          "{"
+ *                              [app-data-structure-stmt stmtsep]
+ *                              [app-extended-stmt stmtsep]
+ *                          "}"
+ *
+ * ANTLR grammar rule
+ *   compilerAnnotationStatement : COMPILER_ANNOTATION string LEFT_CURLY_BRACE
+ *        compilerAnnotationBodyStatement RIGHT_CURLY_BRACE;
+ *
+ *   compilerAnnotationBodyStatement : appDataStructureStatement? appExtendedStatement? ;
+ */
+
+/**
+ * Represents listener based call back function corresponding to the "compiler-annotation"
+ * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
+ */
+public final class CompilerAnnotationListener {
+
+    /**
+     * Creates a new compiler-annotation listener.
+     */
+    private CompilerAnnotationListener() {
+    }
+
+    /**
+     * Performs validation and updates the data model tree. It is called when parser receives an
+     * input matching the grammar rule(compiler-annotation).
+     *
+     * @param listener listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processCompilerAnnotationEntry(TreeWalkListener listener,
+                                                      GeneratedYangParser.CompilerAnnotationStatementContext ctx) {
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, COMPILER_ANNOTATION_DATA, ctx.string().getText(), ENTRY);
+        String prefix = getValidPrefix(ctx.COMPILER_ANNOTATION().getText(), COMPILER_ANNOTATION_DATA, ctx);
+
+        YangCompilerAnnotation compilerAnnotation = new YangCompilerAnnotation();
+        compilerAnnotation.setPrefix(prefix);
+        compilerAnnotation.setPath(removeQuotesAndHandleConcat(ctx.string().getText()));
+
+        Parsable curData = listener.getParsedDataStack().peek();
+        switch (curData.getYangConstructType()) {
+            case MODULE_DATA:
+                YangModule module = ((YangModule) curData);
+                module.addCompilerAnnotation(compilerAnnotation);
+                break;
+            case SUB_MODULE_DATA:
+                YangSubModule subModule = ((YangSubModule) curData);
+                subModule.addCompilerAnnotation(compilerAnnotation);
+                break;
+            default:
+                throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, COMPILER_ANNOTATION_DATA,
+                        ctx.string().getText(), ENTRY));
+        }
+        listener.getParsedDataStack().push(compilerAnnotation);
+    }
+
+    /**
+     * Performs validation and updates the data model tree. It is called when parser
+     * exits from grammar rule (compiler-annotation).
+     *
+     * @param listener listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processCompilerAnnotationExit(TreeWalkListener listener,
+                                                     GeneratedYangParser.CompilerAnnotationStatementContext ctx) {
+
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, COMPILER_ANNOTATION_DATA, ctx.string().getText(), EXIT);
+        if (!(listener.getParsedDataStack().peek() instanceof YangCompilerAnnotation)) {
+            throw new ParserException(constructListenerErrorMessage(MISSING_CURRENT_HOLDER, COMPILER_ANNOTATION_DATA,
+                    ctx.string().getText(), EXIT));
+        }
+        listener.getParsedDataStack().pop();
+    }
+}
diff --git a/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/DataStructureKeyListener.java b/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/DataStructureKeyListener.java
new file mode 100644
index 0000000..65fc50b
--- /dev/null
+++ b/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/DataStructureKeyListener.java
@@ -0,0 +1,87 @@
+/*
+ * 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.parser.impl.listeners;
+
+import org.onosproject.yangutils.datamodel.YangAppDataStructure;
+import org.onosproject.yangutils.datamodel.utils.Parsable;
+import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
+import org.onosproject.yangutils.parser.exceptions.ParserException;
+import org.onosproject.yangutils.parser.impl.TreeWalkListener;
+
+import static org.onosproject.yangutils.datamodel.utils.YangConstructType.KEY_DATA;
+import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
+import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
+import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
+import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
+import static org.onosproject.yangutils.parser.impl.parserutils.ListenerUtil.removeQuotesAndHandleConcat;
+import static org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
+import static org.onosproject.yangutils.utils.UtilConstants.SPACE;
+
+/*
+ * Reference: RFC6020 and YANG ANTLR Grammar
+ *
+ * ABNF grammar as per RFC6020
+ *   data-structure-key-stmt = prefix:key-keyword string ";"
+ *
+ * ANTLR grammar rule
+ *   dataStructureKeyStatement : DATA_STRUCTURE_KEY string STMTEND;
+ */
+
+/**
+ * Represents listener based call back function corresponding to the "key"
+ * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
+ */
+public final class DataStructureKeyListener {
+
+    /**
+     * Creates a new data-structure-key listener.
+     */
+    private DataStructureKeyListener() {
+    }
+
+    /**
+     * Performs validation and updates the data model tree. It is called when parser receives an
+     * input matching the grammar rule(key).
+     *
+     * @param listener listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processDataStructureKeyEntry(TreeWalkListener listener,
+                                                    GeneratedYangParser.DataStructureKeyStatementContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, KEY_DATA, ctx.string().getText(), ENTRY);
+
+        Parsable tmpData = listener.getParsedDataStack().peek();
+        if (listener.getParsedDataStack().peek() instanceof YangAppDataStructure) {
+            YangAppDataStructure dataStructure = (YangAppDataStructure) tmpData;
+            String tmpKeyValue = removeQuotesAndHandleConcat(ctx.string().getText());
+            if (tmpKeyValue.contains(SPACE)) {
+                String[] keyValues = tmpKeyValue.split(SPACE);
+                for (String keyValue : keyValues) {
+                    dataStructure.addKey(keyValue);
+                }
+            } else {
+                dataStructure.addKey(tmpKeyValue);
+            }
+        } else {
+            throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, KEY_DATA, ctx.string().getText(),
+                    ENTRY));
+        }
+    }
+}
+
diff --git a/plugin/src/main/java/org/onosproject/yangutils/parser/impl/parserutils/ListenerUtil.java b/plugin/src/main/java/org/onosproject/yangutils/parser/impl/parserutils/ListenerUtil.java
index aa38b87..5fe0970 100644
--- a/plugin/src/main/java/org/onosproject/yangutils/parser/impl/parserutils/ListenerUtil.java
+++ b/plugin/src/main/java/org/onosproject/yangutils/parser/impl/parserutils/ListenerUtil.java
@@ -1026,4 +1026,28 @@
             throw parserException;
         }
     }
+
+    /**
+     * Checks and return valid prefix.
+     *
+     * @param inputString   string from yang file
+     * @param yangConstruct yang construct for creating error message
+     * @param ctx           yang construct's context to get the line number and character position
+     * @return valid prefix
+     */
+    public static String getValidPrefix(String inputString,
+                                        YangConstructType yangConstruct, ParserRuleContext ctx) {
+        String tmpPrefixString = removeQuotesAndHandleConcat(inputString);
+        String[] tmpData = tmpPrefixString.split(Pattern.quote(COLON));
+        if (tmpData.length == 2) {
+            return tmpData[0];
+        } else {
+            ParserException parserException = new ParserException("YANG file error : " +
+                    YangConstructType.getYangConstructType(yangConstruct) + " name " + inputString +
+                    " is not valid.");
+            parserException.setLine(ctx.getStart().getLine());
+            parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
+            throw parserException;
+        }
+    }
 }
diff --git a/plugin/src/main/resources/GeneratedYang.g4 b/plugin/src/main/resources/GeneratedYang.g4
index eb23364..0362cb0 100644
--- a/plugin/src/main/resources/GeneratedYang.g4
+++ b/plugin/src/main/resources/GeneratedYang.g4
@@ -124,7 +124,8 @@
                | augmentStatement
                | rpcStatement
                | notificationStatement
-               | deviationStatement)*
+               | deviationStatement
+               | compilerAnnotationStatement)*
                ;
 
     /**
@@ -237,13 +238,34 @@
      *                            [status-stmt stmtsep]
      *                            [description-stmt stmtsep]
      *                            [reference-stmt stmtsep]
-     *                            [compiler-annotation-stmt stmtsep]
      *                        "}")
-     * TODO : 0..1 occurance to be checked in listener
      */
     extensionStatement : EXTENSION_KEYWORD identifier (STMTEND | LEFT_CURLY_BRACE extensionBody RIGHT_CURLY_BRACE);
-    extensionBody : (argumentStatement | statusStatement | descriptionStatement
-                  | referenceStatement | compilerAnnotationStatement)* ;
+    extensionBody : argumentStatement? statusStatement? descriptionStatement? referenceStatement?
+                   | argumentStatement? statusStatement? referenceStatement? descriptionStatement?
+                   | argumentStatement? descriptionStatement? statusStatement? referenceStatement?
+                   | argumentStatement? descriptionStatement? referenceStatement? statusStatement?
+                   | argumentStatement? referenceStatement? descriptionStatement? statusStatement?
+                   | argumentStatement? referenceStatement? statusStatement? descriptionStatement?
+                   | statusStatement? referenceStatement? argumentStatement? descriptionStatement?
+                   | statusStatement? referenceStatement? descriptionStatement? argumentStatement?
+                   | statusStatement? descriptionStatement? referenceStatement? argumentStatement?
+                   | statusStatement? descriptionStatement? argumentStatement? referenceStatement?
+                   | statusStatement? argumentStatement? referenceStatement? descriptionStatement?
+                   | statusStatement? argumentStatement? descriptionStatement? referenceStatement?
+                   | descriptionStatement? argumentStatement? statusStatement? referenceStatement?
+                   | descriptionStatement? argumentStatement? referenceStatement? statusStatement?
+                   | descriptionStatement? statusStatement? argumentStatement? referenceStatement?
+                   | descriptionStatement? statusStatement? referenceStatement? argumentStatement?
+                   | descriptionStatement? referenceStatement? statusStatement? argumentStatement?
+                   | descriptionStatement? referenceStatement? argumentStatement? statusStatement?
+                   | referenceStatement? descriptionStatement? argumentStatement? statusStatement?
+                   | referenceStatement? descriptionStatement? statusStatement? argumentStatement?
+                   | referenceStatement? statusStatement? argumentStatement? descriptionStatement?
+                   | referenceStatement? statusStatement? descriptionStatement? argumentStatement?
+                   | referenceStatement? argumentStatement? descriptionStatement? statusStatement?
+                   | referenceStatement? argumentStatement? statusStatement? descriptionStatement?
+                   ;
 
     /**
      * argument-stmt       = argument-keyword sep identifier-arg-str optsep
@@ -270,13 +292,35 @@
      *                            [status-stmt stmtsep]
      *                            [description-stmt stmtsep]
      *                            [reference-stmt stmtsep]
-     *                            [compiler-annotation-stmt stmtsep]
      *                        "}")
-     * TODO : 0..1 occurance to be checked in listener
      */
     identityStatement : IDENTITY_KEYWORD identifier (STMTEND | LEFT_CURLY_BRACE identityBody RIGHT_CURLY_BRACE);
-    identityBody : (baseStatement | statusStatement | descriptionStatement | referenceStatement
-                 | compilerAnnotationStatement)*;
+    identityBody : baseStatement? statusStatement? descriptionStatement? referenceStatement?
+                  | baseStatement? statusStatement? referenceStatement? descriptionStatement?
+                  | baseStatement? descriptionStatement? statusStatement? referenceStatement?
+                  | baseStatement? descriptionStatement? referenceStatement? statusStatement?
+                  | baseStatement? referenceStatement? descriptionStatement? statusStatement?
+                  | baseStatement? referenceStatement? statusStatement? descriptionStatement?
+                  | referenceStatement? baseStatement? statusStatement? descriptionStatement?
+                  | referenceStatement? baseStatement? descriptionStatement? statusStatement?
+                  | referenceStatement? statusStatement? baseStatement? descriptionStatement?
+                  | referenceStatement? statusStatement? descriptionStatement? baseStatement?
+                  | referenceStatement? descriptionStatement? statusStatement? baseStatement?
+                  | referenceStatement? descriptionStatement? baseStatement? statusStatement?
+                  | descriptionStatement? referenceStatement? statusStatement? baseStatement?
+                  | descriptionStatement? referenceStatement? statusStatement? baseStatement?
+                  | descriptionStatement? referenceStatement? baseStatement? statusStatement?
+                  | descriptionStatement? statusStatement? baseStatement? referenceStatement?
+                  | descriptionStatement? statusStatement? referenceStatement? baseStatement?
+                  | descriptionStatement? baseStatement? referenceStatement? statusStatement?
+                  | descriptionStatement? baseStatement? statusStatement? referenceStatement?
+                  | statusStatement? baseStatement? descriptionStatement? referenceStatement?
+                  | statusStatement? baseStatement? referenceStatement? descriptionStatement?
+                  | statusStatement? descriptionStatement? baseStatement? referenceStatement?
+                  | statusStatement? descriptionStatement? referenceStatement? baseStatement?
+                  | statusStatement? referenceStatement? descriptionStatement? baseStatement?
+                  | statusStatement? referenceStatement? baseStatement? descriptionStatement?
+                  ;
 
     /**
      * base-stmt           = base-keyword sep identifier-ref-arg-str
@@ -294,13 +338,34 @@
      *                             [status-stmt stmtsep]
      *                             [description-stmt stmtsep]
      *                             [reference-stmt stmtsep]
-     *                             [compiler-annotation-stmt stmtsep]
      *                         "}")
-     * TODO : 0..1 occurance to be checked in listener
      */
     featureStatement : FEATURE_KEYWORD string (STMTEND | LEFT_CURLY_BRACE featureBody RIGHT_CURLY_BRACE);
-    featureBody : (ifFeatureStatement | statusStatement | descriptionStatement
-                | referenceStatement | compilerAnnotationStatement)* ;
+    featureBody : ifFeatureStatement* statusStatement? descriptionStatement? referenceStatement?
+                 | ifFeatureStatement* statusStatement? referenceStatement? descriptionStatement?
+                 | ifFeatureStatement* descriptionStatement? statusStatement? referenceStatement?
+                 | ifFeatureStatement* descriptionStatement? referenceStatement? statusStatement?
+                 | ifFeatureStatement* referenceStatement? statusStatement? descriptionStatement?
+                 | ifFeatureStatement* referenceStatement? descriptionStatement? statusStatement?
+                 | statusStatement? ifFeatureStatement* descriptionStatement? referenceStatement?
+                 | statusStatement? ifFeatureStatement* referenceStatement? descriptionStatement?
+                 | statusStatement? descriptionStatement? ifFeatureStatement* referenceStatement?
+                 | statusStatement? descriptionStatement? referenceStatement? ifFeatureStatement*
+                 | statusStatement? referenceStatement? ifFeatureStatement* descriptionStatement?
+                 | statusStatement? referenceStatement? descriptionStatement? ifFeatureStatement*
+                 | descriptionStatement? ifFeatureStatement* statusStatement? referenceStatement?
+                 | descriptionStatement? ifFeatureStatement* referenceStatement? statusStatement?
+                 | descriptionStatement? statusStatement? ifFeatureStatement* referenceStatement?
+                 | descriptionStatement? statusStatement? referenceStatement? ifFeatureStatement*
+                 | descriptionStatement? referenceStatement* statusStatement? ifFeatureStatement*
+                 | descriptionStatement? referenceStatement* ifFeatureStatement? statusStatement?
+                 | referenceStatement? ifFeatureStatement* statusStatement? descriptionStatement?
+                 | referenceStatement? ifFeatureStatement* descriptionStatement? statusStatement?
+                 | referenceStatement? descriptionStatement? statusStatement? ifFeatureStatement*
+                 | referenceStatement? descriptionStatement? ifFeatureStatement* statusStatement?
+                 | referenceStatement? statusStatement? descriptionStatement? ifFeatureStatement*
+                 | referenceStatement? statusStatement? ifFeatureStatement* descriptionStatement?
+                 ;
 
     /**
      *  data-def-stmt       = container-stmt /
@@ -340,13 +405,11 @@
      *                             [status-stmt stmtsep]
      *                             [description-stmt stmtsep]
      *                             [reference-stmt stmtsep]
-     *                             [compiler-annotation-stmt stmtsep]
      *                           "}"
      * TODO : 0..1 occurance to be validated in listener
      */
     typedefStatement : TYPEDEF_KEYWORD identifier LEFT_CURLY_BRACE
-                   (typeStatement | unitsStatement | defaultStatement | statusStatement | descriptionStatement
-                   | compilerAnnotationStatement | referenceStatement)*
+                   (typeStatement | unitsStatement | defaultStatement | statusStatement | descriptionStatement | referenceStatement)*
                    RIGHT_CURLY_BRACE;
 
     /**
@@ -715,7 +778,6 @@
      *                            [status-stmt stmtsep]
      *                             [description-stmt stmtsep]
      *                             [reference-stmt stmtsep]
-     *                             [compiler-annotation-stmt stmtsep]
      *                             *((typedef-stmt /
      *                                grouping-stmt) stmtsep)
      *                             *(data-def-stmt stmtsep)
@@ -724,7 +786,7 @@
      */
     groupingStatement : GROUPING_KEYWORD identifier (STMTEND | LEFT_CURLY_BRACE
                       (statusStatement | descriptionStatement | referenceStatement | typedefStatement | groupingStatement
-                       | dataDefStatement | compilerAnnotationStatement)* RIGHT_CURLY_BRACE);
+                       | dataDefStatement)* RIGHT_CURLY_BRACE);
 
     /**
      *  container-stmt      = container-keyword sep identifier-arg-str optsep
@@ -739,7 +801,6 @@
      *                             [status-stmt stmtsep]
      *                             [description-stmt stmtsep]
      *                             [reference-stmt stmtsep]
-     *                             [compiler-annotation-stmt stmtsep]
      *                             *((typedef-stmt /
      *                                grouping-stmt) stmtsep)
      *                             *(data-def-stmt stmtsep)
@@ -749,7 +810,7 @@
     containerStatement : CONTAINER_KEYWORD identifier
                      (STMTEND | LEFT_CURLY_BRACE (whenStatement | ifFeatureStatement | mustStatement | presenceStatement | configStatement
                      | statusStatement | descriptionStatement | referenceStatement | typedefStatement | groupingStatement
-                     | dataDefStatement | compilerAnnotationStatement)* RIGHT_CURLY_BRACE);
+                     | dataDefStatement)* RIGHT_CURLY_BRACE);
 
     /**
      *  leaf-stmt           = leaf-keyword sep identifier-arg-str optsep
@@ -771,7 +832,7 @@
      */
     leafStatement : LEAF_KEYWORD identifier LEFT_CURLY_BRACE (whenStatement | ifFeatureStatement | typeStatement | unitsStatement
               | mustStatement | defaultStatement | configStatement | mandatoryStatement | statusStatement  | descriptionStatement
-              | referenceStatement | compilerAnnotationStatement)* RIGHT_CURLY_BRACE;
+              | referenceStatement)* RIGHT_CURLY_BRACE;
 
     /**
      *  leaf-list-stmt      = leaf-list-keyword sep identifier-arg-str optsep
@@ -794,7 +855,7 @@
      */
     leafListStatement : LEAF_LIST_KEYWORD identifier LEFT_CURLY_BRACE (whenStatement | ifFeatureStatement | typeStatement
                      | unitsStatement | mustStatement | configStatement | minElementsStatement | maxElementsStatement | orderedByStatement
-                     | statusStatement | descriptionStatement | referenceStatement | compilerAnnotationStatement)* RIGHT_CURLY_BRACE;
+                     | statusStatement | descriptionStatement | referenceStatement)* RIGHT_CURLY_BRACE;
 
     /**
      *  list-stmt           = list-keyword sep identifier-arg-str optsep
@@ -820,8 +881,7 @@
      */
     listStatement : LIST_KEYWORD identifier LEFT_CURLY_BRACE (whenStatement | ifFeatureStatement | mustStatement | keyStatement
               | uniqueStatement | configStatement | minElementsStatement | maxElementsStatement | orderedByStatement | statusStatement
-              | descriptionStatement | referenceStatement | typedefStatement | groupingStatement| dataDefStatement
-              | compilerAnnotationStatement)* RIGHT_CURLY_BRACE;
+              | descriptionStatement | referenceStatement | typedefStatement | groupingStatement| dataDefStatement)* RIGHT_CURLY_BRACE;
 
     /**
      *  key-stmt            = key-keyword sep key-arg-str stmtend
@@ -852,7 +912,7 @@
      */
     choiceStatement : CHOICE_KEYWORD identifier (STMTEND | LEFT_CURLY_BRACE (whenStatement | ifFeatureStatement | defaultStatement
                   | configStatement | mandatoryStatement | statusStatement | descriptionStatement | referenceStatement | shortCaseStatement
-                  | caseStatement | compilerAnnotationStatement)* RIGHT_CURLY_BRACE);
+                  | caseStatement)* RIGHT_CURLY_BRACE);
 
     /**
      *  short-case-stmt     = container-stmt /
@@ -897,7 +957,7 @@
      */
      anyxmlStatement : ANYXML_KEYWORD identifier (STMTEND | LEFT_CURLY_BRACE (whenStatement | ifFeatureStatement
                      | mustStatement | configStatement | mandatoryStatement | statusStatement | descriptionStatement
-                     | referenceStatement | compilerAnnotationStatement)* RIGHT_CURLY_BRACE);
+                     | referenceStatement)* RIGHT_CURLY_BRACE);
 
     /**
      *  uses-stmt           = uses-keyword sep identifier-ref-arg-str optsep
@@ -909,15 +969,13 @@
      *                             [status-stmt stmtsep]
      *                             [description-stmt stmtsep]
      *                             [reference-stmt stmtsep]
-     *                             [compiler-annotation-stmt stmtsep]
      *                             *(refine-stmt stmtsep)
      *                             *(uses-augment-stmt stmtsep)
      *                         "}")
      * TODO : 0..1 occurance to be checked in listener
      */
     usesStatement : USES_KEYWORD string (STMTEND | LEFT_CURLY_BRACE (whenStatement | ifFeatureStatement | statusStatement
-                | descriptionStatement | referenceStatement | refineStatement | augmentStatement
-                | compilerAnnotationStatement)* RIGHT_CURLY_BRACE);
+                | descriptionStatement | referenceStatement | refineStatement | augmentStatement)* RIGHT_CURLY_BRACE);
 
     /**
      *  refine-stmt         = refine-keyword sep refine-arg-str optsep
@@ -1032,8 +1090,7 @@
      * TODO : 0..1 occurance to be checked in listener
      */
     augmentStatement : AUGMENT_KEYWORD augment LEFT_CURLY_BRACE (whenStatement | ifFeatureStatement | statusStatement
-                   | descriptionStatement | referenceStatement | dataDefStatement  | caseStatement
-                   | compilerAnnotationStatement)* RIGHT_CURLY_BRACE;
+                   | descriptionStatement | referenceStatement | dataDefStatement  | caseStatement)* RIGHT_CURLY_BRACE;
 
     /**
      *  when-stmt           = when-keyword sep string optsep
@@ -1061,13 +1118,10 @@
      *                                grouping-stmt) stmtsep)
      *                             [input-stmt stmtsep]
      *                             [output-stmt stmtsep]
-     *                             [compiler-annotation-stmt stmtsep]
      *                         "}")
-     * TODO : 0..1 occurance to be checked in listener
      */
-    rpcStatement : RPC_KEYWORD identifier (STMTEND | LEFT_CURLY_BRACE (ifFeatureStatement | statusStatement
-                 | descriptionStatement | referenceStatement | typedefStatement | groupingStatement | inputStatement
-                 | outputStatement | compilerAnnotationStatement)* RIGHT_CURLY_BRACE);
+    rpcStatement : RPC_KEYWORD identifier (STMTEND | LEFT_CURLY_BRACE (ifFeatureStatement | statusStatement | descriptionStatement
+                | referenceStatement | typedefStatement | groupingStatement | inputStatement | outputStatement)* RIGHT_CURLY_BRACE);
 
     /**
      * input-stmt          = input-keyword optsep
@@ -1101,7 +1155,6 @@
      *                             [status-stmt stmtsep]
      *                             [description-stmt stmtsep]
      *                             [reference-stmt stmtsep]
-     *                             [compiler-annotation-stmt stmtsep]
      *                             *((typedef-stmt /
      *                                grouping-stmt) stmtsep)
      *                             *(data-def-stmt stmtsep)
@@ -1110,7 +1163,7 @@
      */
      notificationStatement : NOTIFICATION_KEYWORD identifier (STMTEND | LEFT_CURLY_BRACE (ifFeatureStatement
                            | statusStatement | descriptionStatement | referenceStatement | typedefStatement
-                           | groupingStatement | dataDefStatement | compilerAnnotationStatement)* RIGHT_CURLY_BRACE);
+                           | groupingStatement | dataDefStatement)* RIGHT_CURLY_BRACE);
 
     /**
      *  deviation-stmt      = deviation-keyword sep
@@ -1119,7 +1172,6 @@
      *                            ;; these stmts can appear in any order
      *                            [description-stmt stmtsep]
      *                            [reference-stmt stmtsep]
-     *                            [compiler-annotation-stmt stmtsep]
      *                            (deviate-not-supported-stmt /
      *                              1*(deviate-add-stmt /
      *                                 deviate-replace-stmt /
@@ -1129,7 +1181,7 @@
      */
     deviationStatement: DEVIATION_KEYWORD deviation LEFT_CURLY_BRACE (descriptionStatement | referenceStatement
                       | deviateNotSupportedStatement | deviateAddStatement | deviateReplaceStatement
-                      | deviateDeleteStatement | compilerAnnotationStatement)* RIGHT_CURLY_BRACE;
+                      | deviateDeleteStatement)* RIGHT_CURLY_BRACE;
 
     /**
      * deviate-not-supported-stmt =
@@ -1190,67 +1242,42 @@
                            maxElementsStatement? RIGHT_CURLY_BRACE));
 
     /**
-     * compiler-annotation-stmt = compiler-annotation-keyword optsep
-     *                    "{" stmtsep
-     *                        ;; these stmts can appear in any order
-     *                        *(if-feature-stmt stmtsep)
-     *                         [status-stmt stmtsep]
-     *                         [units-stmt stmtsep]
-     *                         [reference-stmt stmtsep]
-     *                         1*(compiler-annotation-stmt stmtsep)
-     *                    "}"
+     *   compiler-annotation-stmt = prefix:compiler-annotation-keyword string
+     *                          "{"
+     *                              [app-data-structure-stmt stmtsep]
+     *                              [app-extended-stmt stmtsep]
+     *                          "}"
      */
-    compilerAnnotationStatement : COMPILER_ANNOTATION_KEYWORD LEFT_CURLY_BRACE (ifFeatureStatement | statusStatement
-                                | unitsStatement | referenceStatement | annotationStatement)*
-                                  RIGHT_CURLY_BRACE;
+    compilerAnnotationStatement : COMPILER_ANNOTATION string LEFT_CURLY_BRACE
+                                       compilerAnnotationBodyStatement RIGHT_CURLY_BRACE;
+
+    compilerAnnotationBodyStatement : appDataStructureStatement? appExtendedStatement? ;
 
     /**
-     * annotation-stmt = "@" annotation-type [annotation-parameter-specification] ";"
+     *   app-data-structure-stmt = prefix:app-data-structure-keyword string
+     *                         (";" /
+     *                          "{"
+     *                              [data-structure-key-stmt stmtsep]
+     *                          "}")
      */
-    annotationStatement : annotationType annotationParameterSpecification? STMTEND;
+    appDataStructureStatement : APP_DATA_STRUCTURE appDataStructure (STMTEND | (LEFT_CURLY_BRACE
+                  dataStructureKeyStatement? RIGHT_CURLY_BRACE));
 
     /**
-     * annotation-type = identifier
+     *   data-structure-key-stmt = prefix:key-keyword string ";"
      */
-    annotationType : annotationIdentifier;
+    dataStructureKeyStatement : DATA_STRUCTURE_KEY string STMTEND;
 
     /**
-     * annotation-parameter-specification = "(" optsep annotation-parameter-specification-arg optsep ")"
+     *   app-extended-stmt = prefix:app-extended-name-keyword string ";"
      */
-    annotationParameterSpecification : LEFT_ROUND_BRACE annotationParameterSpecificationArg RIGHT_ROUND_BRACE;
-
-    /**
-     * annotation-parameter-specification-arg = annotation-para-type-value
-     *                                     / annotation-para-instance *("," annotation-para-instance)
-     */
-    annotationParameterSpecificationArg : annotationParaTypeValue
-                                        | annotationParaInstance (COMMA annotationParaInstance)*;
-
-    /**
-     * annotation-para-instance = annotation-para-type-identifier optsep "=" optsep annotation-para-type-value
-     */
-    annotationParaInstance : annotationParaTypeIdentifier EQUAL annotationParaTypeValue;
-
-    /**
-     * annotation-para-type-identifier = identifier
-     */
-    annotationParaTypeIdentifier : identifier;
-
-    /**
-     * annotation-para-type-value = identifier
-     */
-    annotationParaTypeValue : identifier;
+    appExtendedStatement : APP_EXTENDED extendedName STMTEND;
 
     string : STRING (PLUS STRING)*
            | IDENTIFIER
            | INTEGER
            | yangConstruct;
 
-    annotationIdentifier : STRING (PLUS STRING)*
-                         | ANNOTATION_IDENTIFIER
-                         | IDENTIFIER
-                         | yangConstruct;
-
     identifier : STRING (PLUS STRING)*
                | IDENTIFIER
                | yangConstruct;
@@ -1296,15 +1323,19 @@
 
     fraction : string;
 
+    appDataStructure : string;
+
+    extendedName : string;
+
     yangConstruct : ANYXML_KEYWORD | ARGUMENT_KEYWORD | AUGMENT_KEYWORD | BASE_KEYWORD | BELONGS_TO_KEYWORD
                   | BIT_KEYWORD | CASE_KEYWORD | CHOICE_KEYWORD | CONFIG_KEYWORD | CONTACT_KEYWORD | CONTAINER_KEYWORD
-                  | DEFAULT_KEYWORD | DESCRIPTION_KEYWORD | ENUM_KEYWORD ERROR_APP_TAG_KEYWORD | ERROR_MESSAGE_KEYWORD
+                  | DEFAULT_KEYWORD | DESCRIPTION_KEYWORD | ENUM_KEYWORD | ERROR_APP_TAG_KEYWORD | ERROR_MESSAGE_KEYWORD
                   | EXTENSION_KEYWORD | DEVIATION_KEYWORD | DEVIATE_KEYWORD | FEATURE_KEYWORD
                   | FRACTION_DIGITS_KEYWORD | GROUPING_KEYWORD | IDENTITY_KEYWORD | IF_FEATURE_KEYWORD
                   | IMPORT_KEYWORD | INCLUDE_KEYWORD | INPUT_KEYWORD | KEY_KEYWORD | LEAF_KEYWORD | LEAF_LIST_KEYWORD
                   | LENGTH_KEYWORD | LIST_KEYWORD | MANDATORY_KEYWORD | MAX_ELEMENTS_KEYWORD | MIN_ELEMENTS_KEYWORD
                   | MODULE_KEYWORD | MUST_KEYWORD | NAMESPACE_KEYWORD | NOTIFICATION_KEYWORD | ORDERED_BY_KEYWORD
-                  | ORGANIZATION_KEYWORD | OUTPUT_KEYWORD | PATH_KEYWORD | PATTERN_KEYWORD |POSITION_KEYWORD
+                  | ORGANIZATION_KEYWORD | OUTPUT_KEYWORD | PATH_KEYWORD | PATTERN_KEYWORD | POSITION_KEYWORD
                   | PREFIX_KEYWORD | PRESENCE_KEYWORD | RANGE_KEYWORD | REFERENCE_KEYWORD | REFINE_KEYWORD
                   | REQUIRE_INSTANCE_KEYWORD | REVISION_KEYWORD | REVISION_DATE_KEYWORD | RPC_KEYWORD
                   | STATUS_KEYWORD | SUBMODULE_KEYWORD | TYPE_KEYWORD | TYPEDEF_KEYWORD | UNIQUE_KEYWORD
@@ -1312,4 +1343,5 @@
                   | YIN_ELEMENT_KEYWORD | ADD_KEYWORD | CURRENT_KEYWORD | DELETE_KEYWORD | DEPRECATED_KEYWORD
                   | FALSE_KEYWORD | MAX_KEYWORD | MIN_KEYWORD | NOT_SUPPORTED_KEYWORD | OBSOLETE_KEYWORD
                   | REPLACE_KEYWORD | SYSTEM_KEYWORD | TRUE_KEYWORD | UNBOUNDED_KEYWORD | USER_KEYWORD
-                  | COMPILER_ANNOTATION_KEYWORD;
+                  | COMPILER_ANNOTATION_KEYWORD | APP_DATA_STRUCTURE_KEYWORD | DATA_STRUCTURE_KEYWORD
+                  | APP_EXTENDED_KEYWORD;
diff --git a/plugin/src/main/resources/YangLexer.g4 b/plugin/src/main/resources/YangLexer.g4
index d1f7fea..8abe32f 100644
--- a/plugin/src/main/resources/YangLexer.g4
+++ b/plugin/src/main/resources/YangLexer.g4
@@ -101,6 +101,14 @@
     UNBOUNDED_KEYWORD   : 'unbounded';
     USER_KEYWORD        : 'user';
     COMPILER_ANNOTATION_KEYWORD : 'compiler-annotation';
+    COMPILER_ANNOTATION : IDENTIFIER COLON COMPILER_ANNOTATION_KEYWORD;
+    APP_DATA_STRUCTURE_KEYWORD : 'app-data-structure';
+    APP_DATA_STRUCTURE : IDENTIFIER COLON APP_DATA_STRUCTURE_KEYWORD;
+    DATA_STRUCTURE_KEYWORD : 'data-structure';
+    DATA_STRUCTURE : IDENTIFIER COLON DATA_STRUCTURE_KEYWORD;
+    DATA_STRUCTURE_KEY : IDENTIFIER COLON KEY_KEYWORD;
+    APP_EXTENDED_KEYWORD : 'app-extended-name';
+    APP_EXTENDED : IDENTIFIER COLON APP_EXTENDED_KEYWORD;
 
     // Lexer tokens to be skipped
     COMMENT
@@ -117,18 +125,11 @@
     DATE_ARG            : DIGIT DIGIT DIGIT DIGIT '-' DIGIT DIGIT '-' DIGIT DIGIT;
     LEFT_CURLY_BRACE    : '{';
     RIGHT_CURLY_BRACE   : '}';
-    LEFT_ROUND_BRACE    : '(';
-    RIGHT_ROUND_BRACE   : ')';
-    ANNOTATION_START    : '@';
-    ANNOTATION_IDENTIFIER : ('@')(ALPHA | '_')
-                              (ALPHA | DIGIT | '_' | '-' | '.')*;
     IDENTIFIER          : (ALPHA | '_')
                           (ALPHA | DIGIT | '_' | '-' | '.')*;
     STMTEND             : ';';
     DQUOTE              : '"';
     COLON               : ':';
-    COMMA               : ',';
-    EQUAL               : '=';
     PLUS : '+';
     MINUS: '-';
 
diff --git a/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/CompilerAnnotationListenerTest.java b/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/CompilerAnnotationListenerTest.java
new file mode 100644
index 0000000..cbc4009
--- /dev/null
+++ b/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/CompilerAnnotationListenerTest.java
@@ -0,0 +1,69 @@
+/*
+ * 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.parser.impl.listeners;
+
+import java.io.IOException;
+import org.junit.Test;
+import org.onosproject.yangutils.datamodel.YangAppDataStructure;
+import org.onosproject.yangutils.datamodel.YangCompilerAnnotation;
+import org.onosproject.yangutils.datamodel.YangDataStructure;
+import org.onosproject.yangutils.datamodel.YangModule;
+import org.onosproject.yangutils.datamodel.YangNode;
+import org.onosproject.yangutils.datamodel.YangNodeType;
+import org.onosproject.yangutils.parser.exceptions.ParserException;
+import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.Is.is;
+
+/**
+ * Test cases for compiler annotation listener.
+ */
+public class CompilerAnnotationListenerTest {
+
+    private final YangUtilsParserManager manager = new YangUtilsParserManager();
+
+    /**
+     * Checks valid compiler annotation statements.
+     */
+    @Test
+    public void processValidCompilerAnnotation() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/ValidCompilerAnnotation.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("event"));
+
+        YangCompilerAnnotation compilerAnnotation = yangNode.getCompilerAnnotationList()
+                .iterator().next();
+        assertThat(compilerAnnotation.getPrefix(), is("ca"));
+        assertThat(compilerAnnotation.getPath(), is("/candidate-servers/server"));
+
+        YangAppDataStructure appDataStructure = compilerAnnotation.getYangAppDataStructure();
+        assertThat(appDataStructure.getPrefix(), is("abc"));
+        assertThat(appDataStructure.getDataStructure(), is(YangDataStructure.MAP));
+
+        assertThat(appDataStructure.getKeyList().iterator().next(), is("name"));
+    }
+}
diff --git a/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ListListenerTest.java b/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ListListenerTest.java
index 2cde776..7c0dae6 100644
--- a/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ListListenerTest.java
+++ b/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ListListenerTest.java
@@ -23,13 +23,13 @@
 import org.junit.Test;
 import org.junit.rules.ExpectedException;
 import org.onosproject.yangutils.datamodel.YangContainer;
-import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes;
 import org.onosproject.yangutils.datamodel.YangLeaf;
 import org.onosproject.yangutils.datamodel.YangList;
 import org.onosproject.yangutils.datamodel.YangModule;
 import org.onosproject.yangutils.datamodel.YangNode;
 import org.onosproject.yangutils.datamodel.YangNodeType;
 import org.onosproject.yangutils.datamodel.YangStatusType;
+import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes;
 import org.onosproject.yangutils.parser.exceptions.ParserException;
 import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
 
@@ -208,4 +208,30 @@
         thrown.expectMessage("YANG file error : list name 1valid is not valid.");
         YangNode node = manager.getDataModel("src/test/resources/ListInvalidIdentifier.yang");
     }
+
+    /**
+     * Checks list with identifier name as enum.
+     */
+    @Test
+    public void processListWithIdentifierNameEnum() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/ListWithIdentifierNameEnum.yang");
+
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        // Check whether the list is child of module
+        YangList yangList = (YangList) yangNode.getChild();
+        assertThat(yangList.getName(), is("enumList"));
+        assertThat(yangList.getKeyList().contains("enum"), is(true));
+        YangLeaf leaf = yangList.getListOfLeaf().iterator().next();
+        assertThat(leaf.getName(), is("enum"));
+        assertThat(leaf.getDataType().getDataType(), is(YangDataTypes.ENUMERATION));
+    }
 }
diff --git a/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/WhenListenerTest.java b/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/WhenListenerTest.java
index fcba7c0..fadbc01 100644
--- a/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/WhenListenerTest.java
+++ b/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/WhenListenerTest.java
@@ -16,6 +16,8 @@
 
 package org.onosproject.yangutils.parser.impl.listeners;
 
+import java.io.IOException;
+import java.util.ListIterator;
 import org.junit.Test;
 import org.onosproject.yangutils.datamodel.YangContainer;
 import org.onosproject.yangutils.datamodel.YangLeaf;
@@ -25,9 +27,6 @@
 import org.onosproject.yangutils.parser.exceptions.ParserException;
 import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
 
-import java.io.IOException;
-import java.util.ListIterator;
-
 import static org.hamcrest.core.Is.is;
 import static org.junit.Assert.assertThat;
 
@@ -49,12 +48,12 @@
         assertThat(yangNode.getName(), is("Test"));
 
         YangList yangList = (YangList) yangNode.getChild();
+        String expectedConstraint = "../switching-capability = 'TDM'";
         assertThat(yangList.getName(), is("interface-switching-capability"));
+        assertThat(yangList.getWhen().getCondition(), is(expectedConstraint));
 
         YangContainer container = (YangContainer) yangList.getNextSibling();
         assertThat(container.getName(), is("time-division-multiplex-capable"));
-
-        String expectedConstraint = "../switching-capability = 'TDM'";
         assertThat(container.getWhen().getCondition(), is(expectedConstraint));
     }
 
diff --git a/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/InterFileIdentityLinkingTest.java b/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/InterFileIdentityLinkingTest.java
index 7805bf0..6c29c28 100644
--- a/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/InterFileIdentityLinkingTest.java
+++ b/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/InterFileIdentityLinkingTest.java
@@ -15,6 +15,8 @@
  */
 package org.onosproject.yangutils.plugin.manager;
 
+import java.io.IOException;
+import java.util.ListIterator;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.junit.Rule;
 import org.junit.Test;
@@ -34,12 +36,10 @@
 import org.onosproject.yangutils.parser.exceptions.ParserException;
 import org.onosproject.yangutils.utils.io.impl.YangFileScanner;
 
-import java.io.IOException;
-import java.util.ListIterator;
-
 import static org.hamcrest.MatcherAssert.assertThat;
 import static org.hamcrest.core.Is.is;
 import static org.onosproject.yangutils.datamodel.YangNodeType.MODULE_NODE;
+import static org.onosproject.yangutils.linker.impl.YangLinkerUtils.updateFilePriority;
 
 /**
  * Test cases for testing inter file linking for identity.
@@ -73,6 +73,8 @@
         // Add references to import list.
         yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
 
+        updateFilePriority(utilManager.getYangNodeSet());
+
         // Carry out inter-file linking.
         yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
 
@@ -162,6 +164,8 @@
         // Add references to include list.
         yangLinkerManager.addRefToYangFilesIncludeList(utilManager.getYangNodeSet());
 
+        updateFilePriority(utilManager.getYangNodeSet());
+
         // Carry out inter-file linking.
         yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
 
@@ -244,6 +248,8 @@
         // Add references to import list.
         yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
 
+        updateFilePriority(utilManager.getYangNodeSet());
+
         // Carry out inter-file linking.
         yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
 
@@ -302,7 +308,7 @@
         assertThat(yangIdentityRef.getBaseIdentity().getName(), is("ref-address-family"));
         assertThat(yangIdentityRef.getReferredIdentity().getName(), is("ref-address-family"));
         assertThat(yangIdentityRef.getResolvableStatus(), is(ResolvableStatus.RESOLVED));
-   }
+    }
 
     /**
      * Checks inter file feature linking with included file with dependency.
@@ -332,6 +338,8 @@
         // Add references to import list.
         yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
 
+        updateFilePriority(utilManager.getYangNodeSet());
+
         // Carry out inter-file linking.
         yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
 
@@ -417,6 +425,8 @@
         // Add references to import list.
         yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
 
+        updateFilePriority(utilManager.getYangNodeSet());
+
         // Carry out inter-file linking.
         yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
     }
@@ -436,10 +446,6 @@
         utilManager.parseYangFileInfoSet();
         utilManager.createYangNodeSet();
 
-        YangNode selfNode = null;
-        YangNode refNode1 = null;
-        YangNode refNode2 = null;
-
         // Create YANG node set
         yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
 
@@ -452,6 +458,9 @@
         // Add references to include list.
         yangLinkerManager.addRefToYangFilesIncludeList(utilManager.getYangNodeSet());
 
+        // Update the priority for all the files.
+        updateFilePriority(utilManager.getYangNodeSet());
+
         // Carry out inter-file linking.
         yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
     }
@@ -478,6 +487,8 @@
         // Add references to import list.
         yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
 
+        updateFilePriority(utilManager.getYangNodeSet());
+
         // Carry out inter-file linking.
         yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
 
@@ -570,6 +581,8 @@
         // Add references to import list.
         yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
 
+        updateFilePriority(utilManager.getYangNodeSet());
+
         // Carry out inter-file linking.
         yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
 
diff --git a/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/InterFileIfFeatureLinkingTest.java b/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/InterFileIfFeatureLinkingTest.java
index c4c501d..4f914ab 100644
--- a/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/InterFileIfFeatureLinkingTest.java
+++ b/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/InterFileIfFeatureLinkingTest.java
@@ -36,6 +36,7 @@
 import static org.onosproject.yangutils.datamodel.YangNodeType.MODULE_NODE;
 import static org.onosproject.yangutils.datamodel.utils.ResolvableStatus.INTRA_FILE_RESOLVED;
 import static org.onosproject.yangutils.datamodel.utils.ResolvableStatus.RESOLVED;
+import static org.onosproject.yangutils.linker.impl.YangLinkerUtils.updateFilePriority;
 
 /**
  * Test cases for testing inter file linking.
@@ -67,6 +68,8 @@
         // Add references to import list.
         yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
 
+        updateFilePriority(utilManager.getYangNodeSet());
+
         // Carry out inter-file linking.
         yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
 
@@ -137,6 +140,8 @@
         // Add references to include list.
         yangLinkerManager.addRefToYangFilesIncludeList(utilManager.getYangNodeSet());
 
+        updateFilePriority(utilManager.getYangNodeSet());
+
         // Carry out inter-file linking.
         yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
 
@@ -201,6 +206,9 @@
         // Add references to import list.
         yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
 
+        // Update the priority for all the files.
+        updateFilePriority(utilManager.getYangNodeSet());
+
         // Carry out inter-file linking.
         yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
 
@@ -272,6 +280,8 @@
         // Add references to import list.
         yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
 
+        updateFilePriority(utilManager.getYangNodeSet());
+
         // Carry out inter-file linking.
         yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
 
@@ -337,6 +347,8 @@
         // Add references to import list.
         yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
 
+        updateFilePriority(utilManager.getYangNodeSet());
+
         // Carry out inter-file linking.
         yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
 
@@ -409,6 +421,8 @@
         // Add references to include list.
         yangLinkerManager.addRefToYangFilesIncludeList(utilManager.getYangNodeSet());
 
+        updateFilePriority(utilManager.getYangNodeSet());
+
         // Carry out inter-file linking.
         yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
 
diff --git a/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/InterFileLeafrefLinkingTest.java b/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/InterFileLeafrefLinkingTest.java
index f27ae11..cc39c53 100644
--- a/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/InterFileLeafrefLinkingTest.java
+++ b/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/InterFileLeafrefLinkingTest.java
@@ -16,6 +16,9 @@
 
 package org.onosproject.yangutils.plugin.manager;
 
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.ListIterator;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.junit.Rule;
 import org.junit.Test;
@@ -32,15 +35,12 @@
 import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
 import org.onosproject.yangutils.utils.io.impl.YangFileScanner;
 
-import java.io.IOException;
-import java.util.Iterator;
-import java.util.ListIterator;
-
 import static org.hamcrest.MatcherAssert.assertThat;
 import static org.hamcrest.core.Is.is;
 import static org.onosproject.yangutils.datamodel.YangNodeType.MODULE_NODE;
 import static org.onosproject.yangutils.datamodel.utils.ResolvableStatus.RESOLVED;
 import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.LEAFREF;
+import static org.onosproject.yangutils.linker.impl.YangLinkerUtils.updateFilePriority;
 
 /**
  * Test cases for testing leafref inter file linking.
@@ -74,6 +74,8 @@
         // Add references to import list.
         yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
 
+        updateFilePriority(utilManager.getYangNodeSet());
+
         // Carry out inter-file linking.
         yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
 
@@ -146,6 +148,8 @@
         // Add references to import list.
         yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
 
+        updateFilePriority(utilManager.getYangNodeSet());
+
         // Carry out inter-file linking.
         yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
 
@@ -209,6 +213,8 @@
         // Add references to import list.
         yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
 
+        updateFilePriority(utilManager.getYangNodeSet());
+
         // Carry out inter-file linking.
         yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
 
@@ -278,6 +284,8 @@
         // Add references to import list.
         yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
 
+        updateFilePriority(utilManager.getYangNodeSet());
+
         // Carry out inter-file linking.
         yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
 
diff --git a/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/InterFileLinkingTest.java b/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/InterFileLinkingTest.java
index e5ed4cf..a99cd6c 100644
--- a/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/InterFileLinkingTest.java
+++ b/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/InterFileLinkingTest.java
@@ -24,6 +24,7 @@
 import org.junit.Test;
 import org.junit.rules.ExpectedException;
 import org.onosproject.yangutils.datamodel.YangAugment;
+import org.onosproject.yangutils.datamodel.YangChoice;
 import org.onosproject.yangutils.datamodel.YangContainer;
 import org.onosproject.yangutils.datamodel.YangDerivedInfo;
 import org.onosproject.yangutils.datamodel.YangGrouping;
@@ -49,6 +50,7 @@
 import static org.onosproject.yangutils.datamodel.utils.ResolvableStatus.RESOLVED;
 import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.DERIVED;
 import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.STRING;
+import static org.onosproject.yangutils.linker.impl.YangLinkerUtils.updateFilePriority;
 import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.deleteDirectory;
 
 /**
@@ -84,6 +86,8 @@
         // Add references to import list.
         yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
 
+        updateFilePriority(utilManager.getYangNodeSet());
+
         // Carry out inter-file linking.
         yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
 
@@ -154,6 +158,8 @@
         // Add references to import list.
         yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
 
+        updateFilePriority(utilManager.getYangNodeSet());
+
         // Carry out inter-file linking.
         yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
 
@@ -227,6 +233,8 @@
         // Add reference to include list.
         yangLinkerManager.addRefToYangFilesIncludeList(utilManager.getYangNodeSet());
 
+        updateFilePriority(utilManager.getYangNodeSet());
+
         // Carry out inter-file linking.
         yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
 
@@ -300,6 +308,8 @@
         // Add reference to include list.
         yangLinkerManager.addRefToYangFilesIncludeList(utilManager.getYangNodeSet());
 
+        updateFilePriority(utilManager.getYangNodeSet());
+
         // Carry out inter-file linking.
         yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
 
@@ -370,6 +380,8 @@
         // Add references to import list.
         yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
 
+        updateFilePriority(utilManager.getYangNodeSet());
+
         // Carry out inter-file linking.
         yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
 
@@ -440,6 +452,8 @@
         // Add references to import list.
         yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
 
+        updateFilePriority(utilManager.getYangNodeSet());
+
         // Carry out inter-file linking.
         yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
 
@@ -511,6 +525,8 @@
         // Add references to import list.
         yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
 
+        updateFilePriority(utilManager.getYangNodeSet());
+
         // Carry out inter-file linking.
         yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
 
@@ -579,6 +595,8 @@
         // Add references to import list.
         yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
 
+        updateFilePriority(utilManager.getYangNodeSet());
+
         // Carry out inter-file linking.
         yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
 
@@ -837,4 +855,80 @@
         YangList list = ((YangList) uses.getNextSibling());
         assertThat(list.getName(), is("connectivity-matrix"));
     }
+
+    /**
+     * Checks contents of uses are copied as child of grouping.
+     */
+    @Test
+    public void interFileUsesInsideChildOfGrouping()
+            throws IOException, ParserException, MojoExecutionException {
+
+        String searchDir = "src/test/resources/interFileUsesInsideChildOfGrouping";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.resolveDependenciesUsingLinker();
+
+        YangNode selfNode = null;
+        YangNode refNode1 = null;
+
+        for (YangNode rootNode : utilManager.getYangNodeSet()) {
+            if (rootNode.getName().equals("ietf-network")) {
+                selfNode = rootNode;
+            } else if (rootNode.getName().equals("ietf-te-topology")) {
+                refNode1 = rootNode;
+            }
+        }
+
+        // Check whether the data model tree returned is of type module.
+        assertThat(selfNode instanceof YangModule, is(true));
+        assertThat(selfNode.getNodeType(), is(MODULE_NODE));
+        YangModule yangNode = (YangModule) selfNode;
+        assertThat(yangNode.getName(), is("ietf-network"));
+
+        YangModule refNode = (YangModule) refNode1;
+        assertThat(refNode.getName(), is("ietf-te-topology"));
+
+        YangAugment augment = ((YangAugment) refNode.getChild().getNextSibling().
+                getNextSibling().getNextSibling().getNextSibling().getNextSibling());
+        assertThat(augment.getName(), is("/nw:networks/nw:network/nt:link"));
+
+        YangUses uses = ((YangUses) augment.getChild());
+        assertThat(uses.getResolvableStatus(), is(RESOLVED));
+        YangContainer container = ((YangContainer) uses.getNextSibling());
+        assertThat(container.getName(), is("te"));
+
+        container = ((YangContainer) container.getChild());
+        assertThat(container.getName(), is("config"));
+
+        uses = ((YangUses) container.getChild().getNextSibling());
+        assertThat(uses.getName(), is("te-link-config-attributes"));
+        assertThat(uses.getResolvableStatus(), is(RESOLVED));
+
+        YangContainer container1 = ((YangContainer) uses.getNextSibling());
+        assertThat(container1.getName(), is("te-link-attributes"));
+
+        container = ((YangContainer) container1.getChild());
+        assertThat(container.getName(), is("underlay"));
+
+        uses = ((YangUses) container.getChild());
+        assertThat(uses.getName(), is("te-link-underlay-attributes"));
+        assertThat(uses.getResolvableStatus(), is(RESOLVED));
+
+        container = ((YangContainer) uses.getNextSibling());
+        assertThat(container.getName(), is("underlay-primary-path"));
+
+        YangList yangList = ((YangList) container.getChild());
+        assertThat(yangList.getName(), is("path-element"));
+
+        uses = ((YangUses) yangList.getChild());
+        assertThat(uses.getName(), is("te-path-element"));
+        assertThat(uses.getResolvableStatus(), is(RESOLVED));
+
+        uses = ((YangUses) uses.getNextSibling());
+        assertThat(uses.getName(), is("explicit-route-subobject"));
+        assertThat(uses.getResolvableStatus(), is(RESOLVED));
+
+        YangChoice choice = ((YangChoice) uses.getNextSibling());
+        assertThat(choice.getName(), is("type"));
+    }
 }
diff --git a/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/IntraFileLeafrefLinkingTest.java b/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/IntraFileLeafrefLinkingTest.java
index fb1b523..3b50365 100644
--- a/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/IntraFileLeafrefLinkingTest.java
+++ b/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/IntraFileLeafrefLinkingTest.java
@@ -16,6 +16,10 @@
 
 package org.onosproject.yangutils.plugin.manager;
 
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
 import org.junit.Ignore;
 import org.junit.Rule;
 import org.junit.Test;
@@ -45,17 +49,13 @@
 import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
 import org.onosproject.yangutils.utils.io.impl.YangFileScanner;
 
-import java.io.IOException;
-import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
-
 import static org.hamcrest.MatcherAssert.assertThat;
 import static org.hamcrest.core.Is.is;
 import static org.hamcrest.core.IsNull.nullValue;
 import static org.onosproject.yangutils.datamodel.YangNodeType.MODULE_NODE;
 import static org.onosproject.yangutils.datamodel.utils.ResolvableStatus.RESOLVED;
 import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.LEAFREF;
+import static org.onosproject.yangutils.linker.impl.YangLinkerUtils.updateFilePriority;
 
 /**
  * Test cases for testing leafref intra file linking.
@@ -88,6 +88,8 @@
         // Add references to import list.
         yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
 
+        updateFilePriority(utilManager.getYangNodeSet());
+
         // Carry out inter-file linking.
         yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
 
@@ -149,6 +151,8 @@
         // Add references to import list.
         yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
 
+        updateFilePriority(utilManager.getYangNodeSet());
+
         // Carry out inter-file linking.
         yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
 
@@ -212,6 +216,8 @@
         // Add references to import list.
         yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
 
+        updateFilePriority(utilManager.getYangNodeSet());
+
         // Carry out inter-file linking.
         yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
 
@@ -277,6 +283,8 @@
         // Add references to import list.
         yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
 
+        updateFilePriority(utilManager.getYangNodeSet());
+
         // Carry out inter-file linking.
         yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
     }
@@ -316,6 +324,8 @@
         // Add references to import list.
         yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
 
+        updateFilePriority(utilManager.getYangNodeSet());
+
         // Carry out inter-file linking.
         yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
     }
@@ -340,6 +350,8 @@
         // Add references to import list.
         yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
 
+        updateFilePriority(utilManager.getYangNodeSet());
+
         // Carry out inter-file linking.
         yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
 
@@ -402,6 +414,8 @@
         // Add references to import list.
         yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
 
+        updateFilePriority(utilManager.getYangNodeSet());
+
         // Carry out inter-file linking.
         yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
 
@@ -463,6 +477,8 @@
         // Add references to import list.
         yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
 
+        updateFilePriority(utilManager.getYangNodeSet());
+
         // Carry out inter-file linking.
         yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
 
@@ -522,6 +538,8 @@
         // Add references to import list.
         yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
 
+        updateFilePriority(utilManager.getYangNodeSet());
+
         // Carry out inter-file linking.
         yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
 
@@ -584,6 +602,8 @@
         // Add references to import list.
         yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
 
+        updateFilePriority(utilManager.getYangNodeSet());
+
         // Carry out inter-file linking.
         yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
     }
@@ -605,6 +625,8 @@
         // Add references to import list.
         yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
 
+        updateFilePriority(utilManager.getYangNodeSet());
+
         // Carry out inter-file linking.
         yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
 
@@ -664,6 +686,8 @@
         // Add references to import list.
         yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
 
+        updateFilePriority(utilManager.getYangNodeSet());
+
         // Carry out inter-file linking.
         yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
 
@@ -725,6 +749,8 @@
         // Add references to import list.
         yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
 
+        updateFilePriority(utilManager.getYangNodeSet());
+
         // Carry out inter-file linking.
         yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
 
@@ -786,6 +812,8 @@
         // Add references to import list.
         yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
 
+        updateFilePriority(utilManager.getYangNodeSet());
+
         // Carry out inter-file linking.
         yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
 
@@ -844,6 +872,8 @@
         // Add references to import list.
         yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
 
+        updateFilePriority(utilManager.getYangNodeSet());
+
         // Carry out inter-file linking.
         yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
 
@@ -905,6 +935,8 @@
         // Add references to import list.
         yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
 
+        updateFilePriority(utilManager.getYangNodeSet());
+
         // Carry out inter-file linking.
         yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
 
@@ -963,6 +995,8 @@
         // Add references to import list.
         yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
 
+        updateFilePriority(utilManager.getYangNodeSet());
+
         // Carry out inter-file linking.
         yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
 
@@ -1024,6 +1058,8 @@
         // Add references to import list.
         yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
 
+        updateFilePriority(utilManager.getYangNodeSet());
+
         // Carry out inter-file linking.
         yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
 
@@ -1084,6 +1120,8 @@
         // Add references to import list.
         yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
 
+        updateFilePriority(utilManager.getYangNodeSet());
+
         // Carry out inter-file linking.
         yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
 
@@ -1144,6 +1182,8 @@
         // Add references to import list.
         yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
 
+        updateFilePriority(utilManager.getYangNodeSet());
+
         // Carry out inter-file linking.
         yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
 
@@ -1206,6 +1246,8 @@
         // Add references to import list.
         yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
 
+        updateFilePriority(utilManager.getYangNodeSet());
+
         // Carry out inter-file linking.
         yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
     }
@@ -1233,6 +1275,8 @@
         // Add references to import list.
         yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
 
+        updateFilePriority(utilManager.getYangNodeSet());
+
         //Carry out inter-file linking.
         yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
     }
@@ -1255,6 +1299,8 @@
         // Add references to import list.
         yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
 
+        updateFilePriority(utilManager.getYangNodeSet());
+
         // Carry out inter-file linking.
         yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
 
@@ -1313,6 +1359,8 @@
         // Add references to import list.
         yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
 
+        updateFilePriority(utilManager.getYangNodeSet());
+
         // Carry out inter-file linking.
         yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
 
@@ -1374,6 +1422,8 @@
         // Add references to import list.
         yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
 
+        updateFilePriority(utilManager.getYangNodeSet());
+
         // Carry out inter-file linking.
         yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
 
@@ -1434,6 +1484,8 @@
         // Add references to import list.
         yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
 
+        updateFilePriority(utilManager.getYangNodeSet());
+
         // Carry out inter-file linking.
         yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
 
@@ -1533,6 +1585,8 @@
         // Add references to import list.
         yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
 
+        updateFilePriority(utilManager.getYangNodeSet());
+
         // Carry out inter-file linking.
         yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
 
@@ -1592,6 +1646,8 @@
         // Add references to import list.
         yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
 
+        updateFilePriority(utilManager.getYangNodeSet());
+
         // Carry out inter-file linking.
         yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
 
@@ -1660,6 +1716,8 @@
         // Add references to import list.
         yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
 
+        updateFilePriority(utilManager.getYangNodeSet());
+
         // Carry out inter-file linking.
         yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
 
@@ -1735,6 +1793,8 @@
         // Add references to import list.
         yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
 
+        updateFilePriority(utilManager.getYangNodeSet());
+
         // Carry out inter-file linking.
         yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
 
@@ -1801,6 +1861,8 @@
         // Add references to import list.
         yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
 
+        updateFilePriority(utilManager.getYangNodeSet());
+
         // Carry out inter-file linking.
         yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
 
diff --git a/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/IntraFileUsesLinkingTest.java b/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/IntraFileUsesLinkingTest.java
index 44ce858..075d2f9 100644
--- a/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/IntraFileUsesLinkingTest.java
+++ b/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/IntraFileUsesLinkingTest.java
@@ -486,7 +486,7 @@
 
         // Check whether uses is getting resolved.
         assertThat(uses.getResolvableStatus(),
-                is(ResolvableStatus.RESOLVED));
+                is(ResolvableStatus.INTRA_FILE_RESOLVED));
 
         // Check whether grouping is the child of module.
         assertThat((yangNode.getChild() instanceof YangGrouping), is(true));
@@ -610,7 +610,7 @@
 
         // Check whether uses is getting resolved.
         assertThat(yangUses1.getResolvableStatus(),
-                is(ResolvableStatus.RESOLVED));
+                is(ResolvableStatus.INTRA_FILE_RESOLVED));
 
         // Check whether grouping is the sibling of uses.
         YangGrouping yangGrouping1 = (YangGrouping) yangUses1.getNextSibling();
diff --git a/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/YangXpathLinkerTest.java b/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/YangXpathLinkerTest.java
index 7fcd7f1..5dd50ca 100644
--- a/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/YangXpathLinkerTest.java
+++ b/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/YangXpathLinkerTest.java
@@ -18,7 +18,6 @@
 
 import java.io.IOException;
 import java.util.List;
-
 import org.apache.maven.plugin.MojoExecutionException;
 import org.junit.Test;
 import org.onosproject.yangutils.datamodel.ResolvableType;
@@ -32,6 +31,7 @@
 
 import static org.hamcrest.MatcherAssert.assertThat;
 import static org.hamcrest.core.Is.is;
+import static org.onosproject.yangutils.linker.impl.YangLinkerUtils.updateFilePriority;
 
 /**
  * Unit test cases for x-path linker.
@@ -237,6 +237,7 @@
         utilManager.parseYangFileInfoSet();
         utilManager.createYangNodeSet();
         linkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+        updateFilePriority(utilManager.getYangNodeSet());
         linkerManager.processInterFileLinking(utilManager.getYangNodeSet());
 
         YangNode targetNode = null;
@@ -267,6 +268,7 @@
         utilManager.parseYangFileInfoSet();
         utilManager.createYangNodeSet();
         linkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+        updateFilePriority(utilManager.getYangNodeSet());
         linkerManager.processInterFileLinking(utilManager.getYangNodeSet());
 
         YangNode targetNode = null;
@@ -451,6 +453,7 @@
         linkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
         linkerManager.linkSubModulesToParentModule(utilManager.getYangNodeSet());
         linkerManager.addRefToYangFilesIncludeList(utilManager.getYangNodeSet());
+        updateFilePriority(utilManager.getYangNodeSet());
         linkerManager.processInterFileLinking(utilManager.getYangNodeSet());
 
         YangNode targetNode = null;
@@ -484,6 +487,7 @@
         linkerManager.linkSubModulesToParentModule(utilManager.getYangNodeSet());
         linkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
         linkerManager.addRefToYangFilesIncludeList(utilManager.getYangNodeSet());
+        updateFilePriority(utilManager.getYangNodeSet());
         linkerManager.processInterFileLinking(utilManager.getYangNodeSet());
         YangNode targetNode = null;
         String targetNodeName = null;
@@ -516,6 +520,7 @@
         linkerManager.linkSubModulesToParentModule(utilManager.getYangNodeSet());
         linkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
         linkerManager.addRefToYangFilesIncludeList(utilManager.getYangNodeSet());
+        updateFilePriority(utilManager.getYangNodeSet());
         linkerManager.processInterFileLinking(utilManager.getYangNodeSet());
         YangNode targetNode = null;
         String targetNodeName = null;
@@ -548,6 +553,7 @@
         linkerManager.linkSubModulesToParentModule(utilManager.getYangNodeSet());
         linkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
         linkerManager.addRefToYangFilesIncludeList(utilManager.getYangNodeSet());
+        updateFilePriority(utilManager.getYangNodeSet());
         linkerManager.processInterFileLinking(utilManager.getYangNodeSet());
 
         YangNode targetNode = null;
@@ -581,6 +587,7 @@
         linkerManager.createYangNodeSet(utilManager.getYangNodeSet());
         linkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
         linkerManager.addRefToYangFilesIncludeList(utilManager.getYangNodeSet());
+        updateFilePriority(utilManager.getYangNodeSet());
         linkerManager.processInterFileLinking(utilManager.getYangNodeSet());
 
         YangNode targetNode = null;
@@ -614,6 +621,7 @@
         linkerManager.linkSubModulesToParentModule(utilManager.getYangNodeSet());
         linkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
         linkerManager.addRefToYangFilesIncludeList(utilManager.getYangNodeSet());
+        updateFilePriority(utilManager.getYangNodeSet());
         linkerManager.processInterFileLinking(utilManager.getYangNodeSet());
 
         YangNode targetNode = null;
diff --git a/plugin/src/test/resources/ContainerSubStatementWhen.yang b/plugin/src/test/resources/ContainerSubStatementWhen.yang
index 7a2674f..c25b499 100644
--- a/plugin/src/test/resources/ContainerSubStatementWhen.yang
+++ b/plugin/src/test/resources/ContainerSubStatementWhen.yang
@@ -1,8 +1,11 @@
 module Test {
     yang-version 1;
-    namespace http://huawei.com;
+    namespace "http://huawei.com";
     prefix Ant;
     list interface-switching-capability {
+         when "../switching-capability = 'TDM'" {
+                 description "Valid only for TDM";
+         }
          key "switching-capability";
          description
            "List of Interface Switching Capabilities Descriptors (ISCD)
diff --git a/plugin/src/test/resources/ListWithIdentifierNameEnum.yang b/plugin/src/test/resources/ListWithIdentifierNameEnum.yang
new file mode 100644
index 0000000..afa82a4
--- /dev/null
+++ b/plugin/src/test/resources/ListWithIdentifierNameEnum.yang
@@ -0,0 +1,16 @@
+module Test {
+    yang-version 1;
+    namespace "ydt.enum";
+    prefix "t";
+
+    list enumList {
+        key enum;
+        leaf enum {
+            type enumeration {
+                enum ten { value "10";}
+                enum hundred { value "100";}
+                enum thousand { value "1000"; }
+            }
+        }
+    }
+}
diff --git a/plugin/src/test/resources/ValidCompilerAnnotation.yang b/plugin/src/test/resources/ValidCompilerAnnotation.yang
new file mode 100644
index 0000000..7913fab
--- /dev/null
+++ b/plugin/src/test/resources/ValidCompilerAnnotation.yang
@@ -0,0 +1,13 @@
+module event {
+
+    namespace "http://example.com/event";
+    prefix "ev";
+
+    ca:compiler-annotation "/candidate-servers/server" {
+        abc:app-data-structure "map" {
+            ca:key "name";
+        }
+       xyz:app-extended-name "special-server";
+    }
+}
+
diff --git a/plugin/src/test/resources/interFileUsesInsideChildOfGrouping/ietf-network-topology.yang b/plugin/src/test/resources/interFileUsesInsideChildOfGrouping/ietf-network-topology.yang
new file mode 100644
index 0000000..499c0f1
--- /dev/null
+++ b/plugin/src/test/resources/interFileUsesInsideChildOfGrouping/ietf-network-topology.yang
@@ -0,0 +1,37 @@
+module ietf-network-topology {
+    yang-version 1;
+    namespace "ietf-vidya-topology";
+    prefix lnk;
+
+    import ietf-network {
+        prefix nd;
+    }
+
+    revision 2015-12-08 {
+        description
+         "Initial revision.
+          NOTE TO RFC EDITOR: Please replace the following reference
+          to draft-ietf-i2rs-yang-network-topo-02 with
+          RFC number when published (i.e. RFC xxxx).";
+        reference
+          "draft-ietf-i2rs-yang-network-topo-02.";
+    }
+
+    augment "/nd:networks/nd:network" {
+        list link {
+            key "link-id";
+            container source {
+                leaf source-node {
+                    type string;
+                    mandatory true;
+                }
+                leaf source-tp {
+                    type string;
+                }
+            }
+            leaf link-id {
+                type string;
+            }
+        }
+    }
+}
diff --git a/plugin/src/test/resources/interFileUsesInsideChildOfGrouping/ietf-network.yang b/plugin/src/test/resources/interFileUsesInsideChildOfGrouping/ietf-network.yang
new file mode 100644
index 0000000..a78b231
--- /dev/null
+++ b/plugin/src/test/resources/interFileUsesInsideChildOfGrouping/ietf-network.yang
@@ -0,0 +1,30 @@
+module ietf-network {
+    yang-version 1;
+    namespace "ietf-network";
+    prefix nd;
+
+    revision 2015-12-08 {
+        description
+         "Initial revision.
+          NOTE TO RFC EDITOR: Please replace the following reference
+          to draft-ietf-i2rs-yang-network-topo-02 with
+          RFC number when published (i.e. RFC xxxx).";
+         reference
+          "draft-ietf-i2rs-yang-network-topo-02";
+    }
+
+    container networks {
+        list network {
+            key "network-id";
+            leaf network-id {
+                type string;
+            }
+            list node {
+                key "node-id";
+                leaf node-id {
+                    type string;
+                }
+            }
+        }
+    }
+}
diff --git a/plugin/src/test/resources/interFileUsesInsideChildOfGrouping/ietf-te-topology.yang b/plugin/src/test/resources/interFileUsesInsideChildOfGrouping/ietf-te-topology.yang
new file mode 100644
index 0000000..f92fccc
--- /dev/null
+++ b/plugin/src/test/resources/interFileUsesInsideChildOfGrouping/ietf-te-topology.yang
@@ -0,0 +1,65 @@
+module ietf-te-topology {
+    yang-version 1;
+    namespace "ietf-te-topology";
+    prefix "tet";
+
+    import ietf-te-types {
+        prefix "te-types";
+    }
+
+    import ietf-network {
+        prefix "nw";
+    }
+
+    import ietf-network-topology {
+        prefix "nt";
+    }
+
+    revision "2016-03-17" {
+        description "Initial revision";
+        reference "TBD";
+    }
+
+    grouping te-link-augment {
+        container te {
+            container config {
+                uses te-link-config;
+            } // config
+        } // te
+    } // te-link-augment
+
+    grouping te-link-config {
+        uses te-link-config-attributes;
+    } // te-link-config
+
+    grouping te-link-config-attributes {
+        container te-link-attributes {
+            container underlay {
+                uses te-link-underlay-attributes;
+            } // underlay
+        } // te-link-attributes
+    } // te-link-config-attributes
+
+    grouping te-link-underlay-attributes {
+        container underlay-primary-path {
+            list path-element {
+                key "path-element-id";
+                description
+                    "A list of path elements describing the service path.";
+                leaf path-element-id {
+                    type uint32;
+                    description "To identify the element in a path.";
+                }
+                uses te-path-element;
+            }
+        } // underlay-primary-path
+    } // te-link-underlay-attributes
+
+    grouping te-path-element {
+        uses te-types:explicit-route-subobject;
+    } // te-path-element
+
+    augment "/nw:networks/nw:network/nt:link" {
+        uses te-link-augment;
+    }
+}
diff --git a/plugin/src/test/resources/interFileUsesInsideChildOfGrouping/ietf-te-types.yang b/plugin/src/test/resources/interFileUsesInsideChildOfGrouping/ietf-te-types.yang
new file mode 100644
index 0000000..96ce986
--- /dev/null
+++ b/plugin/src/test/resources/interFileUsesInsideChildOfGrouping/ietf-te-types.yang
@@ -0,0 +1,19 @@
+module ietf-te-types {
+
+    namespace "ietf-te-types";
+    prefix "te-types";
+
+    revision 2016-03-20 {
+        description "Latest revision of TE generic types";
+        reference "RFC3209";
+    }
+    grouping explicit-route-subobject {
+        choice type {
+            case ipv4-address {
+                leaf v4-address {
+                    type string;
+                }
+            }
+        }
+    }
+}