[ONOS-4348] Yang Bits, Binary and Decimal64
Change-Id: I8e4e54a19a8f9634cbc56a07579a1730174f53f6
diff --git a/plugin/src/test/resources/ContainerSubStatementWhen.yang b/plugin/src/test/resources/ContainerSubStatementWhen.yang
index 644b2ff..7a2674f 100644
--- a/plugin/src/test/resources/ContainerSubStatementWhen.yang
+++ b/plugin/src/test/resources/ContainerSubStatementWhen.yang
@@ -26,7 +26,9 @@
"Interface has time-division multiplex capabilities.";
leaf minimum-lsp-bandwidth {
- type decimal64;
+ type decimal64 {
+ fraction-digits 4;
+ }
}
}
}
diff --git a/plugin/src/test/resources/Decimal64MultiTypedefStatement.yang b/plugin/src/test/resources/Decimal64MultiTypedefStatement.yang
new file mode 100644
index 0000000..fdce08e
--- /dev/null
+++ b/plugin/src/test/resources/Decimal64MultiTypedefStatement.yang
@@ -0,0 +1,19 @@
+module Test {
+ yang-version 1;
+ namespace http://huawei.com;
+ prefix Ant;
+
+ typedef topDecimal {
+ type decimal64 {
+ fraction-digits 4;
+ }
+ }
+
+ typedef validDecimal {
+ type topDecimal;
+ }
+
+ leaf setFourDecimal {
+ type validDecimal;
+ }
+}
diff --git a/plugin/src/test/resources/Decimal64TypeInvalidMaxValueFraction.yang b/plugin/src/test/resources/Decimal64TypeInvalidMaxValueFraction.yang
new file mode 100644
index 0000000..68bd8df
--- /dev/null
+++ b/plugin/src/test/resources/Decimal64TypeInvalidMaxValueFraction.yang
@@ -0,0 +1,11 @@
+module Test {
+ yang-version 1;
+ namespace http://huawei.com;
+ prefix Ant;
+
+ leaf invalidDecimal1 {
+ type decimal64 {
+ fraction-digits 19;
+ }
+ }
+}
diff --git a/plugin/src/test/resources/Decimal64TypeInvalidMinValueFraction1.yang b/plugin/src/test/resources/Decimal64TypeInvalidMinValueFraction1.yang
new file mode 100644
index 0000000..3d7445a
--- /dev/null
+++ b/plugin/src/test/resources/Decimal64TypeInvalidMinValueFraction1.yang
@@ -0,0 +1,11 @@
+module Test {
+ yang-version 1;
+ namespace http://huawei.com;
+ prefix Ant;
+
+ leaf invalidDecimal2 {
+ type decimal64 {
+ fraction-digits 0;
+ }
+ }
+}
diff --git a/plugin/src/test/resources/Decimal64TypeInvalidMinValueFraction2.yang b/plugin/src/test/resources/Decimal64TypeInvalidMinValueFraction2.yang
new file mode 100644
index 0000000..4e17bbe
--- /dev/null
+++ b/plugin/src/test/resources/Decimal64TypeInvalidMinValueFraction2.yang
@@ -0,0 +1,11 @@
+module Test {
+ yang-version 1;
+ namespace http://huawei.com;
+ prefix Ant;
+
+ leaf invalidDecimal3 {
+ type decimal64 {
+ fraction-digits -1;
+ }
+ }
+}
diff --git a/plugin/src/test/resources/Decimal64TypeInvalidRangeStmnt.yang b/plugin/src/test/resources/Decimal64TypeInvalidRangeStmnt.yang
new file mode 100644
index 0000000..2ac3d94
--- /dev/null
+++ b/plugin/src/test/resources/Decimal64TypeInvalidRangeStmnt.yang
@@ -0,0 +1,11 @@
+module Test {
+ yang-version 1;
+ namespace http://huawei.com;
+ prefix Ant;
+ leaf validDecimal {
+ type decimal64 {
+ fraction-digits 18;
+ range "1 .. 20.14";
+ }
+ }
+}
diff --git a/plugin/src/test/resources/Decimal64TypeStatement.yang b/plugin/src/test/resources/Decimal64TypeStatement.yang
new file mode 100644
index 0000000..9824c12
--- /dev/null
+++ b/plugin/src/test/resources/Decimal64TypeStatement.yang
@@ -0,0 +1,10 @@
+module Test {
+ yang-version 1;
+ namespace http://huawei.com;
+ prefix Ant;
+ leaf validDecimal {
+ type decimal64 {
+ fraction-digits 2;
+ }
+ }
+}
diff --git a/plugin/src/test/resources/Decimal64TypeValidation.yang b/plugin/src/test/resources/Decimal64TypeValidation.yang
new file mode 100644
index 0000000..06bf5b7
--- /dev/null
+++ b/plugin/src/test/resources/Decimal64TypeValidation.yang
@@ -0,0 +1,10 @@
+module Test {
+ yang-version 1;
+ namespace http://huawei.com;
+ prefix Ant;
+ leaf validDecimal {
+ type decimal64 {
+ fraction-digits 18;
+ }
+ }
+}
diff --git a/plugin/src/test/resources/Decimal64TypeWithMultiValueRangeStmnt.yang b/plugin/src/test/resources/Decimal64TypeWithMultiValueRangeStmnt.yang
new file mode 100644
index 0000000..f657134
--- /dev/null
+++ b/plugin/src/test/resources/Decimal64TypeWithMultiValueRangeStmnt.yang
@@ -0,0 +1,11 @@
+module Test {
+ yang-version 1;
+ namespace http://huawei.com;
+ prefix Ant;
+ leaf validDecimal {
+ type decimal64 {
+ fraction-digits 18;
+ range "-9.22..7.22 | 8 | 9..max";
+ }
+ }
+}
diff --git a/plugin/src/test/resources/Decimal64TypeWithRangeStatement.yang b/plugin/src/test/resources/Decimal64TypeWithRangeStatement.yang
new file mode 100644
index 0000000..f184927
--- /dev/null
+++ b/plugin/src/test/resources/Decimal64TypeWithRangeStatement.yang
@@ -0,0 +1,11 @@
+module Test {
+ yang-version 1;
+ namespace http://huawei.com;
+ prefix Ant;
+ leaf validDecimal {
+ type decimal64 {
+ fraction-digits 8;
+ range "-92233720368.54775808 .. 92233720368.54775807";
+ }
+ }
+}
diff --git a/plugin/src/test/resources/Decimal64TypeWithoutFraction.yang b/plugin/src/test/resources/Decimal64TypeWithoutFraction.yang
new file mode 100644
index 0000000..e7b8beb
--- /dev/null
+++ b/plugin/src/test/resources/Decimal64TypeWithoutFraction.yang
@@ -0,0 +1,8 @@
+module Test {
+ yang-version 1;
+ namespace http://huawei.com;
+ prefix Ant;
+ leaf validDecimal {
+ type decimal64;
+ }
+}
diff --git a/plugin/src/test/resources/Decimal64TypedefStatement.yang b/plugin/src/test/resources/Decimal64TypedefStatement.yang
new file mode 100644
index 0000000..66addd2
--- /dev/null
+++ b/plugin/src/test/resources/Decimal64TypedefStatement.yang
@@ -0,0 +1,15 @@
+module Test {
+ yang-version 1;
+ namespace http://huawei.com;
+ prefix Ant;
+
+ typedef validDecimal {
+ type decimal64 {
+ fraction-digits 4;
+ }
+ }
+
+ leaf setFourDecimal {
+ type validDecimal;
+ }
+}
diff --git a/plugin/src/test/resources/ValidBinaryLengthStatement.yang b/plugin/src/test/resources/ValidBinaryLengthStatement.yang
new file mode 100644
index 0000000..7182eb3
--- /dev/null
+++ b/plugin/src/test/resources/ValidBinaryLengthStatement.yang
@@ -0,0 +1,10 @@
+module Test {
+ yang-version 1;
+ namespace http://huawei.com;
+ prefix Ant;
+ leaf message {
+ type binary {
+ length "4";
+ }
+ }
+}
diff --git a/plugin/src/test/resources/ValidLengthStatementInsideBinary.yang b/plugin/src/test/resources/ValidLengthStatementInsideBinary.yang
new file mode 100644
index 0000000..7182eb3
--- /dev/null
+++ b/plugin/src/test/resources/ValidLengthStatementInsideBinary.yang
@@ -0,0 +1,10 @@
+module Test {
+ yang-version 1;
+ namespace http://huawei.com;
+ prefix Ant;
+ leaf message {
+ type binary {
+ length "4";
+ }
+ }
+}
diff --git a/plugin/src/test/resources/interfileietf/ietf-te-topology.yang b/plugin/src/test/resources/interfileietf/ietf-te-topology.yang
index b5fd1d9..5b65dff 100644
--- a/plugin/src/test/resources/interfileietf/ietf-te-topology.yang
+++ b/plugin/src/test/resources/interfileietf/ietf-te-topology.yang
@@ -430,8 +430,8 @@
}
leaf unidirectional-packet-loss {
type decimal64 {
- /*fraction-digits 6;
- range "0 .. 50.331642";*/
+ fraction-digits 6;
+ range "0 .. 50.331642";
}
description
"Packet loss as a percentage of the total traffic sent
@@ -440,7 +440,7 @@
}
leaf unidirectional-residual-bandwidth {
type decimal64 {
- /*fraction-digits 2;*/
+ fraction-digits 2;
}
description
"Residual bandwidth that subtracts tunnel
@@ -450,7 +450,7 @@
}
leaf unidirectional-available-bandwidth {
type decimal64 {
- /*fraction-digits 2;*/
+ fraction-digits 2;
}
description
"Available bandwidth that is defined to be residual
@@ -461,7 +461,7 @@
}
leaf unidirectional-utilized-bandwidth {
type decimal64 {
- /*fraction-digits 2;*/
+ fraction-digits 2;
}
description
"Bandwidth utilization that represents the actual
@@ -753,7 +753,7 @@
}
leaf max-link-bandwidth {
type decimal64 {
- /*fraction-digits 2;*/
+ fraction-digits 2;
}
description
"Maximum bandwidth that can be seen on this link in this
@@ -765,7 +765,7 @@
}
leaf max-resv-link-bandwidth {
type decimal64 {
- /*fraction-digits 2;*/
+ fraction-digits 2;
}
description
"Maximum amount of bandwidth that can be reserved in this
@@ -793,7 +793,7 @@
}
leaf bandwidth {
type decimal64 {
- /*fraction-digits 2;*/
+ fraction-digits 2;
}
description
"Unreserved bandwidth for this level.";
@@ -884,7 +884,7 @@
}
leaf bandwidth {
type decimal64 {
- /*fraction-digits 2;*/
+ fraction-digits 2;
}
description
"Max LSP Bandwidth for this level";
@@ -899,7 +899,7 @@
leaf minimum-lsp-bandwidth {
type decimal64 {
- /*fraction-digits 2;*/
+ fraction-digits 2;
}
description
"Minimum LSP Bandwidth. Units in bytes per second.";
@@ -951,7 +951,7 @@
}
leaf bandwidth {
type decimal64 {
- /*fraction-digits 2;*/
+ fraction-digits 2;
}
description
"Max LSP Bandwidth for this level.";
diff --git a/plugin/src/test/resources/interfileietf/ietf-te-types.yang b/plugin/src/test/resources/interfileietf/ietf-te-types.yang
index ffa1984..4b9d3be 100644
--- a/plugin/src/test/resources/interfileietf/ietf-te-types.yang
+++ b/plugin/src/test/resources/interfileietf/ietf-te-types.yang
@@ -580,7 +580,7 @@
typedef admin-group {
type binary {
-// length 32;
+ length 32;
}
description
"Administrative group/Resource class/Color.";