[ONOS-6695]supporting single quoted binary values
Change-Id: Icda3f064c5a2216938ae965d75151091f93ffda7
diff --git a/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/ConfigListenerTest.java b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/ConfigListenerTest.java
index b7a0d41..123e907 100644
--- a/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/ConfigListenerTest.java
+++ b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/ConfigListenerTest.java
@@ -97,6 +97,11 @@
// Check whether the Config value is set correctly.
assertThat(leafInfo.getName(), is("invalid-interval"));
assertThat(leafInfo.isConfig(), is(false));
+
+ // Check whether the Config value is validated for single quoted boolean
+ leafInfo = leafIterator.next();
+ assertThat(leafInfo.getName(), is("invalid-interval1"));
+ assertThat(leafInfo.isConfig(), is(false));
}
/**
diff --git a/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/ErrorAppTagListenerTest.java b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/ErrorAppTagListenerTest.java
index 8bd140c..c6b4c33 100644
--- a/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/ErrorAppTagListenerTest.java
+++ b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/ErrorAppTagListenerTest.java
@@ -50,7 +50,7 @@
YangContainer yangContainer = (YangContainer) yangNode.getChild();
assertThat(yangContainer.getName(), is("interface"));
- String expectedConstraint = "ifType != 'ethernet' or (ifType = 'ethernet' and ifMTU = 1500)";
+ String expectedConstraint = "ifType != ethernet or (ifType = ethernet and ifMTU = 1500)";
List<YangMust> mustConstraintList = yangContainer.getListOfMust();
assertThat(mustConstraintList.iterator().next().getConstraint(), is(expectedConstraint));
@@ -72,7 +72,7 @@
YangContainer yangContainer = (YangContainer) yangNode.getChild();
assertThat(yangContainer.getName(), is("interface"));
- String expectedConstraint = "ifType != 'ethernet' or (ifType = 'ethernet' and ifMTU = 1500)";
+ String expectedConstraint = "ifType != ethernet or (ifType = ethernet and ifMTU = 1500)";
List<YangMust> mustConstraintList = yangContainer.getListOfMust();
assertThat(mustConstraintList.iterator().next().getConstraint(), is(expectedConstraint));
diff --git a/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/ErrorMessageListnerTest.java b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/ErrorMessageListnerTest.java
index 7080ef4..a14da2f 100644
--- a/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/ErrorMessageListnerTest.java
+++ b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/ErrorMessageListnerTest.java
@@ -50,7 +50,7 @@
YangContainer yangContainer = (YangContainer) yangNode.getChild();
assertThat(yangContainer.getName(), is("interface"));
- String expectedConstraint = "ifType != 'ethernet' or (ifType = 'ethernet' and ifMTU = 1500)";
+ String expectedConstraint = "ifType != ethernet or (ifType = ethernet and ifMTU = 1500)";
List<YangMust> mustConstraintList = yangContainer.getListOfMust();
assertThat(mustConstraintList.iterator().next().getConstraint(), is(expectedConstraint));
diff --git a/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/MustListenerTest.java b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/MustListenerTest.java
index 2793420..93c1376 100644
--- a/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/MustListenerTest.java
+++ b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/MustListenerTest.java
@@ -52,7 +52,7 @@
YangContainer yangContainer = (YangContainer) yangNode.getChild();
assertThat(yangContainer.getName(), is("interface"));
- String expectedConstraint = "ifType != 'ethernet' or (ifType = 'ethernet' and ifMTU = 1500)";
+ String expectedConstraint = "ifType != ethernet or (ifType = ethernet and ifMTU = 1500)";
List<YangMust> mustConstraintList = yangContainer.getListOfMust();
assertThat(mustConstraintList.iterator().next().getConstraint(), is(expectedConstraint));
}
@@ -70,7 +70,7 @@
ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
YangLeaf leafInfo = leafIterator.next();
- assertThat(leafInfo.getListOfMust().iterator().next().getConstraint(), is("ifType != 'ethernet'"));
+ assertThat(leafInfo.getListOfMust().iterator().next().getConstraint(), is("ifType != ethernet"));
}
/**
diff --git a/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/WhenListenerTest.java b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/WhenListenerTest.java
index c673b1a..00f776d 100644
--- a/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/WhenListenerTest.java
+++ b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/WhenListenerTest.java
@@ -49,7 +49,7 @@
assertThat(yangNode.getName(), is("Test"));
YangList yangList = (YangList) yangNode.getChild();
- String expectedConstraint = "../switching-capability = 'TDM'";
+ String expectedConstraint = "../switching-capability = TDM";
assertThat(yangList.getName(), is("interface-switching-capability"));
assertThat(yangList.getWhen().getCondition(), is(expectedConstraint));
@@ -71,6 +71,6 @@
ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
YangLeaf leafInfo = leafIterator.next();
- assertThat(leafInfo.getWhen().getCondition(), is("ifType != 'ethernet'"));
+ assertThat(leafInfo.getWhen().getCondition(), is("ifType != ethernet"));
}
}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/ConfigFalse.yang b/compiler/base/parser/src/test/resources/ConfigFalse.yang
index 79dc5ac..b465848 100644
--- a/compiler/base/parser/src/test/resources/ConfigFalse.yang
+++ b/compiler/base/parser/src/test/resources/ConfigFalse.yang
@@ -11,4 +11,13 @@
status current;
reference "RFC 6020";
}
+ leaf invalid-interval1 {
+ type "uint16";
+ units "seconds";
+ description "Interval before a route is declared invalid";
+ config 'false';
+ mandatory 'true';
+ status current;
+ reference "RFC 6020";
+ }
}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/ContainerSubStatementErrorAppTag.yang b/compiler/base/parser/src/test/resources/ContainerSubStatementErrorAppTag.yang
index 644b890..1b03523 100644
--- a/compiler/base/parser/src/test/resources/ContainerSubStatementErrorAppTag.yang
+++ b/compiler/base/parser/src/test/resources/ContainerSubStatementErrorAppTag.yang
@@ -12,8 +12,8 @@
leaf ifMTU {
type uint32;
}
- must "ifType != 'ethernet' or " +
- "(ifType = 'ethernet' and ifMTU = 1500)" {
+ must "ifType != ethernet or " +
+ "(ifType = ethernet and ifMTU = 1500)" {
description "An ethernet MTU must be 1500";
error-app-tag "An ethernet MTU must be 1500";
}
diff --git a/compiler/base/parser/src/test/resources/ContainerSubStatementErrorDefaultAppTag.yang b/compiler/base/parser/src/test/resources/ContainerSubStatementErrorDefaultAppTag.yang
index c265ea2..3edf457 100644
--- a/compiler/base/parser/src/test/resources/ContainerSubStatementErrorDefaultAppTag.yang
+++ b/compiler/base/parser/src/test/resources/ContainerSubStatementErrorDefaultAppTag.yang
@@ -12,8 +12,8 @@
leaf ifMTU {
type uint32;
}
- must "ifType != 'ethernet' or " +
- "(ifType = 'ethernet' and ifMTU = 1500)" {
+ must "ifType != ethernet or " +
+ "(ifType = ethernet and ifMTU = 1500)" {
description "An ethernet MTU must be 1500";
}
must "ifType != 'atm' or " +
diff --git a/compiler/base/parser/src/test/resources/ContainerSubStatementErrorMessage.yang b/compiler/base/parser/src/test/resources/ContainerSubStatementErrorMessage.yang
index 4726d0c..8de1660 100644
--- a/compiler/base/parser/src/test/resources/ContainerSubStatementErrorMessage.yang
+++ b/compiler/base/parser/src/test/resources/ContainerSubStatementErrorMessage.yang
@@ -12,8 +12,8 @@
leaf ifMTU {
type uint32;
}
- must "ifType != 'ethernet' or " +
- "(ifType = 'ethernet' and ifMTU = 1500)" {
+ must "ifType != ethernet or " +
+ "(ifType = ethernet and ifMTU = 1500)" {
description "An ethernet MTU must be 1500";
error-message "An ethernet MTU must be 1500";
}
diff --git a/compiler/base/parser/src/test/resources/ContainerSubStatementMust.yang b/compiler/base/parser/src/test/resources/ContainerSubStatementMust.yang
index c089850..de450fc 100644
--- a/compiler/base/parser/src/test/resources/ContainerSubStatementMust.yang
+++ b/compiler/base/parser/src/test/resources/ContainerSubStatementMust.yang
@@ -12,8 +12,8 @@
leaf ifMTU {
type uint32;
}
- must "ifType != 'ethernet' or " +
- "(ifType = 'ethernet' and ifMTU = 1500)" {
+ must "ifType != ethernet or " +
+ "(ifType = ethernet and ifMTU = 1500)" {
description "An ethernet MTU must be 1500";
}
must "ifType != 'atm' or " +
diff --git a/compiler/base/parser/src/test/resources/ContainerSubStatementWhen.yang b/compiler/base/parser/src/test/resources/ContainerSubStatementWhen.yang
index c25b499..84757ab 100644
--- a/compiler/base/parser/src/test/resources/ContainerSubStatementWhen.yang
+++ b/compiler/base/parser/src/test/resources/ContainerSubStatementWhen.yang
@@ -3,7 +3,7 @@
namespace "http://huawei.com";
prefix Ant;
list interface-switching-capability {
- when "../switching-capability = 'TDM'" {
+ when "../switching-capability = TDM" {
description "Valid only for TDM";
}
key "switching-capability";
@@ -22,7 +22,7 @@
}
}
container time-division-multiplex-capable {
- when "../switching-capability = 'TDM'" {
+ when "../switching-capability = TDM" {
description "Valid only for TDM";
}
description
diff --git a/compiler/base/parser/src/test/resources/LeafSubStatementMust.yang b/compiler/base/parser/src/test/resources/LeafSubStatementMust.yang
index 6d7e626..1a2c0c1 100644
--- a/compiler/base/parser/src/test/resources/LeafSubStatementMust.yang
+++ b/compiler/base/parser/src/test/resources/LeafSubStatementMust.yang
@@ -7,7 +7,7 @@
enum ethernet;
enum atm;
}
- must "ifType != 'ethernet'" {
+ must "ifType != ethernet" {
description "ifType is not ethernet";
}
}
diff --git a/compiler/base/parser/src/test/resources/LeafSubStatementWhen.yang b/compiler/base/parser/src/test/resources/LeafSubStatementWhen.yang
index 239e0b6..f980763 100644
--- a/compiler/base/parser/src/test/resources/LeafSubStatementWhen.yang
+++ b/compiler/base/parser/src/test/resources/LeafSubStatementWhen.yang
@@ -3,7 +3,7 @@
namespace http://huawei.com;
prefix Ant;
leaf ifType {
- when "ifType != 'ethernet'" {
+ when "ifType != ethernet" {
description "ifType is not ethernet";
}
type enumeration {