[ONOS-3894, 4071] YANG Advanced Construct Union & Grouping
Change-Id: I0f828adb5884c2d7b6e4120f9843c416608ae5e7
diff --git a/utils/yangutils/src/test/resources/CaseChoiceHierarchy.yang b/utils/yangutils/src/test/resources/CaseChoiceHierarchy.yang
index 16b4047..28d110e 100644
--- a/utils/yangutils/src/test/resources/CaseChoiceHierarchy.yang
+++ b/utils/yangutils/src/test/resources/CaseChoiceHierarchy.yang
@@ -2,22 +2,22 @@
yang-version 1;
namespace http://huawei.com;
prefix Ant;
- container food {
- choice snack {
- case sports-arena {
- leaf pretzel {
- type empty;
- }
- }
- case late-night {
- choice dinner {
- case late-night {
- leaf beer {
- type empty;
- }
- }
- }
- }
+ container food {
+ choice snack {
+ case sports-arena {
+ leaf pretzel {
+ type empty;
+ }
+ }
+ case late-night {
+ choice dinner {
+ case late-night {
+ leaf beer {
+ type empty;
+ }
+ }
+ }
+ }
+ }
}
- }
}
diff --git a/utils/yangutils/src/test/resources/ConfigFalseParentContainerChildList.yang b/utils/yangutils/src/test/resources/ConfigFalseParentContainerChildList.yang
index 78fbe15..ffc6f60 100644
--- a/utils/yangutils/src/test/resources/ConfigFalseParentContainerChildList.yang
+++ b/utils/yangutils/src/test/resources/ConfigFalseParentContainerChildList.yang
@@ -4,7 +4,7 @@
prefix Ant;
container valid {
config false;
- list valid {
+ list valid {
key "invalid-interval";
config true;
leaf invalid-interval {
diff --git a/utils/yangutils/src/test/resources/ConfigFalseParentListChildContainer.yang b/utils/yangutils/src/test/resources/ConfigFalseParentListChildContainer.yang
index 5a84595..3158dd4 100644
--- a/utils/yangutils/src/test/resources/ConfigFalseParentListChildContainer.yang
+++ b/utils/yangutils/src/test/resources/ConfigFalseParentListChildContainer.yang
@@ -11,7 +11,7 @@
status current;
reference "RFC 6020";
}
- container valid {
+ container valid {
config true;
leaf invalid-interval {
type "uint16";
@@ -19,6 +19,6 @@
status current;
reference "RFC 6020";
}
- }
+ }
}
}
\ No newline at end of file
diff --git a/utils/yangutils/src/test/resources/DuplicateGroupingInContainer.yang b/utils/yangutils/src/test/resources/DuplicateGroupingInContainer.yang
new file mode 100644
index 0000000..f130797
--- /dev/null
+++ b/utils/yangutils/src/test/resources/DuplicateGroupingInContainer.yang
@@ -0,0 +1,23 @@
+module Test {
+ yang-version 1;
+ namespace http://huawei.com;
+ prefix Ant;
+ container valid {
+ grouping endpoint {
+ leaf address {
+ type ip-address;
+ }
+ leaf port {
+ type port-number;
+ }
+ }
+ grouping endpoint {
+ leaf address {
+ type ip-address;
+ }
+ leaf port {
+ type port-number;
+ }
+ }
+ }
+}
diff --git a/utils/yangutils/src/test/resources/DuplicateGroupingInList.yang b/utils/yangutils/src/test/resources/DuplicateGroupingInList.yang
new file mode 100644
index 0000000..2457cbe
--- /dev/null
+++ b/utils/yangutils/src/test/resources/DuplicateGroupingInList.yang
@@ -0,0 +1,33 @@
+module Test {
+ yang-version 1;
+ namespace http://huawei.com;
+ prefix Ant;
+ list valid {
+ key address;
+ grouping endpoint {
+ description "grouping under test";
+ status current;
+ reference "RFC 6020";
+ leaf address {
+ type ip-address;
+ }
+ leaf port {
+ type port-number;
+ }
+ }
+ leaf address {
+ type ip;
+ }
+ grouping endpoint {
+ description "grouping under test";
+ status current;
+ reference "RFC 6020";
+ leaf address {
+ type ip-address;
+ }
+ leaf port {
+ type port-number;
+ }
+ }
+ }
+}
diff --git a/utils/yangutils/src/test/resources/DuplicateGroupingInModule.yang b/utils/yangutils/src/test/resources/DuplicateGroupingInModule.yang
new file mode 100644
index 0000000..d18b166
--- /dev/null
+++ b/utils/yangutils/src/test/resources/DuplicateGroupingInModule.yang
@@ -0,0 +1,21 @@
+module Test {
+ yang-version 1;
+ namespace http://huawei.com;
+ prefix Ant;
+ grouping endpoint {
+ leaf address {
+ type ip-address;
+ }
+ leaf port {
+ type port-number;
+ }
+ }
+ grouping endpoint {
+ leaf address {
+ type ip-address;
+ }
+ leaf port {
+ type port-number;
+ }
+ }
+}
diff --git a/utils/yangutils/src/test/resources/DuplicateLeafInHierarchy.yang b/utils/yangutils/src/test/resources/DuplicateLeafInHierarchy.yang
index c727cb7..e23f04c 100644
--- a/utils/yangutils/src/test/resources/DuplicateLeafInHierarchy.yang
+++ b/utils/yangutils/src/test/resources/DuplicateLeafInHierarchy.yang
@@ -2,22 +2,22 @@
yang-version 1;
namespace http://huawei.com;
prefix Ant;
- container food {
- choice snack {
- case sports-arena {
- leaf pretzel {
- type empty;
- }
- }
- case late-night {
- choice lunch {
- case late {
- leaf pretzel {
- type empty;
- }
- }
- }
- }
+ container food {
+ choice snack {
+ case sports-arena {
+ leaf pretzel {
+ type empty;
+ }
+ }
+ case late-night {
+ choice lunch {
+ case late {
+ leaf pretzel {
+ type empty;
+ }
+ }
+ }
+ }
+ }
}
- }
}
diff --git a/utils/yangutils/src/test/resources/EnumWithDuplicateName.yang b/utils/yangutils/src/test/resources/EnumWithDuplicateName.yang
index d81558f..47c3a85 100644
--- a/utils/yangutils/src/test/resources/EnumWithDuplicateName.yang
+++ b/utils/yangutils/src/test/resources/EnumWithDuplicateName.yang
@@ -4,11 +4,11 @@
prefix Ant;
leaf speed {
type enumeration {
- enum 10m;
- enum 100m;
- enum 10m {
- value 11;
- }
+ enum 10m;
+ enum 100m;
+ enum 10m {
+ value 11;
+ }
}
}
}
diff --git a/utils/yangutils/src/test/resources/GroupingAttributes.yang b/utils/yangutils/src/test/resources/GroupingAttributes.yang
new file mode 100644
index 0000000..7eb3880
--- /dev/null
+++ b/utils/yangutils/src/test/resources/GroupingAttributes.yang
@@ -0,0 +1,22 @@
+module Test {
+ yang-version 1;
+ namespace http://huawei.com;
+ prefix Ant;
+ list valid {
+ key address;
+ leaf address {
+ type ip;
+ }
+ grouping endpoint {
+ description "grouping under test";
+ status current;
+ reference "RFC 6020";
+ leaf address {
+ type ip-address;
+ }
+ leaf port {
+ type port-number;
+ }
+ }
+ }
+}
diff --git a/utils/yangutils/src/test/resources/GroupingInContainer.yang b/utils/yangutils/src/test/resources/GroupingInContainer.yang
new file mode 100644
index 0000000..be9e7e8
--- /dev/null
+++ b/utils/yangutils/src/test/resources/GroupingInContainer.yang
@@ -0,0 +1,15 @@
+module Test {
+ yang-version 1;
+ namespace http://huawei.com;
+ prefix Ant;
+ container valid {
+ grouping endpoint {
+ leaf address {
+ type ip-address;
+ }
+ leaf port {
+ type port-number;
+ }
+ }
+ }
+}
diff --git a/utils/yangutils/src/test/resources/GroupingInList.yang b/utils/yangutils/src/test/resources/GroupingInList.yang
new file mode 100644
index 0000000..2cdf7d1
--- /dev/null
+++ b/utils/yangutils/src/test/resources/GroupingInList.yang
@@ -0,0 +1,19 @@
+module Test {
+ yang-version 1;
+ namespace http://huawei.com;
+ prefix Ant;
+ list valid {
+ key address;
+ leaf address {
+ type ip;
+ }
+ grouping endpoint {
+ leaf address {
+ type ip-address;
+ }
+ leaf port {
+ type port-number;
+ }
+ }
+ }
+}
diff --git a/utils/yangutils/src/test/resources/GroupingInModule.yang b/utils/yangutils/src/test/resources/GroupingInModule.yang
new file mode 100644
index 0000000..d0a31c1
--- /dev/null
+++ b/utils/yangutils/src/test/resources/GroupingInModule.yang
@@ -0,0 +1,13 @@
+module Test {
+ yang-version 1;
+ namespace http://huawei.com;
+ prefix Ant;
+ grouping endpoint {
+ leaf address {
+ type ip-address;
+ }
+ leaf port {
+ type port-number;
+ }
+ }
+}
diff --git a/utils/yangutils/src/test/resources/ShortCaseListenerWithContainer.yang b/utils/yangutils/src/test/resources/ShortCaseListenerWithContainer.yang
index 0e4ff2d..166eeb0 100644
--- a/utils/yangutils/src/test/resources/ShortCaseListenerWithContainer.yang
+++ b/utils/yangutils/src/test/resources/ShortCaseListenerWithContainer.yang
@@ -2,14 +2,14 @@
yang-version 1;
namespace http://huawei.com;
prefix Ant;
- container food {
- choice snack {
- container sports-arena {
- leaf pretzel {
- type empty;
- }
- }
- }
+ container food {
+ choice snack {
+ container sports-arena {
+ leaf pretzel {
+ type empty;
+ }
+ }
+ }
+ }
}
- }
}
diff --git a/utils/yangutils/src/test/resources/ShortCaseListenerWithList.yang b/utils/yangutils/src/test/resources/ShortCaseListenerWithList.yang
index 2ba25d9..eb03fca 100644
--- a/utils/yangutils/src/test/resources/ShortCaseListenerWithList.yang
+++ b/utils/yangutils/src/test/resources/ShortCaseListenerWithList.yang
@@ -2,15 +2,15 @@
yang-version 1;
namespace http://huawei.com;
prefix Ant;
- container food {
- choice snack {
- list sports-arena {
- key "pretzel";
- leaf pretzel {
- type int32;
- }
- }
- }
+ container food {
+ choice snack {
+ list sports-arena {
+ key "pretzel";
+ leaf pretzel {
+ type int32;
+ }
+ }
+ }
+ }
}
- }
}
diff --git a/utils/yangutils/src/test/resources/UnionWhenTypeInLeaf.yang b/utils/yangutils/src/test/resources/UnionWhenTypeInLeaf.yang
new file mode 100644
index 0000000..65c0369
--- /dev/null
+++ b/utils/yangutils/src/test/resources/UnionWhenTypeInLeaf.yang
@@ -0,0 +1,16 @@
+module Test {
+ yang-version 1;
+ namespace http://huawei.com;
+ prefix Ant;
+ list valid {
+ key "invalid-interval";
+ leaf invalid-interval {
+ type union {
+ type int32;
+ type enumeration {
+ enum "unbounded";
+ }
+ }
+ }
+ }
+}
diff --git a/utils/yangutils/src/test/resources/UnionWhenTypeInLeafList.yang b/utils/yangutils/src/test/resources/UnionWhenTypeInLeafList.yang
new file mode 100644
index 0000000..df2b428
--- /dev/null
+++ b/utils/yangutils/src/test/resources/UnionWhenTypeInLeafList.yang
@@ -0,0 +1,16 @@
+module Test {
+ yang-version 1;
+ namespace http://huawei.com;
+ prefix Ant;
+ list valid {
+ key "invalid-interval";
+ leaf-list invalid-interval {
+ type union {
+ type int32;
+ type enumeration {
+ enum "unbounded";
+ }
+ }
+ }
+ }
+}
diff --git a/utils/yangutils/src/test/resources/UnionWithEmptyType.yang b/utils/yangutils/src/test/resources/UnionWithEmptyType.yang
new file mode 100644
index 0000000..81e8795
--- /dev/null
+++ b/utils/yangutils/src/test/resources/UnionWithEmptyType.yang
@@ -0,0 +1,16 @@
+module Test {
+ yang-version 1;
+ namespace http://huawei.com;
+ prefix Ant;
+ list valid {
+ key "invalid-interval";
+ leaf invalid-interval {
+ type union {
+ type empty;
+ type enumeration {
+ enum "unbounded";
+ }
+ }
+ }
+ }
+}
diff --git a/utils/yangutils/src/test/resources/UsesInContainer.yang b/utils/yangutils/src/test/resources/UsesInContainer.yang
new file mode 100644
index 0000000..9fb5fbf
--- /dev/null
+++ b/utils/yangutils/src/test/resources/UsesInContainer.yang
@@ -0,0 +1,12 @@
+module Test {
+ yang-version 1;
+ namespace http://huawei.com;
+ prefix Ant;
+ container valid {
+ uses endpoint {
+ description "grouping under test";
+ status current;
+ reference "RFC 6020";
+ }
+ }
+}
diff --git a/utils/yangutils/src/test/resources/UsesInList.yang b/utils/yangutils/src/test/resources/UsesInList.yang
new file mode 100644
index 0000000..6443cfa
--- /dev/null
+++ b/utils/yangutils/src/test/resources/UsesInList.yang
@@ -0,0 +1,16 @@
+module Test {
+ yang-version 1;
+ namespace http://huawei.com;
+ prefix Ant;
+ list valid {
+ key address;
+ leaf address {
+ type ip;
+ }
+ uses endpoint {
+ description "grouping under test";
+ status current;
+ reference "RFC 6020";
+ }
+ }
+}
diff --git a/utils/yangutils/src/test/resources/UsesInModule.yang b/utils/yangutils/src/test/resources/UsesInModule.yang
new file mode 100644
index 0000000..a0a05f4
--- /dev/null
+++ b/utils/yangutils/src/test/resources/UsesInModule.yang
@@ -0,0 +1,6 @@
+module Test {
+ yang-version 1;
+ namespace http://huawei.com;
+ prefix Ant;
+ uses endpoint;
+}
diff --git a/utils/yangutils/src/test/resources/ValidSameGroupingEntryInModuleAndContainer.yang b/utils/yangutils/src/test/resources/ValidSameGroupingEntryInModuleAndContainer.yang
new file mode 100644
index 0000000..2580cdd
--- /dev/null
+++ b/utils/yangutils/src/test/resources/ValidSameGroupingEntryInModuleAndContainer.yang
@@ -0,0 +1,23 @@
+module Test {
+ yang-version 1;
+ namespace http://huawei.com;
+ prefix Ant;
+ grouping endpoint {
+ leaf address {
+ type ip-address;
+ }
+ leaf port {
+ type port-number;
+ }
+ }
+ container valid {
+ grouping endpoint {
+ leaf address {
+ type ip-address;
+ }
+ leaf port {
+ type port-number;
+ }
+ }
+ }
+}
diff --git a/utils/yangutils/src/test/resources/ValueAndAutoStatement.yang b/utils/yangutils/src/test/resources/ValueAndAutoStatement.yang
index 31f098e..89ba403 100644
--- a/utils/yangutils/src/test/resources/ValueAndAutoStatement.yang
+++ b/utils/yangutils/src/test/resources/ValueAndAutoStatement.yang
@@ -4,13 +4,13 @@
prefix Ant;
leaf speed {
type enumeration {
- enum 10m {
- value 10;
- }
- enum 100m;
- enum auto {
- value 1000;
- }
+ enum 10m {
+ value 10;
+ }
+ enum 100m;
+ enum auto {
+ value 1000;
+ }
}
}
}