YANG uses and UT
Change-Id: Id3ec5cfed2b8e2a7d2d580786c70b5804f03ecfa
diff --git a/src/test/resources/SelfFileLinkingWithGroupingHierarchicalRefUnresolved.yang b/src/test/resources/SelfFileLinkingWithGroupingHierarchicalRefUnresolved.yang
new file mode 100644
index 0000000..cd71621
--- /dev/null
+++ b/src/test/resources/SelfFileLinkingWithGroupingHierarchicalRefUnresolved.yang
@@ -0,0 +1,14 @@
+module Test {
+ yang-version 1;
+ namespace http://huawei.com;
+ prefix Ant;
+ import ietf-yang-types {
+ prefix "P";
+ }
+ grouping create {
+ uses P:valid;
+ }
+ container test{
+ uses create;
+ }
+}
diff --git a/src/test/resources/SelfFileLinkingWithGroupingWithSelfAndExternalPrefixMix.yang b/src/test/resources/SelfFileLinkingWithGroupingWithSelfAndExternalPrefixMix.yang
new file mode 100644
index 0000000..84236a2
--- /dev/null
+++ b/src/test/resources/SelfFileLinkingWithGroupingWithSelfAndExternalPrefixMix.yang
@@ -0,0 +1,28 @@
+module Test {
+ yang-version 1;
+ namespace http://huawei.com;
+ prefix Ant;
+ import ietf-yang-types {
+ prefix "P";
+ }
+ grouping Percentage {
+ leaf hello{
+ type String;
+ }
+ }
+ container ospf {
+ list valid {
+ key "invalid";
+ leaf invalid{
+ type String;
+ }
+ uses Ant:FirstClass;
+ grouping FirstClass {
+ uses P:PassingClass;
+ }
+ }
+ grouping PassingClass {
+ uses Ant:Percentage;
+ }
+ }
+}
diff --git a/src/test/resources/SelfFileLinkingWithGroupingWithSelfModulePrefix.yang b/src/test/resources/SelfFileLinkingWithGroupingWithSelfModulePrefix.yang
new file mode 100644
index 0000000..23f197b
--- /dev/null
+++ b/src/test/resources/SelfFileLinkingWithGroupingWithSelfModulePrefix.yang
@@ -0,0 +1,25 @@
+module Test {
+ yang-version 1;
+ namespace http://huawei.com;
+ prefix Ant;
+ grouping Percentage {
+ leaf hello{
+ type String;
+ }
+ }
+ container ospf {
+ list valid {
+ key "invalid";
+ leaf invalid{
+ type String;
+ }
+ uses Ant:FirstClass;
+ grouping FirstClass {
+ uses PassingClass;
+ }
+ }
+ grouping PassingClass {
+ uses Ant:Percentage;
+ }
+ }
+}
diff --git a/src/test/resources/SelfResolutionGroupingHavingSameUsesManyTimes.yang b/src/test/resources/SelfResolutionGroupingHavingSameUsesManyTimes.yang
new file mode 100644
index 0000000..d449adf
--- /dev/null
+++ b/src/test/resources/SelfResolutionGroupingHavingSameUsesManyTimes.yang
@@ -0,0 +1,25 @@
+module Test {
+ yang-version 1;
+ namespace http://huawei.com;
+ prefix Ant;
+ container valid {
+ grouping endpoint {
+ leaf zip-code {
+ type string;
+ }
+ uses failure;
+ container hold {
+ leaf newone {
+ type string;
+ }
+
+ }
+ uses failure;
+ }
+ grouping failure {
+ leaf test {
+ type string;
+ }
+ }
+ }
+}
diff --git a/src/test/resources/SelfResolutionGroupingInRpcAndUsesInOutput.yang b/src/test/resources/SelfResolutionGroupingInRpcAndUsesInOutput.yang
new file mode 100644
index 0000000..3589a9f
--- /dev/null
+++ b/src/test/resources/SelfResolutionGroupingInRpcAndUsesInOutput.yang
@@ -0,0 +1,34 @@
+module rock {
+ namespace "http://example.net/rock";
+ prefix "rock";
+
+ rpc rock-the-house {
+ description "description";
+ status current;
+ reference "reference";
+ grouping hello {
+ list valid {
+ key invalid-interval;
+ reference "RFC 6020";
+ leaf invalid-interval {
+ type "uint16";
+ units "seconds";
+ status current;
+ reference "RFC 6020";
+ }
+ }
+ }
+ input {
+ leaf zip-code {
+ type string;
+ }
+ uses hello;
+ }
+ output {
+ leaf status {
+ type string;
+ }
+ uses hello;
+ }
+ }
+}
diff --git a/src/test/resources/SelfResolutionGroupingReferencingItselfFailureScenerio.yang b/src/test/resources/SelfResolutionGroupingReferencingItselfFailureScenerio.yang
new file mode 100644
index 0000000..3e0ba3d
--- /dev/null
+++ b/src/test/resources/SelfResolutionGroupingReferencingItselfFailureScenerio.yang
@@ -0,0 +1,13 @@
+module Test {
+ yang-version 1;
+ namespace http://huawei.com;
+ prefix Ant;
+ container valid {
+ grouping endpoint {
+ leaf zip-code {
+ type string;
+ }
+ uses endpoint;
+ }
+ }
+}
diff --git a/src/test/resources/SelfResolutionGroupingWithMultipleUses.yang b/src/test/resources/SelfResolutionGroupingWithMultipleUses.yang
new file mode 100644
index 0000000..906890f
--- /dev/null
+++ b/src/test/resources/SelfResolutionGroupingWithMultipleUses.yang
@@ -0,0 +1,63 @@
+module Test {
+ yang-version 1;
+ namespace http://huawei.com;
+ prefix Ant;
+ container valid {
+ grouping endpoint {
+ leaf zip-code {
+ type string;
+ }
+ uses first;
+ container design {
+ uses second;
+ container correct {
+ leaf newone {
+ type string;
+ }
+ uses third;
+ }
+ }
+ uses fourth;
+ uses fifth;
+ }
+ uses endpoint;
+ grouping first {
+ list valid {
+ key invalid-interval;
+ reference "RFC 6020";
+ leaf invalid-interval {
+ type "uint16";
+ units "seconds";
+ status current;
+ reference "RFC 6020";
+ }
+ }
+ }
+ grouping second {
+ leaf ink {
+ type int32;
+ }
+ }
+ grouping third {
+ container value {
+ leaf zip-code {
+ type string;
+ }
+ }
+ }
+ grouping fourth {
+ typedef my-type {
+ status deprecated;
+ type int32;
+ }
+ leaf correct {
+ type my-type;
+ }
+ }
+ grouping fifth {
+ leaf abc {
+ type string;
+ }
+ }
+ }
+}
diff --git a/src/test/resources/SelfResolutionNestedGroupingWithUnresolvedUses.yang b/src/test/resources/SelfResolutionNestedGroupingWithUnresolvedUses.yang
new file mode 100644
index 0000000..4dbc1a2
--- /dev/null
+++ b/src/test/resources/SelfResolutionNestedGroupingWithUnresolvedUses.yang
@@ -0,0 +1,17 @@
+module Test {
+ yang-version 1;
+ namespace http://huawei.com;
+ prefix Ant;
+ container test{
+ leaf leaf2{
+ type String;
+ }
+ grouping treat {
+ grouping create {
+ grouping mass {
+ }
+ }
+ }
+ }
+ uses treat;
+}
diff --git a/src/test/resources/SelfResolutionRpcWithOneTypedefAndTwoGroupingUnderDifferentNode.yang b/src/test/resources/SelfResolutionRpcWithOneTypedefAndTwoGroupingUnderDifferentNode.yang
new file mode 100644
index 0000000..91dc763
--- /dev/null
+++ b/src/test/resources/SelfResolutionRpcWithOneTypedefAndTwoGroupingUnderDifferentNode.yang
@@ -0,0 +1,38 @@
+module rock {
+ namespace "http://example.net/rock";
+ prefix "rock";
+
+ rpc rock-the-house {
+ description "description";
+ status current;
+ reference "reference";
+ input {
+ leaf zip-code {
+ type string;
+ }
+ grouping creative {
+ leaf carry {
+ type string;
+ }
+ }
+ }
+ output {
+ leaf status {
+ type string;
+ }
+ grouping creative {
+ list valid {
+ key invalid-interval;
+ leaf invalid-interval {
+ type "uint16";
+ }
+ }
+ }
+ typedef my-type {
+ status deprecated;
+ type int32;
+ }
+ uses creative;
+ }
+ }
+}
diff --git a/src/test/resources/SelfResolutionWhenUsesAndGroupingAtRootLevel.yang b/src/test/resources/SelfResolutionWhenUsesAndGroupingAtRootLevel.yang
new file mode 100644
index 0000000..52641d8
--- /dev/null
+++ b/src/test/resources/SelfResolutionWhenUsesAndGroupingAtRootLevel.yang
@@ -0,0 +1,11 @@
+module Test {
+ yang-version 1;
+ namespace http://huawei.com;
+ prefix Ant;
+ uses hello;
+ grouping hello {
+ leaf hello{
+ type String;
+ }
+ }
+}
diff --git a/src/test/resources/SelfResolutionWhenUsesAndGroupingAtRootLevelGroupingWithChild.yang b/src/test/resources/SelfResolutionWhenUsesAndGroupingAtRootLevelGroupingWithChild.yang
new file mode 100644
index 0000000..f4f12b0
--- /dev/null
+++ b/src/test/resources/SelfResolutionWhenUsesAndGroupingAtRootLevelGroupingWithChild.yang
@@ -0,0 +1,16 @@
+module Test {
+ yang-version 1;
+ namespace http://huawei.com;
+ prefix Ant;
+ uses treat;
+ grouping treat {
+ leaf treat{
+ type String;
+ }
+ container test{
+ leaf leaf2{
+ type String;
+ }
+ }
+ }
+}
diff --git a/src/test/resources/UsesInContainer.yang b/src/test/resources/UsesInContainer.yang
index 9fb5fbf..df52fd6 100644
--- a/src/test/resources/UsesInContainer.yang
+++ b/src/test/resources/UsesInContainer.yang
@@ -2,6 +2,8 @@
yang-version 1;
namespace http://huawei.com;
prefix Ant;
+ grouping endpoint {
+ }
container valid {
uses endpoint {
description "grouping under test";
diff --git a/src/test/resources/UsesInList.yang b/src/test/resources/UsesInList.yang
index b79e7b1..6ac7795 100644
--- a/src/test/resources/UsesInList.yang
+++ b/src/test/resources/UsesInList.yang
@@ -4,7 +4,9 @@
prefix Ant;
import ietf-yang-types {
prefix "P";
- }
+ }
+ grouping endpoint {
+ }
list valid {
key address;
leaf address {
diff --git a/src/test/resources/UsesInModule.yang b/src/test/resources/UsesInModule.yang
index a0a05f4..02b9f09 100644
--- a/src/test/resources/UsesInModule.yang
+++ b/src/test/resources/UsesInModule.yang
@@ -2,5 +2,7 @@
yang-version 1;
namespace http://huawei.com;
prefix Ant;
+ grouping endpoint {
+ }
uses endpoint;
}