YANG sub module linking + unsupported yang construct + defect fix

Change-Id: I224c8c14ee2111f6844278cb540c48651544f59b
diff --git a/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/TreeWalkListenerTest.java b/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/TreeWalkListenerTest.java
new file mode 100644
index 0000000..cebd680
--- /dev/null
+++ b/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/TreeWalkListenerTest.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yangutils.parser.impl;
+
+import java.io.IOException;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.onosproject.yangutils.parser.exceptions.ParserException;
+
+/**
+ * Test cases for testing tree walk listener functionality.
+ */
+public class TreeWalkListenerTest {
+
+    private final YangUtilsParserManager manager = new YangUtilsParserManager();
+
+    @Rule
+    public ExpectedException thrown = ExpectedException.none();
+    /**
+     * Checks whether exception is thrown for ordered statement.
+     */
+    @Test
+    public void processOrderedByStatement() throws IOException, ParserException {
+        thrown.expect(ParserException.class);
+        thrown.expectMessage("YANG file error : \"ordered-by\" is not supported in current version, please check wiki" +
+                " for YANG utils road map.");
+        manager.getDataModel("src/test/resources/OrderedByStatement.yang");
+    }
+
+    /**
+     * Checks whether exception is thrown for anyxml statement.
+     */
+    @Test
+    public void processAnyXmlStatement() throws IOException, ParserException {
+        thrown.expect(ParserException.class);
+        thrown.expectMessage("YANG file error : \"anyxml\" is not supported.");
+        manager.getDataModel("src/test/resources/AnyxmlStatement.yang");
+    }
+}
diff --git a/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ConfigListenerTest.java b/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ConfigListenerTest.java
index 439832f..d129e38 100644
--- a/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ConfigListenerTest.java
+++ b/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ConfigListenerTest.java
@@ -134,9 +134,9 @@
     @Test
     public void processModuleSubStatementConfig() throws IOException, ParserException {
         thrown.expect(ParserException.class);
-        thrown.expectMessage("mismatched input 'config' expecting {'augment', 'choice', 'contact', 'container',"
-                + " 'description', 'extension', 'deviation', 'feature', 'grouping', 'identity', 'import', 'include', "
-                + "'leaf', 'leaf-list', 'list', 'notification', 'organization', 'reference',"
+        thrown.expectMessage("mismatched input 'config' expecting {'anyxml', 'augment', 'choice', 'contact', "
+                + "'container', 'description', 'extension', 'deviation', 'feature', 'grouping', 'identity', 'import',"
+                + " 'include', 'leaf', 'leaf-list', 'list', 'notification', 'organization', 'reference',"
                 + " 'revision', 'rpc', 'typedef', 'uses', '}'}");
         YangNode node = manager.getDataModel("src/test/resources/ModuleSubStatementConfig.yang");
     }
diff --git a/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/DefaultListenerTest.java b/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/DefaultListenerTest.java
new file mode 100644
index 0000000..2aab556
--- /dev/null
+++ b/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/DefaultListenerTest.java
@@ -0,0 +1,90 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yangutils.parser.impl.listeners;
+
+import java.io.IOException;
+import java.util.ListIterator;
+
+import org.junit.Test;
+import org.onosproject.yangutils.datamodel.YangNode;
+import org.onosproject.yangutils.datamodel.YangModule;
+import org.onosproject.yangutils.datamodel.YangLeaf;
+import org.onosproject.yangutils.datamodel.YangChoice;
+import org.onosproject.yangutils.datamodel.YangContainer;
+import org.onosproject.yangutils.datamodel.YangNodeType;
+import org.onosproject.yangutils.parser.exceptions.ParserException;
+import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
+
+import static org.hamcrest.core.Is.is;
+import static org.junit.Assert.assertThat;
+
+/**
+ * Test cases for testing default listener functionality.
+ */
+public class DefaultListenerTest {
+
+    private final YangUtilsParserManager manager = new YangUtilsParserManager();
+
+    /**
+     * Checks if default value is set correctly.
+     */
+    @Test
+    public void processLeafSubStatementDefault() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/LeafSubStatementDefault.yang");
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("invalid-interval"));
+        assertThat(leafInfo.getDefaultValueInString(), is("\"1\""));
+    }
+
+    /**
+     * Checks if default value is set correctly.
+     */
+    @Test
+    public void processChoiceSubStatementDefault() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/ChoiceSubStatementDefault.yang");
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        YangContainer yangContainer = (YangContainer) yangNode.getChild();
+        assertThat(yangContainer.getName(), is("food"));
+
+        YangChoice yangChoice = (YangChoice) yangContainer.getChild();
+        assertThat(yangChoice.getName(), is("snack"));
+        assertThat(yangChoice.getDefaultValueInString(), is("\"hello\""));
+    }
+}
diff --git a/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/EnumListenerTest.java b/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/EnumListenerTest.java
index 6f13667..a78c65f 100644
--- a/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/EnumListenerTest.java
+++ b/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/EnumListenerTest.java
@@ -18,7 +18,10 @@
 
 import static org.hamcrest.MatcherAssert.assertThat;
 import static org.hamcrest.core.Is.is;
+
+import org.junit.Rule;
 import org.junit.Test;
+import org.junit.rules.ExpectedException;
 import org.onosproject.yangutils.datamodel.YangDataTypes;
 import org.onosproject.yangutils.datamodel.YangEnum;
 import org.onosproject.yangutils.datamodel.YangEnumeration;
@@ -38,6 +41,9 @@
  */
 public class EnumListenerTest {
 
+    @Rule
+    public ExpectedException thrown = ExpectedException.none();
+
     private final YangUtilsParserManager manager = new YangUtilsParserManager();
 
     /**
@@ -84,7 +90,28 @@
      */
     @Test(expected = ParserException.class)
     public void processEnumWithDuplicateName() throws IOException, ParserException {
-
         YangNode node = manager.getDataModel("src/test/resources/EnumWithDuplicateName.yang");
     }
+
+    /**
+     * Checks enum boundary value.
+     */
+    @Test
+    public void processEnumBoundaryValue() throws IOException, ParserException {
+        thrown.expect(ParserException.class);
+        thrown.expectMessage("YANG file error : value value 21474836472147483647 is not valid.");
+        YangNode node = manager.getDataModel("src/test/resources/EnumBoundaryValue.yang");
+    }
+
+    /**
+     * Checks whether exception is thrown if value is not specified following max enum value.
+     */
+    @Test
+    public void processEnumMaxNextValue() throws IOException, ParserException {
+        thrown.expect(ParserException.class);
+        thrown.expectMessage("YANG file error : "
+                + "An enum value MUST be specified for enum substatements following the one"
+                + "with the current highest value");
+        YangNode node = manager.getDataModel("src/test/resources/EnumMaxNextValue.yang");
+    }
 }
diff --git a/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/KeyListenerTest.java b/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/KeyListenerTest.java
index 37b4733..510b313 100644
--- a/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/KeyListenerTest.java
+++ b/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/KeyListenerTest.java
@@ -203,12 +203,32 @@
     }
 
     /**
+     * Checks key values are set correctly.
+     */
+    @Test
+    public void processKeyWithUsesInList() throws IOException, ParserException {
+        YangNode node = manager.getDataModel("src/test/resources/KeyWithUsesInList.yang");
+
+        assertThat((node instanceof YangModule), is(true));
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        // Check whether the list is child of module
+        YangList yangList = (YangList) yangNode.getChild().getNextSibling();
+        assertThat(yangList.getName(), is("valid"));
+
+        ListIterator<String> keyList = yangList.getKeyList().listIterator();
+        assertThat(keyList.next(), is("invalid-interval"));
+    }
+
+    /**
      * Checks whether exception is thrown when key leaf identifier is not found in list.
      */
     @Test
     public void processInvalidLeafIdentifier() throws IOException, ParserException {
         thrown.expect(ParserException.class);
-        thrown.expectMessage("Leaf identifier must refer to a child leaf of the list");
+        thrown.expectMessage("An identifier, in key, must refer to a child leaf of the list");
         YangNode node = manager.getDataModel("src/test/resources/InvalidLeafIdentifier.yang");
     }
 
@@ -218,7 +238,7 @@
     @Test
     public void processInvalidLeafListIdentifier() throws IOException, ParserException {
         thrown.expect(ParserException.class);
-        thrown.expectMessage("Leaf-list identifier must refer to a child leaf of the list");
+        thrown.expectMessage("An identifier, in key, must refer to a child leaf of the list");
         YangNode node = manager.getDataModel("src/test/resources/InvalidLeafListIdentifier.yang");
     }
 
diff --git a/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/LeafListListenerTest.java b/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/LeafListListenerTest.java
index fe918fa..8e7489b 100644
--- a/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/LeafListListenerTest.java
+++ b/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/LeafListListenerTest.java
@@ -94,9 +94,9 @@
     @Test
     public void processLeafListInvalidStatement() throws IOException, ParserException {
         thrown.expect(ParserException.class);
-        thrown.expectMessage("mismatched input 'leaflist' expecting {'augment', 'choice', 'contact', 'container',"
-                + " 'description', 'extension', 'deviation', 'feature', 'grouping', 'identity', 'import', 'include',"
-                + " 'leaf', 'leaf-list', 'list', 'notification', 'organization', 'reference',"
+        thrown.expectMessage("mismatched input 'leaflist' expecting {'anyxml', 'augment', 'choice', 'contact', "
+                + "'container', 'description', 'extension', 'deviation', 'feature', 'grouping', 'identity', 'import',"
+                + " 'include', 'leaf', 'leaf-list', 'list', 'notification', 'organization', 'reference',"
                 + " 'revision', 'rpc', 'typedef', 'uses', '}'}");
         YangNode node = manager.getDataModel("src/test/resources/LeafListInvalidStatement.yang");
     }
diff --git a/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/LeafListenerTest.java b/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/LeafListenerTest.java
index 186d549..b330e53 100644
--- a/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/LeafListenerTest.java
+++ b/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/LeafListenerTest.java
@@ -95,9 +95,9 @@
     @Test
     public void processLeafInvalidStatement() throws IOException, ParserException {
         thrown.expect(ParserException.class);
-        thrown.expectMessage("mismatched input 'leafs' expecting {'augment', 'choice', 'contact', 'container',"
-                + " 'description', 'extension', 'deviation', 'feature', 'grouping', 'identity', 'import', 'include',"
-                + " 'leaf', 'leaf-list', 'list', 'notification', 'organization', 'reference',"
+        thrown.expectMessage("mismatched input 'leafs' expecting {'anyxml', 'augment', 'choice', 'contact', "
+                + "'container', 'description', 'extension', 'deviation', 'feature', 'grouping', 'identity', 'import',"
+                + " 'include', 'leaf', 'leaf-list', 'list', 'notification', 'organization', 'reference',"
                 + " 'revision', 'rpc', 'typedef', 'uses', '}'}");
         YangNode node = manager.getDataModel("src/test/resources/LeafInvalidStatement.yang");
     }
diff --git a/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/LengthRestrictionListenerTest.java b/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/LengthRestrictionListenerTest.java
index 3c01335..40036f5 100644
--- a/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/LengthRestrictionListenerTest.java
+++ b/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/LengthRestrictionListenerTest.java
@@ -232,4 +232,39 @@
                 " 18446744073709551615.");
         YangNode node = manager.getDataModel("src/test/resources/LengthWithInvalidInterval.yang");
     }
+
+    /**
+     * Checks valid length substatements.
+     */
+    @Test
+    public void processLengthSubStatements() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/LengthSubStatements.yang");
+
+        assertThat((node instanceof YangModule), is(true));
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("invalid-interval"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("string"));
+        assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.STRING));
+        YangStringRestriction stringRestriction = (YangStringRestriction) leafInfo
+                .getDataType().getDataTypeExtendedInfo();
+        YangRangeRestriction lengthRestriction = stringRestriction.getLengthRestriction();
+
+        assertThat(lengthRestriction.getDescription(), is("\"length description\""));
+        assertThat(lengthRestriction.getReference(), is("\"length reference\""));
+
+        ListIterator<YangRangeInterval> lengthListIterator = lengthRestriction.getAscendingRangeIntervals()
+                .listIterator();
+
+        YangRangeInterval rangeInterval = lengthListIterator.next();
+
+        assertThat(((YangUint64) rangeInterval.getStartValue()).getValue(), is(BigInteger.valueOf(0)));
+        assertThat(((YangUint64) rangeInterval.getEndValue()).getValue(), is(BigInteger.valueOf(100)));
+    }
 }
diff --git a/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/MandatoryListenerTest.java b/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/MandatoryListenerTest.java
index 246d4b0..52e43a9 100644
--- a/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/MandatoryListenerTest.java
+++ b/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/MandatoryListenerTest.java
@@ -148,9 +148,9 @@
     @Test
     public void processModuleSubStatementMandatory() throws IOException, ParserException {
         thrown.expect(ParserException.class);
-        thrown.expectMessage("mismatched input 'mandatory' expecting {'augment', 'choice', 'contact', 'container',"
-                + " 'description', 'extension', 'deviation', 'feature', 'grouping', 'identity', 'import', 'include',"
-                + " 'leaf', 'leaf-list', 'list', 'notification', 'organization', 'reference',"
+        thrown.expectMessage("mismatched input 'mandatory' expecting {'anyxml', 'augment', 'choice', 'contact',"
+                + " 'container', 'description', 'extension', 'deviation', 'feature', 'grouping', 'identity', 'import',"
+                + " 'include', 'leaf', 'leaf-list', 'list', 'notification', 'organization', 'reference',"
                 + " 'revision', 'rpc', 'typedef', 'uses', '}'}");
         YangNode node = manager.getDataModel("src/test/resources/ModuleSubStatementMandatory.yang");
     }
diff --git a/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/PatternRestrictionListenerTest.java b/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/PatternRestrictionListenerTest.java
index 00db373..928af5c 100644
--- a/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/PatternRestrictionListenerTest.java
+++ b/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/PatternRestrictionListenerTest.java
@@ -166,4 +166,32 @@
                 .getPatternList().listIterator();
         assertThat(patternListIterator.next(), is("-[0-9]+|[0-9]+"));
     }
+
+    /**
+     * Checks valid pattern substatement.
+     */
+    @Test
+    public void processPatternSubStatements() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/PatternSubStatements.yang");
+
+        assertThat((node instanceof YangModule), is(true));
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("invalid-interval"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("string"));
+        assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.STRING));
+        YangStringRestriction stringRestriction = (YangStringRestriction) leafInfo
+                .getDataType().getDataTypeExtendedInfo();
+        assertThat(stringRestriction.getDescription(), is("\"pattern description\""));
+        assertThat(stringRestriction.getReference(), is("\"pattern reference\""));
+        ListIterator<String> patternListIterator = stringRestriction.getPatternRestriction()
+                .getPatternList().listIterator();
+        assertThat(patternListIterator.next(), is("[a-zA-Z]"));
+    }
 }
diff --git a/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/RangeRestrictionListenerTest.java b/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/RangeRestrictionListenerTest.java
index 76da997..88672fd 100644
--- a/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/RangeRestrictionListenerTest.java
+++ b/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/RangeRestrictionListenerTest.java
@@ -174,4 +174,37 @@
         thrown.expectMessage("YANG file error : Input value \"a\" is not a valid int32.");
         YangNode node = manager.getDataModel("src/test/resources/RangeWithInvalidIntegerPattern.yang");
     }
+
+    /**
+     * Checks valid range statement with description.
+     */
+    @Test
+    public void processRangeSubStatements() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/RangeSubStatements.yang");
+
+        assertThat((node instanceof YangModule), is(true));
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("invalid-interval"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("int32"));
+        assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.INT32));
+        YangRangeRestriction rangeRestriction = (YangRangeRestriction) leafInfo
+                .getDataType().getDataTypeExtendedInfo();
+
+        assertThat(rangeRestriction.getDescription(), is("\"range description\""));
+        assertThat(rangeRestriction.getReference(), is("\"range reference\""));
+
+        ListIterator<YangRangeInterval> rangeListIterator = rangeRestriction.getAscendingRangeIntervals()
+                .listIterator();
+        YangRangeInterval rangeInterval = rangeListIterator.next();
+        assertThat(((YangInt32) rangeInterval.getStartValue()).getValue(), is(1));
+        assertThat(((YangInt32) rangeInterval.getEndValue()).getValue(), is(4));
+        assertThat(((YangInt32) rangeInterval.getEndValue()).getValue(), is(4));
+    }
 }
diff --git a/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/StatusListenerTest.java b/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/StatusListenerTest.java
index 7f0d1ea..b2cbd71 100644
--- a/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/StatusListenerTest.java
+++ b/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/StatusListenerTest.java
@@ -150,9 +150,9 @@
     @Test
     public void processModuleSubStatementStatus() throws IOException, ParserException {
         thrown.expect(ParserException.class);
-        thrown.expectMessage("mismatched input 'status' expecting {'augment', 'choice', 'contact', 'container', "
-                + "'description', 'extension', 'deviation', 'feature', 'grouping', 'identity', 'import', 'include',"
-                + " 'leaf', 'leaf-list', 'list', 'notification', 'organization', 'reference', "
+        thrown.expectMessage("mismatched input 'status' expecting {'anyxml', 'augment', 'choice', 'contact', "
+                + "'container', 'description', 'extension', 'deviation', 'feature', 'grouping', 'identity', 'import',"
+                + " 'include', 'leaf', 'leaf-list', 'list', 'notification', 'organization', 'reference', "
                 + "'revision', 'rpc', 'typedef', 'uses', '}'}");
         YangNode node = manager.getDataModel("src/test/resources/ModuleSubStatementStatus.yang");
     }
diff --git a/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/UnitsListenerTest.java b/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/UnitsListenerTest.java
index 6479991..6684df5 100644
--- a/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/UnitsListenerTest.java
+++ b/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/UnitsListenerTest.java
@@ -76,9 +76,9 @@
     @Test
     public void processModuleSubStatementUnits() throws IOException, ParserException {
         thrown.expect(ParserException.class);
-        thrown.expectMessage("mismatched input 'type' expecting {'augment', 'choice', 'contact', 'container', "
-                + "'description', 'extension', 'deviation', 'feature', 'grouping', 'identity', 'import', "
-                + "'include', 'leaf', 'leaf-list', 'list', 'notification', 'organization', "
+        thrown.expectMessage("mismatched input 'type' expecting {'anyxml', 'augment', 'choice', 'contact', "
+                + "'container', 'description', 'extension', 'deviation', 'feature', 'grouping', 'identity',"
+                + " 'import', 'include', 'leaf', 'leaf-list', 'list', 'notification', 'organization', "
                 + "'reference', 'revision', 'rpc', 'typedef', 'uses', '}'}");
         YangNode node = manager.getDataModel("src/test/resources/ModuleSubStatementUnits.yang");
     }
diff --git a/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ValueListenerTest.java b/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ValueListenerTest.java
index f0d5357..6dae702 100644
--- a/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ValueListenerTest.java
+++ b/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ValueListenerTest.java
@@ -80,6 +80,84 @@
     }
 
     /**
+     * Checks explicitly configured negative value.
+     */
+    @Test
+    public void processValueStatementWithNegativeValue() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/ValueStatementWithNegativeValue.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("speed"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("enumeration"));
+        assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.ENUMERATION));
+        assertThat(((YangEnumeration) leafInfo.getDataType().getDataTypeExtendedInfo()).getName(),
+                is("speed_enum"));
+
+        Set<YangEnum> enumSet = ((YangEnumeration) leafInfo.getDataType().getDataTypeExtendedInfo()).getEnumSet();
+        for (YangEnum tmp : enumSet) {
+            if (tmp.getNamedValue().equals("10m")) {
+                assertThat(tmp.getValue(), is(-2));
+            } else if (tmp.getNamedValue().equals("100m")) {
+                assertThat(tmp.getValue(), is(-1));
+            } else if (tmp.getNamedValue().equals("auto")) {
+                assertThat(tmp.getValue(), is(0));
+            }
+        }
+    }
+
+    /**
+     * Checks explicitly configured value with double quotes.
+     */
+    @Test
+    public void processValueStatementWithQuotes() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/ValueStatementWithQuotes.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("speed"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("enumeration"));
+        assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.ENUMERATION));
+        assertThat(((YangEnumeration) leafInfo.getDataType().getDataTypeExtendedInfo()).getName(),
+                is("speed_enum"));
+
+        Set<YangEnum> enumSet = ((YangEnumeration) leafInfo.getDataType().getDataTypeExtendedInfo()).getEnumSet();
+        for (YangEnum tmp : enumSet) {
+            if (tmp.getNamedValue().equals("10m")) {
+                assertThat(tmp.getValue(), is(10));
+            } else if (tmp.getNamedValue().equals("100m")) {
+                assertThat(tmp.getValue(), is(100));
+            } else if (tmp.getNamedValue().equals("auto")) {
+                assertThat(tmp.getValue(), is(1000));
+            }
+        }
+    }
+
+    /**
      * Checks explicit value and auto generated value.
      */
     @Test