config ang key validation and UT for the same

Change-Id: I507740fc9da3f3da5fb3c88a7414f87db6251c5b
diff --git a/src/test/resources/ConfigDefaultValue.yang b/src/test/resources/ConfigDefaultValue.yang
new file mode 100644
index 0000000..7e19946
--- /dev/null
+++ b/src/test/resources/ConfigDefaultValue.yang
@@ -0,0 +1,15 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    container valid {
+        leaf invalid-interval {
+            type "uint16";
+            units "seconds";
+            description "Interval before a route is declared invalid";
+            mandatory true;
+            status current;
+            reference "RFC 6020";
+        }
+    }
+}
diff --git a/src/test/resources/ConfigFalseNoKey.yang b/src/test/resources/ConfigFalseNoKey.yang
new file mode 100644
index 0000000..66f141e
--- /dev/null
+++ b/src/test/resources/ConfigFalseNoKey.yang
@@ -0,0 +1,14 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    list valid {
+        config false;
+        leaf invalid-interval {
+            type "string";
+            units "seconds";
+            status current;
+            reference "RFC 6020";
+        }
+    }
+}
diff --git a/src/test/resources/ConfigFalseParentContainerChildLeaf.yang b/src/test/resources/ConfigFalseParentContainerChildLeaf.yang
new file mode 100644
index 0000000..ecc0806
--- /dev/null
+++ b/src/test/resources/ConfigFalseParentContainerChildLeaf.yang
@@ -0,0 +1,15 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    container valid {
+        config false;
+        leaf invalid-interval {
+            type "uint16";
+            units "seconds";
+            status current;
+            config true;
+            reference "RFC 6020";
+        }
+    }
+}
diff --git a/src/test/resources/ConfigFalseParentContainerChildLeafList.yang b/src/test/resources/ConfigFalseParentContainerChildLeafList.yang
new file mode 100644
index 0000000..e3c7836
--- /dev/null
+++ b/src/test/resources/ConfigFalseParentContainerChildLeafList.yang
@@ -0,0 +1,15 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    container valid {
+        config false;
+        leaf-list invalid-interval {
+            type "uint16";
+            units "seconds";
+            status current;
+            config true;
+            reference "RFC 6020";
+        }
+    }
+}
diff --git a/src/test/resources/ConfigFalseParentContainerChildList.yang b/src/test/resources/ConfigFalseParentContainerChildList.yang
new file mode 100644
index 0000000..78fbe15
--- /dev/null
+++ b/src/test/resources/ConfigFalseParentContainerChildList.yang
@@ -0,0 +1,18 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    container valid {
+        config false;
+    	list valid {
+            key "invalid-interval";
+            config true;
+            leaf invalid-interval {
+                type "uint16";
+                units "seconds";
+                status current;
+                reference "RFC 6020";
+            }
+        }
+    }
+}
diff --git a/src/test/resources/ConfigFalseParentListChildContainer.yang b/src/test/resources/ConfigFalseParentListChildContainer.yang
new file mode 100644
index 0000000..5a84595
--- /dev/null
+++ b/src/test/resources/ConfigFalseParentListChildContainer.yang
@@ -0,0 +1,24 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    list valid {
+        config false;
+        key "invalid-interval";
+        leaf invalid-interval {
+            type "uint16";
+            units "seconds";
+            status current;
+            reference "RFC 6020";
+        }
+        container valid { 
+            config true;
+            leaf invalid-interval {
+                type "uint16";
+                units "seconds";
+                status current;
+                reference "RFC 6020";
+            }
+        }        
+    }
+}
\ No newline at end of file
diff --git a/src/test/resources/ConfigFalseParentListChildLeaf.yang b/src/test/resources/ConfigFalseParentListChildLeaf.yang
new file mode 100644
index 0000000..65171dd
--- /dev/null
+++ b/src/test/resources/ConfigFalseParentListChildLeaf.yang
@@ -0,0 +1,16 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    list valid {
+        key "invalid-interval";
+        config false;
+        leaf invalid-interval {
+            type "uint16";
+            config true;
+            units "seconds";
+            status current;
+            reference "RFC 6020";
+        }
+    }
+}
\ No newline at end of file
diff --git a/src/test/resources/ConfigFalseParentListChildLeafList.yang b/src/test/resources/ConfigFalseParentListChildLeafList.yang
new file mode 100644
index 0000000..33132cd
--- /dev/null
+++ b/src/test/resources/ConfigFalseParentListChildLeafList.yang
@@ -0,0 +1,16 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    list valid {
+        key "invalid-interval";
+        config false;
+        leaf-list invalid-interval {
+            type "uint16";
+            config true;
+            units "seconds";
+            status current;
+            reference "RFC 6020";
+        }
+    }
+}
\ No newline at end of file
diff --git a/src/test/resources/ConfigFalseValidKeyValidLeaf.yang b/src/test/resources/ConfigFalseValidKeyValidLeaf.yang
new file mode 100644
index 0000000..368a4b5
--- /dev/null
+++ b/src/test/resources/ConfigFalseValidKeyValidLeaf.yang
@@ -0,0 +1,15 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    list valid {
+        key "invalid-interval";
+        config false;
+        leaf invalid-interval {
+            type "string";
+            units "seconds";
+            status current;
+            reference "RFC 6020";
+        }
+    }
+}
\ No newline at end of file
diff --git a/src/test/resources/ConfigFalseValidKeyValidLeafList.yang b/src/test/resources/ConfigFalseValidKeyValidLeafList.yang
new file mode 100644
index 0000000..4196be4
--- /dev/null
+++ b/src/test/resources/ConfigFalseValidKeyValidLeafList.yang
@@ -0,0 +1,14 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    list valid {
+        key "invalid-interval";
+        leaf-list invalid-interval {
+            type "string";
+            units "seconds";
+            status current;
+            reference "RFC 6020";
+        }
+    }
+}
\ No newline at end of file
diff --git a/src/test/resources/ConfigTrueNoKey.yang b/src/test/resources/ConfigTrueNoKey.yang
new file mode 100644
index 0000000..7a0a538
--- /dev/null
+++ b/src/test/resources/ConfigTrueNoKey.yang
@@ -0,0 +1,14 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    list valid {
+        config true;
+        leaf invalid-interval {
+            type "string";
+            units "seconds";
+            status current;
+            reference "RFC 6020";
+        }
+    }
+}
\ No newline at end of file
diff --git a/src/test/resources/ConfigTrueNoleafNoLeafList.yang b/src/test/resources/ConfigTrueNoleafNoLeafList.yang
new file mode 100644
index 0000000..c553e60
--- /dev/null
+++ b/src/test/resources/ConfigTrueNoleafNoLeafList.yang
@@ -0,0 +1,13 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    list valid {
+        config true;
+        container container1 {
+           leaf leaf1 {
+              type "string";
+           }
+        }
+    }
+}
\ No newline at end of file
diff --git a/src/test/resources/ConfigTrueValidKeyValidLeaf List.yang b/src/test/resources/ConfigTrueValidKeyValidLeaf List.yang
new file mode 100644
index 0000000..4196be4
--- /dev/null
+++ b/src/test/resources/ConfigTrueValidKeyValidLeaf List.yang
@@ -0,0 +1,14 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    list valid {
+        key "invalid-interval";
+        leaf-list invalid-interval {
+            type "string";
+            units "seconds";
+            status current;
+            reference "RFC 6020";
+        }
+    }
+}
\ No newline at end of file
diff --git a/src/test/resources/ConfigTrueValidKeyValidLeaf.yang b/src/test/resources/ConfigTrueValidKeyValidLeaf.yang
new file mode 100644
index 0000000..fe8efe3
--- /dev/null
+++ b/src/test/resources/ConfigTrueValidKeyValidLeaf.yang
@@ -0,0 +1,14 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    list valid {
+        key "invalid-interval";
+        leaf invalid-interval {
+            type "string";
+            units "seconds";
+            status current;
+            reference "RFC 6020";
+        }
+    }
+}
diff --git a/src/test/resources/ContainerSubStatementList.yang b/src/test/resources/ContainerSubStatementList.yang
index 4450391..19810c7 100644
--- a/src/test/resources/ContainerSubStatementList.yang
+++ b/src/test/resources/ContainerSubStatementList.yang
@@ -4,7 +4,7 @@
     prefix Ant;
     container ospf {
         list valid {
-            key "invalid";
+            key "invalid-interval";
             leaf invalid-interval {
                 type "uint16";
                 units "seconds";
diff --git a/src/test/resources/InvalidLeafIdentifier.yang b/src/test/resources/InvalidLeafIdentifier.yang
new file mode 100644
index 0000000..6faf092
--- /dev/null
+++ b/src/test/resources/InvalidLeafIdentifier.yang
@@ -0,0 +1,14 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    list valid {
+        key "invalid-interval";
+        leaf invalid {
+            type "string";
+            units "seconds";
+            status current;
+            reference "RFC 6020";
+        }
+    }
+}
\ No newline at end of file
diff --git a/src/test/resources/InvalidLeafListIdentifier.yang b/src/test/resources/InvalidLeafListIdentifier.yang
new file mode 100644
index 0000000..6359d2a
--- /dev/null
+++ b/src/test/resources/InvalidLeafListIdentifier.yang
@@ -0,0 +1,14 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    list valid {
+        key "invalid-interval";
+        leaf-list invalid {
+            type "string";
+            units "seconds";
+            status current;
+            reference "RFC 6020";
+        }
+    }
+}
\ No newline at end of file
diff --git a/src/test/resources/KeyLeafListTypeEmpty.yang b/src/test/resources/KeyLeafListTypeEmpty.yang
new file mode 100644
index 0000000..44c1617
--- /dev/null
+++ b/src/test/resources/KeyLeafListTypeEmpty.yang
@@ -0,0 +1,14 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    list valid {
+        key "invalid-interval";
+        leaf-list invalid-interval {
+            type "empty";
+            units "seconds";
+            status current;
+            reference "RFC 6020";
+        }
+    }
+}
\ No newline at end of file
diff --git a/src/test/resources/KeyLeafTypeEmpty.yang b/src/test/resources/KeyLeafTypeEmpty.yang
new file mode 100644
index 0000000..859520c
--- /dev/null
+++ b/src/test/resources/KeyLeafTypeEmpty.yang
@@ -0,0 +1,14 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    list valid {
+        key "invalid-interval";
+        leaf invalid-interval {
+            type "empty";
+            units "seconds";
+            status current;
+            reference "RFC 6020";
+        }
+    }
+}
\ No newline at end of file
diff --git a/src/test/resources/ListSubStatementContainer.yang b/src/test/resources/ListSubStatementContainer.yang
index a81bda5..4ce6da4 100644
--- a/src/test/resources/ListSubStatementContainer.yang
+++ b/src/test/resources/ListSubStatementContainer.yang
@@ -12,5 +12,8 @@
                 reference "RFC 6020";
             }
         }
+        leaf process-id {
+            type "string";
+        }
     }
 }
\ No newline at end of file
diff --git a/src/test/resources/ListSubStatementList.yang b/src/test/resources/ListSubStatementList.yang
index 14cf270..2021469 100644
--- a/src/test/resources/ListSubStatementList.yang
+++ b/src/test/resources/ListSubStatementList.yang
@@ -5,7 +5,7 @@
     list ospf {
         key "process-id";
         list valid {
-            key "invalid";
+            key "invalid-interval";
             leaf invalid-interval {
                 type "uint16";
                 units "seconds";
@@ -13,5 +13,8 @@
                 reference "RFC 6020";
             }
         }
+        leaf process-id {
+            type "string";
+        }
     }
 }
\ No newline at end of file
diff --git a/src/test/resources/ListSubStatements.yang b/src/test/resources/ListSubStatements.yang
index f684780..109fc17 100644
--- a/src/test/resources/ListSubStatements.yang
+++ b/src/test/resources/ListSubStatements.yang
@@ -3,7 +3,7 @@
     namespace http://huawei.com;
     prefix Ant;
     list ospf {
-        key "process-id";
+        key "invalid-interval";
         config true;
         max-elements 10;
         min-elements 3;
diff --git a/src/test/resources/ModuleSubStatementList.yang b/src/test/resources/ModuleSubStatementList.yang
index baf36e7..1bb3bf5 100644
--- a/src/test/resources/ModuleSubStatementList.yang
+++ b/src/test/resources/ModuleSubStatementList.yang
@@ -3,7 +3,7 @@
     namespace http://huawei.com;
     prefix Ant;
     list valid {
-        key "invalid";
+        key "invalid-interval";
         leaf invalid-interval {
             type "uint16";
             units "seconds";
diff --git a/src/test/resources/NoConfigContainerSubStatementContainer.yang b/src/test/resources/NoConfigContainerSubStatementContainer.yang
new file mode 100644
index 0000000..1aded2d
--- /dev/null
+++ b/src/test/resources/NoConfigContainerSubStatementContainer.yang
@@ -0,0 +1,15 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    container hello {
+        container valid {
+            leaf invalid-interval {
+                type "uint16";
+                units "seconds";
+                status current;
+                reference "RFC 6020";
+            }
+        }
+    }
+}
\ No newline at end of file
diff --git a/src/test/resources/NoConfigContainerSubStatementLeaf.yang b/src/test/resources/NoConfigContainerSubStatementLeaf.yang
new file mode 100644
index 0000000..35a91ad
--- /dev/null
+++ b/src/test/resources/NoConfigContainerSubStatementLeaf.yang
@@ -0,0 +1,13 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    container valid {
+        leaf invalid-interval {
+            type "uint16";
+            units "seconds";
+            status current;
+            reference "RFC 6020";
+        }
+    }
+}
\ No newline at end of file
diff --git a/src/test/resources/NoConfigContainerSubStatementLeafList.yang b/src/test/resources/NoConfigContainerSubStatementLeafList.yang
new file mode 100644
index 0000000..79687c2
--- /dev/null
+++ b/src/test/resources/NoConfigContainerSubStatementLeafList.yang
@@ -0,0 +1,13 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    container valid {
+        leaf-list invalid-interval {
+            type "uint16";
+            units "seconds";
+            status current;
+            reference "RFC 6020";
+        }
+    }
+}
\ No newline at end of file
diff --git a/src/test/resources/NoConfigContainerSubStatementList.yang b/src/test/resources/NoConfigContainerSubStatementList.yang
new file mode 100644
index 0000000..f10c686
--- /dev/null
+++ b/src/test/resources/NoConfigContainerSubStatementList.yang
@@ -0,0 +1,16 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    container hello {
+        list valid {
+            key "invalid-interval";
+            leaf invalid-interval {
+                type "uint16";
+                units "seconds";
+                status current;
+                reference "RFC 6020";
+            }
+        }
+    }
+}
\ No newline at end of file
diff --git a/src/test/resources/NoConfigListSubStatementContainer.yang b/src/test/resources/NoConfigListSubStatementContainer.yang
new file mode 100644
index 0000000..19b4291
--- /dev/null
+++ b/src/test/resources/NoConfigListSubStatementContainer.yang
@@ -0,0 +1,22 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    list list1 {
+        key "invalid-interval";
+        leaf invalid-interval {
+            type "uint16";
+            units "seconds";
+            status current;
+            reference "RFC 6020";
+        }
+        container container1 {
+            leaf leaf1 {
+                type "uint16";
+                units "seconds";
+                status current;
+                reference "RFC 6020";
+            }
+        }
+    }
+}
\ No newline at end of file
diff --git a/src/test/resources/NoConfigListSubStatementLeaf.yang b/src/test/resources/NoConfigListSubStatementLeaf.yang
new file mode 100644
index 0000000..1bb3bf5
--- /dev/null
+++ b/src/test/resources/NoConfigListSubStatementLeaf.yang
@@ -0,0 +1,14 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    list valid {
+        key "invalid-interval";
+        leaf invalid-interval {
+            type "uint16";
+            units "seconds";
+            status current;
+            reference "RFC 6020";
+        }
+    }
+}
\ No newline at end of file
diff --git a/src/test/resources/NoConfigListSubStatementLeafList.yang b/src/test/resources/NoConfigListSubStatementLeafList.yang
new file mode 100644
index 0000000..e70155e
--- /dev/null
+++ b/src/test/resources/NoConfigListSubStatementLeafList.yang
@@ -0,0 +1,14 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    list valid {
+        key "invalid-interval";
+        leaf-list invalid-interval {
+            type "uint16";
+            units "seconds";
+            status current;
+            reference "RFC 6020";
+        }
+    }
+}
\ No newline at end of file
diff --git a/src/test/resources/NoConfigListSubStatementList.yang b/src/test/resources/NoConfigListSubStatementList.yang
new file mode 100644
index 0000000..4de40cb
--- /dev/null
+++ b/src/test/resources/NoConfigListSubStatementList.yang
@@ -0,0 +1,23 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    list valid {
+        key "invalid-interval";
+        leaf invalid-interval {
+            type "uint16";
+            units "seconds";
+            status current;
+            reference "RFC 6020";
+        }
+        list list1 {
+            key "leaf1";
+            leaf leaf1 {
+                type "uint16";
+                units "seconds";
+                status current;
+                reference "RFC 6020";
+            }
+        }
+    }
+}