[ONOS-4799],[ONOS-4351] Augment inter file linker and Generated Code refactored.

Change-Id: Id1f3ac9c90a632373f51cc75d499c3110216be17
diff --git a/plugin/src/test/resources/xPathLinker/InterFile/InterMulti/test.yang b/plugin/src/test/resources/xPathLinker/InterFile/InterMulti/test.yang
new file mode 100644
index 0000000..772f792
--- /dev/null
+++ b/plugin/src/test/resources/xPathLinker/InterFile/InterMulti/test.yang
@@ -0,0 +1,25 @@
+module test {  
+    namespace "xpath:inter:single";  
+    prefix test ; 
+   
+    import test1{
+       prefix test1;
+    }
+ 
+    organization "";  
+    contact "";  
+       
+    description   
+        "Defines basic service types for L3VPN service.";  
+       
+    revision "2015-12-16" {  
+        reference "";  
+    }  
+
+    augment /test1:cont1/test1:cont2 {
+       leaf a {
+          type int32;
+       }
+    }
+}
+    
diff --git a/plugin/src/test/resources/xPathLinker/InterFile/InterMulti/test1.yang b/plugin/src/test/resources/xPathLinker/InterFile/InterMulti/test1.yang
new file mode 100644
index 0000000..9c1cdb0
--- /dev/null
+++ b/plugin/src/test/resources/xPathLinker/InterFile/InterMulti/test1.yang
@@ -0,0 +1,26 @@
+module test1 {  
+    namespace "xpath:inter:single";  
+    prefix test1 ;  
+      
+    organization "";  
+    contact "";  
+       
+    description   
+        "Defines basic service types for L3VPN service.";  
+       
+    revision "2015-12-16" {  
+        reference "";  
+    }  
+
+    container cont1 {
+       leaf leaf1 {
+          type int32;
+       }
+       container cont2 {
+           leaf leaf1 {
+             type int32;
+          }
+       }
+    }
+}
+    
diff --git a/plugin/src/test/resources/xPathLinker/InterFile/InterMultiAugment/test.yang b/plugin/src/test/resources/xPathLinker/InterFile/InterMultiAugment/test.yang
new file mode 100644
index 0000000..640a15a
--- /dev/null
+++ b/plugin/src/test/resources/xPathLinker/InterFile/InterMultiAugment/test.yang
@@ -0,0 +1,25 @@
+module test {  
+    namespace "xpath:inter:single";  
+    prefix test ; 
+   
+    import test1{
+       prefix test1;
+    }
+ 
+    organization "";  
+    contact "";  
+       
+    description   
+        "Defines basic service types for L3VPN service.";  
+       
+    revision "2015-12-16" {  
+        reference "";  
+    }  
+
+    augment /test1:cont1/test1:cont2/test1:cont2 {
+       leaf a {
+          type int32;
+       }
+    }
+}
+    
diff --git a/plugin/src/test/resources/xPathLinker/InterFile/InterMultiAugment/test1.yang b/plugin/src/test/resources/xPathLinker/InterFile/InterMultiAugment/test1.yang
new file mode 100644
index 0000000..c9fbeab
--- /dev/null
+++ b/plugin/src/test/resources/xPathLinker/InterFile/InterMultiAugment/test1.yang
@@ -0,0 +1,34 @@
+module test1 {  
+    namespace "xpath:inter:single";  
+    prefix test1 ;  
+      
+    organization "";  
+    contact "";  
+       
+    description   
+        "Defines basic service types for L3VPN service.";  
+       
+    revision "2015-12-16" {  
+        reference "";  
+    }  
+
+    container cont1 {
+       leaf leaf1 {
+          type int32;
+       }
+    }
+
+    augment /cont1 {
+       container cont2 {
+          leaf leaf1 {
+             type int32;
+          }
+          container cont2 {
+             leaf leaf1 {
+                type int32;
+             }
+          }
+       }
+    }
+}
+    
diff --git a/plugin/src/test/resources/xPathLinker/InterFile/InterMultiFileAugment/test.yang b/plugin/src/test/resources/xPathLinker/InterFile/InterMultiFileAugment/test.yang
new file mode 100644
index 0000000..53ed780
--- /dev/null
+++ b/plugin/src/test/resources/xPathLinker/InterFile/InterMultiFileAugment/test.yang
@@ -0,0 +1,29 @@
+module test {  
+    namespace "xpath:inter:single";  
+    prefix test ; 
+   
+    import test1{
+       prefix test1;
+    }
+
+    import test2{
+       prefix test2;
+    }
+ 
+    organization "";  
+    contact "";  
+       
+    description   
+        "Defines basic service types for L3VPN service.";  
+       
+    revision "2015-12-16" {  
+        reference "";  
+    }  
+
+     augment /test2:cont1/test2:cont2/test1:cont2 {
+       leaf a {
+          type int32;
+       }
+     }
+}
+    
diff --git a/plugin/src/test/resources/xPathLinker/InterFile/InterMultiFileAugment/test1.yang b/plugin/src/test/resources/xPathLinker/InterFile/InterMultiFileAugment/test1.yang
new file mode 100644
index 0000000..9ae5e24
--- /dev/null
+++ b/plugin/src/test/resources/xPathLinker/InterFile/InterMultiFileAugment/test1.yang
@@ -0,0 +1,51 @@
+module test1 {  
+    namespace "xpath:inter:single";  
+    prefix test1 ;  
+      
+    import test2{
+       prefix test2;
+    }
+
+    organization "";  
+    contact "";  
+       
+    description   
+        "Defines basic service types for L3VPN service.";  
+       
+    revision "2015-12-16" {  
+        reference "";  
+    }  
+
+
+    container cont1 {
+       leaf leaf1 {
+          type int32;
+       }
+    }
+
+    augment /cont1 {
+       container cont2 {
+          leaf leaf1 {
+             type int32;
+          }
+          container cont2 {
+             leaf leaf1 {
+                type int32;
+             }
+          }
+       }
+    }
+   
+    augment /test2:cont1/test2:cont2 {
+       leaf a {
+          type int32;
+       }
+
+       container cont2 {
+             leaf leaf1 {
+                type int32;
+             }
+        }
+    }
+}
+    
diff --git a/plugin/src/test/resources/xPathLinker/InterFile/InterMultiFileAugment/test2.yang b/plugin/src/test/resources/xPathLinker/InterFile/InterMultiFileAugment/test2.yang
new file mode 100644
index 0000000..f20ac7d
--- /dev/null
+++ b/plugin/src/test/resources/xPathLinker/InterFile/InterMultiFileAugment/test2.yang
@@ -0,0 +1,26 @@
+module test2 {  
+    namespace "xpath:inter:multi";  
+    prefix test2 ;  
+      
+    organization "";  
+    contact "";  
+       
+    description   
+        "Defines basic service types for L3VPN service.";  
+       
+    revision "2015-12-16" {  
+        reference "";  
+    }  
+
+    container cont1 {
+       leaf leaf1 {
+          type int32;
+       }
+       container cont2 {
+          leaf leaf1 {
+             type int32;
+          }
+       }
+    }
+}
+    
diff --git a/plugin/src/test/resources/xPathLinker/InterFile/InterMultiFileAugmentMulti/test.yang b/plugin/src/test/resources/xPathLinker/InterFile/InterMultiFileAugmentMulti/test.yang
new file mode 100644
index 0000000..139e2c5
--- /dev/null
+++ b/plugin/src/test/resources/xPathLinker/InterFile/InterMultiFileAugmentMulti/test.yang
@@ -0,0 +1,29 @@
+module test {  
+    namespace "xpath:inter:single";  
+    prefix test ; 
+   
+    import test1{
+       prefix test1;
+    }
+
+    import test2{
+       prefix test2;
+    }
+ 
+    organization "";  
+    contact "";  
+       
+    description   
+        "Defines basic service types for L3VPN service.";  
+       
+    revision "2015-12-16" {  
+        reference "";  
+    }  
+
+     augment /test2:cont1/test2:cont2/test2:cont3/test1:cont2 {
+       leaf a {
+          type int32;
+       }
+     }
+}
+    
diff --git a/plugin/src/test/resources/xPathLinker/InterFile/InterMultiFileAugmentMulti/test1.yang b/plugin/src/test/resources/xPathLinker/InterFile/InterMultiFileAugmentMulti/test1.yang
new file mode 100644
index 0000000..ed3716f
--- /dev/null
+++ b/plugin/src/test/resources/xPathLinker/InterFile/InterMultiFileAugmentMulti/test1.yang
@@ -0,0 +1,51 @@
+module test1 {  
+    namespace "xpath:inter:single";  
+    prefix test1 ;  
+      
+    import test2{
+       prefix test2;
+    }
+
+    organization "";  
+    contact "";  
+       
+    description   
+        "Defines basic service types for L3VPN service.";  
+       
+    revision "2015-12-16" {  
+        reference "";  
+    }  
+
+
+    container cont1 {
+       leaf leaf1 {
+          type int32;
+       }
+    }
+
+    augment /cont1 {
+       container cont2 {
+          leaf leaf1 {
+             type int32;
+          }
+          container cont2 {
+             leaf leaf1 {
+                type int32;
+             }
+          }
+       }
+    }
+   
+    augment /test2:cont1/test2:cont2/test2:cont3 {
+       leaf a {
+          type int32;
+       }
+
+       container cont2 {
+             leaf leaf1 {
+                type int32;
+             }
+        }
+    }
+}
+    
diff --git a/plugin/src/test/resources/xPathLinker/InterFile/InterMultiFileAugmentMulti/test2.yang b/plugin/src/test/resources/xPathLinker/InterFile/InterMultiFileAugmentMulti/test2.yang
new file mode 100644
index 0000000..f65bef0
--- /dev/null
+++ b/plugin/src/test/resources/xPathLinker/InterFile/InterMultiFileAugmentMulti/test2.yang
@@ -0,0 +1,34 @@
+module test2 {  
+    namespace "xpath:inter:multi";  
+    prefix test2 ;  
+      
+    organization "";  
+    contact "";  
+       
+    description   
+        "Defines basic service types for L3VPN service.";  
+       
+    revision "2015-12-16" {  
+        reference "";  
+    }  
+
+    container cont1 {
+       leaf leaf1 {
+          type int32;
+       }
+       container cont2 {
+          leaf leaf1 {
+             type int32;
+          }
+       }
+    }
+
+    augment /cont1/cont2 {
+        container cont3 {
+            leaf a {
+              type string;
+            }
+        }
+    }
+}
+    
diff --git a/plugin/src/test/resources/xPathLinker/InterFile/InterMultiSubModule/test.yang b/plugin/src/test/resources/xPathLinker/InterFile/InterMultiSubModule/test.yang
new file mode 100644
index 0000000..40b2386
--- /dev/null
+++ b/plugin/src/test/resources/xPathLinker/InterFile/InterMultiSubModule/test.yang
@@ -0,0 +1,33 @@
+module test {  
+    namespace "xpath:intra:single";  
+    prefix test ;  
+    
+    import test2 {
+       prefix test2;
+    }
+   
+    include test1;
+
+    organization "";  
+    contact "";  
+       
+    description   
+        "Defines basic service types for L3VPN service.";  
+       
+    revision "2015-12-16" {  
+        reference "";  
+    }  
+
+    augment /test2:cont1/test2:cont2/cont2 {
+       leaf a {
+          type int32;
+       }
+    }
+
+    augment /cont2/cont3/cont4 {
+       leaf a {
+          type int32;
+       }
+    }
+}
+    
diff --git a/plugin/src/test/resources/xPathLinker/InterFile/InterMultiSubModule/test1.yang b/plugin/src/test/resources/xPathLinker/InterFile/InterMultiSubModule/test1.yang
new file mode 100644
index 0000000..a19ba35
--- /dev/null
+++ b/plugin/src/test/resources/xPathLinker/InterFile/InterMultiSubModule/test1.yang
@@ -0,0 +1,50 @@
+submodule test1 {  
+
+    belongs-to test {
+         prefix test;
+    }           
+    
+    import test2 {
+       prefix test2;
+    }
+    organization "";  
+    contact "";  
+       
+    description   
+        "Defines basic service types for L3VPN service.";  
+       
+    revision "2015-12-16" {  
+        reference "";  
+    }
+
+    container cont2 {
+          leaf leaf1 {
+             type int32;
+         }
+         container cont3 {
+            leaf leaf1 {
+               type int32;
+            }
+         }
+     }
+    
+    augment /cont2/cont3 {
+        container cont4 {
+          leaf leaf1 {
+             type int32;
+          }
+       }
+    }
+
+    augment /test2:cont1/test2:cont2 {
+       leaf a {
+          type int32;
+       }
+       container cont2 {
+          leaf leaf1 {
+             type int32;
+          }
+       }
+    }
+}
+    
diff --git a/plugin/src/test/resources/xPathLinker/InterFile/InterMultiSubModule/test2.yang b/plugin/src/test/resources/xPathLinker/InterFile/InterMultiSubModule/test2.yang
new file mode 100644
index 0000000..f20ac7d
--- /dev/null
+++ b/plugin/src/test/resources/xPathLinker/InterFile/InterMultiSubModule/test2.yang
@@ -0,0 +1,26 @@
+module test2 {  
+    namespace "xpath:inter:multi";  
+    prefix test2 ;  
+      
+    organization "";  
+    contact "";  
+       
+    description   
+        "Defines basic service types for L3VPN service.";  
+       
+    revision "2015-12-16" {  
+        reference "";  
+    }  
+
+    container cont1 {
+       leaf leaf1 {
+          type int32;
+       }
+       container cont2 {
+          leaf leaf1 {
+             type int32;
+          }
+       }
+    }
+}
+    
diff --git a/plugin/src/test/resources/xPathLinker/InterFile/InterMultiUses/test.yang b/plugin/src/test/resources/xPathLinker/InterFile/InterMultiUses/test.yang
new file mode 100644
index 0000000..80ee110
--- /dev/null
+++ b/plugin/src/test/resources/xPathLinker/InterFile/InterMultiUses/test.yang
@@ -0,0 +1,32 @@
+module test {  
+    namespace "xpath:intra:single";  
+    prefix test ;  
+    
+    import test2 {
+       prefix test2;
+    }
+   
+    organization "";  
+    contact "";  
+       
+    description   
+        "Defines basic service types for L3VPN service.";  
+       
+    revision "2015-12-16" {  
+        reference "";  
+    }
+
+    container cont2 {
+       leaf a {
+          type int32;
+       }
+       uses test2:group1; 
+    }
+
+    augment /cont2/group1/cont1/cont2 {
+          leaf a {
+          type int32;
+       }
+    } 
+}
+    
diff --git a/plugin/src/test/resources/xPathLinker/InterFile/InterMultiUses/test2.yang b/plugin/src/test/resources/xPathLinker/InterFile/InterMultiUses/test2.yang
new file mode 100644
index 0000000..298d443
--- /dev/null
+++ b/plugin/src/test/resources/xPathLinker/InterFile/InterMultiUses/test2.yang
@@ -0,0 +1,28 @@
+module test2 {  
+    namespace "xpath:inter:multi";  
+    prefix test2 ;  
+      
+    organization "";  
+    contact "";  
+       
+    description   
+        "Defines basic service types for L3VPN service.";  
+       
+    revision "2015-12-16" {  
+        reference "";  
+    }  
+
+   grouping group1 {
+    container cont1 {
+       leaf leaf1 {
+          type int32;
+       }
+       container cont2 {
+          leaf leaf1 {
+             type int32;
+          }
+       }
+    }
+  }
+}
+    
diff --git a/plugin/src/test/resources/xPathLinker/InterFile/InterSingle/test.yang b/plugin/src/test/resources/xPathLinker/InterFile/InterSingle/test.yang
new file mode 100644
index 0000000..102ec39
--- /dev/null
+++ b/plugin/src/test/resources/xPathLinker/InterFile/InterSingle/test.yang
@@ -0,0 +1,25 @@
+module test {  
+    namespace "xpath:inter:single";  
+    prefix test ; 
+   
+    import test1{
+       prefix test1;
+    }
+ 
+    organization "";  
+    contact "";  
+       
+    description   
+        "Defines basic service types for L3VPN service.";  
+       
+    revision "2015-12-16" {  
+        reference "";  
+    }  
+
+    augment /test1:cont1 {
+       leaf a {
+          type int32;
+       }
+    }
+}
+    
diff --git a/plugin/src/test/resources/xPathLinker/InterFile/InterSingle/test1.yang b/plugin/src/test/resources/xPathLinker/InterFile/InterSingle/test1.yang
new file mode 100644
index 0000000..243ddfe
--- /dev/null
+++ b/plugin/src/test/resources/xPathLinker/InterFile/InterSingle/test1.yang
@@ -0,0 +1,21 @@
+module test1 {  
+    namespace "xpath:inter:single";  
+    prefix test1 ;  
+      
+    organization "";  
+    contact "";  
+       
+    description   
+        "Defines basic service types for L3VPN service.";  
+       
+    revision "2015-12-16" {  
+        reference "";  
+    }  
+
+    container cont1 {
+       leaf leaf1 {
+          type int32;
+       }
+    }
+}
+    
diff --git a/plugin/src/test/resources/xPathLinker/InterFile/InterSingleAugment/test.yang b/plugin/src/test/resources/xPathLinker/InterFile/InterSingleAugment/test.yang
new file mode 100644
index 0000000..772f792
--- /dev/null
+++ b/plugin/src/test/resources/xPathLinker/InterFile/InterSingleAugment/test.yang
@@ -0,0 +1,25 @@
+module test {  
+    namespace "xpath:inter:single";  
+    prefix test ; 
+   
+    import test1{
+       prefix test1;
+    }
+ 
+    organization "";  
+    contact "";  
+       
+    description   
+        "Defines basic service types for L3VPN service.";  
+       
+    revision "2015-12-16" {  
+        reference "";  
+    }  
+
+    augment /test1:cont1/test1:cont2 {
+       leaf a {
+          type int32;
+       }
+    }
+}
+    
diff --git a/plugin/src/test/resources/xPathLinker/InterFile/InterSingleAugment/test1.yang b/plugin/src/test/resources/xPathLinker/InterFile/InterSingleAugment/test1.yang
new file mode 100644
index 0000000..b9c5e32
--- /dev/null
+++ b/plugin/src/test/resources/xPathLinker/InterFile/InterSingleAugment/test1.yang
@@ -0,0 +1,29 @@
+module test1 {  
+    namespace "xpath:inter:single";  
+    prefix test1 ;  
+      
+    organization "";  
+    contact "";  
+       
+    description   
+        "Defines basic service types for L3VPN service.";  
+       
+    revision "2015-12-16" {  
+        reference "";  
+    }  
+
+    container cont1 {
+       leaf leaf1 {
+          type int32;
+       }
+    }
+
+    augment /cont1 {
+       container cont2 {
+          leaf leaf1 {
+             type int32;
+          }
+       }
+    }
+}
+    
diff --git a/plugin/src/test/resources/xPathLinker/InterFile/InterSingleSubModule/test.yang b/plugin/src/test/resources/xPathLinker/InterFile/InterSingleSubModule/test.yang
new file mode 100644
index 0000000..a8340ab
--- /dev/null
+++ b/plugin/src/test/resources/xPathLinker/InterFile/InterSingleSubModule/test.yang
@@ -0,0 +1,27 @@
+module test {  
+    namespace "xpath:intra:single";  
+    prefix test ;  
+    
+    import test2 {
+       prefix test2;
+    }
+   
+    include test1;
+
+    organization "";  
+    contact "";  
+       
+    description   
+        "Defines basic service types for L3VPN service.";  
+       
+    revision "2015-12-16" {  
+        reference "";  
+    }  
+
+    augment /test2:cont1/test2:cont2/cont2 {
+       leaf a {
+          type int32;
+       }
+    }
+}
+    
diff --git a/plugin/src/test/resources/xPathLinker/InterFile/InterSingleSubModule/test1.yang b/plugin/src/test/resources/xPathLinker/InterFile/InterSingleSubModule/test1.yang
new file mode 100644
index 0000000..ebc8750
--- /dev/null
+++ b/plugin/src/test/resources/xPathLinker/InterFile/InterSingleSubModule/test1.yang
@@ -0,0 +1,31 @@
+submodule test1 {  
+
+    belongs-to test {
+         prefix test;
+    }           
+    
+    import test2 {
+       prefix test2;
+    }
+    organization "";  
+    contact "";  
+       
+    description   
+        "Defines basic service types for L3VPN service.";  
+       
+    revision "2015-12-16" {  
+        reference "";  
+    }  
+
+    augment /test2:cont1/test2:cont2 {
+       leaf a {
+          type int32;
+       }
+       container cont2 {
+          leaf leaf1 {
+             type int32;
+          }
+       }
+    }
+}
+    
diff --git a/plugin/src/test/resources/xPathLinker/InterFile/InterSingleSubModule/test2.yang b/plugin/src/test/resources/xPathLinker/InterFile/InterSingleSubModule/test2.yang
new file mode 100644
index 0000000..f20ac7d
--- /dev/null
+++ b/plugin/src/test/resources/xPathLinker/InterFile/InterSingleSubModule/test2.yang
@@ -0,0 +1,26 @@
+module test2 {  
+    namespace "xpath:inter:multi";  
+    prefix test2 ;  
+      
+    organization "";  
+    contact "";  
+       
+    description   
+        "Defines basic service types for L3VPN service.";  
+       
+    revision "2015-12-16" {  
+        reference "";  
+    }  
+
+    container cont1 {
+       leaf leaf1 {
+          type int32;
+       }
+       container cont2 {
+          leaf leaf1 {
+             type int32;
+          }
+       }
+    }
+}
+    
diff --git a/plugin/src/test/resources/xPathLinker/InterFile/InterSingleUses/test.yang b/plugin/src/test/resources/xPathLinker/InterFile/InterSingleUses/test.yang
new file mode 100644
index 0000000..4b15645
--- /dev/null
+++ b/plugin/src/test/resources/xPathLinker/InterFile/InterSingleUses/test.yang
@@ -0,0 +1,34 @@
+module test {  
+    namespace "xpath:intra:single";  
+    prefix test ;  
+    
+    import test2 {
+       prefix test2;
+    }
+   
+    include test1;
+
+    organization "";  
+    contact "";  
+       
+    description   
+        "Defines basic service types for L3VPN service.";  
+       
+    revision "2015-12-16" {  
+        reference "";  
+    }
+
+    augment /test2:cont1/test2:cont2/cont2 {
+       leaf a {
+          type int32;
+       }
+       uses group1; 
+    }
+
+    augment /test2:cont1/test2:cont2/cont2/group1/cont1/cont2 {
+          leaf a {
+          type int32;
+       }
+    } 
+}
+    
diff --git a/plugin/src/test/resources/xPathLinker/InterFile/InterSingleUses/test1.yang b/plugin/src/test/resources/xPathLinker/InterFile/InterSingleUses/test1.yang
new file mode 100644
index 0000000..fbc3bcb
--- /dev/null
+++ b/plugin/src/test/resources/xPathLinker/InterFile/InterSingleUses/test1.yang
@@ -0,0 +1,42 @@
+submodule test1 {  
+
+    belongs-to test {
+         prefix test;
+    }           
+    
+    import test2 {
+       prefix test2;
+    }
+    organization "";  
+    contact "";  
+       
+    description   
+        "Defines basic service types for L3VPN service.";  
+       
+    revision "2015-12-16" {  
+        reference "";  
+    }  
+
+
+    grouping group1 {
+        container cont1 {
+           container cont2 {
+               leaf a {
+                  type string;
+               }
+           }
+        }
+    }
+
+    augment /test2:cont1/test2:cont2 {
+       leaf a {
+          type int32;
+       }
+       container cont2 {
+          leaf leaf1 {
+             type int32;
+          }
+       }
+    }
+}
+    
diff --git a/plugin/src/test/resources/xPathLinker/InterFile/InterSingleUses/test2.yang b/plugin/src/test/resources/xPathLinker/InterFile/InterSingleUses/test2.yang
new file mode 100644
index 0000000..f20ac7d
--- /dev/null
+++ b/plugin/src/test/resources/xPathLinker/InterFile/InterSingleUses/test2.yang
@@ -0,0 +1,26 @@
+module test2 {  
+    namespace "xpath:inter:multi";  
+    prefix test2 ;  
+      
+    organization "";  
+    contact "";  
+       
+    description   
+        "Defines basic service types for L3VPN service.";  
+       
+    revision "2015-12-16" {  
+        reference "";  
+    }  
+
+    container cont1 {
+       leaf leaf1 {
+          type int32;
+       }
+       container cont2 {
+          leaf leaf1 {
+             type int32;
+          }
+       }
+    }
+}
+