[ONOS-5400][ONOS-5614] identity ref support in yangtools and defect fixes.

Change-Id: Ia1f32a6772e9d468717340953cf7598c61d9f1ed
diff --git a/plugin/maven/src/test/resources/ValidPatternStatement.yang b/plugin/maven/src/test/resources/ValidPatternStatement.yang
index 556db31..0c93e9d 100644
--- a/plugin/maven/src/test/resources/ValidPatternStatement.yang
+++ b/plugin/maven/src/test/resources/ValidPatternStatement.yang
@@ -7,4 +7,24 @@
             pattern "[a-zA-Z]";
          }
     }
+    leaf ipv4-address {
+         type string {
+           pattern
+          '(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(%[\p{N}\p{L}]+)?';
+         }
+      description
+        "The ipv4-address type represents an IPv4 address in
+       dotted-quad notation.  The IPv4 address may include a zone
+       index, separated by a % sign.
+
+       The zone index is used to disambiguate identical address
+       values.  For link-local addresses, the zone index will
+       typically be the interface index number or the name of an
+       interface.  If the zone index is not present, the default
+       zone of the device will be used.
+
+       The canonical format for the zone index is the numerical
+       format";
+    }
+
 }
diff --git a/plugin/maven/src/test/resources/augmentTranslator/test.yang b/plugin/maven/src/test/resources/augmentTranslator/test.yang
index 20393a7..a5a0daf 100644
--- a/plugin/maven/src/test/resources/augmentTranslator/test.yang
+++ b/plugin/maven/src/test/resources/augmentTranslator/test.yang
@@ -71,6 +71,20 @@
         }
     }
     augment /choice1 {
+        case case2 {
+            container con1 {
+                leaf in1 {
+                   type int32;
+                }
+            }
+        }
+        case case3 {
+            container con2 {
+                leaf in2 {
+                   type int32;
+                }
+            }
+        }
         leaf-list leaf2 {
            type int32;
         }
diff --git a/plugin/maven/src/test/resources/compilerAnnotation/test.yang b/plugin/maven/src/test/resources/compilerAnnotation/test.yang
new file mode 100644
index 0000000..592e23f
--- /dev/null
+++ b/plugin/maven/src/test/resources/compilerAnnotation/test.yang
@@ -0,0 +1,33 @@
+module test {  
+    namespace "test:test";  
+    prefix test;
+    typedef type1 {
+        type string;
+    }
+    list list1 {
+       key "name sur-name";
+       leaf name {
+          type string;
+       }
+       leaf sur-name {
+           type type1;
+       }
+       choice c1 {
+          case ca1 {
+             leaf a {
+                type int32;
+             }
+          }
+       }
+    }
+    list list2 {
+           key "name sur-name";
+           leaf name {
+              type string;
+           }
+           leaf sur-name {
+               type type1;
+           }
+        }
+}
+    
diff --git a/plugin/maven/src/test/resources/compilerAnnotation/test2.yang b/plugin/maven/src/test/resources/compilerAnnotation/test2.yang
new file mode 100644
index 0000000..704f724
--- /dev/null
+++ b/plugin/maven/src/test/resources/compilerAnnotation/test2.yang
@@ -0,0 +1,21 @@
+module test1 {  
+    namespace "test1:test1";  
+    prefix test1 ;  
+
+    import test {
+       prefix test;
+    }
+    organization "";  
+    contact "";  
+
+    description   
+       "Defines basic service types for L3VPN service.";  
+
+    revision "2015-12-16" {  
+       reference "";  
+    }
+
+    ca:compiler-annotation /test:list1 {
+        ds:app-data-structure "Map";
+    }
+}
\ No newline at end of file
diff --git a/plugin/maven/src/test/resources/identityTranslator/test.yang b/plugin/maven/src/test/resources/identityTranslator/test.yang
index b8a3193..e8c1889 100644
--- a/plugin/maven/src/test/resources/identityTranslator/test.yang
+++ b/plugin/maven/src/test/resources/identityTranslator/test.yang
@@ -1,14 +1,70 @@
-module IdentityInModule{
+module IdentityTest{
     yang-version 1;
     namespace http://huawei.com;
-    prefix IdentityInModule;
+    prefix IdentityTest;
 
     identity ref-address-family {
-        reference "http://www.iana.org/assignments/address-family-numbers/address-family-numbers.xhtml#address-family-numbers-2";
+        description "ref-address-family";
     }
-    leaf tunnel {
+
+    identity ipv4-address-family {
+        base ref-address-family;
+    }
+
+    identity ipv6-address-family {
+        base ipv4-address-family;
+    }
+
+    typedef tunnel-type {
         type identityref {
             base ref-address-family;
         }
     }
-}
\ No newline at end of file
+    leaf tunnel1 {
+        type identityref {
+            base ipv4-address-family;
+        }
+    }
+
+    typedef type2 {
+       type identityref {
+            base ipv4-address-family;
+        }
+    }
+    typedef type3 {
+    type union {
+                type type2;
+                type identityref {
+                     base ipv4-address-family;
+                }
+            }
+    }
+    leaf tunnel {
+        type union {
+            type type2;
+            type identityref {
+                 base ipv6-address-family;
+            }
+        }
+    }
+ typedef ipv4-address {
+      type string {
+        pattern
+          '(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(%[\p{N}\p{L}]+)?';
+      }
+      description
+        "The ipv4-address type represents an IPv4 address in
+       dotted-quad notation.  The IPv4 address may include a zone
+       index, separated by a % sign.
+
+       The zone index is used to disambiguate identical address
+       values.  For link-local addresses, the zone index will
+       typically be the interface index number or the name of an
+       interface.  If the zone index is not present, the default
+       zone of the device will be used.
+
+       The canonical format for the zone index is the numerical
+       format";
+    }
+
+}