Deviation parser and data model

Change-Id: I3cb3da5748057d0c2c9c99d7c3495643bc1ea243
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/ResolvableType.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/ResolvableType.java
index 367c811..f062837 100644
--- a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/ResolvableType.java
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/ResolvableType.java
@@ -59,5 +59,10 @@
     /**
      * Identifies the compiler annotations.
      */
-    YANG_COMPILER_ANNOTATION
+    YANG_COMPILER_ANNOTATION,
+
+    /**
+     * Identifies the deviation.
+     */
+    YANG_DEVIATION
 }
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangAugment.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangAugment.java
index 4ea139d..e7e36c2 100644
--- a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangAugment.java
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangAugment.java
@@ -85,8 +85,8 @@
 public abstract class YangAugment
         extends YangNode
         implements YangLeavesHolder, YangCommonInfo, Parsable,
-                   CollisionDetector, Resolvable,
-                   YangXPathResolver, YangWhenHolder, YangIfFeatureHolder {
+        CollisionDetector, Resolvable, YangXPathResolver, YangWhenHolder,
+        YangIfFeatureHolder {
 
     private static final long serialVersionUID = 806201602L;
 
@@ -343,7 +343,17 @@
      */
     @Override
     public void addLeaf(YangLeaf leaf) {
-        getListOfLeaf().add(leaf);
+        listOfLeaf.add(leaf);
+    }
+
+    /**
+     * Removes a leaf.
+     *
+     * @param leaf the leaf to be removed
+     */
+    @Override
+    public void removeLeaf(YangLeaf leaf) {
+        listOfLeaf.remove(leaf);
     }
 
     /**
@@ -373,7 +383,17 @@
      */
     @Override
     public void addLeafList(YangLeafList leafList) {
-        getListOfLeafList().add(leafList);
+        listOfLeafList.add(leafList);
+    }
+
+    /**
+     * Removes a leaf-list.
+     *
+     * @param leafList the leaf-list to be removed
+     */
+    @Override
+    public void removeLeafList(YangLeafList leafList) {
+        listOfLeafList.remove(leafList);
     }
 
     @Override
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangCase.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangCase.java
index 8c1f491..c2e1a01 100644
--- a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangCase.java
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangCase.java
@@ -268,6 +268,16 @@
     }
 
     /**
+     * Removes a leaf.
+     *
+     * @param leaf the leaf to be removed
+     */
+    @Override
+    public void removeLeaf(YangLeaf leaf) {
+        listOfLeaf.remove(leaf);
+    }
+
+    /**
      * Returns the list of leaf-list.
      *
      * @return the list of leaf-list
@@ -298,6 +308,16 @@
     }
 
     /**
+     * Removes a leaf-list.
+     *
+     * @param leafList the leaf-list to be removed
+     */
+    @Override
+    public void removeLeafList(YangLeafList leafList) {
+        listOfLeafList.remove(leafList);
+    }
+
+    /**
      * Returns the textual reference.
      *
      * @return the reference
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangChoice.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangChoice.java
index 8e54d48..f2ce166 100644
--- a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangChoice.java
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangChoice.java
@@ -79,7 +79,8 @@
         extends YangNode
         implements YangCommonInfo, Parsable, CollisionDetector,
         YangAugmentableNode, YangWhenHolder, YangIfFeatureHolder,
-        YangAppErrorHolder, YangIsFilterContentNodes, YangConfig {
+        YangAppErrorHolder, YangIsFilterContentNodes, YangConfig,
+        YangDefault, YangMandatory {
 
     private static final long serialVersionUID = 806201604L;
 
@@ -168,6 +169,11 @@
     private YangAppErrorInfo yangAppErrorInfo;
 
     /**
+     * If mandatory leaf.
+     */
+    private boolean isMandatory;
+
+    /**
      * Create a choice node.
      */
     public YangChoice() {
@@ -341,6 +347,7 @@
      *
      * @return the default value
      */
+    @Override
     public String getDefaultValueInString() {
         return defaultValueInString;
     }
@@ -350,6 +357,7 @@
      *
      * @param defaultValueInString the default value
      */
+    @Override
     public void setDefaultValueInString(String defaultValueInString) {
         this.defaultValueInString = defaultValueInString;
     }
@@ -490,4 +498,22 @@
     public void cloneAugmentInfo() {
         yangAugmentedInfo = new ArrayList<>();
     }
+
+    /**
+     * Returns true, if the leaf is mandatory; false otherwise.
+     *
+     * @return true if leaf is mandatory; false otherwise
+     */
+    public boolean isMandatory() {
+        return isMandatory;
+    }
+
+    /**
+     * Sets the mandatory flag.
+     *
+     * @param isReq the flag value to set
+     */
+    public void setMandatory(boolean isReq) {
+        isMandatory = isReq;
+    }
 }
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangContainer.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangContainer.java
index 04d99a4..608e27d 100644
--- a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangContainer.java
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangContainer.java
@@ -269,7 +269,17 @@
      */
     @Override
     public void addLeaf(YangLeaf leaf) {
-        getListOfLeaf().add(leaf);
+        listOfLeaf.add(leaf);
+    }
+
+    /**
+     * Removes a leaf.
+     *
+     * @param leaf the leaf to be removed
+     */
+    @Override
+    public void removeLeaf(YangLeaf leaf) {
+        listOfLeaf.remove(leaf);
     }
 
     /**
@@ -299,9 +309,18 @@
      */
     @Override
     public void addLeafList(YangLeafList leafList) {
-        getListOfLeafList().add(leafList);
+        listOfLeafList.add(leafList);
     }
 
+    /**
+     * Removes a leaf-list.
+     *
+     * @param leafList the leaf-list to be removed
+     */
+    @Override
+    public void removeLeafList(YangLeafList leafList) {
+        listOfLeafList.remove(leafList);
+    }
 
     /**
      * Returns the presence string if present.
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangDefault.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangDefault.java
new file mode 100644
index 0000000..810b706
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangDefault.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.yang.compiler.datamodel;
+
+/**
+ * Abstraction of default entity. It is used to abstract the data holders of
+ * default statement.
+ */
+public interface YangDefault {
+
+    /**
+     * Returns the default value.
+     *
+     * @return the default value
+     */
+    String getDefaultValueInString();
+
+    /**
+     * Sets the default value.
+     *
+     * @param defaultValueInString the default value
+     */
+    void setDefaultValueInString(String defaultValueInString);
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangDeviateAdd.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangDeviateAdd.java
new file mode 100644
index 0000000..87603fd
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangDeviateAdd.java
@@ -0,0 +1,291 @@
+/*
+ * 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.yang.compiler.datamodel;
+
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.datamodel.utils.YangConstructType;
+
+import java.io.Serializable;
+import java.util.LinkedList;
+import java.util.List;
+
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.DEVIATE_ADD;
+
+/*
+ *  Reference RFC 6020.
+ *
+ *  The "deviate" statement defines how the device's implementation of
+ *  the target node deviates from its original definition.  The argument
+ *  is one of the strings "not-supported", "add", "replace", or "delete".
+ *
+ *  The argument "add" adds properties to the target node.  The
+ *  properties to add are identified by substatements to the "deviate"
+ *  statement.  If a property can only appear once, the property MUST NOT
+ *  exist in the target node.
+ *
+ *  The deviate's sub-statements
+ *
+ *        +--------------+---------+-------------+------------------+
+ *        | substatement | section | cardinality |data model mapping|
+ *        +--------------+---------+-------------+------------------+
+ *        | config       | 7.19.1  | 0..1        | YangConfig       |
+ *        | default      | 7.6.4   | 0..1        | String           |
+ *        | mandatory    | 7.6.5   | 0..1        | boolean          |
+ *        | max-elements | 7.7.4   | 0..1        | YangMaxElement   |
+ *        | min-elements | 7.7.3   | 0..1        | YangMinElement   |
+ *        | must         | 7.5.3   | 0..n        | YangMust         |
+ *        | type         | 7.4     | 0..1        | YangType         |
+ *        | unique       | 7.8.3   | 0..n        | String           |
+ *        | units        | 7.3.3   | 0..1        | String           |
+ *        +--------------+---------+-------------+------------------+
+ */
+
+/**
+ * Represents deviate add data represented in YANG.
+ */
+public class YangDeviateAdd implements YangConfig, Parsable,
+        YangMustHolder, YangUniqueHolder, YangMaxElementHolder,
+        YangMinElementHolder, YangUnits, YangMandatory, YangDefault,
+        Serializable {
+
+    private static final long serialVersionUID = 806201609L;
+
+    /**
+     * Textual units info.
+     */
+    private String units;
+
+    /**
+     * List of must statement constraints.
+     */
+    private List<YangMust> mustConstraintList;
+
+    /**
+     * List of unique leaf names.
+     */
+    private List<String> uniqueList;
+
+    /**
+     * Default value in string, needs to be converted to the target object,
+     * based on the type.
+     */
+    private String defaultValueInString;
+
+    /**
+     * Deviate's config data.
+     */
+    private boolean isConfig;
+
+    /**
+     * Mandatory constraint.
+     */
+    private boolean isMandatory;
+
+    /**
+     * Deviate's max element data.
+     */
+    private YangMaxElement maxElements;
+
+    /**
+     * Deviate's min element data.
+     */
+    private YangMinElement minElements;
+
+    /**
+     * Creates a YANG deviate add object.
+     */
+    public YangDeviateAdd() {
+        mustConstraintList = new LinkedList<>();
+        uniqueList = new LinkedList<>();
+    }
+
+    @Override
+    public boolean isConfig() {
+        return isConfig;
+    }
+
+    @Override
+    public void setConfig(boolean isConfig) {
+        this.isConfig = isConfig;
+    }
+
+    @Override
+    public YangConstructType getYangConstructType() {
+        return DEVIATE_ADD;
+    }
+
+    @Override
+    public void validateDataOnEntry() throws DataModelException {
+        // do nothing
+    }
+
+    @Override
+    public void validateDataOnExit() throws DataModelException {
+        // do nothing
+    }
+
+    @Override
+    public List<YangMust> getListOfMust() {
+        return mustConstraintList;
+    }
+
+    @Override
+    public void setListOfMust(List<YangMust> mustConstraintList) {
+        this.mustConstraintList = mustConstraintList;
+    }
+
+    @Override
+    public void addMust(YangMust must) {
+        mustConstraintList.add(must);
+    }
+
+    /**
+     * Returns the max elements.
+     *
+     * @return the max elements
+     */
+    @Override
+    public YangMaxElement getMaxElements() {
+        return maxElements;
+    }
+
+    /**
+     * Sets the max elements.
+     *
+     * @param max the max elements
+     */
+    @Override
+    public void setMaxElements(YangMaxElement max) {
+        this.maxElements = max;
+    }
+
+    /**
+     * Returns the minimum elements.
+     *
+     * @return the minimum elements
+     */
+    @Override
+    public YangMinElement getMinElements() {
+        return minElements;
+    }
+
+    /**
+     * Sets the minimum elements.
+     *
+     * @param minElements the minimum elements
+     */
+    @Override
+    public void setMinElements(YangMinElement minElements) {
+        this.minElements = minElements;
+    }
+
+    /**
+     * Returns the units.
+     *
+     * @return the units
+     */
+    @Override
+    public String getUnits() {
+        return units;
+    }
+
+    /**
+     * Sets the units.
+     *
+     * @param units the units to set
+     */
+    @Override
+    public void setUnits(String units) {
+        this.units = units;
+    }
+
+    /**
+     * Returns if the leaf is mandatory.
+     *
+     * @return if leaf is mandatory
+     */
+    @Override
+    public boolean isMandatory() {
+        return isMandatory;
+    }
+
+    /**
+     * Sets if the leaf is mandatory.
+     *
+     * @param isReq if the leaf is mandatory
+     */
+    @Override
+    public void setMandatory(boolean isReq) {
+        isMandatory = isReq;
+    }
+
+    /**
+     * Returns the default value.
+     *
+     * @return the default value
+     */
+    @Override
+    public String getDefaultValueInString() {
+        return defaultValueInString;
+    }
+
+    /**
+     * Sets the default value.
+     *
+     * @param defaultValueInString the default value
+     */
+    @Override
+    public void setDefaultValueInString(String defaultValueInString) {
+        this.defaultValueInString = defaultValueInString;
+    }
+
+    /**
+     * Returns the list of unique field names.
+     *
+     * @return the list of unique field names
+     */
+    @Override
+    public List<String> getUniqueList() {
+        return uniqueList;
+    }
+
+    /**
+     * Sets the list of unique field names.
+     *
+     * @param uniqueList the list of unique field names
+     */
+    @Override
+    public void setUniqueList(List<String> uniqueList) {
+        this.uniqueList = uniqueList;
+    }
+
+    /**
+     * Adds a unique field name.
+     *
+     * @param unique unique field name
+     * @throws DataModelException a violation of data model rules
+     */
+    @Override
+    public void addUnique(String unique) throws DataModelException {
+        if (uniqueList.contains(unique)) {
+            throw new DataModelException("A leaf identifier must not appear more than once in the\n" +
+                                                 " unique");
+        }
+        uniqueList.add(unique);
+    }
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangDeviateDelete.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangDeviateDelete.java
new file mode 100644
index 0000000..d93cd93
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangDeviateDelete.java
@@ -0,0 +1,201 @@
+/*
+ * 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.yang.compiler.datamodel;
+
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.datamodel.utils.YangConstructType;
+
+import java.io.Serializable;
+import java.util.LinkedList;
+import java.util.List;
+
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.DEVIATE_DELETE;
+
+/*
+ *  Reference 6020.
+ *
+ *  The "deviate" statement defines how the device's implementation of
+ *  the target node deviates from its original definition.  The argument
+ *  is one of the strings "not-supported", "add", "replace", or "delete".
+ *
+ *  The argument "delete" deletes properties from the target node.  The
+ *  properties to delete are identified by substatements to the "delete"
+ *  statement.  The substatement's keyword MUST match a corresponding
+ *  keyword in the target node, and the argument's string MUST be equal
+ *  to the corresponding keyword's argument string in the target node.
+ *
+ *  The deviate's sub-statements
+ *
+ *        +--------------+---------+-------------+------------------+
+ *        | substatement | section | cardinality |data model mapping|
+ *        +--------------+---------+-------------+------------------+
+ *        | config       | 7.19.1  | 0..1        | YangConfig       |
+ *        | default      | 7.6.4   | 0..1        | String           |
+ *        | mandatory    | 7.6.5   | 0..1        | boolean          |
+ *        | max-elements | 7.7.4   | 0..1        | YangMaxElement   |
+ *        | min-elements | 7.7.3   | 0..1        | YangMinElement   |
+ *        | must         | 7.5.3   | 0..n        | YangMust         |
+ *        | type         | 7.4     | 0..1        | YangType         |
+ *        | unique       | 7.8.3   | 0..n        | String           |
+ *        | units        | 7.3.3   | 0..1        | String           |
+ *        +--------------+---------+-------------+------------------+
+ */
+
+/**
+ * Represents deviate delete data represented in YANG.
+ */
+public class YangDeviateDelete implements Parsable, YangMustHolder,
+        YangUniqueHolder, YangDefault, YangUnits, Serializable {
+
+    private static final long serialVersionUID = 806201609L;
+
+    /**
+     * Textual units info.
+     */
+    private String units;
+
+    /**
+     * List of must statement constraints.
+     */
+    private List<YangMust> mustConstraintList;
+
+    /**
+     * List of unique leaf names.
+     */
+    private List<String> uniqueList;
+
+    /**
+     * Default value in string, needs to be converted to the target object,
+     * based on the type.
+     */
+    private String defaultValueInString;
+
+    /**
+     * Creates a YANG deviate delete object.
+     */
+    public YangDeviateDelete() {
+        mustConstraintList = new LinkedList<>();
+        uniqueList = new LinkedList<>();
+    }
+
+    @Override
+    public YangConstructType getYangConstructType() {
+        return DEVIATE_DELETE;
+    }
+
+    @Override
+    public void validateDataOnEntry() throws DataModelException {
+        // do nothing
+    }
+
+    @Override
+    public void validateDataOnExit() throws DataModelException {
+        // do nothing
+    }
+
+    @Override
+    public List<YangMust> getListOfMust() {
+        return mustConstraintList;
+    }
+
+    @Override
+    public void setListOfMust(List<YangMust> mustConstraintList) {
+        this.mustConstraintList = mustConstraintList;
+    }
+
+    @Override
+    public void addMust(YangMust must) {
+        mustConstraintList.add(must);
+    }
+
+    /**
+     * Returns the units.
+     *
+     * @return the units
+     */
+    @Override
+    public String getUnits() {
+        return units;
+    }
+
+    /**
+     * Sets the units.
+     *
+     * @param units the units to set
+     */
+    @Override
+    public void setUnits(String units) {
+        this.units = units;
+    }
+
+    /**
+     * Returns the list of unique field names.
+     *
+     * @return the list of unique field names
+     */
+    @Override
+    public List<String> getUniqueList() {
+        return uniqueList;
+    }
+
+    /**
+     * Sets the list of unique field names.
+     *
+     * @param uniqueList the list of unique field names
+     */
+    @Override
+    public void setUniqueList(List<String> uniqueList) {
+        this.uniqueList = uniqueList;
+    }
+
+    /**
+     * Adds a unique field name.
+     *
+     * @param unique unique field name
+     * @throws DataModelException a violation of data model rules
+     */
+    @Override
+    public void addUnique(String unique)
+            throws DataModelException {
+        if (uniqueList.contains(unique)) {
+            throw new DataModelException("A leaf identifier must not appear more than once in the\n" +
+                                                 " unique");
+        }
+        uniqueList.add(unique);
+    }
+
+    /**
+     * Returns the default value.
+     *
+     * @return the default value
+     */
+    @Override
+    public String getDefaultValueInString() {
+        return defaultValueInString;
+    }
+
+    /**
+     * Sets the default value.
+     *
+     * @param defaultValueInString the default value
+     */
+    @Override
+    public void setDefaultValueInString(String defaultValueInString) {
+        this.defaultValueInString = defaultValueInString;
+    }
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangDeviateReplace.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangDeviateReplace.java
new file mode 100644
index 0000000..b42d685
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangDeviateReplace.java
@@ -0,0 +1,244 @@
+/*
+ * 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.yang.compiler.datamodel;
+
+/*
+ *  Refernce 6020.
+ *
+ *  The "deviate" statement defines how the device's implementation of
+ *  the target node deviates from its original definition.  The argument
+ *  is one of the strings "not-supported", "add", "replace", or "delete".
+ *
+ *  The argument "replace" replaces properties of the target node.  The
+ *  properties to replace are identified by substatements to the
+ *  "deviate" statement.  The properties to replace MUST exist in the
+ *  target node.
+ *
+ *  The deviate's sub-statements
+ *
+ *        +--------------+---------+-------------+------------------+
+ *        | substatement | section | cardinality |data model mapping|
+ *        +--------------+---------+-------------+------------------+
+ *        | config       | 7.19.1  | 0..1        | YangConfig       |
+ *        | default      | 7.6.4   | 0..1        | String           |
+ *        | mandatory    | 7.6.5   | 0..1        | boolean          |
+ *        | max-elements | 7.7.4   | 0..1        | YangMaxElement   |
+ *        | min-elements | 7.7.3   | 0..1        | YangMinElement   |
+ *        | must         | 7.5.3   | 0..n        | YangMust         |
+ *        | type         | 7.4     | 0..1        | YangType         |
+ *        | unique       | 7.8.3   | 0..n        | String           |
+ *        | units        | 7.3.3   | 0..1        | String           |
+ *        +--------------+---------+-------------+------------------+
+ */
+
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.datamodel.utils.YangConstructType;
+
+import java.io.Serializable;
+
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.DEVIATE_REPLACE;
+
+/**
+ * Represents deviate replace data represented in YANG.
+ */
+public class YangDeviateReplace implements YangUnits, YangMinElementHolder,
+        YangMaxElementHolder, YangMandatory, YangDefault, Parsable,
+        YangConfig, Serializable {
+
+    private static final long serialVersionUID = 806201609L;
+
+    /**
+     * Textual units info.
+     */
+    private String units;
+
+    /**
+     * Deviate's config data.
+     */
+    private boolean isConfig;
+
+    /**
+     * Deviate's max element data.
+     */
+    private YangMaxElement maxElements;
+
+    /**
+     * Deviate's min element data.
+     */
+    private YangMinElement minElements;
+
+    /**
+     * Mandatory constraint.
+     */
+    private boolean isMandatory;
+
+    /**
+     * Default value in string, needs to be converted to the target object,
+     * based on the type.
+     */
+    private String defaultValueInString;
+
+    /**
+     * Data type of the leaf.
+     */
+    private YangType<?> dataType;
+
+
+    @Override
+    public boolean isConfig() {
+        return isConfig;
+    }
+
+    @Override
+    public void setConfig(boolean isConfig) {
+        this.isConfig = isConfig;
+    }
+
+    @Override
+    public YangConstructType getYangConstructType() {
+        return DEVIATE_REPLACE;
+    }
+
+    @Override
+    public void validateDataOnEntry() throws DataModelException {
+        // do nothing
+    }
+
+    @Override
+    public void validateDataOnExit() throws DataModelException {
+        // do nothing
+    }
+
+    /**
+     * Returns the max elements.
+     *
+     * @return the max elements
+     */
+    @Override
+    public YangMaxElement getMaxElements() {
+        return maxElements;
+    }
+
+    /**
+     * Sets the max elements.
+     *
+     * @param max the max elements
+     */
+    @Override
+    public void setMaxElements(YangMaxElement max) {
+        this.maxElements = max;
+    }
+
+    /**
+     * Returns the minimum elements.
+     *
+     * @return the minimum elements
+     */
+    @Override
+    public YangMinElement getMinElements() {
+        return minElements;
+    }
+
+    /**
+     * Sets the minimum elements.
+     *
+     * @param minElements the minimum elements
+     */
+    @Override
+    public void setMinElements(YangMinElement minElements) {
+        this.minElements = minElements;
+    }
+
+    /**
+     * Returns the units.
+     *
+     * @return the units
+     */
+    @Override
+    public String getUnits() {
+        return units;
+    }
+
+    /**
+     * Sets the units.
+     *
+     * @param units the units to set
+     */
+    @Override
+    public void setUnits(String units) {
+        this.units = units;
+    }
+
+    /**
+     * Returns if the leaf is mandatory.
+     *
+     * @return if leaf is mandatory
+     */
+    @Override
+    public boolean isMandatory() {
+        return isMandatory;
+    }
+
+    /**
+     * Sets if the leaf is mandatory.
+     *
+     * @param isReq if the leaf is mandatory
+     */
+    @Override
+    public void setMandatory(boolean isReq) {
+        isMandatory = isReq;
+    }
+
+    /**
+     * Returns the default value.
+     *
+     * @return the default value
+     */
+    @Override
+    public String getDefaultValueInString() {
+        return defaultValueInString;
+    }
+
+    /**
+     * Sets the default value.
+     *
+     * @param defaultValueInString the default value
+     */
+    @Override
+    public void setDefaultValueInString(String defaultValueInString) {
+        this.defaultValueInString = defaultValueInString;
+    }
+
+    /**
+     * Returns the data type.
+     *
+     * @return the data type
+     */
+    public YangType<?> getDataType() {
+        return dataType;
+    }
+
+    /**
+     * Sets the data type.
+     *
+     * @param dataType the data type to set
+     */
+    public void setDataType(YangType<?> dataType) {
+        this.dataType = dataType;
+    }
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangDeviation.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangDeviation.java
new file mode 100644
index 0000000..57f9a53
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangDeviation.java
@@ -0,0 +1,346 @@
+/*
+ * 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.yang.compiler.datamodel;
+
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.datamodel.utils.ResolvableStatus;
+import org.onosproject.yang.compiler.datamodel.utils.YangConstructType;
+
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import static org.onosproject.yang.compiler.datamodel.YangSchemaNodeType.YANG_NON_DATA_NODE;
+import static org.onosproject.yang.compiler.datamodel.utils.DataModelUtils.detectCollidingChildUtil;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.DEVIATION_DATA;
+
+/**
+ * Represents deviation data represented in YANG.
+ */
+public class YangDeviation extends YangNode implements Parsable, YangDesc,
+        YangReference, YangXPathResolver, Resolvable, CollisionDetector {
+
+    private static final long serialVersionUID = 806201605L;
+
+    /**
+     * List of node identifiers.
+     */
+    private List<YangAtomicPath> targetNode;
+
+    /**
+     * Description of augment.
+     */
+    private String description;
+
+    /**
+     * Reference of the YANG augment.
+     */
+    private String reference;
+
+    /**
+     * Represents deviate-not-supported statement.
+     */
+    private boolean isDeviateNotSupported;
+
+    /**
+     * Represents deviate add statement.
+     */
+    private List<YangDeviateAdd> deviateAddList;
+
+    /**
+     * Represents deviate delete statement.
+     */
+    private List<YangDeviateDelete> deviateDeleteList;
+
+    /**
+     * Represents deviate replace statement.
+     */
+    private List<YangDeviateReplace> deviateReplaceList;
+
+    /**
+     * Status of resolution.
+     */
+    private ResolvableStatus resolvableStatus;
+
+    /**
+     * Creates a specific type of node.
+     *
+     * @param type              of YANG node
+     * @param ysnContextInfoMap YSN context info map
+     */
+    public YangDeviation(YangNodeType type, Map<YangSchemaNodeIdentifier,
+            YangSchemaNodeContextInfo> ysnContextInfoMap) {
+        super(type, ysnContextInfoMap);
+        targetNode = new LinkedList<>();
+        resolvableStatus = ResolvableStatus.UNRESOLVED;
+        deviateAddList = new LinkedList<>();
+        deviateDeleteList = new LinkedList<>();
+        deviateReplaceList = new LinkedList<>();
+    }
+
+    @Override
+    public YangSchemaNodeType getYangSchemaNodeType() {
+        return YANG_NON_DATA_NODE;
+    }
+
+    @Override
+    public String getJavaPackage() {
+        // do nothing
+        return null;
+    }
+
+    @Override
+    public String getJavaClassNameOrBuiltInType() {
+        // do nothing
+        return null;
+    }
+
+    @Override
+    public String getJavaAttributeName() {
+        // do nothing
+        return null;
+    }
+
+    @Override
+    public void addToChildSchemaMap(YangSchemaNodeIdentifier schemaNodeIdentifier,
+                                    YangSchemaNodeContextInfo yangSchemaNodeContextInfo)
+            throws DataModelException {
+        // do nothing
+    }
+
+    @Override
+    public void incrementMandatoryChildCount() {
+        // do nothing
+    }
+
+    @Override
+    public void addToDefaultChildMap(YangSchemaNodeIdentifier yangSchemaNodeIdentifier,
+                                     YangSchemaNode yangSchemaNode) {
+        // do nothing
+    }
+
+    /**
+     * Returns the augmented node.
+     *
+     * @return the augmented node
+     */
+    public List<YangAtomicPath> getTargetNode() {
+        return targetNode;
+    }
+
+    /**
+     * Sets the augmented node.
+     *
+     * @param nodeIdentifiers the augmented node
+     */
+    public void setTargetNode(List<YangAtomicPath> nodeIdentifiers) {
+        targetNode = nodeIdentifiers;
+    }
+
+    /**
+     * Returns the textual reference.
+     *
+     * @return the reference
+     */
+    @Override
+    public String getReference() {
+        return reference;
+    }
+
+    /**
+     * Sets the textual reference.
+     *
+     * @param reference the reference to set
+     */
+    @Override
+    public void setReference(String reference) {
+        this.reference = reference;
+    }
+
+    /**
+     * Returns the description.
+     *
+     * @return the description
+     */
+    @Override
+    public String getDescription() {
+        return description;
+    }
+
+    /**
+     * Set the description.
+     *
+     * @param description set the description
+     */
+    @Override
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    @Override
+    public YangConstructType getYangConstructType() {
+        return DEVIATION_DATA;
+    }
+
+    @Override
+    public void validateDataOnEntry() throws DataModelException {
+        // do nothing
+    }
+
+    @Override
+    public void validateDataOnExit() throws DataModelException {
+        // do nothing
+    }
+
+    @Override
+    public ResolvableStatus getResolvableStatus() {
+        return resolvableStatus;
+    }
+
+    @Override
+    public void setResolvableStatus(ResolvableStatus resolvableStatus) {
+        this.resolvableStatus = resolvableStatus;
+    }
+
+    @Override
+    public Object resolve() throws DataModelException {
+        // Resolving of target node is being done in XPathLinker.
+        return null;
+    }
+
+    /**
+     * Returns the isDeviateNotSupported flag.
+     *
+     * @return if isDeviateNotSupported flag
+     */
+    public boolean isDeviateNotSupported() {
+        return isDeviateNotSupported;
+    }
+
+    /**
+     * Sets the isDeviateNotSupported flag.
+     *
+     * @param deviateNotSupported the flag value to set
+     */
+    public void setDeviateNotSupported(boolean deviateNotSupported) {
+        isDeviateNotSupported = deviateNotSupported;
+    }
+
+    @Override
+    public void detectCollidingChild(String identifierName,
+                                     YangConstructType dataType)
+            throws DataModelException {
+        detectCollidingChildUtil(identifierName, dataType, this);
+    }
+
+    @Override
+    public void detectSelfCollision(String identifierName,
+                                    YangConstructType dataType)
+            throws DataModelException {
+        if (getName().equals(identifierName)) {
+            throw new DataModelException(
+                    "YANG file error: Duplicate input identifier detected, " +
+                            "same as input \"" +
+                            getName() + " in " +
+                            getLineNumber() + " at " +
+                            getCharPosition() +
+                            " in " + getFileName() + "\"");
+        }
+    }
+
+    /**
+     * Returns the list of deviate-add.
+     *
+     * @return the list of deviate-add
+     */
+    public List<YangDeviateAdd> getDeviateAdd() {
+        return deviateAddList;
+    }
+
+    /**
+     * Sets the list of deviate-add.
+     *
+     * @param deviateAdd the list of deviate-add to set
+     */
+    public void setDeviateAdd(List<YangDeviateAdd> deviateAdd) {
+        this.deviateAddList = deviateAdd;
+    }
+
+    /**
+     * Returns the list of deviate delete.
+     *
+     * @return the list of deviate delete
+     */
+    public List<YangDeviateDelete> getDeviateDelete() {
+        return deviateDeleteList;
+    }
+
+    /**
+     * Sets the list of deviate delete.
+     *
+     * @param deviateDelete the list of deviate delete to set
+     */
+    public void setDeviateDelete(List<YangDeviateDelete> deviateDelete) {
+        this.deviateDeleteList = deviateDelete;
+    }
+
+    /**
+     * Returns the list of deviate replace.
+     *
+     * @return the list of deviate replace
+     */
+    public List<YangDeviateReplace> getDeviateReplace() {
+        return deviateReplaceList;
+    }
+
+    /**
+     * Sets the list of deviate replace.
+     *
+     * @param deviateReplace the list of deviate-replace to set
+     */
+    public void setDeviateReplace(List<YangDeviateReplace> deviateReplace) {
+        this.deviateReplaceList = deviateReplace;
+    }
+
+    /**
+     * Adds a deviate-add.
+     *
+     * @param deviate the deviate-add to be added
+     */
+    public void addDeviateAdd(YangDeviateAdd deviate) {
+        deviateAddList.add(deviate);
+    }
+
+    /**
+     * Adds a deviate delete.
+     *
+     * @param deviate the deviate delete to be added
+     */
+    public void addDeviatedelete(YangDeviateDelete deviate) {
+        deviateDeleteList.add(deviate);
+    }
+
+    /**
+     * Adds a deviate replace.
+     *
+     * @param deviate the deviate replace to be added
+     */
+    public void addDeviateReplace(YangDeviateReplace deviate) {
+        deviateReplaceList.add(deviate);
+    }
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangDeviationHolder.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangDeviationHolder.java
new file mode 100644
index 0000000..358a9b7
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangDeviationHolder.java
@@ -0,0 +1,54 @@
+/*
+ * 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.yang.compiler.datamodel;
+
+/**
+ * Abstraction of deviation entity. It is used to abstract the data holders of
+ * deviation statement.
+ */
+public interface YangDeviationHolder {
+
+    /**
+     * Returns true if deviated node already cloned, false
+     * otherwise.
+     *
+     * @return the isDeviateNodeCloned flag
+     */
+    boolean isDeviatedNodeCloned();
+
+    /**
+     * Sets the deviatedNodeCloned flag.
+     *
+     * @param deviatedNodeCloned the flag to set
+     */
+    void setDeviatedNodeCloned(boolean deviatedNodeCloned);
+
+    /**
+     * Returns true if module defined only for deviation,
+     * false otherwise.
+     *
+     * @return the isDeviateNodeCloned flag
+     */
+    boolean isModuleForDeviation();
+
+    /**
+     * Sets the moduleForDeviation flag.
+     *
+     * @param moduleForDeviation the flag to set
+     */
+    void setModuleForDeviation(boolean moduleForDeviation);
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangGrouping.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangGrouping.java
index da87a1d..aa2303b 100644
--- a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangGrouping.java
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangGrouping.java
@@ -204,6 +204,16 @@
     }
 
     /**
+     * Removes a leaf.
+     *
+     * @param leaf the leaf to be removed
+     */
+    @Override
+    public void removeLeaf(YangLeaf leaf) {
+        listOfLeaf.remove(leaf);
+    }
+
+    /**
      * Returns the list of leaf-list.
      *
      * @return the list of leaf-list
@@ -234,6 +244,16 @@
     }
 
     /**
+     * Removes a leaf-list.
+     *
+     * @param leafList the leaf-list to be removed
+     */
+    @Override
+    public void removeLeafList(YangLeafList leafList) {
+        listOfLeafList.remove(leafList);
+    }
+
+    /**
      * Returns the textual reference.
      *
      * @return the reference
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangIdentityRef.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangIdentityRef.java
index 6c5817f..537f606 100644
--- a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangIdentityRef.java
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangIdentityRef.java
@@ -293,7 +293,8 @@
     }
 
     @Override
-    public YangNode clone(YangUses yangUses) throws CloneNotSupportedException {
+    public YangNode clone(YangUses yangUses, boolean isDeviation)
+            throws CloneNotSupportedException {
         return (YangNode) super.clone();
     }
 }
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangInput.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangInput.java
index 10d7188..a1019a5 100644
--- a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangInput.java
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangInput.java
@@ -183,6 +183,16 @@
         listOfLeaf.add(leaf);
     }
 
+    /**
+     * Removes a leaf.
+     *
+     * @param leaf the leaf to be removed
+     */
+    @Override
+    public void removeLeaf(YangLeaf leaf) {
+        listOfLeaf.remove(leaf);
+    }
+
     @Override
     public List<YangLeafList> getListOfLeafList() {
         return unmodifiableList(listOfLeafList);
@@ -198,6 +208,16 @@
         listOfLeafList.add(leafList);
     }
 
+    /**
+     * Removes a leaf-list.
+     *
+     * @param leafList the leaf-list to be removed
+     */
+    @Override
+    public void removeLeafList(YangLeafList leafList) {
+        listOfLeafList.remove(leafList);
+    }
+
     @Override
     public void addAugmentation(YangAugment augmentInfo) {
         yangAugmentedInfo.add(augmentInfo);
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangLeaf.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangLeaf.java
index a1cf665..7d64d7f 100644
--- a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangLeaf.java
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangLeaf.java
@@ -68,7 +68,7 @@
 public abstract class YangLeaf extends DefaultLocationInfo
         implements YangCommonInfo, Parsable, Cloneable, Serializable,
         YangMustHolder, YangIfFeatureHolder, YangWhenHolder, YangSchemaNode,
-        YangConfig {
+        YangConfig, YangUnits, YangDefault, YangMandatory {
 
     private static final long serialVersionUID = 806201635L;
 
@@ -143,7 +143,8 @@
      */
     private YangLeaf referredLeaf;
 
-    private  boolean isKeyLeaf;
+    private boolean isKeyLeaf;
+
     /**
      * Creates a YANG leaf.
      */
@@ -217,6 +218,7 @@
      *
      * @return if leaf is mandatory
      */
+    @Override
     public boolean isMandatory() {
         return isMandatory;
     }
@@ -226,6 +228,7 @@
      *
      * @param isReq if the leaf is mandatory
      */
+    @Override
     public void setMandatory(boolean isReq) {
         isMandatory = isReq;
     }
@@ -275,6 +278,7 @@
      *
      * @return the units
      */
+    @Override
     public String getUnits() {
         return units;
     }
@@ -284,6 +288,7 @@
      *
      * @param units the units to set
      */
+    @Override
     public void setUnits(String units) {
         this.units = units;
     }
@@ -293,6 +298,7 @@
      *
      * @return the default value
      */
+    @Override
     public String getDefaultValueInString() {
         return defaultValueInString;
     }
@@ -302,6 +308,7 @@
      *
      * @param defaultValueInString the default value
      */
+    @Override
     public void setDefaultValueInString(String defaultValueInString) {
         this.defaultValueInString = defaultValueInString;
     }
@@ -356,6 +363,19 @@
     }
 
     /**
+     * Returns the cloned leaf.
+     *
+     * @return returns cloned leaf
+     * @throws CloneNotSupportedException if the object's class does not
+     *                                    support the interface
+     */
+    public YangLeaf cloneForDeviation()
+            throws CloneNotSupportedException {
+        YangLeaf cl = (YangLeaf) super.clone();
+        return cl;
+    }
+
+    /**
      * Returns the type of the parsed data.
      *
      * @return returns LEAF_DATA
@@ -557,6 +577,7 @@
     public void setReferredLeaf(YangLeaf leaf) {
         referredLeaf = leaf;
     }
+
     /**
      * Returns true if its a key leaf.
      *
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangLeafList.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangLeafList.java
index 2477d1a..93a0683 100644
--- a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangLeafList.java
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangLeafList.java
@@ -64,7 +64,7 @@
 public abstract class YangLeafList extends DefaultLocationInfo
         implements YangCommonInfo, Parsable, Cloneable, Serializable,
         YangMustHolder, YangWhenHolder, YangIfFeatureHolder, YangSchemaNode,
-        YangConfig {
+        YangConfig, YangUnits, YangMaxElementHolder, YangMinElementHolder {
 
     private static final long serialVersionUID = 806201637L;
 
@@ -235,6 +235,7 @@
      *
      * @return the maximum elements number
      */
+    @Override
     public YangMaxElement getMaxElements() {
         return maxElement;
     }
@@ -244,6 +245,7 @@
      *
      * @param maxElement maximum elements number
      */
+    @Override
     public void setMaxElements(YangMaxElement maxElement) {
         this.maxElement = maxElement;
     }
@@ -253,6 +255,7 @@
      *
      * @return the minimum elements number
      */
+    @Override
     public YangMinElement getMinElements() {
         return minElements;
     }
@@ -262,6 +265,7 @@
      *
      * @param minElements the minimum elements number
      */
+    @Override
     public void setMinElements(YangMinElement minElements) {
         this.minElements = minElements;
     }
@@ -311,6 +315,7 @@
      *
      * @return the units
      */
+    @Override
     public String getUnits() {
         return units;
     }
@@ -320,6 +325,7 @@
      *
      * @param units the units to set
      */
+    @Override
     public void setUnits(String units) {
         this.units = units;
     }
@@ -374,6 +380,19 @@
     }
 
     /**
+     * Returns the cloned leaf-list.
+     *
+     * @return returns cloned leaf-list
+     * @throws CloneNotSupportedException if the object's class does not
+     *                                    support the interface
+     */
+    public YangLeafList cloneForDeviation()
+            throws CloneNotSupportedException {
+        YangLeafList cll = (YangLeafList) super.clone();
+        return cll;
+    }
+
+    /**
      * Returns the type of the parsed data.
      *
      * @return returns LEAF_LIST_DATA
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangLeavesHolder.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangLeavesHolder.java
index ad39253..e7e1fac 100644
--- a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangLeavesHolder.java
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangLeavesHolder.java
@@ -47,6 +47,13 @@
     void addLeaf(YangLeaf leaf);
 
     /**
+     * Removes leaf in data holder like container / list.
+     *
+     * @param leaf the leaf to be removed
+     */
+    void removeLeaf(YangLeaf leaf);
+
+    /**
      * Returns the list of leaf-list from data holder like container / list.
      *
      * @return the list of leaf-list
@@ -68,6 +75,13 @@
     void addLeafList(YangLeafList leafList);
 
     /**
+     * Removes leaf-list in data holder like container / list.
+     *
+     * @param leafList the leaf-list to be removed
+     */
+    void removeLeafList(YangLeafList leafList);
+
+    /**
      * Adds namespace for leafs and leaf-list, this is used in case of
      * submodule.
      *
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangList.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangList.java
index 343a8f2..ab01879 100644
--- a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangList.java
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangList.java
@@ -78,7 +78,8 @@
         extends YangNode
         implements YangLeavesHolder, YangCommonInfo, Parsable, CollisionDetector,
         YangAugmentableNode, YangMustHolder, YangWhenHolder, YangIfFeatureHolder, YangSchemaNode,
-        YangIsFilterContentNodes, YangConfig {
+        YangIsFilterContentNodes, YangConfig, YangUniqueHolder,
+        YangMaxElementHolder, YangMinElementHolder {
 
     private static final long serialVersionUID = 806201609L;
 
@@ -330,6 +331,7 @@
      *
      * @return the list of unique field names
      */
+    @Override
     public List<String> getUniqueList() {
         return uniqueList;
     }
@@ -339,7 +341,8 @@
      *
      * @param uniqueList the list of unique field names
      */
-    private void setUniqueList(List<String> uniqueList) {
+    @Override
+    public void setUniqueList(List<String> uniqueList) {
         this.uniqueList = uniqueList;
     }
 
@@ -391,6 +394,7 @@
      * @param unique unique field name.
      * @throws DataModelException a violation of data model rules
      */
+    @Override
     public void addUnique(String unique)
             throws DataModelException {
         if (getUniqueList() == null) {
@@ -434,7 +438,17 @@
      */
     @Override
     public void addLeaf(YangLeaf leaf) {
-        getListOfLeaf().add(leaf);
+        listOfLeaf.add(leaf);
+    }
+
+    /**
+     * Removes a leaf.
+     *
+     * @param leaf the leaf to be removed
+     */
+    @Override
+    public void removeLeaf(YangLeaf leaf) {
+        listOfLeaf.remove(leaf);
     }
 
     /**
@@ -464,7 +478,17 @@
      */
     @Override
     public void addLeafList(YangLeafList leafList) {
-        getListOfLeafList().add(leafList);
+        listOfLeafList.add(leafList);
+    }
+
+    /**
+     * Removes a leaf-list.
+     *
+     * @param leafList the leaf-list to be removed
+     */
+    @Override
+    public void removeLeafList(YangLeafList leafList) {
+        listOfLeafList.remove(leafList);
     }
 
     /**
@@ -472,6 +496,7 @@
      *
      * @return the max elements
      */
+    @Override
     public YangMaxElement getMaxElements() {
         return maxElements;
     }
@@ -481,6 +506,7 @@
      *
      * @param max the max elements
      */
+    @Override
     public void setMaxElements(YangMaxElement max) {
         this.maxElements = max;
     }
@@ -490,6 +516,7 @@
      *
      * @return the minimum elements
      */
+    @Override
     public YangMinElement getMinElements() {
         return minElements;
     }
@@ -499,6 +526,7 @@
      *
      * @param minElements the minimum elements
      */
+    @Override
     public void setMinElements(YangMinElement minElements) {
         this.minElements = minElements;
     }
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangMandatory.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangMandatory.java
new file mode 100644
index 0000000..a436e61
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangMandatory.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.yang.compiler.datamodel;
+
+/**
+ * Abstraction of mandatory entity. It is used to abstract the data holders of
+ * mandatory statement.
+ */
+public interface YangMandatory {
+
+    /**
+     * Returns true, if the leaf is mandatory; false otherwise.
+     *
+     * @return true if leaf is mandatory; false otherwise
+     */
+    boolean isMandatory();
+
+    /**
+     * Sets the mandatory flag.
+     *
+     * @param isReq the flag value to set
+     */
+    void setMandatory(boolean isReq);
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangMaxElementHolder.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangMaxElementHolder.java
new file mode 100644
index 0000000..2e543db
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangMaxElementHolder.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.yang.compiler.datamodel;
+
+/**
+ * Abstraction of max-element entity. It is used to abstract the data holders
+ * of max-element statement.
+ */
+public interface YangMaxElementHolder {
+
+    /**
+     * Returns the max elements.
+     *
+     * @return the max elements
+     */
+    YangMaxElement getMaxElements();
+
+    /**
+     * Sets the max elements.
+     *
+     * @param max the max elements
+     */
+    void setMaxElements(YangMaxElement max);
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangMinElementHolder.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangMinElementHolder.java
new file mode 100644
index 0000000..d5c4375
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangMinElementHolder.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.yang.compiler.datamodel;
+
+/**
+ * Abstraction of min-element entity. It is used to abstract the data holders
+ * of min-element statement.
+ */
+public interface YangMinElementHolder {
+
+    /**
+     * Returns the minimum elements.
+     *
+     * @return the minimum elements
+     */
+    YangMinElement getMinElements();
+
+    /**
+     * Sets the minimum elements.
+     *
+     * @param minElements the minimum elements
+     */
+    void setMinElements(YangMinElement minElements);
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangModule.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangModule.java
index 360b192..09dbc98 100644
--- a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangModule.java
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangModule.java
@@ -30,6 +30,7 @@
 import static org.onosproject.yang.compiler.datamodel.ResolvableType.YANG_BASE;
 import static org.onosproject.yang.compiler.datamodel.ResolvableType.YANG_COMPILER_ANNOTATION;
 import static org.onosproject.yang.compiler.datamodel.ResolvableType.YANG_DERIVED_DATA_TYPE;
+import static org.onosproject.yang.compiler.datamodel.ResolvableType.YANG_DEVIATION;
 import static org.onosproject.yang.compiler.datamodel.ResolvableType.YANG_IDENTITYREF;
 import static org.onosproject.yang.compiler.datamodel.ResolvableType.YANG_IF_FEATURE;
 import static org.onosproject.yang.compiler.datamodel.ResolvableType.YANG_LEAFREF;
@@ -87,7 +88,7 @@
         extends YangNode
         implements YangLeavesHolder, YangDesc, YangReference, Parsable,
         CollisionDetector, YangReferenceResolver, RpcNotificationContainer,
-        YangFeatureHolder, YangIsFilterContentNodes, YangNamespace {
+        YangFeatureHolder, YangIsFilterContentNodes, YangNamespace, YangDeviationHolder {
 
     private static final long serialVersionUID = 806201610L;
 
@@ -239,6 +240,11 @@
     private List<YangResolutionInfo> compilerAnnotationList;
 
     /**
+     * Deviation list.
+     */
+    private List<YangResolutionInfo> deviationList;
+
+    /**
      * Extension list.
      */
     private List<YangExtension> extensionList;
@@ -264,10 +270,19 @@
     private String namespace;
 
     /**
+     * Flag to check whether target node is already cloned.
+     */
+    private boolean isDeviatedNodeCloned;
+
+    /**
+     * Flag to check whether this module is only for deviation.
+     */
+    private boolean isModuleForDeviation;
+
+    /**
      * Creates a YANG node of module type.
      */
     public YangModule() {
-
         super(YangNodeType.MODULE_NODE, new HashMap<>());
         derivedTypeResolutionList = new LinkedList<>();
         augmentResolutionList = new LinkedList<>();
@@ -277,6 +292,7 @@
         baseResolutionList = new LinkedList<>();
         identityRefResolutionList = new LinkedList<>();
         compilerAnnotationList = new LinkedList<>();
+        deviationList = new LinkedList<>();
         importList = new LinkedList<>();
         includeList = new LinkedList<>();
         listOfLeaf = new LinkedList<>();
@@ -423,6 +439,16 @@
     }
 
     /**
+     * Removes a leaf.
+     *
+     * @param leaf the leaf to be removed
+     */
+    @Override
+    public void removeLeaf(YangLeaf leaf) {
+        getListOfLeaf().remove(leaf);
+    }
+
+    /**
      * Returns the list of leaf-list from module.
      *
      * @return the list of leaf-list
@@ -448,6 +474,16 @@
         listOfLeafList.add(leafList);
     }
 
+    /**
+     * Removes a leaf-list.
+     *
+     * @param leafList the leaf-list to be removed
+     */
+    @Override
+    public void removeLeafList(YangLeafList leafList) {
+        getListOfLeafList().remove(leafList);
+    }
+
     @Override
     public List<YangFeature> getFeatureList() {
         return unmodifiableList(listOfFeature);
@@ -680,8 +716,10 @@
             return unmodifiableList(baseResolutionList);
         } else if (type == YANG_IDENTITYREF) {
             return unmodifiableList(identityRefResolutionList);
-        } else {
+        } else if (type == YANG_COMPILER_ANNOTATION) {
             return unmodifiableList(compilerAnnotationList);
+        } else {
+            return unmodifiableList(deviationList);
         }
     }
 
@@ -704,6 +742,8 @@
             identityRefResolutionList.add(info);
         } else if (type == YANG_COMPILER_ANNOTATION) {
             compilerAnnotationList.add(info);
+        } else if (type == YANG_DEVIATION) {
+            deviationList.add(info);
         }
     }
 
@@ -726,6 +766,8 @@
             identityRefResolutionList = resolutionList;
         } else if (type == YANG_COMPILER_ANNOTATION) {
             compilerAnnotationList = resolutionList;
+        } else if (type == YANG_DEVIATION) {
+            deviationList = resolutionList;
         }
     }
 
@@ -817,4 +859,24 @@
     public void setModuleNamespace(String namespace) {
         this.namespace = namespace;
     }
+
+    @Override
+    public boolean isDeviatedNodeCloned() {
+        return isDeviatedNodeCloned;
+    }
+
+    @Override
+    public void setDeviatedNodeCloned(boolean deviatedNodeCloned) {
+        this.isDeviatedNodeCloned = deviatedNodeCloned;
+    }
+
+    @Override
+    public boolean isModuleForDeviation() {
+        return isModuleForDeviation;
+    }
+
+    @Override
+    public void setModuleForDeviation(boolean moduleForDeviation) {
+        isModuleForDeviation = moduleForDeviation;
+    }
 }
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangNode.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangNode.java
index d962a39..8b7f597 100644
--- a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangNode.java
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangNode.java
@@ -396,19 +396,22 @@
     /**
      * Clones the current node contents and create a new node.
      *
-     * @param yangUses YANG uses
+     * @param yangUses    YANG uses
+     * @param isDeviation flag to identify cloning is for deviation
      * @return cloned node
      * @throws CloneNotSupportedException clone is not supported by the referred
      *                                    node
      */
-    public YangNode clone(YangUses yangUses)
+    public YangNode clone(YangUses yangUses, boolean isDeviation)
             throws CloneNotSupportedException {
         YangNode clonedNode = (YangNode) super.clone();
-        clonedNode.referredSchemaNode = this;
+
         if (clonedNode instanceof YangLeavesHolder) {
             try {
-                cloneListOfLeaf((YangLeavesHolder) clonedNode, yangUses);
-                cloneListOfLeafList((YangLeavesHolder) clonedNode, yangUses);
+                cloneListOfLeaf((YangLeavesHolder) clonedNode, yangUses,
+                                isDeviation);
+                cloneListOfLeafList((YangLeavesHolder) clonedNode, yangUses,
+                                    isDeviation);
             } catch (DataModelException e) {
                 throw new CloneNotSupportedException(e.getMessage());
             }
@@ -418,9 +421,12 @@
         clonedNode.setChild(null);
         clonedNode.setNextSibling(null);
         clonedNode.setPreviousSibling(null);
-        clonedNode.yangSchemaNodeIdentifier =
-                clonedNode.yangSchemaNodeIdentifier.clone();
-        clonedNode.ysnContextInfoMap = new HashMap<>();
+        if (!isDeviation) {
+            clonedNode.yangSchemaNodeIdentifier =
+                    clonedNode.yangSchemaNodeIdentifier.clone();
+            clonedNode.ysnContextInfoMap = new HashMap<>();
+            clonedNode.referredSchemaNode = this;
+        }
         if (clonedNode instanceof YangAugmentableNode) {
             ((YangAugmentableNode) clonedNode).cloneAugmentInfo();
         }
@@ -435,10 +441,11 @@
      * @param srcRootNode source node for sub tree cloning
      * @param dstRootNode destination node where the sub tree needs to be cloned
      * @param yangUses    YANG uses
+     * @param isDeviation flag to check whether cloning is for deviation
      * @throws DataModelException data model error
      */
     public static void cloneSubTree(YangNode srcRootNode, YangNode dstRootNode,
-                                    YangUses yangUses)
+                                    YangUses yangUses, boolean isDeviation)
             throws DataModelException {
 
         YangNode nextNodeToClone = srcRootNode;
@@ -473,7 +480,7 @@
                                                          " in " + nextNodeToClone.getFileName() + "\"");
                 }
                 if (curTraversal != PARENT) {
-                    newNode = nextNodeToClone.clone(yangUses);
+                    newNode = nextNodeToClone.clone(yangUses, isDeviation);
                     detectCollisionWhileCloning(clonedTreeCurNode, newNode,
                                                 curTraversal);
                 }
@@ -508,6 +515,7 @@
                      * update the traversal's current node.
                      */
                     nextNodeToClone = nextNodeToClone.getChild();
+
                 } else if (nextNodeToClone.getNextSibling() != null) {
 
                     curTraversal = SIBILING;
@@ -525,6 +533,7 @@
                                                  " at " + nextNodeToClone.getCharPosition() +
                                                  " in " + nextNodeToClone.getFileName() + "\"");
         }
+
     }
 
     /**
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangNodeType.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangNodeType.java
index 1b178d3..994f197 100644
--- a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangNodeType.java
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangNodeType.java
@@ -112,5 +112,10 @@
     /**
      * Identityref node.
      */
-    IDENTITYREF_NODE
+    IDENTITYREF_NODE,
+
+    /**
+     * Deviation node
+     */
+    DEVIATION_NODE
 }
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangNotification.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangNotification.java
index 096b3dc..07a5958 100644
--- a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangNotification.java
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangNotification.java
@@ -216,6 +216,16 @@
         listOfLeaf.add(leaf);
     }
 
+    /**
+     * Removes a leaf.
+     *
+     * @param leaf the leaf to be removed
+     */
+    @Override
+    public void removeLeaf(YangLeaf leaf) {
+        listOfLeaf.remove(leaf);
+    }
+
     @Override
     public List<YangLeafList> getListOfLeafList() {
         return unmodifiableList(listOfLeafList);
@@ -231,6 +241,16 @@
         listOfLeafList.add(leafList);
     }
 
+    /**
+     * Removes a leaf-list.
+     *
+     * @param leafList the leaf-list to be removed
+     */
+    @Override
+    public void removeLeafList(YangLeafList leafList) {
+        listOfLeafList.remove(leafList);
+    }
+
     @Override
     public String getReference() {
         return reference;
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangOutput.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangOutput.java
index 2c206f0..6ce7aed 100644
--- a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangOutput.java
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangOutput.java
@@ -174,6 +174,16 @@
         listOfLeaf.add(leaf);
     }
 
+    /**
+     * Removes a leaf.
+     *
+     * @param leaf the leaf to be removed
+     */
+    @Override
+    public void removeLeaf(YangLeaf leaf) {
+        listOfLeaf.remove(leaf);
+    }
+
     @Override
     public void setListOfLeaf(List<YangLeaf> leafsList) {
         listOfLeaf = leafsList;
@@ -194,6 +204,16 @@
         listOfLeafList.add(leafList);
     }
 
+    /**
+     * Removes a leaf-list.
+     *
+     * @param leafList the leaf-list to be removed
+     */
+    @Override
+    public void removeLeafList(YangLeafList leafList) {
+        listOfLeafList.remove(leafList);
+    }
+
     @Override
     public void addAugmentation(YangAugment augmentInfo) {
         yangAugmentedInfo.add(augmentInfo);
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangSubModule.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangSubModule.java
index d67b15f..a83ba5d 100644
--- a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangSubModule.java
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangSubModule.java
@@ -31,6 +31,7 @@
 import static org.onosproject.yang.compiler.datamodel.ResolvableType.YANG_BASE;
 import static org.onosproject.yang.compiler.datamodel.ResolvableType.YANG_COMPILER_ANNOTATION;
 import static org.onosproject.yang.compiler.datamodel.ResolvableType.YANG_DERIVED_DATA_TYPE;
+import static org.onosproject.yang.compiler.datamodel.ResolvableType.YANG_DEVIATION;
 import static org.onosproject.yang.compiler.datamodel.ResolvableType.YANG_IDENTITYREF;
 import static org.onosproject.yang.compiler.datamodel.ResolvableType.YANG_IF_FEATURE;
 import static org.onosproject.yang.compiler.datamodel.ResolvableType.YANG_LEAFREF;
@@ -96,7 +97,7 @@
         extends YangNode
         implements YangLeavesHolder, YangDesc, YangReference, Parsable,
         CollisionDetector, YangReferenceResolver, RpcNotificationContainer,
-        YangFeatureHolder, YangIsFilterContentNodes, YangNamespace {
+        YangFeatureHolder, YangIsFilterContentNodes, YangNamespace, YangDeviationHolder {
 
     private static final long serialVersionUID = 806201614L;
 
@@ -238,6 +239,11 @@
     private List<YangResolutionInfo> compilerAnnotationList;
 
     /**
+     * Deviation list.
+     */
+    private List<YangResolutionInfo> deviationList;
+
+    /**
      * extension list.
      */
     private List<YangExtension> extensionList;
@@ -268,6 +274,16 @@
     private String namespace;
 
     /**
+     * Flag to check whether target node is already cloned.
+     */
+    private boolean isDeviatedNodeCloned;
+
+    /**
+     * Flag to check whether this module is only for deviation.
+     */
+    private boolean isModuleForDeviation;
+
+    /**
      * Creates a sub module node.
      */
     public YangSubModule() {
@@ -280,12 +296,12 @@
         baseResolutionList = new LinkedList<>();
         identityRefResolutionList = new LinkedList<>();
         compilerAnnotationList = new LinkedList<>();
+        deviationList = new LinkedList<>();
         importList = new LinkedList<>();
         includeList = new LinkedList<>();
         listOfLeaf = new LinkedList<>();
         listOfLeafList = new LinkedList<>();
         extensionList = new LinkedList<>();
-        compilerAnnotationList = new LinkedList<>();
         listOfFeature = new LinkedList<>();
         notificationEnumMap = new HashMap<>();
         augments = new LinkedList<>();
@@ -473,6 +489,16 @@
     }
 
     /**
+     * Removes a leaf.
+     *
+     * @param leaf the leaf to be removed
+     */
+    @Override
+    public void removeLeaf(YangLeaf leaf) {
+        listOfLeaf.remove(leaf);
+    }
+
+    /**
      * Returns the list of leaf-list.
      *
      * @return the list of leaf-list
@@ -498,6 +524,16 @@
     }
 
     /**
+     * Removes a leaf-list.
+     *
+     * @param leafList the leaf-list to be removed
+     */
+    @Override
+    public void removeLeafList(YangLeafList leafList) {
+        listOfLeafList.remove(leafList);
+    }
+
+    /**
      * Returns the sub-modules organization.
      *
      * @return the organization
@@ -632,8 +668,10 @@
             return unmodifiableList(baseResolutionList);
         } else if (type == YANG_IDENTITYREF) {
             return unmodifiableList(identityRefResolutionList);
-        } else {
+        } else if (type == YANG_COMPILER_ANNOTATION) {
             return unmodifiableList(compilerAnnotationList);
+        } else {
+            return unmodifiableList(deviationList);
         }
     }
 
@@ -656,6 +694,8 @@
             identityRefResolutionList.add(resolutionInfo);
         } else if (type == YANG_COMPILER_ANNOTATION) {
             compilerAnnotationList.add(resolutionInfo);
+        } else if (type == YANG_DEVIATION) {
+            deviationList.add(resolutionInfo);
         }
     }
 
@@ -678,6 +718,8 @@
             identityRefResolutionList = resolutionList;
         } else if (type == YANG_COMPILER_ANNOTATION) {
             compilerAnnotationList = resolutionList;
+        } else if (type == YANG_DEVIATION) {
+            deviationList = resolutionList;
         }
     }
 
@@ -824,4 +866,24 @@
     public void setModuleNamespace(String namespace) {
         this.namespace = namespace;
     }
+
+    @Override
+    public boolean isDeviatedNodeCloned() {
+        return isDeviatedNodeCloned;
+    }
+
+    @Override
+    public void setDeviatedNodeCloned(boolean deviatedNodeCloned) {
+        this.isDeviatedNodeCloned = deviatedNodeCloned;
+    }
+
+    @Override
+    public boolean isModuleForDeviation() {
+        return isModuleForDeviation;
+    }
+
+    @Override
+    public void setModuleForDeviation(boolean moduleForDeviation) {
+        isModuleForDeviation = moduleForDeviation;
+    }
 }
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangTypeDef.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangTypeDef.java
index 499269d..b02e800 100644
--- a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangTypeDef.java
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangTypeDef.java
@@ -67,7 +67,7 @@
 public abstract class YangTypeDef
         extends YangNode
         implements YangCommonInfo, Parsable, YangTypeHolder, CollisionDetector,
-        YangTranslatorOperatorNode {
+        YangTranslatorOperatorNode, YangUnits, YangDefault {
 
     private static final long serialVersionUID = 806201615L;
 
@@ -141,6 +141,7 @@
      *
      * @return the default value
      */
+    @Override
     public String getDefaultValueInString() {
         return defaultValueInString;
     }
@@ -150,6 +151,7 @@
      *
      * @param defaultValueInString the default value
      */
+    @Override
     public void setDefaultValueInString(String defaultValueInString) {
         this.defaultValueInString = defaultValueInString;
     }
@@ -240,6 +242,7 @@
      *
      * @return the units
      */
+    @Override
     public String getUnits() {
         return units;
     }
@@ -249,6 +252,7 @@
      *
      * @param units the units to set
      */
+    @Override
     public void setUnits(String units) {
         this.units = units;
     }
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangUniqueHolder.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangUniqueHolder.java
new file mode 100644
index 0000000..40fc343
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangUniqueHolder.java
@@ -0,0 +1,50 @@
+/*
+ * 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.yang.compiler.datamodel;
+
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+
+import java.util.List;
+
+/**
+ * Abstraction of unique entity. It is used to abstract the data holders of
+ * unique.
+ */
+public interface YangUniqueHolder {
+
+    /**
+     * Adds unique in data holder like list.
+     *
+     * @param unique the unique to be added
+     * @throws DataModelException if any violation of data model rules
+     */
+    void addUnique(String unique) throws DataModelException;
+
+    /**
+     * Sets the list of unique.
+     *
+     * @param uniqueList the list of unique to set
+     */
+    void setUniqueList(List<String> uniqueList);
+
+    /**
+     * Returns the list of unique from data holder like list.
+     *
+     * @return the list of unique
+     */
+    List<String> getUniqueList();
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangUnits.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangUnits.java
new file mode 100644
index 0000000..ed56e49
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangUnits.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.yang.compiler.datamodel;
+
+/**
+ * Abstraction of units entity. It is used to abstract the data holders of
+ * units statement.
+ */
+public interface YangUnits {
+
+    /**
+     * Returns the units.
+     *
+     * @return the units
+     */
+    String getUnits();
+
+    /**
+     * Sets the units.
+     *
+     * @param units the units to set
+     */
+    void setUnits(String units);
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangUses.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangUses.java
index b622e28..496e615 100644
--- a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangUses.java
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangUses.java
@@ -424,7 +424,7 @@
         }
 
         try {
-            cloneSubTree(referredGrouping, usesParentNode, this);
+            cloneSubTree(referredGrouping, usesParentNode, this, false);
         } catch (DataModelException e) {
             throw new DataModelException(e.getMessage());
         }
@@ -551,7 +551,8 @@
     }
 
     @Override
-    public YangNode clone(YangUses node) throws CloneNotSupportedException {
+    public YangNode clone(YangUses node, boolean isDeviation) throws
+            CloneNotSupportedException {
         YangNode clnNode = (YangNode) super.clone();
         clnNode.setParent(null);
         clnNode.setChild(null);
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/utils/DataModelUtils.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/utils/DataModelUtils.java
index bfb5b8d..0ce482a 100644
--- a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/utils/DataModelUtils.java
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/utils/DataModelUtils.java
@@ -17,12 +17,18 @@
 package org.onosproject.yang.compiler.datamodel.utils;
 
 import org.onosproject.yang.compiler.datamodel.CollisionDetector;
-import org.onosproject.yang.compiler.datamodel.ResolvableType;
 import org.onosproject.yang.compiler.datamodel.YangAtomicPath;
 import org.onosproject.yang.compiler.datamodel.YangAugment;
 import org.onosproject.yang.compiler.datamodel.YangBase;
 import org.onosproject.yang.compiler.datamodel.YangCompilerAnnotation;
+import org.onosproject.yang.compiler.datamodel.YangConfig;
+import org.onosproject.yang.compiler.datamodel.YangDefault;
 import org.onosproject.yang.compiler.datamodel.YangDerivedInfo;
+import org.onosproject.yang.compiler.datamodel.YangDeviateAdd;
+import org.onosproject.yang.compiler.datamodel.YangDeviateDelete;
+import org.onosproject.yang.compiler.datamodel.YangDeviateReplace;
+import org.onosproject.yang.compiler.datamodel.YangDeviation;
+import org.onosproject.yang.compiler.datamodel.YangEntityToResolveInfo;
 import org.onosproject.yang.compiler.datamodel.YangEntityToResolveInfoImpl;
 import org.onosproject.yang.compiler.datamodel.YangEnumeration;
 import org.onosproject.yang.compiler.datamodel.YangIdentityRef;
@@ -32,13 +38,21 @@
 import org.onosproject.yang.compiler.datamodel.YangLeafList;
 import org.onosproject.yang.compiler.datamodel.YangLeafRef;
 import org.onosproject.yang.compiler.datamodel.YangLeavesHolder;
+import org.onosproject.yang.compiler.datamodel.YangMandatory;
+import org.onosproject.yang.compiler.datamodel.YangMaxElementHolder;
+import org.onosproject.yang.compiler.datamodel.YangMinElementHolder;
 import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangMust;
+import org.onosproject.yang.compiler.datamodel.YangMustHolder;
 import org.onosproject.yang.compiler.datamodel.YangNode;
 import org.onosproject.yang.compiler.datamodel.YangReferenceResolver;
 import org.onosproject.yang.compiler.datamodel.YangResolutionInfo;
 import org.onosproject.yang.compiler.datamodel.YangRpc;
+import org.onosproject.yang.compiler.datamodel.YangSchemaNode;
 import org.onosproject.yang.compiler.datamodel.YangType;
 import org.onosproject.yang.compiler.datamodel.YangUnion;
+import org.onosproject.yang.compiler.datamodel.YangUniqueHolder;
+import org.onosproject.yang.compiler.datamodel.YangUnits;
 import org.onosproject.yang.compiler.datamodel.YangUses;
 import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
 import org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes;
@@ -60,12 +74,20 @@
 import java.util.jar.JarEntry;
 import java.util.jar.JarFile;
 
+import static org.onosproject.yang.compiler.datamodel.ResolvableType.YANG_AUGMENT;
+import static org.onosproject.yang.compiler.datamodel.ResolvableType.YANG_BASE;
+import static org.onosproject.yang.compiler.datamodel.ResolvableType.YANG_COMPILER_ANNOTATION;
+import static org.onosproject.yang.compiler.datamodel.ResolvableType.YANG_DERIVED_DATA_TYPE;
+import static org.onosproject.yang.compiler.datamodel.ResolvableType.YANG_DEVIATION;
+import static org.onosproject.yang.compiler.datamodel.ResolvableType.YANG_IDENTITYREF;
+import static org.onosproject.yang.compiler.datamodel.ResolvableType.YANG_IF_FEATURE;
+import static org.onosproject.yang.compiler.datamodel.ResolvableType.YANG_LEAFREF;
+import static org.onosproject.yang.compiler.datamodel.ResolvableType.YANG_USES;
 import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes.DERIVED;
 import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes.EMPTY;
 import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes.ENUMERATION;
 import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes.UNION;
 
-
 /**
  * Represents utilities for data model tree.
  */
@@ -200,35 +222,36 @@
             }
         }
         YangReferenceResolver resolutionNode = (YangReferenceResolver) curNode;
-
-        if (resolutionInfo.getEntityToResolveInfo()
-                .getEntityToResolve() instanceof YangType) {
+        YangEntityToResolveInfo entityToResolveInfo = resolutionInfo.getEntityToResolveInfo();
+        if (entityToResolveInfo.getEntityToResolve()
+                instanceof YangType) {
             resolutionNode.addToResolutionList(resolutionInfo,
-                                               ResolvableType.YANG_DERIVED_DATA_TYPE);
-        } else if (resolutionInfo.getEntityToResolveInfo()
-                .getEntityToResolve() instanceof YangUses) {
+                                               YANG_DERIVED_DATA_TYPE);
+        } else if (entityToResolveInfo.getEntityToResolve()
+                instanceof YangUses) {
+            resolutionNode.addToResolutionList(resolutionInfo, YANG_USES);
+        } else if (entityToResolveInfo.getEntityToResolve()
+                instanceof YangAugment) {
+            resolutionNode.addToResolutionList(resolutionInfo, YANG_AUGMENT);
+        } else if (entityToResolveInfo.getEntityToResolve()
+                instanceof YangIfFeature) {
+            resolutionNode.addToResolutionList(resolutionInfo, YANG_IF_FEATURE);
+        } else if (entityToResolveInfo.getEntityToResolve()
+                instanceof YangLeafRef) {
+            resolutionNode.addToResolutionList(resolutionInfo, YANG_LEAFREF);
+        } else if (entityToResolveInfo.getEntityToResolve()
+                instanceof YangBase) {
+            resolutionNode.addToResolutionList(resolutionInfo, YANG_BASE);
+        } else if (entityToResolveInfo.getEntityToResolve()
+                instanceof YangIdentityRef) {
+            resolutionNode.addToResolutionList(resolutionInfo, YANG_IDENTITYREF);
+        } else if (entityToResolveInfo.getEntityToResolve()
+                instanceof YangCompilerAnnotation) {
             resolutionNode.addToResolutionList(resolutionInfo,
-                                               ResolvableType.YANG_USES);
-        } else if (resolutionInfo.getEntityToResolveInfo()
-                .getEntityToResolve() instanceof YangAugment) {
-            resolutionNode.addToResolutionList(resolutionInfo,
-                                               ResolvableType.YANG_AUGMENT);
-        } else if (resolutionInfo.getEntityToResolveInfo()
-                .getEntityToResolve() instanceof YangIfFeature) {
-            resolutionNode.addToResolutionList(resolutionInfo,
-                                               ResolvableType.YANG_IF_FEATURE);
-        } else if (resolutionInfo.getEntityToResolveInfo()
-                .getEntityToResolve() instanceof YangLeafRef) {
-            resolutionNode.addToResolutionList(resolutionInfo,
-                                               ResolvableType.YANG_LEAFREF);
-        } else if (resolutionInfo.getEntityToResolveInfo().getEntityToResolve() instanceof YangBase) {
-            resolutionNode.addToResolutionList(resolutionInfo, ResolvableType.YANG_BASE);
-        } else if (resolutionInfo.getEntityToResolveInfo().getEntityToResolve() instanceof YangIdentityRef) {
-            resolutionNode.addToResolutionList(resolutionInfo, ResolvableType.YANG_IDENTITYREF);
-        } else if (resolutionInfo.getEntityToResolveInfo()
-                .getEntityToResolve() instanceof YangCompilerAnnotation) {
-            resolutionNode.addToResolutionList(resolutionInfo,
-                                               ResolvableType.YANG_COMPILER_ANNOTATION);
+                                               YANG_COMPILER_ANNOTATION);
+        } else if (entityToResolveInfo.getEntityToResolve()
+                instanceof YangDeviation) {
+            resolutionNode.addToResolutionList(resolutionInfo, YANG_DEVIATION);
         }
     }
 
@@ -350,22 +373,30 @@
      * cloning. Under the cloned node, with cloned leaf, attributes are set
      * and added to resolution list.
      *
-     * @param clonedNode holder node
-     * @param yangUses   YANG uses
+     * @param clonedNode  holder node
+     * @param yangUses    YANG uses
+     * @param isDeviation flag to identify cloning is for deviation
      * @throws CloneNotSupportedException clone not supported error
      * @throws DataModelException         data model error
      */
-    public static void cloneListOfLeaf(
-            YangLeavesHolder clonedNode, YangUses yangUses)
+    public static void cloneListOfLeaf(YangLeavesHolder clonedNode,
+                                       YangUses yangUses,
+                                       boolean isDeviation)
             throws CloneNotSupportedException, DataModelException {
 
         List<YangLeaf> leaves = clonedNode.getListOfLeaf();
         if (nonEmpty(leaves)) {
             List<YangLeaf> clonedLeaves = new LinkedList<>();
             for (YangLeaf leaf : leaves) {
-                YangLeaf clonedLeaf = leaf.clone();
+                YangLeaf clonedLeaf;
+                if (!isDeviation) {
+                    clonedLeaf = leaf.clone();
+                    addUnresolvedType(yangUses, clonedLeaf,
+                                      (YangNode) clonedNode);
+                } else {
+                    clonedLeaf = leaf.cloneForDeviation();
+                }
                 clonedLeaf.setReferredLeaf(leaf);
-                addUnresolvedType(yangUses, clonedLeaf, (YangNode) clonedNode);
                 clonedLeaf.setContainedIn(clonedNode);
                 clonedLeaves.add(clonedLeaf);
             }
@@ -413,23 +444,29 @@
      * after cloning. Under the cloned node, with cloned leaf-list,
      * attributes are set and added to resolution list.
      *
-     * @param clonedNode cloned holder
-     * @param yangUses   YANG uses
+     * @param clonedNode  cloned holder
+     * @param yangUses    YANG uses
+     * @param isDeviation flag to identify cloning is for deviation
      * @throws CloneNotSupportedException clone not supported error
      * @throws DataModelException         data model error
      */
     public static void cloneListOfLeafList(
-            YangLeavesHolder clonedNode, YangUses yangUses)
+            YangLeavesHolder clonedNode, YangUses yangUses, boolean isDeviation)
             throws CloneNotSupportedException, DataModelException {
 
         List<YangLeafList> listOfLeafList = clonedNode.getListOfLeafList();
         if (nonEmpty(listOfLeafList)) {
             List<YangLeafList> clonedList = new LinkedList<>();
             for (YangLeafList leafList : listOfLeafList) {
-                YangLeafList clonedLeafList = leafList.clone();
+                YangLeafList clonedLeafList;
+                if (!isDeviation) {
+                    clonedLeafList = leafList.clone();
+                    addUnresolvedType(yangUses, clonedLeafList,
+                                      (YangNode) clonedNode);
+                } else {
+                    clonedLeafList = leafList.cloneForDeviation();
+                }
                 clonedLeafList.setReferredSchemaLeafList(leafList);
-                addUnresolvedType(yangUses, clonedLeafList,
-                                  (YangNode) clonedNode);
                 clonedLeafList.setContainedIn(clonedNode);
                 clonedList.add(clonedLeafList);
             }
@@ -844,4 +881,277 @@
                 return dataType.getDataType().equals(EMPTY);
         }
     }
+
+    /**
+     * Validates whether multiple deviation statement's Xpath is referring
+     * to same module.
+     *
+     * @param node YANG data model node
+     * @throws DataModelException if deviations referring to multiple module
+     */
+    public static void validateMultipleDeviationStatement(
+            YangReferenceResolver node) throws DataModelException {
+        List<YangResolutionInfo> deviationList = node
+                .getUnresolvedResolutionList(YANG_DEVIATION);
+        String prefix = null;
+        if (!deviationList.isEmpty()) {
+            YangDeviation firstDeviation = (YangDeviation) deviationList.get(0)
+                    .getEntityToResolveInfo().getEntityToResolve();
+            YangAtomicPath atomic = firstDeviation.getTargetNode().get(0);
+            prefix = atomic.getNodeIdentifier().getPrefix();
+        }
+
+        Iterator<YangResolutionInfo> deviationIterator = deviationList.iterator();
+        while (deviationIterator.hasNext()) {
+            YangDeviation deviation = (YangDeviation) deviationIterator.next()
+                    .getEntityToResolveInfo().getEntityToResolve();
+            List<YangAtomicPath> targetNode = deviation.getTargetNode();
+            YangAtomicPath atomicPath = targetNode.get(0);
+            if (!atomicPath.getNodeIdentifier().getPrefix().equals(prefix)) {
+                throw new DataModelException("YANG FILE ERROR : Deviations " +
+                                                     "of multiple module is" +
+                                                     " currently not " +
+                                                     "supported.");
+            }
+        }
+    }
+
+    /**
+     * Removes node from data model tree.
+     *
+     * @param node YANG data model node
+     */
+    public static void deleteUnsupportedNodeFromTree(YangNode node) {
+        // unlink from parent
+        YangNode parentNode = node.getParent();
+        if (parentNode.getChild().equals(node)) {
+            parentNode.setChild(node.getNextSibling());
+        }
+
+        //unlink from siblings
+        YangNode previousSibling = node.getPreviousSibling();
+        YangNode nextSibling = node.getNextSibling();
+        if (nextSibling != null && previousSibling != null) {
+            previousSibling.setNextSibling(nextSibling);
+            nextSibling.setPreviousSibling(previousSibling);
+        } else if (nextSibling != null) {
+            nextSibling.setPreviousSibling(null);
+        } else if (previousSibling != null) {
+            previousSibling.setNextSibling(null);
+        }
+        node.setParent(null);
+        node.setPreviousSibling(null);
+        node.setNextSibling(null);
+        node.setChild(null);
+    }
+
+    /**
+     * Removes leaf/leaf-list from data model tree.
+     *
+     * @param node     YANG data model node
+     * @param leafName name of leaf to be removed
+     */
+    public static void deleteUnsupportedLeafOrLeafList(YangLeavesHolder node,
+                                                       String leafName) {
+        List<YangLeaf> leaves = node.getListOfLeaf();
+        if (leaves != null && !leaves.isEmpty()) {
+            for (YangLeaf leaf : leaves) {
+                if (leaf.getName().equals(leafName)) {
+                    node.removeLeaf(leaf);
+                    return;
+                }
+            }
+        }
+
+        List<YangLeafList> leafList = node.getListOfLeafList();
+        if (leafList != null && !leafList.isEmpty()) {
+            for (YangLeafList leaf : leafList) {
+                if (leaf.getName().equals(leafName)) {
+                    node.removeLeafList(leaf);
+                    return;
+                }
+            }
+        }
+    }
+
+    /**
+     * Updates the target data model with deviate delete sub statements.
+     *
+     * @param targetNode    target node of deviation
+     * @param deviateDelete YANG deviate delete data model node
+     * @throws DataModelException if deviations referring to multiple module
+     */
+    public static void updateDeviateDeleteToTargetNode(YangSchemaNode targetNode,
+                                                       YangDeviateDelete deviateDelete)
+            throws DataModelException {
+
+        // delete must statement
+        if (targetNode instanceof YangMustHolder
+                && !deviateDelete.getListOfMust().isEmpty()) {
+            deviateDelete.setListOfMust(new LinkedList<>());
+        }
+
+        // delete unique statement
+        if (targetNode instanceof YangUniqueHolder
+                && !deviateDelete.getUniqueList().isEmpty()) {
+            deviateDelete.setUniqueList(new LinkedList<>());
+        }
+
+        // delete units statement
+        if (targetNode instanceof YangUnits) {
+            ((YangUnits) targetNode).setUnits(null);
+        }
+
+        // delete default statement
+        if (targetNode instanceof YangDefault) {
+            ((YangDefault) targetNode)
+                    .setDefaultValueInString(null);
+        }
+    }
+
+    /**
+     * Updates the target data model with deviate add sub statements.
+     *
+     * @param targetNode target node of deviation
+     * @param deviateAdd YANG deviate add data model node
+     * @throws DataModelException if deviations referring to multiple module
+     */
+    public static void updateDeviateAddToTargetNode(YangSchemaNode targetNode,
+                                                    YangDeviateAdd deviateAdd)
+            throws DataModelException {
+        // update must statement
+        if (targetNode instanceof YangMustHolder
+                && !deviateAdd.getListOfMust().isEmpty()) {
+            Iterator<YangMust> mustList = deviateAdd.getListOfMust().listIterator();
+            while (mustList.hasNext()) {
+                ((YangMustHolder) targetNode).addMust(mustList.next());
+            }
+        }
+
+        // update unique statement
+        if (targetNode instanceof YangUniqueHolder
+                && !deviateAdd.getUniqueList().isEmpty()) {
+            Iterator<String> uniqueList = deviateAdd.getUniqueList()
+                    .listIterator();
+            while (uniqueList.hasNext()) {
+                ((YangUniqueHolder) targetNode).addUnique(uniqueList.next());
+            }
+        }
+
+        // update config statement
+        if (targetNode instanceof YangConfig) {
+            ((YangConfig) targetNode).setConfig(deviateAdd.isConfig());
+        }
+
+        // update units statement
+        if (targetNode instanceof YangUnits) {
+            ((YangUnits) targetNode).setUnits(deviateAdd.getUnits());
+        }
+
+        // update default statement
+        if (targetNode instanceof YangDefault) {
+            ((YangDefault) targetNode)
+                    .setDefaultValueInString(deviateAdd.getDefaultValueInString());
+        }
+
+        // update mandatory statement
+        if (targetNode instanceof YangMandatory) {
+            ((YangMandatory) targetNode).setMandatory(deviateAdd.isMandatory());
+        }
+
+        // update minelement statement
+        if (targetNode instanceof YangMinElementHolder) {
+            ((YangMinElementHolder) targetNode)
+                    .setMinElements(deviateAdd.getMinElements());
+        }
+
+        // update max-element statement
+        if (targetNode instanceof YangMaxElementHolder) {
+            ((YangMaxElementHolder) targetNode)
+                    .setMaxElements(deviateAdd.getMaxElements());
+        }
+    }
+
+    /**
+     * Replaces the substatements of deviate replace to target node.
+     *
+     * @param targetNode     target node of deviation
+     * @param deviateReplace YANG deviate replace data model node
+     */
+    public static void updateDeviateReplaceToTargetNode(YangSchemaNode targetNode,
+                                                        YangDeviateReplace deviateReplace) {
+
+        if (targetNode instanceof YangLeaf
+                && deviateReplace.getDataType() != null) {
+            ((YangLeaf) targetNode).setDataType(deviateReplace.getDataType());
+        }
+
+        if (targetNode instanceof YangLeafList
+                && deviateReplace.getDataType() != null) {
+            ((YangLeafList) targetNode).setDataType(deviateReplace
+                                                            .getDataType());
+        }
+
+        // update config statement
+        if (targetNode instanceof YangConfig) {
+            ((YangConfig) targetNode).setConfig(deviateReplace.isConfig());
+        }
+
+        // update units statement
+        if (targetNode instanceof YangUnits) {
+            ((YangUnits) targetNode).setUnits(deviateReplace.getUnits());
+        }
+
+        // update default statement
+        if (targetNode instanceof YangDefault) {
+            ((YangDefault) targetNode)
+                    .setDefaultValueInString(deviateReplace.getDefaultValueInString());
+        }
+
+        // update mandatory statement
+        if (targetNode instanceof YangMandatory) {
+            ((YangMandatory) targetNode).setMandatory(deviateReplace.isMandatory());
+        }
+
+        // update minelement statement
+        if (targetNode instanceof YangMinElementHolder) {
+            ((YangMinElementHolder) targetNode)
+                    .setMinElements(deviateReplace.getMinElements());
+        }
+
+        // update max-element statement
+        if (targetNode instanceof YangMaxElementHolder) {
+            ((YangMaxElementHolder) targetNode)
+                    .setMaxElements(deviateReplace.getMaxElements());
+        }
+    }
+
+    /**
+     * Searches for leaf/leaf-list in given leaf holder node.
+     *
+     * @param target leaf holder
+     * @param name   leaf/leaf-list name
+     * @return leaf/leaf-list node
+     */
+    public static YangSchemaNode findLeafNode(YangLeavesHolder target,
+                                              String name) {
+        List<YangLeaf> leaves = target.getListOfLeaf();
+        if (leaves != null && !leaves.isEmpty()) {
+            for (YangLeaf leaf : leaves) {
+                if (leaf.getName().equals(name)) {
+                    return leaf;
+                }
+            }
+        }
+
+        List<YangLeafList> listOfleafList = target.getListOfLeafList();
+        if (listOfleafList != null && !listOfleafList.isEmpty()) {
+            for (YangLeafList leafList : listOfleafList) {
+                if (leafList.getName().equals(name)) {
+                    return leafList;
+                }
+            }
+        }
+        return null;
+    }
 }
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/utils/YangConstructType.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/utils/YangConstructType.java
index 9c9aedf..edb1128 100644
--- a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/utils/YangConstructType.java
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/utils/YangConstructType.java
@@ -402,7 +402,27 @@
     /**
      * Identifies the YANG argument element parsed data.
      */
-    ARGUMENT_DATA;
+    ARGUMENT_DATA,
+
+    /**
+     * Identifies the YANG deviate not supported element parsed data.
+     */
+    DEVIATE_NOT_SUPPORTED,
+
+    /**
+     * Identifies deviation add element parsed data.
+     */
+    DEVIATE_ADD,
+
+    /**
+     * Identifies deviation delete element parsed data.
+     */
+    DEVIATE_DELETE,
+
+    /**
+     * Identifies deviation replace element parsed data.
+     */
+    DEVIATE_REPLACE;
 
     /**
      * Returns the YANG construct keyword corresponding to enum values.
@@ -567,6 +587,14 @@
                 return "app-extended-name";
             case ARGUMENT_DATA:
                 return "argument";
+            case DEVIATE_NOT_SUPPORTED:
+                return "deviate-not-supported-stmt";
+            case DEVIATE_ADD:
+                return "deviate-add";
+            case DEVIATE_DELETE:
+                return "deviate-delete";
+            case DEVIATE_REPLACE:
+                return "deviate-replace";
             default:
                 return "yang";
         }
diff --git a/compiler/base/linker/src/main/java/org/onosproject/yang/compiler/linker/impl/XpathLinkingTypes.java b/compiler/base/linker/src/main/java/org/onosproject/yang/compiler/linker/impl/XpathLinkingTypes.java
index a4345cf..e560fd8 100644
--- a/compiler/base/linker/src/main/java/org/onosproject/yang/compiler/linker/impl/XpathLinkingTypes.java
+++ b/compiler/base/linker/src/main/java/org/onosproject/yang/compiler/linker/impl/XpathLinkingTypes.java
@@ -27,5 +27,8 @@
     LEAF_REF_LINKING,
 
     // Compiler annotation linking.
-    COMPILER_ANNOTATION_LINKING
+    COMPILER_ANNOTATION_LINKING,
+
+    // Deviation linking.
+    DEVIATION_LINKING
 }
diff --git a/compiler/base/linker/src/main/java/org/onosproject/yang/compiler/linker/impl/YangLinkerManager.java b/compiler/base/linker/src/main/java/org/onosproject/yang/compiler/linker/impl/YangLinkerManager.java
index 61528be..2761480 100644
--- a/compiler/base/linker/src/main/java/org/onosproject/yang/compiler/linker/impl/YangLinkerManager.java
+++ b/compiler/base/linker/src/main/java/org/onosproject/yang/compiler/linker/impl/YangLinkerManager.java
@@ -33,6 +33,7 @@
 import static org.onosproject.yang.compiler.datamodel.ResolvableType.YANG_BASE;
 import static org.onosproject.yang.compiler.datamodel.ResolvableType.YANG_COMPILER_ANNOTATION;
 import static org.onosproject.yang.compiler.datamodel.ResolvableType.YANG_DERIVED_DATA_TYPE;
+import static org.onosproject.yang.compiler.datamodel.ResolvableType.YANG_DEVIATION;
 import static org.onosproject.yang.compiler.datamodel.ResolvableType.YANG_IDENTITYREF;
 import static org.onosproject.yang.compiler.datamodel.ResolvableType.YANG_IF_FEATURE;
 import static org.onosproject.yang.compiler.datamodel.ResolvableType.YANG_LEAFREF;
@@ -179,22 +180,17 @@
         sort(yangNodeSortedList);
         for (YangNode yangNode : yangNodeSortedList) {
             try {
-                ((YangReferenceResolver) yangNode)
-                        .resolveInterFileLinking(YANG_IF_FEATURE);
-                ((YangReferenceResolver) yangNode)
-                        .resolveInterFileLinking(YANG_USES);
-                ((YangReferenceResolver) yangNode)
-                        .resolveInterFileLinking(YANG_AUGMENT);
-                ((YangReferenceResolver) yangNode)
-                        .resolveInterFileLinking(YANG_DERIVED_DATA_TYPE);
-                ((YangReferenceResolver) yangNode)
-                        .resolveInterFileLinking(YANG_BASE);
-                ((YangReferenceResolver) yangNode)
-                        .resolveInterFileLinking(YANG_IDENTITYREF);
-                ((YangReferenceResolver) yangNode)
-                        .resolveInterFileLinking(YANG_LEAFREF);
-                ((YangReferenceResolver) yangNode)
-                        .resolveInterFileLinking(YANG_COMPILER_ANNOTATION);
+                YangReferenceResolver resolver = ((YangReferenceResolver)
+                        yangNode);
+                resolver.resolveInterFileLinking(YANG_IF_FEATURE);
+                resolver.resolveInterFileLinking(YANG_USES);
+                resolver.resolveInterFileLinking(YANG_AUGMENT);
+                resolver.resolveInterFileLinking(YANG_DERIVED_DATA_TYPE);
+                resolver.resolveInterFileLinking(YANG_BASE);
+                resolver.resolveInterFileLinking(YANG_IDENTITYREF);
+                resolver.resolveInterFileLinking(YANG_LEAFREF);
+                resolver.resolveInterFileLinking(YANG_COMPILER_ANNOTATION);
+                resolver.resolveInterFileLinking(YANG_DEVIATION);
             } catch (DataModelException e) {
                 String errorInfo = "Error in file: " + yangNode.getName() + " in " +
                         yangNode.getFileName() + " at " +
diff --git a/compiler/base/linker/src/main/java/org/onosproject/yang/compiler/linker/impl/YangResolutionInfoImpl.java b/compiler/base/linker/src/main/java/org/onosproject/yang/compiler/linker/impl/YangResolutionInfoImpl.java
index 3c1542c..2f7db3b 100644
--- a/compiler/base/linker/src/main/java/org/onosproject/yang/compiler/linker/impl/YangResolutionInfoImpl.java
+++ b/compiler/base/linker/src/main/java/org/onosproject/yang/compiler/linker/impl/YangResolutionInfoImpl.java
@@ -16,6 +16,7 @@
 
 package org.onosproject.yang.compiler.linker.impl;
 
+import org.onosproject.yang.compiler.datamodel.CollisionDetector;
 import org.onosproject.yang.compiler.datamodel.DefaultLocationInfo;
 import org.onosproject.yang.compiler.datamodel.Resolvable;
 import org.onosproject.yang.compiler.datamodel.RpcNotificationContainer;
@@ -26,6 +27,11 @@
 import org.onosproject.yang.compiler.datamodel.YangBase;
 import org.onosproject.yang.compiler.datamodel.YangCompilerAnnotation;
 import org.onosproject.yang.compiler.datamodel.YangDerivedInfo;
+import org.onosproject.yang.compiler.datamodel.YangDeviateAdd;
+import org.onosproject.yang.compiler.datamodel.YangDeviateDelete;
+import org.onosproject.yang.compiler.datamodel.YangDeviateReplace;
+import org.onosproject.yang.compiler.datamodel.YangDeviation;
+import org.onosproject.yang.compiler.datamodel.YangDeviationHolder;
 import org.onosproject.yang.compiler.datamodel.YangEntityToResolveInfoImpl;
 import org.onosproject.yang.compiler.datamodel.YangFeature;
 import org.onosproject.yang.compiler.datamodel.YangFeatureHolder;
@@ -39,12 +45,14 @@
 import org.onosproject.yang.compiler.datamodel.YangLeaf;
 import org.onosproject.yang.compiler.datamodel.YangLeafList;
 import org.onosproject.yang.compiler.datamodel.YangLeafRef;
+import org.onosproject.yang.compiler.datamodel.YangLeavesHolder;
 import org.onosproject.yang.compiler.datamodel.YangList;
 import org.onosproject.yang.compiler.datamodel.YangNode;
 import org.onosproject.yang.compiler.datamodel.YangNodeIdentifier;
 import org.onosproject.yang.compiler.datamodel.YangReferenceResolver;
 import org.onosproject.yang.compiler.datamodel.YangRelativePath;
 import org.onosproject.yang.compiler.datamodel.YangResolutionInfo;
+import org.onosproject.yang.compiler.datamodel.YangSchemaNode;
 import org.onosproject.yang.compiler.datamodel.YangType;
 import org.onosproject.yang.compiler.datamodel.YangTypeDef;
 import org.onosproject.yang.compiler.datamodel.YangUses;
@@ -65,18 +73,28 @@
 import static org.onosproject.yang.compiler.datamodel.TraversalType.PARENT;
 import static org.onosproject.yang.compiler.datamodel.TraversalType.ROOT;
 import static org.onosproject.yang.compiler.datamodel.TraversalType.SIBILING;
+import static org.onosproject.yang.compiler.datamodel.YangNode.cloneSubTree;
 import static org.onosproject.yang.compiler.datamodel.YangPathArgType.ABSOLUTE_PATH;
 import static org.onosproject.yang.compiler.datamodel.YangPathArgType.RELATIVE_PATH;
 import static org.onosproject.yang.compiler.datamodel.exceptions.ErrorMessages.getErrorMsg;
 import static org.onosproject.yang.compiler.datamodel.utils.DataModelUtils.addResolutionInfo;
+import static org.onosproject.yang.compiler.datamodel.utils.DataModelUtils.deleteUnsupportedLeafOrLeafList;
+import static org.onosproject.yang.compiler.datamodel.utils.DataModelUtils.deleteUnsupportedNodeFromTree;
+import static org.onosproject.yang.compiler.datamodel.utils.DataModelUtils.findLeafNode;
+import static org.onosproject.yang.compiler.datamodel.utils.DataModelUtils.updateDeviateAddToTargetNode;
+import static org.onosproject.yang.compiler.datamodel.utils.DataModelUtils.updateDeviateDeleteToTargetNode;
+import static org.onosproject.yang.compiler.datamodel.utils.DataModelUtils.updateDeviateReplaceToTargetNode;
 import static org.onosproject.yang.compiler.datamodel.utils.ResolvableStatus.INTER_FILE_LINKED;
 import static org.onosproject.yang.compiler.datamodel.utils.ResolvableStatus.INTRA_FILE_RESOLVED;
 import static org.onosproject.yang.compiler.datamodel.utils.ResolvableStatus.LINKED;
 import static org.onosproject.yang.compiler.datamodel.utils.ResolvableStatus.RESOLVED;
 import static org.onosproject.yang.compiler.datamodel.utils.ResolvableStatus.UNDEFINED;
 import static org.onosproject.yang.compiler.datamodel.utils.ResolvableStatus.UNRESOLVED;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.LEAF_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.LEAF_LIST_DATA;
 import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.PATH_DATA;
 import static org.onosproject.yang.compiler.linker.impl.XpathLinkingTypes.AUGMENT_LINKING;
+import static org.onosproject.yang.compiler.linker.impl.XpathLinkingTypes.DEVIATION_LINKING;
 import static org.onosproject.yang.compiler.linker.impl.XpathLinkingTypes.LEAF_REF_LINKING;
 import static org.onosproject.yang.compiler.linker.impl.YangLinkerUtils.detectCollisionForAugmentedNode;
 import static org.onosproject.yang.compiler.linker.impl.YangLinkerUtils.fillPathPredicates;
@@ -87,6 +105,7 @@
 import static org.onosproject.yang.compiler.linker.impl.YangLinkerUtils.skipInvalidDataNodes;
 import static org.onosproject.yang.compiler.utils.UtilConstants.EMPTY_STRING;
 import static org.onosproject.yang.compiler.utils.UtilConstants.FAILED_TO_FIND_ANNOTATION;
+import static org.onosproject.yang.compiler.utils.UtilConstants.FAILED_TO_FIND_DEVIATION;
 import static org.onosproject.yang.compiler.utils.UtilConstants.FAILED_TO_FIND_LEAD_INFO_HOLDER;
 import static org.onosproject.yang.compiler.utils.UtilConstants.FAILED_TO_LINK;
 import static org.onosproject.yang.compiler.utils.UtilConstants.INVALID_ENTITY;
@@ -1094,10 +1113,227 @@
                 ex.setFileName(leafRef.getFileName());
                 throw ex;
             }
+        } else if (entityToResolve instanceof YangDeviation) {
+            YangDeviation deviation = (YangDeviation) entityToResolve;
+            List<YangAtomicPath> path = deviation.getTargetNode();
+            YangAtomicPath targetPath = path.get(path.size() - 1);
+            YangSchemaNode target = findDeviationTarget(entityToResolve, root,
+                                                        xPathLinker);
+
+            if (deviation.isDeviateNotSupported()) {
+                resolveDeviationNotSupported(target, targetPath);
+            } else {
+                List<YangDeviateAdd> deviateAddList = deviation.getDeviateAdd();
+
+                if (deviateAddList != null && !deviateAddList.isEmpty()) {
+                    resolveDeviateAdd(deviateAddList, target, targetPath);
+                }
+
+                List<YangDeviateDelete> deviateDeleteList = deviation
+                        .getDeviateDelete();
+                if (deviateDeleteList != null && !deviateDeleteList.isEmpty()) {
+                    resolveDeviateDelete(deviateDeleteList, target, targetPath);
+                }
+
+                List<YangDeviateReplace> deviateReplaceList = deviation
+                        .getDeviateReplace();
+                if (deviateReplaceList != null && !deviateReplaceList.isEmpty()) {
+                    resolveDeviateReplace(deviateReplaceList, target, targetPath);
+                }
+            }
+
+            Resolvable resolvable = (Resolvable) entityToResolve;
+            resolvable.setResolvableStatus(RESOLVED);
         }
     }
 
     /**
+     * Adds deviate add sub-statements to deviation target node.
+     *
+     * @param deviateAddList list of deviate add
+     * @param target         deviation target node
+     * @param targetPath     deviation target's last node
+     * @throws DataModelException if there is a data model error
+     */
+    private void resolveDeviateAdd(List<YangDeviateAdd> deviateAddList,
+                                   YangSchemaNode target,
+                                   YangAtomicPath targetPath)
+            throws DataModelException {
+        for (YangDeviateAdd deviate : deviateAddList) {
+            if (target.getName().equals(targetPath.getNodeIdentifier().getName())) {
+                updateDeviateAddToTargetNode(target, deviate);
+            } else {
+                YangSchemaNode leaf = findLeafNode((YangLeavesHolder) target, targetPath
+                        .getNodeIdentifier().getName());
+                updateDeviateAddToTargetNode(leaf, deviate);
+            }
+        }
+    }
+
+    /**
+     * Removes deviate delete sub-statements from deviation target node.
+     *
+     * @param deviateDeleteList list of deviate delete
+     * @param target            deviation target node
+     * @param targetPath        deviation target's last node
+     * @throws DataModelException if there is a data model error
+     */
+    private void resolveDeviateDelete(List<YangDeviateDelete>
+                                              deviateDeleteList,
+                                      YangSchemaNode target,
+                                      YangAtomicPath targetPath)
+            throws DataModelException {
+        for (YangDeviateDelete deviate : deviateDeleteList) {
+            if (target.getName().equals(targetPath.getNodeIdentifier().getName())) {
+                updateDeviateDeleteToTargetNode(target, deviate);
+            } else {
+                YangSchemaNode leaf = findLeafNode((YangLeavesHolder) target, targetPath
+                        .getNodeIdentifier().getName());
+                updateDeviateDeleteToTargetNode(leaf, deviate);
+            }
+        }
+    }
+
+    /**
+     * Replaces deviate replace sub-statements from deviation target node.
+     *
+     * @param deviateReplaceList list of deviate replace
+     * @param target             deviation target node
+     * @param targetPath         deviation target's last node
+     * @throws DataModelException if there is a data model error
+     */
+    private void resolveDeviateReplace(List<YangDeviateReplace>
+                                               deviateReplaceList,
+                                       YangSchemaNode target,
+                                       YangAtomicPath targetPath)
+            throws DataModelException {
+        for (YangDeviateReplace deviate : deviateReplaceList) {
+            if (target.getName().equals(targetPath.getNodeIdentifier().getName())) {
+                updateDeviateReplaceToTargetNode(target, deviate);
+            } else {
+                YangSchemaNode leaf = findLeafNode((YangLeavesHolder) target, targetPath
+                        .getNodeIdentifier().getName());
+                updateDeviateReplaceToTargetNode(leaf, deviate);
+            }
+        }
+    }
+
+    /**
+     * Removes deviation target node from cloned data model.
+     *
+     * @param target     deviation target node
+     * @param targetPath deviation target's last node
+     */
+    private void resolveDeviationNotSupported(YangSchemaNode target,
+                                              YangAtomicPath targetPath) {
+        if (target.getName().equals(targetPath.getNodeIdentifier().getName())) {
+            deleteUnsupportedNodeFromTree((YangNode) target);
+        } else {
+            deleteUnsupportedLeafOrLeafList((YangLeavesHolder) target,
+                                            targetPath.getNodeIdentifier().getName());
+        }
+    }
+
+    /**
+     * Returns the cloned node of deviation target node.
+     *
+     * @param entityToResolve entity to resolve
+     * @param root            root node
+     * @param xPathLinker     xpath Linker
+     * @throws DataModelException if there is a data model error
+     */
+    private YangSchemaNode findDeviationTarget(T entityToResolve,
+                                               YangReferenceResolver root,
+                                               YangXpathLinker<T> xPathLinker)
+            throws DataModelException {
+
+        YangNode targetNode;
+        YangDeviation deviation = (YangDeviation) entityToResolve;
+        List<YangAtomicPath> path = deviation.getTargetNode();
+        targetNode = xPathLinker.processXpathLinking(path, (YangNode) root,
+                                                     DEVIATION_LINKING);
+
+        if (targetNode != null) {
+            YangNode clonedNode = cloneDeviatedModuleNode(targetNode, deviation);
+            return xPathLinker.parsePath(clonedNode);
+        } else {
+            throw new LinkerException(getErrorMsg(
+                    FAILED_TO_FIND_DEVIATION, deviation.getName(),
+                    deviation.getLineNumber(), deviation.getCharPosition(),
+                    deviation.getFileName()));
+        }
+    }
+
+    /**
+     * Returns the cloned node of deviation target node.
+     *
+     * @param targetNode deviation target node
+     * @param deviation  YANG deviation node
+     * @throws DataModelException if there is a data model error
+     */
+    private YangNode cloneDeviatedModuleNode(YangNode targetNode,
+                                             YangDeviation deviation)
+            throws DataModelException {
+
+        // get Root node of target schema
+        while (targetNode.getParent() != null) {
+            targetNode = targetNode.getParent();
+        }
+        YangNode srcNode = targetNode;
+        YangNode dstNode = deviation.getParent();
+
+        if (((YangDeviationHolder) dstNode).isDeviatedNodeCloned()) {
+            // Target Node is already cloned, no need to clone again
+            return dstNode;
+        }
+
+        // clone leaf and leaf-list of root level
+        YangLeavesHolder destLeafHolder = (YangLeavesHolder) dstNode;
+        YangLeavesHolder srcLeafHolder = (YangLeavesHolder) srcNode;
+        if (srcLeafHolder.getListOfLeaf() != null) {
+            for (YangLeaf leaf : srcLeafHolder.getListOfLeaf()) {
+                YangLeaf clonedLeaf;
+                try {
+                    ((CollisionDetector) dstNode)
+                            .detectCollidingChild(leaf.getName(), LEAF_DATA);
+                    clonedLeaf = leaf.cloneForDeviation();
+                    clonedLeaf.setReferredLeaf(leaf);
+                } catch (CloneNotSupportedException | DataModelException e) {
+                    throw new DataModelException(e.getMessage());
+                }
+
+                clonedLeaf.setContainedIn(destLeafHolder);
+                destLeafHolder.addLeaf(clonedLeaf);
+            }
+        }
+        if (srcLeafHolder.getListOfLeafList() != null) {
+            for (YangLeafList leafList : srcLeafHolder.getListOfLeafList()) {
+                YangLeafList clonedLeafList;
+                try {
+                    ((CollisionDetector) destLeafHolder)
+                            .detectCollidingChild(leafList.getName(), LEAF_LIST_DATA);
+                    clonedLeafList = leafList.cloneForDeviation();
+                    clonedLeafList.setReferredSchemaLeafList(leafList);
+                } catch (CloneNotSupportedException | DataModelException e) {
+                    throw new DataModelException(e.getMessage());
+                }
+                clonedLeafList.setContainedIn(destLeafHolder);
+                destLeafHolder.addLeafList(clonedLeafList);
+            }
+        }
+
+        // clone subtree
+        cloneSubTree(srcNode, dstNode, null, true);
+
+        /*
+         * Cloning of deviated module is done, set isDeviatedNodeCloned
+         * flag as true.
+         */
+        ((YangDeviationHolder) dstNode).setDeviatedNodeCloned(true);
+        return dstNode;
+    }
+
+    /**
      * Returns the referenced prefix of entity under resolution.
      *
      * @return referenced prefix of entity under resolution
diff --git a/compiler/base/linker/src/main/java/org/onosproject/yang/compiler/linker/impl/YangXpathLinker.java b/compiler/base/linker/src/main/java/org/onosproject/yang/compiler/linker/impl/YangXpathLinker.java
index 02d1beb..1579bf1 100644
--- a/compiler/base/linker/src/main/java/org/onosproject/yang/compiler/linker/impl/YangXpathLinker.java
+++ b/compiler/base/linker/src/main/java/org/onosproject/yang/compiler/linker/impl/YangXpathLinker.java
@@ -32,6 +32,7 @@
 import org.onosproject.yang.compiler.datamodel.YangNode;
 import org.onosproject.yang.compiler.datamodel.YangNodeIdentifier;
 import org.onosproject.yang.compiler.datamodel.YangOutput;
+import org.onosproject.yang.compiler.datamodel.YangSchemaNode;
 import org.onosproject.yang.compiler.datamodel.YangSubModule;
 import org.onosproject.yang.compiler.datamodel.YangUses;
 import org.onosproject.yang.compiler.linker.exceptions.LinkerException;
@@ -293,8 +294,7 @@
      * @param root root node
      * @return linked target node
      */
-    private YangNode parsePath(YangNode root) {
-
+    public YangNode parsePath(YangNode root) {
         YangNode tempNode = root;
         Stack<YangNode> linkerStack = new Stack<>();
         Iterator<YangAtomicPath> pathIterator = absPaths.iterator();
@@ -667,7 +667,7 @@
      * @param index    current index of list
      * @return false if target node found
      */
-    private boolean validate(YangNode tempNode, int index) {
+    private boolean validate(YangSchemaNode tempNode, int index) {
 
         int size = absPaths.size();
         if (tempNode != null && index != size) {
@@ -689,7 +689,16 @@
      * @param curNodeId YANG node identifier
      * @return linked target node
      */
-    private YangNode searchTargetNode(YangNode node, YangNodeIdentifier curNodeId) {
+    private YangNode searchTargetNode(YangNode node,
+                                      YangNodeIdentifier curNodeId) {
+
+        if (linkingType == XpathLinkingTypes.DEVIATION_LINKING &&
+                node instanceof YangLeavesHolder) {
+            YangNode targetNode = searchTargetLeaf(node, curNodeId);
+            if (targetNode != null) {
+                return targetNode;
+            }
+        }
 
         if (node != null) {
             node = node.getChild();
@@ -708,12 +717,50 @@
                     !(node instanceof YangUses)) {
                 return node;
             }
+
+            if (linkingType == XpathLinkingTypes.DEVIATION_LINKING &&
+                    node instanceof YangLeavesHolder) {
+                YangNode targetNode = searchTargetLeaf(node, curNodeId);
+                if (targetNode != null) {
+                    return targetNode;
+                }
+            }
             node = node.getNextSibling();
         }
         return null;
     }
 
     /**
+     * Searches target leaf in root node.
+     *
+     * @param node      root node
+     * @param curNodeId YANG node identifier
+     * @return linked target leaf node holder
+     */
+    private YangNode searchTargetLeaf(YangNode node,
+                                      YangNodeIdentifier curNodeId) {
+        YangLeavesHolder holder = (YangLeavesHolder) node;
+        List<YangLeafList> leavesList = holder.getListOfLeafList();
+        if (leavesList != null && !leavesList.isEmpty()) {
+            for (YangLeafList leafList : leavesList) {
+                if (leafList.getName().equals(curNodeId.getName())) {
+                    return node;
+                }
+            }
+        }
+
+        List<YangLeaf> leaves = holder.getListOfLeaf();
+        if (leaves != null && !leaves.isEmpty()) {
+            for (YangLeaf leaf : leaves) {
+                if (leaf.getName().equals(curNodeId.getName())) {
+                    return node;
+                }
+            }
+        }
+        return null;
+    }
+
+    /**
      * Returns root prefix.
      *
      * @param root root node
diff --git a/compiler/base/parser/pom.xml b/compiler/base/parser/pom.xml
index 671bd15..4f2ee4f 100644
--- a/compiler/base/parser/pom.xml
+++ b/compiler/base/parser/pom.xml
@@ -55,7 +55,6 @@
             <version>4.12</version>
             <scope>test</scope>
         </dependency>
-
     </dependencies>
 
     <build>
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/TreeWalkListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/TreeWalkListener.java
index 42fe6ca..babe61e 100644
--- a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/TreeWalkListener.java
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/TreeWalkListener.java
@@ -42,6 +42,10 @@
 import org.onosproject.yang.compiler.parser.impl.listeners.Decimal64Listener;
 import org.onosproject.yang.compiler.parser.impl.listeners.DefaultListener;
 import org.onosproject.yang.compiler.parser.impl.listeners.DescriptionListener;
+import org.onosproject.yang.compiler.parser.impl.listeners.DeviateAddListener;
+import org.onosproject.yang.compiler.parser.impl.listeners.DeviateDeleteListener;
+import org.onosproject.yang.compiler.parser.impl.listeners.DeviateReplaceListener;
+import org.onosproject.yang.compiler.parser.impl.listeners.DeviationListener;
 import org.onosproject.yang.compiler.parser.impl.listeners.EnumListener;
 import org.onosproject.yang.compiler.parser.impl.listeners.EnumerationListener;
 import org.onosproject.yang.compiler.parser.impl.listeners.ErrorAppTagListener;
@@ -1473,14 +1477,12 @@
 
     @Override
     public void enterDeviationStatement(DeviationStatementContext ctx) {
-        increaseUnsupportedYangConstructDepth();
-        ListenerUtil.handleUnsupportedYangConstruct(YangConstructType.DEVIATION_DATA, ctx, UtilConstants.UNSUPPORTED_YANG_CONSTRUCT,
-                                                    getFileName());
+        DeviationListener.processDeviationEntry(this, ctx);
     }
 
     @Override
     public void exitDeviationStatement(DeviationStatementContext ctx) {
-        decreaseUnsupportedYangConstructDepth();
+        DeviationListener.processDeviationExit(this, ctx);
     }
 
     @Override
@@ -1495,32 +1497,32 @@
 
     @Override
     public void enterDeviateAddStatement(DeviateAddStatementContext ctx) {
-        // do nothing.
+        DeviateAddListener.processDeviateAddEntry(this, ctx);
     }
 
     @Override
     public void exitDeviateAddStatement(DeviateAddStatementContext ctx) {
-        // do nothing.
+        DeviateAddListener.processDeviateAddExit(this, ctx);
     }
 
     @Override
     public void enterDeviateDeleteStatement(DeviateDeleteStatementContext ctx) {
-        // do nothing.
+        DeviateDeleteListener.processDeviateDeleteEntry(this, ctx);
     }
 
     @Override
     public void exitDeviateDeleteStatement(DeviateDeleteStatementContext ctx) {
-        // do nothing.
+        DeviateDeleteListener.processDeviateDeleteExit(this, ctx);
     }
 
     @Override
     public void enterDeviateReplaceStatement(DeviateReplaceStatementContext ctx) {
-        // do nothing.
+        DeviateReplaceListener.processDeviateReplaceEntry(this, ctx);
     }
 
     @Override
     public void exitDeviateReplaceStatement(DeviateReplaceStatementContext ctx) {
-        // do nothing.
+        DeviateReplaceListener.processDeviateReplaceExit(this, ctx);
     }
 
     @Override
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/ConfigListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/ConfigListener.java
index 186e1c8..6c6b8da 100644
--- a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/ConfigListener.java
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/ConfigListener.java
@@ -16,28 +16,6 @@
 
 package org.onosproject.yang.compiler.parser.impl.listeners;
 
-import org.onosproject.yang.compiler.datamodel.YangContainer;
-import org.onosproject.yang.compiler.datamodel.YangLeaf;
-import org.onosproject.yang.compiler.datamodel.YangLeafList;
-import org.onosproject.yang.compiler.datamodel.YangList;
-import org.onosproject.yang.compiler.datamodel.utils.Parsable;
-import org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser;
-import org.onosproject.yang.compiler.parser.exceptions.ParserException;
-import org.onosproject.yang.compiler.parser.impl.TreeWalkListener;
-import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation;
-import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction;
-import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType;
-import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil;
-import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation;
-
-import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.CONFIG_DATA;
-import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
-import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
-import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
-import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
-import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil.getValidBooleanValue;
-import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
-
 /*
  * Reference: RFC6020 and YANG ANTLR Grammar
  *
@@ -53,6 +31,20 @@
  * config          : string;
  */
 
+import org.onosproject.yang.compiler.datamodel.YangConfig;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.TreeWalkListener;
+
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.CONFIG_DATA;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil.getValidBooleanValue;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
+
 /**
  * Represents listener based call back function corresponding to the "config"
  * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
@@ -78,30 +70,17 @@
         // Check for stack to be non empty.
         checkStackIsNotEmpty(listener, MISSING_HOLDER, CONFIG_DATA, "", ENTRY);
 
-        boolean isConfig = getValidBooleanValue(ctx.config().getText(), CONFIG_DATA, ctx);
+        boolean isConfig = getValidBooleanValue(ctx.config().getText(),
+                                                CONFIG_DATA, ctx);
 
         Parsable tmpData = listener.getParsedDataStack().peek();
-        switch (tmpData.getYangConstructType()) {
-            case LEAF_DATA:
-                YangLeaf leaf = (YangLeaf) tmpData;
-                leaf.setConfig(isConfig);
-                break;
-            case CONTAINER_DATA:
-                YangContainer container = (YangContainer) tmpData;
-                container.setConfig(isConfig);
-                break;
-            case LEAF_LIST_DATA:
-                YangLeafList leafList = (YangLeafList) tmpData;
-                leafList.setConfig(isConfig);
-                break;
-            case LIST_DATA:
-                YangList yangList = (YangList) tmpData;
-                yangList.setConfig(isConfig);
-                break;
-            case CHOICE_DATA: // TODO
-                break;
-            default:
-                throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, CONFIG_DATA, "", ENTRY));
+        if (tmpData instanceof YangConfig) {
+            YangConfig config = ((YangConfig) tmpData);
+            config.setConfig(isConfig);
+        } else {
+            throw new ParserException(
+                    constructListenerErrorMessage(INVALID_HOLDER,
+                                                  CONFIG_DATA, "", ENTRY));
         }
     }
 }
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/DefaultListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/DefaultListener.java
index 0000aff..043cacd 100644
--- a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/DefaultListener.java
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/DefaultListener.java
@@ -39,9 +39,7 @@
  * defaultStatement : DEFAULT_KEYWORD string STMTEND;
  */
 
-import org.onosproject.yang.compiler.datamodel.YangChoice;
-import org.onosproject.yang.compiler.datamodel.YangLeaf;
-import org.onosproject.yang.compiler.datamodel.YangTypeDef;
+import org.onosproject.yang.compiler.datamodel.YangDefault;
 import org.onosproject.yang.compiler.datamodel.utils.Parsable;
 import org.onosproject.yang.compiler.parser.exceptions.ParserException;
 import org.onosproject.yang.compiler.parser.impl.TreeWalkListener;
@@ -77,28 +75,20 @@
                                            DefaultStatementContext ctx) {
 
         // Check for stack to be non empty.
-        checkStackIsNotEmpty(listener, MISSING_HOLDER, DEFAULT_DATA, ctx.string().getText(), ENTRY);
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, DEFAULT_DATA,
+                             ctx.string().getText(), ENTRY);
+        String value = removeQuotesAndHandleConcat(ctx.string().getText());
 
         Parsable tmpNode = listener.getParsedDataStack().peek();
-        switch (tmpNode.getYangConstructType()) {
-            case TYPEDEF_DATA: {
-                YangTypeDef typeDef = (YangTypeDef) tmpNode;
-                typeDef.setDefaultValueInString(removeQuotesAndHandleConcat(ctx.string().getText()));
-                break;
-            }
-            case LEAF_DATA: {
-                YangLeaf leaf = (YangLeaf) tmpNode;
-                leaf.setDefaultValueInString(removeQuotesAndHandleConcat(ctx.string().getText()));
-                break;
-            }
-            case CHOICE_DATA: {
-                YangChoice choice = (YangChoice) tmpNode;
-                choice.setDefaultValueInString(removeQuotesAndHandleConcat(ctx.string().getText()));
-                break;
-            }
-            default:
-                throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER,
-                                                                        DEFAULT_DATA, ctx.string().getText(), ENTRY));
+        if (tmpNode instanceof YangDefault) {
+            YangDefault defaultHolder = ((YangDefault) tmpNode);
+            defaultHolder.setDefaultValueInString(value);
+        } else {
+            throw new ParserException(
+                    constructListenerErrorMessage(INVALID_HOLDER,
+                                                  DEFAULT_DATA,
+                                                  ctx.string().getText(),
+                                                  ENTRY));
         }
     }
 }
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/DeviateAddListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/DeviateAddListener.java
new file mode 100644
index 0000000..1e78332
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/DeviateAddListener.java
@@ -0,0 +1,126 @@
+/*
+ * 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.yang.compiler.parser.impl.listeners;
+
+
+import org.onosproject.yang.compiler.datamodel.YangDeviateAdd;
+import org.onosproject.yang.compiler.datamodel.YangDeviation;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.TreeWalkListener;
+
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.DEVIATE_ADD;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.EXIT;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_CURRENT_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
+
+
+/*
+ * Reference: RFC6020 and YANG ANTLR Grammar
+ *
+ * ABNF grammar as per RFC6020
+ *
+ *  deviate-add-stmt    = deviate-keyword sep add-keyword optsep
+ *                        (";" /
+ *                         "{" stmtsep
+ *                             [units-stmt stmtsep]
+ *                             *(must-stmt stmtsep)
+ *                             *(unique-stmt stmtsep)
+ *                             [default-stmt stmtsep]
+ *                             [config-stmt stmtsep]
+ *                             [mandatory-stmt stmtsep]
+ *                             [min-elements-stmt stmtsep]
+ *                             [max-elements-stmt stmtsep]
+ *                         "}")
+ *
+ * ANTLR grammar rule
+ *   deviateAddStatement: DEVIATE_KEYWORD ADD_KEYWORD (STMTEND
+ *           | LEFT_CURLY_BRACE (unitsStatement | mustStatement
+ *           | uniqueStatement| defaultStatement| configStatement
+ *           | mandatoryStatement | minElementsStatement
+ *           | maxElementsStatement)*
+ *           RIGHT_CURLY_BRACE);
+ */
+
+/**
+ * Represents listener based call back function corresponding to the "deviate
+ * add" rule defined in ANTLR grammar file for corresponding ABNF rule in RFC
+ * 6020.
+ */
+public final class DeviateAddListener {
+
+    //No instantiation
+    private DeviateAddListener() {
+    }
+
+    /**
+     * Performs validation and updates the data model tree. It is called when
+     * parser receives an input matching the grammar rule(deviate add).
+     *
+     * @param listener listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processDeviateAddEntry(TreeWalkListener listener,
+                                              GeneratedYangParser.DeviateAddStatementContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, DEVIATE_ADD, null, ENTRY);
+
+        // TODO : Validate sub-statements cardinality
+
+        Parsable curData = listener.getParsedDataStack().peek();
+        if (curData instanceof YangDeviation) {
+            YangDeviation curNode = (YangDeviation) curData;
+            YangDeviateAdd deviationAdd = new YangDeviateAdd();
+            curNode.addDeviateAdd(deviationAdd);
+            listener.getParsedDataStack().push(deviationAdd);
+        } else {
+            throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER,
+                                                                    DEVIATE_ADD,
+                                                                    null,
+                                                                    ENTRY));
+        }
+    }
+
+    /**
+     * Performs validation and updates the data model tree. It is called when
+     * parser exits from grammar rule (deviate add).
+     *
+     * @param listener listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processDeviateAddExit(TreeWalkListener listener,
+                                             GeneratedYangParser.DeviateAddStatementContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, DEVIATE_ADD, null,
+                             EXIT);
+
+        if (listener.getParsedDataStack().peek() instanceof YangDeviateAdd) {
+            listener.getParsedDataStack().pop();
+        } else {
+            throw new ParserException(constructListenerErrorMessage
+                                              (MISSING_CURRENT_HOLDER, DEVIATE_ADD,
+                                               null, EXIT));
+        }
+    }
+}
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/DeviateDeleteListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/DeviateDeleteListener.java
new file mode 100644
index 0000000..2c84791
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/DeviateDeleteListener.java
@@ -0,0 +1,121 @@
+/*
+ * 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.yang.compiler.parser.impl.listeners;
+
+
+import org.onosproject.yang.compiler.datamodel.YangDeviateDelete;
+import org.onosproject.yang.compiler.datamodel.YangDeviation;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.TreeWalkListener;
+
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.DEVIATE_DELETE;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.EXIT;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_CURRENT_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
+
+/*
+ * Reference: RFC6020 and YANG ANTLR Grammar
+ *
+ * ABNF grammar as per RFC6020
+ *
+ *  deviate-delete-stmt = deviate-keyword sep delete-keyword optsep
+ *                        (";" /
+ *                         "{" stmtsep
+ *                             [units-stmt stmtsep]
+ *                             *(must-stmt stmtsep)
+ *                             *(unique-stmt stmtsep)
+ *                               [default-stmt stmtsep]
+ *                           "}")
+ *
+ * ANTLR grammar rule
+ *   deviateDeleteStatement: DEVIATE_KEYWORD DELETE_KEYWORD (STMTEND
+ *           | LEFT_CURLY_BRACE (unitsStatement | mustStatement |
+ *           uniqueStatement | defaultStatement)* RIGHT_CURLY_BRACE);
+ */
+
+/**
+ * Represents listener based call back function corresponding to the "deviate
+ * delete" rule defined in ANTLR grammar file for corresponding ABNF rule in RFC
+ * 6020.
+ */
+public final class DeviateDeleteListener {
+
+    // No instantiation
+    private DeviateDeleteListener() {
+    }
+
+    /**
+     * Performs validation and updates the data model tree. It is called when
+     * parser receives an input matching the grammar rule(deviate delete).
+     *
+     * @param listener listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processDeviateDeleteEntry(TreeWalkListener listener,
+                                                 GeneratedYangParser
+                                                         .DeviateDeleteStatementContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, DEVIATE_DELETE,
+                             null, ENTRY);
+
+        // TODO : Validate sub-statements cardinality
+
+        Parsable curData = listener.getParsedDataStack().peek();
+        if (curData instanceof YangDeviation) {
+            YangDeviation curNode = (YangDeviation) curData;
+            YangDeviateDelete deviateDelete = new YangDeviateDelete();
+            curNode.addDeviatedelete(deviateDelete);
+            listener.getParsedDataStack().push(deviateDelete);
+        } else {
+            throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER,
+                                                                    DEVIATE_DELETE,
+                                                                    null,
+                                                                    ENTRY));
+        }
+    }
+
+    /**
+     * Performs validation and updates the data model tree. It is called when
+     * parser exits from grammar rule (deviate delete).
+     *
+     * @param listener listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processDeviateDeleteExit(TreeWalkListener listener,
+                                                GeneratedYangParser
+                                                        .DeviateDeleteStatementContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, DEVIATE_DELETE, null,
+                             EXIT);
+
+        if (listener.getParsedDataStack().peek() instanceof YangDeviateDelete) {
+            listener.getParsedDataStack().pop();
+        } else {
+            throw new ParserException(constructListenerErrorMessage
+                                              (MISSING_CURRENT_HOLDER, DEVIATE_DELETE,
+                                               null, EXIT));
+        }
+    }
+}
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/DeviateReplaceListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/DeviateReplaceListener.java
new file mode 100644
index 0000000..962aa60
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/DeviateReplaceListener.java
@@ -0,0 +1,125 @@
+/*
+ * 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.yang.compiler.parser.impl.listeners;
+
+import org.onosproject.yang.compiler.datamodel.YangDeviateReplace;
+import org.onosproject.yang.compiler.datamodel.YangDeviation;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.TreeWalkListener;
+
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.DEVIATE_REPLACE;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.EXIT;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_CURRENT_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
+
+/*
+ * Reference: RFC6020 and YANG ANTLR Grammar
+ *
+ * ABNF grammar as per RFC6020
+ *
+ *   deviate-replace-stmt = deviate-keyword sep replace-keyword optsep
+ *                         (";" /
+ *                          "{" stmtsep
+ *                              [type-stmt stmtsep]
+ *                              [units-stmt stmtsep]
+ *                              [default-stmt stmtsep]
+ *                              [config-stmt stmtsep]
+ *                              [mandatory-stmt stmtsep]
+ *                              [min-elements-stmt stmtsep]
+ *                              [max-elements-stmt stmtsep]
+ *                          "}")
+ *
+ * ANTLR grammar rule
+ *   deviateReplaceStatement: DEVIATE_KEYWORD REPLACE_KEYWORD (STMTEND
+ *           | LEFT_CURLY_BRACE (typeStatement | unitsStatement
+ *           | defaultStatement | configStatement
+ *           | mandatoryStatement | minElementsStatement
+ *           | maxElementsStatement)* RIGHT_CURLY_BRACE);
+ */
+
+/**
+ * Represents listener based call back function corresponding to the "deviate
+ * replace" rule defined in ANTLR grammar file for corresponding ABNF rule in
+ * RFC 6020.
+ */
+public final class DeviateReplaceListener {
+
+    //No instantiation
+    private DeviateReplaceListener() {
+    }
+
+    /**
+     * Performs validation and updates the data model tree. It is called when
+     * parser receives an input matching the grammar rule(deviate replace).
+     *
+     * @param listener listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processDeviateReplaceEntry(TreeWalkListener listener,
+                                                  GeneratedYangParser
+                                                          .DeviateReplaceStatementContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, DEVIATE_REPLACE,
+                             null, ENTRY);
+
+        // TODO : Validate sub-statements cardinality
+
+        Parsable curData = listener.getParsedDataStack().peek();
+        if (curData instanceof YangDeviation) {
+            YangDeviation curNode = (YangDeviation) curData;
+            YangDeviateReplace deviationReplace = new YangDeviateReplace();
+            curNode.addDeviateReplace(deviationReplace);
+            listener.getParsedDataStack().push(deviationReplace);
+        } else {
+            throw new ParserException(constructListenerErrorMessage
+                                              (INVALID_HOLDER,
+                                               DEVIATE_REPLACE,
+                                               null,
+                                               ENTRY));
+        }
+    }
+
+    /**
+     * Performs validation and updates the data model tree. It is called when
+     * parser exits from grammar rule (deviate replace).
+     *
+     * @param listener listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processDeviateReplaceExit(TreeWalkListener listener,
+                                                 GeneratedYangParser.DeviateReplaceStatementContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, DEVIATE_REPLACE, null,
+                             EXIT);
+
+        if (listener.getParsedDataStack().peek() instanceof YangDeviateReplace) {
+            listener.getParsedDataStack().pop();
+        } else {
+            throw new ParserException(constructListenerErrorMessage
+                                              (MISSING_CURRENT_HOLDER, DEVIATE_REPLACE,
+                                               null, EXIT));
+        }
+    }
+}
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/DeviationListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/DeviationListener.java
new file mode 100644
index 0000000..97f9be2
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/DeviationListener.java
@@ -0,0 +1,234 @@
+/*
+ * 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.yang.compiler.parser.impl.listeners;
+
+/*
+ * Reference: RFC6020 and YANG ANTLR Grammar
+ *
+ * ABNF grammar as per RFC6020
+ *
+ *  deviation-stmt      = deviation-keyword sep
+ *                        deviation-arg-str optsep
+ *                        "{" stmtsep
+ *                            ;; these stmts can appear in any order
+ *                            [description-stmt stmtsep]
+ *                            [reference-stmt stmtsep]
+ *                            (deviate-not-supported-stmt /
+ *                              1*(deviate-add-stmt /
+ *                                 deviate-replace-stmt /
+ *                                 deviate-delete-stmt))
+ *                        "}"
+ *
+ * ANTLR grammar rule
+ *   deviationStatement: DEVIATION_KEYWORD deviation LEFT_CURLY_BRACE (
+ *       descriptionStatement | referenceStatement | deviateNotSupportedStatement
+ *      | deviateAddStatement | deviateReplaceStatement
+ *      | deviateDeleteStatement)* RIGHT_CURLY_BRACE;
+ */
+
+import org.onosproject.yang.compiler.datamodel.YangAtomicPath;
+import org.onosproject.yang.compiler.datamodel.YangDeviation;
+import org.onosproject.yang.compiler.datamodel.YangDeviationHolder;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.linker.impl.YangResolutionInfoImpl;
+import org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.TreeWalkListener;
+
+import java.util.List;
+
+import static org.onosproject.yang.compiler.datamodel.YangNodeType.DEVIATION_NODE;
+import static org.onosproject.yang.compiler.datamodel.utils.DataModelUtils.addResolutionInfo;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.DESCRIPTION_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.DEVIATE_ADD;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.DEVIATE_DELETE;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.DEVIATE_NOT_SUPPORTED;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.DEVIATE_REPLACE;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.DEVIATION_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.REFERENCE_DATA;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerCollisionDetector.detectCollidingChildUtil;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.EXIT;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructExtendedListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_CURRENT_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.UNHANDLED_PARSED_DATA;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil.getValidAbsoluteSchemaNodeId;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil.removeQuotesAndHandleConcat;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.validateCardinalityMaxOne;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.validateCardinalityMutuallyExclusive;
+
+/**
+ * Represents listener based call back function corresponding to the "deviation"
+ * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
+ */
+public final class DeviationListener {
+
+    /**
+     * Creates a new deviation listener.
+     */
+    private DeviationListener() {
+    }
+
+    /**
+     * Performs validation and updates the data model tree. It is called when
+     * parser receives an input matching the grammar rule(deviation).
+     *
+     * @param listener listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processDeviationEntry(TreeWalkListener listener,
+                                             GeneratedYangParser.DeviationStatementContext ctx) {
+
+        String deviationArg = removeQuotesAndHandleConcat(ctx.deviation().getText());
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, DEVIATION_DATA,
+                             deviationArg, ENTRY);
+
+        // Validates deviation argument string
+        List<YangAtomicPath> targetNode = getValidAbsoluteSchemaNodeId(deviationArg,
+                                                                       DEVIATION_DATA, ctx);
+
+        validateSubStatementsCardinality(ctx);
+
+        // Check for identifier collision
+        int line = ctx.getStart().getLine();
+        int charPositionInLine = ctx.getStart().getCharPositionInLine();
+        detectCollidingChildUtil(listener, line, charPositionInLine,
+                                 deviationArg, DEVIATION_DATA);
+
+        Parsable curData = listener.getParsedDataStack().peek();
+        if (curData instanceof YangDeviationHolder) {
+            YangDeviation deviation = new YangDeviation(DEVIATION_NODE, null);
+            deviation.setName(deviationArg);
+            deviation.setLineNumber(line);
+            deviation.setCharPosition(charPositionInLine);
+            deviation.setFileName(listener.getFileName());
+            deviation.setTargetNode(targetNode);
+            if (!ctx.deviateNotSupportedStatement().isEmpty()) {
+                deviation.setDeviateNotSupported(true);
+            }
+            YangNode curNode = (YangNode) curData;
+            try {
+                curNode.addChild(deviation);
+                ((YangDeviationHolder) curNode).setModuleForDeviation(true);
+            } catch (DataModelException e) {
+                throw new ParserException(
+                        constructExtendedListenerErrorMessage(UNHANDLED_PARSED_DATA,
+                                                              DEVIATION_DATA,
+                                                              deviationArg,
+                                                              ENTRY, e.getMessage()));
+            }
+            listener.getParsedDataStack().push(deviation);
+
+            // Adds resolution info to the list
+            YangResolutionInfoImpl<YangDeviation> info =
+                    new YangResolutionInfoImpl<>(deviation, deviation.getParent(),
+                                                 line, charPositionInLine);
+            addToResolution(info, ctx);
+        } else {
+            throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER,
+                                                                    DEVIATION_DATA,
+                                                                    deviationArg,
+                                                                    ENTRY));
+        }
+    }
+
+    /**
+     * Performs validation and updates the data model tree. It is called when
+     * parser exits from grammar rule (deviation).
+     *
+     * @param listener listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processDeviationExit(TreeWalkListener listener,
+                                            GeneratedYangParser.DeviationStatementContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, DEVIATION_DATA, ctx
+                .deviation().getText(), EXIT);
+
+        if (listener.getParsedDataStack().peek() instanceof YangDeviation) {
+            listener.getParsedDataStack().pop();
+        } else {
+            throw new ParserException(constructListenerErrorMessage
+                                              (MISSING_CURRENT_HOLDER, DEVIATION_DATA,
+                                               ctx.deviation().getText(), EXIT));
+        }
+    }
+
+    /**
+     * Validates the cardinality of deviation sub-statements as per grammar.
+     *
+     * @param ctx context object of the grammar rule
+     */
+    private static void validateSubStatementsCardinality(GeneratedYangParser
+                                                                 .DeviationStatementContext ctx) {
+        validateCardinalityMaxOne(ctx.descriptionStatement(),
+                                  DESCRIPTION_DATA, DEVIATION_DATA,
+                                  ctx.deviation().getText());
+        validateCardinalityMaxOne(ctx.referenceStatement(), REFERENCE_DATA,
+                                  DEVIATION_DATA, ctx.deviation().getText());
+        validateCardinalityMaxOne(ctx.deviateNotSupportedStatement(),
+                                  DEVIATE_NOT_SUPPORTED,
+                                  DEVIATION_DATA, ctx.deviation().getText());
+        validateCardinalityMutuallyExclusive(ctx.deviateNotSupportedStatement(),
+                                             DEVIATE_NOT_SUPPORTED,
+                                             ctx.deviateAddStatement(),
+                                             DEVIATE_ADD,
+                                             DEVIATION_DATA,
+                                             ctx.deviation().getText(),
+                                             ctx);
+        validateCardinalityMutuallyExclusive(ctx.deviateNotSupportedStatement(),
+                                             DEVIATE_NOT_SUPPORTED,
+                                             ctx.deviateReplaceStatement(),
+                                             DEVIATE_REPLACE,
+                                             DEVIATION_DATA,
+                                             ctx.deviation().getText(),
+                                             ctx);
+        validateCardinalityMutuallyExclusive(ctx.deviateNotSupportedStatement(),
+                                             DEVIATE_NOT_SUPPORTED,
+                                             ctx.deviateDeleteStatement(),
+                                             DEVIATE_DELETE,
+                                             DEVIATION_DATA,
+                                             ctx.deviation().getText(),
+                                             ctx);
+    }
+
+    /**
+     * Add to resolution list.
+     *
+     * @param info resolution info
+     * @param ctx  context object
+     */
+    private static void addToResolution(YangResolutionInfoImpl<YangDeviation> info,
+                                        GeneratedYangParser.DeviationStatementContext ctx) {
+        try {
+            addResolutionInfo(info);
+        } catch (DataModelException e) {
+            throw new ParserException(constructExtendedListenerErrorMessage(
+                    UNHANDLED_PARSED_DATA, DEVIATION_DATA,
+                    ctx.deviation().getText(), EXIT, e.getMessage()));
+        }
+    }
+}
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/MandatoryListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/MandatoryListener.java
index b711592..5f21154 100644
--- a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/MandatoryListener.java
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/MandatoryListener.java
@@ -16,7 +16,7 @@
 
 package org.onosproject.yang.compiler.parser.impl.listeners;
 
-import org.onosproject.yang.compiler.datamodel.YangLeaf;
+import org.onosproject.yang.compiler.datamodel.YangMandatory;
 import org.onosproject.yang.compiler.datamodel.utils.Parsable;
 import org.onosproject.yang.compiler.parser.exceptions.ParserException;
 import org.onosproject.yang.compiler.parser.impl.TreeWalkListener;
@@ -73,18 +73,16 @@
         // Check for stack to be non empty.
         checkStackIsNotEmpty(listener, MISSING_HOLDER, MANDATORY_DATA, "", ENTRY);
 
-        boolean isMandatory = getValidBooleanValue(ctx.mandatory().getText(), MANDATORY_DATA, ctx);
+        boolean isMandatory = getValidBooleanValue(ctx.mandatory().getText(),
+                                                   MANDATORY_DATA, ctx);
 
         Parsable tmpNode = listener.getParsedDataStack().peek();
-        switch (tmpNode.getYangConstructType()) {
-            case LEAF_DATA:
-                YangLeaf leaf = (YangLeaf) tmpNode;
-                leaf.setMandatory(isMandatory);
-                break;
-            case CHOICE_DATA: // TODO
-                break;
-            default:
-                throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, MANDATORY_DATA, "", ENTRY));
+        if (tmpNode instanceof YangMandatory) {
+            YangMandatory yangMandatory = ((YangMandatory) tmpNode);
+            yangMandatory.setMandatory(isMandatory);
+        } else {
+            throw new ParserException(constructListenerErrorMessage(
+                    INVALID_HOLDER, MANDATORY_DATA, "", ENTRY));
         }
     }
 }
\ No newline at end of file
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/MaxElementsListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/MaxElementsListener.java
index ee7f1ef..f46b606 100644
--- a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/MaxElementsListener.java
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/MaxElementsListener.java
@@ -16,9 +16,8 @@
 
 package org.onosproject.yang.compiler.parser.impl.listeners;
 
-import org.onosproject.yang.compiler.datamodel.YangLeafList;
-import org.onosproject.yang.compiler.datamodel.YangList;
 import org.onosproject.yang.compiler.datamodel.YangMaxElement;
+import org.onosproject.yang.compiler.datamodel.YangMaxElementHolder;
 import org.onosproject.yang.compiler.datamodel.utils.Parsable;
 import org.onosproject.yang.compiler.datamodel.utils.YangConstructType;
 import org.onosproject.yang.compiler.parser.exceptions.ParserException;
@@ -85,17 +84,12 @@
         maxElement.setCharPosition(ctx.getStart().getCharPositionInLine());
         maxElement.setFileName(listener.getFileName());
         Parsable tmpData = listener.getParsedDataStack().peek();
-        switch (tmpData.getYangConstructType()) {
-            case LEAF_LIST_DATA:
-                YangLeafList leafList = (YangLeafList) tmpData;
-                leafList.setMaxElements(maxElement);
-                break;
-            case LIST_DATA:
-                YangList yangList = (YangList) tmpData;
-                yangList.setMaxElements(maxElement);
-                break;
-            default:
-                throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, MAX_ELEMENT_DATA, "", ENTRY));
+        if (tmpData instanceof YangMaxElementHolder) {
+            YangMaxElementHolder holder = ((YangMaxElementHolder) tmpData);
+            holder.setMaxElements(maxElement);
+        } else {
+            throw new ParserException(constructListenerErrorMessage(
+                    INVALID_HOLDER, MAX_ELEMENT_DATA, "", ENTRY));
         }
     }
 
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/MinElementsListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/MinElementsListener.java
index ed80c4c..ed07598 100644
--- a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/MinElementsListener.java
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/MinElementsListener.java
@@ -16,15 +16,11 @@
 
 package org.onosproject.yang.compiler.parser.impl.listeners;
 
-import org.onosproject.yang.compiler.datamodel.YangLeafList;
-import org.onosproject.yang.compiler.datamodel.YangList;
+import org.onosproject.yang.compiler.datamodel.YangMinElementHolder;
 import org.onosproject.yang.compiler.datamodel.YangMinElement;
 import org.onosproject.yang.compiler.datamodel.utils.Parsable;
 import org.onosproject.yang.compiler.parser.exceptions.ParserException;
 import org.onosproject.yang.compiler.parser.impl.TreeWalkListener;
-import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation;
-import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType;
-import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil;
 
 import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.MIN_ELEMENT_DATA;
 import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.MinElementsStatementContext;
@@ -74,9 +70,11 @@
                                                MinElementsStatementContext ctx) {
 
         // Check for stack to be non empty.
-        checkStackIsNotEmpty(listener, MISSING_HOLDER, MIN_ELEMENT_DATA, ctx.minValue().getText(), ENTRY);
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, MIN_ELEMENT_DATA,
+                             ctx.minValue().getText(), ENTRY);
 
-        int minElementValue = getValidNonNegativeIntegerValue(ctx.minValue().getText(), MIN_ELEMENT_DATA, ctx);
+        int minElementValue = getValidNonNegativeIntegerValue(
+                ctx.minValue().getText(), MIN_ELEMENT_DATA, ctx);
 
         YangMinElement minElement = new YangMinElement();
 
@@ -84,19 +82,15 @@
         minElement.setLineNumber(ctx.getStart().getLine());
         minElement.setCharPosition(ctx.getStart().getCharPositionInLine());
         minElement.setFileName(listener.getFileName());
+
         Parsable tmpData = listener.getParsedDataStack().peek();
-        switch (tmpData.getYangConstructType()) {
-            case LEAF_LIST_DATA:
-                YangLeafList leafList = (YangLeafList) tmpData;
-                leafList.setMinElements(minElement);
-                break;
-            case LIST_DATA:
-                YangList yangList = (YangList) tmpData;
-                yangList.setMinElements(minElement);
-                break;
-            default:
-                throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, MIN_ELEMENT_DATA,
-                                                                        ctx.minValue().getText(), ENTRY));
+        if (tmpData instanceof YangMinElementHolder) {
+            YangMinElementHolder holder = ((YangMinElementHolder) tmpData);
+            holder.setMinElements(minElement);
+        } else {
+            throw new ParserException(constructListenerErrorMessage(
+                    INVALID_HOLDER, MIN_ELEMENT_DATA, ctx.minValue().getText(),
+                    ENTRY));
         }
     }
 }
\ No newline at end of file
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/ModuleListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/ModuleListener.java
index 346e35c..fa3a6f9 100644
--- a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/ModuleListener.java
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/ModuleListener.java
@@ -35,6 +35,7 @@
 import static org.onosproject.yang.compiler.datamodel.ResolvableType.YANG_IF_FEATURE;
 import static org.onosproject.yang.compiler.datamodel.ResolvableType.YANG_LEAFREF;
 import static org.onosproject.yang.compiler.datamodel.ResolvableType.YANG_USES;
+import static org.onosproject.yang.compiler.datamodel.utils.DataModelUtils.validateMultipleDeviationStatement;
 import static org.onosproject.yang.compiler.datamodel.utils.GeneratedLanguage.JAVA_GENERATION;
 import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.MODULE_DATA;
 import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.ModuleStatementContext;
@@ -148,6 +149,16 @@
             linkerException.setFileName(listener.getFileName());
             throw linkerException;
         }
+
+        /*
+         * Validate whether all deviation statement xpath is referring to same
+         * module
+         */
+        try {
+            validateMultipleDeviationStatement(module);
+        } catch (DataModelException e) {
+            throw new ParserException(e.getMessage());
+        }
     }
 
     private static void throwError(ListenerErrorType type,
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/SubModuleListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/SubModuleListener.java
index 7b18d5b..f1dbf66 100644
--- a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/SubModuleListener.java
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/SubModuleListener.java
@@ -25,12 +25,8 @@
 import org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser;
 import org.onosproject.yang.compiler.parser.exceptions.ParserException;
 import org.onosproject.yang.compiler.parser.impl.TreeWalkListener;
-import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation;
-import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction;
-import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType;
-import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil;
-import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation;
 
+import static org.onosproject.yang.compiler.datamodel.utils.DataModelUtils.validateMultipleDeviationStatement;
 import static org.onosproject.yang.compiler.datamodel.utils.GeneratedLanguage.JAVA_GENERATION;
 import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.MODULE_DATA;
 import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.SUB_MODULE_DATA;
@@ -154,5 +150,15 @@
             linkerException.setFileName(listener.getFileName());
             throw linkerException;
         }
+
+        /*
+         * Validate whether all deviation statement xpath is referring to same
+         * module
+         */
+        try {
+            validateMultipleDeviationStatement(subModule);
+        } catch (DataModelException e) {
+            throw new ParserException(e.getMessage());
+        }
     }
 }
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/TypeListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/TypeListener.java
index 0b16af7..7a23e7a 100644
--- a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/TypeListener.java
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/TypeListener.java
@@ -17,6 +17,7 @@
 package org.onosproject.yang.compiler.parser.impl.listeners;
 
 import org.onosproject.yang.compiler.datamodel.YangDerivedInfo;
+import org.onosproject.yang.compiler.datamodel.YangDeviateReplace;
 import org.onosproject.yang.compiler.datamodel.YangLeaf;
 import org.onosproject.yang.compiler.datamodel.YangLeafList;
 import org.onosproject.yang.compiler.datamodel.YangNode;
@@ -32,7 +33,6 @@
 import org.onosproject.yang.compiler.parser.exceptions.ParserException;
 import org.onosproject.yang.compiler.parser.impl.TreeWalkListener;
 import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType;
-import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil;
 
 import static org.onosproject.yang.compiler.datamodel.utils.GeneratedLanguage.JAVA_GENERATION;
 import static org.onosproject.yang.compiler.datamodel.utils.ResolvableStatus.UNRESOLVED;
@@ -247,8 +247,10 @@
                     addToResolutionList(resolutionInfo, ctx);
                 }
                 break;
-            //TODO: deviate replacement statement.
-
+            case DEVIATE_REPLACE:
+                YangDeviateReplace replace = (YangDeviateReplace) tmpData;
+                replace.setDataType(type);
+                break;
             default:
                 throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, TYPE_DATA,
                                                                         ctx.string().getText(), EXIT));
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/UniqueListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/UniqueListener.java
index e222422..c97d272 100644
--- a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/UniqueListener.java
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/UniqueListener.java
@@ -16,15 +16,12 @@
 
 package org.onosproject.yang.compiler.parser.impl.listeners;
 
-import org.onosproject.yang.compiler.datamodel.YangList;
+import org.onosproject.yang.compiler.datamodel.YangUniqueHolder;
 import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
 import org.onosproject.yang.compiler.datamodel.utils.Parsable;
 import org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser;
 import org.onosproject.yang.compiler.parser.exceptions.ParserException;
 import org.onosproject.yang.compiler.parser.impl.TreeWalkListener;
-import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation;
-import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType;
-import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil;
 
 import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.UNIQUE_DATA;
 import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
@@ -33,6 +30,7 @@
 import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
 import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
 import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.UNHANDLED_PARSED_DATA;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil.SPACE;
 import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil.removeQuotesAndHandleConcat;
 import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
 
@@ -70,35 +68,43 @@
                                           GeneratedYangParser.UniqueStatementContext ctx) {
 
         // Check for stack to be non empty.
-        checkStackIsNotEmpty(listener, MISSING_HOLDER, UNIQUE_DATA, ctx.unique().getText(), ENTRY);
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, UNIQUE_DATA, ctx.unique()
+                .getText(), ENTRY);
 
         Parsable tmpData = listener.getParsedDataStack().peek();
-        if (listener.getParsedDataStack().peek() instanceof YangList) {
-            YangList yangList = (YangList) tmpData;
-            String tmpUniqueValue = removeQuotesAndHandleConcat(ctx.unique().getText());
+        if (listener.getParsedDataStack().peek() instanceof YangUniqueHolder) {
+            YangUniqueHolder uniqueHolder = (YangUniqueHolder) tmpData;
+            String tmpUniqueValue = removeQuotesAndHandleConcat(
+                    ctx.unique().getText());
 
-            if (tmpUniqueValue.contains(" ")) {
-                String[] uniqueValues = tmpUniqueValue.split(" ");
+            if (tmpUniqueValue.contains(SPACE)) {
+                String[] uniqueValues = tmpUniqueValue.split(SPACE);
                 for (String uniqueValue : uniqueValues) {
                     try {
-                        yangList.addUnique(uniqueValue);
+                        uniqueHolder.addUnique(uniqueValue);
                     } catch (DataModelException e) {
-                        throw new ParserException(constructExtendedListenerErrorMessage(UNHANDLED_PARSED_DATA,
-                                UNIQUE_DATA,
-                                ctx.unique().getText(), ENTRY, e.getMessage()));
+                        throw new ParserException(
+                                constructExtendedListenerErrorMessage(UNHANDLED_PARSED_DATA,
+                                                                      UNIQUE_DATA,
+                                                                      ctx.unique().getText(),
+                                                                      ENTRY, e.getMessage()));
                     }
                 }
             } else {
                 try {
-                    yangList.addUnique(tmpUniqueValue);
+                    uniqueHolder.addUnique(tmpUniqueValue);
                 } catch (DataModelException e) {
-                    throw new ParserException(constructExtendedListenerErrorMessage(UNHANDLED_PARSED_DATA, UNIQUE_DATA,
-                            ctx.unique().getText(), ENTRY, e.getMessage()));
+                    throw new ParserException(
+                            constructExtendedListenerErrorMessage(
+                                    UNHANDLED_PARSED_DATA, UNIQUE_DATA,
+                                    ctx.unique().getText(), ENTRY, e.getMessage()));
                 }
             }
         } else {
-            throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, UNIQUE_DATA, ctx.unique().getText(),
-                    ENTRY));
+            throw new ParserException(
+                    constructListenerErrorMessage(INVALID_HOLDER, UNIQUE_DATA,
+                                                  ctx.unique().getText(),
+                                                  ENTRY));
         }
     }
 }
\ No newline at end of file
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/UnitsListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/UnitsListener.java
index f8db2cf..b5eb1f7 100644
--- a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/UnitsListener.java
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/UnitsListener.java
@@ -16,12 +16,15 @@
 
 package org.onosproject.yang.compiler.parser.impl.listeners;
 
+import org.onosproject.yang.compiler.datamodel.YangDeviateAdd;
+import org.onosproject.yang.compiler.datamodel.YangDeviateDelete;
+import org.onosproject.yang.compiler.datamodel.YangDeviateReplace;
 import org.onosproject.yang.compiler.datamodel.YangLeaf;
 import org.onosproject.yang.compiler.datamodel.YangLeafList;
+import org.onosproject.yang.compiler.datamodel.YangTypeDef;
 import org.onosproject.yang.compiler.datamodel.utils.Parsable;
 import org.onosproject.yang.compiler.parser.exceptions.ParserException;
 import org.onosproject.yang.compiler.parser.impl.TreeWalkListener;
-import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType;
 
 import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.UNITS_DATA;
 import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.UnitsStatementContext;
@@ -78,11 +81,27 @@
                 leafList.setUnits(ctx.string().getText());
                 break;
             case TYPEDEF_DATA:
-                // TODO
+                YangTypeDef typeDef = (YangTypeDef) tmpData;
+                typeDef.setUnits(ctx.string().getText());
+                break;
+            case DEVIATE_ADD:
+                YangDeviateAdd deviateAdd = (YangDeviateAdd) tmpData;
+                deviateAdd.setUnits(ctx.string().getText());
+                break;
+            case DEVIATE_DELETE:
+                YangDeviateDelete deviateDelete = (YangDeviateDelete) tmpData;
+                deviateDelete.setUnits(ctx.string().getText());
+                break;
+            case DEVIATE_REPLACE:
+                YangDeviateReplace replace = (YangDeviateReplace) tmpData;
+                replace.setUnits(ctx.string().getText());
                 break;
             default:
-                throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, UNITS_DATA,
-                                ctx.string().getText(), ENTRY));
+                throw new ParserException(
+                        constructListenerErrorMessage(INVALID_HOLDER,
+                                                      UNITS_DATA,
+                                                      ctx.string().getText(),
+                                                      ENTRY));
         }
     }
 }
\ No newline at end of file
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/parserutils/ListenerUtil.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/parserutils/ListenerUtil.java
index e71eb98..328b6bc 100644
--- a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/parserutils/ListenerUtil.java
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/parserutils/ListenerUtil.java
@@ -90,6 +90,7 @@
     private static final String DATE_FORMAT = "yyyy-MM-dd";
     private static final String REGEX_EQUAL = "[=]";
     private static final String REGEX_OPEN_BRACE = "[(]";
+    public static final String SPACE = " ";
 
     // No instantiation.
     private ListenerUtil() {
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/parserutils/ListenerValidation.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/parserutils/ListenerValidation.java
index eeb1dc9..4b45fcd 100644
--- a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/parserutils/ListenerValidation.java
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/parserutils/ListenerValidation.java
@@ -240,4 +240,38 @@
             throw parserException;
         }
     }
+
+    /**
+     * Checks if a either of one construct occurrence.
+     *
+     * @param ctx1       first optional child's context
+     * @param type1      first child construct for whom cardinality is
+     *                   to be validated
+     * @param ctx2       second optional child's context
+     * @param type2      second child construct for whom cardinality is
+     *                   to be validated
+     * @param type       parent construct
+     * @param parentName parent name
+     * @param ctx        parents's context
+     * @throws ParserException exception if cardinality check fails
+     */
+    public static void validateCardinalityMutuallyExclusive(List<?> ctx1,
+                                                            YangConstructType type1,
+                                                            List<?> ctx2,
+                                                            YangConstructType type2,
+                                                            YangConstructType type,
+                                                            String parentName,
+                                                            ParserRuleContext ctx)
+            throws ParserException {
+
+        if (!ctx1.isEmpty() && !ctx2.isEmpty()) {
+            String error = "YANG file error: Either " + getYangConstructType(type1)
+                    + " or " + getYangConstructType(type2) + " should be present in "
+                    + getYangConstructType(type) + " " + parentName + ".";
+            ParserException parserException = new ParserException(error);
+            parserException.setLine(ctx.getStart().getLine());
+            parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
+            throw parserException;
+        }
+    }
 }
diff --git a/compiler/base/parser/src/main/resources/GeneratedYang.g4 b/compiler/base/parser/src/main/resources/GeneratedYang.g4
index 3ba1201..af16c05 100644
--- a/compiler/base/parser/src/main/resources/GeneratedYang.g4
+++ b/compiler/base/parser/src/main/resources/GeneratedYang.g4
@@ -1207,9 +1207,12 @@
      *                             [max-elements-stmt stmtsep]
      *                         "}")
      */
-    deviateAddStatement: DEVIATE_KEYWORD ADD_KEYWORD (STMTEND | (LEFT_CURLY_BRACE unitsStatement? mustStatement* uniqueStatement*
-                      defaultStatement? configStatement? mandatoryStatement? minElementsStatement? maxElementsStatement?
-                      RIGHT_CURLY_BRACE));
+    deviateAddStatement: DEVIATE_KEYWORD ADD_KEYWORD (STMTEND
+                       | LEFT_CURLY_BRACE (unitsStatement | mustStatement
+                         | uniqueStatement| defaultStatement| configStatement
+                         | mandatoryStatement | minElementsStatement
+                         | maxElementsStatement)*
+                       RIGHT_CURLY_BRACE);
 
     /**
      *  deviate-delete-stmt = deviate-keyword sep delete-keyword optsep
@@ -1222,7 +1225,8 @@
      *                           "}")
      */
     deviateDeleteStatement: DEVIATE_KEYWORD DELETE_KEYWORD (STMTEND
-                       | (LEFT_CURLY_BRACE  unitsStatement? mustStatement* uniqueStatement* defaultStatement? RIGHT_CURLY_BRACE));
+                       | LEFT_CURLY_BRACE (unitsStatement | mustStatement |
+                       uniqueStatement | defaultStatement)* RIGHT_CURLY_BRACE);
 
     /**
      *   deviate-replace-stmt = deviate-keyword sep replace-keyword optsep
@@ -1237,9 +1241,11 @@
      *                              [max-elements-stmt stmtsep]
      *                          "}")
      */
-    deviateReplaceStatement: DEVIATE_KEYWORD REPLACE_KEYWORD (STMTEND | (LEFT_CURLY_BRACE typeStatement? unitsStatement?
-                           defaultStatement? configStatement? mandatoryStatement? minElementsStatement?
-                           maxElementsStatement? RIGHT_CURLY_BRACE));
+    deviateReplaceStatement: DEVIATE_KEYWORD REPLACE_KEYWORD (STMTEND
+                           | LEFT_CURLY_BRACE (typeStatement | unitsStatement
+                             | defaultStatement | configStatement
+                             | mandatoryStatement | minElementsStatement
+                             | maxElementsStatement)* RIGHT_CURLY_BRACE);
 
     /**
      *   compiler-annotation-stmt = prefix:compiler-annotation-keyword string
diff --git a/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/DeviationListenerTest.java b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/DeviationListenerTest.java
new file mode 100644
index 0000000..cca24d1
--- /dev/null
+++ b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/DeviationListenerTest.java
@@ -0,0 +1,212 @@
+/*
+ * 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.yang.compiler.parser.impl.listeners;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.onosproject.yang.compiler.datamodel.YangAtomicPath;
+import org.onosproject.yang.compiler.datamodel.YangDeviateAdd;
+import org.onosproject.yang.compiler.datamodel.YangDeviateDelete;
+import org.onosproject.yang.compiler.datamodel.YangDeviateReplace;
+import org.onosproject.yang.compiler.datamodel.YangDeviation;
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.YangUtilsParserManager;
+
+import java.io.IOException;
+import java.util.List;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.Is.is;
+import static org.onosproject.yang.compiler.datamodel.YangNodeType.MODULE_NODE;
+import static org.onosproject.yang.compiler.datamodel.utils.ResolvableStatus.UNRESOLVED;
+import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes.INT8;
+
+/**
+ * Test cases for testing deviation listener.
+ */
+public class DeviationListenerTest {
+
+    @Rule
+    public ExpectedException thrown = ExpectedException.none();
+
+    private final YangUtilsParserManager manager = new YangUtilsParserManager();
+
+    /**
+     * Checks deviation statement as sub-statement of module.
+     */
+    @Test
+    public void processDeviationNotSupported() throws IOException,
+            ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/" +
+                                                     "ValidDeviationNotSupported.yang");
+
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        // Check whether the container is child of module
+        YangDeviation deviation = (YangDeviation) yangNode.getChild();
+        assertThat(deviation.getName(), is("/base:system/base:daytime"));
+        assertThat(deviation.getDescription(), is("\"desc\""));
+        assertThat(deviation.getReference(), is("\"ref\""));
+        assertThat(deviation.isDeviateNotSupported(), is(true));
+        List<YangAtomicPath> targetNode = deviation.getTargetNode();
+        assertThat(targetNode.get(0).getNodeIdentifier().getName(),
+                   is("system"));
+        assertThat(targetNode.get(1).getNodeIdentifier().getName(),
+                   is("daytime"));
+        assertThat(targetNode.get(0).getNodeIdentifier().getPrefix(),
+                   is("base"));
+        assertThat(deviation.getResolvableStatus(), is(UNRESOLVED));
+    }
+
+    /**
+     * Checks deviation add statement as sub-statement of module.
+     */
+    @Test
+    public void processDeviationAddStatement() throws IOException,
+            ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/" +
+                                                     "ValidDeviateAdd.yang");
+
+        assertThat((node instanceof YangModule), is(true));
+        assertThat(node.getNodeType(), is(MODULE_NODE));
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        YangDeviation deviation = (YangDeviation) yangNode.getChild();
+        assertThat(deviation.getName(), is("/base:system/base:user/base:type"));
+        assertThat(deviation.isDeviateNotSupported(), is(false));
+        List<YangAtomicPath> targetNode = deviation.getTargetNode();
+        assertThat(targetNode.get(0).getNodeIdentifier().getName(),
+                   is("system"));
+        assertThat(targetNode.get(0).getNodeIdentifier().getPrefix(),
+                   is("base"));
+        assertThat(targetNode.get(1).getNodeIdentifier().getName(),
+                   is("user"));
+        assertThat(targetNode.get(2).getNodeIdentifier().getName(),
+                   is("type"));
+
+        YangDeviateAdd deviateAdd = deviation.getDeviateAdd().get(0);
+        assertThat(deviateAdd.getUnits(), is("\"units\""));
+        assertThat(deviateAdd.getListOfMust().get(0).getConstraint(),
+                   is("/base:system"));
+        assertThat(deviateAdd.getUniqueList().get(0), is("id"));
+        assertThat(deviateAdd.getDefaultValueInString(), is("admin"));
+        assertThat(deviateAdd.isConfig(), is(true));
+        assertThat(deviateAdd.isMandatory(), is(true));
+        assertThat(deviateAdd.getMinElements().getMinElement(), is(0));
+        assertThat(deviateAdd.getMaxElements().getMaxElement(), is(12343));
+        assertThat(deviation.getResolvableStatus(), is(UNRESOLVED));
+    }
+
+    /**
+     * Checks deviation delete statement as sub-statement of module.
+     */
+    @Test
+    public void processDeviationDeleteStatement() throws IOException,
+            ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/" +
+                                                     "ValidDeviateDelete.yang");
+
+        assertThat((node instanceof YangModule), is(true));
+        assertThat(node.getNodeType(), is(MODULE_NODE));
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        YangDeviation deviation = (YangDeviation) yangNode.getChild();
+        assertThat(deviation.getName(), is("/base:system"));
+        assertThat(deviation.isDeviateNotSupported(), is(false));
+        List<YangAtomicPath> targetNode = deviation.getTargetNode();
+        assertThat(targetNode.get(0).getNodeIdentifier().getName(),
+                   is("system"));
+        assertThat(targetNode.get(0).getNodeIdentifier().getPrefix(),
+                   is("base"));
+
+        YangDeviateDelete deviateDelete = deviation.getDeviateDelete().get(0);
+        assertThat(deviateDelete.getUnits(), is("\"units\""));
+        assertThat(deviateDelete.getListOfMust().get(0).getConstraint(),
+                   is("daytime or time"));
+        assertThat(deviateDelete.getUniqueList().get(0), is("id"));
+        assertThat(deviateDelete.getDefaultValueInString(), is("defaultValue"));
+        assertThat(deviation.getResolvableStatus(), is(UNRESOLVED));
+    }
+
+    /**
+     * Checks deviation replace statement as sub-statement of module.
+     */
+    @Test
+    public void processDeviationReplaceStatement() throws IOException,
+            ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/" +
+                                                     "ValidDeviateReplace.yang");
+
+        assertThat((node instanceof YangModule), is(true));
+        assertThat(node.getNodeType(), is(MODULE_NODE));
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        YangDeviation deviation = (YangDeviation) yangNode.getChild();
+        assertThat(deviation.getName(), is("/base:system/base:name-server"));
+        assertThat(deviation.isDeviateNotSupported(), is(false));
+        List<YangAtomicPath> targetNode = deviation.getTargetNode();
+        assertThat(targetNode.get(0).getNodeIdentifier().getName(),
+                   is("system"));
+        assertThat(targetNode.get(0).getNodeIdentifier().getPrefix(),
+                   is("base"));
+        assertThat(targetNode.get(1).getNodeIdentifier().getName(),
+                   is("name-server"));
+
+        YangDeviateReplace replace = deviation.getDeviateReplace().get(0);
+        assertThat(replace.getDataType().getDataType(), is(INT8));
+        assertThat(replace.getUnits(), is("\"units\""));
+        assertThat(replace.getDefaultValueInString(), is("0"));
+        assertThat(replace.isConfig(), is(true));
+        assertThat(replace.isMandatory(), is(true));
+        assertThat(replace.getMinElements().getMinElement(), is(0));
+        assertThat(replace.getMaxElements().getMaxElement(), is(3));
+        assertThat(deviation.getResolvableStatus(), is(UNRESOLVED));
+    }
+
+    /**
+     * Checks deviation unsupported statement and deviate add as
+     * sub-statement of module.
+     */
+    @Test
+    public void processInvalidDeviateStatement() throws
+            IOException, ParserException {
+        String error = "YANG file error: Either deviate-not-supported-stmt or" +
+                " deviate-replace should be present in deviation" +
+                " /base:system/base:daytime";
+        thrown.expect(ParserException.class);
+        thrown.expectMessage(error);
+        YangNode node = manager.getDataModel("src/test/resources/InvalidDeviateStatement.yang");
+    }
+}
+
diff --git a/compiler/base/parser/src/test/resources/InvalidDeviateStatement.yang b/compiler/base/parser/src/test/resources/InvalidDeviateStatement.yang
new file mode 100644
index 0000000..9068050
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/InvalidDeviateStatement.yang
@@ -0,0 +1,19 @@
+module Test {
+    yang-version 1;
+    namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
+    prefix On;
+    deviation /base:system/base:daytime {
+        description "desc";
+        reference "ref";
+        deviate not-supported;
+        deviate replace {
+            type int8;
+            units "units";
+            default "0";
+            config "true";
+            mandatory "true";
+            min-elements 0;
+            max-elements 3;
+        }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/ValidDeviateAdd.yang b/compiler/base/parser/src/test/resources/ValidDeviateAdd.yang
new file mode 100644
index 0000000..7915d54
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ValidDeviateAdd.yang
@@ -0,0 +1,17 @@
+module Test {
+    yang-version 1;
+    namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
+    prefix On;
+    deviation /base:system/base:user/base:type {
+        deviate add {
+            units "units";
+            must "/base:system";
+            unique "id";
+            default "admin";
+            config "true";
+            mandatory "true";
+            min-elements "0";
+            max-elements "12343";
+        }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/ValidDeviateDelete.yang b/compiler/base/parser/src/test/resources/ValidDeviateDelete.yang
new file mode 100644
index 0000000..767f3de
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ValidDeviateDelete.yang
@@ -0,0 +1,13 @@
+module Test {
+    yang-version 1;
+    namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
+    prefix On;
+    deviation "/base:system" {
+        deviate delete {
+           units "units";
+           must "daytime or time";
+           unique "id";
+           default "defaultValue";
+        }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/ValidDeviateReplace.yang b/compiler/base/parser/src/test/resources/ValidDeviateReplace.yang
new file mode 100644
index 0000000..dc7f0fb
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ValidDeviateReplace.yang
@@ -0,0 +1,16 @@
+module Test {
+    yang-version 1;
+    namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
+    prefix On;
+    deviation /base:system/base:name-server {
+        deviate replace {
+            type int8;
+            units "units";
+            default "0";
+            config "true";
+            mandatory "true";
+            min-elements 0;
+            max-elements 3;
+        }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/ValidDeviationNotSupported.yang b/compiler/base/parser/src/test/resources/ValidDeviationNotSupported.yang
new file mode 100644
index 0000000..979f29f
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ValidDeviationNotSupported.yang
@@ -0,0 +1,10 @@
+module Test {
+    yang-version 1;
+    namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
+    prefix On;
+    deviation /base:system/base:daytime {
+        description "desc";
+        reference "ref";
+        deviate not-supported;
+    }
+}
diff --git a/compiler/base/tool/src/main/java/org/onosproject/yang/compiler/base/tool/YangToolManager.java b/compiler/base/tool/src/main/java/org/onosproject/yang/compiler/base/tool/YangToolManager.java
index 7378728..548511d 100644
--- a/compiler/base/tool/src/main/java/org/onosproject/yang/compiler/base/tool/YangToolManager.java
+++ b/compiler/base/tool/src/main/java/org/onosproject/yang/compiler/base/tool/YangToolManager.java
@@ -16,16 +16,17 @@
 
 package org.onosproject.yang.compiler.base.tool;
 
-import org.onosproject.yang.compiler.parser.YangUtilsParser;
-import org.onosproject.yang.compiler.parser.exceptions.ParserException;
-import org.onosproject.yang.compiler.parser.impl.YangUtilsParserManager;
 import org.onosproject.yang.compiler.base.tool.exception.YangToolException;
+import org.onosproject.yang.compiler.datamodel.YangDeviationHolder;
 import org.onosproject.yang.compiler.datamodel.YangNode;
 import org.onosproject.yang.compiler.datamodel.YangReferenceResolver;
 import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
 import org.onosproject.yang.compiler.linker.YangLinker;
 import org.onosproject.yang.compiler.linker.exceptions.LinkerException;
 import org.onosproject.yang.compiler.linker.impl.YangLinkerManager;
+import org.onosproject.yang.compiler.parser.YangUtilsParser;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.YangUtilsParserManager;
 import org.onosproject.yang.compiler.utils.io.YangPluginConfig;
 import org.slf4j.Logger;
 
@@ -302,7 +303,8 @@
         yangNodeSortedList.addAll(yangNodeSet);
         sort(yangNodeSortedList);
         for (YangNode node : yangNodeSortedList) {
-            if (node.isToTranslate()) {
+            if (node.isToTranslate() && !(!((YangDeviationHolder) node)
+                    .isModuleForDeviation())) {
                 generateJavaCode(node, pluginConfig);
             }
         }
diff --git a/compiler/base/utils/src/main/java/org/onosproject/yang/compiler/utils/UtilConstants.java b/compiler/base/utils/src/main/java/org/onosproject/yang/compiler/utils/UtilConstants.java
index 05073fc..bec4e2d 100644
--- a/compiler/base/utils/src/main/java/org/onosproject/yang/compiler/utils/UtilConstants.java
+++ b/compiler/base/utils/src/main/java/org/onosproject/yang/compiler/utils/UtilConstants.java
@@ -18,6 +18,7 @@
 
 import java.io.File;
 import java.util.Arrays;
+import java.util.Collections;
 import java.util.List;
 
 /**
@@ -1228,20 +1229,20 @@
      * List of keywords in java, this is used for checking if the input does not
      * contain these keywords.
      */
-    public static final List<String> JAVA_KEY_WORDS =
-            Arrays.asList("abstract", "assert", "boolean", "break", "byte",
-                          "case", "catch", "char", "class", "const", "continue",
-                          "default", "do", "double", "else", "extends", "false",
-                          "final", "finally", "float", "for", "goto", "if",
-                          "implements", "import", "instanceof", "enum", "int",
-                          "interface", "long", "native", "new", "null",
-                          "package", "private", "protected", "public", "return",
-                          "short", "static", "strictfp", "super", "switch",
-                          "synchronized", "this", "throw", "throws", "transient",
-                          "true", "try", "void", "volatile", "while", "list",
-                          "map", "arrayList", "hashMap", "linkedList", "notify",
-                          "notifyAll", "Method",
-                          "collections");
+    public static final List<String> JAVA_KEY_WORDS = Collections
+            .unmodifiableList(Arrays.asList("abstract", "assert", "boolean", "break", "byte",
+                                            "case", "catch", "char", "class", "const", "continue",
+                                            "default", "do", "double", "else", "extends", "false",
+                                            "final", "finally", "float", "for", "goto", "if",
+                                            "implements", "import", "instanceof", "enum", "int",
+                                            "interface", "long", "native", "new", "null",
+                                            "package", "private", "protected", "public", "return",
+                                            "short", "static", "strictfp", "super", "switch",
+                                            "synchronized", "this", "throw", "throws", "transient",
+                                            "true", "try", "void", "volatile", "while", "list",
+                                            "map", "arrayList", "hashMap", "linkedList", "notify",
+                                            "notifyAll", "Method",
+                                            "collections"));
 
     /**
      * Static attribute for regex for all the special characters.
@@ -1671,6 +1672,13 @@
             "compiler annotation ";
 
     /**
+     * Static attribute for compiler annotation resolve entity error
+     * information.
+     */
+    public static final String FAILED_TO_FIND_DEVIATION = "Failed to link " +
+            "deviation ";
+
+    /**
      * Static attribute for failed to link entity error information.
      */
     public static final String FAILED_TO_LINK = "Failed to link ";
diff --git a/compiler/plugin/maven/src/main/java/org/onosproject/yang/compiler/plugin/maven/YangUtilManager.java b/compiler/plugin/maven/src/main/java/org/onosproject/yang/compiler/plugin/maven/YangUtilManager.java
index a9d0ce0..903c705 100644
--- a/compiler/plugin/maven/src/main/java/org/onosproject/yang/compiler/plugin/maven/YangUtilManager.java
+++ b/compiler/plugin/maven/src/main/java/org/onosproject/yang/compiler/plugin/maven/YangUtilManager.java
@@ -25,6 +25,7 @@
 import org.apache.maven.plugins.annotations.Parameter;
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.rtinfo.RuntimeInformation;
+import org.onosproject.yang.compiler.datamodel.YangDeviationHolder;
 import org.onosproject.yang.compiler.parser.YangUtilsParser;
 import org.onosproject.yang.compiler.parser.exceptions.ParserException;
 import org.onosproject.yang.compiler.parser.impl.YangUtilsParserManager;
@@ -295,7 +296,7 @@
      * TODO: Delete me and use the tool code for UT test cases
      * Creates YANG nodes set.
      */
-    protected void createYangNodeSet() {
+    public void createYangNodeSet() {
         for (YangFileInfo yangFileInfo : yangFileInfoSet) {
             yangNodeSet.add(yangFileInfo.getRootNode());
         }
@@ -351,7 +352,8 @@
         yangNodeSortedList.addAll(yangNodeSet);
         sort(yangNodeSortedList);
         for (YangNode node : yangNodeSortedList) {
-            if (node.isToTranslate()) {
+            if (node.isToTranslate() && (!((YangDeviationHolder) node)
+                    .isModuleForDeviation())) {
                 JavaCodeGeneratorUtil.generateJavaCode(node, yangPlugin);
             }
         }
diff --git a/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/InterFileDeviationLinkingTest.java b/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/InterFileDeviationLinkingTest.java
new file mode 100644
index 0000000..e1cf83f
--- /dev/null
+++ b/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/InterFileDeviationLinkingTest.java
@@ -0,0 +1,551 @@
+/*
+ * 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.yang.compiler.plugin.maven;
+
+import org.junit.Test;
+import org.onosproject.yang.compiler.datamodel.YangAtomicPath;
+import org.onosproject.yang.compiler.datamodel.YangContainer;
+import org.onosproject.yang.compiler.datamodel.YangDeviateAdd;
+import org.onosproject.yang.compiler.datamodel.YangDeviateDelete;
+import org.onosproject.yang.compiler.datamodel.YangDeviateReplace;
+import org.onosproject.yang.compiler.datamodel.YangDeviation;
+import org.onosproject.yang.compiler.datamodel.YangLeaf;
+import org.onosproject.yang.compiler.datamodel.YangLeavesHolder;
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.linker.exceptions.LinkerException;
+import org.onosproject.yang.compiler.linker.impl.YangLinkerManager;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.translator.tojava.JavaFileInfoContainer;
+import org.onosproject.yang.compiler.translator.tojava.JavaFileInfoTranslator;
+import org.onosproject.yang.compiler.utils.io.YangPluginConfig;
+import org.onosproject.yang.compiler.utils.io.impl.YangFileScanner;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.List;
+
+import static org.hamcrest.CoreMatchers.nullValue;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.Is.is;
+import static org.onosproject.yang.compiler.datamodel.YangNodeType.MODULE_NODE;
+import static org.onosproject.yang.compiler.datamodel.YangStatusType.CURRENT;
+import static org.onosproject.yang.compiler.datamodel.utils.ResolvableStatus.UNRESOLVED;
+import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes.INT8;
+import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes.UINT16;
+import static org.onosproject.yang.compiler.linker.impl.YangLinkerUtils.updateFilePriority;
+import static org.onosproject.yang.compiler.utils.io.YangPluginConfig.compileCode;
+import static org.onosproject.yang.compiler.utils.io.impl.YangIoUtils.deleteDirectory;
+
+
+/**
+ * Unit test case for deviation linking.
+ */
+public class InterFileDeviationLinkingTest {
+
+    private static final String DIR = "target/deviationTest/";
+    private final YangUtilManager utilManager = new YangUtilManager();
+    private final YangLinkerManager yangLinkerManager = new YangLinkerManager();
+    private static final String COMP = System.getProperty("user.dir") + File
+            .separator + DIR;
+
+    /**
+     * Checks deviation not supported statement linking.
+     */
+    @Test
+    public void processDeviationNotSupportedLinking() throws IOException,
+            ParserException {
+
+        String searchDir = "src/test/resources/deviationLinking";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+
+        YangNode refNode = null;
+        YangNode selfNode = null;
+
+        // Create YANG node set
+        yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+
+        // Add references to import list.
+        yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
+
+        updateFilePriority(utilManager.getYangNodeSet());
+
+        Iterator<YangNode> yangNodeIterator = utilManager.getYangNodeSet().iterator();
+
+        while (yangNodeIterator.hasNext()) {
+            YangNode rootNode = yangNodeIterator.next();
+            if (rootNode.getName().equals("deviation-module")) {
+                selfNode = rootNode;
+            } else if (rootNode.getName().equals("Test2")) {
+                refNode = rootNode;
+            }
+        }
+
+        // Check whether the node type is set properly to module.
+        assertThat(selfNode.getNodeType(), is(MODULE_NODE));
+
+        // Check whether the deviation module info is set correctly after
+        // parsing.
+        YangModule yangNode = (YangModule) selfNode;
+        assertThat(yangNode.getName(), is("deviation-module"));
+
+        // Check whether the container is child of module
+        YangDeviation deviation = (YangDeviation) yangNode.getChild();
+        assertThat(deviation.getName(), is("/t:ospf"));
+        assertThat(deviation.getDescription(), is("\"desc\""));
+        assertThat(deviation.getReference(), is("\"ref\""));
+        assertThat(deviation.isDeviateNotSupported(), is(true));
+        List<YangAtomicPath> targetNode = deviation.getTargetNode();
+        assertThat(targetNode.get(0).getNodeIdentifier().getName(), is("ospf"));
+        assertThat(targetNode.get(0).getNodeIdentifier().getPrefix(), is("t"));
+        assertThat(deviation.getResolvableStatus(), is(UNRESOLVED));
+
+        // Check whether the base module - test information is set correctly.
+        YangModule yangRefNode = (YangModule) refNode;
+        assertThat(yangRefNode.getName(), is("Test2"));
+
+        YangNode ospfNode = yangRefNode.getChild();
+        assertThat(ospfNode.getName(), is("ospf"));
+
+        YangNode testValid = ospfNode.getNextSibling();
+        assertThat(testValid.getName(), is("valid"));
+
+        assertThat(testValid.getNextSibling(), nullValue());
+
+        // Carry out inter-file linking.
+        yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
+        YangPluginConfig yangPluginConfig = new YangPluginConfig();
+        yangPluginConfig.setCodeGenDir(DIR);
+        utilManager.translateToJava(yangPluginConfig);
+
+        compileCode(COMP);
+        deleteDirectory(DIR);
+
+        // Check whether the data model tree returned is of type module.
+        assertThat(selfNode instanceof YangModule, is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(selfNode.getNodeType(), is(MODULE_NODE));
+
+
+        // Check whether the module name is set correctly.
+        yangRefNode = (YangModule) refNode;
+        assertThat(yangRefNode.getName(), is("Test2"));
+
+        YangNode childNode2 = yangRefNode.getChild();
+        assertThat(childNode2.getName(), is("ospf"));
+
+        testValid = childNode2.getNextSibling();
+        assertThat(testValid.getName(), is("valid"));
+
+        // Check whether the module name is set correctly.
+        yangNode = (YangModule) selfNode;
+        assertThat(yangNode.getName(), is("deviation-module"));
+
+        YangNode deviationValid = yangNode.getChild().getNextSibling()
+                .getNextSibling();
+        assertThat(deviationValid.getName(), is("valid"));
+
+        List<YangLeaf> lisfOfLeaf = ((YangLeavesHolder) deviationValid).getListOfLeaf();
+        assertThat(lisfOfLeaf.isEmpty(), is(true));
+        assertThat(deviationValid.getNextSibling(), nullValue());
+
+        assertThat(testValid.getYangSchemaNodeIdentifier(), is
+                (deviationValid.getYangSchemaNodeIdentifier()));
+
+        JavaFileInfoTranslator deviateJavaFile = ((JavaFileInfoContainer)
+                deviationValid).getJavaFileInfo();
+
+        JavaFileInfoTranslator testJavaFile = ((JavaFileInfoContainer)
+                testValid).getJavaFileInfo();
+        assertThat(testJavaFile, is(deviateJavaFile));
+    }
+
+    /**
+     * Checks deviate add statement linking.
+     */
+    @Test
+    public void processDeviationAddLinking() throws IOException,
+            ParserException {
+
+        String searchDir = "src/test/resources/deviationLinking";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+
+        YangNode refNode = null;
+        YangNode selfNode = null;
+
+        // Create YANG node set
+        yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+
+        // Add references to import list.
+        yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
+
+        updateFilePriority(utilManager.getYangNodeSet());
+
+        Iterator<YangNode> yangNodeIterator = utilManager.getYangNodeSet().iterator();
+
+        while (yangNodeIterator.hasNext()) {
+            YangNode rootNode = yangNodeIterator.next();
+            if (rootNode.getName().equals("deviation-module2")) {
+                selfNode = rootNode;
+            } else if (rootNode.getName().equals("Test2")) {
+                refNode = rootNode;
+            }
+        }
+
+        // Check whether the node type is set properly to module.
+        assertThat(selfNode.getNodeType(), is(MODULE_NODE));
+
+        // Check whether the deviation module info is set correctly after
+        // parsing.
+        YangModule yangNode = (YangModule) selfNode;
+        assertThat(yangNode.getName(), is("deviation-module2"));
+
+        // Check whether the container is child of module
+        YangDeviation deviation = (YangDeviation) yangNode.getChild();
+        assertThat(deviation.getName(), is("/t:ospf"));
+        assertThat(deviation.getDescription(), is("\"desc\""));
+        assertThat(deviation.getReference(), is("\"ref\""));
+
+        List<YangAtomicPath> targetNode = deviation.getTargetNode();
+        assertThat(targetNode.get(0).getNodeIdentifier().getName(), is("ospf"));
+        assertThat(targetNode.get(0).getNodeIdentifier().getPrefix(), is("t"));
+
+        YangDeviateAdd deviateAdd = deviation.getDeviateAdd().get(0);
+        assertThat(deviateAdd.getListOfMust().get(0).getConstraint(),
+                   is("/base:system"));
+        assertThat(deviateAdd.isConfig(), is(false));
+        assertThat(deviation.getResolvableStatus(), is(UNRESOLVED));
+
+        // Check whether the base module - test information is set correctly.
+        YangModule yangRefNode = (YangModule) refNode;
+        assertThat(yangRefNode.getName(), is("Test2"));
+
+        YangNode ospfNode = yangRefNode.getChild();
+        assertThat(ospfNode.getName(), is("ospf"));
+        assertThat(((YangContainer) ospfNode).getListOfMust().isEmpty(), is(true));
+        assertThat(((YangContainer) ospfNode).isConfig(), is(true));
+
+        // Carry out inter-file linking.
+        yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
+
+        YangPluginConfig yangPluginConfig = new YangPluginConfig();
+        yangPluginConfig.setCodeGenDir(DIR);
+        utilManager.translateToJava(yangPluginConfig);
+
+        compileCode(COMP);
+        deleteDirectory(DIR);
+
+        // Check whether the data model tree returned is of type module.
+        assertThat(selfNode instanceof YangModule, is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(selfNode.getNodeType(), is(MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        yangNode = (YangModule) selfNode;
+        assertThat(yangNode.getName(), is("deviation-module2"));
+
+        YangContainer deviationValid = ((YangContainer) yangNode.getChild()
+                .getNextSibling()
+                .getNextSibling());
+        assertThat(deviationValid.getName(), is("ospf"));
+        assertThat(deviationValid.getListOfMust().get(0).getConstraint(),
+                   is("/base:system"));
+        assertThat(deviationValid.isConfig(), is(false));
+    }
+
+    /**
+     * Checks deviate delete statement linking.
+     */
+    @Test
+    public void processDeviationDeleteLinking() throws IOException,
+            ParserException {
+
+        String searchDir = "src/test/resources/deviationLinking";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+
+        YangNode refNode = null;
+        YangNode selfNode = null;
+
+        // Create YANG node set
+        yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+
+        // Add references to import list.
+        yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
+
+        updateFilePriority(utilManager.getYangNodeSet());
+
+        Iterator<YangNode> yangNodeIterator = utilManager.getYangNodeSet().iterator();
+
+        while (yangNodeIterator.hasNext()) {
+            YangNode rootNode = yangNodeIterator.next();
+            if (rootNode.getName().equals("deviation-module4")) {
+                selfNode = rootNode;
+            } else if (rootNode.getName().equals("Test2")) {
+                refNode = rootNode;
+            }
+        }
+
+        // Check whether the node type is set properly to module.
+        assertThat(selfNode.getNodeType(), is(MODULE_NODE));
+
+        // Check whether the deviation module info is set correctly after
+        // parsing.
+        YangModule yangNode = (YangModule) selfNode;
+        assertThat(yangNode.getName(), is("deviation-module4"));
+
+        // Check whether the container is child of module
+        YangDeviation deviation = (YangDeviation) yangNode.getChild();
+        assertThat(deviation.getName(), is("/t:ospf/t:process-id"));
+        assertThat(deviation.getDescription(), is("\"desc\""));
+        assertThat(deviation.getReference(), is("\"ref\""));
+
+        List<YangAtomicPath> targetNode = deviation.getTargetNode();
+        assertThat(targetNode.get(0).getNodeIdentifier().getName(), is("ospf"));
+        assertThat(targetNode.get(0).getNodeIdentifier().getPrefix(), is("t"));
+        assertThat(targetNode.get(1).getNodeIdentifier().getName(), is("process-id"));
+        assertThat(targetNode.get(1).getNodeIdentifier().getPrefix(), is("t"));
+
+        YangDeviateDelete delete = deviation.getDeviateDelete().get(0);
+        assertThat(delete.getUnits(), is("\"units\""));
+        assertThat(delete.getDefaultValueInString(), is("defaultValue"));
+        assertThat(deviation.getResolvableStatus(), is(UNRESOLVED));
+
+        // Check whether the base module - test information is set correctly.
+        YangModule yangRefNode = (YangModule) refNode;
+        assertThat(yangRefNode.getName(), is("Test2"));
+
+        YangNode ospfNode = yangRefNode.getChild();
+        assertThat(ospfNode.getName(), is("ospf"));
+        YangLeaf leaf = ((YangLeavesHolder) ospfNode).getListOfLeaf().get(0);
+        assertThat(leaf.getName(), is("process-id"));
+        assertThat(leaf.getDataType().getDataType(), is(UINT16));
+        assertThat(leaf.getUnits(), is("\"seconds\""));
+        assertThat(leaf.getStatus(), is(CURRENT));
+        assertThat(leaf.getReference(), is("\"RFC 6020\""));
+        assertThat(leaf.getDefaultValueInString(), is("1"));
+
+        // Carry out inter-file linking.
+        yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
+
+        YangPluginConfig yangPluginConfig = new YangPluginConfig();
+        yangPluginConfig.setCodeGenDir(DIR);
+        utilManager.translateToJava(yangPluginConfig);
+
+        compileCode(COMP);
+        deleteDirectory(DIR);
+
+        // Check whether the data model tree returned is of type module.
+        assertThat(selfNode instanceof YangModule, is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(selfNode.getNodeType(), is(MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        yangNode = (YangModule) selfNode;
+        assertThat(yangNode.getName(), is("deviation-module4"));
+
+        YangContainer ospf = (YangContainer) yangNode.getChild()
+                .getNextSibling();
+        assertThat(ospf.getName(), is("ospf"));
+
+        leaf = ospf.getListOfLeaf().get(0);
+        assertThat(leaf.getName(), is("process-id"));
+        assertThat(leaf.getDataType().getDataType(), is(UINT16));
+        assertThat(leaf.getUnits(), nullValue());
+        assertThat(leaf.getDefaultValueInString(), nullValue());
+    }
+
+    /**
+     * Checks deviate replace statement linking.
+     */
+    @Test
+    public void processDeviationReplaceLinking() throws IOException,
+            ParserException {
+
+        String searchDir = "src/test/resources/deviationLinking";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+
+        YangNode refNode = null;
+        YangNode selfNode = null;
+
+        // Create YANG node set
+        yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+
+        // Add references to import list.
+        yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
+
+        updateFilePriority(utilManager.getYangNodeSet());
+
+        Iterator<YangNode> yangNodeIterator = utilManager.getYangNodeSet().iterator();
+
+        while (yangNodeIterator.hasNext()) {
+            YangNode rootNode = yangNodeIterator.next();
+            if (rootNode.getName().equals("deviation-module3")) {
+                selfNode = rootNode;
+            } else if (rootNode.getName().equals("Test2")) {
+                refNode = rootNode;
+            }
+        }
+
+        // Check whether the node type is set properly to module.
+        assertThat(selfNode.getNodeType(), is(MODULE_NODE));
+
+        // Check whether the deviation module info is set correctly after
+        // parsing.
+        YangModule yangNode = (YangModule) selfNode;
+        assertThat(yangNode.getName(), is("deviation-module3"));
+
+        // Check whether the container is child of module
+        YangDeviation deviation = (YangDeviation) yangNode.getChild();
+        assertThat(deviation.getName(), is("/t:ospf/t:process-id"));
+        assertThat(deviation.getDescription(), is("\"desc\""));
+        assertThat(deviation.getReference(), is("\"ref\""));
+
+        List<YangAtomicPath> targetNode = deviation.getTargetNode();
+        assertThat(targetNode.get(0).getNodeIdentifier().getName(), is("ospf"));
+        assertThat(targetNode.get(0).getNodeIdentifier().getPrefix(), is("t"));
+        assertThat(targetNode.get(1).getNodeIdentifier().getName(), is("process-id"));
+        assertThat(targetNode.get(1).getNodeIdentifier().getPrefix(), is("t"));
+
+        YangDeviateReplace replace = deviation.getDeviateReplace().get(0);
+        assertThat(replace.getDataType().getDataType(), is(INT8));
+        assertThat(replace.getUnits(), is("\"units\""));
+        assertThat(replace.getDefaultValueInString(), is("0"));
+        assertThat(replace.isConfig(), is(true));
+        assertThat(replace.isMandatory(), is(true));
+        assertThat(replace.getMinElements().getMinElement(), is(0));
+        assertThat(replace.getMaxElements().getMaxElement(), is(3));
+        assertThat(deviation.getResolvableStatus(), is(UNRESOLVED));
+
+        // Check whether the base module - test information is set correctly.
+        YangModule yangRefNode = (YangModule) refNode;
+        assertThat(yangRefNode.getName(), is("Test2"));
+
+        YangNode ospfNode = yangRefNode.getChild();
+        assertThat(ospfNode.getName(), is("ospf"));
+        YangLeaf leaf = ((YangLeavesHolder) ospfNode).getListOfLeaf().get(0);
+        assertThat(leaf.getName(), is("process-id"));
+        assertThat(leaf.getDataType().getDataType(), is(UINT16));
+        assertThat(leaf.getUnits(), is("\"seconds\""));
+        assertThat(leaf.getStatus(), is(CURRENT));
+        assertThat(leaf.getReference(), is("\"RFC 6020\""));
+
+        // Carry out inter-file linking.
+        yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
+
+        YangPluginConfig yangPluginConfig = new YangPluginConfig();
+        yangPluginConfig.setCodeGenDir(DIR);
+        utilManager.translateToJava(yangPluginConfig);
+
+        compileCode(COMP);
+        deleteDirectory(DIR);
+
+        // Check whether the data model tree returned is of type module.
+        assertThat(selfNode instanceof YangModule, is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(selfNode.getNodeType(), is(MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        yangNode = (YangModule) selfNode;
+        assertThat(yangNode.getName(), is("deviation-module3"));
+
+        YangContainer ospf = (YangContainer) yangNode.getChild()
+                .getNextSibling();
+        assertThat(ospf.getName(), is("ospf"));
+
+        leaf = ospf.getListOfLeaf().get(0);
+        assertThat(leaf.getName(), is("process-id"));
+        assertThat(leaf.getDataType().getDataType(), is(INT8));
+        assertThat(leaf.getUnits(), is("\"units\""));
+        assertThat(leaf.getDefaultValueInString(), is("0"));
+        assertThat(leaf.isConfig(), is(true));
+        assertThat(leaf.isMandatory(), is(true));
+        assertThat(leaf.getStatus(), is(CURRENT));
+        assertThat(leaf.getReference(), is("\"RFC 6020\""));
+    }
+
+    /**
+     * Checks whether exception is thrown when deviation target is invalid.
+     */
+    @Test(expected = LinkerException.class)
+    public void processDeviationInvalidTarget() throws IOException,
+            ParserException {
+
+        String searchDir = "src/test/resources/InvalidDeviation";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+
+        YangNode selfNode = null;
+
+        // Create YANG node set
+        yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+
+        // Add references to import list.
+        yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
+
+        updateFilePriority(utilManager.getYangNodeSet());
+
+        Iterator<YangNode> yangNodeIterator = utilManager.getYangNodeSet().iterator();
+
+        while (yangNodeIterator.hasNext()) {
+            YangNode rootNode = yangNodeIterator.next();
+            if (rootNode.getName().equals("deviation-module5")) {
+                selfNode = rootNode;
+            }
+        }
+
+        // Check whether the node type is set properly to module.
+        assertThat(selfNode.getNodeType(), is(MODULE_NODE));
+
+        // Check whether the deviation module info is set correctly after
+        // parsing.
+        YangModule yangNode = (YangModule) selfNode;
+        assertThat(yangNode.getName(), is("deviation-module5"));
+
+        // Check whether the container is child of module
+        YangDeviation deviation = (YangDeviation) yangNode.getChild();
+        assertThat(deviation.getName(), is("/t:ospf/t:intf-id"));
+        assertThat(deviation.getDescription(), is("\"desc\""));
+        assertThat(deviation.getReference(), is("\"ref\""));
+
+        List<YangAtomicPath> targetNode = deviation.getTargetNode();
+        assertThat(targetNode.get(0).getNodeIdentifier().getName(), is("ospf"));
+        assertThat(targetNode.get(0).getNodeIdentifier().getPrefix(), is("t"));
+        assertThat(targetNode.get(1).getNodeIdentifier().getName(), is("intf-id"));
+        assertThat(targetNode.get(1).getNodeIdentifier().getPrefix(), is("t"));
+
+        // Carry out inter-file linking.
+        yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
+
+        YangPluginConfig yangPluginConfig = new YangPluginConfig();
+        yangPluginConfig.setCodeGenDir(DIR);
+        utilManager.translateToJava(yangPluginConfig);
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/InvalidDeviation/InvalidDeviationTarget.yang b/compiler/plugin/maven/src/test/resources/InvalidDeviation/InvalidDeviationTarget.yang
new file mode 100644
index 0000000..eff4726
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/InvalidDeviation/InvalidDeviationTarget.yang
@@ -0,0 +1,16 @@
+module deviation-module5 {
+    yang-version 1;
+    namespace test:deviation5;
+    prefix On;
+    import "target" {
+        prefix "t";
+    }
+    deviation /t:ospf/t:intf-id {
+        description "desc";
+        reference "ref";
+         deviate delete {
+           units "units";
+           default "defaultValue";
+         }
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/InvalidDeviation/deviationTarget.yang b/compiler/plugin/maven/src/test/resources/InvalidDeviation/deviationTarget.yang
new file mode 100644
index 0000000..cddfd0c
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/InvalidDeviation/deviationTarget.yang
@@ -0,0 +1,14 @@
+module target {
+    yang-version 1;
+    namespace "test:deviation";
+    prefix test;
+    container ospf {
+        leaf process-id {
+            type "uint16";
+            units "seconds";
+            status current;
+            reference "RFC 6020";
+            default "1";
+         }
+    }
+}
\ No newline at end of file
diff --git a/compiler/plugin/maven/src/test/resources/deviationLinking/DeviationAddStatement.yang b/compiler/plugin/maven/src/test/resources/deviationLinking/DeviationAddStatement.yang
new file mode 100644
index 0000000..5aa8ba5
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/deviationLinking/DeviationAddStatement.yang
@@ -0,0 +1,22 @@
+module deviation-module2 {
+    yang-version 1;
+    namespace test:deviation2;
+    prefix On;
+    import "Test2" {
+        prefix "t";
+    }
+    deviation /t:ospf {
+        description "desc";
+        reference "ref";
+         deviate add {
+            must "/base:system";
+            config "false";
+         }
+    }
+
+    deviation /t:valid/t:invalid-interval {
+            description "desc";
+            reference "ref";
+            deviate not-supported;
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/deviationLinking/DeviationDeleteStatement.yang b/compiler/plugin/maven/src/test/resources/deviationLinking/DeviationDeleteStatement.yang
new file mode 100644
index 0000000..e129726
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/deviationLinking/DeviationDeleteStatement.yang
@@ -0,0 +1,16 @@
+module deviation-module4 {
+    yang-version 1;
+    namespace test:deviation4;
+    prefix On;
+    import "Test2" {
+        prefix "t";
+    }
+    deviation /t:ospf/t:process-id {
+        description "desc";
+        reference "ref";
+         deviate delete {
+           units "units";
+           default "defaultValue";
+         }
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/deviationLinking/DeviationNotSupported.yang b/compiler/plugin/maven/src/test/resources/deviationLinking/DeviationNotSupported.yang
new file mode 100644
index 0000000..3cce4c5
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/deviationLinking/DeviationNotSupported.yang
@@ -0,0 +1,19 @@
+module deviation-module {
+    yang-version 1;
+    namespace test:deviation;
+    prefix On;
+    import "Test2" {
+        prefix "t";
+    }
+    deviation /t:ospf {
+        description "desc";
+        reference "ref";
+        deviate not-supported;
+    }
+
+    deviation /t:valid/t:invalid-interval {
+            description "desc";
+            reference "ref";
+            deviate not-supported;
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/deviationLinking/DeviationReplaceStatement.yang b/compiler/plugin/maven/src/test/resources/deviationLinking/DeviationReplaceStatement.yang
new file mode 100644
index 0000000..6ed6545
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/deviationLinking/DeviationReplaceStatement.yang
@@ -0,0 +1,21 @@
+module deviation-module3 {
+    yang-version 1;
+    namespace test:deviation3;
+    prefix On;
+    import "Test2" {
+        prefix "t";
+    }
+    deviation /t:ospf/t:process-id {
+        description "desc";
+        reference "ref";
+         deviate replace {
+            type int8;
+            units "units";
+            default "0";
+            config "true";
+            mandatory "true";
+            min-elements 0;
+            max-elements 3;
+         }
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/deviationLinking/DeviationTarget.yang b/compiler/plugin/maven/src/test/resources/deviationLinking/DeviationTarget.yang
new file mode 100644
index 0000000..e072c08
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/deviationLinking/DeviationTarget.yang
@@ -0,0 +1,23 @@
+module Test2 {
+    yang-version 1;
+    namespace "test2:deviation";
+    prefix test;
+    container ospf {
+        leaf process-id {
+            type "uint16";
+            units "seconds";
+            status current;
+            reference "RFC 6020";
+            default "1";
+         }
+    }
+
+    container valid {
+        leaf invalid-interval {
+            type "uint16";
+            units "seconds";
+            status current;
+            reference "RFC 6020";
+         }
+    }
+}
\ No newline at end of file