diff --git a/utils/yangutils/datamodel/pom.xml b/utils/yangutils/datamodel/pom.xml
new file mode 100644
index 0000000..9fb30d1
--- /dev/null
+++ b/utils/yangutils/datamodel/pom.xml
@@ -0,0 +1,35 @@
+<!--
+  ~ 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.
+  -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.onosproject</groupId>
+        <artifactId>onos-yangutils</artifactId>
+        <version>1.7.0-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <artifactId>yangutils-datamodel</artifactId>
+    <version>1.7.0-SNAPSHOT</version>
+    <name>onos-yang-utils-datamodel</name>
+    <packaging>jar</packaging>
+
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    </properties>
+</project>
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/CollisionDetector.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/CollisionDetector.java
new file mode 100644
index 0000000..ad6a904
--- /dev/null
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/CollisionDetector.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yangutils.datamodel;
+
+import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
+import org.onosproject.yangutils.datamodel.utils.YangConstructType;
+
+/**
+ * Abstraction of YANG collision function. Abstracted to unify the collision
+ * detection functionality.
+ */
+public interface CollisionDetector {
+    /**
+     * Checks for the colliding child.
+     *
+     * @param identifierName name of identifier for which collision to be
+     * checked
+     * @param dataType type of the YANG construct for which collision to be
+     * checked
+     * @throws DataModelException if there is any collision in YANG rules in
+     *             parsed data, corresponding exception should be thrown
+     */
+    void detectCollidingChild(String identifierName, YangConstructType dataType)
+            throws DataModelException;
+
+    /**
+     * Check for the self collision.
+     *
+     * @param identifierName name of identifier for which collision to be
+     * checked
+     * @param dataType type of the YANG construct for which collision to be
+     * checked
+     * @throws DataModelException if there is any collision in YANG rules in
+     *                            parsed data, corresponding exception should be thrown
+     */
+    void detectSelfCollision(String identifierName, YangConstructType dataType)
+            throws DataModelException;
+}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/LocationInfo.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/LocationInfo.java
new file mode 100644
index 0000000..edd8849
--- /dev/null
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/LocationInfo.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yangutils.datamodel;
+
+/**
+ * Abstraction of location information, this is used during resolution is
+ * carried out and line/character position in line is required to point
+ * out the error location in YANG file.
+ */
+public interface LocationInfo {
+
+    /**
+     * Returns the line number YANG construct in file.
+     *
+     * @return the line number YANG construct in file
+     */
+    int getLineNumber();
+
+    /**
+     * Returns the character position in line.
+     *
+     * @return the character position in line
+     */
+    int getCharPosition();
+
+    /**
+     * Sets line number of YANG construct.
+     *
+     * @param lineNumber the line number of YANG construct in file
+     */
+    void setLineNumber(int lineNumber);
+
+    /**
+     * Sets character position of YANG construct.
+     *
+     * @param charPositionInLine character position of YANG construct in file
+     */
+    void setCharPosition(int charPositionInLine);
+}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/Resolvable.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/Resolvable.java
new file mode 100644
index 0000000..571873b
--- /dev/null
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/Resolvable.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yangutils.datamodel;
+
+import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
+import org.onosproject.yangutils.datamodel.utils.ResolvableStatus;
+
+/**
+ * Abstraction of YANG resolvable information. Abstracted to obtain the
+ * information required for linking resolution.
+ */
+public interface Resolvable {
+
+    /**
+     * Returns the status of resolution. If completely resolved returns enum
+     * value "RESOLVED", if not returns "UNRESOLVED", in case reference of
+     * grouping/typedef is added to uses/type but it's not resolved
+     * "INTRA_FILE_RESOLVED" is returned.
+     *
+     * @return status of resolution
+     */
+    ResolvableStatus getResolvableStatus();
+
+    /**
+     * Set the status of type/uses resolution. If completely resolved set enum
+     * value "RESOLVED", if not set it to "UNRESOLVED", in case reference of
+     * grouping/typedef is added to uses/type but it's not resolved
+     * "INTRA_FILE_RESOLVED" should be set.
+     *
+     * @param resolvableStatus status of resolution
+     */
+    void setResolvableStatus(ResolvableStatus resolvableStatus);
+
+    /**
+     * Resolves the linking.
+     *
+     * @throws DataModelException data model exception
+     */
+    void resolve()
+            throws DataModelException;
+}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/ResolvableType.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/ResolvableType.java
new file mode 100644
index 0000000..9521f41
--- /dev/null
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/ResolvableType.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yangutils.datamodel;
+
+/**
+ * Type of the resolvable info.
+ */
+public enum ResolvableType {
+
+    /**
+     * Identifies the derived data type.
+     */
+    YANG_DERIVED_DATA_TYPE,
+
+    /**
+     * Identifies the uses.
+     */
+    YANG_USES
+}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/RpcNotificationContainer.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/RpcNotificationContainer.java
new file mode 100644
index 0000000..2d29f9e
--- /dev/null
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/RpcNotificationContainer.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yangutils.datamodel;
+
+/**
+ * Represents class having rpc and notification.
+ */
+public interface RpcNotificationContainer {
+}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangAppErrorInfo.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangAppErrorInfo.java
new file mode 100644
index 0000000..671aa08
--- /dev/null
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangAppErrorInfo.java
@@ -0,0 +1,48 @@
+/*Copyright 2016.year Open Networking Laboratory
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.*/
+package org.onosproject.yangutils.datamodel;
+
+/**
+ * Abstraction of error message and application info processing.
+ */
+public interface YangAppErrorInfo {
+
+    /**
+     * Returns the application's error message for data error.
+     *
+     * @return application's error message for data error.
+     */
+    String getGetErrorMessage();
+
+    /**
+     * Sets the application's error message for data error.
+     *
+     * @param errorMessage application's error message for data error.
+     */
+    void setErrorMessage(String errorMessage);
+
+    /**
+     * Returns the application's error tag for data error.
+     *
+     * @return application's error tag for data error.
+     */
+    String getGetErrorAppTag();
+
+    /**
+     * Sets the application's error tag for data error.
+     *
+     * @param errorMessage application's error tag for data error.
+     */
+    void setErrorAppTag(String errorMessage);
+}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangAugment.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangAugment.java
new file mode 100644
index 0000000..84f0173
--- /dev/null
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangAugment.java
@@ -0,0 +1,344 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.yangutils.datamodel;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
+import org.onosproject.yangutils.datamodel.utils.Parsable;
+import org.onosproject.yangutils.datamodel.utils.YangConstructType;
+
+import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.detectCollidingChildUtil;
+
+/*-
+ * Reference RFC 6020.
+ *
+ * The "augment" statement allows a module or submodule to add to the
+ *  schema tree defined in an external module, or the current module and
+ *  its submodules, and to add to the nodes from a grouping in a "uses"
+ *  statement.  The argument is a string that identifies a node in the
+ *  schema tree.  This node is called the augment's target node.  The
+ *  target node MUST be either a container, list, choice, case, input,
+ *  output, or notification node.  It is augmented with the nodes defined
+ *  in the sub-statements that follow the "augment" statement.
+ *
+ *  The argument string is a schema node identifier.
+ *  If the "augment" statement is on the top level in a module or
+ *  submodule, the absolute form of a schema node identifier
+ *  MUST be used.  If the "augment" statement is a sub-statement to the
+ *  "uses" statement, the descendant form MUST be used.
+ *
+ *  If the target node is a container, list, case, input, output, or
+ *  notification node, the "container", "leaf", "list", "leaf-list",
+ *  "uses", and "choice" statements can be used within the "augment"
+ *  statement.
+ *
+ *  If the target node is a choice node, the "case" statement, or a case
+ *  shorthand statement can be used within the "augment" statement.
+ *
+ *   If the target node is in another module, then nodes added by the
+ *  augmentation MUST NOT be mandatory nodes.
+ *
+ *  The "augment" statement MUST NOT add multiple nodes with the same
+ *  name from the same module to the target node.
+ *  The augment's sub-statements
+ *
+ *                +--------------+---------+-------------+------------------+
+ *                | substatement | section | cardinality |data model mapping|
+ *                +--------------+---------+-------------+------------------+
+ *                | anyxml       | 7.10    | 0..n        |-not supported    |
+ *                | case         | 7.9.2   | 0..n        |-child nodes      |
+ *                | choice       | 7.9     | 0..n        |-child nodes      |
+ *                | container    | 7.5     | 0..n        |-child nodes      |
+ *                | description  | 7.19.3  | 0..1        |-string           |
+ *                | if-feature   | 7.18.2  | 0..n        |-TODO             |
+ *                | leaf         | 7.6     | 0..n        |-YangLeaf         |
+ *                | leaf-list    | 7.7     | 0..n        |-YangLeafList     |
+ *                | list         | 7.8     | 0..n        |-child nodes      |
+ *                | reference    | 7.19.4  | 0..1        |-String           |
+ *                | status       | 7.19.2  | 0..1        |-YangStatus       |
+ *                | uses         | 7.12    | 0..n        |-child nodes      |
+ *                | when         | 7.19.5  | 0..1        |-TODO             |
+ *                +--------------+---------+-------------+------------------+
+ */
+
+/**
+ * Representation of data model node to maintain information defined in YANG augment.
+ */
+public class YangAugment
+        extends YangNode
+        implements YangLeavesHolder, YangCommonInfo, Parsable, CollisionDetector {
+
+    private static final long serialVersionUID = 806201602L;
+
+    /**
+     * Augment target node.
+     */
+    private String name;
+
+    /**
+     * Description of augment.
+     */
+    private String description;
+
+    /**
+     * List of leaves.
+     */
+    private List<YangLeaf> listOfLeaf;
+
+    /**
+     * List of leaf-lists.
+     */
+    private List<YangLeafList> listOfLeafList;
+
+    /**
+     * List of node identifiers.
+     */
+    private List<YangNodeIdentifier> targetNode;
+
+    /**
+     * Reference of the YANG augment.
+     */
+    private String reference;
+
+    /**
+     * Status of the node.
+     */
+    private YangStatusType status;
+
+    /**
+     * Create a YANG augment node.
+     */
+    public YangAugment() {
+        super(YangNodeType.AUGMENT_NODE);
+    }
+
+    /**
+     * Returns the augmented node.
+     *
+     * @return the augmented node
+     */
+    public List<YangNodeIdentifier> getTargetNode() {
+        return targetNode;
+    }
+
+    /**
+     * Sets the augmented node.
+     *
+     * @param nodeIdentifiers the augmented node
+     */
+    public void setTargetNode(List<YangNodeIdentifier> nodeIdentifiers) {
+        targetNode = nodeIdentifiers;
+    }
+
+    /**
+     * 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 void detectCollidingChild(String identifierName, YangConstructType dataType)
+            throws DataModelException {
+        // Detect colliding child.
+        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() + "\"");
+        }
+    }
+
+    /**
+     * Returns the list of leaves.
+     *
+     * @return the list of leaves
+     */
+    @Override
+    public List<YangLeaf> getListOfLeaf() {
+        return listOfLeaf;
+    }
+
+    /**
+     * Sets the list of leaves.
+     *
+     * @param leafsList the list of leaf to set
+     */
+    @Override
+    public void setListOfLeaf(List<YangLeaf> leafsList) {
+        listOfLeaf = leafsList;
+    }
+
+    /**
+     * Adds a leaf.
+     *
+     * @param leaf the leaf to be added
+     */
+    @Override
+    public void addLeaf(YangLeaf leaf) {
+        if (getListOfLeaf() == null) {
+            setListOfLeaf(new LinkedList<YangLeaf>());
+        }
+
+        getListOfLeaf().add(leaf);
+    }
+
+    /**
+     * Returns the list of leaf-list.
+     *
+     * @return the list of leaf-list
+     */
+    @Override
+    public List<YangLeafList> getListOfLeafList() {
+        return listOfLeafList;
+    }
+
+    /**
+     * Sets the list of leaf-list.
+     *
+     * @param listOfLeafList the list of leaf-list to set
+     */
+    @Override
+    public void setListOfLeafList(List<YangLeafList> listOfLeafList) {
+        this.listOfLeafList = listOfLeafList;
+    }
+
+    /**
+     * Adds a leaf-list.
+     *
+     * @param leafList the leaf-list to be added
+     */
+    @Override
+    public void addLeafList(YangLeafList leafList) {
+        if (getListOfLeafList() == null) {
+            setListOfLeafList(new LinkedList<YangLeafList>());
+        }
+
+        getListOfLeafList().add(leafList);
+    }
+
+    /**
+     * 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 status.
+     *
+     * @return the status
+     */
+    @Override
+    public YangStatusType getStatus() {
+        return status;
+    }
+
+    /**
+     * Sets the status.
+     *
+     * @param status the status to set
+     */
+    @Override
+    public void setStatus(YangStatusType status) {
+        this.status = status;
+    }
+
+    /**
+     * Returns the type of the data as belongs-to.
+     *
+     * @return returns AUGMENT_DATA
+     */
+    @Override
+    public YangConstructType getYangConstructType() {
+        return YangConstructType.AUGMENT_DATA;
+    }
+
+    /**
+     * Validates the data on entering the corresponding parse tree node.
+     *
+     * @throws DataModelException a violation of data model rules
+     */
+    @Override
+    public void validateDataOnEntry()
+            throws DataModelException {
+        // TODO auto-generated method stub, to be implemented by parser
+    }
+
+    /**
+     * Validates the data on exiting the corresponding parse tree node.
+     *
+     * @throws DataModelException a violation of data model rules
+     */
+    @Override
+    public void validateDataOnExit()
+            throws DataModelException {
+        // TODO auto-generated method stub, to be implemented by parser
+    }
+
+    /**
+     * Returns the target nodes name where the augmentation is being done.
+     *
+     * @return target nodes name where the augmentation is being done
+     */
+    @Override
+    public String getName() {
+        return name;
+    }
+
+    /**
+     * Sets the target nodes name where the augmentation is being done.
+     *
+     * @param name target nodes name where the augmentation is being done
+     */
+    @Override
+    public void setName(String name) {
+        this.name = name;
+    }
+
+}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangAugmentationHolder.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangAugmentationHolder.java
new file mode 100644
index 0000000..aa2b678
--- /dev/null
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangAugmentationHolder.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yangutils.datamodel;
+
+/**
+ * Represents YANG constructs which can be augmented.
+ */
+public interface YangAugmentationHolder {
+}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangBelongsTo.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangBelongsTo.java
new file mode 100644
index 0000000..9cb8dde
--- /dev/null
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangBelongsTo.java
@@ -0,0 +1,219 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.yangutils.datamodel;
+
+import java.io.Serializable;
+import java.util.Set;
+
+import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
+import org.onosproject.yangutils.datamodel.utils.Parsable;
+import org.onosproject.yangutils.datamodel.utils.YangConstructType;
+
+import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.findReferredNode;
+
+/*-
+ *   Reference 6020.
+ *
+ *  The "belongs-to" statement specifies the module to which the
+ *  submodule belongs.  The argument is an identifier that is the name of
+ *  the module.
+ *
+ *  A submodule MUST only be included by the module to which it belongs,
+ *  or by another submodule that belongs to that module.
+ *
+ *  The mandatory "prefix" sub-statement assigns a prefix for the module
+ *  to which the submodule belongs.  All definitions in the local
+ *  submodule and any included submodules can be accessed by using the
+ *  prefix.
+ *
+ *  The belongs-to's sub-statements
+ *
+ *                +--------------+---------+-------------+
+ *                | substatement | section | cardinality |
+ *                +--------------+---------+-------------+
+ *                | prefix       | 7.1.4   | 1           |
+ *                +--------------+---------+-------------+
+ */
+
+/**
+ * Represents the belongs-to data type information.
+ */
+public class YangBelongsTo implements Parsable, LocationInfo, Serializable {
+
+    private static final long serialVersionUID = 806201639L;
+
+    /**
+     * Reference RFC 6020.
+     *
+     * The "belongs-to" statement specifies the module to which the submodule
+     * belongs. The argument is an identifier that is the name of the module.
+     */
+    private String belongsToModuleName;
+
+    /**
+     * Module node to which sub-module belongs to.
+     */
+    private YangNode moduleNode;
+
+    /**
+     * Reference RFC 6020.
+     *
+     * The mandatory "prefix" substatement assigns a prefix for the module to
+     * which the submodule belongs. All definitions in the local submodule and
+     * any included submodules can be accessed by using the prefix.
+     */
+    private String prefix;
+
+    // Error Line number.
+    private transient int lineNumber;
+
+    // Error character position.
+    private transient int charPosition;
+
+    /**
+     * Create a belongs to object.
+     */
+    public YangBelongsTo() {
+
+    }
+
+    /**
+     * Returns the belongs to module name.
+     *
+     * @return the belongs to module name
+     */
+    public String getBelongsToModuleName() {
+        return belongsToModuleName;
+    }
+
+    /**
+     * Sets the belongs to module name.
+     *
+     * @param belongsToModuleName the belongs to module name to set
+     */
+    public void setBelongsToModuleName(String belongsToModuleName) {
+        this.belongsToModuleName = belongsToModuleName;
+    }
+
+    /**
+     * Returns the prefix.
+     *
+     * @return the prefix
+     */
+    public String getPrefix() {
+        return prefix;
+    }
+
+    /**
+     * Sets the prefix.
+     *
+     * @param prefix the prefix to set
+     */
+    public void setPrefix(String prefix) {
+        this.prefix = prefix;
+    }
+
+    /**
+     * Returns the module data model node.
+     *
+     * @return the module data model node
+     */
+    public YangNode getModuleNode() {
+        return moduleNode;
+    }
+
+    /**
+     * Sets the module node.
+     *
+     * @param moduleNode module data model node
+     */
+    public void setModuleNode(YangNode moduleNode) {
+        this.moduleNode = moduleNode;
+    }
+
+    /**
+     * Returns the type of the data as belongs-to.
+     *
+     * @return ParsedDataType returns BELONGS_TO_DATA
+     */
+    @Override
+    public YangConstructType getYangConstructType() {
+        return YangConstructType.BELONGS_TO_DATA;
+    }
+
+    /**
+     * Validates the data on entering the corresponding parse tree node.
+     *
+     * @throws DataModelException a violation of data model rules
+     */
+    @Override
+    public void validateDataOnEntry() throws DataModelException {
+        // TODO auto-generated method stub, to be implemented by parser
+    }
+
+    /**
+     * Validates the data on exiting the corresponding parse tree node.
+     *
+     * @throws DataModelException a violation of data model rules
+     */
+    @Override
+    public void validateDataOnExit() throws DataModelException {
+        // TODO auto-generated method stub, to be implemented by parser
+    }
+
+    @Override
+    public int getLineNumber() {
+        return lineNumber;
+    }
+
+    @Override
+    public int getCharPosition() {
+        return charPosition;
+    }
+
+    @Override
+    public void setLineNumber(int lineNumber) {
+        this.lineNumber = lineNumber;
+    }
+
+    @Override
+    public void setCharPosition(int charPositionInLine) {
+        charPosition = charPositionInLine;
+    }
+
+    /**
+     * Links the belongs to with a module.
+     *
+     * @param yangNodeSet YANG file information set
+     * @throws DataModelException a violation in data model rule
+     */
+    public void linkWithModule(Set<YangNode> yangNodeSet)
+            throws DataModelException {
+        String belongsToModuleName = getBelongsToModuleName();
+        YangNode moduleNode = findReferredNode(yangNodeSet, belongsToModuleName);
+        if (moduleNode != null) {
+            if (moduleNode instanceof YangModule) {
+                setModuleNode(moduleNode);
+                return;
+            }
+        }
+        DataModelException exception = new DataModelException("YANG file error : Module " + belongsToModuleName +
+                "to which sub-module belongs to is not found.");
+        exception.setLine(getLineNumber());
+        exception.setCharPosition(getCharPosition());
+        throw exception;
+    }
+}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangBit.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangBit.java
new file mode 100644
index 0000000..5db6b54
--- /dev/null
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangBit.java
@@ -0,0 +1,229 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yangutils.datamodel;
+
+import java.io.Serializable;
+import java.util.Objects;
+
+import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
+import org.onosproject.yangutils.datamodel.utils.Parsable;
+import org.onosproject.yangutils.datamodel.utils.YangConstructType;
+
+/*-
+ *  The "bit" statement, which is a sub-statement to the "type" statement,
+ *  MUST be present if the type is "bits".  It is repeatedly used to
+ *  specify each assigned named bit of a bits type.  It takes as an
+ *  argument a string that is the assigned name of the bit.  It is
+ *  followed by a block of sub-statements that holds detailed bit
+ *  information.
+ *  All assigned names in a bits type MUST be unique.
+ *
+ *  The bit's sub-statements
+ *
+ *                +--------------+---------+-------------+------------------+
+ *                | substatement | section | cardinality |data model mapping|
+ *                +--------------+---------+-------------+------------------+
+ *                | description  | 7.19.3  | 0..1        | - string         |
+ *                | reference    | 7.19.4  | 0..1        | - string         |
+ *                | status       | 7.19.2  | 0..1        | - YangStatus     |
+ *                | position     | 9.7.4.2 | 0..1        | - int            |
+ *                +--------------+---------+-------------+------------------+
+ */
+
+/**
+ * Represents the bit data type information.
+ */
+public class YangBit implements YangCommonInfo, Parsable, Serializable {
+
+    private static final long serialVersionUID = 806201640L;
+
+    /**
+     * Name of the bit.
+     */
+    private String bitName;
+
+    /**
+     * Description of the bit field.
+     */
+    private String description;
+
+    /**
+     * Reference info of the bit field.
+     */
+    private String reference;
+
+    /**
+     * Status of the bit field.
+     */
+    private YangStatusType status;
+
+    /**
+     * Position of the bit whose name bit is described.
+     */
+    private int position;
+
+    /**
+     * Create a YANG bit type object.
+     */
+    public YangBit() {
+
+    }
+
+    /**
+     * Returns bit name.
+     *
+     * @return the bit name
+     */
+    public String getBitName() {
+        return bitName;
+    }
+
+    /**
+     * Sets the bit name.
+     *
+     * @param bitName the bit name to set
+     */
+    public void setBitName(String bitName) {
+        this.bitName = bitName;
+    }
+
+    /**
+     * Returns description.
+     *
+     * @return the description
+     */
+    @Override
+    public String getDescription() {
+        return description;
+    }
+
+    /**
+     * Sets the description.
+     *
+     * @param description set the description
+     */
+    @Override
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    /**
+     * Returns 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 status.
+     *
+     * @return the status
+     */
+    @Override
+    public YangStatusType getStatus() {
+        return status;
+    }
+
+    /**
+     * Sets the status.
+     *
+     * @param status the status to set
+     */
+    @Override
+    public void setStatus(YangStatusType status) {
+        this.status = status;
+    }
+
+    /**
+     * Returns bit position.
+     *
+     * @return the position
+     */
+    public int getPosition() {
+        return position;
+    }
+
+    /**
+     * Sets the bit position.
+     *
+     * @param position the position to set
+     */
+    public void setPosition(int position) {
+        this.position = position;
+    }
+
+    /**
+     * Returns the type of the data.
+     *
+     * @return ParsedDataType returns BIT_DATA
+     */
+    @Override
+    public YangConstructType getYangConstructType() {
+        return YangConstructType.BIT_DATA;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+
+        if (this == obj) {
+            return true;
+        }
+        if (obj instanceof YangBit) {
+            final YangBit other = (YangBit) obj;
+            return Objects.equals(bitName, other.bitName);
+        }
+        return false;
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hashCode(bitName);
+    }
+
+    /**
+     * Validates the data on entering the corresponding parse tree node.
+     *
+     * @throws DataModelException a violation of data model rules
+     */
+    @Override
+    public void validateDataOnEntry() throws DataModelException {
+        // TODO auto-generated method stub, to be implemented by parser
+    }
+
+    /**
+     * Validates the data on exiting the corresponding parse tree node.
+     *
+     * @throws DataModelException a violation of data model rules
+     */
+    @Override
+    public void validateDataOnExit() throws DataModelException {
+        // TODO auto-generated method stub, to be implemented by parser
+    }
+}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangBits.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangBits.java
new file mode 100644
index 0000000..84076dd
--- /dev/null
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangBits.java
@@ -0,0 +1,133 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yangutils.datamodel;
+
+import java.io.Serializable;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
+import org.onosproject.yangutils.datamodel.utils.Parsable;
+import org.onosproject.yangutils.datamodel.utils.YangConstructType;
+
+/*
+ * Reference RFC 6020.
+ *
+ * The bits built-in type represents a bit set.  That is, a bits value
+ * is a set of flags identified by small integer position numbers
+ * starting at 0.  Each bit number has an assigned name.
+ */
+
+/**
+ * Represents the bits data type information.
+ */
+public class YangBits implements Parsable, Serializable {
+
+    private static final long serialVersionUID = 806201641L;
+
+    // Bits information set.
+    private Set<YangBit> bitSet;
+
+    // BITS name.
+    private String bitsName;
+
+    /**
+     * Creates a YANG bits type object.
+     */
+    public YangBits() {
+        setBitSet(new HashSet<YangBit>());
+    }
+
+    /**
+     * Returns the bit set.
+     *
+     * @return the bit set
+     */
+    public Set<YangBit> getBitSet() {
+        return bitSet;
+    }
+
+    /**
+     * Sets the bit set.
+     *
+     * @param bitSet the bit set
+     */
+    private void setBitSet(Set<YangBit> bitSet) {
+        this.bitSet = bitSet;
+    }
+
+    /**
+     * Adds bit info.
+     *
+     * @param bitInfo the bit information to be added
+     * @throws DataModelException due to violation in data model rules
+     */
+    public void addBitInfo(YangBit bitInfo) throws DataModelException {
+        if (!getBitSet().add(bitInfo)) {
+            throw new DataModelException("YANG file error: Duplicate identifier detected, same as bit \""
+                    + bitInfo.getBitName() + "\"");
+        }
+    }
+
+    /**
+     * Returns the type of the data.
+     *
+     * @return ParsedDataType returns BITS_DATA
+     */
+    @Override
+    public YangConstructType getYangConstructType() {
+        return YangConstructType.BITS_DATA;
+    }
+
+    /**
+     * Returns the bits name.
+     *
+     * @return name of the bits
+     */
+    public String getBitsName() {
+        return bitsName;
+    }
+
+    /**
+     * Sets bits name.
+     *
+     * @param bitsName bit name to be set
+     */
+    public void setBitsName(String bitsName) {
+        this.bitsName = bitsName;
+    }
+
+    /**
+     * Validates the data on entering the corresponding parse tree node.
+     *
+     * @throws DataModelException a violation of data model rules
+     */
+    @Override
+    public void validateDataOnEntry() throws DataModelException {
+        // TODO auto-generated method stub, to be implemented by parser
+    }
+
+    /**
+     * Validates the data on exiting the corresponding parse tree node.
+     *
+     * @throws DataModelException a violation of data model rules
+     */
+    @Override
+    public void validateDataOnExit() throws DataModelException {
+        // TODO auto-generated method stub, to be implemented by parser
+    }
+}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangCase.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangCase.java
new file mode 100644
index 0000000..a00b77d
--- /dev/null
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangCase.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.yangutils.datamodel;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
+import org.onosproject.yangutils.datamodel.utils.Parsable;
+import org.onosproject.yangutils.datamodel.utils.YangConstructType;
+
+import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.detectCollidingChildUtil;
+import static org.onosproject.yangutils.datamodel.utils.YangConstructType.CASE_DATA;
+
+/*-
+ * Reference RFC 6020.
+ *
+ * The "case" statement is used to define branches of the choice. It takes as an
+ * argument an identifier, followed by a block of sub-statements that holds
+ * detailed case information.
+ *
+ * The identifier is used to identify the case node in the schema tree. A case
+ * node does not exist in the data tree.
+ *
+ * Within a "case" statement, the "anyxml", "choice", "container", "leaf",
+ * "list", "leaf-list", and "uses" statements can be used to define child nodes
+ * to the case node. The identifiers of all these child nodes MUST be unique
+ * within all cases in a choice. For example, the following is illegal:
+ *
+ * choice interface-type {     // This example is illegal YANG
+ *        case a {
+ *            leaf ethernet { ... }
+ *        }
+ *        case b {
+ *            container ethernet { ...}
+ *        }
+ *    }
+ *
+ *  As a shorthand, the "case" statement can be omitted if the branch
+ *  contains a single "anyxml", "container", "leaf", "list", or
+ *  "leaf-list" statement.  In this case, the identifier of the case node
+ *  is the same as the identifier in the branch statement.  The following
+ *  example:
+ *
+ *    choice interface-type {
+ *        container ethernet { ... }
+ *    }
+ *
+ *  is equivalent to:
+ *
+ *    choice interface-type {
+ *        case ethernet {
+ *            container ethernet { ... }
+ *        }
+ *    }
+ *
+ *  The case identifier MUST be unique within a choice.
+ *
+ *  The case's sub-statements
+ *
+ *                +--------------+---------+-------------+------------------+
+ *                | substatement | section | cardinality |data model mapping|
+ *                +--------------+---------+-------------+------------------+
+ *                | anyxml       | 7.10    | 0..n        |-not supported    |
+ *                | choice       | 7.9     | 0..n        |-child nodes      |
+ *                | container    | 7.5     | 0..n        |-child nodes      |
+ *                | description  | 7.19.3  | 0..1        |-string           |
+ *                | if-feature   | 7.18.2  | 0..n        |-TODO             |
+ *                | leaf         | 7.6     | 0..n        |-YangLeaf         |
+ *                | leaf-list    | 7.7     | 0..n        |-YangLeafList     |
+ *                | list         | 7.8     | 0..n        |-child nodes      |
+ *                | reference    | 7.19.4  | 0..1        |-string           |
+ *                | status       | 7.19.2  | 0..1        |-YangStatus       |
+ *                | uses         | 7.12    | 0..n        |-child node       |
+ *                | when         | 7.19.5  | 0..1        |-TODO             |
+ *                +--------------+---------+-------------+------------------+
+ */
+
+/**
+ * Represents data model node to maintain information defined in YANG case.
+ */
+public class YangCase
+        extends YangNode
+        implements YangLeavesHolder, YangCommonInfo, Parsable, CollisionDetector, YangAugmentationHolder {
+
+    private static final long serialVersionUID = 806201603L;
+
+    /**
+     * Case name.
+     */
+    private String name;
+
+    // TODO: default field identification for the case
+
+    /**
+     * Description of case.
+     */
+    private String description;
+
+    /**
+     * List of leaves.
+     */
+    private List<YangLeaf> listOfLeaf;
+
+    /**
+     * List of leaf lists.
+     */
+    private List<YangLeafList> listOfLeafList;
+
+    /**
+     * Reference of the module.
+     */
+    private String reference;
+
+    /**
+     * Status of the node.
+     */
+    private YangStatusType status;
+
+    /**
+     * Creates a choice node.
+     */
+    public YangCase() {
+        super(YangNodeType.CASE_NODE);
+    }
+
+    /**
+     * Returns the case name.
+     *
+     * @return case name
+     */
+    @Override
+    public String getName() {
+        return name;
+    }
+
+    /**
+     * Sets the case name.
+     *
+     * @param name case name
+     */
+    @Override
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    /**
+     * Returns the description.
+     *
+     * @return the description
+     */
+    @Override
+    public String getDescription() {
+        return description;
+    }
+
+    /**
+     * Sets the description.
+     *
+     * @param description set the description
+     */
+    @Override
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    /**
+     * Returns the list of leaves.
+     *
+     * @return the list of leaves
+     */
+    @Override
+    public List<YangLeaf> getListOfLeaf() {
+        return listOfLeaf;
+    }
+
+    /**
+     * Sets the list of leaves.
+     *
+     * @param leafsList the list of leaf to set
+     */
+    @Override
+    public void setListOfLeaf(List<YangLeaf> leafsList) {
+        listOfLeaf = leafsList;
+    }
+
+    /**
+     * Adds a leaf.
+     *
+     * @param leaf the leaf to be added
+     */
+    @Override
+    public void addLeaf(YangLeaf leaf) {
+        if (getListOfLeaf() == null) {
+            setListOfLeaf(new LinkedList<YangLeaf>());
+        }
+
+        getListOfLeaf().add(leaf);
+    }
+
+    /**
+     * Returns the list of leaf-list.
+     *
+     * @return the list of leaf-list
+     */
+    @Override
+    public List<YangLeafList> getListOfLeafList() {
+        return listOfLeafList;
+    }
+
+    /**
+     * Sets the list of leaf-list.
+     *
+     * @param listOfLeafList the list of leaf-list to set
+     */
+    @Override
+    public void setListOfLeafList(List<YangLeafList> listOfLeafList) {
+        this.listOfLeafList = listOfLeafList;
+    }
+
+    /**
+     * Adds a leaf-list.
+     *
+     * @param leafList the leaf-list to be added
+     */
+    @Override
+    public void addLeafList(YangLeafList leafList) {
+        if (getListOfLeafList() == null) {
+            setListOfLeafList(new LinkedList<YangLeafList>());
+        }
+
+        getListOfLeafList().add(leafList);
+    }
+
+    /**
+     * 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 status.
+     *
+     * @return the status
+     */
+    @Override
+    public YangStatusType getStatus() {
+        return status;
+    }
+
+    /**
+     * Sets the status.
+     *
+     * @param status the status to set
+     */
+    @Override
+    public void setStatus(YangStatusType status) {
+        this.status = status;
+    }
+
+    /**
+     * Returns the type of the data.
+     *
+     * @return returns CASE_DATA
+     */
+    @Override
+    public YangConstructType getYangConstructType() {
+        return CASE_DATA;
+    }
+
+    /**
+     * Validates the data on entering the corresponding parse tree node.
+     *
+     * @throws DataModelException a violation of data model rules
+     */
+    @Override
+    public void validateDataOnEntry()
+            throws DataModelException {
+        // TODO auto-generated method stub, to be implemented by parser
+    }
+
+    /**
+     * Validates the data on exiting the corresponding parse tree node.
+     *
+     * @throws DataModelException a violation of data model rules
+     */
+    @Override
+    public void validateDataOnExit()
+            throws DataModelException {
+        // TODO auto-generated method stub, to be implemented by parser
+    }
+
+    @Override
+    public void detectCollidingChild(String identifierName, YangConstructType dataType)
+            throws DataModelException {
+        if (!(getParent() instanceof YangChoice)) {
+            throw new DataModelException("Internal Data Model Tree Error: Invalid/Missing holder in case " +
+                    getName());
+        }
+        // Traverse up in tree to ask parent choice start collision detection.
+        ((CollisionDetector) getParent()).detectCollidingChild(identifierName, dataType);
+    }
+
+    @Override
+    public void detectSelfCollision(String identifierName, YangConstructType dataType)
+            throws DataModelException {
+
+        if (dataType == CASE_DATA) {
+            if (getName().equals(identifierName)) {
+                throw new DataModelException("YANG File Error: Identifier collision detected in case \"" +
+                        getName() + "\"");
+            }
+            return;
+        }
+
+        // Asks helper to detect colliding child.
+        detectCollidingChildUtil(identifierName, dataType, this);
+    }
+}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangChoice.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangChoice.java
new file mode 100644
index 0000000..85ba107
--- /dev/null
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangChoice.java
@@ -0,0 +1,368 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.yangutils.datamodel;
+
+import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
+import org.onosproject.yangutils.datamodel.utils.Parsable;
+import org.onosproject.yangutils.datamodel.utils.YangConstructType;
+
+import static org.onosproject.yangutils.datamodel.utils.YangConstructType.CHOICE_DATA;
+
+/*-
+ * Reference RFC 6020.
+ *
+ * The "choice" statement defines a set of alternatives, only one of
+ *  which may exist at any one time.  The argument is an identifier,
+ *  followed by a block of sub-statements that holds detailed choice
+ *  information.  The identifier is used to identify the choice node in
+ *  the schema tree.  A choice node does not exist in the data tree.
+ *
+ *  A choice consists of a number of branches, defined with the "case"
+ *  sub-statement.  Each branch contains a number of child nodes.  The
+ *  nodes from at most one of the choice's branches exist at the same
+ *  time.
+ *
+ *  The choice's sub-statements
+ *
+ *                +--------------+---------+-------------+------------------+
+ *                | substatement | section | cardinality |data model mapping|
+ *                +--------------+---------+-------------+------------------+
+ *                | anyxml       | 7.10    | 0..n        |-not supported    |
+ *                | case         | 7.9.2   | 0..n        |-YangChoice       |
+ *                | config       | 7.19.1  | 0..1        |-boolean          |
+ *                | container    | 7.5     | 0..n        |-child case nodes |
+ *                | default      | 7.9.3   | 0..1        |-string           |
+ *                | description  | 7.19.3  | 0..1        |-string           |
+ *                | if-feature   | 7.18.2  | 0..n        |-TODO             |
+ *                | leaf         | 7.6     | 0..n        |-child case nodes |
+ *                | leaf-list    | 7.7     | 0..n        |-child case nodes |
+ *                | list         | 7.8     | 0..n        |-child case nodes |
+ *                | mandatory    | 7.9.4   | 0..1        |-string           |
+ *                | reference    | 7.19.4  | 0..1        |-string           |
+ *                | status       | 7.19.2  | 0..1        |-string           |
+ *                | when         | 7.19.5  | 0..1        |-TODO             |
+ *                +--------------+---------+-------------+------------------+
+ */
+/**
+ * Represents data model node to maintain information defined in YANG choice.
+ */
+public class YangChoice extends YangNode
+        implements YangCommonInfo, Parsable, CollisionDetector, YangAugmentationHolder {
+
+    private static final long serialVersionUID = 806201604L;
+
+    /**
+     * Name of choice.
+     */
+    private String name;
+
+    /**
+     * If the choice represents config data.
+     */
+    private boolean isConfig;
+
+    /**
+     * Reference RFC 6020.
+     *
+     * The "default" statement indicates if a case should be considered as the
+     * default if no child nodes from any of the choice's cases exist. The
+     * argument is the identifier of the "case" statement. If the "default"
+     * statement is missing, there is no default case.
+     *
+     * The "default" statement MUST NOT be present on choices where "mandatory"
+     * is true.
+     *
+     * The default case is only important when considering the default values of
+     * nodes under the cases. The default values for nodes under the default
+     * case are used if none of the nodes under any of the cases are present.
+     *
+     * There MUST NOT be any mandatory nodes directly under the default case.
+     *
+     * Default values for child nodes under a case are only used if one of the
+     * nodes under that case is present, or if that case is the default case. If
+     * none of the nodes under a case are present and the case is not the
+     * default case, the default values of the cases' child nodes are ignored.
+     *
+     * the default case to be used if no case members is present.
+     */
+    private String defaultCase;
+
+    /**
+     * Description of choice.
+     */
+    private String description;
+
+    /**
+     * Reference RFC 6020.
+     *
+     * The "mandatory" statement, which is optional, takes as an argument the
+     * string "true" or "false", and puts a constraint on valid data. If
+     * "mandatory" is "true", at least one node from exactly one of the choice's
+     * case branches MUST exist.
+     *
+     * If not specified, the default is "false".
+     *
+     * The behavior of the constraint depends on the type of the choice's
+     * closest ancestor node in the schema tree which is not a non-presence
+     * container:
+     *
+     * o If this ancestor is a case node, the constraint is enforced if any
+     * other node from the case exists.
+     *
+     * o Otherwise, it is enforced if the ancestor node exists.
+     */
+    private String mandatory;
+
+    /**
+     * Reference of the choice.
+     */
+    private String reference;
+
+    /**
+     * Status of the node.
+     */
+    private YangStatusType status;
+
+    /**
+     * Default value in string, needs to be converted to the target object,
+     * based on the type.
+     */
+    private String defaultValueInString;
+
+    /**
+     * Create a choice node.
+     */
+    public YangChoice() {
+        super(YangNodeType.CHOICE_NODE);
+    }
+
+    /**
+     * Returns the choice name.
+     *
+     * @return choice name
+     */
+    @Override
+    public String getName() {
+        return name;
+    }
+
+    /**
+     * Sets the choice name.
+     *
+     * @param name choice name
+     */
+    @Override
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    /**
+     * Returns config flag.
+     *
+     * @return the config flag
+     */
+    public boolean isConfig() {
+        return isConfig;
+    }
+
+    /**
+     * Sets config flag.
+     *
+     * @param isCfg the config flag
+     */
+    public void setConfig(boolean isCfg) {
+        isConfig = isCfg;
+    }
+
+    /**
+     * Returns the default case.
+     *
+     * @return the default case
+     */
+    public String getDefaultCase() {
+        return defaultCase;
+    }
+
+    /**
+     * Sets the default case.
+     *
+     * @param defaultCase the default case to set
+     */
+    public void setDefaultCase(String defaultCase) {
+        this.defaultCase = defaultCase;
+    }
+
+    /**
+     * Returns the mandatory status.
+     *
+     * @return the mandatory status
+     */
+    public String getMandatory() {
+        return mandatory;
+    }
+
+    /**
+     * Sets the mandatory status.
+     *
+     * @param mandatory the mandatory status
+     */
+    public void setMandatory(String mandatory) {
+        this.mandatory = mandatory;
+    }
+
+    /**
+     * Returns the description.
+     *
+     * @return the description
+     */
+    @Override
+    public String getDescription() {
+        return description;
+    }
+
+    /**
+     * Sets the description.
+     *
+     * @param description set the description
+     */
+    @Override
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    /**
+     * 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 status.
+     *
+     * @return the status
+     */
+    @Override
+    public YangStatusType getStatus() {
+        return status;
+    }
+
+    /**
+     * Sets the status.
+     *
+     * @param status the status to set
+     */
+    @Override
+    public void setStatus(YangStatusType status) {
+        this.status = status;
+    }
+
+    /**
+     * Returns the default value.
+     *
+     * @return the default value
+     */
+    public String getDefaultValueInString() {
+        return defaultValueInString;
+    }
+
+    /**
+     * Sets the default value.
+     *
+     * @param defaultValueInString the default value
+     */
+    public void setDefaultValueInString(String defaultValueInString) {
+        this.defaultValueInString = defaultValueInString;
+    }
+
+    /**
+     * Returns the type of the data.
+     *
+     * @return choice data
+     */
+    @Override
+    public YangConstructType getYangConstructType() {
+        return CHOICE_DATA;
+    }
+
+    /**
+     * Validates the data on entering the corresponding parse tree node.
+     *
+     * @throws DataModelException a violation of data model rules
+     */
+    @Override
+    public void validateDataOnEntry() throws DataModelException {
+        // TODO auto-generated method stub, to be implemented by parser
+    }
+
+    /**
+     * Validates the data on exiting the corresponding parse tree node.
+     *
+     * @throws DataModelException a violation of data model rules
+     */
+    @Override
+    public void validateDataOnExit() throws DataModelException {
+        // TODO auto-generated method stub, to be implemented by parser
+    }
+
+    @Override
+    public void detectCollidingChild(String identifierName, YangConstructType dataType) throws DataModelException {
+
+        if (getParent() instanceof YangCase && dataType != YangConstructType.CASE_DATA) {
+            ((CollisionDetector) getParent()).detectCollidingChild(identifierName, dataType);
+        }
+        YangNode node = getChild();
+        while (node != null) {
+            if (node instanceof CollisionDetector) {
+                ((CollisionDetector) node).detectSelfCollision(identifierName, dataType);
+            }
+            node = node.getNextSibling();
+        }
+    }
+
+    @Override
+    public void detectSelfCollision(String identifierName, YangConstructType dataType) throws DataModelException {
+
+        if (dataType == CHOICE_DATA) {
+            if (getName().equals(identifierName)) {
+                throw new DataModelException("YANG file error: Identifier collision detected in choice \"" +
+                        getName() + "\"");
+            }
+            return;
+        }
+
+        YangNode node = getChild();
+        while (node != null) {
+            if (node instanceof CollisionDetector) {
+                ((CollisionDetector) node).detectSelfCollision(identifierName, dataType);
+            }
+            node = node.getNextSibling();
+        }
+    }
+}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangCommonInfo.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangCommonInfo.java
new file mode 100644
index 0000000..89b7dc0
--- /dev/null
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangCommonInfo.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yangutils.datamodel;
+
+/**
+ * Abstraction of YANG entity's common meta data. Abstracted to unify the
+ * parsing and translator processing.
+ */
+public interface YangCommonInfo extends YangDesc, YangReference, YangStatus {
+}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangContainer.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangContainer.java
new file mode 100644
index 0000000..e23bf02
--- /dev/null
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangContainer.java
@@ -0,0 +1,448 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yangutils.datamodel;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
+import org.onosproject.yangutils.datamodel.utils.Parsable;
+import org.onosproject.yangutils.datamodel.utils.YangConstructType;
+
+import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.detectCollidingChildUtil;
+
+/*-
+ * Reference RFC 6020.
+ *
+ * The "container" statement is used to define an interior data node in the
+ * schema tree. It takes one argument, which is an identifier, followed by a
+ * block of sub-statements that holds detailed container information.
+ *
+ * A container node does not have a value, but it has a list of child nodes in
+ * the data tree. The child nodes are defined in the container's sub-statements.
+ *
+ * Containers with Presence
+ *
+ * YANG supports two styles of containers, those that exist only for organizing
+ * the hierarchy of data nodes, and those whose presence in the configuration
+ * has an explicit meaning.
+ *
+ * In the first style, the container has no meaning of its own, existing only to
+ * contain child nodes. This is the default style.
+ *
+ * For example, the set of scrambling options for Synchronous Optical Network
+ * (SONET) interfaces may be placed inside a "scrambling" container to enhance
+ * the organization of the configuration hierarchy, and to keep these nodes
+ * together. The "scrambling" node itself has no meaning, so removing the node
+ * when it becomes empty relieves the user from performing this task.
+ *
+ * In the second style, the presence of the container itself is configuration
+ * data, representing a single bit of configuration data. The container acts as
+ * both a configuration knob and a means of organizing related configuration.
+ * These containers are explicitly created and deleted.
+ *
+ * YANG calls this style a "presence container" and it is indicated using the
+ * "presence" statement, which takes as its argument a text string indicating
+ * what the presence of the node means.
+ *
+ * The container's Substatements
+ *
+ *                +--------------+---------+-------------+------------------+
+ *                | substatement | section | cardinality |data model mapping|
+ *                +--------------+---------+-------------+------------------+
+ *                | anyxml       | 7.10    | 0..n        | -not supported   |
+ *                | choice       | 7.9     | 0..n        | -child nodes     |
+ *                | config       | 7.19.1  | 0..1        | -boolean         |
+ *                | container    | 7.5     | 0..n        | -child nodes     |
+ *                | description  | 7.19.3  | 0..1        | -string          |
+ *                | grouping     | 7.11    | 0..n        | -child nodes     |
+ *                | if-feature   | 7.18.2  | 0..n        | -TODO            |
+ *                | leaf         | 7.6     | 0..n        | -YangLeaf        |
+ *                | leaf-list    | 7.7     | 0..n        | -YangLeafList    |
+ *                | list         | 7.8     | 0..n        | -child nodes     |
+ *                | must         | 7.5.3   | 0..n        | -TODO            |
+ *                | presence     | 7.5.5   | 0..1        | -boolean         |
+ *                | reference    | 7.19.4  | 0..1        | -string          |
+ *                | status       | 7.19.2  | 0..1        | -YangStatus      |
+ *                | typedef      | 7.3     | 0..n        | -child nodes     |
+ *                | uses         | 7.12    | 0..n        | -child nodes     |
+ *                | when         | 7.19.5  | 0..1        | -TODO            |
+ *                +--------------+---------+-------------+------------------+
+ */
+
+/**
+ * Represents data model node to maintain information defined in YANG container.
+ */
+public class YangContainer
+        extends YangNode
+        implements YangLeavesHolder, YangCommonInfo, Parsable, CollisionDetector, YangAugmentationHolder {
+
+    private static final long serialVersionUID = 806201605L;
+
+    /**
+     * Name of the container.
+     */
+    private String name;
+
+    /**
+     * If container maintains config data.
+     */
+    private Boolean isConfig;
+
+    /**
+     * Description of container.
+     */
+    private String description;
+
+    /**
+     * List of leaves contained.
+     */
+    private List<YangLeaf> listOfLeaf;
+
+    /**
+     * List of leaf-lists contained.
+     */
+    private List<YangLeafList> listOfLeafList;
+
+    /**
+     * If it is a presence container, then the textual documentation of presence
+     * usage.
+     */
+    private String presence;
+
+    /**
+     * Reference of the module.
+     */
+    private String reference;
+
+    /**
+     * Status of the node.
+     */
+    private YangStatusType status = YangStatusType.CURRENT;
+
+    /**
+     * Create a container node.
+     */
+    public YangContainer() {
+        super(YangNodeType.CONTAINER_NODE);
+    }
+
+    /**
+     * Returns the YANG name of container.
+     *
+     * @return the name of container as defined in YANG file
+     */
+    @Override
+    public String getName() {
+        return name;
+    }
+
+    /**
+     * Sets the YANG name of container.
+     *
+     * @param name the name of container as defined in YANG file
+     */
+    @Override
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    /**
+     * Returns the config flag.
+     *
+     * @return the isConfig
+     */
+    public Boolean isConfig() {
+        return isConfig;
+    }
+
+    /**
+     * Sets the config flag.
+     *
+     * @param isCfg the config flag
+     */
+    public void setConfig(boolean isCfg) {
+        isConfig = isCfg;
+    }
+
+    /**
+     * Returns the description.
+     *
+     * @return the description
+     */
+    @Override
+    public String getDescription() {
+        return description;
+    }
+
+    /**
+     * Sets the description.
+     *
+     * @param description set the description
+     */
+    @Override
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    /**
+     * Returns the list of leaves.
+     *
+     * @return the list of leaves
+     */
+    @Override
+    public List<YangLeaf> getListOfLeaf() {
+        return listOfLeaf;
+    }
+
+    /**
+     * Sets the list of leaves.
+     *
+     * @param leafsList the list of leaf to set
+     */
+    @Override
+    public void setListOfLeaf(List<YangLeaf> leafsList) {
+        listOfLeaf = leafsList;
+    }
+
+    /**
+     * Adds a leaf.
+     *
+     * @param leaf the leaf to be added
+     */
+    @Override
+    public void addLeaf(YangLeaf leaf) {
+
+        if (getListOfLeaf() == null) {
+            setListOfLeaf(new LinkedList<YangLeaf>());
+        }
+
+        getListOfLeaf().add(leaf);
+    }
+
+    /**
+     * Returns the list of leaf-list.
+     *
+     * @return the list of leaf-list
+     */
+    @Override
+    public List<YangLeafList> getListOfLeafList() {
+        return listOfLeafList;
+    }
+
+    /**
+     * Sets the list of leaf-list.
+     *
+     * @param listOfLeafList the list of leaf-list to set
+     */
+    @Override
+    public void setListOfLeafList(List<YangLeafList> listOfLeafList) {
+        this.listOfLeafList = listOfLeafList;
+    }
+
+    /**
+     * Adds a leaf-list.
+     *
+     * @param leafList the leaf-list to be added
+     */
+    @Override
+    public void addLeafList(YangLeafList leafList) {
+
+        if (getListOfLeafList() == null) {
+            setListOfLeafList(new LinkedList<YangLeafList>());
+        }
+
+        getListOfLeafList().add(leafList);
+    }
+
+    /**
+     * Returns the presence string if present.
+     *
+     * @return the presence
+     */
+    public String getPresence() {
+        return presence;
+    }
+
+    /**
+     * Sets the presence string.
+     *
+     * @param presence the presence flag
+     */
+    public void setPresence(String presence) {
+        this.presence = presence;
+    }
+
+    /**
+     * 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 status.
+     *
+     * @return the status
+     */
+    @Override
+    public YangStatusType getStatus() {
+        return status;
+    }
+
+    /**
+     * Sets the status.
+     *
+     * @param status the status to set
+     */
+    @Override
+    public void setStatus(YangStatusType status) {
+        this.status = status;
+    }
+
+    /**
+     * Returns the type of the data.
+     *
+     * @return returns CONTAINER_DATA
+     */
+    @Override
+    public YangConstructType getYangConstructType() {
+        return YangConstructType.CONTAINER_DATA;
+    }
+
+    /**
+     * Validates the data on entering the corresponding parse tree node.
+     *
+     * @throws DataModelException a violation of data model rules
+     */
+    @Override
+    public void validateDataOnEntry()
+            throws DataModelException {
+        // TODO auto-generated method stub, to be implemented by parser
+    }
+
+    /**
+     * Validates the data on exiting the corresponding parse tree node.
+     *
+     * @throws DataModelException a violation of data model rules
+     */
+    @Override
+    public void validateDataOnExit()
+            throws DataModelException {
+        List<YangLeaf> leaves = getListOfLeaf();
+        List<YangLeafList> leafLists = getListOfLeafList();
+
+        setDefaultConfigValueToChild(leaves, leafLists);
+        validateConfig(leaves, leafLists);
+    }
+
+    /**
+     * Sets the config's value to all leaf if leaf's config statement is not
+     * specified.
+     *
+     * @param leaves list of leaf attributes of container
+     * @param leafLists list of leaf-list attributes of container
+     */
+    private void setDefaultConfigValueToChild(List<YangLeaf> leaves, List<YangLeafList> leafLists) {
+
+        /*
+         * If "config" is not specified, the default is the same as the parent
+         * schema node's "config" value.
+         */
+        if (leaves != null) {
+            for (YangLeaf leaf : leaves) {
+                if (leaf.isConfig() == null) {
+                    leaf.setConfig(isConfig);
+                }
+            }
+        }
+
+        /*
+         * If "config" is not specified, the default is the same as the parent
+         * schema node's "config" value.
+         */
+        if (leafLists != null) {
+            for (YangLeafList leafList : leafLists) {
+                if (leafList.isConfig() == null) {
+                    leafList.setConfig(isConfig);
+                }
+            }
+        }
+    }
+
+    /**
+     * Validates config statement of container.
+     *
+     * @param leaves list of leaf attributes of container
+     * @param leafLists list of leaf-list attributes of container
+     * @throws DataModelException a violation of data model rules
+     */
+    private void validateConfig(List<YangLeaf> leaves, List<YangLeafList> leafLists)
+            throws DataModelException {
+
+        /*
+         * If a node has "config" set to "false", no node underneath it can have
+         * "config" set to "true".
+         */
+        if (!isConfig && leaves != null) {
+            for (YangLeaf leaf : leaves) {
+                if (leaf.isConfig()) {
+                    throw new DataModelException("If a container has \"config\" set to \"false\", no node underneath " +
+                            "it can have \"config\" set to \"true\".");
+                }
+            }
+        }
+
+        if (!isConfig && leafLists != null) {
+            for (YangLeafList leafList : leafLists) {
+                if (leafList.isConfig()) {
+                    throw new DataModelException("If a container has \"config\" set to \"false\", no node underneath " +
+                            "it can have \"config\" set to \"true\".");
+                }
+            }
+        }
+    }
+
+    @Override
+    public void detectCollidingChild(String identifierName, YangConstructType dataType)
+            throws DataModelException {
+        // Asks helper to detect colliding child.
+        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 container \""
+                    + getName() + "\"");
+        }
+    }
+}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangDataTypes.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangDataTypes.java
new file mode 100644
index 0000000..32408d9
--- /dev/null
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangDataTypes.java
@@ -0,0 +1,237 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yangutils.datamodel;
+
+/**
+ * Represents ENUM to identify the YANG data type.
+ */
+public enum YangDataTypes {
+    /**
+     * Reference:RFC 6020.
+     *
+     * int8 represents integer values between -128 and 127, inclusively.
+     */
+    INT8,
+
+    /**
+     * Reference:RFC 6020.
+     *
+     * int16 represents integer values between -32768 and 32767, inclusively.
+     */
+    INT16,
+
+    /**
+     * Reference:RFC 6020.
+     *
+     * int32 represents integer values between -2147483648 and 2147483647,
+     * inclusively.
+     */
+    INT32,
+
+    /**
+     * Reference:RFC 6020.
+     *
+     * int64 represents integer values between -9223372036854775808 and
+     * 9223372036854775807, inclusively.
+     */
+    INT64,
+
+    /**
+     * Reference:RFC 6020.
+     *
+     * uint8 represents integer values between 0 and 255, inclusively.
+     */
+    UINT8,
+
+    /**
+     * Reference:RFC 6020.
+     *
+     * uint16 represents integer values between 0 and 65535, inclusively.
+     */
+    UINT16,
+
+    /**
+     * Reference:RFC 6020.
+     *
+     * uint32 represents integer values between 0 and 4294967295, inclusively.
+     */
+    UINT32,
+
+    /**
+     * Reference:RFC 6020.
+     *
+     * uint64 represents integer values between 0 and 18446744073709551615,
+     * inclusively.
+     */
+    UINT64,
+
+    /**
+     * Reference:RFC 6020.
+     *
+     * The decimal64 type represents a subset of the real numbers, which can be
+     * represented by decimal numerals. The value space of decimal64 is the set
+     * of numbers that can be obtained by multiplying a 64-bit signed integer by
+     * a negative power of ten, i.e., expressible as "i x 10^-n" where i is an
+     * integer64 and n is an integer between 1 and 18, inclusively.
+     */
+    DECIMAL64, // TODO: need to implement in type.
+
+    /**
+     * Reference:RFC 6020.
+     *
+     * The string built-in type represents human-readable strings in YANG. Legal
+     * characters are tab, carriage return, line feed, and the legal characters
+     * of Unicode and ISO/IEC 10646
+     */
+    STRING,
+
+    /**
+     * Reference:RFC 6020.
+     *
+     * The boolean built-in type represents a boolean value.
+     */
+    BOOLEAN,
+
+    /**
+     * Reference:RFC 6020.
+     *
+     * The enumeration built-in type represents values from a set of assigned
+     * names.
+     */
+    ENUMERATION,
+
+    /**
+     * Reference:RFC 6020.
+     *
+     * The bits built-in type represents a bit set. That is, a bits value is a
+     * set of flags identified by small integer position numbers starting at 0.
+     * Each bit number has an assigned name.
+     */
+    BITS,
+
+    /**
+     * Reference:RFC 6020.
+     *
+     * The binary built-in type represents any binary data, i.e., a sequence of
+     * octets.
+     */
+    BINARY,
+
+    /**
+     * Reference:RFC 6020.
+     *
+     * The leafref type is used to reference a particular leaf instance in the
+     * data tree. The "path" sub-statement (Section 9.9.2) selects a set of leaf
+     * instances, and the leafref value space is the set of values of these leaf
+     * instances.
+     *
+     * If the leaf with the leafref type represents configuration data, the leaf
+     * it refers to MUST also represent configuration. Such a leaf puts a
+     * constraint on valid data. All leafref nodes MUST reference existing leaf
+     * instances or leafs with default values in use for the data to be valid.
+     *
+     * There MUST NOT be any circular chains of leafrefs.
+     *
+     * If the leaf that the leafref refers to is conditional based on one or
+     * more features, then the leaf with the leafref type MUST also be
+     * conditional based on at least the same set of features.
+     */
+    LEAFREF, // TODO: need to implement in type.
+
+    /**
+     * Reference:RFC 6020.
+     *
+     * The identityref type is used to reference an existing identity.
+     */
+    IDENTITYREF,
+
+    /**
+     * Reference:RFC 6020.
+     *
+     * The empty built-in type represents a leaf that does not have any value,
+     * it conveys information by its presence or absence.
+     *
+     * An empty type cannot have a default value.
+     */
+    EMPTY,
+
+    /**
+     * Reference:RFC 6020.
+     *
+     * The union built-in type represents a value that corresponds to one of its
+     * member types.
+     *
+     * When the type is "union", the "type" statement MUST be present. It is
+     * used to repeatedly specify each member type of the union. It takes as an
+     * argument a string that is the name of a member type.
+     *
+     * A member type can be of any built-in or derived type, except it MUST NOT
+     * be one of the built-in types "empty" or "leafref".
+     *
+     * When a string representing a union data type is validated, the string is
+     * validated against each member type, in the order they are specified in
+     * the "type" statement, until a match is found.
+     *
+     * Any default value or "units" property defined in the member types is not
+     * inherited by the union type.
+     */
+    UNION,
+
+    /**
+     * Reference:RFC 6020.
+     *
+     * The instance-identifier built-in type is used to uniquely identify a
+     * particular instance node in the data tree.
+     *
+     * The syntax for an instance-identifier is a subset of the XPath
+     * abbreviated syntax, formally defined by the rule "instance-identifier".
+     * It is used to uniquely identify a node in the data tree. Predicates are
+     * used only for specifying the values for the key nodes for list entries, a
+     * value of a leaf-list entry, or a positional index for a list without
+     * keys. For identifying list entries with keys, each predicate consists of
+     * one equality test per key, and each key MUST have a corresponding
+     * predicate.
+     *
+     * If the leaf with the instance-identifier type represents configuration
+     * data, and the "require-instance" property is "true", the node it refers
+     * to MUST also represent configuration. Such a leaf puts a constraint on
+     * valid data. All such leaf nodes MUST reference existing nodes or leaf
+     * nodes with their default value in use for the data to be valid.
+     */
+    INSTANCE_IDENTIFIER,
+
+    /**
+     * Derived data type.
+     */
+    DERIVED;
+
+    /**
+     * Returns YANG data type for corresponding type name.
+     *
+     * @param name type name from YANG file.
+     * @return YANG data type for corresponding type name.
+     */
+    public static YangDataTypes getType(String name) {
+        name = name.replace("\"", "");
+        for (YangDataTypes yangDataType : values()) {
+            if (yangDataType.name().toLowerCase().equals(name)) {
+                return yangDataType;
+            }
+        }
+        return YangDataTypes.DERIVED;
+    }
+}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangDerivedInfo.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangDerivedInfo.java
new file mode 100644
index 0000000..bedeead
--- /dev/null
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangDerivedInfo.java
@@ -0,0 +1,681 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yangutils.datamodel;
+
+import java.io.Serializable;
+
+import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
+import org.onosproject.yangutils.datamodel.utils.ResolvableStatus;
+
+import com.google.common.base.Strings;
+
+import static org.onosproject.yangutils.datamodel.YangDataTypes.BINARY;
+import static org.onosproject.yangutils.datamodel.YangDataTypes.BITS;
+import static org.onosproject.yangutils.datamodel.YangDataTypes.BOOLEAN;
+import static org.onosproject.yangutils.datamodel.YangDataTypes.DERIVED;
+import static org.onosproject.yangutils.datamodel.YangDataTypes.EMPTY;
+import static org.onosproject.yangutils.datamodel.YangDataTypes.ENUMERATION;
+import static org.onosproject.yangutils.datamodel.YangDataTypes.IDENTITYREF;
+import static org.onosproject.yangutils.datamodel.YangDataTypes.LEAFREF;
+import static org.onosproject.yangutils.datamodel.YangDataTypes.STRING;
+import static org.onosproject.yangutils.datamodel.YangDataTypes.UNION;
+import static org.onosproject.yangutils.datamodel.utils.ResolvableStatus.INTRA_FILE_RESOLVED;
+import static org.onosproject.yangutils.datamodel.utils.ResolvableStatus.RESOLVED;
+import static org.onosproject.yangutils.datamodel.utils.RestrictionResolver.isOfRangeRestrictedType;
+import static org.onosproject.yangutils.datamodel.utils.RestrictionResolver.processLengthRestriction;
+import static org.onosproject.yangutils.datamodel.utils.RestrictionResolver.processRangeRestriction;
+
+/**
+ * Represents the derived information.
+ *
+ * @param <T> extended information.
+ */
+public class YangDerivedInfo<T>
+        implements LocationInfo, Cloneable, Serializable {
+
+    private static final long serialVersionUID = 806201641L;
+
+    /**
+     * YANG typedef reference.
+     */
+    private YangTypeDef referredTypeDef;
+
+    /**
+     * Resolved additional information about data type after linking, example
+     * restriction info, named values, etc. The extra information is based
+     * on the data type. Based on the data type, the extended info can vary.
+     */
+    private T resolvedExtendedInfo;
+
+    /**
+     * Line number of pattern restriction in YANG file.
+     */
+    private int lineNumber;
+
+    /**
+     * Position of pattern restriction in line.
+     */
+    private int charPositionInLine;
+
+    /**
+     * Effective built-in type, requried in case type of typedef is again a
+     * derived type. This information is to be added during linking.
+     */
+    private YangDataTypes effectiveBuiltInType;
+
+    /**
+     * Length restriction string to temporary store the length restriction when the type
+     * is derived.
+     */
+    private String lengthRestrictionString;
+
+    /**
+     * Range restriction string to temporary store the range restriction when the type
+     * is derived.
+     */
+    private String rangeRestrictionString;
+
+    /**
+     * Pattern restriction string to  temporary store the pattern restriction when the type
+     * is derived.
+     */
+    private YangPatternRestriction patternRestriction;
+
+    /**
+     * Returns the referred typedef reference.
+     *
+     * @return referred typedef reference
+     */
+    public YangTypeDef getReferredTypeDef() {
+        return referredTypeDef;
+    }
+
+    /**
+     * Sets the referred typedef reference.
+     *
+     * @param referredTypeDef referred typedef reference
+     */
+    public void setReferredTypeDef(YangTypeDef referredTypeDef) {
+        this.referredTypeDef = referredTypeDef;
+    }
+
+    /**
+     * Returns resolved extended information after successful linking.
+     *
+     * @return resolved extended information
+     */
+    public T getResolvedExtendedInfo() {
+        return resolvedExtendedInfo;
+    }
+
+    /**
+     * Sets resolved extended information after successful linking.
+     *
+     * @param resolvedExtendedInfo resolved extended information
+     */
+    public void setResolvedExtendedInfo(T resolvedExtendedInfo) {
+        this.resolvedExtendedInfo = resolvedExtendedInfo;
+    }
+
+    @Override
+    public int getLineNumber() {
+        return lineNumber;
+    }
+
+    @Override
+    public int getCharPosition() {
+        return charPositionInLine;
+    }
+
+    @Override
+    public void setLineNumber(int lineNumber) {
+        this.lineNumber = lineNumber;
+    }
+
+    @Override
+    public void setCharPosition(int charPositionInLine) {
+        this.charPositionInLine = charPositionInLine;
+    }
+
+    /**
+     * Returns the length restriction string.
+     *
+     * @return the length restriction string
+     */
+    public String getLengthRestrictionString() {
+        return lengthRestrictionString;
+    }
+
+    /**
+     * Sets the length restriction string.
+     *
+     * @param lengthRestrictionString the length restriction string
+     */
+    public void setLengthRestrictionString(String lengthRestrictionString) {
+        this.lengthRestrictionString = lengthRestrictionString;
+    }
+
+    /**
+     * Returns the range restriction string.
+     *
+     * @return the range restriction string
+     */
+    public String getRangeRestrictionString() {
+        return rangeRestrictionString;
+    }
+
+    /**
+     * Sets the range restriction string.
+     *
+     * @param rangeRestrictionString the range restriction string
+     */
+    public void setRangeRestrictionString(String rangeRestrictionString) {
+        this.rangeRestrictionString = rangeRestrictionString;
+    }
+
+    /**
+     * Returns the pattern restriction.
+     *
+     * @return the pattern restriction
+     */
+    public YangPatternRestriction getPatternRestriction() {
+        return patternRestriction;
+    }
+
+    /**
+     * Sets the pattern restriction.
+     *
+     * @param patternRestriction the pattern restriction
+     */
+    public void setPatternRestriction(YangPatternRestriction patternRestriction) {
+        this.patternRestriction = patternRestriction;
+    }
+
+    /**
+     * Returns effective built-in type.
+     *
+     * @return effective built-in type
+     */
+    public YangDataTypes getEffectiveBuiltInType() {
+        return effectiveBuiltInType;
+    }
+
+    /**
+     * Sets effective built-in type.
+     *
+     * @param effectiveBuiltInType effective built-in type
+     */
+    public void setEffectiveBuiltInType(YangDataTypes effectiveBuiltInType) {
+        this.effectiveBuiltInType = effectiveBuiltInType;
+    }
+
+    /**
+     * Resolves the type derived info, by obtaining the effective built-in type
+     * and resolving the restrictions.
+     *
+     * @return resolution status
+     * @throws DataModelException a violation in data mode rule
+     */
+    public ResolvableStatus resolve()
+            throws DataModelException {
+
+        YangType<?> baseType = getReferredTypeDef().getTypeDefBaseType();
+
+        /*
+         * Checks the data type of the referred typedef, if it's derived, obtain
+         * effective built-in type and restrictions from it's derived info,
+         * otherwise take from the base type of type itself.
+         */
+        if (baseType.getDataType() == DERIVED) {
+            /*
+             * Check whether the referred typedef is resolved.
+             */
+            if (baseType.getResolvableStatus() != INTRA_FILE_RESOLVED && baseType.getResolvableStatus() != RESOLVED) {
+                throw new DataModelException("Linker Error: Referred typedef is not resolved for type.");
+            }
+
+            /*
+             * Check if the referred typedef is intra file resolved, if yes sets
+             * current status also to intra file resolved .
+             */
+            if (getReferredTypeDef().getTypeDefBaseType().getResolvableStatus() == INTRA_FILE_RESOLVED) {
+                return INTRA_FILE_RESOLVED;
+            }
+            setEffectiveBuiltInType(((YangDerivedInfo<?>) baseType.getDataTypeExtendedInfo())
+                    .getEffectiveBuiltInType());
+            YangDerivedInfo refDerivedInfo = (YangDerivedInfo<?>) baseType.getDataTypeExtendedInfo();
+            /*
+             * Check whether the effective built-in type can have range
+             * restrictions, if yes call resolution of range.
+             */
+            if (isOfRangeRestrictedType(getEffectiveBuiltInType())) {
+                if (refDerivedInfo.getResolvedExtendedInfo() == null) {
+                    resolveRangeRestriction(null);
+                    /*
+                     * Return the resolution status as resolved, if it's not
+                     * resolve range/string restriction will throw exception in
+                     * previous function.
+                     */
+                    return RESOLVED;
+                } else {
+                    if (!(refDerivedInfo.getResolvedExtendedInfo() instanceof YangRangeRestriction)) {
+                        throw new DataModelException("Linker error: Referred typedef restriction info is of invalid " +
+                                "type.");
+                    }
+                    resolveRangeRestriction((YangRangeRestriction) refDerivedInfo.getResolvedExtendedInfo());
+                    /*
+                     * Return the resolution status as resolved, if it's not
+                     * resolve range/string restriction will throw exception in
+                     * previous function.
+                     */
+                    return RESOLVED;
+                }
+                /*
+                 * If the effective built-in type is of type string calls for
+                 * string resolution.
+                 */
+            } else if (getEffectiveBuiltInType() == STRING) {
+                if (refDerivedInfo.getResolvedExtendedInfo() == null) {
+                    resolveStringRestriction(null);
+                    /*
+                     * Return the resolution status as resolved, if it's not
+                     * resolve range/string restriction will throw exception in
+                     * previous function.
+                     */
+                    return RESOLVED;
+                } else {
+                    if (!(refDerivedInfo.getResolvedExtendedInfo() instanceof YangStringRestriction)) {
+                        throw new DataModelException("Linker error: Referred typedef restriction info is of invalid " +
+                                "type.");
+                    }
+                    resolveStringRestriction((YangStringRestriction) refDerivedInfo.getResolvedExtendedInfo());
+                    /*
+                     * Return the resolution status as resolved, if it's not
+                     * resolve range/string restriction will throw exception in
+                     * previous function.
+                     */
+                    return RESOLVED;
+                }
+            } else if (getEffectiveBuiltInType() == BINARY) {
+                if (refDerivedInfo.getResolvedExtendedInfo() == null) {
+                    resolveLengthRestriction(null);
+                    /*
+                     * Return the resolution status as resolved, if it's not
+                     * resolve length restriction will throw exception in
+                     * previous function.
+                     */
+                    return RESOLVED;
+                } else {
+                    if (!(refDerivedInfo.getResolvedExtendedInfo() instanceof YangRangeRestriction)) {
+                        throw new DataModelException("Linker error: Referred typedef restriction info is of invalid " +
+                                "type.");
+                    }
+                    resolveLengthRestriction((YangRangeRestriction) refDerivedInfo.getResolvedExtendedInfo());
+                    /*
+                     * Return the resolution status as resolved, if it's not
+                     * resolve length restriction will throw exception in
+                     * previous function.
+                     */
+                    return RESOLVED;
+                }
+            }
+        } else {
+            setEffectiveBuiltInType(baseType.getDataType());
+            /*
+             * Check whether the effective built-in type can have range
+             * restrictions, if yes call resolution of range.
+             */
+            if (isOfRangeRestrictedType(getEffectiveBuiltInType())) {
+                if (baseType.getDataTypeExtendedInfo() == null) {
+                    resolveRangeRestriction(null);
+                    /*
+                     * Return the resolution status as resolved, if it's not
+                     * resolve range/string restriction will throw exception in
+                     * previous function.
+                     */
+                    return RESOLVED;
+                } else {
+                    if (!(baseType.getDataTypeExtendedInfo() instanceof YangRangeRestriction)) {
+                        throw new DataModelException("Linker error: Referred typedef restriction info is of invalid " +
+                                "type.");
+                    }
+                    resolveRangeRestriction((YangRangeRestriction) baseType.getDataTypeExtendedInfo());
+                    /*
+                     * Return the resolution status as resolved, if it's not
+                     * resolve range/string restriction will throw exception in
+                     * previous function.
+                     */
+                    return RESOLVED;
+                }
+                /*
+                 * If the effective built-in type is of type string calls for
+                 * string resolution.
+                 */
+            } else if (getEffectiveBuiltInType() == STRING) {
+                if (baseType.getDataTypeExtendedInfo() == null) {
+                    resolveStringRestriction(null);
+                    /*
+                     * Return the resolution status as resolved, if it's not
+                     * resolve range/string restriction will throw exception in
+                     * previous function.
+                     */
+                    return RESOLVED;
+                } else {
+                    if (!(baseType.getDataTypeExtendedInfo() instanceof YangStringRestriction)) {
+                        throw new DataModelException("Linker error: Referred typedef restriction info is of invalid " +
+                                "type.");
+                    }
+                    resolveStringRestriction((YangStringRestriction) baseType.getDataTypeExtendedInfo());
+                    /*
+                     * Return the resolution status as resolved, if it's not
+                     * resolve range/string restriction will throw exception in
+                     * previous function.
+                     */
+                    return RESOLVED;
+                }
+            } else if (getEffectiveBuiltInType() == BINARY) {
+                if (baseType.getDataTypeExtendedInfo() == null) {
+                    resolveLengthRestriction(null);
+                    /*
+                     * Return the resolution status as resolved, if it's not
+                     * resolve length restriction will throw exception in
+                     * previous function.
+                     */
+                    return RESOLVED;
+                } else {
+                    if (!(baseType.getDataTypeExtendedInfo() instanceof YangRangeRestriction)) {
+                        throw new DataModelException("Linker error: Referred typedef restriction info is of invalid " +
+                                "type.");
+                    }
+                    resolveLengthRestriction((YangRangeRestriction) baseType.getDataTypeExtendedInfo());
+                    /*
+                     * Return the resolution status as resolved, if it's not
+                     * resolve length restriction will throw exception in
+                     * previous function.
+                     */
+                    return RESOLVED;
+                }
+            }
+        }
+
+        /*
+         * Check if the data type is the one which can't be restricted, in this
+         * case check whether no self restrictions should be present.
+         */
+        if (isOfValidNonRestrictedType(getEffectiveBuiltInType())) {
+            if (Strings.isNullOrEmpty(getLengthRestrictionString())
+                    && Strings.isNullOrEmpty(getRangeRestrictionString())
+                    && getPatternRestriction() == null) {
+                return RESOLVED;
+            } else {
+                throw new DataModelException("YANG file error: Restrictions can't be applied to a given type");
+            }
+        }
+
+        // Throw exception for unsupported types
+        throw new DataModelException("Linker error: Unable to process the derived type.");
+    }
+
+    /**
+     * Resolves the string restrictions.
+     *
+     * @param refStringRestriction referred string restriction of typedef
+     * @throws DataModelException a violation in data model rule
+     */
+    private void resolveStringRestriction(YangStringRestriction refStringRestriction)
+            throws DataModelException {
+        YangStringRestriction curStringRestriction = null;
+        YangRangeRestriction refRangeRestriction = null;
+        YangPatternRestriction refPatternRestriction = null;
+
+        /*
+         * Check that range restriction should be null when built-in type is
+         * string.
+         */
+        if (!Strings.isNullOrEmpty(getRangeRestrictionString())) {
+            DataModelException dataModelException = new DataModelException("YANG file error: Range restriction " +
+                    "should't be present for string data type.");
+            dataModelException.setLine(lineNumber);
+            dataModelException.setCharPosition(charPositionInLine);
+            throw dataModelException;
+        }
+
+        /*
+         * If referred restriction and self restriction both are null, no
+         * resolution is required.
+         */
+        if (refStringRestriction == null && Strings.isNullOrEmpty(getLengthRestrictionString())
+                && getPatternRestriction() == null) {
+            return;
+        }
+
+        /*
+         * If referred string restriction is not null, take value of length and
+         * pattern restriction and assign.
+         */
+        if (refStringRestriction != null) {
+            refRangeRestriction = refStringRestriction.getLengthRestriction();
+            refPatternRestriction = refStringRestriction.getPatternRestriction();
+        }
+
+        YangRangeRestriction lengthRestriction = resolveLengthRestriction(refRangeRestriction);
+        YangPatternRestriction patternRestriction = resolvePatternRestriction(refPatternRestriction);
+
+        /*
+         * Check if either of length or pattern restriction is present, if yes
+         * create string restriction and assign value.
+         */
+        if (lengthRestriction != null || patternRestriction != null) {
+            curStringRestriction = new YangStringRestriction();
+            curStringRestriction.setLengthRestriction(lengthRestriction);
+            curStringRestriction.setPatternRestriction(patternRestriction);
+        }
+        setResolvedExtendedInfo((T) curStringRestriction);
+    }
+
+    /**
+     * Resolves pattern restriction.
+     *
+     * @param refPatternRestriction referred pattern restriction of typedef
+     * @return resolved pattern restriction
+     */
+    private YangPatternRestriction resolvePatternRestriction(YangPatternRestriction refPatternRestriction) {
+        /*
+         * If referred restriction and self restriction both are null, no
+         * resolution is required.
+         */
+        if (refPatternRestriction == null && getPatternRestriction() == null) {
+            return null;
+        }
+
+        /*
+         * If self restriction is null, and referred restriction is present
+         * shallow copy the referred to self.
+         */
+        if (getPatternRestriction() == null) {
+            return refPatternRestriction;
+        }
+
+        /*
+         * If referred restriction is null, and self restriction is present
+         * carry out self resolution.
+         */
+        if (refPatternRestriction == null) {
+            return getPatternRestriction();
+        }
+
+        /*
+         * Get patterns of referred type and add it to current pattern
+         * restrictions.
+         */
+        for (String pattern : refPatternRestriction.getPatternList()) {
+            getPatternRestriction().addPattern(pattern);
+        }
+        return getPatternRestriction();
+    }
+
+    /**
+     * Resolves the length restrictions.
+     *
+     * @param refLengthRestriction referred length restriction of typedef
+     * @return resolved length restriction
+     * @throws DataModelException a violation in data model rule
+     */
+    private YangRangeRestriction resolveLengthRestriction(YangRangeRestriction refLengthRestriction)
+            throws DataModelException {
+
+        /*
+         * If referred restriction and self restriction both are null, no
+         * resolution is required.
+         */
+        if (refLengthRestriction == null && Strings.isNullOrEmpty(getLengthRestrictionString())) {
+            return null;
+        }
+
+        /*
+         * If self restriction is null, and referred restriction is present
+         * shallow copy the referred to self.
+         */
+        if (Strings.isNullOrEmpty(getLengthRestrictionString())) {
+            return refLengthRestriction;
+        }
+
+        /*
+         * If referred restriction is null, and self restriction is present
+         * carry out self resolution.
+         */
+        if (refLengthRestriction == null) {
+            YangRangeRestriction curLengthRestriction = processLengthRestriction(null, lineNumber,
+                    charPositionInLine, false, getLengthRestrictionString());
+            return curLengthRestriction;
+        }
+
+        /*
+         * Carry out self resolution based with obtained effective built-in type
+         * and MIN/MAX values as per the referred typedef's values.
+         */
+        YangRangeRestriction curLengthRestriction = processLengthRestriction(refLengthRestriction, lineNumber,
+                charPositionInLine, true, getLengthRestrictionString());
+
+        // Resolve the range with referred typedef's restriction.
+        resolveLengthAndRangeRestriction(refLengthRestriction, curLengthRestriction);
+        return curLengthRestriction;
+    }
+
+    /**
+     * Resolves the length/range self and referred restriction, to check whether
+     * the all the range interval in self restriction is stricter than the
+     * referred typedef's restriction.
+     *
+     * @param refRestriction referred restriction
+     * @param curRestriction self restriction
+     */
+    private void resolveLengthAndRangeRestriction(YangRangeRestriction refRestriction,
+            YangRangeRestriction curRestriction)
+            throws DataModelException {
+        for (Object curInterval : curRestriction.getAscendingRangeIntervals()) {
+            if (!(curInterval instanceof YangRangeInterval)) {
+                throw new DataModelException("Linker error: Current range intervals not processed correctly.");
+            }
+            try {
+                refRestriction.isValidInterval((YangRangeInterval) curInterval);
+            } catch (DataModelException e) {
+                DataModelException dataModelException = new DataModelException(e);
+                dataModelException.setLine(lineNumber);
+                dataModelException.setCharPosition(charPositionInLine);
+                throw dataModelException;
+            }
+        }
+    }
+
+    /**
+     * Resolves the range restrictions.
+     *
+     * @param refRangeRestriction referred range restriction of typedef
+     * @throws DataModelException a violation in data model rule
+     */
+    private void resolveRangeRestriction(YangRangeRestriction refRangeRestriction)
+            throws DataModelException {
+
+        /*
+         * Check that string restriction should be null when built-in type is of
+         * range type.
+         */
+        if (!Strings.isNullOrEmpty(getLengthRestrictionString()) || getPatternRestriction() != null) {
+            DataModelException dataModelException = new DataModelException("YANG file error: Length/Pattern " +
+                    "restriction should't be present for int/uint/decimal data type.");
+            dataModelException.setLine(lineNumber);
+            dataModelException.setCharPosition(charPositionInLine);
+            throw dataModelException;
+        }
+
+        /*
+         * If referred restriction and self restriction both are null, no
+         * resolution is required.
+         */
+        if (refRangeRestriction == null && Strings.isNullOrEmpty(getRangeRestrictionString())) {
+            return;
+        }
+
+        /*
+         * If self restriction is null, and referred restriction is present
+         * shallow copy the referred to self.
+         */
+        if (Strings.isNullOrEmpty(getRangeRestrictionString())) {
+            setResolvedExtendedInfo((T) refRangeRestriction);
+            return;
+        }
+
+        /*
+         * If referred restriction is null, and self restriction is present
+         * carry out self resolution.
+         */
+        if (refRangeRestriction == null) {
+            YangRangeRestriction curRangeRestriction = processRangeRestriction(null, lineNumber,
+                    charPositionInLine, false, getRangeRestrictionString(), getEffectiveBuiltInType());
+            setResolvedExtendedInfo((T) curRangeRestriction);
+            return;
+        }
+
+        /*
+         * Carry out self resolution based with obtained effective built-in type
+         * and MIN/MAX values as per the referred typedef's values.
+         */
+        YangRangeRestriction curRangeRestriction = processRangeRestriction(refRangeRestriction, lineNumber,
+                charPositionInLine, true, getRangeRestrictionString(), getEffectiveBuiltInType());
+
+        // Resolve the range with referred typedef's restriction.
+        resolveLengthAndRangeRestriction(refRangeRestriction, curRangeRestriction);
+        setResolvedExtendedInfo((T) curRangeRestriction);
+    }
+
+    /**
+     * Returns whether the data type is of non restricted type.
+     *
+     * @param dataType data type to be checked
+     * @return true, if data type can't be restricted, false otherwise
+     */
+    private boolean isOfValidNonRestrictedType(YangDataTypes dataType) {
+        return dataType == BOOLEAN
+                || dataType == ENUMERATION
+                || dataType == BITS
+                || dataType == EMPTY
+                || dataType == UNION
+                || dataType == IDENTITYREF
+                || dataType == LEAFREF;
+    }
+}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangDesc.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangDesc.java
new file mode 100644
index 0000000..8c9d60e
--- /dev/null
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangDesc.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yangutils.datamodel;
+
+/**
+ * Abstraction of textual description for a YANG entity. Abstracted to unify the
+ * parsing and translator processing of description.
+ */
+public interface YangDesc {
+
+    /**
+     * Returns the description of YANG entity.
+     *
+     * @return the description of YANG entity.
+     */
+    String getDescription();
+
+    /**
+     * Set the description of YANG entity.
+     *
+     * @param description set the description of YANG entity.
+     */
+    void setDescription(String description);
+}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangEntityToResolveInfo.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangEntityToResolveInfo.java
new file mode 100644
index 0000000..77323f1
--- /dev/null
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangEntityToResolveInfo.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.yangutils.datamodel;
+
+/**
+ * Abstraction of information about entity being resolved.
+ *
+ * @param <T> type of entity being resolved, uses / grouping
+ */
+public interface YangEntityToResolveInfo<T> {
+
+    /**
+     * Retrieves the entity to be resolved.
+     *
+     * @return entity to be resolved
+     */
+    T getEntityToResolve();
+
+    /**
+     * Sets entity to be resolved.
+     *
+     * @param entityToResolve entity to be resolved
+     */
+    void setEntityToResolve(T entityToResolve);
+
+    /**
+     * Retrieves the parent node which contains the entity to be resolved.
+     *
+     * @return parent node which contains the entity to be resolved
+     */
+    YangNode getHolderOfEntityToResolve();
+
+    /**
+     * Sets parent node which contains the entity to be resolved.
+     *
+     * @param holderOfEntityToResolve parent node which contains the entity to
+     *                                be resolved
+     */
+    void setHolderOfEntityToResolve(YangNode holderOfEntityToResolve);
+}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangEnum.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangEnum.java
new file mode 100644
index 0000000..04ea232
--- /dev/null
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangEnum.java
@@ -0,0 +1,240 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yangutils.datamodel;
+
+import java.io.Serializable;
+import java.util.Objects;
+
+import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
+import org.onosproject.yangutils.datamodel.utils.Parsable;
+import org.onosproject.yangutils.datamodel.utils.YangConstructType;
+
+/*-
+ * The "ENUM" statement, which is a sub-statement to the "type"
+ *  statement, MUST be present if the type is "enumeration".  It is
+ *  repeatedly used to specify each assigned name of an enumeration type.
+ *  It takes as an argument a string which is the assigned name.  The
+ *  string MUST NOT be empty and MUST NOT have any leading or trailing
+ *  whitespace characters.  The use of Unicode control codes SHOULD be
+ *  avoided.
+ *
+ *  The statement is optionally followed by a block of sub-statements that
+ *  holds detailed ENUM information.
+ *  All assigned names in an enumeration MUST be unique.
+ *
+ *  The ENUM's sub-statements
+ *
+ *                +--------------+---------+-------------+------------------+
+ *                | substatement | section | cardinality |data model mapping|
+ *                +--------------+---------+-------------+------------------+
+ *                | description  | 7.19.3  | 0..1        | - string         |
+ *                | reference    | 7.19.4  | 0..1        | - string         |
+ *                | status       | 7.19.2  | 0..1        | - YangStatus     |
+ *                | value        | 9.6.4.2 | 0..1        | - int            |
+ *                +--------------+---------+-------------+------------------+
+ */
+
+/**
+ * Represents the ENUM data type information.
+ */
+public class YangEnum implements YangCommonInfo, Parsable, Comparable<YangEnum>, Serializable {
+
+    private static final long serialVersionUID = 806201643L;
+
+    /**
+     * Named value for the ENUM.
+     */
+    private String namedValue;
+
+    /**
+     * Description of the ENUM value.
+     */
+    private String description;
+
+    /**
+     * Reference info of the ENUM value.
+     */
+    private String reference;
+
+    /**
+     * Status of the ENUM value.
+     */
+    private YangStatusType status;
+
+    /**
+     * Value of ENUM.
+     */
+    private int value;
+
+    /**
+     * Create a YANG ENUM.
+     */
+    public YangEnum() {
+
+    }
+
+    /**
+     * Returns the named value.
+     *
+     * @return the named value
+     */
+    public String getNamedValue() {
+        return namedValue;
+    }
+
+    /**
+     * Sets the named value.
+     *
+     * @param namedValue the named value to set
+     */
+    public void setNamedValue(String namedValue) {
+        this.namedValue = namedValue;
+    }
+
+    /**
+     * Returns the description.
+     *
+     * @return the description
+     */
+    @Override
+    public String getDescription() {
+        return description;
+    }
+
+    /**
+     * Sets the description.
+     *
+     * @param description set the description
+     */
+    @Override
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    /**
+     * 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 status.
+     *
+     * @return the status
+     */
+    @Override
+    public YangStatusType getStatus() {
+        return status;
+    }
+
+    /**
+     * Sets the status.
+     *
+     * @param status the status to set
+     */
+    @Override
+    public void setStatus(YangStatusType status) {
+        this.status = status;
+    }
+
+    /**
+     * Returns the value.
+     *
+     * @return the value
+     */
+    public int getValue() {
+        return value;
+    }
+
+    /**
+     * Sets the value.
+     *
+     * @param value the value to set
+     */
+    public void setValue(int value) {
+        this.value = value;
+    }
+
+    /**
+     * Returns the type of the data.
+     *
+     * @return ParsedDataType returns ENUM_DATA
+     */
+    @Override
+    public YangConstructType getYangConstructType() {
+        return YangConstructType.ENUM_DATA;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj instanceof YangEnum) {
+            final YangEnum other = (YangEnum) obj;
+            return Objects.equals(namedValue, other.namedValue);
+        }
+        return false;
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hashCode(namedValue);
+    }
+
+    /**
+     * Validates the data on entering the corresponding parse tree node.
+     *
+     * @throws DataModelException a violation of data model rules
+     */
+    @Override
+    public void validateDataOnEntry() throws DataModelException {
+        // TODO auto-generated method stub, to be implemented by parser
+    }
+
+    /**
+     * Validates the data on exiting the corresponding parse tree node.
+     *
+     * @throws DataModelException a violation of data model rules
+     */
+    @Override
+    public void validateDataOnExit() throws DataModelException {
+        // TODO auto-generated method stub, to be implemented by parser
+    }
+
+    @Override
+    public int compareTo(YangEnum otherEnum) {
+        if (namedValue.equals(otherEnum.getNamedValue())) {
+            return 0;
+        }
+        return new Integer(value).compareTo(otherEnum.getValue());
+    }
+}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangEnumeration.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangEnumeration.java
new file mode 100644
index 0000000..cf23464
--- /dev/null
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangEnumeration.java
@@ -0,0 +1,152 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yangutils.datamodel;
+
+import java.util.SortedSet;
+import java.util.TreeSet;
+
+import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
+import org.onosproject.yangutils.datamodel.utils.Parsable;
+import org.onosproject.yangutils.datamodel.utils.YangConstructType;
+
+/*
+ * The enumeration built-in type represents values from a set of
+ *  assigned names.
+ */
+
+/**
+ * Represents the enumeration data type information.
+ */
+public class YangEnumeration
+        extends YangNode
+        implements Parsable, CollisionDetector {
+
+    private static final long serialVersionUID = 806201606L;
+
+    // Enumeration info set.
+    private SortedSet<YangEnum> enumSet;
+
+    // Enumeration name.
+    private String name;
+
+    /**
+     * Creates an enumeration object.
+     */
+    public YangEnumeration() {
+        super(YangNodeType.ENUMERATION_NODE);
+        setEnumSet(new TreeSet<YangEnum>());
+    }
+
+    /**
+     * Returns the ENUM set.
+     *
+     * @return the ENUM set
+     */
+    public SortedSet<YangEnum> getEnumSet() {
+        return enumSet;
+    }
+
+    /**
+     * Sets the ENUM set.
+     *
+     * @param enumSet the ENUM set to set
+     */
+    private void setEnumSet(SortedSet<YangEnum> enumSet) {
+        this.enumSet = enumSet;
+    }
+
+    /**
+     * Adds ENUM information.
+     *
+     * @param enumInfo the ENUM information to be added
+     * @throws DataModelException due to violation in data model rules
+     */
+    public void addEnumInfo(YangEnum enumInfo)
+            throws DataModelException {
+        if (!getEnumSet().add(enumInfo)) {
+            throw new DataModelException("YANG ENUM already exists");
+        }
+    }
+
+    /**
+     * Returns enumeration name.
+     *
+     * @return the enumeration name
+     */
+    @Override
+    public String getName() {
+        return name;
+    }
+
+    /**
+     * Sets the enumeration name.
+     *
+     * @param name enumeration name
+     */
+    @Override
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    /**
+     * Returns the type of the data.
+     *
+     * @return returns ENUMERATION_DATA
+     */
+    @Override
+    public YangConstructType getYangConstructType() {
+        return YangConstructType.ENUMERATION_DATA;
+    }
+
+    /**
+     * Validates the data on entering the corresponding parse tree node.
+     *
+     * @throws DataModelException a violation of data model rules
+     */
+    @Override
+    public void validateDataOnEntry()
+            throws DataModelException {
+        // TODO auto-generated method stub, to be implemented by parser
+    }
+
+    /**
+     * Validates the data on exiting the corresponding parse tree node.
+     *
+     * @throws DataModelException a violation of data model rules
+     */
+    @Override
+    public void validateDataOnExit()
+            throws DataModelException {
+        // TODO auto-generated method stub, to be implemented by parser
+    }
+
+    @Override
+    public void detectCollidingChild(String identifierName, YangConstructType dataType)
+            throws DataModelException {
+        /*
+        Do nothing, since it is not part of the schema tree, it is only type of an existing node in schema tree.
+         */
+    }
+
+    @Override
+    public void detectSelfCollision(String identifierName, YangConstructType dataType)
+            throws DataModelException {
+        /*
+        Do nothing, since it is not part of the schema tree, it is only type of an existing node in schema tree.
+         */
+    }
+}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangGrouping.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangGrouping.java
new file mode 100644
index 0000000..0f6ba7a
--- /dev/null
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangGrouping.java
@@ -0,0 +1,324 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.yangutils.datamodel;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
+import org.onosproject.yangutils.datamodel.utils.Parsable;
+import org.onosproject.yangutils.datamodel.utils.YangConstructType;
+
+import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.detectCollidingChildUtil;
+
+/*-
+ * Reference RFC 6020.
+ *
+ *  The "grouping" statement is used to define a reusable block of nodes,
+ *  which may be used locally in the module, in modules that include it,
+ *  and by other modules that import from it.  It takes one argument,
+ *  which is an identifier, followed by a block of sub-statements that
+ *  holds detailed grouping information.
+ *
+ *  The "grouping" statement is not a data definition statement and, as
+ *  such, does not define any nodes in the schema tree.
+ *
+ *  A grouping is like a "structure" or a "record" in conventional
+ *  programming languages.
+ *  Once a grouping is defined, it can be referenced in a "uses"
+ *  statement.  A grouping MUST NOT reference itself,
+ *  neither directly nor indirectly through a chain of other groupings.
+ *
+ *  If the grouping is defined at the top level of a YANG module or
+ *  submodule, the grouping's identifier MUST be unique within the
+ *  module.
+ *
+ *  A grouping is more than just a mechanism for textual substitution,
+ *  but defines a collection of nodes.  Identifiers appearing inside the
+ *  grouping are resolved relative to the scope in which the grouping is
+ *  defined, not where it is used.  Prefix mappings, type names, grouping
+ *  names, and extension usage are evaluated in the hierarchy where the
+ *  "grouping" statement appears.  For extensions, this means that
+ *  extensions are applied to the grouping node, not the uses node.
+ *
+ *  The grouping's sub-statements
+ *
+ *                +--------------+---------+-------------+------------------+
+ *                | substatement | section | cardinality |data model mapping|
+ *                +--------------+---------+-------------+------------------+
+ *                | anyxml       | 7.10    | 0..n        |-not supported    |
+ *                | choice       | 7.9     | 0..n        |-child nodes      |
+ *                | container    | 7.5     | 0..n        |-child nodes      |
+ *                | description  | 7.19.3  | 0..1        |-string           |
+ *                | grouping     | 7.11    | 0..n        |-child nodes      |
+ *                | leaf         | 7.6     | 0..n        |-YangLeaf         |
+ *                | leaf-list    | 7.7     | 0..n        |-YangLeafList     |
+ *                | list         | 7.8     | 0..n        |-child nodes      |
+ *                | reference    | 7.19.4  | 0..1        |-string           |
+ *                | status       | 7.19.2  | 0..1        |-YangStatus       |
+ *                | typedef      | 7.3     | 0..n        |-child nodes      |
+ *                | uses         | 7.12    | 0..n        |-child nodes      |
+ *                +--------------+---------+-------------+------------------+
+ */
+
+/**
+ * Represents data model node to maintain information defined in YANG grouping.
+ */
+public class YangGrouping
+        extends YangNode
+        implements YangLeavesHolder, YangCommonInfo, Parsable, CollisionDetector {
+
+    private static final long serialVersionUID = 806201607L;
+
+    /**
+     * Name of the grouping.
+     */
+    private String name;
+
+    /**
+     * Description.
+     */
+    private String description;
+
+    /**
+     * List of leaves.
+     */
+    private List<YangLeaf> listOfLeaf;
+
+    /**
+     * List of leaf lists.
+     */
+    private List<YangLeafList> listOfLeafList;
+
+    /**
+     * Reference of the module.
+     */
+    private String reference;
+
+    /**
+     * Status of the node.
+     */
+    private YangStatusType status;
+
+    /**
+     * Creates the grouping node.
+     */
+    public YangGrouping() {
+        super(YangNodeType.GROUPING_NODE);
+        listOfLeaf = new LinkedList<YangLeaf>();
+        listOfLeafList = new LinkedList<YangLeafList>();
+    }
+
+    /**
+     * Returns YANG grouping name.
+     *
+     * @return YANG grouping name
+     */
+    @Override
+    public String getName() {
+        return name;
+    }
+
+    /**
+     * Sets YANG grouping name.
+     *
+     * @param name YANG grouping name
+     */
+    @Override
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    /**
+     * Returns the description.
+     *
+     * @return the description
+     */
+    @Override
+    public String getDescription() {
+        return description;
+    }
+
+    /**
+     * Sets the description.
+     *
+     * @param description set the description
+     */
+    @Override
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    /**
+     * Returns the list of leaves.
+     *
+     * @return the list of leaves
+     */
+    @Override
+    public List<YangLeaf> getListOfLeaf() {
+        return listOfLeaf;
+    }
+
+    /**
+     * Sets the list of leaves.
+     *
+     * @param leafsList the list of leaf to set
+     */
+    @Override
+    public void setListOfLeaf(List<YangLeaf> leafsList) {
+        listOfLeaf = leafsList;
+    }
+
+    /**
+     * Adds a leaf.
+     *
+     * @param leaf the leaf to be added
+     */
+    @Override
+    public void addLeaf(YangLeaf leaf) {
+        getListOfLeaf().add(leaf);
+    }
+
+    /**
+     * Returns the list of leaf-list.
+     *
+     * @return the list of leaf-list
+     */
+    @Override
+    public List<YangLeafList> getListOfLeafList() {
+        return listOfLeafList;
+    }
+
+    /**
+     * Sets the list of leaf-list.
+     *
+     * @param listOfLeafList the list of leaf-list to set
+     */
+    @Override
+    public void setListOfLeafList(List<YangLeafList> listOfLeafList) {
+        this.listOfLeafList = listOfLeafList;
+    }
+
+    /**
+     * Adds a leaf-list.
+     *
+     * @param leafList the leaf-list to be added
+     */
+    @Override
+    public void addLeafList(YangLeafList leafList) {
+        getListOfLeafList().add(leafList);
+    }
+
+    /**
+     * 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 status.
+     *
+     * @return the status
+     */
+    @Override
+    public YangStatusType getStatus() {
+        return status;
+    }
+
+    /**
+     * Sets the status.
+     *
+     * @param status the status to set
+     */
+    @Override
+    public void setStatus(YangStatusType status) {
+        this.status = status;
+    }
+
+    /**
+     * Returns the type of the data.
+     *
+     * @return returns GROUPING_DATA
+     */
+    @Override
+    public YangConstructType getYangConstructType() {
+        return YangConstructType.GROUPING_DATA;
+    }
+
+    /**
+     * Validates the data on entering the corresponding parse tree node.
+     *
+     * @throws DataModelException a violation of data model rules
+     */
+    @Override
+    public void validateDataOnEntry()
+            throws DataModelException {
+        // TODO auto-generated method stub, to be implemented by parser
+    }
+
+    /**
+     * Validates the data on exiting the corresponding parse tree node.
+     *
+     * @throws DataModelException a violation of data model rules
+     */
+    @Override
+    public void validateDataOnExit()
+            throws DataModelException {
+        // TODO auto-generated method stub, to be implemented by parser
+    }
+
+    /*
+     * Reference RFC6020
+     *
+     * Once a grouping is defined, it can be referenced in a "uses"
+     * statement (see Section 7.12).  A grouping MUST NOT reference itself,
+     * neither directly nor indirectly through a chain of other groupings.
+     *
+     * If the grouping is defined at the top level of a YANG module or
+     * submodule, the grouping's identifier MUST be unique within the
+     * module.
+     */
+    @Override
+    public void detectCollidingChild(String identifierName, YangConstructType dataType)
+            throws DataModelException {
+        // Asks helper to detect colliding child.
+        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 grouping \"" +
+                    getName() + "\"");
+        }
+    }
+    // TODO  A grouping MUST NOT reference itself, neither directly nor indirectly through a chain of other groupings.
+}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangImport.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangImport.java
new file mode 100644
index 0000000..0fcf663
--- /dev/null
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangImport.java
@@ -0,0 +1,288 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.yangutils.datamodel;
+
+import java.io.Serializable;
+import java.util.Set;
+
+import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
+import org.onosproject.yangutils.datamodel.utils.Parsable;
+import org.onosproject.yangutils.datamodel.utils.YangConstructType;
+
+import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.findReferredNode;
+
+/*
+ *  Reference:RFC 6020.
+ *  The "import" statement makes definitions from one module available
+ *  inside another module or submodule.  The argument is the name of the
+ *  module to import, and the statement is followed by a block of
+ *  sub statements that holds detailed import information.
+ *  When a module is imported, the importing module may:
+ *  o  use any grouping and typedef defined at the top level in the
+ *     imported module or its submodules.
+ *
+ *  o  use any extension, feature, and identity defined in the imported
+ *     module or its submodules.
+ *
+ *  o  use any node in the imported module's schema tree in "must",
+ *     "path", and "when" statements, or as the target node in "augment"
+ *     and "deviation" statements.
+ *
+ *  The mandatory "prefix" sub statement assigns a prefix for the imported
+ *  module that is scoped to the importing module or submodule.  Multiple
+ *  "import" statements may be specified to import from different
+ *  modules.
+ *  When the optional "revision-date" sub-statement is present, any
+ *  typedef, grouping, extension, feature, and identity referenced by
+ *  definitions in the local module are taken from the specified revision
+ *  of the imported module.  It is an error if the specified revision of
+ *  the imported module does not exist.  If no "revision-date"
+ *  sub-statement is present, it is undefined from which revision of the
+ *  module they are taken.
+ *
+ *  Multiple revisions of the same module MUST NOT be imported.
+ *
+ *                       The import's Substatements
+ *
+ *                +---------------+---------+-------------+------------------+
+ *                | substatement  | section | cardinality |data model mapping|
+ *                +---------------+---------+-------------+------------------+
+ *                | prefix        | 7.1.4   | 1           | string           |
+ *                | revision-date | 7.1.5.1 | 0..1        | string           |
+ *                +---------------+---------+-------------+------------------+
+ */
+
+/**
+ * Represents the information about the imported modules.
+ */
+public class YangImport
+        implements Parsable, LocationInfo, Serializable {
+
+    private static final long serialVersionUID = 806201642L;
+
+    /**
+     * Name of the module that is being imported.
+     */
+    private String name;
+
+    /**
+     * Prefix used to identify the entities from the imported module.
+     */
+    private String prefixId;
+
+    /**
+     * Reference:RFC 6020.
+     * <p>
+     * The import's "revision-date" statement is used to specify the exact
+     * version of the module to import. The "revision-date" statement MUST match
+     * the most recent "revision" statement in the imported module. organization
+     * which defined the YANG module.
+     */
+    private String revision;
+
+    /**
+     * Reference to node which is imported.
+     */
+    private YangNode importedNode;
+
+    // Error Line number.
+    private transient int lineNumber;
+
+    // Error character position.
+    private transient int charPosition;
+
+    /**
+     * Creates a YANG import.
+     */
+    public YangImport() {
+    }
+
+    /**
+     * Returns the imported module name.
+     *
+     * @return the module name
+     */
+    public String getModuleName() {
+        return name;
+    }
+
+    /**
+     * Sets module name.
+     *
+     * @param moduleName the module name to set
+     */
+    public void setModuleName(String moduleName) {
+        name = moduleName;
+    }
+
+    /**
+     * Returns the prefix used to identify the entities from the imported module.
+     *
+     * @return the prefix used to identify the entities from the imported
+     * module
+     */
+    public String getPrefixId() {
+        return prefixId;
+    }
+
+    /**
+     * Sets prefix identifier.
+     *
+     * @param prefixId set the prefix identifier of the imported module
+     */
+    public void setPrefixId(String prefixId) {
+        this.prefixId = prefixId;
+    }
+
+    /**
+     * Returns the revision of the imported module.
+     *
+     * @return the revision of the imported module
+     */
+    public String getRevision() {
+        return revision;
+    }
+
+    /**
+     * Sets the revision of the imported module.
+     *
+     * @param rev set the revision of the imported module
+     */
+    public void setRevision(String rev) {
+        revision = rev;
+    }
+
+    /**
+     * Returns the type of the parsed data.
+     *
+     * @return returns IMPORT_DATA
+     */
+    @Override
+    public YangConstructType getYangConstructType() {
+        return YangConstructType.IMPORT_DATA;
+    }
+
+    /**
+     * Validates the data on entering the corresponding parse tree node.
+     *
+     * @throws DataModelException a violation of data model rules
+     */
+    @Override
+    public void validateDataOnEntry()
+            throws DataModelException {
+        // TODO auto-generated method stub, to be implemented by parser
+
+    }
+
+    /**
+     * Validates the data on exiting the corresponding parse tree node.
+     *
+     * @throws DataModelException a violation of data model rules
+     */
+    @Override
+    public void validateDataOnExit()
+            throws DataModelException {
+        // TODO auto-generated method stub, to be implemented by parser
+
+    }
+
+    /**
+     * Returns imported node.
+     *
+     * @return imported node
+     */
+    public YangNode getImportedNode() {
+        return importedNode;
+    }
+
+    /**
+     * Sets imported node.
+     *
+     * @param importedNode imported node
+     */
+    public void setImportedNode(YangNode importedNode) {
+        this.importedNode = importedNode;
+    }
+
+    @Override
+    public int getLineNumber() {
+        return lineNumber;
+    }
+
+    @Override
+    public int getCharPosition() {
+        return charPosition;
+    }
+
+    @Override
+    public void setLineNumber(int lineNumber) {
+        this.lineNumber = lineNumber;
+    }
+
+    @Override
+    public void setCharPosition(int charPositionInLine) {
+        charPosition = charPositionInLine;
+    }
+
+    /**
+     * Adds reference to an import.
+     *
+     * @param yangNodeSet YANG file info set
+     * @throws DataModelException a violation of data model rules
+     */
+    public void addReferenceToImport(Set<YangNode> yangNodeSet) throws DataModelException {
+        String importedModuleName = getModuleName();
+        String importedModuleRevision = getRevision();
+        YangNode moduleNode = null;
+        /*
+         * Find the imported module node for a given module name with a
+         * specified revision if revision is not null.
+         */
+        if (importedModuleRevision != null) {
+            String importedModuleNameWithRevision = importedModuleName + "@" + importedModuleRevision;
+            moduleNode = findReferredNode(yangNodeSet, importedModuleNameWithRevision);
+        }
+
+        /*
+         * Find the imported module node for a given module name without
+         * revision if can't find with revision.
+         */
+        if (moduleNode == null) {
+            moduleNode = findReferredNode(yangNodeSet, importedModuleName);
+        }
+
+        if (moduleNode != null) {
+            if (moduleNode instanceof YangModule) {
+                if (getRevision() == null || getRevision().isEmpty()) {
+                    setImportedNode(moduleNode);
+                    return;
+                }
+                // Match revision if import is with revision.
+                if (((YangModule) moduleNode).getRevision().getRevDate().equals(importedModuleRevision)) {
+                    setImportedNode(moduleNode);
+                    return;
+                }
+            }
+        }
+
+        // Exception if there is no match.
+        DataModelException exception = new DataModelException("YANG file error : Imported module "
+                + importedModuleName + " with revision " + importedModuleRevision + " is not found.");
+        exception.setLine(getLineNumber());
+        exception.setCharPosition(getCharPosition());
+        throw exception;
+    }
+}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangInclude.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangInclude.java
new file mode 100644
index 0000000..5970a24
--- /dev/null
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangInclude.java
@@ -0,0 +1,242 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.yangutils.datamodel;
+
+import java.io.Serializable;
+import java.util.Set;
+
+import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
+import org.onosproject.yangutils.datamodel.utils.Parsable;
+import org.onosproject.yangutils.datamodel.utils.YangConstructType;
+
+import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.findReferredNode;
+
+/*
+ * Reference:RFC 6020.
+ * The "include" statement is used to make content from a submodule
+ *  available to that submodule's parent module, or to another submodule
+ *  of that parent module.  The argument is an identifier that is the
+ *  name of the submodule to include.
+ *  The includes's Substatements
+ *
+ *                +---------------+---------+-------------+------------------+
+ *                | substatement  | section | cardinality |data model mapping|
+ *                +---------------+---------+-------------+------------------+
+ *                | revision-date | 7.1.5.1 | 0..1        | string           |
+ *                +---------------+---------+-------------+------------------+
+ */
+
+/**
+ * Represents the information about the included sub-modules.
+ */
+public class YangInclude
+        implements Parsable, LocationInfo, Serializable {
+
+    private static final long serialVersionUID = 806201644L;
+
+    /**
+     * Name of the sub-module that is being included.
+     */
+    private String subModuleName;
+
+    /**
+     * The include's "revision-date" statement is used to specify the exact
+     * version of the submodule to import.
+     */
+    private String revision;
+
+    /**
+     * Reference to node which is included.
+     */
+    private YangNode includedNode;
+
+    // Error Line number.
+    private transient int lineNumber;
+
+    // Error character position.
+    private transient int charPosition;
+
+    /**
+     * Creates a YANG include.
+     */
+    public YangInclude() {
+    }
+
+    /**
+     * Returns the name of included sub-module.
+     *
+     * @return the sub-module name
+     */
+    public String getSubModuleName() {
+        return subModuleName;
+    }
+
+    /**
+     * Sets the name of included sub-modules.
+     *
+     * @param subModuleName the sub-module name to set
+     */
+    public void setSubModuleName(String subModuleName) {
+        this.subModuleName = subModuleName;
+    }
+
+    /**
+     * Returns the revision.
+     *
+     * @return the revision
+     */
+    public String getRevision() {
+        return revision;
+    }
+
+    /**
+     * Sets the revision.
+     *
+     * @param revision the revision to set
+     */
+    public void setRevision(String revision) {
+        this.revision = revision;
+    }
+
+    /**
+     * Returns the type of parsed data.
+     *
+     * @return returns INCLUDE_DATA
+     */
+    @Override
+    public YangConstructType getYangConstructType() {
+        return YangConstructType.INCLUDE_DATA;
+    }
+
+    /**
+     * Validates the data on entering the corresponding parse tree node.
+     *
+     * @throws DataModelException a violation of data model rules
+     */
+    @Override
+    public void validateDataOnEntry()
+            throws DataModelException {
+        // TODO auto-generated method stub, to be implemented by parser
+
+    }
+
+    /**
+     * Validates the data on exiting the corresponding parse tree node.
+     *
+     * @throws DataModelException a violation of data model rules
+     */
+    @Override
+    public void validateDataOnExit()
+            throws DataModelException {
+        // TODO auto-generated method stub, to be implemented by parser
+
+    }
+
+    public YangNode getIncludedNode() {
+        return includedNode;
+    }
+
+    public void setIncludedNode(YangNode includedNode) {
+        this.includedNode = includedNode;
+    }
+
+    @Override
+    public int getLineNumber() {
+        return lineNumber;
+    }
+
+    @Override
+    public int getCharPosition() {
+        return charPosition;
+    }
+
+    @Override
+    public void setLineNumber(int lineNumber) {
+        this.lineNumber = lineNumber;
+    }
+
+    @Override
+    public void setCharPosition(int charPositionInLine) {
+        charPosition = charPositionInLine;
+    }
+
+    /**
+     * Adds reference to an include.
+     *
+     * @param yangNodeSet YANG node set
+     * @return YANG sub module node
+     * @throws DataModelException a violation of data model rules
+     */
+    public YangSubModule addReferenceToInclude(Set<YangNode> yangNodeSet) throws DataModelException {
+        String includedSubModuleName = getSubModuleName();
+        String includedSubModuleRevision = getRevision();
+        YangNode subModuleNode = null;
+
+        /*
+         * Find the included sub-module node for a given module name with a
+         * specified revision if revision is not null.
+         */
+        if (includedSubModuleRevision != null) {
+            String includedSubModuleNameWithRevision = includedSubModuleName + "@" + includedSubModuleRevision;
+            subModuleNode = findReferredNode(yangNodeSet, includedSubModuleNameWithRevision);
+        }
+
+        /*
+         * Find the imported sub module node for a given module name without
+         * revision if can't find with revision.
+         */
+        if (subModuleNode == null) {
+            subModuleNode = findReferredNode(yangNodeSet, includedSubModuleName);
+        }
+
+        if (subModuleNode != null) {
+            if (subModuleNode instanceof YangSubModule) {
+                if (getRevision() == null || getRevision().isEmpty()) {
+                    setIncludedNode(subModuleNode);
+                    return (YangSubModule) subModuleNode;
+                }
+                // Match revision if inclusion is with revision.
+                if (((YangSubModule) subModuleNode).getRevision().getRevDate().equals(includedSubModuleRevision)) {
+                    setIncludedNode(subModuleNode);
+                    return (YangSubModule) subModuleNode;
+                }
+            }
+        }
+        // Exception if there is no match.
+        DataModelException exception = new DataModelException("YANG file error : Included sub module " +
+                includedSubModuleName + "with a given revision is not found.");
+        exception.setLine(getLineNumber());
+        exception.setCharPosition(getCharPosition());
+        throw exception;
+    }
+
+    /**
+     * Reports an error when included sub-module doesn't meet condition that
+     * "included sub-modules should belong module, as defined by the
+     * "belongs-to" statement or sub-modules are only allowed to include other
+     * sub-modules belonging to the same module.
+     *
+     * @throws DataModelException a violation in data model rule
+     */
+    public void reportIncludeError() throws DataModelException {
+        DataModelException exception = new DataModelException("YANG file error : Included sub-module " +
+                getSubModuleName() + "doesn't belongs to parent module also it doesn't belongs" +
+                "to sub-module belonging to the same parent module.");
+        exception.setLine(getLineNumber());
+        exception.setCharPosition(getCharPosition());
+        throw exception;
+    }
+}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangInput.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangInput.java
new file mode 100644
index 0000000..7238a3e
--- /dev/null
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangInput.java
@@ -0,0 +1,174 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yangutils.datamodel;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
+import org.onosproject.yangutils.datamodel.utils.Parsable;
+import org.onosproject.yangutils.datamodel.utils.YangConstructType;
+
+import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.detectCollidingChildUtil;
+
+/*
+ * Reference RFC 6020.
+ *
+ * The "input" statement, which is optional, is used to define input
+ * parameters to the RPC operation.  It does not take an argument.  The
+ * substatements to "input" define nodes under the RPC's input node.
+ *
+ * If a leaf in the input tree has a "mandatory" statement with the
+ * value "true", the leaf MUST be present in a NETCONF RPC invocation.
+ * Otherwise, the server MUST return a "missing-element" error.
+ *
+ * If a leaf in the input tree has a default value, the NETCONF server
+ * MUST use this value in the same cases as described in Section 7.6.1.
+ * In these cases, the server MUST operationally behave as if the leaf
+ * was present in the NETCONF RPC invocation with the default value as
+ * its value.
+ *
+ * If a "config" statement is present for any node in the input tree,
+ * the "config" statement is ignored.
+ *
+ * If any node has a "when" statement that would evaluate to false, then
+ * this node MUST NOT be present in the input tree.
+ *
+ * The input substatements
+ *
+ *     +--------------+---------+-------------+------------------+
+ *     | substatement | section | cardinality |data model mapping|
+ *     +--------------+---------+-------------+------------------+
+ *     | anyxml       | 7.10    | 0..n        | -not supported   |
+ *     | choice       | 7.9     | 0..n        | -child nodes     |
+ *     | container    | 7.5     | 0..n        | -child nodes     |
+ *     | grouping     | 7.11    | 0..n        | -child nodes     |
+ *     | leaf         | 7.6     | 0..n        | -YangLeaf        |
+ *     | leaf-list    | 7.7     | 0..n        | -YangLeafList    |
+ *     | list         | 7.8     | 0..n        | -child nodes     |
+ *     | typedef      | 7.3     | 0..n        | -child nodes     |
+ *     | uses         | 7.12    | 0..n        | -child nodes     |
+ *     +--------------+---------+-------------+------------------+
+ */
+
+/**
+ * Represents data model node to maintain information defined in YANG input.
+ */
+public class YangInput
+        extends YangNode
+        implements YangLeavesHolder, Parsable, CollisionDetector, YangAugmentationHolder {
+
+    private static final long serialVersionUID = 806201608L;
+
+    /**
+     * Name of the input.
+     */
+    private String name;
+
+    /**
+     * List of leaves contained.
+     */
+    private List<YangLeaf> listOfLeaf;
+
+    /**
+     * List of leaf-lists contained.
+     */
+    private List<YangLeafList> listOfLeafList;
+
+    /**
+     * Create a rpc input node.
+     */
+    public YangInput() {
+        super(YangNodeType.INPUT_NODE);
+        listOfLeaf = new LinkedList<YangLeaf>();
+        listOfLeafList = new LinkedList<YangLeafList>();
+    }
+
+    @Override
+    public void detectCollidingChild(String identifierName, YangConstructType dataType)
+            throws DataModelException {
+        // Detect colliding child.
+        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() + "\"");
+        }
+    }
+
+    @Override
+    public YangConstructType getYangConstructType() {
+        return YangConstructType.INPUT_DATA;
+    }
+
+    @Override
+    public void validateDataOnEntry()
+            throws DataModelException {
+        //TODO: implement the method.
+    }
+
+    @Override
+    public void validateDataOnExit()
+            throws DataModelException {
+        //TODO: implement the method.
+    }
+
+    @Override
+    public List<YangLeaf> getListOfLeaf() {
+        return listOfLeaf;
+    }
+
+    @Override
+    public void setListOfLeaf(List<YangLeaf> leafsList) {
+        listOfLeaf = leafsList;
+    }
+
+
+    @Override
+    public void addLeaf(YangLeaf leaf) {
+        getListOfLeaf().add(leaf);
+    }
+
+    @Override
+    public List<YangLeafList> getListOfLeafList() {
+        return listOfLeafList;
+    }
+
+    @Override
+    public void setListOfLeafList(List<YangLeafList> listOfLeafList) {
+        this.listOfLeafList = listOfLeafList;
+    }
+
+    @Override
+    public void addLeafList(YangLeafList leafList) {
+        getListOfLeafList().add(leafList);
+    }
+
+    @Override
+    public String getName() {
+        return name;
+    }
+
+    @Override
+    public void setName(String name) {
+        this.name = name;
+    }
+}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangLeaf.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangLeaf.java
new file mode 100644
index 0000000..0391518
--- /dev/null
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangLeaf.java
@@ -0,0 +1,349 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yangutils.datamodel;
+
+import java.io.Serializable;
+
+import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
+import org.onosproject.yangutils.datamodel.utils.Parsable;
+import org.onosproject.yangutils.datamodel.utils.YangConstructType;
+
+/*
+ * Reference:RFC 6020.
+ *  The "leaf" statement is used to define a leaf node in the schema
+ *  tree.  It takes one argument, which is an identifier, followed by a
+ *  block of sub-statements that holds detailed leaf information.
+ *
+ *  A leaf node has a value, but no child nodes in the data tree.
+ *  Conceptually, the value in the data tree is always in the canonical
+ *  form.
+ *
+ *  A leaf node exists in zero or one instances in the data tree.
+ *
+ *  The "leaf" statement is used to define a scalar variable of a
+ *  particular built-in or derived type.
+ *
+ * The leaf's sub-statements
+ *
+ *       +--------------+---------+-------------+------------------+
+ *       | substatement | section | cardinality |data model mapping|
+ *       +--------------+---------+-------------+------------------+
+ *       | config       | 7.19.1  | 0..1        | - boolean        |
+ *       | default      | 7.6.4   | 0..1        | - TODO           |
+ *       | description  | 7.19.3  | 0..1        | - string         |
+ *       | if-feature   | 7.18.2  | 0..n        | - TODO           |
+ *       | mandatory    | 7.6.5   | 0..1        | - boolean        |
+ *       | must         | 7.5.3   | 0..n        | - TODO           |
+ *       | reference    | 7.19.4  | 0..1        | - string         |
+ *       | status       | 7.19.2  | 0..1        | - YangStatus     |
+ *       | type         | 7.6.3   | 1           | - YangType       |
+ *       | units        | 7.3.3   | 0..1        | - String         |
+ *       | when         | 7.19.5  | 0..1        | - TODO           |
+ *       +--------------+---------+-------------+------------------+
+ */
+
+/**
+ * Represents leaf data represented in YANG.
+ */
+public class YangLeaf
+        implements YangCommonInfo, Parsable, Cloneable, Serializable {
+
+    private static final long serialVersionUID = 806201635L;
+
+    /**
+     * Name of leaf.
+     */
+    private String name;
+
+    /**
+     * If the leaf is a config parameter.
+     */
+    private Boolean isConfig;
+
+    /**
+     * description of leaf.
+     */
+    private String description;
+
+    /**
+     * If mandatory leaf.
+     */
+    private boolean isMandatory;
+
+    /**
+     * The textual reference to this leaf.
+     */
+    private String reference;
+
+    /**
+     * Status of leaf in YANG definition.
+     */
+    private YangStatusType status = YangStatusType.CURRENT;
+
+    /**
+     * Textual units info.
+     */
+    private String units;
+
+    /**
+     * Data type of the leaf.
+     */
+    private YangType<?> dataType;
+
+    /**
+     * Default value in string, needs to be converted to the target object,
+     * based on the type.
+     */
+    private String defaultValueInString;
+
+    /**
+     * YANG Node in which the leaf is contained.
+     */
+    private transient YangLeavesHolder containedIn;
+
+    /**
+     * Creates a YANG leaf.
+     */
+    public YangLeaf() {
+    }
+
+    /**
+     * Returns the name of leaf.
+     *
+     * @return the leaf name
+     */
+    public String getName() {
+        return name;
+    }
+
+    /**
+     * Sets the name of leaf.
+     *
+     * @param leafName the leaf name to set
+     */
+    public void setLeafName(String leafName) {
+        name = leafName;
+    }
+
+    /**
+     * Returns the config flag.
+     *
+     * @return if config flag
+     */
+    public Boolean isConfig() {
+        return isConfig;
+    }
+
+    /**
+     * Sets the config flag.
+     *
+     * @param isCfg the flag value to set
+     */
+    public void setConfig(boolean isCfg) {
+        isConfig = isCfg;
+    }
+
+    /**
+     * Returns the description.
+     *
+     * @return the description
+     */
+    @Override
+    public String getDescription() {
+        return description;
+    }
+
+    /**
+     * Sets the description.
+     *
+     * @param description set the description
+     */
+    @Override
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    /**
+     * Returns if the leaf is mandatory.
+     *
+     * @return if leaf is mandatory
+     */
+    public boolean isMandatory() {
+        return isMandatory;
+    }
+
+    /**
+     * Sets if the leaf is mandatory.
+     *
+     * @param isReq if the leaf is mandatory
+     */
+    public void setMandatory(boolean isReq) {
+        isMandatory = isReq;
+    }
+
+    /**
+     * 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 status.
+     *
+     * @return the status
+     */
+    @Override
+    public YangStatusType getStatus() {
+        return status;
+    }
+
+    /**
+     * Sets the status.
+     *
+     * @param status the status to set
+     */
+    @Override
+    public void setStatus(YangStatusType status) {
+        this.status = status;
+    }
+
+    /**
+     * Returns the units.
+     *
+     * @return the units
+     */
+    public String getUnits() {
+        return units;
+    }
+
+    /**
+     * Sets the units.
+     *
+     * @param units the units to set
+     */
+    public void setUnits(String units) {
+        this.units = units;
+    }
+
+    /**
+     * Returns the default value.
+     *
+     * @return the default value
+     */
+    public String getDefaultValueInString() {
+        return defaultValueInString;
+    }
+
+    /**
+     * Sets the default value.
+     *
+     * @param defaultValueInString the default value
+     */
+    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;
+    }
+
+    /**
+     * Retrieves the YANG node in which the leaf is defined.
+     *
+     * @return the YANG node in which the leaf is defined
+     */
+    public YangLeavesHolder getContainedIn() {
+        return containedIn;
+    }
+
+    /**
+     * Assigns the YANG node in which the leaf is defined.
+     *
+     * @param containedIn the YANG node in which the leaf is defined
+     */
+    public void setContainedIn(YangLeavesHolder containedIn) {
+        this.containedIn = containedIn;
+    }
+
+    @Override
+    public YangLeaf clone()
+            throws CloneNotSupportedException {
+        return (YangLeaf) super.clone();
+    }
+
+    /**
+     * Returns the type of the parsed data.
+     *
+     * @return returns LEAF_DATA
+     */
+    @Override
+    public YangConstructType getYangConstructType() {
+        return YangConstructType.LEAF_DATA;
+    }
+
+    /**
+     * Validates the data on entering the corresponding parse tree node.
+     *
+     * @throws DataModelException a violation of data model rules
+     */
+    @Override
+    public void validateDataOnEntry()
+            throws DataModelException {
+        // TODO auto-generated method stub, to be implemented by parser
+
+    }
+
+    /**
+     * Validates the data on exiting the corresponding parse tree node.
+     *
+     * @throws DataModelException a violation of data model rules
+     */
+    @Override
+    public void validateDataOnExit()
+            throws DataModelException {
+        // TODO auto-generated method stub, to be implemented by parser
+
+    }
+}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangLeafList.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangLeafList.java
new file mode 100644
index 0000000..2ce44fb
--- /dev/null
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangLeafList.java
@@ -0,0 +1,366 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yangutils.datamodel;
+
+import java.io.Serializable;
+
+import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
+import org.onosproject.yangutils.datamodel.utils.Parsable;
+import org.onosproject.yangutils.datamodel.utils.YangConstructType;
+
+/*
+ *  Reference:RFC 6020.
+ *  Where the "leaf" statement is used to define a simple scalar variable
+ *  of a particular type, the "leaf-list" statement is used to define an
+ *  array of a particular type.  The "leaf-list" statement takes one
+ *  argument, which is an identifier, followed by a block of
+ *  sub-statements that holds detailed leaf-list information.
+ *
+ *  The values in a leaf-list MUST be unique.
+ *
+ * The leaf-list's sub-statements
+ *
+ *                +--------------+---------+-------------+------------------+
+ *                | substatement | section | cardinality |data model mapping|
+ *                +--------------+---------+-------------+------------------+
+ *                | config       | 7.19.1  | 0..1        | -boolean         |
+ *                | description  | 7.19.3  | 0..1        | -string          |
+ *                | if-feature   | 7.18.2  | 0..n        | -TODO            |
+ *                | max-elements | 7.7.4   | 0..1        | -int             |
+ *                | min-elements | 7.7.3   | 0..1        | -int             |
+ *                | must         | 7.5.3   | 0..n        | -TODO            |
+ *                | ordered-by   | 7.7.5   | 0..1        | -TODO            |
+ *                | reference    | 7.19.4  | 0..1        | -string          |
+ *                | status       | 7.19.2  | 0..1        | -YangStatus      |
+ *                | type         | 7.4     | 1           | -YangType        |
+ *                | units        | 7.3.3   | 0..1        | -string          |
+ *                | when         | 7.19.5  | 0..1        | -TODO            |
+ *                +--------------+---------+-------------+------------------+
+ */
+
+/**
+ * Represents leaf-list data represented in YANG.
+ */
+public class YangLeafList
+        implements YangCommonInfo, Parsable, Cloneable, Serializable {
+
+    private static final long serialVersionUID = 806201637L;
+
+    /**
+     * Name of leaf-list.
+     */
+    private String name;
+
+    /**
+     * If the leaf-list is a config parameter.
+     */
+    private Boolean isConfig;
+
+    /**
+     * Description of leaf-list.
+     */
+    private String description;
+
+    /**
+     * Reference:RFC 6020.
+     *
+     * The "max-elements" statement, which is optional, takes as an argument a
+     * positive integer or the string "unbounded", which puts a constraint on
+     * valid list entries. A valid leaf-list or list always has at most
+     * max-elements entries.
+     *
+     * If no "max-elements" statement is present, it defaults to "unbounded".
+     */
+    private int maxElelements = Integer.MAX_VALUE;
+
+    /**
+     * Reference:RFC 6020.
+     *
+     * The "min-elements" statement, which is optional, takes as an argument a
+     * non-negative integer that puts a constraint on valid list entries. A
+     * valid leaf-list or list MUST have at least min-elements entries.
+     *
+     * If no "min-elements" statement is present, it defaults to zero.
+     *
+     * The behavior of the constraint depends on the type of the leaf-list's or
+     * list's closest ancestor node in the schema tree that is not a non-
+     * presence container:
+     *
+     * o If this ancestor is a case node, the constraint is enforced if any
+     * other node from the case exists.
+     *
+     * o Otherwise, it is enforced if the ancestor node exists.
+     */
+    private int minElements = 0;
+
+    /**
+     * The textual reference to this leaf-list.
+     */
+    private String reference;
+
+    /**
+     * Status of the leaf-list in the YANG definition.
+     */
+    private YangStatusType status = YangStatusType.CURRENT;
+
+    /**
+     * Textual units.
+     */
+    private String units;
+
+    /**
+     * Data type of leaf-list.
+     */
+    private YangType<?> dataType;
+
+    /**
+     * YANG Node in which the leaf is contained.
+     */
+    private transient YangLeavesHolder containedIn;
+
+    /**
+     * Creates a YANG leaf-list.
+     */
+    public YangLeafList() {
+    }
+
+    /**
+     * Returns the leaf-list name.
+     *
+     * @return the leaf-list name
+     */
+    public String getName() {
+        return name;
+    }
+
+    /**
+     * Sets the leaf-list name.
+     *
+     * @param leafListName the leaf-list name to set
+     */
+    public void setLeafName(String leafListName) {
+        name = leafListName;
+    }
+
+    /**
+     * Returns the config flag.
+     *
+     * @return the config flag
+     */
+    public Boolean isConfig() {
+        return isConfig;
+    }
+
+    /**
+     * Sets the config flag.
+     *
+     * @param isCfg the config flag
+     */
+    public void setConfig(boolean isCfg) {
+        isConfig = isCfg;
+    }
+
+    /**
+     * Returns the description.
+     *
+     * @return the description
+     */
+    @Override
+    public String getDescription() {
+        return description;
+    }
+
+    /**
+     * Sets the description.
+     *
+     * @param description set the description
+     */
+    @Override
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    /**
+     * Returns the max elements no.
+     *
+     * @return the max elements no
+     */
+    public int getMaxElelements() {
+        return maxElelements;
+    }
+
+    /**
+     * Sets the max elements no.
+     *
+     * @param maxElelements max elements no
+     */
+    public void setMaxElelements(int maxElelements) {
+        this.maxElelements = maxElelements;
+    }
+
+    /**
+     * Returns the min elements no.
+     *
+     * @return the min elements no
+     */
+    public int getMinElements() {
+        return minElements;
+    }
+
+    /**
+     * Sets the min elements no.
+     *
+     * @param minElements the min elements no
+     */
+    public void setMinElements(int minElements) {
+        this.minElements = minElements;
+    }
+
+    /**
+     * 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 status.
+     *
+     * @return the status
+     */
+    @Override
+    public YangStatusType getStatus() {
+        return status;
+    }
+
+    /**
+     * Sets the status.
+     *
+     * @param status the status to set
+     */
+    @Override
+    public void setStatus(YangStatusType status) {
+        this.status = status;
+    }
+
+    /**
+     * Returns the units.
+     *
+     * @return the units
+     */
+    public String getUnits() {
+        return units;
+    }
+
+    /**
+     * Sets the units.
+     *
+     * @param units the units to set
+     */
+    public void setUnits(String units) {
+        this.units = units;
+    }
+
+    /**
+     * 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;
+    }
+
+    /**
+     * Retrieves the YANG node in which the leaf is defined.
+     *
+     * @return the YANG node in which the leaf is defined
+     */
+    public YangLeavesHolder getContainedIn() {
+        return containedIn;
+    }
+
+    /**
+     * Assigns the YANG node in which the leaf is defined.
+     *
+     * @param containedIn the YANG node in which the leaf is defined
+     */
+    public void setContainedIn(YangLeavesHolder containedIn) {
+        this.containedIn = containedIn;
+    }
+
+    @Override
+    public YangLeafList clone()
+            throws CloneNotSupportedException {
+        return (YangLeafList) super.clone();
+    }
+
+    /**
+     * Returns the type of the parsed data.
+     *
+     * @return returns LEAF_LIST_DATA
+     */
+    @Override
+    public YangConstructType getYangConstructType() {
+        return YangConstructType.LEAF_LIST_DATA;
+    }
+
+    /**
+     * Validates the data on entering the corresponding parse tree node.
+     *
+     * @throws DataModelException a violation of data model rules
+     */
+    @Override
+    public void validateDataOnEntry()
+            throws DataModelException {
+        // TODO auto-generated method stub, to be implemented by parser
+
+    }
+
+    /**
+     * Validates the data on exiting the corresponding parse tree node.
+     *
+     * @throws DataModelException a violation of data model rules
+     */
+    @Override
+    public void validateDataOnExit()
+            throws DataModelException {
+        // TODO auto-generated method stub, to be implemented by parser
+
+    }
+}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangLeavesHolder.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangLeavesHolder.java
new file mode 100644
index 0000000..a21ed34
--- /dev/null
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangLeavesHolder.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yangutils.datamodel;
+
+import java.util.List;
+
+/**
+ * Abstraction of atomic configurable/status entity. It is used to abstract the
+ * data holders of leaf or leaf list. Used in leaves parsing or attribute code
+ * generation.
+ */
+public interface YangLeavesHolder {
+
+    /**
+     * Returns the list of leaves from data holder like container / list.
+     *
+     * @return the list of leaves
+     */
+    List<YangLeaf> getListOfLeaf();
+
+    /**
+     * Sets the list of leaves.
+     *
+     * @param leafsList the list of leaf to set
+     */
+    void setListOfLeaf(List<YangLeaf> leafsList);
+
+    /**
+     * Adds leaf in data holder like container / list.
+     *
+     * @param leaf the leaf to be added
+     */
+    void addLeaf(YangLeaf leaf);
+
+    /**
+     * Returns the list of leaf-list from data holder like container / list.
+     *
+     * @return the list of leaf-list
+     */
+    List<YangLeafList> getListOfLeafList();
+
+    /**
+     * Sets the list of leaf-list.
+     *
+     * @param listOfLeafList the list of leaf-list to set
+     */
+    void setListOfLeafList(List<YangLeafList> listOfLeafList);
+
+    /**
+     * Adds leaf-list in data holder like container / list.
+     *
+     * @param leafList the leaf-list to be added
+     */
+    void addLeafList(YangLeafList leafList);
+}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangLengthRestriction.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangLengthRestriction.java
new file mode 100644
index 0000000..a89c09e
--- /dev/null
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangLengthRestriction.java
@@ -0,0 +1,221 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yangutils.datamodel;
+
+import java.io.Serializable;
+
+/*-
+ * Reference RFC 6020.
+ *
+ * Binary can be restricted with "length" statements alone.
+ *
+ */
+
+import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
+import org.onosproject.yangutils.datamodel.utils.Parsable;
+import org.onosproject.yangutils.datamodel.utils.YangConstructType;
+import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangUint64;
+
+/**
+ * Represents the restriction for length data type.
+ */
+public class YangLengthRestriction implements YangDesc, YangReference, YangAppErrorInfo, Parsable, Serializable {
+
+    /*-
+     * Reference RFC 6020.
+     * The length Statement
+     *
+     * The "length" statement, which is an optional sub-statement to the
+     * "type" statement, takes as an argument a length expression string.
+     * It is used to restrict the built-in type "string", or types derived
+     * from "string".
+     * A "length" statement restricts the number of unicode characters in
+     * the string.
+     * A length range consists of an explicit value, or a lower bound, two
+     * consecutive dots "..", and an upper bound.  Multiple values or ranges
+     * can be given, separated by "|".  Length-restricting values MUST NOT
+     * be negative.  If multiple values or ranges are given, they all MUST
+     * be disjoint and MUST be in ascending order.  If a length restriction
+     * is applied to an already length-restricted type, the new restriction
+     * MUST be equal or more limiting, that is, raising the lower bounds,
+     * reducing the upper bounds, removing explicit length values or ranges,
+     * or splitting ranges into multiple ranges with intermediate gaps.  A
+     * length value is a non-negative integer, or one of the special values
+     * "min" or "max". "min" and "max" mean the minimum and maximum length
+     * accepted for the type being restricted, respectively.  An
+     * implementation is not required to support a length value larger than
+     * 18446744073709551615.
+     * The length's sub-statements
+     *
+     *  +---------------+---------+-------------+-----------------+
+     *  | substatement  | section | cardinality | mapped data type|
+     *  +---------------+---------+-------------+-----------------+
+     *  | description   | 7.19.3  | 0..1        | string          |
+     *  | error-app-tag | 7.5.4.2 | 0..1        | string          |
+     *  | error-message | 7.5.4.1 | 0..1        | string          |
+     *  | reference     | 7.19.4  | 0..1        | string          |
+     *  +---------------+---------+-------------+-----------------+
+     */
+
+    private static final long serialVersionUID = 806201645L;
+
+    /**
+     * Length restriction information.
+     */
+    private YangRangeRestriction<YangUint64> lengthRestriction;
+
+    /**
+     * Textual reference.
+     */
+    private String reference;
+
+    /**
+     * Application's error message, to be used for data error.
+     */
+    private String errorMessage;
+
+    /**
+     * Application's error tag, to be filled in data validation error response.
+     */
+    private String errorAppTag;
+
+    /**
+     * Textual description.
+     */
+    private String description;
+
+    /**
+     * Creates a YANG length restriction object.
+     */
+    public YangLengthRestriction() {
+    }
+
+    /**
+     * Returns the length restriction on the string data.
+     *
+     * @return length restriction on the string data
+     */
+    public YangRangeRestriction<YangUint64> getLengthRestriction() {
+        return lengthRestriction;
+    }
+
+    /**
+     * Sets the length restriction on the string data.
+     *
+     * @param lengthRestriction length restriction on the string data
+     */
+    public void setLengthRestriction(YangRangeRestriction<YangUint64> lengthRestriction) {
+        this.lengthRestriction = lengthRestriction;
+    }
+
+    /**
+     * Returns the textual reference of the length restriction.
+     *
+     * @return textual reference of the length restriction
+     */
+    @Override
+    public String getReference() {
+        return reference;
+    }
+
+    /**
+     * Sets the textual reference of the length restriction.
+     *
+     * @param ref textual reference of the length restriction
+     */
+    @Override
+    public void setReference(String ref) {
+        reference = ref;
+    }
+
+    /**
+     * Returns the description of the length restriction.
+     *
+     * @return description of the length restriction
+     */
+    @Override
+    public String getDescription() {
+        return description;
+    }
+
+    /**
+     * Sets the description of the length restriction.
+     *
+     * @param desc description of the length restriction
+     */
+    @Override
+    public void setDescription(String desc) {
+        description = desc;
+
+    }
+
+    /**
+     * Returns application's error message, to be used for data error.
+     *
+     * @return Application's error message, to be used for data error
+     */
+    @Override
+    public String getGetErrorMessage() {
+        return errorMessage;
+    }
+
+    /**
+     * Sets Application's error message, to be used for data error.
+     *
+     * @param errMsg Application's error message, to be used for data error
+     */
+    @Override
+    public void setErrorMessage(String errMsg) {
+        errorMessage = errMsg;
+
+    }
+
+    /**
+     * Returns application's error tag, to be used for data error.
+     *
+     * @return application's error tag, to be used for data error
+     */
+    @Override
+    public String getGetErrorAppTag() {
+        return errorAppTag;
+    }
+
+    /**
+     * Sets application's error tag, to be used for data error.
+     *
+     * @param errTag application's error tag, to be used for data error.
+     */
+    @Override
+    public void setErrorAppTag(String errTag) {
+        errorAppTag = errTag;
+    }
+
+    @Override
+    public YangConstructType getYangConstructType() {
+        return YangConstructType.PATTERN_DATA;
+    }
+
+    @Override
+    public void validateDataOnEntry() throws DataModelException {
+        // TODO: implement the method.
+    }
+
+    @Override
+    public void validateDataOnExit() throws DataModelException {
+        // TODO: implement the method.
+    }
+}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangList.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangList.java
new file mode 100644
index 0000000..632c5b7
--- /dev/null
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangList.java
@@ -0,0 +1,646 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yangutils.datamodel;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
+import org.onosproject.yangutils.datamodel.utils.Parsable;
+import org.onosproject.yangutils.datamodel.utils.YangConstructType;
+
+import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.detectCollidingChildUtil;
+
+/*
+ *  The "list" statement is used to define an interior data node in the
+ *  schema tree.  A list node may exist in multiple instances in the data
+ *  tree.  Each such instance is known as a list entry.  The "list"
+ *  statement takes one argument, which is an identifier, followed by a
+ *  block of sub-statements that holds detailed list information.
+ *
+ *  A list entry is uniquely identified by the values of the list's keys,
+ *  if defined.
+ *
+ *  The list's sub-statements
+ *
+ *                +--------------+---------+-------------+------------------+
+ *                | substatement | section | cardinality |data model mapping|
+ *                +--------------+---------+-------------+------------------+
+ *                | anyxml       | 7.10    | 0..n        |-not supported    |
+ *                | choice       | 7.9     | 0..n        |-child nodes      |
+ *                | config       | 7.19.1  | 0..1        |-boolean          |
+ *                | container    | 7.5     | 0..n        |-child nodes      |
+ *                | description  | 7.19.3  | 0..1        |-string           |
+ *                | grouping     | 7.11    | 0..n        |-child nodes      |
+ *                | if-feature   | 7.18.2  | 0..n        |-TODO             |
+ *                | key          | 7.8.2   | 0..1        |-String list      |
+ *                | leaf         | 7.6     | 0..n        |-YangLeaf         |
+ *                | leaf-list    | 7.7     | 0..n        |-YangLeafList     |
+ *                | list         | 7.8     | 0..n        |-child nodes      |
+ *                | max-elements | 7.7.4   | 0..1        |-int              |
+ *                | min-elements | 7.7.3   | 0..1        |-int              |
+ *                | must         | 7.5.3   | 0..n        |-TODO             |
+ *                | ordered-by   | 7.7.5   | 0..1        |-TODO             |
+ *                | reference    | 7.19.4  | 0..1        |-string           |
+ *                | status       | 7.19.2  | 0..1        |-YangStatus       |
+ *                | typedef      | 7.3     | 0..n        |-child nodes      |
+ *                | unique       | 7.8.3   | 0..n        |-TODO             |
+ *                | uses         | 7.12    | 0..n        |-child nodes(TODO)|
+ *                | when         | 7.19.5  | 0..1        |-TODO             |
+ *                +--------------+---------+-------------+------------------+
+ */
+
+/**
+ * Represents list data represented in YANG.
+ */
+public class YangList
+        extends YangNode
+        implements YangLeavesHolder, YangCommonInfo, Parsable, CollisionDetector, YangAugmentationHolder {
+
+    private static final long serialVersionUID = 806201609L;
+
+    /**
+     * Name of the YANG list.
+     */
+    private String name;
+
+    /**
+     * If list maintains config data.
+     */
+    private Boolean isConfig;
+
+    /**
+     * Description of list.
+     */
+    private String description;
+
+    /**
+     * Reference RFC 6020.
+     *
+     * The "key" statement, which MUST be present if the list represents
+     * configuration, and MAY be present otherwise, takes as an argument a
+     * string that specifies a space-separated list of leaf identifiers of this
+     * list. A leaf identifier MUST NOT appear more than once in the key. Each
+     * such leaf identifier MUST refer to a child leaf of the list. The leafs
+     * can be defined directly in sub-statements to the list, or in groupings
+     * used in the list.
+     *
+     * The combined values of all the leafs specified in the key are used to
+     * uniquely identify a list entry. All key leafs MUST be given values when a
+     * list entry is created. Thus, any default values in the key leafs or their
+     * types are ignored. It also implies that any mandatory statement in the
+     * key leafs are ignored.
+     *
+     * A leaf that is part of the key can be of any built-in or derived type,
+     * except it MUST NOT be the built-in type "empty".
+     *
+     * All key leafs in a list MUST have the same value for their "config" as
+     * the list itself.
+     *
+     * List of key leaf names.
+     */
+    private List<String> keyList;
+
+    /**
+     * List of leaves.
+     */
+    private List<YangLeaf> listOfLeaf;
+
+    /**
+     * List of leaf-lists.
+     */
+    private List<YangLeafList> listOfLeafList;
+
+    /**
+     * Reference RFC 6020.
+     *
+     * The "max-elements" statement, which is optional, takes as an argument a
+     * positive integer or the string "unbounded", which puts a constraint on
+     * valid list entries. A valid leaf-list or list always has at most
+     * max-elements entries.
+     *
+     * If no "max-elements" statement is present, it defaults to "unbounded".
+     */
+    private int maxElements = Integer.MAX_VALUE;
+
+    /**
+     * Reference RFC 6020.
+     *
+     * The "min-elements" statement, which is optional, takes as an argument a
+     * non-negative integer that puts a constraint on valid list entries. A
+     * valid leaf-list or list MUST have at least min-elements entries.
+     *
+     * If no "min-elements" statement is present, it defaults to zero.
+     *
+     * The behavior of the constraint depends on the type of the leaf-list's or
+     * list's closest ancestor node in the schema tree that is not a non-
+     * presence container:
+     *
+     * o If this ancestor is a case node, the constraint is enforced if any
+     * other node from the case exists.
+     *
+     * o Otherwise, it is enforced if the ancestor node exists.
+     */
+    private int minElements = 0;
+
+    /**
+     * reference.
+     */
+    private String reference;
+
+    /**
+     * Status of the node.
+     */
+
+    private YangStatusType status = YangStatusType.CURRENT;
+
+    /**
+     * Creates a YANG list object.
+     */
+    public YangList() {
+        super(YangNodeType.LIST_NODE);
+    }
+
+    /**
+     * Returns the YANG list name.
+     *
+     * @return YANG list name
+     */
+    @Override
+    public String getName() {
+        return name;
+    }
+
+    /**
+     * Sets the YANG list name.
+     *
+     * @param name YANG list name
+     */
+    @Override
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    /**
+     * Returns the config flag.
+     *
+     * @return the isConfig
+     */
+    public Boolean isConfig() {
+        return isConfig;
+    }
+
+    /**
+     * Sets the config flag.
+     *
+     * @param isCfg the config flag
+     */
+    public void setConfig(boolean isCfg) {
+        isConfig = isCfg;
+    }
+
+    /**
+     * Returns the description.
+     *
+     * @return the description
+     */
+    @Override
+    public String getDescription() {
+        return description;
+    }
+
+    /**
+     * Sets the description.
+     *
+     * @param description set the description
+     */
+    @Override
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    /**
+     * Returns the list of key field names.
+     *
+     * @return the list of key field names
+     */
+    public List<String> getKeyList() {
+        return keyList;
+    }
+
+    /**
+     * Sets the list of key field names.
+     *
+     * @param keyList the list of key field names
+     */
+    private void setKeyList(List<String> keyList) {
+        this.keyList = keyList;
+    }
+
+    /**
+     * Adds a key field name.
+     *
+     * @param key key field name.
+     * @throws DataModelException a violation of data model rules
+     */
+    public void addKey(String key)
+            throws DataModelException {
+        if (getKeyList() == null) {
+            setKeyList(new LinkedList<String>());
+        }
+
+        if (getKeyList().contains(key)) {
+            throw new DataModelException("A leaf identifier must not appear more than once in the\n" +
+                    "   key");
+        }
+
+        getKeyList().add(key);
+    }
+
+    /**
+     * Returns the list of leaves.
+     *
+     * @return the list of leaves
+     */
+    @Override
+    public List<YangLeaf> getListOfLeaf() {
+        return listOfLeaf;
+    }
+
+    /**
+     * Sets the list of leaves.
+     *
+     * @param leafsList the list of leaf to set
+     */
+    @Override
+    public void setListOfLeaf(List<YangLeaf> leafsList) {
+        listOfLeaf = leafsList;
+    }
+
+    /**
+     * Adds a leaf.
+     *
+     * @param leaf the leaf to be added
+     */
+    @Override
+    public void addLeaf(YangLeaf leaf) {
+        if (getListOfLeaf() == null) {
+            setListOfLeaf(new LinkedList<YangLeaf>());
+        }
+
+        getListOfLeaf().add(leaf);
+    }
+
+    /**
+     * Returns the list of leaf-list.
+     *
+     * @return the list of leaf-list
+     */
+    @Override
+    public List<YangLeafList> getListOfLeafList() {
+        return listOfLeafList;
+    }
+
+    /**
+     * Sets the list of leaf-list.
+     *
+     * @param listOfLeafList the list of leaf-list to set
+     */
+    @Override
+    public void setListOfLeafList(List<YangLeafList> listOfLeafList) {
+        this.listOfLeafList = listOfLeafList;
+    }
+
+    /**
+     * Adds a leaf-list.
+     *
+     * @param leafList the leaf-list to be added
+     */
+    @Override
+    public void addLeafList(YangLeafList leafList) {
+        if (getListOfLeafList() == null) {
+            setListOfLeafList(new LinkedList<YangLeafList>());
+        }
+
+        getListOfLeafList().add(leafList);
+    }
+
+    /**
+     * Returns the max elements.
+     *
+     * @return the max elements
+     */
+    public int getMaxElements() {
+        return maxElements;
+    }
+
+    /**
+     * Sets the max elements.
+     *
+     * @param max the max elements
+     */
+    public void setMaxElements(int max) {
+        maxElements = max;
+    }
+
+    /**
+     * Returns the minimum elements.
+     *
+     * @return the minimum elements
+     */
+    public int getMinElements() {
+        return minElements;
+    }
+
+    /**
+     * Sets the minimum elements.
+     *
+     * @param minElements the minimum elements
+     */
+    public void setMinElements(int minElements) {
+        this.minElements = minElements;
+    }
+
+    /**
+     * 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 status.
+     *
+     * @return the status
+     */
+    @Override
+    public YangStatusType getStatus() {
+        return status;
+    }
+
+    /**
+     * Sets the status.
+     *
+     * @param status the status to set
+     */
+    @Override
+    public void setStatus(YangStatusType status) {
+        this.status = status;
+    }
+
+    /**
+     * Returns the type of the parsed data.
+     *
+     * @return returns LIST_DATA
+     */
+    @Override
+    public YangConstructType getYangConstructType() {
+        return YangConstructType.LIST_DATA;
+    }
+
+    /**
+     * Validates the data on entering the corresponding parse tree node.
+     *
+     * @throws DataModelException a violation of data model rules
+     */
+    @Override
+    public void validateDataOnEntry()
+            throws DataModelException {
+        // TODO auto-generated method stub, to be implemented by parser
+    }
+
+    /**
+     * Validates the data on exiting the corresponding parse tree node.
+     *
+     * @throws DataModelException a violation of data model rules
+     */
+    @Override
+    public void validateDataOnExit()
+            throws DataModelException {
+        List<String> keys = getKeyList();
+        List<YangLeaf> leaves = getListOfLeaf();
+        List<YangLeafList> leafLists = getListOfLeafList();
+
+        setDefaultConfigValueToChild(leaves, leafLists);
+        validateConfig(leaves, leafLists);
+
+        /* A list must have atleast one key leaf if config is true */
+        if (isConfig && (keys == null || leaves == null && leafLists == null) && !isUsesPresentInList()
+                && !isListPresentInGrouping()) {
+            throw new DataModelException("A list must have atleast one key leaf if config is true;");
+        } else if (keys != null) {
+            validateKey(leaves, leafLists, keys);
+        }
+    }
+
+    /**
+     * Sets the config's value to all leaf if leaf's config statement is not
+     * specified.
+     *
+     * @param leaves list of leaf attributes of YANG list
+     * @param leafLists list of leaf-list attributes of YANG list
+     */
+    private void setDefaultConfigValueToChild(List<YangLeaf> leaves, List<YangLeafList> leafLists) {
+
+        /*
+         * If "config" is not specified, the default is the same as the parent
+         * schema node's "config" value.
+         */
+        if (leaves != null) {
+            for (YangLeaf leaf : leaves) {
+                if (leaf.isConfig() == null) {
+                    leaf.setConfig(isConfig);
+                }
+            }
+        }
+
+        /*
+         * If "config" is not specified, the default is the same as the parent
+         * schema node's "config" value.
+         */
+        if (leafLists != null) {
+            for (YangLeafList leafList : leafLists) {
+                if (leafList.isConfig() == null) {
+                    leafList.setConfig(isConfig);
+                }
+            }
+        }
+    }
+
+    /**
+     * Validates config statement of YANG list.
+     *
+     * @param leaves list of leaf attributes of YANG list
+     * @param leafLists list of leaf-list attributes of YANG list
+     * @throws DataModelException a violation of data model rules
+     */
+    private void validateConfig(List<YangLeaf> leaves, List<YangLeafList> leafLists)
+            throws DataModelException {
+
+        /*
+         * If a node has "config" set to "false", no node underneath it can have
+         * "config" set to "true".
+         */
+        if (!isConfig && leaves != null) {
+            for (YangLeaf leaf : leaves) {
+                if (leaf.isConfig()) {
+                    throw new DataModelException("If a list has \"config\" set to \"false\", no node underneath " +
+                            "it can have \"config\" set to \"true\".");
+                }
+            }
+        }
+
+        if (!isConfig && leafLists != null) {
+            for (YangLeafList leafList : leafLists) {
+                if (leafList.isConfig()) {
+                    throw new DataModelException("If a list has \"config\" set to \"false\", no node underneath " +
+                            "it can have \"config\" set to \"true\".");
+                }
+            }
+        }
+    }
+
+    /**
+     * Validates key statement of list.
+     *
+     * @param leaves list of leaf attributes of list
+     * @param leafLists list of leaf-list attributes of list
+     * @param keys list of key attributes of list
+     * @throws DataModelException a violation of data model rules
+     */
+    private void validateKey(List<YangLeaf> leaves, List<YangLeafList> leafLists, List<String> keys)
+            throws
+            DataModelException {
+        boolean leafFound = false;
+        List<YangLeaf> keyLeaves = new LinkedList<>();
+        List<YangLeafList> keyLeafLists = new LinkedList<>();
+
+        /*
+         * 1. Leaf identifier must refer to a child leaf of the list 2. A leaf
+         * that is part of the key must not be the built-in type "empty".
+         */
+        for (String key : keys) {
+            if (leaves != null && !leaves.isEmpty()) {
+                for (YangLeaf leaf : leaves) {
+                    if (key.equals(leaf.getName())) {
+                        if (leaf.getDataType().getDataType() == YangDataTypes.EMPTY) {
+                            throw new DataModelException(" A leaf that is part of the key must not be the built-in " +
+                                    "type \"empty\".");
+                        }
+                        leafFound = true;
+                        keyLeaves.add(leaf);
+                        break;
+                    }
+                }
+            }
+
+            if (leafLists != null && !leafLists.isEmpty()) {
+                for (YangLeafList leafList : leafLists) {
+                    if (key.equals(leafList.getName())) {
+                        if (leafList.getDataType().getDataType() == YangDataTypes.EMPTY) {
+                            throw new DataModelException(" A leaf-list that is part of the key" +
+                                    " must not be the built-in type \"empty\".");
+                        }
+                        leafFound = true;
+                        keyLeafLists.add(leafList);
+                        break;
+                    }
+                }
+            }
+
+            if (!leafFound && !isUsesPresentInList() && !isListPresentInGrouping()) {
+                throw new DataModelException("An identifier, in key, must refer to a child leaf of the list");
+            }
+            leafFound = false;
+        }
+
+        /*
+         * All key leafs in a list MUST have the same value for their "config"
+         * as the list itself.
+         */
+        for (YangLeaf keyLeaf : keyLeaves) {
+            if (isConfig != keyLeaf.isConfig()) {
+                throw new DataModelException("All key leafs in a list must have the same value for their" +
+                        " \"config\" as the list itself.");
+            }
+        }
+
+         /*
+         * All key leafs in a list MUST have the same value for their "config"
+         * as the list itself.
+         */
+        for (YangLeafList keyLeafList : keyLeafLists) {
+            if (isConfig() != keyLeafList.isConfig()) {
+                throw new DataModelException("All key leaf-lists in a list must have the same value for their" +
+                        " \"config\" as the list itself.");
+            }
+        }
+    }
+
+    @Override
+    public void detectCollidingChild(String identifierName, YangConstructType dataType)
+            throws DataModelException {
+        // Asks helper to detect colliding child.
+        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 list \"" +
+                    getName() + "\"");
+        }
+    }
+
+    private boolean isUsesPresentInList() {
+        YangNode node = getChild();
+        while (node != null) {
+            if (node instanceof YangUses) {
+                return true;
+            }
+            node = node.getNextSibling();
+        }
+        return false;
+        // TODO When grouping linking is done this method has to be modified.
+    }
+
+    private boolean isListPresentInGrouping() {
+        YangNode node = getParent();
+        while (node != null) {
+            if (node instanceof YangGrouping) {
+                return true;
+            }
+            node = node.getParent();
+        }
+        return false;
+        // TODO When grouping linking is done this method has to be modified.
+    }
+}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangModule.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangModule.java
new file mode 100644
index 0000000..f14cfeb
--- /dev/null
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangModule.java
@@ -0,0 +1,618 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.yangutils.datamodel;
+
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
+import org.onosproject.yangutils.datamodel.utils.Parsable;
+import org.onosproject.yangutils.datamodel.utils.YangConstructType;
+
+import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.detectCollidingChildUtil;
+import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.linkInterFileReferences;
+import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.resolveLinkingForResolutionList;
+
+/*-
+ * Reference:RFC 6020.
+ * The "module" statement defines the module's name,
+ * and groups all statements that belong to the module together. The "module"
+ * statement's argument is the name of the module, followed by a block of
+ * sub statements that hold detailed module information.
+ * The module's sub statements
+ *
+ *                +--------------+---------+-------------+-----------------------+
+ *                |sub statement | section | cardinality | data model mapping    |
+ *                +--------------+---------+-------------+-----------------------+
+ *                | anyxml       | 7.10    | 0..n        | not supported         |
+ *                | augment      | 7.15    | 0..n        | child nodes           |
+ *                | choice       | 7.9     | 0..n        | child nodes           |
+ *                | contact      | 7.1.8   | 0..1        | string                |
+ *                | container    | 7.5     | 0..n        | child nodes           |
+ *                | description  | 7.19.3  | 0..1        | string                |
+ *                | deviation    | 7.18.3  | 0..n        | TODO                  |
+ *                | extension    | 7.17    | 0..n        | TODO                  |
+ *                | feature      | 7.18.1  | 0..n        | TODO                  |
+ *                | grouping     | 7.11    | 0..n        | child nodes           |
+ *                | identity     | 7.16    | 0..n        | TODO                  |
+ *                | import       | 7.1.5   | 0..n        | list of import info   |
+ *                | include      | 7.1.6   | 0..n        | list of include info  |
+ *                | leaf         | 7.6     | 0..n        | list of leaf info     |
+ *                | leaf-list    | 7.7     | 0..n        | list of leaf-list info|
+ *                | list         | 7.8     | 0..n        | child nodes           |
+ *                | namespace    | 7.1.3   | 1           | string/uri            |
+ *                | notification | 7.14    | 0..n        | TODO                  |
+ *                | organization | 7.1.7   | 0..1        | string                |
+ *                | prefix       | 7.1.4   | 1           | string                |
+ *                | reference    | 7.19.4  | 0..1        | string                |
+ *                | revision     | 7.1.9   | 0..n        | revision              |
+ *                | rpc          | 7.13    | 0..n        | TODO                  |
+ *                | typedef      | 7.3     | 0..n        | child nodes           |
+ *                | uses         | 7.12    | 0..n        | child nodes           |
+ *                | YANG-version | 7.1.2   | 0..1        | int                   |
+ *                +--------------+---------+-------------+-----------------------+
+ */
+
+/**
+ * Represents data model node to maintain information defined in YANG module.
+ */
+public class YangModule
+        extends YangNode
+        implements YangLeavesHolder, YangDesc, YangReference, Parsable, CollisionDetector, YangReferenceResolver,
+        RpcNotificationContainer {
+
+    private static final long serialVersionUID = 806201610L;
+
+    /**
+     * Name of the module.
+     */
+    private String name;
+
+    /**
+     * Reference:RFC 6020.
+     * <p>
+     * The "contact" statement provides contact information for the module. The
+     * argument is a string that is used to specify contact information for the
+     * person or persons to whom technical queries concerning this module should
+     * be sent, such as their name, postal address, telephone number, and
+     * electronic mail address.
+     */
+    private String contact;
+
+    /**
+     * Reference:RFC 6020.
+     * <p>
+     * The "description" statement takes as an argument a string that contains a
+     * human-readable textual description of this definition. The text is
+     * provided in a language (or languages) chosen by the module developer; for
+     * the sake of interoperability.
+     */
+    private String description;
+
+    /**
+     * List of YANG modules imported.
+     */
+    private List<YangImport> importList;
+
+    /**
+     * List of YANG sub-modules included.
+     */
+    private List<YangInclude> includeList;
+
+    /**
+     * List of leaves at root level in the module.
+     */
+    private List<YangLeaf> listOfLeaf;
+
+    /**
+     * List of leaf-lists at root level in the module.
+     */
+    private List<YangLeafList> listOfLeafList;
+
+    /**
+     * Name space of the module.
+     */
+    private YangNameSpace nameSpace;
+
+    /**
+     * Reference:RFC 6020.
+     * <p>
+     * The "organization" statement defines the party responsible for this
+     * module. The argument is a string that is used to specify a textual
+     * description of the organization(s) under whose auspices this module was
+     * developed.
+     */
+    private String organization;
+
+    /**
+     * Prefix to refer to the objects in module.
+     */
+    private String prefix;
+
+    /**
+     * Reference of the module.
+     */
+    private String reference;
+
+    /**
+     * Revision info of the module.
+     */
+    private YangRevision revision;
+
+    /**
+     * YANG version.
+     */
+    private byte version;
+
+    /*-
+     * Reference RFC 6020.
+     *
+     * Nested typedefs and groupings.
+     * Typedefs and groupings may appear nested under many YANG statements,
+     * allowing these to be lexically scoped by the hierarchy under which
+     * they appear.  This allows types and groupings to be defined near
+     * where they are used, rather than placing them at the top level of the
+     * hierarchy.  The close proximity increases readability.
+     *
+     * Scoping also allows types to be defined without concern for naming
+     * conflicts between types in different submodules.  Type names can be
+     * specified without adding leading strings designed to prevent name
+     * collisions within large modules.
+     *
+     * Finally, scoping allows the module author to keep types and groupings
+     * private to their module or submodule, preventing their reuse.  Since
+     * only top-level types and groupings (i.e., those appearing as
+     * sub-statements to a module or submodule statement) can be used outside
+     * the module or submodule, the developer has more control over what
+     * pieces of their module are presented to the outside world, supporting
+     * the need to hide internal information and maintaining a boundary
+     * between what is shared with the outside world and what is kept
+     * private.
+     *
+     * Scoped definitions MUST NOT shadow definitions at a higher scope.  A
+     * type or grouping cannot be defined if a higher level in the schema
+     * hierarchy has a definition with a matching identifier.
+     *
+     * A reference to an unprefixed type or grouping, or one which uses the
+     * prefix of the current module, is resolved by locating the closest
+     * matching "typedef" or "grouping" statement among the immediate
+     * sub-statements of each ancestor statement.
+     */
+    private List<YangResolutionInfo> derivedTypeResolutionList;
+
+    /**
+     * uses resolution list.
+     */
+    private List<YangResolutionInfo> usesResolutionList;
+
+    /**
+     * Creates a YANG node of module type.
+     */
+    public YangModule() {
+
+        super(YangNodeType.MODULE_NODE);
+        derivedTypeResolutionList = new LinkedList<>();
+        usesResolutionList = new LinkedList<>();
+        importList = new LinkedList<YangImport>();
+        includeList = new LinkedList<YangInclude>();
+        listOfLeaf = new LinkedList<YangLeaf>();
+        listOfLeafList = new LinkedList<YangLeafList>();
+    }
+
+    /**
+     * Returns name of the module.
+     *
+     * @return module name
+     */
+    @Override
+    public String getName() {
+        return name;
+    }
+
+    /**
+     * Sets module name.
+     *
+     * @param moduleName module name
+     */
+    @Override
+    public void setName(String moduleName) {
+        name = moduleName;
+    }
+
+    /**
+     * Returns the contact details of the module owner.
+     *
+     * @return the contact details of YANG owner
+     */
+    public String getContact() {
+        return contact;
+    }
+
+    /**
+     * Sets the contact details of the module owner.
+     *
+     * @param contact the contact details of YANG owner
+     */
+    public void setContact(String contact) {
+        this.contact = contact;
+    }
+
+    /**
+     * Returns the description of module.
+     *
+     * @return the description of YANG module
+     */
+    @Override
+    public String getDescription() {
+        return description;
+    }
+
+    /**
+     * Sets the description of module.
+     *
+     * @param description set the description of YANG module
+     */
+    @Override
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    /**
+     * Returns the list of imported modules.
+     *
+     * @return the list of imported modules
+     */
+    @Override
+    public List<YangImport> getImportList() {
+        return importList;
+    }
+
+    /**
+     * Adds the imported module information to the import list.
+     *
+     * @param importedModule module being imported
+     */
+    @Override
+    public void addToImportList(YangImport importedModule) {
+        getImportList().add(importedModule);
+    }
+
+    @Override
+    public void setImportList(List<YangImport> importList) {
+        this.importList = importList;
+    }
+
+    /**
+     * Returns the list of included sub modules.
+     *
+     * @return the included list of sub modules
+     */
+    @Override
+    public List<YangInclude> getIncludeList() {
+        return includeList;
+    }
+
+    /**
+     * Adds the included sub module information to the include list.
+     *
+     * @param includeModule submodule being included
+     */
+    @Override
+    public void addToIncludeList(YangInclude includeModule) {
+        getIncludeList().add(includeModule);
+    }
+
+    @Override
+    public void setIncludeList(List<YangInclude> includeList) {
+        this.includeList = includeList;
+    }
+
+    /**
+     * Returns the list of leaves in module.
+     *
+     * @return the list of leaves
+     */
+    @Override
+    public List<YangLeaf> getListOfLeaf() {
+        return listOfLeaf;
+    }
+
+    @Override
+    public void setListOfLeaf(List<YangLeaf> leafsList) {
+        listOfLeaf = leafsList;
+    }
+
+    /**
+     * Adds a leaf in module.
+     *
+     * @param leaf the leaf to be added
+     */
+    @Override
+    public void addLeaf(YangLeaf leaf) {
+        getListOfLeaf().add(leaf);
+    }
+
+    /**
+     * Returns the list of leaf-list from module.
+     *
+     * @return the list of leaf-list
+     */
+    @Override
+    public List<YangLeafList> getListOfLeafList() {
+        return listOfLeafList;
+    }
+
+    @Override
+    public void setListOfLeafList(List<YangLeafList> listOfLeafList) {
+        this.listOfLeafList = listOfLeafList;
+    }
+
+
+    /**
+     * Adds a leaf-list in module.
+     *
+     * @param leafList the leaf-list to be added
+     */
+    @Override
+    public void addLeafList(YangLeafList leafList) {
+        getListOfLeafList().add(leafList);
+    }
+
+    /**
+     * Returns the name space of module elements.
+     *
+     * @return the nameSpace
+     */
+    public YangNameSpace getNameSpace() {
+        return nameSpace;
+    }
+
+    /**
+     * Sets the name space of module elements.
+     *
+     * @param nameSpace the nameSpace to set
+     */
+    public void setNameSpace(YangNameSpace nameSpace) {
+        this.nameSpace = nameSpace;
+    }
+
+    /**
+     * Returns the modules organization.
+     *
+     * @return the organization
+     */
+    public String getOrganization() {
+        return organization;
+    }
+
+    /**
+     * Sets the modules organization.
+     *
+     * @param org the organization to set
+     */
+    public void setOrganization(String org) {
+        organization = org;
+    }
+
+    /**
+     * Returns the prefix.
+     *
+     * @return the prefix
+     */
+    @Override
+    public String getPrefix() {
+        return prefix;
+    }
+
+    /**
+     * Sets the prefix.
+     *
+     * @param prefix the prefix to set
+     */
+    @Override
+    public void setPrefix(String prefix) {
+        this.prefix = prefix;
+    }
+
+    @Override
+    public void resolveSelfFileLinking(ResolvableType type)
+            throws DataModelException {
+        // Get the list to be resolved.
+        List<YangResolutionInfo> resolutionList = getUnresolvedResolutionList(type);
+        // Resolve linking for a resolution list.
+        resolveLinkingForResolutionList(resolutionList, this);
+    }
+
+    @Override
+    public void resolveInterFileLinking(ResolvableType type)
+            throws DataModelException {
+        // Get the list to be resolved.
+        List<YangResolutionInfo> resolutionList = getUnresolvedResolutionList(type);
+        // Resolve linking for a resolution list.
+        linkInterFileReferences(resolutionList, this);
+    }
+
+    /**
+     * 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 revision.
+     *
+     * @return the revision
+     */
+    public YangRevision getRevision() {
+        return revision;
+    }
+
+    /**
+     * Sets the revision.
+     *
+     * @param revision the revision to set
+     */
+    public void setRevision(YangRevision revision) {
+        this.revision = revision;
+    }
+
+    /**
+     * Returns the version.
+     *
+     * @return the version
+     */
+    public byte getVersion() {
+        return version;
+    }
+
+    /**
+     * Sets the version.
+     *
+     * @param version the version to set
+     */
+    public void setVersion(byte version) {
+        this.version = version;
+    }
+
+    /**
+     * Returns the type of the parsed data.
+     *
+     * @return returns MODULE_DATA
+     */
+    @Override
+    public YangConstructType getYangConstructType() {
+        return YangConstructType.MODULE_DATA;
+    }
+
+    /**
+     * Validates the data on entering the corresponding parse tree node.
+     *
+     * @throws DataModelException a violation of data model rules
+     */
+    @Override
+    public void validateDataOnEntry()
+            throws DataModelException {
+        /*
+         * Module is root in the data model tree, hence there is no entry
+         * validation
+         */
+    }
+
+    /**
+     * Validates the data on exiting the corresponding parse tree node.
+     *
+     * @throws DataModelException a violation of data model rules
+     */
+    @Override
+    public void validateDataOnExit()
+            throws DataModelException {
+        /*
+         * TODO: perform symbol linking for the imported or included YANG info.
+         * TODO: perform symbol resolution for referred YANG entities.
+         */
+    }
+
+    @Override
+    public void detectCollidingChild(String identifierName, YangConstructType dataType)
+            throws DataModelException {
+        // Asks helper to detect colliding child.
+        detectCollidingChildUtil(identifierName, dataType, this);
+    }
+
+    @Override
+    public void detectSelfCollision(String identifierName, YangConstructType dataType)
+            throws DataModelException {
+        // Not required as module doesn't have any parent.
+    }
+
+    @Override
+    public List<YangResolutionInfo> getUnresolvedResolutionList(ResolvableType type) {
+        if (type == ResolvableType.YANG_DERIVED_DATA_TYPE) {
+            return derivedTypeResolutionList;
+        } else {
+            return usesResolutionList;
+        }
+
+    }
+
+    @Override
+    public void addToResolutionList(YangResolutionInfo resolutionInfo,
+                                    ResolvableType type) {
+        if (type == ResolvableType.YANG_DERIVED_DATA_TYPE) {
+            derivedTypeResolutionList.add(resolutionInfo);
+        } else if (type == ResolvableType.YANG_USES) {
+            usesResolutionList.add(resolutionInfo);
+        }
+    }
+
+    @Override
+    public void setResolutionList(List<YangResolutionInfo> resolutionList,
+                                  ResolvableType type) {
+        if (type == ResolvableType.YANG_DERIVED_DATA_TYPE) {
+            derivedTypeResolutionList = resolutionList;
+        } else if (type == ResolvableType.YANG_USES) {
+            usesResolutionList = resolutionList;
+        }
+
+    }
+
+    @Override
+    public void addReferencesToImportList(Set<YangNode> yangNodeSet)
+            throws DataModelException {
+        Iterator<YangImport> importInfoIterator = getImportList().iterator();
+        // Run through the imported list to add references.
+        while (importInfoIterator.hasNext()) {
+            YangImport yangImport = importInfoIterator.next();
+            yangImport.addReferenceToImport(yangNodeSet);
+        }
+    }
+
+    @Override
+    public void addReferencesToIncludeList(Set<YangNode> yangNodeSet)
+            throws DataModelException {
+        Iterator<YangInclude> includeInfoIterator = getIncludeList().iterator();
+        // Run through the included list to add references.
+        while (includeInfoIterator.hasNext()) {
+            YangInclude yangInclude = includeInfoIterator.next();
+            YangSubModule subModule = null;
+            try {
+                subModule = yangInclude.addReferenceToInclude(yangNodeSet);
+            } catch (DataModelException e) {
+                throw e;
+            }
+            // Check if the referred sub-modules parent is self
+            if (!(subModule.getBelongsTo().getModuleNode() == this)) {
+                yangInclude.reportIncludeError();
+            }
+        }
+    }
+}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangMust.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangMust.java
new file mode 100644
index 0000000..ead6c5d
--- /dev/null
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangMust.java
@@ -0,0 +1,163 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.yangutils.datamodel;
+
+import java.io.Serializable;
+
+import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
+import org.onosproject.yangutils.datamodel.utils.Parsable;
+import org.onosproject.yangutils.datamodel.utils.YangConstructType;
+
+/*-
+ * The "must" statement, which is optional, takes as an argument a string that
+ * contains an XPath expression. It is used to formally declare a constraint
+ * on valid data.
+ *
+ * When a datastore is validated, all "must" constraints are conceptually
+ * evaluated once for each data node in the data tree, and for all leafs with
+ * default values in use. If a data node does not exist in the data tree, and
+ * it does not have a default value, its "must" statements are not evaluated.
+ *
+ * All such constraints MUST evaluate to true for the data to be valid.
+ *
+ *  The must's sub-statements
+ *
+ *                +---------------+---------+-------------+------------------+
+ *                | substatement  | section | cardinality |data model mapping|
+ *                +---------------+---------+-------------+------------------+
+ *                | description   | 7.19.3  | 0..1        | -string          |
+ *                | error-app-tag | 7.5.4.2 | 0..1        | -not supported   |
+ *                | error-message | 7.5.4.1 | 0..1        | -not supported   |
+ *                | reference     | 7.19.4  | 0..1        | -string          |
+ *                +---------------+---------+-------------+------------------+
+ */
+
+/**
+ * Represents information defined in YANG must.
+ */
+public class YangMust implements YangDesc, YangReference, Parsable, Serializable {
+
+    private static final long serialVersionUID = 806201646L;
+
+    /**
+     * Constraint info.
+     */
+    private String constratint;
+
+    /**
+     * Description string.
+     */
+    private String description;
+
+    /**
+     * Reference string.
+     */
+    private String reference;
+
+    /**
+     * Creates a YANG must restriction.
+     */
+    public YangMust() {
+    }
+
+    /**
+     * Returns the constraint.
+     *
+     * @return the constraint
+     */
+    public String getConstratint() {
+        return constratint;
+    }
+
+    /**
+     * Sets the constraint.
+     *
+     * @param constratint the constraint to set
+     */
+    public void setConstratint(String constratint) {
+        this.constratint = constratint;
+    }
+
+    /**
+     * Returns the description.
+     *
+     * @return the description
+     */
+    @Override
+    public String getDescription() {
+        return description;
+    }
+
+    /**
+     * Sets the description.
+     *
+     * @param description set the description
+     */
+    @Override
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    /**
+     * 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 type of the parsed data.
+     *
+     * @return returns MUST_DATA
+     */
+    @Override
+    public YangConstructType getYangConstructType() {
+        return YangConstructType.MUST_DATA;
+    }
+
+    /**
+     * Validates the data on entering the corresponding parse tree node.
+     *
+     * @throws DataModelException a violation of data model rules
+     */
+    @Override
+    public void validateDataOnEntry() throws DataModelException {
+        // TODO auto-generated method stub, to be implemented by parser
+    }
+
+    /**
+     * Validates the data on exiting the corresponding parse tree node.
+     *
+     * @throws DataModelException a violation of data model rules
+     */
+    @Override
+    public void validateDataOnExit() throws DataModelException {
+        // TODO auto-generated method stub, to be implemented by parser
+    }
+}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangNameSpace.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangNameSpace.java
new file mode 100644
index 0000000..60f327f
--- /dev/null
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangNameSpace.java
@@ -0,0 +1,96 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yangutils.datamodel;
+
+import java.io.Serializable;
+
+import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
+import org.onosproject.yangutils.datamodel.utils.Parsable;
+import org.onosproject.yangutils.datamodel.utils.YangConstructType;
+
+/*
+ *  Reference:RFC 6020.
+ *  The "namespace" statement defines the XML namespace that all
+ *  identifiers defined by the module are qualified by, with the
+ *  exception of data node identifiers defined inside a grouping.
+ *  The argument to the "namespace" statement is the URI of the
+ *  namespace.
+ */
+
+/**
+ * Represents name space to be used for the XML data tree.
+ */
+public class YangNameSpace implements Parsable, Serializable {
+
+    private static final long serialVersionUID = 806201647L;
+
+    private String uri;
+
+    /**
+     * Creats a YANG name space object.
+     */
+    public YangNameSpace() {
+    }
+
+    /**
+     * Returns the name space URI.
+     *
+     * @return the URI
+     */
+    public String getUri() {
+        return uri;
+    }
+
+    /**
+     * Sets the name space URI.
+     *
+     * @param uri the URI to set
+     */
+    public void setUri(String uri) {
+        this.uri = uri;
+    }
+
+    /**
+     * Returns the type of the parsed data.
+     *
+     * @return returns NAMESPACE_DATA
+     */
+    @Override
+    public YangConstructType getYangConstructType() {
+        return YangConstructType.NAMESPACE_DATA;
+    }
+
+    /**
+     * Validates the data on entering the corresponding parse tree node.
+     *
+     * @throws DataModelException a violation of data model rules
+     */
+    @Override
+    public void validateDataOnEntry() throws DataModelException {
+        // TODO auto-generated method stub, to be implemented by parser
+    }
+
+    /**
+     * Validates the data on exiting the corresponding parse tree node.
+     *
+     * @throws DataModelException a violation of data model rules
+     */
+    @Override
+    public void validateDataOnExit() throws DataModelException {
+        // TODO auto-generated method stub, to be implemented by parser
+    }
+}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangNode.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangNode.java
new file mode 100644
index 0000000..20b1686
--- /dev/null
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangNode.java
@@ -0,0 +1,230 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.yangutils.datamodel;
+
+import java.io.Serializable;
+
+import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
+
+/**
+ * Represents base class of a node in data model tree.
+ */
+public abstract class YangNode
+        implements Cloneable, Serializable {
+
+    private static final long serialVersionUID = 806201601L;
+
+    /**
+     * Type of node.
+     */
+    private YangNodeType nodeType;
+
+    /**
+     * Parent reference.
+     */
+    private YangNode parent;
+
+    /**
+     * First child reference.
+     */
+    private YangNode child;
+
+    /**
+     * Next sibling reference.
+     */
+    private YangNode nextSibling;
+
+    /**
+     * Previous sibling reference.
+     */
+    private YangNode previousSibling;
+
+    /**
+     * Returns the nodes name.
+     *
+     * @return nodes name
+     */
+    public abstract String getName();
+
+    /**
+     * Sets the nodes name.
+     *
+     * @param name nodes name
+     */
+    public abstract void setName(String name);
+
+    /**
+     * Creates a YANG node object.
+     */
+    @SuppressWarnings("unused")
+    private YangNode() {
+
+    }
+
+    /**
+     * Creates a specific type of node.
+     *
+     * @param type of YANG node
+     */
+    protected YangNode(YangNodeType type) {
+        setNodeType(type);
+    }
+
+    /**
+     * Returns the node type.
+     *
+     * @return node type
+     */
+    public YangNodeType getNodeType() {
+        return nodeType;
+    }
+
+    /**
+     * Sets the node type.
+     *
+     * @param nodeType type of node
+     */
+    private void setNodeType(YangNodeType nodeType) {
+        this.nodeType = nodeType;
+    }
+
+    /**
+     * Returns the parent of node.
+     *
+     * @return parent of node
+     */
+    public YangNode getParent() {
+        return parent;
+    }
+
+    /**
+     * Sets the parent of node.
+     *
+     * @param parent node
+     */
+    public void setParent(YangNode parent) {
+        this.parent = parent;
+    }
+
+    /**
+     * Returns the first child of node.
+     *
+     * @return first child of node
+     */
+    public YangNode getChild() {
+        return child;
+    }
+
+    /**
+     * Sets the first instance of a child node.
+     *
+     * @param child is only child to be set
+     */
+    public void setChild(YangNode child) {
+        this.child = child;
+    }
+
+    /**
+     * Returns the next sibling of node.
+     *
+     * @return next sibling of node
+     */
+    public YangNode getNextSibling() {
+        return nextSibling;
+    }
+
+    /**
+     * Sets the next sibling of node.
+     *
+     * @param sibling YANG node
+     */
+    private void setNextSibling(YangNode sibling) {
+        nextSibling = sibling;
+    }
+
+    /**
+     * Returns the previous sibling.
+     *
+     * @return previous sibling node
+     */
+    public YangNode getPreviousSibling() {
+        return previousSibling;
+    }
+
+    /**
+     * Sets the previous sibling.
+     *
+     * @param previousSibling points to predecessor sibling
+     */
+    private void setPreviousSibling(YangNode previousSibling) {
+        this.previousSibling = previousSibling;
+    }
+
+    /**
+     * Adds a child node, the children sibling list will be sorted based on node
+     * type.
+     *
+     * @param newChild refers to a child to be added
+     * @throws DataModelException due to violation in data model rules
+     */
+    public void addChild(YangNode newChild)
+            throws DataModelException {
+        if (newChild.getNodeType() == null) {
+            throw new DataModelException("Abstract node cannot be inserted into a tree");
+        }
+
+        if (newChild.getParent() == null) {
+            newChild.setParent(this);
+        } else if (newChild.getParent() != this) {
+            throw new DataModelException("Node is already part of a tree");
+        }
+
+        if (newChild.getChild() != null) {
+            throw new DataModelException("Child to be added is not atomic, it already has a child");
+        }
+
+        if (newChild.getNextSibling() != null) {
+            throw new DataModelException("Child to be added is not atomic, it already has a next sibling");
+        }
+
+        if (newChild.getPreviousSibling() != null) {
+            throw new DataModelException("Child to be added is not atomic, it already has a previous sibling");
+        }
+
+        /* First child to be added */
+        if (getChild() == null) {
+            setChild(newChild);
+            return;
+        }
+
+        YangNode curNode;
+        curNode = getChild();
+
+        /*
+         * Get the predecessor child of new child
+         */
+        while (curNode.getNextSibling() != null) {
+
+            curNode = curNode.getNextSibling();
+        }
+
+        /* If the new node needs to be the last child */
+        if (curNode.getNextSibling() == null) {
+            curNode.setNextSibling(newChild);
+            newChild.setPreviousSibling(curNode);
+        }
+    }
+}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangNodeIdentifier.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangNodeIdentifier.java
new file mode 100644
index 0000000..8c0ff9f
--- /dev/null
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangNodeIdentifier.java
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yangutils.datamodel;
+
+import java.io.Serializable;
+
+/**
+ * Represents YANG node identifier which is a combination of prefix and name.
+ */
+public class YangNodeIdentifier implements Serializable {
+
+    private static final long serialVersionUID = 806201648L;
+
+    // Name of the node.
+    private String name;
+
+    // Prefix of the node.
+    private String prefix;
+
+    /**
+     * Creates an instance of YANG node identifier.
+     */
+    public YangNodeIdentifier() {
+    }
+
+    /**
+     * Returns name of the node identifier.
+     *
+     * @return name of the node identifier
+     */
+    public String getName() {
+        return name;
+    }
+
+    /**
+     * Sets name of the node identifier.
+     *
+     * @param name name of the node identifier
+     */
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    /**
+     * Returns prefix of the node identifier.
+     *
+     * @return name of the node identifier
+     */
+    public String getPrefix() {
+        return prefix;
+    }
+
+    /**
+     * Sets prefix of the node identifier.
+     *
+     * @param prefix prefix of the node identifier
+     */
+    public void setPrefix(String prefix) {
+        this.prefix = prefix;
+    }
+}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangNodeType.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangNodeType.java
new file mode 100644
index 0000000..35fe918
--- /dev/null
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangNodeType.java
@@ -0,0 +1,106 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.yangutils.datamodel;
+
+/**
+ * Represents node type in data model tree corresponding to YANG schema.
+ */
+public enum YangNodeType {
+    /**
+     * Node contains module information.
+     */
+    MODULE_NODE,
+
+    /**
+     * Node contains sub module information.
+     */
+    SUB_MODULE_NODE,
+
+    /**
+     * Node contains "YANG's typedef" information.
+     */
+    TYPEDEF_NODE,
+
+    /**
+     * Node contains "YANG's type" information.
+     */
+    TYPE_NODE,
+
+    /**
+     * Node contains "YANG's choice" information.
+     */
+    CHOICE_NODE,
+
+    /**
+     * Node contains "YANG's case" information.
+     */
+    CASE_NODE,
+
+    /**
+     * Node contains "YANG's enumeration" information.
+     */
+    ENUMERATION_NODE,
+
+    /**
+     * Node contains grouping information.
+     */
+    GROUPING_NODE,
+
+    /**
+     * Node contains "YANG's uses" information.
+     */
+    USES_NODE,
+
+    /**
+     * Node contains augmentation information.
+     */
+    AUGMENT_NODE,
+
+    /**
+     * Node contains "YANG's container" information.
+     */
+    CONTAINER_NODE,
+
+    /**
+     * Node contains "YANG's notification" information.
+     */
+    NOTIFICATION_NODE,
+
+    /**
+     * Node contains "YANG's input" information.
+     */
+    INPUT_NODE,
+
+    /**
+     * Node contains "YANG's output" information.
+     */
+    OUTPUT_NODE,
+
+    /**
+     * Node contains "YANG's rpc" information.
+     */
+    RPC_NODE,
+
+    /**
+     * Node contains "YANG's union" information.
+     */
+    UNION_NODE,
+
+    /**
+     * Node contains "YANG's list" information.
+     */
+    LIST_NODE
+}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangNotification.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangNotification.java
new file mode 100644
index 0000000..6fba390
--- /dev/null
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangNotification.java
@@ -0,0 +1,224 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yangutils.datamodel;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
+import org.onosproject.yangutils.datamodel.utils.Parsable;
+import org.onosproject.yangutils.datamodel.utils.YangConstructType;
+
+import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.detectCollidingChildUtil;
+
+/*
+ * Reference RFC 6020.
+ *
+ * YANG allows the definition of notifications suitable for NETCONF.
+ * YANG data definition statements are used to model the content of the
+ * notification.
+ *
+ * The "notification" statement is used to define a NETCONF
+ * notification.  It takes one argument, which is an identifier,
+ * followed by a block of substatements that holds detailed notification
+ * information.  The "notification" statement defines a notification
+ * node in the schema tree.
+ *
+ * If a leaf in the notification tree has a "mandatory" statement with
+ * the value "true", the leaf MUST be present in a NETCONF notification.
+ *
+ * If a leaf in the notification tree has a default value, the NETCONF
+ * client MUST use this value in the same cases as described in
+ * Section 7.6.1.  In these cases, the client MUST operationally behave
+ * as if the leaf was present in the NETCONF notification with the
+ * default value as its value.
+ *
+ * If a "config" statement is present for any node in the notification
+ * tree, the "config" statement is ignored.
+ *
+ * The notification's substatements
+ *
+ *      +--------------+---------+-------------+------------------+
+ *      | substatement | section | cardinality |data model mapping|
+ *      +--------------+---------+-------------+------------------+
+ *      | anyxml       | 7.10    | 0..n        | -not supported   |
+ *      | choice       | 7.9     | 0..n        | -child nodes     |
+ *      | container    | 7.5     | 0..n        | -child nodes     |
+ *      | description  | 7.19.3  | 0..1        | -string          |
+ *      | grouping     | 7.11    | 0..n        | -child nodes     |
+ *      | if-feature   | 7.18.2  | 0..n        | -TODO            |
+ *      | leaf         | 7.6     | 0..n        | -YangLeaf        |
+ *      | leaf-list    | 7.7     | 0..n        | -YangLeafList    |
+ *      | list         | 7.8     | 0..n        | -child nodes     |
+ *      | reference    | 7.19.4  | 0..1        | -string          |
+ *      | status       | 7.19.2  | 0..1        | -YangStatus      |
+ *      | typedef      | 7.3     | 0..n        | -child nodes     |
+ *      | uses         | 7.12    | 0..n        | -child nodes     |
+ *      +--------------+---------+-------------+------------------+
+ */
+
+/**
+ * Represents data model node to maintain information defined in YANG notification.
+ */
+public class YangNotification
+        extends YangNode
+        implements YangLeavesHolder, YangCommonInfo, Parsable, CollisionDetector, YangAugmentationHolder {
+
+    private static final long serialVersionUID = 806201611L;
+
+    /**
+     * Name of the notification.
+     */
+    private String name;
+
+    /**
+     * Description of notification.
+     */
+    private String description;
+
+    /**
+     * List of leaves contained.
+     */
+    private List<YangLeaf> listOfLeaf;
+
+    /**
+     * List of leaf-lists contained.
+     */
+    private List<YangLeafList> listOfLeafList;
+
+    /**
+     * Reference of the module.
+     */
+    private String reference;
+
+    /**
+     * Status of the node.
+     */
+    private YangStatusType status = YangStatusType.CURRENT;
+
+    /**
+     * Create a notification node.
+     */
+    public YangNotification() {
+        super(YangNodeType.NOTIFICATION_NODE);
+        listOfLeaf = new LinkedList<YangLeaf>();
+        listOfLeafList = new LinkedList<YangLeafList>();
+    }
+
+    @Override
+    public void detectCollidingChild(String identifierName, YangConstructType dataType)
+            throws DataModelException {
+        // Detect colliding child.
+        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 notification \""
+                    + getName() + "\"");
+        }
+    }
+
+    @Override
+    public YangConstructType getYangConstructType() {
+        return YangConstructType.NOTIFICATION_DATA;
+    }
+
+    @Override
+    public void validateDataOnEntry()
+            throws DataModelException {
+        //TODO: implement the method.
+    }
+
+    @Override
+    public void validateDataOnExit()
+            throws DataModelException {
+        //TODO: implement the method.
+    }
+
+    @Override
+    public String getDescription() {
+        return description;
+    }
+
+    @Override
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    @Override
+    public List<YangLeaf> getListOfLeaf() {
+        return listOfLeaf;
+    }
+
+    @Override
+    public void setListOfLeaf(List<YangLeaf> leafsList) {
+        listOfLeaf = leafsList;
+    }
+
+    @Override
+    public void addLeaf(YangLeaf leaf) {
+        getListOfLeaf().add(leaf);
+    }
+
+    @Override
+    public List<YangLeafList> getListOfLeafList() {
+        return listOfLeafList;
+    }
+
+    @Override
+    public void setListOfLeafList(List<YangLeafList> listOfLeafList) {
+        this.listOfLeafList = listOfLeafList;
+    }
+
+    @Override
+    public void addLeafList(YangLeafList leafList) {
+        getListOfLeafList().add(leafList);
+    }
+
+    @Override
+    public String getName() {
+        return name;
+    }
+
+    @Override
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    @Override
+    public String getReference() {
+        return reference;
+    }
+
+    @Override
+    public void setReference(String reference) {
+        this.reference = reference;
+    }
+
+    @Override
+    public YangStatusType getStatus() {
+        return status;
+    }
+
+    @Override
+    public void setStatus(YangStatusType status) {
+        this.status = status;
+    }
+}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangOutput.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangOutput.java
new file mode 100644
index 0000000..f06ca01
--- /dev/null
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangOutput.java
@@ -0,0 +1,173 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yangutils.datamodel;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
+import org.onosproject.yangutils.datamodel.utils.Parsable;
+import org.onosproject.yangutils.datamodel.utils.YangConstructType;
+
+import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.detectCollidingChildUtil;
+
+/*
+ * Reference RFC 6020.
+ *
+ * The "output" statement, which is optional, is used to define output
+ * parameters to the RPC operation.  It does not take an argument.  The
+ * substatements to "output" define nodes under the RPC's output node.
+ *
+ * If a leaf in the output tree has a "mandatory" statement with the
+ * value "true", the leaf MUST be present in a NETCONF RPC reply.
+ *
+ * If a leaf in the output tree has a default value, the NETCONF client
+ * MUST use this value in the same cases as described in Section 7.6.1.
+ * In these cases, the client MUST operationally behave as if the leaf
+ * was present in the NETCONF RPC reply with the default value as its
+ * value.
+ *
+ * If a "config" statement is present for any node in the output tree,
+ * the "config" statement is ignored.
+ *
+ * If any node has a "when" statement that would evaluate to false, then
+ * this node MUST NOT be present in the output tree.
+ *
+ * The output substatements
+ *
+ *    +--------------+---------+-------------+------------------+
+ *    | substatement | section | cardinality |data model mapping|
+ *    +--------------+---------+-------------+------------------+
+ *    | anyxml       | 7.10    | 0..n        | -not supported   |
+ *    | choice       | 7.9     | 0..n        | -child nodes     |
+ *    | container    | 7.5     | 0..n        | -child nodes     |
+ *    | grouping     | 7.11    | 0..n        | -child nodes     |
+ *    | leaf         | 7.6     | 0..n        | -YangLeaf        |
+ *    | leaf-list    | 7.7     | 0..n        | -YangLeafList    |
+ *    | list         | 7.8     | 0..n        | -child nodes     |
+ *    | typedef      | 7.3     | 0..n        | -child nodes     |
+ *    | uses         | 7.12    | 0..n        | -child nodes     |
+ *    +--------------+---------+-------------+------------------+
+ */
+
+/**
+ * Represents data model node to maintain information defined in YANG output.
+ */
+public class YangOutput
+        extends YangNode
+        implements YangLeavesHolder, Parsable, CollisionDetector, YangAugmentationHolder {
+
+    private static final long serialVersionUID = 806201612L;
+
+    /**
+     * Name of the output.
+     */
+    private String name;
+
+    /**
+     * List of leaves contained.
+     */
+    private List<YangLeaf> listOfLeaf;
+
+    /**
+     * List of leaf-lists contained.
+     */
+    private List<YangLeafList> listOfLeafList;
+
+    /**
+     * Create a rpc output node.
+     */
+    public YangOutput() {
+        super(YangNodeType.OUTPUT_NODE);
+        listOfLeaf = new LinkedList<YangLeaf>();
+        listOfLeafList = new LinkedList<YangLeafList>();
+    }
+
+    @Override
+    public void detectCollidingChild(String identifierName, YangConstructType dataType)
+            throws DataModelException {
+        // Detect colliding child.
+        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 identifier detected, same as output \""
+                    + getName() + "\"");
+        }
+    }
+
+    @Override
+    public YangConstructType getYangConstructType() {
+        return YangConstructType.OUTPUT_DATA;
+    }
+
+    @Override
+    public void validateDataOnEntry()
+            throws DataModelException {
+        //TODO: implement the method.
+    }
+
+    @Override
+    public void validateDataOnExit()
+            throws DataModelException {
+        //TODO: implement the method.
+    }
+
+    @Override
+    public List<YangLeaf> getListOfLeaf() {
+        return listOfLeaf;
+    }
+
+    @Override
+    public void addLeaf(YangLeaf leaf) {
+        getListOfLeaf().add(leaf);
+    }
+
+    @Override
+    public void setListOfLeaf(List<YangLeaf> leafsList) {
+        listOfLeaf = leafsList;
+    }
+
+    @Override
+    public List<YangLeafList> getListOfLeafList() {
+        return listOfLeafList;
+    }
+
+    @Override
+    public void setListOfLeafList(List<YangLeafList> listOfLeafList) {
+        this.listOfLeafList = listOfLeafList;
+    }
+
+
+    @Override
+    public void addLeafList(YangLeafList leafList) {
+        getListOfLeafList().add(leafList);
+    }
+
+    @Override
+    public String getName() {
+        return name;
+    }
+
+    @Override
+    public void setName(String name) {
+        this.name = name;
+    }
+}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangPatternRestriction.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangPatternRestriction.java
new file mode 100644
index 0000000..939b732
--- /dev/null
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangPatternRestriction.java
@@ -0,0 +1,97 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yangutils.datamodel;
+
+import java.io.Serializable;
+import java.util.LinkedList;
+import java.util.List;
+
+/*-
+ *  Reference RFC 6020.
+ *
+ *  The pattern Statement
+ *
+ *  The "pattern" statement, which is an optional sub-statement to the
+ *  "type" statement, takes as an argument a regular expression string.
+ *  It is used to restrict the built-in type "string", or types derived
+ *  from "string", to values that match the pattern.
+ *
+ *  If the type has multiple "pattern" statements, the expressions are
+ *  ANDed together, i.e., all such expressions have to match.
+ *
+ *  If a pattern restriction is applied to an already pattern-restricted
+ *  type, values must match all patterns in the base type, in addition to
+ *  the new patterns.
+ *  The pattern's sub-statements
+ *
+ *   +---------------+---------+-------------+
+ *   | substatement  | section | cardinality |
+ *   +---------------+---------+-------------+
+ *   | description   | 7.19.3  | 0..1        |
+ *   | error-app-tag | 7.5.4.2 | 0..1        |
+ *   | error-message | 7.5.4.1 | 0..1        |
+ *   | reference     | 7.19.4  | 0..1        |
+ *   +---------------+---------+-------------+
+ */
+
+/**
+ * Represents pattern restriction information. The regular expression restriction on string
+ * data type.
+ */
+public class YangPatternRestriction implements Serializable {
+
+    private static final long serialVersionUID = 806201649L;
+
+    /**
+     * Pattern restriction defined for the current type.
+     */
+    private List<String> patternList;
+
+    /**
+     * Creates a YANG pattern restriction object.
+     */
+    public YangPatternRestriction() {
+        setPatternList(new LinkedList<String>());
+    }
+
+    /**
+     * Returns the pattern restriction defined for the current type.
+     *
+     * @return pattern restriction defined for the current type.
+     */
+    public List<String> getPatternList() {
+        return patternList;
+    }
+
+    /**
+     * Sets the pattern restriction defined for the current type.
+     *
+     * @param pattern pattern restriction defined for the current type..
+     */
+    private void setPatternList(List<String> pattern) {
+        patternList = pattern;
+    }
+
+    /**
+     * Adds a new pattern to the list of pattern restriction.
+     *
+     * @param newPattern pattern restriction.
+     */
+    public void addPattern(String newPattern) {
+        getPatternList().add(newPattern);
+    }
+}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangRangeInterval.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangRangeInterval.java
new file mode 100644
index 0000000..4ee9787
--- /dev/null
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangRangeInterval.java
@@ -0,0 +1,81 @@
+/*Copyright 2016.year Open Networking Laboratory
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.*/
+package org.onosproject.yangutils.datamodel;
+
+import java.io.Serializable;
+
+import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangBuiltInDataTypeInfo;
+
+/**
+ * Represents single interval information of a range.
+ *
+ * @param <T> range type based on the data type
+ */
+public class YangRangeInterval<T extends YangBuiltInDataTypeInfo<T>> implements Serializable {
+
+    private static final long serialVersionUID = 806201650L;
+
+    /**
+     * Starting value of the range interval.
+     */
+    private T startValue;
+
+    /**
+     * Last value of the range interval.
+     */
+    private T endValue;
+
+    /**
+     * Creates YANG range interval object.
+     */
+    public YangRangeInterval() {
+    }
+
+    /**
+     * Returns the starting value of the range interval.
+     *
+     * @return the starting value of the range interval
+     */
+    public T getStartValue() {
+        return startValue;
+    }
+
+    /**
+     * Sets the starting value of the range interval.
+     *
+     * @param startValue the starting value of the range interval
+     */
+    public void setStartValue(T startValue) {
+        this.startValue = startValue;
+    }
+
+    /**
+     * Returns the last value of the range interval.
+     *
+     * @return last value of the range interval
+     */
+    public T getEndValue() {
+        return endValue;
+    }
+
+    /**
+     * Sets the last value of the range interval.
+     *
+     * @param endValue last value of the range interval
+     */
+    public void setEndValue(T endValue) {
+        this.endValue = endValue;
+    }
+
+}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangRangeRestriction.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangRangeRestriction.java
new file mode 100644
index 0000000..654ac93
--- /dev/null
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangRangeRestriction.java
@@ -0,0 +1,338 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yangutils.datamodel;
+
+import java.io.Serializable;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
+import org.onosproject.yangutils.datamodel.utils.Parsable;
+import org.onosproject.yangutils.datamodel.utils.YangConstructType;
+import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangBuiltInDataTypeInfo;
+
+import static org.onosproject.yangutils.datamodel.utils.builtindatatype.BuiltInTypeObjectFactory.getDataObjectFromString;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+/*-
+ * Reference RFC 6020.
+ *
+ * The range Statement
+ *
+ *  The "range" statement, which is an optional sub-statement to the
+ *  "type" statement, takes as an argument a range expression string.  It
+ *  is used to restrict integer and decimal built-in types, or types
+ *  derived from those.
+ *
+ *  A range consists of an explicit value, or a lower-inclusive bound,
+ *  two consecutive dots "..", and an upper-inclusive bound.  Multiple
+ *  values or ranges can be given, separated by "|".  If multiple values
+ *  or ranges are given, they all MUST be disjoint and MUST be in
+ *  ascending order.  If a range restriction is applied to an already
+ *  range-restricted type, the new restriction MUST be equal or more
+ *  limiting, that is raising the lower bounds, reducing the upper
+ *  bounds, removing explicit values or ranges, or splitting ranges into
+ *  multiple ranges with intermediate gaps.  Each explicit value and
+ *  range boundary value given in the range expression MUST match the
+ *  type being restricted, or be one of the special values "min" or
+ *  "max". "min" and "max" mean the minimum and maximum value accepted
+ *  for the type being restricted, respectively.
+ */
+
+/**
+ * Represents ascending range restriction information.
+ *
+ * @param <T> range type (data type)
+ */
+public class YangRangeRestriction<T extends YangBuiltInDataTypeInfo<T>>
+        implements YangDesc, YangReference, YangAppErrorInfo, Parsable, Serializable {
+
+    private static final long serialVersionUID = 8062016051L;
+
+    /**
+     * Ascending list of range interval restriction. If the restriction is a
+     * single value, the start and end length of the range is same.
+     */
+    private List<YangRangeInterval<T>> ascendingRangeIntervals;
+
+    /**
+     * Textual reference.
+     */
+    private String reference;
+
+    /**
+     * Application's error message, to be used for data error.
+     */
+    private String errorMessage;
+
+    /**
+     * Application's error tag, to be filled in data validation error response.
+     */
+    private String errorAppTag;
+
+    /**
+     * Textual description.
+     */
+    private String description;
+
+    /**
+     * Creates YANG range restriction object.
+     */
+    public YangRangeRestriction() {
+    }
+
+    /**
+     * Returns the list of range interval restriction in ascending order.
+     *
+     * @return list of range interval restriction in ascending order
+     */
+    public List<YangRangeInterval<T>> getAscendingRangeIntervals() {
+        return ascendingRangeIntervals;
+    }
+
+    /**
+     * Sets the list of range interval restriction in ascending order.
+     *
+     * @param rangeList list of range interval restriction in ascending order
+     */
+    private void setAscendingRangeIntervals(List<YangRangeInterval<T>> rangeList) {
+        ascendingRangeIntervals = rangeList;
+    }
+
+    /**
+     * Returns the minimum valid value as per the restriction.
+     *
+     * @return minimum restricted value
+     * @throws DataModelException data model exception for minimum restriction
+     */
+    public T getMinRestrictedvalue() throws DataModelException {
+        if (getAscendingRangeIntervals() == null) {
+            throw new DataModelException("No range restriction info");
+        }
+        if (getAscendingRangeIntervals().isEmpty()) {
+            throw new DataModelException("No range interval info");
+        }
+        return getAscendingRangeIntervals().get(0).getStartValue();
+    }
+
+    /**
+     * Returns the maximum valid value as per the restriction.
+     *
+     * @return minimum maximum value
+     * @throws DataModelException data model exception for maximum restriction
+     */
+    public T getMaxRestrictedvalue() throws DataModelException {
+        if (getAscendingRangeIntervals() == null) {
+            throw new DataModelException("No range restriction info");
+        }
+        if (getAscendingRangeIntervals().isEmpty()) {
+            throw new DataModelException("No range interval info");
+        }
+        return getAscendingRangeIntervals()
+                .get(getAscendingRangeIntervals().size() - 1).getEndValue();
+    }
+
+    /**
+     * Adds new interval to extend its range in the last. i.e. newly added
+     * interval needs to be bigger than the biggest interval in the list.
+     *
+     * @param newInterval restricted length interval
+     * @throws DataModelException data model exception for range restriction
+     */
+    public void addRangeRestrictionInterval(YangRangeInterval<T> newInterval) throws DataModelException {
+
+        checkNotNull(newInterval);
+        checkNotNull(newInterval.getStartValue());
+
+        if (getAscendingRangeIntervals() == null) {
+            /*
+             * First interval that is being added, and it must be the smallest
+             * interval.
+             */
+            setAscendingRangeIntervals(new LinkedList<YangRangeInterval<T>>());
+            getAscendingRangeIntervals().add(newInterval);
+            return;
+        }
+
+        T curMaxvalue = getMaxRestrictedvalue();
+
+        if (newInterval.getStartValue().compareTo(curMaxvalue) != 1) {
+            throw new DataModelException(
+                    "New added range interval is lesser than the old interval(s)");
+        }
+
+        getAscendingRangeIntervals()
+                .add(getAscendingRangeIntervals().size(), newInterval);
+    }
+
+    /**
+     * Validates if the given value is correct as per the restriction.
+     *
+     * @param valueInString value
+     * @return true, if the value is confirming to restriction, false otherwise
+     * @throws DataModelException data model error
+     */
+    public boolean isValidValueString(String valueInString) throws DataModelException {
+
+        if (getAscendingRangeIntervals() == null
+                || getAscendingRangeIntervals().isEmpty()) {
+            // Throw exception, At least one default range needs to be set in
+            // constructor or in linker.
+            throw new DataModelException("Range interval missing in range restriction.");
+
+        }
+
+        YangDataTypes type = getAscendingRangeIntervals().get(0).getStartValue().getYangType();
+        YangBuiltInDataTypeInfo<?> value = getDataObjectFromString(valueInString, type);
+
+        for (YangRangeInterval<T> interval : getAscendingRangeIntervals()) {
+            int rangeStartCompareRes = interval.getStartValue().compareTo((T) value);
+            int rangeEndCompareRes = interval.getEndValue().compareTo((T) value);
+
+            if (rangeStartCompareRes <= 0 && rangeEndCompareRes >= 0) {
+                return true;
+            }
+        }
+
+        return false;
+    }
+
+    /**
+     * Validates if the given interval is correct as per the restriction.
+     *
+     * @param rangeInterval range interval
+     * @return true, if the interval is confirming to restriction, false otherwise
+     * @throws DataModelException data model error
+     */
+    public boolean isValidInterval(YangRangeInterval rangeInterval) throws DataModelException {
+
+        if (getAscendingRangeIntervals() == null
+                || getAscendingRangeIntervals().isEmpty()) {
+            // Throw exception, At least one default range needs to be set in
+            // constructor or in linker.
+            throw new DataModelException("Range interval missing in range restriction.");
+        }
+
+        for (YangRangeInterval<T> interval : getAscendingRangeIntervals()) {
+            int rangeStartCompareRes = interval.getStartValue().compareTo((T) rangeInterval.getStartValue());
+            int rangeEndCompareRes = interval.getEndValue().compareTo((T) rangeInterval.getEndValue());
+
+            if (rangeStartCompareRes <= 0 && rangeEndCompareRes >= 0) {
+                return true;
+            }
+        }
+        throw new DataModelException("Range interval doesn't fall within the referred restriction ranges");
+    }
+
+    /**
+     * Returns the textual reference of the length restriction.
+     *
+     * @return textual reference of the length restriction
+     */
+    @Override
+    public String getReference() {
+        return reference;
+    }
+
+    /**
+     * Sets the textual reference of the length restriction.
+     *
+     * @param ref textual reference of the length restriction
+     */
+    @Override
+    public void setReference(String ref) {
+        reference = ref;
+    }
+
+    /**
+     * Returns the description of the length restriction.
+     *
+     * @return description of the length restriction
+     */
+    @Override
+    public String getDescription() {
+        return description;
+    }
+
+    /**
+     * Sets the description of the length restriction.
+     *
+     * @param desc description of the length restriction
+     */
+    @Override
+    public void setDescription(String desc) {
+        description = desc;
+
+    }
+
+    /**
+     * Returns application's error message, to be used for data error.
+     *
+     * @return Application's error message, to be used for data error
+     */
+    @Override
+    public String getGetErrorMessage() {
+        return errorMessage;
+    }
+
+    /**
+     * Sets Application's error message, to be used for data error.
+     *
+     * @param errMsg Application's error message, to be used for data error
+     */
+    @Override
+    public void setErrorMessage(String errMsg) {
+        errorMessage = errMsg;
+
+    }
+
+    /**
+     * Returns application's error tag, to be used for data error.
+     *
+     * @return application's error tag, to be used for data error
+     */
+    @Override
+    public String getGetErrorAppTag() {
+        return errorAppTag;
+    }
+
+    /**
+     * Sets application's error tag, to be used for data error.
+     *
+     * @param errTag application's error tag, to be used for data error.
+     */
+    @Override
+    public void setErrorAppTag(String errTag) {
+        errorAppTag = errTag;
+    }
+
+    @Override
+    public YangConstructType getYangConstructType() {
+        return YangConstructType.RANGE_DATA;
+    }
+
+    @Override
+    public void validateDataOnEntry() throws DataModelException {
+        // TODO: implement the method.
+    }
+
+    @Override
+    public void validateDataOnExit() throws DataModelException {
+        // TODO: implement the method.
+    }
+}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangReference.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangReference.java
new file mode 100644
index 0000000..44397a3
--- /dev/null
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangReference.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.yangutils.datamodel;
+
+/**
+ * Abstraction of textual reference for a YANG entity. Abstracted to unify the
+ * parsing and translator processing of reference.
+ */
+public interface YangReference {
+
+    /**
+     * Returns the textual reference.
+     *
+     * @return the reference
+     */
+    String getReference();
+
+    /**
+     * Sets the textual reference.
+     *
+     * @param reference the reference to set
+     */
+    void setReference(String reference);
+
+}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangReferenceResolver.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangReferenceResolver.java
new file mode 100644
index 0000000..8be3242
--- /dev/null
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangReferenceResolver.java
@@ -0,0 +1,144 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yangutils.datamodel;
+
+import java.util.List;
+import java.util.Set;
+import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
+
+/**
+ * Abstraction of YANG dependency resolution information. Abstracted to obtain the
+ * resolution information.
+ */
+public interface YangReferenceResolver {
+
+    /**
+     * Returns unresolved resolution list.
+     *
+     * @param type resolvable type
+     * @return list of resolution information objects
+     */
+    List<YangResolutionInfo> getUnresolvedResolutionList(ResolvableType type);
+
+    /**
+     * Adds to the resolution list.
+     *
+     * @param resolutionInfo resolution information
+     * @param type           resolvable type
+     */
+    void addToResolutionList(YangResolutionInfo resolutionInfo, ResolvableType type);
+
+    /**
+     * Creates resolution list.
+     *
+     * @param resolutionList resolution list
+     * @param type           resolvable type
+     */
+    void setResolutionList(List<YangResolutionInfo> resolutionList, ResolvableType type);
+
+    /**
+     * Returns unresolved imported list.
+     *
+     * @return unresolved imported list
+     */
+    List<YangImport> getImportList();
+
+    /**
+     * Adds to the import list.
+     *
+     * @param yangImport import to be added
+     */
+    void addToImportList(YangImport yangImport);
+
+    /**
+     * Create import list.
+     *
+     * @param importList import list
+     */
+    void setImportList(List<YangImport> importList);
+
+    /**
+     * Returns unresolved include list.
+     *
+     * @return unresolved include list
+     */
+    List<YangInclude> getIncludeList();
+
+    /**
+     * Adds to the include list.
+     *
+     * @param yangInclude include to be added
+     */
+    void addToIncludeList(YangInclude yangInclude);
+
+    /**
+     * Creates include list.
+     *
+     * @param includeList include list
+     */
+    void setIncludeList(List<YangInclude> includeList);
+
+    /**
+     * Returns prefix of resolution root node.
+     *
+     * @return prefix resolution root node prefix
+     */
+    String getPrefix();
+
+    /**
+     * Sets prefix of resolution list root node.
+     *
+     * @param prefix resolution root node prefix
+     */
+    void setPrefix(String prefix);
+
+    /**
+     * Resolves self file linking.
+     *
+     * @param type resolvable type
+     * @throws DataModelException a violation in data model rule
+     */
+    void resolveSelfFileLinking(ResolvableType type)
+            throws DataModelException;
+
+    /**
+     * Resolves inter file linking.
+     *
+     * @param type resolvable type
+     * @throws DataModelException a violation in data model rule
+     */
+    void resolveInterFileLinking(ResolvableType type)
+            throws DataModelException;
+
+    /**
+     * Adds references to include.
+     *
+     * @param yangNodeSet YANG node info set
+     * @throws DataModelException a violation of data model rules
+     */
+    void addReferencesToIncludeList(Set<YangNode> yangNodeSet)
+            throws DataModelException;
+
+    /**
+     * Adds references to import.
+     *
+     * @param yangNodeSet YANG node info set
+     * @throws DataModelException a violation of data model rules
+     */
+    void addReferencesToImportList(Set<YangNode> yangNodeSet)
+            throws DataModelException;
+}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangResolutionInfo.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangResolutionInfo.java
new file mode 100644
index 0000000..c63e832
--- /dev/null
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangResolutionInfo.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.yangutils.datamodel;
+
+import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
+
+/**
+ * Abstraction of resolution object which will be resolved by linker.
+ *
+ * @param <T> type of resolution entity uses / type
+ */
+public interface YangResolutionInfo<T> extends LocationInfo {
+
+    /**
+     * Resolves linking with all the ancestors node for a resolution info.
+     *
+     * @param dataModelRootNode module/sub-module node
+     * @throws DataModelException DataModelException a violation of data model
+     *                            rules
+     */
+    void resolveLinkingForResolutionInfo(YangReferenceResolver dataModelRootNode)
+            throws DataModelException;
+
+    /**
+     * Retrieves information about the entity that needs to be resolved.
+     *
+     * @return information about the entity that needs to be resolved
+     */
+    YangEntityToResolveInfo<T> getEntityToResolveInfo();
+
+    /**
+     * Performs inter file linking of uses/type referring to typedef/grouping
+     * of other YANG file.
+     *
+     * @param dataModelRootNode module/sub-module node
+     * @throws DataModelException a violation in data model rule
+     */
+    void linkInterFile(YangReferenceResolver dataModelRootNode)
+            throws DataModelException;
+}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangRevision.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangRevision.java
new file mode 100644
index 0000000..aa326fd
--- /dev/null
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangRevision.java
@@ -0,0 +1,161 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.yangutils.datamodel;
+
+import java.io.Serializable;
+
+import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
+import org.onosproject.yangutils.datamodel.utils.Parsable;
+import org.onosproject.yangutils.datamodel.utils.YangConstructType;
+
+/*
+ *  Reference:RFC 6020.
+ *  The "revision" statement specifies the editorial revision history of
+ *  the module, including the initial revision.  A series of revision
+ *  statements detail the changes in the module's definition.  The
+ *  argument is a date string in the format "YYYY-MM-DD", followed by a
+ *  block of sub-statements that holds detailed revision information.  A
+ *  module SHOULD have at least one initial "revision" statement.  For
+ *  every published editorial change, a new one SHOULD be added in front
+ *  of the revisions sequence, so that all revisions are in reverse
+ *  chronological order.
+ *  The revision's sub-statement
+ *
+ *                +--------------+---------+-------------+------------------+
+ *                | substatement | section | cardinality |data model mapping|
+ *                +--------------+---------+-------------+------------------+
+ *                | description  | 7.19.3  | 0..1        |string            |
+ *                | reference    | 7.19.4  | 0..1        |sring            |
+ *                +--------------+---------+-------------+------------------+
+ */
+/**
+ * Represents the information about the revision.
+ */
+public class YangRevision implements YangDesc, YangReference, Parsable, Serializable {
+
+    private static final long serialVersionUID = 8062016052L;
+
+    /**
+     * Revision date. Date string in the format "YYYY-MM-DD"
+     */
+    private String revDate;
+
+    /**
+     * Description of revision.
+     */
+    private String description;
+
+    /**
+     * Textual reference for revision.
+     */
+    private String reference;
+
+    /**
+     * Creates a YANG revision object.
+     */
+    public YangRevision() {
+    }
+
+    /**
+     * Returns the revision date.
+     *
+     * @return the revision date
+     */
+    public String getRevDate() {
+        return revDate;
+    }
+
+    /**
+     * Sets the revision date.
+     *
+     * @param revDate the revision date to set
+     */
+    public void setRevDate(String revDate) {
+        this.revDate = revDate;
+    }
+
+    /**
+     * Returns the description.
+     *
+     * @return the description
+     */
+    @Override
+    public String getDescription() {
+        return description;
+    }
+
+    /**
+     * Sets the description.
+     *
+     * @param description set the description
+     */
+    @Override
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    /**
+     * 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 type of the parsed data.
+     *
+     * @return returns REVISION_DATA
+     */
+    @Override
+    public YangConstructType getYangConstructType() {
+        return YangConstructType.REVISION_DATA;
+    }
+
+    /**
+     * Validates the data on entering the corresponding parse tree node.
+     *
+     * @throws DataModelException a violation of data model rules
+     */
+    @Override
+    public void validateDataOnEntry() throws DataModelException {
+        // TODO auto-generated method stub, to be implemented by parser
+
+    }
+
+    /**
+     * Validates the data on exiting the corresponding parse tree node.
+     *
+     * @throws DataModelException a violation of data model rules
+     */
+    @Override
+    public void validateDataOnExit() throws DataModelException {
+        // TODO auto-generated method stub, to be implemented by parser
+
+    }
+}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangRpc.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangRpc.java
new file mode 100644
index 0000000..62b8dd1
--- /dev/null
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangRpc.java
@@ -0,0 +1,159 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yangutils.datamodel;
+
+import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
+import org.onosproject.yangutils.datamodel.utils.Parsable;
+import org.onosproject.yangutils.datamodel.utils.YangConstructType;
+
+import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.detectCollidingChildUtil;
+
+/*
+ * Reference RFC 6020.
+ *
+ * The "rpc" statement is used to define a NETCONF RPC operation.  It
+ * takes one argument, which is an identifier, followed by a block of
+ * substatements that holds detailed rpc information.  This argument is
+ * the name of the RPC, and is used as the element name directly under
+ * the <rpc> element, as designated by the substitution group
+ * "rpcOperation" in [RFC4741].
+ *
+ * The "rpc" statement defines an rpc node in the schema tree.  Under
+ * the rpc node, a schema node with the name "input", and a schema node
+ * with the name "output" are also defined.  The nodes "input" and
+ * "output" are defined in the module's namespace.
+ *
+ * The rpc substatements
+ *
+ *    +--------------+---------+-------------+------------------+
+ *    | substatement | section | cardinality |data model mapping|
+ *    +--------------+---------+-------------+------------------+
+ *    | description  | 7.19.3  | 0..1        | -string          |
+ *    | grouping     | 7.11    | 0..n        | -child nodes     |
+ *    | if-feature   | 7.18.2  | 0..n        | -TODO            |
+ *    | input        | 7.13.2  | 0..1        | -child nodes     |
+ *    | output       | 7.13.3  | 0..1        | -child nodes     |
+ *    | reference    | 7.19.4  | 0..1        | -string          |
+ *    | status       | 7.19.2  | 0..1        | -YangStatus      |
+ *    | typedef      | 7.3     | 0..n        | -child nodes     |
+ *    +--------------+---------+-------------+------------------+
+ */
+
+/**
+ * Represents data model node to maintain information defined in YANG rpc.
+ */
+public class YangRpc extends YangNode implements YangCommonInfo, Parsable,
+        CollisionDetector {
+
+    private static final long serialVersionUID = 806201613L;
+
+    /**
+     * Name of the rpc.
+     */
+    private String name;
+
+    /**
+     * Description of rpc.
+     */
+    private String description;
+
+    /**
+     * Reference of the module.
+     */
+    private String reference;
+
+    /**
+     * Status of the node.
+     */
+    private YangStatusType status = YangStatusType.CURRENT;
+
+    /**
+     * Create a rpc node.
+     */
+    public YangRpc() {
+        super(YangNodeType.RPC_NODE);
+    }
+
+    @Override
+    public String getName() {
+        return name;
+    }
+
+    @Override
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    @Override
+    public void detectCollidingChild(String identifierName, YangConstructType dataType) throws DataModelException {
+        // Detect colliding child.
+        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 rpc \""
+                    + getName() + "\"");
+        }
+    }
+
+    @Override
+    public YangConstructType getYangConstructType() {
+        return YangConstructType.RPC_DATA;
+    }
+
+    @Override
+    public void validateDataOnEntry() throws DataModelException {
+        //TODO: implement the method.
+    }
+
+    @Override
+    public void validateDataOnExit() throws DataModelException {
+        //TODO: implement the method.
+    }
+
+    @Override
+    public String getDescription() {
+        return description;
+    }
+
+    @Override
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    @Override
+    public String getReference() {
+        return reference;
+    }
+
+    @Override
+    public void setReference(String reference) {
+        this.reference = reference;
+    }
+
+    @Override
+    public YangStatusType getStatus() {
+        return status;
+    }
+
+    @Override
+    public void setStatus(YangStatusType status) {
+        this.status = status;
+    }
+}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangStatus.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangStatus.java
new file mode 100644
index 0000000..2b3c626
--- /dev/null
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangStatus.java
@@ -0,0 +1,35 @@
+/*Copyright 2016.year Open Networking Laboratory
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.*/
+package org.onosproject.yangutils.datamodel;
+
+/**
+ * Abstraction for status on a YANG entity. Abstracted to unify the parsing and
+ * translator processing of status.
+ */
+public interface YangStatus {
+
+    /**
+     * Returns the status.
+     *
+     * @return the status
+     */
+    YangStatusType getStatus();
+
+    /**
+     * Sets the status.
+     *
+     * @param status the status to set
+     */
+    void setStatus(YangStatusType status);
+}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangStatusType.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangStatusType.java
new file mode 100644
index 0000000..d5ac982
--- /dev/null
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangStatusType.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.yangutils.datamodel;
+
+/*
+ * Reference:RFC 6020.
+ * The "status" statement takes as an argument one of the strings
+ * "current", "deprecated", or "obsolete". If no status is specified,
+ * the default is "current".
+ */
+
+/**
+ * Represents the status of YANG entities.
+ */
+public enum YangStatusType {
+    /**
+     * Reference:RFC 6020.
+     *
+     * "current" means that the definition is current and valid.
+     */
+    CURRENT,
+
+    /**
+     * Reference:RFC 6020.
+     *
+     * "deprecated" indicates an obsolete definition, but it
+     * permits new/ continued implementation in order to foster interoperability
+     * with older/existing implementations.
+     */
+    DEPRECATED,
+
+    /**
+     * Reference:RFC 6020.
+     *
+     * "obsolete" means the definition is obsolete and
+     * SHOULD NOT be implemented and/or can be removed from implementations.
+     */
+    OBSOLETE
+}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangStringRestriction.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangStringRestriction.java
new file mode 100644
index 0000000..ce626ed
--- /dev/null
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangStringRestriction.java
@@ -0,0 +1,256 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yangutils.datamodel;
+
+import java.io.Serializable;
+
+import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
+import org.onosproject.yangutils.datamodel.utils.Parsable;
+import org.onosproject.yangutils.datamodel.utils.YangConstructType;
+import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangUint64;
+
+/*-
+ * Reference RFC 6020.
+ *
+ * A string can be restricted with the "length" and "pattern" statements.
+ *
+ */
+
+/**
+ * Represents the restriction for string data type.
+ */
+public class YangStringRestriction implements YangDesc, YangReference, YangAppErrorInfo, Parsable, Serializable {
+
+    /*-
+     * Reference RFC 6020.
+     * The length Statement
+     *
+     * The "length" statement, which is an optional sub-statement to the
+     * "type" statement, takes as an argument a length expression string.
+     * It is used to restrict the built-in type "string", or types derived
+     * from "string".
+     * A "length" statement restricts the number of unicode characters in
+     * the string.
+     * A length range consists of an explicit value, or a lower bound, two
+     * consecutive dots "..", and an upper bound.  Multiple values or ranges
+     * can be given, separated by "|".  Length-restricting values MUST NOT
+     * be negative.  If multiple values or ranges are given, they all MUST
+     * be disjoint and MUST be in ascending order.  If a length restriction
+     * is applied to an already length-restricted type, the new restriction
+     * MUST be equal or more limiting, that is, raising the lower bounds,
+     * reducing the upper bounds, removing explicit length values or ranges,
+     * or splitting ranges into multiple ranges with intermediate gaps.  A
+     * length value is a non-negative integer, or one of the special values
+     * "min" or "max". "min" and "max" mean the minimum and maximum length
+     * accepted for the type being restricted, respectively.  An
+     * implementation is not required to support a length value larger than
+     * 18446744073709551615.
+     * The length's sub-statements
+     *
+     *  +---------------+---------+-------------+-----------------+
+     *  | substatement  | section | cardinality | mapped data type|
+     *  +---------------+---------+-------------+-----------------+
+     *  | description   | 7.19.3  | 0..1        | string          |
+     *  | error-app-tag | 7.5.4.2 | 0..1        | string          |
+     *  | error-message | 7.5.4.1 | 0..1        | string          |
+     *  | reference     | 7.19.4  | 0..1        | string          |
+     *  +---------------+---------+-------------+-----------------+
+     */
+
+    private static final long serialVersionUID = 8062016053L;
+
+    /**
+     * Length restriction information.
+     */
+    private YangRangeRestriction<YangUint64> lengthRestriction;
+
+    /**
+     * Effective pattern restriction for the type.
+     */
+    private YangPatternRestriction patternRestriction;
+
+    /**
+     * Textual reference.
+     */
+    private String reference;
+
+    /**
+     * Application's error message, to be used for data error.
+     */
+    private String errorMessage;
+
+    /**
+     * Application's error tag, to be filled in data validation error response.
+     */
+    private String errorAppTag;
+
+    /**
+     * Textual description.
+     */
+    private String description;
+
+    /**
+     * Creates a YANG string restriction object.
+     */
+    public YangStringRestriction() {
+    }
+
+    /**
+     * Returns the length restriction on the string data.
+     *
+     * @return length restriction on the string data
+     */
+    public YangRangeRestriction<YangUint64> getLengthRestriction() {
+        return lengthRestriction;
+    }
+
+    /**
+     * Sets the length restriction on the string data.
+     *
+     * @param lengthRestriction length restriction on the string data
+     */
+    public void setLengthRestriction(YangRangeRestriction<YangUint64> lengthRestriction) {
+        this.lengthRestriction = lengthRestriction;
+    }
+
+    /**
+     * Returns the pattern restriction for the type.
+     *
+     * @return pattern restriction for the type
+     */
+    public YangPatternRestriction getPatternRestriction() {
+        return patternRestriction;
+    }
+
+    /**
+     * Sets the pattern restriction for the type.
+     *
+     * @param patternRestriction pattern restriction for the type
+     */
+    public void setPatternRestriction(YangPatternRestriction patternRestriction) {
+        this.patternRestriction = patternRestriction;
+    }
+
+    /**
+     * Adds a new pattern restriction for the type.
+     *
+     * @param newPattern new pattern restriction for the type
+     */
+    public void addPattern(String newPattern) {
+        if (getPatternRestriction() == null) {
+            setPatternRestriction(new YangPatternRestriction());
+        }
+        getPatternRestriction().addPattern(newPattern);
+    }
+
+    /**
+     * Returns the textual reference of the string restriction.
+     *
+     * @return textual reference of the string restriction
+     */
+    @Override
+    public String getReference() {
+        return reference;
+    }
+
+    /**
+     * Sets the textual reference of the string restriction.
+     *
+     * @param ref textual reference of the string restriction
+     */
+    @Override
+    public void setReference(String ref) {
+        reference = ref;
+    }
+
+    /**
+     * Returns the description of the string restriction.
+     *
+     * @return description of the string restriction
+     */
+    @Override
+    public String getDescription() {
+        return description;
+    }
+
+    /**
+     * Sets the description of the string restriction.
+     *
+     * @param desc description of the string restriction
+     */
+    @Override
+    public void setDescription(String desc) {
+        description = desc;
+
+    }
+
+    /**
+     * Returns application's error message, to be used for data error.
+     *
+     * @return Application's error message, to be used for data error
+     */
+    @Override
+    public String getGetErrorMessage() {
+        return errorMessage;
+    }
+
+    /**
+     * Sets Application's error message, to be used for data error.
+     *
+     * @param errMsg Application's error message, to be used for data error
+     */
+    @Override
+    public void setErrorMessage(String errMsg) {
+        errorMessage = errMsg;
+
+    }
+
+    /**
+     * Returns application's error tag, to be used for data error.
+     *
+     * @return application's error tag, to be used for data error
+     */
+    @Override
+    public String getGetErrorAppTag() {
+        return errorAppTag;
+    }
+
+    /**
+     * Sets application's error tag, to be used for data error.
+     *
+     * @param errTag application's error tag, to be used for data error.
+     */
+    @Override
+    public void setErrorAppTag(String errTag) {
+        errorAppTag = errTag;
+    }
+
+    @Override
+    public YangConstructType getYangConstructType() {
+        return YangConstructType.PATTERN_DATA;
+    }
+
+    @Override
+    public void validateDataOnEntry() throws DataModelException {
+        // TODO: implement the method.
+    }
+
+    @Override
+    public void validateDataOnExit() throws DataModelException {
+        // TODO: implement the method.
+    }
+}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangSubModule.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangSubModule.java
new file mode 100644
index 0000000..8e1ba9d
--- /dev/null
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangSubModule.java
@@ -0,0 +1,604 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.yangutils.datamodel;
+
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
+import org.onosproject.yangutils.datamodel.utils.Parsable;
+import org.onosproject.yangutils.datamodel.utils.YangConstructType;
+
+import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.detectCollidingChildUtil;
+import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.linkInterFileReferences;
+import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.resolveLinkingForResolutionList;
+
+/*
+ *  Reference RFC 6020.
+ *
+ *  While the primary unit in YANG is a module, a YANG module can itself
+ *  be constructed out of several submodules.  Submodules allow a module
+ *  designer to split a complex model into several pieces where all the
+ *  submodules contribute to a single namespace, which is defined by the
+ *  module that includes the submodules.
+ *
+ *  The "submodule" statement defines the submodule's name, and groups
+ *  all statements that belong to the submodule together.  The
+ *  "submodule" statement's argument is the name of the submodule,
+ *  followed by a block of sub-statements that hold detailed submodule
+ *  information.
+ *
+ *  The submodule's sub-statements
+ *
+ *                +--------------+---------+-------------+------------------+
+ *                | substatement | section | cardinality |data model mapping|
+ *                +--------------+---------+-------------+------------------+
+ *                | anyxml       | 7.10    | 0..n        | - not supported  |
+ *                | augment      | 7.15    | 0..n        | - child nodes    |
+ *                | belongs-to   | 7.2.2   | 1           | - YangBelongsTo  |
+ *                | choice       | 7.9     | 0..n        | - child nodes    |
+ *                | contact      | 7.1.8   | 0..1        | - string         |
+ *                | container    | 7.5     | 0..n        | - child nodes    |
+ *                | description  | 7.19.3  | 0..1        | - string         |
+ *                | deviation    | 7.18.3  | 0..n        | - TODO           |
+ *                | extension    | 7.17    | 0..n        | - TODO           |
+ *                | feature      | 7.18.1  | 0..n        | - TODO           |
+ *                | grouping     | 7.11    | 0..n        | - child nodes    |
+ *                | identity     | 7.16    | 0..n        | - TODO           |
+ *                | import       | 7.1.5   | 0..n        | - YangImport     |
+ *                | include      | 7.1.6   | 0..n        | - YangInclude    |
+ *                | leaf         | 7.6     | 0..n        | - YangLeaf       |
+ *                | leaf-list    | 7.7     | 0..n        | - YangLeafList   |
+ *                | list         | 7.8     | 0..n        | - child nodes    |
+ *                | notification | 7.14    | 0..n        | - TODO           |
+ *                | organization | 7.1.7   | 0..1        | - string         |
+ *                | reference    | 7.19.4  | 0..1        | - string         |
+ *                | revision     | 7.1.9   | 0..n        | - string         |
+ *                | rpc          | 7.13    | 0..n        | - TODO           |
+ *                | typedef      | 7.3     | 0..n        | - child nodes    |
+ *                | uses         | 7.12    | 0..n        | - child nodes    |
+ *                | YANG-version | 7.1.2   | 0..1        | - int            |
+ *                +--------------+---------+-------------+------------------+
+ */
+
+/**
+ * Represents data model node to maintain information defined in YANG sub-module.
+ */
+public class YangSubModule
+        extends YangNode
+        implements YangLeavesHolder, YangDesc, YangReference, Parsable, CollisionDetector, YangReferenceResolver,
+        RpcNotificationContainer {
+
+    private static final long serialVersionUID = 806201614L;
+
+    /**
+     * Name of sub module.
+     */
+    private String name;
+
+    /**
+     * Module to which it belongs to.
+     */
+    private YangBelongsTo belongsTo;
+
+    /**
+     * Reference RFC 6020.
+     * <p>
+     * The "contact" statement provides contact information for the module. The
+     * argument is a string that is used to specify contact information for the
+     * person or persons to whom technical queries concerning this module should
+     * be sent, such as their name, postal address, telephone number, and
+     * electronic mail address.
+     */
+    private String contact;
+
+    /**
+     * Description.
+     */
+    private String description;
+
+    /**
+     * List of YANG modules imported.
+     */
+    private List<YangImport> importList;
+
+    /**
+     * List of YANG sub-modules included.
+     */
+    private List<YangInclude> includeList;
+
+    /**
+     * List of leaves at root level in the sub-module.
+     */
+    private List<YangLeaf> listOfLeaf;
+
+    /**
+     * List of leaf-lists at root level in the sub-module.
+     */
+    private List<YangLeafList> listOfLeafList;
+
+    /**
+     * Organization owner of the sub-module.
+     */
+    private String organization;
+
+    /**
+     * Reference of the sub-module.
+     */
+    private String reference;
+
+    /**
+     * Revision info of the sub-module.
+     */
+    private YangRevision revision;
+
+    /**
+     * YANG version.
+     */
+    private byte version;
+
+    /**
+     * Prefix of parent module.
+     */
+    private String prefix;
+
+    /*-
+     * Reference RFC 6020.
+     *
+     * Nested typedefs and groupings.
+     * Typedefs and groupings may appear nested under many YANG statements,
+     * allowing these to be lexically scoped by the hierarchy under which
+     * they appear.  This allows types and groupings to be defined near
+     * where they are used, rather than placing them at the top level of the
+     * hierarchy.  The close proximity increases readability.
+     *
+     * Scoping also allows types to be defined without concern for naming
+     * conflicts between types in different submodules.  Type names can be
+     * specified without adding leading strings designed to prevent name
+     * collisions within large modules.
+     *
+     * Finally, scoping allows the module author to keep types and groupings
+     * private to their module or submodule, preventing their reuse.  Since
+     * only top-level types and groupings (i.e., those appearing as
+     * sub-statements to a module or submodule statement) can be used outside
+     * the module or submodule, the developer has more control over what
+     * pieces of their module are presented to the outside world, supporting
+     * the need to hide internal information and maintaining a boundary
+     * between what is shared with the outside world and what is kept
+     * private.
+     *
+     * Scoped definitions MUST NOT shadow definitions at a higher scope.  A
+     * type or grouping cannot be defined if a higher level in the schema
+     * hierarchy has a definition with a matching identifier.
+     *
+     * A reference to an unprefixed type or grouping, or one which uses the
+     * prefix of the current module, is resolved by locating the closest
+     * matching "typedef" or "grouping" statement among the immediate
+     * sub-statements of each ancestor statement.
+     */
+    private List<YangResolutionInfo> derivedTypeResolutionList;
+
+    /**
+     * uses resolution list.
+     */
+    private List<YangResolutionInfo> usesResolutionList;
+
+    /**
+     * Creates a sub module node.
+     */
+    public YangSubModule() {
+        super(YangNodeType.SUB_MODULE_NODE);
+        derivedTypeResolutionList = new LinkedList<>();
+        usesResolutionList = new LinkedList<>();
+        importList = new LinkedList<YangImport>();
+        includeList = new LinkedList<YangInclude>();
+        listOfLeaf = new LinkedList<YangLeaf>();
+        listOfLeafList = new LinkedList<YangLeafList>();
+    }
+
+    /**
+     * Returns the YANG name of the sub module.
+     *
+     * @return YANG name of the sub module
+     */
+    @Override
+    public String getName() {
+        return name;
+    }
+
+    /**
+     * Sets YANG name of the sub module.
+     *
+     * @param subModuleName YANG name of the sub module
+     */
+    @Override
+    public void setName(String subModuleName) {
+        name = subModuleName;
+    }
+
+    /**
+     * Returns the module info.
+     *
+     * @return the belongs to info
+     */
+    public YangBelongsTo getBelongsTo() {
+        return belongsTo;
+    }
+
+    /**
+     * Sets the module info.
+     *
+     * @param belongsTo module info to set
+     */
+    public void setBelongsTo(YangBelongsTo belongsTo) {
+        this.belongsTo = belongsTo;
+    }
+
+    /**
+     * Returns the contact.
+     *
+     * @return the contact
+     */
+    public String getContact() {
+        return contact;
+    }
+
+    /**
+     * Sets the contact.
+     *
+     * @param contact the contact to set
+     */
+    public void setContact(String contact) {
+        this.contact = contact;
+    }
+
+    /**
+     * Returns the description.
+     *
+     * @return the description
+     */
+    @Override
+    public String getDescription() {
+        return description;
+    }
+
+    /**
+     * Sets the description.
+     *
+     * @param description set the description
+     */
+    @Override
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    /**
+     * Returns the list of imported modules.
+     *
+     * @return the list of imported modules
+     */
+    @Override
+    public List<YangImport> getImportList() {
+        return importList;
+    }
+
+    /**
+     * Adds the imported module information to the import list.
+     *
+     * @param importedModule module being imported
+     */
+    @Override
+    public void addToImportList(YangImport importedModule) {
+        getImportList().add(importedModule);
+    }
+
+    @Override
+    public void setImportList(List<YangImport> importList) {
+        this.importList = importList;
+    }
+
+    /**
+     * Returns the list of included sub modules.
+     *
+     * @return the included list of sub modules
+     */
+    @Override
+    public List<YangInclude> getIncludeList() {
+        return includeList;
+    }
+
+    /**
+     * Returns the included sub module information to the include list.
+     *
+     * @param includeModule submodule being included
+     */
+    @Override
+    public void addToIncludeList(YangInclude includeModule) {
+        getIncludeList().add(includeModule);
+    }
+
+    @Override
+    public void setIncludeList(List<YangInclude> includeList) {
+        this.includeList = includeList;
+    }
+
+    @Override
+    public String getPrefix() {
+        return prefix;
+    }
+
+    @Override
+    public void setPrefix(String prefix) {
+        this.prefix = prefix;
+    }
+
+    @Override
+    public void resolveSelfFileLinking(ResolvableType type)
+            throws DataModelException {
+        // Get the list to be resolved.
+        List<YangResolutionInfo> resolutionList = getUnresolvedResolutionList(type);
+        // Resolve linking for a resolution list.
+        resolveLinkingForResolutionList(resolutionList, this);
+    }
+
+    @Override
+    public void resolveInterFileLinking(ResolvableType type)
+            throws DataModelException {
+        // Get the list to be resolved.
+        List<YangResolutionInfo> resolutionList = getUnresolvedResolutionList(type);
+        // Resolve linking for a resolution list.
+        linkInterFileReferences(resolutionList, this);
+    }
+
+    /**
+     * Returns the list of leaves.
+     *
+     * @return the list of leaves
+     */
+    @Override
+    public List<YangLeaf> getListOfLeaf() {
+        return listOfLeaf;
+    }
+
+    @Override
+    public void setListOfLeaf(List<YangLeaf> leafsList) {
+        listOfLeaf = leafsList;
+    }
+
+    /**
+     * Adds a leaf.
+     *
+     * @param leaf the leaf to be added
+     */
+    @Override
+    public void addLeaf(YangLeaf leaf) {
+        getListOfLeaf().add(leaf);
+    }
+
+    /**
+     * Returns the list of leaf-list.
+     *
+     * @return the list of leaf-list
+     */
+    @Override
+    public List<YangLeafList> getListOfLeafList() {
+        return listOfLeafList;
+    }
+
+    @Override
+    public void setListOfLeafList(List<YangLeafList> listOfLeafList) {
+        this.listOfLeafList = listOfLeafList;
+    }
+
+    /**
+     * Adds a leaf-list.
+     *
+     * @param leafList the leaf-list to be added
+     */
+    @Override
+    public void addLeafList(YangLeafList leafList) {
+        getListOfLeafList().add(leafList);
+    }
+
+    /**
+     * Returns the sub-modules organization.
+     *
+     * @return the organization
+     */
+    public String getOrganization() {
+        return organization;
+    }
+
+    /**
+     * Sets the sub-modules organization.
+     *
+     * @param org the organization to set
+     */
+    public void setOrganization(String org) {
+        organization = org;
+    }
+
+    /**
+     * 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 revision.
+     *
+     * @return the revision
+     */
+    public YangRevision getRevision() {
+        return revision;
+    }
+
+    /**
+     * Sets the revision.
+     *
+     * @param revision the revision to set
+     */
+    public void setRevision(YangRevision revision) {
+        this.revision = revision;
+    }
+
+    /**
+     * Returns the version.
+     *
+     * @return the version
+     */
+    public byte getVersion() {
+        return version;
+    }
+
+    /**
+     * Sets the version.
+     *
+     * @param version the version to set
+     */
+    public void setVersion(byte version) {
+        this.version = version;
+    }
+
+    /**
+     * Returns the type of the parsed data.
+     *
+     * @return returns SUB_MODULE_DATA
+     */
+    @Override
+    public YangConstructType getYangConstructType() {
+        return YangConstructType.SUB_MODULE_DATA;
+    }
+
+    /**
+     * Validates the data on entering the corresponding parse tree node.
+     *
+     * @throws DataModelException a violation of data model rules
+     */
+    @Override
+    public void validateDataOnEntry()
+            throws DataModelException {
+        // TODO auto-generated method stub, to be implemented by parser
+    }
+
+    /**
+     * Validates the data on exiting the corresponding parse tree node.
+     *
+     * @throws DataModelException a violation of data model rules
+     */
+    @Override
+    public void validateDataOnExit()
+            throws DataModelException {
+        // TODO auto-generated method stub, to be implemented by parser
+    }
+
+    @Override
+    public void detectCollidingChild(String identifierName, YangConstructType dataType)
+            throws DataModelException {
+        // Asks helper to detect colliding child.
+        detectCollidingChildUtil(identifierName, dataType, this);
+    }
+
+    @Override
+    public void detectSelfCollision(String identifierName, YangConstructType dataType)
+            throws DataModelException {
+        // Not required as module doesn't have any parent.
+    }
+
+    @Override
+    public List<YangResolutionInfo> getUnresolvedResolutionList(ResolvableType type) {
+        if (type == ResolvableType.YANG_DERIVED_DATA_TYPE) {
+            return derivedTypeResolutionList;
+        } else {
+            return usesResolutionList;
+        }
+    }
+
+    @Override
+    public void addToResolutionList(YangResolutionInfo resolutionInfo,
+                                    ResolvableType type) {
+        if (type == ResolvableType.YANG_DERIVED_DATA_TYPE) {
+            derivedTypeResolutionList.add(resolutionInfo);
+        } else if (type == ResolvableType.YANG_USES) {
+            usesResolutionList.add(resolutionInfo);
+        }
+    }
+
+    @Override
+    public void setResolutionList(List<YangResolutionInfo> resolutionList,
+                                  ResolvableType type) {
+        if (type == ResolvableType.YANG_DERIVED_DATA_TYPE) {
+            derivedTypeResolutionList = resolutionList;
+        } else if (type == ResolvableType.YANG_USES) {
+            usesResolutionList = resolutionList;
+        }
+
+    }
+
+    /**
+     * Links the sub-module with module.
+     *
+     * @param yangNodeSet YANG file information set
+     * @throws DataModelException a violation in data model rule
+     */
+    public void linkWithModule(Set<YangNode> yangNodeSet)
+            throws DataModelException {
+        getBelongsTo().linkWithModule(yangNodeSet);
+    }
+
+    @Override
+    public void addReferencesToIncludeList(Set<YangNode> yangNodeSet)
+            throws DataModelException {
+        Iterator<YangInclude> includeInfoIterator = getIncludeList().iterator();
+        // Run through the included list to add references.
+        while (includeInfoIterator.hasNext()) {
+            YangInclude yangInclude = includeInfoIterator.next();
+            YangSubModule subModule = null;
+            subModule = yangInclude.addReferenceToInclude(yangNodeSet);
+            // Check if the referred sub-modules parent is self
+            if (!(subModule.getBelongsTo().getModuleNode() == getBelongsTo().getModuleNode())) {
+                yangInclude.reportIncludeError();
+            }
+        }
+    }
+
+    @Override
+    public void addReferencesToImportList(Set<YangNode> yangNodeSet)
+            throws DataModelException {
+        Iterator<YangImport> importInfoIterator = getImportList().iterator();
+        // Run through the imported list to add references.
+        while (importInfoIterator.hasNext()) {
+            YangImport yangImport = importInfoIterator.next();
+            yangImport.addReferenceToImport(yangNodeSet);
+        }
+    }
+}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangType.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangType.java
new file mode 100644
index 0000000..a19167a
--- /dev/null
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangType.java
@@ -0,0 +1,274 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yangutils.datamodel;
+
+import java.io.Serializable;
+
+import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
+import org.onosproject.yangutils.datamodel.utils.Parsable;
+import org.onosproject.yangutils.datamodel.utils.ResolvableStatus;
+import org.onosproject.yangutils.datamodel.utils.YangConstructType;
+
+import static org.onosproject.yangutils.datamodel.YangDataTypes.DERIVED;
+
+/*
+ * Reference:RFC 6020.
+ * The "type" statement takes as an argument a string that is the name
+ *  of a YANG built-in type or a derived type, followed by an optional
+ *  block of sub-statements that are used to put further restrictions
+ *  on the type.
+ *
+ *  The restrictions that can be applied depend on the type being restricted.
+ *  The type's sub-statements
+ *
+ * +------------------+---------+-------------+------------------------------------+
+ * | substatement     | section | cardinality | mapped data type                   |
+ * +------------------+---------+-------------+------------------------------------+
+ * | bit              | 9.7.4   | 0..n        | - YangBit used in YangBits         |
+ * | enum             | 9.6.4   | 0..n        | - YangEnum used in YangEnumeration |
+ * | length           | 9.4.4   | 0..1        | - used for string                  |
+ * | path             | 9.9.2   | 0..1        | - TODO leaf-ref                    |
+ * | pattern          | 9.4.6   | 0..n        | - used for string                  |
+ * | range            | 9.2.4   | 0..1        | - used for integer data type       |
+ * | require-instance | 9.13.2  | 0..1        | - TODO instance-identifier         |
+ * | type             | 7.4     | 0..n        | - TODO union                       |
+ * +------------------+---------+-------------+------------------------------------+
+ */
+
+/**
+ * Represents the data type information.
+ *
+ * @param <T> YANG data type info
+ */
+public class YangType<T>
+        implements Parsable, Resolvable, Serializable {
+
+    private static final long serialVersionUID = 8062016054L;
+
+    /**
+     * YANG node identifier.
+     */
+    private YangNodeIdentifier nodeIdentifier;
+
+    /**
+     * Java package in which the Java type is defined.
+     */
+    private String javaPackage;
+
+    /**
+     * YANG data type.
+     */
+    private YangDataTypes dataType;
+
+    /**
+     * Additional information about data type, example restriction info, named
+     * values, etc. The extra information is based on the data type. Based on
+     * the data type, the extended info can vary.
+     */
+    private T dataTypeExtendedInfo;
+
+    /**
+     * Status of resolution. If completely resolved enum value is "RESOLVED",
+     * if not enum value is "UNRESOLVED", in case reference of grouping/typedef
+     * is added to uses/type but it's not resolved value of enum should be
+     * "INTRA_FILE_RESOLVED".
+     */
+    private ResolvableStatus resolvableStatus;
+
+    /**
+     * Creates a YANG type object.
+     */
+    public YangType() {
+
+        nodeIdentifier = new YangNodeIdentifier();
+        resolvableStatus = ResolvableStatus.UNRESOLVED;
+    }
+
+    /**
+     * Returns prefix associated with data type name.
+     *
+     * @return prefix associated with data type name
+     */
+    public String getPrefix() {
+        return nodeIdentifier.getPrefix();
+    }
+
+    /**
+     * Sets prefix associated with data type name.
+     *
+     * @param prefix prefix associated with data type name
+     */
+    public void setPrefix(String prefix) {
+        nodeIdentifier.setPrefix(prefix);
+    }
+
+    /**
+     * Returns the name of data type.
+     *
+     * @return the name of data type
+     */
+    public String getDataTypeName() {
+        return nodeIdentifier.getName();
+    }
+
+    /**
+     * Sets the name of the data type.
+     *
+     * @param typeName the name to set
+     */
+    public void setDataTypeName(String typeName) {
+        nodeIdentifier.setName(typeName);
+    }
+
+    /**
+     * Returns the Java package where the type is defined.
+     *
+     * @return Java package where the type is defined
+     */
+    public String getJavaPackage() {
+        return javaPackage;
+    }
+
+    /**
+     * Sets Java package where the type is defined.
+     *
+     * @param javaPackage Java package where the type is defined
+     */
+    public void setJavaPackage(String javaPackage) {
+        this.javaPackage = javaPackage;
+    }
+
+    /**
+     * Returns the type of data.
+     *
+     * @return the data type
+     */
+    public YangDataTypes getDataType() {
+        return dataType;
+    }
+
+    /**
+     * Sets the type of data.
+     *
+     * @param dataType data type
+     */
+    public void setDataType(YangDataTypes dataType) {
+        this.dataType = dataType;
+    }
+
+    /**
+     * Returns the data type meta data.
+     *
+     * @return the data type meta data
+     */
+    public T getDataTypeExtendedInfo() {
+        return dataTypeExtendedInfo;
+    }
+
+    /**
+     * Sets the data type meta data.
+     *
+     * @param dataTypeInfo the meta data to set
+     */
+    public void setDataTypeExtendedInfo(T dataTypeInfo) {
+        this.dataTypeExtendedInfo = dataTypeInfo;
+    }
+
+    /**
+     * Returns node identifier.
+     *
+     * @return node identifier
+     */
+    public YangNodeIdentifier getNodeIdentifier() {
+        return nodeIdentifier;
+    }
+
+    /**
+     * Sets node identifier.
+     *
+     * @param nodeIdentifier the node identifier
+     */
+    public void setNodeIdentifier(YangNodeIdentifier nodeIdentifier) {
+        this.nodeIdentifier = nodeIdentifier;
+    }
+
+    /**
+     * Returns the type of the parsed data.
+     *
+     * @return returns TYPE_DATA
+     */
+    @Override
+    public YangConstructType getYangConstructType() {
+        return YangConstructType.TYPE_DATA;
+    }
+
+    /**
+     * Validates the data on entering the corresponding parse tree node.
+     *
+     * @throws DataModelException a violation of data model rules
+     */
+    @Override
+    public void validateDataOnEntry()
+            throws DataModelException {
+        // TODO auto-generated method stub, to be implemented by parser
+    }
+
+    /**
+     * Validates the data on exiting the corresponding parse tree node.
+     *
+     * @throws DataModelException a violation of data model rules
+     */
+    @Override
+    public void validateDataOnExit()
+            throws DataModelException {
+        // TODO auto-generated method stub, to be implemented by parser
+    }
+
+    @Override
+    public ResolvableStatus getResolvableStatus() {
+        return resolvableStatus;
+    }
+
+    @Override
+    public void setResolvableStatus(ResolvableStatus resolvableStatus) {
+        this.resolvableStatus = resolvableStatus;
+    }
+
+    @Override
+    public void resolve()
+            throws DataModelException {
+        /*
+         * Check whether the data type is derived.
+         */
+        if (getDataType() != DERIVED) {
+            throw new DataModelException("Linker Error: Resolve should only be called for derived data types.");
+        }
+
+        // Check if the derived info is present.
+        YangDerivedInfo<?> derivedInfo = (YangDerivedInfo<?>) getDataTypeExtendedInfo();
+        if (derivedInfo == null) {
+            throw new DataModelException("Linker Error: Derived information is missing.");
+        }
+
+        // Initiate the resolution
+        try {
+            setResolvableStatus(derivedInfo.resolve());
+        } catch (DataModelException e) {
+            throw new DataModelException(e.getMessage());
+        }
+    }
+}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangTypeDef.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangTypeDef.java
new file mode 100644
index 0000000..d0f69af
--- /dev/null
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangTypeDef.java
@@ -0,0 +1,294 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.yangutils.datamodel;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
+import org.onosproject.yangutils.datamodel.utils.Parsable;
+import org.onosproject.yangutils.datamodel.utils.YangConstructType;
+
+import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.detectCollidingChildUtil;
+
+/*-
+ * Reference RFC 6020.
+ *
+ * The "typedef" statement defines a new type that may be used locally in the
+ * module, in modules or submodules which include it, and by other modules that
+ * import from it. The new type is called the "derived type", and the type from
+ * which it was derived is called the "base type". All derived types can be
+ * traced back to a YANG built-in type.
+ *
+ * The "typedef" statement's argument is an identifier that is the name of the
+ * type to be defined, and MUST be followed by a block of sub-statements that
+ * holds detailed typedef information.
+ *
+ * The name of the type MUST NOT be one of the YANG built-in types. If the
+ * typedef is defined at the top level of a YANG module or submodule, the name
+ * of the type to be defined MUST be unique within the module.
+ * The typedef's sub-statements
+ *
+ *                +--------------+---------+-------------+------------------+
+ *                | substatement | section | cardinality |data model mapping|
+ *                +--------------+---------+-------------+------------------+
+ *                | default      | 7.3.4   | 0..1        |-string           |
+ *                | description  | 7.19.3  | 0..1        |-string           |
+ *                | reference    | 7.19.4  | 0..1        |-string           |
+ *                | status       | 7.19.2  | 0..1        |-YangStatus       |
+ *                | type         | 7.3.2   | 1           |-yangType         |
+ *                | units        | 7.3.3   | 0..1        |-string           |
+ *                +--------------+---------+-------------+------------------+
+ */
+
+/**
+ * Represents data model node to maintain information defined in YANG typedef.
+ */
+public class YangTypeDef extends YangNode implements YangCommonInfo, Parsable, YangTypeHolder, CollisionDetector {
+
+    private static final long serialVersionUID = 806201615L;
+
+    /**
+     * Default value in string, needs to be converted to the target object,
+     * based on the type.
+     */
+    private String defaultValueInString;
+
+    /**
+     * Description of new type.
+     */
+    private String description;
+
+    /**
+     * reference string.
+     */
+    private String reference;
+
+    /**
+     * Status of the data type.
+     */
+    private YangStatusType status;
+
+    /**
+     * Name of the typedef.
+     */
+    private String name;
+
+    /**
+     * Units of the data type.
+     */
+    private String units;
+
+    /**
+     * List of YANG type, for typedef it will have single type.
+     * This is done to unify the code with union.
+     */
+    private List<YangType<?>> typeList;
+
+    /**
+     * Creates a typedef node.
+     */
+    public YangTypeDef() {
+        super(YangNodeType.TYPEDEF_NODE);
+        typeList = new LinkedList<>();
+    }
+
+    /**
+     * Returns the default value.
+     *
+     * @return the default value
+     */
+    public String getDefaultValueInString() {
+        return defaultValueInString;
+    }
+
+    /**
+     * Sets the default value.
+     *
+     * @param defaultValueInString the default value
+     */
+    public void setDefaultValueInString(String defaultValueInString) {
+        this.defaultValueInString = defaultValueInString;
+    }
+
+    /**
+     * Returns the description.
+     *
+     * @return the description
+     */
+    @Override
+    public String getDescription() {
+        return description;
+    }
+
+    /**
+     * Sets the description.
+     *
+     * @param description set the description
+     */
+    @Override
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    /**
+     * 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 status.
+     *
+     * @return the status
+     */
+    @Override
+    public YangStatusType getStatus() {
+        return status;
+    }
+
+    /**
+     * Sets the status.
+     *
+     * @param status the status to set
+     */
+    @Override
+    public void setStatus(YangStatusType status) {
+        this.status = status;
+    }
+
+    /**
+     * Returns the data type.
+     *
+     * @return the data type
+     */
+    public YangType<?> getTypeDefBaseType() {
+        if (!getTypeList().isEmpty()) {
+            return getTypeList().get(0);
+        }
+        return null;
+    }
+
+    /**
+     * Sets the data type.
+     *
+     * @param dataType the data type
+     */
+    public void setDataType(YangType<?> dataType) {
+        getTypeList().add(0, dataType);
+    }
+
+    /**
+     * Returns the unit.
+     *
+     * @return the units
+     */
+    public String getUnits() {
+        return units;
+    }
+
+    /**
+     * Sets the unit.
+     *
+     * @param units the units to set
+     */
+    public void setUnits(String units) {
+        this.units = units;
+    }
+
+    /**
+     * Returns the type of the data.
+     *
+     * @return returns TYPEDEF_DATA
+     */
+    @Override
+    public YangConstructType getYangConstructType() {
+        return YangConstructType.TYPEDEF_DATA;
+    }
+
+    /**
+     * Validates the data on entering the corresponding parse tree node.
+     *
+     * @throws DataModelException a violation of data model rules
+     */
+    @Override
+    public void validateDataOnEntry() throws DataModelException {
+        // TODO auto-generated method stub, to be implemented by parser
+    }
+
+    /**
+     * Validates the data on exiting the corresponding parse tree node.
+     *
+     * @throws DataModelException a violation of data model rules
+     */
+    @Override
+    public void validateDataOnExit() throws DataModelException {
+        // TODO auto-generated method stub, to be implemented by parser
+    }
+
+    /**
+     * Returns the YANG name of the typedef.
+     *
+     * @return YANG name of the typedef
+     */
+    @Override
+    public String getName() {
+        return name;
+    }
+
+    /**
+     * Sets YANG name of the typedef.
+     *
+     * @param name YANG name of the typedef
+     */
+    @Override
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    @Override
+    public List<YangType<?>> getTypeList() {
+        return typeList;
+    }
+
+    @Override
+    public void detectCollidingChild(String identifierName, YangConstructType dataType) throws DataModelException {
+        // Asks helper to detect colliding child.
+        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 typedef \""
+                    + getName() + "\"");
+        }
+    }
+}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangTypeHolder.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangTypeHolder.java
new file mode 100644
index 0000000..284f86a
--- /dev/null
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangTypeHolder.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yangutils.datamodel;
+
+import java.util.List;
+
+/**
+ * Represents the holder with type(s).
+ */
+public interface YangTypeHolder {
+
+    /**
+     * Returns type list.
+     *
+     * @return type list
+     */
+    List<YangType<?>> getTypeList();
+}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangUnion.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangUnion.java
new file mode 100644
index 0000000..d4c0306
--- /dev/null
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangUnion.java
@@ -0,0 +1,164 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yangutils.datamodel;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
+import org.onosproject.yangutils.datamodel.utils.Parsable;
+import org.onosproject.yangutils.datamodel.utils.YangConstructType;
+
+/*
+ * Reference RFC 6020.
+ *
+ * The union built-in type represents a value that corresponds to one of
+ * its member types.
+ *
+ * When the type is "union", the "type" statement (Section 7.4) MUST be
+ * present.  It is used to repeatedly specify each member type of the
+ * union.  It takes as an argument a string that is the name of a member
+ * type.
+ *
+ * A member type can be of any built-in or derived type, except it MUST
+ * NOT be one of the built-in types "empty" or "leafref".
+ *
+ * When a string representing a union data type is validated, the string
+ * is validated against each member type, in the order they are
+ * specified in the "type" statement, until a match is found.
+ *
+ * Any default value or "units" property defined in the member types is
+ * not inherited by the union type.
+ */
+
+/**
+ * Represents data model node to maintain information defined in YANG union.
+ */
+public class YangUnion extends YangNode implements Parsable, YangTypeHolder {
+
+    private static final long serialVersionUID = 806201616L;
+
+    // List of YANG type.
+    private List<YangType<?>> typeList;
+
+    // Name of union.
+    private String name;
+
+    // Current child union number.
+    private transient int childUnionNumber;
+
+    /**
+     * Creates a YANG union node.
+     */
+    public YangUnion() {
+        super(YangNodeType.UNION_NODE);
+        typeList = new LinkedList<>();
+        childUnionNumber = 1;
+    }
+
+    @Override
+    public List<YangType<?>> getTypeList() {
+        return typeList;
+    }
+
+    /**
+     * Sets the list of YANG type.
+     *
+     * @param typeList list of YANG type.
+     */
+    public void setTypeList(List<YangType<?>> typeList) {
+        this.typeList = typeList;
+    }
+
+    /**
+     * Returns running child union number.
+     *
+     * @return running child union number
+     */
+    public int getChildUnionNumber() {
+        return childUnionNumber;
+    }
+
+    /**
+     * Sets the running child union number.
+     *
+     * @param childUnionNumber running child union number
+     */
+    public void setChildUnionNumber(int childUnionNumber) {
+        this.childUnionNumber = childUnionNumber;
+    }
+
+    /**
+     * Adds YANG type to type list.
+     *
+     * @param yangType YANG type to be added to list
+     * @throws DataModelException union member type must not be one of the
+     *                            built-in types "empty" or "leafref"
+     */
+    public void addType(YangType<?> yangType) throws DataModelException {
+        if (yangType.getDataType() == YangDataTypes.EMPTY || yangType.getDataType() == YangDataTypes.LEAFREF) {
+            throw new DataModelException("Union member type must not be one of the built-in types \"empty\" or " +
+                    "\"leafref\"");
+        }
+        getTypeList().add(yangType);
+    }
+
+    /**
+     * Returns union name.
+     *
+     * @return the union name
+     */
+    @Override
+    public String getName() {
+        return name;
+    }
+
+    /**
+     * Sets the union name.
+     *
+     * @param name union name
+     */
+    @Override
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    @Override
+    public YangConstructType getYangConstructType() {
+        return YangConstructType.UNION_DATA;
+    }
+
+    /**
+     * Validates the data on entering the corresponding parse tree node.
+     *
+     * @throws DataModelException a violation of data model rules
+     */
+    @Override
+    public void validateDataOnEntry() throws DataModelException {
+        //TODO: implement the method.
+    }
+
+    /**
+     * Validates the data on exiting the corresponding parse tree node.
+     *
+     * @throws DataModelException a violation of data model rules
+     */
+    @Override
+    public void validateDataOnExit() throws DataModelException {
+        //TODO: implement the method.
+    }
+}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangUses.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangUses.java
new file mode 100644
index 0000000..b0d9ed9
--- /dev/null
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangUses.java
@@ -0,0 +1,506 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.yangutils.datamodel;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
+import org.onosproject.yangutils.datamodel.utils.Parsable;
+import org.onosproject.yangutils.datamodel.utils.ResolvableStatus;
+import org.onosproject.yangutils.datamodel.utils.YangConstructType;
+
+import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.detectCollidingChildUtil;
+import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.getParentNodeInGenCode;
+
+/*-
+ * Reference RFC 6020.
+ *
+ * The "uses" statement is used to reference a "grouping" definition. It takes
+ * one argument, which is the name of the grouping.
+ *
+ * The effect of a "uses" reference to a grouping is that the nodes defined by
+ * the grouping are copied into the current schema tree, and then updated
+ * according to the "refine" and "augment" statements.
+ *
+ * The identifiers defined in the grouping are not bound to a namespace until
+ * the contents of the grouping are added to the schema tree via a "uses"
+ * statement that does not appear inside a "grouping" statement, at which point
+ * they are bound to the namespace of the current module.
+ *
+ * The uses's sub-statements
+ *
+ *                +--------------+---------+-------------+------------------+
+ *                | substatement | section | cardinality |data model mapping|
+ *                +--------------+---------+-------------+------------------+
+ *                | augment      | 7.15    | 0..1        | -child nodes     |
+ *                | description  | 7.19.3  | 0..1        | -string          |
+ *                | if-feature   | 7.18.2  | 0..n        | -TODO            |
+ *                | refine       | 7.12.2  | 0..1        | -TODO            |
+ *                | reference    | 7.19.4  | 0..1        | -string          |
+ *                | status       | 7.19.2  | 0..1        | -YangStatus      |
+ *                | when         | 7.19.5  | 0..1        | -TODO            |
+ *                +--------------+---------+-------------+------------------+
+ */
+
+/**
+ * Represents data model node to maintain information defined in YANG uses.
+ */
+public class YangUses
+        extends YangNode
+        implements YangCommonInfo, Parsable, Resolvable, CollisionDetector {
+
+    private static final long serialVersionUID = 806201617L;
+
+    /**
+     * YANG node identifier.
+     */
+    private YangNodeIdentifier nodeIdentifier;
+
+    /**
+     * Referred group.
+     */
+    private YangGrouping refGroup;
+
+    /**
+     * Description of YANG uses.
+     */
+    private String description;
+
+    /**
+     * YANG reference.
+     */
+    private String reference;
+
+    /**
+     * Status of YANG uses.
+     */
+    private YangStatusType status;
+
+    /**
+     * Status of resolution. If completely resolved enum value is "RESOLVED",
+     * if not enum value is "UNRESOLVED", in case reference of grouping/typedef
+     * is added to uses/type but it's not resolved value of enum should be
+     * "INTRA_FILE_RESOLVED".
+     */
+    private ResolvableStatus resolvableStatus;
+
+    /**
+     * Effective list of nodes of grouping that needs to replicated at YANG uses.
+     */
+    private List<YangNode> resolvedGroupingNodes;
+
+    /**
+     * Effective list of leaves of grouping that needs to replicated at YANG uses.
+     */
+    private List<List<YangLeaf>> resolvedGroupingLeaves;
+
+    /**
+     * Effective list of leaf lists of grouping that needs to replicated at YANG uses.
+     */
+    private List<List<YangLeafList>> resolvedGroupingLeafLists;
+
+    /**
+     * Creates an YANG uses node.
+     */
+    public YangUses() {
+        super(YangNodeType.USES_NODE);
+        nodeIdentifier = new YangNodeIdentifier();
+        resolvableStatus = ResolvableStatus.UNRESOLVED;
+        resolvedGroupingNodes = new LinkedList<YangNode>();
+        resolvedGroupingLeaves = new LinkedList<List<YangLeaf>>();
+        resolvedGroupingLeafLists = new LinkedList<List<YangLeafList>>();
+    }
+
+    /**
+     * Returns the referred group.
+     *
+     * @return the referred group
+     */
+    public YangGrouping getRefGroup() {
+        return refGroup;
+    }
+
+    /**
+     * Sets the referred group.
+     *
+     * @param refGroup the referred group
+     */
+    public void setRefGroup(YangGrouping refGroup) {
+        this.refGroup = refGroup;
+    }
+
+    /**
+     * Returns the description.
+     *
+     * @return the description
+     */
+    @Override
+    public String getDescription() {
+        return description;
+    }
+
+    /**
+     * Sets the description.
+     *
+     * @param description set the description
+     */
+    @Override
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    /**
+     * 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 status.
+     *
+     * @return the status
+     */
+    @Override
+    public YangStatusType getStatus() {
+        return status;
+    }
+
+    /**
+     * Sets the status.
+     *
+     * @param status the status to set
+     */
+    @Override
+    public void setStatus(YangStatusType status) {
+        this.status = status;
+    }
+
+    /**
+     * Returns the type of the data.
+     *
+     * @return returns USES_DATA
+     */
+    @Override
+    public YangConstructType getYangConstructType() {
+        return YangConstructType.USES_DATA;
+    }
+
+    /**
+     * Validates the data on entering the corresponding parse tree node.
+     *
+     * @throws DataModelException a violation of data model rules
+     */
+    @Override
+    public void validateDataOnEntry()
+            throws DataModelException {
+        // TODO auto-generated method stub, to be implemented by parser
+    }
+
+    /**
+     * Validates the data on exiting the corresponding parse tree node.
+     *
+     * @throws DataModelException a violation of data model rules
+     */
+    @Override
+    public void validateDataOnExit()
+            throws DataModelException {
+        // TODO auto-generated method stub, to be implemented by parser
+    }
+
+    @Override
+    public String getName() {
+        return nodeIdentifier.getName();
+    }
+
+    @Override
+    public void setName(String name) {
+        nodeIdentifier.setName(name);
+    }
+
+    /**
+     * Returns node identifier.
+     *
+     * @return node identifier
+     */
+    public YangNodeIdentifier getNodeIdentifier() {
+        return nodeIdentifier;
+    }
+
+    /**
+     * Sets node identifier.
+     *
+     * @param nodeIdentifier the node identifier
+     */
+    public void setNodeIdentifier(YangNodeIdentifier nodeIdentifier) {
+        this.nodeIdentifier = nodeIdentifier;
+    }
+
+    /**
+     * Returns prefix associated with uses.
+     *
+     * @return prefix associated with uses
+     */
+    public String getPrefix() {
+        return nodeIdentifier.getPrefix();
+    }
+
+    /**
+     * Get prefix associated with uses.
+     *
+     * @param prefix prefix associated with uses
+     */
+    public void setPrefix(String prefix) {
+        nodeIdentifier.setPrefix(prefix);
+    }
+
+    @Override
+    public void resolve()
+            throws DataModelException {
+
+        YangGrouping referredGrouping = getRefGroup();
+
+        if (referredGrouping == null) {
+            throw new DataModelException("YANG uses linker error, cannot resolve uses");
+        }
+
+        YangNode usesParentNode = getParentNodeInGenCode(this);
+        if (!(usesParentNode instanceof YangLeavesHolder)
+                || !(usesParentNode instanceof CollisionDetector)) {
+            throw new DataModelException("YANG uses holder construct is wrong");
+        }
+
+        YangLeavesHolder usesParentLeavesHolder = (YangLeavesHolder) usesParentNode;
+        if (referredGrouping.getListOfLeaf() != null
+                && referredGrouping.getListOfLeaf().size() != 0) {
+            addLeavesOfGrouping(
+                    cloneLeavesList(referredGrouping.getListOfLeaf(),
+                            usesParentLeavesHolder));
+        }
+
+        if (referredGrouping.getListOfLeafList() != null
+                && referredGrouping.getListOfLeafList().size() != 0) {
+            addListOfLeafListOfGrouping(
+                    cloneListOfLeafList(referredGrouping.getListOfLeafList(),
+                            usesParentLeavesHolder));
+        }
+
+        YangNode childInGrouping = referredGrouping.getChild();
+
+        while (childInGrouping != null) {
+            if (childInGrouping instanceof YangEnumeration
+                    || childInGrouping instanceof YangUnion
+                    || childInGrouping instanceof YangTypeDef) {
+
+                /*
+                 * No need to copy the leaves, union / enum class, as these will
+                 * be generated in the scope of grouping
+                 */
+                childInGrouping = childInGrouping.getNextSibling();
+                continue;
+            } else if (childInGrouping instanceof YangUses) {
+                addResolvedUsesInfoOfGrouping((YangUses) childInGrouping,
+                        usesParentLeavesHolder);
+            } else {
+                addNodeOfGrouping(childInGrouping);
+            }
+
+            childInGrouping = childInGrouping.getNextSibling();
+        }
+    }
+
+    /**
+     * Clone the resolved uses contained in grouping to the uses of grouping.
+     *
+     * @param usesInGrouping resolved uses in grouping
+     * @param usesHolder     holder of uses
+     */
+    private void addResolvedUsesInfoOfGrouping(YangUses usesInGrouping,
+            YangLeavesHolder usesHolder) throws DataModelException {
+        for (YangNode usesResolvedNode : usesInGrouping.getUsesResolvedNodeList()) {
+            addNodeOfGrouping(usesResolvedNode);
+        }
+
+        for (List<YangLeaf> leavesList : usesInGrouping.getUsesResolvedLeavesList()) {
+            addLeavesOfGrouping(cloneLeavesList(leavesList, usesHolder));
+        }
+
+        for (List<YangLeafList> listOfLeafLists : usesInGrouping.getUsesResolvedListOfLeafList()) {
+            addListOfLeafListOfGrouping(
+                    cloneListOfLeafList(listOfLeafLists, usesHolder));
+        }
+    }
+
+    /**
+     * Clone the list of leaves and return the cloned list leaves.
+     *
+     * @param listOfLeaves   list of leaves to be cloned
+     * @param usesParentNode parent of the cloned location
+     * @return cloned list of leaves
+     * @throws DataModelException a violation in data model rule
+     */
+    private List<YangLeaf> cloneLeavesList(List<YangLeaf> listOfLeaves,
+            YangLeavesHolder usesParentNode) throws DataModelException {
+        if (listOfLeaves == null || listOfLeaves.size() == 0) {
+            throw new DataModelException("No leaves to clone");
+        }
+
+        List<YangLeaf> newLeavesList = new LinkedList<YangLeaf>();
+        for (YangLeaf leaf : listOfLeaves) {
+            YangLeaf clonedLeaf;
+            try {
+                ((CollisionDetector) usesParentNode).detectCollidingChild(leaf.getName(),
+                        YangConstructType.LEAF_DATA);
+                clonedLeaf = leaf.clone();
+            } catch (CloneNotSupportedException | DataModelException e) {
+                throw new DataModelException(e.getMessage());
+            }
+
+            clonedLeaf.setContainedIn(usesParentNode);
+            newLeavesList.add(clonedLeaf);
+        }
+
+        return newLeavesList;
+    }
+
+    /**
+     * Clone the list of leaf list.
+     *
+     * @param listOfLeafList list of leaf list that needs to be cloned
+     * @param usesParentNode parent of uses
+     * @return cloned list of leaf list
+     */
+    private List<YangLeafList> cloneListOfLeafList(List<YangLeafList> listOfLeafList,
+            YangLeavesHolder usesParentNode) throws DataModelException {
+        if (listOfLeafList == null || listOfLeafList.size() == 0) {
+            throw new DataModelException("No leaf lists to clone");
+        }
+
+        List<YangLeafList> newListOfLeafList = new LinkedList<YangLeafList>();
+        for (YangLeafList leafList : listOfLeafList) {
+            YangLeafList clonedLeafList;
+            try {
+                ((CollisionDetector) usesParentNode).detectCollidingChild(leafList.getName(),
+                        YangConstructType.LEAF_LIST_DATA);
+                clonedLeafList = leafList.clone();
+            } catch (CloneNotSupportedException | DataModelException e) {
+                throw new DataModelException(e.getMessage());
+            }
+
+            clonedLeafList.setContainedIn(usesParentNode);
+            newListOfLeafList.add(clonedLeafList);
+        }
+
+        return newListOfLeafList;
+    }
+
+    @Override
+    public ResolvableStatus getResolvableStatus() {
+        return resolvableStatus;
+    }
+
+    @Override
+    public void setResolvableStatus(ResolvableStatus resolvableStatus) {
+        this.resolvableStatus = resolvableStatus;
+    }
+
+    @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 uses \""
+                    + getName() + "\"");
+        }
+    }
+
+    /**
+     * Adds the node under grouping to the effective uses resolved info.
+     *
+     * @param nodeInGrouping node defined under grouping which needs to be copied in
+     *                       the context of uses
+     */
+    public void addNodeOfGrouping(YangNode nodeInGrouping) {
+        resolvedGroupingNodes.add(nodeInGrouping);
+    }
+
+    /**
+     * Returns the effective list of nodes added due to uses linking.
+     *
+     * @return effective list of nodes added due to uses linking
+     */
+    public List<YangNode> getUsesResolvedNodeList() {
+        return resolvedGroupingNodes;
+    }
+
+    /**
+     * Adds the leaves under grouping to the effective uses resolved info.
+     *
+     * @param leavesInGrouping Leaves defined under grouping which needs to be copied in
+     *                         the context of uses
+     */
+    public void addLeavesOfGrouping(List<YangLeaf> leavesInGrouping) {
+        resolvedGroupingLeaves.add(leavesInGrouping);
+    }
+
+    /**
+     * Returns the effective list of Leaves added due to uses linking.
+     *
+     * @return effective list of Leaves added due to uses linking
+     */
+    public List<List<YangLeaf>> getUsesResolvedLeavesList() {
+        return resolvedGroupingLeaves;
+    }
+
+    /**
+     * Adds the leaf-lists under grouping to the effective uses resolved info.
+     *
+     * @param leafListsInGrouping leaf-lists defined under grouping which needs to be copied in
+     *                            the context of uses
+     */
+    public void addListOfLeafListOfGrouping(List<YangLeafList> leafListsInGrouping) {
+        resolvedGroupingLeafLists.add(leafListsInGrouping);
+    }
+
+    /**
+     * Returns the effective list of Leaves added due to uses linking.
+     *
+     * @return effective list of Leaves added due to uses linking
+     */
+    public List<List<YangLeafList>> getUsesResolvedListOfLeafList() {
+        return resolvedGroupingLeafLists;
+    }
+}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/exceptions/DataModelException.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/exceptions/DataModelException.java
new file mode 100644
index 0000000..b1375a7
--- /dev/null
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/exceptions/DataModelException.java
@@ -0,0 +1,90 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.yangutils.datamodel.exceptions;
+
+/**
+ * Represents base class for exceptions in data model operations.
+ */
+public class DataModelException extends Exception {
+
+    private static final long serialVersionUID = 201601270658L;
+    private int lineNumber;
+    private int charPositionInLine;
+
+    /**
+     * Creates a data model exception with message.
+     *
+     * @param message the detail of exception in string
+     */
+    public DataModelException(String message) {
+        super(message);
+    }
+
+    /**
+     * Creates exception from message and cause.
+     *
+     * @param message the detail of exception in string
+     * @param cause underlying cause of the error
+     */
+    public DataModelException(final String message, final Throwable cause) {
+        super(message, cause);
+    }
+
+    /**
+     * Creates exception from cause.
+     *
+     * @param cause underlying cause of the error
+     */
+    public DataModelException(final Throwable cause) {
+        super(cause);
+    }
+
+    /**
+     * Returns line number of the exception.
+     *
+     * @return line number of the exception
+     */
+    public int getLineNumber() {
+        return this.lineNumber;
+    }
+
+    /**
+     * Returns position of the exception.
+     *
+     * @return position of the exception
+     */
+    public int getCharPositionInLine() {
+        return this.charPositionInLine;
+    }
+
+    /**
+     * Sets line number of YANG file.
+     *
+     * @param line line number of YANG file
+     */
+    public void setLine(int line) {
+        this.lineNumber = line;
+    }
+
+    /**
+     * Sets position of exception.
+     *
+     * @param charPosition position of exception
+     */
+    public void setCharPosition(int charPosition) {
+        this.charPositionInLine = charPosition;
+    }
+}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/exceptions/package-info.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/exceptions/package-info.java
new file mode 100644
index 0000000..ec607f3
--- /dev/null
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/exceptions/package-info.java
@@ -0,0 +1,19 @@
+/*
+ * 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.
+ */
+/**
+ * Custom data model exceptions.
+ */
+package org.onosproject.yangutils.datamodel.exceptions;
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/package-info.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/package-info.java
new file mode 100644
index 0000000..d8e8901
--- /dev/null
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * 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.
+ */
+
+/**
+ * Maintains application's schema information.
+ */
+package org.onosproject.yangutils.datamodel;
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/DataModelUtils.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/DataModelUtils.java
new file mode 100644
index 0000000..f7ac5f2
--- /dev/null
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/DataModelUtils.java
@@ -0,0 +1,258 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yangutils.datamodel.utils;
+
+import java.util.List;
+import java.util.Set;
+
+import org.onosproject.yangutils.datamodel.CollisionDetector;
+import org.onosproject.yangutils.datamodel.ResolvableType;
+import org.onosproject.yangutils.datamodel.YangLeaf;
+import org.onosproject.yangutils.datamodel.YangLeafList;
+import org.onosproject.yangutils.datamodel.YangLeavesHolder;
+import org.onosproject.yangutils.datamodel.YangNode;
+import org.onosproject.yangutils.datamodel.YangReferenceResolver;
+import org.onosproject.yangutils.datamodel.YangResolutionInfo;
+import org.onosproject.yangutils.datamodel.YangRpc;
+import org.onosproject.yangutils.datamodel.YangType;
+import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
+
+/**
+ * Represents utilities for data model tree.
+ */
+public final class DataModelUtils {
+
+    /**
+     * Creates a new data model tree utility.
+     */
+    private DataModelUtils() {
+    }
+
+    /**
+     * Detects the colliding identifier name in a given YANG node and its child.
+     *
+     * @param identifierName name for which collision detection is to be checked
+     * @param dataType       type of YANG node asking for detecting collision
+     * @param node           instance of calling node
+     * @throws DataModelException a violation of data model rules
+     */
+    public static void detectCollidingChildUtil(String identifierName, YangConstructType dataType, YangNode node)
+            throws DataModelException {
+        if (dataType == YangConstructType.USES_DATA || dataType == YangConstructType.GROUPING_DATA) {
+            detectCollidingForUsesGrouping(identifierName, dataType, node);
+        } else {
+            if (node instanceof YangLeavesHolder) {
+                YangLeavesHolder leavesHolder = (YangLeavesHolder) node;
+                detectCollidingLeaf(leavesHolder.getListOfLeaf(), identifierName);
+                detectCollidingLeafList(leavesHolder.getListOfLeafList(), identifierName);
+            }
+            node = node.getChild();
+            while (node != null) {
+                Parsable parsable = (Parsable) node;
+                if (node instanceof CollisionDetector
+                        && parsable.getYangConstructType() != YangConstructType.USES_DATA
+                        && parsable.getYangConstructType() != YangConstructType.GROUPING_DATA) {
+                    ((CollisionDetector) node).detectSelfCollision(identifierName, dataType);
+                }
+                node = node.getNextSibling();
+            }
+        }
+    }
+
+    /**
+     * Detects colliding of uses and grouping only with uses and grouping respectively.
+     *
+     * @param identifierName name for which collision detection is to be checked
+     * @param dataType       type of YANG node asking for detecting collision
+     * @param node           node instance of calling node
+     * @throws DataModelException a violation of data model rules
+     */
+    public static void detectCollidingForUsesGrouping(String identifierName, YangConstructType dataType, YangNode node)
+            throws DataModelException {
+
+        node = node.getChild();
+        while (node != null) {
+            Parsable parsable = (Parsable) node;
+            if (node instanceof CollisionDetector
+                    && parsable.getYangConstructType() == dataType) {
+                ((CollisionDetector) node).detectSelfCollision(identifierName, dataType);
+            }
+            node = node.getNextSibling();
+        }
+    }
+
+    /**
+     * Detects the colliding identifier name in a given leaf node.
+     *
+     * @param listOfLeaf     List of leaves to detect collision
+     * @param identifierName name for which collision detection is to be checked
+     * @throws DataModelException a violation of data model rules
+     */
+    private static void detectCollidingLeaf(List<YangLeaf> listOfLeaf, String identifierName)
+            throws DataModelException {
+
+        if (listOfLeaf == null) {
+            return;
+        }
+        for (YangLeaf leaf : listOfLeaf) {
+            if (leaf.getName().equals(identifierName)) {
+                throw new DataModelException("YANG file error: Duplicate input identifier detected, same as leaf \""
+                        + leaf.getName() + "\"");
+            }
+        }
+    }
+
+    /**
+     * Detects the colliding identifier name in a given leaf-list node.
+     *
+     * @param listOfLeafList list of leaf-lists to detect collision
+     * @param identifierName name for which collision detection is to be checked
+     * @throws DataModelException a violation of data model rules
+     */
+    private static void detectCollidingLeafList(List<YangLeafList> listOfLeafList, String identifierName)
+            throws DataModelException {
+
+        if (listOfLeafList == null) {
+            return;
+        }
+        for (YangLeafList leafList : listOfLeafList) {
+            if (leafList.getName().equals(identifierName)) {
+                throw new DataModelException("YANG file error: Duplicate input identifier detected, same as leaf " +
+                        "list \"" + leafList.getName() + "\"");
+            }
+        }
+    }
+
+    /**
+     * Add a resolution information.
+     *
+     * @param resolutionInfo information about the YANG construct which has to be resolved
+     * @throws DataModelException a violation of data model rules
+     */
+    public static void addResolutionInfo(YangResolutionInfo resolutionInfo)
+            throws DataModelException {
+
+        /* get the module node to add maintain the list of nested reference */
+        YangNode curNode = resolutionInfo.getEntityToResolveInfo()
+                .getHolderOfEntityToResolve();
+        while (!(curNode instanceof YangReferenceResolver)) {
+            curNode = curNode.getParent();
+            if (curNode == null) {
+                throw new DataModelException("Internal datamodel error: Datamodel tree is not correct");
+            }
+        }
+        YangReferenceResolver resolutionNode = (YangReferenceResolver) curNode;
+
+        if (resolutionInfo.getEntityToResolveInfo()
+                .getEntityToResolve() instanceof YangType) {
+            resolutionNode.addToResolutionList(resolutionInfo,
+                    ResolvableType.YANG_DERIVED_DATA_TYPE);
+        } else {
+            resolutionNode.addToResolutionList(resolutionInfo,
+                    ResolvableType.YANG_USES);
+        }
+
+    }
+
+    /**
+     * Resolve linking for a resolution list.
+     *
+     * @param resolutionList    resolution list for which linking to be done
+     * @param dataModelRootNode module/sub-module node
+     * @throws DataModelException a violation of data model rules
+     */
+    public static void resolveLinkingForResolutionList(List<YangResolutionInfo> resolutionList,
+            YangReferenceResolver dataModelRootNode)
+            throws DataModelException {
+
+        for (YangResolutionInfo resolutionInfo : resolutionList) {
+            resolutionInfo.resolveLinkingForResolutionInfo(dataModelRootNode);
+        }
+    }
+
+    /**
+     * Links type/uses referring to typedef/uses of inter YANG file.
+     *
+     * @param resolutionList    resolution list for which linking to be done
+     * @param dataModelRootNode module/sub-module node
+     * @throws DataModelException a violation of data model rules
+     */
+    public static void linkInterFileReferences(List<YangResolutionInfo> resolutionList,
+            YangReferenceResolver dataModelRootNode)
+            throws DataModelException {
+        /*
+         * Run through the resolution list, find type/uses referring to inter
+         * file typedef/grouping, ask for linking.
+         */
+        for (YangResolutionInfo resolutionInfo : resolutionList) {
+            resolutionInfo.linkInterFile(dataModelRootNode);
+        }
+    }
+
+    /**
+     * Checks if there is any rpc defined in the module or sub-module.
+     *
+     * @param rootNode root node of the data model
+     * @return status of rpc's existence
+     */
+    public static boolean isRpcChildNodePresent(YangNode rootNode) {
+        YangNode childNode = rootNode.getChild();
+        while (childNode != null) {
+            if (childNode instanceof YangRpc) {
+                return true;
+            }
+            childNode = childNode.getNextSibling();
+        }
+        return false;
+    }
+
+    /**
+     * Returns referred node in a given set.
+     *
+     * @param yangNodeSet YANG node set
+     * @param refNodeName name of the node which is referred
+     * @return referred node's reference
+     */
+    public static YangNode findReferredNode(Set<YangNode> yangNodeSet, String refNodeName) {
+        /*
+         * Run through the YANG files to see which YANG file matches the
+         * referred node name.
+         */
+        for (YangNode yangNode : yangNodeSet) {
+            if (yangNode.getName().equals(refNodeName)) {
+                return yangNode;
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Returns the contained data model parent node.
+     *
+     * @param currentNode current node which parent contained node is required
+     * @return parent node in which the current node is an attribute
+     */
+    public static YangNode getParentNodeInGenCode(YangNode currentNode) {
+
+        /*
+         * TODO: recursive parent lookup to support choice/augment/uses. TODO:
+         * need to check if this needs to be updated for
+         * choice/case/augment/grouping
+         */
+        return currentNode.getParent();
+    }
+}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/GeneratedLanguage.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/GeneratedLanguage.java
new file mode 100644
index 0000000..37d2161
--- /dev/null
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/GeneratedLanguage.java
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.yangutils.datamodel.utils;
+
+/**
+ * Represents the target language in which the YANG information is modeled.
+ */
+public enum GeneratedLanguage {
+    /**
+     * Target language is java.
+     */
+    JAVA_GENERATION
+}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/Parsable.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/Parsable.java
new file mode 100644
index 0000000..eb32bc8
--- /dev/null
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/Parsable.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.yangutils.datamodel.utils;
+
+import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
+
+/**
+ * Abstraction of an entity which process the data of lexer's parse tree.
+ */
+public interface Parsable {
+
+    /**
+     * Returns the type of YANG construct data.
+     *
+     * @return the type of YANG construct data.
+     */
+    YangConstructType getYangConstructType();
+
+    /**
+     * Checks if the node is valid as per YANG grammar's syntax and semantics.
+     * This validation will be performed on entering the node in traversal
+     *
+     * @throws DataModelException if there is any violation of the YANG rules
+     * in parsed data, corresponding exception should be thrown
+     */
+    void validateDataOnEntry() throws DataModelException;
+
+    /**
+     * Checks if the node is valid as per YANG grammar's syntax and semantics.
+     * This validation will be performed on exiting the node in traversal
+     *
+     * @throws DataModelException if there is any violation of the YANG rules
+     * in parsed data, corresponding exception should be thrown
+     */
+    void validateDataOnExit() throws DataModelException;
+}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/ResolvableStatus.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/ResolvableStatus.java
new file mode 100644
index 0000000..d476c8b
--- /dev/null
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/ResolvableStatus.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yangutils.datamodel.utils;
+
+/**
+ * Represents the status of resolvable entity.
+ */
+public enum ResolvableStatus {
+
+    /**
+     * Identifies that resolvable entity is unresolved.
+     */
+    UNRESOLVED,
+
+    /**
+     * Identifies that resolvable entity's reference is linked.
+     */
+    LINKED,
+
+    /**
+     * Identifies that resolvable entity is IntraFile resolved (i.e. complete
+     * linking with in the intra file).
+     */
+    INTRA_FILE_RESOLVED,
+
+    /**
+     * Identifies that resolvable entity is resolved.
+     */
+    RESOLVED,
+
+    /**
+     * Identifies that resolvable entity is inter file linked (i.e. complete
+     * linking with external files).
+     */
+    INTER_FILE_LINKED
+
+}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/RestrictionResolver.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/RestrictionResolver.java
new file mode 100644
index 0000000..c9863c0
--- /dev/null
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/RestrictionResolver.java
@@ -0,0 +1,268 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yangutils.datamodel.utils;
+
+import static org.onosproject.yangutils.datamodel.YangDataTypes.DECIMAL64;
+import static org.onosproject.yangutils.datamodel.YangDataTypes.INT16;
+import static org.onosproject.yangutils.datamodel.YangDataTypes.INT32;
+import static org.onosproject.yangutils.datamodel.YangDataTypes.INT64;
+import static org.onosproject.yangutils.datamodel.YangDataTypes.INT8;
+import static org.onosproject.yangutils.datamodel.YangDataTypes.UINT16;
+import static org.onosproject.yangutils.datamodel.YangDataTypes.UINT32;
+import static org.onosproject.yangutils.datamodel.YangDataTypes.UINT64;
+import static org.onosproject.yangutils.datamodel.YangDataTypes.UINT8;
+import static org.onosproject.yangutils.datamodel.utils.YangConstructType.LENGTH_DATA;
+import static org.onosproject.yangutils.datamodel.utils.YangConstructType.RANGE_DATA;
+import static org.onosproject.yangutils.datamodel.utils.builtindatatype.BuiltInTypeObjectFactory.getDataObjectFromString;
+
+import java.util.regex.Pattern;
+
+import org.onosproject.yangutils.datamodel.YangDataTypes;
+import org.onosproject.yangutils.datamodel.YangRangeInterval;
+import org.onosproject.yangutils.datamodel.YangRangeRestriction;
+import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
+import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangBuiltInDataTypeInfo;
+
+/**
+ * Represents restriction resolver which provide common utility used by parser
+ * and during linking for restriction resolution.
+ */
+public final class RestrictionResolver {
+
+    private static final String PIPE = "|";
+    private static final String ADD = "+";
+    private static final String EMPTY_STRING = "";
+    private static final String INTERVAL = "..";
+    private static final int MAX_RANGE_BOUNDARY = 2;
+    private static final int MIN_RANGE_BOUNDARY = 1;
+    private static final String MIN_KEYWORD = "min";
+    private static final String MAX_KEYWORD = "max";
+
+    /**
+     * Creates a restriction resolver.
+     */
+    private RestrictionResolver() {
+    }
+
+    /**
+     * Processes the range restriction for parser and linker.
+     *
+     * @param refRangeRestriction    range restriction of referred typedef
+     * @param lineNumber             error line number
+     * @param charPositionInLine     error character position in line
+     * @param hasReferredRestriction whether has referred restriction
+     * @param curRangeString         caller type's range string
+     * @param effectiveType          effective type, when called from linker
+     * @return YANG range restriction
+     * @throws DataModelException a violation in data model rule
+     */
+    public static YangRangeRestriction processRangeRestriction(YangRangeRestriction refRangeRestriction,
+            int lineNumber, int charPositionInLine,
+            boolean hasReferredRestriction,
+            String curRangeString, YangDataTypes effectiveType)
+            throws DataModelException {
+        YangBuiltInDataTypeInfo<?> startValue;
+        YangBuiltInDataTypeInfo<?> endValue;
+        YangRangeRestriction rangeRestriction = new YangRangeRestriction();
+
+        String rangeArgument = removeQuotesAndHandleConcat(curRangeString);
+        String[] rangeArguments = rangeArgument.trim().split(Pattern.quote(PIPE));
+
+        for (String rangePart : rangeArguments) {
+            String startInterval;
+            String endInterval;
+            YangRangeInterval rangeInterval = new YangRangeInterval();
+            String[] rangeBoundary = rangePart.trim().split(Pattern.quote(INTERVAL));
+
+            if (rangeBoundary.length > MAX_RANGE_BOUNDARY) {
+                DataModelException dataModelException = new DataModelException("YANG file error : " +
+                        YangConstructType.getYangConstructType(RANGE_DATA) + " " + rangeArgument +
+                        " is not valid.");
+                dataModelException.setLine(lineNumber);
+                dataModelException.setCharPosition(charPositionInLine);
+                throw dataModelException;
+            }
+
+            if (rangeBoundary.length == MIN_RANGE_BOUNDARY) {
+                startInterval = rangeBoundary[0].trim();
+                endInterval = rangeBoundary[0].trim();
+            } else {
+                startInterval = rangeBoundary[0].trim();
+                endInterval = rangeBoundary[1].trim();
+            }
+
+            try {
+                if (hasReferredRestriction && startInterval.equals(MIN_KEYWORD)
+                        && refRangeRestriction.getMinRestrictedvalue() != null) {
+                    startValue = refRangeRestriction.getMinRestrictedvalue();
+                } else if (hasReferredRestriction && startInterval.equals(MAX_KEYWORD)
+                        && refRangeRestriction.getMaxRestrictedvalue() != null) {
+                    startValue = refRangeRestriction.getMaxRestrictedvalue();
+                } else {
+                    startValue = getDataObjectFromString(startInterval, effectiveType);
+                }
+                if (hasReferredRestriction && endInterval.equals(MIN_KEYWORD)
+                        && refRangeRestriction.getMinRestrictedvalue() != null) {
+                    endValue = refRangeRestriction.getMinRestrictedvalue();
+                } else if (hasReferredRestriction && endInterval.equals(MAX_KEYWORD)
+                        && refRangeRestriction.getMaxRestrictedvalue() != null) {
+                    endValue = refRangeRestriction.getMaxRestrictedvalue();
+                } else {
+                    endValue = getDataObjectFromString(endInterval, effectiveType);
+                }
+            } catch (Exception e) {
+                DataModelException dataModelException = new DataModelException(e.getMessage());
+                dataModelException.setLine(lineNumber);
+                dataModelException.setCharPosition(charPositionInLine);
+                throw dataModelException;
+            }
+
+            rangeInterval.setStartValue(startValue);
+            rangeInterval.setEndValue(endValue);
+
+            try {
+                rangeRestriction.addRangeRestrictionInterval(rangeInterval);
+            } catch (DataModelException dataModelException) {
+                dataModelException.setLine(lineNumber);
+                dataModelException.setCharPosition(charPositionInLine);
+                throw dataModelException;
+            }
+        }
+        return rangeRestriction;
+    }
+
+    /**
+     * Processes the length restriction for parser and linker.
+     *
+     * @param refLengthRestriction   length restriction of referred typedef
+     * @param lineNumber             error line number
+     * @param charPositionInLine     error character position in line
+     * @param hasReferredRestriction whether has referred restriction
+     * @param curLengthString        caller type's length string
+     * @return YANG range restriction
+     * @throws DataModelException a violation in data model rule
+     */
+    public static YangRangeRestriction processLengthRestriction(YangRangeRestriction refLengthRestriction,
+            int lineNumber, int charPositionInLine,
+            boolean hasReferredRestriction,
+            String curLengthString) throws DataModelException {
+
+        YangBuiltInDataTypeInfo<?> startValue;
+        YangBuiltInDataTypeInfo<?> endValue;
+        YangRangeRestriction lengthRestriction = new YangRangeRestriction<>();
+
+        String rangeArgument = removeQuotesAndHandleConcat(curLengthString);
+        String[] rangeArguments = rangeArgument.trim().split(Pattern.quote(PIPE));
+
+        for (String rangePart : rangeArguments) {
+            String startInterval;
+            String endInterval;
+            YangRangeInterval rangeInterval = new YangRangeInterval<>();
+            String[] rangeBoundary = rangePart.trim().split(Pattern.quote(INTERVAL));
+
+            if (rangeBoundary.length > MAX_RANGE_BOUNDARY) {
+                DataModelException dataModelException = new DataModelException("YANG file error : " +
+                        YangConstructType.getYangConstructType(LENGTH_DATA) + " " + rangeArgument +
+                        " is not valid.");
+                dataModelException.setLine(lineNumber);
+                dataModelException.setCharPosition(charPositionInLine);
+                throw dataModelException;
+            }
+
+            if (rangeBoundary.length == MIN_RANGE_BOUNDARY) {
+                startInterval = rangeBoundary[0].trim();
+                endInterval = rangeBoundary[0].trim();
+            } else {
+                startInterval = rangeBoundary[0].trim();
+                endInterval = rangeBoundary[1].trim();
+            }
+
+            try {
+                if (hasReferredRestriction && startInterval.equals(MIN_KEYWORD)
+                        && refLengthRestriction.getMinRestrictedvalue() != null) {
+                    startValue = refLengthRestriction.getMinRestrictedvalue();
+                } else if (hasReferredRestriction && startInterval.equals(MAX_KEYWORD)
+                        && refLengthRestriction.getMaxRestrictedvalue() != null) {
+                    startValue = refLengthRestriction.getMaxRestrictedvalue();
+                } else {
+                    startValue = getDataObjectFromString(startInterval, YangDataTypes.UINT64);
+                }
+                if (hasReferredRestriction && endInterval.equals(MIN_KEYWORD)
+                        && refLengthRestriction.getMinRestrictedvalue() != null) {
+                    endValue = refLengthRestriction.getMinRestrictedvalue();
+                } else if (hasReferredRestriction && endInterval.equals(MAX_KEYWORD)
+                        && refLengthRestriction.getMaxRestrictedvalue() != null) {
+                    endValue = refLengthRestriction.getMaxRestrictedvalue();
+                } else {
+                    endValue = getDataObjectFromString(endInterval, YangDataTypes.UINT64);
+                }
+            } catch (Exception e) {
+                DataModelException dataModelException = new DataModelException(e.getMessage());
+                dataModelException.setLine(lineNumber);
+                dataModelException.setCharPosition(charPositionInLine);
+                throw dataModelException;
+            }
+
+            rangeInterval.setStartValue(startValue);
+            rangeInterval.setEndValue(endValue);
+
+            try {
+                lengthRestriction.addRangeRestrictionInterval(rangeInterval);
+            } catch (DataModelException dataModelException) {
+                dataModelException.setLine(lineNumber);
+                dataModelException.setCharPosition(charPositionInLine);
+                throw dataModelException;
+            }
+        }
+        return lengthRestriction;
+    }
+
+    /**
+     * Returns whether the data type is of range restricted type.
+     *
+     * @param dataType data type to be checked
+     * @return true, if data type can have range restrictions, false otherwise
+     */
+    public static boolean isOfRangeRestrictedType(YangDataTypes dataType) {
+        return dataType == INT8
+                || dataType == INT16
+                || dataType == INT32
+                || dataType == INT64
+                || dataType == UINT8
+                || dataType == UINT16
+                || dataType == UINT32
+                || dataType == UINT64
+                || dataType == DECIMAL64;
+    }
+
+    /**
+     * Removes doubles quotes and concatenates if string has plus symbol.
+     *
+     * @param yangStringData string from yang file
+     * @return concatenated string after removing double quotes
+     */
+    private static String removeQuotesAndHandleConcat(String yangStringData) {
+
+        yangStringData = yangStringData.replace("\"", EMPTY_STRING);
+        String[] tmpData = yangStringData.split(Pattern.quote(ADD));
+        StringBuilder builder = new StringBuilder();
+        for (String yangString : tmpData) {
+            builder.append(yangString);
+        }
+        return builder.toString();
+    }
+}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/YangConstructType.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/YangConstructType.java
new file mode 100644
index 0000000..715fb76
--- /dev/null
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/YangConstructType.java
@@ -0,0 +1,532 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.yangutils.datamodel.utils;
+
+/**
+ * Represents ENUM to represent the type of data in parse tree.
+ */
+public enum YangConstructType {
+    /**
+     * Identifies the module parsed data.
+     */
+    MODULE_DATA,
+
+    /**
+     * Identifies the sub module parsed data.
+     */
+    SUB_MODULE_DATA,
+
+    /**
+     * Identifies the typedef parsed data.
+     */
+    TYPEDEF_DATA,
+
+    /**
+     * Identifies the type parsed data.
+     */
+    TYPE_DATA,
+
+    /**
+     * Identifies the choice parsed data.
+     */
+    CHOICE_DATA,
+
+    /**
+     * Identifies the case parsed data.
+     */
+    CASE_DATA,
+
+    /**
+     * Identifies the YANG enumeration parsed data.
+     */
+    ENUMERATION_DATA,
+
+    /**
+     * Identifies the grouping parsed data.
+     */
+    GROUPING_DATA,
+
+    /**
+     * Identifies the uses parsed data.
+     */
+    USES_DATA,
+
+    /**
+     * Identifies the augment parsed data.
+     */
+    AUGMENT_DATA,
+
+    /**
+     * Identifies the container parsed data.
+     */
+    CONTAINER_DATA,
+
+    /**
+     * Identifies the YANG list parsed data.
+     */
+    LIST_DATA,
+
+    /**
+     * Identifies the YANG belongs-to parsed data.
+     */
+    BELONGS_TO_DATA,
+
+    /**
+     * Identifies the YANG bit parsed data.
+     */
+    BIT_DATA,
+
+    /**
+     * Identifies the YANG bits parsed data.
+     */
+    BITS_DATA,
+
+    /**
+     * Identifies the YANG enum parsed data.
+     */
+    ENUM_DATA,
+
+    /**
+     * Identifies the YANG import parsed data.
+     */
+    IMPORT_DATA,
+
+    /**
+     * Identifies the YANG include parsed data.
+     */
+    INCLUDE_DATA,
+
+    /**
+     * Identifies the YANG leaf parsed data.
+     */
+    LEAF_DATA,
+
+    /**
+     * Identifies the YANG leaf list parsed data.
+     */
+    LEAF_LIST_DATA,
+
+    /**
+     * Identifies the YANG must parsed data.
+     */
+    MUST_DATA,
+
+    /**
+     * Identifies the YANG revision parsed data.
+     */
+    REVISION_DATA,
+
+    /**
+     * Identifies the YANG revision date parsed data.
+     */
+    REVISION_DATE_DATA,
+
+    /**
+     * Identifies the YANG namespace parsed data.
+     */
+    NAMESPACE_DATA,
+
+    /**
+     * Identifies the YANG contact parsed data.
+     */
+    CONTACT_DATA,
+
+    /**
+     * Identifies the YANG config parsed data.
+     */
+    CONFIG_DATA,
+
+    /**
+     * Identifies the YANG description parsed data.
+     */
+    DESCRIPTION_DATA,
+
+    /**
+     * Identifies the YANG key parsed data.
+     */
+    KEY_DATA,
+
+    /**
+     * Identifies the YANG mandatory parsed data.
+     */
+    MANDATORY_DATA,
+
+    /**
+     * Identifies the YANG max element parsed data.
+     */
+    MAX_ELEMENT_DATA,
+
+    /**
+     * Identifies the YANG min element parsed data.
+     */
+    MIN_ELEMENT_DATA,
+
+    /**
+     * Identifies the YANG presence element parsed data.
+     */
+    PRESENCE_DATA,
+
+    /**
+     * Identifies the YANG reference element parsed data.
+     */
+    REFERENCE_DATA,
+
+    /**
+     * Identifies the YANG status element parsed data.
+     */
+    STATUS_DATA,
+
+    /**
+     * Identifies the YANG units element parsed data.
+     */
+    UNITS_DATA,
+
+    /**
+     * Identifies the YANG version element parsed data.
+     */
+    VERSION_DATA,
+
+    /**
+     * Identifies the YANG base element parsed data.
+     */
+    YANGBASE_DATA,
+
+    /**
+     * Identifies the YANG prefix element parsed data.
+     */
+    PREFIX_DATA,
+
+    /**
+     * Identifies the YANG default element parsed data.
+     */
+    DEFAULT_DATA,
+
+    /**
+     * Identifies the YANG value element parsed data.
+     */
+    VALUE_DATA,
+
+    /**
+     * Identifies the YANG organization parsed data.
+     */
+    ORGANIZATION_DATA,
+
+    /**
+     * Identifies the YANG position element parsed data.
+     */
+    POSITION_DATA,
+
+    /**
+     * Identifies the YANG data definition statements.
+     */
+    DATA_DEF_DATA,
+
+    /**
+     * Identifies the YANG union element parsed data.
+     */
+    UNION_DATA,
+
+    /**
+     * Identifies the YANG notification element parsed data.
+     */
+    NOTIFICATION_DATA,
+
+    /**
+     * Identifies the YANG when element parsed data.
+     */
+    WHEN_DATA,
+
+    /**
+     * Identifies the YANG input element parsed data.
+     */
+    INPUT_DATA,
+
+    /**
+     * Identifies the YANG output element parsed data.
+     */
+    OUTPUT_DATA,
+
+    /**
+     * Identifies the YANG rpc element parsed data.
+     */
+    RPC_DATA,
+
+    /**
+     * Identifies the YANG short case element parsed data.
+     */
+    SHORT_CASE_DATA,
+
+    /**
+     * Identifies the derived data type.
+     */
+    DERIVED,
+
+    /**
+     * Identifies the YANG range element parsed data.
+     */
+    RANGE_DATA,
+
+    /**
+     * Identifies the YANG length element parsed data.
+     */
+    LENGTH_DATA,
+
+    /**
+     * Identifies the YANG pattern element parsed data.
+     */
+    PATTERN_DATA,
+
+    /**
+     * Identifies the YANG extension element parsed data.
+     */
+    EXTENSION_DATA,
+
+    /**
+     * Identifies the YANG identity element parsed data.
+     */
+    IDENTITY_DATA,
+
+    /**
+     * Identifies the YANG base element parsed data.
+     */
+    BASE_DATA,
+
+    /**
+     * Identifies the YANG feature element parsed data.
+     */
+    FEATURE_DATA,
+
+    /**
+     * Identifies the YANG if-feature element parsed data.
+     */
+    IF_FEATURE_DATA,
+
+    /**
+     * Identifies the YANG path element parsed data.
+     */
+    PATH_DATA,
+
+    /**
+     * Identifies the YANG require-instance element parsed data.
+     */
+    REQUIRE_INSTANCE_DATA,
+
+    /**
+     * Identifies the YANG ordered-by element parsed data.
+     */
+    ORDERED_BY_DATA,
+
+    /**
+     * Identifies the YANG error-message element parsed data.
+     */
+    ERROR_MESSAGE_DATA,
+
+    /**
+     * Identifies the YANG error-app-tag element parsed data.
+     */
+    ERROR_APP_TAG_DATA,
+
+    /**
+     * Identifies the YANG unique element parsed data.
+     */
+    UNIQUE_DATA,
+
+    /**
+     * Identifies the YANG refine element parsed data.
+     */
+    REFINE_DATA,
+
+    /**
+     * Identifies the YANG leafref element parsed data.
+     */
+    LEAFREF_DATA,
+
+    /**
+     * Identifies the YANG identityref element parsed data.
+     */
+    IDENTITYREF_DATA,
+
+    /**
+     * Identifies the YANG instance identifier element parsed data.
+     */
+    INSTANCE_IDENTIFIER_DATA,
+
+    /**
+     * Identifies the YANG deviation element parsed data.
+     */
+    DEVIATION_DATA,
+
+    /**
+     * Identifies the YANG anyxml element parsed data.
+     */
+    ANYXML_DATA;
+
+    /**
+     * Returns the YANG construct keyword corresponding to enum values.
+     *
+     * @param yangConstructType enum value for parsable data type.
+     * @return YANG construct keyword.
+     */
+    public static String getYangConstructType(YangConstructType yangConstructType) {
+
+        switch (yangConstructType) {
+            case MODULE_DATA:
+                return "module";
+            case SUB_MODULE_DATA:
+                return "submodule";
+            case TYPEDEF_DATA:
+                return "typedef";
+            case TYPE_DATA:
+                return "type";
+            case CHOICE_DATA:
+                return "choice";
+            case CASE_DATA:
+                return "case";
+            case ENUMERATION_DATA:
+                return "enumeration";
+            case GROUPING_DATA:
+                return "grouping";
+            case USES_DATA:
+                return "uses";
+            case AUGMENT_DATA:
+                return "augment";
+            case CONTAINER_DATA:
+                return "container";
+            case LIST_DATA:
+                return "list";
+            case BELONGS_TO_DATA:
+                return "belongs-to";
+            case BIT_DATA:
+                return "bit";
+            case BITS_DATA:
+                return "bits";
+            case ENUM_DATA:
+                return "enum";
+            case IMPORT_DATA:
+                return "import";
+            case INCLUDE_DATA:
+                return "include";
+            case LEAF_DATA:
+                return "leaf";
+            case LEAF_LIST_DATA:
+                return "leaf-list";
+            case MUST_DATA:
+                return "must";
+            case REVISION_DATA:
+                return "revision";
+            case REVISION_DATE_DATA:
+                return "revision-date";
+            case NAMESPACE_DATA:
+                return "namespace";
+            case CONTACT_DATA:
+                return "contact";
+            case CONFIG_DATA:
+                return "config";
+            case DESCRIPTION_DATA:
+                return "description";
+            case KEY_DATA:
+                return "key";
+            case MANDATORY_DATA:
+                return "mandatory";
+            case MAX_ELEMENT_DATA:
+                return "max-elements";
+            case MIN_ELEMENT_DATA:
+                return "min-elements";
+            case PRESENCE_DATA:
+                return "presence";
+            case REFERENCE_DATA:
+                return "reference";
+            case STATUS_DATA:
+                return "status";
+            case UNITS_DATA:
+                return "units";
+            case VERSION_DATA:
+                return "version";
+            case YANGBASE_DATA:
+                return "yangbase";
+            case PREFIX_DATA:
+                return "prefix";
+            case ORGANIZATION_DATA:
+                return "organization";
+            case VALUE_DATA:
+                return "value";
+            case POSITION_DATA:
+                return "position";
+            case DEFAULT_DATA:
+                return "default";
+            case DATA_DEF_DATA:
+                return "data-def-substatements";
+            case WHEN_DATA:
+                return "when";
+            case INPUT_DATA:
+                return "input";
+            case OUTPUT_DATA:
+                return "ouput";
+            case RPC_DATA:
+                return "rpc";
+            case SHORT_CASE_DATA:
+                return "short-case";
+            case DERIVED:
+                return "derived";
+            case NOTIFICATION_DATA:
+                return "notification";
+            case UNION_DATA:
+                return "union";
+            case RANGE_DATA:
+                return "range";
+            case LENGTH_DATA:
+                return "length";
+            case PATTERN_DATA:
+                return "pattern";
+            case EXTENSION_DATA:
+                return "extension";
+            case IDENTITY_DATA:
+                return "identity";
+            case BASE_DATA:
+                return "base";
+            case FEATURE_DATA:
+                return "feature";
+            case IF_FEATURE_DATA:
+                return "if-feature";
+            case PATH_DATA:
+                return "path";
+            case REQUIRE_INSTANCE_DATA:
+                return "require-instance";
+            case ORDERED_BY_DATA:
+                return "ordered-by";
+            case ERROR_MESSAGE_DATA:
+                return "error-message";
+            case ERROR_APP_TAG_DATA:
+                return "error-app-tag";
+            case UNIQUE_DATA:
+                return "unique";
+            case REFINE_DATA:
+                return "refine";
+            case LEAFREF_DATA:
+                return "leafref";
+            case IDENTITYREF_DATA:
+                return "identityref";
+            case INSTANCE_IDENTIFIER_DATA:
+                return "instance-identifier";
+            case DEVIATION_DATA:
+                return "deviation";
+            case ANYXML_DATA:
+                return "anyxml";
+            default:
+                return "yang";
+        }
+    }
+}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/BuiltInTypeObjectFactory.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/BuiltInTypeObjectFactory.java
new file mode 100644
index 0000000..1f28565
--- /dev/null
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/BuiltInTypeObjectFactory.java
@@ -0,0 +1,79 @@
+/*-
+ * Copyright 2016 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.yangutils.datamodel.utils.builtindatatype;
+
+import java.io.Serializable;
+
+import org.onosproject.yangutils.datamodel.YangDataTypes;
+
+/**
+ * Factory to create an object of required type.
+ */
+public final class BuiltInTypeObjectFactory implements Serializable {
+
+    private static final long serialVersionUID = 8006201671L;
+
+    /**
+     * Utility factory class, hence the object creation is forbidden.
+     */
+    private BuiltInTypeObjectFactory() {
+    }
+
+    /**
+     * Given the value represented in string return the corresponding types
+     * object with the value initialized.
+     *
+     * @param valueInStr  value represented in string
+     * @param builtInType built in data type
+     * @param <T>         the data type of the target object
+     * @return the target data type object with the value initialized
+     */
+    public static <T extends YangBuiltInDataTypeInfo<?>> T getDataObjectFromString(String valueInStr,
+            YangDataTypes builtInType) {
+
+        switch (builtInType) {
+        case INT8: {
+            return (T) new YangInt8(valueInStr);
+        }
+        case INT16: {
+            return (T) new YangInt16(valueInStr);
+        }
+        case INT32: {
+            return (T) new YangInt32(valueInStr);
+        }
+        case INT64: {
+            return (T) new YangInt64(valueInStr);
+        }
+        case UINT8: {
+            return (T) new YangUint8(valueInStr);
+        }
+        case UINT16: {
+            return (T) new YangUint16(valueInStr);
+        }
+        case UINT32: {
+            return (T) new YangUint32(valueInStr);
+        }
+        case UINT64: {
+            return (T) new YangUint64(valueInStr);
+        }
+        default: {
+            throw new DataTypeException("YANG file error : Unsupported data type");
+        }
+        }
+
+    }
+
+}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/DataTypeException.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/DataTypeException.java
new file mode 100644
index 0000000..8c24d6c
--- /dev/null
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/DataTypeException.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2016 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yangutils.datamodel.utils.builtindatatype;
+
+/**
+ * Base class for exceptions in data type.
+ */
+public class DataTypeException extends RuntimeException {
+
+    private static final long serialVersionUID = 20160211L;
+
+    /**
+     * Create a new data type exception.
+     */
+    public DataTypeException() {
+        super();
+    }
+
+    /**
+     * Creates a new data type exception with given message.
+     *
+     * @param message the detail of exception in string
+     */
+    public DataTypeException(String message) {
+        super(message);
+    }
+
+    /**
+     * Creates a new data type exception from given message and cause.
+     *
+     * @param message the detail of exception in string
+     * @param cause   underlying cause of the error
+     */
+    public DataTypeException(final String message, final Throwable cause) {
+        super(message, cause);
+    }
+
+    /**
+     * Creates a new data type exception from cause.
+     *
+     * @param cause underlying cause of the error
+     */
+    public DataTypeException(final Throwable cause) {
+        super(cause);
+    }
+
+}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/YangBinary.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/YangBinary.java
new file mode 100644
index 0000000..663ddc5
--- /dev/null
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/YangBinary.java
@@ -0,0 +1,107 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yangutils.datamodel.utils.builtindatatype;
+
+import java.io.Serializable;
+import java.util.Objects;
+
+import com.google.common.base.MoreObjects;
+
+/**
+ * Represents binary data type.
+ */
+public final class YangBinary implements Serializable {
+
+    private static final long serialVersionUID = 8006201670L;
+
+    private byte[] byteArray;
+
+    /**
+     * Creates an instance of YANG binary.
+     */
+    private YangBinary() {
+    }
+
+    /**
+     * Creates an instance of YANG binary.
+     *
+     * @param bytes byte array
+     */
+    public YangBinary(byte[] bytes) {
+        byteArray = bytes;
+    }
+
+    /**
+     * Returns object of YANG binary.
+     *
+     * @param bytes byte array
+     * @return object of YANG binary
+     */
+    public static YangBinary of(byte[] bytes) {
+        return new YangBinary(bytes);
+    }
+
+    /**
+     * Returns byte array.
+     *
+     * @return byte array
+     */
+    public byte[] byteArray() {
+        return byteArray;
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(byteArray);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj instanceof YangBinary) {
+            YangBinary other = (YangBinary) obj;
+            return Objects.equals(byteArray, other.byteArray);
+        }
+        return false;
+    }
+
+    @Override
+    public String toString() {
+        return MoreObjects.toStringHelper(getClass())
+                .omitNullValues()
+                .add("byteArray", byteArray)
+                .toString();
+    }
+
+    /**
+     * Returns the object of YANG binary fromString input String.
+     *
+     * @param valInString input String
+     * @return Object of YANG binary
+     */
+    public static YangBinary fromString(String valInString) {
+        try {
+            byte[] tmpVal = valInString.getBytes();
+            return of(tmpVal);
+        } catch (Exception e) {
+        }
+        return null;
+    }
+
+}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/YangBits.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/YangBits.java
new file mode 100644
index 0000000..1e1d325
--- /dev/null
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/YangBits.java
@@ -0,0 +1,107 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yangutils.datamodel.utils.builtindatatype;
+
+import java.io.Serializable;
+import java.util.Objects;
+
+import com.google.common.base.MoreObjects;
+
+/**
+ * Represents bits data type.
+ */
+public class YangBits implements Serializable {
+
+    private static final long serialVersionUID = 8006201669L;
+
+    private byte[] byteArray;
+
+    /**
+     * Creates an instance of YANG bits.
+     */
+    private YangBits() {
+    }
+
+    /**
+     * Creates an instance of YANG bits.
+     *
+     * @param bytes byte array
+     */
+    public YangBits(byte[] bytes) {
+        byteArray = bytes;
+    }
+
+    /**
+     * Returns object of YANG bits.
+     *
+     * @param bytes byte array
+     * @return object of YANG bits
+     */
+    public static YangBits of(byte[] bytes) {
+        return new YangBits(bytes);
+    }
+
+    /**
+     * Returns byte array.
+     *
+     * @return byte array
+     */
+    public byte[] byteArray() {
+        return byteArray;
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(byteArray);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj instanceof YangBits) {
+            YangBits other = (YangBits) obj;
+            return Objects.equals(byteArray, other.byteArray);
+        }
+        return false;
+    }
+
+    @Override
+    public String toString() {
+        return MoreObjects.toStringHelper(getClass())
+                .omitNullValues()
+                .add("byteArray", byteArray)
+                .toString();
+    }
+
+    /**
+     * Returns the object of YANG bits fromString input String.
+     *
+     * @param valInString input String
+     * @return Object of YANG bits
+     */
+    public static YangBits fromString(String valInString) {
+        try {
+            byte[] tmpVal = valInString.getBytes();
+            return of(tmpVal);
+        } catch (Exception e) {
+        }
+        return null;
+    }
+
+}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/YangBuiltInDataTypeInfo.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/YangBuiltInDataTypeInfo.java
new file mode 100644
index 0000000..b082c16
--- /dev/null
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/YangBuiltInDataTypeInfo.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2016 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.yangutils.datamodel.utils.builtindatatype;
+
+import org.onosproject.yangutils.datamodel.YangDataTypes;
+
+/**
+ * Represents the list of utility functions to be supported by YANG built in
+ * data type implementations.
+ *
+ * @param <T> The target data type
+ */
+public interface YangBuiltInDataTypeInfo<T> extends Comparable<T> {
+
+    /**
+     * Returns the YANG built in type.
+     *
+     * @return the YANG built in type
+     */
+    YangDataTypes getYangType();
+}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/YangDecimal64.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/YangDecimal64.java
new file mode 100644
index 0000000..74c657b
--- /dev/null
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/YangDecimal64.java
@@ -0,0 +1,115 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yangutils.datamodel.utils.builtindatatype;
+
+import java.io.Serializable;
+import java.util.Objects;
+
+import com.google.common.base.MoreObjects;
+
+/**
+ * Represents YANG decimal 64.
+ */
+public class YangDecimal64 implements Serializable {
+
+    private static final long serialVersionUID = 8006201668L;
+
+    private int fractionDigit;
+
+    /**
+     * Creates an instance of YANG decimal64.
+     */
+    public YangDecimal64() {
+    }
+
+    /**
+     * Creates an instance of of YANG decimal64.
+     *
+     * @param fractionDigit fraction digit
+     */
+    public YangDecimal64(int fractionDigit) {
+        setFractionDigit(fractionDigit);
+    }
+
+    /**
+     * Returns fraction digit.
+     *
+     * @return the fractionDigit
+     */
+    public int getFractionDigit() {
+        return fractionDigit;
+    }
+
+    /**
+     * Sets fraction digit.
+     *
+     * @param fractionDigit fraction digits.
+     */
+    public void setFractionDigit(int fractionDigit) {
+        this.fractionDigit = fractionDigit;
+    }
+
+    /**
+     * Returns object of YANG decimal64.
+     *
+     * @param value fraction digit
+     * @return YANG decimal64
+     */
+    public static YangDecimal64 of(int value) {
+        return new YangDecimal64(value);
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(fractionDigit);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj instanceof YangDecimal64) {
+            YangDecimal64 other = (YangDecimal64) obj;
+            return Objects.equals(fractionDigit, other.fractionDigit);
+        }
+        return false;
+    }
+
+    @Override
+    public String toString() {
+        return MoreObjects.toStringHelper(getClass())
+                .omitNullValues()
+                .add("fractionDigit", fractionDigit)
+                .toString();
+    }
+
+    /**
+     * Returns the object of YANG decimal64 fromString input String.
+     *
+     * @param valInString input String
+     * @return Object of YANG decimal64
+     */
+    public static YangDecimal64 fromString(String valInString) {
+        try {
+            int tmpVal = Integer.parseInt(valInString);
+            return of(tmpVal);
+        } catch (Exception e) {
+        }
+        return null;
+    }
+}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/YangInt16.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/YangInt16.java
new file mode 100644
index 0000000..c005b8d
--- /dev/null
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/YangInt16.java
@@ -0,0 +1,98 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yangutils.datamodel.utils.builtindatatype;
+
+import java.io.Serializable;
+
+import org.onosproject.yangutils.datamodel.YangDataTypes;
+
+/**
+ * Handles the YANG's int16 data type processing.
+ *
+ * int16 represents integer values between -32768 and 32767, inclusively.
+ */
+public class YangInt16 implements YangBuiltInDataTypeInfo<YangInt16>, Serializable {
+
+    private static final long serialVersionUID = 8006201667L;
+
+    /**
+     * YANG's min keyword.
+     */
+    private static final String MIN_KEYWORD = "min";
+
+    /**
+     * YANG's max keyword.
+     */
+    private static final String MAX_KEYWORD = "max";
+
+    /**
+     * Valid minimum value of YANG's int16.
+     */
+    public static final short MIN_VALUE = -32768;
+
+    /**
+     * Valid maximum value of YANG's int16.
+     */
+    public static final short MAX_VALUE = 32767;
+
+    /**
+     * The value of YANG's int16.
+     */
+    private final short value;
+
+    /**
+     * Creates an object with the value initialized with value represented in
+     * string.
+     *
+     * @param valueInString value of the object in string
+     */
+    public YangInt16(String valueInString) {
+
+        if (valueInString.matches(MIN_KEYWORD)) {
+            value = MIN_VALUE;
+        } else if (valueInString.matches(MAX_KEYWORD)) {
+            value = MAX_VALUE;
+        } else {
+            try {
+                value = Short.parseShort(valueInString);
+            } catch (Exception e) {
+                throw new DataTypeException("YANG file error : Input value \"" + valueInString + "\" is not a valid " +
+                        "int16.");
+            }
+        }
+    }
+
+    /**
+     * Returns YANG's int16 value.
+     *
+     * @return value of YANG's int16
+     */
+    public short getValue() {
+        return value;
+    }
+
+    @Override
+    public int compareTo(YangInt16 anotherYangInt16) {
+        return Short.compare(value, anotherYangInt16.value);
+    }
+
+    @Override
+    public YangDataTypes getYangType() {
+        return YangDataTypes.INT16;
+    }
+
+}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/YangInt32.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/YangInt32.java
new file mode 100644
index 0000000..45ae3d1
--- /dev/null
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/YangInt32.java
@@ -0,0 +1,98 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yangutils.datamodel.utils.builtindatatype;
+
+import java.io.Serializable;
+
+import org.onosproject.yangutils.datamodel.YangDataTypes;
+
+/**
+ * Handles the YANG's int32 data type processing.
+ *
+ * int32 represents integer values between -2147483648 and 2147483647, inclusively.
+ */
+public class YangInt32 implements YangBuiltInDataTypeInfo<YangInt32>, Serializable {
+
+    private static final long serialVersionUID = 8006201666L;
+
+    /**
+     * YANG's min keyword.
+     */
+    private static final String MIN_KEYWORD = "min";
+
+    /**
+     * YANG's max keyword.
+     */
+    private static final String MAX_KEYWORD = "max";
+
+    /**
+     * Valid minimum value of YANG's int32.
+     */
+    public static final int MIN_VALUE = -2147483648;
+
+    /**
+     * Valid maximum value of YANG's int32.
+     */
+    public static final int MAX_VALUE = 2147483647;
+
+    /**
+     * The value of YANG's int32.
+     */
+    private final int value;
+
+    /**
+     * Creates an object with the value initialized with value represented in
+     * string.
+     *
+     * @param valueInString value of the object in string
+     */
+    public YangInt32(String valueInString) {
+
+        if (valueInString.matches(MIN_KEYWORD)) {
+            value = MIN_VALUE;
+        } else if (valueInString.matches(MAX_KEYWORD)) {
+            value = MAX_VALUE;
+        } else {
+            try {
+                value = Integer.parseInt(valueInString);
+            } catch (Exception e) {
+                throw new DataTypeException("YANG file error : Input value \"" + valueInString + "\" is not a valid " +
+                        "int32.");
+            }
+        }
+    }
+
+    /**
+     * Returns YANG's int32 value.
+     *
+     * @return value of YANG's int32
+     */
+    public int getValue() {
+        return value;
+    }
+
+    @Override
+    public int compareTo(YangInt32 anotherYangInt32) {
+        return Integer.compare(value, anotherYangInt32.value);
+    }
+
+    @Override
+    public YangDataTypes getYangType() {
+        return YangDataTypes.INT32;
+    }
+
+}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/YangInt64.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/YangInt64.java
new file mode 100644
index 0000000..9f97bf8
--- /dev/null
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/YangInt64.java
@@ -0,0 +1,98 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yangutils.datamodel.utils.builtindatatype;
+
+import java.io.Serializable;
+
+import org.onosproject.yangutils.datamodel.YangDataTypes;
+
+/**
+ * Handles the YANG's int8 data type processing.
+ *
+ * int8 represents integer values between -9223372036854775808 and 9223372036854775807, inclusively.
+ */
+public class YangInt64 implements YangBuiltInDataTypeInfo<YangInt64>, Serializable {
+
+    private static final long serialVersionUID = 8006201665L;
+
+    /**
+     * YANG's min keyword.
+     */
+    private static final String MIN_KEYWORD = "min";
+
+    /**
+     * YANG's max keyword.
+     */
+    private static final String MAX_KEYWORD = "max";
+
+    /**
+     * Valid minimum value of YANG's int64.
+     */
+    public static final Long MIN_VALUE = 0x8000000000000000L;
+
+    /**
+     * Valid maximum value of YANG's int64.
+     */
+    public static final long MAX_VALUE = 0x7fffffffffffffffL;
+
+    /**
+     * The value of YANG's int64.
+     */
+    private final long value;
+
+    /**
+     * Creates an object with the value initialized with value represented in
+     * string.
+     *
+     * @param valueInString value of the object in string
+     */
+    public YangInt64(String valueInString) {
+
+        if (valueInString.matches(MIN_KEYWORD)) {
+            value = MIN_VALUE;
+        } else if (valueInString.matches(MAX_KEYWORD)) {
+            value = MAX_VALUE;
+        } else {
+            try {
+                value = Long.parseLong(valueInString);
+            } catch (Exception e) {
+                throw new DataTypeException("YANG file error : Input value \"" + valueInString + "\" is not a valid " +
+                        "int64.");
+            }
+        }
+    }
+
+    /**
+     * Returns YANG's int64 value.
+     *
+     * @return value of YANG's int64
+     */
+    public long getValue() {
+        return value;
+    }
+
+    @Override
+    public int compareTo(YangInt64 anotherYangInt64) {
+        return Long.compare(value, anotherYangInt64.value);
+    }
+
+    @Override
+    public YangDataTypes getYangType() {
+        return YangDataTypes.INT64;
+    }
+
+}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/YangInt8.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/YangInt8.java
new file mode 100644
index 0000000..aad8c0b
--- /dev/null
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/YangInt8.java
@@ -0,0 +1,98 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yangutils.datamodel.utils.builtindatatype;
+
+import java.io.Serializable;
+
+import org.onosproject.yangutils.datamodel.YangDataTypes;
+
+/**
+ * Handles the YANG's int8 data type processing.
+ *
+ * int8 represents integer values between -128 and 127, inclusively.
+ */
+public class YangInt8 implements YangBuiltInDataTypeInfo<YangInt8>, Serializable {
+
+    private static final long serialVersionUID = 8006201664L;
+
+    /**
+     * YANG's min keyword.
+     */
+    private static final String MIN_KEYWORD = "min";
+
+    /**
+     * YANG's max keyword.
+     */
+    private static final String MAX_KEYWORD = "max";
+
+    /**
+     * Valid minimum value of YANG's int8.
+     */
+    public static final byte MIN_VALUE = -128;
+
+    /**
+     * Valid maximum value of YANG's int8.
+     */
+    public static final byte MAX_VALUE = 127;
+
+    /**
+     * The value of YANG's int8.
+     */
+    private final byte value;
+
+    /**
+     * Creates an object with the value initialized with value represented in
+     * string.
+     *
+     * @param valueInString value of the object in string
+     */
+    public YangInt8(String valueInString) {
+
+        if (valueInString.matches(MIN_KEYWORD)) {
+            value = MIN_VALUE;
+        } else if (valueInString.matches(MAX_KEYWORD)) {
+            value = MAX_VALUE;
+        } else {
+            try {
+                value = Byte.parseByte(valueInString);
+            } catch (Exception e) {
+                throw new DataTypeException("YANG file error : Input value \"" + valueInString + "\" is not a valid " +
+                        "int8.");
+            }
+        }
+    }
+
+    /**
+     * Returns YANG's int8 value.
+     *
+     * @return value of YANG's int8
+     */
+    public byte getValue() {
+        return value;
+    }
+
+    @Override
+    public int compareTo(YangInt8 anotherYangInt8) {
+        return Byte.compare(value, anotherYangInt8.value);
+    }
+
+    @Override
+    public YangDataTypes getYangType() {
+        return YangDataTypes.INT8;
+    }
+
+}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/YangUint16.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/YangUint16.java
new file mode 100644
index 0000000..c5a1ff3
--- /dev/null
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/YangUint16.java
@@ -0,0 +1,106 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yangutils.datamodel.utils.builtindatatype;
+
+import java.io.Serializable;
+
+import org.onosproject.yangutils.datamodel.YangDataTypes;
+
+/**
+ * Handles the YANG's Uint16 data type processing.
+ *
+ * Uint16 represents integer values between 0 and 65535, inclusively.
+ */
+public class YangUint16 implements YangBuiltInDataTypeInfo<YangUint16>, Serializable {
+
+    private static final long serialVersionUID = 8006201663L;
+
+    /**
+     * YANG's min keyword.
+     */
+    private static final String MIN_KEYWORD = "min";
+
+    /**
+     * YANG's max keyword.
+     */
+    private static final String MAX_KEYWORD = "max";
+
+    /**
+     * Valid minimum value of YANG's Uint16.
+     */
+    public static final int MIN_VALUE = 0;
+
+    /**
+     * Valid maximum value of YANG's Uint16.
+     */
+    public static final int MAX_VALUE = 65535;
+
+    /**
+     * Value of the object.
+     */
+    private int value;
+
+    /**
+     * Creates an object with the value initialized with value represented in
+     * string.
+     *
+     * @param valueInString value of the object in string
+     */
+    YangUint16(String valueInString) {
+
+        if (valueInString.matches(MIN_KEYWORD)) {
+            value = MIN_VALUE;
+        } else if (valueInString.matches(MAX_KEYWORD)) {
+            value = MAX_VALUE;
+        } else {
+            try {
+                value = Integer.parseInt(valueInString);
+            } catch (Exception e) {
+                throw new DataTypeException("YANG file error : Input value \"" + valueInString + "\" is not a valid " +
+                        "uint16.");
+            }
+        }
+
+        if (value < MIN_VALUE) {
+            throw new DataTypeException("YANG file error : " + valueInString + " is lesser than minimum value "
+                    + MIN_VALUE + ".");
+        } else if (value > MAX_VALUE) {
+            throw new DataTypeException("YANG file error : " + valueInString + " is greater than maximum value "
+                    + MAX_VALUE + ".");
+        }
+    }
+
+    /**
+     * Returns YANG's uint16 value.
+     *
+     * @return value of YANG's uint16
+     */
+    public int getValue() {
+        return value;
+    }
+
+    @Override
+    public int compareTo(YangUint16 another) {
+        return Integer.compare(value, another.value);
+    }
+
+    @Override
+    public YangDataTypes getYangType() {
+        return YangDataTypes.UINT16;
+    }
+
+}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/YangUint32.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/YangUint32.java
new file mode 100644
index 0000000..031f45a
--- /dev/null
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/YangUint32.java
@@ -0,0 +1,99 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yangutils.datamodel.utils.builtindatatype;
+
+import java.io.Serializable;
+
+import org.onosproject.yangutils.datamodel.YangDataTypes;
+
+/**
+ * Handles the YANG's Uint32 data type processing.
+ *
+ * Uint32 represents integer values between 0 and 4294967295, inclusively.
+ */
+public class YangUint32 implements YangBuiltInDataTypeInfo<YangUint32>, Serializable {
+
+    private static final long serialVersionUID = 8006201662L;
+
+    private static final String MIN_KEYWORD = "min";
+    private static final String MAX_KEYWORD = "max";
+
+    /**
+     * Valid minimum value of YANG's Uint32.
+     */
+    public static final long MIN_VALUE = 0;
+
+    /**
+     * Valid maximum value of YANG's Uint32.
+     */
+    public static final long MAX_VALUE = 4294967295L;
+
+    /**
+     * Value of the object.
+     */
+    private long value;
+
+    /**
+     * Creates an object with the value initialized with value represented in
+     * string.
+     *
+     * @param valueInString value of the object in string
+     */
+    YangUint32(String valueInString) {
+
+        if (valueInString.matches(MIN_KEYWORD)) {
+            value = MIN_VALUE;
+        } else if (valueInString.matches(MAX_KEYWORD)) {
+            value = MAX_VALUE;
+        } else {
+            try {
+                value = Long.parseLong(valueInString);
+            } catch (Exception e) {
+                throw new DataTypeException("YANG file error : Input value \"" + valueInString + "\" is not a valid " +
+                        "uint32.");
+            }
+        }
+
+        if (value < MIN_VALUE) {
+            throw new DataTypeException("YANG file error : " + valueInString + " is lesser than minimum value "
+                    + MIN_VALUE + ".");
+        } else if (value > MAX_VALUE) {
+            throw new DataTypeException("YANG file error : " + valueInString + " is greater than maximum value "
+                    + MAX_VALUE + ".");
+        }
+    }
+
+    /**
+     * Returns YANG's uint32 value.
+     *
+     * @return value of YANG's uint32
+     */
+    public long getValue() {
+        return value;
+    }
+
+    @Override
+    public int compareTo(YangUint32 another) {
+        return Long.compare(value, another.value);
+    }
+
+    @Override
+    public YangDataTypes getYangType() {
+        return YangDataTypes.UINT32;
+    }
+
+}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/YangUint64.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/YangUint64.java
new file mode 100644
index 0000000..3a0a71f
--- /dev/null
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/YangUint64.java
@@ -0,0 +1,111 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yangutils.datamodel.utils.builtindatatype;
+
+import java.io.Serializable;
+import java.math.BigInteger;
+import java.util.regex.Pattern;
+
+import org.onosproject.yangutils.datamodel.YangDataTypes;
+
+/**
+ * Handles the YANG's Uint16 data type processing.
+ *
+ * Uint64 represents integer values between 0 and 18446744073709551615, inclusively.
+ */
+public class YangUint64 implements YangBuiltInDataTypeInfo<YangUint64>, Serializable {
+
+    private static final long serialVersionUID = 8006201661L;
+
+    /**
+     * YANG's min keyword.
+     */
+    private static final String MIN_KEYWORD = "min";
+
+    /**
+     * YANG's max keyword.
+     */
+    private static final String MAX_KEYWORD = "max";
+
+    /**
+     * YANG's Integer value pattern.
+     */
+    private static final Pattern NON_NEGATIVE_INTEGER_PATTERN = Pattern.compile("[0-9]+");
+
+    /**
+     * Valid minimum value of YANG's Uint64.
+     */
+    public static final BigInteger MIN_VALUE = BigInteger.valueOf(0);
+
+    /**
+     * Valid maximum value of YANG's Uint64.
+     */
+    public static final BigInteger MAX_VALUE = new BigInteger("18446744073709551615");
+
+    /**
+     * Value of the object.
+     */
+    private BigInteger value;
+
+    /**
+     * Creates an object with the value initialized with value represented in
+     * string.
+     *
+     * @param valueInString value of the object in string
+     */
+    YangUint64(String valueInString) {
+
+        if (valueInString.matches(MIN_KEYWORD)) {
+            value = MIN_VALUE;
+        } else if (valueInString.matches(MAX_KEYWORD)) {
+            value = MAX_VALUE;
+        } else if (NON_NEGATIVE_INTEGER_PATTERN.matcher(valueInString).matches()) {
+            value = new BigInteger(valueInString);
+        } else {
+            throw new DataTypeException("YANG file error : Input value \"" + valueInString + "\" is not a valid " +
+                    "uint64.");
+        }
+
+        if (value.compareTo(MIN_VALUE) < 0) {
+            throw new DataTypeException("YANG file error : " + valueInString + " is lesser than minimum value "
+                    + MIN_VALUE + ".");
+        } else if (value.compareTo(MAX_VALUE) > 0) {
+            throw new DataTypeException("YANG file error : " + valueInString + " is greater than maximum value "
+                    + MAX_VALUE + ".");
+        }
+    }
+
+    /**
+     * Returns YANG's uint64 value.
+     *
+     * @return value of YANG's uint64
+     */
+    public BigInteger getValue() {
+        return value;
+    }
+
+    @Override
+    public int compareTo(YangUint64 another) {
+        return value.compareTo(another.value);
+    }
+
+    @Override
+    public YangDataTypes getYangType() {
+        return YangDataTypes.UINT64;
+    }
+
+}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/YangUint8.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/YangUint8.java
new file mode 100644
index 0000000..8de263a
--- /dev/null
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/YangUint8.java
@@ -0,0 +1,106 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yangutils.datamodel.utils.builtindatatype;
+
+import java.io.Serializable;
+
+import org.onosproject.yangutils.datamodel.YangDataTypes;
+
+/**
+ * Handles the YANG's Uint8 data type processing.
+ *
+ * Uint8 represents integer values between 0 and 255, inclusively.
+ */
+public class YangUint8 implements YangBuiltInDataTypeInfo<YangUint8>, Serializable {
+
+    private static final long serialVersionUID = 8006201660L;
+
+    /**
+     * YANG's min keyword.
+     */
+    private static final String MIN_KEYWORD = "min";
+
+    /**
+     * YANG's max keyword.
+     */
+    private static final String MAX_KEYWORD = "max";
+
+    /**
+     * Valid minimum value of YANG's Uint8.
+     */
+    public static final short MIN_VALUE = 0;
+
+    /**
+     * Valid maximum value of YANG's Uint8.
+     */
+    public static final short MAX_VALUE = 255;
+
+    /**
+     * Value of the object.
+     */
+    private short value;
+
+    /**
+     * Creates an object with the value initialized with value represented in
+     * string.
+     *
+     * @param valueInString value of the object in string
+     */
+    YangUint8(String valueInString) {
+
+        if (valueInString.matches(MIN_KEYWORD)) {
+            value = MIN_VALUE;
+        } else if (valueInString.matches(MAX_KEYWORD)) {
+            value = MAX_VALUE;
+        } else {
+            try {
+                value = Short.parseShort(valueInString);
+            } catch (Exception e) {
+                throw new DataTypeException("YANG file error : Input value \"" + valueInString + "\" is not a valid " +
+                        "uint8.");
+            }
+        }
+
+        if (value < MIN_VALUE) {
+            throw new DataTypeException("YANG file error : " + valueInString + " is lesser than minimum value "
+                    + MIN_VALUE + ".");
+        } else if (value > MAX_VALUE) {
+            throw new DataTypeException("YANG file error : " + valueInString + " is greater than maximum value "
+                    + MAX_VALUE + ".");
+        }
+    }
+
+    /**
+     * Returns YANG's uint8 value.
+     *
+     * @return value of YANG's uint8
+     */
+    public short getValue() {
+        return value;
+    }
+
+    @Override
+    public int compareTo(YangUint8 another) {
+        return Short.compare(value, another.value);
+    }
+
+    @Override
+    public YangDataTypes getYangType() {
+        return YangDataTypes.UINT8;
+    }
+
+}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/package-info.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/package-info.java
new file mode 100644
index 0000000..d1ceae5
--- /dev/null
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/package-info.java
@@ -0,0 +1,20 @@
+/*-
+ * Copyright 2016 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.
+ */
+
+/**
+ * Utilities for YANG built in data types.
+ */
+package org.onosproject.yangutils.datamodel.utils.builtindatatype;
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/package-info.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/package-info.java
new file mode 100644
index 0000000..5d2a683
--- /dev/null
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * 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.
+ */
+
+/**
+ * Utilities for checking data model tree collisions.
+ */
+package org.onosproject.yangutils.datamodel.utils;
\ No newline at end of file
