[ONOS-4829] Augmented data method generator implmentation.

Change-Id: I0cb68dd10a748e5b66eec0b832574f408a23ba5c
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/InterJarLinkerTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/InterJarLinkerTest.java
index fcd2966..16962f2 100644
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/InterJarLinkerTest.java
+++ b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/InterJarLinkerTest.java
@@ -206,7 +206,7 @@
         File folder = new File(System.getProperty("user.dir") + SLASH + FLOW_CLASSIFIER_FOLDER);
         File file = new File(System.getProperty("user.dir") + SLASH + FLOW_CLASSIFIER_MANAGER);
         assertThat(true, is(folder.exists()));
-        assertThat(false, is(file.exists()));
+        assertThat(true, is(file.exists()));
     }
 
     /**
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/NotificationTranslatorTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/NotificationTranslatorTest.java
index 27b42e1..ac7e417 100644
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/NotificationTranslatorTest.java
+++ b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/NotificationTranslatorTest.java
@@ -50,6 +50,7 @@
         generateJavaCode(node, yangPluginConfig);
 
         deleteDirectory("target/NotificationTest/");
+        deleteDirectory("target/NotificationTest1/");
     }
 
     // TODO enhance the test cases, after having a framework of translator test.
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/YangXpathLinkerTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/YangXpathLinkerTest.java
index 5d1251a..7fcd7f1 100644
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/YangXpathLinkerTest.java
+++ b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/YangXpathLinkerTest.java
@@ -26,7 +26,6 @@
 import org.onosproject.yangutils.datamodel.YangNode;
 import org.onosproject.yangutils.datamodel.YangReferenceResolver;
 import org.onosproject.yangutils.datamodel.YangResolutionInfo;
-import org.onosproject.yangutils.linker.exceptions.LinkerException;
 import org.onosproject.yangutils.linker.impl.YangLinkerManager;
 import org.onosproject.yangutils.linker.impl.YangXpathLinker;
 import org.onosproject.yangutils.utils.io.impl.YangFileScanner;
@@ -44,11 +43,12 @@
     private YangLinkerManager linkerManager = new YangLinkerManager();
     private static final String INTRA_FILE_PATH = "src/test/resources/xPathLinker/IntraFile/";
     private static final String INTER_FILE_PATH = "src/test/resources/xPathLinker/InterFile/";
+    private static final String CASE_FILE_PATH = "src/test/resources/xPathLinker/Case/";
 
     /**
      * Unit test case for intra file linking for single level container.
      *
-     * @throws IOException when fails to do IO operations
+     * @throws IOException            when fails to do IO operations
      * @throws MojoExecutionException
      */
     @Test
@@ -230,7 +230,7 @@
      *
      * @throws IOException when fails to do IO operations
      */
-    @Test(expected = LinkerException.class)
+    @Test
     public void processIntraFileLinkingInUsesSingleLevel() throws IOException {
 
         utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(INTRA_FILE_PATH + "IntraSingleUses/"));
@@ -260,7 +260,7 @@
      *
      * @throws IOException when fails to do IO operations
      */
-    @Test(expected = LinkerException.class)
+    @Test
     public void processIntraFileLinkingInUsesMultiLevel() throws IOException {
 
         utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(INTRA_FILE_PATH + "IntraMultiUses/"));
@@ -449,6 +449,9 @@
         utilManager.createYangNodeSet();
         linkerManager.createYangNodeSet(utilManager.getYangNodeSet());
         linkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
+        linkerManager.linkSubModulesToParentModule(utilManager.getYangNodeSet());
+        linkerManager.addRefToYangFilesIncludeList(utilManager.getYangNodeSet());
+        linkerManager.processInterFileLinking(utilManager.getYangNodeSet());
 
         YangNode targetNode = null;
         String targetNodeName = null;
@@ -459,7 +462,7 @@
             for (YangAugment augment : augments) {
                 targetNodeName = augment.getTargetNode().get(augment.getTargetNode().size() - 1).getNodeIdentifier()
                         .getName();
-                targetNode = linker.processAugmentXpathLinking(augment.getTargetNode(), node);
+                targetNode = augment.getAugmentedNode();
             }
         }
 
@@ -481,7 +484,7 @@
         linkerManager.linkSubModulesToParentModule(utilManager.getYangNodeSet());
         linkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
         linkerManager.addRefToYangFilesIncludeList(utilManager.getYangNodeSet());
-
+        linkerManager.processInterFileLinking(utilManager.getYangNodeSet());
         YangNode targetNode = null;
         String targetNodeName = null;
 
@@ -491,7 +494,7 @@
             for (YangAugment augment : augments) {
                 targetNodeName = augment.getTargetNode().get(augment.getTargetNode().size() - 1).getNodeIdentifier()
                         .getName();
-                targetNode = linker.processAugmentXpathLinking(augment.getTargetNode(), node);
+                targetNode = augment.getAugmentedNode();
             }
         }
 
@@ -523,7 +526,7 @@
             for (YangAugment augment : augments) {
                 targetNodeName = augment.getTargetNode().get(augment.getTargetNode().size() - 1).getNodeIdentifier()
                         .getName();
-                targetNode = linker.processAugmentXpathLinking(augment.getTargetNode(), node);
+                targetNode = augment.getAugmentedNode();
             }
         }
 
@@ -538,11 +541,11 @@
     @Test
     public void processInterFileLinkingInUsesInAugment() throws IOException {
 
-        /* FIXME: when uses cloning is done test it.
         utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(INTER_FILE_PATH + "InterSingleUses/"));
         utilManager.parseYangFileInfoSet();
         utilManager.createYangNodeSet();
         linkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+        linkerManager.linkSubModulesToParentModule(utilManager.getYangNodeSet());
         linkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
         linkerManager.addRefToYangFilesIncludeList(utilManager.getYangNodeSet());
         linkerManager.processInterFileLinking(utilManager.getYangNodeSet());
@@ -555,13 +558,13 @@
 
             for (YangAugment augment : augments) {
                 targetNodeName = augment.getTargetNode().get(augment.getTargetNode().size() - 1)
-                .getNodeIdentifier().getName();
-                targetNode = linker.processXpathLinking(augment.getTargetNode(), node);
+                        .getNodeIdentifier().getName();
+                targetNode = augment.getAugmentedNode();
             }
         }
 
         assertThat(true, is(targetNode.getName().equals(targetNodeName)));
-        */
+
     }
 
     /**
@@ -569,7 +572,7 @@
      *
      * @throws IOException when fails to do IO operations
      */
-    @Test(expected = LinkerException.class)
+    @Test
     public void processInterFileLinkingInUsesMultiLevel() throws IOException {
 
         utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(INTER_FILE_PATH + "InterMultiUses/"));
@@ -596,4 +599,72 @@
         assertThat(true, is(targetNode.getName().equals(targetNodeName)));
     }
 
+    /**
+     * Unit test case for inter file linking for multi level uses inside augment.
+     *
+     * @throws IOException when fails to do IO operations
+     */
+    @Test
+    public void processInterFileLinkingInMultipleSubmodules() throws IOException {
+
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(CASE_FILE_PATH + "submodule/"));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+        linkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+        linkerManager.linkSubModulesToParentModule(utilManager.getYangNodeSet());
+        linkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
+        linkerManager.addRefToYangFilesIncludeList(utilManager.getYangNodeSet());
+        linkerManager.processInterFileLinking(utilManager.getYangNodeSet());
+
+        YangNode targetNode = null;
+        String targetNodeName = null;
+
+        for (YangNode node : utilManager.getYangNodeSet()) {
+            List<YangAugment> augments = linker.getListOfYangAugment(node);
+
+            for (YangAugment augment : augments) {
+                targetNodeName = augment.getTargetNode().get(augment.getTargetNode().size() - 1)
+                        .getNodeIdentifier().getName();
+                targetNode = augment.getAugmentedNode();
+            }
+        }
+
+        assertThat(true, is(targetNode.getName().equals(targetNodeName)));
+
+    }
+
+    /**
+     * Unit test case for inter file linking for multi level uses inside augment.
+     *
+     * @throws IOException when fails to do IO operations
+     */
+    @Test
+    public void processInterFileLinkingInMultipleUses() throws IOException {
+
+        /** FIXME: once order of linking is done.
+         utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(CASE_FILE_PATH + "uses/"));
+         utilManager.parseYangFileInfoSet();
+         utilManager.createYangNodeSet();
+         linkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+         linkerManager.linkSubModulesToParentModule(utilManager.getYangNodeSet());
+         linkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
+         linkerManager.addRefToYangFilesIncludeList(utilManager.getYangNodeSet());
+         linkerManager.processInterFileLinking(utilManager.getYangNodeSet());
+
+         YangNode targetNode = null;
+         String targetNodeName = null;
+
+         for (YangNode node : utilManager.getYangNodeSet()) {
+         List<YangAugment> augments = linker.getListOfYangAugment(node);
+
+         for (YangAugment augment : augments) {
+         targetNodeName = augment.getTargetNode().get(augment.getTargetNode().size() - 1)
+         .getNodeIdentifier().getName();
+         targetNode = augment.getAugmentedNode();
+         }
+         }
+
+         assertThat(true, is(targetNode.getName().equals(targetNodeName)));
+         */
+    }
 }
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/translator/tojava/utils/JavaIdentifierSyntaxTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/translator/tojava/utils/JavaIdentifierSyntaxTest.java
index bfde08d..bd598e4 100644
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/translator/tojava/utils/JavaIdentifierSyntaxTest.java
+++ b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/translator/tojava/utils/JavaIdentifierSyntaxTest.java
@@ -113,8 +113,6 @@
     private static final String BASE_DIR_PKG = "target.UnitTestCase.";
     private static final String DIR_PATH = "exist1.exist2.exist3";
     private static final String PKG_INFO = "package-info.java";
-    private static final String BASE_PKG = "target/UnitTestCase";
-    private static final String TEST_DATA_1 = "This is to append a text to the file first1\n";
 
     /**
      * Unit test for private constructor.
@@ -319,5 +317,6 @@
         assertThat(true, is(doesPackageExist(strPath)));
         createDir.delete();
         deleteDirectory(createDir);
+        deleteDirectory(new File(BASE_DIR_PKG.replace(PERIOD, SLASH)));
     }
 }
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/utils/io/impl/FileSystemUtilTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/utils/io/impl/FileSystemUtilTest.java
index 0198720..271036f 100644
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/utils/io/impl/FileSystemUtilTest.java
+++ b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/utils/io/impl/FileSystemUtilTest.java
@@ -20,6 +20,8 @@
 import java.io.IOException;
 import java.lang.reflect.Constructor;
 import java.lang.reflect.InvocationTargetException;
+
+import org.apache.commons.io.FileUtils;
 import org.junit.Test;
 
 import static org.apache.commons.io.FileUtils.deleteDirectory;
@@ -84,5 +86,6 @@
         appendFileContents(createFile, createSourceFile);
         updateFileHandle(createFile, null, true);
         deleteDirectory(dir);
+        FileUtils.deleteDirectory(new File(BASE_PKG));
     }
 }
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/utils/io/impl/YangIoUtilsTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/utils/io/impl/YangIoUtilsTest.java
index e1b167d..6451e4d 100644
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/utils/io/impl/YangIoUtilsTest.java
+++ b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/utils/io/impl/YangIoUtilsTest.java
@@ -67,7 +67,7 @@
         addPackageInfo(dirPath, CHECK1, CREATE_PATH, false, getStubPluginConfig());
         File filePath = new File(dirPath + File.separator + PKG_INFO);
         assertThat(filePath.isFile(), is(true));
-        FileUtils.deleteDirectory(dirPath);
+        FileUtils.deleteDirectory(new File(BASE_DIR));
     }
 
     /**
@@ -83,7 +83,7 @@
         addPackageInfo(dirPath, CHECK1, PATH + CREATE_PATH, false, getStubPluginConfig());
         File filePath = new File(dirPath + File.separator + PKG_INFO);
         assertThat(filePath.isFile(), is(true));
-        FileUtils.deleteDirectory(dirPath);
+        FileUtils.deleteDirectory(new File(BASE_DIR));
     }
 
     /**
@@ -99,7 +99,7 @@
         addPackageInfo(dirPath, CHECK1, PATH + CREATE_PATH, true, getStubPluginConfig());
         File filePath = new File(dirPath + File.separator + PKG_INFO);
         assertThat(filePath.isFile(), is(true));
-        FileUtils.deleteDirectory(dirPath);
+        FileUtils.deleteDirectory(new File(BASE_DIR));
     }
 
     /**
@@ -117,6 +117,7 @@
         File filePath1 = new File(dirPath + File.separator + PKG_INFO);
         assertThat(filePath1.isFile(), is(false));
         FileUtils.deleteDirectory(dirPath);
+        FileUtils.deleteDirectory(new File(BASE_DIR));
     }
 
     /**
@@ -180,7 +181,7 @@
 
         File dirPath = createDirectories(CREATE_PATH);
         assertThat(dirPath.isDirectory(), is(true));
-        FileUtils.deleteDirectory(dirPath);
+        FileUtils.deleteDirectory(new File(BASE_DIR));
     }
 
     /**
diff --git a/utils/yangutils/plugin/src/test/resources/augmentTranslator/test4.yang b/utils/yangutils/plugin/src/test/resources/augmentTranslator/test4.yang
index daa0f88..bed22db 100644
--- a/utils/yangutils/plugin/src/test/resources/augmentTranslator/test4.yang
+++ b/utils/yangutils/plugin/src/test/resources/augmentTranslator/test4.yang
@@ -2,10 +2,7 @@
         
     belongs-to "test" {
          prefix "test";
-    }           
-    import test1{  
-       prefix test1;
-    }  
+    }
     organization "";  
     contact "";  
          
diff --git a/utils/yangutils/plugin/src/test/resources/interfileietf/ietf-te-topology.yang b/utils/yangutils/plugin/src/test/resources/interfileietf/ietf-te-topology.yang
index 106b2aa..10b6c11 100644
--- a/utils/yangutils/plugin/src/test/resources/interfileietf/ietf-te-topology.yang
+++ b/utils/yangutils/plugin/src/test/resources/interfileietf/ietf-te-topology.yang
@@ -1723,9 +1723,9 @@
        uses tet:te-link-state-derived;
      }
 
-     /*
+     
      augment "/te-link-event/te-link-attributes/underlay" {
        description "Add state attributes to te-link underlay.";
        uses te-link-state-underlay-attributes;
-     } */
+     }
    }
diff --git a/utils/yangutils/plugin/src/test/resources/xPathLinker/Case/submodule/test.yang b/utils/yangutils/plugin/src/test/resources/xPathLinker/Case/submodule/test.yang
new file mode 100644
index 0000000..dbff7e8
--- /dev/null
+++ b/utils/yangutils/plugin/src/test/resources/xPathLinker/Case/submodule/test.yang
@@ -0,0 +1,31 @@
+module test {  
+    namespace "xpath:intra:single";  
+    prefix test ;  
+   
+    include test1;
+    include test2;
+    include test4;
+
+    organization "";  
+    contact "";  
+       
+    description   
+        "Defines basic service types for L3VPN service.";  
+       
+    revision "2015-12-16" {  
+        reference "";  
+    }  
+
+    augment /cont5/cont6 {
+       leaf a {
+          type int32;
+       }
+    }
+
+   augment /cont3/cont4/cont8 {
+       leaf a {
+          type int32;
+       }
+    }
+}
+    
diff --git a/utils/yangutils/plugin/src/test/resources/xPathLinker/Case/submodule/test1.yang b/utils/yangutils/plugin/src/test/resources/xPathLinker/Case/submodule/test1.yang
new file mode 100644
index 0000000..23161d4
--- /dev/null
+++ b/utils/yangutils/plugin/src/test/resources/xPathLinker/Case/submodule/test1.yang
@@ -0,0 +1,47 @@
+submodule test1 {  
+
+    belongs-to test {
+         prefix test;
+    }           
+
+    include test4;
+
+    organization "";  
+    contact "";  
+       
+    description   
+        "Defines basic service types for L3VPN service.";  
+       
+    revision "2015-12-16" {  
+        reference "";  
+    }
+
+    container cont1 {
+          leaf leaf1 {
+             type int32;
+         }
+         container cont2 {
+            leaf leaf2 {
+               type int32;
+            }
+         }
+     }
+    
+    augment /cont1/cont2 {
+        container cont4 {
+          leaf leaf1 {
+             type int32;
+          }
+       }
+    }
+
+     augment /cont3/cont4 {
+        container cont8 {
+          leaf leaf8 {
+             type int32;
+          }
+       }
+    }
+
+}
+    
diff --git a/utils/yangutils/plugin/src/test/resources/xPathLinker/Case/submodule/test2.yang b/utils/yangutils/plugin/src/test/resources/xPathLinker/Case/submodule/test2.yang
new file mode 100644
index 0000000..26640ee
--- /dev/null
+++ b/utils/yangutils/plugin/src/test/resources/xPathLinker/Case/submodule/test2.yang
@@ -0,0 +1,36 @@
+submodule test2{
+    belongs-to test {
+         prefix test;
+    }
+
+    include test1;
+    organization "";  
+    contact "";  
+       
+    description   
+        "Defines basic service types for L3VPN service.";  
+       
+    revision "2015-12-16" {  
+        reference "";  
+    }  
+
+    container cont5 {
+       leaf leaf5 {
+          type int32;
+       }
+       container cont6 {
+          leaf leaf6 {
+             type int32;
+          }
+       }
+    }
+
+   augment /cont1/cont2/cont4 {
+        container cont10 {
+          leaf leaf10 {
+             type int32;
+          }
+       }
+    }
+}
+    
diff --git a/utils/yangutils/plugin/src/test/resources/xPathLinker/Case/submodule/test4.yang b/utils/yangutils/plugin/src/test/resources/xPathLinker/Case/submodule/test4.yang
new file mode 100644
index 0000000..fcbf522
--- /dev/null
+++ b/utils/yangutils/plugin/src/test/resources/xPathLinker/Case/submodule/test4.yang
@@ -0,0 +1,28 @@
+submodule test4 {  
+
+    belongs-to test {
+         prefix test;
+    } 
+      
+    organization "";  
+    contact "";  
+       
+    description   
+        "Defines basic service types for L3VPN service.";  
+       
+    revision "2015-12-16" {  
+        reference "";  
+    }  
+
+    container cont3 {
+       leaf leaf3 {
+          type int32;
+       }
+       container cont4 {
+          leaf leaf4 {
+             type int32;
+          }
+       }
+    }
+}
+    
diff --git a/utils/yangutils/plugin/src/test/resources/xPathLinker/Case/uses/test.yang b/utils/yangutils/plugin/src/test/resources/xPathLinker/Case/uses/test.yang
new file mode 100644
index 0000000..e57a468
--- /dev/null
+++ b/utils/yangutils/plugin/src/test/resources/xPathLinker/Case/uses/test.yang
@@ -0,0 +1,31 @@
+module test {  
+    namespace "xpath:intra:single";  
+    prefix test ;  
+   
+    include test1;
+    include test2;
+    include test4;
+
+    organization "";  
+    contact "";  
+       
+    description   
+        "Defines basic service types for L3VPN service.";  
+       
+    revision "2015-12-16" {  
+        reference "";  
+    }  
+
+    augment /cont5/cont6/cont3/cont4 {
+       leaf a {
+          type int32;
+       }
+    }
+
+   augment /group1/cont3/cont4/cont8 {
+       leaf a {
+          type int32;
+       }
+    }
+}
+    
diff --git a/utils/yangutils/plugin/src/test/resources/xPathLinker/Case/uses/test1.yang b/utils/yangutils/plugin/src/test/resources/xPathLinker/Case/uses/test1.yang
new file mode 100644
index 0000000..2c5dc20
--- /dev/null
+++ b/utils/yangutils/plugin/src/test/resources/xPathLinker/Case/uses/test1.yang
@@ -0,0 +1,47 @@
+submodule test1 {  
+
+    belongs-to test {
+         prefix test;
+    }           
+
+    include test4;
+
+    organization "";  
+    contact "";  
+       
+    description   
+        "Defines basic service types for L3VPN service.";  
+       
+    revision "2015-12-16" {  
+        reference "";  
+    }
+
+    container cont1 {
+          leaf leaf1 {
+             type int32;
+         }
+         container cont2 {
+            leaf leaf2 {
+               type int32;
+            }
+         }
+     }
+    
+    augment /cont1/cont2 {
+        container cont4 {
+          leaf leaf1 {
+             type int32;
+          }
+       }
+    }
+
+     augment /group1/cont3/cont4 {
+        container cont8 {
+          leaf leaf8 {
+             type int32;
+          }
+       }
+    }
+
+}
+    
diff --git a/utils/yangutils/plugin/src/test/resources/xPathLinker/Case/uses/test2.yang b/utils/yangutils/plugin/src/test/resources/xPathLinker/Case/uses/test2.yang
new file mode 100644
index 0000000..fedb0aa
--- /dev/null
+++ b/utils/yangutils/plugin/src/test/resources/xPathLinker/Case/uses/test2.yang
@@ -0,0 +1,56 @@
+submodule test2{
+    belongs-to test {
+         prefix test;
+    }
+
+    include test1;
+    include test4;
+
+    organization "";  
+    contact "";  
+       
+    description   
+        "Defines basic service types for L3VPN service.";  
+       
+    revision "2015-12-16" {  
+        reference "";  
+    }  
+
+    grouping group2 {
+        container cont11 {
+        }
+    }
+
+    container cont5 {
+       leaf leaf5 {
+          type int32;
+       }
+       container cont6 {
+          leaf leaf6 {
+             type int32;
+          }
+       uses group1;
+       }
+    }
+
+     container ethernet {
+           leaf leaf10 {
+                 type string;
+            }
+     }
+         
+
+   augment /ethernet {
+       uses group2;
+   }
+
+   augment /cont1/cont2/cont4 {
+        container cont10 {
+          leaf leaf10 {
+             type int32;
+          }
+          
+       }
+    }
+}
+    
diff --git a/utils/yangutils/plugin/src/test/resources/xPathLinker/Case/uses/test4.yang b/utils/yangutils/plugin/src/test/resources/xPathLinker/Case/uses/test4.yang
new file mode 100644
index 0000000..589179d
--- /dev/null
+++ b/utils/yangutils/plugin/src/test/resources/xPathLinker/Case/uses/test4.yang
@@ -0,0 +1,37 @@
+submodule test4 {  
+
+    belongs-to test {
+         prefix test;
+    } 
+      
+    include test2;
+    organization "";  
+    contact "";  
+       
+    description   
+        "Defines basic service types for L3VPN service.";  
+       
+    revision "2015-12-16" {  
+        reference "";  
+    }  
+
+    grouping group1 {
+        container cont3 {
+           leaf leaf3 {
+              type int32;
+           }
+           container cont4 {
+                 leaf leaf4 {
+                    type int32;
+                 }
+            }
+        }
+    }
+
+    augment /ethernet/cont11 {
+       leaf leaf11 {
+             type int32;
+       }
+   }
+    
+}
diff --git a/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterMultiFileAugmentMulti/test.yang b/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterMultiFileAugmentMulti/test.yang
index 139e2c5..adb4800 100644
--- a/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterMultiFileAugmentMulti/test.yang
+++ b/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterMultiFileAugmentMulti/test.yang
@@ -21,7 +21,7 @@
     }  
 
      augment /test2:cont1/test2:cont2/test2:cont3/test1:cont2 {
-       leaf a {
+       leaf leaf8 {
           type int32;
        }
      }
diff --git a/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterMultiFileAugmentMulti/test1.yang b/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterMultiFileAugmentMulti/test1.yang
index ed3716f..0957e15 100644
--- a/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterMultiFileAugmentMulti/test1.yang
+++ b/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterMultiFileAugmentMulti/test1.yang
@@ -29,7 +29,7 @@
              type int32;
           }
           container cont2 {
-             leaf leaf1 {
+             leaf leaf3 {
                 type int32;
              }
           }
@@ -37,12 +37,12 @@
     }
    
     augment /test2:cont1/test2:cont2/test2:cont3 {
-       leaf a {
+       leaf leaf2 {
           type int32;
        }
 
        container cont2 {
-             leaf leaf1 {
+             leaf leaf4 {
                 type int32;
              }
         }
diff --git a/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterMultiFileAugmentMulti/test2.yang b/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterMultiFileAugmentMulti/test2.yang
index f65bef0..0eeb46d 100644
--- a/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterMultiFileAugmentMulti/test2.yang
+++ b/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterMultiFileAugmentMulti/test2.yang
@@ -13,11 +13,11 @@
     }  
 
     container cont1 {
-       leaf leaf1 {
+       leaf leaf5 {
           type int32;
        }
        container cont2 {
-          leaf leaf1 {
+          leaf leaf6 {
              type int32;
           }
        }
@@ -25,7 +25,7 @@
 
     augment /cont1/cont2 {
         container cont3 {
-            leaf a {
+            leaf leaf7 {
               type string;
             }
         }
diff --git a/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterMultiUses/test.yang b/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterMultiUses/test.yang
index 80ee110..01aa34e 100644
--- a/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterMultiUses/test.yang
+++ b/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterMultiUses/test.yang
@@ -23,7 +23,7 @@
        uses test2:group1; 
     }
 
-    augment /cont2/group1/cont1/cont2 {
+    augment /cont2/cont1/cont2 {
           leaf a {
           type int32;
        }
diff --git a/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterSingleUses/test.yang b/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterSingleUses/test.yang
index 4b15645..15a6fab 100644
--- a/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterSingleUses/test.yang
+++ b/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterSingleUses/test.yang
@@ -19,14 +19,14 @@
     }
 
     augment /test2:cont1/test2:cont2/cont2 {
-       leaf a {
+       leaf leaf {
           type int32;
        }
        uses group1; 
     }
 
-    augment /test2:cont1/test2:cont2/cont2/group1/cont1/cont2 {
-          leaf a {
+    augment /test2:cont1/test2:cont2/cont2/cont1/cont2 {
+          leaf leaf1 {
           type int32;
        }
     } 
diff --git a/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterSingleUses/test1.yang b/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterSingleUses/test1.yang
index fbc3bcb..e7fbc31 100644
--- a/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterSingleUses/test1.yang
+++ b/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterSingleUses/test1.yang
@@ -21,7 +21,7 @@
     grouping group1 {
         container cont1 {
            container cont2 {
-               leaf a {
+               leaf leaf2 {
                   type string;
                }
            }
@@ -29,7 +29,7 @@
     }
 
     augment /test2:cont1/test2:cont2 {
-       leaf a {
+       leaf leaf3 {
           type int32;
        }
        container cont2 {
diff --git a/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterSingleUses/test2.yang b/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterSingleUses/test2.yang
index f20ac7d..2905f9a 100644
--- a/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterSingleUses/test2.yang
+++ b/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterSingleUses/test2.yang
@@ -13,11 +13,11 @@
     }  
 
     container cont1 {
-       leaf leaf1 {
+       leaf leaf4 {
           type int32;
        }
        container cont2 {
-          leaf leaf1 {
+          leaf leaf5 {
              type int32;
           }
        }
diff --git a/utils/yangutils/plugin/src/test/resources/xPathLinker/IntraFile/IntraMultiUses/test.yang b/utils/yangutils/plugin/src/test/resources/xPathLinker/IntraFile/IntraMultiUses/test.yang
index 6cfb133..6d7473d 100644
--- a/utils/yangutils/plugin/src/test/resources/xPathLinker/IntraFile/IntraMultiUses/test.yang
+++ b/utils/yangutils/plugin/src/test/resources/xPathLinker/IntraFile/IntraMultiUses/test.yang
@@ -29,7 +29,7 @@
          uses group1;
     }
 
-    augment /cont2/group1/cont1/cont3 {
+    augment /cont2/cont1/cont3 {
        leaf a {
           type int32;
        }
diff --git a/utils/yangutils/plugin/src/test/resources/xPathLinker/IntraFile/IntraSingleUses/test.yang b/utils/yangutils/plugin/src/test/resources/xPathLinker/IntraFile/IntraSingleUses/test.yang
index c60668a..3074db7 100644
--- a/utils/yangutils/plugin/src/test/resources/xPathLinker/IntraFile/IntraSingleUses/test.yang
+++ b/utils/yangutils/plugin/src/test/resources/xPathLinker/IntraFile/IntraSingleUses/test.yang
@@ -24,7 +24,7 @@
          uses group1;
     }
 
-    augment /cont2/group1/cont1 {
+    augment /cont2/cont1 {
        leaf a {
           type int32;
        }