[ONOS-4636]YANG Grouping linking bug fix + YANG Code review comment fix

Change-Id: I68ee8dd08266a02593e217cef1a9bb010037d673
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangAugment.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangAugment.java
index adac640..bd160d1 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangAugment.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangAugment.java
@@ -79,7 +79,8 @@
 /**
  * Representation of data model node to maintain information defined in YANG augment.
  */
-public class YangAugment extends YangNode
+public class YangAugment
+        extends YangNode
         implements YangLeavesHolder, YangCommonInfo, Parsable, CollisionDetector {
 
     /**
@@ -163,13 +164,15 @@
     }
 
     @Override
-    public void detectCollidingChild(String identifierName, YangConstructType dataType) throws DataModelException {
+    public void detectCollidingChild(String identifierName, YangConstructType dataType)
+            throws DataModelException {
         // Detect colliding child.
         detectCollidingChildUtil(identifierName, dataType, this);
     }
 
     @Override
-    public void detectSelfCollision(String identifierName, YangConstructType dataType) throws DataModelException {
+    public void detectSelfCollision(String identifierName, YangConstructType dataType)
+            throws DataModelException {
         if (this.getName().equals(identifierName)) {
             throw new DataModelException("YANG file error: Duplicate input identifier detected, same as input \""
                     + this.getName() + "\"");
@@ -191,7 +194,8 @@
      *
      * @param leafsList the list of leaf to set
      */
-    private void setListOfLeaf(List<YangLeaf> leafsList) {
+    @Override
+    public void setListOfLeaf(List<YangLeaf> leafsList) {
         listOfLeaf = leafsList;
     }
 
@@ -224,7 +228,8 @@
      *
      * @param listOfLeafList the list of leaf-list to set
      */
-    private void setListOfLeafList(List<YangLeafList> listOfLeafList) {
+    @Override
+    public void setListOfLeafList(List<YangLeafList> listOfLeafList) {
         this.listOfLeafList = listOfLeafList;
     }
 
@@ -298,7 +303,8 @@
      * @throws DataModelException a violation of data model rules
      */
     @Override
-    public void validateDataOnEntry() throws DataModelException {
+    public void validateDataOnEntry()
+            throws DataModelException {
         // TODO auto-generated method stub, to be implemented by parser
     }
 
@@ -308,7 +314,8 @@
      * @throws DataModelException a violation of data model rules
      */
     @Override
-    public void validateDataOnExit() throws DataModelException {
+    public void validateDataOnExit()
+            throws DataModelException {
         // TODO auto-generated method stub, to be implemented by parser
     }
 
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangCase.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangCase.java
index 6787dc9..abe4b1a 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangCase.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangCase.java
@@ -88,10 +88,12 @@
  *                | when         | 7.19.5  | 0..1        |-TODO             |
  *                +--------------+---------+-------------+------------------+
  */
+
 /**
  * Represents data model node to maintain information defined in YANG case.
  */
-public class YangCase extends YangNode
+public class YangCase
+        extends YangNode
         implements YangLeavesHolder, YangCommonInfo, Parsable, CollisionDetector, YangAugmentationHolder {
 
     /**
@@ -188,7 +190,8 @@
      *
      * @param leafsList the list of leaf to set
      */
-    private void setListOfLeaf(List<YangLeaf> leafsList) {
+    @Override
+    public void setListOfLeaf(List<YangLeaf> leafsList) {
         listOfLeaf = leafsList;
     }
 
@@ -221,7 +224,8 @@
      *
      * @param listOfLeafList the list of leaf-list to set
      */
-    private void setListOfLeafList(List<YangLeafList> listOfLeafList) {
+    @Override
+    public void setListOfLeafList(List<YangLeafList> listOfLeafList) {
         this.listOfLeafList = listOfLeafList;
     }
 
@@ -295,7 +299,8 @@
      * @throws DataModelException a violation of data model rules
      */
     @Override
-    public void validateDataOnEntry() throws DataModelException {
+    public void validateDataOnEntry()
+            throws DataModelException {
         // TODO auto-generated method stub, to be implemented by parser
     }
 
@@ -305,12 +310,14 @@
      * @throws DataModelException a violation of data model rules
      */
     @Override
-    public void validateDataOnExit() throws DataModelException {
+    public void validateDataOnExit()
+            throws DataModelException {
         // TODO auto-generated method stub, to be implemented by parser
     }
 
     @Override
-    public void detectCollidingChild(String identifierName, YangConstructType dataType) throws DataModelException {
+    public void detectCollidingChild(String identifierName, YangConstructType dataType)
+            throws DataModelException {
         if (!(getParent() instanceof YangChoice)) {
             throw new DataModelException("Internal Data Model Tree Error: Invalid/Missing holder in case " +
                     getName());
@@ -320,7 +327,8 @@
     }
 
     @Override
-    public void detectSelfCollision(String identifierName, YangConstructType dataType) throws DataModelException {
+    public void detectSelfCollision(String identifierName, YangConstructType dataType)
+            throws DataModelException {
 
         if (dataType == CASE_DATA) {
             if (getName().equals(identifierName)) {
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangContainer.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangContainer.java
index 3930433..ccb824b 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangContainer.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangContainer.java
@@ -87,7 +87,8 @@
 /**
  * Represents data model node to maintain information defined in YANG container.
  */
-public class YangContainer extends YangNode
+public class YangContainer
+        extends YangNode
         implements YangLeavesHolder, YangCommonInfo, Parsable, CollisionDetector, YangAugmentationHolder {
 
     /**
@@ -211,7 +212,8 @@
      *
      * @param leafsList the list of leaf to set
      */
-    private void setListOfLeaf(List<YangLeaf> leafsList) {
+    @Override
+    public void setListOfLeaf(List<YangLeaf> leafsList) {
         listOfLeaf = leafsList;
     }
 
@@ -245,7 +247,8 @@
      *
      * @param listOfLeafList the list of leaf-list to set
      */
-    private void setListOfLeafList(List<YangLeafList> listOfLeafList) {
+    @Override
+    public void setListOfLeafList(List<YangLeafList> listOfLeafList) {
         this.listOfLeafList = listOfLeafList;
     }
 
@@ -338,7 +341,8 @@
      * @throws DataModelException a violation of data model rules
      */
     @Override
-    public void validateDataOnEntry() throws DataModelException {
+    public void validateDataOnEntry()
+            throws DataModelException {
         // TODO auto-generated method stub, to be implemented by parser
     }
 
@@ -348,7 +352,8 @@
      * @throws DataModelException a violation of data model rules
      */
     @Override
-    public void validateDataOnExit() throws DataModelException {
+    public void validateDataOnExit()
+            throws DataModelException {
         List<YangLeaf> leaves = getListOfLeaf();
         List<YangLeafList> leafLists = getListOfLeafList();
 
@@ -397,7 +402,8 @@
      * @param leafLists list of leaf-list attributes of container
      * @throws DataModelException a violation of data model rules
      */
-    private void validateConfig(List<YangLeaf> leaves, List<YangLeafList> leafLists) throws DataModelException {
+    private void validateConfig(List<YangLeaf> leaves, List<YangLeafList> leafLists)
+            throws DataModelException {
 
         /*
          * If a node has "config" set to "false", no node underneath it can have
@@ -423,13 +429,15 @@
     }
 
     @Override
-    public void detectCollidingChild(String identifierName, YangConstructType dataType) throws DataModelException {
+    public void detectCollidingChild(String identifierName, YangConstructType dataType)
+            throws DataModelException {
         // Asks helper to detect colliding child.
         detectCollidingChildUtil(identifierName, dataType, this);
     }
 
     @Override
-    public void detectSelfCollision(String identifierName, YangConstructType dataType) throws DataModelException {
+    public void detectSelfCollision(String identifierName, YangConstructType dataType)
+            throws DataModelException {
         if (getName().equals(identifierName)) {
             throw new DataModelException("YANG file error: Duplicate input identifier detected, same as container \""
                     + getName() + "\"");
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangDerivedInfo.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangDerivedInfo.java
index 613237a..3cfdc38 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangDerivedInfo.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangDerivedInfo.java
@@ -17,7 +17,8 @@
 package org.onosproject.yangutils.datamodel;
 
 import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.linker.impl.ResolvableStatus;
+import org.onosproject.yangutils.linker.ResolvableStatus;
+
 import com.google.common.base.Strings;
 
 import static org.onosproject.yangutils.datamodel.YangDataTypes.BINARY;
@@ -30,8 +31,8 @@
 import static org.onosproject.yangutils.datamodel.YangDataTypes.LEAFREF;
 import static org.onosproject.yangutils.datamodel.YangDataTypes.STRING;
 import static org.onosproject.yangutils.datamodel.YangDataTypes.UNION;
-import static org.onosproject.yangutils.linker.impl.ResolvableStatus.INTRA_FILE_RESOLVED;
-import static org.onosproject.yangutils.linker.impl.ResolvableStatus.RESOLVED;
+import static org.onosproject.yangutils.linker.ResolvableStatus.INTRA_FILE_RESOLVED;
+import static org.onosproject.yangutils.linker.ResolvableStatus.RESOLVED;
 import static org.onosproject.yangutils.utils.RestrictionResolver.isOfRangeRestrictedType;
 import static org.onosproject.yangutils.utils.RestrictionResolver.processLengthRestriction;
 import static org.onosproject.yangutils.utils.RestrictionResolver.processRangeRestriction;
@@ -41,7 +42,8 @@
  *
  * @param <T> extended information.
  */
-public class YangDerivedInfo<T> implements LocationInfo {
+public class YangDerivedInfo<T>
+        implements LocationInfo, Cloneable {
 
     /**
      * YANG typedef reference.
@@ -224,8 +226,11 @@
      * @return resolution status
      * @throws DataModelException a violation in data mode rule
      */
-    public ResolvableStatus resolve() throws DataModelException {
+    public ResolvableStatus resolve()
+            throws DataModelException {
+
         YangType<?> baseType = getReferredTypeDef().getTypeDefBaseType();
+
         /*
          * Checks the data type of the referred typedef, if it's derived,
          * obtain effective built-in type and restrictions from it's derived
@@ -238,6 +243,7 @@
             if (baseType.getResolvableStatus() != INTRA_FILE_RESOLVED && baseType.getResolvableStatus() != RESOLVED) {
                 throw new DataModelException("Linker Error: Referred typedef is not resolved for type.");
             }
+
             /*
              * Check if the referred typedef is intra file resolved, if yes sets
              * current status also to intra file resolved .
@@ -401,6 +407,7 @@
                 }
             }
         }
+
         /*
          * Check if the data type is the one which can't be restricted, in
          * this case check whether no self restrictions should be present.
@@ -414,6 +421,7 @@
                 throw new DataModelException("YANG file error: Restrictions can't be applied to a given type");
             }
         }
+
         // Throw exception for unsupported types
         throw new DataModelException("Linker error: Unable to process the derived type.");
     }
@@ -424,7 +432,8 @@
      * @param refStringRestriction referred string restriction of typedef
      * @throws DataModelException a violation in data model rule
      */
-    private void resolveStringRestriction(YangStringRestriction refStringRestriction) throws DataModelException {
+    private void resolveStringRestriction(YangStringRestriction refStringRestriction)
+            throws DataModelException {
         YangStringRestriction curStringRestriction = null;
         YangRangeRestriction refRangeRestriction = null;
         YangPatternRestriction refPatternRestriction = null;
@@ -522,7 +531,8 @@
      * @return resolved length restriction
      * @throws DataModelException a violation in data model rule
      */
-    private YangRangeRestriction resolveLengthRestriction(YangRangeRestriction refLengthRestriction) throws
+    private YangRangeRestriction resolveLengthRestriction(YangRangeRestriction refLengthRestriction)
+            throws
             DataModelException {
 
         /*
@@ -572,7 +582,8 @@
      * @param curRestriction self restriction
      */
     private void resolveLengthAndRangeRestriction(YangRangeRestriction refRestriction,
-                                                  YangRangeRestriction curRestriction) throws DataModelException {
+            YangRangeRestriction curRestriction)
+            throws DataModelException {
         for (Object curInterval : curRestriction.getAscendingRangeIntervals()) {
             if (!(curInterval instanceof YangRangeInterval)) {
                 throw new DataModelException("Linker error: Current range intervals not processed correctly.");
@@ -594,7 +605,8 @@
      * @param refRangeRestriction referred range restriction of typedef
      * @throws DataModelException a violation in data model rule
      */
-    private void resolveRangeRestriction(YangRangeRestriction refRangeRestriction) throws DataModelException {
+    private void resolveRangeRestriction(YangRangeRestriction refRangeRestriction)
+            throws DataModelException {
 
         /*
          * Check that string restriction should be null when built-in type is
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangEnumeration.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangEnumeration.java
index 9bf924a..38b8266 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangEnumeration.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangEnumeration.java
@@ -31,7 +31,9 @@
 /**
  * Represents the enumeration data type information.
  */
-public class YangEnumeration extends YangNode implements Parsable, CollisionDetector {
+public class YangEnumeration
+        extends YangNode
+        implements Parsable, CollisionDetector {
 
     // Enumeration info set.
     private SortedSet<YangEnum> enumSet;
@@ -71,7 +73,8 @@
      * @param enumInfo the ENUM information to be added
      * @throws DataModelException due to violation in data model rules
      */
-    public void addEnumInfo(YangEnum enumInfo) throws DataModelException {
+    public void addEnumInfo(YangEnum enumInfo)
+            throws DataModelException {
         if (!getEnumSet().add(enumInfo)) {
             throw new DataModelException("YANG ENUM already exists");
         }
@@ -113,7 +116,8 @@
      * @throws DataModelException a violation of data model rules
      */
     @Override
-    public void validateDataOnEntry() throws DataModelException {
+    public void validateDataOnEntry()
+            throws DataModelException {
         // TODO auto-generated method stub, to be implemented by parser
     }
 
@@ -123,21 +127,24 @@
      * @throws DataModelException a violation of data model rules
      */
     @Override
-    public void validateDataOnExit() throws DataModelException {
+    public void validateDataOnExit()
+            throws DataModelException {
         // TODO auto-generated method stub, to be implemented by parser
     }
 
     @Override
-    public void detectCollidingChild(String identifierName, YangConstructType dataType) throws DataModelException {
+    public void detectCollidingChild(String identifierName, YangConstructType dataType)
+            throws DataModelException {
         /*
-        Do nothing.The implementation for this is not required.
+        Do nothing, since it is not part of the schema tree, it is only type of an existing node in schema tree.
          */
     }
 
     @Override
-    public void detectSelfCollision(String identifierName, YangConstructType dataType) throws DataModelException {
+    public void detectSelfCollision(String identifierName, YangConstructType dataType)
+            throws DataModelException {
         /*
-        Do nothing.The implementation for this is not required.
+        Do nothing, since it is not part of the schema tree, it is only type of an existing node in schema tree.
          */
     }
 }
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangGrouping.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangGrouping.java
index 47abdca..68f7587 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangGrouping.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangGrouping.java
@@ -77,7 +77,8 @@
 /**
  * Represents data model node to maintain information defined in YANG grouping.
  */
-public class YangGrouping extends YangNode
+public class YangGrouping
+        extends YangNode
         implements YangLeavesHolder, YangCommonInfo, Parsable, CollisionDetector {
 
     /**
@@ -174,7 +175,8 @@
      *
      * @param leafsList the list of leaf to set
      */
-    private void setListOfLeaf(List<YangLeaf> leafsList) {
+    @Override
+    public void setListOfLeaf(List<YangLeaf> leafsList) {
         listOfLeaf = leafsList;
     }
 
@@ -203,7 +205,8 @@
      *
      * @param listOfLeafList the list of leaf-list to set
      */
-    private void setListOfLeafList(List<YangLeafList> listOfLeafList) {
+    @Override
+    public void setListOfLeafList(List<YangLeafList> listOfLeafList) {
         this.listOfLeafList = listOfLeafList;
     }
 
@@ -273,7 +276,8 @@
      * @throws DataModelException a violation of data model rules
      */
     @Override
-    public void validateDataOnEntry() throws DataModelException {
+    public void validateDataOnEntry()
+            throws DataModelException {
         // TODO auto-generated method stub, to be implemented by parser
     }
 
@@ -283,7 +287,8 @@
      * @throws DataModelException a violation of data model rules
      */
     @Override
-    public void validateDataOnExit() throws DataModelException {
+    public void validateDataOnExit()
+            throws DataModelException {
         // TODO auto-generated method stub, to be implemented by parser
     }
 
@@ -299,13 +304,15 @@
      * module.
      */
     @Override
-    public void detectCollidingChild(String identifierName, YangConstructType dataType) throws DataModelException {
+    public void detectCollidingChild(String identifierName, YangConstructType dataType)
+            throws DataModelException {
         // Asks helper to detect colliding child.
         detectCollidingChildUtil(identifierName, dataType, this);
     }
 
     @Override
-    public void detectSelfCollision(String identifierName, YangConstructType dataType) throws DataModelException {
+    public void detectSelfCollision(String identifierName, YangConstructType dataType)
+            throws DataModelException {
         if (getName().equals(identifierName)) {
             throw new DataModelException("YANG file error: Duplicate input identifier detected, same as grouping \"" +
                     getName() + "\"");
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangInput.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangInput.java
index 4d7f2df..8aceaa4 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangInput.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangInput.java
@@ -68,7 +68,8 @@
 /**
  * Represents data model node to maintain information defined in YANG input.
  */
-public class YangInput extends YangNode
+public class YangInput
+        extends YangNode
         implements YangLeavesHolder, Parsable, CollisionDetector, YangAugmentationHolder {
 
     /**
@@ -96,13 +97,15 @@
     }
 
     @Override
-    public void detectCollidingChild(String identifierName, YangConstructType dataType) throws DataModelException {
+    public void detectCollidingChild(String identifierName, YangConstructType dataType)
+            throws DataModelException {
         // Detect colliding child.
         detectCollidingChildUtil(identifierName, dataType, this);
     }
 
     @Override
-    public void detectSelfCollision(String identifierName, YangConstructType dataType) throws DataModelException {
+    public void detectSelfCollision(String identifierName, YangConstructType dataType)
+            throws DataModelException {
         if (this.getName().equals(identifierName)) {
             throw new DataModelException("YANG file error: Duplicate input identifier detected, same as input \""
                     + this.getName() + "\"");
@@ -115,12 +118,14 @@
     }
 
     @Override
-    public void validateDataOnEntry() throws DataModelException {
+    public void validateDataOnEntry()
+            throws DataModelException {
         //TODO: implement the method.
     }
 
     @Override
-    public void validateDataOnExit() throws DataModelException {
+    public void validateDataOnExit()
+            throws DataModelException {
         //TODO: implement the method.
     }
 
@@ -130,6 +135,12 @@
     }
 
     @Override
+    public void setListOfLeaf(List<YangLeaf> leafsList) {
+        listOfLeaf = leafsList;
+    }
+
+
+    @Override
     public void addLeaf(YangLeaf leaf) {
         getListOfLeaf().add(leaf);
     }
@@ -140,6 +151,11 @@
     }
 
     @Override
+    public void setListOfLeafList(List<YangLeafList> listOfLeafList) {
+        this.listOfLeafList = listOfLeafList;
+    }
+
+    @Override
     public void addLeafList(YangLeafList leafList) {
         getListOfLeafList().add(leafList);
     }
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangLeaf.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangLeaf.java
index f59cdcc..9adeff7 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangLeaf.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangLeaf.java
@@ -58,7 +58,7 @@
  * Represents leaf data represented in YANG.
  */
 public class YangLeaf
-        implements YangCommonInfo, Parsable {
+        implements YangCommonInfo, Parsable, Cloneable {
 
     /**
      * Name of leaf.
@@ -107,6 +107,11 @@
     private String defaultValueInString;
 
     /**
+     * YANG Node in which the leaf is contained.
+     */
+    YangLeavesHolder containedIn;
+
+    /**
      * Creates a YANG leaf.
      */
     public YangLeaf() {
@@ -281,6 +286,30 @@
     }
 
     /**
+     * Retrieves the YANG node in which the leaf is defined.
+     *
+     * @return the YANG node in which the leaf is defined
+     */
+    public YangLeavesHolder getContainedIn() {
+        return containedIn;
+    }
+
+    /**
+     * Assigns the YANG node in which the leaf is defined.
+     *
+     * @param containedIn the YANG node in which the leaf is defined
+     */
+    public void setContainedIn(YangLeavesHolder containedIn) {
+        this.containedIn = containedIn;
+    }
+
+    @Override
+    public YangLeaf clone()
+            throws CloneNotSupportedException {
+        return (YangLeaf) super.clone();
+    }
+
+    /**
      * Returns the type of the parsed data.
      *
      * @return returns LEAF_DATA
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangLeafList.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangLeafList.java
index 0e0bc3e..5794420 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangLeafList.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangLeafList.java
@@ -54,7 +54,7 @@
  * Represents leaf-list data represented in YANG.
  */
 public class YangLeafList
-        implements YangCommonInfo, Parsable {
+        implements YangCommonInfo, Parsable, Cloneable {
 
     /**
      * Name of leaf-list.
@@ -124,6 +124,11 @@
     private YangType<?> dataType;
 
     /**
+     * YANG Node in which the leaf is contained.
+     */
+    YangLeavesHolder containedIn;
+
+    /**
      * Creates a YANG leaf-list.
      */
     public YangLeafList() {
@@ -298,6 +303,30 @@
     }
 
     /**
+     * Retrieves the YANG node in which the leaf is defined.
+     *
+     * @return the YANG node in which the leaf is defined
+     */
+    public YangLeavesHolder getContainedIn() {
+        return containedIn;
+    }
+
+    /**
+     * Assigns the YANG node in which the leaf is defined.
+     *
+     * @param containedIn the YANG node in which the leaf is defined
+     */
+    public void setContainedIn(YangLeavesHolder containedIn) {
+        this.containedIn = containedIn;
+    }
+
+    @Override
+    public YangLeafList clone()
+            throws CloneNotSupportedException {
+        return (YangLeafList) super.clone();
+    }
+
+    /**
      * Returns the type of the parsed data.
      *
      * @return returns LEAF_LIST_DATA
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangLeavesHolder.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangLeavesHolder.java
index 37ecc8f..a21ed34 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangLeavesHolder.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangLeavesHolder.java
@@ -33,6 +33,13 @@
     List<YangLeaf> getListOfLeaf();
 
     /**
+     * Sets the list of leaves.
+     *
+     * @param leafsList the list of leaf to set
+     */
+    void setListOfLeaf(List<YangLeaf> leafsList);
+
+    /**
      * Adds leaf in data holder like container / list.
      *
      * @param leaf the leaf to be added
@@ -47,6 +54,13 @@
     List<YangLeafList> getListOfLeafList();
 
     /**
+     * Sets the list of leaf-list.
+     *
+     * @param listOfLeafList the list of leaf-list to set
+     */
+    void setListOfLeafList(List<YangLeafList> listOfLeafList);
+
+    /**
      * Adds leaf-list in data holder like container / list.
      *
      * @param leafList the leaf-list to be added
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangList.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangList.java
index cd45bdc..834a0ad 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangList.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangList.java
@@ -67,7 +67,8 @@
 /**
  * Represents list data represented in YANG.
  */
-public class YangList extends YangNode
+public class YangList
+        extends YangNode
         implements YangLeavesHolder, YangCommonInfo, Parsable, CollisionDetector, YangAugmentationHolder {
 
     /**
@@ -254,7 +255,8 @@
      * @param key key field name.
      * @throws DataModelException a violation of data model rules
      */
-    public void addKey(String key) throws DataModelException {
+    public void addKey(String key)
+            throws DataModelException {
         if (getKeyList() == null) {
             setKeyList(new LinkedList<String>());
         }
@@ -282,7 +284,8 @@
      *
      * @param leafsList the list of leaf to set
      */
-    private void setListOfLeaf(List<YangLeaf> leafsList) {
+    @Override
+    public void setListOfLeaf(List<YangLeaf> leafsList) {
         listOfLeaf = leafsList;
     }
 
@@ -315,7 +318,8 @@
      *
      * @param listOfLeafList the list of leaf-list to set
      */
-    private void setListOfLeafList(List<YangLeafList> listOfLeafList) {
+    @Override
+    public void setListOfLeafList(List<YangLeafList> listOfLeafList) {
         this.listOfLeafList = listOfLeafList;
     }
 
@@ -425,7 +429,8 @@
      * @throws DataModelException a violation of data model rules
      */
     @Override
-    public void validateDataOnEntry() throws DataModelException {
+    public void validateDataOnEntry()
+            throws DataModelException {
         // TODO auto-generated method stub, to be implemented by parser
     }
 
@@ -435,7 +440,8 @@
      * @throws DataModelException a violation of data model rules
      */
     @Override
-    public void validateDataOnExit() throws DataModelException {
+    public void validateDataOnExit()
+            throws DataModelException {
         List<String> keys = getKeyList();
         List<YangLeaf> leaves = getListOfLeaf();
         List<YangLeafList> leafLists = getListOfLeafList();
@@ -493,7 +499,8 @@
      * @param leafLists list of leaf-list attributes of YANG list
      * @throws DataModelException a violation of data model rules
      */
-    private void validateConfig(List<YangLeaf> leaves, List<YangLeafList> leafLists) throws DataModelException {
+    private void validateConfig(List<YangLeaf> leaves, List<YangLeafList> leafLists)
+            throws DataModelException {
 
         /*
          * If a node has "config" set to "false", no node underneath it can have
@@ -526,7 +533,8 @@
      * @param keys list of key attributes of list
      * @throws DataModelException a violation of data model rules
      */
-    private void validateKey(List<YangLeaf> leaves, List<YangLeafList> leafLists, List<String> keys) throws
+    private void validateKey(List<YangLeaf> leaves, List<YangLeafList> leafLists, List<String> keys)
+            throws
             DataModelException {
         boolean leafFound = false;
         List<YangLeaf> keyLeaves = new LinkedList<>();
@@ -595,13 +603,15 @@
     }
 
     @Override
-    public void detectCollidingChild(String identifierName, YangConstructType dataType) throws DataModelException {
+    public void detectCollidingChild(String identifierName, YangConstructType dataType)
+            throws DataModelException {
         // Asks helper to detect colliding child.
         detectCollidingChildUtil(identifierName, dataType, this);
     }
 
     @Override
-    public void detectSelfCollision(String identifierName, YangConstructType dataType) throws DataModelException {
+    public void detectSelfCollision(String identifierName, YangConstructType dataType)
+            throws DataModelException {
         if (getName().equals(identifierName)) {
             throw new DataModelException("YANG file error: Duplicate input identifier detected, same as list \"" +
                     getName() + "\"");
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangModule.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangModule.java
index 26df1f5..11b089d 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangModule.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangModule.java
@@ -19,9 +19,11 @@
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Set;
+
 import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
 import org.onosproject.yangutils.linker.exceptions.LinkerException;
-import org.onosproject.yangutils.linker.impl.YangReferenceResolver;
+import org.onosproject.yangutils.linker.ResolvableType;
+import org.onosproject.yangutils.linker.YangReferenceResolver;
 import org.onosproject.yangutils.linker.impl.YangResolutionInfo;
 import org.onosproject.yangutils.parser.Parsable;
 import org.onosproject.yangutils.plugin.manager.YangFileInfo;
@@ -74,7 +76,8 @@
 /**
  * Represents data model node to maintain information defined in YANG module.
  */
-public class YangModule extends YangNode
+public class YangModule
+        extends YangNode
         implements YangLeavesHolder, YangDesc, YangReference, Parsable, CollisionDetector, YangReferenceResolver,
         RpcNotificationContainer {
 
@@ -85,7 +88,7 @@
 
     /**
      * Reference:RFC 6020.
-     * <p>
+     *
      * The "contact" statement provides contact information for the module. The
      * argument is a string that is used to specify contact information for the
      * person or persons to whom technical queries concerning this module should
@@ -96,7 +99,7 @@
 
     /**
      * Reference:RFC 6020.
-     * <p>
+     *
      * The "description" statement takes as an argument a string that contains a
      * human-readable textual description of this definition. The text is
      * provided in a language (or languages) chosen by the module developer; for
@@ -131,7 +134,7 @@
 
     /**
      * Reference:RFC 6020.
-     * <p>
+     *
      * The "organization" statement defines the party responsible for this
      * module. The argument is a string that is used to specify a textual
      * description of the organization(s) under whose auspices this module was
@@ -193,7 +196,12 @@
      * matching "typedef" or "grouping" statement among the immediate
      * sub-statements of each ancestor statement.
      */
-    private List<YangResolutionInfo> unresolvedResolutionList;
+    private List<YangResolutionInfo> derivedTypeResolutionList;
+
+    /**
+     * uses resolution list.
+     */
+    private List<YangResolutionInfo> usesResolutionList;
 
     /**
      * Creates a YANG node of module type.
@@ -201,7 +209,8 @@
     public YangModule() {
 
         super(YangNodeType.MODULE_NODE);
-        unresolvedResolutionList = new LinkedList<YangResolutionInfo>();
+        derivedTypeResolutionList = new LinkedList<YangResolutionInfo>();
+        usesResolutionList = new LinkedList<YangResolutionInfo>();
         importList = new LinkedList<YangImport>();
         includeList = new LinkedList<YangInclude>();
         listOfLeaf = new LinkedList<YangLeaf>();
@@ -326,6 +335,11 @@
         return listOfLeaf;
     }
 
+    @Override
+    public void setListOfLeaf(List<YangLeaf> leafsList) {
+        listOfLeaf = leafsList;
+    }
+
     /**
      * Adds a leaf in module.
      *
@@ -346,6 +360,12 @@
         return listOfLeafList;
     }
 
+    @Override
+    public void setListOfLeafList(List<YangLeafList> listOfLeafList) {
+        this.listOfLeafList = listOfLeafList;
+    }
+
+
     /**
      * Adds a leaf-list in module.
      *
@@ -413,17 +433,19 @@
     }
 
     @Override
-    public void resolveSelfFileLinking() throws DataModelException {
+    public void resolveSelfFileLinking(ResolvableType type)
+            throws DataModelException {
         // Get the list to be resolved.
-        List<YangResolutionInfo> resolutionList = getUnresolvedResolutionList();
+        List<YangResolutionInfo> resolutionList = getUnresolvedResolutionList(type);
         // Resolve linking for a resolution list.
         resolveLinkingForResolutionList(resolutionList, this);
     }
 
     @Override
-    public void resolveInterFileLinking() throws DataModelException {
+    public void resolveInterFileLinking(ResolvableType type)
+            throws DataModelException {
         // Get the list to be resolved.
-        List<YangResolutionInfo> resolutionList = getUnresolvedResolutionList();
+        List<YangResolutionInfo> resolutionList = getUnresolvedResolutionList(type);
         // Resolve linking for a resolution list.
         linkInterFileReferences(resolutionList, this);
     }
@@ -500,7 +522,8 @@
      * @throws DataModelException a violation of data model rules
      */
     @Override
-    public void validateDataOnEntry() throws DataModelException {
+    public void validateDataOnEntry()
+            throws DataModelException {
         /*
          * Module is root in the data model tree, hence there is no entry
          * validation
@@ -513,7 +536,8 @@
      * @throws DataModelException a violation of data model rules
      */
     @Override
-    public void validateDataOnExit() throws DataModelException {
+    public void validateDataOnExit()
+            throws DataModelException {
         /*
          * TODO: perform symbol linking for the imported or included YANG info.
          * TODO: perform symbol resolution for referred YANG entities.
@@ -521,29 +545,47 @@
     }
 
     @Override
-    public void detectCollidingChild(String identifierName, YangConstructType dataType) throws DataModelException {
+    public void detectCollidingChild(String identifierName, YangConstructType dataType)
+            throws DataModelException {
         // Asks helper to detect colliding child.
         detectCollidingChildUtil(identifierName, dataType, this);
     }
 
     @Override
-    public void detectSelfCollision(String identifierName, YangConstructType dataType) throws DataModelException {
+    public void detectSelfCollision(String identifierName, YangConstructType dataType)
+            throws DataModelException {
         // Not required as module doesn't have any parent.
     }
 
     @Override
-    public List<YangResolutionInfo> getUnresolvedResolutionList() {
-        return unresolvedResolutionList;
+    public List<YangResolutionInfo> getUnresolvedResolutionList(ResolvableType type) {
+        if (type == ResolvableType.YANG_DERIVED_DATA_TYPE) {
+            return derivedTypeResolutionList;
+        } else {
+            return usesResolutionList;
+        }
+
     }
 
     @Override
-    public void addToResolutionList(YangResolutionInfo resolutionInfo) {
-        unresolvedResolutionList.add(resolutionInfo);
+    public void addToResolutionList(YangResolutionInfo resolutionInfo,
+            ResolvableType type) {
+        if (type == ResolvableType.YANG_DERIVED_DATA_TYPE) {
+            derivedTypeResolutionList.add(resolutionInfo);
+        } else if (type == ResolvableType.YANG_USES) {
+            usesResolutionList.add(resolutionInfo);
+        }
     }
 
     @Override
-    public void setResolutionList(List<YangResolutionInfo> resolutionList) {
-        unresolvedResolutionList = resolutionList;
+    public void setResolutionList(List<YangResolutionInfo> resolutionList,
+            ResolvableType type) {
+        if (type == ResolvableType.YANG_DERIVED_DATA_TYPE) {
+            derivedTypeResolutionList = resolutionList;
+        } else if (type == ResolvableType.YANG_USES) {
+            usesResolutionList = resolutionList;
+        }
+
     }
 
     @Override
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangNode.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangNode.java
index 811c76e..f9d5b26 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangNode.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangNode.java
@@ -16,12 +16,6 @@
 package org.onosproject.yangutils.datamodel;
 
 import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.parser.Parsable;
-import org.onosproject.yangutils.translator.tojava.TraversalType;
-
-import static org.onosproject.yangutils.translator.tojava.TraversalType.CHILD;
-import static org.onosproject.yangutils.translator.tojava.TraversalType.PARENT;
-import static org.onosproject.yangutils.translator.tojava.TraversalType.SIBILING;
 
 /**
  * Represents base class of a node in data model tree.
@@ -229,179 +223,4 @@
             newChild.setPreviousSibling(curNode);
         }
     }
-
-    /**
-     * Clone the current node contents and create a new node.
-     *
-     * @return cloned node
-     * @throws CloneNotSupportedException clone is not supported by the referred
-     *             node
-     */
-    @Override
-    public YangNode clone()
-            throws CloneNotSupportedException {
-        YangNode clonedNode = (YangNode) super.clone();
-        clonedNode.setParent(null);
-        clonedNode.setChild(null);
-        clonedNode.setNextSibling(null);
-        clonedNode.setPreviousSibling(null);
-        return clonedNode;
-    }
-
-    /**
-     * Clone the subtree from the specified source node to the mentioned target
-     * node. The source and target root node cloning is carried out by the
-     * caller.
-     *
-     * @param srcRootNode source node for sub tree cloning
-     * @param dstRootNode destination node where the sub tree needs to be cloned
-     * @throws DataModelException data model error
-     */
-    public static void cloneSubTree(YangNode srcRootNode, YangNode dstRootNode)
-            throws DataModelException {
-
-        YangNode nextNodeToClone = srcRootNode;
-        TraversalType curTraversal;
-
-        YangNode clonedTreeCurNode = dstRootNode;
-        YangNode newNode = null;
-
-        nextNodeToClone = nextNodeToClone.getChild();
-        if (nextNodeToClone == null) {
-            return;
-        } else {
-            /**
-             * Root level cloning is taken care in the caller.
-             */
-            curTraversal = CHILD;
-        }
-
-        /**
-         * Caller ensures the cloning of the root nodes
-         */
-        try {
-            while (nextNodeToClone != srcRootNode) {
-                if (nextNodeToClone == null) {
-                    throw new DataModelException("Internal error: Cloning failed, source tree null pointer reached");
-                }
-                if (curTraversal != PARENT) {
-                    newNode = nextNodeToClone.clone();
-                    detectCollisionWhileCloning(clonedTreeCurNode, newNode, curTraversal);
-                }
-
-                if (curTraversal == CHILD) {
-
-                    /**
-                     * add the new node to the cloned tree.
-                     */
-                    clonedTreeCurNode.addChild(newNode);
-
-                    /**
-                     * update the cloned tree's traversal current node as the
-                     * new node.
-                     */
-                    clonedTreeCurNode = newNode;
-                } else if (curTraversal == SIBILING) {
-
-                    clonedTreeCurNode.addNextSibling(newNode);
-                    clonedTreeCurNode = newNode;
-                } else if (curTraversal == PARENT) {
-                    clonedTreeCurNode = clonedTreeCurNode.getParent();
-                }
-
-                if (curTraversal != PARENT && nextNodeToClone.getChild() != null) {
-                    curTraversal = CHILD;
-
-                    /**
-                     * update the traversal's current node.
-                     */
-                    nextNodeToClone = nextNodeToClone.getChild();
-
-                } else if (nextNodeToClone.getNextSibling() != null) {
-
-                    curTraversal = SIBILING;
-
-                    nextNodeToClone = nextNodeToClone.getNextSibling();
-                } else {
-                    curTraversal = PARENT;
-                    nextNodeToClone = nextNodeToClone.getParent();
-                }
-            }
-        } catch (CloneNotSupportedException e) {
-            throw new DataModelException("Failed to clone the tree");
-        }
-
-    }
-
-    /**
-     * Detects collision when the grouping is deep copied to the uses's parent.
-     *
-     * @param currentNode parent/previous sibling node for the new node
-     * @param newNode node which has to be added
-     * @param addAs traversal type of the node
-     * @throws DataModelException data model error
-     */
-    private static void detectCollisionWhileCloning(YangNode currentNode, YangNode newNode, TraversalType addAs)
-            throws DataModelException {
-        if (!(currentNode instanceof CollisionDetector)
-                || !(newNode instanceof Parsable)) {
-            throw new DataModelException("Node in data model tree does not support collision detection");
-        }
-
-        CollisionDetector collisionDetector = (CollisionDetector) currentNode;
-        Parsable parsable = (Parsable) newNode;
-        if (addAs == TraversalType.CHILD) {
-            collisionDetector.detectCollidingChild(newNode.getName(), parsable.getYangConstructType());
-        } else if (addAs == TraversalType.SIBILING) {
-            currentNode = currentNode.getParent();
-            if (!(currentNode instanceof CollisionDetector)) {
-                throw new DataModelException("Node in data model tree does not support collision detection");
-            }
-            collisionDetector = (CollisionDetector) currentNode;
-            collisionDetector.detectCollidingChild(newNode.getName(), parsable.getYangConstructType());
-        } else {
-            throw new DataModelException("Errored tree cloning");
-        }
-
-    }
-
-    /**
-     * Add a new next sibling.
-     *
-     * @param newSibling new sibling to be added
-     * @throws DataModelException data model error
-     */
-    private void addNextSibling(YangNode newSibling)
-            throws DataModelException {
-
-        if (newSibling.getNodeType() == null) {
-            throw new DataModelException("Cloned abstract node cannot be inserted into a tree");
-        }
-
-        if (newSibling.getParent() == null) {
-            /**
-             * Since the siblings needs to have a common parent, set the parent
-             * as the current node's parent
-             */
-            newSibling.setParent(getParent());
-
-        } else {
-            throw new DataModelException("Node is already part of a tree, and cannot be added as a sibling");
-        }
-
-        if (newSibling.getPreviousSibling() == null) {
-            newSibling.setPreviousSibling(this);
-            setNextSibling(newSibling);
-        } else {
-            throw new DataModelException("New sibling to be added is not atomic, it already has a previous sibling");
-        }
-
-        if (newSibling.getChild() != null) {
-            throw new DataModelException("Sibling to be added is not atomic, it already has a child");
-        }
-
-        if (newSibling.getNextSibling() != null) {
-            throw new DataModelException("Sibling to be added is not atomic, it already has a next sibling");
-        }
-    }
 }
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangNotification.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangNotification.java
index 5e81f64..e70261f 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangNotification.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangNotification.java
@@ -74,7 +74,8 @@
 /**
  * Represents data model node to maintain information defined in YANG notification.
  */
-public class YangNotification extends YangNode
+public class YangNotification
+        extends YangNode
         implements YangLeavesHolder, YangCommonInfo, Parsable, CollisionDetector, YangAugmentationHolder {
 
     /**
@@ -117,13 +118,15 @@
     }
 
     @Override
-    public void detectCollidingChild(String identifierName, YangConstructType dataType) throws DataModelException {
+    public void detectCollidingChild(String identifierName, YangConstructType dataType)
+            throws DataModelException {
         // Detect colliding child.
         detectCollidingChildUtil(identifierName, dataType, this);
     }
 
     @Override
-    public void detectSelfCollision(String identifierName, YangConstructType dataType) throws DataModelException {
+    public void detectSelfCollision(String identifierName, YangConstructType dataType)
+            throws DataModelException {
         if (this.getName().equals(identifierName)) {
             throw new DataModelException("YANG file error: Duplicate input identifier detected, same as notification \""
                     + this.getName() + "\"");
@@ -136,12 +139,14 @@
     }
 
     @Override
-    public void validateDataOnEntry() throws DataModelException {
+    public void validateDataOnEntry()
+            throws DataModelException {
         //TODO: implement the method.
     }
 
     @Override
-    public void validateDataOnExit() throws DataModelException {
+    public void validateDataOnExit()
+            throws DataModelException {
         //TODO: implement the method.
     }
 
@@ -161,6 +166,11 @@
     }
 
     @Override
+    public void setListOfLeaf(List<YangLeaf> leafsList) {
+        listOfLeaf = leafsList;
+    }
+
+    @Override
     public void addLeaf(YangLeaf leaf) {
         getListOfLeaf().add(leaf);
     }
@@ -171,6 +181,11 @@
     }
 
     @Override
+    public void setListOfLeafList(List<YangLeafList> listOfLeafList) {
+        this.listOfLeafList = listOfLeafList;
+    }
+
+    @Override
     public void addLeafList(YangLeafList leafList) {
         getListOfLeafList().add(leafList);
     }
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangOutput.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangOutput.java
index 97072cf..2cb4c34 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangOutput.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangOutput.java
@@ -67,7 +67,8 @@
 /**
  * Represents data model node to maintain information defined in YANG output.
  */
-public class YangOutput extends YangNode
+public class YangOutput
+        extends YangNode
         implements YangLeavesHolder, Parsable, CollisionDetector, YangAugmentationHolder {
 
     /**
@@ -95,13 +96,15 @@
     }
 
     @Override
-    public void detectCollidingChild(String identifierName, YangConstructType dataType) throws DataModelException {
+    public void detectCollidingChild(String identifierName, YangConstructType dataType)
+            throws DataModelException {
         // Detect colliding child.
         detectCollidingChildUtil(identifierName, dataType, this);
     }
 
     @Override
-    public void detectSelfCollision(String identifierName, YangConstructType dataType) throws DataModelException {
+    public void detectSelfCollision(String identifierName, YangConstructType dataType)
+            throws DataModelException {
         if (this.getName().equals(identifierName)) {
             throw new DataModelException("YANG file error: Duplicate identifier detected, same as output \""
                     + this.getName() + "\"");
@@ -114,12 +117,14 @@
     }
 
     @Override
-    public void validateDataOnEntry() throws DataModelException {
+    public void validateDataOnEntry()
+            throws DataModelException {
         //TODO: implement the method.
     }
 
     @Override
-    public void validateDataOnExit() throws DataModelException {
+    public void validateDataOnExit()
+            throws DataModelException {
         //TODO: implement the method.
     }
 
@@ -134,11 +139,22 @@
     }
 
     @Override
+    public void setListOfLeaf(List<YangLeaf> leafsList) {
+        listOfLeaf = leafsList;
+    }
+
+    @Override
     public List<YangLeafList> getListOfLeafList() {
         return listOfLeafList;
     }
 
     @Override
+    public void setListOfLeafList(List<YangLeafList> listOfLeafList) {
+        this.listOfLeafList = listOfLeafList;
+    }
+
+
+    @Override
     public void addLeafList(YangLeafList leafList) {
         getListOfLeafList().add(leafList);
     }
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangSubModule.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangSubModule.java
index 7a54aaf..89c49dd 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangSubModule.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangSubModule.java
@@ -19,9 +19,11 @@
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Set;
+
 import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
 import org.onosproject.yangutils.linker.exceptions.LinkerException;
-import org.onosproject.yangutils.linker.impl.YangReferenceResolver;
+import org.onosproject.yangutils.linker.ResolvableType;
+import org.onosproject.yangutils.linker.YangReferenceResolver;
 import org.onosproject.yangutils.linker.impl.YangResolutionInfo;
 import org.onosproject.yangutils.parser.Parsable;
 import org.onosproject.yangutils.plugin.manager.YangFileInfo;
@@ -82,7 +84,8 @@
 /**
  * Represents data model node to maintain information defined in YANG sub-module.
  */
-public class YangSubModule extends YangNode
+public class YangSubModule
+        extends YangNode
         implements YangLeavesHolder, YangDesc, YangReference, Parsable, CollisionDetector, YangReferenceResolver,
         RpcNotificationContainer {
 
@@ -156,6 +159,7 @@
      * Prefix of parent module.
      */
     private String prefix;
+
     /*-
      * Reference RFC 6020.
      *
@@ -190,14 +194,20 @@
      * matching "typedef" or "grouping" statement among the immediate
      * sub-statements of each ancestor statement.
      */
-    private List<YangResolutionInfo> unresolvedResolutionList;
+    private List<YangResolutionInfo> derivedTypeResolutionList;
+
+    /**
+     * uses resolution list.
+     */
+    private List<YangResolutionInfo> usesResolutionList;
 
     /**
      * Creates a sub module node.
      */
     public YangSubModule() {
         super(YangNodeType.SUB_MODULE_NODE);
-        unresolvedResolutionList = new LinkedList<YangResolutionInfo>();
+        derivedTypeResolutionList = new LinkedList<YangResolutionInfo>();
+        usesResolutionList = new LinkedList<YangResolutionInfo>();
         importList = new LinkedList<YangImport>();
         includeList = new LinkedList<YangInclude>();
         listOfLeaf = new LinkedList<YangLeaf>();
@@ -341,17 +351,19 @@
     }
 
     @Override
-    public void resolveSelfFileLinking() throws DataModelException {
+    public void resolveSelfFileLinking(ResolvableType type)
+            throws DataModelException {
         // Get the list to be resolved.
-        List<YangResolutionInfo> resolutionList = getUnresolvedResolutionList();
+        List<YangResolutionInfo> resolutionList = getUnresolvedResolutionList(type);
         // Resolve linking for a resolution list.
         resolveLinkingForResolutionList(resolutionList, this);
     }
 
     @Override
-    public void resolveInterFileLinking() throws DataModelException {
+    public void resolveInterFileLinking(ResolvableType type)
+            throws DataModelException {
         // Get the list to be resolved.
-        List<YangResolutionInfo> resolutionList = getUnresolvedResolutionList();
+        List<YangResolutionInfo> resolutionList = getUnresolvedResolutionList(type);
         // Resolve linking for a resolution list.
         linkInterFileReferences(resolutionList, this);
     }
@@ -366,6 +378,11 @@
         return listOfLeaf;
     }
 
+    @Override
+    public void setListOfLeaf(List<YangLeaf> leafsList) {
+        listOfLeaf = leafsList;
+    }
+
     /**
      * Adds a leaf.
      *
@@ -386,6 +403,11 @@
         return listOfLeafList;
     }
 
+    @Override
+    public void setListOfLeafList(List<YangLeafList> listOfLeafList) {
+        this.listOfLeafList = listOfLeafList;
+    }
+
     /**
      * Adds a leaf-list.
      *
@@ -486,7 +508,8 @@
      * @throws DataModelException a violation of data model rules
      */
     @Override
-    public void validateDataOnEntry() throws DataModelException {
+    public void validateDataOnEntry()
+            throws DataModelException {
         // TODO auto-generated method stub, to be implemented by parser
     }
 
@@ -496,34 +519,52 @@
      * @throws DataModelException a violation of data model rules
      */
     @Override
-    public void validateDataOnExit() throws DataModelException {
+    public void validateDataOnExit()
+            throws DataModelException {
         // TODO auto-generated method stub, to be implemented by parser
     }
 
     @Override
-    public void detectCollidingChild(String identifierName, YangConstructType dataType) throws DataModelException {
+    public void detectCollidingChild(String identifierName, YangConstructType dataType)
+            throws DataModelException {
         // Asks helper to detect colliding child.
         detectCollidingChildUtil(identifierName, dataType, this);
     }
 
     @Override
-    public void detectSelfCollision(String identifierName, YangConstructType dataType) throws DataModelException {
+    public void detectSelfCollision(String identifierName, YangConstructType dataType)
+            throws DataModelException {
         // Not required as module doesn't have any parent.
     }
 
     @Override
-    public List<YangResolutionInfo> getUnresolvedResolutionList() {
-        return unresolvedResolutionList;
+    public List<YangResolutionInfo> getUnresolvedResolutionList(ResolvableType type) {
+        if (type == ResolvableType.YANG_DERIVED_DATA_TYPE) {
+            return derivedTypeResolutionList;
+        } else {
+            return usesResolutionList;
+        }
     }
 
     @Override
-    public void addToResolutionList(YangResolutionInfo resolutionInfo) {
-        this.unresolvedResolutionList.add(resolutionInfo);
+    public void addToResolutionList(YangResolutionInfo resolutionInfo,
+            ResolvableType type) {
+        if (type == ResolvableType.YANG_DERIVED_DATA_TYPE) {
+            derivedTypeResolutionList.add(resolutionInfo);
+        } else if (type == ResolvableType.YANG_USES) {
+            usesResolutionList.add(resolutionInfo);
+        }
     }
 
     @Override
-    public void setResolutionList(List<YangResolutionInfo> resolutionList) {
-        this.unresolvedResolutionList = resolutionList;
+    public void setResolutionList(List<YangResolutionInfo> resolutionList,
+            ResolvableType type) {
+        if (type == ResolvableType.YANG_DERIVED_DATA_TYPE) {
+            derivedTypeResolutionList = resolutionList;
+        } else if (type == ResolvableType.YANG_USES) {
+            usesResolutionList = resolutionList;
+        }
+
     }
 
     /**
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangType.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangType.java
index 4421619..41e07e4 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangType.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangType.java
@@ -17,9 +17,9 @@
 package org.onosproject.yangutils.datamodel;
 
 import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
+import org.onosproject.yangutils.linker.Resolvable;
+import org.onosproject.yangutils.linker.ResolvableStatus;
 import org.onosproject.yangutils.linker.exceptions.LinkerException;
-import org.onosproject.yangutils.linker.impl.Resolvable;
-import org.onosproject.yangutils.linker.impl.ResolvableStatus;
 import org.onosproject.yangutils.parser.Parsable;
 import org.onosproject.yangutils.utils.YangConstructType;
 
@@ -247,7 +247,8 @@
     }
 
     @Override
-    public void resolve() throws LinkerException {
+    public void resolve()
+            throws LinkerException {
        /*
         * Check whether the data type is derived.
         */
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangUses.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangUses.java
index 4eae3a2..d2d8bc2 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangUses.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangUses.java
@@ -15,10 +15,13 @@
  */
 package org.onosproject.yangutils.datamodel;
 
+import java.util.LinkedList;
+import java.util.List;
+
 import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
+import org.onosproject.yangutils.linker.Resolvable;
+import org.onosproject.yangutils.linker.ResolvableStatus;
 import org.onosproject.yangutils.linker.exceptions.LinkerException;
-import org.onosproject.yangutils.linker.impl.Resolvable;
-import org.onosproject.yangutils.linker.impl.ResolvableStatus;
 import org.onosproject.yangutils.parser.Parsable;
 import org.onosproject.yangutils.utils.YangConstructType;
 
@@ -96,12 +99,30 @@
     private ResolvableStatus resolvableStatus;
 
     /**
+     * Effective list of nodes of grouping that needs to replicated at YANG uses.
+     */
+    List<YangNode> resolvedGroupingNodes;
+
+    /**
+     * Effective list of leaves of grouping that needs to replicated at YANG uses.
+     */
+    List<List<YangLeaf>> resolvedGroupingLeaves;
+
+    /**
+     * Effective list of leaf lists of grouping that needs to replicated at YANG uses.
+     */
+    List<List<YangLeafList>> resolvedGroupingLeafLists;
+
+    /**
      * Creates an YANG uses node.
      */
     public YangUses() {
         super(YangNodeType.USES_NODE);
         nodeIdentifier = new YangNodeIdentifier();
         resolvableStatus = ResolvableStatus.UNRESOLVED;
+        resolvedGroupingNodes = new LinkedList<YangNode>();
+        resolvedGroupingLeaves = new LinkedList<List<YangLeaf>>();
+        resolvedGroupingLeafLists = new LinkedList<List<YangLeafList>>();
     }
 
     /**
@@ -277,36 +298,132 @@
         }
 
         YangLeavesHolder usesParentLeavesHolder = (YangLeavesHolder) usesParentNode;
-        if (referredGrouping.getListOfLeaf() != null) {
-            for (YangLeaf leaf : referredGrouping.getListOfLeaf()) {
-                try {
-                    ((CollisionDetector) usesParentLeavesHolder).detectCollidingChild(leaf.getName(),
-                            YangConstructType.LEAF_DATA);
-                } catch (DataModelException e) {
-                    throw new LinkerException(e.getMessage());
-                }
-                usesParentLeavesHolder.addLeaf(leaf);
-            }
-        }
-        if (referredGrouping.getListOfLeafList() != null) {
-            for (YangLeafList leafList : referredGrouping.getListOfLeafList()) {
-                try {
-                    ((CollisionDetector) usesParentLeavesHolder).detectCollidingChild(leafList.getName(),
-                            YangConstructType.LEAF_LIST_DATA);
-                } catch (DataModelException e) {
-                    throw new LinkerException(e.getMessage());
-                }
-                usesParentLeavesHolder.addLeafList(leafList);
-            }
+        if (referredGrouping.getListOfLeaf() != null
+                && referredGrouping.getListOfLeaf().size() != 0) {
+            addLeavesOfGrouping(
+                    cloneLeavesList(referredGrouping.getListOfLeaf(),
+                            usesParentLeavesHolder));
         }
 
-        try {
-            YangNode.cloneSubTree(getRefGroup(), usesParentNode);
-        } catch (DataModelException e) {
-            throw new LinkerException(e.getMessage());
+        if (referredGrouping.getListOfLeafList() != null
+                && referredGrouping.getListOfLeafList().size() != 0) {
+            addListOfLeafListOfGrouping(
+                    cloneListOfLeafList(referredGrouping.getListOfLeafList(),
+                            usesParentLeavesHolder));
+        }
+
+        YangNode childInGrouping = referredGrouping.getChild();
+
+        while (childInGrouping != null) {
+            if ((childInGrouping instanceof YangEnumeration)
+                    || (childInGrouping instanceof YangUnion)
+                    || (childInGrouping instanceof YangTypeDef)) {
+
+                /*
+                 * No need to copy the leaves, union / enum class,
+                 * as these will be generated in the scope of grouping
+                 */
+                childInGrouping = childInGrouping.getNextSibling();
+                continue;
+            } else if ((childInGrouping instanceof YangUses)) {
+                addResolvedUsesInfoOfGrouping((YangUses) childInGrouping,
+                        usesParentLeavesHolder);
+            } else {
+                addNodeOfGrouping(childInGrouping);
+            }
+
+            childInGrouping = childInGrouping.getNextSibling();
         }
     }
 
+    /**
+     * Clone the resolved uses contained in grouping to the uses of grouping.
+     *
+     * @param usesInGrouping resolved uses in grouping
+     * @param usesHolder     holder of uses
+     */
+    private void addResolvedUsesInfoOfGrouping(YangUses usesInGrouping,
+            YangLeavesHolder usesHolder) {
+        for (YangNode usesResolvedNode :
+                usesInGrouping.getUsesResolvedNodeList()) {
+            addNodeOfGrouping(usesResolvedNode);
+        }
+
+        for (List<YangLeaf> leavesList :
+                usesInGrouping.getUsesResolvedLeavesList()) {
+            addLeavesOfGrouping(cloneLeavesList(leavesList, usesHolder));
+        }
+
+        for (List<YangLeafList> listOfLeafLists :
+                usesInGrouping.getUsesResolvedListOfLeafList()) {
+            addListOfLeafListOfGrouping(
+                    cloneListOfLeafList(listOfLeafLists, usesHolder));
+        }
+    }
+
+    /**
+     * Clone the list of leaves and return the cloned list leaves.
+     *
+     * @param listOfLeaves   list of leaves to be cloned
+     * @param usesParentNode parent of the cloned location
+     * @return cloned list of leaves
+     */
+    private List<YangLeaf> cloneLeavesList(List<YangLeaf> listOfLeaves,
+            YangLeavesHolder usesParentNode) {
+        if ((listOfLeaves == null) || listOfLeaves.size() == 0) {
+            throw new LinkerException("No leaves to clone");
+        }
+
+        List<YangLeaf> newLeavesList = new LinkedList<YangLeaf>();
+        for (YangLeaf leaf : listOfLeaves) {
+            YangLeaf clonedLeaf;
+            try {
+                ((CollisionDetector) usesParentNode).detectCollidingChild(leaf.getName(),
+                        YangConstructType.LEAF_DATA);
+                clonedLeaf = leaf.clone();
+            } catch (CloneNotSupportedException | DataModelException e) {
+                throw new LinkerException(e.getMessage());
+            }
+
+            clonedLeaf.setContainedIn(usesParentNode);
+            newLeavesList.add(clonedLeaf);
+        }
+
+        return newLeavesList;
+    }
+
+    /**
+     * Clone the list of leaf list.
+     *
+     * @param listOfLeafList list of leaf list that needs to be cloned
+     * @param usesParentNode parent of uses
+     * @return cloned list of leaf list
+     */
+    private List<YangLeafList> cloneListOfLeafList(List<YangLeafList> listOfLeafList,
+            YangLeavesHolder usesParentNode) {
+        if ((listOfLeafList == null) || listOfLeafList.size() == 0) {
+            throw new LinkerException("No leaf lists to clone");
+        }
+
+        List<YangLeafList> newListOfLeafList = new LinkedList<YangLeafList>();
+        for (YangLeafList leafList : listOfLeafList) {
+            YangLeafList clonedLeafList;
+            try {
+                ((CollisionDetector) usesParentNode).detectCollidingChild(leafList.getName(),
+                        YangConstructType.LEAF_LIST_DATA);
+                clonedLeafList = leafList.clone();
+            } catch (CloneNotSupportedException | DataModelException e) {
+                throw new LinkerException(e.getMessage());
+            }
+
+            clonedLeafList.setContainedIn(usesParentNode);
+            newListOfLeafList.add(clonedLeafList);
+        }
+
+        return newListOfLeafList;
+    }
+
+
     @Override
     public ResolvableStatus getResolvableStatus() {
         return resolvableStatus;
@@ -318,12 +435,14 @@
     }
 
     @Override
-    public void detectCollidingChild(String identifierName, YangConstructType dataType) throws DataModelException {
+    public void detectCollidingChild(String identifierName, YangConstructType dataType)
+            throws DataModelException {
         detectCollidingChildUtil(identifierName, dataType, this);
     }
 
     @Override
-    public void detectSelfCollision(String identifierName, YangConstructType dataType) throws DataModelException {
+    public void detectSelfCollision(String identifierName, YangConstructType dataType)
+            throws DataModelException {
 
         if (getName().equals(identifierName)) {
             throw new DataModelException("YANG file error: Duplicate input identifier detected, same as uses \""
@@ -331,4 +450,61 @@
         }
     }
 
+
+    /**
+     * Adds the node under grouping to the effective uses resolved info.
+     *
+     * @param nodeInGrouping node defined under grouping which needs to be copied in
+     *                       the context of uses
+     */
+    public void addNodeOfGrouping(YangNode nodeInGrouping) {
+        resolvedGroupingNodes.add(nodeInGrouping);
+    }
+
+    /**
+     * Returns the effective list of nodes added due to uses linking.
+     *
+     * @return effective list of nodes added due to uses linking
+     */
+    public List<YangNode> getUsesResolvedNodeList() {
+        return resolvedGroupingNodes;
+    }
+
+    /**
+     * Adds the leaves under grouping to the effective uses resolved info.
+     *
+     * @param leavesInGrouping Leaves defined under grouping which needs to be copied in
+     *                         the context of uses
+     */
+    public void addLeavesOfGrouping(List<YangLeaf> leavesInGrouping) {
+        resolvedGroupingLeaves.add(leavesInGrouping);
+    }
+
+    /**
+     * Returns the effective list of Leaves added due to uses linking.
+     *
+     * @return effective list of Leaves added due to uses linking
+     */
+    public List<List<YangLeaf>> getUsesResolvedLeavesList() {
+        return resolvedGroupingLeaves;
+    }
+
+    /**
+     * Adds the leaf-lists under grouping to the effective uses resolved info.
+     *
+     * @param leafListsInGrouping leaf-lists defined under grouping which needs to be copied in
+     *                            the context of uses
+     */
+    public void addListOfLeafListOfGrouping(List<YangLeafList> leafListsInGrouping) {
+        resolvedGroupingLeafLists.add(leafListsInGrouping);
+    }
+
+    /**
+     * Returns the effective list of Leaves added due to uses linking.
+     *
+     * @return effective list of Leaves added due to uses linking
+     */
+    public List<List<YangLeafList>> getUsesResolvedListOfLeafList() {
+        return resolvedGroupingLeafLists;
+    }
 }
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/utils/DataModelUtils.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/utils/DataModelUtils.java
index ea17891..29d384b 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/utils/DataModelUtils.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/utils/DataModelUtils.java
@@ -18,15 +18,18 @@
 
 import java.util.List;
 import java.util.Set;
+
 import org.onosproject.yangutils.datamodel.CollisionDetector;
 import org.onosproject.yangutils.datamodel.YangLeaf;
 import org.onosproject.yangutils.datamodel.YangLeafList;
 import org.onosproject.yangutils.datamodel.YangLeavesHolder;
 import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.linker.impl.YangReferenceResolver;
-import org.onosproject.yangutils.linker.impl.YangResolutionInfo;
 import org.onosproject.yangutils.datamodel.YangRpc;
+import org.onosproject.yangutils.datamodel.YangType;
 import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
+import org.onosproject.yangutils.linker.ResolvableType;
+import org.onosproject.yangutils.linker.YangReferenceResolver;
+import org.onosproject.yangutils.linker.impl.YangResolutionInfo;
 import org.onosproject.yangutils.parser.Parsable;
 import org.onosproject.yangutils.plugin.manager.YangFileInfo;
 import org.onosproject.yangutils.utils.YangConstructType;
@@ -45,8 +48,7 @@
     /**
      * Detects the colliding identifier name in a given YANG node and its child.
      *
-     * @param identifierName name for which collision detection is to be
-     *                       checked
+     * @param identifierName name for which collision detection is to be checked
      * @param dataType       type of YANG node asking for detecting collision
      * @param node           instance of calling node
      * @throws DataModelException a violation of data model rules
@@ -77,8 +79,7 @@
     /**
      * Detects colliding of uses and grouping only with uses and grouping respectively.
      *
-     * @param identifierName name for which collision detection is to be
-     *                       checked
+     * @param identifierName name for which collision detection is to be checked
      * @param dataType       type of YANG node asking for detecting collision
      * @param node           node instance of calling node
      * @throws DataModelException a violation of data model rules
@@ -101,8 +102,7 @@
      * Detects the colliding identifier name in a given leaf node.
      *
      * @param listOfLeaf     List of leaves to detect collision
-     * @param identifierName name for which collision detection is to be
-     *                       checked
+     * @param identifierName name for which collision detection is to be checked
      * @throws DataModelException a violation of data model rules
      */
     private static void detectCollidingLeaf(List<YangLeaf> listOfLeaf, String identifierName)
@@ -123,8 +123,7 @@
      * Detects the colliding identifier name in a given leaf-list node.
      *
      * @param listOfLeafList list of leaf-lists to detect collision
-     * @param identifierName name for which collision detection is to be
-     *                       checked
+     * @param identifierName name for which collision detection is to be checked
      * @throws DataModelException a violation of data model rules
      */
     private static void detectCollidingLeafList(List<YangLeafList> listOfLeafList, String identifierName)
@@ -144,8 +143,7 @@
     /**
      * Add a resolution information.
      *
-     * @param resolutionInfo information about the YANG construct which has to
-     *                       be resolved
+     * @param resolutionInfo information about the YANG construct which has to be resolved
      * @throws DataModelException a violation of data model rules
      */
     public static void addResolutionInfo(YangResolutionInfo resolutionInfo)
@@ -162,7 +160,15 @@
         }
         YangReferenceResolver resolutionNode = (YangReferenceResolver) curNode;
 
-        resolutionNode.addToResolutionList(resolutionInfo);
+        if (resolutionInfo.getEntityToResolveInfo()
+                .getEntityToResolve() instanceof YangType) {
+            resolutionNode.addToResolutionList(resolutionInfo,
+                    ResolvableType.YANG_DERIVED_DATA_TYPE);
+        } else {
+            resolutionNode.addToResolutionList(resolutionInfo,
+                    ResolvableType.YANG_USES);
+        }
+
     }
 
     /**
@@ -173,7 +179,7 @@
      * @throws DataModelException a violation of data model rules
      */
     public static void resolveLinkingForResolutionList(List<YangResolutionInfo> resolutionList,
-                                                       YangReferenceResolver dataModelRootNode)
+            YangReferenceResolver dataModelRootNode)
             throws DataModelException {
 
         for (YangResolutionInfo resolutionInfo : resolutionList) {
@@ -189,7 +195,7 @@
      * @throws DataModelException a violation of data model rules
      */
     public static void linkInterFileReferences(List<YangResolutionInfo> resolutionList,
-                                               YangReferenceResolver dataModelRootNode)
+            YangReferenceResolver dataModelRootNode)
             throws DataModelException {
         /*
          * Run through the resolution list, find type/uses referring to
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/linker/impl/Resolvable.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/linker/Resolvable.java
similarity index 97%
rename from utils/yangutils/src/main/java/org/onosproject/yangutils/linker/impl/Resolvable.java
rename to utils/yangutils/src/main/java/org/onosproject/yangutils/linker/Resolvable.java
index f384dc5..975c3f4 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/linker/impl/Resolvable.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/linker/Resolvable.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package org.onosproject.yangutils.linker.impl;
+package org.onosproject.yangutils.linker;
 
 import org.onosproject.yangutils.linker.exceptions.LinkerException;
 
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/linker/impl/ResolvableStatus.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/linker/ResolvableStatus.java
similarity index 96%
rename from utils/yangutils/src/main/java/org/onosproject/yangutils/linker/impl/ResolvableStatus.java
rename to utils/yangutils/src/main/java/org/onosproject/yangutils/linker/ResolvableStatus.java
index cd43c18..0ff5da5 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/linker/impl/ResolvableStatus.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/linker/ResolvableStatus.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package org.onosproject.yangutils.linker.impl;
+package org.onosproject.yangutils.linker;
 
 /**
  * Represents the status of resolvable entity.
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/linker/ResolvableType.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/linker/ResolvableType.java
new file mode 100644
index 0000000..ff0778f
--- /dev/null
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/linker/ResolvableType.java
@@ -0,0 +1,33 @@
+/*
+ * 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.linker;
+
+/**
+ * Type of the resolvable info.
+ */
+public enum ResolvableType {
+
+    /**
+     * Identifies the derived data type.
+     */
+    YANG_DERIVED_DATA_TYPE,
+
+    /**
+     * Identifies the uses.
+     */
+    YANG_USES
+}
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/linker/YangLinkingPhase.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/linker/YangLinkingPhase.java
new file mode 100644
index 0000000..23020df
--- /dev/null
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/linker/YangLinkingPhase.java
@@ -0,0 +1,34 @@
+/*
+ * 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.linker;
+
+/**
+ * Represents the phase of YANG file reference linking.
+ */
+public enum YangLinkingPhase {
+
+    /**
+     * Linking the reference within the files.
+     */
+    INTRA_FILE,
+
+    /**
+     * Linking the reference across the files.
+     */
+    INTER_FILE
+
+}
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/linker/impl/YangReferenceResolver.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/linker/YangReferenceResolver.java
similarity index 80%
rename from utils/yangutils/src/main/java/org/onosproject/yangutils/linker/impl/YangReferenceResolver.java
rename to utils/yangutils/src/main/java/org/onosproject/yangutils/linker/YangReferenceResolver.java
index 4681985..307675d 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/linker/impl/YangReferenceResolver.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/linker/YangReferenceResolver.java
@@ -14,14 +14,16 @@
  * limitations under the License.
  */
 
-package org.onosproject.yangutils.linker.impl;
+package org.onosproject.yangutils.linker;
 
 import java.util.List;
 import java.util.Set;
+
 import org.onosproject.yangutils.datamodel.YangImport;
 import org.onosproject.yangutils.datamodel.YangInclude;
 import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
 import org.onosproject.yangutils.linker.exceptions.LinkerException;
+import org.onosproject.yangutils.linker.impl.YangResolutionInfo;
 import org.onosproject.yangutils.plugin.manager.YangFileInfo;
 
 /**
@@ -33,23 +35,26 @@
     /**
      * Returns unresolved resolution list.
      *
-     * @return unresolved resolution list
+     * @param type resolvable type
+     * @return list of resolution information objects
      */
-    List<YangResolutionInfo> getUnresolvedResolutionList();
+    List<YangResolutionInfo> getUnresolvedResolutionList(ResolvableType type);
 
     /**
      * Adds to the resolution list.
      *
      * @param resolutionInfo resolution information
+     * @param type           resolvable type
      */
-    void addToResolutionList(YangResolutionInfo resolutionInfo);
+    void addToResolutionList(YangResolutionInfo resolutionInfo, ResolvableType type);
 
     /**
      * Creates resolution list.
      *
      * @param resolutionList resolution list
+     * @param type           resolvable type
      */
-    void setResolutionList(List<YangResolutionInfo> resolutionList);
+    void setResolutionList(List<YangResolutionInfo> resolutionList, ResolvableType type);
 
     /**
      * Returns unresolved imported list.
@@ -110,16 +115,20 @@
     /**
      * Resolves self file linking.
      *
+     * @param type resolvable type
      * @throws DataModelException a violation in data model rule
      */
-    void resolveSelfFileLinking() throws DataModelException;
+    void resolveSelfFileLinking(ResolvableType type)
+            throws DataModelException;
 
     /**
      * Resolves inter file linking.
      *
+     * @param type resolvable type
      * @throws DataModelException a violation in data model rule
      */
-    void resolveInterFileLinking() throws DataModelException;
+    void resolveInterFileLinking(ResolvableType type)
+            throws DataModelException;
 
     /**
      * Adds references to include.
@@ -127,7 +136,8 @@
      * @param yangFileInfoSet YANG file info set
      * @throws LinkerException a violation of linker rules
      */
-    void addReferencesToIncludeList(Set<YangFileInfo> yangFileInfoSet) throws LinkerException;
+    void addReferencesToIncludeList(Set<YangFileInfo> yangFileInfoSet)
+            throws LinkerException;
 
     /**
      * Adds references to import.
@@ -135,5 +145,6 @@
      * @param yangFileInfoSet YANG file info set
      * @throws LinkerException a violation of linker rules
      */
-    void addReferencesToImportList(Set<YangFileInfo> yangFileInfoSet) throws LinkerException;
+    void addReferencesToImportList(Set<YangFileInfo> yangFileInfoSet)
+            throws LinkerException;
 }
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/linker/impl/YangLinkerManager.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/linker/impl/YangLinkerManager.java
index 0fc3d99..deaebb2 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/linker/impl/YangLinkerManager.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/linker/impl/YangLinkerManager.java
@@ -17,10 +17,13 @@
 package org.onosproject.yangutils.linker.impl;
 
 import java.util.Set;
+
 import org.onosproject.yangutils.datamodel.YangNode;
 import org.onosproject.yangutils.datamodel.YangSubModule;
 import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
+import org.onosproject.yangutils.linker.ResolvableType;
 import org.onosproject.yangutils.linker.YangLinker;
+import org.onosproject.yangutils.linker.YangReferenceResolver;
 import org.onosproject.yangutils.linker.exceptions.LinkerException;
 import org.onosproject.yangutils.plugin.manager.YangFileInfo;
 
@@ -29,7 +32,8 @@
 /**
  * Representation of entity which provides linking service of YANG files.
  */
-public class YangLinkerManager implements YangLinker {
+public class YangLinkerManager
+        implements YangLinker {
     @Override
     public void resolveDependencies(Set<YangFileInfo> yangFileInfoSet) {
 
@@ -54,7 +58,8 @@
      * @param yangFileInfoSet set of YANG files info
      * @throws LinkerException fails to link sub-module to parent module
      */
-    public void linkSubModulesToParentModule(Set<YangFileInfo> yangFileInfoSet) throws LinkerException {
+    public void linkSubModulesToParentModule(Set<YangFileInfo> yangFileInfoSet)
+            throws LinkerException {
         for (YangFileInfo yangFileInfo : yangFileInfoSet) {
             YangNode yangNode = yangFileInfo.getRootNode();
             if (yangNode instanceof YangSubModule) {
@@ -106,10 +111,13 @@
      * @param yangFileInfoSet set of YANG files info
      * @throws LinkerException a violation in linker execution
      */
-    public void processInterFileLinking(Set<YangFileInfo> yangFileInfoSet) throws LinkerException {
+    public void processInterFileLinking(Set<YangFileInfo> yangFileInfoSet)
+            throws LinkerException {
         for (YangFileInfo yangFileInfo : yangFileInfoSet) {
             try {
-                ((YangReferenceResolver) yangFileInfo.getRootNode()).resolveInterFileLinking();
+                ((YangReferenceResolver) yangFileInfo.getRootNode()).resolveInterFileLinking(ResolvableType.YANG_USES);
+                ((YangReferenceResolver) yangFileInfo.getRootNode())
+                        .resolveInterFileLinking(ResolvableType.YANG_DERIVED_DATA_TYPE);
             } catch (DataModelException e) {
                 String errorInfo = "Error in file: " + yangFileInfo.getYangFileName() + " at line: "
                         + e.getLineNumber() + " at position: " + e.getCharPositionInLine() + NEW_LINE + e.getMessage();
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/linker/impl/YangResolutionInfo.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/linker/impl/YangResolutionInfo.java
index 26d4cb6..83b11c4 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/linker/impl/YangResolutionInfo.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/linker/impl/YangResolutionInfo.java
@@ -17,6 +17,7 @@
 package org.onosproject.yangutils.linker.impl;
 
 import java.util.Stack;
+
 import org.onosproject.yangutils.datamodel.LocationInfo;
 import org.onosproject.yangutils.datamodel.YangDataTypes;
 import org.onosproject.yangutils.datamodel.YangDerivedInfo;
@@ -28,12 +29,18 @@
 import org.onosproject.yangutils.datamodel.YangTypeDef;
 import org.onosproject.yangutils.datamodel.YangUses;
 import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
+import org.onosproject.yangutils.linker.Resolvable;
+import org.onosproject.yangutils.linker.ResolvableStatus;
+import org.onosproject.yangutils.linker.YangLinkingPhase;
+import org.onosproject.yangutils.linker.YangReferenceResolver;
 
-import static org.onosproject.yangutils.linker.impl.ResolvableStatus.INTER_FILE_LINKED;
-import static org.onosproject.yangutils.linker.impl.ResolvableStatus.INTRA_FILE_RESOLVED;
-import static org.onosproject.yangutils.linker.impl.ResolvableStatus.LINKED;
-import static org.onosproject.yangutils.linker.impl.ResolvableStatus.RESOLVED;
-import static org.onosproject.yangutils.linker.impl.ResolvableStatus.UNRESOLVED;
+import static org.onosproject.yangutils.linker.ResolvableStatus.INTER_FILE_LINKED;
+import static org.onosproject.yangutils.linker.ResolvableStatus.INTRA_FILE_RESOLVED;
+import static org.onosproject.yangutils.linker.ResolvableStatus.LINKED;
+import static org.onosproject.yangutils.linker.ResolvableStatus.RESOLVED;
+import static org.onosproject.yangutils.linker.ResolvableStatus.UNRESOLVED;
+import static org.onosproject.yangutils.linker.YangLinkingPhase.INTER_FILE;
+import static org.onosproject.yangutils.linker.YangLinkingPhase.INTRA_FILE;
 import static org.onosproject.yangutils.utils.UtilConstants.TYPEDEF_LINKER_ERROR;
 import static org.onosproject.yangutils.utils.UtilConstants.GROUPING_LINKER_ERROR;
 
@@ -42,7 +49,8 @@
  *
  * @param <T> type of resolution entity uses / type
  */
-public class YangResolutionInfo<T> implements LocationInfo {
+public class YangResolutionInfo<T>
+        implements LocationInfo {
 
     /**
      * Information about the entity that needs to be resolved.
@@ -164,7 +172,7 @@
                          * resolve the references and pop the entity and
                          * continue with remaining stack elements to resolve.
                          */
-                        resolveTopOfStack();
+                        resolveTopOfStack(INTRA_FILE);
                         getPartialResolvedStack().pop();
                         break;
                     }
@@ -213,7 +221,7 @@
     /**
      * Resolves the current entity in the stack.
      */
-    private void resolveTopOfStack()
+    private void resolveTopOfStack(YangLinkingPhase linkingPhase)
             throws DataModelException {
         ((Resolvable) getCurrentEntityToResolveFromStack()).resolve();
         if (((Resolvable) getCurrentEntityToResolveFromStack()).getResolvableStatus()
@@ -280,7 +288,8 @@
      * @return true if self file reference, false otherwise
      * @throws DataModelException a violation of data model rules
      */
-    private boolean isCandidateForSelfFileReference() throws DataModelException {
+    private boolean isCandidateForSelfFileReference()
+            throws DataModelException {
         String prefix = getRefPrefix();
         return prefix == null || prefix.contentEquals(getCurReferenceResolver().getPrefix());
     }
@@ -598,7 +607,8 @@
      * @return referenced prefix of entity under resolution
      * @throws DataModelException a violation in data model rule
      */
-    private String getRefPrefix() throws DataModelException {
+    private String getRefPrefix()
+            throws DataModelException {
         String refPrefix;
         if (getCurrentEntityToResolveFromStack() instanceof YangType) {
             refPrefix = ((YangType<?>) getCurrentEntityToResolveFromStack()).getPrefix();
@@ -643,7 +653,7 @@
                          * resolve the references and pop the entity and
                          * continue with remaining stack elements to resolve
                          */
-                        resolveTopOfStack();
+                        resolveTopOfStack(INTER_FILE);
                         getPartialResolvedStack().pop();
                         break;
                     }
@@ -679,7 +689,8 @@
      *
      * @throws DataModelException data model error
      */
-    private void linkInterFileTopOfStackRefUpdateStack() throws DataModelException {
+    private void linkInterFileTopOfStackRefUpdateStack()
+            throws DataModelException {
 
         /*
          * Obtain the referred node of top of stack entity under resolution
@@ -727,7 +738,8 @@
      * @return true if resolved, false otherwise
      * @throws DataModelException a violation in data model rule
      */
-    private boolean resolveWithInclude() throws DataModelException {
+    private boolean resolveWithInclude()
+            throws DataModelException {
         /*
          * Run through all the nodes in include list and search for referred
          * typedef/grouping at the root level.
@@ -762,7 +774,8 @@
      * @return true if resolved, false otherwise
      * @throws DataModelException a violation in data model rule
      */
-    private boolean resolveWithImport() throws DataModelException {
+    private boolean resolveWithImport()
+            throws DataModelException {
         /*
          * Run through import list to find the referred typedef/grouping.
          */
@@ -808,7 +821,8 @@
      * @return referred typedef/grouping node
      * @throws DataModelException a violation in data model rule
      */
-    private T getRefNode() throws DataModelException {
+    private T getRefNode()
+            throws DataModelException {
         if (getCurrentEntityToResolveFromStack() instanceof YangType) {
             YangDerivedInfo<?> derivedInfo = (YangDerivedInfo<?>)
                     ((YangType<?>) getCurrentEntityToResolveFromStack()).getDataTypeExtendedInfo();
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/parser/impl/listeners/AugmentListener.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/parser/impl/listeners/AugmentListener.java
index b3b22ae..f9042fa 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/parser/impl/listeners/AugmentListener.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/parser/impl/listeners/AugmentListener.java
@@ -39,8 +39,10 @@
 import static org.onosproject.yangutils.parser.impl.parserutils.ListenerCollisionDetector.detectCollidingChildUtil;
 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.constructExtendedListenerErrorMessage;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
+import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorMessageConstruction
+        .constructExtendedListenerErrorMessage;
+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;
@@ -98,7 +100,7 @@
      * @param ctx context object of the grammar rule
      */
     public static void processAugmentEntry(TreeWalkListener listener,
-                                       GeneratedYangParser.AugmentStatementContext ctx) {
+            GeneratedYangParser.AugmentStatementContext ctx) {
 
         // Check for stack to be non empty.
         checkStackIsNotEmpty(listener, MISSING_HOLDER, AUGMENT_DATA, ctx.augment().getText(), ENTRY);
@@ -120,7 +122,8 @@
             YangNode curNode = (YangNode) curData;
             YangAugment yangAugment = getYangAugmentNode(JAVA_GENERATION);
 
-            validateTargetNodePath(targetNodes, curNode, ctx);
+            //validateTargetNodePath(targetNodes, curNode, ctx);
+            // TODO: handle in linker.
 
             yangAugment.setTargetNode(targetNodes);
             yangAugment.setName(generateNameForAugmentNode(curData, targetNodes, listener));
@@ -147,7 +150,7 @@
      * @param ctx context object of the grammar rule
      */
     public static void processAugmentExit(TreeWalkListener listener,
-                                      GeneratedYangParser.AugmentStatementContext ctx) {
+            GeneratedYangParser.AugmentStatementContext ctx) {
 
         //Check for stack to be non empty.
         checkStackIsNotEmpty(listener, MISSING_HOLDER, AUGMENT_DATA, ctx.augment().getText(), EXIT);
@@ -170,15 +173,15 @@
         validateCardinalityMaxOne(ctx.referenceStatement(), REFERENCE_DATA, AUGMENT_DATA, ctx.augment().getText());
         validateCardinalityMaxOne(ctx.whenStatement(), WHEN_DATA, AUGMENT_DATA, ctx.augment().getText());
         validateMutuallyExclusiveChilds(ctx.dataDefStatement(), DATA_DEF_DATA, ctx.caseStatement(),
-                                        CASE_DATA, AUGMENT_DATA, ctx.augment().getText());
+                CASE_DATA, AUGMENT_DATA, ctx.augment().getText());
     }
 
     /**
      * Validates whether the current target node path is correct or not.
      *
      * @param targetNodes list of target nodes
-     * @param line line in YANG file
-     * @param charPositionInLine char position in YANG file
+     * @param curNode current Node
+     * @param ctx augment context
      * @param curNode current YANG node
      */
     private static void validateTargetNodePath(List<YangNodeIdentifier> targetNodes, YangNode curNode,
@@ -189,7 +192,8 @@
             if (!moduleId.getName().equals(curNode.getName())) {
                 throw parserException(ctx);
             } else {
-                validateNodeInTargetPath(curNode, targetNodes, ctx);
+                //validateNodeInTargetPath(curNode, targetNodes, ctx);
+                // TODO: handle in linker.
             }
         } else {
             String parentPrefix = getParentsPrefix(curNode);
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/parser/impl/listeners/LeafListListener.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/parser/impl/listeners/LeafListListener.java
index 4a2481a..f478e8a 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/parser/impl/listeners/LeafListListener.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/parser/impl/listeners/LeafListListener.java
@@ -113,11 +113,12 @@
         leafList.setLeafName(identifier);
 
         Parsable tmpData = listener.getParsedDataStack().peek();
-        YangLeavesHolder leaves;
+        YangLeavesHolder leavesHolder;
 
         if (tmpData instanceof YangLeavesHolder) {
-            leaves = (YangLeavesHolder) tmpData;
-            leaves.addLeafList(leafList);
+            leavesHolder = (YangLeavesHolder) tmpData;
+            leavesHolder.addLeafList(leafList);
+            leafList.setContainedIn(leavesHolder);
         } else {
             throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, LEAF_LIST_DATA,
                     ctx.identifier().getText(), ENTRY));
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/parser/impl/listeners/LeafListener.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/parser/impl/listeners/LeafListener.java
index b8e3b2d..0a648af 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/parser/impl/listeners/LeafListener.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/parser/impl/listeners/LeafListener.java
@@ -115,11 +115,12 @@
         leaf.setLeafName(identifier);
 
         Parsable tmpData = listener.getParsedDataStack().peek();
-        YangLeavesHolder leaves;
+        YangLeavesHolder leavesHolder;
 
         if (tmpData instanceof YangLeavesHolder) {
-            leaves = (YangLeavesHolder) tmpData;
-            leaves.addLeaf(leaf);
+            leavesHolder = (YangLeavesHolder) tmpData;
+            leavesHolder.addLeaf(leaf);
+            leaf.setContainedIn(leavesHolder);
         } else {
             throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, LEAF_DATA,
                     ctx.identifier().getText(), ENTRY));
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/parser/impl/listeners/ModuleListener.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/parser/impl/listeners/ModuleListener.java
index a0005ba..afa9acd 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/parser/impl/listeners/ModuleListener.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/parser/impl/listeners/ModuleListener.java
@@ -16,10 +16,11 @@
 
 package org.onosproject.yangutils.parser.impl.listeners;
 
-import org.onosproject.yangutils.linker.impl.YangReferenceResolver;
 import org.onosproject.yangutils.datamodel.YangModule;
 import org.onosproject.yangutils.datamodel.YangRevision;
 import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
+import org.onosproject.yangutils.linker.ResolvableType;
+import org.onosproject.yangutils.linker.YangReferenceResolver;
 import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
 import org.onosproject.yangutils.parser.exceptions.ParserException;
 import org.onosproject.yangutils.parser.impl.TreeWalkListener;
@@ -28,7 +29,8 @@
 import static org.onosproject.yangutils.datamodel.utils.YangDataModelFactory.getYangModuleNode;
 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.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;
@@ -116,7 +118,10 @@
                     ctx.identifier().getText(), EXIT));
         }
         try {
-            ((YangReferenceResolver) listener.getParsedDataStack().peek()).resolveSelfFileLinking();
+            ((YangReferenceResolver) listener.getParsedDataStack()
+                    .peek()).resolveSelfFileLinking(ResolvableType.YANG_USES);
+            ((YangReferenceResolver) listener.getParsedDataStack()
+                    .peek()).resolveSelfFileLinking(ResolvableType.YANG_DERIVED_DATA_TYPE);
         } catch (DataModelException e) {
             ParserException parserException = new ParserException(e.getMessage());
             parserException.setLine(e.getLineNumber());
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/parser/impl/listeners/PatternRestrictionListener.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/parser/impl/listeners/PatternRestrictionListener.java
index 4f0ce8e..bd65855 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/parser/impl/listeners/PatternRestrictionListener.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/parser/impl/listeners/PatternRestrictionListener.java
@@ -151,7 +151,7 @@
      * @param ctx      context object of the grammar rule
      */
     public static void processPatternRestrictionExit(TreeWalkListener listener,
-                                                     GeneratedYangParser.PatternStatementContext ctx) {
+                                                    GeneratedYangParser.PatternStatementContext ctx) {
 
         // Check for stack to be non empty.
         checkStackIsNotEmpty(listener, MISSING_HOLDER, PATTERN_DATA, ctx.string().getText(), EXIT);
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/parser/impl/listeners/SubModuleListener.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/parser/impl/listeners/SubModuleListener.java
index 2c97f30..048e635 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/parser/impl/listeners/SubModuleListener.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/parser/impl/listeners/SubModuleListener.java
@@ -16,10 +16,11 @@
 
 package org.onosproject.yangutils.parser.impl.listeners;
 
-import org.onosproject.yangutils.linker.impl.YangReferenceResolver;
 import org.onosproject.yangutils.datamodel.YangRevision;
 import org.onosproject.yangutils.datamodel.YangSubModule;
 import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
+import org.onosproject.yangutils.linker.ResolvableType;
+import org.onosproject.yangutils.linker.YangReferenceResolver;
 import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
 import org.onosproject.yangutils.parser.exceptions.ParserException;
 import org.onosproject.yangutils.parser.impl.TreeWalkListener;
@@ -28,7 +29,8 @@
 import static org.onosproject.yangutils.datamodel.utils.YangDataModelFactory.getYangSubModuleNode;
 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.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;
@@ -121,7 +123,10 @@
                     ctx.identifier().getText(), EXIT));
         }
         try {
-            ((YangReferenceResolver) listener.getParsedDataStack().peek()).resolveSelfFileLinking();
+            ((YangReferenceResolver) listener.getParsedDataStack().peek())
+                    .resolveSelfFileLinking(ResolvableType.YANG_USES);
+            ((YangReferenceResolver) listener.getParsedDataStack().peek())
+                    .resolveSelfFileLinking(ResolvableType.YANG_DERIVED_DATA_TYPE);
         } catch (DataModelException e) {
             ParserException parserException = new ParserException(e.getMessage());
             parserException.setLine(e.getLineNumber());
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/parser/impl/listeners/TypeListener.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/parser/impl/listeners/TypeListener.java
index 6e25f1b..6e386da 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/parser/impl/listeners/TypeListener.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/parser/impl/listeners/TypeListener.java
@@ -35,7 +35,7 @@
 import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.addResolutionInfo;
 import static org.onosproject.yangutils.datamodel.utils.GeneratedLanguage.JAVA_GENERATION;
 import static org.onosproject.yangutils.datamodel.utils.YangDataModelFactory.getYangType;
-import static org.onosproject.yangutils.linker.impl.ResolvableStatus.UNRESOLVED;
+import static org.onosproject.yangutils.linker.ResolvableStatus.UNRESOLVED;
 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.constructExtendedListenerErrorMessage;
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/parser/impl/parserutils/AugmentListenerUtil.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/parser/impl/parserutils/AugmentListenerUtil.java
index 764cef4..7aae767 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/parser/impl/parserutils/AugmentListenerUtil.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/parser/impl/parserutils/AugmentListenerUtil.java
@@ -247,7 +247,7 @@
     /**
      * Validates whether nodes in target node list are valid or not.
      *
-     * @param targetNodeName current target node
+     * @param targetNodes target node
      * @param curNode YANG node
      * @return true or false
      */
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/plugin/manager/YangFileInfo.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/plugin/manager/YangFileInfo.java
index a92ca68..4c6147a 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/plugin/manager/YangFileInfo.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/plugin/manager/YangFileInfo.java
@@ -17,7 +17,7 @@
 package org.onosproject.yangutils.plugin.manager;
 
 import java.util.Objects;
-import org.onosproject.yangutils.linker.impl.ResolvableStatus;
+import org.onosproject.yangutils.linker.ResolvableStatus;
 import org.onosproject.yangutils.datamodel.YangNode;
 
 /**
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/plugin/manager/YangUtilManager.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/plugin/manager/YangUtilManager.java
index 0f6febeb..3eb1ea3 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/plugin/manager/YangUtilManager.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/plugin/manager/YangUtilManager.java
@@ -62,7 +62,8 @@
  */
 @Mojo(name = "yang2java", defaultPhase = GENERATE_SOURCES, requiresDependencyResolution = COMPILE,
         requiresProject = true)
-public class YangUtilManager extends AbstractMojo {
+public class YangUtilManager
+        extends AbstractMojo {
 
     private YangNode rootNode;
     // YANG file information set.
@@ -134,7 +135,8 @@
     private BuildContext context;
 
     @Override
-    public void execute() throws MojoExecutionException, MojoFailureException {
+    public void execute()
+            throws MojoExecutionException, MojoFailureException {
 
         try {
 
@@ -204,7 +206,8 @@
      *
      * @throws MojoExecutionException a violation in mojo excecution
      */
-    public void resolveDependenciesUsingLinker() throws MojoExecutionException {
+    public void resolveDependenciesUsingLinker()
+            throws MojoExecutionException {
         for (YangFileInfo yangFileInfo : getYangFileInfoSet()) {
             setCurYangFileInfo(yangFileInfo);
             try {
@@ -220,7 +223,8 @@
      *
      * @throws IOException a violation in IO
      */
-    public void parseYangFileInfoSet() throws IOException {
+    public void parseYangFileInfoSet()
+            throws IOException {
         for (YangFileInfo yangFileInfo : getYangFileInfoSet()) {
             setCurYangFileInfo(yangFileInfo);
             try {
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/translator/tojava/JavaCodeGeneratorUtil.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/translator/tojava/JavaCodeGeneratorUtil.java
index 6457596..a6eb9d7 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/translator/tojava/JavaCodeGeneratorUtil.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/translator/tojava/JavaCodeGeneratorUtil.java
@@ -64,10 +64,10 @@
     /**
      * Generates Java code files corresponding to the YANG schema.
      *
-     * @param rootNode root node of the data model tree
+     * @param rootNode   root node of the data model tree
      * @param yangPlugin YANG plugin config
      * @throws TranslatorException when fails to generate java code file the current
-     *                     node
+     *                             node
      */
     public static void generateJavaCode(YangNode rootNode, YangPluginConfig yangPlugin)
             throws TranslatorException {
@@ -77,18 +77,35 @@
 
         while (codeGenNode != null) {
             if (curTraversal != PARENT) {
+                if (!(codeGenNode instanceof JavaCodeGenerator)) {
+                    throw new TranslatorException("Unsupported node to generate code");
+                }
+
                 setCurNode(codeGenNode);
-                generateCodeEntry(codeGenNode, yangPlugin);
+                try {
+                    generateCodeEntry(codeGenNode, yangPlugin);
+                } catch (Exception e) {
+                    throw new TranslatorException(e.getMessage());
+                }
+
             }
             if (curTraversal != PARENT && codeGenNode.getChild() != null) {
                 curTraversal = CHILD;
                 codeGenNode = codeGenNode.getChild();
             } else if (codeGenNode.getNextSibling() != null) {
-                generateCodeExit(codeGenNode);
+                try {
+                    generateCodeExit(codeGenNode);
+                } catch (Exception e) {
+                    throw new TranslatorException(e.getMessage());
+                }
                 curTraversal = SIBILING;
                 codeGenNode = codeGenNode.getNextSibling();
             } else {
-                generateCodeExit(codeGenNode);
+                try {
+                    generateCodeExit(codeGenNode);
+                } catch (Exception e) {
+                    throw new TranslatorException(e.getMessage());
+                }
                 curTraversal = PARENT;
                 codeGenNode = codeGenNode.getParent();
             }
@@ -99,10 +116,10 @@
      * Generates the current nodes code snippet.
      *
      * @param codeGenNode current data model node for which the code needs to be
-     * generated
-     * @param yangPlugin YANG plugin config
+     *                    generated
+     * @param yangPlugin  YANG plugin config
      * @throws TranslatorException when fails to generate java code file the current
-     *                     node
+     *                             node
      */
     private static void generateCodeEntry(YangNode codeGenNode, YangPluginConfig yangPlugin)
             throws TranslatorException {
@@ -119,11 +136,12 @@
      * Generates the current nodes code target code from the snippet.
      *
      * @param codeGenNode current data model node for which the code needs to be
-     * generated
+     *                    generated
      * @throws TranslatorException when fails to generate java code file the current
-     *                     node
+     *                             node
      */
-    private static void generateCodeExit(YangNode codeGenNode) throws TranslatorException {
+    private static void generateCodeExit(YangNode codeGenNode)
+            throws TranslatorException {
 
         if (codeGenNode instanceof JavaCodeGenerator) {
             ((JavaCodeGenerator) codeGenNode).generateCodeExit();
@@ -188,7 +206,7 @@
      * Delete Java code files corresponding to the YANG schema.
      *
      * @param rootNode root node of data-model tree
-     * @throws IOException        when fails to delete java code file the current node
+     * @throws IOException when fails to delete java code file the current node
      */
     public static void translatorErrorHandler(YangNode rootNode)
             throws IOException {
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/translator/tojava/JavaImportData.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/translator/tojava/JavaImportData.java
index 5ccf0b3..b1c36ec 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/translator/tojava/JavaImportData.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/translator/tojava/JavaImportData.java
@@ -20,8 +20,6 @@
 import java.util.SortedSet;
 import java.util.TreeSet;
 
-import static java.util.Collections.sort;
-
 import static org.onosproject.yangutils.utils.UtilConstants.ABSTRACT_EVENT;
 import static org.onosproject.yangutils.utils.UtilConstants.ARRAY_LIST;
 import static org.onosproject.yangutils.utils.UtilConstants.AUGMENTATION_HOLDER_CLASS_IMPORT_CLASS;
@@ -45,6 +43,8 @@
 import static org.onosproject.yangutils.utils.UtilConstants.PROVIDED_AUGMENTATION_CLASS_IMPORT_PKG;
 import static org.onosproject.yangutils.utils.UtilConstants.SEMI_COLAN;
 
+import static java.util.Collections.sort;
+
 /**
  * Represents that generated Java file can contain imports.
  */
@@ -116,20 +116,52 @@
      * a qualified manner.
      *
      * @param newImportInfo class/interface info being imported
-     * @return status of new addition of class/interface to the import set
+     * @param className     name of the call being generated
+     * @param classPkg      generated class package
+     * @return qualified access status of the import node being added
      */
-    public boolean addImportInfo(JavaQualifiedTypeInfo newImportInfo) {
+    public boolean addImportInfo(JavaQualifiedTypeInfo newImportInfo,
+            String className, String classPkg) {
+
+        if (newImportInfo.getClassInfo().contentEquals(className)) {
+            /*
+             * if the current class name is same as the attribute class name,
+             * then the attribute must be accessed in a qualified manner.
+             */
+            return true;
+        } else if (newImportInfo.getPkgInfo() == null) {
+            /*
+             * If the package info is null, then it is not a candidate for import / qualified access
+             */
+            return false;
+        }
+
+        /*
+         * If the attribute type is having the package info, it is contender
+         * for import list and also need to check if it needs to be a
+         * qualified access.
+         */
+        if (newImportInfo.getPkgInfo().contentEquals(classPkg)) {
+            /**
+             * Package of the referred attribute and the generated class is same, so no need import
+             * or qualified access.
+             */
+            return false;
+        }
 
         for (JavaQualifiedTypeInfo curImportInfo : getImportSet()) {
             if (curImportInfo.getClassInfo()
                     .contentEquals(newImportInfo.getClassInfo())) {
-                return curImportInfo.getPkgInfo()
+                return !curImportInfo.getPkgInfo()
                         .contentEquals(newImportInfo.getPkgInfo());
             }
         }
 
+        /*
+         * import is added, so it is a member for non qualified access
+         */
         getImportSet().add(newImportInfo);
-        return true;
+        return false;
     }
 
     /**
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/translator/tojava/JavaQualifiedTypeInfo.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/translator/tojava/JavaQualifiedTypeInfo.java
index 2e6b43f..35ee6d5 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/translator/tojava/JavaQualifiedTypeInfo.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/translator/tojava/JavaQualifiedTypeInfo.java
@@ -134,10 +134,10 @@
      * Returns the import info for an attribute, which needs to be used for code
      * generation for import or for qualified access.
      *
-     * @param curNode current data model node for which the java file is being
-     * generated
+     * @param curNode       current data model node for which the java file is being
+     *                      generated
      * @param attributeName name of the attribute being added, it will used in
-     * import info for child class
+     *                      import info for child class
      * @return return the import info for this attribute
      */
     public static JavaQualifiedTypeInfo getQualifiedTypeInfoOfCurNode(YangNode curNode,
@@ -149,14 +149,10 @@
             throw new TranslatorException("missing java file information to get the package details "
                     + "of attribute corresponding to child node");
         }
-        /*
-         * The scenario when we need to add the child class as an attribute in
-         * the current class. The child class is in the package of the current
-         * classes package with current classes name.
-         */
+
         importInfo.setClassInfo(attributeName);
-        importInfo.setPkgInfo((((JavaFileInfoContainer) curNode).getJavaFileInfo().getPackage() + "."
-                + ((JavaFileInfoContainer) curNode).getJavaFileInfo().getJavaName()).toLowerCase());
+        importInfo.setPkgInfo(((JavaFileInfoContainer) curNode)
+                .getJavaFileInfo().getPackage());
 
         return importInfo;
     }
@@ -165,7 +161,7 @@
      * Returns the java qualified type information for the wrapper classes.
      *
      * @param referredTypesAttrInfo attribute of referred type
-     * @param conflictResolver plugin configurations
+     * @param conflictResolver      plugin configurations
      * @return return the import info for this attribute
      */
     public static JavaQualifiedTypeInfo getQualifiedInfoOfFromString(JavaAttributeInfo referredTypesAttrInfo,
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaFragmentFiles.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaFragmentFiles.java
index 0820c07..4243852 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaFragmentFiles.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaFragmentFiles.java
@@ -25,15 +25,13 @@
 import org.onosproject.yangutils.datamodel.YangLeaf;
 import org.onosproject.yangutils.datamodel.YangLeafList;
 import org.onosproject.yangutils.datamodel.YangLeavesHolder;
+import org.onosproject.yangutils.datamodel.YangList;
 import org.onosproject.yangutils.datamodel.YangNode;
 import org.onosproject.yangutils.translator.exception.TranslatorException;
 import org.onosproject.yangutils.translator.tojava.javamodel.JavaLeafInfoContainer;
 import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaGrouping;
-import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaInput;
 import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaModule;
-import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaOutput;
 import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaSubModule;
-import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaUses;
 import org.onosproject.yangutils.translator.tojava.utils.JavaExtendsListHolder;
 import org.onosproject.yangutils.translator.tojava.utils.YangPluginConfig;
 
@@ -56,6 +54,7 @@
 import static org.onosproject.yangutils.translator.tojava.JavaAttributeInfo.getAttributeInfoForTheData;
 import static org.onosproject.yangutils.translator.tojava.JavaQualifiedTypeInfo.getQualifiedInfoOfFromString;
 import static org.onosproject.yangutils.translator.tojava.JavaQualifiedTypeInfo.getQualifiedTypeInfoOfCurNode;
+import static org.onosproject.yangutils.translator.tojava.utils.AttributesJavaDataType.updateJavaFileInfo;
 import static org.onosproject.yangutils.translator.tojava.utils.JavaCodeSnippetGen.getJavaAttributeDefination;
 import static org.onosproject.yangutils.translator.tojava.utils.JavaCodeSnippetGen.getJavaClassDefClose;
 import static org.onosproject.yangutils.translator.tojava.utils.JavaFileGenerator.generateBuilderClassFile;
@@ -82,28 +81,36 @@
 import static org.onosproject.yangutils.translator.tojava.utils.MethodsGenerator.getToStringMethod;
 import static org.onosproject.yangutils.translator.tojava.utils.MethodsGenerator.parseBuilderInterfaceBuildMethodString;
 import static org.onosproject.yangutils.translator.tojava.utils.TempJavaCodeFragmentFilesUtils.addArrayListImport;
-import static org.onosproject.yangutils.translator.tojava.utils.TempJavaCodeFragmentFilesUtils.addAugmentationHoldersImport;
+import static org.onosproject.yangutils.translator.tojava.utils.TempJavaCodeFragmentFilesUtils
+        .addAugmentationHoldersImport;
 import static org.onosproject.yangutils.translator.tojava.utils.TempJavaCodeFragmentFilesUtils.addAugmentedInfoImport;
 import static org.onosproject.yangutils.translator.tojava.utils.TempJavaCodeFragmentFilesUtils.closeFile;
-import static org.onosproject.yangutils.translator.tojava.utils.TempJavaCodeFragmentFilesUtils.detectCollisionBwParentAndChildForImport;
-import static org.onosproject.yangutils.translator.tojava.utils.TempJavaCodeFragmentFilesUtils.isAugmentationHolderExtended;
+import static org.onosproject.yangutils.translator.tojava.utils.TempJavaCodeFragmentFilesUtils
+        .isAugmentationHolderExtended;
 import static org.onosproject.yangutils.translator.tojava.utils.TempJavaCodeFragmentFilesUtils.isAugmentedInfoExtended;
 import static org.onosproject.yangutils.translator.tojava.utils.TempJavaCodeFragmentFilesUtils.sortImports;
+import static org.onosproject.yangutils.utils.UtilConstants.ACTIVATE;
 import static org.onosproject.yangutils.utils.UtilConstants.BUILDER;
+import static org.onosproject.yangutils.utils.UtilConstants.COMPONENT;
+import static org.onosproject.yangutils.utils.UtilConstants.DEACTIVATE;
 import static org.onosproject.yangutils.utils.UtilConstants.EMPTY_STRING;
 import static org.onosproject.yangutils.utils.UtilConstants.FOUR_SPACE_INDENTATION;
 import static org.onosproject.yangutils.utils.UtilConstants.IMPL;
 import static org.onosproject.yangutils.utils.UtilConstants.IMPORT;
 import static org.onosproject.yangutils.utils.UtilConstants.INTERFACE;
+import static org.onosproject.yangutils.utils.UtilConstants.MANAGER;
 import static org.onosproject.yangutils.utils.UtilConstants.NEW_LINE;
 import static org.onosproject.yangutils.utils.UtilConstants.PERIOD;
+import static org.onosproject.yangutils.utils.UtilConstants.REFERENCE;
+import static org.onosproject.yangutils.utils.UtilConstants.REFERENCE_CARDINALITY;
 import static org.onosproject.yangutils.utils.UtilConstants.SEMI_COLAN;
+import static org.onosproject.yangutils.utils.UtilConstants.SERVICE;
 import static org.onosproject.yangutils.utils.UtilConstants.SLASH;
 import static org.onosproject.yangutils.utils.io.impl.FileSystemUtil.createPackage;
 import static org.onosproject.yangutils.utils.io.impl.FileSystemUtil.readAppendFile;
-import static org.onosproject.yangutils.utils.io.impl.JavaDocGen.getJavaDoc;
 import static org.onosproject.yangutils.utils.io.impl.JavaDocGen.JavaDocType.GETTER_METHOD;
 import static org.onosproject.yangutils.utils.io.impl.JavaDocGen.JavaDocType.OF_METHOD;
+import static org.onosproject.yangutils.utils.io.impl.JavaDocGen.getJavaDoc;
 import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.getAbsolutePackagePath;
 import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.insertDataIntoJavaFile;
 import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.mergeJavaFiles;
@@ -139,6 +146,7 @@
      * Contains all the interface(s)/class name which will be extended by generated files.
      */
     private JavaExtendsListHolder javaExtendsListHolder;
+
     /**
      * File type extension for java classes.
      */
@@ -295,12 +303,6 @@
     private boolean isAttributePresent;
 
     /**
-     * Creates an instance of temp java fragment files.
-     */
-    public TempJavaFragmentFiles() {
-    }
-
-    /**
      * Retrieves the absolute path where the file needs to be generated.
      *
      * @return absolute path where the file needs to be generated
@@ -313,7 +315,7 @@
      * Sets absolute path where the file needs to be generated.
      *
      * @param absoluteDirPath absolute path where the file needs to be
-     * generated.
+     *                        generated.
      */
     void setAbsoluteDirPath(String absoluteDirPath) {
         this.absoluteDirPath = absoluteDirPath;
@@ -366,7 +368,7 @@
     /**
      * Sets generated file files.
      *
-     * @param generatedTempFile generated file
+     * @param fileType generated file type
      */
     void setGeneratedTempFiles(int fileType) {
         generatedTempFiles = fileType;
@@ -493,7 +495,7 @@
      * Sets from string method's temporary file handle.
      *
      * @param fromStringImplTempFileHandle from string method's temporary file
-     * handle
+     *                                     handle
      */
     private void setFromStringImplTempFileHandle(File fromStringImplTempFileHandle) {
         this.fromStringImplTempFileHandle = fromStringImplTempFileHandle;
@@ -505,7 +507,8 @@
      * @param javaFileInfo generated java file information
      * @throws IOException when fails to create new file handle
      */
-    TempJavaFragmentFiles(JavaFileInfo javaFileInfo) throws IOException {
+    TempJavaFragmentFiles(JavaFileInfo javaFileInfo)
+            throws IOException {
         setJavaExtendsListHolder(new JavaExtendsListHolder());
         setJavaImportData(new JavaImportData());
         setJavaFileInfo(javaFileInfo);
@@ -801,8 +804,8 @@
     /**
      * Adds attribute for class.
      *
-     * @param attr attribute info
-     * @param pluginConfig plugin configurations
+     * @param attr             attribute info
+     * @param yangPluginConfig plugin configurations
      * @throws IOException when fails to append to temporary file
      */
     private void addAttribute(JavaAttributeInfo attr, YangPluginConfig yangPluginConfig)
@@ -814,7 +817,7 @@
     /**
      * Adds getter for interface.
      *
-     * @param attr attribute info
+     * @param attr         attribute info
      * @param pluginConfig plugin configurations
      * @throws IOException when fails to append to temporary file
      */
@@ -827,7 +830,7 @@
     /**
      * Adds setter for interface.
      *
-     * @param attr attribute info
+     * @param attr         attribute info
      * @param pluginConfig plugin configurations
      * @throws IOException when fails to append to temporary file
      */
@@ -855,7 +858,7 @@
     /**
      * Adds getter method's impl for class.
      *
-     * @param attr attribute info
+     * @param attr         attribute info
      * @param pluginConfig plugin configurations
      * @throws IOException when fails to append to temporary file
      */
@@ -875,8 +878,8 @@
     /**
      * Adds build method for interface.
      *
-     * @return build method for interface
      * @param pluginConfig plugin configurations
+     * @return build method for interface
      * @throws IOException when fails to append to temporary file
      */
     String addBuildMethodForInterface(YangPluginConfig pluginConfig)
@@ -898,8 +901,8 @@
     /**
      * Adds default constructor for class.
      *
-     * @param modifier modifier for constructor.
-     * @param toAppend string which need to be appended with the class name
+     * @param modifier     modifier for constructor.
+     * @param toAppend     string which need to be appended with the class name
      * @param pluginConfig plugin configurations
      * @return default constructor for class
      * @throws IOException when fails to append to file
@@ -959,7 +962,7 @@
     /**
      * Adds from string method for union class.
      *
-     * @param javaAttributeInfo type attribute info
+     * @param javaAttributeInfo       type attribute info
      * @param fromStringAttributeInfo from string attribute info
      * @throws IOException when fails to append to temporary file
      */
@@ -987,6 +990,8 @@
         File file = new File(path + fileName + TEMP_FILE_EXTENSION);
         if (!file.exists()) {
             file.createNewFile();
+        } else {
+            throw new IOException(fileName + " is reused due to YANG naming");
         }
         return file;
     }
@@ -998,7 +1003,8 @@
      * @return temporary file handle
      * @throws IOException when fails to create new file handle
      */
-    File getJavaFileHandle(String fileName) throws IOException {
+    File getJavaFileHandle(String fileName)
+            throws IOException {
         return getFileObject(getDirPath(), fileName, JAVA_FILE_EXTENSION, getJavaFileInfo());
     }
 
@@ -1034,7 +1040,7 @@
     /**
      * Parses attribute to get the attribute string.
      *
-     * @param attr attribute info
+     * @param attr         attribute info
      * @param pluginConfig plugin configurations
      * @return attribute string
      */
@@ -1072,9 +1078,9 @@
     /**
      * Adds current node info as and attribute to the parent generated file.
      *
-     * @param curNode current node which needs to be added as an attribute in
-     * the parent generated code
-     * @param isList is list construct
+     * @param curNode      current node which needs to be added as an attribute in
+     *                     the parent generated code
+     * @param isList       is list construct
      * @param pluginConfig plugin configurations
      * @throws IOException IO operation exception
      */
@@ -1085,10 +1091,16 @@
         if (!(parent instanceof JavaCodeGenerator)) {
             throw new TranslatorException("missing parent node to contain current node info in generated file");
         }
-        if (curNode instanceof YangJavaUses) {
-            curNode = ((YangJavaUses) curNode).getRefGroup();
+
+        if (parent instanceof YangJavaGrouping) {
+            /*
+             * In case of grouping, there is no need to add the information, it will be taken care in
+             * uses
+             */
+            return;
         }
-        JavaAttributeInfo javaAttributeInfo = getCurNodeAsAttributeInParent(curNode,
+
+        JavaAttributeInfo javaAttributeInfo = getCurNodeAsAttributeInTarget(curNode,
                 parent, isList);
         if (!(parent instanceof TempJavaCodeFragmentFilesContainer)) {
             throw new TranslatorException("missing parent temp file handle");
@@ -1097,80 +1109,111 @@
                 .addJavaSnippetInfoToApplicableTempFiles(javaAttributeInfo, pluginConfig);
     }
 
+
+    /**
+     * Adds current node info as and attribute to the parent generated file.
+     *
+     * @param curNode      current node which needs to be added as an attribute in
+     *                     the parent generated code
+     * @param pluginConfig plugin configurations
+     * @param targetNode   target node to add the attribute
+     * @throws IOException IO operation exception
+     */
+    public static void addCurNodeAsAttributeInTargetTempFile(YangNode curNode,
+            YangPluginConfig pluginConfig, YangNode targetNode)
+            throws IOException {
+
+        if (!(targetNode instanceof JavaCodeGenerator)) {
+            throw new TranslatorException("invalid target node to generated file");
+        }
+
+        if (targetNode instanceof YangJavaGrouping) {
+            /*
+             * In case of grouping, there is no need to add the information, it will be taken care in
+             * uses
+             */
+            return;
+        }
+
+        boolean isList = curNode instanceof YangList;
+
+        JavaAttributeInfo javaAttributeInfo = getCurNodeAsAttributeInTarget(curNode,
+                targetNode, isList);
+        if (!(targetNode instanceof TempJavaCodeFragmentFilesContainer)) {
+            throw new TranslatorException("missing target node's temp file handle");
+        }
+        getNodesInterfaceFragmentFiles(targetNode)
+                .addJavaSnippetInfoToApplicableTempFiles(javaAttributeInfo, pluginConfig);
+    }
+
     /**
      * Creates an attribute info object corresponding to a data model node and
      * return it.
      *
-     * @param curNode current data model node for which the java code generation
-     * is being handled
-     * @param parentNode parent node in which the current node is an attribute
+     * @param curNode    current data model node for which the java code generation
+     *                   is being handled
+     * @param targetNode target node in which the current node is an attribute
      * @param isListNode is the current added attribute needs to be a list
      * @return AttributeInfo attribute details required to add in temporary
      * files
      */
-    public static JavaAttributeInfo getCurNodeAsAttributeInParent(
-            YangNode curNode, YangNode parentNode, boolean isListNode) {
-
-        YangPluginConfig pluginConfig = ((JavaFileInfoContainer) parentNode).getJavaFileInfo().getPluginConfig();
-        JavaFileInfo curNodeJavaInfo = ((JavaFileInfoContainer) curNode).getJavaFileInfo();
-        String curNodeName = null;
-
-        if (curNodeJavaInfo.getJavaName() != null) {
-            curNodeName = curNodeJavaInfo.getJavaName();
-        } else {
-            curNodeName = getCamelCase(curNode.getName(), pluginConfig.getConflictResolver());
-        }
-
-        if (!(parentNode instanceof TempJavaCodeFragmentFilesContainer)) {
-            throw new TranslatorException("Parent node does not have file info");
-        }
-
-        TempJavaFragmentFiles tempJavaFragmentFiles = getNodesInterfaceFragmentFiles(parentNode);
-        boolean isQualified = true;
-        JavaImportData parentImportData = tempJavaFragmentFiles.getJavaImportData();
-        if (isListNode) {
-            parentImportData.setIfListImported(true);
+    public static JavaAttributeInfo getCurNodeAsAttributeInTarget(YangNode curNode,
+            YangNode targetNode, boolean isListNode) {
+        String curNodeName = ((JavaFileInfoContainer) curNode).getJavaFileInfo().getJavaName();
+        if (curNodeName == null) {
+            updateJavaFileInfo(curNode, null);
+            curNodeName = ((JavaFileInfoContainer) curNode).getJavaFileInfo().getJavaName();
         }
 
         /*
          * Get the import info corresponding to the attribute for import in
          * generated java files or qualified access
          */
+        JavaQualifiedTypeInfo qualifiedTypeInfo = getQualifiedTypeInfoOfCurNode(curNode,
+                getCapitalCase(curNodeName));
+        if (!(targetNode instanceof TempJavaCodeFragmentFilesContainer)) {
+            throw new TranslatorException("Parent node does not have file info");
+        }
+        TempJavaFragmentFiles tempJavaFragmentFiles = getNodesInterfaceFragmentFiles(targetNode);
+        JavaImportData parentImportData = tempJavaFragmentFiles.getJavaImportData();
+        JavaFileInfo fileInfo = ((JavaFileInfoContainer) targetNode).getJavaFileInfo();
 
-        JavaQualifiedTypeInfo qualifiedTypeInfo = new JavaQualifiedTypeInfo();
-        if (curNode instanceof YangJavaGrouping) {
-            qualifiedTypeInfo = resolveGroupingsQuailifiedInfo(curNode, pluginConfig);
+        boolean isQualified;
+        if ((targetNode instanceof YangJavaModule || targetNode instanceof YangJavaSubModule)
+                && (qualifiedTypeInfo.getClassInfo().contentEquals(SERVICE)
+                || qualifiedTypeInfo.getClassInfo().contentEquals(COMPONENT)
+                || qualifiedTypeInfo.getClassInfo().contentEquals(getCapitalCase(ACTIVATE))
+                || qualifiedTypeInfo.getClassInfo().contentEquals(getCapitalCase(DEACTIVATE))
+                || qualifiedTypeInfo.getClassInfo().contentEquals(REFERENCE_CARDINALITY)
+                || qualifiedTypeInfo.getClassInfo().contentEquals(REFERENCE))
+                || qualifiedTypeInfo.getClassInfo().contentEquals(getCapitalCase(fileInfo.getJavaName() + SERVICE))
+                || qualifiedTypeInfo.getClassInfo().contentEquals(getCapitalCase(fileInfo.getJavaName() + MANAGER))) {
+
+            isQualified = true;
         } else {
-            qualifiedTypeInfo = getQualifiedTypeInfoOfCurNode(parentNode,
-                    getCapitalCase(curNodeName));
+            String className;
+            if (targetNode instanceof YangJavaModule || targetNode instanceof YangJavaSubModule) {
+                className = getCapitalCase(fileInfo.getJavaName()) + "Service";
+            } else {
+                className = getCapitalCase(fileInfo.getJavaName());
+            }
+
+            isQualified = parentImportData.addImportInfo(qualifiedTypeInfo,
+                    className, fileInfo.getPackage());
         }
 
-        if (parentNode instanceof YangJavaModule
-                || parentNode instanceof YangJavaSubModule
-                || parentNode instanceof YangJavaInput
-                || parentNode instanceof YangJavaOutput) {
-            parentImportData.addImportInfo(qualifiedTypeInfo);
-            isQualified = false;
-        } else if (curNode instanceof YangJavaGrouping) {
-            JavaFileInfo parentsClassInfo = ((JavaFileInfoContainer) parentNode).getJavaFileInfo();
-            if (qualifiedTypeInfo.getClassInfo().equals(parentsClassInfo.getJavaName())) {
-                isQualified = true;
-            }
-            if (!qualifiedTypeInfo.getPkgInfo().equals(parentsClassInfo.getPackage())) {
-                parentImportData.addImportInfo(qualifiedTypeInfo);
-                isQualified = false;
-            }
-        } else if (!detectCollisionBwParentAndChildForImport(curNode, qualifiedTypeInfo)) {
-            parentImportData.addImportInfo(qualifiedTypeInfo);
-            isQualified = false;
+        if (isListNode) {
+            parentImportData.setIfListImported(true);
         }
+
+
         return getAttributeInfoForTheData(qualifiedTypeInfo, curNodeName, null, isQualified, isListNode);
     }
 
     /**
      * Resolves groupings java qualified info.
      *
-     * @param curNode grouping node
+     * @param curNode      grouping node
      * @param pluginConfig plugin configurations
      * @return groupings java qualified info
      */
@@ -1247,7 +1290,7 @@
     /**
      * Adds parent's info to current node import list.
      *
-     * @param curNode current node for which import list needs to be updated
+     * @param curNode      current node for which import list needs to be updated
      * @param pluginConfig plugin configurations
      */
     public void addParentInfoInCurNodeTempFile(YangNode curNode, YangPluginConfig pluginConfig) {
@@ -1263,18 +1306,22 @@
         caseImportInfo.setClassInfo(getCapitalCase(getCamelCase(parent.getName(),
                 pluginConfig.getConflictResolver())));
         caseImportInfo.setPkgInfo(((JavaFileInfoContainer) parent).getJavaFileInfo().getPackage());
+
+        JavaFileInfo fileInfo = ((JavaFileInfoContainer) curNode).getJavaFileInfo();
+
         ((TempJavaCodeFragmentFilesContainer) curNode).getTempJavaCodeFragmentFiles()
-                .getBeanTempFiles().getJavaImportData().addImportInfo(caseImportInfo);
+                .getBeanTempFiles().getJavaImportData().addImportInfo(caseImportInfo,
+                getCapitalCase(fileInfo.getJavaName()), fileInfo.getPackage());
     }
 
     /**
      * Adds leaf attributes in generated files.
      *
-     * @param listOfLeaves list of YANG leaf
-     * @param yangPluginConfig
+     * @param listOfLeaves     list of YANG leaf
+     * @param yangPluginConfig plugin config
      * @throws IOException IO operation fail
      */
-    private void addLeavesInfoToTempFiles(List<YangLeaf> listOfLeaves,
+    public void addLeavesInfoToTempFiles(List<YangLeaf> listOfLeaves,
             YangPluginConfig yangPluginConfig)
             throws IOException {
         if (listOfLeaves != null) {
@@ -1299,11 +1346,11 @@
     /**
      * Adds leaf list's attributes in generated files.
      *
-     * @param listOfLeafList list of YANG leaves
-     * @param yangPluginConfig
+     * @param listOfLeafList   list of YANG leaves
+     * @param yangPluginConfig plugin config
      * @throws IOException IO operation fail
      */
-    private void addLeafListInfoToTempFiles(List<YangLeafList> listOfLeafList, YangPluginConfig yangPluginConfig)
+    public void addLeafListInfoToTempFiles(List<YangLeafList> listOfLeafList, YangPluginConfig yangPluginConfig)
             throws IOException {
         if (listOfLeafList != null) {
             for (YangLeafList leafList : listOfLeafList) {
@@ -1329,7 +1376,7 @@
      * Adds all the leaves in the current data model node as part of the
      * generated temporary file.
      *
-     * @param curNode java file info of the generated file
+     * @param curNode          java file info of the generated file
      * @param yangPluginConfig plugin config
      * @throws IOException IO operation fail
      */
@@ -1347,8 +1394,8 @@
     /**
      * Adds the new attribute info to the target generated temporary files.
      *
-     * @param newAttrInfo the attribute info that needs to be added to temporary
-     * files
+     * @param newAttrInfo  the attribute info that needs to be added to temporary
+     *                     files
      * @param pluginConfig plugin configurations
      * @throws IOException IO operation fail
      */
@@ -1423,7 +1470,7 @@
      * Constructs java code exit.
      *
      * @param fileType generated file type
-     * @param curNode current YANG node
+     * @param curNode  current YANG node
      * @throws IOException when fails to generate java files
      */
     public void generateJavaFile(int fileType, YangNode curNode)
@@ -1542,8 +1589,8 @@
      * Removes all temporary file handles.
      *
      * @param isErrorOccurred when translator fails to generate java files we
-     * need to close all open file handles include temporary files
-     * and java files.
+     *                        need to close all open file handles include temporary files
+     *                        and java files.
      * @throws IOException when failed to delete the temporary files
      */
     public void freeTemporaryResources(boolean isErrorOccurred)
@@ -1597,38 +1644,9 @@
      */
     public boolean getIsQualifiedAccessOrAddToImportList(
             JavaQualifiedTypeInfo importInfo) {
-        boolean isImportPkgEqualCurNodePkg;
-        if (importInfo.getClassInfo().contentEquals(
-                getGeneratedJavaClassName())) {
-            /*
-             * if the current class name is same as the attribute class name,
-             * then the attribute must be accessed in a qualified manner.
-             */
-            return true;
-        } else if (importInfo.getPkgInfo() != null) {
-            /*
-             * If the attribute type is having the package info, it is contender
-             * for import list and also need to check if it needs to be a
-             * qualified access.
-             */
-            isImportPkgEqualCurNodePkg = isImportPkgEqualCurNodePkg(importInfo);
-            if (!isImportPkgEqualCurNodePkg) {
-                /*
-                 * If the package of the attribute added is not same as the
-                 * current class package, then it must either be imported for
-                 * access or it must be a qualified access.
-                 */
-                boolean isImportAdded = getJavaImportData().addImportInfo(importInfo);
-                if (!isImportAdded) {
-                    /*
-                     * If the attribute type info is not imported, then it must
-                     * be a qualified access.
-                     */
-                    return true;
-                }
-            }
-        }
-        return false;
+
+        return getJavaImportData().addImportInfo(importInfo, getGeneratedJavaClassName(),
+                getJavaFileInfo().getPackage());
     }
 
     /**
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaServiceFragmentFiles.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaServiceFragmentFiles.java
index c41fdb0..f13e6a5 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaServiceFragmentFiles.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaServiceFragmentFiles.java
@@ -71,11 +71,11 @@
 import static org.onosproject.yangutils.utils.UtilConstants.SLASH;
 import static org.onosproject.yangutils.utils.UtilConstants.VOID;
 import static org.onosproject.yangutils.utils.io.impl.FileSystemUtil.createPackage;
-import static org.onosproject.yangutils.utils.io.impl.JavaDocGen.generateJavaDocForRpc;
-import static org.onosproject.yangutils.utils.io.impl.JavaDocGen.getJavaDoc;
 import static org.onosproject.yangutils.utils.io.impl.JavaDocGen.JavaDocType.ENUM_ATTRIBUTE;
 import static org.onosproject.yangutils.utils.io.impl.JavaDocGen.JavaDocType.GETTER_METHOD;
 import static org.onosproject.yangutils.utils.io.impl.JavaDocGen.JavaDocType.MANAGER_SETTER_METHOD;
+import static org.onosproject.yangutils.utils.io.impl.JavaDocGen.generateJavaDocForRpc;
+import static org.onosproject.yangutils.utils.io.impl.JavaDocGen.getJavaDoc;
 import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.insertDataIntoJavaFile;
 
 /**
@@ -119,6 +119,7 @@
      * File name for event subject setter temp file.
      */
     private static final String EVENT_SUBJECT_SETTER_FILE_NAME = "EventSubjectSetter";
+
     /**
      * File name for generated class file for service
      * suffix.
@@ -370,14 +371,13 @@
      * Constructs java code exit.
      *
      * @param fileType generated file type
-     * @param curNode current YANG node
+     * @param curNode  current YANG node
      * @throws IOException when fails to generate java files
      */
     @Override
     public void generateJavaFile(int fileType, YangNode curNode)
             throws IOException {
-        List<String> imports = new ArrayList<>();
-        imports = getJavaImportData().getImports();
+        List<String> imports = getJavaImportData().getImports();
 
         createPackage(curNode);
 
@@ -433,15 +433,16 @@
     /**
      * Adds rpc string information to applicable temp file.
      *
-     * @param javaAttributeInfoOfInput rpc's input node attribute info
+     * @param javaAttributeInfoOfInput  rpc's input node attribute info
      * @param javaAttributeInfoOfOutput rpc's output node attribute info
-     * @param rpcName name of the rpc function
-     * @param pluginConfig plugin configurations
+     * @param rpcName                   name of the rpc function
+     * @param pluginConfig              plugin configurations
      * @throws IOException IO operation fail
      */
     private void addRpcString(JavaAttributeInfo javaAttributeInfoOfInput,
             JavaAttributeInfo javaAttributeInfoOfOutput, YangPluginConfig pluginConfig,
-            String rpcName) throws IOException {
+            String rpcName)
+            throws IOException {
         String rpcInput = EMPTY_STRING;
         String rpcOutput = VOID;
         String rpcInputJavaDoc = EMPTY_STRING;
@@ -464,20 +465,21 @@
     /**
      * Adds rpc string information to applicable temp file.
      *
-     * @param javaAttributeInfoOfInput rpc's input node attribute info
+     * @param javaAttributeInfoOfInput  rpc's input node attribute info
      * @param javaAttributeInfoOfOutput rpc's output node attribute info
-     * @param rpcName name of the rpc function
-     * @param pluginConfig plugin configurations
-     * @param isInputLeafHolder if input node is leaf holder
-     * @param isOutputLeafHolder if output node is leaf holder
-     * @param isInputSingleChildHolder if input node is single child holder
+     * @param rpcName                   name of the rpc function
+     * @param pluginConfig              plugin configurations
+     * @param isInputLeafHolder         if input node is leaf holder
+     * @param isOutputLeafHolder        if output node is leaf holder
+     * @param isInputSingleChildHolder  if input node is single child holder
      * @param isOutputSingleChildHolder if input node is single child holder
      * @throws IOException IO operation fail
      */
     public void addRpcString(JavaAttributeInfo javaAttributeInfoOfInput,
             JavaAttributeInfo javaAttributeInfoOfOutput, YangPluginConfig pluginConfig,
             String rpcName, boolean isInputLeafHolder, boolean isOutputLeafHolder,
-            boolean isInputSingleChildHolder, boolean isOutputSingleChildHolder) throws IOException {
+            boolean isInputSingleChildHolder, boolean isOutputSingleChildHolder)
+            throws IOException {
         String rpcInput = EMPTY_STRING;
         String rpcOutput = VOID;
         String rpcInputJavaDoc = EMPTY_STRING;
@@ -504,10 +506,10 @@
     /**
      * Returns names for input and output.
      *
-     * @param attr attribute info
-     * @param isLeafHolder if leaf holder
+     * @param attr                attribute info
+     * @param isLeafHolder        if leaf holder
      * @param isSinglechildHolder if single child holder
-     * @param pluginConfig plugin configurations
+     * @param pluginConfig        plugin configurations
      * @return names for input and output
      */
     private String getInputOutputNames(JavaAttributeInfo attr, boolean isLeafHolder, boolean isSinglechildHolder,
@@ -550,13 +552,13 @@
     /**
      * Adds the JAVA rpc snippet information.
      *
-     * @param javaAttributeInfoOfInput rpc's input node attribute info
+     * @param javaAttributeInfoOfInput  rpc's input node attribute info
      * @param javaAttributeInfoOfOutput rpc's output node attribute info
-     * @param pluginConfig plugin configurations
-     * @param rpcName name of the rpc function
-     * @param isInputLeafHolder if input node is leaf holder
-     * @param isOutputLeafHolder if output node is leaf holder
-     * @param isInputSingleChildHolder if input node is single child holder
+     * @param pluginConfig              plugin configurations
+     * @param rpcName                   name of the rpc function
+     * @param isInputLeafHolder         if input node is leaf holder
+     * @param isOutputLeafHolder        if output node is leaf holder
+     * @param isInputSingleChildHolder  if input node is single child holder
      * @param isOutputSingleChildHolder if input node is single child holder
      * @throws IOException IO operation fail
      */
@@ -573,7 +575,7 @@
      * Constructs java code exit.
      *
      * @param fileType generated file type
-     * @param curNode current YANG node
+     * @param curNode  current YANG node
      * @throws IOException when fails to generate java files
      */
     public void generateEventJavaFile(int fileType, YangNode curNode)
@@ -604,7 +606,7 @@
      * Constructs java code exit.
      *
      * @param fileType generated file type
-     * @param curNode current YANG node
+     * @param curNode  current YANG node
      * @throws IOException when fails to generate java files
      */
     public void generateEventListenerJavaFile(int fileType, YangNode curNode)
@@ -632,7 +634,7 @@
      * Constructs java code exit.
      *
      * @param fileType generated file type
-     * @param curNode current YANG node
+     * @param curNode  current YANG node
      * @throws IOException when fails to generate java files
      */
     public void generateEventSubjectJavaFile(int fileType, YangNode curNode)
@@ -657,8 +659,8 @@
      * Removes all temporary file handles.
      *
      * @param isErrorOccurred when translator fails to generate java files we
-     * need to close all open file handles include temporary files
-     * and java files.
+     *                        need to close all open file handles include temporary files
+     *                        and java files.
      * @throws IOException when failed to delete the temporary files
      */
     @Override
@@ -782,17 +784,18 @@
     /**
      * Adds java snippet for events to event subject file.
      *
-     * @param curNode current node
+     * @param curNode      current node
      * @param pluginConfig plugin configurations
      * @throws IOException when fails to do IO operations
      */
-    public void addJavaSnippetOfEvent(YangNode curNode, YangPluginConfig pluginConfig) throws IOException {
+    public void addJavaSnippetOfEvent(YangNode curNode, YangPluginConfig pluginConfig)
+            throws IOException {
 
         String currentInfo = getCapitalCase(getCamelCase(((YangNotification) curNode).getName(),
                 pluginConfig.getConflictResolver()));
         String notificationName = ((YangNotification) curNode).getName();
 
-        JavaQualifiedTypeInfo qualifiedTypeInfo = getQualifiedTypeInfoOfCurNode(curNode.getParent(),
+        JavaQualifiedTypeInfo qualifiedTypeInfo = getQualifiedTypeInfoOfCurNode(curNode,
                 getCapitalCase(currentInfo));
 
         JavaAttributeInfo javaAttributeInfo =
@@ -807,14 +810,16 @@
     }
 
     /*Adds event to enum temp file.*/
-    private void addEventEnum(String notificationName, YangPluginConfig pluginConfig) throws IOException {
+    private void addEventEnum(String notificationName, YangPluginConfig pluginConfig)
+            throws IOException {
         appendToFile(getEventEnumTempFileHandle(),
                 getJavaDoc(ENUM_ATTRIBUTE, notificationName, false, pluginConfig) + FOUR_SPACE_INDENTATION
                         + getEnumJavaAttribute(notificationName).toUpperCase() + COMMA + NEW_LINE);
     }
 
     /*Adds event method in event class*/
-    private void addEnumMethod(String eventClassname, String className) throws IOException {
+    private void addEnumMethod(String eventClassname, String className)
+            throws IOException {
         appendToFile(getEventMethodTempFileHandle(), getEventFileContents(eventClassname, className));
     }
 
@@ -853,7 +858,8 @@
     }
 
     /*Adds getter method for event in event subject class.*/
-    private void addEventSubjectGetter(JavaAttributeInfo attr, YangPluginConfig pluginConfig) throws IOException {
+    private void addEventSubjectGetter(JavaAttributeInfo attr, YangPluginConfig pluginConfig)
+            throws IOException {
         appendToFile(getEventSubjectGetterTempFileHandle(),
                 getJavaDoc(GETTER_METHOD, getCapitalCase(attr.getAttributeName()), false, pluginConfig)
                         + getGetterForClass(attr, GENERATE_EVENT_SUBJECT_CLASS) + NEW_LINE);
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaTypeFragmentFiles.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaTypeFragmentFiles.java
index 2cbbb49..930b6b4 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaTypeFragmentFiles.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaTypeFragmentFiles.java
@@ -76,6 +76,7 @@
      * Temporary file handle for of string method of class.
      */
     private File ofStringImplTempFileHandle;
+
     /**
      * Temporary file handle for constructor for type class.
      */
@@ -85,6 +86,7 @@
      * Java file handle for typedef class file.
      */
     private File typedefClassJavaFileHandle;
+
     /**
      * Java file handle for type class like union, typedef file.
      */
@@ -211,7 +213,7 @@
                 YangJavaType<?> javaType = (YangJavaType<?>) yangType;
                 javaType.updateJavaQualifiedInfo(pluginConfig.getConflictResolver());
                 String typeName = javaType.getDataTypeName();
-                    typeName = getCamelCase(typeName, pluginConfig.getConflictResolver());
+                typeName = getCamelCase(typeName, pluginConfig.getConflictResolver());
                 JavaAttributeInfo javaAttributeInfo = getAttributeInfoForTheData(
                         javaType.getJavaQualifiedInfo(),
                         typeName, javaType,
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaGrouping.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaGrouping.java
index f647c0d..265caf6 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaGrouping.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaGrouping.java
@@ -24,14 +24,14 @@
 import org.onosproject.yangutils.translator.tojava.TempJavaCodeFragmentFiles;
 import org.onosproject.yangutils.translator.tojava.utils.YangPluginConfig;
 
-import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_INTERFACE_WITH_BUILDER;
-import static org.onosproject.yangutils.translator.tojava.utils.YangJavaModelUtils.generateCodeOfNode;
+import static org.onosproject.yangutils.translator.tojava.utils.YangJavaModelUtils.updatePackageInfo;
 
 /**
  * Represents grouping information extended to support java code generation.
  */
 public class YangJavaGrouping
-        extends YangGrouping implements JavaCodeGeneratorInfo, JavaCodeGenerator {
+        extends YangGrouping
+        implements JavaCodeGeneratorInfo, JavaCodeGenerator {
 
     /**
      * Contains the information of the java file being generated.
@@ -50,7 +50,6 @@
     public YangJavaGrouping() {
         super();
         setJavaFileInfo(new JavaFileInfo());
-        getJavaFileInfo().setGeneratedFileTypes(GENERATE_INTERFACE_WITH_BUILDER);
     }
 
     /**
@@ -96,35 +95,22 @@
         tempFileHandle = fileHandle;
     }
 
-    /**
-     * Prepare the information for java code generation corresponding to YANG
-     * grouping info.
-     *
-     * @param yangPlugin YANG plugin config
-     * @throws TranslatorException translator operation fail
-     */
+
     @Override
-    public void generateCodeEntry(YangPluginConfig yangPlugin) throws TranslatorException {
+    public void generateCodeEntry(YangPluginConfig yangPlugin)
+            throws TranslatorException {
         try {
-            generateCodeOfNode(this, yangPlugin);
+            updatePackageInfo(this, yangPlugin);
         } catch (IOException e) {
-            throw new TranslatorException(
-                    "Failed to prepare generate code entry for container node " + this.getName());
+            throw new TranslatorException(e.getCause());
         }
     }
 
-    /**
-     * Create a java file using the YANG grouping info.
-     *
-     * @throws TranslatorException translator operation fail
-     */
     @Override
-    public void generateCodeExit() throws TranslatorException {
-        try {
-            getTempJavaCodeFragmentFiles().generateJavaFile(GENERATE_INTERFACE_WITH_BUILDER, this);
-        } catch (IOException e) {
-            throw new TranslatorException("Failed to generate code for container node " + this.getName());
-        }
+    public void generateCodeExit()
+            throws TranslatorException {
+        /*
+         * Do nothing.
+         */
     }
-
 }
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaRpc.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaRpc.java
index c3bd23a..2bf1989 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaRpc.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaRpc.java
@@ -24,6 +24,7 @@
 import org.onosproject.yangutils.datamodel.YangLeaf;
 import org.onosproject.yangutils.datamodel.YangLeafList;
 import org.onosproject.yangutils.datamodel.YangLeavesHolder;
+import org.onosproject.yangutils.datamodel.YangList;
 import org.onosproject.yangutils.datamodel.YangNode;
 import org.onosproject.yangutils.datamodel.YangOutput;
 import org.onosproject.yangutils.datamodel.YangRpc;
@@ -40,10 +41,8 @@
 import org.onosproject.yangutils.translator.tojava.TempJavaFragmentFiles;
 import org.onosproject.yangutils.translator.tojava.utils.YangPluginConfig;
 
-import static org.onosproject.yangutils.datamodel.YangNodeType.LIST_NODE;
 import static org.onosproject.yangutils.translator.tojava.JavaAttributeInfo.getAttributeInfoForTheData;
 import static org.onosproject.yangutils.translator.tojava.JavaQualifiedTypeInfo.getQualifiedTypeInfoOfCurNode;
-import static org.onosproject.yangutils.translator.tojava.TempJavaFragmentFiles.resolveGroupingsQuailifiedInfo;
 import static org.onosproject.yangutils.translator.tojava.utils.AttributesJavaDataType.getJavaDataType;
 import static org.onosproject.yangutils.translator.tojava.utils.AttributesJavaDataType.getJavaImportClass;
 import static org.onosproject.yangutils.translator.tojava.utils.AttributesJavaDataType.getJavaImportPackage;
@@ -52,6 +51,13 @@
 import static org.onosproject.yangutils.translator.tojava.utils.JavaIdentifierSyntax.getPackageDirPathFromJavaJPackage;
 import static org.onosproject.yangutils.translator.tojava.utils.JavaIdentifierSyntax.getParentNodeInGenCode;
 import static org.onosproject.yangutils.translator.tojava.utils.YangJavaModelUtils.updatePackageInfo;
+import static org.onosproject.yangutils.utils.UtilConstants.ACTIVATE;
+import static org.onosproject.yangutils.utils.UtilConstants.COMPONENT;
+import static org.onosproject.yangutils.utils.UtilConstants.DEACTIVATE;
+import static org.onosproject.yangutils.utils.UtilConstants.MANAGER;
+import static org.onosproject.yangutils.utils.UtilConstants.REFERENCE;
+import static org.onosproject.yangutils.utils.UtilConstants.REFERENCE_CARDINALITY;
+import static org.onosproject.yangutils.utils.UtilConstants.SERVICE;
 import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.deleteDirectory;
 
 /**
@@ -126,7 +132,8 @@
      * @throws TranslatorException translator operations fails
      */
     @Override
-    public void generateCodeEntry(YangPluginConfig yangPlugin) throws TranslatorException {
+    public void generateCodeEntry(YangPluginConfig yangPlugin)
+            throws TranslatorException {
 
         if (!(this instanceof JavaCodeGeneratorInfo)) {
             // TODO:throw exception
@@ -152,7 +159,8 @@
      * @throws TranslatorException translator operations fails
      */
     @Override
-    public void generateCodeExit() throws TranslatorException {
+    public void generateCodeExit()
+            throws TranslatorException {
         // Get the parent module/sub-module.
         YangNode parent = getParentNodeInGenCode(this);
 
@@ -216,7 +224,15 @@
                     YangNode tempNode = node.getChild();
                     while (tempNode != null) {
                         if (tempNode instanceof YangUses) {
-                            deleteDirectoryWhenNoFileIsGeneratedForInputOutput(rpcsChildNodePkg);
+                            boolean isCodeGenerated = true;
+                            if (node instanceof YangJavaInput) {
+                                isCodeGenerated = ((YangJavaInput) node).isCodeGenFlag();
+                            } else if (node instanceof YangJavaOutput) {
+                                isCodeGenerated = ((YangJavaOutput) node).isCodeGenFlag();
+                            }
+                            if (!isCodeGenerated) {
+                                deleteDirectoryWhenNoFileIsGeneratedForInputOutput(rpcsChildNodePkg);
+                            }
                         }
                         tempNode = tempNode.getNextSibling();
                     }
@@ -236,7 +252,8 @@
      * @param emptyPkg empty package
      * @throws IOException when fails to do IO operations
      */
-    private void deleteDirectoryWhenNoFileIsGeneratedForInputOutput(String emptyPkg) throws IOException {
+    private void deleteDirectoryWhenNoFileIsGeneratedForInputOutput(String emptyPkg)
+            throws IOException {
         deleteDirectory(emptyPkg);
     }
 
@@ -244,8 +261,8 @@
      * Creates an attribute info object corresponding to a data model node and
      * return it.
      *
-     * @param childNode child data model node(input / output) for which the java code generation
-     * is being handled
+     * @param childNode   child data model node(input / output) for which the java code generation
+     *                    is being handled
      * @param currentNode parent node (module / sub-module) in which the child node is an attribute
      * @return AttributeInfo attribute details required to add in temporary
      * files
@@ -260,7 +277,7 @@
          * Get the import info corresponding to the attribute for import in
          * generated java files or qualified access
          */
-        JavaQualifiedTypeInfo qualifiedTypeInfo = getQualifiedTypeInfoOfCurNode(currentNode,
+        JavaQualifiedTypeInfo qualifiedTypeInfo = getQualifiedTypeInfoOfCurNode(childNode,
                 getCapitalCase(childNodeName));
         if (!(parentNode instanceof TempJavaCodeFragmentFilesContainer)) {
             throw new TranslatorException("Parent node does not have file info");
@@ -281,7 +298,7 @@
     /**
      * Process input/output nodes.
      *
-     * @param node YANG node
+     * @param node             YANG node
      * @param yangPluginConfig plugin configurations
      */
     private void processNodeEntry(YangNode node, YangPluginConfig yangPluginConfig) {
@@ -299,7 +316,11 @@
         } else if (node.getChild() != null && holder.getListOfLeaf().isEmpty()
                 && holder.getListOfLeafList().isEmpty()) {
             if (getNumberOfChildNodes(node) == 1) {
-                setCodeGenFlagForNode(node, false);
+                if (node.getChild() instanceof YangUses) {
+                    setCodeGenFlagForNode(node, getCodeGenFlagWhenUsesIsAChildNode(node));
+                } else {
+                    setCodeGenFlagForNode(node, false);
+                }
             } else {
                 setCodeGenFlagForNode(node, true);
             }
@@ -308,10 +329,37 @@
         }
     }
 
+    /*Returns code gen flag when uses is a child node.*/
+    private boolean getCodeGenFlagWhenUsesIsAChildNode(YangNode node) {
+        YangUses uses = (YangUses) node.getChild();
+
+        List<YangNode> groupingChildResolvedNodes = uses.getUsesResolvedNodeList();
+        List<List<YangLeaf>> groupingChildResolvedLeaves = uses.getUsesResolvedLeavesList();
+        List<List<YangLeafList>> groupingChildResolvedLeafList = uses.getUsesResolvedListOfLeafList();
+
+        if (!groupingChildResolvedNodes.isEmpty()
+                && groupingChildResolvedNodes.size() == 1
+                && groupingChildResolvedLeaves.isEmpty()
+                && groupingChildResolvedLeafList.isEmpty()) {
+            return false;
+        } else if (groupingChildResolvedNodes.isEmpty()
+                && isOnlyOneLeafPresentInGrouping(groupingChildResolvedLeaves)
+                && groupingChildResolvedLeafList.isEmpty()) {
+            return false;
+        } else if (groupingChildResolvedNodes.isEmpty()
+                && groupingChildResolvedLeaves.isEmpty()
+                && isOnlyOneLeafListPresentInGrouping(groupingChildResolvedLeafList)) {
+            return false;
+        }
+        return (groupingChildResolvedNodes.isEmpty()
+                && groupingChildResolvedLeaves.isEmpty()
+                && groupingChildResolvedLeafList.isEmpty());
+    }
+
     /**
      * Process input/output nodes.
      *
-     * @param node YANG node
+     * @param node             YANG node
      * @param yangPluginConfig plugin configurations
      * @return java attribute info
      */
@@ -343,7 +391,7 @@
     /**
      * Process input/output node when one leaf is present.
      *
-     * @param node input/output node
+     * @param node             input/output node
      * @param yangPluginConfig plugin configurations
      * @return java attribute for node
      */
@@ -351,30 +399,15 @@
             YangPluginConfig yangPluginConfig) {
 
         YangLeavesHolder holder = (YangLeavesHolder) node;
-        List<YangLeaf> listOfLeaves = holder.getListOfLeaf();
-
-        for (YangLeaf leaf : listOfLeaves) {
-            if (!(leaf instanceof JavaLeafInfoContainer)) {
-                throw new TranslatorException("Leaf does not have java information");
-            }
-            JavaLeafInfoContainer javaLeaf = (JavaLeafInfoContainer) leaf;
-            javaLeaf.setConflictResolveConfig(yangPluginConfig.getConflictResolver());
-            javaLeaf.updateJavaQualifiedInfo();
-            JavaAttributeInfo javaAttributeInfo = getAttributeInfoForTheData(
-                    javaLeaf.getJavaQualifiedInfo(),
-                    javaLeaf.getJavaName(yangPluginConfig.getConflictResolver()),
-                    javaLeaf.getDataType(),
-                    addTypeImport(javaLeaf.getDataType(), false, yangPluginConfig), false);
-            setLeafHolderFlag(node, true);
-            return javaAttributeInfo;
-        }
-        return null;
+        YangLeaf leaf = holder.getListOfLeaf().get(0);
+        setLeafHolderFlag(node, true);
+        return getAttributeInfoForLeaf(leaf, yangPluginConfig);
     }
 
     /**
      * Process input/output node when one leaf list is present.
      *
-     * @param node input/output node
+     * @param node             input/output node
      * @param yangPluginConfig plugin configurations
      * @return java attribute for node
      */
@@ -382,33 +415,57 @@
             YangPluginConfig yangPluginConfig) {
 
         YangLeavesHolder holder = (YangLeavesHolder) node;
-        List<YangLeafList> listOfLeafList = holder.getListOfLeafList();
+        YangLeafList leafList = holder.getListOfLeafList().get(0);
+        setLeafHolderFlag(node, true);
+        return getAttributeInfoForLeafList(leafList, yangPluginConfig);
+    }
 
-        for (YangLeafList leafList : listOfLeafList) {
-            if (!(leafList instanceof JavaLeafInfoContainer)) {
-                throw new TranslatorException("Leaf-list does not have java information");
-            }
-            JavaLeafInfoContainer javaLeaf = (JavaLeafInfoContainer) leafList;
-            javaLeaf.setConflictResolveConfig(yangPluginConfig.getConflictResolver());
-            javaLeaf.updateJavaQualifiedInfo();
-            ((TempJavaCodeFragmentFilesContainer) this.getParent()).getTempJavaCodeFragmentFiles()
-                    .getServiceTempFiles().getJavaImportData().setIfListImported(true);
-            JavaAttributeInfo javaAttributeInfo = getAttributeInfoForTheData(
-                    javaLeaf.getJavaQualifiedInfo(),
-                    javaLeaf.getJavaName(yangPluginConfig.getConflictResolver()),
-                    javaLeaf.getDataType(),
-                    addTypeImport(javaLeaf.getDataType(), true, yangPluginConfig),
-                    true);
-            setLeafHolderFlag(node, true);
-            return javaAttributeInfo;
-        }
-        return null;
+    /**
+     * Returns java attribute info for leaf.
+     *
+     * @param leaf             YANG leaf
+     * @param yangPluginConfig plugin configurations
+     * @return java attribute info for leaf
+     */
+    private JavaAttributeInfo getAttributeInfoForLeaf(YangLeaf leaf, YangPluginConfig yangPluginConfig) {
+        JavaLeafInfoContainer javaLeaf = (JavaLeafInfoContainer) leaf;
+        javaLeaf.setConflictResolveConfig(yangPluginConfig.getConflictResolver());
+        javaLeaf.updateJavaQualifiedInfo();
+        JavaAttributeInfo javaAttributeInfo = getAttributeInfoForTheData(
+                javaLeaf.getJavaQualifiedInfo(),
+                javaLeaf.getJavaName(yangPluginConfig.getConflictResolver()),
+                javaLeaf.getDataType(),
+                addTypeImport(javaLeaf.getDataType(), false, yangPluginConfig), false);
+        return javaAttributeInfo;
+    }
+
+    /**
+     * Returns java attribute info for leaf list.
+     *
+     * @param leafList         YANG leaf list
+     * @param yangPluginConfig plugin configurations
+     * @return java attribute info for leaf list
+     */
+    private JavaAttributeInfo getAttributeInfoForLeafList(YangLeafList leafList,
+            YangPluginConfig yangPluginConfig) {
+        JavaLeafInfoContainer javaLeaf = (JavaLeafInfoContainer) leafList;
+        javaLeaf.setConflictResolveConfig(yangPluginConfig.getConflictResolver());
+        javaLeaf.updateJavaQualifiedInfo();
+        ((TempJavaCodeFragmentFilesContainer) this.getParent()).getTempJavaCodeFragmentFiles()
+                .getServiceTempFiles().getJavaImportData().setIfListImported(true);
+        JavaAttributeInfo javaAttributeInfo = getAttributeInfoForTheData(
+                javaLeaf.getJavaQualifiedInfo(),
+                javaLeaf.getJavaName(yangPluginConfig.getConflictResolver()),
+                javaLeaf.getDataType(),
+                addTypeImport(javaLeaf.getDataType(), true, yangPluginConfig),
+                true);
+        return javaAttributeInfo;
     }
 
     /**
      * Process input/output node when one child node is present.
      *
-     * @param node input/output node
+     * @param node             input/output node
      * @param yangPluginConfig plugin configurations
      * @return java attribute for node
      */
@@ -418,10 +475,8 @@
         String clsInfo = "";
         JavaQualifiedTypeInfo childInfo = new JavaQualifiedTypeInfo();
         if (node.getChild() instanceof YangJavaUses) {
-            childInfo = resolveGroupingsQuailifiedInfo(((YangJavaUses) node.getChild()).getRefGroup(),
-                    yangPluginConfig);
-            clsInfo = getCapitalCase(getCamelCase(((YangJavaUses) node.getChild()).getRefGroup().getName(),
-                    yangPluginConfig.getConflictResolver()));
+            YangJavaUses uses = (YangJavaUses) node.getChild();
+            return processNodeWhenUsesIsChild(uses, node, yangPluginConfig);
         } else {
             String pkg = (rpcInfo.getPackage() + "." + rpcInfo.getJavaName() + "."
                     + getCamelCase(node.getName(), yangPluginConfig.getConflictResolver())).toLowerCase();
@@ -431,7 +486,7 @@
             childInfo.setClassInfo(clsInfo);
         }
         boolean isList = false;
-        if (node.getChild().getNodeType().equals(LIST_NODE)) {
+        if (node.getChild() instanceof YangList) {
             isList = true;
         }
         boolean isQualified = addImportToService(childInfo);
@@ -445,6 +500,88 @@
     }
 
     /**
+     * Returns java attribute info when child node is uses.
+     *
+     * @param uses             YANG uses node
+     * @param node             YANG node
+     * @param yangPluginConfig plugin configurations
+     * @return java attribute info when child node is uses
+     */
+    private JavaAttributeInfo processNodeWhenUsesIsChild(YangUses uses, YangNode node,
+            YangPluginConfig yangPluginConfig) {
+        String clsInfo = "";
+        JavaQualifiedTypeInfo childInfo = new JavaQualifiedTypeInfo();
+        List<YangNode> groupingChildResolvedNodes = uses.getUsesResolvedNodeList();
+        List<List<YangLeaf>> groupingChildResolvedLeaves = uses.getUsesResolvedLeavesList();
+        List<List<YangLeafList>> groupingChildResolvedLeafList = uses.getUsesResolvedListOfLeafList();
+
+        if (!groupingChildResolvedNodes.isEmpty()
+                && groupingChildResolvedNodes.size() == 1
+                && groupingChildResolvedLeaves.isEmpty()
+                && groupingChildResolvedLeafList.isEmpty()) {
+            YangNode childNodeOfGrouping = groupingChildResolvedNodes.get(0);
+            boolean isList = false;
+            if (childNodeOfGrouping instanceof YangList) {
+                isList = true;
+            }
+            JavaFileInfo childNodeOfGroupingInfo =
+                    ((JavaFileInfoContainer) childNodeOfGrouping).getJavaFileInfo();
+            childInfo.setClassInfo(getCapitalCase(childNodeOfGroupingInfo.getJavaName()));
+            childInfo.setPkgInfo(childNodeOfGroupingInfo.getPackage());
+            clsInfo = childInfo.getClassInfo();
+            boolean isQualified = addImportToService(childInfo);
+            setLeafHolderFlag(node, false);
+            setSingleChildHolderFlag(node, true);
+            return getAttributeInfoForTheData(childInfo, clsInfo, null, isQualified, isList);
+
+        } else if (groupingChildResolvedNodes.isEmpty()
+                && isOnlyOneLeafPresentInGrouping(groupingChildResolvedLeaves)
+                && groupingChildResolvedLeafList.isEmpty()) {
+
+            YangLeaf leaf = groupingChildResolvedLeaves.get(0).get(0);
+            setLeafHolderFlag(node, true);
+            return getAttributeInfoForLeaf(leaf, yangPluginConfig);
+
+        } else if (groupingChildResolvedNodes.isEmpty()
+                && groupingChildResolvedLeaves.isEmpty()
+                && isOnlyOneLeafListPresentInGrouping(groupingChildResolvedLeafList)) {
+            YangLeafList leafList = groupingChildResolvedLeafList.get(0).get(0);
+            setLeafHolderFlag(node, true);
+            return getAttributeInfoForLeafList(leafList, yangPluginConfig);
+
+        } else if (groupingChildResolvedNodes.isEmpty()
+                && groupingChildResolvedLeaves.isEmpty()
+                && groupingChildResolvedLeafList.isEmpty()) {
+            return null;
+        } else {
+            return processNodeWhenMultipleContaintsArePresent(node);
+        }
+    }
+
+    /*Return true if only one leaf is present in grouping node.*/
+    private boolean isOnlyOneLeafPresentInGrouping(List<List<YangLeaf>> groupingChildResolvedLeaves) {
+        if (!groupingChildResolvedLeaves.isEmpty() &&
+                groupingChildResolvedLeaves.size() == 1) {
+            List<YangLeaf> leaves = groupingChildResolvedLeaves.get(0);
+            return leaves.size() == 1;
+        } else {
+            return false;
+        }
+    }
+
+    /*Returns true is only one leaf list is present in grouping node.*/
+    private boolean isOnlyOneLeafListPresentInGrouping(List<List<YangLeafList>> groupingChildResolvedLeafList) {
+
+        if (!groupingChildResolvedLeafList.isEmpty() &&
+                groupingChildResolvedLeafList.size() == 1) {
+            List<YangLeafList> leaves = groupingChildResolvedLeafList.get(0);
+            return leaves.size() == 1;
+        } else {
+            return false;
+        }
+    }
+
+    /**
      * Process input/output node when multiple leaf and child nodes are present.
      *
      * @param node input/output node
@@ -460,8 +597,8 @@
     /**
      * Adds type import to the RPC import list.
      *
-     * @param type YANG type
-     * @param isList is list attribute
+     * @param type         YANG type
+     * @param isList       is list attribute
      * @param pluginConfig plugin configurations
      * @return type import to the RPC import list
      */
@@ -492,13 +629,26 @@
      * @return true or false
      */
     private boolean addImportToService(JavaQualifiedTypeInfo importInfo) {
-        if (((TempJavaCodeFragmentFilesContainer) this.getParent()).getTempJavaCodeFragmentFiles()
-                .getServiceTempFiles().getJavaImportData().addImportInfo(importInfo)) {
-            return !((TempJavaCodeFragmentFilesContainer) this.getParent()).getTempJavaCodeFragmentFiles()
-                    .getServiceTempFiles().getJavaImportData().getImportSet().contains(importInfo);
-        } else {
+        JavaFileInfo fileInfo = ((JavaFileInfoContainer) this.getParent()).getJavaFileInfo();
+
+        if (importInfo.getClassInfo().contentEquals(SERVICE)
+                || importInfo.getClassInfo().contentEquals(COMPONENT)
+                || importInfo.getClassInfo().contentEquals(getCapitalCase(ACTIVATE))
+                || importInfo.getClassInfo().contentEquals(getCapitalCase(DEACTIVATE))
+                || importInfo.getClassInfo().contentEquals(REFERENCE_CARDINALITY)
+                || importInfo.getClassInfo().contentEquals(REFERENCE)
+                || importInfo.getClassInfo().contentEquals(getCapitalCase(fileInfo.getJavaName() + SERVICE))
+                || importInfo.getClassInfo().contentEquals(getCapitalCase(fileInfo.getJavaName() + MANAGER))) {
             return true;
         }
+
+        String className;
+        className = getCapitalCase(fileInfo.getJavaName()) + "Service";
+
+        return ((TempJavaCodeFragmentFilesContainer) this.getParent()).getTempJavaCodeFragmentFiles()
+                .getServiceTempFiles().getJavaImportData().addImportInfo(importInfo,
+                        className, fileInfo.getPackage());
+
     }
 
     /**
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaUses.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaUses.java
index f2d2ada..f000b99 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaUses.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaUses.java
@@ -16,7 +16,12 @@
 package org.onosproject.yangutils.translator.tojava.javamodel;
 
 import java.io.IOException;
+import java.util.List;
 
+import org.onosproject.yangutils.datamodel.YangGrouping;
+import org.onosproject.yangutils.datamodel.YangLeaf;
+import org.onosproject.yangutils.datamodel.YangLeafList;
+import org.onosproject.yangutils.datamodel.YangNode;
 import org.onosproject.yangutils.datamodel.YangUses;
 import org.onosproject.yangutils.translator.exception.TranslatorException;
 import org.onosproject.yangutils.translator.tojava.JavaCodeGenerator;
@@ -24,15 +29,16 @@
 import org.onosproject.yangutils.translator.tojava.TempJavaCodeFragmentFiles;
 import org.onosproject.yangutils.translator.tojava.utils.YangPluginConfig;
 
-import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_INTERFACE_WITH_BUILDER;
-import static org.onosproject.yangutils.translator.tojava.TempJavaFragmentFiles.addCurNodeInfoInParentTempFile;
+import static org.onosproject.yangutils.translator.tojava.TempJavaFragmentFiles.addCurNodeAsAttributeInTargetTempFile;
+import static org.onosproject.yangutils.translator.tojava.utils.JavaIdentifierSyntax.getParentNodeInGenCode;
+import static org.onosproject.yangutils.translator.tojava.utils.YangJavaModelUtils.updatePackageInfo;
 
 /**
  * Represents uses information extended to support java code generation.
  */
 public class YangJavaUses
-        extends YangUses implements JavaCodeGeneratorInfo, JavaCodeGenerator {
-
+        extends YangUses
+        implements JavaCodeGeneratorInfo, JavaCodeGenerator {
 
     /**
      * Contains the information of the java file being generated.
@@ -51,7 +57,6 @@
     public YangJavaUses() {
         super();
         setJavaFileInfo(new JavaFileInfo());
-        getJavaFileInfo().setGeneratedFileTypes(GENERATE_INTERFACE_WITH_BUILDER);
     }
 
     /**
@@ -97,31 +102,57 @@
         tempFileHandle = fileHandle;
     }
 
-    /**
-     * Prepare the information for java code generation corresponding to YANG
-     * uses info.
-     *
-     * @param yangPlugin YANG plugin config
-     * @throws TranslatorException translator operation fail
-     */
+
     @Override
-    public void generateCodeEntry(YangPluginConfig yangPlugin) throws TranslatorException {
+    public void generateCodeEntry(YangPluginConfig yangPlugin)
+            throws TranslatorException {
         try {
-            addCurNodeInfoInParentTempFile(this, false, yangPlugin);
+            updatePackageInfo(this, yangPlugin);
+
+            if (!(getParentNodeInGenCode(this) instanceof JavaCodeGeneratorInfo)) {
+                throw new TranslatorException("invalid container of uses");
+            }
+            JavaCodeGeneratorInfo javaCodeGeneratorInfo = (JavaCodeGeneratorInfo) getParentNodeInGenCode(this);
+
+            if (javaCodeGeneratorInfo instanceof YangGrouping) {
+                /*
+                 * Do nothing, since it will taken care in the groupings uses.
+                 */
+                return;
+            }
+
+            for (List<YangLeaf> leavesList :
+                    getUsesResolvedLeavesList()) {
+                //add the resolved leaves to the parent as an attribute
+                javaCodeGeneratorInfo.getTempJavaCodeFragmentFiles()
+                        .getBeanTempFiles().addLeavesInfoToTempFiles(leavesList, yangPlugin);
+            }
+
+            for (List<YangLeafList> listOfLeafLists :
+                    getUsesResolvedListOfLeafList()) {
+                //add the resolved leaf-list to the parent as an attribute
+                javaCodeGeneratorInfo.getTempJavaCodeFragmentFiles()
+                        .getBeanTempFiles().addLeafListInfoToTempFiles(listOfLeafLists, yangPlugin);
+            }
+
+            for (YangNode usesResolvedNode :
+                    getUsesResolvedNodeList()) {
+                //add the resolved nodes to the parent as an attribute
+                addCurNodeAsAttributeInTargetTempFile(usesResolvedNode, yangPlugin,
+                        getParentNodeInGenCode(this));
+            }
+
         } catch (IOException e) {
-            throw new TranslatorException(
-                    "Failed to prepare generate code entry for container node " + this.getName());
+            throw new TranslatorException(e.getCause());
         }
     }
 
-    /**
-     * Create a java file using the YANG uses info.
-     *
-     * @throws TranslatorException translator operation fail
-     */
-    @Override
-    public void generateCodeExit() throws TranslatorException {
-        // no code generation will be done for uses.
-    }
 
+    @Override
+    public void generateCodeExit()
+            throws TranslatorException {
+        /*
+         * Do nothing.
+         */
+    }
 }
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/translator/tojava/utils/AttributesJavaDataType.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/translator/tojava/utils/AttributesJavaDataType.java
index 9e7cc5c..19ed11d 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/translator/tojava/utils/AttributesJavaDataType.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/translator/tojava/utils/AttributesJavaDataType.java
@@ -16,6 +16,8 @@
 
 package org.onosproject.yangutils.translator.tojava.utils;
 
+import java.util.Stack;
+
 import org.onosproject.yangutils.datamodel.YangDataTypes;
 import org.onosproject.yangutils.datamodel.YangDerivedInfo;
 import org.onosproject.yangutils.datamodel.YangEnumeration;
@@ -26,6 +28,7 @@
 import org.onosproject.yangutils.translator.exception.TranslatorException;
 import org.onosproject.yangutils.translator.tojava.JavaFileInfo;
 import org.onosproject.yangutils.translator.tojava.JavaFileInfoContainer;
+import org.onosproject.yangutils.translator.tojava.javamodel.JavaCodeGeneratorInfo;
 import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaEnumeration;
 import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaModule;
 import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaSubModule;
@@ -34,6 +37,8 @@
 
 import static org.onosproject.yangutils.translator.tojava.utils.JavaIdentifierSyntax.getCamelCase;
 import static org.onosproject.yangutils.translator.tojava.utils.JavaIdentifierSyntax.getCapitalCase;
+import static org.onosproject.yangutils.translator.tojava.utils.JavaIdentifierSyntax.getCurNodePackage;
+import static org.onosproject.yangutils.translator.tojava.utils.JavaIdentifierSyntax.getPackageDirPathFromJavaJPackage;
 import static org.onosproject.yangutils.translator.tojava.utils.JavaIdentifierSyntax.getRootPackage;
 import static org.onosproject.yangutils.utils.UtilConstants.BIG_INTEGER;
 import static org.onosproject.yangutils.utils.UtilConstants.BOOLEAN_DATA_TYPE;
@@ -119,7 +124,7 @@
      * Returns from string method parsed string.
      *
      * @param targetDataType target data type
-     * @param yangType YANG type
+     * @param yangType       YANG type
      * @return parsed string
      */
     public static String getParseFromStringMethod(String targetDataType, YangType<?> yangType) {
@@ -163,8 +168,8 @@
     /**
      * Returns java import class.
      *
-     * @param yangType YANG type
-     * @param isListAttr if the attribute need to be a list
+     * @param yangType     YANG type
+     * @param isListAttr   if the attribute need to be a list
      * @param pluginConfig plugin configurations
      * @return java import class
      */
@@ -199,8 +204,8 @@
                     return BOOLEAN_WRAPPER;
                 case ENUMERATION:
                     return getCapitalCase(
-                        getCamelCase(((YangJavaEnumeration) yangType.getDataTypeExtendedInfo()).getName(),
-                                pluginConfig));
+                            getCamelCase(((YangJavaEnumeration) yangType.getDataTypeExtendedInfo()).getName(),
+                                    pluginConfig));
                 case BITS:
                     return YANG_BITS_CLASS;
                 case BINARY:
@@ -215,13 +220,13 @@
                     return BOOLEAN_WRAPPER;
                 case UNION:
                     return getCapitalCase(getCamelCase(((YangJavaUnion) yangType.getDataTypeExtendedInfo()).getName(),
-                        pluginConfig));
+                            pluginConfig));
                 case INSTANCE_IDENTIFIER:
                     //TODO:INSTANCE_IDENTIFIER
                     break;
                 case DERIVED:
-                return getCapitalCase(
-                        getCamelCase(yangType.getDataTypeName(), pluginConfig));
+                    return getCapitalCase(
+                            getCamelCase(yangType.getDataTypeName(), pluginConfig));
                 default:
                     throw new TranslatorException("given data type is not supported.");
             }
@@ -235,8 +240,8 @@
                     return STRING_DATA_TYPE;
                 case ENUMERATION:
                     return getCapitalCase(
-                        getCamelCase(((YangJavaEnumeration) yangType.getDataTypeExtendedInfo()).getName(),
-                                pluginConfig));
+                            getCamelCase(((YangJavaEnumeration) yangType.getDataTypeExtendedInfo()).getName(),
+                                    pluginConfig));
                 case BITS:
                     return YANG_BITS_CLASS;
                 case BINARY:
@@ -251,13 +256,13 @@
                     return BOOLEAN_DATA_TYPE;
                 case UNION:
                     return getCapitalCase(getCamelCase(((YangJavaUnion) yangType.getDataTypeExtendedInfo()).getName(),
-                        pluginConfig));
+                            pluginConfig));
                 case INSTANCE_IDENTIFIER:
                     //TODO:INSTANCE_IDENTIFIER
                     break;
                 case DERIVED:
-                return getCapitalCase(
-                        getCamelCase(yangType.getDataTypeName(), pluginConfig));
+                    return getCapitalCase(
+                            getCamelCase(yangType.getDataTypeName(), pluginConfig));
                 default:
                     return null;
             }
@@ -268,8 +273,8 @@
     /**
      * Returns java import package.
      *
-     * @param yangType YANG type
-     * @param isListAttr if the attribute is of list type
+     * @param yangType         YANG type
+     * @param isListAttr       if the attribute is of list type
      * @param conflictResolver object of YANG to java naming conflict util
      * @return java import package
      */
@@ -352,7 +357,7 @@
     /**
      * Returns java package for typedef node.
      *
-     * @param type YANG type
+     * @param type             YANG type
      * @param conflictResolver object of YANG to java naming conflict util
      * @return java package for typedef node
      */
@@ -376,7 +381,7 @@
     /**
      * Returns java package for union node.
      *
-     * @param type YANG type
+     * @param type             YANG type
      * @param conflictResolver object of YANG to java naming conflict util
      * @return java package for union node
      */
@@ -396,7 +401,7 @@
     /**
      * Returns YANG enumeration's java package.
      *
-     * @param type YANG type
+     * @param type             YANG type
      * @param conflictResolver object of YANG to java naming conflict util
      * @return YANG enumeration's java package
      */
@@ -415,29 +420,87 @@
     /**
      * Returns package from parent node.
      *
-     * @param parent parent YANG node
+     * @param parent           parent YANG node
      * @param conflictResolver object of YANG to java naming conflict util
      * @return java package from parent node
      */
-    private static String getPackageFromParent(YangNode parent, YangToJavaNamingConflictUtil conflictResolver) {
+    private static String getPackageFromParent(YangNode parent,
+            YangToJavaNamingConflictUtil conflictResolver) {
         if (!(parent instanceof JavaFileInfoContainer)) {
             throw new TranslatorException("invalid child node is being processed.");
         }
         JavaFileInfo parentInfo = ((JavaFileInfoContainer) parent).getJavaFileInfo();
         if (parentInfo.getPackage() == null) {
-            if (parent instanceof YangJavaModule) {
-                YangJavaModule module = (YangJavaModule) parent;
-                String modulePkg = getRootPackage(module.getVersion(), module.getNameSpace().getUri(), module
-                        .getRevision().getRevDate(), conflictResolver);
-                return modulePkg + PERIOD + getCamelCase(module.getName(), conflictResolver).toLowerCase();
-            } else if (parent instanceof YangJavaSubModule) {
-                YangJavaSubModule submodule = (YangJavaSubModule) parent;
-                String subModulePkg = getRootPackage(submodule.getVersion(),
-                        submodule.getNameSpaceFromModule(submodule.getBelongsTo()),
-                        submodule.getRevision().getRevDate(), conflictResolver);
-                return subModulePkg + PERIOD + getCamelCase(submodule.getName(), conflictResolver).toLowerCase();
-            }
+            updateJavaFileInfo(parent, conflictResolver);
         }
         return parentInfo.getPackage() + PERIOD + parentInfo.getJavaName().toLowerCase();
     }
+
+    /**
+     * Update the referred data model nodes java file info, this will be called,
+     * when the linked node is yet to translate. Then resolve until the parent hierarchy.
+     *
+     * @param yangNode         node whose java info needs to be updated
+     * @param conflictResolver yang plugin config
+     */
+    public static void updateJavaFileInfo(YangNode yangNode,
+            YangToJavaNamingConflictUtil conflictResolver) {
+        Stack<YangNode> nodesToUpdatePackage = new Stack<YangNode>();
+
+        /*
+         * Add the nodes to be updated for package info in a stack.
+         */
+        while (yangNode != null
+                && ((JavaFileInfoContainer) yangNode)
+                .getJavaFileInfo().getPackage() == null) {
+            nodesToUpdatePackage.push(yangNode);
+            yangNode = yangNode.getParent();
+        }
+
+        /*
+         * If the package is not updated till root node, then root package needs to
+         * be updated.
+         */
+        if (yangNode == null) {
+            yangNode = nodesToUpdatePackage.pop();
+            String pkg;
+            if (yangNode instanceof YangJavaModule) {
+                YangJavaModule module = (YangJavaModule) yangNode;
+                pkg = getRootPackage(module.getVersion(), module.getNameSpace().getUri(), module
+                        .getRevision().getRevDate(), conflictResolver);
+            } else if (yangNode instanceof YangJavaSubModule) {
+                YangJavaSubModule submodule = (YangJavaSubModule) yangNode;
+                pkg = getRootPackage(submodule.getVersion(),
+                        submodule.getNameSpaceFromModule(submodule.getBelongsTo()),
+                        submodule.getRevision().getRevDate(), conflictResolver);
+            } else {
+                throw new TranslatorException("Invalid root node of data model tree");
+            }
+
+            ((JavaCodeGeneratorInfo) yangNode).getJavaFileInfo()
+                    .setJavaName(getCamelCase(yangNode.getName(), conflictResolver));
+            ((JavaCodeGeneratorInfo) yangNode).getJavaFileInfo()
+                    .setPackage(pkg);
+            ((JavaCodeGeneratorInfo) yangNode).getJavaFileInfo()
+                    .setPackageFilePath(getPackageDirPathFromJavaJPackage(
+                            ((JavaCodeGeneratorInfo) yangNode).getJavaFileInfo()
+                                    .getPackage()));
+        }
+
+        /**
+         * Parent of the node in stack is updated with java info,
+         * all the nodes can be popped and updated
+         */
+        while (nodesToUpdatePackage.size() != 0) {
+            yangNode = nodesToUpdatePackage.pop();
+            ((JavaCodeGeneratorInfo) yangNode).getJavaFileInfo()
+                    .setJavaName(getCamelCase(yangNode.getName(), conflictResolver));
+            ((JavaCodeGeneratorInfo) yangNode).getJavaFileInfo()
+                    .setPackage(getCurNodePackage(yangNode));
+            ((JavaCodeGeneratorInfo) yangNode).getJavaFileInfo()
+                    .setPackageFilePath(getPackageDirPathFromJavaJPackage(
+                            ((JavaCodeGeneratorInfo) yangNode).getJavaFileInfo()
+                                    .getPackage()));
+        }
+    }
 }
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/translator/tojava/utils/JavaExtendsListHolder.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/translator/tojava/utils/JavaExtendsListHolder.java
index 3ee83fd..36986b8 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/translator/tojava/utils/JavaExtendsListHolder.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/translator/tojava/utils/JavaExtendsListHolder.java
@@ -27,6 +27,7 @@
 import org.onosproject.yangutils.translator.tojava.JavaImportData;
 import org.onosproject.yangutils.translator.tojava.JavaQualifiedTypeInfo;
 
+import static org.onosproject.yangutils.translator.tojava.utils.JavaIdentifierSyntax.getCapitalCase;
 import static org.onosproject.yangutils.translator.tojava.utils.TempJavaCodeFragmentFilesUtils.getTempJavaFragement;
 
 /**
@@ -58,7 +59,7 @@
     /**
      * Sets extends list.
      *
-     * @param extendsList list of classes need to be extended
+     * @param extendedClass map of classes need to be extended
      */
     private void setExtendedClassStore(Map<JavaQualifiedTypeInfo, Boolean> extendedClass) {
         this.extendedClassStore = extendedClass;
@@ -73,14 +74,13 @@
     public void addToExtendsList(JavaQualifiedTypeInfo info, YangNode node) {
         JavaFileInfo fileInfo = ((JavaFileInfoContainer) node).getJavaFileInfo();
 
-        if (!fileInfo.getPackage().equals(info.getPkgInfo())) {
-            JavaImportData importData = getTempJavaFragement(node).getJavaImportData();
-            importData.addImportInfo(info);
+        JavaImportData importData = getTempJavaFragement(node).getJavaImportData();
+        boolean qualified = importData.addImportInfo(info,
+                getCapitalCase(fileInfo.getJavaName()), fileInfo.getPackage());
 
             /*true means import should be added*/
-            getExtendedClassStore().put(info, true);
-        }
-        getExtendedClassStore().put(info, false);
+        getExtendedClassStore().put(info, qualified);
+
         addToExtendsList(info);
     }
 
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/translator/tojava/utils/JavaFileGeneratorUtils.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/translator/tojava/utils/JavaFileGeneratorUtils.java
index 0b951db..0ecc49e 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/translator/tojava/utils/JavaFileGeneratorUtils.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/translator/tojava/utils/JavaFileGeneratorUtils.java
@@ -83,7 +83,6 @@
 import static org.onosproject.yangutils.utils.UtilConstants.SLASH;
 import static org.onosproject.yangutils.utils.UtilConstants.SPACE;
 import static org.onosproject.yangutils.utils.UtilConstants.TRUE;
-import static org.onosproject.yangutils.utils.io.impl.JavaDocGen.getJavaDoc;
 import static org.onosproject.yangutils.utils.io.impl.JavaDocGen.JavaDocType.BUILDER_CLASS;
 import static org.onosproject.yangutils.utils.io.impl.JavaDocGen.JavaDocType.BUILDER_INTERFACE;
 import static org.onosproject.yangutils.utils.io.impl.JavaDocGen.JavaDocType.ENUM_CLASS;
@@ -94,6 +93,7 @@
 import static org.onosproject.yangutils.utils.io.impl.JavaDocGen.JavaDocType.INTERFACE;
 import static org.onosproject.yangutils.utils.io.impl.JavaDocGen.JavaDocType.RPC_INTERFACE;
 import static org.onosproject.yangutils.utils.io.impl.JavaDocGen.JavaDocType.RPC_MANAGER;
+import static org.onosproject.yangutils.utils.io.impl.JavaDocGen.getJavaDoc;
 import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.insertDataIntoJavaFile;
 import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.parsePkg;
 
@@ -111,10 +111,10 @@
     /**
      * Returns a file object for generated file.
      *
-     * @param filePath file package path
-     * @param fileName file name
+     * @param fileName  file name
+     * @param filePath  file package path
      * @param extension file extension
-     * @param handle cached file handle
+     * @param handle    cached file handle
      * @return file object
      */
     public static File getFileObject(String filePath, String fileName, String extension, JavaFileInfo handle) {
@@ -125,7 +125,7 @@
     /**
      * Returns data stored in temporary files.
      *
-     * @param generatedTempFiles temporary file types
+     * @param generatedTempFiles    temporary file types
      * @param tempJavaFragmentFiles temp java fragment files
      * @return data stored in temporary files
      * @throws IOException when failed to get the data from temporary file handle
@@ -253,11 +253,11 @@
     /**
      * Initiates generation of file based on generated file type.
      *
-     * @param file generated file
-     * @param className generated file class name
-     * @param genType generated file type
-     * @param imports imports for the file
-     * @param pkg generated file package
+     * @param file         generated file
+     * @param className    generated file class name
+     * @param genType      generated file type
+     * @param imports      imports for the file
+     * @param pkg          generated file package
      * @param pluginConfig plugin configurations
      * @throws IOException when fails to generate a file
      */
@@ -276,17 +276,22 @@
     /**
      * Initiates generation of file based on generated file type.
      *
-     * @param file generated file
-     * @param genType generated file type
-     * @param imports imports for the file
-     * @param curNode current YANG node
+     * @param file      generated file
+     * @param genType   generated file type
+     * @param imports   imports for the file
+     * @param curNode   current YANG node
      * @param className class name
      * @throws IOException when fails to generate a file
      */
     public static void initiateJavaFileGeneration(File file, int genType, List<String> imports,
-            YangNode curNode, String className) throws IOException {
+            YangNode curNode, String className)
+            throws IOException {
 
         try {
+            if (file.exists()) {
+                throw new IOException(file.getName() + " is reused due to YANG naming");
+            }
+
             file.createNewFile();
             appendContents(file, genType, imports, curNode, className);
         } catch (IOException e) {
@@ -297,15 +302,16 @@
     /**
      * Appends all the contents into a generated java file.
      *
-     * @param file generated file
-     * @param genType generated file type
+     * @param file        generated file
+     * @param genType     generated file type
      * @param importsList list of java imports
-     * @param curNode current YANG node
-     * @param className class name
+     * @param curNode     current YANG node
+     * @param className   class name
      * @throws IOException
      */
     private static void appendContents(File file, int genType, List<String> importsList, YangNode curNode,
-            String className) throws IOException {
+            String className)
+            throws IOException {
 
         JavaFileInfo javaFileInfo = ((JavaFileInfoContainer) curNode).getJavaFileInfo();
 
@@ -321,39 +327,39 @@
             pkgString = parsePackageString(path, importsList);
         }
         switch (genType) {
-        case INTERFACE_MASK:
-            appendHeaderContents(file, pkgString, importsList);
-            write(file, genType, INTERFACE, curNode, className);
-            break;
-        case GENERATE_SERVICE_AND_MANAGER:
-            appendHeaderContents(file, pkgString, importsList);
-            write(file, genType, RPC_INTERFACE, curNode, className);
-            break;
-        case GENERATE_EVENT_CLASS:
-            appendHeaderContents(file, pkgString, importsList);
-            write(file, genType, EVENT, curNode, className);
-            break;
-        case GENERATE_EVENT_LISTENER_INTERFACE:
-            appendHeaderContents(file, pkgString, importsList);
-            write(file, genType, EVENT_LISTENER, curNode, className);
-            break;
-        case GENERATE_EVENT_SUBJECT_CLASS:
-            appendHeaderContents(file, pkgString, importsList);
-            write(file, genType, EVENT_SUBJECT_CLASS, curNode, className);
-            break;
-        default:
-            break;
+            case INTERFACE_MASK:
+                appendHeaderContents(file, pkgString, importsList);
+                write(file, genType, INTERFACE, curNode, className);
+                break;
+            case GENERATE_SERVICE_AND_MANAGER:
+                appendHeaderContents(file, pkgString, importsList);
+                write(file, genType, RPC_INTERFACE, curNode, className);
+                break;
+            case GENERATE_EVENT_CLASS:
+                appendHeaderContents(file, pkgString, importsList);
+                write(file, genType, EVENT, curNode, className);
+                break;
+            case GENERATE_EVENT_LISTENER_INTERFACE:
+                appendHeaderContents(file, pkgString, importsList);
+                write(file, genType, EVENT_LISTENER, curNode, className);
+                break;
+            case GENERATE_EVENT_SUBJECT_CLASS:
+                appendHeaderContents(file, pkgString, importsList);
+                write(file, genType, EVENT_SUBJECT_CLASS, curNode, className);
+                break;
+            default:
+                break;
         }
     }
 
     /**
      * Appends all the contents into a generated java file.
      *
-     * @param file generated file
-     * @param fileName generated file name
-     * @param genType generated file type
-     * @param importsList list of java imports
-     * @param pkg generated file package
+     * @param file         generated file
+     * @param fileName     generated file name
+     * @param genType      generated file type
+     * @param importsList  list of java imports
+     * @param pkg          generated file package
      * @param pluginConfig plugin configurations
      * @throws IOException when fails to append contents
      */
@@ -364,37 +370,37 @@
         String pkgString = parsePackageString(pkg, importsList);
 
         switch (genType) {
-        case IMPL_CLASS_MASK:
-            write(file, fileName, genType, IMPL_CLASS, pluginConfig);
-            break;
-        case BUILDER_INTERFACE_MASK:
-            write(file, fileName, genType, BUILDER_INTERFACE, pluginConfig);
-            break;
-        case GENERATE_TYPEDEF_CLASS:
-            appendHeaderContents(file, pkgString, importsList);
-            write(file, fileName, genType, IMPL_CLASS, pluginConfig);
-            break;
-        case BUILDER_CLASS_MASK:
-            appendHeaderContents(file, pkgString, importsList);
-            write(file, fileName, genType, BUILDER_CLASS, pluginConfig);
-            break;
-        case GENERATE_UNION_CLASS:
-            appendHeaderContents(file, pkgString, importsList);
-            write(file, fileName, genType, IMPL_CLASS, pluginConfig);
-            break;
-        case GENERATE_ENUM_CLASS:
-            appendHeaderContents(file, pkgString, importsList);
-            write(file, fileName, genType, ENUM_CLASS, pluginConfig);
-            break;
-        default:
-            break;
+            case IMPL_CLASS_MASK:
+                write(file, fileName, genType, IMPL_CLASS, pluginConfig);
+                break;
+            case BUILDER_INTERFACE_MASK:
+                write(file, fileName, genType, BUILDER_INTERFACE, pluginConfig);
+                break;
+            case GENERATE_TYPEDEF_CLASS:
+                appendHeaderContents(file, pkgString, importsList);
+                write(file, fileName, genType, IMPL_CLASS, pluginConfig);
+                break;
+            case BUILDER_CLASS_MASK:
+                appendHeaderContents(file, pkgString, importsList);
+                write(file, fileName, genType, BUILDER_CLASS, pluginConfig);
+                break;
+            case GENERATE_UNION_CLASS:
+                appendHeaderContents(file, pkgString, importsList);
+                write(file, fileName, genType, IMPL_CLASS, pluginConfig);
+                break;
+            case GENERATE_ENUM_CLASS:
+                appendHeaderContents(file, pkgString, importsList);
+                write(file, fileName, genType, ENUM_CLASS, pluginConfig);
+                break;
+            default:
+                break;
         }
     }
 
     /**
      * Removes base directory path from package and generates package string for file.
      *
-     * @param javaPkg generated java package
+     * @param javaPkg     generated java package
      * @param importsList list of imports
      * @return package string
      */
@@ -416,8 +422,8 @@
      * Appends other contents to interface, builder and typedef classes.
      * for example : ONOS copyright, imports and package.
      *
-     * @param file generated file
-     * @param pkg generated package
+     * @param file        generated file
+     * @param pkg         generated package
      * @param importsList list of imports
      * @throws IOException when fails to append contents
      */
@@ -443,11 +449,11 @@
     /**
      * Writes data to the specific generated file.
      *
-     * @param file generated file
-     * @param genType generated file type
+     * @param file        generated file
+     * @param genType     generated file type
      * @param javaDocType java doc type
-     * @param curNode current YANG node
-     * @param fileName file name
+     * @param curNode     current YANG node
+     * @param fileName    file name
      * @throws IOException when fails to write into a file
      */
     private static void write(File file, int genType, JavaDocType javaDocType, YangNode curNode, String fileName)
@@ -470,10 +476,10 @@
     /**
      * Writes data to the specific generated file.
      *
-     * @param file generated file
-     * @param fileName file name
-     * @param genType generated file type
-     * @param javaDocType java doc type
+     * @param file         generated file
+     * @param fileName     file name
+     * @param genType      generated file type
+     * @param javaDocType  java doc type
      * @param pluginConfig plugin configurations
      * @throws IOException
      */
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/translator/tojava/utils/TempJavaCodeFragmentFilesUtils.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/translator/tojava/utils/TempJavaCodeFragmentFilesUtils.java
index 617ac99..f70ec53 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/translator/tojava/utils/TempJavaCodeFragmentFilesUtils.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/translator/tojava/utils/TempJavaCodeFragmentFilesUtils.java
@@ -29,12 +29,7 @@
 import org.onosproject.yangutils.translator.tojava.TempJavaCodeFragmentFilesContainer;
 import org.onosproject.yangutils.translator.tojava.TempJavaFragmentFiles;
 import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaAugment;
-import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaInput;
 import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaModule;
-import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaOutput;
-import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaSubModule;
-
-import static java.util.Collections.sort;
 
 import static org.onosproject.yangutils.translator.tojava.utils.JavaIdentifierSyntax.getCapitalCase;
 import static org.onosproject.yangutils.translator.tojava.utils.JavaIdentifierSyntax.getSmallCase;
@@ -69,6 +64,8 @@
 import static org.onosproject.yangutils.utils.UtilConstants.TYPE;
 import static org.onosproject.yangutils.utils.io.impl.FileSystemUtil.updateFileHandle;
 
+import static java.util.Collections.sort;
+
 /**
  * Represents utilities for temporary java code fragments.
  */
@@ -83,8 +80,8 @@
     /**
      * Adds import for AugmentationHolders class.
      *
-     * @param curNode current YANG node
-     * @param imports list of imports
+     * @param curNode   current YANG node
+     * @param imports   list of imports
      * @param operation add or delete import
      */
     public static void addAugmentationHoldersImport(YangNode curNode, List<String> imports, boolean operation) {
@@ -95,8 +92,8 @@
     /**
      * Adds import for AugmentedInfo class.
      *
-     * @param curNode current YANG node
-     * @param imports list of imports
+     * @param curNode   current YANG node
+     * @param imports   list of imports
      * @param operation add or delete import
      */
     public static void addAugmentedInfoImport(YangNode curNode, List<String> imports, boolean operation) {
@@ -126,8 +123,8 @@
     /**
      * Updated imports with augmented nodes import.
      *
-     * @param curNode current YANG node
-     * @param imports list of imports
+     * @param curNode   current YANG node
+     * @param imports   list of imports
      * @param operation to add or to delete
      */
     public static void addAugmentedNodesImport(YangNode curNode, List<String> imports, boolean operation) {
@@ -156,7 +153,7 @@
     /**
      * Returns imports for augmented node.
      *
-     * @param parent parent YANG node
+     * @param parent      parent YANG node
      * @param targetNodes list of target nodes
      * @param isImplClass if impl class's import required
      * @return imports for augmented node
@@ -204,8 +201,8 @@
     /**
      * Adds import for array list.
      *
-     * @param curNode current YANG node
-     * @param imports list of imports
+     * @param curNode   current YANG node
+     * @param imports   list of imports
      * @param operation add or delete import
      */
     public static void addArrayListImport(YangNode curNode, List<String> imports, boolean operation) {
@@ -224,8 +221,8 @@
     /**
      * Adds listener's imports.
      *
-     * @param curNode currentYangNode.
-     * @param imports import list
+     * @param curNode   currentYangNode.
+     * @param imports   import list
      * @param operation add or remove
      * @param classInfo class info to be added to import list
      */
@@ -244,7 +241,7 @@
     /**
      * Adds annotations imports.
      *
-     * @param imports list if imports
+     * @param imports   list if imports
      * @param operation to add or to delete
      */
     public static void addAnnotationsImports(List<String> imports, boolean operation) {
@@ -269,7 +266,7 @@
     /**
      * Performs given operations on import list.
      *
-     * @param imports list of imports
+     * @param imports   list of imports
      * @param curImport current import
      * @param operation add or remove
      * @return import list
@@ -314,7 +311,7 @@
     /**
      * Closes the file handle for temporary file.
      *
-     * @param file file to be closed
+     * @param file        file to be closed
      * @param toBeDeleted flag to indicate if file needs to be deleted
      * @throws IOException when failed to close the file handle
      */
@@ -330,33 +327,6 @@
     }
 
     /**
-     * Detects collision between parent and child node which have same name.
-     * When parent and child node both have the same name in that case child node should be used with
-     * qualified name.
-     *
-     * @param curNode current YANG node
-     * @param qualifiedTypeInfo current node's qualified info
-     * @return true if collision is detected
-     */
-    public static boolean detectCollisionBwParentAndChildForImport(YangNode curNode,
-            JavaQualifiedTypeInfo qualifiedTypeInfo) {
-
-        YangNode parent = curNode.getParent();
-        if (parent instanceof YangJavaModule
-                || parent instanceof YangJavaSubModule
-                || parent instanceof YangJavaInput
-                || parent instanceof YangJavaOutput) {
-            return false;
-        }
-        String parentsClassInfo = getCapitalCase(((JavaFileInfoContainer) parent).getJavaFileInfo().getJavaName());
-        String childsClassInfo = qualifiedTypeInfo.getClassInfo();
-        if (childsClassInfo.equals(parentsClassInfo)) {
-            return true;
-        }
-        return false;
-    }
-
-    /**
      * Returns sorted import list.
      *
      * @param imports import list
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/translator/tojava/utils/YangJavaModelUtils.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/translator/tojava/utils/YangJavaModelUtils.java
index 8e02082..3f378c7 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/translator/tojava/utils/YangJavaModelUtils.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/translator/tojava/utils/YangJavaModelUtils.java
@@ -19,8 +19,6 @@
 import java.io.IOException;
 
 import org.onosproject.yangutils.datamodel.RpcNotificationContainer;
-import org.onosproject.yangutils.datamodel.YangAugment;
-import org.onosproject.yangutils.datamodel.YangAugmentationHolder;
 import org.onosproject.yangutils.datamodel.YangCase;
 import org.onosproject.yangutils.datamodel.YangChoice;
 import org.onosproject.yangutils.datamodel.YangLeavesHolder;
@@ -45,9 +43,6 @@
 import static org.onosproject.yangutils.translator.tojava.utils.JavaIdentifierSyntax.getCapitalCase;
 import static org.onosproject.yangutils.translator.tojava.utils.JavaIdentifierSyntax.getCurNodePackage;
 import static org.onosproject.yangutils.translator.tojava.utils.JavaIdentifierSyntax.getPackageDirPathFromJavaJPackage;
-import static org.onosproject.yangutils.utils.UtilConstants.AUGMENTATION_HOLDER;
-import static org.onosproject.yangutils.utils.UtilConstants.AUGMENTED_INFO;
-import static org.onosproject.yangutils.utils.UtilConstants.PROVIDED_AUGMENTATION_CLASS_IMPORT_PKG;
 
 /**
  * Represents utility class for YANG java model.
@@ -64,7 +59,7 @@
      * Updates YANG java file package information.
      *
      * @param javaCodeGeneratorInfo YANG java file info node
-     * @param yangPluginConfig YANG plugin config
+     * @param yangPluginConfig      YANG plugin config
      * @throws IOException IO operations fails
      */
     public static void updatePackageInfo(JavaCodeGeneratorInfo javaCodeGeneratorInfo,
@@ -85,7 +80,7 @@
      * Updates YANG java file package information for specified package.
      *
      * @param javaCodeGeneratorInfo YANG java file info node
-     * @param yangPlugin YANG plugin config
+     * @param yangPlugin            YANG plugin config
      * @throws IOException IO operations fails
      */
     private static void updatePackageInfo(JavaCodeGeneratorInfo javaCodeGeneratorInfo, YangPluginConfig yangPlugin,
@@ -128,7 +123,7 @@
              */
             javaCodeGeneratorInfo.getTempJavaCodeFragmentFiles()
                     .getServiceTempFiles().addCurNodeLeavesInfoToTempFiles(
-                            (YangNode) javaCodeGeneratorInfo, yangPluginConfig);
+                    (YangNode) javaCodeGeneratorInfo, yangPluginConfig);
             if ((YangNode) javaCodeGeneratorInfo instanceof YangJavaModule) {
                 if (!((YangJavaModule) javaCodeGeneratorInfo).getNotificationNodes().isEmpty()) {
                     updateNotificaitonNodeInfo(javaCodeGeneratorInfo, yangPluginConfig);
@@ -151,7 +146,7 @@
              */
             javaCodeGeneratorInfo.getTempJavaCodeFragmentFiles()
                     .getBeanTempFiles().addCurNodeLeavesInfoToTempFiles(
-                            (YangNode) javaCodeGeneratorInfo, yangPluginConfig);
+                    (YangNode) javaCodeGeneratorInfo, yangPluginConfig);
         } else if (javaCodeGeneratorInfo instanceof YangTypeHolder) {
             /*
              * Typedef
@@ -194,11 +189,12 @@
      * Updates notification node info in service temporary file.
      *
      * @param javaCodeGeneratorInfo java code generator info
-     * @param yangPluginConfig plugin configurations
+     * @param yangPluginConfig      plugin configurations
      * @throws IOException when fails to do IO operations
      */
     private static void updateNotificaitonNodeInfo(JavaCodeGeneratorInfo javaCodeGeneratorInfo,
-            YangPluginConfig yangPluginConfig) throws IOException {
+            YangPluginConfig yangPluginConfig)
+            throws IOException {
         if ((YangNode) javaCodeGeneratorInfo instanceof YangJavaModule) {
             for (YangNode notificaiton : ((YangJavaModule) javaCodeGeneratorInfo).getNotificationNodes()) {
                 javaCodeGeneratorInfo.getTempJavaCodeFragmentFiles()
@@ -220,8 +216,8 @@
      * Generates code for the current ata model node and adds itself as an attribute in the parent.
      *
      * @param javaCodeGeneratorInfo YANG java file info node
-     * @param yangPlugin YANG plugin config
-     * @param isMultiInstance flag to indicate whether it's a list
+     * @param yangPlugin            YANG plugin config
+     * @param isMultiInstance       flag to indicate whether it's a list
      * @throws IOException IO operations fails
      */
     public static void generateCodeAndUpdateInParent(JavaCodeGeneratorInfo javaCodeGeneratorInfo,
@@ -246,7 +242,7 @@
      * Generates code for the current data model node and adds support for it to be augmented.
      *
      * @param javaCodeGeneratorInfo YANG java file info node
-     * @param yangPlugin YANG plugin config
+     * @param yangPlugin            YANG plugin config
      * @throws IOException IO operations fails
      */
     public static void generateCodeOfAugmentableNode(JavaCodeGeneratorInfo javaCodeGeneratorInfo,
@@ -259,8 +255,9 @@
         generateCodeOfNode(javaCodeGeneratorInfo, yangPlugin);
 
         /*
+        TODO: Need to use this, when augmentation is added in YMS
          * For augmentation of nodes.
-         */
+
         if (javaCodeGeneratorInfo instanceof YangAugmentationHolder) {
             JavaQualifiedTypeInfo augmentationHoldersInfo = new JavaQualifiedTypeInfo();
             augmentationHoldersInfo.setClassInfo(AUGMENTATION_HOLDER);
@@ -276,7 +273,7 @@
                     .addToExtendsList(augmentedInfo, (YangNode) javaCodeGeneratorInfo);
 
         }
-
+        */
         if (javaCodeGeneratorInfo instanceof YangCase) {
             YangNode parent = ((YangCase) javaCodeGeneratorInfo).getParent();
             JavaQualifiedTypeInfo parentsInfo = new JavaQualifiedTypeInfo();
@@ -297,7 +294,7 @@
      * Generates code for the current data model node.
      *
      * @param javaCodeGeneratorInfo YANG java file info node
-     * @param yangPluginConfig YANG plugin config
+     * @param yangPluginConfig      YANG plugin config
      * @throws IOException IO operations fails
      */
     public static void generateCodeOfNode(JavaCodeGeneratorInfo javaCodeGeneratorInfo,
@@ -314,8 +311,8 @@
      * Generates code for the root module/sub-module node.
      *
      * @param javaCodeGeneratorInfo YANG java file info node
-     * @param yangPluginConfig YANG plugin config
-     * @param rootPkg package of the root node
+     * @param yangPluginConfig      YANG plugin config
+     * @param rootPkg               package of the root node
      * @throws IOException IO operations fails
      */
     public static void generateCodeOfRootNode(JavaCodeGeneratorInfo javaCodeGeneratorInfo,
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/utils/UtilConstants.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/utils/UtilConstants.java
index 7e89998..adc7015 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/utils/UtilConstants.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/utils/UtilConstants.java
@@ -966,6 +966,7 @@
      * Static attribute for augmentable.
      */
     public static final String AUGMENTABLE = "Augmentable";
+
     /**
      * Static attribute for list.
      */
@@ -1018,6 +1019,11 @@
     public static final String COMPONENT_ANNOTATION = "@Component";
 
     /**
+     * Static attribute for component.
+     */
+    public static final String COMPONENT = "Component";
+
+    /**
      * Static attribute for immediate.
      */
     public static final String IMMEDIATE = "immediate";
@@ -1134,6 +1140,16 @@
             + "grouping for given uses";
 
     /**
+     * Static attribute for reference.
+     */
+    public static final String REFERENCE = "Reference";
+
+    /**
+     * Static attribute for ReferenceCardinality.
+     */
+    public static final String REFERENCE_CARDINALITY = "ReferenceCardinality";
+
+    /**
      * Creates an instance of util constants.
      */
     private UtilConstants() {
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/utils/io/impl/YangIoUtils.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/utils/io/impl/YangIoUtils.java
index 7120612..47e95c3 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/utils/io/impl/YangIoUtils.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/utils/io/impl/YangIoUtils.java
@@ -56,8 +56,8 @@
 import static org.onosproject.yangutils.utils.UtilConstants.YANG_RESOURCES;
 import static org.onosproject.yangutils.utils.io.impl.FileSystemUtil.appendFileContents;
 import static org.onosproject.yangutils.utils.io.impl.FileSystemUtil.updateFileHandle;
-import static org.onosproject.yangutils.utils.io.impl.JavaDocGen.getJavaDoc;
 import static org.onosproject.yangutils.utils.io.impl.JavaDocGen.JavaDocType.PACKAGE_INFO;
+import static org.onosproject.yangutils.utils.io.impl.JavaDocGen.getJavaDoc;
 import static org.slf4j.LoggerFactory.getLogger;
 
 /**
@@ -67,7 +67,7 @@
 
     private static final Logger log = getLogger(YangIoUtils.class);
     private static final String TARGET_RESOURCE_PATH = SLASH + TEMP + SLASH + YANG_RESOURCES + SLASH;
-    private static final int LINE_SIZE = 116;
+    private static final int LINE_SIZE = 118;
     private static final int SUB_LINE_SIZE = 112;
     private static final int ZERO = 0;
 
@@ -92,10 +92,10 @@
     /**
      * Adds package info file for the created directory.
      *
-     * @param path directory path
-     * @param classInfo class info for the package
-     * @param pack package of the directory
-     * @param isChildNode is it a child node
+     * @param path         directory path
+     * @param classInfo    class info for the package
+     * @param pack         package of the directory
+     * @param isChildNode  is it a child node
      * @param pluginConfig plugin configurations
      * @throws IOException when fails to create package info file
      */
@@ -159,7 +159,8 @@
      * @param dir generated directory in previous build
      * @throws IOException when failed to delete directory
      */
-    public static void deleteDirectory(String dir) throws IOException {
+    public static void deleteDirectory(String dir)
+            throws IOException {
         File generatedDirectory = new File(dir);
         if (generatedDirectory.exists()) {
             try {
@@ -177,7 +178,8 @@
      * @param root root directory
      * @throws IOException when fails to do IO operations.
      */
-    public static void searchAndDeleteTempDir(String root) throws IOException {
+    public static void searchAndDeleteTempDir(String root)
+            throws IOException {
         List<File> store = new LinkedList<>();
         Stack<String> stack = new Stack<>();
         stack.push(root);
@@ -207,7 +209,7 @@
     /**
      * Adds generated source directory to the compilation root.
      *
-     * @param source directory
+     * @param source  directory
      * @param project current maven project
      * @param context current build context
      */
@@ -220,7 +222,7 @@
     /**
      * Removes extra char from the string.
      *
-     * @param valueString string to be trimmed
+     * @param valueString    string to be trimmed
      * @param removealStirng extra chars
      * @return new string
      */
@@ -255,8 +257,8 @@
      * Returns the directory path of the package in canonical form.
      *
      * @param baseCodeGenPath base path where the generated files needs to be
-     *            put
-     * @param pathOfJavaPkg java package of the file being generated
+     *                        put
+     * @param pathOfJavaPkg   java package of the file being generated
      * @return absolute path of the package in canonical form
      */
     public static String getDirectory(String baseCodeGenPath, String pathOfJavaPkg) {
@@ -276,8 +278,8 @@
      * Returns the absolute path of the package in canonical form.
      *
      * @param baseCodeGenPath base path where the generated files needs to be
-     *            put
-     * @param pathOfJavaPkg java package of the file being generated
+     *                        put
+     * @param pathOfJavaPkg   java package of the file being generated
      * @return absolute path of the package in canonical form
      */
     public static String getAbsolutePackagePath(String baseCodeGenPath, String pathOfJavaPkg) {
@@ -288,8 +290,8 @@
      * Copies YANG files to the current project's output directory.
      *
      * @param yangFileInfo list of YANG files
-     * @param outputDir project's output directory
-     * @param project maven project
+     * @param outputDir    project's output directory
+     * @param project      maven project
      * @throws IOException when fails to copy files to destination resource directory
      */
     public static void copyYangFilesToTarget(Set<YangFileInfo> yangFileInfo, String outputDir, MavenProject project)
@@ -334,7 +336,8 @@
      * @param srcFile    main file
      * @throws IOException when fails to append contents
      */
-    public static void mergeJavaFiles(File appendFile, File srcFile) throws IOException {
+    public static void mergeJavaFiles(File appendFile, File srcFile)
+            throws IOException {
         try {
             appendFileContents(appendFile, srcFile);
         } catch (IOException e) {
@@ -349,7 +352,8 @@
      * @param data data which need to be inserted
      * @throws IOException when fails to insert into file
      */
-    public static void insertDataIntoJavaFile(File file, String data) throws IOException {
+    public static void insertDataIntoJavaFile(File file, String data)
+            throws IOException {
         try {
             updateFileHandle(file, data, false);
         } catch (IOException e) {
@@ -365,7 +369,8 @@
      * @return updated file
      * @throws IOException when fails to do IO operations.
      */
-    public static File validateLineLength(File dataFile) throws IOException {
+    public static File validateLineLength(File dataFile)
+            throws IOException {
         File tempFile = dataFile;
         FileReader fileReader = new FileReader(dataFile);
         BufferedReader bufferReader = new BufferedReader(fileReader);