[ONOS-4798] Error Message implementation for YANG utils

Change-Id: Idb13e851258754773f8f447ace69a9393c7c1b3d
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangAppErrorHolder.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangAppErrorHolder.java
new file mode 100644
index 0000000..484aec1
--- /dev/null
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangAppErrorHolder.java
@@ -0,0 +1,38 @@
+/*
+ * 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.datamodel;
+
+/**
+ * Represents data model node to maintain YANG app error message information.
+ */
+public interface YangAppErrorHolder {
+
+    /**
+     * Sets the application's error information.
+     *
+     * @param yangAppErrorInfo the application's error information
+     */
+    void setAppErrorInfo(YangAppErrorInfo yangAppErrorInfo);
+
+    /**
+     * Returns application's error information.
+     *
+     * @return application's error information
+     */
+    YangAppErrorInfo getAppErrorInfo();
+
+}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangAppErrorInfo.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangAppErrorInfo.java
index 671aa08..213dccf 100644
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangAppErrorInfo.java
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangAppErrorInfo.java
@@ -1,48 +1,149 @@
-/*Copyright 2016.year Open Networking Laboratory
+/*
+ * 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.
+ */
 
-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.datamodel;
 
+import java.io.Serializable;
+
 /**
- * Abstraction of error message and application info processing.
+ * Represents data model to maintain yang app error information.
  */
-public interface YangAppErrorInfo {
+public class YangAppErrorInfo implements Serializable {
+
+    private static final long serialVersionUID = 807201693L;
 
     /**
-     * Returns the application's error message for data error.
-     *
-     * @return application's error message for data error.
+     * Application's error message, to be used for data error.
      */
-    String getGetErrorMessage();
+    private String errorMessage;
 
     /**
-     * Sets the application's error message for data error.
-     *
-     * @param errorMessage application's error message for data error.
+     * Error tag, to be filled in data validation error response.
      */
-    void setErrorMessage(String errorMessage);
+    private String errorTag;
 
     /**
-     * Returns the application's error tag for data error.
-     *
-     * @return application's error tag for data error.
+     * Application's error tag, to be filled in data validation error response.
      */
-    String getGetErrorAppTag();
+    private String errorAppTag;
 
     /**
-     * Sets the application's error tag for data error.
-     *
-     * @param errorMessage application's error tag for data error.
+     * Application's error path, to be filled in data validation error response.
      */
-    void setErrorAppTag(String errorMessage);
+    private String errorAppPath;
+
+    /**
+     * Application's error info, to be filled in data validation error response.
+     */
+    private String errorAppInfo;
+
+    /**
+     * Creates a YANG app error info object.
+     */
+    @SuppressWarnings("unused")
+    public YangAppErrorInfo() {
+    }
+
+    /**
+     * Returns application's error message, to be used for data error.
+     *
+     * @return Application's error message, to be used for data error
+     */
+    public String getGetErrorMessage() {
+        return errorMessage;
+    }
+
+    /**
+     * Sets Application's error message, to be used for data error.
+     *
+     * @param errMsg Application's error message, to be used for data error
+     */
+    public void setErrorMessage(String errMsg) {
+        errorMessage = errMsg;
+    }
+
+    /**
+     * Returns error tag, to be used for data error.
+     *
+     * @return error tag, to be used for data error
+     */
+    public String getGetErrorTag() {
+        return errorTag;
+    }
+
+    /**
+     * Sets error tag, to be used for data error.
+     *
+     * @param errTag error tag, to be used for data error
+     */
+    public void setErrorTag(String errTag) {
+        errorTag = errTag;
+    }
+
+    /**
+     * Returns application's error tag, to be used for data error.
+     *
+     * @return application's error tag, to be used for data error
+     */
+    public String getGetErrorAppTag() {
+        return errorAppTag;
+    }
+
+    /**
+     * Sets application's error tag, to be used for data error.
+     *
+     * @param errTag application's error tag, to be used for data error
+     */
+    public void setErrorAppTag(String errTag) {
+        errorAppTag = errTag;
+    }
+
+    /**
+     * Returns application's error path, to be used for data error.
+     *
+     * @return application's error path, to be used for data error
+     */
+    public String getGetErrorAppPath() {
+        return errorAppPath;
+    }
+
+    /**
+     * Sets application's error path, to be used for data error.
+     *
+     * @param errPath application's error path, to be used for data error
+     */
+    public void setErrorAppPath(String errPath) {
+        errorAppPath = errPath;
+    }
+
+    /**
+     * Returns application's error info, to be used for data error.
+     *
+     * @return application's error info, to be used for data error
+     */
+    public String getGetErrorAppInfo() {
+        return errorAppInfo;
+    }
+
+    /**
+     * Sets application's error info, to be used for data error.
+     *
+     * @param errInfo application's error info, to be used for data error
+     */
+    public void setErrorAppInfo(String errInfo) {
+        errorAppInfo = errInfo;
+    }
 }
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangChoice.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangChoice.java
index 5e78d55..b7bdf08 100644
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangChoice.java
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangChoice.java
@@ -23,6 +23,9 @@
 import org.onosproject.yangutils.datamodel.utils.YangConstructType;
 
 import static org.onosproject.yangutils.datamodel.utils.YangConstructType.CHOICE_DATA;
+import static org.onosproject.yangutils.datamodel.utils.YangErrMsgConstants.DATA_MISSING_ERROR_TAG;
+import static org.onosproject.yangutils.datamodel.utils.YangErrMsgConstants.ERROR_PATH_MISSING_CHOICE;
+import static org.onosproject.yangutils.datamodel.utils.YangErrMsgConstants.MISSING_CHOICE_ERROR_APP_TAG;
 
 /*-
  * Reference RFC 6020.
@@ -65,7 +68,7 @@
  */
 public class YangChoice extends YangNode
         implements YangCommonInfo, Parsable, CollisionDetector, YangAugmentableNode,
-        YangWhenHolder, YangIfFeatureHolder {
+        YangWhenHolder, YangIfFeatureHolder, YangAppErrorHolder {
 
     private static final long serialVersionUID = 806201604L;
 
@@ -160,10 +163,19 @@
     private List<YangAugmentedInfo> yangAugmentedInfo = new ArrayList<>();
 
     /**
+     * YANG application error information.
+     */
+    private YangAppErrorInfo yangAppErrorInfo;
+
+    /**
      * Create a choice node.
      */
     public YangChoice() {
         super(YangNodeType.CHOICE_NODE);
+        yangAppErrorInfo = new YangAppErrorInfo();
+        yangAppErrorInfo.setErrorTag(DATA_MISSING_ERROR_TAG);
+        yangAppErrorInfo.setErrorAppTag(MISSING_CHOICE_ERROR_APP_TAG);
+        yangAppErrorInfo.setErrorAppPath(ERROR_PATH_MISSING_CHOICE);
     }
 
     /**
@@ -435,4 +447,15 @@
     public List<YangAugmentedInfo> getAugmentedInfoList() {
         return yangAugmentedInfo;
     }
+
+    @Override
+    public void setAppErrorInfo(YangAppErrorInfo yangAppErrorInfo) {
+        this.yangAppErrorInfo = yangAppErrorInfo;
+    }
+
+    @Override
+    public YangAppErrorInfo getAppErrorInfo() {
+        return yangAppErrorInfo;
+    }
+
 }
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangLeafList.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangLeafList.java
index 11e55db..cbb2038 100644
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangLeafList.java
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangLeafList.java
@@ -87,7 +87,7 @@
      *
      * If no "max-elements" statement is present, it defaults to "unbounded".
      */
-    private int maxElelements = Integer.MAX_VALUE;
+    private YangMaxElement maxElement;
 
     /**
      * Reference:RFC 6020.
@@ -107,7 +107,7 @@
      *
      * o Otherwise, it is enforced if the ancestor node exists.
      */
-    private int minElements = 0;
+    private YangMinElement minElements;
 
     /**
      * The textual reference to this leaf-list.
@@ -153,6 +153,8 @@
      * Creates a YANG leaf-list.
      */
     public YangLeafList() {
+        setMinElements(new YangMinElement());
+        setMaxElements(new YangMaxElement());
     }
 
     /**
@@ -232,38 +234,38 @@
     }
 
     /**
-     * Returns the max elements no.
+     * Returns the maximum elements number.
      *
-     * @return the max elements no
+     * @return the maximum elements number
      */
-    public int getMaxElelements() {
-        return maxElelements;
+    public YangMaxElement getMaxElements() {
+        return maxElement;
     }
 
     /**
-     * Sets the max elements no.
+     * Sets the maximum elements number.
      *
-     * @param maxElelements max elements no
+     * @param maxElement maximum elements number
      */
-    public void setMaxElelements(int maxElelements) {
-        this.maxElelements = maxElelements;
+    public void setMaxElements(YangMaxElement maxElement) {
+        this.maxElement = maxElement;
     }
 
     /**
-     * Returns the min elements no.
+     * Returns the minimum elements number.
      *
-     * @return the min elements no
+     * @return the minimum elements number
      */
-    public int getMinElements() {
+    public YangMinElement getMinElements() {
         return minElements;
     }
 
     /**
-     * Sets the min elements no.
+     * Sets the minimum elements number.
      *
-     * @param minElements the min elements no
+     * @param minElements the minimum elements number
      */
-    public void setMinElements(int minElements) {
+    public void setMinElements(YangMinElement minElements) {
         this.minElements = minElements;
     }
 
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangLeafRef.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangLeafRef.java
index 0c3a98f..4973303 100644
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangLeafRef.java
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangLeafRef.java
@@ -29,6 +29,9 @@
 
 import static org.onosproject.yangutils.datamodel.utils.ResolvableStatus.INTRA_FILE_RESOLVED;
 import static org.onosproject.yangutils.datamodel.utils.ResolvableStatus.RESOLVED;
+import static org.onosproject.yangutils.datamodel.utils.YangErrMsgConstants.DATA_MISSING_ERROR_TAG;
+import static org.onosproject.yangutils.datamodel.utils.YangErrMsgConstants.ERROR_PATH_LEAFREF_LEAF;
+import static org.onosproject.yangutils.datamodel.utils.YangErrMsgConstants.INSTANCE_REQUIRED_ERROR_APP_TAG;
 
 /*
  * Reference:RFC 6020.
@@ -44,7 +47,7 @@
  * @param <T> YANG leafref info
  */
 public class YangLeafRef<T> implements Parsable, Resolvable, Serializable, YangIfFeatureHolder,
-        YangXPathResolver {
+        YangXPathResolver, YangAppErrorHolder {
 
     private static final long serialVersionUID = 286201644L;
 
@@ -97,6 +100,21 @@
     private List<YangIfFeature> ifFeatureList;
 
     /**
+     * YANG application error information.
+     */
+    private YangAppErrorInfo yangAppErrorInfo;
+
+    /**
+     * Creates a YANG leaf ref.
+     */
+    public YangLeafRef() {
+        yangAppErrorInfo = new YangAppErrorInfo();
+        yangAppErrorInfo.setErrorTag(DATA_MISSING_ERROR_TAG);
+        yangAppErrorInfo.setErrorAppTag(INSTANCE_REQUIRED_ERROR_APP_TAG);
+        yangAppErrorInfo.setErrorAppPath(ERROR_PATH_LEAFREF_LEAF);
+    }
+
+    /**
      * Returns the status of the require instance in leafref.
      *
      * @return status of the require instance
@@ -266,6 +284,16 @@
     }
 
     @Override
+    public void setAppErrorInfo(YangAppErrorInfo yangAppErrorInfo) {
+        this.yangAppErrorInfo = yangAppErrorInfo;
+    }
+
+    @Override
+    public YangAppErrorInfo getAppErrorInfo() {
+        return yangAppErrorInfo;
+    }
+
+    @Override
     public void resolve() throws DataModelException {
 
         if (getReferredLeafOrLeafList() == null) {
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangLengthRestriction.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangLengthRestriction.java
index 9157801..43780a6 100644
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangLengthRestriction.java
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangLengthRestriction.java
@@ -33,7 +33,7 @@
 /**
  * Represents the restriction for length data type.
  */
-public class YangLengthRestriction implements YangDesc, YangReference, YangAppErrorInfo, Parsable, Serializable {
+public class YangLengthRestriction implements YangDesc, YangReference, Parsable, Serializable, YangAppErrorHolder {
 
     /*-
      * Reference RFC 6020.
@@ -84,21 +84,16 @@
     private String reference;
 
     /**
-     * Application's error message, to be used for data error.
-     */
-    private String errorMessage;
-
-    /**
-     * Application's error tag, to be filled in data validation error response.
-     */
-    private String errorAppTag;
-
-    /**
      * Textual description.
      */
     private String description;
 
     /**
+     * YANG application error information.
+     */
+    private YangAppErrorInfo yangAppErrorInfo;
+
+    /**
      * Creates a YANG length restriction object.
      */
     public YangLengthRestriction() {
@@ -164,47 +159,6 @@
 
     }
 
-    /**
-     * Returns application's error message, to be used for data error.
-     *
-     * @return Application's error message, to be used for data error
-     */
-    @Override
-    public String getGetErrorMessage() {
-        return errorMessage;
-    }
-
-    /**
-     * Sets Application's error message, to be used for data error.
-     *
-     * @param errMsg Application's error message, to be used for data error
-     */
-    @Override
-    public void setErrorMessage(String errMsg) {
-        errorMessage = errMsg;
-
-    }
-
-    /**
-     * Returns application's error tag, to be used for data error.
-     *
-     * @return application's error tag, to be used for data error
-     */
-    @Override
-    public String getGetErrorAppTag() {
-        return errorAppTag;
-    }
-
-    /**
-     * Sets application's error tag, to be used for data error.
-     *
-     * @param errTag application's error tag, to be used for data error.
-     */
-    @Override
-    public void setErrorAppTag(String errTag) {
-        errorAppTag = errTag;
-    }
-
     @Override
     public YangConstructType getYangConstructType() {
         return YangConstructType.PATTERN_DATA;
@@ -219,4 +173,24 @@
     public void validateDataOnExit() throws DataModelException {
         // TODO: implement the method.
     }
+
+    /**
+     * Sets the application's error information.
+     *
+     * @param yangAppErrorInfo the application's error information
+     */
+    @Override
+    public void setAppErrorInfo(YangAppErrorInfo yangAppErrorInfo) {
+        this.yangAppErrorInfo = yangAppErrorInfo;
+    }
+
+    /**
+     * Returns application's error information.
+     *
+     * @return application's error information
+     */
+    @Override
+    public YangAppErrorInfo getAppErrorInfo() {
+        return yangAppErrorInfo;
+    }
 }
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangList.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangList.java
index 2d28525..d5eafb1 100644
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangList.java
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangList.java
@@ -140,7 +140,7 @@
      *
      * If no "max-elements" statement is present, it defaults to "unbounded".
      */
-    private int maxElements = Integer.MAX_VALUE;
+    private YangMaxElement maxElements;
 
     /**
      * Reference RFC 6020.
@@ -160,7 +160,7 @@
      *
      * o Otherwise, it is enforced if the ancestor node exists.
      */
-    private int minElements = 0;
+    private YangMinElement minElements;
 
     /**
      * reference.
@@ -381,7 +381,7 @@
      *
      * @return the max elements
      */
-    public int getMaxElements() {
+    public YangMaxElement getMaxElements() {
         return maxElements;
     }
 
@@ -390,8 +390,8 @@
      *
      * @param max the max elements
      */
-    public void setMaxElements(int max) {
-        maxElements = max;
+    public void setMaxElements(YangMaxElement max) {
+        this.maxElements = max;
     }
 
     /**
@@ -399,7 +399,7 @@
      *
      * @return the minimum elements
      */
-    public int getMinElements() {
+    public YangMinElement getMinElements() {
         return minElements;
     }
 
@@ -408,7 +408,7 @@
      *
      * @param minElements the minimum elements
      */
-    public void setMinElements(int minElements) {
+    public void setMinElements(YangMinElement minElements) {
         this.minElements = minElements;
     }
 
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangMaxElement.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangMaxElement.java
new file mode 100644
index 0000000..6ec7f47
--- /dev/null
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangMaxElement.java
@@ -0,0 +1,84 @@
+/*
+ * 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.datamodel;
+
+import static org.onosproject.yangutils.datamodel.utils.YangErrMsgConstants.OPERATION_FAILED_ERROR_TAG;
+import static org.onosproject.yangutils.datamodel.utils.YangErrMsgConstants.TOO_MANY_ELEMENTS_ERROR_APP_TAG;
+
+import java.io.Serializable;
+
+/**
+ * Represents max element data represented in YANG.
+ */
+public class YangMaxElement implements YangAppErrorHolder, Serializable {
+
+    private static final long serialVersionUID = 807201694L;
+
+    /**
+     * YANG application error information.
+     */
+    private YangAppErrorInfo yangAppErrorInfo;
+
+    /**
+     * Reference:RFC 6020.
+     *
+     * The "max-elements" statement, which is optional, takes as an argument a
+     * positive integer or the string "unbounded", which puts a constraint on
+     * valid list entries. A valid leaf-list or list always has at most
+     * max-elements entries.
+     *
+     * If no "max-elements" statement is present, it defaults to "unbounded".
+     */
+    private int maxElement = Integer.MAX_VALUE;
+
+    /**
+     * Creates a YANG maximum element.
+     */
+    public YangMaxElement() {
+        YangAppErrorInfo yangAppErrorInfo = new YangAppErrorInfo();
+        yangAppErrorInfo.setErrorTag(OPERATION_FAILED_ERROR_TAG);
+        yangAppErrorInfo.setErrorAppTag(TOO_MANY_ELEMENTS_ERROR_APP_TAG);
+    }
+
+    /**
+     * Returns the maximum element value.
+     *
+     * @return the maximum element value
+     */
+    public int getMaxElement() {
+        return maxElement;
+    }
+
+    /**
+     * Sets the maximum element value.
+     *
+     * @param maxElement the maximum element value
+     */
+    public void setMaxElement(int maxElement) {
+        this.maxElement = maxElement;
+    }
+
+    @Override
+    public void setAppErrorInfo(YangAppErrorInfo yangAppErrorInfo) {
+        this.yangAppErrorInfo = yangAppErrorInfo;
+    }
+
+    @Override
+    public YangAppErrorInfo getAppErrorInfo() {
+        return yangAppErrorInfo;
+    }
+}
\ No newline at end of file
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangMinElement.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangMinElement.java
new file mode 100644
index 0000000..4eab3a8
--- /dev/null
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangMinElement.java
@@ -0,0 +1,92 @@
+/*
+ * 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.datamodel;
+
+import static org.onosproject.yangutils.datamodel.utils.YangErrMsgConstants.OPERATION_FAILED_ERROR_TAG;
+import static org.onosproject.yangutils.datamodel.utils.YangErrMsgConstants.TOO_FEW_ELEMENTS_ERROR_APP_TAG;
+
+import java.io.Serializable;
+
+/**
+ * Represents minimum element data represented in YANG.
+ */
+public class YangMinElement implements YangAppErrorHolder, Serializable {
+
+    private static final long serialVersionUID = 807201695L;
+
+    /**
+     * YANG application error information.
+     */
+    private YangAppErrorInfo yangAppErrorInfo;
+
+    /**
+     * Reference:RFC 6020.
+     *
+     * The "min-elements" statement, which is optional, takes as an argument a
+     * non-negative integer that puts a constraint on valid list entries. A
+     * valid leaf-list or list MUST have at least min-elements entries.
+     *
+     * If no "min-elements" statement is present, it defaults to zero.
+     *
+     * The behavior of the constraint depends on the type of the leaf-list's or
+     * list's closest ancestor node in the schema tree that is not a non-
+     * presence container:
+     *
+     * If this ancestor is a case node, the constraint is enforced if any
+     * other node from the case exists.
+     *
+     * Otherwise, it is enforced if the ancestor node exists.
+     */
+    private int minElement = 0;
+
+    /**
+     * Creates a YANG minimum element.
+     */
+    public YangMinElement() {
+        YangAppErrorInfo yangAppErrorInfo = new YangAppErrorInfo();
+        yangAppErrorInfo.setErrorTag(OPERATION_FAILED_ERROR_TAG);
+        yangAppErrorInfo.setErrorAppTag(TOO_FEW_ELEMENTS_ERROR_APP_TAG);
+    }
+
+    /**
+     * Returns the minimum element value.
+     *
+     * @return the minimum element value
+     */
+    public int getMinElement() {
+        return minElement;
+    }
+
+    /**
+     * Sets the minimum element value.
+     *
+     * @param minElement the minimum element value
+     */
+    public void setMinElement(int minElement) {
+        this.minElement = minElement;
+    }
+
+    @Override
+    public void setAppErrorInfo(YangAppErrorInfo yangAppErrorInfo) {
+        this.yangAppErrorInfo = yangAppErrorInfo;
+    }
+
+    @Override
+    public YangAppErrorInfo getAppErrorInfo() {
+        return yangAppErrorInfo;
+    }
+}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangMust.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangMust.java
index c579003..62f6c9e 100644
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangMust.java
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangMust.java
@@ -20,6 +20,8 @@
 import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
 import org.onosproject.yangutils.datamodel.utils.Parsable;
 import org.onosproject.yangutils.datamodel.utils.YangConstructType;
+import static org.onosproject.yangutils.datamodel.utils.YangErrMsgConstants.OPERATION_FAILED_ERROR_TAG;
+import static org.onosproject.yangutils.datamodel.utils.YangErrMsgConstants.MUST_VIOLATION_ERROR_APP_TAG;
 
 /*-
  * The "must" statement, which is optional, takes as an argument a string that
@@ -48,7 +50,7 @@
 /**
  * Represents information defined in YANG must.
  */
-public class YangMust implements YangDesc, YangReference, Parsable, Serializable {
+public class YangMust implements YangDesc, YangReference, Parsable, Serializable, YangAppErrorHolder {
 
     private static final long serialVersionUID = 806201646L;
 
@@ -68,9 +70,17 @@
     private String reference;
 
     /**
+     * YANG application error information.
+     */
+    private YangAppErrorInfo yangAppErrorInfo;
+
+    /**
      * Creates a YANG must restriction.
      */
     public YangMust() {
+        yangAppErrorInfo = new YangAppErrorInfo();
+        yangAppErrorInfo.setErrorTag(OPERATION_FAILED_ERROR_TAG);
+        yangAppErrorInfo.setErrorAppTag(MUST_VIOLATION_ERROR_APP_TAG);
     }
 
     /**
@@ -160,4 +170,14 @@
     public void validateDataOnExit() throws DataModelException {
         // TODO auto-generated method stub, to be implemented by parser
     }
+
+    @Override
+    public void setAppErrorInfo(YangAppErrorInfo yangAppErrorInfo) {
+        this.yangAppErrorInfo = yangAppErrorInfo;
+    }
+
+    @Override
+    public YangAppErrorInfo getAppErrorInfo() {
+        return yangAppErrorInfo;
+    }
 }
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangPatternRestriction.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangPatternRestriction.java
index 939b732..9e5d8ef 100644
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangPatternRestriction.java
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangPatternRestriction.java
@@ -52,7 +52,7 @@
  * Represents pattern restriction information. The regular expression restriction on string
  * data type.
  */
-public class YangPatternRestriction implements Serializable {
+public class YangPatternRestriction implements Serializable, YangAppErrorHolder {
 
     private static final long serialVersionUID = 806201649L;
 
@@ -62,6 +62,11 @@
     private List<String> patternList;
 
     /**
+     * YANG application error information.
+     */
+    private YangAppErrorInfo yangAppErrorInfo;
+
+    /**
      * Creates a YANG pattern restriction object.
      */
     public YangPatternRestriction() {
@@ -94,4 +99,14 @@
     public void addPattern(String newPattern) {
         getPatternList().add(newPattern);
     }
+
+    @Override
+    public void setAppErrorInfo(YangAppErrorInfo yangAppErrorInfo) {
+        this.yangAppErrorInfo = yangAppErrorInfo;
+    }
+
+    @Override
+    public YangAppErrorInfo getAppErrorInfo() {
+        return yangAppErrorInfo;
+    }
 }
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangRangeRestriction.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangRangeRestriction.java
index b49dda6..ae9b68e 100644
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangRangeRestriction.java
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangRangeRestriction.java
@@ -59,7 +59,7 @@
  * @param <T> range type (data type)
  */
 public class YangRangeRestriction<T extends YangBuiltInDataTypeInfo<T>>
-        implements YangDesc, YangReference, YangAppErrorInfo, Parsable, Serializable {
+        implements YangDesc, YangReference, Parsable, Serializable, YangAppErrorHolder {
 
     private static final long serialVersionUID = 8062016051L;
 
@@ -75,21 +75,16 @@
     private String reference;
 
     /**
-     * Application's error message, to be used for data error.
-     */
-    private String errorMessage;
-
-    /**
-     * Application's error tag, to be filled in data validation error response.
-     */
-    private String errorAppTag;
-
-    /**
      * Textual description.
      */
     private String description;
 
     /**
+     * YANG application error information.
+     */
+    private YangAppErrorInfo yangAppErrorInfo;
+
+    /**
      * Creates YANG range restriction object.
      */
     public YangRangeRestriction() {
@@ -278,47 +273,6 @@
 
     }
 
-    /**
-     * Returns application's error message, to be used for data error.
-     *
-     * @return Application's error message, to be used for data error
-     */
-    @Override
-    public String getGetErrorMessage() {
-        return errorMessage;
-    }
-
-    /**
-     * Sets Application's error message, to be used for data error.
-     *
-     * @param errMsg Application's error message, to be used for data error
-     */
-    @Override
-    public void setErrorMessage(String errMsg) {
-        errorMessage = errMsg;
-
-    }
-
-    /**
-     * Returns application's error tag, to be used for data error.
-     *
-     * @return application's error tag, to be used for data error
-     */
-    @Override
-    public String getGetErrorAppTag() {
-        return errorAppTag;
-    }
-
-    /**
-     * Sets application's error tag, to be used for data error.
-     *
-     * @param errTag application's error tag, to be used for data error.
-     */
-    @Override
-    public void setErrorAppTag(String errTag) {
-        errorAppTag = errTag;
-    }
-
     @Override
     public YangConstructType getYangConstructType() {
         return YangConstructType.RANGE_DATA;
@@ -333,4 +287,14 @@
     public void validateDataOnExit() throws DataModelException {
         // TODO: implement the method.
     }
+
+    @Override
+    public void setAppErrorInfo(YangAppErrorInfo yangAppErrorInfo) {
+        this.yangAppErrorInfo = yangAppErrorInfo;
+    }
+
+    @Override
+    public YangAppErrorInfo getAppErrorInfo() {
+        return yangAppErrorInfo;
+    }
 }
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangStringRestriction.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangStringRestriction.java
index ce626ed..b52a70e 100644
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangStringRestriction.java
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangStringRestriction.java
@@ -33,7 +33,7 @@
 /**
  * Represents the restriction for string data type.
  */
-public class YangStringRestriction implements YangDesc, YangReference, YangAppErrorInfo, Parsable, Serializable {
+public class YangStringRestriction implements YangDesc, YangReference, Parsable, Serializable {
 
     /*-
      * Reference RFC 6020.
@@ -89,16 +89,6 @@
     private String reference;
 
     /**
-     * Application's error message, to be used for data error.
-     */
-    private String errorMessage;
-
-    /**
-     * Application's error tag, to be filled in data validation error response.
-     */
-    private String errorAppTag;
-
-    /**
      * Textual description.
      */
     private String description;
@@ -198,47 +188,6 @@
 
     }
 
-    /**
-     * Returns application's error message, to be used for data error.
-     *
-     * @return Application's error message, to be used for data error
-     */
-    @Override
-    public String getGetErrorMessage() {
-        return errorMessage;
-    }
-
-    /**
-     * Sets Application's error message, to be used for data error.
-     *
-     * @param errMsg Application's error message, to be used for data error
-     */
-    @Override
-    public void setErrorMessage(String errMsg) {
-        errorMessage = errMsg;
-
-    }
-
-    /**
-     * Returns application's error tag, to be used for data error.
-     *
-     * @return application's error tag, to be used for data error
-     */
-    @Override
-    public String getGetErrorAppTag() {
-        return errorAppTag;
-    }
-
-    /**
-     * Sets application's error tag, to be used for data error.
-     *
-     * @param errTag application's error tag, to be used for data error.
-     */
-    @Override
-    public void setErrorAppTag(String errTag) {
-        errorAppTag = errTag;
-    }
-
     @Override
     public YangConstructType getYangConstructType() {
         return YangConstructType.PATTERN_DATA;
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/YangErrMsgConstants.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/YangErrMsgConstants.java
new file mode 100644
index 0000000..4468d9b
--- /dev/null
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/YangErrMsgConstants.java
@@ -0,0 +1,94 @@
+/*
+ * 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.datamodel.utils;
+
+/**
+ * Represents default YANG error message types.
+ */
+public final class YangErrMsgConstants {
+
+    /**
+     * Static attribute for operation failed error tag.
+     */
+    public static final String OPERATION_FAILED_ERROR_TAG = "operation-failed";
+
+    /**
+     * Static attribute for data missing error tag.
+     */
+    public static final String DATA_MISSING_ERROR_TAG = "data-missing";
+
+    /**
+     * Static attribute for bad attribute error tag.
+     */
+    public static final String BAD_ATTRIBUTE_ERROR_TAG = "bad-attribute";
+
+    /**
+     * Static attribute for data not unique error app tag.
+     */
+    public static final String DATA_NOT_UNIQUE_ERROR_APP_TAG = "data-not-unique";
+
+    /**
+     * Static attribute for too many elements error app tag.
+     */
+    public static final String TOO_MANY_ELEMENTS_ERROR_APP_TAG = "too-many-elements";
+
+    /**
+     * Static attribute for too few elements error app tag.
+     */
+    public static final String TOO_FEW_ELEMENTS_ERROR_APP_TAG = "too-few-elements";
+
+    /**
+     * Static attribute for must violation error app tag.
+     */
+    public static final String MUST_VIOLATION_ERROR_APP_TAG = "must-violation";
+
+    /**
+     * Static attribute for instance required error app tag.
+     */
+    public static final String INSTANCE_REQUIRED_ERROR_APP_TAG = "instance-required";
+
+    /**
+     * Static attribute for missing choice error app tag.
+     */
+    public static final String MISSING_CHOICE_ERROR_APP_TAG = "missing-choice";
+
+    /**
+     * Static attribute for missing instance error app tag.
+     */
+    public static final String MISSING_INSTANCE_ERROR_APP_TAG = "missing-instance";
+
+    /**
+     * TODO: Static attribute for error path to the instance-identifier leaf.
+     */
+    public static final String ERROR_PATH_INSTANCE_IDENTIFIER_LEAF = "Path to the instance-identifier leaf.";
+
+    /**
+     * Static attribute for error path to the missing choice.
+     */
+    public static final String ERROR_PATH_MISSING_CHOICE = "Path to the element with the missing choice.";
+
+    /**
+     * Static attribute for error path to the leafref leaf.
+     */
+    public static final String ERROR_PATH_LEAFREF_LEAF = "Path to the leafref leaf.";
+
+    /**
+     * Creates an instance of yang error message constants.
+     */
+    private YangErrMsgConstants() {
+    }
+}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/TreeWalkListener.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/TreeWalkListener.java
index 3d81e0d..26e41c6 100644
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/TreeWalkListener.java
+++ b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/TreeWalkListener.java
@@ -88,7 +88,8 @@
 import org.onosproject.yangutils.parser.impl.listeners.ValueListener;
 import org.onosproject.yangutils.parser.impl.listeners.VersionListener;
 import org.onosproject.yangutils.parser.impl.listeners.WhenListener;
-
+import org.onosproject.yangutils.parser.impl.listeners.ErrorMessageListener;
+import org.onosproject.yangutils.parser.impl.listeners.ErrorAppTagListener;
 import static org.onosproject.yangutils.parser.impl.parserutils.ListenerUtil.handleUnsupportedYangConstruct;
 import static org.onosproject.yangutils.utils.UtilConstants.CURRENTLY_UNSUPPORTED;
 import static org.onosproject.yangutils.utils.UtilConstants.UNSUPPORTED_YANG_CONSTRUCT;
@@ -845,7 +846,7 @@
 
     @Override
     public void enterErrorMessageStatement(GeneratedYangParser.ErrorMessageStatementContext ctx) {
-        handleUnsupportedYangConstruct(YangConstructType.ERROR_MESSAGE_DATA, ctx, CURRENTLY_UNSUPPORTED);
+        ErrorMessageListener.processErrorMessageEntry(this, ctx);
     }
 
     @Override
@@ -855,7 +856,7 @@
 
     @Override
     public void enterErrorAppTagStatement(GeneratedYangParser.ErrorAppTagStatementContext ctx) {
-        handleUnsupportedYangConstruct(YangConstructType.ERROR_APP_TAG_DATA, ctx, CURRENTLY_UNSUPPORTED);
+        ErrorAppTagListener.processErrorAppTagMessageEntry(this, ctx);
     }
 
     @Override
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/ErrorAppTagListener.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/ErrorAppTagListener.java
new file mode 100644
index 0000000..befc70a
--- /dev/null
+++ b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/ErrorAppTagListener.java
@@ -0,0 +1,81 @@
+/*
+ * 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 org.onosproject.yangutils.datamodel.YangAppErrorHolder;
+import org.onosproject.yangutils.datamodel.YangAppErrorInfo;
+import org.onosproject.yangutils.datamodel.utils.Parsable;
+import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
+import org.onosproject.yangutils.parser.exceptions.ParserException;
+import org.onosproject.yangutils.parser.impl.TreeWalkListener;
+
+import static org.onosproject.yangutils.datamodel.utils.YangConstructType.ERROR_APP_TAG_DATA;
+import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
+import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
+import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
+import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
+import static org.onosproject.yangutils.parser.impl.parserutils.ListenerUtil.removeQuotesAndHandleConcat;
+import static org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
+
+/*
+ * Reference: RFC 6020 and YANG ANTLR Grammar
+ *
+ * ABNF grammar as per RFC 6020
+ *
+ *  error-app-tag-stmt  = error-app-tag-keyword sep string stmtend
+ *
+ * ANTLR grammar rule
+ * errorAppTagStatement : ERROR_APP_TAG_KEYWORD string STMTEND;
+ */
+
+/**
+ * Represents listener based call back function corresponding to the
+ * error app tag defined in ANTLR grammar file for corresponding ABNF rule
+ * in RFC 6020.
+ */
+public final class ErrorAppTagListener {
+
+    /**
+     * Creates a new error app tag listener.
+     */
+    private ErrorAppTagListener() {
+    }
+
+    /**
+     * Performs validations and updates the data model tree. It is called when parser
+     * receives an input matching the grammar rule error app tag.
+     *
+     * @param listener listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processErrorAppTagMessageEntry(TreeWalkListener listener,
+                                                GeneratedYangParser.ErrorAppTagStatementContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, ERROR_APP_TAG_DATA, ctx.string().getText(), ENTRY);
+        String errorMessage = removeQuotesAndHandleConcat(ctx.string().getText());
+        // Obtain the node of the stack.
+        Parsable tmpNode = listener.getParsedDataStack().peek();
+        if (tmpNode instanceof YangAppErrorHolder) {
+            YangAppErrorInfo yangAppErrorInfo = ((YangAppErrorHolder) tmpNode).getAppErrorInfo();
+            yangAppErrorInfo.setErrorAppTag(errorMessage);
+        } else {
+            throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, ERROR_APP_TAG_DATA,
+                    ctx.string().getText(), ENTRY));
+        }
+    }
+}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/ErrorMessageListener.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/ErrorMessageListener.java
new file mode 100644
index 0000000..b6722b5
--- /dev/null
+++ b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/ErrorMessageListener.java
@@ -0,0 +1,82 @@
+/*
+ * 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 org.onosproject.yangutils.datamodel.YangAppErrorHolder;
+import org.onosproject.yangutils.datamodel.YangAppErrorInfo;
+import org.onosproject.yangutils.datamodel.utils.Parsable;
+import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
+import org.onosproject.yangutils.parser.exceptions.ParserException;
+import org.onosproject.yangutils.parser.impl.TreeWalkListener;
+
+import static org.onosproject.yangutils.datamodel.utils.YangConstructType.ERROR_MESSAGE_DATA;
+import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
+import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
+import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
+import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
+import static org.onosproject.yangutils.parser.impl.parserutils.ListenerUtil.removeQuotesAndHandleConcat;
+import static org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
+
+/*
+ * Reference: RFC6020 and YANG ANTLR Grammar
+ *
+ * ABNF grammar as per RFC6020
+ *
+ *  error-message-stmt  = error-message-keyword sep string stmtend
+ *
+ * ANTLR grammar rule
+ * errorMessageStatement : ERROR_MESSAGE_KEYWORD string STMTEND;
+ */
+
+/**
+ * Represents listener based call back function corresponding to the
+ * app error message defined in ANTLR grammar file for corresponding ABNF rule
+ * in RFC 6020.
+ */
+public final class ErrorMessageListener {
+
+    /**
+     * Creates a new must listener.
+     */
+    private ErrorMessageListener() {
+    }
+
+    /**
+     * Performs validations and updates the data model tree. It is called when parser
+     * receives an input matching the grammar rule (app error message).
+     *
+     * @param listener listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processErrorMessageEntry(TreeWalkListener listener,
+                                        GeneratedYangParser.ErrorMessageStatementContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, ERROR_MESSAGE_DATA, ctx.string().getText(), ENTRY);
+        String errorMessage = removeQuotesAndHandleConcat(ctx.string().getText());
+
+        // Obtain the node of the stack.
+        Parsable tmpNode = listener.getParsedDataStack().peek();
+        if (tmpNode instanceof YangAppErrorHolder) {
+            YangAppErrorInfo yangAppErrorInfo = ((YangAppErrorHolder) tmpNode).getAppErrorInfo();
+            yangAppErrorInfo.setErrorMessage(errorMessage);
+        } else {
+            throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, ERROR_MESSAGE_DATA,
+                    ctx.string().getText(), ENTRY));
+        }
+    }
+}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/MaxElementsListener.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/MaxElementsListener.java
index afb6dc3..90acba6 100644
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/MaxElementsListener.java
+++ b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/MaxElementsListener.java
@@ -18,6 +18,7 @@
 
 import org.onosproject.yangutils.datamodel.YangLeafList;
 import org.onosproject.yangutils.datamodel.YangList;
+import org.onosproject.yangutils.datamodel.YangMaxElement;
 import org.onosproject.yangutils.datamodel.utils.Parsable;
 import org.onosproject.yangutils.datamodel.utils.YangConstructType;
 import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
@@ -81,11 +82,15 @@
         switch (tmpData.getYangConstructType()) {
             case LEAF_LIST_DATA:
                 YangLeafList leafList = (YangLeafList) tmpData;
-                leafList.setMaxElelements(maxElementsValue);
+                YangMaxElement maxLeafListElement = new YangMaxElement();
+                maxLeafListElement.setMaxElement(maxElementsValue);
+                leafList.setMaxElements(maxLeafListElement);
                 break;
             case LIST_DATA:
                 YangList yangList = (YangList) tmpData;
-                yangList.setMaxElements(maxElementsValue);
+                YangMaxElement maxListElement = new YangMaxElement();
+                maxListElement.setMaxElement(maxElementsValue);
+                yangList.setMaxElements(maxListElement);
                 break;
             default:
                 throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, MAX_ELEMENT_DATA, "", ENTRY));
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/MinElementsListener.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/MinElementsListener.java
index 7553aa2..7e7ed78 100644
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/MinElementsListener.java
+++ b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/MinElementsListener.java
@@ -18,6 +18,7 @@
 
 import org.onosproject.yangutils.datamodel.YangLeafList;
 import org.onosproject.yangutils.datamodel.YangList;
+import org.onosproject.yangutils.datamodel.YangMinElement;
 import org.onosproject.yangutils.datamodel.utils.Parsable;
 import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
 import org.onosproject.yangutils.parser.exceptions.ParserException;
@@ -78,11 +79,15 @@
         switch (tmpData.getYangConstructType()) {
             case LEAF_LIST_DATA:
                 YangLeafList leafList = (YangLeafList) tmpData;
-                leafList.setMinElements(minElementValue);
+                YangMinElement minLeafListElement = new YangMinElement();
+                minLeafListElement.setMinElement(minElementValue);
+                leafList.setMinElements(minLeafListElement);
                 break;
             case LIST_DATA:
                 YangList yangList = (YangList) tmpData;
-                yangList.setMinElements(minElementValue);
+                YangMinElement minElement = new YangMinElement();
+                minElement.setMinElement(minElementValue);
+                yangList.setMinElements(minElement);
                 break;
             default:
                 throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, MIN_ELEMENT_DATA,
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ErrorAppTagListenerTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ErrorAppTagListenerTest.java
new file mode 100644
index 0000000..a367942
--- /dev/null
+++ b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ErrorAppTagListenerTest.java
@@ -0,0 +1,83 @@
+/*
+ * 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 org.junit.Test;
+import org.onosproject.yangutils.datamodel.YangMust;
+import org.onosproject.yangutils.datamodel.YangModule;
+import org.onosproject.yangutils.datamodel.YangNode;
+import org.onosproject.yangutils.datamodel.YangContainer;
+import org.onosproject.yangutils.datamodel.YangAppErrorInfo;
+import org.onosproject.yangutils.parser.exceptions.ParserException;
+import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
+
+import java.io.IOException;
+import java.util.List;
+
+import static org.hamcrest.core.Is.is;
+import static org.junit.Assert.assertThat;
+
+/**
+ * Test-cases for testing error app tag message listener functionality.
+ */
+public class ErrorAppTagListenerTest {
+    private final YangUtilsParserManager manager = new YangUtilsParserManager();
+
+    /**
+     * Checks if error app tag message is default updated in the data model.
+     */
+    @Test
+    public void processContainerSubStatementErrorDefaultAppTag() throws IOException, ParserException {
+        YangNode node = manager.getDataModel("src/test/resources/ContainerSubStatementErrorDefaultAppTag.yang");
+
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("ErrorAppTag"));
+
+        YangContainer yangContainer = (YangContainer) yangNode.getChild();
+        assertThat(yangContainer.getName(), is("interface"));
+
+        String expectedConstraint = "ifType != 'ethernet' or (ifType = 'ethernet' and ifMTU = 1500)";
+        List<YangMust> mustConstraintList = yangContainer.getListOfMust();
+        assertThat(mustConstraintList.iterator().next().getConstraint(), is(expectedConstraint));
+
+        YangAppErrorInfo yangAppErrorInfo = mustConstraintList.iterator().next().getAppErrorInfo();
+        assertThat(yangAppErrorInfo.getGetErrorAppTag(), is("must-violation"));
+        assertThat(yangAppErrorInfo.getGetErrorTag(), is("operation-failed"));
+    }
+
+    /**
+     * Checks if error app tag message listener updates the data model.
+     */
+    @Test
+    public void processContainerSubStatementErrorAppTag() throws IOException, ParserException {
+        YangNode node = manager.getDataModel("src/test/resources/ContainerSubStatementErrorAppTag.yang");
+
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("ErrorAppTag"));
+
+        YangContainer yangContainer = (YangContainer) yangNode.getChild();
+        assertThat(yangContainer.getName(), is("interface"));
+
+        String expectedConstraint = "ifType != 'ethernet' or (ifType = 'ethernet' and ifMTU = 1500)";
+        List<YangMust> mustConstraintList = yangContainer.getListOfMust();
+        assertThat(mustConstraintList.iterator().next().getConstraint(), is(expectedConstraint));
+
+        YangAppErrorInfo yangAppErrorInfo = mustConstraintList.iterator().next().getAppErrorInfo();
+        assertThat(yangAppErrorInfo.getGetErrorAppTag(), is("An ethernet MTU must be 1500"));
+        assertThat(yangAppErrorInfo.getGetErrorTag(), is("operation-failed"));
+    }
+}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ErrorMessageListnerTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ErrorMessageListnerTest.java
new file mode 100644
index 0000000..bf53292
--- /dev/null
+++ b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ErrorMessageListnerTest.java
@@ -0,0 +1,61 @@
+/*
+ * 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 org.junit.Test;
+import org.onosproject.yangutils.datamodel.YangMust;
+import org.onosproject.yangutils.datamodel.YangModule;
+import org.onosproject.yangutils.datamodel.YangNode;
+import org.onosproject.yangutils.datamodel.YangContainer;
+import org.onosproject.yangutils.datamodel.YangAppErrorInfo;
+import org.onosproject.yangutils.parser.exceptions.ParserException;
+import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
+
+import java.io.IOException;
+import java.util.List;
+
+import static org.hamcrest.core.Is.is;
+import static org.junit.Assert.assertThat;
+
+/**
+ * Test-cases for testing error message listener functionality.
+ */
+public class ErrorMessageListnerTest {
+    private final YangUtilsParserManager manager = new YangUtilsParserManager();
+
+    /**
+     * Checks if error message listener updates the data model.
+     */
+    @Test
+    public void processContainerSubStatementErrorMessage() throws IOException, ParserException {
+        YangNode node = manager.getDataModel("src/test/resources/ContainerSubStatementErrorMessage.yang");
+
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("ErrorMessage"));
+
+        YangContainer yangContainer = (YangContainer) yangNode.getChild();
+        assertThat(yangContainer.getName(), is("interface"));
+
+        String expectedConstraint = "ifType != 'ethernet' or (ifType = 'ethernet' and ifMTU = 1500)";
+        List<YangMust> mustConstraintList = yangContainer.getListOfMust();
+        assertThat(mustConstraintList.iterator().next().getConstraint(), is(expectedConstraint));
+
+        YangAppErrorInfo yangAppErrorInfo = mustConstraintList.iterator().next().getAppErrorInfo();
+        assertThat(yangAppErrorInfo.getGetErrorMessage(), is("An ethernet MTU must be 1500"));
+        assertThat(yangAppErrorInfo.getGetErrorTag(), is("operation-failed"));
+    }
+}
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/InputListenerTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/InputListenerTest.java
index ade3747..9000235 100644
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/InputListenerTest.java
+++ b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/InputListenerTest.java
@@ -72,8 +72,8 @@
         assertThat(yangList.getName(), is("ospf"));
         assertThat(yangList.getKeyList().contains("invalid-interval"), is(true));
         assertThat(yangList.isConfig(), is(true));
-        assertThat(yangList.getMaxElements(), is(10));
-        assertThat(yangList.getMinElements(), is(3));
+        assertThat(yangList.getMaxElements().getMaxElement(), is(10));
+        assertThat(yangList.getMinElements().getMinElement(), is(3));
         leafIterator = yangList.getListOfLeaf().listIterator();
         leafInfo = leafIterator.next();
         assertThat(leafInfo.getName(), is("invalid-interval"));
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/LeafListListenerTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/LeafListListenerTest.java
index b156188..083bf81 100644
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/LeafListListenerTest.java
+++ b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/LeafListListenerTest.java
@@ -72,7 +72,7 @@
         assertThat(leafListInfo.getUnits(), is("\"seconds\""));
         assertThat(leafListInfo.getDescription(), is("\"Interval before a route is declared invalid\""));
         assertThat(leafListInfo.isConfig(), is(true));
-        assertThat(leafListInfo.getMaxElelements(), is(3));
+        assertThat(leafListInfo.getMaxElements().getMaxElement(), is(3));
         assertThat(leafListInfo.getStatus(), is(YangStatusType.CURRENT));
         assertThat(leafListInfo.getReference(), is("\"RFC 6020\""));
     }
@@ -162,8 +162,8 @@
         assertThat(leafListInfo.getUnits(), is("\"seconds\""));
         assertThat(leafListInfo.getDescription(), is("\"Interval before a route is declared invalid\""));
         assertThat(leafListInfo.isConfig(), is(true));
-        assertThat(leafListInfo.getMinElements(), is(1));
-        assertThat(leafListInfo.getMaxElelements(), is(2147483647));
+        assertThat(leafListInfo.getMinElements().getMinElement(), is(1));
+        assertThat(leafListInfo.getMaxElements().getMaxElement(), is(2147483647));
         assertThat(leafListInfo.getStatus(), is(YangStatusType.CURRENT));
         assertThat(leafListInfo.getReference(), is("\"RFC 6020\""));
     }
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ListListenerTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ListListenerTest.java
index ba7022a..2cde776 100644
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ListListenerTest.java
+++ b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ListListenerTest.java
@@ -151,8 +151,8 @@
         assertThat(yangList.getKeyList().contains("invalid-interval"), is(true));
 
         assertThat(yangList.isConfig(), is(true));
-        assertThat(yangList.getMaxElements(), is(10));
-        assertThat(yangList.getMinElements(), is(3));
+        assertThat(yangList.getMaxElements().getMaxElement(), is(10));
+        assertThat(yangList.getMinElements().getMinElement(), is(3));
         assertThat(yangList.getDescription(), is("\"list description\""));
         assertThat(yangList.getStatus(), is(YangStatusType.CURRENT));
         assertThat(yangList.getReference(), is("\"list reference\""));
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/MaxElementsListenerTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/MaxElementsListenerTest.java
index 29e4c63..ab47d2c 100644
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/MaxElementsListenerTest.java
+++ b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/MaxElementsListenerTest.java
@@ -65,7 +65,7 @@
         YangLeafList leafListInfo = leafListIterator.next();
 
         assertThat(leafListInfo.getName(), is("invalid-interval"));
-        assertThat(leafListInfo.getMaxElelements(), is(3));
+        assertThat(leafListInfo.getMaxElements().getMaxElement(), is(3));
     }
 
     /**
@@ -88,7 +88,7 @@
         // Check whether the list is child of module
         YangList yangList = (YangList) yangNode.getChild();
         assertThat(yangList.getName(), is("valid"));
-        assertThat(yangList.getMaxElements(), is(3));
+        assertThat(yangList.getMaxElements().getMaxElement(), is(3));
     }
 
     /**
@@ -136,7 +136,7 @@
         YangLeafList leafListInfo = leafListIterator.next();
 
         assertThat(leafListInfo.getName(), is("invalid-interval"));
-        assertThat(leafListInfo.getMaxElelements(), is(2147483647));
+        assertThat(leafListInfo.getMaxElements().getMaxElement(), is(2147483647));
     }
 
     /**
@@ -161,7 +161,7 @@
         YangLeafList leafListInfo = leafListIterator.next();
 
         assertThat(leafListInfo.getName(), is("invalid-interval"));
-        assertThat(leafListInfo.getMaxElelements(), is(2147483647));
+        assertThat(leafListInfo.getMaxElements().getMaxElement(), is(2147483647));
     }
 
     /**
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/MinElementsListenerTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/MinElementsListenerTest.java
index e362eeb..fcf6c39 100644
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/MinElementsListenerTest.java
+++ b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/MinElementsListenerTest.java
@@ -65,7 +65,7 @@
         YangLeafList leafListInfo = leafListIterator.next();
 
         assertThat(leafListInfo.getName(), is("invalid-interval"));
-        assertThat(leafListInfo.getMinElements(), is(3));
+        assertThat(leafListInfo.getMinElements().getMinElement(), is(3));
     }
 
     /**
@@ -88,7 +88,7 @@
         // Check whether the list is child of module
         YangList yangList = (YangList) yangNode.getChild();
         assertThat(yangList.getName(), is("valid"));
-        assertThat(yangList.getMinElements(), is(3));
+        assertThat(yangList.getMinElements().getMinElement(), is(3));
     }
 
     /**
@@ -158,6 +158,6 @@
         YangLeafList leafListInfo = leafListIterator.next();
 
         assertThat(leafListInfo.getName(), is("invalid-interval"));
-        assertThat(leafListInfo.getMinElements(), is(0));
+        assertThat(leafListInfo.getMinElements().getMinElement(), is(0));
     }
 }
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/OutputListenerTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/OutputListenerTest.java
index ea60935..e31f4c4 100644
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/OutputListenerTest.java
+++ b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/OutputListenerTest.java
@@ -71,8 +71,8 @@
         assertThat(yangList.getName(), is("ospf"));
         assertThat(yangList.getKeyList().contains("invalid-interval"), is(true));
         assertThat(yangList.isConfig(), is(true));
-        assertThat(yangList.getMaxElements(), is(10));
-        assertThat(yangList.getMinElements(), is(3));
+        assertThat(yangList.getMaxElements().getMaxElement(), is(10));
+        assertThat(yangList.getMinElements().getMinElement(), is(3));
         leafIterator = yangList.getListOfLeaf().listIterator();
         leafInfo = leafIterator.next();
         assertThat(leafInfo.getName(), is("invalid-interval"));
diff --git a/utils/yangutils/plugin/src/test/resources/ContainerSubStatementErrorAppTag.yang b/utils/yangutils/plugin/src/test/resources/ContainerSubStatementErrorAppTag.yang
new file mode 100644
index 0000000..644b890
--- /dev/null
+++ b/utils/yangutils/plugin/src/test/resources/ContainerSubStatementErrorAppTag.yang
@@ -0,0 +1,25 @@
+module ErrorAppTag {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    container interface {
+        leaf ifType {
+            type enumeration {
+                enum ethernet;
+                enum atm;
+            }
+        }
+        leaf ifMTU {
+            type uint32;
+        }
+        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";
+        }
+        must "ifType != 'atm' or " +
+             "(ifType = 'atm' and ifMTU <= 17966 and ifMTU >= 64)" {
+            description "An atm MTU must be  64 .. 17966";
+        }
+    }
+}
diff --git a/utils/yangutils/plugin/src/test/resources/ContainerSubStatementErrorDefaultAppTag.yang b/utils/yangutils/plugin/src/test/resources/ContainerSubStatementErrorDefaultAppTag.yang
new file mode 100644
index 0000000..c265ea2
--- /dev/null
+++ b/utils/yangutils/plugin/src/test/resources/ContainerSubStatementErrorDefaultAppTag.yang
@@ -0,0 +1,24 @@
+module ErrorAppTag {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    container interface {
+        leaf ifType {
+            type enumeration {
+                enum ethernet;
+                enum atm;
+            }
+        }
+        leaf ifMTU {
+            type uint32;
+        }
+        must "ifType != 'ethernet' or " +
+             "(ifType = 'ethernet' and ifMTU = 1500)" {
+            description "An ethernet MTU must be 1500";
+        }
+        must "ifType != 'atm' or " +
+             "(ifType = 'atm' and ifMTU <= 17966 and ifMTU >= 64)" {
+            description "An atm MTU must be  64 .. 17966";
+        }
+    }
+}
diff --git a/utils/yangutils/plugin/src/test/resources/ContainerSubStatementErrorMessage.yang b/utils/yangutils/plugin/src/test/resources/ContainerSubStatementErrorMessage.yang
new file mode 100644
index 0000000..4726d0c
--- /dev/null
+++ b/utils/yangutils/plugin/src/test/resources/ContainerSubStatementErrorMessage.yang
@@ -0,0 +1,25 @@
+module ErrorMessage {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    container interface {
+        leaf ifType {
+            type enumeration {
+                enum ethernet;
+                enum atm;
+            }
+        }
+        leaf ifMTU {
+            type uint32;
+        }
+        must "ifType != 'ethernet' or " +
+             "(ifType = 'ethernet' and ifMTU = 1500)" {
+            description "An ethernet MTU must be 1500";
+            error-message "An ethernet MTU must be 1500";
+        }
+        must "ifType != 'atm' or " +
+             "(ifType = 'atm' and ifMTU <= 17966 and ifMTU >= 64)" {
+            description "An atm MTU must be  64 .. 17966";
+        }
+    }
+}