Lookup leaf key methods in parents
[mdsal.git] / binding / mdsal-binding-generator-impl / src / test / resources / mdsal161.yang
diff --git a/binding/mdsal-binding-generator-impl/src/test/resources/mdsal161.yang b/binding/mdsal-binding-generator-impl/src/test/resources/mdsal161.yang
new file mode 100644 (file)
index 0000000..a49e9cd
--- /dev/null
@@ -0,0 +1,120 @@
+module mdsal161 {
+    namespace "mdsal161";
+    prefix "mdsal161";
+
+    // Reported case:
+    typedef revision-identifier {
+        type string {
+            pattern '\d{4}-\d{2}-\d{2}';
+        }
+    }
+
+    grouping grp {
+        leaf name {
+            type string;
+        }
+        leaf revision {
+            type union {
+                type revision-identifier;
+                type string { length 0; }
+            }
+        }
+    }
+
+    list with-grp {
+        key "name revision";
+
+        uses grp;
+    }
+
+    // Simpler case: same thing without the grouping
+    list without-grp {
+        key "name revision";
+
+        leaf name {
+            type string;
+        }
+        leaf revision {
+            type union {
+                type revision-identifier;
+                type string { length 0; }
+            }
+        }
+    }
+
+    // Two different cases: the type is defined in a grouping typedef
+    grouping grp-typedef {
+        typedef revision-type {
+            type union {
+                type revision-identifier;
+                type string { length 0; }
+            }
+        }
+
+        leaf name {
+            type string;
+        }
+        leaf revision {
+            type revision-type;
+        }
+    }
+
+    list with-grp-typedef {
+        key "name revision";
+
+        uses grp-typedef;
+    }
+
+    list without-grp-typedef {
+        typedef revision-type {
+            type union {
+                type revision-identifier;
+                type string { length 0; }
+            }
+        }
+
+        key "name revision";
+
+        leaf name {
+            type string;
+        }
+        leaf revision {
+            type revision-type;
+        }
+    }
+
+    // Another set of cases: the type is externally typedef'd
+    typedef ext-typedef {
+        type union {
+            type revision-identifier;
+            type string { length 0; }
+        }
+    }
+
+    grouping grp-ext {
+        leaf name {
+            type string;
+        }
+        leaf revision {
+            type ext-typedef;
+        }
+    }
+
+    list with-grp-ext {
+        key "name revision";
+
+        uses grp-ext;
+    }
+
+    list without-grp-ext {
+        key "name revision";
+
+        leaf name {
+            type string;
+        }
+        leaf revision {
+            type ext-typedef;
+        }
+    }
+}
+