[ONOS-5785] Refactor code into new folder structure

Change-Id: I115d5af1cd7bfbde71a3092973fe160ec1d9bae5
diff --git a/compiler/api/pom.xml b/compiler/api/pom.xml
new file mode 100644
index 0000000..fd80dc2
--- /dev/null
+++ b/compiler/api/pom.xml
@@ -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.
+  -->
+<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-yang-compiler</artifactId>
+        <version>1.12-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>onos-yang-compiler-api</artifactId>
+    <packaging>pom</packaging>
+    <!--
+        Change packaging to jar
+    -->
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-jar-plugin</artifactId>
+                <version>3.0.2</version>
+                <configuration>
+                    <skipIfEmpty>true</skipIfEmpty>
+                </configuration>
+                <executions>
+                    <execution>
+                        <id>default</id>
+                        <goals>
+                            <goal>test-jar</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+</project>
diff --git a/compiler/api/src/main/java/org/onosproject/yang/compiler/api/package-info.java b/compiler/api/src/main/java/org/onosproject/yang/compiler/api/package-info.java
new file mode 100644
index 0000000..7b88263
--- /dev/null
+++ b/compiler/api/src/main/java/org/onosproject/yang/compiler/api/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.
+ */
+
+/**
+ * Created by root1 on 10/1/17.
+ */
+package org.onosproject.yang.compiler.api;
\ No newline at end of file
diff --git a/compiler/base/datamodel/pom.xml b/compiler/base/datamodel/pom.xml
new file mode 100644
index 0000000..28618a0
--- /dev/null
+++ b/compiler/base/datamodel/pom.xml
@@ -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.
+  -->
+<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-yang-compiler-base</artifactId>
+        <version>1.12-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>onos-yang-compiler-datamodel</artifactId>
+    <packaging>jar</packaging>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-jar-plugin</artifactId>
+                <version>3.0.2</version>
+                <configuration>
+                    <skipIfEmpty>true</skipIfEmpty>
+                </configuration>
+                <executions>
+                    <execution>
+                        <id>default</id>
+                        <goals>
+                            <goal>test-jar</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+</project>
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/BuiltInTypeObjectFactory.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/BuiltInTypeObjectFactory.java
new file mode 100644
index 0000000..f2bfb8c
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/BuiltInTypeObjectFactory.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.yang.compiler.datamodel;
+
+import org.onosproject.yang.compiler.datamodel.utils.builtindatatype.DataTypeException;
+import org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangBuiltInDataTypeInfo;
+import org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes;
+import org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangInt16;
+import org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangInt32;
+import org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangInt64;
+import org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangInt8;
+import org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangUint16;
+import org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangUint32;
+import org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangUint64;
+import org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangUint8;
+
+import java.io.Serializable;
+
+/**
+ * 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);
+            }
+            case DECIMAL64: {
+                return (T) new YangDecimal64(valueInStr);
+            }
+            default: {
+                throw new DataTypeException("YANG file error : Unsupported data type");
+            }
+        }
+    }
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/CollisionDetector.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/CollisionDetector.java
new file mode 100644
index 0000000..728a513
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/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.yang.compiler.datamodel;
+
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.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/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/DefaultLocationInfo.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/DefaultLocationInfo.java
new file mode 100644
index 0000000..985542b
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/DefaultLocationInfo.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.datamodel;
+
+/**
+ * Represents the implementation of location info.
+ */
+public class DefaultLocationInfo implements LocationInfo {
+
+    private transient int lineNumber;
+    private transient int charPosition;
+    private String fileName;
+
+    @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;
+    }
+
+    @Override
+    public String getFileName() {
+        return fileName;
+    }
+
+    @Override
+    public void setFileName(String name) {
+        fileName = name;
+    }
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/InvalidOpTypeHolder.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/InvalidOpTypeHolder.java
new file mode 100644
index 0000000..f8659cd
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/InvalidOpTypeHolder.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.yang.compiler.datamodel;
+
+/**
+ * Represents non data nodes which will not have operation api's ex: operation
+ * type, value leaf flag, select leaf flag and process sub tree filter in
+ * their generated code.
+ */
+public interface InvalidOpTypeHolder {
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/LeafRefInvalidHolder.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/LeafRefInvalidHolder.java
new file mode 100644
index 0000000..d9f23f0
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/LeafRefInvalidHolder.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.yang.compiler.datamodel;
+
+/**
+ * Represents YANG nodes which linking of leaf ref should be avoided.
+ */
+public interface LeafRefInvalidHolder {
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/LocationInfo.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/LocationInfo.java
new file mode 100644
index 0000000..0e1f4c1
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/LocationInfo.java
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.datamodel;
+
+/**
+ * Abstraction of 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);
+
+    /**
+     * Returns YANG file name.
+     *
+     * @return YANG file name
+     */
+    String getFileName();
+
+    /**
+     * Sets YANG file name
+     *
+     * @param name YANG file name
+     */
+    void setFileName(String name);
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/Resolvable.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/Resolvable.java
new file mode 100644
index 0000000..ec25c55
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/Resolvable.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.datamodel;
+
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.datamodel.utils.ResolvableStatus;
+
+/**
+ * Abstraction of YANG resolvable information. Abstracted to obtain the
+ * information required for linking resolution.
+ *
+ * @param <T>  YANG resolvable info
+ */
+public interface Resolvable<T> {
+
+    /**
+     * 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.
+     *
+     * @return list of entities to be added for resolution
+     * @throws DataModelException data model exception
+     */
+    T resolve()
+            throws DataModelException;
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/ResolvableType.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/ResolvableType.java
new file mode 100644
index 0000000..367c811
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/ResolvableType.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.datamodel;
+
+/**
+ * Type of the resolvable info.
+ */
+public enum ResolvableType {
+
+    /**
+     * Identifies the derived data type.
+     */
+    YANG_DERIVED_DATA_TYPE,
+
+    /**
+     * Identifies the uses.
+     */
+    YANG_USES,
+
+    /**
+     * Identifies the if-feature.
+     */
+    YANG_IF_FEATURE,
+
+    /**
+     * Identifies the leafref.
+     */
+    YANG_LEAFREF,
+
+    /**
+     * Identifies the base.
+     */
+    YANG_BASE,
+
+    /**
+     * Identifies the identityref.
+     */
+    YANG_IDENTITYREF,
+
+    /**
+     * Identifies the augment.
+     */
+    YANG_AUGMENT,
+
+    /**
+     * Identifies the compiler annotations.
+     */
+    YANG_COMPILER_ANNOTATION
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/RpcNotificationContainer.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/RpcNotificationContainer.java
new file mode 100644
index 0000000..4f709b3
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/RpcNotificationContainer.java
@@ -0,0 +1,68 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.datamodel;
+
+import java.util.List;
+
+/**
+ * Represents class having rpc and notification.
+ */
+public interface RpcNotificationContainer {
+
+    /**
+     * Sets notification presence flag.
+     *
+     * @param notificationPresent notification presence flag
+     */
+    void setNotificationPresenceFlag(boolean notificationPresent);
+
+    /**
+     * Adds to notification enumeration map.
+     *
+     * @param enumName   name of notification in enum
+     * @param schemaNode schema node of notification
+     */
+    void addToNotificationEnumMap(String enumName, YangSchemaNode schemaNode);
+
+    /**
+     * Adds augment which is augmenting input node to augment list.
+     *
+     * @param augment augment which is augmenting input
+     */
+    void addToAugmentList(YangAugment augment);
+
+    /**
+     * Returns augment list.
+     *
+     * @return augment list
+     */
+    List<YangAugment> getAugmentList();
+
+    /**
+     * Returns prefix.
+     *
+     * @return prefix
+     */
+    String getPrefix();
+
+    /**
+     * Returns list of notification nodes.
+     *
+     * @return list of notification nodes
+     */
+    List<YangNode> getNotificationNodes();
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/TraversalType.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/TraversalType.java
new file mode 100644
index 0000000..4b7162d
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/TraversalType.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.datamodel;
+
+/**
+ * Represents data model tree traversal types.
+ */
+public enum TraversalType {
+
+    /**
+     * Start of traversal at the tree root.
+     */
+    ROOT,
+
+    /**
+     * Child node traversal.
+     */
+    CHILD,
+
+    /**
+     * Sibling node traversal.
+     */
+    SIBILING,
+
+    /**
+     * Parent node traversal.
+     */
+    PARENT
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangAppDataStructure.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangAppDataStructure.java
new file mode 100644
index 0000000..d750d9e
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangAppDataStructure.java
@@ -0,0 +1,124 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.datamodel;
+
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.datamodel.utils.YangConstructType;
+
+import java.io.Serializable;
+import java.util.LinkedList;
+import java.util.List;
+
+import static java.util.Collections.unmodifiableList;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.APP_DATA_STRUCTURE;
+
+/**
+ * Represents data model node to maintain information defined in YANG app-data-structure.
+ */
+public class YangAppDataStructure extends DefaultLocationInfo
+        implements Parsable, Serializable {
+
+    private static final long serialVersionUID = 806201602L;
+
+    /**
+     * Data structure information.
+     */
+    private YangDataStructure dataStructure;
+
+    /**
+     * List of key names.
+     */
+    private List<String> keyList;
+
+    /**
+     * Prefix of app-data-structure.
+     */
+    private String prefix;
+
+    /**
+     * Returns the YANG data structure information.
+     *
+     * @return the YANG data structure information
+     */
+    public YangDataStructure getDataStructure() {
+        return dataStructure;
+    }
+
+    /**
+     * Sets the YANG data structure information.
+     *
+     * @param dataStructure the YANG data structure to set
+     */
+    public void setDataStructure(YangDataStructure dataStructure) {
+        this.dataStructure = dataStructure;
+    }
+
+    /**
+     * Returns the list of key field names.
+     *
+     * @return the list of key field names
+     */
+    public List<String> getKeyList() {
+        return unmodifiableList(keyList);
+    }
+
+    /**
+     * Adds a key field name.
+     *
+     * @param key key field name
+     */
+    public void addKey(String key) {
+        if (keyList == null) {
+            keyList = new LinkedList<>();
+        }
+        keyList.add(key);
+    }
+
+    /**
+     * Returns the prefix.
+     *
+     * @return the prefix
+     */
+    public String getPrefix() {
+        return prefix;
+    }
+
+    /**
+     * Sets the prefix information.
+     *
+     * @param prefix the prefix to set
+     */
+    public void setPrefix(String prefix) {
+        this.prefix = prefix;
+    }
+
+    @Override
+    public YangConstructType getYangConstructType() {
+        return APP_DATA_STRUCTURE;
+    }
+
+    @Override
+    public void validateDataOnEntry() throws DataModelException {
+        // TODO : to be implemented
+    }
+
+    @Override
+    public void validateDataOnExit() throws DataModelException {
+        // TODO : to be implemented
+    }
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangAppErrorHolder.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangAppErrorHolder.java
new file mode 100644
index 0000000..113a143
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangAppErrorHolder.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.datamodel;
+
+/**
+ * Represents data model node to maintain YANG app error message information.
+ */
+public interface YangAppErrorHolder {
+
+    /**
+     * Sets the application's error information.
+     *
+     * @param yangAppErrorInfo the application's error information
+     */
+    void setAppErrorInfo(YangAppErrorInfo yangAppErrorInfo);
+
+    /**
+     * Returns application's error information.
+     *
+     * @return application's error information
+     */
+    YangAppErrorInfo getAppErrorInfo();
+
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangAppErrorInfo.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangAppErrorInfo.java
new file mode 100644
index 0000000..f82c7e6
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangAppErrorInfo.java
@@ -0,0 +1,149 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.datamodel;
+
+import java.io.Serializable;
+
+/**
+ * Represents data model to maintain yang app error information.
+ */
+public class YangAppErrorInfo extends DefaultLocationInfo implements Serializable {
+
+    private static final long serialVersionUID = 807201693L;
+
+    /**
+     * Application's error message, to be used for data error.
+     */
+    private String errorMessage;
+
+    /**
+     * Error tag, to be filled in data validation error response.
+     */
+    private String errorTag;
+
+    /**
+     * Application's error tag, to be filled in data validation error response.
+     */
+    private String errorAppTag;
+
+    /**
+     * Application's error path, to be filled in data validation error response.
+     */
+    private String errorAppPath;
+
+    /**
+     * Application's error info, to be filled in data validation error response.
+     */
+    private String errorAppInfo;
+
+    /**
+     * Creates a YANG app error info object.
+     */
+    @SuppressWarnings("unused")
+    public YangAppErrorInfo() {
+    }
+
+    /**
+     * Returns application's error message, to be used for data error.
+     *
+     * @return Application's error message, to be used for data error
+     */
+    public String getGetErrorMessage() {
+        return errorMessage;
+    }
+
+    /**
+     * Sets Application's error message, to be used for data error.
+     *
+     * @param errMsg Application's error message, to be used for data error
+     */
+    public void setErrorMessage(String errMsg) {
+        errorMessage = errMsg;
+    }
+
+    /**
+     * Returns error tag, to be used for data error.
+     *
+     * @return error tag, to be used for data error
+     */
+    public String getGetErrorTag() {
+        return errorTag;
+    }
+
+    /**
+     * Sets error tag, to be used for data error.
+     *
+     * @param errTag error tag, to be used for data error
+     */
+    public void setErrorTag(String errTag) {
+        errorTag = errTag;
+    }
+
+    /**
+     * Returns application's error tag, to be used for data error.
+     *
+     * @return application's error tag, to be used for data error
+     */
+    public String getGetErrorAppTag() {
+        return errorAppTag;
+    }
+
+    /**
+     * Sets application's error tag, to be used for data error.
+     *
+     * @param errTag application's error tag, to be used for data error
+     */
+    public void setErrorAppTag(String errTag) {
+        errorAppTag = errTag;
+    }
+
+    /**
+     * Returns application's error path, to be used for data error.
+     *
+     * @return application's error path, to be used for data error
+     */
+    public String getGetErrorAppPath() {
+        return errorAppPath;
+    }
+
+    /**
+     * Sets application's error path, to be used for data error.
+     *
+     * @param errPath application's error path, to be used for data error
+     */
+    public void setErrorAppPath(String errPath) {
+        errorAppPath = errPath;
+    }
+
+    /**
+     * Returns application's error info, to be used for data error.
+     *
+     * @return application's error info, to be used for data error
+     */
+    public String getGetErrorAppInfo() {
+        return errorAppInfo;
+    }
+
+    /**
+     * Sets application's error info, to be used for data error.
+     *
+     * @param errInfo application's error info, to be used for data error
+     */
+    public void setErrorAppInfo(String errInfo) {
+        errorAppInfo = errInfo;
+    }
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangAppExtended.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangAppExtended.java
new file mode 100644
index 0000000..b96b4cb
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangAppExtended.java
@@ -0,0 +1,92 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.datamodel;
+
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.datamodel.utils.YangConstructType;
+
+import java.io.Serializable;
+
+/**
+ * Represents data model node to maintain information defined in YANG extended name.
+ */
+public class YangAppExtended extends DefaultLocationInfo
+        implements Parsable, Serializable {
+
+    private static final long serialVersionUID = 806201602L;
+    /**
+     * App extended name information.
+     */
+    private String yangAppExtendedName;
+
+    /**
+     * Prefix of extended name.
+     */
+    private String prefix;
+
+    /**
+     * Returns the YANG app extended name information.
+     *
+     * @return the YANG app extended name information
+     */
+    public String getYangAppExtendedName() {
+        return yangAppExtendedName;
+    }
+
+    /**
+     * Sets the YANG app extended name information.
+     *
+     * @param yangAppExtendedName the YANG app extended name to set
+     */
+    public void setYangAppExtendedName(String yangAppExtendedName) {
+        this.yangAppExtendedName = yangAppExtendedName;
+    }
+
+    /**
+     * Returns the prefix.
+     *
+     * @return the prefix
+     */
+    public String getPrefix() {
+        return prefix;
+    }
+
+    /**
+     * Sets the prefix information.
+     *
+     * @param prefix the prefix to set
+     */
+    public void setPrefix(String prefix) {
+        this.prefix = prefix;
+    }
+
+    @Override
+    public YangConstructType getYangConstructType() {
+        return YangConstructType.APP_EXTENDED_NAME_DATA;
+    }
+
+    @Override
+    public void validateDataOnEntry() throws DataModelException {
+        // TODO : to be implemented
+    }
+
+    @Override
+    public void validateDataOnExit() throws DataModelException {
+        // TODO : to be implemented
+    }
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangAtomicPath.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangAtomicPath.java
new file mode 100644
index 0000000..411aca3
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangAtomicPath.java
@@ -0,0 +1,102 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.yang.compiler.datamodel;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * Representation of data model node to maintain absolute path defined in YANG path-arg.
+ */
+public class YangAtomicPath extends DefaultLocationInfo implements Serializable {
+
+    private static final long serialVersionUID = 806201688L;
+
+    // YANG node identifier.
+    private YangNodeIdentifier nodeIdentifier;
+
+    // List of path predicates expression.
+    private List<YangPathPredicate> pathPredicatesList;
+
+    /**
+     * Resolved node for the absolute path.
+     */
+    private YangNode resolvedNode;
+
+    /**
+     * Returns the node identifier.
+     *
+     * @return the node identifier
+     */
+    public YangNodeIdentifier getNodeIdentifier() {
+        return nodeIdentifier;
+    }
+
+    /**
+     * Sets the node identifier.
+     *
+     * @param nodeIdentifier Sets the node identifier
+     */
+    public void setNodeIdentifier(YangNodeIdentifier nodeIdentifier) {
+        this.nodeIdentifier = nodeIdentifier;
+    }
+
+    /**
+     * Returns the path predicate expression.
+     *
+     * @return the path predicate expression
+     */
+    public List<YangPathPredicate> getPathPredicatesList() {
+        return pathPredicatesList;
+    }
+
+    /**
+     * Sets the path predicate expression.
+     *
+     * @param pathPredicatesList Sets the path predicate expression
+     */
+    public void setPathPredicatesList(List<YangPathPredicate> pathPredicatesList) {
+        this.pathPredicatesList = pathPredicatesList;
+    }
+
+    /**
+     * Adds predicate expression in data holder.
+     *
+     * @param predicatesExp the predicate expression to be added
+     */
+    public void addLeavesPredicate(YangPathPredicate predicatesExp) {
+        getPathPredicatesList().add(predicatesExp);
+    }
+
+
+    /**
+     * Returns resolved node.
+     *
+     * @return resolved node
+     */
+    public YangNode getResolvedNode() {
+        return resolvedNode;
+    }
+
+    /**
+     * Sets resolved node.
+     *
+     * @param resolvedNode resolved node
+     */
+    public void setResolvedNode(YangNode resolvedNode) {
+        this.resolvedNode = resolvedNode;
+    }
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangAugment.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangAugment.java
new file mode 100644
index 0000000..4ea139d
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangAugment.java
@@ -0,0 +1,535 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.yang.compiler.datamodel;
+
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.datamodel.utils.ResolvableStatus;
+import org.onosproject.yang.compiler.datamodel.utils.YangConstructType;
+
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+
+import static org.onosproject.yang.compiler.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        |-YangIfFeature    |
+ *                | 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        |-YangWhen         |
+ *                +--------------+---------+-------------+------------------+
+ */
+
+/**
+ * Representation of data model node to maintain information defined in YANG
+ * augment.
+ */
+public abstract class YangAugment
+        extends YangNode
+        implements YangLeavesHolder, YangCommonInfo, Parsable,
+                   CollisionDetector, Resolvable,
+                   YangXPathResolver, YangWhenHolder, YangIfFeatureHolder {
+
+    private static final long serialVersionUID = 806201602L;
+
+    /**
+     * 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<YangAtomicPath> targetNode;
+
+    /**
+     * Reference of the YANG augment.
+     */
+    private String reference;
+
+    /**
+     * Status of the node.
+     */
+    private YangStatusType status;
+
+    /**
+     * Resolved augmented node.
+     */
+    private YangNode augmentedNode;
+
+    /**
+     * 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;
+
+    /**
+     * When data of the node.
+     */
+    private YangWhen when;
+
+    /**
+     * List of if-feature.
+     */
+    private List<YangIfFeature> ifFeatureList;
+
+    /**
+     * Name of augment when prefix is removed if it is in the same file. For
+     * linking purpose the name with same prefix of the file is removed and
+     * maintained.
+     */
+    private String prefixRemovedName;
+
+    /**
+     * Name of augment's setter method.
+     */
+    private String setterMethodName;
+
+    /**
+     * Create a YANG augment node.
+     */
+    public YangAugment() {
+        super(YangNodeType.AUGMENT_NODE, new HashMap<>());
+        listOfLeaf = new LinkedList<>();
+        listOfLeafList = new LinkedList<>();
+        targetNode = new LinkedList<>();
+        ifFeatureList = new LinkedList<>();
+        resolvableStatus = ResolvableStatus.UNRESOLVED;
+    }
+
+    @Override
+    public void addToChildSchemaMap(
+            YangSchemaNodeIdentifier schemaNodeIdentifier,
+            YangSchemaNodeContextInfo yangSchemaNodeContextInfo)
+            throws DataModelException {
+        getYsnContextInfoMap()
+                .put(schemaNodeIdentifier, yangSchemaNodeContextInfo);
+        YangSchemaNodeContextInfo yangSchemaNodeContextInfo1 =
+                new YangSchemaNodeContextInfo();
+        yangSchemaNodeContextInfo1
+                .setSchemaNode(yangSchemaNodeContextInfo.getSchemaNode());
+        yangSchemaNodeContextInfo1.setContextSwitchedNode(this);
+        getAugmentedNode().addToChildSchemaMap(schemaNodeIdentifier,
+                                               yangSchemaNodeContextInfo1);
+    }
+
+    @Override
+    public void setNameSpaceAndAddToParentSchemaMap() {
+        // Get parent namespace and set namespace for self node.
+        setNameSpace(getParent().getNameSpace());
+        /*
+         * Check if node contains leaf/leaf-list, if yes add namespace for leaf
+         * and leaf list.
+         */
+        setLeafNameSpaceAndAddToParentSchemaMap();
+    }
+
+    @Override
+    public void incrementMandatoryChildCount() {
+        // TODO
+    }
+
+    @Override
+    public void addToDefaultChildMap(
+            YangSchemaNodeIdentifier yangSchemaNodeIdentifier,
+            YangSchemaNode yangSchemaNode) {
+        // TODO
+    }
+
+    @Override
+    public YangSchemaNodeType getYangSchemaNodeType() {
+        /*
+         * Augment node to switch the name space in YMS
+         */
+        return YangSchemaNodeType.YANG_AUGMENT_NODE;
+    }
+
+    /**
+     * Returns the augmented node.
+     *
+     * @return the augmented node
+     */
+    public List<YangAtomicPath> getTargetNode() {
+        return targetNode;
+    }
+
+    /**
+     * Sets the augmented node.
+     *
+     * @param nodeIdentifiers the augmented node
+     */
+    public void setTargetNode(List<YangAtomicPath> nodeIdentifiers) {
+        targetNode = nodeIdentifiers;
+    }
+
+    /**
+     * Returns the name of augment after removing the prefix, in each atomic
+     * content, which is equal to the root prefix.
+     *
+     * @return prefix removed augment name
+     */
+    public String getPrefixRemovedName() {
+        return prefixRemovedName;
+    }
+
+    /**
+     * Sets the name of augment after removing the prefix, in each atomic
+     * content, which is equal to the root prefix.
+     *
+     * @param prefixRemovedName augment name
+     */
+    public void setPrefixRemovedName(String prefixRemovedName) {
+        this.prefixRemovedName = prefixRemovedName;
+    }
+
+    /**
+     * Returns the when.
+     *
+     * @return the when
+     */
+    @Override
+    public YangWhen getWhen() {
+        return when;
+    }
+
+    /**
+     * Sets the when.
+     *
+     * @param when the when to set
+     */
+    @Override
+    public void setWhen(YangWhen when) {
+        this.when = when;
+    }
+
+    /**
+     * 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() + " in " +
+                            getLineNumber() + " at " +
+                            getCharPosition() +
+                            " in " + getFileName() + "\"");
+        }
+    }
+
+    /**
+     * 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);
+    }
+
+    @Override
+    public void setLeafNameSpaceAndAddToParentSchemaMap() {
+        // Add namespace for all leafs.
+        for (YangLeaf yangLeaf : getListOfLeaf()) {
+            yangLeaf.setLeafNameSpaceAndAddToParentSchemaMap(getNameSpace());
+        }
+        // Add namespace for all leaf list.
+        for (YangLeafList yangLeafList : getListOfLeafList()) {
+            yangLeafList
+                    .setLeafNameSpaceAndAddToParentSchemaMap(getNameSpace());
+        }
+    }
+
+    /**
+     * 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 augmented node.
+     *
+     * @return augmented node
+     */
+    public YangNode getAugmentedNode() {
+        return augmentedNode;
+    }
+
+    /**
+     * Sets augmented node.
+     *
+     * @param augmentedNode augmented node
+     */
+    public void setAugmentedNode(YangNode augmentedNode) {
+        this.augmentedNode = augmentedNode;
+    }
+
+    @Override
+    public List<YangIfFeature> getIfFeatureList() {
+        return ifFeatureList;
+    }
+
+    @Override
+    public void setIfFeatureList(List<YangIfFeature> ifFeatureList) {
+        this.ifFeatureList = ifFeatureList;
+    }
+
+    @Override
+    public void addIfFeatureList(YangIfFeature ifFeature) {
+        if (getIfFeatureList() == null) {
+            setIfFeatureList(new LinkedList<>());
+        }
+        getIfFeatureList().add(ifFeature);
+    }
+
+    @Override
+    public ResolvableStatus getResolvableStatus() {
+        return resolvableStatus;
+    }
+
+    @Override
+    public void setResolvableStatus(ResolvableStatus resolvableStatus) {
+        this.resolvableStatus = resolvableStatus;
+
+    }
+
+    @Override
+    public Object resolve()
+            throws DataModelException {
+        // Resolving of target node is being done in XPathLinker.
+        return null;
+    }
+
+    /**
+     * Returns setter method name for augment in application.
+     *
+     * @return setter method name for augment in application
+     */
+    public String getSetterMethodName() {
+        return setterMethodName;
+    }
+
+    /**
+     * Sets setter method name for augment in application.
+     *
+     * @param name setter method name for augment in application
+     */
+    public void setSetterMethodName(String name) {
+        setterMethodName = name;
+    }
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangAugmentableNode.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangAugmentableNode.java
new file mode 100644
index 0000000..5d24723
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangAugmentableNode.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.yang.compiler.datamodel;
+
+import java.util.List;
+
+/**
+ * Represents YANG constructs which can be augmented.
+ */
+public interface YangAugmentableNode {
+
+    /**
+     * Adds augment info to the augment info list.
+     *
+     * @param augmentInfo augment info of node
+     */
+    void addAugmentation(YangAugment augmentInfo);
+
+    /**
+     * Removes augment info from the node.
+     *
+     * @param augmentInfo augment info of node
+     */
+    void removeAugmentation(YangAugment augmentInfo);
+
+    /**
+     * Returns list of augment info.
+     *
+     * @return list of augment info
+     */
+    List<YangAugment> getAugmentedInfoList();
+
+    /**
+     * Clones augment info.
+     */
+    void cloneAugmentInfo();
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangBase.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangBase.java
new file mode 100644
index 0000000..a0194bb
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangBase.java
@@ -0,0 +1,117 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.yang.compiler.datamodel;
+
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.datamodel.utils.ResolvableStatus;
+
+import java.io.Serializable;
+
+import static org.onosproject.yang.compiler.datamodel.utils.ResolvableStatus.UNRESOLVED;
+
+/**
+ * Reference RFC 6020.
+ * <p>
+ * Represents data model node to maintain information defined in YANG base.
+ * The "base" statement, which is optional, takes as an argument a
+ * string that is the name of an existing identity, from which the new
+ * identity is derived.  If no "base" statement is present, the identity
+ * is defined from scratch.
+ * <p>
+ * If a prefix is present on the base name, it refers to an identity
+ * defined in the module that was imported with that prefix, or the
+ * local module if the prefix matches the local module's prefix.
+ * Otherwise, an identity with the matching name MUST be defined in the
+ * current module or an included submodule.
+ */
+
+/**
+ * Represents data model node to maintain information defined in YANG base.
+ */
+public class YangBase extends DefaultLocationInfo implements Resolvable, Serializable {
+
+    private static final long serialVersionUID = 806201693L;
+
+    // YANG node identifier.
+    private YangNodeIdentifier baseIdentifier;
+
+    // Referred identity parent information.
+    private YangIdentity referredIdentity;
+
+    /**
+     * Status of resolution. If completely resolved enum value is "RESOLVED",
+     * if not enum value is "UNRESOLVED", in case reference of grouping/typedef/base/identityref
+     * is added to uses/type/base/identityref but it's not resolved value of enum should be
+     * "INTRA_FILE_RESOLVED".
+     */
+    private ResolvableStatus resolvableStatus;
+
+    // Creates a base type of node.
+    public YangBase() {
+        resolvableStatus = UNRESOLVED;
+    }
+
+    /**
+     * Returns the YANG node identifier.
+     *
+     * @return the YANG node identifier
+     */
+    public YangNodeIdentifier getBaseIdentifier() {
+        return baseIdentifier;
+    }
+
+    /**
+     * Sets the YANG node identifier.
+     *
+     * @param baseIdentifier the YANG node identifier to set
+     */
+    public void setBaseIdentifier(YangNodeIdentifier baseIdentifier) {
+        this.baseIdentifier = baseIdentifier;
+    }
+
+    /**
+     * Returns the parent identity node.
+     *
+     * @return the parent identity node
+     */
+    public YangIdentity getReferredIdentity() {
+        return referredIdentity;
+    }
+
+    /**
+     * Sets the parent identity node.
+     *
+     * @param referredIdentity the parent identity node to set
+     */
+    public void setReferredIdentity(YangIdentity referredIdentity) {
+        this.referredIdentity = referredIdentity;
+    }
+
+    @Override
+    public ResolvableStatus getResolvableStatus() {
+        return resolvableStatus;
+    }
+
+    @Override
+    public void setResolvableStatus(ResolvableStatus resolvableStatus) {
+        this.resolvableStatus = resolvableStatus;
+    }
+
+    @Override
+    public Object resolve() throws DataModelException {
+        return null;
+    }
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangBelongsTo.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangBelongsTo.java
new file mode 100644
index 0000000..74b6338
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangBelongsTo.java
@@ -0,0 +1,196 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.yang.compiler.datamodel;
+
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.datamodel.utils.YangConstructType;
+
+import java.io.Serializable;
+import java.util.Set;
+
+import static org.onosproject.yang.compiler.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 extends DefaultLocationInfo implements Parsable, Serializable {
+
+    private static final long serialVersionUID = 806201639L;
+
+    /**
+     * Reference RFC 6020.
+     * <p>
+     * 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.
+     * <p>
+     * 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;
+
+    /**
+     * 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
+    }
+
+    /**
+     * 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. " + " in " +
+                getLineNumber() + " at " +
+                getCharPosition() +
+                " in " + getFileName());
+        exception.setLine(getLineNumber());
+        exception.setCharPosition(getCharPosition());
+        throw exception;
+    }
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangBinary.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangBinary.java
new file mode 100644
index 0000000..22f6e82
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangBinary.java
@@ -0,0 +1,92 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.datamodel;
+
+import org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangBuiltInDataTypeInfo;
+import org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes;
+
+import java.io.Serializable;
+import java.util.Base64;
+
+/*
+ * Reference RFC 6020.
+ *
+ * The binary built-in type represents any binary data,
+ * i.e., a sequence of octets.
+ */
+public class YangBinary extends DefaultLocationInfo implements YangBuiltInDataTypeInfo<YangBinary>,
+        Serializable, Comparable<YangBinary> {
+
+    private static final long serialVersionUID = 2106201608L;
+
+    // Binary data is a decoded value by base64 decoding scheme from data input (jason)
+    private byte[] binaryData;
+
+    /**
+     * Creates a binary object corresponding to the base 64 encoding value.
+     *
+     * @param strValue base64 encoded value
+     */
+    public YangBinary(String strValue) {
+        setBinaryData(Base64.getDecoder().decode(strValue));
+    }
+
+    /**
+     * Retrieves decoded binary data.
+     *
+     * @return binary data
+     */
+    public byte[] getBinaryData() {
+        return binaryData;
+    }
+
+    /**
+     * Sets binary data.
+     *
+     * @param binaryData binary data
+     */
+    public void setBinaryData(byte[] binaryData) {
+        this.binaryData = binaryData;
+    }
+
+    /**
+     * Encodes binary data by base64 encoding scheme.
+     *
+     * @return encoded binary data
+     */
+    public String toString() {
+        return Base64.getEncoder()
+                .encodeToString(binaryData);
+    }
+
+    @Override
+    public YangDataTypes getYangType() {
+        return YangDataTypes.BINARY;
+    }
+
+    @Override
+    public int compareTo(YangBinary o) {
+        for (int i = 0, j = 0; i < this.binaryData.length && j < o.binaryData.length; i++, j++) {
+            int a = (this.binaryData[i] & 0xff);
+            int b = (o.binaryData[j] & 0xff);
+            if (a != b) {
+                return a - b;
+            }
+        }
+        return this.binaryData.length - o.binaryData.length;
+    }
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangBit.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangBit.java
new file mode 100644
index 0000000..8482905
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/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.yang.compiler.datamodel;
+
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.datamodel.utils.YangConstructType;
+
+import java.io.Serializable;
+import java.util.Objects;
+
+/*-
+ *  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 extends DefaultLocationInfo 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/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangBits.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangBits.java
new file mode 100644
index 0000000..fd97e38
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangBits.java
@@ -0,0 +1,260 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.datamodel;
+
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.datamodel.utils.YangConstructType;
+
+import java.io.Serializable;
+import java.util.BitSet;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.regex.Pattern;
+
+/*
+ * 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 extends DefaultLocationInfo implements Parsable, Serializable {
+
+    private static final long serialVersionUID = 806201641L;
+    private static final String SPACE = " ";
+
+    // Bits name
+    private String bitsName;
+    // Bits data contains bit-positions will be used to send to ONOS application
+    private BitSet bitDataSet;
+    /**
+     * Mapping bit name to YangBit. In data input (jason), only bit name will be received.
+     * By using the bit name corresponding (yang) bit-position will be retrieved from bitNameMap map.
+     */
+    private Map<String, YangBit> bitNameMap;
+    /**
+     * Mapping bit position to YangBit. The bit-position received from ONOS application
+     * will be converted into bit-name by using bitPositionMap map to send (jason) output data as response.
+     */
+    private Map<Integer, YangBit> bitPositionMap;
+
+    /**
+     * Creates a YANG bits type object.
+     */
+    public YangBits() {
+        bitDataSet = new BitSet();
+        setBitNameMap(new HashMap<>());
+        setBitPositionMap(new HashMap<>());
+    }
+
+    /**
+     * Returns the bits name.
+     *
+     * @return the bits name
+     */
+    public String getBitsName() {
+        return bitsName;
+    }
+
+    /**
+     * Sets the bits name.
+     *
+     * @param bitsName the bits name
+     */
+    public void setBitsName(String bitsName) {
+        this.bitsName = bitsName;
+    }
+
+    /**
+     * Returns the bit data set.
+     *
+     * @return the bit data set
+     */
+    public BitSet getBitDataSet() {
+        return bitDataSet;
+    }
+
+    /**
+     * Sets the bit data set.
+     *
+     * @param bitNames the set of bit names
+     * @throws DataModelException due to violation in data model rules
+     */
+    public void setBitDataSet(String[] bitNames) throws DataModelException {
+        YangBit bit;
+        for (String bitName : bitNames) {
+            bit = bitNameMap.get(bitName);
+            if (bit == null) {
+                throw new DataModelException("YANG file error: Unable to find " +
+                        "corresponding bit position for bit name: " + bitName +
+                        " in " +
+                        getLineNumber() + " at " +
+                        getCharPosition() +
+                        " in " + getFileName());
+            }
+            bitDataSet.set(bit.getPosition());
+        }
+    }
+
+    /**
+     * Returns the bit name map.
+     *
+     * @return the bit name map
+     */
+    public Map<String, YangBit> getBitNameMap() {
+        return bitNameMap;
+    }
+
+    /**
+     * Sets the bit name map.
+     *
+     * @param bitNameMap the bit name map
+     */
+    public void setBitNameMap(Map<String, YangBit> bitNameMap) {
+        this.bitNameMap = bitNameMap;
+    }
+
+    /**
+     * Checks whether bit name already available.
+     *
+     * @param bitName bit name
+     * @return true if bit name already available otherwise returns false
+     */
+    public boolean isBitNameExists(String bitName) {
+        return bitNameMap.containsKey(bitName);
+    }
+
+    /**
+     * Returns the bit position map.
+     *
+     * @return the bit position map
+     */
+    public Map<Integer, YangBit> getBitPositionMap() {
+        return bitPositionMap;
+    }
+
+    /**
+     * Sets the bit position map.
+     *
+     * @param bitPositionMap the bit position map
+     */
+    public void setBitPositionMap(Map<Integer, YangBit> bitPositionMap) {
+        this.bitPositionMap = bitPositionMap;
+    }
+
+    /**
+     * Checks whether bit position already available.
+     *
+     * @param bitPosition bit position
+     * @return true if bit position already available otherwise returns false
+     */
+    public boolean isBitPositionExists(Integer bitPosition) {
+        return bitPositionMap.containsKey(bitPosition);
+    }
+
+    /**
+     * 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 (bitNameMap.put(bitInfo.getBitName(), bitInfo) != null) {
+            throw new DataModelException("YANG file error: Duplicate bit name detected, same as bit name \""
+                    + bitInfo.getBitName() + " in " +
+                    getLineNumber() + " at " +
+                    getCharPosition() +
+                    " in " + getFileName() + "\"");
+        }
+        if (bitPositionMap.put(bitInfo.getPosition(), bitInfo) != null) {
+            throw new DataModelException("YANG file error: Duplicate bit position detected, same as bit position \""
+                    + bitInfo.getPosition() + " in " +
+                    getLineNumber() + " at " +
+                    getCharPosition() +
+                    " in " + getFileName() + "\"");
+        }
+    }
+
+    /**
+     * Returns the type of the data.
+     *
+     * @return ParsedDataType returns BITS_DATA
+     */
+    @Override
+    public YangConstructType getYangConstructType() {
+        return YangConstructType.BITS_DATA;
+    }
+
+    @Override
+    public String toString() {
+        YangBit bit;
+        String bits = new String();
+        for (int i = bitDataSet.nextSetBit(0); i >= 0; i = bitDataSet.nextSetBit(i + 1)) {
+            bit = bitPositionMap.get(i);
+            if (bit == null) {
+                return null;
+            }
+            if (bits.isEmpty()) {
+                bits = bit.getBitName();
+            } else {
+                bits += " " + bit.getBitName();
+            }
+        }
+        return bits.trim();
+    }
+
+    /**
+     * Returns the object of YANG bits based on specific set of bit names.
+     *
+     * @param bits set of bit names
+     * @return Object of YANG bits
+     */
+    public YangBits fromString(String bits) {
+        try {
+            String[] bitNames = bits.trim().split(Pattern.quote(SPACE));
+            setBitDataSet(bitNames);
+            return this;
+        } catch (Exception e) {
+        }
+        return null;
+    }
+
+    /**
+     * 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/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangCase.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangCase.java
new file mode 100644
index 0000000..8c1f491
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangCase.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.yang.compiler.datamodel;
+
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.datamodel.utils.YangConstructType;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+
+import static java.util.Collections.unmodifiableList;
+import static org.onosproject.yang.compiler.datamodel.YangNodeType.CASE_NODE;
+import static org.onosproject.yang.compiler.datamodel.YangSchemaNodeType.YANG_NON_DATA_NODE;
+import static org.onosproject.yang.compiler.datamodel.exceptions.ErrorMessages.CASE;
+import static org.onosproject.yang.compiler.datamodel.exceptions.ErrorMessages.COLLISION_DETECTION;
+import static org.onosproject.yang.compiler.datamodel.exceptions.ErrorMessages.INVALID_CASE_HOLDER;
+import static org.onosproject.yang.compiler.datamodel.exceptions.ErrorMessages.getErrorMsg;
+import static org.onosproject.yang.compiler.datamodel.exceptions.ErrorMessages.getErrorMsgCollision;
+import static org.onosproject.yang.compiler.datamodel.utils.DataModelUtils.detectCollidingChildUtil;
+import static org.onosproject.yang.compiler.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        |-YangIfFeature    |
+ *                | 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        |-YangWhen         |
+ *                +--------------+---------+-------------+------------------+
+ */
+
+/**
+ * Represents data model node to maintain information defined in YANG case.
+ */
+public abstract class YangCase
+        extends YangNode
+        implements YangLeavesHolder, YangCommonInfo, Parsable, CollisionDetector,
+        YangAugmentableNode, YangWhenHolder, YangIfFeatureHolder, YangIsFilterContentNodes {
+
+    private static final long serialVersionUID = 806201603L;
+
+    /**
+     * 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;
+
+    /**
+     * When data of the node.
+     */
+    private YangWhen when;
+
+    /**
+     * List of if-feature.
+     */
+    private List<YangIfFeature> ifFeatureList;
+
+    private List<YangAugment> yangAugmentedInfo;
+
+    /**
+     * Creates a choice node.
+     */
+    public YangCase() {
+        super(CASE_NODE, new HashMap<>());
+        listOfLeaf = new LinkedList<>();
+        listOfLeafList = new LinkedList<>();
+        ifFeatureList = new LinkedList<>();
+        yangAugmentedInfo = new ArrayList<>();
+    }
+
+    @Override
+    public void addToChildSchemaMap(YangSchemaNodeIdentifier id,
+                                    YangSchemaNodeContextInfo context)
+            throws DataModelException {
+        getYsnContextInfoMap().put(id, context);
+        YangSchemaNodeContextInfo contextInfo = new YangSchemaNodeContextInfo();
+        contextInfo.setSchemaNode(context.getSchemaNode());
+        contextInfo.setContextSwitchedNode(this);
+        getParent().addToChildSchemaMap(id, contextInfo);
+    }
+
+    @Override
+    public void setNameSpaceAndAddToParentSchemaMap() {
+        // Get parent namespace and set namespace for self node.
+        setNameSpace(getParent().getNameSpace());
+        /*
+         * Check if node contains leaf/leaf-list, if yes add namespace for leaf
+         * and leaf list.
+         */
+        setLeafNameSpaceAndAddToParentSchemaMap();
+    }
+
+    @Override
+    public void incrementMandatoryChildCount() {
+        //For non data nodes, mandatory child to be added to parent node.
+        // TODO
+    }
+
+    @Override
+    public void addToDefaultChildMap(YangSchemaNodeIdentifier id,
+                                     YangSchemaNode node) {
+        //For non data nodes, default child to be added to parent node.
+        // TODO
+    }
+
+    @Override
+    public YangSchemaNodeType getYangSchemaNodeType() {
+        return YANG_NON_DATA_NODE;
+    }
+
+    /**
+     * Returns the when.
+     *
+     * @return the when
+     */
+    @Override
+    public YangWhen getWhen() {
+        return when;
+    }
+
+    /**
+     * Sets the when.
+     *
+     * @param when the when to set
+     */
+    @Override
+    public void setWhen(YangWhen when) {
+        this.when = when;
+    }
+
+    /**
+     * 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 unmodifiableList(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) {
+        listOfLeaf.add(leaf);
+    }
+
+    /**
+     * Returns the list of leaf-list.
+     *
+     * @return the list of leaf-list
+     */
+    @Override
+    public List<YangLeafList> getListOfLeafList() {
+        return unmodifiableList(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) {
+        listOfLeafList.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 ||
+                getParent() instanceof YangAugment)) {
+            throw new DataModelException(getErrorMsg(
+                    INVALID_CASE_HOLDER, getName(), getLineNumber(),
+                    getCharPosition(), getFileName()));
+        }
+        // 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(getErrorMsgCollision(
+                        COLLISION_DETECTION, getName(), getLineNumber(),
+                        getCharPosition(), CASE, getFileName()));
+            }
+            return;
+        }
+
+        // Asks helper to detect colliding child.
+        detectCollidingChildUtil(identifierName, dataType, this);
+    }
+
+    @Override
+    public List<YangIfFeature> getIfFeatureList() {
+        return unmodifiableList(ifFeatureList);
+    }
+
+    @Override
+    public void addIfFeatureList(YangIfFeature ifFeature) {
+        ifFeatureList.add(ifFeature);
+    }
+
+    @Override
+    public void setIfFeatureList(List<YangIfFeature> ifFeatureList) {
+        this.ifFeatureList = ifFeatureList;
+    }
+
+    @Override
+    public void addAugmentation(YangAugment augmentInfo) {
+        yangAugmentedInfo.add(augmentInfo);
+    }
+
+    @Override
+    public void removeAugmentation(YangAugment augmentInfo) {
+        yangAugmentedInfo.remove(augmentInfo);
+    }
+
+    @Override
+    public List<YangAugment> getAugmentedInfoList() {
+        return unmodifiableList(yangAugmentedInfo);
+    }
+
+    @Override
+    public void setLeafNameSpaceAndAddToParentSchemaMap() {
+        // Add namespace for all leafs.
+        for (YangLeaf yangLeaf : listOfLeaf) {
+            yangLeaf.setLeafNameSpaceAndAddToParentSchemaMap(getNameSpace());
+        }
+        // Add namespace for all leaf list.
+        for (YangLeafList yangLeafList : listOfLeafList) {
+            yangLeafList.setLeafNameSpaceAndAddToParentSchemaMap(getNameSpace());
+        }
+    }
+
+
+    public void cloneAugmentInfo() {
+        yangAugmentedInfo = new ArrayList<>();
+    }
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangChoice.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangChoice.java
new file mode 100644
index 0000000..8e54d48
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangChoice.java
@@ -0,0 +1,493 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.yang.compiler.datamodel;
+
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.datamodel.utils.YangConstructType;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+
+import static java.util.Collections.unmodifiableList;
+import static org.onosproject.yang.compiler.datamodel.YangNodeType.CHOICE_NODE;
+import static org.onosproject.yang.compiler.datamodel.YangSchemaNodeType.YANG_CHOICE_NODE;
+import static org.onosproject.yang.compiler.datamodel.exceptions.ErrorMessages.CHOICE;
+import static org.onosproject.yang.compiler.datamodel.exceptions.ErrorMessages.COLLISION_DETECTION;
+import static org.onosproject.yang.compiler.datamodel.exceptions.ErrorMessages.getErrorMsgCollision;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.CASE_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.CHOICE_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangErrMsgConstants.DATA_MISSING_ERROR_TAG;
+import static org.onosproject.yang.compiler.datamodel.utils.YangErrMsgConstants.ERROR_PATH_MISSING_CHOICE;
+import static org.onosproject.yang.compiler.datamodel.utils.YangErrMsgConstants.MISSING_CHOICE_ERROR_APP_TAG;
+
+/*-
+ * 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        |-YangIfFeature    |
+ *                | 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        |-YangWhen         |
+ *                +--------------+---------+-------------+------------------+
+ */
+
+/**
+ * Represents data model node to maintain information defined in YANG choice.
+ */
+public abstract class YangChoice
+        extends YangNode
+        implements YangCommonInfo, Parsable, CollisionDetector,
+        YangAugmentableNode, YangWhenHolder, YangIfFeatureHolder,
+        YangAppErrorHolder, YangIsFilterContentNodes, YangConfig {
+
+    private static final long serialVersionUID = 806201604L;
+
+    /**
+     * If the choice represents config data.
+     */
+    private boolean isConfig;
+
+    /**
+     * Description of choice.
+     */
+    private String description;
+
+    /**
+     * Reference RFC 6020.
+     * <p>
+     * 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.
+     * <p>
+     * If not specified, the default is "false".
+     * <p>
+     * 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:
+     * <p>
+     * o If this ancestor is a case node, the constraint is enforced if any
+     * other node from the case exists.
+     * <p>
+     * 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;
+
+    /**
+     * Reference RFC 6020.
+     * <p>
+     * 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.
+     * <p>
+     * The "default" statement MUST NOT be present on choices where "mandatory"
+     * is true.
+     * <p>
+     * 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.
+     * <p>
+     * There MUST NOT be any mandatory nodes directly under the default case.
+     * <p>
+     * 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.
+     * <p>
+     * the default case to be used if no case members is present.
+     */
+    private String defaultValueInString;
+
+    /**
+     * When data of the node.
+     */
+    private YangWhen when;
+
+    /**
+     * List of if-feature.
+     */
+    private List<YangIfFeature> ifFeatureList;
+
+    private List<YangAugment> yangAugmentedInfo;
+
+    /**
+     * YANG application error information.
+     */
+    private YangAppErrorInfo yangAppErrorInfo;
+
+    /**
+     * Create a choice node.
+     */
+    public YangChoice() {
+        super(CHOICE_NODE, new HashMap<>());
+        yangAppErrorInfo = new YangAppErrorInfo();
+        ifFeatureList = new LinkedList<>();
+        yangAugmentedInfo = new ArrayList<>();
+        yangAppErrorInfo.setErrorTag(DATA_MISSING_ERROR_TAG);
+        yangAppErrorInfo.setErrorAppTag(MISSING_CHOICE_ERROR_APP_TAG);
+        yangAppErrorInfo.setErrorAppPath(ERROR_PATH_MISSING_CHOICE);
+    }
+
+    @Override
+    public void addToChildSchemaMap(YangSchemaNodeIdentifier id,
+                                    YangSchemaNodeContextInfo context)
+            throws DataModelException {
+        getYsnContextInfoMap().put(id, context);
+        YangSchemaNodeContextInfo contextInfo =
+                new YangSchemaNodeContextInfo();
+        contextInfo.setSchemaNode(context.getSchemaNode());
+        contextInfo.setContextSwitchedNode(this);
+        getParent().addToChildSchemaMap(id, contextInfo);
+    }
+
+    @Override
+    public void setNameSpaceAndAddToParentSchemaMap() {
+        // Get parent namespace and set namespace for self node.
+        setNameSpace(getParent().getNameSpace());
+    }
+
+    @Override
+    public void incrementMandatoryChildCount() {
+        //For non data nodes, mandatory child to be added to parent node.
+        // TODO
+    }
+
+    @Override
+    public void addToDefaultChildMap(
+            YangSchemaNodeIdentifier yangSchemaNodeIdentifier,
+            YangSchemaNode yangSchemaNode) {
+        //For non data nodes, default child to be added to parent node.
+        // TODO
+    }
+
+    @Override
+    public YangSchemaNodeType getYangSchemaNodeType() {
+        /*Choice node to be skipped in YANG data tree preparation*/
+        return YANG_CHOICE_NODE;
+    }
+
+    /**
+     * Returns the when.
+     *
+     * @return the when
+     */
+    @Override
+    public YangWhen getWhen() {
+        return when;
+    }
+
+    /**
+     * Sets the when.
+     *
+     * @param when the when to set
+     */
+    @Override
+    public void setWhen(YangWhen when) {
+        this.when = when;
+    }
+
+    /**
+     * Returns config flag.
+     *
+     * @return the config flag
+     */
+    @Override
+    public boolean isConfig() {
+        return isConfig;
+    }
+
+    /**
+     * Sets config flag.
+     *
+     * @param isConfig the config flag
+     */
+    @Override
+    public void setConfig(boolean isConfig) {
+        this.isConfig = isConfig;
+    }
+
+    /**
+     * 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 {
+        if (defaultValueInString != null && !defaultValueInString.isEmpty()) {
+            YangNode node = getChild();
+            boolean matched = false;
+            // Check whether default string matches the case
+            while (node != null) {
+                if (node instanceof YangCase) {
+                    if (defaultValueInString.equals(node.getName())) {
+                        matched = true;
+                        break;
+                    }
+                }
+                node = node.getNextSibling();
+            }
+
+            if (!matched) {
+                throw new DataModelException(
+                        "YANG file error: default string \"" +
+                                defaultValueInString + "\" not matching choice \"" +
+                                getName() + "\" case.");
+            }
+        }
+    }
+
+    @Override
+    public void detectCollidingChild(String idName, YangConstructType type)
+            throws DataModelException {
+
+        if (getParent() instanceof YangCase && type != CASE_DATA) {
+            ((CollisionDetector) getParent()).detectCollidingChild(idName, type);
+        }
+        YangNode node = getChild();
+        while (node != null) {
+            if (node instanceof CollisionDetector) {
+                ((CollisionDetector) node).detectSelfCollision(idName, type);
+            }
+            node = node.getNextSibling();
+        }
+    }
+
+    @Override
+    public void detectSelfCollision(String identifierName,
+                                    YangConstructType dataType)
+            throws DataModelException {
+
+        if (dataType == CHOICE_DATA) {
+            if (getName().equals(identifierName)) {
+                throw new DataModelException(
+                        getErrorMsgCollision(COLLISION_DETECTION, getName(),
+                                             getLineNumber(), getCharPosition(),
+                                             CHOICE, getFileName()));
+            }
+            return;
+        }
+
+        YangNode node = getChild();
+        while (node != null) {
+            if (node instanceof CollisionDetector) {
+                ((CollisionDetector) node)
+                        .detectSelfCollision(identifierName, dataType);
+            }
+            node = node.getNextSibling();
+        }
+    }
+
+    @Override
+    public List<YangIfFeature> getIfFeatureList() {
+        return unmodifiableList(ifFeatureList);
+    }
+
+    @Override
+    public void addIfFeatureList(YangIfFeature ifFeature) {
+        ifFeatureList.add(ifFeature);
+    }
+
+    @Override
+    public void setIfFeatureList(List<YangIfFeature> ifFeatureList) {
+        this.ifFeatureList = ifFeatureList;
+    }
+
+    @Override
+    public void addAugmentation(YangAugment augmentInfo) {
+        yangAugmentedInfo.add(augmentInfo);
+    }
+
+    @Override
+    public void removeAugmentation(YangAugment augmentInfo) {
+        yangAugmentedInfo.remove(augmentInfo);
+    }
+
+    @Override
+    public List<YangAugment> getAugmentedInfoList() {
+        return unmodifiableList(yangAugmentedInfo);
+    }
+
+    @Override
+    public void setAppErrorInfo(YangAppErrorInfo yangAppErrorInfo) {
+        this.yangAppErrorInfo = yangAppErrorInfo;
+    }
+
+    @Override
+    public YangAppErrorInfo getAppErrorInfo() {
+        return yangAppErrorInfo;
+    }
+
+    public void cloneAugmentInfo() {
+        yangAugmentedInfo = new ArrayList<>();
+    }
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangCommonInfo.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangCommonInfo.java
new file mode 100644
index 0000000..82872f0
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/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.yang.compiler.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/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangCompilerAnnotation.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangCompilerAnnotation.java
new file mode 100644
index 0000000..f106689
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangCompilerAnnotation.java
@@ -0,0 +1,189 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.datamodel;
+
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.datamodel.utils.ResolvableStatus;
+import org.onosproject.yang.compiler.datamodel.utils.YangConstructType;
+
+import java.io.Serializable;
+import java.util.LinkedList;
+import java.util.List;
+
+import static java.util.Collections.unmodifiableList;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.COMPILER_ANNOTATION_DATA;
+
+/**
+ * Represents data model node to maintain information defined in YANG compiler-annotation.
+ */
+public class YangCompilerAnnotation extends DefaultLocationInfo
+        implements Parsable, YangXPathResolver, Resolvable, Serializable {
+
+    private static final long serialVersionUID = 806201602L;
+
+    /**
+     * App data structure information.
+     */
+    private YangAppDataStructure yangAppDataStructure;
+
+    /**
+     * App extended name information.
+     */
+    private YangAppExtended yangAppExtended;
+
+    /**
+     * Prefix of compiler-annotation.
+     */
+    private String prefix;
+
+    /**
+     * Path of compiler-annotation.
+     */
+    private String path;
+
+    /**
+     * Path of compiler-annotation.
+     */
+    private List<YangAtomicPath> atomicPathList = new LinkedList<>();
+
+    /**
+     * Resolution status.
+     */
+    private ResolvableStatus resolvableStatus;
+
+    /**
+     * Returns the YANG app data structure information.
+     *
+     * @return the YANG app data structure information
+     */
+    public YangAppDataStructure getYangAppDataStructure() {
+        return yangAppDataStructure;
+    }
+
+    /**
+     * Sets the YANG app data structure information.
+     *
+     * @param yangAppDataStructure the YANG app data structure to set
+     */
+    public void setYangAppDataStructure(YangAppDataStructure yangAppDataStructure) {
+        this.yangAppDataStructure = yangAppDataStructure;
+    }
+
+    /**
+     * Returns the prefix.
+     *
+     * @return the prefix
+     */
+    public String getPrefix() {
+        return prefix;
+    }
+
+    /**
+     * Sets the prefix information.
+     *
+     * @param prefix the prefix to set
+     */
+    public void setPrefix(String prefix) {
+        this.prefix = prefix;
+    }
+
+    /**
+     * Returns the path.
+     *
+     * @return the path
+     */
+    public String getPath() {
+        return path;
+    }
+
+    /**
+     * Sets the path.
+     *
+     * @param path the path to set
+     */
+    public void setPath(String path) {
+        this.path = path;
+    }
+
+    /**
+     * Returns the YANG app extended name information.
+     *
+     * @return the YANG app extended name information
+     */
+    public YangAppExtended getYangAppExtendedName() {
+        return yangAppExtended;
+    }
+
+    /**
+     * Sets the YANG app extended name information.
+     *
+     * @param yangAppExtendedName the YANG app extended name to set
+     */
+    public void setYangAppExtendedName(YangAppExtended yangAppExtendedName) {
+        yangAppExtended = yangAppExtendedName;
+    }
+
+    /**
+     * Returns the list of atomic path.
+     *
+     * @return the list of atomic path
+     */
+    public List<YangAtomicPath> getAtomicPathList() {
+        return unmodifiableList(atomicPathList);
+    }
+
+    /**
+     * Sets the atomic path.
+     *
+     * @param atomicPathList the atomic path list to set
+     */
+    public void setAtomicPathList(List<YangAtomicPath> atomicPathList) {
+        this.atomicPathList = atomicPathList;
+    }
+
+    @Override
+    public YangConstructType getYangConstructType() {
+        return COMPILER_ANNOTATION_DATA;
+    }
+
+    @Override
+    public void validateDataOnEntry() throws DataModelException {
+        // TODO : to be implemented
+    }
+
+    @Override
+    public void validateDataOnExit() throws DataModelException {
+        // TODO : to be implemented
+    }
+
+    @Override
+    public ResolvableStatus getResolvableStatus() {
+        return resolvableStatus;
+    }
+
+    @Override
+    public void setResolvableStatus(ResolvableStatus resolvableStatus) {
+        this.resolvableStatus = resolvableStatus;
+    }
+
+    @Override
+    public Object resolve()
+            throws DataModelException {
+        return null;
+    }
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangConfig.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangConfig.java
new file mode 100644
index 0000000..3659396
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangConfig.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.datamodel;
+
+/**
+ * Abstraction of config entity. It is used to abstract the data holders of config statement.
+ */
+public interface YangConfig {
+
+    /**
+     * Returns the config flag.
+     *
+     * @return if config flag
+     */
+    boolean isConfig();
+
+    /**
+     * Sets the config flag.
+     *
+     * @param isConfig the flag value to set
+     */
+    void setConfig(boolean isConfig);
+
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangContainer.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangContainer.java
new file mode 100644
index 0000000..04d99a4
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangContainer.java
@@ -0,0 +1,523 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.datamodel;
+
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.datamodel.utils.YangConstructType;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+
+import static org.onosproject.yang.compiler.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        | -YangIfFeature   |
+ *                | 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        | -YangMust        |
+ *                | 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        | -YangWhen        |
+ *                +--------------+---------+-------------+------------------+
+ */
+
+/**
+ * Represents data model node to maintain information defined in YANG container.
+ */
+public abstract class YangContainer
+        extends YangNode
+        implements YangLeavesHolder, YangCommonInfo, Parsable, CollisionDetector,
+        YangAugmentableNode, YangMustHolder, YangWhenHolder, YangIfFeatureHolder, YangIsFilterContentNodes,
+        YangConfig {
+
+    private static final long serialVersionUID = 806201605L;
+
+    /**
+     * 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;
+
+    private List<YangAugment> yangAugmentedInfo = new ArrayList<>();
+
+    /**
+     * Status of the node.
+     */
+    private YangStatusType status = YangStatusType.CURRENT;
+
+    /**
+     * List of must statement constraints.
+     */
+    private List<YangMust> mustConstraintList;
+
+    /**
+     * When data of the node.
+     */
+    private YangWhen when;
+
+    /**
+     * List of if-feature.
+     */
+    private List<YangIfFeature> ifFeatureList;
+
+    /**
+     * Create a container node.
+     */
+    public YangContainer() {
+        super(YangNodeType.CONTAINER_NODE, new HashMap<>());
+        listOfLeaf = new LinkedList<>();
+        listOfLeafList = new LinkedList<>();
+        mustConstraintList = new LinkedList<>();
+        ifFeatureList = new LinkedList<>();
+    }
+
+    @Override
+    public void addToChildSchemaMap(YangSchemaNodeIdentifier schemaNodeIdentifier,
+                                    YangSchemaNodeContextInfo yangSchemaNodeContextInfo) {
+        getYsnContextInfoMap().put(schemaNodeIdentifier, yangSchemaNodeContextInfo);
+    }
+
+    @Override
+    public void incrementMandatoryChildCount() {
+        // TODO
+    }
+
+    @Override
+    public void addToDefaultChildMap(YangSchemaNodeIdentifier yangSchemaNodeIdentifier, YangSchemaNode yangSchemaNode) {
+        // TODO
+    }
+
+    @Override
+    public YangSchemaNodeType getYangSchemaNodeType() {
+        return YangSchemaNodeType.YANG_SINGLE_INSTANCE_NODE;
+    }
+
+    /**
+     * Returns the when.
+     *
+     * @return the when
+     */
+    @Override
+    public YangWhen getWhen() {
+        return when;
+    }
+
+    /**
+     * Sets the when.
+     *
+     * @param when the when to set
+     */
+    @Override
+    public void setWhen(YangWhen when) {
+        this.when = when;
+    }
+
+    /**
+     * Returns the config flag.
+     *
+     * @return the isConfig
+     */
+    @Override
+    public boolean isConfig() {
+        return isConfig;
+    }
+
+    /**
+     * Sets the config flag.
+     *
+     * @param isConfig the config flag
+     */
+    @Override
+    public void setConfig(boolean isConfig) {
+        this.isConfig = isConfig;
+    }
+
+    /**
+     * 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 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();
+        validateConfig(leaves, leafLists);
+    }
+
+    /**
+     * 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\"." + getName() + " in " +
+                                                         getLineNumber() + " at " +
+                                                         getCharPosition() +
+                                                         " in " + getFileName() + "\"");
+                }
+            }
+        }
+
+        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\"." +
+                                                         getName() + " in " +
+                                                         getLineNumber() + " at " +
+                                                         getCharPosition() +
+                                                         " in " + getFileName() + "\"");
+                }
+            }
+        }
+    }
+
+    @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() + " in " +
+                                                 getLineNumber() + " at " +
+                                                 getCharPosition() +
+                                                 " in " + getFileName() + "\"");
+        }
+    }
+
+    @Override
+    public List<YangIfFeature> getIfFeatureList() {
+        return ifFeatureList;
+    }
+
+    @Override
+    public void addIfFeatureList(YangIfFeature ifFeature) {
+        if (getIfFeatureList() == null) {
+            setIfFeatureList(new LinkedList<>());
+        }
+        getIfFeatureList().add(ifFeature);
+    }
+
+    @Override
+    public void setIfFeatureList(List<YangIfFeature> ifFeatureList) {
+        this.ifFeatureList = ifFeatureList;
+    }
+
+    @Override
+    public List<YangMust> getListOfMust() {
+        return mustConstraintList;
+    }
+
+    @Override
+    public void setListOfMust(List<YangMust> mustConstraintList) {
+        this.mustConstraintList = mustConstraintList;
+    }
+
+    @Override
+    public void addMust(YangMust must) {
+        if (getListOfMust() == null) {
+            setListOfMust(new LinkedList<>());
+        }
+        getListOfMust().add(must);
+    }
+
+    @Override
+    public void addAugmentation(YangAugment augmentInfo) {
+        yangAugmentedInfo.add(augmentInfo);
+    }
+
+    @Override
+    public void removeAugmentation(YangAugment augmentInfo) {
+        yangAugmentedInfo.remove(augmentInfo);
+    }
+
+    @Override
+    public List<YangAugment> getAugmentedInfoList() {
+        return yangAugmentedInfo;
+    }
+
+    @Override
+    public void setLeafNameSpaceAndAddToParentSchemaMap() {
+        // Add namespace for all leafs.
+        for (YangLeaf yangLeaf : getListOfLeaf()) {
+            yangLeaf.setLeafNameSpaceAndAddToParentSchemaMap(getNameSpace());
+        }
+        // Add namespace for all leaf list.
+        for (YangLeafList yangLeafList : getListOfLeafList()) {
+            yangLeafList.setLeafNameSpaceAndAddToParentSchemaMap(getNameSpace());
+        }
+    }
+
+    public void cloneAugmentInfo() {
+        yangAugmentedInfo = new ArrayList<>();
+    }
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangDataStructure.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangDataStructure.java
new file mode 100644
index 0000000..0896a48
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangDataStructure.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.datamodel;
+
+/**
+ * Represents ENUM to identify the YANG data type.
+ */
+public enum YangDataStructure {
+
+    QUEUE,
+
+    LIST,
+
+    MAP,
+
+    SET;
+
+    /**
+     * Returns YANG data structure type for corresponding data structure name.
+     *
+     * @param name data structure name from YANG file.
+     * @return YANG data structure for corresponding data structure name.
+     */
+    public static YangDataStructure getDataStructureType(String name) {
+        name = name.replace("\"", "");
+        for (YangDataStructure dataStructure : values()) {
+            if (dataStructure.name().toLowerCase().equals(name.toLowerCase())) {
+                return dataStructure;
+            }
+        }
+        return null;
+    }
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangDecimal64.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangDecimal64.java
new file mode 100644
index 0000000..56ae4f3
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangDecimal64.java
@@ -0,0 +1,360 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.datamodel;
+
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.datamodel.utils.FractionDigits;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.datamodel.utils.YangConstructType;
+import org.onosproject.yang.compiler.datamodel.utils.builtindatatype.DataTypeException;
+import org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangBuiltInDataTypeInfo;
+import org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.ListIterator;
+
+import static org.onosproject.yang.compiler.datamodel.exceptions.ErrorMessages.getErrorMsg;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.DECIMAL64_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes.DECIMAL64;
+
+/**
+ * Represents YANG decimal 64.
+ */
+public class YangDecimal64<T> extends DefaultLocationInfo
+        implements YangBuiltInDataTypeInfo<YangDecimal64>, Parsable, Serializable,
+        Comparable<YangDecimal64> {
+
+    private static final long serialVersionUID = 8006201668L;
+
+    /**
+     * 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 fraction-digits.
+     */
+    public static final int MIN_FRACTION_DIGITS_VALUE = 1;
+
+    /**
+     * Valid maximum value of YANG's fraction-digits.
+     */
+    public static final int MAX_FRACTION_DIGITS_VALUE = 18;
+
+    /**
+     * Valid minimum value of YANG's decimal64.
+     */
+    private static final BigDecimal MIN_VALUE =
+            BigDecimal.valueOf(-922337203685477580.8);
+
+    /**
+     * Valid maximum value of YANG's decimal64.
+     */
+    private static final BigDecimal MAX_VALUE =
+            BigDecimal.valueOf(922337203685477580.7);
+
+    private static final int MIN_FRACTION_DIGIT_RANGE = 1;
+    private static final int MAX_FRACTION_DIGIT_RANGE = 18;
+    private static final int ZERO = 0;
+
+
+    // Decimal64 value
+    private BigDecimal value;
+
+    // fraction-digits
+    private int fractionDigit;
+
+    /**
+     * Additional information about range restriction.
+     */
+    private T rangeRestrictedExtendedInfo;
+
+    /**
+     * Creates an instance of YANG decimal64.
+     */
+    public YangDecimal64() {
+    }
+
+    /**
+     * Creates an instance of YANG decimal64.
+     *
+     * @param value of decimal64
+     */
+    public YangDecimal64(BigDecimal value) {
+        setValue(value);
+    }
+
+    /**
+     * Creates an instance of YANG decimal64.
+     *
+     * @param valueInString of decimal64 in string
+     */
+    YangDecimal64(String valueInString) {
+        if (valueInString.matches(MIN_KEYWORD)) {
+            value = MIN_VALUE;
+        } else if (valueInString.matches(MAX_KEYWORD)) {
+            value = MAX_VALUE;
+        } else {
+            try {
+                value = new BigDecimal(valueInString);
+            } catch (Exception e) {
+                throw new DataTypeException(
+                        "YANG file error : Input value \"" + valueInString + "\"" +
+                                " is not a valid decimal64.");
+            }
+        }
+
+        if (value.doubleValue() < MIN_VALUE.doubleValue()) {
+            throw new DataTypeException("YANG file error : " + valueInString +
+                                                " is less than minimum value "
+                                                + MIN_VALUE + ".");
+        } else if (value.doubleValue() > MAX_VALUE.doubleValue()) {
+            throw new DataTypeException("YANG file error : " + valueInString +
+                                                " is greater than maximum value "
+                                                + MAX_VALUE + ".");
+        }
+    }
+
+    /**
+     * Returns decimal64 value.
+     *
+     * @return value
+     */
+    public BigDecimal getValue() {
+        return value;
+    }
+
+    /**
+     * Sets the decimal64 value.
+     *
+     * @param value of decimal64
+     */
+    public void setValue(BigDecimal value) {
+        this.value = value;
+    }
+
+    /**
+     * 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 additional information about range restriction.
+     *
+     * @return resolved range restricted extended information
+     */
+    public T getRangeRestrictedExtendedInfo() {
+        return rangeRestrictedExtendedInfo;
+    }
+
+    /**
+     * Sets additional information about range restriction.
+     *
+     * @param resolvedExtendedInfo resolved range restricted extended information
+     */
+    public void setRangeRestrictedExtendedInfo(T resolvedExtendedInfo) {
+        rangeRestrictedExtendedInfo = resolvedExtendedInfo;
+    }
+
+    /**
+     * Returns object of YANG decimal64.
+     *
+     * @param value of decimal64
+     * @return YANG decimal64 object
+     */
+    public static YangDecimal64 of(BigDecimal value) {
+        return new YangDecimal64(value);
+    }
+
+    @Override
+    public YangDataTypes getYangType() {
+        return DECIMAL64;
+    }
+
+    @Override
+    public YangConstructType getYangConstructType() {
+        return DECIMAL64_DATA;
+    }
+
+    @Override
+    public String toString() {
+        return value.toString();
+    }
+
+    /**
+     * Returns the object of YANG decimal64 from input string.
+     *
+     * @param valInString input String
+     * @return Object of YANG decimal64
+     */
+    static YangDecimal64 fromString(String valInString) {
+        return new YangDecimal64(valInString);
+    }
+
+    /**
+     * Checks whether specific fraction-digit in its range.
+     *
+     * @return true if fraction-digit is in its range otherwise false
+     */
+    public boolean isValidFractionDigit() {
+        return fractionDigit >= MIN_FRACTION_DIGIT_RANGE &&
+                fractionDigit <= MAX_FRACTION_DIGIT_RANGE;
+    }
+
+
+    /**
+     * Checks whether value is in correct decimal64 value range.
+     *
+     * @throws DataModelException a violation of data model rules
+     */
+    public void validateDecimal64() throws DataModelException {
+        YangRangeRestriction rangeRestriction =
+                (YangRangeRestriction) getRangeRestrictedExtendedInfo();
+        if (rangeRestriction != null) {
+            // Check whether value is within provided range value
+            ListIterator<YangRangeInterval> rangeListIterator =
+                    rangeRestriction.getAscendingRangeIntervals().listIterator();
+
+            boolean isMatched = false;
+            while (rangeListIterator.hasNext()) {
+                YangRangeInterval rangeInterval = rangeListIterator.next();
+                rangeInterval.setCharPosition(getCharPosition());
+                rangeInterval.setLineNumber(getLineNumber());
+                rangeInterval.setFileName(getFileName());
+                BigDecimal startValue = ((YangDecimal64) rangeInterval.getStartValue()).getValue();
+                BigDecimal endValue = ((YangDecimal64) rangeInterval.getEndValue()).getValue();
+                if (value.compareTo(startValue) >= ZERO &&
+                        value.compareTo(endValue) <= ZERO) {
+                    isMatched = true;
+                    break;
+                }
+            }
+            // If range is not matched then throw error
+            if (!isMatched) {
+                throw new DataModelException(getErrorMsg(
+                        "YANG file error : decimal64 validation failed.", "decimal64",
+                        getLineNumber(), getCharPosition(), getFileName() + "\""));
+            }
+        } else {
+            // Check value is in fraction-digits decimal64 value range
+            if (!FractionDigits.isValueInDecimal64Range(value, getFractionDigit())) {
+                throw new DataModelException(
+                        "YANG file error : value is not in decimal64 range.");
+            }
+        }
+    }
+
+    /**
+     * Validate range restriction values based on fraction-digits decimal64 range value.
+     *
+     * @throws DataModelException a violation of data model rules
+     */
+    public void validateRange() throws DataModelException {
+        YangRangeRestriction rangeRestriction =
+                (YangRangeRestriction) getRangeRestrictedExtendedInfo();
+        if (rangeRestriction == null) {
+            // No need to validate. Range is optional.
+            return;
+        }
+        ListIterator<YangRangeInterval> rangeListIterator =
+                rangeRestriction.getAscendingRangeIntervals().listIterator();
+        while (rangeListIterator.hasNext()) {
+            YangRangeInterval rangeInterval = rangeListIterator.next();
+            rangeInterval.setCharPosition(getCharPosition());
+            rangeInterval.setLineNumber(getLineNumber());
+            rangeInterval.setFileName(getFileName());
+            if (!FractionDigits.isValueInDecimal64Range(
+                    ((YangDecimal64) rangeInterval.getStartValue()).getValue(),
+                    getFractionDigit())) {
+                throw new DataModelException(getErrorMsg(
+                        "YANG file error : decimal64 validation failed.", "decimal64",
+                        getLineNumber(), getCharPosition(), getFileName() + "\""));
+            }
+            if (!FractionDigits.isValueInDecimal64Range(
+                    ((YangDecimal64) rangeInterval.getEndValue()).getValue(),
+                    getFractionDigit())) {
+                throw new DataModelException(getErrorMsg(
+                        "YANG file error : decimal64 validation failed.", "decimal64",
+                        getLineNumber(), getCharPosition(), getFileName() + "\""));
+            }
+        }
+    }
+
+    @Override
+    public int compareTo(YangDecimal64 o) {
+        return Double.compare(value.doubleValue(), o.value.doubleValue());
+    }
+
+    /**
+     * Returns decimal64 default range restriction based on fraction-digits.
+     * If range restriction is not provided then this default range value will be applicable.
+     *
+     * @return range restriction
+     * @throws DataModelException a violation of data model rules
+     */
+    public YangRangeRestriction getDefaultRangeRestriction() throws DataModelException {
+        YangRangeRestriction refRangeRestriction = new YangRangeRestriction();
+        YangRangeInterval rangeInterval = new YangRangeInterval<>();
+        rangeInterval.setCharPosition(getCharPosition());
+        rangeInterval.setLineNumber(getLineNumber());
+        rangeInterval.setFileName(getFileName());
+        FractionDigits.Range range = FractionDigits.getRange(fractionDigit);
+        rangeInterval.setStartValue(new YangDecimal64(new BigDecimal((range.getMin()))));
+        rangeInterval.setEndValue(new YangDecimal64(new BigDecimal((range.getMax()))));
+        refRangeRestriction.addRangeRestrictionInterval(rangeInterval);
+        return refRangeRestriction;
+    }
+
+    /**
+     * 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/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangDerivedInfo.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangDerivedInfo.java
new file mode 100644
index 0000000..88adac0
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangDerivedInfo.java
@@ -0,0 +1,684 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.datamodel;
+
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.datamodel.utils.ResolvableStatus;
+import org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes;
+
+import java.io.Serializable;
+
+import static com.google.common.base.Strings.isNullOrEmpty;
+import static org.onosproject.yang.compiler.datamodel.exceptions.ErrorMessages.getErrorMsg;
+import static org.onosproject.yang.compiler.datamodel.utils.ResolvableStatus.INTRA_FILE_RESOLVED;
+import static org.onosproject.yang.compiler.datamodel.utils.ResolvableStatus.RESOLVED;
+import static org.onosproject.yang.compiler.datamodel.utils.RestrictionResolver.processLengthRestriction;
+import static org.onosproject.yang.compiler.datamodel.utils.RestrictionResolver.processRangeRestriction;
+import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypeUtils.isOfRangeRestrictedType;
+import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes.BINARY;
+import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes.DECIMAL64;
+import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes.DERIVED;
+import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes.IDENTITYREF;
+import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes.LEAFREF;
+import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes.STRING;
+
+/**
+ * Represents the derived information.
+ *
+ * @param <T> extended information.
+ */
+public class YangDerivedInfo<T> extends DefaultLocationInfo
+        implements 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;
+
+    /**
+     * Effective built-in type, required 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;
+    }
+
+    /**
+     * 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;
+    }
+
+    /**
+     * 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();
+        YangDataTypes type = baseType.getDataType();
+        T extended = (T) baseType.getDataTypeExtendedInfo();
+
+        /*
+         * 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 (type == DERIVED) {
+            ResolvableStatus resolvableStatus = resolveTypeDerivedInfo(baseType);
+            if (resolvableStatus != null) {
+                return resolvableStatus;
+            }
+        } else if (type == LEAFREF || type == IDENTITYREF) {
+            effectiveBuiltInType = type;
+            return RESOLVED;
+        } else {
+            effectiveBuiltInType = type;
+            /*
+             * Check whether the effective built-in type can have range
+             * restrictions, if yes call resolution of range.
+             */
+            if (isOfRangeRestrictedType(effectiveBuiltInType)) {
+                return getResolveStatusForRangeRestrictionType(extended);
+            } else if (effectiveBuiltInType == STRING) {
+                return getResolveStatusForString(extended);
+            } else if (effectiveBuiltInType == BINARY) {
+                return getResolveStatusForBinary(extended);
+            } else if (effectiveBuiltInType == DECIMAL64) {
+                return getResolveStatusForDecimal64(extended);
+            }
+        }
+
+        /*
+         * 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 (effectiveBuiltInType.isNonRestrictedType()) {
+            if (isNullOrEmpty(getLengthRestrictionString()) &&
+                    isNullOrEmpty(getRangeRestrictionString()) &&
+                    getPatternRestriction() == null) {
+                return RESOLVED;
+            } else {
+                throw new DataModelException(getErrorMsg(
+                        "YANG file error: Restrictions can't be applied to a " +
+                                "given type ", "type.", getLineNumber(),
+                        getCharPosition(), getFileName() + "\""));
+            }
+        }
+        // Throw exception for unsupported types
+        throw new DataModelException(getErrorMsg(
+                "Linker error: Unable to process the derived type. ", "type.",
+                getLineNumber(), getCharPosition(), getFileName() + "\""));
+    }
+
+    //Returns resolve status for range restrictions.
+    private ResolvableStatus getResolveStatusForRangeRestrictionType(T extended)
+            throws DataModelException {
+        if (extended == 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 (!(extended instanceof YangRangeRestriction)) {
+                throwError();
+            }
+            resolveRangeRestriction((YangRangeRestriction) extended);
+                    /*
+                     * Return the resolution status as resolved, if it's not
+                     * resolve range/string restriction will throw exception in
+                     * previous function.
+                     */
+            return RESOLVED;
+        }
+    }
+
+    //Returns resolve status for string.
+    private ResolvableStatus getResolveStatusForString(T extended)
+            throws DataModelException {
+        if (extended == 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 (!(extended instanceof YangStringRestriction)) {
+                throwError();
+            }
+            resolveStringRestriction((YangStringRestriction) extended);
+                    /*
+                     * Return the resolution status as resolved, if it's not
+                     * resolve range/string restriction will throw exception in
+                     * previous function.
+                     */
+            return RESOLVED;
+        }
+    }
+
+    //Returns resolve status for binary type.
+    private ResolvableStatus getResolveStatusForBinary(T extended)
+            throws DataModelException {
+        if (extended == null) {
+            resolveBinaryRestriction(null);
+                    /*
+                     * Return the resolution status as resolved, if it's not
+                     * resolve length restriction will throw exception in
+                     * previous function.
+                     */
+            return RESOLVED;
+        } else {
+            if (!(extended instanceof YangRangeRestriction)) {
+                throwError();
+            }
+            resolveBinaryRestriction((YangRangeRestriction) extended);
+                    /*
+                     * Return the resolution status as resolved, if it's not
+                     * resolve length restriction will throw exception in
+                     * previous function.
+                     */
+            return RESOLVED;
+        }
+    }
+
+    //Returns resolve status for decimal64 type.
+    private ResolvableStatus getResolveStatusForDecimal64(T extended)
+            throws DataModelException {
+        if (extended != null) {
+            if (((YangDecimal64) extended).getRangeRestrictedExtendedInfo() == null) {
+                resolveRangeRestriction(null);
+                        /*
+                         * Return the resolution status as resolved, if it's not;
+                         * resolve range restriction will throw exception in
+                         * previous function.
+                         */
+                return RESOLVED;
+            } else {
+                if (!(((YangDecimal64) extended)
+                        .getRangeRestrictedExtendedInfo() instanceof YangRangeRestriction)) {
+                    throwError();
+                }
+                resolveRangeRestriction((YangRangeRestriction) (
+                        (YangDecimal64) extended).getRangeRestrictedExtendedInfo());
+                        /*
+                         * Return the resolution status as resolved, if it's not
+                         * resolve range/string restriction will throw exception in
+                         * previous function.
+                         */
+                return RESOLVED;
+            }
+
+        } else {
+            throw new DataModelException(getErrorMsg(
+                    "Linker error: Unable to find type extended info " +
+                            "for decimal64.", "type.", getLineNumber(),
+                    getCharPosition(), getFileName() + "\""));
+        }
+    }
+
+    private void throwError() throws DataModelException {
+        throw new DataModelException(getErrorMsg(
+                "Linker error: Referred typedef restriction info is of invalid ",
+                "type.", getLineNumber(), getCharPosition(), getFileName() + "\""));
+    }
+
+    /**
+     * Resolves the type derived info, by obtaining the effective built-in type
+     * and resolving the restrictions.
+     *
+     * @param baseType base type of typedef
+     * @return resolution status
+     * @throws DataModelException a violation in data mode rule
+     */
+    private ResolvableStatus resolveTypeDerivedInfo(YangType<?> baseType)
+            throws DataModelException {
+
+        //Check whether the referred typedef is resolved.
+        if (baseType.getResolvableStatus() != INTRA_FILE_RESOLVED &&
+                baseType.getResolvableStatus() != RESOLVED) {
+            throwError();
+        }
+
+        /*
+         * 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;
+        }
+        effectiveBuiltInType = ((YangDerivedInfo<?>) baseType
+                .getDataTypeExtendedInfo()).getEffectiveBuiltInType();
+        YangDerivedInfo refDerivedInfo = (YangDerivedInfo<?>) baseType.getDataTypeExtendedInfo();
+        T extendedInfo = (T) refDerivedInfo.getResolvedExtendedInfo();
+        /*
+         * Check whether the effective built-in type can have range
+         * restrictions, if yes call resolution of range.
+         */
+        if (isOfRangeRestrictedType(effectiveBuiltInType)) {
+            return getResolveStatusForRangeRestrictionType(extendedInfo);
+        } else if (effectiveBuiltInType == STRING) {
+            return getResolveStatusForString(extendedInfo);
+        } else if (effectiveBuiltInType == BINARY) {
+            return getResolveStatusForBinary(extendedInfo);
+        } else if (effectiveBuiltInType == DECIMAL64) {
+            if (extendedInfo == null) {
+                resolveRangeRestriction(null);
+                 /*
+                  * Return the resolution status as resolved, if it's not;
+                  * resolve range restriction will throw exception in
+                  * previous function.
+                  */
+                return RESOLVED;
+            } else {
+                if (!(extendedInfo instanceof YangRangeRestriction)) {
+                    throwError();
+                }
+                resolveRangeRestriction((YangRangeRestriction) extendedInfo);
+                /*
+                 * Return the resolution status as resolved, if it's not
+                 * resolve range/string restriction will throw exception in
+                 * previous function.
+                 */
+                return RESOLVED;
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Resolves the string restrictions.
+     *
+     * @param refSr referred string restriction of typedef
+     * @throws DataModelException a violation in data model rule
+     */
+    private void resolveStringRestriction(YangStringRestriction refSr)
+            throws DataModelException {
+        YangStringRestriction curSr = null;
+        YangRangeRestriction refRr = null;
+        YangPatternRestriction refPr = null;
+
+        /*
+         * Check that range restriction should be null when built-in type is
+         * string.
+         */
+        if (!isNullOrEmpty(getRangeRestrictionString())) {
+            throw new DataModelException(getErrorMsg(
+                    "YANG file error: Range restriction should't be present for" +
+                            " string data type.", ".", getLineNumber(),
+                    getCharPosition(), getFileName()));
+        }
+
+        /*
+         * If referred restriction and self restriction both are null, no
+         * resolution is required.
+         */
+        if (refSr == null && isNullOrEmpty(getLengthRestrictionString()) &&
+                getPatternRestriction() == null) {
+            return;
+        }
+
+        /*
+         * If referred string restriction is not null, take value of length and
+         * pattern restriction and assign.
+         */
+        if (refSr != null) {
+            refRr = refSr.getLengthRestriction();
+            refPr = refSr.getPatternRestriction();
+        }
+
+        YangRangeRestriction lr = resolveLengthRestriction(refRr);
+        YangPatternRestriction pr = resolvePatternRestriction(refPr);
+
+        /*
+         * Check if either of length or pattern restriction is present, if yes
+         * create string restriction and assign value.
+         */
+        if (lr != null || pr != null) {
+            curSr = new YangStringRestriction();
+            curSr.setCharPosition(getCharPosition());
+            curSr.setFileName(getFileName());
+            curSr.setLineNumber(getLineNumber());
+            curSr.setLengthRestriction(lr);
+            curSr.setPatternRestriction(pr);
+        }
+        resolvedExtendedInfo = (T) curSr;
+    }
+
+    /**
+     * Resolves the binary restrictions.
+     *
+     * @param refLr referred length restriction of typedef
+     * @throws DataModelException a violation in data model rule
+     */
+    private void resolveBinaryRestriction(YangRangeRestriction refLr)
+            throws DataModelException {
+
+        if (rangeRestrictionString != null || patternRestriction != null) {
+            throw new DataModelException(getErrorMsg(
+                    "YANG file error: for binary range restriction or pattern " +
+                            "restriction is not allowed.", "type.",
+                    getLineNumber(), getCharPosition(), getFileName()));
+        }
+
+        // Get the final resolved length restriction
+        YangRangeRestriction lr = resolveLengthRestriction(refLr);
+        // Set the length restriction.
+        resolvedExtendedInfo = (T) lr;
+    }
+
+    /**
+     * Resolves pattern restriction.
+     *
+     * @param refPr referred pattern restriction of typedef
+     * @return resolved pattern restriction
+     */
+    private YangPatternRestriction resolvePatternRestriction(YangPatternRestriction refPr) {
+        /*
+         * If referred restriction and self restriction both are null, no
+         * resolution is required.
+         */
+        if (refPr == 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 refPr;
+        }
+
+        /*
+         * If referred restriction is null, and self restriction is present
+         * carry out self resolution.
+         */
+        if (refPr == null) {
+            return getPatternRestriction();
+        }
+
+        /*
+         * Get patterns of referred type and add it to current pattern
+         * restrictions.
+         */
+        for (String pattern : refPr.getPatternList()) {
+            getPatternRestriction().addPattern(pattern);
+        }
+        return getPatternRestriction();
+    }
+
+    /**
+     * Resolves the length restrictions.
+     *
+     * @param refLenRestriction referred length restriction of typedef
+     * @return resolved length restriction
+     * @throws DataModelException a violation in data model rule
+     */
+    private YangRangeRestriction resolveLengthRestriction(
+            YangRangeRestriction refLenRestriction) throws DataModelException {
+
+        /*
+         * If referred restriction and self restriction both are null, no
+         * resolution is required.
+         */
+        if (refLenRestriction == null && isNullOrEmpty(getLengthRestrictionString())) {
+            return null;
+        }
+
+        /*
+         * If self restriction is null, and referred restriction is present
+         * shallow copy the referred to self.
+         */
+        if (isNullOrEmpty(getLengthRestrictionString())) {
+            return refLenRestriction;
+        }
+
+        /*
+         * If referred restriction is null, and self restriction is present
+         * carry out self resolution.
+         */
+        if (refLenRestriction == null) {
+            return processLengthRestriction(
+                    null, getLineNumber(), getCharPosition(), false,
+                    getLengthRestrictionString(), getFileName());
+        }
+
+        /*
+         * 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(refLenRestriction, getLineNumber(),
+                                         getCharPosition(), true,
+                                         getLengthRestrictionString(), getFileName());
+
+        // Resolve the range with referred typedef's restriction.
+        resolveLengthAndRangeRestriction(refLenRestriction, 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(getErrorMsg(
+                        "Linker error: Current range intervals not processed correctly.",
+                        "type.", getLineNumber(), getCharPosition(), getFileName()));
+            }
+            try {
+                refRestriction.isValidInterval((YangRangeInterval)
+                                                       curInterval, getFileName());
+            } catch (DataModelException e) {
+                throw new DataModelException(getErrorMsg(
+                        e.getMessage(), "type.", getLineNumber(), getCharPosition(),
+                        getFileName()));
+            }
+        }
+    }
+
+    /**
+     * 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 (!isNullOrEmpty(getLengthRestrictionString())
+                || getPatternRestriction() != null) {
+            throw new DataModelException(getErrorMsg(
+                    "YANG file error: Length/Pattern restriction should't be present" +
+                            " for int/uint/decimal data type.", "type.", getLineNumber(),
+                    getCharPosition(), getFileName()));
+        }
+
+        /*
+         * If referred restriction and self restriction both are null, no
+         * resolution is required.
+         */
+        if (refRangeRestriction == null && isNullOrEmpty(getRangeRestrictionString())) {
+            return;
+        }
+
+        /*
+         * If self restriction is null, and referred restriction is present
+         * shallow copy the referred to self.
+         */
+        if (isNullOrEmpty(getRangeRestrictionString())) {
+            resolvedExtendedInfo = (T) refRangeRestriction;
+            return;
+        }
+
+        /*
+         * If referred restriction is null, and self restriction is present
+         * carry out self resolution.
+         */
+        if (refRangeRestriction == null) {
+            YangRangeRestriction curRangeRestriction =
+                    processRangeRestriction(null, getLineNumber(),
+                                            getCharPosition(), false, getRangeRestrictionString(),
+                                            effectiveBuiltInType, getFileName());
+            resolvedExtendedInfo = (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, getLineNumber(),
+                                        getCharPosition(), true,
+                                        getRangeRestrictionString(),
+                                        effectiveBuiltInType, getFileName());
+
+        // Resolve the range with referred typedef's restriction.
+        resolveLengthAndRangeRestriction(refRangeRestriction, curRangeRestriction);
+        resolvedExtendedInfo = (T) curRangeRestriction;
+    }
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangDesc.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangDesc.java
new file mode 100644
index 0000000..7bfbf38
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/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.yang.compiler.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/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangEntityToResolveInfo.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangEntityToResolveInfo.java
new file mode 100644
index 0000000..f4efa8b
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/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.yang.compiler.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/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangEntityToResolveInfoImpl.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangEntityToResolveInfoImpl.java
new file mode 100644
index 0000000..14cced0
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangEntityToResolveInfoImpl.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.yang.compiler.datamodel;
+
+import java.io.Serializable;
+
+/**
+ * Represents implementation of information about entity being resolved.
+ *
+ * @param <T> type of entity being resolved, uses / grouping
+ */
+public class YangEntityToResolveInfoImpl<T> extends DefaultLocationInfo
+        implements YangEntityToResolveInfo<T>, Serializable {
+
+    private static final long serialVersionUID = 806201659L;
+
+    /**
+     * Parsable node for which resolution is to be performed.
+     */
+    private T entityToResolve;
+
+    /**
+     * Holder of the YANG construct for which resolution has to be carried out.
+     */
+    private YangNode holderOfEntityToResolve;
+
+    @Override
+    public T getEntityToResolve() {
+        return entityToResolve;
+    }
+
+    @Override
+    public void setEntityToResolve(T entityToResolve) {
+        this.entityToResolve = entityToResolve;
+    }
+
+    @Override
+    public YangNode getHolderOfEntityToResolve() {
+        return holderOfEntityToResolve;
+    }
+
+    @Override
+    public void setHolderOfEntityToResolve(YangNode holderOfEntityToResolve) {
+        this.holderOfEntityToResolve = holderOfEntityToResolve;
+    }
+
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangEnum.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangEnum.java
new file mode 100644
index 0000000..cc8da44
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangEnum.java
@@ -0,0 +1,243 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.datamodel;
+
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.datamodel.utils.YangConstructType;
+
+import java.io.Serializable;
+import java.util.Objects;
+
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.ENUM_DATA;
+
+/*-
+ * 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 extends DefaultLocationInfo 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 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/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangEnumeration.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangEnumeration.java
new file mode 100644
index 0000000..37e747c
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangEnumeration.java
@@ -0,0 +1,158 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.datamodel;
+
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.datamodel.utils.YangConstructType;
+
+import java.util.SortedSet;
+import java.util.TreeSet;
+
+import static org.onosproject.yang.compiler.datamodel.YangSchemaNodeType.YANG_NON_DATA_NODE;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.ENUMERATION_DATA;
+
+/*
+ * The enumeration built-in type represents values from a set of
+ *  assigned names.
+ */
+
+/**
+ * Represents the enumeration data type information.
+ */
+public abstract class YangEnumeration
+        extends YangNode
+        implements Parsable, CollisionDetector {
+
+    private static final long serialVersionUID = 806201606L;
+
+    // Enumeration info set.
+    private SortedSet<YangEnum> enumSet;
+
+    /**
+     * Creates an enumeration object.
+     */
+    public YangEnumeration() {
+        super(YangNodeType.ENUMERATION_NODE, null);
+        setEnumSet(new TreeSet<>());
+    }
+
+    @Override
+    public void addToChildSchemaMap(YangSchemaNodeIdentifier schemaNodeIdentifier,
+                                    YangSchemaNodeContextInfo yangSchemaNodeContextInfo)
+            throws DataModelException {
+        // Do nothing.
+    }
+
+    @Override
+    public void incrementMandatoryChildCount() {
+        // TODO
+    }
+
+    @Override
+    public void addToDefaultChildMap(YangSchemaNodeIdentifier yangSchemaNodeIdentifier, YangSchemaNode yangSchemaNode) {
+        // TODO
+    }
+
+    @Override
+    public YangSchemaNodeType getYangSchemaNodeType() {
+        return YANG_NON_DATA_NODE;
+    }
+
+    /**
+     * 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 " +
+                    getName() + " in " +
+                    getLineNumber() + " at " +
+                    getCharPosition() +
+                    " in " + getFileName() + "\"");
+        }
+    }
+
+    /**
+     * Returns the type of the data.
+     *
+     * @return returns ENUMERATION_DATA
+     */
+    @Override
+    public YangConstructType getYangConstructType() {
+        return 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/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangExtension.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangExtension.java
new file mode 100644
index 0000000..b6e469e
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangExtension.java
@@ -0,0 +1,220 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.datamodel;
+
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.datamodel.utils.YangConstructType;
+
+import java.io.Serializable;
+
+/*-
+ * Reference RFC 6020.
+ *
+ * The "extension" statement allows the definition of new statements
+ * within the YANG language.  This new statement definition can be
+ * imported and used by other modules.
+ *
+ * The statement's argument is an identifier that is the new keyword for
+ * the extension and must be followed by a block of sub-statements that
+ * holds detailed extension information.  The purpose of the "extension"
+ * statement is to define a keyword, so that it can be imported and used
+ * by other modules.
+ *
+ * The extension can be used like a normal YANG statement, with the
+ * statement name followed by an argument if one is defined by the
+ * extension, and an optional block of sub-statements.  The statement's
+ * name is created by combining the prefix of the module in which the
+ * extension was defined, a colon (":"), and the extension's keyword,
+ * with no interleaving whitespace.  The sub-statements of an extension
+ * are defined by the extension, using some mechanism outside the scope
+ * of this specification.  Syntactically, the sub-statements MUST be YANG
+ * statements, or also defined using "extension" statements.
+ *
+ * The extension'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      |
+ *                | argument     | 7.17.2  | 0..1        | -string          |
+ *                +--------------+---------+-------------+------------------+
+ */
+
+/**
+ * Represents data model node to maintain information defined in YANG extension.
+ */
+public class YangExtension extends DefaultLocationInfo
+        implements YangCommonInfo, Serializable, Parsable {
+
+    private static final long serialVersionUID = 806201605L;
+
+    /**
+     * Name of the extension.
+     */
+    private String name;
+
+    /**
+     * Name of the argument.
+     */
+    private String argumentName;
+
+    /**
+     * Description of extension.
+     */
+    private String description;
+
+    /**
+     * Reference of the extension.
+     */
+    private String reference;
+
+    /**
+     * Status of the extension.
+     */
+    private YangStatusType status = YangStatusType.CURRENT;
+
+    /**
+     * Returns the YANG name of extension.
+     *
+     * @return the name of extension as defined in YANG file
+     */
+    public String getName() {
+        return name;
+    }
+
+    /**
+     * Sets the YANG name of extension.
+     *
+     * @param name the name of extension as defined in YANG file
+     */
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    /**
+     * Returns the YANG argument name of extension.
+     *
+     * @return the name of argument as defined in YANG file
+     */
+    public String getArgumentName() {
+        return argumentName;
+    }
+
+    /**
+     * Sets the YANG argument name of extension.
+     *
+     * @param argumentName the name of argument as defined in YANG file
+     */
+    public void setArgumentName(String argumentName) {
+        this.argumentName = argumentName;
+    }
+
+    /**
+     * 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 EXTENSION_DATA
+     */
+    @Override
+    public YangConstructType getYangConstructType() {
+        return YangConstructType.EXTENSION_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 : to be implemented
+    }
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangFeature.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangFeature.java
new file mode 100644
index 0000000..76a3515
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangFeature.java
@@ -0,0 +1,158 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.datamodel;
+
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.datamodel.utils.YangConstructType;
+
+import java.io.Serializable;
+import java.util.LinkedList;
+import java.util.List;
+
+/*
+ * Reference RFC 6020.
+ *
+ * The "feature" statement is used to define a mechanism by which
+ * portions of the schema are marked as conditional.  A feature name is
+ * defined that can later be referenced using the "if-feature" statement.
+ * Schema nodes tagged with a feature are ignored by the device unless
+ * the device supports the given feature.  This allows portions of the
+ * YANG module to be conditional based on conditions on the device.
+ * The model can represent the abilities of the device within the model,
+ * giving a richer model that allows for differing device abilities and roles.
+ *
+ * The argument to the "feature" statement is the name of the new
+ * feature, and follows the rules for identifiers.  This name is used by the
+ * "if-feature" statement to tie the schema nodes to the feature.
+ *
+ * The feature's Substatements
+ *
+ *                +--------------+---------+-------------+------------------+
+ *                | substatement | section | cardinality |data model mapping|
+ *                +--------------+---------+-------------+------------------+
+ *                | description  | 7.19.3  | 0..1        | -string          |
+ *                | if-feature   | 7.18.2  | 0..n        | -YangIfFeature   |
+ *                | reference    | 7.19.4  | 0..1        | -string          |
+ *                | status       | 7.19.2  | 0..1        | -YangStatus      |
+ *                +--------------+---------+-------------+------------------+
+ */
+
+/**
+ * Represents data model node to maintain information defined in YANG feature.
+ */
+public class YangFeature extends DefaultLocationInfo
+        implements YangCommonInfo, Parsable, YangIfFeatureHolder, Serializable {
+
+    private static final long serialVersionUID = 806201635L;
+
+    /**
+     * Name of the feature.
+     */
+    private String name;
+
+    /**
+     * Description of feature.
+     */
+    private String description;
+
+    /**
+     * Reference of the feature.
+     */
+    private String reference;
+
+    /**
+     * Status of feature.
+     */
+    private YangStatusType statusType;
+
+    /**
+     * List of if-feature.
+     */
+    private List<YangIfFeature> ifFeatureList;
+
+    @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 statusType;
+    }
+
+    @Override
+    public void setStatus(YangStatusType status) {
+        this.statusType = status;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    @Override
+    public YangConstructType getYangConstructType() {
+        return YangConstructType.FEATURE_DATA;
+    }
+
+    @Override
+    public void validateDataOnEntry() throws DataModelException {
+        //TODO : To be implemented
+    }
+
+    @Override
+    public void validateDataOnExit() throws DataModelException {
+        //TODO : To be implemented
+    }
+
+    @Override
+    public List<YangIfFeature> getIfFeatureList() {
+        return ifFeatureList;
+    }
+
+    @Override
+    public void addIfFeatureList(YangIfFeature ifFeature) {
+        if (getIfFeatureList() == null) {
+            setIfFeatureList(new LinkedList<>());
+        }
+        getIfFeatureList().add(ifFeature);
+    }
+
+    @Override
+    public void setIfFeatureList(List<YangIfFeature> ifFeatureList) {
+        this.ifFeatureList = ifFeatureList;
+    }
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangFeatureHolder.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangFeatureHolder.java
new file mode 100644
index 0000000..d6f588d
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangFeatureHolder.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.datamodel;
+
+import java.util.List;
+
+/**
+ * Abstraction of feature entity. It is used to abstract the data holders of feature.
+ */
+public interface YangFeatureHolder {
+
+    /**
+     * Returns the list of feature from data holder like container / list.
+     *
+     * @return the list of feature
+     */
+    List<YangFeature> getFeatureList();
+
+    /**
+     * Adds feature in feature list.
+     *
+     * @param feature the feature to be added
+     */
+    void addFeatureList(YangFeature feature);
+
+    /**
+     * Sets the list of feature.
+     *
+     * @param listOfFeature the list of feature to set
+     */
+    void setListOfFeature(List<YangFeature> listOfFeature);
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangGrouping.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangGrouping.java
new file mode 100644
index 0000000..da87a1d
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangGrouping.java
@@ -0,0 +1,367 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.yang.compiler.datamodel;
+
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.datamodel.utils.YangConstructType;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import static java.util.Collections.unmodifiableList;
+import static org.onosproject.yang.compiler.datamodel.YangNodeType.GROUPING_NODE;
+import static org.onosproject.yang.compiler.datamodel.YangSchemaNodeType.YANG_NON_DATA_NODE;
+import static org.onosproject.yang.compiler.datamodel.exceptions.ErrorMessages.COLLISION_DETECTION;
+import static org.onosproject.yang.compiler.datamodel.exceptions.ErrorMessages.GROUPING;
+import static org.onosproject.yang.compiler.datamodel.exceptions.ErrorMessages.getErrorMsgCollision;
+import static org.onosproject.yang.compiler.datamodel.utils.DataModelUtils.detectCollidingChildUtil;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.GROUPING_DATA;
+
+/*-
+ * 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 abstract class YangGrouping
+        extends YangNode
+        implements YangLeavesHolder, YangCommonInfo, Parsable, CollisionDetector,
+        YangTranslatorOperatorNode {
+
+    private static final long serialVersionUID = 806201607L;
+
+    /**
+     * 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;
+
+    /**
+     * Grouping depth.
+     */
+    private int groupingDepth;
+
+    /**
+     * Creates the grouping node.
+     */
+    public YangGrouping() {
+        super(GROUPING_NODE, null);
+        listOfLeaf = new LinkedList<>();
+        listOfLeafList = new LinkedList<>();
+    }
+
+    @Override
+    public void addToChildSchemaMap(YangSchemaNodeIdentifier id,
+                                    YangSchemaNodeContextInfo context)
+            throws DataModelException {
+        // Do nothing, to be handled during linking.
+    }
+
+    @Override
+    public void incrementMandatoryChildCount() {
+        // Do nothing, to be handled during linking.
+    }
+
+    @Override
+    public void addToDefaultChildMap(YangSchemaNodeIdentifier id,
+                                     YangSchemaNode node) {
+        // Do nothing, to be handled during linking.
+    }
+
+    @Override
+    public YangSchemaNodeType getYangSchemaNodeType() {
+        return YANG_NON_DATA_NODE;
+    }
+
+    /**
+     * 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 unmodifiableList(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) {
+        listOfLeaf.add(leaf);
+    }
+
+    /**
+     * Returns the list of leaf-list.
+     *
+     * @return the list of leaf-list
+     */
+    @Override
+    public List<YangLeafList> getListOfLeafList() {
+        return unmodifiableList(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) {
+        listOfLeafList.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 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(
+                    getErrorMsgCollision(COLLISION_DETECTION, getName(),
+                                         getLineNumber(), getCharPosition(),
+                                         GROUPING, getFileName()));
+        }
+    }
+
+    @Override
+    public void setLeafNameSpaceAndAddToParentSchemaMap() {
+        // Add namespace for all leafs.
+        for (YangLeaf yangLeaf : listOfLeaf) {
+            yangLeaf.setLeafNameSpaceAndAddToParentSchemaMap(getNameSpace());
+        }
+        // Add namespace for all leaf list.
+        for (YangLeafList yangLeafList : listOfLeafList) {
+            yangLeafList.setLeafNameSpaceAndAddToParentSchemaMap(getNameSpace());
+        }
+    }
+    // TODO  A grouping MUST NOT reference itself, neither directly nor indirectly through a chain of other groupings.
+
+    /**
+     * Returns grouping depth.
+     *
+     * @return grouping depth
+     */
+    public int getGroupingDepth() {
+        return groupingDepth;
+    }
+
+    /**
+     * Sets grouping depth.
+     *
+     * @param groupingDepth grouping depth
+     */
+    public void setGroupingDepth(int groupingDepth) {
+        this.groupingDepth = groupingDepth;
+    }
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangIdentity.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangIdentity.java
new file mode 100644
index 0000000..94732a9
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangIdentity.java
@@ -0,0 +1,157 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.yang.compiler.datamodel;
+
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.datamodel.utils.YangConstructType;
+
+import java.io.Serializable;
+
+/*-
+ * Reference RFC 6020.
+ *
+ *  The "identity" statement is used to define a new globally unique,
+ *  abstract, and untyped identity.  Its only purpose is to denote its
+ *  name, semantics, and existence.  An identity can either be defined
+ *  from scratch or derived from a base identity.  The identity's
+ *  argument is an identifier that is the name of the identity.  It is
+ *  followed by a block of substatements that holds detailed identity
+ *  information.
+ *
+ *  The identity's Substatements
+ *
+ *                +--------------+---------+-------------+-----------------------+
+ *                | substatement | section | cardinality |  data model mapping   |
+ *                +--------------+---------+-------------+-----------------------+
+ *                | base         | 7.16.2  | 0..1        |  -YangNodeIdentifier  |
+ *                | description  | 7.19.3  | 0..1        |  -string              |
+ *                | reference    | 7.19.4  | 0..1        |  -string              |
+ *                | status       | 7.19.2  | 0..1        |  -YangStatus          |
+ *                +--------------+---------+-------------+-----------------------+
+ */
+
+/**
+ * Represents data model node to maintain information defined in YANG identity.
+ */
+public abstract class YangIdentity
+        extends YangNode
+        implements YangCommonInfo, Parsable, Serializable, YangTranslatorOperatorNode {
+
+    private static final long serialVersionUID = 806201691L;
+
+    //Base node of identity.
+    private YangBase baseNode;
+
+    //Status of YANG identity.
+    private YangStatusType status;
+
+    //Description of YANG identity.
+    private String description;
+
+    //YANG reference of the identity.
+    private String reference;
+
+    //Creates a identity type of node.
+    public YangIdentity() {
+        super(YangNodeType.IDENTITY_NODE, null);
+    }
+
+    @Override
+    public void addToChildSchemaMap(YangSchemaNodeIdentifier schemaNodeIdentifier,
+            YangSchemaNodeContextInfo yangSchemaNodeContextInfo)
+            throws DataModelException {
+        // Do nothing.
+    }
+
+    @Override
+    public void incrementMandatoryChildCount() {
+        // TODO
+    }
+
+    @Override
+    public void addToDefaultChildMap(YangSchemaNodeIdentifier yangSchemaNodeIdentifier, YangSchemaNode yangSchemaNode) {
+        // TODO
+    }
+
+    @Override
+    public YangSchemaNodeType getYangSchemaNodeType() {
+        return YangSchemaNodeType.YANG_NON_DATA_NODE;
+    }
+
+    @Override
+    public YangStatusType getStatus() {
+        return status;
+    }
+
+    @Override
+    public void setStatus(YangStatusType status) {
+        this.status = status;
+    }
+
+    @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 YangConstructType getYangConstructType() {
+        return YangConstructType.IDENTITY_DATA;
+    }
+
+    @Override
+    public void validateDataOnEntry()
+            throws DataModelException {
+    }
+
+    @Override
+    public void validateDataOnExit()
+            throws DataModelException {
+    }
+
+    /**
+     * Returns base node of identity.
+     *
+     * @return the base node of identity
+     */
+    public YangBase getBaseNode() {
+        return baseNode;
+    }
+
+    /**
+     * Sets the base node.
+     *
+     * @param baseNode the base node to set
+     */
+    public void setBaseNode(YangBase baseNode) {
+        this.baseNode = baseNode;
+    }
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangIdentityRef.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangIdentityRef.java
new file mode 100644
index 0000000..6c5817f
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangIdentityRef.java
@@ -0,0 +1,299 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.yang.compiler.datamodel;
+
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.datamodel.utils.ResolvableStatus;
+import org.onosproject.yang.compiler.datamodel.utils.YangConstructType;
+
+import java.io.Serializable;
+
+import static org.onosproject.yang.compiler.datamodel.utils.ResolvableStatus.INTRA_FILE_RESOLVED;
+import static org.onosproject.yang.compiler.datamodel.utils.ResolvableStatus.RESOLVED;
+import static org.onosproject.yang.compiler.datamodel.utils.ResolvableStatus.UNRESOLVED;
+
+/*-
+ * Reference RFC 6020.
+ *
+ * The identityref type is used to reference an existing identity.
+ *
+ *  The identityref's base Statement :
+ *       The "base" statement, which is a substatement to the "type"
+ *  statement, MUST be present if the type is "identityref".  The
+ *  argument is the name of an identity, as defined by an "identity"
+ *  statement.  If a prefix is present on the identity name, it refers to
+ *  an identity defined in the module that was imported with that prefix.
+ *  Otherwise, an identity with the matching name MUST be defined in the
+ *  current module or an included submodule.
+ *  Valid values for an identityref are any identities derived from the
+ *  identityref's base identity.  On a particular server, the valid
+ *  values are further restricted to the set of identities defined in the
+ *  modules supported by the server.
+ */
+
+/**
+ * Represents data model node to maintain information defined in YANG identityref.
+ */
+public class YangIdentityRef
+        extends YangNode
+        implements Cloneable, Parsable, Resolvable, Serializable {
+
+    private static final long serialVersionUID = 806201692L;
+
+    // Get referred identity parent information.
+    private YangIdentity referredIdentity;
+
+    // YANG node identifier.
+    private YangNodeIdentifier baseIdentity;
+
+    /**
+     * Status of resolution. If completely resolved enum value is "RESOLVED",
+     * if not enum value is "UNRESOLVED", in case reference of grouping/typedef/identityref/base
+     * is added to uses/type/identityref/base but it's not resolved value of enum should be
+     * "INTRA_FILE_RESOLVED".
+     */
+    private ResolvableStatus resolvableStatus;
+
+    /**
+     * Resolution for interfile grouping.
+     */
+    private boolean isIdentityForInterFileGroupingResolution;
+
+    /**
+     * Flag to indicate whether the leaf ref is inside grouping.
+     */
+    private boolean inGrouping;
+
+    // Creates a specific identityref of node.
+    public YangIdentityRef() {
+        super(YangNodeType.IDENTITYREF_NODE, null);
+        baseIdentity = new YangNodeIdentifier();
+        resolvableStatus = UNRESOLVED;
+    }
+
+    @Override
+    public void addToChildSchemaMap(YangSchemaNodeIdentifier schemaNodeIdentifier,
+            YangSchemaNodeContextInfo yangSchemaNodeContextInfo)
+            throws DataModelException {
+        // Do nothing.
+    }
+
+    @Override
+    public void incrementMandatoryChildCount() {
+        // TODO
+    }
+
+    @Override
+    public void addToDefaultChildMap(YangSchemaNodeIdentifier yangSchemaNodeIdentifier, YangSchemaNode yangSchemaNode) {
+        // TODO
+    }
+
+    @Override
+    public YangSchemaNodeType getYangSchemaNodeType() {
+        return YangSchemaNodeType.YANG_NON_DATA_NODE;
+    }
+
+    @Override
+    public ResolvableStatus getResolvableStatus() {
+        return resolvableStatus;
+    }
+
+    @Override
+    public void setResolvableStatus(ResolvableStatus resolvableStatus) {
+        this.resolvableStatus = resolvableStatus;
+    }
+
+    @Override
+    public Object resolve()
+            throws DataModelException {
+
+        // Check if the derived info is present.
+        YangIdentity identity = getReferredIdentity();
+
+        if (identity == null) {
+            throw new DataModelException("Linker Error: Identity information is missing. " +
+                    getName() + " in " +
+                    getLineNumber() + " at " +
+                    getCharPosition() +
+                    " in " + getFileName() + "\"");
+        }
+
+        while (identity.getBaseNode() != null) {
+            if (identity.getBaseNode().getResolvableStatus() != RESOLVED) {
+                setResolvableStatus(INTRA_FILE_RESOLVED);
+                return null;
+            }
+            identity = identity.getBaseNode().getReferredIdentity();
+        }
+        return null;
+    }
+
+    /**
+     * Returns the YANG base node identifier.
+     *
+     * @return the YANG base node identifier
+     */
+    public YangNodeIdentifier getBaseIdentity() {
+        return baseIdentity;
+    }
+
+    /**
+     * Sets the YANG node identifier.
+     *
+     * @param baseIdentity the YANG node identifier to set
+     */
+    public void setBaseIdentity(YangNodeIdentifier baseIdentity) {
+        this.baseIdentity = baseIdentity;
+    }
+
+    /**
+     * Returns the name of identity.
+     *
+     * @return the identity name
+     */
+    @Override
+    public String getName() {
+        return baseIdentity.getName();
+    }
+
+    /**
+     * Sets the name of identity.
+     *
+     * @param name the identity name to set
+     */
+    @Override
+    public void setName(String name) {
+        baseIdentity.setName(name);
+    }
+
+    /**
+     * Sets node identifier.
+     *
+     * @param nodeIdentifier the node identifier
+     */
+    public void setNodeIdentifier(YangNodeIdentifier nodeIdentifier) {
+        this.baseIdentity = nodeIdentifier;
+    }
+
+    /**
+     * Returns prefix associated with base.
+     *
+     * @return prefix associated with base
+     */
+    public String getPrefix() {
+        return baseIdentity.getPrefix();
+    }
+
+    /**
+     * Sets prefix associated with base.
+     *
+     * @param prefix prefix associated with base
+     */
+    public void setPrefix(String prefix) {
+        baseIdentity.setPrefix(prefix);
+    }
+
+    @Override
+    public YangConstructType getYangConstructType() {
+        return YangConstructType.IDENTITYREF_DATA;
+    }
+
+    @Override
+    public void validateDataOnEntry()
+            throws DataModelException {
+    }
+
+    @Override
+    public void validateDataOnExit()
+            throws DataModelException {
+    }
+
+    /**
+     * Returns the parent identity node.
+     *
+     * @return the parent identity node
+     */
+    public YangIdentity getReferredIdentity() {
+        return referredIdentity;
+    }
+
+    /**
+     * Sets the parent identity node.
+     *
+     * @param referredIdentity the parent identity node to set
+     */
+    public void setReferredIdentity(YangIdentity referredIdentity) {
+        this.referredIdentity = referredIdentity;
+    }
+
+    public boolean isIdentityForInterFileGroupingResolution() {
+        return isIdentityForInterFileGroupingResolution;
+    }
+
+    public void setIdentityForInterFileGroupingResolution(
+            boolean identityForInterFileGroupingResolution) {
+        isIdentityForInterFileGroupingResolution =
+                identityForInterFileGroupingResolution;
+    }
+
+    @Override
+    public YangIdentityRef clone()
+            throws CloneNotSupportedException {
+        YangIdentityRef identityRef = (YangIdentityRef) super.clone();
+        return identityRef;
+    }
+
+    @Override
+    public String getJavaPackage() {
+        //TODO: throw exception
+        return null;
+    }
+
+    @Override
+    public String getJavaClassNameOrBuiltInType() {
+        //TODO: throw exception
+        return null;
+    }
+
+    @Override
+    public String getJavaAttributeName() {
+        throw new RuntimeException("Attribute name is not applicable ");
+    }
+
+    /**
+     * Returns flag value indicating whether leafref is inside grouping.
+     *
+     * @return true if leafref is in grouping, false otherwise
+     */
+    public boolean isInGrouping() {
+        return inGrouping;
+    }
+
+    /**
+     * Sets in grouping flag.
+     *
+     * @param inGrouping flag
+     */
+    public void setInGrouping(boolean inGrouping) {
+        this.inGrouping = inGrouping;
+    }
+
+    @Override
+    public YangNode clone(YangUses yangUses) throws CloneNotSupportedException {
+        return (YangNode) super.clone();
+    }
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangIfFeature.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangIfFeature.java
new file mode 100644
index 0000000..a4e50c4
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangIfFeature.java
@@ -0,0 +1,192 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.datamodel;
+
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.datamodel.utils.ResolvableStatus;
+import org.onosproject.yang.compiler.datamodel.utils.YangConstructType;
+
+import java.io.Serializable;
+import java.util.Iterator;
+import java.util.List;
+
+/*
+ * Reference RFC 6020.
+ *
+ *  The "if-feature" statement makes its parent statement conditional.
+ *  The argument is the name of a feature, as defined by a "feature"
+ *  statement.  The parent statement is implemented by servers that
+ *  support this feature.  If a prefix is present on the feature name, it
+ *  refers to a feature defined in the module that was imported with that
+ *  prefix, or the local module if the prefix matches the local module's
+ *  prefix.  Otherwise, a feature with the matching name MUST be defined
+ *  in the current module or an included submodule.
+ *
+ *  Since submodules cannot include the parent module, any features in
+ *  the module that need to be exposed to submodules MUST be defined in a
+ *  submodule.  Submodules can then include this submodule to find the
+ *  definition of the feature.
+ */
+
+/**
+ * Represents data model node to maintain information defined in YANG if-feature.
+ */
+public class YangIfFeature extends DefaultLocationInfo
+        implements Parsable, Resolvable, Serializable {
+
+    private static final long serialVersionUID = 806201635L;
+
+    /**
+     * if-feature argument.
+     */
+    private YangNodeIdentifier name;
+
+    /**
+     * Referred feature information.
+     */
+    private YangFeature referredFeature;
+
+    /**
+     * Referred feature parent information.
+     */
+    private YangNode referredFeatureHolder;
+
+    /**
+     * 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;
+
+    /**
+     * Returns referred feature holder.
+     *
+     * @return referred feature holder
+     */
+    public YangNode getReferredFeatureHolder() {
+        return referredFeatureHolder;
+    }
+
+    /**
+     * Sets the referred feature holder.
+     *
+     * @param referredFeatureHolder referred feature holder
+     */
+    public void setReferredFeatureHolder(YangNode referredFeatureHolder) {
+        this.referredFeatureHolder = referredFeatureHolder;
+    }
+
+    /**
+     * Returns prefix associated with identifier.
+     *
+     * @return prefix associated with identifier
+     */
+    public String getPrefix() {
+        return name.getPrefix();
+    }
+
+    /**
+     * Sets prefix associated with identifier.
+     *
+     * @param prefix prefix associated with identifier
+     */
+    public void setPrefix(String prefix) {
+        name.setPrefix(prefix);
+    }
+
+    /**
+     * Returns referred feature associated with if-feature.
+     *
+     * @return referred feature associated with if-feature
+     */
+    public YangFeature getReferredFeature() {
+        return referredFeature;
+    }
+
+    /**
+     * Sets referred feature associated with if-feature.
+     *
+     * @param referredFeature referred feature associated with if-feature
+     */
+    public void setReferredFeature(YangFeature referredFeature) {
+        this.referredFeature = referredFeature;
+    }
+
+    /**
+     * Returns the YANG name of if-feature.
+     *
+     * @return the name of if-feature as defined in YANG file
+     */
+    public YangNodeIdentifier getName() {
+        return name;
+    }
+
+    /**
+     * Sets the YANG name of if-feature.
+     *
+     * @param name the name of if-feature as defined in YANG file
+     */
+    public void setName(YangNodeIdentifier name) {
+        this.name = name;
+    }
+
+    @Override
+    public YangConstructType getYangConstructType() {
+        return YangConstructType.IF_FEATURE_DATA;
+    }
+
+    @Override
+    public void validateDataOnEntry() throws DataModelException {
+        // do nothing, no validation required for if-feature
+    }
+
+    @Override
+    public void validateDataOnExit() throws DataModelException {
+        // do nothing, no validation required for if-feature
+    }
+
+    @Override
+    public ResolvableStatus getResolvableStatus() {
+        return resolvableStatus;
+    }
+
+    @Override
+    public void setResolvableStatus(ResolvableStatus resolvableStatus) {
+        this.resolvableStatus = resolvableStatus;
+    }
+
+    @Override
+    public Object resolve() throws DataModelException {
+        YangFeature feature = getReferredFeature();
+
+        // check whether feature has if-feature
+        List<YangIfFeature> ifFeatureList = feature.getIfFeatureList();
+        if (ifFeatureList != null && !ifFeatureList.isEmpty()) {
+            Iterator<YangIfFeature> ifFeatureIterator = ifFeatureList.iterator();
+            while (ifFeatureIterator.hasNext()) {
+                YangIfFeature ifFeature = ifFeatureIterator.next();
+                if (ifFeature.getResolvableStatus() != ResolvableStatus.RESOLVED) {
+                    setResolvableStatus(ResolvableStatus.INTRA_FILE_RESOLVED);
+                    return null;
+                }
+            }
+        }
+        return null;
+    }
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangIfFeatureHolder.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangIfFeatureHolder.java
new file mode 100644
index 0000000..a7eda66
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangIfFeatureHolder.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.datamodel;
+
+import java.util.List;
+
+/**
+ * Abstraction of if-feature entity. It is used to abstract the data holders of if-feature.
+ */
+public interface YangIfFeatureHolder {
+
+    /**
+     * Returns the list of if-feature from data holder like container / list.
+     *
+     * @return the list of if-feature
+     */
+    List<YangIfFeature> getIfFeatureList();
+
+    /**
+     * Adds if-feature in if-feature list.
+     *
+     * @param ifFeature the if-feature to be added
+     */
+    void addIfFeatureList(YangIfFeature ifFeature);
+
+    /**
+     * Sets the list of if-feature.
+     *
+     * @param ifFeatureList the list of if-feature to set
+     */
+    void setIfFeatureList(List<YangIfFeature> ifFeatureList);
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangImport.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangImport.java
new file mode 100644
index 0000000..bef36ab
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangImport.java
@@ -0,0 +1,266 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.yang.compiler.datamodel;
+
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.datamodel.utils.YangConstructType;
+
+import java.io.Serializable;
+import java.util.Date;
+import java.util.Set;
+
+import static org.onosproject.yang.compiler.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        | Date             |
+ *                +---------------+---------+-------------+------------------+
+ */
+
+/**
+ * Represents the information about the imported modules.
+ */
+public class YangImport extends DefaultLocationInfo
+        implements Parsable, 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 Date revision;
+
+    /**
+     * Reference to node which is imported.
+     */
+    private YangNode importedNode;
+
+    /**
+     * 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 Date getRevision() {
+        return revision;
+    }
+
+    /**
+     * Sets the revision of the imported module.
+     *
+     * @param rev set the revision of the imported module
+     */
+    public void setRevision(Date 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;
+    }
+
+    /**
+     * 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();
+        Date 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) {
+                    setImportedNode(moduleNode);
+                    return;
+                }
+                // Match revision if import is with revision.
+                if (moduleNode.getRevision() != null && (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());
+        exception.setFileName(getFileName());
+        throw exception;
+    }
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangInclude.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangInclude.java
new file mode 100644
index 0000000..83c6bbe
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangInclude.java
@@ -0,0 +1,222 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.yang.compiler.datamodel;
+
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.datamodel.utils.YangConstructType;
+
+import java.io.Serializable;
+import java.util.Date;
+import java.util.Set;
+
+import static org.onosproject.yang.compiler.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 extends DefaultLocationInfo
+        implements Parsable, 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 Date revision;
+
+    /**
+     * Reference to node which is included.
+     */
+    private YangNode includedNode;
+
+    /**
+     * 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 Date getRevision() {
+        return revision;
+    }
+
+    /**
+     * Sets the revision.
+     *
+     * @param revision the revision to set
+     */
+    public void setRevision(Date 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;
+    }
+
+    /**
+     * 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();
+        Date 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) {
+                    setIncludedNode(subModuleNode);
+                    return (YangSubModule) subModuleNode;
+                }
+
+                // Match revision if inclusion is with revision.
+                if (subModuleNode.getRevision() != null && 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());
+        exception.setFileName(getFileName());
+        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());
+        exception.setFileName(getFileName());
+        throw exception;
+    }
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangInput.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangInput.java
new file mode 100644
index 0000000..10d7188
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangInput.java
@@ -0,0 +1,231 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.datamodel;
+
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.datamodel.utils.YangConstructType;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+
+import static java.util.Collections.unmodifiableList;
+import static org.onosproject.yang.compiler.datamodel.YangNodeType.INPUT_NODE;
+import static org.onosproject.yang.compiler.datamodel.YangSchemaNodeType.YANG_SINGLE_INSTANCE_NODE;
+import static org.onosproject.yang.compiler.datamodel.exceptions.ErrorMessages.COLLISION_DETECTION;
+import static org.onosproject.yang.compiler.datamodel.exceptions.ErrorMessages.INPUT;
+import static org.onosproject.yang.compiler.datamodel.exceptions.ErrorMessages.getErrorMsgCollision;
+import static org.onosproject.yang.compiler.datamodel.utils.DataModelUtils.detectCollidingChildUtil;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.INPUT_DATA;
+
+/*
+ * 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 abstract class YangInput
+        extends YangNode
+        implements YangLeavesHolder, Parsable, CollisionDetector,
+        YangAugmentableNode, YangIsFilterContentNodes, InvalidOpTypeHolder {
+
+    private static final long serialVersionUID = 806201608L;
+
+    /**
+     * List of leaves contained.
+     */
+    private List<YangLeaf> listOfLeaf;
+
+    /**
+     * List of leaf-lists contained.
+     */
+    private List<YangLeafList> listOfLeafList;
+
+    private List<YangAugment> yangAugmentedInfo;
+
+    /**
+     * Create a rpc input node.
+     */
+    public YangInput() {
+        super(INPUT_NODE, new HashMap<>());
+        listOfLeaf = new LinkedList<>();
+        listOfLeafList = new LinkedList<>();
+        yangAugmentedInfo = new ArrayList<>();
+    }
+
+    @Override
+    public void addToChildSchemaMap(YangSchemaNodeIdentifier id,
+                                    YangSchemaNodeContextInfo context)
+            throws DataModelException {
+        getYsnContextInfoMap().put(id, context);
+    }
+
+    @Override
+    public void incrementMandatoryChildCount() {
+        //For non data nodes, mandatory child to be added to parent node.
+        // TODO
+    }
+
+    @Override
+    public void addToDefaultChildMap(YangSchemaNodeIdentifier id,
+                                     YangSchemaNode yangSchemaNode) {
+        //For non data nodes, default child to be added to parent node.
+        // TODO
+    }
+
+    @Override
+    public YangSchemaNodeType getYangSchemaNodeType() {
+        return YANG_SINGLE_INSTANCE_NODE;
+    }
+
+    @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(
+                    getErrorMsgCollision(COLLISION_DETECTION, getName(),
+                                         getLineNumber(), getCharPosition(),
+                                         INPUT, getFileName()));
+        }
+    }
+
+    @Override
+    public YangConstructType getYangConstructType() {
+        return 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 unmodifiableList(listOfLeaf);
+    }
+
+    @Override
+    public void setListOfLeaf(List<YangLeaf> leafsList) {
+        listOfLeaf = leafsList;
+    }
+
+    @Override
+    public void addLeaf(YangLeaf leaf) {
+        listOfLeaf.add(leaf);
+    }
+
+    @Override
+    public List<YangLeafList> getListOfLeafList() {
+        return unmodifiableList(listOfLeafList);
+    }
+
+    @Override
+    public void setListOfLeafList(List<YangLeafList> listOfLeafList) {
+        this.listOfLeafList = listOfLeafList;
+    }
+
+    @Override
+    public void addLeafList(YangLeafList leafList) {
+        listOfLeafList.add(leafList);
+    }
+
+    @Override
+    public void addAugmentation(YangAugment augmentInfo) {
+        yangAugmentedInfo.add(augmentInfo);
+    }
+
+    @Override
+    public void removeAugmentation(YangAugment augmentInfo) {
+        yangAugmentedInfo.remove(augmentInfo);
+    }
+
+    @Override
+    public List<YangAugment> getAugmentedInfoList() {
+        return unmodifiableList(yangAugmentedInfo);
+    }
+
+    @Override
+    public void setLeafNameSpaceAndAddToParentSchemaMap() {
+        // Add namespace for all leafs.
+        for (YangLeaf yangLeaf : listOfLeaf) {
+            yangLeaf.setLeafNameSpaceAndAddToParentSchemaMap(getNameSpace());
+        }
+        // Add namespace for all leaf list.
+        for (YangLeafList yangLeafList : listOfLeafList) {
+            yangLeafList.setLeafNameSpaceAndAddToParentSchemaMap(getNameSpace());
+        }
+    }
+
+    public void cloneAugmentInfo() {
+        yangAugmentedInfo = new ArrayList<>();
+    }
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangIsFilterContentNodes.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangIsFilterContentNodes.java
new file mode 100644
index 0000000..ec097c1
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangIsFilterContentNodes.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.yang.compiler.datamodel;
+
+/**
+ * Represent the YANG nodes which can contain is filter content match.
+ */
+public interface YangIsFilterContentNodes {
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangLeaf.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangLeaf.java
new file mode 100644
index 0000000..a1cf665
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangLeaf.java
@@ -0,0 +1,577 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.datamodel;
+
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.datamodel.utils.YangConstructType;
+
+import java.io.Serializable;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import static org.onosproject.yang.compiler.datamodel.YangStatusType.CURRENT;
+import static org.onosproject.yang.compiler.datamodel.utils.DataModelUtils.validateEmptyDataType;
+
+/*
+ * 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        | - string         |
+ *       | description  | 7.19.3  | 0..1        | - string         |
+ *       | if-feature   | 7.18.2  | 0..n        | - YangIfFeature  |
+ *       | mandatory    | 7.6.5   | 0..1        | - boolean        |
+ *       | must         | 7.5.3   | 0..n        | - YangMust       |
+ *       | 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        | - YangWhen       |
+ *       +--------------+---------+-------------+------------------+
+ */
+
+/**
+ * Represents leaf data represented in YANG.
+ */
+public abstract class YangLeaf extends DefaultLocationInfo
+        implements YangCommonInfo, Parsable, Cloneable, Serializable,
+        YangMustHolder, YangIfFeatureHolder, YangWhenHolder, YangSchemaNode,
+        YangConfig {
+
+    private static final long serialVersionUID = 806201635L;
+
+    /**
+     * YANG schema node identifier.
+     */
+    private YangSchemaNodeIdentifier yangSchemaNodeIdentifier;
+
+    /**
+     * 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 = 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;
+
+    /**
+     * When data of the leaf.
+     */
+    private YangWhen when;
+
+    /**
+     * YANG Node in which the leaf is contained.
+     */
+    private YangLeavesHolder containedIn;
+
+    /**
+     * List of must statement constraints.
+     */
+    private List<YangMust> mustConstraintList;
+
+    /**
+     * List of if-feature.
+     */
+    private List<YangIfFeature> ifFeatureList;
+
+    /**
+     * Referred schema leaf.
+     */
+    private YangLeaf referredLeaf;
+
+    private  boolean isKeyLeaf;
+    /**
+     * Creates a YANG leaf.
+     */
+    public YangLeaf() {
+        mustConstraintList = new LinkedList<>();
+        ifFeatureList = new LinkedList<>();
+    }
+
+    /**
+     * Returns the config flag.
+     *
+     * @return if config flag
+     */
+    @Override
+    public boolean isConfig() {
+        return isConfig;
+    }
+
+    /**
+     * Sets the config flag.
+     *
+     * @param isConfig the flag value to set
+     */
+    @Override
+    public void setConfig(boolean isConfig) {
+        this.isConfig = isConfig;
+    }
+
+    /**
+     * Returns the when.
+     *
+     * @return the when
+     */
+    @Override
+    public YangWhen getWhen() {
+        return when;
+    }
+
+    /**
+     * Sets the when.
+     *
+     * @param when the when to set
+     */
+    @Override
+    public void setWhen(YangWhen when) {
+        this.when = when;
+    }
+
+    /**
+     * 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;
+    }
+
+    @Override
+    public boolean isEmptyDataType() {
+        return validateEmptyDataType(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 {
+        YangLeaf cl = (YangLeaf) super.clone();
+        cl.yangSchemaNodeIdentifier = yangSchemaNodeIdentifier.clone();
+        return cl;
+    }
+
+    /**
+     * 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 {
+        if (defaultValueInString != null && !defaultValueInString.isEmpty()
+                && dataType != null) {
+            dataType.isValidValue(defaultValueInString);
+        }
+    }
+
+    @Override
+    public List<YangMust> getListOfMust() {
+        return mustConstraintList;
+    }
+
+    @Override
+    public void setListOfMust(List<YangMust> mustConstraintList) {
+        this.mustConstraintList = mustConstraintList;
+    }
+
+    @Override
+    public void addMust(YangMust must) {
+        if (getListOfMust() == null) {
+            setListOfMust(new LinkedList<>());
+        }
+        getListOfMust().add(must);
+    }
+
+    @Override
+    public List<YangIfFeature> getIfFeatureList() {
+        return ifFeatureList;
+    }
+
+    @Override
+    public void addIfFeatureList(YangIfFeature ifFeature) {
+        if (getIfFeatureList() == null) {
+            setIfFeatureList(new LinkedList<>());
+        }
+        getIfFeatureList().add(ifFeature);
+    }
+
+    @Override
+    public void setIfFeatureList(List<YangIfFeature> ifFeatureList) {
+        this.ifFeatureList = ifFeatureList;
+    }
+
+    @Override
+    public YangSchemaNodeContextInfo getChildSchema(
+            YangSchemaNodeIdentifier dataNodeIdentifier)
+            throws DataModelException {
+        throw new DataModelException("leaf cannot have any child schema nodes " +
+                getName() + " in " +
+                getLineNumber() + " at " +
+                getCharPosition() +
+                " in " + getFileName() + "\"");
+    }
+
+    @Override
+    public void isValueValid(String value)
+            throws DataModelException {
+        getDataType().isValidValue(value);
+    }
+
+    @Override
+    public int getMandatoryChildCount()
+            throws DataModelException {
+        throw new DataModelException("Leaf can't have child. " +
+                getName() + " in " +
+                getLineNumber() + " at " +
+                getCharPosition() +
+                " in " + getFileName() + "\"");
+    }
+
+    @Override
+    public Map<YangSchemaNodeIdentifier, YangSchemaNode> getDefaultChild(YangSchemaNodeIdentifier dataNodeIdentifier) {
+        // Returns null as there is no child to leaf.
+        return null;
+    }
+
+    @Override
+    public boolean isNotificationPresent() throws DataModelException {
+        throw new DataModelException("Method is called for node other than module/sub-module.");
+    }
+
+    @Override
+    public YangSchemaNodeType getYangSchemaNodeType() {
+        return YangSchemaNodeType.YANG_SINGLE_INSTANCE_LEAF_NODE;
+    }
+
+    /**
+     * Sets leaf namespace and add itself to parent child schema map.
+     *
+     * @param nameSpace namespace
+     */
+    public void setLeafNameSpaceAndAddToParentSchemaMap(YangNamespace nameSpace) {
+        setNameSpace(nameSpace);
+        // Process addition of leaf to schema node map.
+        ((YangNode) getContainedIn()).processAdditionOfSchemaNodeToCurNodeMap(getName(), getNameSpace(), this);
+    }
+
+    @Override
+    public YangSchemaNodeIdentifier getYangSchemaNodeIdentifier() {
+        return yangSchemaNodeIdentifier;
+    }
+
+    /**
+     * Sets YANG schema node identifier.
+     *
+     * @param yangSchemaNodeIdentifier YANG schema node identifier
+     */
+    public void setYangSchemaNodeIdentifier(YangSchemaNodeIdentifier
+                                                    yangSchemaNodeIdentifier) {
+        if (this.yangSchemaNodeIdentifier == null) {
+            this.yangSchemaNodeIdentifier = new YangSchemaNodeIdentifier();
+        }
+        this.yangSchemaNodeIdentifier = yangSchemaNodeIdentifier;
+    }
+
+    /**
+     * Retrieve the name of leaf.
+     *
+     * @return leaf name
+     */
+    public String getName() {
+        return yangSchemaNodeIdentifier.getName();
+    }
+
+    /**
+     * Sets name of node.
+     *
+     * @param name name of the node
+     */
+    public void setName(String name) {
+        if (yangSchemaNodeIdentifier == null) {
+            yangSchemaNodeIdentifier = new YangSchemaNodeIdentifier();
+        }
+        yangSchemaNodeIdentifier.setName(name);
+    }
+
+    @Override
+    public YangNamespace getNameSpace() {
+        return yangSchemaNodeIdentifier.getNameSpace();
+    }
+
+    /**
+     * Sets namespace of node.
+     *
+     * @param namespace namespace of the node
+     */
+    public void setNameSpace(YangNamespace namespace) {
+        if (yangSchemaNodeIdentifier == null) {
+            yangSchemaNodeIdentifier = new YangSchemaNodeIdentifier();
+        }
+        yangSchemaNodeIdentifier.setNameSpace(namespace);
+    }
+
+    @Override
+    public YangSchemaNode getNotificationSchemaNode(String notificationNameInEnum)
+            throws DataModelException {
+        throw new DataModelException("Method called for schema node other " +
+                                             "then module/sub-module");
+    }
+
+    @Override
+    public YangLeaf getReferredSchema() {
+        return referredLeaf;
+    }
+
+    /**
+     * Sets referred schema leaf. This is only applicable for grouping.
+     *
+     * @param leaf referred schema leaf
+     */
+    public void setReferredLeaf(YangLeaf leaf) {
+        referredLeaf = leaf;
+    }
+    /**
+     * Returns true if its a key leaf.
+     *
+     * @return true if its a key leaf
+     */
+    public boolean isKeyLeaf() {
+        return isKeyLeaf;
+    }
+
+    /**
+     * Sets true if its a key leaf.
+     *
+     * @param keyLeaf true if its a key leaf
+     */
+    public void setKeyLeaf(boolean keyLeaf) {
+        isKeyLeaf = keyLeaf;
+    }
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangLeafList.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangLeafList.java
new file mode 100644
index 0000000..2477d1a
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangLeafList.java
@@ -0,0 +1,574 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.datamodel;
+
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.datamodel.utils.YangConstructType;
+
+import java.io.Serializable;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import static org.onosproject.yang.compiler.datamodel.YangStatusType.CURRENT;
+import static org.onosproject.yang.compiler.datamodel.utils.DataModelUtils.validateEmptyDataType;
+
+/*
+ *  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        | -YangIfFeature   |
+ *                | max-elements | 7.7.4   | 0..1        | -int             |
+ *                | min-elements | 7.7.3   | 0..1        | -int             |
+ *                | must         | 7.5.3   | 0..n        | -YangMust        |
+ *                | 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        | -YangWhen        |
+ *                +--------------+---------+-------------+------------------+
+ */
+
+/**
+ * Represents leaf-list data represented in YANG.
+ */
+public abstract class YangLeafList extends DefaultLocationInfo
+        implements YangCommonInfo, Parsable, Cloneable, Serializable,
+        YangMustHolder, YangWhenHolder, YangIfFeatureHolder, YangSchemaNode,
+        YangConfig {
+
+    private static final long serialVersionUID = 806201637L;
+
+    /**
+     * Name of leaf-list.
+     */
+    private YangSchemaNodeIdentifier yangSchemaNodeIdentifier;
+
+    /**
+     * If the leaf-list is a config parameter.
+     */
+    private boolean isConfig;
+
+    /**
+     * Description of leaf-list.
+     */
+    private String description;
+
+    /**
+     * Reference:RFC 6020.
+     * <p>
+     * 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.
+     * <p>
+     * If no "max-elements" statement is present, it defaults to "unbounded".
+     */
+    private YangMaxElement maxElement;
+
+    /**
+     * Reference:RFC 6020.
+     * <p>
+     * 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.
+     * <p>
+     * If no "min-elements" statement is present, it defaults to zero.
+     * <p>
+     * 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:
+     * <p>
+     * o If this ancestor is a case node, the constraint is enforced if any
+     * other node from the case exists.
+     * <p>
+     * o Otherwise, it is enforced if the ancestor node exists.
+     */
+    private YangMinElement minElements;
+
+    /**
+     * The textual reference to this leaf-list.
+     */
+    private String reference;
+
+    /**
+     * Status of the leaf-list in the YANG definition.
+     */
+    private YangStatusType status = CURRENT;
+
+    /**
+     * Textual units.
+     */
+    private String units;
+
+    /**
+     * Data type of leaf-list.
+     */
+    private YangType<?> dataType;
+
+    /**
+     * YANG Node in which the leaf is contained.
+     */
+    private YangLeavesHolder containedIn;
+
+    /**
+     * List of must statement constraints.
+     */
+    private List<YangMust> mustConstraintList;
+
+    /**
+     * When data of the leaf.
+     */
+    private YangWhen when;
+
+    /**
+     * List of if-feature.
+     */
+    private List<YangIfFeature> ifFeatureList;
+
+    /**
+     * Referred schema leaf list.
+     */
+    private YangLeafList referredLeafList;
+
+    /**
+     * Creates a YANG leaf-list.
+     */
+    public YangLeafList() {
+        mustConstraintList = new LinkedList<>();
+        ifFeatureList = new LinkedList<>();
+        setMinElements(new YangMinElement());
+        setMaxElements(new YangMaxElement());
+    }
+
+    /**
+     * Returns the config flag.
+     *
+     * @return the config flag
+     */
+    @Override
+    public boolean isConfig() {
+        return isConfig;
+    }
+
+    /**
+     * Sets the config flag.
+     *
+     * @param isConfig the config flag
+     */
+    @Override
+    public void setConfig(boolean isConfig) {
+        this.isConfig = isConfig;
+    }
+
+    /**
+     * Returns the when.
+     *
+     * @return the when
+     */
+    @Override
+    public YangWhen getWhen() {
+        return when;
+    }
+
+    /**
+     * Sets the when.
+     *
+     * @param when the when to set
+     */
+    @Override
+    public void setWhen(YangWhen when) {
+        this.when = when;
+    }
+
+    /**
+     * 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 maximum elements number.
+     *
+     * @return the maximum elements number
+     */
+    public YangMaxElement getMaxElements() {
+        return maxElement;
+    }
+
+    /**
+     * Sets the maximum elements number.
+     *
+     * @param maxElement maximum elements number
+     */
+    public void setMaxElements(YangMaxElement maxElement) {
+        this.maxElement = maxElement;
+    }
+
+    /**
+     * Returns the minimum elements number.
+     *
+     * @return the minimum elements number
+     */
+    public YangMinElement getMinElements() {
+        return minElements;
+    }
+
+    /**
+     * Sets the minimum elements number.
+     *
+     * @param minElements the minimum elements number
+     */
+    public void setMinElements(YangMinElement 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;
+    }
+
+    @Override
+    public boolean isEmptyDataType() {
+        return validateEmptyDataType(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 {
+        YangLeafList cll = (YangLeafList) super.clone();
+        cll.yangSchemaNodeIdentifier = yangSchemaNodeIdentifier.clone();
+        return cll;
+    }
+
+    /**
+     * 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
+
+    }
+
+    @Override
+    public List<YangIfFeature> getIfFeatureList() {
+        return ifFeatureList;
+    }
+
+    @Override
+    public void addIfFeatureList(YangIfFeature ifFeature) {
+        if (getIfFeatureList() == null) {
+            setIfFeatureList(new LinkedList<>());
+        }
+        getIfFeatureList().add(ifFeature);
+    }
+
+    @Override
+    public void setIfFeatureList(List<YangIfFeature> ifFeatureList) {
+        this.ifFeatureList = ifFeatureList;
+    }
+
+    @Override
+    public List<YangMust> getListOfMust() {
+        return mustConstraintList;
+    }
+
+    @Override
+    public void setListOfMust(List<YangMust> mustConstraintList) {
+        this.mustConstraintList = mustConstraintList;
+    }
+
+    @Override
+    public void addMust(YangMust must) {
+        if (getListOfMust() == null) {
+            setListOfMust(new LinkedList<>());
+        }
+        getListOfMust().add(must);
+    }
+
+    @Override
+    public YangSchemaNodeContextInfo getChildSchema(
+            YangSchemaNodeIdentifier dataNodeIdentifier)
+            throws DataModelException {
+        throw new DataModelException("leaf cannot have any child schema nodes" +
+                getName() + " in " +
+                getLineNumber() + " at " +
+                getCharPosition() +
+                " in " + getFileName() + "\"");
+    }
+
+    @Override
+    public void isValueValid(String value)
+            throws DataModelException {
+        getDataType().isValidValue(value);
+    }
+
+    @Override
+    public int getMandatoryChildCount()
+            throws DataModelException {
+        throw new DataModelException("leaf list can't have child " + getName() + " in " +
+                getLineNumber() + " at " +
+                getCharPosition() +
+                " in " + getFileName() + "\"");
+    }
+
+    @Override
+    public Map<YangSchemaNodeIdentifier, YangSchemaNode> getDefaultChild(YangSchemaNodeIdentifier dataNodeIdentifier) {
+        // Returns null as there is no child to leaf list.
+        return null;
+    }
+
+    @Override
+    public boolean isNotificationPresent() throws DataModelException {
+        throw new DataModelException("Method is called for node other than module/sub-module.");
+    }
+
+    @Override
+    public YangSchemaNodeType getYangSchemaNodeType() {
+        return YangSchemaNodeType.YANG_MULTI_INSTANCE_LEAF_NODE;
+    }
+
+    /**
+     * Sets leaf namespace and add itself to parent child schema map.
+     *
+     * @param nameSpace namespace
+     */
+    public void setLeafNameSpaceAndAddToParentSchemaMap(YangNamespace nameSpace) {
+        setNameSpace(nameSpace);
+        // Process addition of leaf to schema node map.
+        ((YangNode) getContainedIn()).processAdditionOfSchemaNodeToCurNodeMap(getName(), getNameSpace(), this);
+    }
+
+    @Override
+    public YangSchemaNodeIdentifier getYangSchemaNodeIdentifier() {
+        return yangSchemaNodeIdentifier;
+    }
+
+    /**
+     * Sets YANG schema node identifier.
+     *
+     * @param yangSchemaNodeIdentifier YANG schema node identifier
+     */
+    public void setYangSchemaNodeIdentifier(YangSchemaNodeIdentifier
+                                                    yangSchemaNodeIdentifier) {
+        if (this.yangSchemaNodeIdentifier == null) {
+            this.yangSchemaNodeIdentifier = new YangSchemaNodeIdentifier();
+        }
+        this.yangSchemaNodeIdentifier = yangSchemaNodeIdentifier;
+    }
+
+    /**
+     * Retrieve the name of leaf list
+     *
+     * @return leaf list name
+     */
+    public String getName() {
+        return yangSchemaNodeIdentifier.getName();
+    }
+
+    /**
+     * Sets name of node.
+     *
+     * @param name name of the node
+     */
+    public void setName(String name) {
+        if (yangSchemaNodeIdentifier == null) {
+            yangSchemaNodeIdentifier = new YangSchemaNodeIdentifier();
+        }
+        yangSchemaNodeIdentifier.setName(name);
+    }
+
+    @Override
+    public YangNamespace getNameSpace() {
+        return yangSchemaNodeIdentifier.getNameSpace();
+    }
+
+    /**
+     * Sets namespace of node.
+     *
+     * @param namespace namespace of the node
+     */
+    public void setNameSpace(YangNamespace namespace) {
+        if (yangSchemaNodeIdentifier == null) {
+            yangSchemaNodeIdentifier = new YangSchemaNodeIdentifier();
+        }
+        yangSchemaNodeIdentifier.setNameSpace(namespace);
+    }
+
+    @Override
+    public YangSchemaNode getNotificationSchemaNode(String notificationNameInEnum)
+            throws DataModelException {
+        throw new DataModelException("Method called for schema node other then module/sub-module");
+    }
+
+    @Override
+    public YangLeafList getReferredSchema() {
+        return referredLeafList;
+    }
+
+    /**
+     * Sets referred schema leaf-list. This is only applicable for grouping.
+     *
+     * @param leafList referred schema leaf-list
+     */
+    public void setReferredSchemaLeafList(YangLeafList leafList) {
+        referredLeafList = leafList;
+    }
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangLeafRef.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangLeafRef.java
new file mode 100644
index 0000000..cdefeda
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangLeafRef.java
@@ -0,0 +1,553 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.datamodel;
+
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.datamodel.utils.ResolvableStatus;
+import org.onosproject.yang.compiler.datamodel.utils.YangConstructType;
+import org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import static java.util.Collections.unmodifiableList;
+import static org.onosproject.yang.compiler.datamodel.utils.ResolvableStatus.INTRA_FILE_RESOLVED;
+import static org.onosproject.yang.compiler.datamodel.utils.ResolvableStatus.RESOLVED;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.LEAFREF_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangErrMsgConstants.DATA_MISSING_ERROR_TAG;
+import static org.onosproject.yang.compiler.datamodel.utils.YangErrMsgConstants.ERROR_PATH_LEAFREF_LEAF;
+import static org.onosproject.yang.compiler.datamodel.utils.YangErrMsgConstants.INSTANCE_REQUIRED_ERROR_APP_TAG;
+import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes.LEAFREF;
+
+/*
+ * Reference:RFC 6020.
+ * The leafref type is used to reference a particular leaf instance in
+ * the data tree.  The "path" substatement (Section 9.9.2) selects a set
+ * of leaf instances, and the leafref value space is the set of values
+ * of these leaf instances.
+ */
+
+/**
+ * Represents the leafref information.
+ *
+ * @param <T> YANG leafref info
+ */
+public class YangLeafRef<T> extends DefaultLocationInfo
+        implements Cloneable, Parsable, Resolvable, Serializable, YangIfFeatureHolder,
+        YangXPathResolver, YangAppErrorHolder {
+
+    private static final long serialVersionUID = 286201644L;
+
+    /**
+     * YANG data type.
+     */
+    private YangType effectiveDataType;
+
+    /**
+     * Referred leaf/leaf-list for the path specified in the leafref type.
+     */
+    private T referredLeafOrLeafList;
+
+    /**
+     * Path of the leafref.
+     */
+    private String path;
+
+    /**
+     * Leafref path type. Either absolute or relative path.
+     */
+    private YangPathArgType pathType;
+
+    /**
+     * List of atomic paths in absolute Path.
+     */
+    private List<YangAtomicPath> atomicPath;
+
+    /**
+     * YANG relative path.
+     */
+    private YangRelativePath relativePath;
+
+    /**
+     * Status of resolution. If completely resolved enum value is "RESOLVED",
+     * if not enum value is "UNRESOLVED", in case reference of grouping/typedef/leafref
+     * is added to uses/type/leafref but it's not resolved value of enum should be
+     * "INTRA_FILE_RESOLVED".
+     */
+    private ResolvableStatus resolvableStatus;
+
+    /**
+     * Require instance status in leafref type.
+     */
+    private boolean requireInstance;
+
+    /**
+     * List of if-feature.
+     */
+    private List<YangIfFeature> ifFeatureList;
+
+    /**
+     * Parent node of the leafref's leaf.
+     */
+    private YangNode parentNode;
+
+    /**
+     * Prefix in the nodes of the leafref path and its imported node name.
+     */
+    private Map<String, String> prefixAndNode;
+
+    /**
+     * Flag to indicate whether the leaf ref is inside grouping.
+     */
+    private boolean inGrouping;
+
+    /**
+     * Returns the prefix in the leafref path and its imported node name.
+     *
+     * @return map of prefix with node
+     */
+    public Map<String, String> getPrefixAndNode() {
+        return prefixAndNode;
+    }
+
+    /**
+     * Sets the prefix in the leaf-ref path and its imported node name.
+     *
+     * @param prefixAndNode prefix with node map
+     */
+    public void setPrefixAndNode(Map<String, String> prefixAndNode) {
+        this.prefixAndNode = prefixAndNode;
+    }
+
+    /**
+     * Returns the parent node from the leafref's leaf.
+     *
+     * @return parent node of the leafref
+     */
+    public YangNode getParentNode() {
+        return parentNode;
+    }
+
+    /**
+     * Sets the parent node from the leafref's leaf.
+     *
+     * @param parentNode parent node
+     */
+    public void setParentNode(YangNode parentNode) {
+        this.parentNode = parentNode;
+    }
+
+    /**
+     * YANG application error information.
+     */
+    private YangAppErrorInfo yangAppErrorInfo;
+
+    /**
+     * Creates a YANG leaf ref.
+     */
+    public YangLeafRef() {
+        yangAppErrorInfo = new YangAppErrorInfo();
+        prefixAndNode = new HashMap<>();
+        atomicPath = new ArrayList<>();
+        ifFeatureList = new ArrayList<>();
+        yangAppErrorInfo.setErrorTag(DATA_MISSING_ERROR_TAG);
+        yangAppErrorInfo.setErrorAppTag(INSTANCE_REQUIRED_ERROR_APP_TAG);
+        yangAppErrorInfo.setErrorAppPath(ERROR_PATH_LEAFREF_LEAF);
+    }
+
+    /**
+     * Returns the status of the require instance in leafref.
+     *
+     * @return status of the require instance
+     */
+    public boolean getRequireInstance() {
+        return requireInstance;
+    }
+
+    /**
+     * Sets the status of the require instance in leafref.
+     *
+     * @param requireInstance status of the require instance
+     */
+    public void setRequireInstance(boolean requireInstance) {
+        this.requireInstance = requireInstance;
+    }
+
+    /**
+     * Returns the type of data.
+     *
+     * @return the data type
+     */
+    public YangType getEffectiveDataType() {
+        return effectiveDataType;
+    }
+
+    /**
+     * Sets the type of data.
+     *
+     * @param effectiveDataType data type
+     */
+    public void setEffectiveDataType(YangType effectiveDataType) {
+        this.effectiveDataType = effectiveDataType;
+    }
+
+    /**
+     * Returns the path of the leafref.
+     *
+     * @return path of the leafref
+     */
+    public String getPath() {
+        return path;
+    }
+
+    /**
+     * Sets the path of the leafref.
+     *
+     * @param path leafref path
+     */
+    public void setPath(String path) {
+        this.path = path;
+    }
+
+    /**
+     * Returns the type of path in the leafref.
+     *
+     * @return type of path
+     */
+    public YangPathArgType getPathType() {
+        return pathType;
+    }
+
+    /**
+     * Sets the type of path in the leafref. It can be either absolute or relative type.
+     *
+     * @param pathType type of path
+     */
+    public void setPathType(YangPathArgType pathType) {
+        this.pathType = pathType;
+    }
+
+    /**
+     * Returns the list of atomic path.
+     *
+     * @return list of atomic path
+     */
+    public List<YangAtomicPath> getAtomicPath() {
+        return unmodifiableList(atomicPath);
+    }
+
+    /**
+     * Sets the list of atomic path.
+     *
+     * @param atomicPath list of atomic path.
+     */
+    public void setAtomicPath(List<YangAtomicPath> atomicPath) {
+        this.atomicPath = atomicPath;
+    }
+
+    /**
+     * Returns the object of relative path.
+     *
+     * @return object of relative path
+     */
+    public YangRelativePath getRelativePath() {
+        return relativePath;
+    }
+
+    /**
+     * Sets the object of relative path.
+     *
+     * @param relativePath object of relative path.
+     */
+    public void setRelativePath(YangRelativePath relativePath) {
+        this.relativePath = relativePath;
+    }
+
+    /**
+     * Returns the object of referred leaf/leaf-list.
+     *
+     * @return object of referred leaf/leaf-list
+     */
+    public T getReferredLeafOrLeafList() {
+        return referredLeafOrLeafList;
+    }
+
+    /**
+     * Sets the object of referred leaf/leaf-list.
+     *
+     * @param targetExtendedInfo object of referred leaf/leaf-list
+     */
+    public void setReferredLeafOrLeafList(T targetExtendedInfo) {
+        this.referredLeafOrLeafList = targetExtendedInfo;
+    }
+
+    @Override
+    public List<YangIfFeature> getIfFeatureList() {
+        return unmodifiableList(ifFeatureList);
+    }
+
+    @Override
+    public void addIfFeatureList(YangIfFeature ifFeature) {
+        ifFeatureList.add(ifFeature);
+    }
+
+    @Override
+    public void setIfFeatureList(List<YangIfFeature> ifFeatureList) {
+        this.ifFeatureList = ifFeatureList;
+    }
+
+    @Override
+    public YangConstructType getYangConstructType() {
+        return LEAFREF_DATA;
+    }
+
+    @Override
+    public void validateDataOnEntry()
+            throws DataModelException {
+        // TODO auto-generated method stub, to be implemented by parser
+    }
+
+    @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 setAppErrorInfo(YangAppErrorInfo yangAppErrorInfo) {
+        this.yangAppErrorInfo = yangAppErrorInfo;
+    }
+
+    @Override
+    public YangAppErrorInfo getAppErrorInfo() {
+        return yangAppErrorInfo;
+    }
+
+    @Override
+    public Object resolve()
+            throws DataModelException {
+
+        if (getReferredLeafOrLeafList() == null) {
+            throw new DataModelException("Linker Error: The leafref does not refer to any leaf/leaf-list." +
+                    " in " +
+                    getLineNumber() + " at " +
+                    getCharPosition() +
+                    " in " + getFileName() + "\"");
+        }
+
+        // Initiate the resolution
+        try {
+            setResolvableStatus(getResolution());
+        } catch (DataModelException e) {
+            throw new DataModelException(e.getMessage());
+        }
+        return null;
+    }
+
+    /**
+     * Returns the resolution status by getting the effective built-in type.
+     *
+     * @return status of resolution
+     * @throws DataModelException a violation of data model rules
+     */
+    private ResolvableStatus getResolution()
+            throws DataModelException {
+
+        if (getReferredLeafOrLeafList() instanceof YangLeaf) {
+            YangLeaf yangLeaf = ((YangLeaf) getReferredLeafOrLeafList());
+            YangType baseType = yangLeaf.getDataType();
+
+            if (baseType.getDataType() == LEAFREF) {
+                YangLeafRef referredLeafRefInfo = (YangLeafRef) (yangLeaf.getDataType().getDataTypeExtendedInfo());
+
+                //Check whether the referred typedef is resolved.
+                if (referredLeafRefInfo.getResolvableStatus() != INTRA_FILE_RESOLVED
+                        && referredLeafRefInfo.getResolvableStatus() != RESOLVED) {
+                    throw new DataModelException("Linker Error: Referred typedef is not resolved for type." +
+                            " in " +
+                            getLineNumber() + " at " +
+                            getCharPosition() +
+                            " in " + getFileName() + "\"");
+                }
+
+                /*
+                 * Check if the referred typedef is intra file resolved, if yes
+                 * sets current status also to intra file resolved .
+                 */
+                if ((referredLeafRefInfo.getResolvableStatus() == INTRA_FILE_RESOLVED)) {
+                    return INTRA_FILE_RESOLVED;
+                }
+
+                // Add the if-feature list from referred leafref to current leafref.
+                List<YangIfFeature> referredLeafIfFeatureListFromLeafref = referredLeafRefInfo.getIfFeatureList();
+                if (referredLeafIfFeatureListFromLeafref != null && !referredLeafIfFeatureListFromLeafref.isEmpty()) {
+                    Iterator<YangIfFeature> referredLeafIfFeature = referredLeafIfFeatureListFromLeafref.iterator();
+                    while (referredLeafIfFeature.hasNext()) {
+                        YangIfFeature ifFeature = referredLeafIfFeature.next();
+                        addIfFeatureList(ifFeature);
+                    }
+                }
+                setEffectiveDataType(referredLeafRefInfo.getEffectiveDataType());
+            } else if (baseType.getDataType() == YangDataTypes.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." +
+                            " in " +
+                            getLineNumber() + " at " +
+                            getCharPosition() +
+                            " in " + getFileName() + "\"");
+                }
+                /*
+                 * Check if the referred typedef is intra file resolved, if yes
+                 * sets current status also to intra file resolved .
+                 */
+                if ((baseType.getResolvableStatus() == INTRA_FILE_RESOLVED)) {
+                    return INTRA_FILE_RESOLVED;
+                }
+                setEffectiveDataType(baseType);
+            } else {
+                setEffectiveDataType(baseType);
+            }
+
+            // Add the if-feature list from referred leaf to current leafref.
+            List<YangIfFeature> referredLeafIfFeatureList = yangLeaf.getIfFeatureList();
+            if (referredLeafIfFeatureList != null && !referredLeafIfFeatureList.isEmpty()) {
+                Iterator<YangIfFeature> referredLeafIfFeature = referredLeafIfFeatureList.iterator();
+                while (referredLeafIfFeature.hasNext()) {
+                    YangIfFeature ifFeature = referredLeafIfFeature.next();
+                    addIfFeatureList(ifFeature);
+                }
+            }
+            return RESOLVED;
+        } else if (getReferredLeafOrLeafList() instanceof YangLeafList) {
+            YangLeafList yangLeafList = ((YangLeafList) getReferredLeafOrLeafList());
+            YangType baseType = yangLeafList.getDataType();
+
+            if (baseType.getDataType() == LEAFREF) {
+                YangLeafRef referredLeafRefInfo = (YangLeafRef) yangLeafList.getDataType().getDataTypeExtendedInfo();
+
+                //Check whether the referred typedef is resolved.
+                if (referredLeafRefInfo.getResolvableStatus() != INTRA_FILE_RESOLVED
+                        && referredLeafRefInfo.getResolvableStatus() != RESOLVED) {
+                    throw new DataModelException("Linker Error: Referred typedef is not resolved for type." +
+                            " in " +
+                            getLineNumber() + " at " +
+                            getCharPosition() +
+                            " in " + getFileName() + "\"");
+                }
+                /*
+                 * Check if the referred typedef is intra file resolved, if yes
+                 * sets current status also to intra file resolved .
+                 */
+                if ((referredLeafRefInfo.getResolvableStatus() == INTRA_FILE_RESOLVED)) {
+                    return INTRA_FILE_RESOLVED;
+                }
+                // Add the if-feature list from referred leafref to current leafref.
+                List<YangIfFeature> referredLeafListIfFeatureListFromLeafref = referredLeafRefInfo.getIfFeatureList();
+                if (referredLeafListIfFeatureListFromLeafref != null
+                        && !referredLeafListIfFeatureListFromLeafref.isEmpty()) {
+                    Iterator<YangIfFeature> referredLeafListIfFeature = referredLeafListIfFeatureListFromLeafref
+                            .iterator();
+                    while (referredLeafListIfFeature.hasNext()) {
+                        YangIfFeature ifFeature = referredLeafListIfFeature.next();
+                        addIfFeatureList(ifFeature);
+                    }
+                }
+                setEffectiveDataType(referredLeafRefInfo.getEffectiveDataType());
+            } else if (baseType.getDataType() == YangDataTypes.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." +
+                            " in " +
+                            getLineNumber() + " at " +
+                            getCharPosition() +
+                            " in " + getFileName() + "\"");
+                }
+                /*
+                 * Check if the referred typedef is intra file resolved, if yes
+                 * sets current status also to intra file resolved .
+                 */
+                if ((baseType.getResolvableStatus() == INTRA_FILE_RESOLVED)) {
+                    return INTRA_FILE_RESOLVED;
+                }
+                setEffectiveDataType(baseType);
+            } else {
+                setEffectiveDataType(baseType);
+            }
+            // Add the if-feature list from referred leaf-list to current leafref.
+            List<YangIfFeature> referredLeafListIfFeatureList = yangLeafList.getIfFeatureList();
+            if (referredLeafListIfFeatureList != null && !referredLeafListIfFeatureList.isEmpty()) {
+                Iterator<YangIfFeature> referredLeafListIfFeature = referredLeafListIfFeatureList.iterator();
+                while (referredLeafListIfFeature.hasNext()) {
+                    YangIfFeature ifFeature = referredLeafListIfFeature.next();
+                    addIfFeatureList(ifFeature);
+                }
+            }
+            return RESOLVED;
+        } else {
+            throw new DataModelException("Linker Error: The leafref must refer only to leaf/leaf-list." +
+                    " in " +
+                    getLineNumber() + " at " +
+                    getCharPosition() +
+                    " in " + getFileName() + "\"");
+        }
+    }
+
+    @Override
+    public YangLeafRef<T> clone()
+            throws CloneNotSupportedException {
+        YangLeafRef<T> clonedLeafRef = (YangLeafRef<T>) super.clone();
+        return clonedLeafRef;
+    }
+
+    /**
+     * Returns flag value indicating whether leafref is inside grouping.
+     *
+     * @return true if leafref is in grouping, false otherwise
+     */
+    public boolean isInGrouping() {
+        return inGrouping;
+    }
+
+    /**
+     * Sets in grouping flag.
+     *
+     * @param inGrouping flag
+     */
+    public void setInGrouping(boolean inGrouping) {
+        this.inGrouping = inGrouping;
+    }
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangLeavesHolder.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangLeavesHolder.java
new file mode 100644
index 0000000..ad39253
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangLeavesHolder.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.datamodel;
+
+import 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 extends LocationInfo {
+
+    /**
+     * 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);
+
+    /**
+     * Adds namespace for leafs and leaf-list, this is used in case of
+     * submodule.
+     *
+     */
+    void setLeafNameSpaceAndAddToParentSchemaMap();
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangLengthRestriction.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangLengthRestriction.java
new file mode 100644
index 0000000..797d1a3
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangLengthRestriction.java
@@ -0,0 +1,200 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.datamodel;
+
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.datamodel.utils.YangConstructType;
+import org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangUint64;
+
+import java.io.Serializable;
+
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.PATTERN_DATA;
+
+/*-
+ * Reference RFC 6020.
+ *
+ * Binary can be restricted with "length" statements alone.
+ *
+ */
+
+/**
+ * Represents the restriction for length data type.
+ */
+public class YangLengthRestriction extends DefaultLocationInfo
+        implements YangDesc, YangReference, Parsable, Serializable, YangAppErrorHolder {
+
+    /*-
+     * 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;
+
+    /**
+     * Textual description.
+     */
+    private String description;
+
+    /**
+     * YANG application error information.
+     */
+    private YangAppErrorInfo yangAppErrorInfo;
+
+    /**
+     * Creates a YANG length restriction object.
+     */
+    public YangLengthRestriction() {
+        setLengthRestriction(new YangRangeRestriction<>());
+        yangAppErrorInfo = new YangAppErrorInfo();
+    }
+
+    /**
+     * 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;
+
+    }
+
+    @Override
+    public YangConstructType getYangConstructType() {
+        return PATTERN_DATA;
+    }
+
+    @Override
+    public void validateDataOnEntry() throws DataModelException {
+        // TODO: implement the method.
+    }
+
+    @Override
+    public void validateDataOnExit() throws DataModelException {
+        // TODO: implement the method.
+    }
+
+    /**
+     * Sets the application's error information.
+     *
+     * @param yangAppErrorInfo the application's error information
+     */
+    @Override
+    public void setAppErrorInfo(YangAppErrorInfo yangAppErrorInfo) {
+        this.yangAppErrorInfo = yangAppErrorInfo;
+    }
+
+    /**
+     * Returns application's error information.
+     *
+     * @return application's error information
+     */
+    @Override
+    public YangAppErrorInfo getAppErrorInfo() {
+        return yangAppErrorInfo;
+    }
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangList.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangList.java
new file mode 100644
index 0000000..343a8f2
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangList.java
@@ -0,0 +1,804 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.datamodel;
+
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.datamodel.utils.DataModelUtils;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.datamodel.utils.YangConstructType;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+
+import static org.onosproject.yang.compiler.datamodel.YangNodeType.LIST_NODE;
+import static org.onosproject.yang.compiler.datamodel.YangSchemaNodeType.YANG_MULTI_INSTANCE_NODE;
+import static org.onosproject.yang.compiler.datamodel.YangStatusType.CURRENT;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.LIST_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes.EMPTY;
+
+/*
+ *  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        |-YangIfFeature    |
+ *                | 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        |-YangMust         |
+ *                | 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      |
+ *                | when         | 7.19.5  | 0..1        |-YangWhen         |
+ *                +--------------+---------+-------------+------------------+
+ */
+
+/**
+ * Represents list data represented in YANG.
+ */
+public abstract class YangList
+        extends YangNode
+        implements YangLeavesHolder, YangCommonInfo, Parsable, CollisionDetector,
+        YangAugmentableNode, YangMustHolder, YangWhenHolder, YangIfFeatureHolder, YangSchemaNode,
+        YangIsFilterContentNodes, YangConfig {
+
+    private static final long serialVersionUID = 806201609L;
+
+    /**
+     * If list maintains config data.
+     */
+    private boolean isConfig;
+
+    /**
+     * Description of list.
+     */
+    private String description;
+
+    /**
+     * Reference RFC 6020.
+     * <p>
+     * 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.
+     * <p>
+     * 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.
+     * <p>
+     * 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".
+     * <p>
+     * All key leafs in a list MUST have the same value for their "config" as
+     * the list itself.
+     * <p>
+     * List of key leaf names.
+     */
+    private List<String> keyList;
+
+    /**
+     * Reference RFC 6020.
+     * <p>
+     * The "unique" statement is used to put constraints on valid list
+     * entries.  It takes as an argument a string that contains a space-
+     * separated list of schema node identifiers, which MUST be given in the
+     * descendant form.  Each such schema node identifier MUST refer to a leaf.
+     * <p>
+     * If one of the referenced leafs represents configuration data, then
+     * all of the referenced leafs MUST represent configuration data.
+     * <p>
+     * The "unique" constraint specifies that the combined values of all the
+     * leaf instances specified in the argument string, including leafs with
+     * default values, MUST be unique within all list entry instances in
+     * which all referenced leafs exist.
+     * <p>
+     * List of unique leaf/leaf-list names
+     */
+    private List<String> uniqueList;
+
+    /**
+     * List of leaves.
+     */
+    private List<YangLeaf> listOfLeaf;
+
+    /**
+     * List of leaf-lists.
+     */
+    private List<YangLeafList> listOfLeafList;
+
+    private List<YangAugment> yangAugmentedInfo = new ArrayList<>();
+
+    /**
+     * Reference RFC 6020.
+     * <p>
+     * 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.
+     * <p>
+     * If no "max-elements" statement is present, it defaults to "unbounded".
+     */
+    private YangMaxElement maxElements;
+
+    /**
+     * Reference RFC 6020.
+     * <p>
+     * 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.
+     * <p>
+     * If no "min-elements" statement is present, it defaults to zero.
+     * <p>
+     * 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:
+     * <p>
+     * o If this ancestor is a case node, the constraint is enforced if any
+     * other node from the case exists.
+     * <p>
+     * o Otherwise, it is enforced if the ancestor node exists.
+     */
+    private YangMinElement minElements;
+
+    /**
+     * reference.
+     */
+    private String reference;
+
+    /**
+     * Status of the node.
+     */
+    private YangStatusType status = CURRENT;
+
+    /**
+     * List of must statement constraints.
+     */
+    private List<YangMust> mustConstraintList;
+
+    /**
+     * When data of the node.
+     */
+    private YangWhen when;
+
+    /**
+     * List of if-feature.
+     */
+    private List<YangIfFeature> ifFeatureList;
+
+    /**
+     * Compiler Annotation.
+     */
+    private transient YangCompilerAnnotation compilerAnnotation;
+
+    /**
+     * Creates a YANG list object.
+     */
+    public YangList() {
+        super(LIST_NODE, new HashMap<>());
+        listOfLeaf = new LinkedList<>();
+        listOfLeafList = new LinkedList<>();
+        mustConstraintList = new LinkedList<>();
+        ifFeatureList = new LinkedList<>();
+        uniqueList = new LinkedList<>();
+        keyList = new LinkedList<>();
+    }
+
+    @Override
+    public void addToChildSchemaMap(YangSchemaNodeIdentifier schemaNodeIdentifier,
+                                    YangSchemaNodeContextInfo yangSchemaNodeContextInfo) {
+        getYsnContextInfoMap().put(schemaNodeIdentifier, yangSchemaNodeContextInfo);
+    }
+
+    @Override
+    public void incrementMandatoryChildCount() {
+        // TODO
+    }
+
+    @Override
+    public void addToDefaultChildMap(YangSchemaNodeIdentifier yangSchemaNodeIdentifier, YangSchemaNode yangSchemaNode) {
+        // TODO
+    }
+
+    @Override
+    public YangSchemaNodeType getYangSchemaNodeType() {
+        return YANG_MULTI_INSTANCE_NODE;
+    }
+
+    /**
+     * Returns the compiler annotation.
+     *
+     * @return the compiler annotation
+     */
+    public YangCompilerAnnotation getCompilerAnnotation() {
+        return compilerAnnotation;
+    }
+
+    /**
+     * Sets the compiler annotation.
+     *
+     * @param compilerAnnotation the compiler annotation to set
+     */
+    public void setCompilerAnnotation(YangCompilerAnnotation compilerAnnotation) {
+        this.compilerAnnotation = compilerAnnotation;
+    }
+
+    /**
+     * Returns the when.
+     *
+     * @return the when
+     */
+    @Override
+    public YangWhen getWhen() {
+        return when;
+    }
+
+    /**
+     * Sets the when.
+     *
+     * @param when the when to set
+     */
+    @Override
+    public void setWhen(YangWhen when) {
+        this.when = when;
+    }
+
+    /**
+     * Returns the config flag.
+     *
+     * @return the isConfig
+     */
+    @Override
+    public boolean isConfig() {
+        return isConfig;
+    }
+
+    /**
+     * Sets the config flag.
+     *
+     * @param isConfig the config flag
+     */
+    @Override
+    public void setConfig(boolean isConfig) {
+        this.isConfig = isConfig;
+    }
+
+    /**
+     * 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 unique field names.
+     *
+     * @return the list of unique field names
+     */
+    public List<String> getUniqueList() {
+        return uniqueList;
+    }
+
+    /**
+     * Sets the list of unique field names.
+     *
+     * @param uniqueList the list of unique field names
+     */
+    private void setUniqueList(List<String> uniqueList) {
+        this.uniqueList = uniqueList;
+    }
+
+    /**
+     * 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<>());
+        }
+
+        if (getKeyList().contains(key)) {
+            throw new DataModelException("A leaf identifier must not appear more than once in the\n" +
+                                                 "   key" +
+                                                 getName() + " in " +
+                                                 getLineNumber() + " at " +
+                                                 getCharPosition() +
+                                                 " in " + getFileName() + "\"");
+        }
+
+        getKeyList().add(key);
+    }
+
+    /**
+     * Adds a unique field name.
+     *
+     * @param unique unique field name.
+     * @throws DataModelException a violation of data model rules
+     */
+    public void addUnique(String unique)
+            throws DataModelException {
+        if (getUniqueList() == null) {
+            setUniqueList(new LinkedList<>());
+        }
+        if (getUniqueList().contains(unique)) {
+            throw new DataModelException("A leaf identifier must not appear more than once in the\n" +
+                                                 "   unique" +
+                                                 getName() + " in " +
+                                                 getLineNumber() + " at " +
+                                                 getCharPosition() +
+                                                 " in " + getFileName() + "\"");
+        }
+        getUniqueList().add(unique);
+    }
+
+    /**
+     * 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 max elements.
+     *
+     * @return the max elements
+     */
+    public YangMaxElement getMaxElements() {
+        return maxElements;
+    }
+
+    /**
+     * Sets the max elements.
+     *
+     * @param max the max elements
+     */
+    public void setMaxElements(YangMaxElement max) {
+        this.maxElements = max;
+    }
+
+    /**
+     * Returns the minimum elements.
+     *
+     * @return the minimum elements
+     */
+    public YangMinElement getMinElements() {
+        return minElements;
+    }
+
+    /**
+     * Sets the minimum elements.
+     *
+     * @param minElements the minimum elements
+     */
+    public void setMinElements(YangMinElement 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 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();
+
+        validateConfig(leaves, leafLists);
+
+        //A list must have atleast one key leaf if config is true
+        if (isConfig && (keys.isEmpty() || leaves.isEmpty()) && !isUsesPresentInList()
+                && !isListPresentInGrouping()) {
+            throw new DataModelException("A list must have atleast one key leaf if config is true; " +
+                                                 getName() + " in " +
+                                                 getLineNumber() + " at " +
+                                                 getCharPosition() +
+                                                 " in " + getFileName() + "\"");
+        } else if (keys != null) {
+            validateKey(leaves, keys);
+        }
+    }
+
+    /**
+     * 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\"." +
+                                                         getName() + " in " +
+                                                         getLineNumber() + " at " +
+                                                         getCharPosition() +
+                                                         " in " + getFileName() + "\"");
+                }
+            }
+        }
+
+        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\"." + getName() + " in " +
+                                                         getLineNumber() + " at " +
+                                                         getCharPosition() +
+                                                         " in " + getFileName() + "\"");
+                }
+            }
+        }
+    }
+
+    /**
+     * Validates key statement of list.
+     *
+     * @param leaves list of leaf 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<String> keys)
+            throws DataModelException {
+        boolean leafFound = false;
+        List<YangLeaf> keyLeaves = 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() == EMPTY) {
+                            throw new DataModelException(" A leaf that is part of the key must not be the built-in " +
+                                                                 "type \"empty\"." +
+                                                                 getName() + " in " +
+                                                                 getLineNumber() + " at " +
+                                                                 getCharPosition() +
+                                                                 " in " + getFileName() + "\"");
+                        }
+                        leafFound = true;
+                        keyLeaves.add(leaf);
+                        break;
+                    }
+                }
+            }
+
+            if (!leafFound && !isUsesPresentInList() && !isListPresentInGrouping()) {
+                throw new DataModelException("An identifier, in key, must refer to a child leaf of the list" +
+                                                     getName() + " in " +
+                                                     getLineNumber() + " at " +
+                                                     getCharPosition() +
+                                                     " in " + getFileName() + "\"");
+            }
+            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." +
+                                                     getName() + " in " +
+                                                     getLineNumber() + " at " +
+                                                     getCharPosition() +
+                                                     " in " + getFileName() + "\"");
+            }
+        }
+    }
+
+    @Override
+    public void detectCollidingChild(String identifierName, YangConstructType dataType)
+            throws DataModelException {
+        // Asks helper to detect colliding child.
+        DataModelUtils.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() + " in " +
+                                                 getLineNumber() + " at " +
+                                                 getCharPosition() +
+                                                 " in " + getFileName() + "\"");
+        }
+    }
+
+    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.
+    }
+
+    @Override
+    public List<YangIfFeature> getIfFeatureList() {
+        return ifFeatureList;
+    }
+
+    @Override
+    public void addIfFeatureList(YangIfFeature ifFeature) {
+        if (getIfFeatureList() == null) {
+            setIfFeatureList(new LinkedList<>());
+        }
+        getIfFeatureList().add(ifFeature);
+    }
+
+    @Override
+    public void setIfFeatureList(List<YangIfFeature> ifFeatureList) {
+        this.ifFeatureList = ifFeatureList;
+    }
+
+    @Override
+    public List<YangMust> getListOfMust() {
+        return mustConstraintList;
+    }
+
+    @Override
+    public void setListOfMust(List<YangMust> mustConstraintList) {
+        this.mustConstraintList = mustConstraintList;
+    }
+
+    @Override
+    public void addMust(YangMust must) {
+        if (getListOfMust() == null) {
+            setListOfMust(new LinkedList<>());
+        }
+        getListOfMust().add(must);
+    }
+
+    @Override
+    public void addAugmentation(YangAugment augmentInfo) {
+        yangAugmentedInfo.add(augmentInfo);
+    }
+
+    @Override
+    public void removeAugmentation(YangAugment augmentInfo) {
+        yangAugmentedInfo.remove(augmentInfo);
+    }
+
+    @Override
+    public List<YangAugment> getAugmentedInfoList() {
+        return yangAugmentedInfo;
+    }
+
+    @Override
+    public void setLeafNameSpaceAndAddToParentSchemaMap() {
+        // Add namespace for all leafs.
+        for (YangLeaf yangLeaf : getListOfLeaf()) {
+            yangLeaf.setLeafNameSpaceAndAddToParentSchemaMap(getNameSpace());
+        }
+        // Add namespace for all leaf list.
+        for (YangLeafList yangLeafList : getListOfLeafList()) {
+            yangLeafList.setLeafNameSpaceAndAddToParentSchemaMap(getNameSpace());
+        }
+    }
+
+    public void cloneAugmentInfo() {
+        yangAugmentedInfo = new ArrayList<>();
+    }
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangMaxElement.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangMaxElement.java
new file mode 100644
index 0000000..5ccd572
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangMaxElement.java
@@ -0,0 +1,86 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.datamodel;
+
+import java.io.Serializable;
+
+import static java.lang.Integer.MAX_VALUE;
+import static org.onosproject.yang.compiler.datamodel.utils.YangErrMsgConstants.OPERATION_FAILED_ERROR_TAG;
+import static org.onosproject.yang.compiler.datamodel.utils.YangErrMsgConstants.TOO_MANY_ELEMENTS_ERROR_APP_TAG;
+
+/**
+ * Represents max element data represented in YANG.
+ */
+public class YangMaxElement extends DefaultLocationInfo
+        implements YangAppErrorHolder, Serializable {
+
+    private static final long serialVersionUID = 807201694L;
+
+    /**
+     * YANG application error information.
+     */
+    private YangAppErrorInfo yangAppErrorInfo;
+
+    /**
+     * Reference:RFC 6020.
+     * <p>
+     * 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.
+     * <p>
+     * If no "max-elements" statement is present, it defaults to "unbounded".
+     */
+    private int maxElement = MAX_VALUE;
+
+    /**
+     * Creates a YANG maximum element.
+     */
+    public YangMaxElement() {
+        yangAppErrorInfo = new YangAppErrorInfo();
+        yangAppErrorInfo.setErrorTag(OPERATION_FAILED_ERROR_TAG);
+        yangAppErrorInfo.setErrorAppTag(TOO_MANY_ELEMENTS_ERROR_APP_TAG);
+    }
+
+    /**
+     * Returns the maximum element value.
+     *
+     * @return the maximum element value
+     */
+    public int getMaxElement() {
+        return maxElement;
+    }
+
+    /**
+     * Sets the maximum element value.
+     *
+     * @param maxElement the maximum element value
+     */
+    public void setMaxElement(int maxElement) {
+        this.maxElement = maxElement;
+    }
+
+    @Override
+    public void setAppErrorInfo(YangAppErrorInfo yangAppErrorInfo) {
+        this.yangAppErrorInfo = yangAppErrorInfo;
+    }
+
+    @Override
+    public YangAppErrorInfo getAppErrorInfo() {
+        return yangAppErrorInfo;
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangMinElement.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangMinElement.java
new file mode 100644
index 0000000..0c04837
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangMinElement.java
@@ -0,0 +1,93 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.datamodel;
+
+import java.io.Serializable;
+
+import static org.onosproject.yang.compiler.datamodel.utils.YangErrMsgConstants.OPERATION_FAILED_ERROR_TAG;
+import static org.onosproject.yang.compiler.datamodel.utils.YangErrMsgConstants.TOO_FEW_ELEMENTS_ERROR_APP_TAG;
+
+/**
+ * Represents minimum element data represented in YANG.
+ */
+public class YangMinElement extends DefaultLocationInfo
+        implements YangAppErrorHolder, Serializable {
+
+    private static final long serialVersionUID = 807201695L;
+
+    /**
+     * YANG application error information.
+     */
+    private YangAppErrorInfo yangAppErrorInfo;
+
+    /**
+     * Reference:RFC 6020.
+     * <p>
+     * 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.
+     * <p>
+     * If no "min-elements" statement is present, it defaults to zero.
+     * <p>
+     * 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:
+     * <p>
+     * If this ancestor is a case node, the constraint is enforced if any
+     * other node from the case exists.
+     * <p>
+     * Otherwise, it is enforced if the ancestor node exists.
+     */
+    private int minElement;
+
+    /**
+     * Creates a YANG minimum element.
+     */
+    public YangMinElement() {
+        yangAppErrorInfo = new YangAppErrorInfo();
+        yangAppErrorInfo.setErrorTag(OPERATION_FAILED_ERROR_TAG);
+        yangAppErrorInfo.setErrorAppTag(TOO_FEW_ELEMENTS_ERROR_APP_TAG);
+    }
+
+    /**
+     * Returns the minimum element value.
+     *
+     * @return the minimum element value
+     */
+    public int getMinElement() {
+        return minElement;
+    }
+
+    /**
+     * Sets the minimum element value.
+     *
+     * @param minElement the minimum element value
+     */
+    public void setMinElement(int minElement) {
+        this.minElement = minElement;
+    }
+
+    @Override
+    public void setAppErrorInfo(YangAppErrorInfo yangAppErrorInfo) {
+        this.yangAppErrorInfo = yangAppErrorInfo;
+    }
+
+    @Override
+    public YangAppErrorInfo getAppErrorInfo() {
+        return yangAppErrorInfo;
+    }
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangModule.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangModule.java
new file mode 100644
index 0000000..360b192
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangModule.java
@@ -0,0 +1,820 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.yang.compiler.datamodel;
+
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.datamodel.utils.YangConstructType;
+
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import static java.util.Collections.unmodifiableList;
+import static org.onosproject.yang.compiler.datamodel.ResolvableType.YANG_AUGMENT;
+import static org.onosproject.yang.compiler.datamodel.ResolvableType.YANG_BASE;
+import static org.onosproject.yang.compiler.datamodel.ResolvableType.YANG_COMPILER_ANNOTATION;
+import static org.onosproject.yang.compiler.datamodel.ResolvableType.YANG_DERIVED_DATA_TYPE;
+import static org.onosproject.yang.compiler.datamodel.ResolvableType.YANG_IDENTITYREF;
+import static org.onosproject.yang.compiler.datamodel.ResolvableType.YANG_IF_FEATURE;
+import static org.onosproject.yang.compiler.datamodel.ResolvableType.YANG_LEAFREF;
+import static org.onosproject.yang.compiler.datamodel.ResolvableType.YANG_USES;
+import static org.onosproject.yang.compiler.datamodel.YangSchemaNodeType.YANG_SINGLE_INSTANCE_NODE;
+import static org.onosproject.yang.compiler.datamodel.utils.DataModelUtils.detectCollidingChildUtil;
+import static org.onosproject.yang.compiler.datamodel.utils.DataModelUtils.linkInterFileReferences;
+import static org.onosproject.yang.compiler.datamodel.utils.DataModelUtils.resolveLinkingForResolutionList;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.MODULE_DATA;
+
+/*-
+ * 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 abstract class YangModule
+        extends YangNode
+        implements YangLeavesHolder, YangDesc, YangReference, Parsable,
+        CollisionDetector, YangReferenceResolver, RpcNotificationContainer,
+        YangFeatureHolder, YangIsFilterContentNodes, YangNamespace {
+
+    private static final long serialVersionUID = 806201610L;
+
+    /**
+     * 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;
+
+    /**
+     * List of feature at root level in the module.
+     */
+    private List<YangFeature> listOfFeature;
+
+    /**
+     * 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 un-prefixed 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;
+
+    /**
+     * If-feature resolution list.
+     */
+    private List<YangResolutionInfo> ifFeatureResolutionList;
+
+    /**
+     * LeafRef resolution list.
+     */
+    private List<YangResolutionInfo> leafRefResolutionList;
+
+    /**
+     * Base resolution list.
+     */
+    private List<YangResolutionInfo> baseResolutionList;
+
+    /**
+     * IdentityRef resolution list.
+     */
+    private List<YangResolutionInfo> identityRefResolutionList;
+
+    /**
+     * Augment resolution list.
+     */
+    private List<YangResolutionInfo> augmentResolutionList;
+
+    /**
+     * Compiler annotation list.
+     */
+    private List<YangResolutionInfo> compilerAnnotationList;
+
+    /**
+     * Extension list.
+     */
+    private List<YangExtension> extensionList;
+
+    /**
+     * Flag to indicate the presence of notification.
+     */
+    private boolean isNotificationPresent;
+
+    /**
+     * Map of notification enum.
+     */
+    private final Map<String, YangSchemaNode> notificationEnumMap;
+
+    /**
+     * List of augments which augmenting to an input in rpc.
+     */
+    private final List<YangAugment> augments;
+
+    /**
+     * YANG defined namespace.
+     */
+    private String namespace;
+
+    /**
+     * Creates a YANG node of module type.
+     */
+    public YangModule() {
+
+        super(YangNodeType.MODULE_NODE, new HashMap<>());
+        derivedTypeResolutionList = new LinkedList<>();
+        augmentResolutionList = new LinkedList<>();
+        usesResolutionList = new LinkedList<>();
+        ifFeatureResolutionList = new LinkedList<>();
+        leafRefResolutionList = new LinkedList<>();
+        baseResolutionList = new LinkedList<>();
+        identityRefResolutionList = new LinkedList<>();
+        compilerAnnotationList = new LinkedList<>();
+        importList = new LinkedList<>();
+        includeList = new LinkedList<>();
+        listOfLeaf = new LinkedList<>();
+        listOfLeafList = new LinkedList<>();
+        extensionList = new LinkedList<>();
+        listOfFeature = new LinkedList<>();
+        notificationEnumMap = new HashMap<>();
+        augments = new LinkedList<>();
+    }
+
+    @Override
+    public void addToChildSchemaMap(YangSchemaNodeIdentifier id,
+                                    YangSchemaNodeContextInfo context) {
+        getYsnContextInfoMap().put(id, context);
+    }
+
+    @Override
+    public void incrementMandatoryChildCount() {
+        // TODO
+    }
+
+    @Override
+    public void addToDefaultChildMap(YangSchemaNodeIdentifier id,
+                                     YangSchemaNode node) {
+        // TODO
+    }
+
+    @Override
+    public YangSchemaNodeType getYangSchemaNodeType() {
+        return YANG_SINGLE_INSTANCE_NODE;
+    }
+
+    /**
+     * 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 unmodifiableList(importList);
+    }
+
+    /**
+     * Adds the imported module information to the import list.
+     *
+     * @param importedModule module being imported
+     */
+    @Override
+    public void addToImportList(YangImport importedModule) {
+        importList.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 unmodifiableList(includeList);
+    }
+
+    /**
+     * Adds the included sub module information to the include list.
+     *
+     * @param includeModule submodule being included
+     */
+    @Override
+    public void addToIncludeList(YangInclude includeModule) {
+        includeList.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 unmodifiableList(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) {
+        listOfLeaf.add(leaf);
+    }
+
+    /**
+     * Returns the list of leaf-list from module.
+     *
+     * @return the list of leaf-list
+     */
+    @Override
+    public List<YangLeafList> getListOfLeafList() {
+        return unmodifiableList(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) {
+        listOfLeafList.add(leafList);
+    }
+
+    @Override
+    public List<YangFeature> getFeatureList() {
+        return unmodifiableList(listOfFeature);
+    }
+
+    @Override
+    public void addFeatureList(YangFeature feature) {
+        listOfFeature.add(feature);
+    }
+
+    @Override
+    public void setListOfFeature(List<YangFeature> listOfFeature) {
+        this.listOfFeature = listOfFeature;
+    }
+
+    /**
+     * 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;
+    }
+
+    /**
+     * Adds extension in extension list.
+     *
+     * @param extension the extension to be added
+     */
+    public void addExtension(YangExtension extension) {
+        extensionList.add(extension);
+    }
+
+    /**
+     * Returns the extension list.
+     *
+     * @return the extension list
+     */
+    public List<YangExtension> getExtensionList() {
+        return unmodifiableList(extensionList);
+    }
+
+    /**
+     * Sets the extension list.
+     *
+     * @param extensionList the list of extension
+     */
+    protected void setExtensionList(List<YangExtension> extensionList) {
+        this.extensionList = extensionList;
+    }
+
+    /**
+     * Adds to extension list.
+     *
+     * @param extension YANG extension
+     */
+    public void addToExtensionList(YangExtension extension) {
+        extensionList.add(extension);
+    }
+
+    /**
+     * Returns the type of the parsed data.
+     *
+     * @return returns MODULE_DATA
+     */
+    @Override
+    public YangConstructType getYangConstructType() {
+        return 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 == YANG_DERIVED_DATA_TYPE) {
+            return unmodifiableList(derivedTypeResolutionList);
+        } else if (type == YANG_USES) {
+            return unmodifiableList(usesResolutionList);
+        } else if (type == YANG_AUGMENT) {
+            return unmodifiableList(augmentResolutionList);
+        } else if (type == YANG_IF_FEATURE) {
+            return unmodifiableList(ifFeatureResolutionList);
+        } else if (type == YANG_LEAFREF) {
+            return unmodifiableList(leafRefResolutionList);
+        } else if (type == YANG_BASE) {
+            return unmodifiableList(baseResolutionList);
+        } else if (type == YANG_IDENTITYREF) {
+            return unmodifiableList(identityRefResolutionList);
+        } else {
+            return unmodifiableList(compilerAnnotationList);
+        }
+    }
+
+    @Override
+    public void addToResolutionList(YangResolutionInfo info,
+                                    ResolvableType type) {
+        if (type == YANG_DERIVED_DATA_TYPE) {
+            derivedTypeResolutionList.add(info);
+        } else if (type == YANG_USES) {
+            usesResolutionList.add(info);
+        } else if (type == YANG_IF_FEATURE) {
+            ifFeatureResolutionList.add(info);
+        } else if (type == YANG_LEAFREF) {
+            leafRefResolutionList.add(info);
+        } else if (type == YANG_BASE) {
+            baseResolutionList.add(info);
+        } else if (type == YANG_AUGMENT) {
+            augmentResolutionList.add(info);
+        } else if (type == YANG_IDENTITYREF) {
+            identityRefResolutionList.add(info);
+        } else if (type == YANG_COMPILER_ANNOTATION) {
+            compilerAnnotationList.add(info);
+        }
+    }
+
+    @Override
+    public void setResolutionList(List<YangResolutionInfo> resolutionList,
+                                  ResolvableType type) {
+        if (type == YANG_DERIVED_DATA_TYPE) {
+            derivedTypeResolutionList = resolutionList;
+        } else if (type == YANG_USES) {
+            usesResolutionList = resolutionList;
+        } else if (type == YANG_IF_FEATURE) {
+            ifFeatureResolutionList.add((YangResolutionInfo) resolutionList);
+        } else if (type == YANG_LEAFREF) {
+            leafRefResolutionList = resolutionList;
+        } else if (type == YANG_BASE) {
+            baseResolutionList = resolutionList;
+        } else if (type == YANG_AUGMENT) {
+            augmentResolutionList = resolutionList;
+        } else if (type == YANG_IDENTITYREF) {
+            identityRefResolutionList = resolutionList;
+        } else if (type == YANG_COMPILER_ANNOTATION) {
+            compilerAnnotationList = resolutionList;
+        }
+    }
+
+    @Override
+    public void addReferencesToImportList(Set<YangNode> yangNodeSet)
+            throws DataModelException {
+        // Run through the imported list to add references.
+        for (YangImport yangImport : getImportList()) {
+            yangImport.addReferenceToImport(yangNodeSet);
+        }
+    }
+
+    @Override
+    public void addReferencesToIncludeList(Set<YangNode> yangNodeSet)
+            throws DataModelException {
+        // Run through the included list to add references.
+        for (YangInclude yangInclude : getIncludeList()) {
+            YangSubModule subModule = yangInclude
+                    .addReferenceToInclude(yangNodeSet);
+
+            // Check if the referred sub-modules parent is self
+            if (!subModule.getBelongsTo().getModuleNode().equals(this)) {
+                yangInclude.reportIncludeError();
+            }
+        }
+    }
+
+    @Override
+    public void setLeafNameSpaceAndAddToParentSchemaMap() {
+        // Add namespace for all leafs.
+        for (YangLeaf yangLeaf : getListOfLeaf()) {
+            yangLeaf.setLeafNameSpaceAndAddToParentSchemaMap(getNameSpace());
+        }
+        // Add namespace for all leaf list.
+        for (YangLeafList yangLeafList : getListOfLeafList()) {
+            yangLeafList.setLeafNameSpaceAndAddToParentSchemaMap(getNameSpace());
+        }
+    }
+
+    @Override
+    public boolean isNotificationPresent() {
+        return isNotificationPresent;
+    }
+
+    @Override
+    public void setNotificationPresenceFlag(boolean notificationPresent) {
+        isNotificationPresent = notificationPresent;
+    }
+
+    @Override
+    public void addToNotificationEnumMap(String enumName,
+                                         YangSchemaNode notification) {
+        notificationEnumMap.put(enumName, notification);
+    }
+
+    @Override
+    public YangSchemaNode getNotificationSchemaNode(String enumName) {
+        return notificationEnumMap.get(enumName);
+    }
+
+    /**
+     * Adds to augment list.
+     *
+     * @param augment augment which is augmenting input
+     */
+    public void addToAugmentList(YangAugment augment) {
+        augments.add(augment);
+    }
+
+    /**
+     * Returns augmented list.
+     *
+     * @return augmented list
+     */
+    public List<YangAugment> getAugmentList() {
+        return unmodifiableList(augments);
+    }
+
+    @Override
+    public String getModuleNamespace() {
+        return namespace;
+    }
+
+    @Override
+    public String getModuleName() {
+        return getName();
+    }
+
+    public void setModuleNamespace(String namespace) {
+        this.namespace = namespace;
+    }
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangMust.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangMust.java
new file mode 100644
index 0000000..45c349f
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangMust.java
@@ -0,0 +1,186 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.yang.compiler.datamodel;
+
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.datamodel.utils.YangConstructType;
+
+import java.io.Serializable;
+
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.MUST_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangErrMsgConstants.MUST_VIOLATION_ERROR_APP_TAG;
+import static org.onosproject.yang.compiler.datamodel.utils.YangErrMsgConstants.OPERATION_FAILED_ERROR_TAG;
+
+/*-
+ * 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 extends DefaultLocationInfo
+        implements YangDesc, YangReference, Parsable, Serializable, YangAppErrorHolder {
+
+    private static final long serialVersionUID = 806201646L;
+
+    /**
+     * Constraint info.
+     */
+    private String constraint;
+
+    /**
+     * Description string.
+     */
+    private String description;
+
+    /**
+     * Reference string.
+     */
+    private String reference;
+
+    /**
+     * YANG application error information.
+     */
+    private YangAppErrorInfo yangAppErrorInfo;
+
+    /**
+     * Creates a YANG must restriction.
+     */
+    public YangMust() {
+        yangAppErrorInfo = new YangAppErrorInfo();
+        yangAppErrorInfo.setErrorTag(OPERATION_FAILED_ERROR_TAG);
+        yangAppErrorInfo.setErrorAppTag(MUST_VIOLATION_ERROR_APP_TAG);
+    }
+
+    /**
+     * Returns the constraint.
+     *
+     * @return the constraint
+     */
+    public String getConstraint() {
+        return constraint;
+    }
+
+    /**
+     * Sets the constraint.
+     *
+     * @param constraint the constraint to set
+     */
+    public void setConstraint(String constraint) {
+        this.constraint = constraint;
+    }
+
+    /**
+     * 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 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
+    }
+
+    @Override
+    public void setAppErrorInfo(YangAppErrorInfo yangAppErrorInfo) {
+        this.yangAppErrorInfo = yangAppErrorInfo;
+    }
+
+    @Override
+    public YangAppErrorInfo getAppErrorInfo() {
+        return yangAppErrorInfo;
+    }
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangMustHolder.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangMustHolder.java
new file mode 100644
index 0000000..8a9b39a
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangMustHolder.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.datamodel;
+
+import java.util.List;
+
+/**
+ * Abstraction of must entity. It is used to abstract the data holders of must.
+ */
+public interface YangMustHolder {
+
+    /**
+     * Returns the list of must from data holder like container / list.
+     *
+     * @return the list of must
+     */
+    List<YangMust> getListOfMust();
+
+    /**
+     * Sets the list of must.
+     *
+     * @param mustConstraintList the list of must to set
+     */
+    void setListOfMust(List<YangMust> mustConstraintList);
+
+    /**
+     * Adds must in data holder like container / list.
+     *
+     * @param must the must to be added
+     */
+    void addMust(YangMust must);
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangNamespace.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangNamespace.java
new file mode 100644
index 0000000..5131c2c
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangNamespace.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.datamodel;
+
+/**
+ * Representation of YANG namespace.
+ */
+public interface YangNamespace {
+
+    /**
+     * Returns module's namespace.
+     *
+     * @return module namespace
+     */
+    String getModuleNamespace();
+
+    /**
+     * Returns module name.
+     *
+     * @return module name
+     */
+    String getModuleName();
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangNode.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangNode.java
new file mode 100644
index 0000000..d962a39
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangNode.java
@@ -0,0 +1,930 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.yang.compiler.datamodel;
+
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
+
+import static org.onosproject.yang.compiler.datamodel.TraversalType.CHILD;
+import static org.onosproject.yang.compiler.datamodel.TraversalType.PARENT;
+import static org.onosproject.yang.compiler.datamodel.TraversalType.SIBILING;
+import static org.onosproject.yang.compiler.datamodel.utils.DataModelUtils.cloneListOfLeaf;
+import static org.onosproject.yang.compiler.datamodel.utils.DataModelUtils.cloneListOfLeafList;
+import static org.onosproject.yang.compiler.datamodel.utils.DataModelUtils.updateClonedLeavesUnionEnumRef;
+
+/**
+ * Represents base class of a node in data model tree.
+ */
+public abstract class YangNode
+        implements Cloneable, Serializable, YangSchemaNode,
+        Comparable<YangNode> {
+
+    private static final long serialVersionUID = 806201601L;
+
+    /**
+     * YANG schema node identifier.
+     */
+    private YangSchemaNodeIdentifier yangSchemaNodeIdentifier;
+
+    /**
+     * 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;
+
+    /**
+     * Priority of the node.
+     */
+    private int priority;
+
+    /**
+     * Flag if the node is for translation.
+     */
+    private boolean isToTranslate = true;
+
+    private transient int lineNumber;
+    private transient int charPosition;
+    private String fileName;
+
+    /**
+     * Map of YANG context information. It is to be consumed by YMS.
+     */
+    private Map<YangSchemaNodeIdentifier, YangSchemaNodeContextInfo> ysnContextInfoMap;
+
+    /**
+     * Count of mandatory YANG schema nodes.
+     */
+    private int mandatoryChildCount;
+
+    /**
+     * Yang revision.
+     */
+    private YangRevision revision;
+
+    /**
+     * Map of default schema nodes.
+     */
+    private Map<YangSchemaNodeIdentifier, YangSchemaNode> defaultChildMap;
+
+    /**
+     * Flag to check whether any descendant node is augmented.
+     */
+    private boolean isDescendantNodeAugmented;
+
+    /**
+     * Referred schema node, only applicable during grouping.
+     */
+    private YangNode referredSchemaNode;
+
+    /**
+     * Returns the priority of the node.
+     *
+     * @return priority of the node
+     */
+    public int getPriority() {
+        return priority;
+    }
+
+    /**
+     * Sets the priority of the node.
+     *
+     * @param priority of the node
+     */
+    public void setPriority(int priority) {
+        this.priority = priority;
+    }
+
+    /**
+     * Creates a YANG node object.
+     */
+    @SuppressWarnings("unused")
+    private YangNode() {
+    }
+
+    /**
+     * Creates a specific type of node.
+     *
+     * @param type              of YANG node
+     * @param ysnContextInfoMap YSN context info map
+     */
+    protected YangNode(YangNodeType type,
+                       Map<YangSchemaNodeIdentifier, YangSchemaNodeContextInfo> ysnContextInfoMap) {
+        nodeType = type;
+        this.ysnContextInfoMap = ysnContextInfoMap;
+    }
+
+    /**
+     * Returns true if descendant node is augmented.
+     *
+     * @return true if descendant node is augmented
+     */
+    public boolean isDescendantNodeAugmented() {
+        return isDescendantNodeAugmented;
+    }
+
+    /**
+     * Sets true if descendant node is augmented.
+     *
+     * @param descendantNodeAugmented true if descendant node is augmented.
+     */
+    public void setDescendantNodeAugmented(boolean descendantNodeAugmented) {
+        isDescendantNodeAugmented = descendantNodeAugmented;
+    }
+
+    /**
+     * 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
+     */
+    public 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
+     */
+    public 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 " + getName() +
+                                                 " in " + getLineNumber() +
+                                                 " at " + getCharPosition() +
+                                                 " in " + getFileName() + "\"");
+        }
+
+        if (newChild.getParent() == null) {
+            newChild.setParent(this);
+        } else if (newChild.getParent() != this) {
+            throw new DataModelException("Node is already part of a tree " +
+                                                 getName() + " in " +
+                                                 getLineNumber() + " at " +
+                                                 getCharPosition() + " in " +
+                                                 getFileName() + "\"");
+        }
+
+        if (newChild.getChild() != null) {
+            throw new DataModelException("Child to be added is not atomic, " +
+                                                 "it already has a child " +
+                                                 getName() + " in " +
+                                                 getLineNumber() + " at " +
+                                                 getCharPosition() + " in " +
+                                                 getFileName() + "\"");
+        }
+
+        if (newChild.getNextSibling() != null) {
+            throw new DataModelException("Child to be added is not atomic, " +
+                                                 "it already has a next " +
+                                                 "sibling " + getName() +
+                                                 " in " + getLineNumber() +
+                                                 " at " + getCharPosition() +
+                                                 " in " + getFileName() + "\"");
+        }
+
+        if (newChild.getPreviousSibling() != null) {
+            throw new DataModelException("Child to be added is not atomic, " +
+                                                 "it already has a previous " +
+                                                 "sibling " + getName() +
+                                                 " in " + getLineNumber() +
+                                                 " at " + getCharPosition() +
+                                                 " in " + getFileName() + "\"");
+        }
+
+        /* First child to be added */
+        if (getChild() == null) {
+            setChild(newChild);
+        } else {
+
+            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);
+            }
+        }
+    }
+
+    /**
+     * Processes addition of schema node child to parent map.
+     *
+     * @param name      name of the node
+     * @param namespace namespace of the node
+     */
+    protected void processAdditionOfSchemaNodeToParentMap(String name,
+                                                          YangNamespace namespace) {
+        processAdditionOfSchemaNodeToMap(name, namespace, this, getParent());
+    }
+
+    /**
+     * Processes addition of schema node child to parent map.
+     *
+     * @param name           name of the node
+     * @param namespace      namespace of the node
+     * @param yangSchemaNode YANG schema node
+     */
+    public void processAdditionOfSchemaNodeToCurNodeMap(String name,
+                                                        YangNamespace namespace,
+                                                        YangSchemaNode yangSchemaNode) {
+        processAdditionOfSchemaNodeToMap(name, namespace, yangSchemaNode, this);
+    }
+
+    /**
+     * Processes addition of schema node child to map.
+     *
+     * @param name                 name of the node
+     * @param namespace            namespace of the node
+     * @param yangSchemaNode       YANG schema node
+     * @param childSchemaMapHolder child schema map holder
+     */
+    private void processAdditionOfSchemaNodeToMap(String name,
+                                                  YangNamespace namespace,
+                                                  YangSchemaNode yangSchemaNode,
+                                                  YangNode childSchemaMapHolder) {
+        // Addition of node to schema node map.
+        // Create YANG schema node identifier with child node name.
+        YangSchemaNodeIdentifier yangSchemaNodeIdentifier = new YangSchemaNodeIdentifier();
+        yangSchemaNodeIdentifier.setName(name);
+        yangSchemaNodeIdentifier.setNameSpace(namespace);
+        // Create YANG schema node context info and set child node.
+        YangSchemaNodeContextInfo yangSchemaNodeContextInfo = new YangSchemaNodeContextInfo();
+        yangSchemaNodeContextInfo.setSchemaNode(yangSchemaNode);
+        // Invoke parent method to add the created entry.
+        try {
+            childSchemaMapHolder.addToChildSchemaMap(yangSchemaNodeIdentifier,
+                                                     yangSchemaNodeContextInfo);
+        } catch (DataModelException e) {
+            //TODO
+        }
+    }
+
+    @Override
+    public int compareTo(YangNode otherNode) {
+        if (priority == otherNode.getPriority()) {
+            return 0;
+        }
+        return ((Integer) otherNode.getPriority()).compareTo(priority);
+    }
+
+    /**
+     * Clones the current node contents and create a new node.
+     *
+     * @param yangUses YANG uses
+     * @return cloned node
+     * @throws CloneNotSupportedException clone is not supported by the referred
+     *                                    node
+     */
+    public YangNode clone(YangUses yangUses)
+            throws CloneNotSupportedException {
+        YangNode clonedNode = (YangNode) super.clone();
+        clonedNode.referredSchemaNode = this;
+        if (clonedNode instanceof YangLeavesHolder) {
+            try {
+                cloneListOfLeaf((YangLeavesHolder) clonedNode, yangUses);
+                cloneListOfLeafList((YangLeavesHolder) clonedNode, yangUses);
+            } catch (DataModelException e) {
+                throw new CloneNotSupportedException(e.getMessage());
+            }
+        }
+
+        clonedNode.setParent(null);
+        clonedNode.setChild(null);
+        clonedNode.setNextSibling(null);
+        clonedNode.setPreviousSibling(null);
+        clonedNode.yangSchemaNodeIdentifier =
+                clonedNode.yangSchemaNodeIdentifier.clone();
+        clonedNode.ysnContextInfoMap = new HashMap<>();
+        if (clonedNode instanceof YangAugmentableNode) {
+            ((YangAugmentableNode) clonedNode).cloneAugmentInfo();
+        }
+        return clonedNode;
+    }
+
+    /**
+     * Clones the subtree from the specified source node to the mentioned target
+     * node. The source and target root node cloning is carried out by the
+     * caller.
+     *
+     * @param srcRootNode source node for sub tree cloning
+     * @param dstRootNode destination node where the sub tree needs to be cloned
+     * @param yangUses    YANG uses
+     * @throws DataModelException data model error
+     */
+    public static void cloneSubTree(YangNode srcRootNode, YangNode dstRootNode,
+                                    YangUses yangUses)
+            throws DataModelException {
+
+        YangNode nextNodeToClone = srcRootNode;
+        TraversalType curTraversal;
+
+        YangNode clonedTreeCurNode = dstRootNode;
+        YangNode newNode = null;
+
+        nextNodeToClone = nextNodeToClone.getChild();
+        if (nextNodeToClone == null) {
+            return;
+        } else {
+            /*
+             * Root level cloning is taken care in the caller.
+             */
+            curTraversal = CHILD;
+        }
+
+        /*
+         * Caller ensures the cloning of the root nodes
+         */
+        try {
+            while (nextNodeToClone != srcRootNode) {
+                if (nextNodeToClone == null) {
+                    throw new DataModelException("Internal error: Cloning " +
+                                                         "failed, source " +
+                                                         "tree null pointer " +
+                                                         "reached " +
+                                                         nextNodeToClone.getName() +
+                                                         " in " + nextNodeToClone.getLineNumber() +
+                                                         " at " + nextNodeToClone.getCharPosition() +
+                                                         " in " + nextNodeToClone.getFileName() + "\"");
+                }
+                if (curTraversal != PARENT) {
+                    newNode = nextNodeToClone.clone(yangUses);
+                    detectCollisionWhileCloning(clonedTreeCurNode, newNode,
+                                                curTraversal);
+                }
+
+                if (curTraversal == CHILD) {
+
+                    /*
+                     * add the new node to the cloned tree.
+                     */
+                    clonedTreeCurNode.addChild(newNode);
+
+                    /*
+                     * update the cloned tree's traversal current node as the
+                     * new node.
+                     */
+                    clonedTreeCurNode = newNode;
+                } else if (curTraversal == SIBILING) {
+
+                    clonedTreeCurNode.addNextSibling(newNode);
+                    clonedTreeCurNode = newNode;
+                } else {
+                    if (clonedTreeCurNode instanceof YangLeavesHolder) {
+                        updateClonedLeavesUnionEnumRef((YangLeavesHolder) clonedTreeCurNode);
+                    }
+                    clonedTreeCurNode = clonedTreeCurNode.getParent();
+                }
+
+                if (curTraversal != PARENT && nextNodeToClone.getChild() != null) {
+                    curTraversal = CHILD;
+
+                    /*
+                     * update the traversal's current node.
+                     */
+                    nextNodeToClone = nextNodeToClone.getChild();
+                } else if (nextNodeToClone.getNextSibling() != null) {
+
+                    curTraversal = SIBILING;
+
+                    nextNodeToClone = nextNodeToClone.getNextSibling();
+                } else {
+                    curTraversal = PARENT;
+                    nextNodeToClone = nextNodeToClone.getParent();
+                }
+            }
+        } catch (CloneNotSupportedException e) {
+            throw new DataModelException("Failed to clone the tree " +
+                                                 nextNodeToClone.getName() +
+                                                 " in " + nextNodeToClone.getLineNumber() +
+                                                 " at " + nextNodeToClone.getCharPosition() +
+                                                 " in " + nextNodeToClone.getFileName() + "\"");
+        }
+    }
+
+    /**
+     * Detects collision when the grouping is deep copied to the uses's parent.
+     *
+     * @param currentNode parent/previous sibling node for the new node
+     * @param newNode     node which has to be added
+     * @param addAs       traversal type of the node
+     * @throws DataModelException data model error
+     */
+    private static void detectCollisionWhileCloning(YangNode currentNode,
+                                                    YangNode newNode,
+                                                    TraversalType addAs)
+            throws DataModelException {
+        if (!(currentNode instanceof CollisionDetector)
+                || !(newNode instanceof Parsable)) {
+            throw new DataModelException("Node in data model tree does not " +
+                                                 "support collision detection " +
+                                                 newNode.getName() + " in " +
+                                                 newNode.getLineNumber() + " at " +
+                                                 newNode.getCharPosition() +
+                                                 " in " + newNode.getFileName() + "\"");
+        }
+
+        CollisionDetector collisionDetector = (CollisionDetector) currentNode;
+        Parsable parsable = (Parsable) newNode;
+        if (addAs == CHILD) {
+            collisionDetector.detectCollidingChild(newNode.getName(),
+                                                   parsable.getYangConstructType());
+        } else if (addAs == SIBILING) {
+            currentNode = currentNode.getParent();
+            if (!(currentNode instanceof CollisionDetector)) {
+                throw new DataModelException("Node in data model tree does " +
+                                                     "not support collision " +
+                                                     "detection" + currentNode.getName() +
+                                                     " in " + currentNode.getLineNumber() +
+                                                     " at " + currentNode.getCharPosition() +
+                                                     " in " + currentNode.getFileName() + "\"");
+            }
+            collisionDetector = (CollisionDetector) currentNode;
+            collisionDetector.detectCollidingChild(newNode.getName(),
+                                                   parsable.getYangConstructType());
+        } else {
+            throw new DataModelException("Error tree cloning " +
+                                                 currentNode.getName() + " in" +
+                                                 " " + currentNode.getLineNumber() +
+                                                 " at " + currentNode.getCharPosition() +
+                                                 " in " + currentNode.getFileName() + "\"");
+        }
+    }
+
+    /**
+     * /** Returns true if translation required.
+     *
+     * @return true if translation required
+     */
+    public boolean isToTranslate() {
+        return isToTranslate;
+    }
+
+    /**
+     * Sest true if translation required.
+     *
+     * @param toTranslate true if translation required.
+     */
+    public void setToTranslate(boolean toTranslate) {
+        isToTranslate = toTranslate;
+    }
+
+    /**
+     * Adds a new next sibling.
+     *
+     * @param newSibling new sibling to be added
+     * @throws DataModelException data model error
+     */
+    private void addNextSibling(YangNode newSibling)
+            throws DataModelException {
+
+        if (newSibling.getNodeType() == null) {
+            throw new DataModelException("Cloned abstract node cannot be " +
+                                                 "inserted into a tree "
+                                                 + getName() + " in " +
+                                                 getLineNumber() + " at " +
+                                                 getCharPosition()
+                                                 + " in " + getFileName() + "\"");
+        }
+
+        if (newSibling.getParent() == null) {
+            /**
+             * Since the siblings needs to have a common parent, set the parent
+             * as the current node's parent
+             */
+            newSibling.setParent(getParent());
+        } else {
+            throw new DataModelException("Node is already part of a tree, " +
+                                                 "and cannot be added as a " +
+                                                 "sibling " + getName() + " in " +
+                                                 getLineNumber() + " at " +
+                                                 getCharPosition() + " in " +
+                                                 getFileName() + "\"");
+        }
+
+        if (newSibling.getPreviousSibling() == null) {
+            newSibling.setPreviousSibling(this);
+            setNextSibling(newSibling);
+        } else {
+            throw new DataModelException("New sibling to be added is not " +
+                                                 "atomic, it already has a " +
+                                                 "previous sibling " +
+                                                 getName() + " in " +
+                                                 getLineNumber() + " at " +
+                                                 getCharPosition() + " in " +
+                                                 getFileName() + "\"");
+        }
+
+        if (newSibling.getChild() != null) {
+            throw new DataModelException("Sibling to be added is not atomic, " +
+                                                 "it already has a child " +
+                                                 getName() + " in " +
+                                                 getLineNumber() + " at " +
+                                                 getCharPosition() + " in " +
+                                                 getFileName() + "\"");
+        }
+
+        if (newSibling.getNextSibling() != null) {
+            throw new DataModelException("Sibling to be added is not atomic, " +
+                                                 "it already has a next " +
+                                                 "sibling " + getName() +
+                                                 " in " + getLineNumber() +
+                                                 " at " + getCharPosition() +
+                                                 " in " + getFileName() + "\"");
+        }
+    }
+
+    @Override
+    public YangSchemaNodeContextInfo getChildSchema(YangSchemaNodeIdentifier dataNodeIdentifier)
+            throws DataModelException {
+        YangSchemaNodeContextInfo childSchemaContext =
+                ysnContextInfoMap.get(dataNodeIdentifier);
+        if (childSchemaContext == null) {
+            throw new DataModelException("Requested " +
+                                                 dataNodeIdentifier.getName() +
+                                                 " is not child in " +
+                                                 getName());
+        }
+        return childSchemaContext;
+    }
+
+    @Override
+    public int getMandatoryChildCount()
+            throws DataModelException {
+        return mandatoryChildCount;
+    }
+
+    @Override
+    public Map<YangSchemaNodeIdentifier, YangSchemaNode> getDefaultChild(YangSchemaNodeIdentifier dataNodeIdentifier) {
+        return defaultChildMap;
+    }
+
+    @Override
+    public boolean isNotificationPresent() throws DataModelException {
+        throw new DataModelException("Method is called for node other than module/sub-module.");
+    }
+
+    @Override
+    public boolean isEmptyDataType() throws DataModelException {
+        throw new DataModelException("Method is called for node other than " +
+                                             "leaf/leaf-list.");
+    }
+
+    /**
+     * Adds child schema in child schema map, this is used to add the schema
+     * to the map in case of leaf as a child.
+     *
+     * @param schemaNodeIdentifier      YANG schema node identifier
+     * @param yangSchemaNodeContextInfo YANG data node context information
+     * @throws DataModelException a violation in data model rule
+     */
+    public abstract void addToChildSchemaMap(YangSchemaNodeIdentifier schemaNodeIdentifier,
+                                             YangSchemaNodeContextInfo yangSchemaNodeContextInfo)
+            throws DataModelException;
+
+    /**
+     * Increments mandatory child count.
+     */
+    public abstract void incrementMandatoryChildCount();
+
+    /**
+     * Sets mandatory child count.
+     *
+     * @param mandatoryChildCount value of mandatory child count
+     */
+    public void setMandatoryChildCount(int mandatoryChildCount) {
+        this.mandatoryChildCount = mandatoryChildCount;
+    }
+
+    /**
+     * Adds default child information to map.
+     *
+     * @param yangSchemaNodeIdentifier YANG schema node identifier
+     * @param yangSchemaNode           YANG schema node
+     */
+    public abstract void addToDefaultChildMap(YangSchemaNodeIdentifier yangSchemaNodeIdentifier,
+                                              YangSchemaNode yangSchemaNode);
+
+    /**
+     * Returns default child map.
+     *
+     * @return default child map
+     */
+    public Map<YangSchemaNodeIdentifier, YangSchemaNode> getDefaultChildMap() {
+        return defaultChildMap;
+    }
+
+    /**
+     * Returns YANG schema node context info map.
+     *
+     * @return YANG schema node context info map
+     */
+    public Map<YangSchemaNodeIdentifier,
+            YangSchemaNodeContextInfo> getYsnContextInfoMap() {
+        return ysnContextInfoMap;
+    }
+
+    /**
+     * Adds namespace for self, next sibling and first child. This is used
+     * after obtaining namespace in case of submodule after performing
+     * linking.
+     */
+    public void setNameSpaceAndAddToParentSchemaMap() {
+        // Get parent namespace.
+        if (getParent() != null) {
+            // Get parent namespace and set namespace for self node.
+            setNameSpace(getParent().getNameSpace());
+            // Process addition of leaf to the child schema map of parent.
+            processAdditionOfSchemaNodeToParentMap(getName(), getNameSpace());
+        } else {
+            // Module/Sub-module
+            setNameSpace((YangNamespace) this);
+        }
+        /*
+         * Check if node contains leaf/leaf-list, if yes add namespace for leaf
+         * and leaf list.
+         */
+        if (this instanceof YangLeavesHolder) {
+            ((YangLeavesHolder) this).setLeafNameSpaceAndAddToParentSchemaMap();
+        }
+    }
+
+    /**
+     * Sets YSN context info map.
+     *
+     * @param ysnContextInfoMap YSN context info map
+     */
+    public void setYsnContextInfoMap(Map<YangSchemaNodeIdentifier,
+            YangSchemaNodeContextInfo> ysnContextInfoMap) {
+        this.ysnContextInfoMap = ysnContextInfoMap;
+    }
+
+    /**
+     * Adds to YSN context info map.
+     *
+     * @param yangSchemaNodeIdentifier  YANG schema node identifier
+     * @param yangSchemaNodeContextInfo YANG schema node context info
+     */
+    public void addToYsnContextInfoMap(YangSchemaNodeIdentifier
+                                               yangSchemaNodeIdentifier, YangSchemaNodeContextInfo
+                                               yangSchemaNodeContextInfo) {
+        getYsnContextInfoMap().put(yangSchemaNodeIdentifier, yangSchemaNodeContextInfo);
+    }
+
+    @Override
+    public void isValueValid(String value)
+            throws DataModelException {
+        throw new DataModelException("Value validation asked for YANG node. "
+                                             + getName() + " in " +
+                                             getLineNumber() + " at " +
+                                             getCharPosition()
+                                             + " in " + getFileName() + "\"");
+    }
+
+    @Override
+    public YangSchemaNodeIdentifier getYangSchemaNodeIdentifier() {
+        return yangSchemaNodeIdentifier;
+    }
+
+    /**
+     * Sets YANG schema node identifier.
+     *
+     * @param yangSchemaNodeIdentifier YANG schema node identifier
+     */
+    public void setYangSchemaNodeIdentifier(YangSchemaNodeIdentifier yangSchemaNodeIdentifier) {
+        if (this.yangSchemaNodeIdentifier == null) {
+            this.yangSchemaNodeIdentifier = new YangSchemaNodeIdentifier();
+        }
+        this.yangSchemaNodeIdentifier = yangSchemaNodeIdentifier;
+    }
+
+    @Override
+    public String getName() {
+        return yangSchemaNodeIdentifier.getName();
+    }
+
+    /**
+     * Sets name of node.
+     *
+     * @param name name of the node
+     */
+    public void setName(String name) {
+        if (yangSchemaNodeIdentifier == null) {
+            yangSchemaNodeIdentifier = new YangSchemaNodeIdentifier();
+        }
+        yangSchemaNodeIdentifier.setName(name);
+    }
+
+    @Override
+    public YangNamespace getNameSpace() {
+        return yangSchemaNodeIdentifier.getNameSpace();
+    }
+
+    /**
+     * Sets namespace of node.
+     *
+     * @param namespace namespace of the node
+     */
+    public void setNameSpace(YangNamespace namespace) {
+        if (yangSchemaNodeIdentifier == null) {
+            yangSchemaNodeIdentifier = new YangSchemaNodeIdentifier();
+        }
+        yangSchemaNodeIdentifier.setNameSpace(namespace);
+    }
+
+    /**
+     * Returns YANG revision.
+     *
+     * @return YANG revision
+     */
+    public YangRevision getRevision() {
+        return revision;
+    }
+
+    /**
+     * Sets YANG revision.
+     *
+     * @param revision YANG revision
+     */
+    public void setRevision(YangRevision revision) {
+        this.revision = revision;
+    }
+
+    @Override
+    public YangSchemaNode getNotificationSchemaNode(String notificationNameInEnum)
+            throws DataModelException {
+        throw new DataModelException("Method called for schema node other " +
+                                             "then module/sub-module");
+    }
+
+    @Override
+    public YangSchemaNode getReferredSchema() {
+        return referredSchemaNode;
+    }
+
+    /**
+     * Returns true if op type info required for node.
+     *
+     * @return true if op type info required for node
+     */
+    public boolean isOpTypeReq() {
+        return this instanceof RpcNotificationContainer ||
+                !(this instanceof InvalidOpTypeHolder) &&
+                        getParent().isOpTypeReq();
+    }
+
+    @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;
+    }
+
+    @Override
+    public String getFileName() {
+        return fileName;
+    }
+
+    @Override
+    public void setFileName(String name) {
+        fileName = name;
+    }
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangNodeIdentifier.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangNodeIdentifier.java
new file mode 100644
index 0000000..f18633a
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangNodeIdentifier.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.datamodel;
+
+import java.io.Serializable;
+
+/**
+ * Represents YANG node identifier which is a combination of prefix and name.
+ */
+public class YangNodeIdentifier extends DefaultLocationInfo
+        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/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangNodeType.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangNodeType.java
new file mode 100644
index 0000000..1b178d3
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangNodeType.java
@@ -0,0 +1,116 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.yang.compiler.datamodel;
+
+/**
+ * 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,
+
+    /**
+     * Identity node.
+     */
+    IDENTITY_NODE,
+
+    /**
+     * Identityref node.
+     */
+    IDENTITYREF_NODE
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangNotification.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangNotification.java
new file mode 100644
index 0000000..096b3dc
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangNotification.java
@@ -0,0 +1,299 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.datamodel;
+
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.datamodel.utils.YangConstructType;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+
+import static java.util.Collections.unmodifiableList;
+import static org.onosproject.yang.compiler.datamodel.YangNodeType.NOTIFICATION_NODE;
+import static org.onosproject.yang.compiler.datamodel.YangSchemaNodeType.YANG_SINGLE_INSTANCE_NODE;
+import static org.onosproject.yang.compiler.datamodel.YangStatusType.CURRENT;
+import static org.onosproject.yang.compiler.datamodel.exceptions.ErrorMessages.COLLISION_DETECTION;
+import static org.onosproject.yang.compiler.datamodel.exceptions.ErrorMessages.NOTIFICATION;
+import static org.onosproject.yang.compiler.datamodel.exceptions.ErrorMessages.getErrorMsgCollision;
+import static org.onosproject.yang.compiler.datamodel.utils.DataModelUtils.detectCollidingChildUtil;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.NOTIFICATION_DATA;
+
+/*
+ * 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        | -YangIfFeature   |
+ *      | 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 abstract class YangNotification
+        extends YangNode
+        implements YangLeavesHolder, YangCommonInfo, Parsable, CollisionDetector,
+        YangAugmentableNode, YangIfFeatureHolder, InvalidOpTypeHolder {
+
+    private static final long serialVersionUID = 806201611L;
+
+    /**
+     * 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 = CURRENT;
+
+    /**
+     * List of if-feature.
+     */
+    private List<YangIfFeature> ifFeatureList;
+
+    private List<YangAugment> yangAugmentedInfo;
+
+    /**
+     * Create a notification node.
+     */
+    public YangNotification() {
+        super(NOTIFICATION_NODE, new HashMap<>());
+        listOfLeaf = new LinkedList<>();
+        listOfLeafList = new LinkedList<>();
+        ifFeatureList = new LinkedList<>();
+        yangAugmentedInfo = new LinkedList<>();
+    }
+
+    @Override
+    public void addToChildSchemaMap(YangSchemaNodeIdentifier id,
+                                    YangSchemaNodeContextInfo context)
+            throws DataModelException {
+        getYsnContextInfoMap().put(id, context);
+    }
+
+    @Override
+    public void incrementMandatoryChildCount() {
+        // TODO
+    }
+
+    @Override
+    public void addToDefaultChildMap(YangSchemaNodeIdentifier id,
+                                     YangSchemaNode yangSchemaNode) {
+        // TODO
+    }
+
+    @Override
+    public YangSchemaNodeType getYangSchemaNodeType() {
+        return YANG_SINGLE_INSTANCE_NODE;
+    }
+
+    @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(getErrorMsgCollision(
+                    COLLISION_DETECTION, getName(), getLineNumber(),
+                    getCharPosition(), NOTIFICATION, getFileName()));
+        }
+    }
+
+    @Override
+    public YangConstructType getYangConstructType() {
+        return 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 unmodifiableList(listOfLeaf);
+    }
+
+    @Override
+    public void setListOfLeaf(List<YangLeaf> leafsList) {
+        listOfLeaf = leafsList;
+    }
+
+    @Override
+    public void addLeaf(YangLeaf leaf) {
+        listOfLeaf.add(leaf);
+    }
+
+    @Override
+    public List<YangLeafList> getListOfLeafList() {
+        return unmodifiableList(listOfLeafList);
+    }
+
+    @Override
+    public void setListOfLeafList(List<YangLeafList> listOfLeafList) {
+        this.listOfLeafList = listOfLeafList;
+    }
+
+    @Override
+    public void addLeafList(YangLeafList leafList) {
+        listOfLeafList.add(leafList);
+    }
+
+    @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;
+    }
+
+    @Override
+    public List<YangIfFeature> getIfFeatureList() {
+        return unmodifiableList(ifFeatureList);
+    }
+
+    @Override
+    public void addIfFeatureList(YangIfFeature ifFeature) {
+        ifFeatureList.add(ifFeature);
+    }
+
+    @Override
+    public void setIfFeatureList(List<YangIfFeature> ifFeatureList) {
+        this.ifFeatureList = ifFeatureList;
+    }
+
+    @Override
+    public void addAugmentation(YangAugment augmentInfo) {
+        yangAugmentedInfo.add(augmentInfo);
+    }
+
+    @Override
+    public void removeAugmentation(YangAugment augmentInfo) {
+        yangAugmentedInfo.remove(augmentInfo);
+    }
+
+    @Override
+    public List<YangAugment> getAugmentedInfoList() {
+        return unmodifiableList(yangAugmentedInfo);
+    }
+
+    @Override
+    public void setLeafNameSpaceAndAddToParentSchemaMap() {
+        // Add namespace for all leafs.
+        for (YangLeaf yangLeaf : listOfLeaf) {
+            yangLeaf.setLeafNameSpaceAndAddToParentSchemaMap(getNameSpace());
+        }
+        // Add namespace for all leaf list.
+        for (YangLeafList yangLeafList : listOfLeafList) {
+            yangLeafList.setLeafNameSpaceAndAddToParentSchemaMap(getNameSpace());
+        }
+    }
+
+    public void cloneAugmentInfo() {
+        yangAugmentedInfo = new ArrayList<>();
+    }
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangOutput.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangOutput.java
new file mode 100644
index 0000000..2c206f0
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangOutput.java
@@ -0,0 +1,227 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.datamodel;
+
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.datamodel.utils.YangConstructType;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+
+import static java.util.Collections.unmodifiableList;
+import static org.onosproject.yang.compiler.datamodel.YangSchemaNodeType.YANG_SINGLE_INSTANCE_NODE;
+import static org.onosproject.yang.compiler.datamodel.exceptions.ErrorMessages.COLLISION_DETECTION;
+import static org.onosproject.yang.compiler.datamodel.exceptions.ErrorMessages.OUTPUT;
+import static org.onosproject.yang.compiler.datamodel.exceptions.ErrorMessages.getErrorMsgCollision;
+import static org.onosproject.yang.compiler.datamodel.utils.DataModelUtils.detectCollidingChildUtil;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.OUTPUT_DATA;
+
+/*
+ * 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 abstract class YangOutput
+        extends YangNode
+        implements YangLeavesHolder, Parsable, CollisionDetector,
+        YangAugmentableNode, YangIsFilterContentNodes, InvalidOpTypeHolder {
+
+    private static final long serialVersionUID = 806201612L;
+
+    /**
+     * List of leaves contained.
+     */
+    private List<YangLeaf> listOfLeaf;
+
+    /**
+     * List of leaf-lists contained.
+     */
+    private List<YangLeafList> listOfLeafList;
+
+    private List<YangAugment> yangAugmentedInfo;
+
+    /**
+     * Create a rpc output node.
+     */
+    public YangOutput() {
+        super(YangNodeType.OUTPUT_NODE, new HashMap<>());
+        listOfLeaf = new LinkedList<>();
+        listOfLeafList = new LinkedList<>();
+        yangAugmentedInfo = new ArrayList<>();
+    }
+
+    @Override
+    public void addToChildSchemaMap(YangSchemaNodeIdentifier id,
+                                    YangSchemaNodeContextInfo context)
+            throws DataModelException {
+        getYsnContextInfoMap().put(id, context);
+    }
+
+    @Override
+    public void incrementMandatoryChildCount() {
+        // For non data nodes, mandatory child to be added to parent node.
+        // TODO
+    }
+
+    @Override
+    public void addToDefaultChildMap(YangSchemaNodeIdentifier id,
+                                     YangSchemaNode yangSchemaNode) {
+        // For non data nodes, default child to be added to parent node.
+        // TODO
+    }
+
+    @Override
+    public YangSchemaNodeType getYangSchemaNodeType() {
+        return YANG_SINGLE_INSTANCE_NODE;
+    }
+
+    @Override
+    public void detectCollidingChild(String idName, YangConstructType dataType)
+            throws DataModelException {
+        // Detect colliding child.
+        detectCollidingChildUtil(idName, dataType, this);
+    }
+
+    @Override
+    public void detectSelfCollision(String identifierName,
+                                    YangConstructType dataType)
+            throws DataModelException {
+        if (getName().equals(identifierName)) {
+            getErrorMsgCollision(COLLISION_DETECTION, getName(),
+                                 getLineNumber(), getCharPosition(),
+                                 OUTPUT, getFileName());
+        }
+    }
+
+    @Override
+    public YangConstructType getYangConstructType() {
+        return 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 unmodifiableList(listOfLeaf);
+    }
+
+    @Override
+    public void addLeaf(YangLeaf leaf) {
+        listOfLeaf.add(leaf);
+    }
+
+    @Override
+    public void setListOfLeaf(List<YangLeaf> leafsList) {
+        listOfLeaf = leafsList;
+    }
+
+    @Override
+    public List<YangLeafList> getListOfLeafList() {
+        return unmodifiableList(listOfLeafList);
+    }
+
+    @Override
+    public void setListOfLeafList(List<YangLeafList> listOfLeafList) {
+        this.listOfLeafList = listOfLeafList;
+    }
+
+    @Override
+    public void addLeafList(YangLeafList leafList) {
+        listOfLeafList.add(leafList);
+    }
+
+    @Override
+    public void addAugmentation(YangAugment augmentInfo) {
+        yangAugmentedInfo.add(augmentInfo);
+    }
+
+    @Override
+    public void removeAugmentation(YangAugment augmentInfo) {
+        yangAugmentedInfo.remove(augmentInfo);
+    }
+
+    @Override
+    public List<YangAugment> getAugmentedInfoList() {
+        return unmodifiableList(yangAugmentedInfo);
+    }
+
+    @Override
+    public void setLeafNameSpaceAndAddToParentSchemaMap() {
+        // Add namespace for all leafs.
+        for (YangLeaf yangLeaf : listOfLeaf) {
+            yangLeaf.setLeafNameSpaceAndAddToParentSchemaMap(getNameSpace());
+        }
+        // Add namespace for all leaf list.
+        for (YangLeafList yangLeafList : listOfLeafList) {
+            yangLeafList.setLeafNameSpaceAndAddToParentSchemaMap(getNameSpace());
+        }
+    }
+
+    public void cloneAugmentInfo() {
+        yangAugmentedInfo = new ArrayList<>();
+    }
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangPathArgType.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangPathArgType.java
new file mode 100644
index 0000000..2f4fd79
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangPathArgType.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.yang.compiler.datamodel;
+
+/**
+ * Represents path argument type in data model tree.
+ */
+public enum YangPathArgType {
+
+    /**
+     * Absolute path.
+     */
+    ABSOLUTE_PATH,
+
+    /**
+     * Relative path.
+     */
+    RELATIVE_PATH
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangPathOperator.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangPathOperator.java
new file mode 100644
index 0000000..b911384
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangPathOperator.java
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.yang.compiler.datamodel;
+
+/**
+ * Represents path-expr in data model tree.
+ */
+public enum YangPathOperator {
+
+    /**
+     *  Path expression contains equal-to.
+     */
+    EQUALTO
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangPathPredicate.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangPathPredicate.java
new file mode 100644
index 0000000..c308d0a
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangPathPredicate.java
@@ -0,0 +1,143 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.yang.compiler.datamodel;
+
+import java.io.Serializable;
+
+/**
+ * Representation of data model node to maintain path predicate in YANG
+ * absolute-path or relative-path.
+ */
+public class YangPathPredicate extends DefaultLocationInfo
+        implements Serializable {
+
+    private static final long serialVersionUID = 806201689L;
+
+    /**
+     * YANG node id.
+     */
+    private YangNodeIdentifier nodeId;
+
+    /**
+     * Left axis represents node-id before equality sign.
+     */
+    private Object leftAxisNode;
+
+    /**
+     * YANG path operator.
+     */
+    private YangPathOperator pathOp;
+
+    /**
+     * YANG right relative path in path-predicate.
+     */
+    private YangRelativePath relPath;
+
+    /**
+     * Right axis node represents the node-id after the equality sign.
+     */
+    private Object rightAxisNode;
+
+    /**
+     * Returns the path expression operator.
+     *
+     * @return path operator
+     */
+    public YangPathOperator getPathOp() {
+        return pathOp;
+    }
+
+    /**
+     * Sets the path expression operator.
+     *
+     * @param pathOp path operator
+     */
+    public void setPathOp(YangPathOperator pathOp) {
+        this.pathOp = pathOp;
+    }
+
+    /**
+     * Returns the right relative path expression.
+     *
+     * @return relative path
+     */
+    public YangRelativePath getRelPath() {
+        return relPath;
+    }
+
+    /**
+     * Sets the right relative path expression.
+     *
+     * @param relPath relative path
+     */
+    public void setRelPath(YangRelativePath relPath) {
+        this.relPath = relPath;
+    }
+
+    /**
+     * Returns the node identifier.
+     *
+     * @return node id
+     */
+    public YangNodeIdentifier getNodeId() {
+        return nodeId;
+    }
+
+    /**
+     * Sets the YANG node identifier.
+     *
+     * @param nodeId node id
+     */
+    public void setNodeId(YangNodeIdentifier nodeId) {
+        this.nodeId = nodeId;
+    }
+
+    /**
+     * Returns the left axis node.
+     *
+     * @return left axis node
+     */
+    public Object getLeftAxisNode() {
+        return leftAxisNode;
+    }
+
+    /**
+     * Sets the left axis node.
+     *
+     * @param leftAxisNode left axis node
+     */
+    public void setLeftAxisNode(Object leftAxisNode) {
+        this.leftAxisNode = leftAxisNode;
+    }
+
+    /**
+     * Returns the right axis node.
+     *
+     * @return right axis node
+     */
+    public Object getRightAxisNode() {
+        return rightAxisNode;
+    }
+
+    /**
+     * Sets the right axis node.
+     *
+     * @param rightAxisNode right axis node
+     */
+    public void setRightAxisNode(Object rightAxisNode) {
+        this.rightAxisNode = rightAxisNode;
+    }
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangPatternRestriction.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangPatternRestriction.java
new file mode 100644
index 0000000..3e0363b
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangPatternRestriction.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.yang.compiler.datamodel;
+
+import java.io.Serializable;
+import java.util.LinkedList;
+import java.util.List;
+
+import static java.util.Collections.unmodifiableList;
+
+/*-
+ *  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 extends DefaultLocationInfo
+        implements Serializable, YangAppErrorHolder {
+
+    private static final long serialVersionUID = 806201649L;
+
+    /**
+     * Pattern restriction defined for the current type.
+     */
+    private final List<String> patternList;
+
+    /**
+     * YANG application error information.
+     */
+    private YangAppErrorInfo yangAppErrorInfo;
+
+    /**
+     * Creates a YANG pattern restriction object.
+     */
+    public YangPatternRestriction() {
+        patternList = new LinkedList<>();
+        yangAppErrorInfo = new YangAppErrorInfo();
+    }
+
+    /**
+     * Returns the pattern restriction defined for the current type.
+     *
+     * @return pattern restriction defined for the current type.
+     */
+    public List<String> getPatternList() {
+        return unmodifiableList(patternList);
+    }
+
+    /**
+     * Adds a new pattern to the list of pattern restriction.
+     *
+     * @param newPattern pattern restriction.
+     */
+    public void addPattern(String newPattern) {
+        patternList.add(newPattern);
+    }
+
+    @Override
+    public void setAppErrorInfo(YangAppErrorInfo yangAppErrorInfo) {
+        this.yangAppErrorInfo = yangAppErrorInfo;
+    }
+
+    @Override
+    public YangAppErrorInfo getAppErrorInfo() {
+        return yangAppErrorInfo;
+    }
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangRangeInterval.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangRangeInterval.java
new file mode 100644
index 0000000..a298d20
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangRangeInterval.java
@@ -0,0 +1,84 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.yang.compiler.datamodel;
+
+import org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangBuiltInDataTypeInfo;
+
+import java.io.Serializable;
+
+/**
+ * Represents single interval information of a range.
+ *
+ * @param <T> range type based on the data type
+ */
+public class YangRangeInterval<T extends YangBuiltInDataTypeInfo<T>> extends DefaultLocationInfo
+        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/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangRangeRestriction.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangRangeRestriction.java
new file mode 100644
index 0000000..f9f0da7
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangRangeRestriction.java
@@ -0,0 +1,308 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.datamodel;
+
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.datamodel.utils.YangConstructType;
+import org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangBuiltInDataTypeInfo;
+import org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes;
+
+import java.io.Serializable;
+import java.util.LinkedList;
+import java.util.List;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static org.onosproject.yang.compiler.datamodel.BuiltInTypeObjectFactory.getDataObjectFromString;
+import static org.onosproject.yang.compiler.datamodel.exceptions.ErrorMessages.getErrorMsg;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.RANGE_DATA;
+
+/*-
+ * 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>>
+        extends DefaultLocationInfo
+        implements YangDesc, YangReference, Parsable, Serializable, YangAppErrorHolder {
+
+    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;
+
+    /**
+     * Textual description.
+     */
+    private String description;
+
+    /**
+     * YANG application error information.
+     */
+    private YangAppErrorInfo yangAppErrorInfo;
+
+    /**
+     * Creates YANG range restriction object.
+     */
+    public YangRangeRestriction() {
+        yangAppErrorInfo = new YangAppErrorInfo();
+    }
+
+    /**
+     * 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;
+    }
+
+    /**
+     * 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(getErrorMsg(
+                    "No range restriction info ",
+                    "", getLineNumber(), getCharPosition(), getFileName() + "\""));
+        }
+        if (getAscendingRangeIntervals().isEmpty()) {
+            throw new DataModelException(getErrorMsg(
+                    "No range interval info ",
+                    "", getLineNumber(), getCharPosition(), getFileName() + "\""));
+        }
+        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(getErrorMsg(
+                    "No range restriction info ",
+                    "", getLineNumber(), getCharPosition(), getFileName() + "\""));
+        }
+        if (getAscendingRangeIntervals().isEmpty()) {
+            throw new DataModelException(getErrorMsg(
+                    "No range interval info ",
+                    "", getLineNumber(), getCharPosition(), getFileName() + "\""));
+        }
+        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 (ascendingRangeIntervals == null) {
+            /*
+             * First interval that is being added, and it must be the smallest
+             * interval.
+             */
+            ascendingRangeIntervals = new LinkedList<>();
+            ascendingRangeIntervals.add(newInterval);
+            return;
+        }
+
+        T curMaxvalue = getMaxRestrictedValue();
+        if (newInterval.getStartValue().compareTo(curMaxvalue) < 1) {
+            throw new DataModelException(getErrorMsg(
+                    "New added range interval is lesser than the old interval(s) ",
+                    "", getLineNumber(), getCharPosition(), getFileName() + "\""));
+        }
+        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
+     */
+    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(getErrorMsg(
+                    "Range interval missing in range restriction. ",
+                    "", getLineNumber(), getCharPosition(), getFileName() + "\""));
+        }
+
+        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
+     * @param fileName      file name
+     * @return true, if the interval is confirming to restriction, false otherwise
+     * @throws DataModelException data model error
+     */
+    boolean isValidInterval(YangRangeInterval rangeInterval, String fileName)
+            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(getErrorMsg(
+                    "Range interval missing in range restriction. ",
+                    "restriction ranges.", getLineNumber(), getCharPosition(), fileName + "\""));
+        }
+
+        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(getErrorMsg(
+                "Range interval doesn't fall within the referred restriction ranges ",
+                "restriction ranges.", getLineNumber(), getCharPosition(), fileName + "\""));
+    }
+
+    /**
+     * 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;
+
+    }
+
+    @Override
+    public YangConstructType getYangConstructType() {
+        return RANGE_DATA;
+    }
+
+    @Override
+    public void validateDataOnEntry() throws DataModelException {
+        // TODO: implement the method.
+    }
+
+    @Override
+    public void validateDataOnExit() throws DataModelException {
+        // TODO: implement the method.
+    }
+
+    @Override
+    public void setAppErrorInfo(YangAppErrorInfo yangAppErrorInfo) {
+        this.yangAppErrorInfo = yangAppErrorInfo;
+    }
+
+    @Override
+    public YangAppErrorInfo getAppErrorInfo() {
+        return yangAppErrorInfo;
+    }
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangReference.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangReference.java
new file mode 100644
index 0000000..74ec1f4
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/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.yang.compiler.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/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangReferenceResolver.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangReferenceResolver.java
new file mode 100644
index 0000000..d47387e
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangReferenceResolver.java
@@ -0,0 +1,147 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.datamodel;
+
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+
+import java.util.List;
+import java.util.Set;
+
+/**
+ * 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/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangRelativePath.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangRelativePath.java
new file mode 100644
index 0000000..007b914
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangRelativePath.java
@@ -0,0 +1,70 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.yang.compiler.datamodel;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * Representation of data model node to maintain relative path defined in YANG path-arg.
+ */
+public class YangRelativePath extends DefaultLocationInfo
+        implements Serializable {
+
+    private static final long serialVersionUID = 806201690L;
+
+    // Relative path ancestor node count the number of node exist between current node to parent node.
+    private int ancestorNodeCount;
+
+    // Absolute path expression.
+    private List<YangAtomicPath> atomicPathList;
+
+    /**
+     * Returns the absolute path.
+     *
+     * @return the absolute path
+     */
+    public List<YangAtomicPath> getAtomicPathList() {
+        return atomicPathList;
+    }
+
+    /**
+     * Sets the absolute path.
+     *
+     * @param atomicPathList Sets the absolute path
+     */
+    public void setAtomicPathList(List<YangAtomicPath> atomicPathList) {
+        this.atomicPathList = atomicPathList;
+    }
+
+    /**
+     * Returns the relative path ancestor count.
+     *
+     * @return the relative path ancestor count
+     */
+    public int getAncestorNodeCount() {
+        return ancestorNodeCount;
+    }
+
+    /**
+     * Sets the relative path ancestor count.
+     *
+     * @param ancestorNodeCount Sets the relative path ancestor count
+     */
+    public void setAncestorNodeCount(int ancestorNodeCount) {
+        this.ancestorNodeCount = ancestorNodeCount;
+    }
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangResolutionInfo.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangResolutionInfo.java
new file mode 100644
index 0000000..b5ad97d
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/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.yang.compiler.datamodel;
+
+import org.onosproject.yang.compiler.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> {
+
+    /**
+     * 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/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangRevision.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangRevision.java
new file mode 100644
index 0000000..9e13144
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangRevision.java
@@ -0,0 +1,175 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.yang.compiler.datamodel;
+
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.datamodel.utils.YangConstructType;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/*
+ *  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
+        extends DefaultLocationInfo
+        implements YangDesc, YangReference, Parsable, Serializable, Comparable<YangRevision> {
+
+    private static final long serialVersionUID = 8062016052L;
+
+    /**
+     * Revision date. Date string in the format "YYYY-MM-DD"
+     */
+    private Date 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 Date getRevDate() {
+        return revDate;
+    }
+
+    /**
+     * Sets the revision date.
+     *
+     * @param revDate the revision date to set
+     */
+    public void setRevDate(Date 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
+
+    }
+
+    @Override
+    public int compareTo(YangRevision obj) {
+        if (this == obj) {
+            return 0;
+        }
+        return getRevDate().compareTo(obj.getRevDate());
+    }
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangRpc.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangRpc.java
new file mode 100644
index 0000000..cd3f30e
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangRpc.java
@@ -0,0 +1,218 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.datamodel;
+
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.datamodel.utils.YangConstructType;
+
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+
+import static java.util.Collections.unmodifiableList;
+import static org.onosproject.yang.compiler.datamodel.YangNodeType.RPC_NODE;
+import static org.onosproject.yang.compiler.datamodel.YangSchemaNodeType.YANG_SINGLE_INSTANCE_NODE;
+import static org.onosproject.yang.compiler.datamodel.YangStatusType.CURRENT;
+import static org.onosproject.yang.compiler.datamodel.exceptions.ErrorMessages.COLLISION_DETECTION;
+import static org.onosproject.yang.compiler.datamodel.exceptions.ErrorMessages.RPC;
+import static org.onosproject.yang.compiler.datamodel.exceptions.ErrorMessages.getErrorMsgCollision;
+import static org.onosproject.yang.compiler.datamodel.utils.DataModelUtils.detectCollidingChildUtil;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.RPC_DATA;
+
+/*
+ * 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        | -YangIfFeature   |
+ *    | 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 abstract class YangRpc
+        extends YangNode
+        implements YangCommonInfo, Parsable,
+        CollisionDetector, YangIfFeatureHolder, InvalidOpTypeHolder {
+
+    private static final long serialVersionUID = 806201613L;
+
+    /**
+     * Description of rpc.
+     */
+    private String description;
+
+    /**
+     * Reference of the module.
+     */
+    private String reference;
+
+    /**
+     * Status of the node.
+     */
+    private YangStatusType status = CURRENT;
+
+    /**
+     * List of if-feature.
+     */
+    private List<YangIfFeature> ifFeatureList;
+
+    /**
+     * Creates a rpc node.
+     */
+    public YangRpc() {
+        super(RPC_NODE, new HashMap<>());
+        ifFeatureList = new LinkedList<>();
+    }
+
+    @Override
+    public void addToChildSchemaMap(YangSchemaNodeIdentifier id,
+                                    YangSchemaNodeContextInfo context)
+            throws DataModelException {
+        getYsnContextInfoMap().put(id, context);
+    }
+
+    @Override
+    public void incrementMandatoryChildCount() {
+        /*
+         * This will maintain all mandatory child which are there inside
+         * input and
+         * output as input/output is non data node.
+         */
+        // TODO
+    }
+
+    @Override
+    public void addToDefaultChildMap(YangSchemaNodeIdentifier id,
+                                     YangSchemaNode yangSchemaNode) {
+        /*
+         * This will maintain all default child which are there inside input and
+         * output as input/output is non data node.
+         */
+        // TODO
+    }
+
+    @Override
+    public YangSchemaNodeType getYangSchemaNodeType() {
+        return YANG_SINGLE_INSTANCE_NODE;
+    }
+
+    @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(getErrorMsgCollision(
+                    COLLISION_DETECTION, getName(), getLineNumber(),
+                    getCharPosition(), RPC, getFileName()));
+        }
+    }
+
+    @Override
+    public YangConstructType getYangConstructType() {
+        return 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;
+    }
+
+    @Override
+    public List<YangIfFeature> getIfFeatureList() {
+        return unmodifiableList(ifFeatureList);
+    }
+
+    @Override
+    public void addIfFeatureList(YangIfFeature ifFeature) {
+        ifFeatureList.add(ifFeature);
+    }
+
+    @Override
+    public void setIfFeatureList(List<YangIfFeature> ifFeatureList) {
+        this.ifFeatureList = ifFeatureList;
+    }
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangSchemaNode.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangSchemaNode.java
new file mode 100644
index 0000000..155f522
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangSchemaNode.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.yang.compiler.datamodel;
+
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+
+import java.util.Map;
+
+/**
+ * Abstraction of YANG data node, used by YMS to abstractly refer the data
+ * nodes in YANG data tree.
+ */
+public interface YangSchemaNode extends LocationInfo {
+
+    /**
+     * Returns type of YANG schema node.
+     *
+     * @return type of YANG schema node
+     */
+    YangSchemaNodeType getYangSchemaNodeType();
+
+    /**
+     * Returns child schema information. It is used by YMS to obtain the child
+     * schema corresponding to data node identifier.
+     *
+     * @param dataNodeIdentifier YANG data node identifier
+     * @return YANG data node context information
+     * @throws DataModelException data model exception in searching the child
+     */
+    YangSchemaNodeContextInfo getChildSchema(YangSchemaNodeIdentifier dataNodeIdentifier)
+            throws DataModelException;
+
+    /**
+     * Validates whether the leaf/leaf-list value is valid as per YANG. It is
+     * used by YMS to validate input value.
+     *
+     * @param value value of leaf/leaf-list
+     * @throws DataModelException a violation in data model rule
+     */
+    void isValueValid(String value)
+            throws DataModelException;
+
+    /**
+     * Returns count of mandatory child nodes, this is used by YMS to identify
+     * whether in request all mandatory child nodes are available.
+     *
+     * @return count of YANG schema nodes
+     * @throws DataModelException a violation in data model rule
+     */
+    int getMandatoryChildCount()
+            throws DataModelException;
+
+    /**
+     * Returns map of default child nodes, this is used by YMS to identify
+     * whether
+     * in request all default child nodes are available.
+     *
+     * @param dataNodeIdentifier YANG data node identifier
+     * @return map of default child nodes
+     */
+    Map<YangSchemaNodeIdentifier, YangSchemaNode> getDefaultChild(
+            YangSchemaNodeIdentifier dataNodeIdentifier);
+
+    /**
+     * Get Java class's package corresponding to the schema node.
+     *
+     * @return java package, it is null, if the Java type is a built in data
+     * type
+     */
+    String getJavaPackage();
+
+    /**
+     * Get Java class or built in data type corresponding to the schema node.
+     *
+     * @return Java class or built in data type corresponding to the schema node
+     */
+    String getJavaClassNameOrBuiltInType();
+
+    /**
+     * Returns schema node identifier.
+     *
+     * @return schema node identifier
+     */
+    YangSchemaNodeIdentifier getYangSchemaNodeIdentifier();
+
+    /**
+     * Returns name of the node.
+     *
+     * @return name of the node
+     */
+    String getName();
+
+    /**
+     * Returns Java attribute name.
+     *
+     * @return Java attribute name
+     */
+    String getJavaAttributeName();
+
+    /**
+     * Returns namespace of the node.
+     *
+     * @return namespace of the node
+     */
+    YangNamespace getNameSpace();
+
+    /**
+     * Checks for the presence of notification in module/sub-module. Exception
+     * will be thrown if this is called for any other node type.
+     *
+     * @return true if notification is present, false otherwise
+     * @throws DataModelException a violation in data model rule
+     */
+    boolean isNotificationPresent()
+            throws DataModelException;
+
+    /**
+     * Returns notification schema node corresponding to the name of
+     * notification as per the generated code enumeration. This is to be used
+     * for notification processing in YMS.
+     *
+     * @param notificationNameInEnum notification name in enum
+     * @return notification schema node
+     * @throws DataModelException a violation in data model rule
+     */
+    YangSchemaNode getNotificationSchemaNode(String notificationNameInEnum)
+            throws DataModelException;
+
+    /**
+     * Returns referred schema node in case of grouping.
+     *
+     * @return referred schema node
+     */
+    YangSchemaNode getReferredSchema();
+
+    /**
+     * Checks for the presence of empty data-type in requested schema node.
+     * Exception will be thrown if this is called for other then leaf/leaf-list
+     * node type.
+     *
+     * @return true if empty data-type is present, false otherwise
+     * @throws DataModelException when fails to do data model operations
+     */
+    boolean isEmptyDataType() throws DataModelException;
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangSchemaNodeContextInfo.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangSchemaNodeContextInfo.java
new file mode 100644
index 0000000..3b42112
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangSchemaNodeContextInfo.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.datamodel;
+
+import java.io.Serializable;
+
+/**
+ * Abstraction of YANG data node context information, used by YMS to abstractly
+ * refer the YANG data nodes schema context information.
+ */
+public class YangSchemaNodeContextInfo extends DefaultLocationInfo
+        implements Serializable {
+
+    private static final long serialVersionUID = 806201613L;
+
+    // Current schema node
+    private YangSchemaNode schemaNode;
+
+    /*
+     * Context switched schema node, it will be non null only for the scenarios
+     * in which context switch is there like augment, choice etc, in this case
+     * this node will point to context switched node like YangAugmentInfo.
+     */
+    private YangSchemaNode contextSwitchedNode;
+
+    // Default instance of YangSchemaNodeContextInfo.
+    public YangSchemaNodeContextInfo() {
+    }
+
+    /**
+     * Returns the YANG schema node.
+     *
+     * @return YANG schema node
+     */
+    public YangSchemaNode getSchemaNode() {
+        return schemaNode;
+    }
+
+    /**
+     * Sets YANG schema node.
+     *
+     * @param schemaNode YANG schema node
+     */
+    void setSchemaNode(YangSchemaNode schemaNode) {
+        this.schemaNode = schemaNode;
+    }
+
+    /**
+     * Returns context switched node.
+     *
+     * @return context switched node
+     */
+    public YangSchemaNode getContextSwitchedNode() {
+        return contextSwitchedNode;
+    }
+
+    /**
+     * Set context switched node.
+     *
+     * @param contextSwitchedNode context switched node
+     */
+    void setContextSwitchedNode(YangSchemaNode contextSwitchedNode) {
+        this.contextSwitchedNode = contextSwitchedNode;
+    }
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangSchemaNodeIdentifier.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangSchemaNodeIdentifier.java
new file mode 100644
index 0000000..4ee96fd
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangSchemaNodeIdentifier.java
@@ -0,0 +1,120 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.datamodel;
+
+import java.io.Serializable;
+import java.util.Objects;
+
+/**
+ * Represents YANG data node identifier which is a combination of name and namespace.
+ * Namespace will be present only if node is module/sub-module or augmented node.
+ */
+public class YangSchemaNodeIdentifier extends DefaultLocationInfo
+        implements Serializable, Cloneable {
+
+    private static final long serialVersionUID = 806201648L;
+
+    // Name of YANG data node.
+    private String name;
+
+    // Namespace of YANG data node.
+    private YangNamespace namespace;
+
+    /**
+     * Creates an instance of YANG data node identifier.
+     */
+    public YangSchemaNodeIdentifier() {
+    }
+
+    /**
+     * Returns the name of the node.
+     *
+     * @return name of the node
+     */
+    public String getName() {
+        return name;
+    }
+
+    /**
+     * Sets name of the node.
+     *
+     * @param name name of the node
+     */
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    /**
+     * Returns namespace of the node.
+     *
+     * @return namespace of the node
+     */
+    public YangNamespace getNameSpace() {
+        return namespace;
+    }
+
+    /**
+     * Sets namespace of the node.
+     *
+     * @param namespace namespace of the node
+     */
+    public void setNameSpace(YangNamespace namespace) {
+        this.namespace = namespace;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+
+        if (this == obj) {
+            return true;
+        }
+        if (obj instanceof YangSchemaNodeIdentifier) {
+            YangSchemaNodeIdentifier other = (YangSchemaNodeIdentifier) obj;
+
+            if (!Objects.equals(name, other.name)) {
+                return false;
+            }
+            String name = namespace.getModuleName();
+            String otherName = other.getNameSpace().getModuleName();
+            if (name != null && otherName != null) {
+                if (namespace.getModuleName()
+                        .equals(other.getNameSpace().getModuleName())) {
+                    return true;
+                }
+
+            }
+            String nSpace = namespace.getModuleNamespace();
+            String otherNspace = other.getNameSpace().getModuleNamespace();
+            if (nSpace != null && otherNspace != null) {
+                if (nSpace.equals(otherNspace)) {
+                    return true;
+                }
+            }
+        }
+        return false;
+    }
+
+    @Override
+    public YangSchemaNodeIdentifier clone() throws CloneNotSupportedException {
+        return (YangSchemaNodeIdentifier) super.clone();
+    }
+
+    @Override
+    public int hashCode() {
+        return 0;
+    }
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangSchemaNodeType.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangSchemaNodeType.java
new file mode 100644
index 0000000..ebcfd0a
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangSchemaNodeType.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.datamodel;
+
+/**
+ * Represents the nature of YANG node, it is used by YMS to abstractly
+ * understand the nature of node without knowing details of the YANG
+ * construct.
+ */
+public enum YangSchemaNodeType {
+
+    /**
+     * Represents single instance of YANG node like YANG container, YANG module,
+     * YANG sub-module. This is used by YMS to abstractly understand the nature
+     * of node.
+     */
+    YANG_SINGLE_INSTANCE_NODE,
+
+    /**
+     * Represents multi instance of YANG node i.e. YANG list.
+     * This is used by YMS to abstractly understand the nature of node.
+     */
+    YANG_MULTI_INSTANCE_NODE,
+
+    /**
+     * Represents single instance of YANG leaf node i.e. YANG leaf
+     * This is used by YMS to abstractly understand the nature of node.
+     */
+    YANG_SINGLE_INSTANCE_LEAF_NODE,
+
+    /**
+     * Represents multi instance of YANG leaf node i.e. YANG leaflist
+     * This is used by YMS to abstractly understand the nature of node.
+     */
+    YANG_MULTI_INSTANCE_LEAF_NODE,
+
+    /**
+     * Represents node which is not a data node.
+     */
+    YANG_NON_DATA_NODE,
+
+    /**
+     * Represents node which cannot be instantiated.
+     */
+    YANG_CHOICE_NODE,
+
+    /**
+     * Represents the Augmented Node.
+     */
+    YANG_AUGMENT_NODE
+
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangStatus.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangStatus.java
new file mode 100644
index 0000000..044ba5a
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangStatus.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.yang.compiler.datamodel;
+
+/**
+ * Abstraction 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/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangStatusType.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangStatusType.java
new file mode 100644
index 0000000..6de81fd
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/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.yang.compiler.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/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangStringRestriction.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangStringRestriction.java
new file mode 100644
index 0000000..1934e8d
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangStringRestriction.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.yang.compiler.datamodel;
+
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.datamodel.utils.YangConstructType;
+import org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangUint64;
+
+import java.io.Serializable;
+import java.math.BigInteger;
+import java.util.ListIterator;
+
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.PATTERN_DATA;
+
+/*-
+ * Reference RFC 6020.
+ *
+ * A string can be restricted with the "length" and "pattern" statements.
+ *
+ */
+
+/**
+ * Represents the restriction for string data type.
+ */
+public class YangStringRestriction extends DefaultLocationInfo
+        implements YangDesc, YangReference, 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;
+
+    /**
+     * 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 rest length restriction on the string data
+     */
+    public void setLengthRestriction(YangRangeRestriction<YangUint64> rest) {
+        lengthRestriction = rest;
+    }
+
+    /**
+     * 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 rest pattern restriction for the type
+     */
+    void setPatternRestriction(YangPatternRestriction rest) {
+        patternRestriction = rest;
+    }
+
+    /**
+     * Adds a new pattern restriction for the type.
+     *
+     * @param newPattern new pattern restriction for the type
+     */
+    public void addPattern(String newPattern) {
+        if (patternRestriction == null) {
+            patternRestriction = new YangPatternRestriction();
+        }
+        patternRestriction.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;
+
+    }
+
+    @Override
+    public YangConstructType getYangConstructType() {
+        return PATTERN_DATA;
+    }
+
+    /**
+     * Validates if the given value is correct as per the length restriction.
+     *
+     * @param valueInString value
+     * @return true, if the value is confirming to length restriction, false otherwise
+     */
+    boolean isValidStringOnLengthRestriction(String valueInString) {
+        if (lengthRestriction == null || lengthRestriction.getAscendingRangeIntervals() == null
+                || lengthRestriction.getAscendingRangeIntervals().isEmpty()) {
+            // Length restriction is optional
+            return true;
+        }
+
+        ListIterator<YangRangeInterval<YangUint64>> rangeListIterator =
+                lengthRestriction.getAscendingRangeIntervals().listIterator();
+        boolean isMatched = false;
+        while (rangeListIterator.hasNext()) {
+            YangRangeInterval rangeInterval = rangeListIterator.next();
+            rangeInterval.setCharPosition(getCharPosition());
+            rangeInterval.setLineNumber(getLineNumber());
+            rangeInterval.setFileName(getFileName());
+            BigInteger startValue = ((YangUint64) rangeInterval.getStartValue()).getValue();
+            BigInteger endValue = ((YangUint64) rangeInterval.getEndValue()).getValue();
+            if (valueInString.length() >= startValue.intValue() &&
+                    valueInString.length() <= endValue.intValue()) {
+                isMatched = true;
+                break;
+            }
+        }
+
+        return isMatched;
+    }
+
+    /**
+     * Validates if the given value is correct as per the pattern restriction.
+     *
+     * @param valueInString value
+     * @return true, if the value is confirming to pattern restriction, false otherwise
+     */
+    boolean isValidStringOnPatternRestriction(String valueInString) {
+        if (patternRestriction == null
+                || patternRestriction.getPatternList().isEmpty()) {
+            // Pattern restriction is optional
+            return true;
+        }
+
+        ListIterator<String> patternListIterator =
+                patternRestriction.getPatternList().listIterator();
+        boolean isMatched = false;
+        while (patternListIterator.hasNext()) {
+            if (valueInString.matches(patternListIterator.next())) {
+                isMatched = true;
+                break;
+            }
+        }
+        return isMatched;
+    }
+
+    @Override
+    public void validateDataOnEntry() throws DataModelException {
+        // TODO: implement the method.
+    }
+
+    @Override
+    public void validateDataOnExit() throws DataModelException {
+        // TODO: implement the method.
+    }
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangSubModule.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangSubModule.java
new file mode 100644
index 0000000..d67b15f
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangSubModule.java
@@ -0,0 +1,827 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.yang.compiler.datamodel;
+
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.datamodel.utils.YangConstructType;
+
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Set;
+
+import static java.util.Collections.unmodifiableList;
+import static org.onosproject.yang.compiler.datamodel.ResolvableType.YANG_AUGMENT;
+import static org.onosproject.yang.compiler.datamodel.ResolvableType.YANG_BASE;
+import static org.onosproject.yang.compiler.datamodel.ResolvableType.YANG_COMPILER_ANNOTATION;
+import static org.onosproject.yang.compiler.datamodel.ResolvableType.YANG_DERIVED_DATA_TYPE;
+import static org.onosproject.yang.compiler.datamodel.ResolvableType.YANG_IDENTITYREF;
+import static org.onosproject.yang.compiler.datamodel.ResolvableType.YANG_IF_FEATURE;
+import static org.onosproject.yang.compiler.datamodel.ResolvableType.YANG_LEAFREF;
+import static org.onosproject.yang.compiler.datamodel.ResolvableType.YANG_USES;
+import static org.onosproject.yang.compiler.datamodel.YangSchemaNodeType.YANG_SINGLE_INSTANCE_NODE;
+import static org.onosproject.yang.compiler.datamodel.utils.DataModelUtils.detectCollidingChildUtil;
+import static org.onosproject.yang.compiler.datamodel.utils.DataModelUtils.linkInterFileReferences;
+import static org.onosproject.yang.compiler.datamodel.utils.DataModelUtils.resolveLinkingForResolutionList;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.SUB_MODULE_DATA;
+
+/*
+ *  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        | - YangFeature    |
+ *                | 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 abstract class YangSubModule
+        extends YangNode
+        implements YangLeavesHolder, YangDesc, YangReference, Parsable,
+        CollisionDetector, YangReferenceResolver, RpcNotificationContainer,
+        YangFeatureHolder, YangIsFilterContentNodes, YangNamespace {
+
+    private static final long serialVersionUID = 806201614L;
+
+    /**
+     * 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;
+
+    /**
+     * List of feature at root level in the module.
+     */
+    private List<YangFeature> listOfFeature;
+
+    /**
+     * 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 un-prefixed 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;
+
+    /**
+     * If-feature resolution list.
+     */
+    private List<YangResolutionInfo> ifFeatureResolutionList;
+
+    /**
+     * LeafRef resolution list.
+     */
+    private List<YangResolutionInfo> leafRefResolutionList;
+
+    /**
+     * Base resolution list.
+     */
+    private List<YangResolutionInfo> baseResolutionList;
+
+    /**
+     * IdentityRef resolution list.
+     */
+    private List<YangResolutionInfo> identityRefResolutionList;
+
+    /**
+     * Compiler annotation list.
+     */
+    private List<YangResolutionInfo> compilerAnnotationList;
+
+    /**
+     * extension list.
+     */
+    private List<YangExtension> extensionList;
+
+    /**
+     * Augment resolution list.
+     */
+    private List<YangResolutionInfo> augmentResolutionList;
+
+    /**
+     * Flag to indicate the presence of notification.
+     */
+    private boolean isNotificationPresent;
+
+    /**
+     * Map of notification enum.
+     */
+    private final Map<String, YangSchemaNode> notificationEnumMap;
+
+    /**
+     * List of augments which are augmenting input.
+     */
+    private final List<YangAugment> augments;
+
+    /**
+     * YANG defined namespace.
+     */
+    private String namespace;
+
+    /**
+     * Creates a sub module node.
+     */
+    public YangSubModule() {
+        super(YangNodeType.SUB_MODULE_NODE, new HashMap<>());
+        derivedTypeResolutionList = new LinkedList<>();
+        augmentResolutionList = new LinkedList<>();
+        usesResolutionList = new LinkedList<>();
+        ifFeatureResolutionList = new LinkedList<>();
+        leafRefResolutionList = new LinkedList<>();
+        baseResolutionList = new LinkedList<>();
+        identityRefResolutionList = new LinkedList<>();
+        compilerAnnotationList = new LinkedList<>();
+        importList = new LinkedList<>();
+        includeList = new LinkedList<>();
+        listOfLeaf = new LinkedList<>();
+        listOfLeafList = new LinkedList<>();
+        extensionList = new LinkedList<>();
+        compilerAnnotationList = new LinkedList<>();
+        listOfFeature = new LinkedList<>();
+        notificationEnumMap = new HashMap<>();
+        augments = new LinkedList<>();
+    }
+
+    @Override
+    public void addToChildSchemaMap(YangSchemaNodeIdentifier id,
+                                    YangSchemaNodeContextInfo context) {
+        getYsnContextInfoMap().put(id, context);
+    }
+
+    @Override
+    public void incrementMandatoryChildCount() {
+        // TODO
+    }
+
+    @Override
+    public void addToDefaultChildMap(YangSchemaNodeIdentifier id,
+                                     YangSchemaNode yangSchemaNode) {
+        // TODO
+    }
+
+    @Override
+    public YangSchemaNodeType getYangSchemaNodeType() {
+        return YANG_SINGLE_INSTANCE_NODE;
+    }
+
+    /**
+     * 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 unmodifiableList(importList);
+    }
+
+    /**
+     * Adds the imported module information to the import list.
+     *
+     * @param importedModule module being imported
+     */
+    @Override
+    public void addToImportList(YangImport importedModule) {
+        importList.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 unmodifiableList(includeList);
+    }
+
+    /**
+     * Returns the included sub module information to the include list.
+     *
+     * @param includeModule submodule being included
+     */
+    @Override
+    public void addToIncludeList(YangInclude includeModule) {
+        includeList.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 unmodifiableList(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) {
+        listOfLeaf.add(leaf);
+    }
+
+    /**
+     * Returns the list of leaf-list.
+     *
+     * @return the list of leaf-list
+     */
+    @Override
+    public List<YangLeafList> getListOfLeafList() {
+        return unmodifiableList(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) {
+        listOfLeafList.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 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 id, YangConstructType dataType)
+            throws DataModelException {
+        // Asks helper to detect colliding child.
+        detectCollidingChildUtil(id, dataType, this);
+    }
+
+    @Override
+    public void detectSelfCollision(String id, YangConstructType dataType)
+            throws DataModelException {
+        // Not required as module doesn't have any parent.
+    }
+
+    @Override
+    public List<YangResolutionInfo> getUnresolvedResolutionList(ResolvableType type) {
+        if (type == YANG_DERIVED_DATA_TYPE) {
+            return unmodifiableList(derivedTypeResolutionList);
+        } else if (type == YANG_USES) {
+            return unmodifiableList(usesResolutionList);
+        } else if (type == YANG_AUGMENT) {
+            return unmodifiableList(augmentResolutionList);
+        } else if (type == YANG_IF_FEATURE) {
+            return unmodifiableList(ifFeatureResolutionList);
+        } else if (type == YANG_LEAFREF) {
+            return unmodifiableList(leafRefResolutionList);
+        } else if (type == YANG_BASE) {
+            return unmodifiableList(baseResolutionList);
+        } else if (type == YANG_IDENTITYREF) {
+            return unmodifiableList(identityRefResolutionList);
+        } else {
+            return unmodifiableList(compilerAnnotationList);
+        }
+    }
+
+    @Override
+    public void addToResolutionList(YangResolutionInfo resolutionInfo,
+                                    ResolvableType type) {
+        if (type == YANG_DERIVED_DATA_TYPE) {
+            derivedTypeResolutionList.add(resolutionInfo);
+        } else if (type == YANG_USES) {
+            usesResolutionList.add(resolutionInfo);
+        } else if (type == YANG_IF_FEATURE) {
+            ifFeatureResolutionList.add(resolutionInfo);
+        } else if (type == YANG_LEAFREF) {
+            leafRefResolutionList.add(resolutionInfo);
+        } else if (type == YANG_BASE) {
+            baseResolutionList.add(resolutionInfo);
+        } else if (type == YANG_AUGMENT) {
+            augmentResolutionList.add(resolutionInfo);
+        } else if (type == YANG_IDENTITYREF) {
+            identityRefResolutionList.add(resolutionInfo);
+        } else if (type == YANG_COMPILER_ANNOTATION) {
+            compilerAnnotationList.add(resolutionInfo);
+        }
+    }
+
+    @Override
+    public void setResolutionList(List<YangResolutionInfo> resolutionList,
+                                  ResolvableType type) {
+        if (type == YANG_DERIVED_DATA_TYPE) {
+            derivedTypeResolutionList = resolutionList;
+        } else if (type == YANG_USES) {
+            usesResolutionList = resolutionList;
+        } else if (type == YANG_IF_FEATURE) {
+            ifFeatureResolutionList.add((YangResolutionInfo) resolutionList);
+        } else if (type == YANG_LEAFREF) {
+            leafRefResolutionList = resolutionList;
+        } else if (type == YANG_BASE) {
+            baseResolutionList = resolutionList;
+        } else if (type == YANG_AUGMENT) {
+            augmentResolutionList = resolutionList;
+        } else if (type == YANG_IDENTITYREF) {
+            identityRefResolutionList = resolutionList;
+        } else if (type == YANG_COMPILER_ANNOTATION) {
+            compilerAnnotationList = 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 {
+        belongsTo.linkWithModule(yangNodeSet);
+        namespace = ((YangNamespace) belongsTo.getModuleNode())
+                .getModuleNamespace();
+    }
+
+    @Override
+    public void addReferencesToIncludeList(Set<YangNode> yangNodeSet)
+            throws DataModelException {
+        // Run through the included list to add references.
+        for (YangInclude yangInclude : getIncludeList()) {
+            YangSubModule subModule = yangInclude.addReferenceToInclude(yangNodeSet);
+            // Check if the referred sub-modules parent is self
+            if (!Objects.equals(subModule.getBelongsTo().getModuleNode(), getBelongsTo()
+                    .getModuleNode())) {
+                yangInclude.reportIncludeError();
+            }
+        }
+    }
+
+    @Override
+    public void addReferencesToImportList(Set<YangNode> yangNodeSet)
+            throws DataModelException {
+        // Run through the imported list to add references.
+        for (YangImport yangImport : getImportList()) {
+            yangImport.addReferenceToImport(yangNodeSet);
+        }
+    }
+
+    @Override
+    public List<YangFeature> getFeatureList() {
+        return unmodifiableList(listOfFeature);
+    }
+
+    @Override
+    public void addFeatureList(YangFeature feature) {
+        listOfFeature.add(feature);
+    }
+
+    @Override
+    public void setListOfFeature(List<YangFeature> listOfFeature) {
+        this.listOfFeature = listOfFeature;
+    }
+
+    /**
+     * Adds extension in extension list.
+     *
+     * @param extension the extension to be added
+     */
+    public void addExtension(YangExtension extension) {
+        extensionList.add(extension);
+    }
+
+    /**
+     * Returns the extension list.
+     *
+     * @return the extension list
+     */
+    public List<YangExtension> getExtensionList() {
+        return unmodifiableList(extensionList);
+    }
+
+    /**
+     * Sets the extension list.
+     *
+     * @param extensionList the list of extension
+     */
+    public void setExtensionList(List<YangExtension> extensionList) {
+        this.extensionList = extensionList;
+    }
+
+    @Override
+    public void setLeafNameSpaceAndAddToParentSchemaMap() {
+        // Add namespace for all leafs.
+        for (YangLeaf yangLeaf : getListOfLeaf()) {
+            yangLeaf.setLeafNameSpaceAndAddToParentSchemaMap(getNameSpace());
+        }
+        // Add namespace for all leaf list.
+        for (YangLeafList yangLeafList : getListOfLeafList()) {
+            yangLeafList.setLeafNameSpaceAndAddToParentSchemaMap(getNameSpace());
+        }
+    }
+
+
+    @Override
+    public boolean isNotificationPresent() {
+        return isNotificationPresent;
+    }
+
+    @Override
+    public void setNotificationPresenceFlag(boolean notificationPresent) {
+        isNotificationPresent = notificationPresent;
+    }
+
+    @Override
+    public void addToNotificationEnumMap(String enumName,
+                                         YangSchemaNode notification) {
+        notificationEnumMap.put(enumName, notification);
+    }
+
+    @Override
+    public YangSchemaNode getNotificationSchemaNode(String enumName) {
+        return notificationEnumMap.get(enumName);
+    }
+
+    /**
+     * Adds to augment list.
+     *
+     * @param augment augment which is augmenting input
+     */
+    public void addToAugmentList(YangAugment augment) {
+        augments.add(augment);
+    }
+
+    /**
+     * Returns augmented list.
+     *
+     * @return augmented list
+     */
+    public List<YangAugment> getAugmentList() {
+        return unmodifiableList(augments);
+    }
+
+    @Override
+    public String getModuleNamespace() {
+        return namespace;
+    }
+
+    @Override
+    public String getModuleName() {
+        return getName();
+    }
+
+    public void setModuleNamespace(String namespace) {
+        this.namespace = namespace;
+    }
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangTranslatorOperatorNode.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangTranslatorOperatorNode.java
new file mode 100644
index 0000000..7045109
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangTranslatorOperatorNode.java
@@ -0,0 +1,25 @@
+
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.datamodel;
+
+/**
+ * Abstraction of an entity which provides info about whether to translate module/submodule in manager and service
+ * classes.
+ */
+public interface YangTranslatorOperatorNode {
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangType.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangType.java
new file mode 100644
index 0000000..8105d37
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangType.java
@@ -0,0 +1,557 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.datamodel;
+
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.datamodel.utils.DataModelUtils;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.datamodel.utils.ResolvableStatus;
+import org.onosproject.yang.compiler.datamodel.utils.YangConstructType;
+import org.onosproject.yang.compiler.datamodel.utils.builtindatatype.DataTypeException;
+import org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes;
+import org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangUint64;
+
+import java.io.Serializable;
+import java.math.BigInteger;
+import java.util.Iterator;
+import java.util.ListIterator;
+
+import static org.onosproject.yang.compiler.datamodel.BuiltInTypeObjectFactory.getDataObjectFromString;
+import static org.onosproject.yang.compiler.datamodel.utils.ResolvableStatus.UNRESOLVED;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.TYPE_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypeUtils.isOfRangeRestrictedType;
+import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.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        | - path for referred leaf/leaf-list |
+ * | 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> extends DefaultLocationInfo
+        implements Cloneable, Parsable, Resolvable, Serializable {
+
+    private static final long serialVersionUID = 8062016054L;
+
+    /**
+     * YANG node identifier.
+     */
+    private YangNodeIdentifier nodeId;
+
+    /**
+     * 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;
+
+
+    /**
+     * Resolution for interfile grouping.
+     */
+    private boolean isTypeForInterFileGroupingResolution;
+
+    /**
+     * Resolved within the grouping where the type is used.
+     */
+    private boolean isTypeNotResolvedTillRootNode;
+
+    /**
+     * Creates a YANG type object.
+     */
+    public YangType() {
+
+        nodeId = new YangNodeIdentifier();
+        resolvableStatus = UNRESOLVED;
+    }
+
+    /**
+     * Returns prefix associated with data type name.
+     *
+     * @return prefix associated with data type name
+     */
+    public String getPrefix() {
+        return nodeId.getPrefix();
+    }
+
+    /**
+     * Sets prefix associated with data type name.
+     *
+     * @param prefix prefix associated with data type name
+     */
+    public void setPrefix(String prefix) {
+        nodeId.setPrefix(prefix);
+    }
+
+    /**
+     * Returns the name of data type.
+     *
+     * @return the name of data type
+     */
+    public String getDataTypeName() {
+        return nodeId.getName();
+    }
+
+    /**
+     * Sets the name of the data type.
+     *
+     * @param typeName the name to set
+     */
+    public void setDataTypeName(String typeName) {
+        nodeId.setName(typeName);
+    }
+
+    /**
+     * 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 getNodeId() {
+        return nodeId;
+    }
+
+    /**
+     * Sets node identifier.
+     *
+     * @param nodeId the node identifier
+     */
+    public void setNodeId(YangNodeIdentifier nodeId) {
+        this.nodeId = nodeId;
+    }
+
+    /**
+     * Resets the class attributes to its default value.
+     */
+    public void resetYangType() {
+        nodeId = new YangNodeIdentifier();
+        resolvableStatus = UNRESOLVED;
+        dataType = null;
+        dataTypeExtendedInfo = null;
+    }
+
+    /**
+     * Returns the type of the parsed data.
+     *
+     * @return returns TYPE_DATA
+     */
+    @Override
+    public YangConstructType getYangConstructType() {
+        return 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 Object 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. "
+                                                 + " in " +
+                                                 getLineNumber() + " at " +
+                                                 getCharPosition()
+                                                 + " in " + getFileName() + "\"");
+        }
+
+        // Check if the derived info is present.
+        YangDerivedInfo<?> derivedInfo = (YangDerivedInfo<?>) getDataTypeExtendedInfo();
+        if (derivedInfo == null) {
+            throw new DataModelException("Linker Error: Derived information is missing. " + " in " +
+                                                 getLineNumber() + " at " +
+                                                 getCharPosition()
+                                                 + " in " + getFileName() + "\"");
+        }
+
+        // Initiate the resolution
+        try {
+            setResolvableStatus(derivedInfo.resolve());
+        } catch (DataModelException e) {
+            throw new DataModelException(e.getMessage());
+        }
+        return null;
+    }
+
+    /**
+     * Validates the input data value against the permissible value for the
+     * type as per the YANG file.
+     *
+     * @param value input data value
+     * @throws DataModelException a violation of data model rules
+     */
+    void isValidValue(String value)
+            throws DataModelException {
+        switch (getDataType()) {
+            case INT8:
+            case INT16:
+            case INT32:
+            case INT64:
+            case UINT8:
+            case UINT16:
+            case UINT32:
+            case UINT64: {
+                if (getDataTypeExtendedInfo() == null) {
+                    getDataObjectFromString(value, getDataType());
+                } else {
+                    if (!((YangRangeRestriction) getDataTypeExtendedInfo()).isValidValueString(value)) {
+                        throw new DataTypeException("YANG file error : Input value \"" + value + "\" is not a valid " +
+                                                            getDataType());
+                    }
+                }
+                break;
+            }
+            case DECIMAL64: {
+                // Fraction-Digits and range needs to get it from yang
+                YangDecimal64<YangRangeRestriction> decimal64 =
+                        (YangDecimal64<YangRangeRestriction>) getDataTypeExtendedInfo();
+                validateDecimal64(value, decimal64.getFractionDigit(),
+                                  decimal64.getRangeRestrictedExtendedInfo());
+                break;
+            }
+            case STRING: {
+                if (getDataTypeExtendedInfo() == null) {
+                    break;
+                } else if (!(((YangStringRestriction) getDataTypeExtendedInfo()).isValidStringOnLengthRestriction(value)
+                        && ((YangStringRestriction) getDataTypeExtendedInfo())
+                        .isValidStringOnPatternRestriction(value))) {
+                    throw new DataTypeException("YANG file error : Input value \"" + value + "\" is not a valid " +
+                                                        getDataType());
+                }
+                break;
+            }
+            case BOOLEAN:
+                if (!(value.equals(DataModelUtils.TRUE) || value.equals(DataModelUtils.FALSE))) {
+                    throw new DataTypeException("YANG file error : Input value \"" + value + "\" is not a valid " +
+                                                        getDataType());
+                }
+                break;
+            case ENUMERATION: {
+                Iterator<YangEnum> iterator = ((YangEnumeration) getDataTypeExtendedInfo()).getEnumSet().iterator();
+                boolean isValidated = false;
+                while (iterator.hasNext()) {
+                    YangEnum enumTemp = iterator.next();
+                    if (enumTemp.getNamedValue().equals(value)) {
+                        isValidated = true;
+                        break;
+                    }
+                }
+
+                if (!isValidated) {
+                    throw new DataTypeException("YANG file error : Input value \"" + value + "\" is not a valid " +
+                                                        getDataType());
+                }
+                break;
+            }
+            case BITS: {
+                YangBits bits = (YangBits) getDataTypeExtendedInfo();
+                if (bits.fromString(value) == null) {
+                    throw new DataTypeException("YANG file error : Input value \"" + value + "\" is not a valid " +
+                                                        getDataType());
+                }
+                break;
+            }
+            case BINARY: {
+                if (!isValidBinary(value, (YangRangeRestriction) getDataTypeExtendedInfo())) {
+                    throw new DataTypeException("YANG file error : Input value \"" + value + "\" is not a valid " +
+                                                        getDataType());
+                }
+                break;
+            }
+            case LEAFREF: {
+                YangLeafRef<?> leafRef = (YangLeafRef<?>) getDataTypeExtendedInfo();
+                leafRef.validateDataOnExit();
+                break;
+            }
+            case IDENTITYREF: {
+                // TODO TBD
+                break;
+            }
+            case EMPTY: {
+                if (value.length() > 0) {
+                    throw new DataTypeException("YANG file error : Input value \"" + value
+                                                        + "\" is not allowed for a data type " + getDataType());
+                }
+                break;
+            }
+            case UNION: {
+                ListIterator<YangType<?>> listIterator = ((YangUnion) getDataTypeExtendedInfo()).getTypeList()
+                        .listIterator();
+                boolean isValidated = false;
+                while (listIterator.hasNext()) {
+                    YangType<?> type = (YangType<?>) listIterator.next();
+                    try {
+                        type.isValidValue(value);
+                        // If it is not thrown exception then validation is success
+                        isValidated = true;
+                        break;
+                    } catch (Exception e) {
+                    }
+                }
+
+                if (!isValidated) {
+                    throw new DataTypeException("YANG file error : Input value \"" + value + "\" is not a valid " +
+                                                        getDataType());
+                }
+                break;
+            }
+            case INSTANCE_IDENTIFIER: {
+                // TODO TBD
+                break;
+            }
+            case DERIVED: {
+                YangDataTypes dataType = ((YangDerivedInfo) getDataTypeExtendedInfo()).getEffectiveBuiltInType();
+                if (isOfRangeRestrictedType(dataType)) {
+                    if (((YangDerivedInfo) getDataTypeExtendedInfo()).getResolvedExtendedInfo() == null) {
+                        getDataObjectFromString(value,
+                                                ((YangDerivedInfo) getDataTypeExtendedInfo())
+                                                        .getEffectiveBuiltInType());
+                    } else {
+                        if (!((YangRangeRestriction) ((YangDerivedInfo) getDataTypeExtendedInfo())
+                                .getResolvedExtendedInfo()).isValidValueString(value)) {
+                            throw new DataTypeException("YANG file error : Input value \"" + value
+                                                                + "\" is not a valid " + dataType);
+                        }
+                    }
+                } else if (dataType == YangDataTypes.STRING) {
+                    Object info = ((YangDerivedInfo) getDataTypeExtendedInfo())
+                            .getResolvedExtendedInfo();
+                    if (info != null) {
+                        if (info instanceof YangStringRestriction) {
+                            YangStringRestriction stringRestriction =
+                                    (YangStringRestriction) info;
+                            if (!(stringRestriction.isValidStringOnLengthRestriction(value) &&
+                                    stringRestriction.isValidStringOnPatternRestriction(value))) {
+                                throw new DataTypeException("YANG file error : Input value \"" + value
+                                                                    + "\" is not a valid " + dataType);
+                            }
+                        }
+                    }
+                } else if (dataType == YangDataTypes.BITS) {
+                    YangTypeDef prevTypedef = ((YangDerivedInfo) getDataTypeExtendedInfo())
+                            .getReferredTypeDef();
+                    YangType type = prevTypedef.getTypeList().iterator().next();
+                    YangBits bits = (YangBits) type.getDataTypeExtendedInfo();
+                    if (bits.fromString(value) == null) {
+                        throw new DataTypeException("YANG file error : Input value \"" + value + "\" is not a valid " +
+                                                            dataType);
+                    }
+                } else if (dataType == YangDataTypes.BINARY) {
+                    if (!isValidBinary(value, (YangRangeRestriction) ((YangDerivedInfo)
+                            getDataTypeExtendedInfo()).getResolvedExtendedInfo())) {
+                        throw new DataTypeException("YANG file error : Input value \"" + value + "\" is not a valid " +
+                                                            dataType);
+                    }
+                } else if (dataType == YangDataTypes.DECIMAL64) {
+                    YangDerivedInfo derivedInfo = (YangDerivedInfo) getDataTypeExtendedInfo();
+                    YangTypeDef typedef = (YangTypeDef) derivedInfo.getReferredTypeDef();
+                    YangType<YangDecimal64> decimal64Type =
+                            (YangType<YangDecimal64>) typedef.getTypeList().iterator().next();
+                    YangDecimal64<YangRangeRestriction> decimal64 = decimal64Type.getDataTypeExtendedInfo();
+                    // Fraction-Digits and range needs to get it from yang
+                    validateDecimal64(value, decimal64.getFractionDigit(),
+                                      decimal64.getRangeRestrictedExtendedInfo());
+                }
+                break;
+            }
+            default: {
+                throw new DataTypeException("YANG file error : Input value \"" + value + "\" received for " +
+                                                    "unsupported data type " + getDataType());
+            }
+        }
+    }
+
+
+    /**
+     * Checks whether specific string is valid decimal64 value.
+     *
+     * @param value decimal64 value
+     */
+    private void validateDecimal64(String value, int fractionDigit, YangRangeRestriction rangeRestriction)
+            throws DataModelException {
+        YangDecimal64<YangRangeRestriction> decimal64 = YangDecimal64.fromString(value);
+        decimal64.setFractionDigit(fractionDigit);
+        decimal64.setRangeRestrictedExtendedInfo(rangeRestriction);
+        decimal64.validateDecimal64();
+    }
+
+    /**
+     * Checks whether specific string is valid binary.
+     *
+     * @param value binary value
+     * @return true if validation success otherwise false
+     */
+    private boolean isValidBinary(String value, YangRangeRestriction lengthRestriction) {
+        YangBinary binary = new YangBinary(value);
+
+        // After decoding binary, its length should not be zero
+        if (binary.getBinaryData().length == 0) {
+            return false;
+        }
+
+        if (lengthRestriction == null || lengthRestriction.getAscendingRangeIntervals() == null
+                || lengthRestriction.getAscendingRangeIntervals().isEmpty()) {
+            // Length restriction is optional
+            return true;
+        }
+
+        ListIterator<YangRangeInterval<YangUint64>> rangeListIterator = lengthRestriction.getAscendingRangeIntervals()
+                .listIterator();
+        boolean isMatched = false;
+        while (rangeListIterator.hasNext()) {
+            YangRangeInterval rangeInterval = rangeListIterator.next();
+            rangeInterval.setFileName(getFileName());
+            rangeInterval.setLineNumber(getLineNumber());
+            rangeInterval.setCharPosition(getCharPosition());
+            BigInteger startValue = ((YangUint64) rangeInterval.getStartValue()).getValue();
+            BigInteger endValue = ((YangUint64) rangeInterval.getEndValue()).getValue();
+            // convert (encode) back and check length
+            if ((binary.toString().length() >= startValue.intValue()) &&
+                    (binary.toString().length() <= endValue.intValue())) {
+                isMatched = true;
+                break;
+            }
+        }
+
+        return isMatched;
+    }
+
+    public boolean isTypeForInterFileGroupingResolution() {
+        return isTypeForInterFileGroupingResolution;
+    }
+
+    public void setTypeForInterFileGroupingResolution(boolean typeForInterFileGroupingResolution) {
+        isTypeForInterFileGroupingResolution = typeForInterFileGroupingResolution;
+    }
+
+    public boolean isTypeNotResolvedTillRootNode() {
+        return isTypeNotResolvedTillRootNode;
+    }
+
+    public void setTypeNotResolvedTillRootNode(boolean typeNotResolvedTillRootNode) {
+        isTypeNotResolvedTillRootNode = typeNotResolvedTillRootNode;
+    }
+
+    @Override
+    public YangType<T> clone()
+            throws CloneNotSupportedException {
+        YangType<T> clonedNode = (YangType<T>) super.clone();
+        return clonedNode;
+    }
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangTypeDef.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangTypeDef.java
new file mode 100644
index 0000000..499269d
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangTypeDef.java
@@ -0,0 +1,313 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.yang.compiler.datamodel;
+
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.datamodel.utils.YangConstructType;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import static java.util.Collections.unmodifiableList;
+import static org.onosproject.yang.compiler.datamodel.YangNodeType.TYPEDEF_NODE;
+import static org.onosproject.yang.compiler.datamodel.YangSchemaNodeType.YANG_NON_DATA_NODE;
+import static org.onosproject.yang.compiler.datamodel.exceptions.ErrorMessages.COLLISION_DETECTION;
+import static org.onosproject.yang.compiler.datamodel.exceptions.ErrorMessages.TYPEDEF;
+import static org.onosproject.yang.compiler.datamodel.exceptions.ErrorMessages.getErrorMsgCollision;
+import static org.onosproject.yang.compiler.datamodel.utils.DataModelUtils.detectCollidingChildUtil;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.TYPEDEF_DATA;
+
+/*-
+ * 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 abstract class YangTypeDef
+        extends YangNode
+        implements YangCommonInfo, Parsable, YangTypeHolder, CollisionDetector,
+        YangTranslatorOperatorNode {
+
+    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;
+
+    /**
+     * 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 final List<YangType<?>> typeList;
+
+    /**
+     * Creates a typedef node.
+     */
+    public YangTypeDef() {
+        super(TYPEDEF_NODE, null);
+        typeList = new LinkedList<>();
+    }
+
+    @Override
+    public void addToChildSchemaMap(YangSchemaNodeIdentifier id,
+                                    YangSchemaNodeContextInfo yangSchemaNodeContextInfo)
+            throws DataModelException {
+        // Do nothing.
+    }
+
+    @Override
+    public void incrementMandatoryChildCount() {
+        // Do nothing, to be handled during linking.
+        // TODO
+    }
+
+    @Override
+    public void addToDefaultChildMap(YangSchemaNodeIdentifier id,
+                                     YangSchemaNode node) {
+        // Do nothing, to be handled during linking.
+        // TODO
+    }
+
+    @Override
+    public YangSchemaNodeType getYangSchemaNodeType() {
+        return YANG_NON_DATA_NODE;
+    }
+
+    /**
+     * 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 (!typeList.isEmpty()) {
+            return typeList.get(0);
+        }
+        return null;
+    }
+
+    /**
+     * Sets the data type.
+     *
+     * @param dataType the data type
+     */
+    public void setDataType(YangType<?> dataType) {
+        typeList.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 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 {
+        if (defaultValueInString != null && !defaultValueInString.isEmpty() &&
+                getTypeDefBaseType() != null) {
+            getTypeDefBaseType().isValidValue(defaultValueInString);
+        }
+    }
+
+    @Override
+    public List<YangType<?>> getTypeList() {
+        return unmodifiableList(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(
+                    getErrorMsgCollision(COLLISION_DETECTION, getName(),
+                                         getLineNumber(), getCharPosition(),
+                                         TYPEDEF, getFileName()));
+        }
+    }
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangTypeHolder.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangTypeHolder.java
new file mode 100644
index 0000000..443ec08
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/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.yang.compiler.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/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangUnion.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangUnion.java
new file mode 100644
index 0000000..7dd545a
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangUnion.java
@@ -0,0 +1,187 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.datamodel;
+
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.datamodel.utils.YangConstructType;
+import org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import static org.onosproject.yang.compiler.datamodel.YangSchemaNodeType.YANG_NON_DATA_NODE;
+import static org.onosproject.yang.compiler.datamodel.exceptions.ErrorMessages.getErrorMsg;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.UNION_DATA;
+
+/*
+ * 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 abstract class YangUnion
+        extends YangNode
+        implements Parsable, YangTypeHolder, CollisionDetector {
+
+    private static final long serialVersionUID = 806201616L;
+
+    // List of YANG type.
+    private List<YangType<?>> typeList;
+
+    // Current child union number.
+    private transient int childUnionNumber;
+
+    /**
+     * Creates a YANG union node.
+     */
+    public YangUnion() {
+        super(YangNodeType.UNION_NODE, null);
+        typeList = new LinkedList<>();
+        childUnionNumber = 1;
+    }
+
+    @Override
+    public void addToChildSchemaMap(YangSchemaNodeIdentifier schemaNodeIdentifier,
+                                    YangSchemaNodeContextInfo yangSchemaNodeContextInfo)
+            throws DataModelException {
+        // Do nothing.
+    }
+
+    @Override
+    public void incrementMandatoryChildCount() {
+        // Do nothing, as leaf can't come directly or indirectly below this construct.
+        // TODO
+    }
+
+    @Override
+    public void addToDefaultChildMap(YangSchemaNodeIdentifier yangSchemaNodeIdentifier, YangSchemaNode yangSchemaNode) {
+        // Do nothing, as leaf can't come directly or indirectly below this construct.
+        // TODO
+    }
+
+    @Override
+    public YangSchemaNodeType getYangSchemaNodeType() {
+        return YANG_NON_DATA_NODE;
+    }
+
+    @Override
+    public List<YangType<?>> getTypeList() {
+        return 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 {
+        YangDataTypes type = yangType.getDataType();
+        String msg = "Union member type must not be one of the built-in types" +
+                " \"empty\" or \"leafref\"";
+        switch (type) {
+            case EMPTY:
+            case LEAFREF:
+                throw new DataModelException(getErrorMsg(
+                        msg, getName(), getLineNumber(), getCharPosition(),
+                        getFileName()));
+
+            default:
+                typeList.add(yangType);
+        }
+    }
+
+    @Override
+    public YangConstructType getYangConstructType() {
+        return 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.
+    }
+
+    @Override
+    public void detectCollidingChild(String identifierName, YangConstructType dataType)
+            throws DataModelException {
+        // Do nothing
+    }
+
+    @Override
+    public void detectSelfCollision(String identifierName, YangConstructType dataType)
+            throws DataModelException {
+        // Do nothing
+    }
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangUses.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangUses.java
new file mode 100644
index 0000000..b622e28
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangUses.java
@@ -0,0 +1,562 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.yang.compiler.datamodel;
+
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.datamodel.utils.ResolvableStatus;
+import org.onosproject.yang.compiler.datamodel.utils.YangConstructType;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import static java.util.Collections.unmodifiableList;
+import static org.onosproject.yang.compiler.datamodel.TraversalType.CHILD;
+import static org.onosproject.yang.compiler.datamodel.TraversalType.PARENT;
+import static org.onosproject.yang.compiler.datamodel.TraversalType.ROOT;
+import static org.onosproject.yang.compiler.datamodel.TraversalType.SIBILING;
+import static org.onosproject.yang.compiler.datamodel.YangNodeType.USES_NODE;
+import static org.onosproject.yang.compiler.datamodel.YangSchemaNodeType.YANG_NON_DATA_NODE;
+import static org.onosproject.yang.compiler.datamodel.exceptions.ErrorMessages.COLLISION_DETECTION;
+import static org.onosproject.yang.compiler.datamodel.exceptions.ErrorMessages.USES;
+import static org.onosproject.yang.compiler.datamodel.exceptions.ErrorMessages.getErrorMsgCollision;
+import static org.onosproject.yang.compiler.datamodel.utils.DataModelUtils.addUnresolvedType;
+import static org.onosproject.yang.compiler.datamodel.utils.DataModelUtils.detectCollidingChildUtil;
+import static org.onosproject.yang.compiler.datamodel.utils.DataModelUtils.getParentNodeInGenCode;
+import static org.onosproject.yang.compiler.datamodel.utils.DataModelUtils.updateClonedLeavesUnionEnumRef;
+import static org.onosproject.yang.compiler.datamodel.utils.ResolvableStatus.INTRA_FILE_RESOLVED;
+import static org.onosproject.yang.compiler.datamodel.utils.ResolvableStatus.RESOLVED;
+import static org.onosproject.yang.compiler.datamodel.utils.ResolvableStatus.UNRESOLVED;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.LEAF_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.LEAF_LIST_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.USES_DATA;
+
+/*-
+ * 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        | -YangIfFeature   |
+ *                | 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        | -YangWhen        |
+ *                +--------------+---------+-------------+------------------+
+ */
+
+/**
+ * Represents data model node to maintain information defined in YANG uses.
+ */
+public abstract class YangUses
+        extends YangNode
+        implements YangCommonInfo, Parsable, Resolvable, CollisionDetector,
+        YangWhenHolder, YangIfFeatureHolder, YangTranslatorOperatorNode,
+        LeafRefInvalidHolder {
+
+    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;
+
+    /**
+     * When data of the node.
+     */
+    private YangWhen when;
+
+    /**
+     * List of if-feature.
+     */
+    private List<YangIfFeature> ifFeatureList;
+
+    /**
+     * 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 leaf lists of grouping that needs to replicated at YANG uses.
+     */
+    private List<YangEntityToResolveInfoImpl> entityToResolveInfoList;
+
+    /**
+     * Current grouping depth for uses.
+     */
+    private int currentGroupingDepth;
+
+    /**
+     * Creates an YANG uses node.
+     */
+    public YangUses() {
+        super(USES_NODE, null);
+        nodeIdentifier = new YangNodeIdentifier();
+        resolvableStatus = UNRESOLVED;
+        ifFeatureList = new LinkedList<>();
+        entityToResolveInfoList = new LinkedList<>();
+    }
+
+    @Override
+    public void addToChildSchemaMap(YangSchemaNodeIdentifier id,
+                                    YangSchemaNodeContextInfo context)
+            throws DataModelException {
+        // Do nothing.
+    }
+
+    @Override
+    public void incrementMandatoryChildCount() {
+        // Do nothing.
+        // TODO
+    }
+
+    @Override
+    public void addToDefaultChildMap(YangSchemaNodeIdentifier id,
+                                     YangSchemaNode yangSchemaNode) {
+        // Do nothing.
+        // TODO
+    }
+
+    @Override
+    public YangSchemaNodeType getYangSchemaNodeType() {
+        return YANG_NON_DATA_NODE;
+    }
+
+    /**
+     * Adds an entity to resolve in list.
+     *
+     * @param entityToResolve entity to resolved
+     * @throws DataModelException a violation of data model rules
+     */
+    public void addEntityToResolve(
+            List<YangEntityToResolveInfoImpl> entityToResolve)
+            throws DataModelException {
+        if (entityToResolveInfoList == null) {
+            entityToResolveInfoList = new
+                    LinkedList<>();
+        }
+        entityToResolveInfoList.addAll(entityToResolve);
+    }
+
+    /**
+     * 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 when.
+     *
+     * @return the when
+     */
+    @Override
+    public YangWhen getWhen() {
+        return when;
+    }
+
+    /**
+     * Sets the when.
+     *
+     * @param when the when to set
+     */
+    @Override
+    public void setWhen(YangWhen when) {
+        this.when = when;
+    }
+
+    /**
+     * 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 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
+    }
+
+    /**
+     * 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 Object resolve()
+            throws DataModelException {
+
+        YangGrouping referredGrouping = getRefGroup();
+
+        if (referredGrouping == null) {
+            throw new DataModelException("YANG uses linker error, cannot resolve" +
+                                                 " uses " + getName() + " in " +
+                                                 getLineNumber() + " at " +
+                                                 getCharPosition() + " in " +
+                                                 getFileName() + "\"");
+        } else {
+            /*
+             * if referredGrouping has uses which is not resolved then set the status
+             * as Intra file resolved and return
+             */
+            if (checkIsUnresolvedRecursiveUsesInGrouping(referredGrouping)) {
+                return null;
+            }
+        }
+
+        YangNode usesParentNode = getParentNodeInGenCode(this);
+        if (!(usesParentNode instanceof YangLeavesHolder)
+                || !(usesParentNode instanceof CollisionDetector)) {
+            throw new DataModelException(
+                    "YANG uses holder construct is wrong " + getName() + " in " +
+                            getLineNumber() + " at " + getCharPosition() +
+                            " in " + getFileName() + "\"");
+        }
+
+        YangLeavesHolder usesParent = (YangLeavesHolder) usesParentNode;
+        if (referredGrouping.getListOfLeaf() != null) {
+            for (YangLeaf leaf : referredGrouping.getListOfLeaf()) {
+                YangLeaf clonedLeaf;
+                try {
+                    ((CollisionDetector) usesParent)
+                            .detectCollidingChild(leaf.getName(), LEAF_DATA);
+                    clonedLeaf = leaf.clone();
+                    clonedLeaf.setReferredLeaf(leaf);
+                    addUnresolvedType(this, clonedLeaf, (YangNode) usesParent);
+                } catch (CloneNotSupportedException | DataModelException e) {
+                    throw new DataModelException(e.getMessage());
+                }
+
+                clonedLeaf.setContainedIn(usesParent);
+                usesParent.addLeaf(clonedLeaf);
+            }
+        }
+        if (referredGrouping.getListOfLeafList() != null) {
+            for (YangLeafList leafList : referredGrouping.getListOfLeafList()) {
+                YangLeafList clonedLeafList;
+                try {
+                    ((CollisionDetector) usesParent)
+                            .detectCollidingChild(leafList.getName(), LEAF_LIST_DATA);
+                    clonedLeafList = leafList.clone();
+                    clonedLeafList.setReferredSchemaLeafList(leafList);
+                    addUnresolvedType(this, clonedLeafList,
+                                      (YangNode) usesParent);
+                } catch (CloneNotSupportedException | DataModelException e) {
+                    throw new DataModelException(e.getMessage());
+                }
+                clonedLeafList.setContainedIn(usesParent);
+                usesParent.addLeafList(clonedLeafList);
+            }
+        }
+
+        try {
+            cloneSubTree(referredGrouping, usesParentNode, this);
+        } catch (DataModelException e) {
+            throw new DataModelException(e.getMessage());
+        }
+        updateClonedLeavesUnionEnumRef(usesParent);
+        return unmodifiableList(entityToResolveInfoList);
+    }
+
+    /**
+     * Checks if referred grouping has uses which is not resolved then it set the
+     * status of current uses as intra file resolved and returns true.
+     *
+     * @param referredGrouping referred grouping node of uses
+     * @return true if referred grouping has unresolved uses
+     */
+    private boolean checkIsUnresolvedRecursiveUsesInGrouping(YangGrouping referredGrouping) {
+
+        /*
+         * Search the grouping node's children for presence of uses node.
+         */
+        TraversalType curTraversal = ROOT;
+        YangNode curNode = referredGrouping.getChild();
+        while (curNode != null) {
+            if (curNode == referredGrouping || (curNode instanceof YangUses &&
+                    curNode.getName().equals(referredGrouping.getName()))) {
+                // if we have traversed all the child nodes, then exit from loop
+                return false;
+            }
+
+            // if child nodes has uses, then add it to resolution stack
+            if (curNode instanceof YangUses) {
+                if (((YangUses) curNode).getResolvableStatus() != RESOLVED) {
+                    setResolvableStatus(INTRA_FILE_RESOLVED);
+                    return true;
+                }
+            }
+
+            // Traversing all the child nodes of grouping
+            if (curTraversal != PARENT && curNode.getChild() != null) {
+                curTraversal = CHILD;
+                curNode = curNode.getChild();
+            } else if (curNode.getNextSibling() != null) {
+                curTraversal = SIBILING;
+                curNode = curNode.getNextSibling();
+            } else {
+                curTraversal = PARENT;
+                curNode = curNode.getParent();
+            }
+        }
+        return false;
+    }
+
+    @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(
+                    getErrorMsgCollision(COLLISION_DETECTION, getName(),
+                                         getLineNumber(), getCharPosition(),
+                                         USES, getFileName()));
+        }
+    }
+
+    @Override
+    public List<YangIfFeature> getIfFeatureList() {
+        return unmodifiableList(ifFeatureList);
+    }
+
+    @Override
+    public void addIfFeatureList(YangIfFeature ifFeature) {
+        if (ifFeatureList == null) {
+            ifFeatureList = new LinkedList<>();
+        }
+        ifFeatureList.add(ifFeature);
+    }
+
+    @Override
+    public void setIfFeatureList(List<YangIfFeature> ifFeatureList) {
+        this.ifFeatureList = ifFeatureList;
+    }
+
+    /**
+     * Sets the current grouping depth.
+     *
+     * @param currentGroupingDepth current grouping depth
+     */
+    public void setCurrentGroupingDepth(int currentGroupingDepth) {
+        this.currentGroupingDepth = currentGroupingDepth;
+    }
+
+    /**
+     * Returns the current grouping depth.
+     *
+     * @return current grouping depth
+     */
+    public int getCurrentGroupingDepth() {
+        return currentGroupingDepth;
+    }
+
+    @Override
+    public String getName() {
+        return nodeIdentifier.getName();
+    }
+
+    @Override
+    public void setName(String name) {
+        nodeIdentifier.setName(name);
+    }
+
+    @Override
+    public YangNode clone(YangUses node) throws CloneNotSupportedException {
+        YangNode clnNode = (YangNode) super.clone();
+        clnNode.setParent(null);
+        clnNode.setChild(null);
+        clnNode.setNextSibling(null);
+        clnNode.setPreviousSibling(null);
+        return clnNode;
+    }
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangWhen.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangWhen.java
new file mode 100644
index 0000000..68b6160
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangWhen.java
@@ -0,0 +1,165 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.yang.compiler.datamodel;
+
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.datamodel.utils.YangConstructType;
+
+import java.io.Serializable;
+
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.WHEN_DATA;
+
+/*
+ * Reference RFC 6020.
+ *
+ * The "when" statement makes its parent data definition statement
+ * conditional.  The node defined by the parent data definition
+ * statement is only valid when the condition specified by the "when"
+ * statement is satisfied.
+ *
+ * The statement's argument is an XPath expression, which is used to formally
+ * specify this condition.  If the XPath  expression conceptually evaluates to
+ * "true" for a particular instance, then the node defined by the parent data
+ * definition statement is valid; otherwise, it is not.
+ *
+ *  The when's sub-statements
+ *
+ *                +---------------+---------+-------------+------------------+
+ *                | substatement  | section | cardinality |data model mapping|
+ *                +---------------+---------+-------------+------------------+
+ *                | description   | 7.19.3  | 0..1        | -string          |
+ *                | reference     | 7.19.4  | 0..1        | -string          |
+ *                +---------------+---------+-------------+------------------+
+ */
+
+/**
+ * Represents information defined in YANG when.
+ */
+public class YangWhen extends DefaultLocationInfo
+        implements YangDesc, YangReference, Parsable, Serializable {
+
+    private static final long serialVersionUID = 806201646L;
+
+    /**
+     * When condition info.
+     */
+    private String condition;
+
+    /**
+     * Description string.
+     */
+    private String description;
+
+    /**
+     * Reference string.
+     */
+    private String reference;
+
+    /**
+     * Creates a YANG when restriction.
+     */
+    public YangWhen() {
+    }
+
+    /**
+     * Returns the condition.
+     *
+     * @return the condition
+     */
+    public String getCondition() {
+        return condition;
+    }
+
+    /**
+     * Sets the condition.
+     *
+     * @param condition the condition to set
+     */
+    public void setCondition(String condition) {
+        this.condition = condition;
+    }
+
+    /**
+     * 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 WHEN_DATA
+     */
+    @Override
+    public YangConstructType getYangConstructType() {
+        return WHEN_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/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangWhenHolder.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangWhenHolder.java
new file mode 100644
index 0000000..08a4ee7
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangWhenHolder.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.datamodel;
+
+/**
+ * Abstraction of when entity. It is used to abstract the data holders of when.
+ */
+public interface YangWhenHolder {
+
+    /**
+     * Returns the when.
+     *
+     * @return the when
+     */
+    YangWhen getWhen();
+
+    /**
+     * Sets the when.
+     *
+     * @param when the when to set
+     */
+    void setWhen(YangWhen when);
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangXPathResolver.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangXPathResolver.java
new file mode 100644
index 0000000..075241c
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangXPathResolver.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.yang.compiler.datamodel;
+
+/**
+ * Abstraction of an entity which can be resolved with x-path linker.
+ */
+public interface YangXPathResolver {
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/exceptions/DataModelException.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/exceptions/DataModelException.java
new file mode 100644
index 0000000..054b6e4
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/exceptions/DataModelException.java
@@ -0,0 +1,109 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.yang.compiler.datamodel.exceptions;
+
+/**
+ * Represents base class for exceptions in data model operations.
+ */
+public class DataModelException extends Exception {
+
+    private static final long serialVersionUID = 201601270658L;
+    private transient int lineNumber;
+    private transient int charPositionInLine;
+    private transient String fileName;
+
+    /**
+     * 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;
+    }
+
+    /**
+     * Returns YANG file name of the exception.
+     *
+     * @return YANG file name of the exception
+     */
+    public String getFileName() {
+        return this.fileName;
+    }
+
+    /**
+     * Sets file name in datamodel exception.
+     *
+     * @param fileName YANG file name
+     */
+    public void setFileName(String fileName) {
+        this.fileName = fileName;
+    }
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/exceptions/ErrorMessages.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/exceptions/ErrorMessages.java
new file mode 100644
index 0000000..26f813e
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/exceptions/ErrorMessages.java
@@ -0,0 +1,102 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.yang.compiler.datamodel.exceptions;
+
+/**
+ * Represents error messages thrown by data model exception.
+ */
+public final class ErrorMessages {
+
+    private ErrorMessages() {
+    }
+
+    private static final String IN = " in ";
+    private static final String AT = " at ";
+    private static final String AS = "as ";
+    public static final String QUOTES = "\"";
+    public static final String CASE = " case ";
+    public static final String NOTIFICATION = " notificaiton ";
+    public static final String RPC = " rpc ";
+    public static final String INPUT = " input ";
+    public static final String OUTPUT = " output ";
+    public static final String CHOICE = " choice ";
+    public static final String GROUPING = " grouping ";
+    public static final String TYPEDEF = " typedef ";
+    public static final String USES = " uses ";
+    public static final String INVALID_CASE_HOLDER
+            = "\"Internal Data Model Tree Error: Invalid/Missing \"" +
+            "                                   \"holder in case \"";
+    public static final String TARGET_NODE_LEAF_INFO = "target node leaf/leaf-list";
+    public static final String TARGET_NODE = "target node ";
+    public static final String COLLISION_DETECTION = "YANG File Error: " +
+            "Identifier collision detected in";
+    public static final String FAILED_TO_ADD_CASE = "Failed to add child " +
+            "nodes to case node of augment ";
+
+    /**
+     * Returns error message for datamodel exception for collision detection.
+     *
+     * @param msg      message
+     * @param name     name of construct
+     * @param line     line number
+     * @param position character position
+     * @param fileName file name
+     * @return error message for datamodel exception for collision detection
+     */
+    public static String getErrorMsg(String msg, String name, int line,
+                                     int position, String fileName) {
+        StringBuilder builder = new StringBuilder();
+        builder.append(msg)
+                .append(name)
+                .append(IN)
+                .append(line)
+                .append(AT)
+                .append(position)
+                .append(IN)
+                .append(fileName);
+        return builder.toString();
+    }
+
+    /**
+     * Returns error message for datamodel exception for collision detection.
+     *
+     * @param msg       message
+     * @param name      name of construct
+     * @param line      line number
+     * @param position  character position
+     * @param construct construct name
+     * @param fileName  file name
+     * @return error message for datamodel exception for collision detection
+     */
+    public static String getErrorMsgCollision(String msg, String name, int line,
+                                              int position, String construct,
+                                              String fileName) {
+        StringBuilder builder = new StringBuilder();
+        builder.append(msg)
+                .append(construct)
+                .append(AS)
+                .append(QUOTES)
+                .append(name)
+                .append(IN)
+                .append(line)
+                .append(AT)
+                .append(position)
+                .append(IN)
+                .append(fileName)
+                .append(QUOTES);
+        return builder.toString();
+    }
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/exceptions/package-info.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/exceptions/package-info.java
new file mode 100644
index 0000000..e22c2af
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/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.yang.compiler.datamodel.exceptions;
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/javadatamodel/JavaFileInfo.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/javadatamodel/JavaFileInfo.java
new file mode 100644
index 0000000..284378b
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/javadatamodel/JavaFileInfo.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.yang.compiler.datamodel.javadatamodel;
+
+import java.io.Serializable;
+
+/**
+ * Represents cached java file handle, which supports the addition of member attributes and
+ * methods.
+ */
+public class JavaFileInfo
+        implements Serializable {
+
+    private static final long serialVersionUID = 806102633L;
+
+    /**
+     * Name of the module.
+     */
+    protected String javaName;
+
+    /**
+     * Java package of the mapped java class.
+     */
+    protected String pkg;
+
+    /**
+     * Java attribute name;
+     */
+    protected String javaAttributeName;
+
+    /**
+     * Returns the java name of the node.
+     *
+     * @return the java name of node
+     */
+    public String getJavaName() {
+        return javaName;
+    }
+
+    /**
+     * Sets the java name of the node.
+     *
+     * @param name the java name of node
+     */
+    public void setJavaName(String name) {
+        javaName = name;
+    }
+
+    /**
+     * Returns the mapped java package.
+     *
+     * @return the java package
+     */
+    public String getPackage() {
+        return pkg;
+    }
+
+    /**
+     * Sets the node's package.
+     *
+     * @param nodePackage node's package
+     */
+    public void setPackage(String nodePackage) {
+        pkg = nodePackage;
+    }
+
+    /**
+     * Retrieve Java attribute name.
+     *
+     * @return Java attribute name
+     */
+    public String getJavaAttributeName() {
+        return javaAttributeName;
+    }
+
+    /**
+     * Assign the Java attribute Name.
+     *
+     * @param javaAttributeName Java attribute name
+     */
+    public void setJavaAttributeName(String javaAttributeName) {
+        this.javaAttributeName = javaAttributeName;
+    }
+
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/javadatamodel/JavaQualifiedTypeInfo.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/javadatamodel/JavaQualifiedTypeInfo.java
new file mode 100644
index 0000000..fcf0da0
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/javadatamodel/JavaQualifiedTypeInfo.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.yang.compiler.datamodel.javadatamodel;
+
+import java.io.Serializable;
+
+/**
+ * Represents the information about individual imports in the generated file.
+ */
+public class JavaQualifiedTypeInfo
+        implements Serializable {
+
+    private static final long serialVersionUID = 806201634L;
+
+    /**
+     * Package location where the imported class/interface is defined.
+     */
+    protected String pkgInfo;
+
+    /**
+     * Class/interface being referenced.
+     */
+    protected String classInfo;
+
+    /**
+     * attribute name being used.
+     */
+    protected String javaAttributeName;
+    /**
+     * Returns the imported package info.
+     *
+     * @return the imported package info
+     */
+    public String getPkgInfo() {
+        return pkgInfo;
+    }
+
+    /**
+     * Sets the imported package info.
+     *
+     * @param pkgInfo the imported package info
+     */
+    public void setPkgInfo(String pkgInfo) {
+        this.pkgInfo = pkgInfo;
+    }
+
+    /**
+     * Returns the imported class/interface info.
+     *
+     * @return the imported class/interface info
+     */
+    public String getClassInfo() {
+        return classInfo;
+    }
+
+    /**
+     * Sets the imported class/interface info.
+     *
+     * @param classInfo the imported class/interface info
+     */
+    public void setClassInfo(String classInfo) {
+        this.classInfo = classInfo;
+    }
+
+    /**
+     * Retrieve Java attribute name.
+     *
+     * @return Java attribute name
+     */
+    public String getJavaAttributeName() {
+        return javaAttributeName;
+    }
+
+    /**
+     * Assign Java attribute name.
+     *
+     * @param javaAttributeName Java attribute name
+     */
+    public void setJavaAttributeName(String javaAttributeName) {
+        this.javaAttributeName = javaAttributeName;
+    }
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/javadatamodel/JavaQualifiedTypeInfoContainer.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/javadatamodel/JavaQualifiedTypeInfoContainer.java
new file mode 100644
index 0000000..dc14455
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/javadatamodel/JavaQualifiedTypeInfoContainer.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.yang.compiler.datamodel.javadatamodel;
+
+/**
+ * Maintain the java qualified access details for an attribute or a class.
+ */
+public interface JavaQualifiedTypeInfoContainer {
+
+    /**
+     * Obtain the java qualified details.
+     *
+     * @return java qualified type details
+     */
+    JavaQualifiedTypeInfo getJavaQualifiedInfo();
+
+    /**
+     * Assign the qualified type info.
+     *
+     * @param typeInfo qualified type information
+     */
+    void setJavaQualifiedInfo(JavaQualifiedTypeInfo typeInfo);
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/javadatamodel/YangJavaAugment.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/javadatamodel/YangJavaAugment.java
new file mode 100644
index 0000000..c358326
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/javadatamodel/YangJavaAugment.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.datamodel.javadatamodel;
+
+import org.onosproject.yang.compiler.datamodel.YangAugment;
+
+/**
+ * Represents YANG java augment.
+ */
+public class YangJavaAugment
+        extends YangAugment {
+
+    private static final long serialVersionUID = 208201601L;
+
+    protected JavaFileInfo javaFileInfo;
+
+    /**
+     * Returns java file info.
+     *
+     * @return java file info
+     */
+    public JavaFileInfo getJavaFileInfo() {
+        return javaFileInfo;
+    }
+
+    @Override
+    public String getJavaPackage() {
+        return getJavaFileInfo().getPackage();
+    }
+
+    @Override
+    public String getJavaClassNameOrBuiltInType() {
+        return getJavaFileInfo().getJavaName();
+    }
+
+    @Override
+    public String getJavaAttributeName() {
+        return getJavaFileInfo().getJavaAttributeName();
+    }
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/javadatamodel/YangJavaCase.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/javadatamodel/YangJavaCase.java
new file mode 100644
index 0000000..bc5bd70
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/javadatamodel/YangJavaCase.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.datamodel.javadatamodel;
+
+import org.onosproject.yang.compiler.datamodel.YangCase;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+
+/**
+ * Represents YANG java case.
+ */
+public class YangJavaCase
+        extends YangCase {
+
+    private static final long serialVersionUID = 208201602L;
+
+    protected JavaFileInfo javaFileInfo;
+
+    /**
+     * Returns java file info.
+     *
+     * @return java file info
+     */
+    public JavaFileInfo getJavaFileInfo() {
+        return javaFileInfo;
+    }
+
+    @Override
+    public String getJavaPackage() {
+        return getJavaFileInfo().getPackage();
+    }
+
+    @Override
+    public String getJavaClassNameOrBuiltInType() {
+        return getJavaFileInfo().getJavaName();
+    }
+
+    @Override
+    public String getJavaAttributeName() {
+        YangNode parent = getParent();
+        if (parent instanceof YangJavaChoice) {
+            return ((YangJavaChoice) parent).getJavaFileInfo()
+                    .getJavaAttributeName();
+        }
+        throw new RuntimeException("Attribute name is not applicable ");
+    }
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/javadatamodel/YangJavaChoice.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/javadatamodel/YangJavaChoice.java
new file mode 100644
index 0000000..406b442
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/javadatamodel/YangJavaChoice.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.datamodel.javadatamodel;
+
+import org.onosproject.yang.compiler.datamodel.YangChoice;
+
+/**
+ * Represents YANG java choice.
+ */
+public class YangJavaChoice
+        extends YangChoice {
+
+    private static final long serialVersionUID = 208201603L;
+
+    protected JavaFileInfo javaFileInfo;
+
+    /**
+     * Returns java file info.
+     *
+     * @return java file info
+     */
+    public JavaFileInfo getJavaFileInfo() {
+        return javaFileInfo;
+    }
+
+    @Override
+    public String getJavaPackage() {
+        return getJavaFileInfo().getPackage();
+    }
+
+    @Override
+    public String getJavaClassNameOrBuiltInType() {
+        return getJavaFileInfo().getJavaName();
+    }
+
+    @Override
+    public String getJavaAttributeName() {
+        return getJavaFileInfo().getJavaAttributeName();
+    }
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/javadatamodel/YangJavaContainer.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/javadatamodel/YangJavaContainer.java
new file mode 100644
index 0000000..68dc622
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/javadatamodel/YangJavaContainer.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.datamodel.javadatamodel;
+
+import org.onosproject.yang.compiler.datamodel.YangContainer;
+
+/**
+ * Represents YANG java container.
+ */
+public class YangJavaContainer
+        extends YangContainer {
+
+    private static final long serialVersionUID = 208201604L;
+
+    protected JavaFileInfo javaFileInfo;
+
+    /**
+     * Returns java file info.
+     *
+     * @return java file info
+     */
+    public JavaFileInfo getJavaFileInfo() {
+        return javaFileInfo;
+    }
+
+    @Override
+    public String getJavaPackage() {
+        return getJavaFileInfo().getPackage();
+    }
+
+    @Override
+    public String getJavaClassNameOrBuiltInType() {
+        return getJavaFileInfo().getJavaName();
+    }
+
+    @Override
+    public String getJavaAttributeName() {
+        return getJavaFileInfo().getJavaAttributeName();
+    }
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/javadatamodel/YangJavaEnumeration.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/javadatamodel/YangJavaEnumeration.java
new file mode 100644
index 0000000..9f41d3a
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/javadatamodel/YangJavaEnumeration.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.datamodel.javadatamodel;
+
+import org.onosproject.yang.compiler.datamodel.YangEnumeration;
+
+/**
+ * Represents YANG java enumeration.
+ */
+public class YangJavaEnumeration
+        extends YangEnumeration {
+
+    private static final long serialVersionUID = 208201605L;
+
+    protected JavaFileInfo javaFileInfo;
+
+    /**
+     * Returns java file info.
+     *
+     * @return java file info
+     */
+    public JavaFileInfo getJavaFileInfo() {
+        return javaFileInfo;
+    }
+
+    @Override
+    public String getJavaPackage() {
+        return getJavaFileInfo().getPackage();
+    }
+
+    @Override
+    public String getJavaClassNameOrBuiltInType() {
+        return getJavaFileInfo().getJavaName();
+    }
+
+    @Override
+    public String getJavaAttributeName() {
+        throw new RuntimeException("Attribute name is not applicable ");
+    }
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/javadatamodel/YangJavaGrouping.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/javadatamodel/YangJavaGrouping.java
new file mode 100644
index 0000000..7fc247c
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/javadatamodel/YangJavaGrouping.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.datamodel.javadatamodel;
+
+import org.onosproject.yang.compiler.datamodel.YangGrouping;
+
+/**
+ * Represents YANG java grouping.
+ */
+public class YangJavaGrouping
+        extends YangGrouping {
+
+    private static final long serialVersionUID = 208201606L;
+
+    protected JavaFileInfo javaFileInfo;
+
+    /**
+     * Returns java file info.
+     *
+     * @return java file info
+     */
+    public JavaFileInfo getJavaFileInfo() {
+        return javaFileInfo;
+    }
+
+    @Override
+    public String getJavaPackage() {
+        return getJavaFileInfo().getPackage();
+    }
+
+    @Override
+    public String getJavaClassNameOrBuiltInType() {
+        return getJavaFileInfo().getJavaName();
+    }
+
+    @Override
+    public String getJavaAttributeName() {
+        throw new RuntimeException("Attribute name is not applicable ");
+    }
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/javadatamodel/YangJavaIdentity.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/javadatamodel/YangJavaIdentity.java
new file mode 100644
index 0000000..bd447e4
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/javadatamodel/YangJavaIdentity.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.datamodel.javadatamodel;
+
+import org.onosproject.yang.compiler.datamodel.YangIdentity;
+
+/**
+ * Represents YANG java identity.
+ */
+public class YangJavaIdentity
+        extends YangIdentity {
+
+    private static final long serialVersionUID = 208201616L;
+
+    protected JavaFileInfo javaFileInfo;
+
+    /**
+     * Returns java file info.
+     *
+     * @return java file info
+     */
+    public JavaFileInfo getJavaFileInfo() {
+        return javaFileInfo;
+    }
+
+    @Override
+    public String getJavaPackage() {
+        return getJavaFileInfo().getPackage();
+    }
+
+    @Override
+    public String getJavaClassNameOrBuiltInType() {
+        return getJavaFileInfo().getJavaName();
+    }
+
+    @Override
+    public String getJavaAttributeName() {
+        return getJavaFileInfo().getJavaAttributeName();
+    }
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/javadatamodel/YangJavaInput.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/javadatamodel/YangJavaInput.java
new file mode 100644
index 0000000..c83cec2
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/javadatamodel/YangJavaInput.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.datamodel.javadatamodel;
+
+import org.onosproject.yang.compiler.datamodel.YangInput;
+
+/**
+ * Represents YANG java input.
+ */
+public class YangJavaInput
+        extends YangInput {
+
+    private static final long serialVersionUID = 208201607L;
+
+    protected JavaFileInfo javaFileInfo;
+
+    /**
+     * Returns java file info.
+     *
+     * @return java file info
+     */
+    public JavaFileInfo getJavaFileInfo() {
+        return javaFileInfo;
+    }
+
+    @Override
+    public String getJavaPackage() {
+        return getJavaFileInfo().getPackage();
+    }
+
+    @Override
+    public String getJavaClassNameOrBuiltInType() {
+        return getJavaFileInfo().getJavaName();
+    }
+
+    @Override
+    public String getJavaAttributeName() {
+        return getJavaFileInfo().getJavaAttributeName();
+    }
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/javadatamodel/YangJavaLeaf.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/javadatamodel/YangJavaLeaf.java
new file mode 100644
index 0000000..7549862
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/javadatamodel/YangJavaLeaf.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.datamodel.javadatamodel;
+
+import org.onosproject.yang.compiler.datamodel.YangLeaf;
+
+/**
+ * Represent YANG java leaf.
+ */
+public class YangJavaLeaf
+        extends YangLeaf
+        implements JavaQualifiedTypeInfoContainer {
+
+    private static final long serialVersionUID = 208201617L;
+
+    protected JavaQualifiedTypeInfo javaQualifiedTypeInfo;
+
+    /**
+     * Sets java qualified type info.
+     *
+     * @param javaQualifiedTypeInfo java qualified type info
+     */
+    public void setJavaQualifiedInfo(JavaQualifiedTypeInfo javaQualifiedTypeInfo) {
+        this.javaQualifiedTypeInfo = javaQualifiedTypeInfo;
+    }
+
+    /**
+     * Returns java qualified type info.
+     *
+     * @return java qualified type info
+     */
+    public JavaQualifiedTypeInfo getJavaQualifiedInfo() {
+        return javaQualifiedTypeInfo;
+    }
+
+    @Override
+    public String getJavaPackage() {
+        return getJavaQualifiedInfo().getPkgInfo();
+    }
+
+    @Override
+    public String getJavaClassNameOrBuiltInType() {
+        return getJavaQualifiedInfo().getClassInfo();
+    }
+
+    @Override
+    public String getJavaAttributeName() {
+        return getJavaQualifiedInfo().getJavaAttributeName();
+    }
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/javadatamodel/YangJavaLeafList.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/javadatamodel/YangJavaLeafList.java
new file mode 100644
index 0000000..8825fa7
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/javadatamodel/YangJavaLeafList.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.datamodel.javadatamodel;
+
+import org.onosproject.yang.compiler.datamodel.YangLeafList;
+
+/**
+ * Represents YANG java leaf list.
+ */
+public class YangJavaLeafList
+        extends YangLeafList
+        implements JavaQualifiedTypeInfoContainer {
+
+    private static final long serialVersionUID = 208201618L;
+
+    protected JavaQualifiedTypeInfo javaQualifiedTypeInfo;
+
+    /**
+     * Returns java qualified type info.
+     *
+     * @return java qualified type info
+     */
+    public JavaQualifiedTypeInfo getJavaQualifiedInfo() {
+        return javaQualifiedTypeInfo;
+    }
+
+    /**
+     * Sets java qualified type info.
+     *
+     * @param javaQualifiedTypeInfo java qualified type info
+     */
+    public void setJavaQualifiedInfo(JavaQualifiedTypeInfo javaQualifiedTypeInfo) {
+        this.javaQualifiedTypeInfo = javaQualifiedTypeInfo;
+    }
+
+    @Override
+    public String getJavaPackage() {
+        return getJavaQualifiedInfo().getPkgInfo();
+    }
+
+    @Override
+    public String getJavaClassNameOrBuiltInType() {
+        return getJavaQualifiedInfo().getClassInfo();
+    }
+
+    @Override
+    public String getJavaAttributeName() {
+        return getJavaQualifiedInfo().getJavaAttributeName();
+    }
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/javadatamodel/YangJavaList.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/javadatamodel/YangJavaList.java
new file mode 100644
index 0000000..72ee3b5
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/javadatamodel/YangJavaList.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.datamodel.javadatamodel;
+
+import org.onosproject.yang.compiler.datamodel.YangList;
+
+/**
+ * Represent YANG java list.
+ */
+public class YangJavaList
+        extends YangList {
+
+    private static final long serialVersionUID = 208201608L;
+
+    /**
+     * Contains the information of the java file being generated.
+     */
+    protected JavaFileInfo javaFileInfo;
+
+    /**
+     * Returns java file info.
+     *
+     * @return java file info
+     */
+    public JavaFileInfo getJavaFileInfo() {
+        return javaFileInfo;
+    }
+
+    @Override
+    public String getJavaPackage() {
+        return getJavaFileInfo().getPackage();
+    }
+
+    @Override
+    public String getJavaClassNameOrBuiltInType() {
+        return getJavaFileInfo().getJavaName();
+    }
+
+    @Override
+    public String getJavaAttributeName() {
+        return getJavaFileInfo().getJavaAttributeName();
+    }
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/javadatamodel/YangJavaModule.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/javadatamodel/YangJavaModule.java
new file mode 100644
index 0000000..fb98261
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/javadatamodel/YangJavaModule.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.datamodel.javadatamodel;
+
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+
+import java.util.List;
+
+import static java.util.Collections.unmodifiableList;
+
+/**
+ * Represents YANG java module.
+ */
+public class YangJavaModule
+        extends YangModule {
+
+    private static final long serialVersionUID = 208201609L;
+
+    protected JavaFileInfo javaFileInfo;
+    protected List<YangNode> notificationNodes;
+
+    /**
+     * Returns java file info.
+     *
+     * @return java file info
+     */
+    public JavaFileInfo getJavaFileInfo() {
+        return javaFileInfo;
+    }
+
+    @Override
+    public String getJavaPackage() {
+        return getJavaFileInfo().getPackage();
+    }
+
+    @Override
+    public String getJavaClassNameOrBuiltInType() {
+        return getJavaFileInfo().getJavaName();
+    }
+
+    @Override
+    public String getJavaAttributeName() {
+        throw new RuntimeException("Attribute name is not applicable ");
+    }
+
+    @Override
+    public List<YangNode> getNotificationNodes() {
+        return unmodifiableList(notificationNodes);
+    }
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/javadatamodel/YangJavaNotification.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/javadatamodel/YangJavaNotification.java
new file mode 100644
index 0000000..a774327
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/javadatamodel/YangJavaNotification.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.datamodel.javadatamodel;
+
+import org.onosproject.yang.compiler.datamodel.YangNotification;
+
+/**
+ * Represents YANG java notification.
+ */
+public class YangJavaNotification
+        extends YangNotification {
+
+    private static final long serialVersionUID = 208201610L;
+
+    protected JavaFileInfo javaFileInfo;
+
+    /**
+     * Returns java file info.
+     *
+     * @return java file info
+     */
+    public JavaFileInfo getJavaFileInfo() {
+        return javaFileInfo;
+    }
+
+    @Override
+    public String getJavaPackage() {
+        return getJavaFileInfo().getPackage();
+    }
+
+    @Override
+    public String getJavaClassNameOrBuiltInType() {
+        return getJavaFileInfo().getJavaName();
+    }
+
+    @Override
+    public String getJavaAttributeName() {
+        return getJavaFileInfo().getJavaAttributeName();
+    }
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/javadatamodel/YangJavaOutput.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/javadatamodel/YangJavaOutput.java
new file mode 100644
index 0000000..2fc9983
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/javadatamodel/YangJavaOutput.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.datamodel.javadatamodel;
+
+import org.onosproject.yang.compiler.datamodel.YangOutput;
+
+/**
+ * Represents YANG java output.
+ */
+public class YangJavaOutput
+        extends YangOutput {
+
+    private static final long serialVersionUID = 208201611L;
+
+    protected JavaFileInfo javaFileInfo;
+
+    /**
+     * Returns java file info.
+     *
+     * @return java file info
+     */
+    public JavaFileInfo getJavaFileInfo() {
+        return javaFileInfo;
+    }
+
+    @Override
+    public String getJavaPackage() {
+        return getJavaFileInfo().getPackage();
+    }
+
+    @Override
+    public String getJavaClassNameOrBuiltInType() {
+        return getJavaFileInfo().getJavaName();
+    }
+
+    @Override
+    public String getJavaAttributeName() {
+        return getJavaFileInfo().getJavaAttributeName();
+    }
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/javadatamodel/YangJavaRpc.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/javadatamodel/YangJavaRpc.java
new file mode 100644
index 0000000..e88c624
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/javadatamodel/YangJavaRpc.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.datamodel.javadatamodel;
+
+import org.onosproject.yang.compiler.datamodel.YangRpc;
+
+/**
+ * Represents YANG java rpc.
+ */
+public class YangJavaRpc
+        extends YangRpc {
+
+    private static final long serialVersionUID = 208201612L;
+
+    protected JavaFileInfo javaFileInfo;
+
+    /**
+     * Returns java file info.
+     *
+     * @return java file info
+     */
+    public JavaFileInfo getJavaFileInfo() {
+        return javaFileInfo;
+    }
+
+    @Override
+    public String getJavaPackage() {
+        return getJavaFileInfo().getPackage();
+    }
+
+    @Override
+    public String getJavaClassNameOrBuiltInType() {
+        return getJavaFileInfo().getJavaName();
+    }
+
+    @Override
+    public String getJavaAttributeName() {
+        return getJavaFileInfo().getJavaAttributeName();
+    }
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/javadatamodel/YangJavaSubModule.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/javadatamodel/YangJavaSubModule.java
new file mode 100644
index 0000000..00ee10c
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/javadatamodel/YangJavaSubModule.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.datamodel.javadatamodel;
+
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangSubModule;
+
+import java.util.List;
+
+import static java.util.Collections.unmodifiableList;
+
+/**
+ * Represents YANG java submodule.
+ */
+public class YangJavaSubModule
+        extends YangSubModule {
+
+    private static final long serialVersionUID = 208201612L;
+
+    protected JavaFileInfo javaFileInfo;
+    protected List<YangNode> notificationNodes;
+
+    /**
+     * Returns java file info.
+     *
+     * @return java file info
+     */
+    public JavaFileInfo getJavaFileInfo() {
+        return javaFileInfo;
+    }
+
+    @Override
+    public String getJavaPackage() {
+        return getJavaFileInfo().getPackage();
+    }
+
+    @Override
+    public String getJavaClassNameOrBuiltInType() {
+        return getJavaFileInfo().getJavaName();
+    }
+
+    @Override
+    public String getJavaAttributeName() {
+        throw new RuntimeException("Attribute name is not applicable ");
+    }
+
+    @Override
+    public List<YangNode> getNotificationNodes() {
+        return unmodifiableList(notificationNodes);
+    }
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/javadatamodel/YangJavaType.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/javadatamodel/YangJavaType.java
new file mode 100644
index 0000000..9eaf4b0
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/javadatamodel/YangJavaType.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.datamodel.javadatamodel;
+
+import org.onosproject.yang.compiler.datamodel.YangType;
+
+/**
+ * Represents YANG java type.
+ */
+public class YangJavaType extends YangType implements JavaQualifiedTypeInfoContainer {
+
+    private static final long serialVersionUID = 19082016001L;
+    protected JavaQualifiedTypeInfo javaQualifiedTypeInfo;
+
+    /**
+     * Returns java qualified type info.
+     *
+     * @return java qualified type info
+     */
+
+    @Override
+    public JavaQualifiedTypeInfo getJavaQualifiedInfo() {
+        return javaQualifiedTypeInfo;
+    }
+
+    @Override
+    public void setJavaQualifiedInfo(JavaQualifiedTypeInfo typeInfo) {
+        this.javaQualifiedTypeInfo = typeInfo;
+    }
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/javadatamodel/YangJavaTypeDef.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/javadatamodel/YangJavaTypeDef.java
new file mode 100644
index 0000000..c97719a
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/javadatamodel/YangJavaTypeDef.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.datamodel.javadatamodel;
+
+import org.onosproject.yang.compiler.datamodel.YangTypeDef;
+
+/**
+ * Represents YANG java typedef.
+ */
+public class YangJavaTypeDef
+        extends YangTypeDef {
+
+    private static final long serialVersionUID = 208201613L;
+
+    protected JavaFileInfo javaFileInfo;
+
+    /**
+     * Returns java file info.
+     *
+     * @return java file info
+     */
+    public JavaFileInfo getJavaFileInfo() {
+        return javaFileInfo;
+    }
+
+    @Override
+    public String getJavaPackage() {
+        return getJavaFileInfo().getPackage();
+    }
+
+    @Override
+    public String getJavaClassNameOrBuiltInType() {
+        return getJavaFileInfo().getJavaName();
+    }
+
+    @Override
+    public String getJavaAttributeName() {
+        throw new RuntimeException("Attribute name is not applicable ");
+    }
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/javadatamodel/YangJavaUnion.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/javadatamodel/YangJavaUnion.java
new file mode 100644
index 0000000..858bd58
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/javadatamodel/YangJavaUnion.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.yang.compiler.datamodel.javadatamodel;
+
+import org.onosproject.yang.compiler.datamodel.YangUnion;
+
+/**
+ * Represent YANG java union.
+ */
+public class YangJavaUnion
+        extends YangUnion {
+
+    private static final long serialVersionUID = 208201614L;
+    protected JavaFileInfo javaFileInfo;
+
+    /**
+     * Returns java file info.
+     *
+     * @return java file info
+     */
+    public JavaFileInfo getJavaFileInfo() {
+        return javaFileInfo;
+    }
+
+    @Override
+    public String getJavaPackage() {
+        return getJavaFileInfo().getPackage();
+    }
+
+    @Override
+    public String getJavaClassNameOrBuiltInType() {
+        return getJavaFileInfo().getJavaName();
+    }
+
+    @Override
+    public String getJavaAttributeName() {
+        throw new RuntimeException("Attribute name is not applicable ");
+    }
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/javadatamodel/YangJavaUses.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/javadatamodel/YangJavaUses.java
new file mode 100644
index 0000000..466fd3c
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/javadatamodel/YangJavaUses.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.datamodel.javadatamodel;
+
+import org.onosproject.yang.compiler.datamodel.YangUses;
+
+/**
+ * Represent YANG java uses.
+ */
+public class YangJavaUses
+        extends YangUses {
+
+    private static final long serialVersionUID = 208201615L;
+
+    protected JavaFileInfo javaFileInfo;
+
+    /**
+     * Returns java file info.
+     *
+     * @return java file info
+     */
+    public JavaFileInfo getJavaFileInfo() {
+        return javaFileInfo;
+    }
+
+    @Override
+    public String getJavaPackage() {
+        return getJavaFileInfo().getPackage();
+    }
+
+    @Override
+    public String getJavaClassNameOrBuiltInType() {
+        return getJavaFileInfo().getJavaName();
+    }
+
+    @Override
+    public String getJavaAttributeName() {
+        throw new RuntimeException("Attribute name is not applicable ");
+    }
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/javadatamodel/package-info.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/javadatamodel/package-info.java
new file mode 100644
index 0000000..45da407
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/javadatamodel/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.
+ */
+
+/**
+ * Representation of YANG java data model.
+ */
+package org.onosproject.yang.compiler.datamodel.javadatamodel;
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/package-info.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/package-info.java
new file mode 100644
index 0000000..f02b899
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/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.yang.compiler.datamodel;
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/utils/DataModelUtils.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/utils/DataModelUtils.java
new file mode 100644
index 0000000..bfb5b8d
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/utils/DataModelUtils.java
@@ -0,0 +1,847 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.datamodel.utils;
+
+import org.onosproject.yang.compiler.datamodel.CollisionDetector;
+import org.onosproject.yang.compiler.datamodel.ResolvableType;
+import org.onosproject.yang.compiler.datamodel.YangAtomicPath;
+import org.onosproject.yang.compiler.datamodel.YangAugment;
+import org.onosproject.yang.compiler.datamodel.YangBase;
+import org.onosproject.yang.compiler.datamodel.YangCompilerAnnotation;
+import org.onosproject.yang.compiler.datamodel.YangDerivedInfo;
+import org.onosproject.yang.compiler.datamodel.YangEntityToResolveInfoImpl;
+import org.onosproject.yang.compiler.datamodel.YangEnumeration;
+import org.onosproject.yang.compiler.datamodel.YangIdentityRef;
+import org.onosproject.yang.compiler.datamodel.YangIfFeature;
+import org.onosproject.yang.compiler.datamodel.YangImport;
+import org.onosproject.yang.compiler.datamodel.YangLeaf;
+import org.onosproject.yang.compiler.datamodel.YangLeafList;
+import org.onosproject.yang.compiler.datamodel.YangLeafRef;
+import org.onosproject.yang.compiler.datamodel.YangLeavesHolder;
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangReferenceResolver;
+import org.onosproject.yang.compiler.datamodel.YangResolutionInfo;
+import org.onosproject.yang.compiler.datamodel.YangRpc;
+import org.onosproject.yang.compiler.datamodel.YangType;
+import org.onosproject.yang.compiler.datamodel.YangUnion;
+import org.onosproject.yang.compiler.datamodel.YangUses;
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.ObjectInputStream;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
+
+import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes.DERIVED;
+import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes.EMPTY;
+import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes.ENUMERATION;
+import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes.UNION;
+
+
+/**
+ * Represents utilities for data model tree.
+ */
+public final class DataModelUtils {
+    public static final String TRUE = "true";
+    public static final String FALSE = "false";
+    private static final String SLASH = File.separator;
+
+    /**
+     * 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
+     */
+    private 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() + " in " +
+                                                     leaf.getLineNumber() + " at " +
+                                                     leaf.getCharPosition() +
+                                                     " in " + leaf.getFileName() + "\"");
+            }
+        }
+    }
+
+    /**
+     * 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() + " in " +
+                                                     leafList.getLineNumber() + " at " +
+                                                     leafList.getCharPosition() +
+                                                     " in " + leafList.getFileName() + "\"");
+            }
+        }
+    }
+
+    /**
+     * 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 if (resolutionInfo.getEntityToResolveInfo()
+                .getEntityToResolve() instanceof YangUses) {
+            resolutionNode.addToResolutionList(resolutionInfo,
+                                               ResolvableType.YANG_USES);
+        } else if (resolutionInfo.getEntityToResolveInfo()
+                .getEntityToResolve() instanceof YangAugment) {
+            resolutionNode.addToResolutionList(resolutionInfo,
+                                               ResolvableType.YANG_AUGMENT);
+        } else if (resolutionInfo.getEntityToResolveInfo()
+                .getEntityToResolve() instanceof YangIfFeature) {
+            resolutionNode.addToResolutionList(resolutionInfo,
+                                               ResolvableType.YANG_IF_FEATURE);
+        } else if (resolutionInfo.getEntityToResolveInfo()
+                .getEntityToResolve() instanceof YangLeafRef) {
+            resolutionNode.addToResolutionList(resolutionInfo,
+                                               ResolvableType.YANG_LEAFREF);
+        } else if (resolutionInfo.getEntityToResolveInfo().getEntityToResolve() instanceof YangBase) {
+            resolutionNode.addToResolutionList(resolutionInfo, ResolvableType.YANG_BASE);
+        } else if (resolutionInfo.getEntityToResolveInfo().getEntityToResolve() instanceof YangIdentityRef) {
+            resolutionNode.addToResolutionList(resolutionInfo, ResolvableType.YANG_IDENTITYREF);
+        } else if (resolutionInfo.getEntityToResolveInfo()
+                .getEntityToResolve() instanceof YangCompilerAnnotation) {
+            resolutionNode.addToResolutionList(resolutionInfo,
+                                               ResolvableType.YANG_COMPILER_ANNOTATION);
+        }
+    }
+
+    /**
+     * 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.
+         */
+        if (resolutionList != null) {
+            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();
+    }
+
+    /**
+     * Returns de-serializes YANG data-model nodes.
+     *
+     * @param serializedFileInfo serialized File Info
+     * @return de-serializes YANG data-model nodes
+     * @throws IOException when fails do IO operations
+     */
+    public static Set<YangNode> deSerializeDataModel(String serializedFileInfo)
+            throws IOException {
+
+        Set<YangNode> nodes;
+        try {
+            FileInputStream fileInputStream = new FileInputStream(serializedFileInfo);
+            ObjectInputStream objectInputStream = new ObjectInputStream(fileInputStream);
+            nodes = (Set<YangNode>) objectInputStream.readObject();
+            objectInputStream.close();
+            fileInputStream.close();
+        } catch (IOException | ClassNotFoundException e) {
+            throw new IOException(serializedFileInfo + " not found.");
+        }
+        return nodes;
+    }
+
+    /**
+     * Adds the list of leaf present under a node to resolution list, after
+     * cloning. Under the cloned node, with cloned leaf, attributes are set
+     * and added to resolution list.
+     *
+     * @param clonedNode holder node
+     * @param yangUses   YANG uses
+     * @throws CloneNotSupportedException clone not supported error
+     * @throws DataModelException         data model error
+     */
+    public static void cloneListOfLeaf(
+            YangLeavesHolder clonedNode, YangUses yangUses)
+            throws CloneNotSupportedException, DataModelException {
+
+        List<YangLeaf> leaves = clonedNode.getListOfLeaf();
+        if (nonEmpty(leaves)) {
+            List<YangLeaf> clonedLeaves = new LinkedList<>();
+            for (YangLeaf leaf : leaves) {
+                YangLeaf clonedLeaf = leaf.clone();
+                clonedLeaf.setReferredLeaf(leaf);
+                addUnresolvedType(yangUses, clonedLeaf, (YangNode) clonedNode);
+                clonedLeaf.setContainedIn(clonedNode);
+                clonedLeaves.add(clonedLeaf);
+            }
+            clonedNode.setListOfLeaf(clonedLeaves);
+        }
+    }
+
+    /**
+     * Adds all the unresolved type under leaf/leaf-list to the resolution
+     * list, after cloning. This makes the resolution to happen after cloning
+     * of the grouping. Adds resolution with cloned node holder under which
+     * cloned type is present.
+     *
+     * @param yangUses   YANG uses
+     * @param clonedObj  cloned type object
+     * @param clonedNode holder node
+     * @throws DataModelException data model error
+     */
+    public static void addUnresolvedType(
+            YangUses yangUses, Object clonedObj,
+            YangNode clonedNode) throws DataModelException {
+
+        List<YangEntityToResolveInfoImpl> infoList;
+        if (yangUses != null && yangUses.getCurrentGroupingDepth() == 0) {
+            infoList = getTypesToBeResolved(clonedObj, clonedNode, yangUses);
+            if (nonEmpty(infoList)) {
+                yangUses.addEntityToResolve(infoList);
+            }
+        }
+    }
+
+    /**
+     * Returns true if collection object is non-null and non-empty; false
+     * otherwise.
+     *
+     * @param c collection object
+     * @return true if object is non-null and non-empty; false otherwise
+     */
+    public static boolean nonEmpty(Collection<?> c) {
+        return c != null && !c.isEmpty();
+    }
+
+    /**
+     * Adds the list of leaf-list present under a node to resolution list,
+     * after cloning. Under the cloned node, with cloned leaf-list,
+     * attributes are set and added to resolution list.
+     *
+     * @param clonedNode cloned holder
+     * @param yangUses   YANG uses
+     * @throws CloneNotSupportedException clone not supported error
+     * @throws DataModelException         data model error
+     */
+    public static void cloneListOfLeafList(
+            YangLeavesHolder clonedNode, YangUses yangUses)
+            throws CloneNotSupportedException, DataModelException {
+
+        List<YangLeafList> listOfLeafList = clonedNode.getListOfLeafList();
+        if (nonEmpty(listOfLeafList)) {
+            List<YangLeafList> clonedList = new LinkedList<>();
+            for (YangLeafList leafList : listOfLeafList) {
+                YangLeafList clonedLeafList = leafList.clone();
+                clonedLeafList.setReferredSchemaLeafList(leafList);
+                addUnresolvedType(yangUses, clonedLeafList,
+                                  (YangNode) clonedNode);
+                clonedLeafList.setContainedIn(clonedNode);
+                clonedList.add(clonedLeafList);
+            }
+            clonedNode.setListOfLeafList(clonedList);
+        }
+    }
+
+    /**
+     * Returns types that has to be resolved for a single leaf/leaf-list.
+     * Identifies the object to be leaf/leaf-list and assigns respective
+     * parameters to resolve the types under leaf/leaf-list.
+     *
+     * @param clonedObj  leaf/leaf-list object
+     * @param holderNode holder node
+     * @param yangUses   YANG uses
+     * @return list of resolvable entities in a leaf/leaf-list
+     * @throws DataModelException data model error
+     */
+    private static List<YangEntityToResolveInfoImpl> getTypesToBeResolved(
+            Object clonedObj, YangNode holderNode,
+            YangUses yangUses) throws DataModelException {
+
+        YangType type;
+        if (clonedObj instanceof YangLeaf) {
+            YangLeaf clonedLeaf = (YangLeaf) clonedObj;
+            type = clonedLeaf.getDataType();
+            return getUnresolvedTypeList(type.getDataType(), type, holderNode,
+                                         yangUses, true);
+        }
+        YangLeafList clonedLeafList = (YangLeafList) clonedObj;
+        type = clonedLeafList.getDataType();
+        return getUnresolvedTypeList(type.getDataType(), type, holderNode,
+                                     yangUses, false);
+    }
+
+    /**
+     * Returns list of resolvable entities from the type of leaf/leaf-list.
+     * If the type is leaf-ref, derived or union with type resolution
+     * required, it has to be resolved from the place where it is cloned. So,
+     * the resolution list added with these entities. When a type require no
+     * resolution then null is returned, so it will never be added to
+     * resolution list.
+     *
+     * @param dataTypes data type of type
+     * @param type      type of leaf/leaf-list
+     * @param holder    holder node of type
+     * @param yangUses  YANG uses
+     * @param isLeaf    leaf or leaf-list
+     * @return list of resolvable entities for a leaf/leaf-list.
+     * @throws DataModelException data model error
+     */
+    private static List<YangEntityToResolveInfoImpl> getUnresolvedTypeList(
+            YangDataTypes dataTypes, YangType type, YangNode holder,
+            YangUses yangUses, boolean isLeaf) throws DataModelException {
+
+        List<YangEntityToResolveInfoImpl> infoList = new ArrayList<>();
+        YangEntityToResolveInfoImpl entity = null;
+        List<YangEntityToResolveInfoImpl> entityList = null;
+
+        switch (dataTypes) {
+            case LEAFREF:
+                entity = getLeafRefResolvableEntity(type, yangUses, holder);
+                break;
+
+            case DERIVED:
+                entity = getDerivedResolvableEntity(type, holder, isLeaf);
+                break;
+
+            case UNION:
+                entityList = getUnionResolvableEntity(type, isLeaf);
+                break;
+
+            default:
+                return null;
+        }
+        infoList.add(entity);
+        if (nonEmpty(entityList)) {
+            infoList.addAll(entityList);
+        }
+        return infoList;
+    }
+
+    /**
+     * Returns resolvable entity when the type is leaf-ref. It changes the
+     * prefixes from grouping to uses, then changes the parent node to the
+     * cloned node, sets needed information to entity such as line number,
+     * position number and holder.
+     *
+     * @param type     YANG type of leaf-ref
+     * @param yangUses YANG uses
+     * @param holder   cloned holder
+     * @return entity to resolve for leaf-ref
+     * @throws DataModelException data model error
+     */
+    private static YangEntityToResolveInfoImpl getLeafRefResolvableEntity(
+            YangType type, YangUses yangUses, YangNode holder)
+            throws DataModelException {
+
+        YangEntityToResolveInfoImpl<YangLeafRef> leafRefInfo =
+                new YangEntityToResolveInfoImpl<>();
+        YangLeafRef leafRef = (YangLeafRef) type.getDataTypeExtendedInfo();
+
+        // Conversion of prefixes in absolute path while cloning them.
+        convertThePrefixesDuringChange(leafRef, yangUses);
+        leafRef.setParentNode(holder);
+        leafRefInfo.setEntityToResolve(leafRef);
+
+        return setInformationInEntity(
+                leafRefInfo, holder, leafRef.getCharPosition(),
+                leafRef.getLineNumber());
+    }
+
+    /**
+     * Returns resolvable entity when the type is derived. It sets needed
+     * information to entity such as line number,position number and holder.
+     * Returns null when identity is for inter grouping.
+     *
+     * @param type   derived YANG type
+     * @param holder holder node
+     * @param isLeaf leaf or leaf-list
+     * @return entity to resolve for derived type
+     */
+    private static YangEntityToResolveInfoImpl getDerivedResolvableEntity(
+            YangType<?> type, YangNode holder, boolean isLeaf) {
+
+        YangEntityToResolveInfoImpl<YangType<?>> derivedInfo =
+                new YangEntityToResolveInfoImpl<>();
+        if (type.isTypeForInterFileGroupingResolution()) {
+            return null;
+        }
+        if (!isLeaf && type.isTypeNotResolvedTillRootNode()) {
+            return null;
+        }
+
+        derivedInfo.setEntityToResolve(type);
+        return setInformationInEntity(
+                derivedInfo, holder, type.getCharPosition(),
+                type.getLineNumber());
+    }
+
+    /**
+     * Sets the information needed for adding the entity into resolution
+     * list, such as line number, position number and cloned holder node.
+     *
+     * @param entity  resolvable entity
+     * @param holder  cloned holder node
+     * @param charPos character position
+     * @param lineNum line number
+     * @return resolvable entity after setting info
+     */
+    private static YangEntityToResolveInfoImpl<?> setInformationInEntity(
+            YangEntityToResolveInfoImpl<?> entity, YangNode holder,
+            int charPos, int lineNum) {
+
+        entity.setHolderOfEntityToResolve(holder);
+        entity.setCharPosition(charPos);
+        entity.setLineNumber(lineNum);
+        return entity;
+    }
+
+    /**
+     * Returns resolvable entity under union. When types under union have
+     * identity-ref, derived and union, the function call is done recursively
+     * to get resolvable entity and adds it to list.
+     *
+     * @param type   union YANG type
+     * @param isLeaf leaf or leaf-list
+     * @return resolvable entity list after setting info
+     * @throws DataModelException data model error
+     */
+    private static List<YangEntityToResolveInfoImpl> getUnionResolvableEntity(
+            YangType type, boolean isLeaf) throws DataModelException {
+
+        YangUnion union = (YangUnion) type.getDataTypeExtendedInfo();
+        List<YangType<?>> typeList = union.getTypeList();
+        List<YangEntityToResolveInfoImpl> unionList = new ArrayList<>();
+        List<YangEntityToResolveInfoImpl> entity;
+
+        for (YangType unionType : typeList) {
+            entity = getUnresolvedTypeList(unionType.getDataType(),
+                                           unionType, union, null, isLeaf);
+            if (nonEmpty(entity)) {
+                unionList.addAll(entity);
+            }
+        }
+        return unionList;
+    }
+
+    /**
+     * Converts the prefixes in all the nodes of the leafref with respect to the uses node.
+     *
+     * @param leafrefForCloning leafref that is to be cloned
+     * @param yangUses          instance of YANG uses where cloning is done
+     * @throws DataModelException data model error
+     */
+    private static void convertThePrefixesDuringChange(YangLeafRef leafrefForCloning, YangUses yangUses)
+            throws DataModelException {
+        List<YangAtomicPath> atomicPathList = leafrefForCloning.getAtomicPath();
+        if (atomicPathList != null && !atomicPathList.isEmpty()) {
+            Iterator<YangAtomicPath> atomicPathIterator = atomicPathList.listIterator();
+            while (atomicPathIterator.hasNext()) {
+                YangAtomicPath atomicPath = atomicPathIterator.next();
+                Map<String, String> prefixesAndItsImportNameNode = leafrefForCloning.getPrefixAndNode();
+                String prefixInPath = atomicPath.getNodeIdentifier().getPrefix();
+                String importedNodeName = prefixesAndItsImportNameNode.get(prefixInPath);
+                assignCurrentLeafedWithNewPrefixes(importedNodeName, atomicPath, yangUses);
+            }
+        }
+    }
+
+    /**
+     * Assigns leafref with new prefixes while cloning.
+     *
+     * @param importedNodeName imported node name from grouping
+     * @param atomicPath       atomic path in leafref
+     * @param node             instance of YANG uses where cloning is done
+     * @throws DataModelException data model error
+     */
+    private static void assignCurrentLeafedWithNewPrefixes(String importedNodeName, YangAtomicPath atomicPath,
+                                                           YangNode node)
+            throws DataModelException {
+        while (!(node instanceof YangReferenceResolver)) {
+            node = node.getParent();
+            if (node == null) {
+                throw new DataModelException("Internal datamodel error: Datamodel tree is not correct");
+            }
+        }
+        if (node instanceof YangModule) {
+            List<YangImport> importInUsesList = ((YangModule) node).getImportList();
+            if (importInUsesList != null && !importInUsesList.isEmpty()) {
+                Iterator<YangImport> importInUsesListIterator = importInUsesList.listIterator();
+                while (importInUsesListIterator.hasNext()) {
+                    YangImport importInUsesNode = importInUsesListIterator.next();
+                    if (importInUsesNode.getModuleName().equals(importedNodeName)) {
+                        atomicPath.getNodeIdentifier().setPrefix(importInUsesNode.getPrefixId());
+                    }
+                }
+            }
+        }
+    }
+
+    /**
+     * Clones the union or enum leaves. If there is any cloned leaves whose type is union/enum then the corresponding
+     * type info needs to be updated to the cloned new type node.
+     *
+     * @param leavesHolder cloned leaves holder, for whom the leaves reference needs to be updated
+     * @throws DataModelException when fails to do data model operations
+     */
+    public static void updateClonedLeavesUnionEnumRef(YangLeavesHolder leavesHolder)
+            throws DataModelException {
+        List<YangLeaf> currentListOfLeaves = leavesHolder.getListOfLeaf();
+        if (currentListOfLeaves != null) {
+            for (YangLeaf leaf : currentListOfLeaves) {
+                if (leaf.getDataType().getDataType() == ENUMERATION
+                        || leaf.getDataType().getDataType() == UNION) {
+                    try {
+                        YangType<?> clonedType = leaf.getDataType().clone();
+                        updateClonedTypeRef(clonedType, leavesHolder);
+                        leaf.setDataType(clonedType);
+                    } catch (DataModelException e) {
+                        throw e;
+                    } catch (CloneNotSupportedException e) {
+                        e.printStackTrace();
+                        throw new DataModelException("Could not clone Type node " +
+                                                             leaf.getDataType().getDataTypeName() + " in " +
+                                                             leaf.getDataType().getLineNumber() + " at " +
+                                                             leaf.getDataType().getCharPosition() +
+                                                             " in " + leaf.getDataType().getFileName() + "\"");
+                    }
+                }
+            }
+        }
+
+        List<YangLeafList> currentListOfLeafList = leavesHolder.getListOfLeafList();
+        if (currentListOfLeafList != null) {
+            for (YangLeafList leafList : currentListOfLeafList) {
+                if (leafList.getDataType().getDataType() == ENUMERATION
+                        || leafList.getDataType().getDataType() == UNION) {
+                    try {
+                        YangType<?> clonedType = leafList.getDataType().clone();
+                        updateClonedTypeRef(clonedType, leavesHolder);
+                        leafList.setDataType(clonedType);
+                    } catch (DataModelException e) {
+                        throw e;
+                    } catch (CloneNotSupportedException e) {
+                        e.printStackTrace();
+                        throw new DataModelException("Could not clone Type node " +
+                                                             leafList.getDataType().getDataTypeName() + " in " +
+                                                             leafList.getDataType().getLineNumber() + " at " +
+                                                             leafList.getDataType().getCharPosition() +
+                                                             " in " + leafList.getDataType().getFileName() + "\"");
+                    }
+                }
+            }
+        }
+    }
+
+    /**
+     * Updates the types extended info pointer to point to the cloned type node.
+     *
+     * @param dataType     data type, whose extended info needs to be pointed to the cloned type
+     * @param leavesHolder the leaves holder having the cloned type
+     */
+    private static void updateClonedTypeRef(YangType dataType, YangLeavesHolder leavesHolder)
+            throws DataModelException {
+        if (!(leavesHolder instanceof YangNode)) {
+            throw new DataModelException("Data model error: cloned leaves holder is not a node " +
+                                                 " in " +
+                                                 leavesHolder.getLineNumber() + " at " +
+                                                 leavesHolder.getCharPosition() +
+                                                 " in " + leavesHolder.getFileName() + "\"");
+        }
+        YangNode potentialTypeNode = ((YangNode) leavesHolder).getChild();
+        while (potentialTypeNode != null) {
+            String dataTypeName = null;
+            if (dataType.getDataType() == ENUMERATION) {
+                YangEnumeration enumNode = (YangEnumeration) dataType.getDataTypeExtendedInfo();
+                dataTypeName = enumNode.getName();
+            } else if (dataType.getDataType() == UNION) {
+                YangUnion unionNode = (YangUnion) dataType.getDataTypeExtendedInfo();
+                dataTypeName = unionNode.getName();
+            }
+            if (potentialTypeNode.getName().contentEquals(dataTypeName)) {
+                dataType.setDataTypeExtendedInfo(potentialTypeNode);
+                return;
+            }
+            potentialTypeNode = potentialTypeNode.getNextSibling();
+        }
+
+        throw new DataModelException("Data model error: cloned leaves type is not found " +
+                                             dataType.getDataTypeName() + " in " +
+                                             dataType.getLineNumber() + " at " +
+                                             dataType.getCharPosition() +
+                                             " in " + dataType.getFileName() + "\"");
+    }
+
+    /**
+     * Parses jar file and returns list of serialized file names.
+     *
+     * @param jarFile   jar file to be parsed
+     * @param directory directory where to search
+     * @return list of serialized files
+     * @throws IOException when fails to do IO operations
+     */
+    public static List<YangNode> parseJarFile(String jarFile, String directory)
+            throws IOException {
+
+        List<YangNode> nodes = new ArrayList<>();
+        JarFile jar = new JarFile(jarFile);
+        Enumeration<?> enumEntries = jar.entries();
+
+        while (enumEntries.hasMoreElements()) {
+            JarEntry file = (JarEntry) enumEntries.nextElement();
+            if (file.getName().endsWith(".ser")) {
+
+                if (file.getName().contains(SLASH)) {
+                    String[] strArray = file.getName().split(SLASH);
+                    String tempPath = "";
+                    for (int i = 0; i < strArray.length - 1; i++) {
+                        tempPath = SLASH + tempPath + SLASH + strArray[i];
+                    }
+                    File dir = new File(directory + tempPath);
+                    dir.mkdirs();
+                }
+                File serializedFile = new File(directory + SLASH + file.getName());
+                if (file.isDirectory()) {
+                    serializedFile.mkdirs();
+                    continue;
+                }
+                InputStream inputStream = jar.getInputStream(file);
+
+                FileOutputStream fileOutputStream = new FileOutputStream(serializedFile);
+                while (inputStream.available() > 0) {
+                    fileOutputStream.write(inputStream.read());
+                }
+                fileOutputStream.close();
+                inputStream.close();
+                nodes.addAll(deSerializeDataModel(serializedFile.toString()));
+            }
+        }
+        jar.close();
+        return nodes;
+    }
+
+    /**
+     * Validates the requested data-type resolve type in empty or not.
+     *
+     * @param dataType the data type
+     * @return true, for empty resolved data-type; false otherwise
+     */
+    public static boolean validateEmptyDataType(YangType dataType) {
+        switch (dataType.getDataType()) {
+            case DERIVED:
+                return ((YangDerivedInfo) dataType.getDataTypeExtendedInfo())
+                        .getEffectiveBuiltInType().equals(EMPTY);
+
+            case LEAFREF:
+                YangType type = ((YangLeafRef) dataType
+                        .getDataTypeExtendedInfo())
+                        .getEffectiveDataType();
+                if (type.getDataType() == DERIVED) {
+                    return ((YangDerivedInfo) type.getDataTypeExtendedInfo())
+                            .getEffectiveBuiltInType().equals(EMPTY);
+                }
+                return ((YangLeafRef) dataType.getDataTypeExtendedInfo())
+                        .getEffectiveDataType().getDataType().equals(EMPTY);
+
+            case UNION:
+                return ((YangUnion) dataType.getDataTypeExtendedInfo())
+                        .getTypeList().contains(EMPTY);
+            default:
+                return dataType.getDataType().equals(EMPTY);
+        }
+    }
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/utils/FractionDigits.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/utils/FractionDigits.java
new file mode 100644
index 0000000..b64c548
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/utils/FractionDigits.java
@@ -0,0 +1,169 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.datamodel.utils;
+
+import org.onosproject.yang.compiler.datamodel.DefaultLocationInfo;
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+
+import java.math.BigDecimal;
+import java.util.ArrayList;
+
+/**
+ * The "fraction-digits" statement, which is a substatement to the
+ * "type" statement, MUST be present if the type is "decimal64".  It
+ * takes as an argument an integer between 1 and 18, inclusively.  It
+ * controls the size of the minimum difference between values of a
+ * decimal64 type, by restricting the value space to numbers that are
+ * expressible as "i x 10^-n" where n is the fraction-digits argument.
+ *
+ * +----------------+-----------------------+----------------------+
+ * | fraction-digit | min                   | max                  |
+ * +----------------+-----------------------+----------------------+
+ * | 1              | -922337203685477580.8 | 922337203685477580.7 |
+ * | 2              | -92233720368547758.08 | 92233720368547758.07 |
+ * | 3              | -9223372036854775.808 | 9223372036854775.807 |
+ * | 4              | -922337203685477.5808 | 922337203685477.5807 |
+ * | 5              | -92233720368547.75808 | 92233720368547.75807 |
+ * | 6              | -9223372036854.775808 | 9223372036854.775807 |
+ * | 7              | -922337203685.4775808 | 922337203685.4775807 |
+ * | 8              | -92233720368.54775808 | 92233720368.54775807 |
+ * | 9              | -9223372036.854775808 | 9223372036.854775807 |
+ * | 10             | -922337203.6854775808 | 922337203.6854775807 |
+ * | 11             | -92233720.36854775808 | 92233720.36854775807 |
+ * | 12             | -9223372.036854775808 | 9223372.036854775807 |
+ * | 13             | -922337.2036854775808 | 922337.2036854775807 |
+ * | 14             | -92233.72036854775808 | 92233.72036854775807 |
+ * | 15             | -9223.372036854775808 | 9223.372036854775807 |
+ * | 16             | -922.3372036854775808 | 922.3372036854775807 |
+ * | 17             | -92.23372036854775808 | 92.23372036854775807 |
+ * | 18             | -9.223372036854775808 | 9.223372036854775807 |
+ * +----------------+-----------------------+----------------------+
+ */
+
+/**
+ * Represents the decimal64 value range based on fraction-digits.
+ */
+public final class FractionDigits extends DefaultLocationInfo {
+
+    public static class Range {
+        private double min;
+        private double max;
+
+        /**
+         * Creates an instance of range.
+         *
+         * @param min minimum value of decimal64
+         * @param max maximum value of decimal64
+         */
+        protected Range(double min, double max) {
+            this.min = min;
+            this.max = max;
+        }
+
+        /**
+         * Retrieve minimum value range.
+         *
+         * @return minimum value range
+         */
+        public double getMin() {
+            return min;
+        }
+
+        /**
+         * Retrieve maximum value range.
+         *
+         * @return maximum value range
+         */
+        public double getMax() {
+            return max;
+        }
+    }
+
+    private static ArrayList<Range> decimal64ValueRange = null;
+
+    /**
+     * Creates a fraction-digits instance.
+     */
+    private FractionDigits() {
+    }
+
+    /**
+     * Generates decimal64 value range based on fraction-digits.
+     *
+     * @return decimal64 value range by fraction-digits as index
+     */
+    public static ArrayList<Range> getDecimal64ValueRange() {
+        if (decimal64ValueRange == null) {
+            decimal64ValueRange = new ArrayList<>();
+            decimal64ValueRange.add(new Range(-922337203685477580.8, 922337203685477580.7)); // fraction-digit: 1
+            decimal64ValueRange.add(new Range(-92233720368547758.08, 92233720368547758.07)); // fraction-digit: 2
+            decimal64ValueRange.add(new Range(-9223372036854775.808, 9223372036854775.807)); // fraction-digit: 3
+            decimal64ValueRange.add(new Range(-922337203685477.5808, 922337203685477.5807)); // fraction-digit: 4
+            decimal64ValueRange.add(new Range(-92233720368547.75808, 92233720368547.75807)); // fraction-digit: 5
+            decimal64ValueRange.add(new Range(-9223372036854.775808, 9223372036854.775807)); // fraction-digit: 6
+            decimal64ValueRange.add(new Range(-922337203685.4775808, 922337203685.4775807)); // fraction-digit: 7
+            decimal64ValueRange.add(new Range(-92233720368.54775808, 92233720368.54775807)); // fraction-digit: 8
+            decimal64ValueRange.add(new Range(-9223372036.854775808, 9223372036.854775807)); // fraction-digit: 9
+            decimal64ValueRange.add(new Range(-922337203.6854775808, 922337203.6854775807)); // fraction-digit: 10
+            decimal64ValueRange.add(new Range(-92233720.36854775808, 92233720.36854775807)); // fraction-digit: 11
+            decimal64ValueRange.add(new Range(-9223372.036854775808, 9223372.036854775807)); // fraction-digit: 12
+            decimal64ValueRange.add(new Range(-922337.2036854775808, 922337.2036854775807)); // fraction-digit: 13
+            decimal64ValueRange.add(new Range(-92233.72036854775808, 92233.72036854775807)); // fraction-digit: 14
+            decimal64ValueRange.add(new Range(-9223.372036854775808, 9223.372036854775807)); // fraction-digit: 15
+            decimal64ValueRange.add(new Range(-922.3372036854775808, 922.3372036854775807)); // fraction-digit: 16
+            decimal64ValueRange.add(new Range(-92.23372036854775808, 92.23372036854775807)); // fraction-digit: 17
+            decimal64ValueRange.add(new Range(-9.223372036854775808, 9.223372036854775807)); // fraction-digit: 18
+        }
+        return decimal64ValueRange;
+    }
+
+    /**
+     * Retrieve range based on fraction-digits.
+     *
+     * @param fractionDigit fraction-digits
+     * @return range
+     * @throws DataModelException a violation of data model rules
+     */
+    public static Range getRange(int fractionDigit) throws DataModelException {
+        if (!((fractionDigit >= 1) && (fractionDigit <= 18))) {
+            throw new DataModelException("YANG file error : given fraction-digit is not in its range (1..18).");
+        }
+
+        return getDecimal64ValueRange().get(fractionDigit - 1);
+    }
+
+    /**
+     * Checks whether specific decimal64 value is in correct range based fraction-digit.
+     *
+     * @param value decimal64 value
+     * @param fractionDigit fraction-digits
+     * @return true when it is in correct range otherwise false
+     */
+    public static boolean isValueInDecimal64Range(BigDecimal value, int fractionDigit) {
+        // Fraction-digits should be in correct its own range.
+        if (!((fractionDigit >= 1) && (fractionDigit <= 18))) {
+            return false;
+        }
+
+        // ArrayList index starts from 0.
+        FractionDigits.Range range = FractionDigits.getDecimal64ValueRange().get(fractionDigit - 1);
+        if ((value.doubleValue() >= range.getMin()) && (value.doubleValue() <= range.getMax())) {
+            return true;
+        }
+        return false;
+    }
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/utils/GeneratedLanguage.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/utils/GeneratedLanguage.java
new file mode 100644
index 0000000..ff1253b
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/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.yang.compiler.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/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/utils/Parsable.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/utils/Parsable.java
new file mode 100644
index 0000000..3ca59ce
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/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.yang.compiler.datamodel.utils;
+
+import org.onosproject.yang.compiler.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/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/utils/ResolvableStatus.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/utils/ResolvableStatus.java
new file mode 100644
index 0000000..f822d0b
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/utils/ResolvableStatus.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.datamodel.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,
+
+    /**
+     * Identifies that resolvable entity is referred node is not defined.
+     */
+    UNDEFINED
+
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/utils/RestrictionResolver.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/utils/RestrictionResolver.java
new file mode 100644
index 0000000..bed39cd
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/utils/RestrictionResolver.java
@@ -0,0 +1,203 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.datamodel.utils;
+
+import org.onosproject.yang.compiler.datamodel.YangRangeInterval;
+import org.onosproject.yang.compiler.datamodel.YangRangeRestriction;
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangBuiltInDataTypeInfo;
+import org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes;
+
+import static java.util.regex.Pattern.quote;
+import static org.onosproject.yang.compiler.datamodel.BuiltInTypeObjectFactory.getDataObjectFromString;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.LENGTH_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.RANGE_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.getYangConstructType;
+import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes.UINT64;
+
+/**
+ * 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";
+    private static final String SPACE = " ";
+    private static final String QUOTE = "\"";
+
+    /**
+     * Creates a restriction resolver.
+     */
+    private RestrictionResolver() {
+    }
+
+    /**
+     * Processes the range restriction for parser and linker.
+     *
+     * @param refRr    range restriction of referred typedef
+     * @param line     error line number
+     * @param position error character position in line
+     * @param hasRefR  whether has referred restriction
+     * @param curRange caller type's range string
+     * @param type     effective type, when called from linker
+     * @param fileName file name
+     * @return YANG range restriction
+     * @throws DataModelException a violation in data model rule
+     */
+    public static YangRangeRestriction processRangeRestriction(
+            YangRangeRestriction refRr, int line, int position,
+            boolean hasRefR, String curRange, YangDataTypes type, String fileName)
+            throws DataModelException {
+        return getRestriction(refRr, line, position, hasRefR, curRange, fileName,
+                              type, RANGE_DATA);
+    }
+
+    /**
+     * Processes the length restriction for parser and linker.
+     *
+     * @param refLr     length restriction of referred typedef
+     * @param line      error line number
+     * @param position  error character position in line
+     * @param hasRefR   whether has referred restriction
+     * @param curLenStr caller type's length string
+     * @param fileName  file name
+     * @return YANG range restriction
+     * @throws DataModelException a violation in data model rule
+     */
+    public static YangRangeRestriction processLengthRestriction(
+            YangRangeRestriction refLr, int line, int position, boolean hasRefR,
+            String curLenStr, String fileName) throws DataModelException {
+        return getRestriction(refLr, line, position, hasRefR, curLenStr, fileName,
+                              UINT64, LENGTH_DATA);
+    }
+
+    /**
+     * Processes the range/length restriction for parser and linker.
+     *
+     * @param refR     range/length restriction of referred typedef
+     * @param line     error line number
+     * @param position error character position in line
+     * @param hasRefR  whether has referred restriction
+     * @param curRange caller type's range string
+     * @param type     effective type, when called from linker
+     * @param fileName file name
+     * @param conType  construct type
+     * @return YANG range restriction
+     * @throws DataModelException a violation in data model rule
+     */
+    private static YangRangeRestriction getRestriction(
+            YangRangeRestriction refR, int line, int position, boolean hasRefR,
+            String curRange, String fileName, YangDataTypes type,
+            YangConstructType conType) throws
+            DataModelException {
+        YangBuiltInDataTypeInfo<?> startValue;
+        YangBuiltInDataTypeInfo<?> endValue;
+        YangRangeRestriction rr = new YangRangeRestriction();
+
+        String rangeArg = removeQuotesAndHandleConcat(curRange);
+        String[] rangeArguments = rangeArg.trim().split(quote(PIPE));
+
+        for (String rangePart : rangeArguments) {
+            String startInterval;
+            String endInterval;
+            YangRangeInterval rangeInterval = new YangRangeInterval();
+            rangeInterval.setCharPosition(position);
+            rangeInterval.setLineNumber(line);
+            rangeInterval.setFileName(fileName);
+            String[] rangeBoundary = rangePart.trim().split(quote(INTERVAL));
+
+            if (rangeBoundary.length > MAX_RANGE_BOUNDARY) {
+                DataModelException ex = new DataModelException(
+                        "YANG file error : " + getYangConstructType(conType) +
+                                SPACE + rangeArg + " is not valid.");
+                ex.setLine(line);
+                ex.setCharPosition(position);
+                ex.setFileName(fileName);
+                throw ex;
+            }
+
+            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 (hasRefR && startInterval.equals(MIN_KEYWORD) &&
+                        refR.getMinRestrictedValue() != null) {
+                    startValue = refR.getMinRestrictedValue();
+                } else if (hasRefR && startInterval.equals(MAX_KEYWORD) &&
+                        refR.getMaxRestrictedValue() != null) {
+                    startValue = refR.getMaxRestrictedValue();
+                } else {
+                    startValue = getDataObjectFromString(startInterval, type);
+                }
+                if (hasRefR && endInterval.equals(MIN_KEYWORD) &&
+                        refR.getMinRestrictedValue() != null) {
+                    endValue = refR.getMinRestrictedValue();
+                } else if (hasRefR && endInterval.equals(MAX_KEYWORD) &&
+                        refR.getMaxRestrictedValue() != null) {
+                    endValue = refR.getMaxRestrictedValue();
+                } else {
+                    endValue = getDataObjectFromString(endInterval, type);
+                }
+            } catch (Exception e) {
+                DataModelException ex = new DataModelException(e.getMessage());
+                ex.setLine(line);
+                ex.setCharPosition(position);
+                ex.setFileName(fileName);
+                throw ex;
+            }
+            rangeInterval.setStartValue(startValue);
+            rangeInterval.setEndValue(endValue);
+            try {
+                rr.addRangeRestrictionInterval(rangeInterval);
+            } catch (DataModelException ex) {
+                ex.setLine(line);
+                ex.setCharPosition(position);
+                ex.setFileName(fileName);
+                throw ex;
+            }
+        }
+        return rr;
+    }
+
+    /**
+     * 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(QUOTE, EMPTY_STRING);
+        String[] tmpData = yangStringData.split(quote(ADD));
+        StringBuilder builder = new StringBuilder();
+        for (String yangString : tmpData) {
+            builder.append(yangString);
+        }
+        return builder.toString();
+    }
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/utils/YangConstructType.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/utils/YangConstructType.java
new file mode 100644
index 0000000..9c9aedf
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/utils/YangConstructType.java
@@ -0,0 +1,574 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.yang.compiler.datamodel.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 decimal64 parsed data.
+     */
+    DECIMAL64_DATA,
+
+    /**
+     * Identifies the YANG fraction-digits parsed data.
+     */
+    FRACTION_DIGITS_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,
+
+    /**
+     * Identifies the YANG compiler annotation element parsed data.
+     */
+    COMPILER_ANNOTATION_DATA,
+
+    /**
+     * Identifies the YANG app data structure element parsed data.
+     */
+    APP_DATA_STRUCTURE,
+
+    /**
+     * Identifies the YANG app extended element parsed data.
+     */
+    APP_EXTENDED_NAME_DATA,
+
+    /**
+     * Identifies the YANG argument element parsed data.
+     */
+    ARGUMENT_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 DECIMAL64_DATA:
+                return "decimal64";
+            case FRACTION_DIGITS_DATA:
+                return "fraction-digits";
+            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";
+            case COMPILER_ANNOTATION_DATA:
+                return "compiler-annotation";
+            case APP_DATA_STRUCTURE:
+                return "app-data-structure";
+            case APP_EXTENDED_NAME_DATA:
+                return "app-extended-name";
+            case ARGUMENT_DATA:
+                return "argument";
+            default:
+                return "yang";
+        }
+    }
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/utils/YangErrMsgConstants.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/utils/YangErrMsgConstants.java
new file mode 100644
index 0000000..48f0bb8
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/utils/YangErrMsgConstants.java
@@ -0,0 +1,94 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.datamodel.utils;
+
+/**
+ * Represents default YANG error message types.
+ */
+public final class YangErrMsgConstants {
+
+    /**
+     * Static attribute for operation failed error tag.
+     */
+    public static final String OPERATION_FAILED_ERROR_TAG = "operation-failed";
+
+    /**
+     * Static attribute for data missing error tag.
+     */
+    public static final String DATA_MISSING_ERROR_TAG = "data-missing";
+
+    /**
+     * Static attribute for bad attribute error tag.
+     */
+    public static final String BAD_ATTRIBUTE_ERROR_TAG = "bad-attribute";
+
+    /**
+     * Static attribute for data not unique error app tag.
+     */
+    public static final String DATA_NOT_UNIQUE_ERROR_APP_TAG = "data-not-unique";
+
+    /**
+     * Static attribute for too many elements error app tag.
+     */
+    public static final String TOO_MANY_ELEMENTS_ERROR_APP_TAG = "too-many-elements";
+
+    /**
+     * Static attribute for too few elements error app tag.
+     */
+    public static final String TOO_FEW_ELEMENTS_ERROR_APP_TAG = "too-few-elements";
+
+    /**
+     * Static attribute for must violation error app tag.
+     */
+    public static final String MUST_VIOLATION_ERROR_APP_TAG = "must-violation";
+
+    /**
+     * Static attribute for instance required error app tag.
+     */
+    public static final String INSTANCE_REQUIRED_ERROR_APP_TAG = "instance-required";
+
+    /**
+     * Static attribute for missing choice error app tag.
+     */
+    public static final String MISSING_CHOICE_ERROR_APP_TAG = "missing-choice";
+
+    /**
+     * Static attribute for missing instance error app tag.
+     */
+    public static final String MISSING_INSTANCE_ERROR_APP_TAG = "missing-instance";
+
+    /**
+     * TODO: Static attribute for error path to the instance-identifier leaf.
+     */
+    public static final String ERROR_PATH_INSTANCE_IDENTIFIER_LEAF = "Path to the instance-identifier leaf.";
+
+    /**
+     * Static attribute for error path to the missing choice.
+     */
+    public static final String ERROR_PATH_MISSING_CHOICE = "Path to the element with the missing choice.";
+
+    /**
+     * Static attribute for error path to the leafref leaf.
+     */
+    public static final String ERROR_PATH_LEAFREF_LEAF = "Path to the leafref leaf.";
+
+    /**
+     * Creates an instance of yang error message constants.
+     */
+    private YangErrMsgConstants() {
+    }
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/utils/builtindatatype/DataTypeException.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/utils/builtindatatype/DataTypeException.java
new file mode 100644
index 0000000..115f611
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/utils/builtindatatype/DataTypeException.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.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/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/utils/builtindatatype/YangBuiltInDataTypeInfo.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/utils/builtindatatype/YangBuiltInDataTypeInfo.java
new file mode 100644
index 0000000..56b7a01
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/utils/builtindatatype/YangBuiltInDataTypeInfo.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.yang.compiler.datamodel.utils.builtindatatype;
+
+/**
+ * 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/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/utils/builtindatatype/YangDataTypeUtils.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/utils/builtindatatype/YangDataTypeUtils.java
new file mode 100644
index 0000000..75fb807
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/utils/builtindatatype/YangDataTypeUtils.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.yang.compiler.datamodel.utils.builtindatatype;
+
+import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes.INT16;
+import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes.INT32;
+import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes.INT64;
+import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes.INT8;
+import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes.UINT16;
+import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes.UINT32;
+import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes.UINT64;
+import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes.UINT8;
+
+/**
+ * Represents YANG data type utilities.
+ */
+public final class YangDataTypeUtils {
+
+    /**
+     * Restricts creation of YANG data type utils instance.
+     */
+    private YangDataTypeUtils() {
+    }
+
+    /**
+     * 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;
+    }
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/utils/builtindatatype/YangDataTypes.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/utils/builtindatatype/YangDataTypes.java
new file mode 100644
index 0000000..8221627
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/utils/builtindatatype/YangDataTypes.java
@@ -0,0 +1,285 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.datamodel.utils.builtindatatype;
+
+/**
+ * Represents ENUM to identify the YANG data type.
+ */
+public enum YangDataTypes {
+    /**
+     * Reference:RFC 6020.
+     * <p>
+     * int8 represents integer values between -128 and 127, inclusively.
+     */
+    INT8("int8"),
+
+    /**
+     * Reference:RFC 6020.
+     * <p>
+     * int16 represents integer values between -32768 and 32767, inclusively.
+     */
+    INT16("int16"),
+
+    /**
+     * Reference:RFC 6020.
+     * <p>
+     * int32 represents integer values between -2147483648 and 2147483647,
+     * inclusively.
+     */
+    INT32("int32"),
+
+    /**
+     * Reference:RFC 6020.
+     * <p>
+     * int64 represents integer values between -9223372036854775808 and
+     * 9223372036854775807, inclusively.
+     */
+    INT64("int64"),
+
+    /**
+     * Reference:RFC 6020.
+     * <p>
+     * uint8 represents integer values between 0 and 255, inclusively.
+     */
+    UINT8("uint8"),
+
+    /**
+     * Reference:RFC 6020.
+     * <p>
+     * uint16 represents integer values between 0 and 65535, inclusively.
+     */
+    UINT16("uint16"),
+
+    /**
+     * Reference:RFC 6020.
+     * <p>
+     * uint32 represents integer values between 0 and 4294967295, inclusively.
+     */
+    UINT32("uint32"),
+
+    /**
+     * Reference:RFC 6020.
+     * <p>
+     * uint64 represents integer values between 0 and 18446744073709551615,
+     * inclusively.
+     */
+    UINT64("uint64"),
+
+    /**
+     * Reference:RFC 6020.
+     * <p>
+     * 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("decimal64"), // TODO: need to implement in type.
+
+    /**
+     * Reference:RFC 6020.
+     * <p>
+     * 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("string"),
+
+    /**
+     * Reference:RFC 6020.
+     * <p>
+     * The boolean built-in type represents a boolean value.
+     */
+    BOOLEAN("boolean"),
+
+    /**
+     * Reference:RFC 6020.
+     * <p>
+     * The enumeration built-in type represents values from a set of assigned
+     * names.
+     */
+    ENUMERATION("enumeration"),
+
+    /**
+     * Reference:RFC 6020.
+     * <p>
+     * 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("bits"),
+
+    /**
+     * Reference:RFC 6020.
+     * <p>
+     * The binary built-in type represents any binary data, i.e., a sequence of
+     * octets.
+     */
+    BINARY("binary"),
+
+    /**
+     * Reference:RFC 6020.
+     * <p>
+     * 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.
+     * <p>
+     * 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.
+     * <p>
+     * There MUST NOT be any circular chains of leafrefs.
+     * <p>
+     * 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("leafref"),
+
+    /**
+     * Reference:RFC 6020.
+     * <p>
+     * The identityref type is used to reference an existing identity.
+     */
+    IDENTITYREF("identityref"),
+
+    /**
+     * Reference:RFC 6020.
+     * <p>
+     * The empty built-in type represents a leaf that does not have any value,
+     * it conveys information by its presence or absence.
+     * <p>
+     * An empty type cannot have a default value.
+     */
+    EMPTY("empty"),
+
+    /**
+     * Reference:RFC 6020.
+     * <p>
+     * The union built-in type represents a value that corresponds to one of its
+     * member types.
+     * <p>
+     * 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.
+     * <p>
+     * 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".
+     * <p>
+     * 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.
+     * <p>
+     * Any default value or "units" property defined in the member types is not
+     * inherited by the union type.
+     */
+    UNION("union"),
+
+    /**
+     * Reference:RFC 6020.
+     * <p>
+     * The instance-identifier built-in type is used to uniquely identify a
+     * particular instance node in the data tree.
+     * <p>
+     * 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.
+     * <p>
+     * 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("instance-identifier"),
+
+    /**
+     * Derived data type.
+     */
+    DERIVED("derived");
+
+    /**
+     * Defined type from the enum value.
+     */
+    private final String definedType;
+
+    /**
+     * Constructs type value from enum.
+     *
+     * @param definedType value of enum
+     */
+    YangDataTypes(String definedType) {
+        this.definedType = definedType;
+    }
+
+    /**
+     * 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.definedType.toLowerCase().equals(name)) {
+                return yangDataType;
+            }
+        }
+        return YangDataTypes.DERIVED;
+    }
+
+    /**
+     * Returns whether the data type is of primitive data type.
+     *
+     * @return true, if data type can have primitive data type, false otherwise
+     */
+    public boolean isPrimitiveDataType() {
+        return this == INT8 ||
+                this == INT16 ||
+                this == INT32 ||
+                this == INT64 ||
+                this == UINT8 ||
+                this == UINT16 ||
+                this == UINT32 ||
+                this == UINT64 ||
+                this == DECIMAL64 ||
+                this == BOOLEAN ||
+                this == EMPTY;
+    }
+
+    /**
+     * Returns whether the data type is of non restricted type.
+     *
+     * @return true, if data type can't be restricted, false otherwise
+     */
+    public boolean isNonRestrictedType() {
+        return this == BOOLEAN ||
+                this == ENUMERATION ||
+                this == BITS ||
+                this == EMPTY ||
+                this == UNION ||
+                this == IDENTITYREF ||
+                this == LEAFREF;
+    }
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/utils/builtindatatype/YangInt16.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/utils/builtindatatype/YangInt16.java
new file mode 100644
index 0000000..679196f
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/utils/builtindatatype/YangInt16.java
@@ -0,0 +1,101 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.datamodel.utils.builtindatatype;
+
+import org.onosproject.yang.compiler.datamodel.DefaultLocationInfo;
+
+import java.io.Serializable;
+
+import static java.lang.Short.compare;
+import static java.lang.Short.parseShort;
+
+/**
+ * Handles the YANG's int16 data type processing.
+ *
+ * int16 represents integer values between -32768 and 32767, inclusively.
+ */
+public class YangInt16 extends DefaultLocationInfo
+        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 = 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 compare(value, anotherYangInt16.value);
+    }
+
+    @Override
+    public YangDataTypes getYangType() {
+        return YangDataTypes.INT16;
+    }
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/utils/builtindatatype/YangInt32.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/utils/builtindatatype/YangInt32.java
new file mode 100644
index 0000000..6beac4c
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/utils/builtindatatype/YangInt32.java
@@ -0,0 +1,101 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.datamodel.utils.builtindatatype;
+
+import org.onosproject.yang.compiler.datamodel.DefaultLocationInfo;
+
+import java.io.Serializable;
+
+import static java.lang.Integer.compare;
+import static java.lang.Integer.parseInt;
+
+/**
+ * Handles the YANG's int32 data type processing.
+ *
+ * int32 represents integer values between -2147483648 and 2147483647, inclusively.
+ */
+public class YangInt32 extends DefaultLocationInfo
+        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 = 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 compare(value, anotherYangInt32.value);
+    }
+
+    @Override
+    public YangDataTypes getYangType() {
+        return YangDataTypes.INT32;
+    }
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/utils/builtindatatype/YangInt64.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/utils/builtindatatype/YangInt64.java
new file mode 100644
index 0000000..4bfe8b0
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/utils/builtindatatype/YangInt64.java
@@ -0,0 +1,102 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.datamodel.utils.builtindatatype;
+
+import org.onosproject.yang.compiler.datamodel.DefaultLocationInfo;
+
+import java.io.Serializable;
+
+import static java.lang.Long.compare;
+import static java.lang.Long.parseLong;
+import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes.INT64;
+
+/**
+ * Handles the YANG's int8 data type processing.
+ *
+ * int8 represents integer values between -9223372036854775808 and 9223372036854775807, inclusively.
+ */
+public class YangInt64 extends DefaultLocationInfo
+        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 = 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 compare(value, anotherYangInt64.value);
+    }
+
+    @Override
+    public YangDataTypes getYangType() {
+        return INT64;
+    }
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/utils/builtindatatype/YangInt8.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/utils/builtindatatype/YangInt8.java
new file mode 100644
index 0000000..e1474a9
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/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.yang.compiler.datamodel.utils.builtindatatype;
+
+import org.onosproject.yang.compiler.datamodel.DefaultLocationInfo;
+
+import java.io.Serializable;
+
+/**
+ * Handles the YANG's int8 data type processing.
+ *
+ * int8 represents integer values between -128 and 127, inclusively.
+ */
+public class YangInt8 extends DefaultLocationInfo
+        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/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/utils/builtindatatype/YangUint16.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/utils/builtindatatype/YangUint16.java
new file mode 100644
index 0000000..defa218
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/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.yang.compiler.datamodel.utils.builtindatatype;
+
+import org.onosproject.yang.compiler.datamodel.DefaultLocationInfo;
+
+import java.io.Serializable;
+
+/**
+ * Handles the YANG's Uint16 data type processing.
+ *
+ * Uint16 represents integer values between 0 and 65535, inclusively.
+ */
+public class YangUint16 extends DefaultLocationInfo
+        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
+     */
+    public 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/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/utils/builtindatatype/YangUint32.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/utils/builtindatatype/YangUint32.java
new file mode 100644
index 0000000..dd5176f
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/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.yang.compiler.datamodel.utils.builtindatatype;
+
+import org.onosproject.yang.compiler.datamodel.DefaultLocationInfo;
+
+import java.io.Serializable;
+
+/**
+ * Handles the YANG's Uint32 data type processing.
+ *
+ * Uint32 represents integer values between 0 and 4294967295, inclusively.
+ */
+public class YangUint32 extends DefaultLocationInfo
+        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
+     */
+    public 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/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/utils/builtindatatype/YangUint64.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/utils/builtindatatype/YangUint64.java
new file mode 100644
index 0000000..5568f85
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/utils/builtindatatype/YangUint64.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.yang.compiler.datamodel.utils.builtindatatype;
+
+import org.onosproject.yang.compiler.datamodel.DefaultLocationInfo;
+
+import java.io.Serializable;
+import java.math.BigInteger;
+
+/**
+ * Handles the YANG's Uint16 data type processing.
+ *
+ * Uint64 represents integer values between 0 and 18446744073709551615, inclusively.
+ */
+public class YangUint64 extends DefaultLocationInfo
+        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";
+
+    /**
+     * 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
+     */
+    public YangUint64(String valueInString) {
+
+        if (valueInString.matches(MIN_KEYWORD)) {
+            value = MIN_VALUE;
+        } else if (valueInString.matches(MAX_KEYWORD)) {
+            value = MAX_VALUE;
+        } else {
+            try {
+                value = new BigInteger(valueInString);
+            } catch (Exception e) {
+                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/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/utils/builtindatatype/YangUint8.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/utils/builtindatatype/YangUint8.java
new file mode 100644
index 0000000..93df40f
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/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.yang.compiler.datamodel.utils.builtindatatype;
+
+import org.onosproject.yang.compiler.datamodel.DefaultLocationInfo;
+
+import java.io.Serializable;
+
+/**
+ * Handles the YANG's Uint8 data type processing.
+ *
+ * Uint8 represents integer values between 0 and 255, inclusively.
+ */
+public class YangUint8 extends DefaultLocationInfo
+        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
+     */
+    public 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/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/utils/builtindatatype/package-info.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/utils/builtindatatype/package-info.java
new file mode 100644
index 0000000..e2a8a94
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/utils/builtindatatype/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 YANG built in data types.
+ */
+package org.onosproject.yang.compiler.datamodel.utils.builtindatatype;
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/utils/package-info.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/utils/package-info.java
new file mode 100644
index 0000000..563ea68
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/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.yang.compiler.datamodel.utils;
\ No newline at end of file
diff --git a/compiler/base/linker/pom.xml b/compiler/base/linker/pom.xml
new file mode 100644
index 0000000..7cd5222
--- /dev/null
+++ b/compiler/base/linker/pom.xml
@@ -0,0 +1,74 @@
+<!--
+  ~ 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-yang-compiler-base</artifactId>
+        <version>1.12-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>onos-yang-compiler-linker</artifactId>
+    <packaging>jar</packaging>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.onosproject</groupId>
+            <artifactId>onos-yang-compiler-datamodel</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.onosproject</groupId>
+            <artifactId>onos-yang-compiler-utils</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.onosproject</groupId>
+            <artifactId>onos-yang-compiler-translator</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>4.8.2</version>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-jar-plugin</artifactId>
+                <version>3.0.2</version>
+                <configuration>
+                    <skipIfEmpty>true</skipIfEmpty>
+                </configuration>
+                <executions>
+                    <execution>
+                        <id>default</id>
+                        <goals>
+                            <goal>test-jar</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+</project>
diff --git a/compiler/base/linker/src/main/java/org/onosproject/yang/compiler/linker/YangLinker.java b/compiler/base/linker/src/main/java/org/onosproject/yang/compiler/linker/YangLinker.java
new file mode 100644
index 0000000..b82e21e
--- /dev/null
+++ b/compiler/base/linker/src/main/java/org/onosproject/yang/compiler/linker/YangLinker.java
@@ -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.
+ */
+
+package org.onosproject.yang.compiler.linker;
+
+import org.onosproject.yang.compiler.datamodel.YangNode;
+
+import java.util.Set;
+
+/**
+ * Abstraction of entity which provides linking service of YANG files.
+ */
+public interface YangLinker {
+
+    /**
+     * Resolve the import and include dependencies for a given resolution
+     * information.
+     *
+     * @param yangNodeSet set of all dependent YANG nodes
+     */
+    void resolveDependencies(Set<YangNode> yangNodeSet);
+}
diff --git a/compiler/base/linker/src/main/java/org/onosproject/yang/compiler/linker/YangLinkingPhase.java b/compiler/base/linker/src/main/java/org/onosproject/yang/compiler/linker/YangLinkingPhase.java
new file mode 100644
index 0000000..bd7ecea
--- /dev/null
+++ b/compiler/base/linker/src/main/java/org/onosproject/yang/compiler/linker/YangLinkingPhase.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.linker;
+
+/**
+ * Represents the phase of YANG file reference linking.
+ */
+public enum YangLinkingPhase {
+
+    /**
+     * Linking the reference within the files.
+     */
+    INTRA_FILE,
+
+    /**
+     * Linking the reference across the files.
+     */
+    INTER_FILE
+
+}
diff --git a/compiler/base/linker/src/main/java/org/onosproject/yang/compiler/linker/exceptions/LinkerException.java b/compiler/base/linker/src/main/java/org/onosproject/yang/compiler/linker/exceptions/LinkerException.java
new file mode 100644
index 0000000..9bc3e5b
--- /dev/null
+++ b/compiler/base/linker/src/main/java/org/onosproject/yang/compiler/linker/exceptions/LinkerException.java
@@ -0,0 +1,117 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.linker.exceptions;
+
+/**
+ * Represents base class for exceptions in linker operations.
+ */
+public class LinkerException extends RuntimeException {
+
+    private static final long serialVersionUID = 20160211L;
+    private transient int lineNumber;
+    private transient int charPositionInLine;
+    private transient String fileName;
+
+    /**
+     * Creates a new linker exception.
+     */
+    public LinkerException() {
+        super();
+    }
+
+    /**
+     * Creates a new linker exception with given message.
+     *
+     * @param message the detail of exception in string
+     */
+    public LinkerException(String message) {
+        super(message);
+    }
+
+    /**
+     * Creates a new linker exception from given message and cause.
+     *
+     * @param message the detail of exception in string
+     * @param cause   underlying cause of the error
+     */
+    public LinkerException(final String message, final Throwable cause) {
+        super(message, cause);
+    }
+
+    /**
+     * Creates a new linker exception from cause.
+     *
+     * @param cause underlying cause of the error
+     */
+    public LinkerException(final Throwable cause) {
+        super(cause);
+    }
+
+    /**
+     * Returns line number of the exception.
+     *
+     * @return line number of the exception
+     */
+    public int getLineNumber() {
+        return this.lineNumber;
+    }
+
+    /**
+     * Returns YANG file name of the exception.
+     *
+     * @return YANG file name of the exception
+     */
+    public String getFileName() {
+        return this.fileName;
+    }
+
+    /**
+     * 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;
+    }
+
+    /**
+     * Sets file name in parser exception.
+     *
+     * @param fileName YANG file name
+     */
+    public void setFileName(String fileName) {
+        this.fileName = fileName;
+    }
+}
diff --git a/compiler/base/linker/src/main/java/org/onosproject/yang/compiler/linker/exceptions/package-info.java b/compiler/base/linker/src/main/java/org/onosproject/yang/compiler/linker/exceptions/package-info.java
new file mode 100644
index 0000000..a3de887
--- /dev/null
+++ b/compiler/base/linker/src/main/java/org/onosproject/yang/compiler/linker/exceptions/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.
+ */
+
+/**
+ * Custom linker exceptions.
+ */
+package org.onosproject.yang.compiler.linker.exceptions;
diff --git a/compiler/base/linker/src/main/java/org/onosproject/yang/compiler/linker/impl/PrefixResolverType.java b/compiler/base/linker/src/main/java/org/onosproject/yang/compiler/linker/impl/PrefixResolverType.java
new file mode 100644
index 0000000..a7896b7
--- /dev/null
+++ b/compiler/base/linker/src/main/java/org/onosproject/yang/compiler/linker/impl/PrefixResolverType.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.linker.impl;
+
+/**
+ * Enum for prefix resolver type when augment has come in path.
+ */
+enum PrefixResolverType {
+
+    /**
+     * When prefix changes from inter file to intra file.
+     */
+    INTER_TO_INTRA,
+
+    /**
+     * When prefix changes from intra file to inter file.
+     */
+    INTRA_TO_INTER,
+
+    /**
+     * When prefix changes from one inter file to other inter file.
+     */
+    INTER_TO_INTER,
+
+    /**
+     * When no prefix change occurs.
+     */
+    NO_PREFIX_CHANGE_FOR_INTRA,
+
+    /**
+     * When no prefix change occurs.
+     */
+    NO_PREFIX_CHANGE_FOR_INTER
+}
diff --git a/compiler/base/linker/src/main/java/org/onosproject/yang/compiler/linker/impl/XpathLinkingTypes.java b/compiler/base/linker/src/main/java/org/onosproject/yang/compiler/linker/impl/XpathLinkingTypes.java
new file mode 100644
index 0000000..a4345cf
--- /dev/null
+++ b/compiler/base/linker/src/main/java/org/onosproject/yang/compiler/linker/impl/XpathLinkingTypes.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.yang.compiler.linker.impl;
+
+/**
+ * Represents x path linking types.
+ */
+public enum XpathLinkingTypes {
+
+    // Augment path linking.
+    AUGMENT_LINKING,
+
+    // Leaf ref path linking.
+    LEAF_REF_LINKING,
+
+    // Compiler annotation linking.
+    COMPILER_ANNOTATION_LINKING
+}
diff --git a/compiler/base/linker/src/main/java/org/onosproject/yang/compiler/linker/impl/YangLinkerManager.java b/compiler/base/linker/src/main/java/org/onosproject/yang/compiler/linker/impl/YangLinkerManager.java
new file mode 100644
index 0000000..61528be
--- /dev/null
+++ b/compiler/base/linker/src/main/java/org/onosproject/yang/compiler/linker/impl/YangLinkerManager.java
@@ -0,0 +1,215 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.linker.impl;
+
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangReferenceResolver;
+import org.onosproject.yang.compiler.datamodel.YangSubModule;
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.linker.YangLinker;
+import org.onosproject.yang.compiler.linker.exceptions.LinkerException;
+
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import static java.util.Collections.sort;
+import static org.onosproject.yang.compiler.datamodel.ResolvableType.YANG_AUGMENT;
+import static org.onosproject.yang.compiler.datamodel.ResolvableType.YANG_BASE;
+import static org.onosproject.yang.compiler.datamodel.ResolvableType.YANG_COMPILER_ANNOTATION;
+import static org.onosproject.yang.compiler.datamodel.ResolvableType.YANG_DERIVED_DATA_TYPE;
+import static org.onosproject.yang.compiler.datamodel.ResolvableType.YANG_IDENTITYREF;
+import static org.onosproject.yang.compiler.datamodel.ResolvableType.YANG_IF_FEATURE;
+import static org.onosproject.yang.compiler.datamodel.ResolvableType.YANG_LEAFREF;
+import static org.onosproject.yang.compiler.datamodel.ResolvableType.YANG_USES;
+import static org.onosproject.yang.compiler.linker.impl.YangLinkerUtils.updateFilePriority;
+import static org.onosproject.yang.compiler.utils.UtilConstants.NEW_LINE;
+
+/**
+ * Representation of entity which provides linking service of YANG files.
+ */
+public class YangLinkerManager
+        implements YangLinker {
+
+    /*
+     * Set of all the YANG nodes, corresponding to the YANG files parsed by
+     * parser.
+     */
+    private Set<YangNode> yangNodeSet = new HashSet<>();
+
+    /**
+     * Returns set of YANG node.
+     *
+     * @return set of YANG node
+     */
+    public Set<YangNode> getYangNodeSet() {
+        return yangNodeSet;
+    }
+
+    /**
+     * Creates YANG nodes set.
+     *
+     * @param yangNodeSet YANG node information set
+     */
+    public void createYangNodeSet(Set<YangNode> yangNodeSet) {
+        getYangNodeSet().addAll(yangNodeSet);
+    }
+
+    @Override
+    public void resolveDependencies(Set<YangNode> yangNodeSet) {
+
+        // Create YANG node set.
+        createYangNodeSet(yangNodeSet);
+
+        // Carry out linking of sub module with module.
+        linkSubModulesToParentModule(yangNodeSet);
+
+        // Add references to import list.
+        addRefToYangFilesImportList(yangNodeSet);
+
+        // Add reference to include list.
+        addRefToYangFilesIncludeList(yangNodeSet);
+
+        // Update the priority for all the files.
+        updateFilePriority(yangNodeSet);
+
+        // TODO check for circular import/include.
+
+        // Carry out inter-file linking.
+        processInterFileLinking(yangNodeSet);
+    }
+
+    /**
+     * Resolves sub-module linking by linking sub module with parent module.
+     *
+     * @param yangNodeSet set of YANG files info
+     * @throws LinkerException fails to link sub-module to parent module
+     */
+    public void linkSubModulesToParentModule(Set<YangNode> yangNodeSet)
+            throws LinkerException {
+        for (YangNode yangNode : yangNodeSet) {
+            if (yangNode instanceof YangSubModule) {
+                try {
+                    ((YangSubModule) yangNode).linkWithModule(getYangNodeSet());
+                } catch (DataModelException e) {
+                    String errorInfo = "Error in file: " + yangNode.getName() + " in " +
+                            yangNode.getFileName() + " at " +
+                            "line: " + e.getLineNumber() + " at position: " + e.getCharPositionInLine() + NEW_LINE
+                            + e.getLocalizedMessage();
+                    throw new LinkerException(errorInfo);
+                    // TODO add file path in exception message in util manager.
+                }
+            }
+        }
+    }
+
+    /**
+     * Adds imported node information to the import list.
+     *
+     * @param yangNodeSet set of YANG files info
+     * @throws LinkerException fails to find imported module
+     */
+    public void addRefToYangFilesImportList(Set<YangNode> yangNodeSet)
+            throws LinkerException {
+        for (YangNode yangNode : yangNodeSet) {
+            if (yangNode instanceof YangReferenceResolver) {
+                try {
+                    ((YangReferenceResolver) yangNode).addReferencesToImportList(getYangNodeSet());
+                } catch (DataModelException e) {
+                    String errorInfo = "Error in file: " + yangNode.getName() + " in " +
+                            yangNode.getFileName() + " at " +
+                            "line: " + e.getLineNumber() + " at position: " + e.getCharPositionInLine() + NEW_LINE
+                            + e.getLocalizedMessage();
+                    throw new LinkerException(errorInfo);
+                    // TODO add file path in exception message in util manager.
+                }
+            }
+        }
+    }
+
+    /**
+     * Adds included node information to the include list.
+     *
+     * @param yangNodeSet set of YANG files info
+     * @throws LinkerException fails to find included sub-module
+     */
+    public void addRefToYangFilesIncludeList(Set<YangNode> yangNodeSet)
+            throws LinkerException {
+        for (YangNode yangNode : yangNodeSet) {
+            if (yangNode instanceof YangReferenceResolver) {
+                try {
+                    ((YangReferenceResolver) yangNode).addReferencesToIncludeList(getYangNodeSet());
+                } catch (DataModelException e) {
+                    String errorInfo = "Error in file: " + yangNode.getName() + " in " +
+                            yangNode.getFileName() + " at " +
+                            "line: " + e.getLineNumber() + " at position: " + e.getCharPositionInLine() + NEW_LINE
+                            + e.getLocalizedMessage();
+                    throw new LinkerException(errorInfo);
+                    // TODO add file path in exception message in util manager.
+                }
+            }
+        }
+    }
+
+    /**
+     * Processes inter file linking for type and uses.
+     *
+     * @param yangNodeSet set of YANG files info
+     * @throws LinkerException a violation in linker execution
+     */
+    public void processInterFileLinking(Set<YangNode> yangNodeSet)
+            throws LinkerException {
+        List<YangNode> yangNodeSortedList = new LinkedList<>();
+        yangNodeSortedList.addAll(yangNodeSet);
+        sort(yangNodeSortedList);
+        for (YangNode yangNode : yangNodeSortedList) {
+            try {
+                ((YangReferenceResolver) yangNode)
+                        .resolveInterFileLinking(YANG_IF_FEATURE);
+                ((YangReferenceResolver) yangNode)
+                        .resolveInterFileLinking(YANG_USES);
+                ((YangReferenceResolver) yangNode)
+                        .resolveInterFileLinking(YANG_AUGMENT);
+                ((YangReferenceResolver) yangNode)
+                        .resolveInterFileLinking(YANG_DERIVED_DATA_TYPE);
+                ((YangReferenceResolver) yangNode)
+                        .resolveInterFileLinking(YANG_BASE);
+                ((YangReferenceResolver) yangNode)
+                        .resolveInterFileLinking(YANG_IDENTITYREF);
+                ((YangReferenceResolver) yangNode)
+                        .resolveInterFileLinking(YANG_LEAFREF);
+                ((YangReferenceResolver) yangNode)
+                        .resolveInterFileLinking(YANG_COMPILER_ANNOTATION);
+            } catch (DataModelException e) {
+                String errorInfo = "Error in file: " + yangNode.getName() + " in " +
+                        yangNode.getFileName() + " at " +
+                        "line: " + e.getLineNumber() + " at position: " + e.getCharPositionInLine() + NEW_LINE
+                        + e.getLocalizedMessage();
+                throw new LinkerException(errorInfo);
+                // TODO add file path in exception message in util manager.
+            } catch (LinkerException e) {
+                String errorInfo = "Error in file: " + yangNode.getName() + " in " +
+                        yangNode.getFileName() + " at " +
+                        "line: " + e.getLineNumber() + " at position: " + e.getCharPositionInLine() + NEW_LINE
+                        + e.getLocalizedMessage();
+                throw new LinkerException(errorInfo);
+                // TODO add file path in exception message in util manager.
+            }
+        }
+    }
+}
diff --git a/compiler/base/linker/src/main/java/org/onosproject/yang/compiler/linker/impl/YangLinkerUtils.java b/compiler/base/linker/src/main/java/org/onosproject/yang/compiler/linker/impl/YangLinkerUtils.java
new file mode 100644
index 0000000..7783328
--- /dev/null
+++ b/compiler/base/linker/src/main/java/org/onosproject/yang/compiler/linker/impl/YangLinkerUtils.java
@@ -0,0 +1,934 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.linker.impl;
+
+import org.onosproject.yang.compiler.datamodel.TraversalType;
+import org.onosproject.yang.compiler.datamodel.YangAtomicPath;
+import org.onosproject.yang.compiler.datamodel.YangAugment;
+import org.onosproject.yang.compiler.datamodel.YangAugmentableNode;
+import org.onosproject.yang.compiler.datamodel.YangBase;
+import org.onosproject.yang.compiler.datamodel.YangCase;
+import org.onosproject.yang.compiler.datamodel.YangChoice;
+import org.onosproject.yang.compiler.datamodel.YangGrouping;
+import org.onosproject.yang.compiler.datamodel.YangIdentityRef;
+import org.onosproject.yang.compiler.datamodel.YangIfFeature;
+import org.onosproject.yang.compiler.datamodel.YangImport;
+import org.onosproject.yang.compiler.datamodel.YangInclude;
+import org.onosproject.yang.compiler.datamodel.YangLeaf;
+import org.onosproject.yang.compiler.datamodel.YangLeafList;
+import org.onosproject.yang.compiler.datamodel.YangLeafRef;
+import org.onosproject.yang.compiler.datamodel.YangLeavesHolder;
+import org.onosproject.yang.compiler.datamodel.YangList;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangNodeIdentifier;
+import org.onosproject.yang.compiler.datamodel.YangPathPredicate;
+import org.onosproject.yang.compiler.datamodel.YangReferenceResolver;
+import org.onosproject.yang.compiler.datamodel.YangRelativePath;
+import org.onosproject.yang.compiler.datamodel.YangType;
+import org.onosproject.yang.compiler.datamodel.YangTypeDef;
+import org.onosproject.yang.compiler.datamodel.YangUses;
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.datamodel.utils.YangConstructType;
+import org.onosproject.yang.compiler.linker.exceptions.LinkerException;
+import org.onosproject.yang.compiler.translator.exception.TranslatorException;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.regex.Pattern;
+
+import static org.onosproject.yang.compiler.datamodel.TraversalType.CHILD;
+import static org.onosproject.yang.compiler.datamodel.TraversalType.PARENT;
+import static org.onosproject.yang.compiler.datamodel.TraversalType.ROOT;
+import static org.onosproject.yang.compiler.datamodel.TraversalType.SIBILING;
+import static org.onosproject.yang.compiler.datamodel.exceptions.ErrorMessages.COLLISION_DETECTION;
+import static org.onosproject.yang.compiler.datamodel.exceptions.ErrorMessages.FAILED_TO_ADD_CASE;
+import static org.onosproject.yang.compiler.datamodel.exceptions.ErrorMessages.TARGET_NODE;
+import static org.onosproject.yang.compiler.datamodel.exceptions.ErrorMessages.TARGET_NODE_LEAF_INFO;
+import static org.onosproject.yang.compiler.datamodel.exceptions.ErrorMessages.getErrorMsg;
+import static org.onosproject.yang.compiler.datamodel.exceptions.ErrorMessages.getErrorMsgCollision;
+import static org.onosproject.yang.compiler.datamodel.utils.DataModelUtils.addResolutionInfo;
+import static org.onosproject.yang.compiler.datamodel.utils.GeneratedLanguage.JAVA_GENERATION;
+import static org.onosproject.yang.compiler.datamodel.utils.ResolvableStatus.RESOLVED;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.getYangConstructType;
+import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes.DERIVED;
+import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes.IDENTITYREF;
+import static org.onosproject.yang.compiler.translator.tojava.YangDataModelFactory.getYangCaseNode;
+import static org.onosproject.yang.compiler.utils.UtilConstants.BASE_LINKER_ERROR;
+import static org.onosproject.yang.compiler.utils.UtilConstants.COLON;
+import static org.onosproject.yang.compiler.utils.UtilConstants.COMMA;
+import static org.onosproject.yang.compiler.utils.UtilConstants.EMPTY_STRING;
+import static org.onosproject.yang.compiler.utils.UtilConstants.FEATURE_LINKER_ERROR;
+import static org.onosproject.yang.compiler.utils.UtilConstants.GROUPING_LINKER_ERROR;
+import static org.onosproject.yang.compiler.utils.UtilConstants.IDENTITYREF_LINKER_ERROR;
+import static org.onosproject.yang.compiler.utils.UtilConstants.INVALID_TREE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.IS_INVALID;
+import static org.onosproject.yang.compiler.utils.UtilConstants.LEAFREF_ERROR;
+import static org.onosproject.yang.compiler.utils.UtilConstants.LEAFREF_LINKER_ERROR;
+import static org.onosproject.yang.compiler.utils.UtilConstants.TYPEDEF_LINKER_ERROR;
+
+/**
+ * Represent utilities for YANG linker.
+ */
+public final class YangLinkerUtils {
+
+    private static final int IDENTIFIER_LENGTH = 64;
+    private static final Pattern IDENTIFIER_PATTERN =
+            Pattern.compile("[a-zA-Z_][a-zA-Z0-9_.-]*");
+    private static final String XML = "xml";
+    private static final String INVALID_PATH_PRE =
+            "YANG file error: The path predicate of the leafref has an " +
+                    "invalid path in ";
+    private static final String EMPTY_PATH_LIST_ERR =
+            "YANG file error : The atomic path list cannot be empty of the " +
+                    "leafref in the path ";
+    private static final String TGT_LEAF_ERR =
+            "YANG file error: There is no leaf/leaf-list in YANG node as " +
+                    "mentioned in the path predicate of the leafref path ";
+    private static final String LEAF_REF_LIST_ERR =
+            "YANG file error: Path predicates are only applicable for YANG " +
+                    "list. The leafref path has path predicate for non-list " +
+                    "node in the path ";
+
+    // No instantiation.
+    private YangLinkerUtils() {
+    }
+
+    /**
+     * Detects collision between target nodes leaf/leaf-list or child node with augmented leaf/leaf-list or child node.
+     *
+     * @param targetNode target node
+     * @param augment    augment node
+     */
+    private static void detectCollision(YangNode targetNode, YangAugment augment) {
+        YangNode targetNodesChild = targetNode.getChild();
+        YangNode augmentsChild = augment.getChild();
+        if (targetNode instanceof YangChoice) {
+            addCaseNodeToChoiceTarget(augment);
+        } else {
+            detectCollisionInLeaveHolders(targetNode, augment);
+            while (augmentsChild != null) {
+                detectCollisionInChildNodes(targetNodesChild, augmentsChild);
+                augmentsChild = augmentsChild.getNextSibling();
+            }
+        }
+    }
+
+    /*Detects collision between leaves/leaf-lists*/
+    private static void detectCollisionInLeaveHolders(YangNode targetNode, YangAugment augment) {
+        YangLeavesHolder targetNodesLeavesHolder = (YangLeavesHolder) targetNode;
+        if (augment.getListOfLeaf() != null && augment.getListOfLeaf().isEmpty() &&
+                targetNodesLeavesHolder.getListOfLeaf() != null) {
+            for (YangLeaf leaf : augment.getListOfLeaf()) {
+                for (YangLeaf targetLeaf : targetNodesLeavesHolder.getListOfLeaf()) {
+                    detectCollision(targetLeaf.getName(), leaf.getName(),
+                                    leaf.getLineNumber(),
+                                    leaf.getCharPosition(),
+                                    leaf.getFileName(), TARGET_NODE_LEAF_INFO);
+                }
+            }
+        }
+        if (augment.getListOfLeafList() != null &&
+                augment.getListOfLeafList().isEmpty() &&
+                targetNodesLeavesHolder.getListOfLeafList() != null) {
+            for (YangLeafList leafList : augment.getListOfLeafList()) {
+                for (YangLeafList targetLeafList : targetNodesLeavesHolder.getListOfLeafList()) {
+                    detectCollision(targetLeafList.getName(), leafList.getName(),
+                                    leafList.getLineNumber(),
+                                    leafList.getCharPosition(),
+                                    leafList.getFileName(), TARGET_NODE_LEAF_INFO);
+                }
+            }
+        }
+    }
+
+
+    private static void detectCollision(String first, String second,
+                                        int line, int position, String
+                                                fileName, String type) {
+        if (first.equals(second)) {
+            throw new LinkerException(getErrorMsgCollision(
+                    COLLISION_DETECTION, second, line, position, type,
+                    fileName));
+        }
+    }
+
+    /*Detects collision for child nodes.*/
+    private static void detectCollisionInChildNodes(YangNode targetNodesChild,
+                                                    YangNode augmentsChild) {
+        while (augmentsChild != null) {
+            while (targetNodesChild != null) {
+                if (targetNodesChild.getName().equals(augmentsChild.getName())) {
+                    detectCollision(targetNodesChild.getName(), augmentsChild.getName(),
+                                    augmentsChild.getLineNumber(),
+                                    augmentsChild.getCharPosition(),
+                                    augmentsChild.getFileName(), TARGET_NODE);
+                }
+                targetNodesChild = targetNodesChild.getNextSibling();
+            }
+            augmentsChild = augmentsChild.getNextSibling();
+        }
+    }
+
+    /**
+     * Adds a case node in augment when augmenting a choice node.
+     *
+     * @param augment augment node
+     */
+    private static void addCaseNodeToChoiceTarget(YangAugment augment) {
+        try {
+            YangNode child = augment.getChild();
+            List<YangNode> childNodes = new ArrayList<>();
+            List<YangNode> caseNodes = new ArrayList<>();
+            while (child != null) {
+                if (!(child instanceof YangCase)) {
+                    childNodes.add(child);
+                } else {
+                    caseNodes.add(child);
+                }
+                child = child.getNextSibling();
+            }
+            augment.setChild(null);
+
+            for (YangNode node : childNodes) {
+                Map<YangNode, List<YangNode>> map = new LinkedHashMap<>();
+                node.setNextSibling(null);
+                node.setPreviousSibling(null);
+                node.setParent(null);
+                YangCase javaCase = getYangCaseNode(JAVA_GENERATION);
+                javaCase.setName(node.getName());
+                //Break the tree to from a new tree.
+                traverseAndBreak(node, map);
+                augment.addChild(javaCase);
+                node.setParent(javaCase);
+                javaCase.addChild(node);
+                //Connect each node to its correct parent again.
+                connectTree(map);
+            }
+
+            for (YangNode node : caseNodes) {
+                Map<YangNode, List<YangNode>> map = new LinkedHashMap<>();
+                node.setNextSibling(null);
+                node.setPreviousSibling(null);
+                node.setParent(null);
+                //Break the tree to from a new tree.
+                traverseAndBreak(node, map);
+                augment.addChild(node);
+                node.setParent(augment);
+                //Connect each node to its correct parent again.
+                connectTree(map);
+            }
+            if (augment.getListOfLeaf() != null) {
+                for (YangLeaf leaf : augment.getListOfLeaf()) {
+                    YangCase javaCase = getYangCaseNode(JAVA_GENERATION);
+                    javaCase.setName(leaf.getName());
+                    javaCase.addLeaf(leaf);
+                    augment.addChild(javaCase);
+                }
+                augment.getListOfLeaf().clear();
+            }
+            if (augment.getListOfLeafList() != null) {
+                for (YangLeafList leafList : augment.getListOfLeafList()) {
+                    YangCase javaCase = getYangCaseNode(JAVA_GENERATION);
+                    javaCase.setName(leafList.getName());
+                    javaCase.addLeafList(leafList);
+                    augment.addChild(javaCase);
+                }
+                augment.getListOfLeafList().clear();
+            }
+        } catch (DataModelException e) {
+            throw new TranslatorException(
+                    getErrorMsg(FAILED_TO_ADD_CASE, augment.getName(),
+                                augment.getLineNumber(), augment.getCharPosition(),
+                                augment.getFileName()));
+        }
+    }
+
+    private static void connectTree(Map<YangNode, List<YangNode>> map)
+            throws DataModelException {
+        ArrayList<YangNode> keys = new ArrayList<>(map.keySet());
+        int size = keys.size();
+        for (int i = size - 1; i >= 0; i--) {
+            YangNode curNode = keys.get(i);
+            List<YangNode> nodes = map.get(curNode);
+            if (nodes != null) {
+                for (YangNode node : nodes) {
+                    curNode.addChild(node);
+                }
+            }
+        }
+        map.clear();
+    }
+
+    private static void processHierarchyChild(YangNode node,
+                                              Map<YangNode, List<YangNode>> map) {
+        YangNode child = node.getChild();
+        if (child != null) {
+            List<YangNode> nodes = new ArrayList<>();
+            while (child != null) {
+                nodes.add(child);
+                child.setParent(null);
+                child = child.getNextSibling();
+                if (child != null) {
+                    child.getPreviousSibling().setNextSibling(null);
+                    child.setPreviousSibling(null);
+                }
+            }
+            map.put(node, nodes);
+        }
+        node.setChild(null);
+    }
+
+    private static void traverseAndBreak(YangNode rootNode,
+                                         Map<YangNode, List<YangNode>> map) {
+
+        YangNode curNode = rootNode;
+        TraversalType curTraversal = ROOT;
+        while (curNode != null) {
+            if (curTraversal != PARENT && curNode.getChild() != null) {
+                curTraversal = CHILD;
+                curNode = curNode.getChild();
+            } else if (curNode.getNextSibling() != null) {
+                curTraversal = SIBILING;
+                curNode = curNode.getNextSibling();
+            } else {
+                curTraversal = PARENT;
+                curNode = curNode.getParent();
+                if (curNode != null) {
+                    processHierarchyChild(curNode, map);
+                }
+            }
+        }
+    }
+
+    /**
+     * Returns error messages.
+     *
+     * @param resolvable resolvable entity
+     * @return error message
+     */
+    static String getErrorInfoForLinker(Object resolvable) {
+        if (resolvable instanceof YangType) {
+            return TYPEDEF_LINKER_ERROR;
+        }
+        if (resolvable instanceof YangUses) {
+            return GROUPING_LINKER_ERROR;
+        }
+        if (resolvable instanceof YangIfFeature) {
+            return FEATURE_LINKER_ERROR;
+        }
+        if (resolvable instanceof YangBase) {
+            return BASE_LINKER_ERROR;
+        }
+        if (resolvable instanceof YangIdentityRef) {
+            return IDENTITYREF_LINKER_ERROR;
+        }
+        return LEAFREF_LINKER_ERROR;
+    }
+
+    /**
+     * Returns leafref's error message.
+     *
+     * @param leafref leaf ref
+     * @return error message
+     */
+    static String getLeafRefErrorInfo(YangLeafRef leafref) {
+        return getErrorMsg(
+                LEAFREF_ERROR + leafref.getPath() + COMMA + IS_INVALID, EMPTY_STRING,
+                leafref.getLineNumber(), leafref.getCharPosition(), leafref
+                        .getFileName());
+    }
+
+    /**
+     * Detects collision between target nodes and its all leaf/leaf-list or child node with augmented leaf/leaf-list or
+     * child node.
+     *
+     * @param targetNode target node
+     * @param augment    augment node
+     */
+    static void detectCollisionForAugmentedNode(YangNode targetNode, YangAugment augment) {
+        // Detect collision for target node and augment node.
+        detectCollision(targetNode, augment);
+        List<YangAugment> yangAugmentedInfo = ((YangAugmentableNode) targetNode).getAugmentedInfoList();
+        // Detect collision for target augment node and current augment node.
+        for (YangAugment info : yangAugmentedInfo) {
+            detectCollision(info, augment);
+        }
+    }
+
+    /**
+     * Returns list of path names that are needed from augment.
+     *
+     * @param augment            instance of YANG augment
+     * @param remainingAncestors ancestor count to move in augment path
+     * @return list of path names needed in leafref
+     */
+    static List<String> getPathWithAugment(YangAugment augment, int remainingAncestors) {
+        List<String> listOfPathName = new ArrayList<>();
+        for (YangAtomicPath atomicPath : augment.getTargetNode()) {
+            if (atomicPath.getNodeIdentifier().getPrefix() != null &&
+                    !atomicPath.getNodeIdentifier().getPrefix().equals(EMPTY_STRING)) {
+                listOfPathName.add(atomicPath.getNodeIdentifier().getPrefix()
+                                           + COLON + atomicPath.getNodeIdentifier().getName());
+            } else {
+                listOfPathName.add(atomicPath.getNodeIdentifier().getName());
+            }
+        }
+        for (int countOfAncestor = 0; countOfAncestor < remainingAncestors; countOfAncestor++) {
+            listOfPathName.remove(listOfPathName.size() - 1);
+        }
+        return listOfPathName;
+    }
+
+    /**
+     * Skips the invalid nodes which cannot have data from YANG.
+     *
+     * @param curParent current parent
+     * @param leafRef   YANG leaf-ref
+     * @return parent node which can hold data
+     * @throws LinkerException if linker rules are violated
+     */
+    public static YangNode skipInvalidDataNodes(YangNode curParent,
+                                                YangLeafRef leafRef)
+            throws LinkerException {
+
+        YangNode node = curParent;
+        while (node instanceof YangChoice ||
+                node instanceof YangCase) {
+
+            if (node.getParent() == null) {
+                throw new LinkerException(getLeafRefErrorInfo(leafRef));
+            }
+            node = node.getParent();
+        }
+        return node;
+    }
+
+    /**
+     * Checks and return valid node identifier.
+     *
+     * @param nodeIdentifierString string from yang file
+     * @param yangConstruct        yang construct for creating error message
+     * @return valid node identifier
+     */
+    static YangNodeIdentifier getValidNodeIdentifier(String nodeIdentifierString,
+                                                     YangConstructType yangConstruct) {
+        String[] tmpData = nodeIdentifierString.split(Pattern.quote(COLON));
+        if (tmpData.length == 1) {
+            YangNodeIdentifier nodeIdentifier = new YangNodeIdentifier();
+            nodeIdentifier.setName(getValidIdentifier(tmpData[0], yangConstruct));
+            return nodeIdentifier;
+        } else if (tmpData.length == 2) {
+            YangNodeIdentifier nodeIdentifier = new YangNodeIdentifier();
+            nodeIdentifier.setPrefix(getValidIdentifier(tmpData[0], yangConstruct));
+            nodeIdentifier.setName(getValidIdentifier(tmpData[1], yangConstruct));
+            return nodeIdentifier;
+        } else {
+            throw new LinkerException("YANG file error : " +
+                                              getYangConstructType(yangConstruct) + " name " + nodeIdentifierString +
+                                              " is not valid.");
+        }
+    }
+
+    /**
+     * Validates identifier and returns concatenated string if string contains plus symbol.
+     *
+     * @param identifier    string from yang file
+     * @param yangConstruct yang construct for creating error message=
+     * @return concatenated string after removing double quotes
+     */
+    public static String getValidIdentifier(String identifier, YangConstructType yangConstruct) {
+
+        if (identifier.length() > IDENTIFIER_LENGTH) {
+            throw new LinkerException("YANG file error : " +
+                                              getYangConstructType(yangConstruct) + " name " + identifier + " is " +
+                                              "greater than 64 characters.");
+        } else if (!IDENTIFIER_PATTERN.matcher(identifier).matches()) {
+            throw new LinkerException("YANG file error : " +
+                                              getYangConstructType(yangConstruct) + " name " + identifier + " is not " +
+                                              "valid.");
+        } else if (identifier.toLowerCase().startsWith(XML)) {
+            throw new LinkerException("YANG file error : " +
+                                              getYangConstructType(yangConstruct) + " identifier " + identifier +
+                                              " must not start with (('X'|'x') ('M'|'m') ('L'|'l')).");
+        } else {
+            return identifier;
+        }
+    }
+
+    /**
+     * Updates the priority for all the input files.
+     *
+     * @param yangNodeSet set of YANG files info
+     */
+    public static void updateFilePriority(Set<YangNode> yangNodeSet) {
+        for (YangNode yangNode : yangNodeSet) {
+            updateFilePriorityOfNode(yangNode);
+        }
+    }
+
+    /**
+     * Updates priority of the node.
+     *
+     * @param yangNode YANG node information
+     */
+    private static void updateFilePriorityOfNode(YangNode yangNode) {
+        int curNodePriority = yangNode.getPriority();
+        if (yangNode instanceof YangReferenceResolver) {
+            List<YangImport> yangImportList = ((YangReferenceResolver) yangNode).getImportList();
+            Iterator<YangImport> importInfoIterator = yangImportList.iterator();
+            // Run through the imported list to update priority.
+            while (importInfoIterator.hasNext()) {
+                YangImport yangImport = importInfoIterator.next();
+                YangNode importedNode = yangImport.getImportedNode();
+                if (curNodePriority >= importedNode.getPriority()) {
+                    importedNode.setPriority(curNodePriority + 1);
+                    updateFilePriorityOfNode(importedNode);
+                }
+            }
+
+            List<YangInclude> yangIncludeList = ((YangReferenceResolver) yangNode).getIncludeList();
+            Iterator<YangInclude> includeInfoIterator = yangIncludeList.iterator();
+            // Run through the imported list to update priority.
+            while (includeInfoIterator.hasNext()) {
+                YangInclude yangInclude = includeInfoIterator.next();
+                YangNode includedNode = yangInclude.getIncludedNode();
+                if (curNodePriority >= includedNode.getPriority()) {
+                    includedNode.setPriority(curNodePriority + 1);
+                    updateFilePriorityOfNode(includedNode);
+                }
+            }
+        }
+    }
+
+    /**
+     * Add the unresolved data under the root leve grouping to be resolved, since it will be used in interfile uses.
+     *
+     * @param referenceResolver module / sub-module
+     */
+    public static void resolveGroupingInDefinationScope(YangReferenceResolver referenceResolver) {
+        YangNode potentialInterFileGrouping = ((YangNode) referenceResolver).getChild();
+
+        while (potentialInterFileGrouping != null) {
+            if (potentialInterFileGrouping instanceof YangGrouping) {
+                addGroupingResolvableEntitiesToResolutionList((YangGrouping) potentialInterFileGrouping);
+            }
+
+            potentialInterFileGrouping = potentialInterFileGrouping.getNextSibling();
+        }
+    }
+
+    /**
+     * Add the interfile grouping resolvable entities to reesolution list.
+     *
+     * @param interFileGrouping interfile grouping
+     */
+    private static void addGroupingResolvableEntitiesToResolutionList(YangGrouping interFileGrouping) {
+        YangNode curNode = interFileGrouping;
+        TraversalType curTraversal = ROOT;
+        addResolvableLeavesToResolutionList((YangLeavesHolder) curNode);
+        curTraversal = CHILD;
+        curNode = interFileGrouping.getChild();
+        if (curNode == null) {
+            return;
+        }
+        while (curNode != interFileGrouping) {
+            if (curTraversal != PARENT) {
+                if (curNode instanceof YangGrouping || curNode instanceof YangUses) {
+                    if (curNode.getNextSibling() != null) {
+                        curTraversal = SIBILING;
+                        curNode = curNode.getNextSibling();
+                    } else {
+                        curTraversal = PARENT;
+                        curNode = curNode.getParent();
+                    }
+                    continue;
+                }
+
+                if (curNode instanceof YangLeavesHolder) {
+                    addResolvableLeavesToResolutionList((YangLeavesHolder) curNode);
+                } else if (curNode instanceof YangTypeDef) {
+                    List<YangType<?>> typeList = ((YangTypeDef) curNode).getTypeList();
+                    if (!typeList.isEmpty()) {
+                        YangType<?> type = typeList.get(0);
+                        if (type.getDataType() == DERIVED) {
+                            if (type.getResolvableStatus() != RESOLVED) {
+
+                                type.setTypeForInterFileGroupingResolution(true);
+
+                                // Add resolution information to the list
+                                YangResolutionInfoImpl resolutionInfo =
+                                        new YangResolutionInfoImpl<YangType>(type, curNode, type.getLineNumber(),
+                                                                             type.getCharPosition());
+                                try {
+                                    addResolutionInfo(resolutionInfo);
+                                } catch (DataModelException e) {
+                                    String errorInfo = "Error in file: " + curNode.getName() + " in " +
+                                            curNode.getFileName() + " at " +
+                                            "line: " + e.getLineNumber() +
+                                            " at position: " + e.getCharPositionInLine()
+                                            + e.getLocalizedMessage();
+                                    throw new LinkerException("Failed to add type info in grouping to resolution "
+                                                                      + errorInfo);
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+            if (curTraversal != PARENT && curNode.getChild() != null) {
+                curTraversal = CHILD;
+                curNode = curNode.getChild();
+            } else if (curNode.getNextSibling() != null) {
+
+                curTraversal = SIBILING;
+                curNode = curNode.getNextSibling();
+            } else {
+                curTraversal = PARENT;
+                curNode = curNode.getParent();
+            }
+        }
+    }
+
+    /**
+     * Add resolvable leaves type info to resolution list.
+     *
+     * @param leavesHolder leaves holder node
+     */
+    private static void addResolvableLeavesToResolutionList(YangLeavesHolder leavesHolder) {
+        if (leavesHolder.getListOfLeaf() != null && !leavesHolder.getListOfLeaf().isEmpty()) {
+            for (YangLeaf leaf : leavesHolder.getListOfLeaf()) {
+                YangType type = leaf.getDataType();
+                if (type.getDataType() == DERIVED) {
+
+                    type.setTypeForInterFileGroupingResolution(true);
+
+                    // Add resolution information to the list
+                    YangResolutionInfoImpl resolutionInfo =
+                            new YangResolutionInfoImpl<>(type, (YangNode) leavesHolder,
+                                                         type.getLineNumber(), type.getCharPosition());
+                    try {
+                        addResolutionInfo(resolutionInfo);
+                    } catch (DataModelException e) {
+                        throw new LinkerException("Failed to add leaf type info in grouping, to resolution ");
+                    }
+                } else if (type.getDataType() == IDENTITYREF) {
+                    YangIdentityRef identityRef = (YangIdentityRef) type.getDataTypeExtendedInfo();
+
+                    identityRef.setIdentityForInterFileGroupingResolution(true);
+
+                    // Add resolution information to the list
+                    YangResolutionInfoImpl resolutionInfo =
+                            new YangResolutionInfoImpl<YangIdentityRef>(identityRef, (YangNode) leavesHolder,
+                                                                        identityRef.getLineNumber(), identityRef.getCharPosition());
+                    try {
+                        addResolutionInfo(resolutionInfo);
+                    } catch (DataModelException e) {
+                        throw new LinkerException("Failed to add leaf identity ref info in grouping, to resolution ");
+                    }
+                }
+            }
+        }
+
+        if (leavesHolder.getListOfLeafList() != null && !leavesHolder.getListOfLeafList().isEmpty()) {
+            for (YangLeafList leafList : leavesHolder.getListOfLeafList()) {
+                YangType type = leafList.getDataType();
+                if (type.getDataType() == DERIVED) {
+
+                    type.setTypeForInterFileGroupingResolution(true);
+
+                    // Add resolution information to the list
+                    YangResolutionInfoImpl resolutionInfo =
+                            new YangResolutionInfoImpl<YangType>(type, (YangNode) leavesHolder,
+                                                                 type.getLineNumber(), type.getCharPosition());
+                    try {
+                        addResolutionInfo(resolutionInfo);
+                    } catch (DataModelException e) {
+                        throw new LinkerException("Failed to add leaf type info in grouping, to resolution ");
+                    }
+                } else if (type.getDataType() == IDENTITYREF) {
+                    YangIdentityRef identityRef = (YangIdentityRef) type.getDataTypeExtendedInfo();
+
+                    identityRef.setIdentityForInterFileGroupingResolution(true);
+                    // Add resolution information to the list
+                    YangResolutionInfoImpl resolutionInfo =
+                            new YangResolutionInfoImpl<YangIdentityRef>(identityRef, (YangNode) leavesHolder,
+                                                                        identityRef.getLineNumber(), identityRef.getCharPosition());
+                    try {
+                        addResolutionInfo(resolutionInfo);
+                    } catch (DataModelException e) {
+                        throw new LinkerException("Failed to add leaf identity ref info in grouping, to resolution ");
+                    }
+                }
+            }
+        }
+    }
+
+    /**
+     * Fills the path predicates of the leaf-ref with right axis node and
+     * left axis node, after linking the nodes.
+     *
+     * @param leafRef YANG leaf-ref
+     * @throws DataModelException if there is a data model error
+     */
+    public static void fillPathPredicates(YangLeafRef<?> leafRef)
+            throws DataModelException {
+
+        List<YangAtomicPath> atomics = leafRef.getAtomicPath();
+        if (atomics != null) {
+            for (YangAtomicPath atom : atomics) {
+                List<YangPathPredicate> predicates =
+                        atom.getPathPredicatesList();
+
+                if (predicates != null) {
+                    for (YangPathPredicate predicate : predicates) {
+                        setLeftAxisNode(leafRef, atom, predicate);
+                        setRightAxisNode(leafRef, predicate);
+                    }
+                }
+            }
+        }
+    }
+
+    /**
+     * Sets the left axis node in the YANG path predicate after finding it
+     * under the YANG list node.
+     *
+     * @param leafRef   YANG leaf-ref
+     * @param atom      atomic path content
+     * @param predicate predicate in the atomic path
+     * @throws DataModelException if there is a data model error
+     */
+    private static void setLeftAxisNode(YangLeafRef<?> leafRef,
+                                        YangAtomicPath atom,
+                                        YangPathPredicate predicate)
+            throws DataModelException {
+        YangNode resolvedNode = atom.getResolvedNode();
+        if (!(resolvedNode instanceof YangList)) {
+            throw getDataModelExc(LEAF_REF_LIST_ERR, leafRef);
+        }
+
+        YangNodeIdentifier leftAxisName = predicate.getNodeId();
+        Object target = getTarget(leftAxisName, resolvedNode, leafRef);
+        predicate.setLeftAxisNode(target);
+    }
+
+    /**
+     * Returns the target leaf/leaf-list from the provided YANG node.
+     *
+     * @param leftAxisName name of node
+     * @param node         node having target
+     * @param leafRef      YANG leaf-ref
+     * @return target leaf/leaf-list
+     * @throws DataModelException if there is a data model error
+     */
+    private static Object getTarget(YangNodeIdentifier leftAxisName,
+                                    YangNode node, YangLeafRef leafRef)
+            throws DataModelException {
+
+        YangLeaf leaf = getLeaf(leftAxisName, (YangLeavesHolder) node);
+        if (leaf != null) {
+            return leaf;
+        }
+        YangLeafList leafList = getLeafList(leftAxisName,
+                                            (YangLeavesHolder) node);
+        if (leafList == null) {
+            throw getDataModelExc(TGT_LEAF_ERR, leafRef);
+        }
+        return leafList;
+    }
+
+    /**
+     * Returns the leaf by searching it in the node by the leaf name. Returns
+     * null when the name doesn't match.
+     *
+     * @param name   leaf name
+     * @param holder holder of leaf
+     * @return YANG leaf
+     */
+    private static YangLeaf getLeaf(YangNodeIdentifier name,
+                                    YangLeavesHolder holder) {
+
+        List<YangLeaf> listOfLeaf = holder.getListOfLeaf();
+        if (listOfLeaf != null) {
+            for (YangLeaf yangLeaf : listOfLeaf) {
+                if (yangLeaf.getName().equals(name.getName())) {
+                    return yangLeaf;
+                }
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Returns the leaf-list by searching it in the node by the leaf-list name.
+     * Returns null when the name doesn't match.
+     *
+     * @param name   leaf-list name
+     * @param holder holder of leaf-list
+     * @return YANG leaf-list
+     */
+    private static YangLeafList getLeafList(YangNodeIdentifier name,
+                                            YangLeavesHolder holder) {
+
+        List<YangLeafList> listOfLeafList = holder.getListOfLeafList();
+        if (listOfLeafList != null) {
+            for (YangLeafList yangLeafList : listOfLeafList) {
+                if (yangLeafList.getName().equals(name.getName())) {
+                    return yangLeafList;
+                }
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Returns the root node from which the path with the atomic node names
+     * has to be traversed through. With the ancestor count the nodes are
+     * moved upward.
+     *
+     * @param count   ancestor count
+     * @param node    current leaf-ref parent
+     * @param leafRef YANG leaf-ref
+     * @return root node from ancestor count
+     * @throws DataModelException if there is a data model error
+     */
+    private static YangNode getRootNode(int count, YangNode node,
+                                        YangLeafRef leafRef)
+            throws DataModelException {
+
+        YangNode curParent = node;
+        int curCount = 0;
+        while (curCount < count) {
+            curCount = curCount + 1;
+            if (curCount != 1) {
+                if (curParent.getParent() == null) {
+                    throw getDataModelExc(INVALID_TREE, leafRef);
+                }
+                curParent = curParent.getParent();
+            }
+            curParent = skipInvalidDataNodes(curParent, leafRef);
+            if (curParent instanceof YangAugment) {
+                YangAugment augment = (YangAugment) curParent;
+                curParent = augment.getAugmentedNode();
+                curCount = curCount + 1;
+            }
+        }
+        return curParent;
+    }
+
+    /**
+     * Returns the last node by traversing through the atomic node id by
+     * leaving the last target leaf/leaf-list.
+     *
+     * @param curNode current node
+     * @param relPath relative path
+     * @param leafRef YANG leaf-ref
+     * @return last YANG node
+     * @throws DataModelException if there is a data model error
+     */
+    private static Object getLastNode(YangNode curNode,
+                                      YangRelativePath relPath,
+                                      YangLeafRef leafRef)
+            throws DataModelException {
+
+        YangNode node = curNode;
+        List<YangAtomicPath> atomics = new ArrayList<>();
+        atomics.addAll(relPath.getAtomicPathList());
+
+        if (atomics.isEmpty()) {
+            throw getDataModelExc(EMPTY_PATH_LIST_ERR, leafRef);
+        }
+
+        YangAtomicPath pathTgt = atomics.get(atomics.size() - 1);
+        if (atomics.size() == 1) {
+            return getTarget(pathTgt.getNodeIdentifier(), node, leafRef);
+        }
+
+        atomics.remove(atomics.size() - 1);
+        for (YangAtomicPath atomicPath : atomics) {
+            node = getNode(node.getChild(), atomicPath.getNodeIdentifier());
+            if (node == null) {
+                throw getDataModelExc(INVALID_PATH_PRE, leafRef);
+            }
+        }
+        return getTarget(pathTgt.getNodeIdentifier(), node, leafRef);
+    }
+
+    /**
+     * Returns the node from the parent node by matching it with the atomic
+     * name. If no child node matches the name then it returns null.
+     *
+     * @param curNode    current node
+     * @param identifier atomic name
+     * @return node to be traversed
+     */
+    private static YangNode getNode(YangNode curNode,
+                                    YangNodeIdentifier identifier) {
+        YangNode node = curNode;
+        while (node != null) {
+            if (node.getName().equals(identifier.getName())) {
+                return node;
+            }
+            node = node.getNextSibling();
+        }
+        return null;
+    }
+
+    /**
+     * Sets the right axis node in the YANG path predicate after finding it
+     * from the relative path.
+     *
+     * @param leafRef   YANG leaf-ref
+     * @param predicate YANG path predicate
+     * @throws DataModelException if there is a data model error
+     */
+    private static void setRightAxisNode(YangLeafRef leafRef,
+                                         YangPathPredicate predicate)
+            throws DataModelException {
+
+        YangNode parentNode = leafRef.getParentNode();
+        YangRelativePath relPath = predicate.getRelPath();
+        int ancestor = relPath.getAncestorNodeCount();
+
+        YangNode rootNode = getRootNode(ancestor, parentNode, leafRef);
+        Object target = getLastNode(rootNode, relPath, leafRef);
+        if (target == null) {
+            throw getDataModelExc(INVALID_PATH_PRE, leafRef);
+        }
+        predicate.setRightAxisNode(target);
+    }
+
+    /**
+     * Returns data model error messages for leaf-ref with the path.
+     *
+     * @param msg     error message
+     * @param leafRef YANG leaf-ref
+     * @return data model exception
+     */
+    private static DataModelException getDataModelExc(String msg,
+                                                      YangLeafRef leafRef) {
+        DataModelException exc = new DataModelException(
+                msg + leafRef.getPath());
+        exc.setCharPosition(leafRef.getCharPosition());
+        exc.setLine(leafRef.getLineNumber());
+        return exc;
+    }
+}
diff --git a/compiler/base/linker/src/main/java/org/onosproject/yang/compiler/linker/impl/YangResolutionInfoImpl.java b/compiler/base/linker/src/main/java/org/onosproject/yang/compiler/linker/impl/YangResolutionInfoImpl.java
new file mode 100644
index 0000000..3c1542c
--- /dev/null
+++ b/compiler/base/linker/src/main/java/org/onosproject/yang/compiler/linker/impl/YangResolutionInfoImpl.java
@@ -0,0 +1,1623 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.linker.impl;
+
+import org.onosproject.yang.compiler.datamodel.DefaultLocationInfo;
+import org.onosproject.yang.compiler.datamodel.Resolvable;
+import org.onosproject.yang.compiler.datamodel.RpcNotificationContainer;
+import org.onosproject.yang.compiler.datamodel.TraversalType;
+import org.onosproject.yang.compiler.datamodel.YangAtomicPath;
+import org.onosproject.yang.compiler.datamodel.YangAugment;
+import org.onosproject.yang.compiler.datamodel.YangAugmentableNode;
+import org.onosproject.yang.compiler.datamodel.YangBase;
+import org.onosproject.yang.compiler.datamodel.YangCompilerAnnotation;
+import org.onosproject.yang.compiler.datamodel.YangDerivedInfo;
+import org.onosproject.yang.compiler.datamodel.YangEntityToResolveInfoImpl;
+import org.onosproject.yang.compiler.datamodel.YangFeature;
+import org.onosproject.yang.compiler.datamodel.YangFeatureHolder;
+import org.onosproject.yang.compiler.datamodel.YangGrouping;
+import org.onosproject.yang.compiler.datamodel.YangIdentity;
+import org.onosproject.yang.compiler.datamodel.YangIdentityRef;
+import org.onosproject.yang.compiler.datamodel.YangIfFeature;
+import org.onosproject.yang.compiler.datamodel.YangImport;
+import org.onosproject.yang.compiler.datamodel.YangInclude;
+import org.onosproject.yang.compiler.datamodel.YangInput;
+import org.onosproject.yang.compiler.datamodel.YangLeaf;
+import org.onosproject.yang.compiler.datamodel.YangLeafList;
+import org.onosproject.yang.compiler.datamodel.YangLeafRef;
+import org.onosproject.yang.compiler.datamodel.YangList;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangNodeIdentifier;
+import org.onosproject.yang.compiler.datamodel.YangReferenceResolver;
+import org.onosproject.yang.compiler.datamodel.YangRelativePath;
+import org.onosproject.yang.compiler.datamodel.YangResolutionInfo;
+import org.onosproject.yang.compiler.datamodel.YangType;
+import org.onosproject.yang.compiler.datamodel.YangTypeDef;
+import org.onosproject.yang.compiler.datamodel.YangUses;
+import org.onosproject.yang.compiler.datamodel.YangXPathResolver;
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.datamodel.utils.ResolvableStatus;
+import org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes;
+import org.onosproject.yang.compiler.linker.exceptions.LinkerException;
+
+import java.io.Serializable;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Stack;
+
+import static org.onosproject.yang.compiler.datamodel.ResolvableType.YANG_LEAFREF;
+import static org.onosproject.yang.compiler.datamodel.TraversalType.CHILD;
+import static org.onosproject.yang.compiler.datamodel.TraversalType.PARENT;
+import static org.onosproject.yang.compiler.datamodel.TraversalType.ROOT;
+import static org.onosproject.yang.compiler.datamodel.TraversalType.SIBILING;
+import static org.onosproject.yang.compiler.datamodel.YangPathArgType.ABSOLUTE_PATH;
+import static org.onosproject.yang.compiler.datamodel.YangPathArgType.RELATIVE_PATH;
+import static org.onosproject.yang.compiler.datamodel.exceptions.ErrorMessages.getErrorMsg;
+import static org.onosproject.yang.compiler.datamodel.utils.DataModelUtils.addResolutionInfo;
+import static org.onosproject.yang.compiler.datamodel.utils.ResolvableStatus.INTER_FILE_LINKED;
+import static org.onosproject.yang.compiler.datamodel.utils.ResolvableStatus.INTRA_FILE_RESOLVED;
+import static org.onosproject.yang.compiler.datamodel.utils.ResolvableStatus.LINKED;
+import static org.onosproject.yang.compiler.datamodel.utils.ResolvableStatus.RESOLVED;
+import static org.onosproject.yang.compiler.datamodel.utils.ResolvableStatus.UNDEFINED;
+import static org.onosproject.yang.compiler.datamodel.utils.ResolvableStatus.UNRESOLVED;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.PATH_DATA;
+import static org.onosproject.yang.compiler.linker.impl.XpathLinkingTypes.AUGMENT_LINKING;
+import static org.onosproject.yang.compiler.linker.impl.XpathLinkingTypes.LEAF_REF_LINKING;
+import static org.onosproject.yang.compiler.linker.impl.YangLinkerUtils.detectCollisionForAugmentedNode;
+import static org.onosproject.yang.compiler.linker.impl.YangLinkerUtils.fillPathPredicates;
+import static org.onosproject.yang.compiler.linker.impl.YangLinkerUtils.getErrorInfoForLinker;
+import static org.onosproject.yang.compiler.linker.impl.YangLinkerUtils.getLeafRefErrorInfo;
+import static org.onosproject.yang.compiler.linker.impl.YangLinkerUtils.getPathWithAugment;
+import static org.onosproject.yang.compiler.linker.impl.YangLinkerUtils.getValidNodeIdentifier;
+import static org.onosproject.yang.compiler.linker.impl.YangLinkerUtils.skipInvalidDataNodes;
+import static org.onosproject.yang.compiler.utils.UtilConstants.EMPTY_STRING;
+import static org.onosproject.yang.compiler.utils.UtilConstants.FAILED_TO_FIND_ANNOTATION;
+import static org.onosproject.yang.compiler.utils.UtilConstants.FAILED_TO_FIND_LEAD_INFO_HOLDER;
+import static org.onosproject.yang.compiler.utils.UtilConstants.FAILED_TO_LINK;
+import static org.onosproject.yang.compiler.utils.UtilConstants.INVALID_ENTITY;
+import static org.onosproject.yang.compiler.utils.UtilConstants.INVALID_LINKER_STATE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.INVALID_RESOLVED_ENTITY;
+import static org.onosproject.yang.compiler.utils.UtilConstants.INVALID_TARGET;
+import static org.onosproject.yang.compiler.utils.UtilConstants.INVALID_TREE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.LEAFREF;
+import static org.onosproject.yang.compiler.utils.UtilConstants.LINKER_ERROR;
+import static org.onosproject.yang.compiler.utils.UtilConstants.SLASH_FOR_STRING;
+import static org.onosproject.yang.compiler.utils.UtilConstants.UNRESOLVABLE;
+
+/**
+ * Represents implementation of resolution object which will be resolved by
+ * linker.
+ *
+ * @param <T> type of resolution entity uses / type
+ */
+public class YangResolutionInfoImpl<T> extends DefaultLocationInfo
+        implements YangResolutionInfo<T>, Serializable {
+
+    private static final long serialVersionUID = 806201658L;
+
+    /**
+     * Information about the entity that needs to be resolved.
+     */
+    private YangEntityToResolveInfoImpl<T> entityToResolveInfo;
+
+    /**
+     * Current module/sub-module reference, will be used in inter-file/
+     * inter-jar scenario to get the import/include list.
+     */
+    private YangReferenceResolver curRefResolver;
+
+    /**
+     * Stack for type/uses is maintained for hierarchical references, this is
+     * used during resolution.
+     */
+    private Stack<YangEntityToResolveInfoImpl<T>> partialResolvedStack;
+
+    /**
+     * It is private to ensure the overloaded method be invoked to create an
+     * object.
+     */
+    @SuppressWarnings("unused")
+    private YangResolutionInfoImpl() {
+    }
+
+    /**
+     * Creates a resolution information object with all the inputs.
+     *
+     * @param dataNode           current parsable data node
+     * @param holderNode         parent YANG node
+     * @param lineNumber         error line number
+     * @param charPositionInLine error character position in line
+     */
+    public YangResolutionInfoImpl(T dataNode, YangNode holderNode, int lineNumber,
+                                  int charPositionInLine) {
+        entityToResolveInfo = new YangEntityToResolveInfoImpl<>();
+        entityToResolveInfo.setEntityToResolve(dataNode);
+        entityToResolveInfo.setHolderOfEntityToResolve(holderNode);
+        setLineNumber(lineNumber);
+        setCharPosition(charPositionInLine);
+        partialResolvedStack = new Stack<>();
+    }
+
+    @Override
+    public void resolveLinkingForResolutionInfo(YangReferenceResolver dataModelRootNode)
+            throws DataModelException {
+
+        curRefResolver = dataModelRootNode;
+    /*
+         * Current node to resolve, it can be a YANG type, YANG uses or YANG if-feature or
+         * YANG leafref or YANG base or YANG identityref.
+         */
+        T entityToResolve = entityToResolveInfo.getEntityToResolve();
+
+        // Check if linking is already done
+        if (entityToResolve instanceof Resolvable) {
+            Resolvable resolvable = (Resolvable) entityToResolve;
+            if (resolvable.getResolvableStatus() == RESOLVED) {
+                /*
+                 * entity is already resolved, so nothing to do
+                 */
+                return;
+            }
+        } else {
+            throw new DataModelException(LINKER_ERROR);
+        }
+        // Push the initial entity to resolve in stack.
+        addInPartialResolvedStack(entityToResolveInfo);
+        linkAndResolvePartialResolvedStack();
+        addDerivedRefTypeToRefTypeResolutionList();
+    }
+
+    /**
+     * Resolves linking with ancestors.
+     *
+     * @throws DataModelException a violation of data model rules
+     */
+    private void linkAndResolvePartialResolvedStack()
+            throws DataModelException {
+
+        while (!partialResolvedStack.isEmpty()) {
+            /*
+             * Current node to resolve, it can be a YANG type or YANG uses or
+             * YANG if-feature or YANG leafref or YANG base or YANG identityref.
+             */
+            T entityToResolve = getCurEntityToResolveFromStack();
+            if (!(entityToResolve instanceof Resolvable)) {
+                throw new DataModelException(LINKER_ERROR);
+            }
+            // Check if linking is already done
+            Resolvable resolvable = (Resolvable) entityToResolve;
+            switch (resolvable.getResolvableStatus()) {
+                case RESOLVED:
+                        /*
+                         * If the entity is already resolved in the stack, then pop
+                         * it and continue with the remaining stack elements to
+                         * resolve
+                         */
+                    partialResolvedStack.pop();
+                    break;
+
+                case LINKED:
+                        /*
+                         * If the top of the stack is already linked then resolve
+                         * the references and pop the entity and continue with
+                         * remaining stack elements to resolve.
+                         */
+                    resolveTopOfStack();
+                    partialResolvedStack.pop();
+                    break;
+
+                case INTRA_FILE_RESOLVED:
+                        /*
+                         * Pop the top of the stack.
+                         */
+                    partialResolvedStack.pop();
+                    break;
+
+                case UNRESOLVED:
+                    linkTopOfStackReferenceUpdateStack();
+
+                    if (resolvable.getResolvableStatus() == UNRESOLVED) {
+                        // If current entity is still not resolved, then
+                        // linking/resolution has failed.
+                        DataModelException ex =
+                                new DataModelException
+                                        (getErrorInfoForLinker(resolvable));
+                        ex.setLine(getLineNumber());
+                        ex.setCharPosition(getCharPosition());
+                        throw ex;
+                    }
+                    break;
+
+                default:
+                    throw new DataModelException(INVALID_LINKER_STATE);
+            }
+        }
+    }
+
+    /**
+     * Adds leaf-ref to the resolution list, with different context if
+     * leaf-ref is defined under derived type. Leaf-ref must be resolved from
+     * where the typedef is referenced.
+     */
+    private void addDerivedRefTypeToRefTypeResolutionList()
+            throws DataModelException {
+
+        YangNode refNode = entityToResolveInfo.getHolderOfEntityToResolve();
+        YangDerivedInfo info = getValidResolvableType();
+
+        if (info == null) {
+            return;
+        }
+
+        YangType<T> type =
+                (YangType<T>) entityToResolveInfo.getEntityToResolve();
+
+        T extType = (T) info.getReferredTypeDef().getTypeDefBaseType()
+                .getDataTypeExtendedInfo();
+
+        while (extType instanceof YangDerivedInfo) {
+            info = (YangDerivedInfo) extType;
+            extType = (T) info.getReferredTypeDef().getTypeDefBaseType()
+                    .getDataTypeExtendedInfo();
+        }
+        /*
+         * Backup the leaf-ref info from derived type and deletes the derived
+         * type info. Copies the backed up leaf-ref data to the actual type in
+         * replacement of derived type. Adds to the resolution list in this
+         * context.
+         */
+        addRefTypeInfo(extType, type, refNode);
+    }
+
+    /**
+     * Returns the derived info if the holder is typedef, the entity is type
+     * and the effective type is leaf-ref; null otherwise.
+     *
+     * @return derived info
+     */
+    private YangDerivedInfo<?> getValidResolvableType() {
+
+        YangNode refNode = entityToResolveInfo.getHolderOfEntityToResolve();
+        T entity = entityToResolveInfo.getEntityToResolve();
+
+        if (!(refNode instanceof YangTypeDef) && entity instanceof YangType) {
+            YangType<?> type = (YangType) entity;
+            YangDerivedInfo<?> info =
+                    (YangDerivedInfo) type.getDataTypeExtendedInfo();
+            YangDataTypes dataType = info.getEffectiveBuiltInType();
+            if ((type.getResolvableStatus() == RESOLVED) &&
+                    (dataType == YangDataTypes.LEAFREF)) {
+                return info;
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Adds resolvable type (leaf-ref) info to resolution list.
+     *
+     * @param extType resolvable type
+     * @param type    YANG type
+     * @param holder  holder node
+     * @throws DataModelException if there is a data model error
+     */
+    private void addRefTypeInfo(T extType, YangType<T> type, YangNode holder)
+            throws DataModelException {
+
+        type.resetYangType();
+        type.setResolvableStatus(RESOLVED);
+        type.setDataType(YangDataTypes.LEAFREF);
+        type.setDataTypeName(LEAFREF);
+        type.setDataTypeExtendedInfo(extType);
+
+        YangLeafRef leafRef = (YangLeafRef) extType;
+        (leafRef).setResolvableStatus(UNRESOLVED);
+        leafRef.setParentNode(holder);
+
+        YangResolutionInfoImpl info = new YangResolutionInfoImpl<>(
+                leafRef, holder, getLineNumber(), getCharPosition());
+        curRefResolver.addToResolutionList(info, YANG_LEAFREF);
+        curRefResolver.resolveSelfFileLinking(YANG_LEAFREF);
+    }
+
+    /**
+     * Resolves the current entity in the stack.
+     */
+    private void resolveTopOfStack()
+            throws DataModelException {
+        T entity = getCurEntityToResolveFromStack();
+        List<T> entityToResolve = (List<T>) ((Resolvable) entity).resolve();
+        if (entityToResolve != null && !entityToResolve.isEmpty()) {
+            for (T anEntityToResolve : entityToResolve) {
+                addUnresolvedEntitiesToResolutionList(anEntityToResolve);
+            }
+        }
+        if (((Resolvable) entity).getResolvableStatus() != INTRA_FILE_RESOLVED &&
+                ((Resolvable) entity).getResolvableStatus() != UNDEFINED) {
+            // Sets the resolution status in inside the type/uses/if-feature/leafref.
+            ((Resolvable) entity).setResolvableStatus(RESOLVED);
+        }
+    }
+
+    /**
+     * Adds the unresolved entities to the resolution list.
+     *
+     * @param entityToResolve entity to resolve
+     * @throws DataModelException a violation of data model rules
+     */
+    private void addUnresolvedEntitiesToResolutionList(T entityToResolve)
+            throws DataModelException {
+        if (entityToResolve instanceof YangEntityToResolveInfoImpl) {
+            YangEntityToResolveInfoImpl entityToResolveInfo
+                    = (YangEntityToResolveInfoImpl) entityToResolve;
+            if (entityToResolveInfo.getEntityToResolve() instanceof YangLeafRef) {
+                YangLeafRef leafref = (YangLeafRef) entityToResolveInfo
+                        .getEntityToResolve();
+                YangNode parentNodeOfLeafref = entityToResolveInfo
+                        .getHolderOfEntityToResolve();
+                leafref.setParentNode(parentNodeOfLeafref);
+                if (leafref.getResolvableStatus() == UNRESOLVED) {
+                    leafref.setResolvableStatus(INTRA_FILE_RESOLVED);
+                }
+            }
+
+            // Add resolution information to the list.
+            YangResolutionInfoImpl resolutionInfoImpl = new YangResolutionInfoImpl<>(
+                    entityToResolveInfo.getEntityToResolve(),
+                    entityToResolveInfo.getHolderOfEntityToResolve(),
+                    entityToResolveInfo.getLineNumber(),
+                    entityToResolveInfo.getCharPosition());
+            addResolutionInfo(resolutionInfoImpl);
+        }
+    }
+
+    /**
+     * Resolves linking for a node child and siblings.
+     *
+     * @throws DataModelException data model error
+     */
+    private void linkTopOfStackReferenceUpdateStack()
+            throws DataModelException {
+        T entity = getCurEntityToResolveFromStack();
+        if (entity instanceof YangLeafRef) {
+            ((Resolvable) entity).setResolvableStatus(INTRA_FILE_RESOLVED);
+            return;
+        }
+        /*
+         * Check if self file reference is there, this will not check for the
+         * scenario when prefix is not present and type/uses is present in
+         * sub-module from include list.
+         */
+        if (!isCandidateForSelfFileReference()) {
+            ((Resolvable) entity).setResolvableStatus(INTRA_FILE_RESOLVED);
+            return;
+        }
+
+        /*
+         * Try to resolve the top of the stack and update partial resolved stack
+         * if there is recursive references
+         */
+        YangNode ancestorRefNode = partialResolvedStack.peek()
+                .getHolderOfEntityToResolve();
+
+        if (entity instanceof YangIfFeature) {
+            resolveSelfFileLinkingForIfFeature(ancestorRefNode);
+            return;
+        }
+        if (entity instanceof YangIdentityRef || entity instanceof YangBase) {
+            resolveSelfFileLinkingForBaseAndIdentityref();
+            return;
+        }
+        YangType type = null;
+        if (entity instanceof YangType) {
+            type = (YangType) entity;
+        }
+            /*
+             * Traverse up in the ancestor tree to check if the referred node is
+             * defined
+             */
+        while (ancestorRefNode != null) {
+                /*
+                 * Check for the referred node defined in a ancestor scope
+                 */
+            YangNode curRefNode = ancestorRefNode.getChild();
+            if (isReferredNodeInSiblingListProcessed(curRefNode)) {
+                return;
+            }
+            ancestorRefNode = ancestorRefNode.getParent();
+            if (type != null && ancestorRefNode != null) {
+                if (ancestorRefNode.getParent() == null) {
+                    type.setTypeNotResolvedTillRootNode(true);
+                }
+            }
+        }
+
+        /*
+         * In case prefix is not present or it's self prefix it's a candidate for inter-file
+         * resolution via include list.
+         */
+        if (getRefPrefix() == null ||
+                getRefPrefix().contentEquals(curRefResolver.getPrefix())) {
+            ((Resolvable) entity).setResolvableStatus(INTRA_FILE_RESOLVED);
+        }
+    }
+
+    /**
+     * Resolves self file linking for base/identityref.
+     *
+     * @throws DataModelException a violation of data model rules
+     */
+    private void resolveSelfFileLinkingForBaseAndIdentityref()
+            throws DataModelException {
+
+        boolean refIdentity = false;
+        String nodeName = null;
+        T entity = getCurEntityToResolveFromStack();
+        if (entity instanceof YangIdentityRef) {
+            nodeName = ((YangIdentityRef) entity).getName();
+        } else if (entity instanceof YangBase) {
+            nodeName = ((YangBase) entity).getBaseIdentifier().getName();
+        }
+        if (curRefResolver instanceof RpcNotificationContainer) {
+            // Sends list of nodes for finding the target identity.
+            refIdentity = isIdentityReferenceFound(nodeName, (YangNode) curRefResolver);
+        }
+        if (refIdentity) {
+            return;
+        }
+
+        /*
+         * In case prefix is not present or it's self prefix it's a candidate for inter-file
+         * resolution via include list.
+         */
+        if (getRefPrefix() == null || getRefPrefix()
+                .contentEquals(curRefResolver.getPrefix())) {
+            ((Resolvable) entity).setResolvableStatus(INTRA_FILE_RESOLVED);
+        }
+    }
+
+    /**
+     * Resolves self file linking for if-feature.
+     *
+     * @param ancestorRefNode if-feature holder node
+     * @throws DataModelException DataModelException a violation of data model
+     *                            rules
+     */
+    private void resolveSelfFileLinkingForIfFeature(YangNode ancestorRefNode)
+            throws DataModelException {
+
+        YangFeatureHolder featureHolder = getFeatureHolder(ancestorRefNode);
+        YangNode curRefNode = (YangNode) featureHolder;
+        if (isReferredNode(curRefNode)) {
+
+            // Adds reference link of entity to the node under resolution.
+            addReferredEntityLink(curRefNode, LINKED);
+
+            /*
+             * resolve the reference and update the partial resolution stack
+             * with any further recursive references
+             */
+            addUnresolvedRecursiveReferenceToStack(curRefNode);
+            return;
+        }
+
+        /*
+         * In case prefix is not present or it's self prefix it's a candidate for inter-file
+         * resolution via include list.
+         */
+        if (getRefPrefix() == null || getRefPrefix()
+                .contentEquals(curRefResolver.getPrefix())) {
+            ((Resolvable) getCurEntityToResolveFromStack())
+                    .setResolvableStatus(INTRA_FILE_RESOLVED);
+        }
+    }
+
+    /**
+     * Returns the status of the referred identity found for base/identityref.
+     *
+     * @param nodeName        the name of the base node
+     *                        identifier/identityref node identifier
+     * @param ancestorRefNode the parent node of base/identityref
+     * @return status of referred base/identityref
+     * @throws DataModelException a violation of data model rules
+     */
+    private boolean isIdentityReferenceFound(String nodeName, YangNode ancestorRefNode)
+            throws DataModelException {
+
+        // When child is not present return.
+        if (ancestorRefNode.getChild() == null) {
+            return false;
+        }
+
+        ancestorRefNode = ancestorRefNode.getChild();
+
+        // Checks all the siblings under the node and returns the matched node.
+        YangNode nodeFound = isReferredNodeInSiblingProcessedForIdentity(ancestorRefNode,
+                                                                         nodeName);
+
+        if (nodeFound != null) {
+            // Adds reference link of entity to the node under resolution.
+            addReferredEntityLink(nodeFound, LINKED);
+
+            /*
+             * resolve the reference and update the partial resolution stack with any further recursive references
+             */
+            addUnresolvedRecursiveReferenceToStack(nodeFound);
+            return true;
+        }
+
+        return false;
+    }
+
+    /**
+     * Adds the unresolved constructs to stack which has to be resolved for leafref.
+     *
+     * @param leavesInfo      YANG leaf or leaf list which holds the type
+     * @param ancestorRefNode holder of the YANG leaf or leaf list
+     */
+    private void addUnResolvedLeafRefTypeToStack(T leavesInfo, YangNode ancestorRefNode) {
+
+        YangType refType;
+        T extendedInfo;
+        if (leavesInfo instanceof YangLeaf) {
+            YangLeaf leaf = (YangLeaf) leavesInfo;
+            refType = leaf.getDataType();
+        } else {
+            YangLeafList leafList = (YangLeafList) leavesInfo;
+            refType = leafList.getDataType();
+        }
+        extendedInfo = (T) refType.getDataTypeExtendedInfo();
+        addUnResolvedTypeDataToStack(refType, ancestorRefNode, extendedInfo);
+    }
+
+    //Adds unresolved type info to stack.
+    private void addUnResolvedTypeDataToStack(YangType refType, YangNode
+            ancestorRefNode, T extendedInfo) {
+        YangEntityToResolveInfoImpl<YangLeafRef<?>> unResolvedLeafRef =
+                new YangEntityToResolveInfoImpl<>();
+        YangEntityToResolveInfoImpl<YangType<?>> unResolvedTypeDef =
+                new YangEntityToResolveInfoImpl<>();
+        if (refType.getDataType() == YangDataTypes.LEAFREF) {
+            unResolvedLeafRef.setEntityToResolve((YangLeafRef<?>) extendedInfo);
+            unResolvedLeafRef.setHolderOfEntityToResolve(ancestorRefNode);
+            addInPartialResolvedStack((YangEntityToResolveInfoImpl<T>) unResolvedLeafRef);
+        } else if (refType.getDataType() == YangDataTypes.DERIVED) {
+            unResolvedTypeDef.setEntityToResolve(refType);
+            unResolvedTypeDef.setHolderOfEntityToResolve(ancestorRefNode);
+            addInPartialResolvedStack((YangEntityToResolveInfoImpl<T>) unResolvedTypeDef);
+        }
+    }
+
+    /**
+     * Returns feature holder(module/sub-module node) .
+     *
+     * @param ancestorRefNode if-feature holder node
+     */
+    private YangFeatureHolder getFeatureHolder(YangNode ancestorRefNode) {
+        while (ancestorRefNode != null) {
+            if (ancestorRefNode instanceof YangFeatureHolder) {
+                return (YangFeatureHolder) ancestorRefNode;
+            }
+            ancestorRefNode = ancestorRefNode.getParent();
+        }
+        return null;
+    }
+
+    /**
+     * Checks if the reference in self file or in external file.
+     *
+     * @return true if self file reference, false otherwise
+     * @throws DataModelException a violation of data model rules
+     */
+    private boolean isCandidateForSelfFileReference()
+            throws DataModelException {
+        String prefix = getRefPrefix();
+        return prefix == null || prefix.contentEquals(curRefResolver.getPrefix());
+    }
+
+    /**
+     * Checks for the referred parent node for the base/identity.
+     *
+     * @param refNode potential referred node
+     * @return the referred parent node of base/identity.
+     * @throws DataModelException data model errors
+     */
+    private YangNode isReferredNodeInSiblingProcessedForIdentity(YangNode refNode,
+                                                                 String refName)
+            throws DataModelException {
+
+        while (refNode != null) {
+            if (refNode instanceof YangIdentity) {
+                // Check if the potential referred node is the actual referred node
+                if (isReferredNodeForIdentity(refNode, refName)) {
+                    return refNode;
+                }
+            }
+            refNode = refNode.getNextSibling();
+        }
+        return null;
+    }
+
+    /**
+     * Checks if the current reference node name and the name in the base/identityref base are equal.
+     *
+     * @param curRefNode the node where the reference is pointed
+     * @param name       name of the base in the base/identityref base
+     * @return status of the match between the name
+     * @throws DataModelException a violation of data model rules
+     */
+    private boolean isReferredNodeForIdentity(YangNode curRefNode, String name)
+            throws DataModelException {
+        T entity = getCurEntityToResolveFromStack();
+        if (entity instanceof YangIdentityRef || entity instanceof YangBase) {
+
+            //Check if name of node name matches with the current reference node.
+            return curRefNode.getName().contentEquals(name);
+        } else {
+            throw new DataModelException(getErrorMsg(
+                    INVALID_ENTITY, curRefNode.getName(), curRefNode.getLineNumber(),
+                    curRefNode.getCharPosition(), curRefNode.getFileName()));
+        }
+    }
+
+    /**
+     * Checks for the referred node defined in a ancestor scope.
+     *
+     * @param refNode potential referred node
+     * @return status of resolution and updating the partial resolved stack with
+     * the any recursive references
+     * @throws DataModelException a violation of data model rules
+     */
+    private boolean isReferredNodeInSiblingListProcessed(YangNode refNode)
+            throws DataModelException {
+        while (refNode != null) {
+
+            // Check if the potential referred node is the actual referred node
+            if (isReferredNode(refNode)) {
+
+                // Adds reference link of entity to the node under resolution.
+                addReferredEntityLink(refNode, LINKED);
+
+                /*
+                 * resolve the reference and update the partial resolution stack
+                 * with any further recursive references
+                 */
+                addUnresolvedRecursiveReferenceToStack(refNode);
+
+                /*
+                 * return true, since the reference is linked and any recursive
+                 * unresolved references is added to the stack
+                 */
+                return true;
+            }
+
+            refNode = refNode.getNextSibling();
+        }
+        return false;
+    }
+
+    /**
+     * Checks if the potential referred node is the actual referred node.
+     *
+     * @param refNode typedef/grouping node
+     * @return true if node is of resolve type otherwise false
+     * @throws DataModelException a violation of data model rules
+     */
+    private boolean isReferredNode(YangNode refNode)
+            throws DataModelException {
+        T entity = getCurEntityToResolveFromStack();
+        if (entity instanceof YangType) {
+            if (refNode instanceof YangTypeDef) {
+                return isNodeNameSameAsResolutionInfoName(refNode);
+            }
+        } else if (entity instanceof YangUses) {
+            if (refNode instanceof YangGrouping) {
+                return isNodeNameSameAsResolutionInfoName(refNode);
+            }
+        } else if (entity instanceof YangIfFeature) {
+            if (refNode instanceof YangFeatureHolder) {
+                return isNodeNameSameAsResolutionInfoName(refNode);
+            }
+        } else if (entity instanceof YangBase || entity instanceof YangIdentityRef) {
+            if (refNode instanceof YangIdentity) {
+                return isNodeNameSameAsResolutionInfoName(refNode);
+            }
+        } else {
+            throw new DataModelException(getErrorMsg(
+                    LINKER_ERROR, refNode.getName(), refNode.getLineNumber(),
+                    refNode.getCharPosition(), refNode.getFileName()));
+        }
+        return false;
+    }
+
+    /**
+     * Checks if node name is same as name in resolution info, i.e. name of
+     * typedef/grouping is same as name of type/uses.
+     *
+     * @param node typedef/grouping node
+     * @return true if node name is same as name in resolution info, otherwise
+     * false
+     * @throws DataModelException a violation of data model rules
+     */
+
+    private boolean isNodeNameSameAsResolutionInfoName(YangNode node)
+            throws DataModelException {
+        T entity = getCurEntityToResolveFromStack();
+        if (entity instanceof YangType) {
+            return node.getName().contentEquals(((YangType<?>) entity)
+                                                        .getDataTypeName());
+        }
+        if (entity instanceof YangUses) {
+            return node.getName().contentEquals(((YangUses) entity).getName());
+        }
+        if (entity instanceof YangIfFeature) {
+            return isFeatureDefinedInNode(node);
+        }
+        if (entity instanceof YangBase) {
+            return node.getName().contentEquals(((
+                    YangBase) entity).getBaseIdentifier().getName());
+        }
+        if (entity instanceof YangIdentityRef) {
+            return node.getName().contentEquals(((YangIdentityRef) entity).getName());
+        }
+        throw new DataModelException(getErrorMsg(
+                INVALID_RESOLVED_ENTITY, node.getName(), node.getLineNumber(),
+                node.getCharPosition(), node.getFileName()));
+    }
+
+    private boolean isFeatureDefinedInNode(YangNode node) {
+        T entity = getCurEntityToResolveFromStack();
+        YangNodeIdentifier ifFeature = ((YangIfFeature) entity).getName();
+        List<YangFeature> featureList = ((YangFeatureHolder) node).getFeatureList();
+        if (featureList != null && !featureList.isEmpty()) {
+            Iterator<YangFeature> iterator = featureList.iterator();
+            while (iterator.hasNext()) {
+                YangFeature feature = iterator.next();
+                if (ifFeature.getName().equals(feature.getName())) {
+                    ((YangIfFeature) entity).setReferredFeature(feature);
+                    ((YangIfFeature) entity).setReferredFeatureHolder(node);
+                    return true;
+                }
+            }
+        }
+        return false;
+    }
+
+    /**
+     * Adds reference of grouping/typedef in uses/type.
+     *
+     * @param refNode      grouping/typedef node being referred
+     * @param linkedStatus linked status if success.
+     * @throws DataModelException a violation of data model rules
+     */
+    private void addReferredEntityLink(YangNode refNode, ResolvableStatus linkedStatus)
+            throws DataModelException {
+        T entity = getCurEntityToResolveFromStack();
+        if (entity instanceof YangType) {
+            YangDerivedInfo<?> derivedInfo = (YangDerivedInfo<?>) ((
+                    YangType<?>) entity).getDataTypeExtendedInfo();
+            derivedInfo.setReferredTypeDef((YangTypeDef) refNode);
+        } else if (entity instanceof YangUses) {
+            ((YangUses) entity).setRefGroup((YangGrouping) refNode);
+        } else if (entity instanceof YangBase) {
+            ((YangBase) entity).setReferredIdentity((YangIdentity) refNode);
+        } else if (entity instanceof YangIdentityRef) {
+            ((YangIdentityRef) entity).setReferredIdentity((YangIdentity) refNode);
+        } else if (!(entity instanceof YangIfFeature) &&
+                !(entity instanceof YangLeafRef)) {
+            throw new DataModelException(getErrorMsg(
+                    LINKER_ERROR, refNode.getName(), refNode.getLineNumber(),
+                    refNode.getCharPosition(), refNode.getFileName()));
+        }
+        // Sets the resolution status in inside the type/uses.
+        ((Resolvable) entity).setResolvableStatus(linkedStatus);
+    }
+
+    /**
+     * Checks if type/grouping has further reference to typedef/ unresolved
+     * uses. Add it to the partial resolve stack and return the status of
+     * addition to stack.
+     *
+     * @param refNode grouping/typedef node
+     * @throws DataModelException a violation of data model rules
+     */
+    private void addUnresolvedRecursiveReferenceToStack(YangNode refNode)
+            throws DataModelException {
+        T entity = getCurEntityToResolveFromStack();
+        if (entity instanceof YangType) {
+
+            //Checks if typedef type is derived
+            if (((YangTypeDef) refNode).getTypeDefBaseType()
+                    .getDataType() == YangDataTypes.DERIVED) {
+                addEntityToStack((T) ((YangTypeDef) refNode).getTypeDefBaseType(),
+                                 refNode);
+            }
+        } else if (entity instanceof YangUses) {
+            /*
+             * Search if the grouping has any un resolved uses child, if so
+             * return true, else return false.
+             */
+            addUnResolvedUsesToStack(refNode);
+        } else if (entity instanceof YangIfFeature) {
+            addUnResolvedIfFeatureToStack(refNode);
+        } else if (entity instanceof YangLeafRef) {
+            // do nothing , referred node is already set
+            throw new DataModelException(getErrorMsg(
+                    INVALID_RESOLVED_ENTITY, refNode.getName(), refNode.getLineNumber(),
+                    refNode.getCharPosition(), refNode.getFileName()));
+        } else if (entity instanceof YangBase || entity instanceof YangIdentityRef) {
+
+            //Search if the identity has any un resolved base, if so return true, else return false.
+            addUnResolvedBaseToStack(refNode);
+        } else {
+            throw new DataModelException(getErrorMsg(
+                    LINKER_ERROR, refNode.getName(), refNode.getLineNumber(),
+                    refNode.getCharPosition(), refNode.getFileName()));
+        }
+    }
+
+    /**
+     * Returns if there is any unresolved uses in grouping.
+     *
+     * @param node grouping/typedef node
+     */
+    private void addUnResolvedUsesToStack(YangNode node) {
+
+        //Search the grouping node's children for presence of uses node.
+        TraversalType curTraversal = ROOT;
+        YangNode curNode = node.getChild();
+        while (curNode != null) {
+            if (curNode.getName().equals(node.getName())) {
+                // if we have traversed all the child nodes, then exit from loop
+                return;
+            }
+
+            // if child nodes has uses, then add it to resolution stack
+            if (curNode instanceof YangUses) {
+                addEntityToStack((T) curNode, node);
+            }
+
+            // Traversing all the child nodes of grouping
+            if (curTraversal != PARENT && curNode.getChild() != null) {
+                curTraversal = CHILD;
+                curNode = curNode.getChild();
+            } else if (curNode.getNextSibling() != null) {
+                curTraversal = SIBILING;
+                curNode = curNode.getNextSibling();
+            } else {
+                curTraversal = PARENT;
+                curNode = curNode.getParent();
+            }
+        }
+    }
+
+    /**
+     * Returns if there is any unresolved if-feature in feature.
+     *
+     * @param node module/submodule node
+     */
+    private void addUnResolvedIfFeatureToStack(YangNode node) {
+        YangFeature refFeature = ((YangIfFeature) getCurEntityToResolveFromStack())
+                .getReferredFeature();
+        List<YangIfFeature> ifFeatureList = refFeature.getIfFeatureList();
+        if (ifFeatureList != null && !ifFeatureList.isEmpty()) {
+            Iterator<YangIfFeature> ifFeatureIterator = ifFeatureList.iterator();
+            while (ifFeatureIterator.hasNext()) {
+                addEntityToStack((T) ifFeatureIterator.next(), node);
+            }
+        }
+    }
+
+    /**
+     * Returns if there is any unresolved base in identity.
+     *
+     * @param node module/submodule node
+     */
+    private void addUnResolvedBaseToStack(YangNode node) {
+
+        YangIdentity curNode = (YangIdentity) node;
+        if (curNode.getBaseNode() != null) {
+            if (curNode.getBaseNode().getResolvableStatus() != RESOLVED) {
+                addEntityToStack((T) curNode.getBaseNode(), node);
+            }
+        }
+    }
+
+    private void addEntityToStack(T entity, YangNode holder) {
+        YangEntityToResolveInfoImpl<T> unResolvedEntityInfo =
+                new YangEntityToResolveInfoImpl<>();
+        unResolvedEntityInfo.setEntityToResolve(entity);
+        unResolvedEntityInfo.setHolderOfEntityToResolve(holder);
+        addInPartialResolvedStack(unResolvedEntityInfo);
+    }
+
+    /**
+     * Sets stack of YANG type with partially resolved YANG construct hierarchy.
+     *
+     * @param partialResolvedInfo partial resolved YANG construct stack
+     */
+    private void addInPartialResolvedStack(YangEntityToResolveInfoImpl<T> partialResolvedInfo) {
+        partialResolvedStack.push(partialResolvedInfo);
+    }
+
+    /**
+     * Retrieves the next entity in the stack that needs to be resolved. It is
+     * assumed that the caller ensures that the stack is not empty.
+     *
+     * @return next entity in the stack that needs to be resolved
+     */
+    private T getCurEntityToResolveFromStack() {
+        return partialResolvedStack.peek().getEntityToResolve();
+    }
+
+    @Override
+    public YangEntityToResolveInfoImpl<T> getEntityToResolveInfo() {
+        return entityToResolveInfo;
+    }
+
+    @Override
+    public void linkInterFile(YangReferenceResolver dataModelRootNode)
+            throws DataModelException {
+
+        curRefResolver = dataModelRootNode;
+
+        // Current node to resolve, it can be a YANG type or YANG uses.
+        T entityToResolve = entityToResolveInfo.getEntityToResolve();
+
+        // Check if linking is already done
+        if (entityToResolve instanceof Resolvable) {
+            Resolvable resolvable = (Resolvable) entityToResolve;
+            if (resolvable.getResolvableStatus() == RESOLVED) {
+                return;
+            }
+        } else {
+            throw new DataModelException(UNRESOLVABLE);
+        }
+
+        if (entityToResolve instanceof YangXPathResolver &&
+                !(entityToResolve instanceof YangLeafRef)) {
+            //Process x-path linking.
+            processXPathLinking(entityToResolve, dataModelRootNode);
+        } else {
+            // Push the initial entity to resolve in stack.
+            addInPartialResolvedStack(entityToResolveInfo);
+            // Inter file linking and resolution.
+            linkInterFileAndResolve();
+            addDerivedRefTypeToRefTypeResolutionList();
+        }
+    }
+
+    /**
+     * Process x-path linking for augment and leaf-ref.
+     *
+     * @param entityToResolve entity to resolve
+     * @param root            root node
+     * @throws DataModelException if there is a data model error
+     */
+    private void processXPathLinking(T entityToResolve,
+                                     YangReferenceResolver root)
+            throws DataModelException {
+
+        YangXpathLinker<T> xPathLinker = new YangXpathLinker<T>();
+
+        if (entityToResolve instanceof YangAugment) {
+            YangNode targetNode;
+            YangAugment augment = (YangAugment) entityToResolve;
+            targetNode = xPathLinker
+                    .processXpathLinking(augment.getTargetNode(), (YangNode)
+                            root, AUGMENT_LINKING);
+            if (targetNode != null) {
+                if (targetNode instanceof YangAugmentableNode) {
+                    detectCollisionForAugmentedNode(targetNode, augment);
+                    ((YangAugmentableNode) targetNode).addAugmentation(augment);
+                    augment.setAugmentedNode(targetNode);
+                    setAugmentedFlagInAncestors(targetNode);
+                    Resolvable resolvable = (Resolvable) entityToResolve;
+                    resolvable.setResolvableStatus(RESOLVED);
+                    if (targetNode instanceof YangInput) {
+                        xPathLinker.addInModuleIfInput(augment, (YangNode) root);
+                    }
+                } else {
+                    throw new LinkerException(getErrorMsg(
+                            INVALID_TARGET + targetNode.getNodeType(),
+                            augment.getName(), augment.getLineNumber(),
+                            augment.getCharPosition(), augment.getFileName()));
+                }
+            } else {
+                throw new LinkerException(getErrorMsg(
+                        FAILED_TO_LINK, augment.getName(), augment
+                                .getLineNumber(), augment.getCharPosition(),
+                        augment.getFileName()));
+            }
+        } else if (entityToResolve instanceof YangCompilerAnnotation) {
+            YangNode targetNode;
+            YangCompilerAnnotation ca = (YangCompilerAnnotation) entityToResolve;
+            targetNode = xPathLinker.processXpathLinking(ca.getAtomicPathList(),
+                                                         (YangNode) root,
+                                                         AUGMENT_LINKING);
+            if (targetNode != null) {
+                if (targetNode instanceof YangList) {
+                    ((YangList) targetNode).setCompilerAnnotation(
+                            (YangCompilerAnnotation) entityToResolve);
+                    Resolvable resolvable = (Resolvable) entityToResolve;
+                    resolvable.setResolvableStatus(RESOLVED);
+                } else {
+                    throw new LinkerException(getErrorMsg(
+                            INVALID_TARGET + targetNode.getNodeType(), ca.getPath(),
+                            ca.getLineNumber(), ca.getCharPosition(), ca.getFileName()));
+                }
+            } else {
+                throw new LinkerException(getErrorMsg(
+                        FAILED_TO_FIND_ANNOTATION, ca.getPath(), ca.getLineNumber(),
+                        ca.getCharPosition(), ca.getFileName()));
+            }
+        } else if (entityToResolve instanceof YangLeafRef) {
+            YangLeafRef leafRef = (YangLeafRef) entityToResolve;
+            Object target = xPathLinker.processLeafRefXpathLinking(
+                    leafRef.getAtomicPath(), (YangNode) root, leafRef, LEAF_REF_LINKING);
+            if (target != null) {
+                YangLeaf leaf;
+                YangLeafList leafList;
+                leafRef.setReferredLeafOrLeafList(target);
+                if (target instanceof YangLeaf) {
+                    leaf = (YangLeaf) target;
+                    leafRef.setResolvableStatus(INTER_FILE_LINKED);
+                    addUnResolvedLeafRefTypeToStack((T) leaf, entityToResolveInfo
+                            .getHolderOfEntityToResolve());
+                } else {
+                    leafList = (YangLeafList) target;
+                    leafRef.setResolvableStatus(INTER_FILE_LINKED);
+                    addUnResolvedLeafRefTypeToStack(
+                            (T) leafList, entityToResolveInfo.getHolderOfEntityToResolve());
+                }
+                fillPathPredicates(leafRef);
+            } else {
+                LinkerException ex = new LinkerException(
+                        FAILED_TO_FIND_LEAD_INFO_HOLDER + leafRef.getPath());
+                ex.setCharPosition(leafRef.getCharPosition());
+                ex.setLine(leafRef.getLineNumber());
+                ex.setFileName(leafRef.getFileName());
+                throw ex;
+            }
+        }
+    }
+
+    /**
+     * Returns the referenced prefix of entity under resolution.
+     *
+     * @return referenced prefix of entity under resolution
+     * @throws DataModelException a violation in data model rule
+     */
+    private String getRefPrefix()
+            throws DataModelException {
+        T entity = getCurEntityToResolveFromStack();
+        if (entity instanceof YangType) {
+            return ((YangType<?>) entity).getPrefix();
+        }
+        if (entity instanceof YangUses) {
+            return ((YangUses) entity).getPrefix();
+        }
+        if (entity instanceof YangIfFeature) {
+            return ((YangIfFeature) entity).getPrefix();
+        }
+        if (entity instanceof YangBase) {
+            return ((YangBase) entity).getBaseIdentifier()
+                    .getPrefix();
+        }
+        if (entity instanceof YangIdentityRef) {
+            return ((YangIdentityRef) entity).getPrefix();
+        }
+        throw new DataModelException(LINKER_ERROR);
+    }
+
+    /**
+     * Performs inter file linking and resolution.
+     *
+     * @throws DataModelException a violation in data model rule
+     */
+    private void linkInterFileAndResolve()
+            throws DataModelException {
+
+        while (!partialResolvedStack.isEmpty()) {
+
+            // Current node to resolve, it can be a YANG type or YANG uses.
+            T entityToResolve = getCurEntityToResolveFromStack();
+            // Check if linking is already done
+            if (entityToResolve instanceof Resolvable) {
+
+                Resolvable resolvable = (Resolvable) entityToResolve;
+                switch (resolvable.getResolvableStatus()) {
+                    case RESOLVED:
+                        /*
+                         * If the entity is already resolved in the stack, then pop
+                         * it and continue with the remaining stack elements to
+                         * resolve
+                         */
+                        partialResolvedStack.pop();
+                        break;
+
+                    case INTER_FILE_LINKED:
+                        /*
+                         * If the top of the stack is already linked then resolve
+                         * the references and pop the entity and continue with
+                         * remaining stack elements to resolve
+                         */
+                        resolveTopOfStack();
+                        partialResolvedStack.pop();
+                        break;
+
+                    case INTRA_FILE_RESOLVED:
+                        /*
+                         * If the top of the stack is intra file resolved then check
+                         * if top of stack is linked, if not link it using
+                         * import/include list and push the linked referred entity
+                         * to the stack, otherwise only push it to the stack.
+                         */
+                        linkInterFileTopOfStackRefUpdateStack();
+                        break;
+
+                    case UNDEFINED:
+                        /*
+                         * In case of if-feature resolution, if referred "feature" is not
+                         * defined then the resolvable status will be undefined.
+                         */
+                        partialResolvedStack.pop();
+                        break;
+
+                    default:
+                        throw new DataModelException(INVALID_LINKER_STATE);
+                }
+            } else {
+                throw new DataModelException(INVALID_RESOLVED_ENTITY);
+            }
+        }
+    }
+
+    /**
+     * Links the top of the stack if it's inter-file and update stack.
+     *
+     * @throws DataModelException data model error
+     */
+    private void linkInterFileTopOfStackRefUpdateStack()
+            throws DataModelException {
+        T entity = getCurEntityToResolveFromStack();
+        if (entity instanceof YangLeafRef) {
+            // When leafref path comes with relative path, it will be converted to absolute path.
+            setAbsolutePathFromRelativePathInLeafref(entity);
+            processXPathLinking(entity, curRefResolver);
+            return;
+        }
+        /*
+         * Obtain the referred node of top of stack entity under resolution
+         */
+        T refNode = getRefNode();
+
+        /*
+         * Check for null for scenario when it's not linked and inter-file
+         * linking is required.
+         */
+        if (refNode == null) {
+
+            /*
+             * Check if prefix is null or not, to identify whether to search in
+             * import list or include list.
+             */
+            if (getRefPrefix() != null && !getRefPrefix()
+                    .contentEquals(curRefResolver.getPrefix())) {
+                if (resolveWithImport()) {
+                    return;
+                }
+            } else {
+                if (resolveWithInclude()) {
+                    return;
+                }
+            }
+
+            if (entity instanceof YangIfFeature) {
+                ((YangIfFeature) entity).setResolvableStatus(UNDEFINED);
+                return;
+            }
+            // If current entity is still not resolved, then
+            // linking/resolution has failed.
+
+            DataModelException ex = new DataModelException(
+                    getErrorInfoForLinker(entity));
+            ex.setLine(getLineNumber());
+            ex.setCharPosition(getCharPosition());
+            throw ex;
+        } else {
+            ((Resolvable) entity).setResolvableStatus(INTER_FILE_LINKED);
+            addUnresolvedRecursiveReferenceToStack((YangNode) refNode);
+        }
+    }
+
+    /**
+     * Sets the leafref with absolute path from the relative path.
+     *
+     * @param resolutionInfo information about the YANG construct which has to be resolved
+     * @throws DataModelException a violation of data model rules
+     */
+    private void setAbsolutePathFromRelativePathInLeafref(T resolutionInfo)
+            throws DataModelException {
+        if (resolutionInfo instanceof YangLeafRef) {
+
+            YangNode leafParent = ((YangLeafRef) resolutionInfo)
+                    .getParentNode();
+            YangLeafRef leafref = (YangLeafRef) resolutionInfo;
+
+            // Checks if the leafref has relative path in it.
+            if (leafref.getPathType() == RELATIVE_PATH) {
+                YangRelativePath relativePath = leafref.getRelativePath();
+                List<YangAtomicPath> absoluteInRelative = relativePath.getAtomicPathList();
+                int ancestorCount = relativePath.getAncestorNodeCount();
+
+                // Gets the root node from the ancestor count.
+                T nodeOrAugmentList =
+                        getRootNodeWithAncestorCountForLeafref(ancestorCount, leafParent,
+                                                               leafref);
+                if (nodeOrAugmentList instanceof YangNode) {
+                    StringBuilder name = new StringBuilder();
+                    StringBuilder prefix = new StringBuilder();
+                    YangNode rootNode = (YangNode) nodeOrAugmentList;
+                    // Forms a new absolute path from the relative path
+                    while (!(rootNode instanceof YangReferenceResolver)) {
+                        name.append(rootNode.getName());
+                        prefix.append(SLASH_FOR_STRING).append(name.reverse());
+                        name.delete(0, name.length());
+                        rootNode = rootNode.getParent();
+                        if (rootNode == null) {
+                            throw new DataModelException(INVALID_TREE);
+                        }
+                    }
+                    prefix.reverse();
+                    fillAbsolutePathValuesInLeafref(leafref, prefix.toString(),
+                                                    absoluteInRelative);
+                } else {
+                    List<String> listOfAugment = (List<String>) nodeOrAugmentList;
+                    Iterator<String> listOfAugmentIterator = listOfAugment.listIterator();
+                    StringBuilder augment = new StringBuilder(EMPTY_STRING);
+                    while (listOfAugmentIterator.hasNext()) {
+                        augment.append(SLASH_FOR_STRING)
+                                .append(listOfAugmentIterator.next());
+                    }
+                    fillAbsolutePathValuesInLeafref(leafref, augment.toString(),
+                                                    absoluteInRelative);
+                }
+            }
+        }
+    }
+
+    /**
+     * Fills the absolute path values in the leafref from relative path.
+     *
+     * @param leafref  instance of YANG leafref
+     * @param path     path name which has to be prefixed to relative path
+     * @param relative atomic paths in relative
+     * @throws DataModelException a violation of data model rules
+     */
+    private void fillAbsolutePathValuesInLeafref(YangLeafRef leafref, String path,
+                                                 List<YangAtomicPath> relative)
+            throws DataModelException {
+        leafref.setPathType(ABSOLUTE_PATH);
+        String[] pathName = new String[0];
+        if (path != null && !path.equals(EMPTY_STRING)) {
+            pathName = path.split(SLASH_FOR_STRING);
+        }
+        List<YangAtomicPath> finalListForAbsolute = new LinkedList<>();
+        for (String value : pathName) {
+            if (value != null && !value.isEmpty() && !value.equals(EMPTY_STRING)) {
+                YangNodeIdentifier nodeId = getValidNodeIdentifier(value, PATH_DATA);
+                YangAtomicPath atomicPath = new YangAtomicPath();
+                atomicPath.setNodeIdentifier(nodeId);
+                finalListForAbsolute.add(atomicPath);
+            }
+        }
+        if (relative != null && !relative.isEmpty()) {
+            Iterator<YangAtomicPath> pathIt = relative.listIterator();
+            while (pathIt.hasNext()) {
+                YangAtomicPath yangAtomicPath = pathIt.next();
+                finalListForAbsolute.add(yangAtomicPath);
+            }
+            leafref.setAtomicPath(finalListForAbsolute);
+        } else {
+            DataModelException ex = new DataModelException(getLeafRefErrorInfo(leafref));
+            ex.setCharPosition(leafref.getCharPosition());
+            ex.setLine(leafref.getLineNumber());
+            ex.setFileName(leafref.getFileName());
+            throw ex;
+        }
+    }
+
+    /**
+     * Returns the root parent with respect to the ancestor count from leafref.
+     *
+     * @param ancestorCount count of node where parent node can be reached
+     * @param curParent     current parent node
+     * @param leafref       instance of YANG leafref
+     * @return node where the ancestor count stops or augment path name list
+     * @throws DataModelException a violation of data model rules
+     */
+    private T getRootNodeWithAncestorCountForLeafref(
+            int ancestorCount, YangNode curParent, YangLeafRef leafref)
+            throws DataModelException {
+
+        int curParentCount = 1;
+        curParent = skipInvalidDataNodes(curParent, leafref);
+        if (curParent instanceof YangAugment) {
+            YangAugment augment = (YangAugment) curParent;
+            List<String> valueInAugment = getPathWithAugment(augment,
+                                                             ancestorCount - curParentCount);
+            return (T) valueInAugment;
+        } else {
+            while (curParentCount < ancestorCount) {
+                YangNode currentSkippedParent = skipInvalidDataNodes(curParent, leafref);
+                if (currentSkippedParent == curParent) {
+                    if (curParent.getParent() == null) {
+                        throw new DataModelException(getLeafRefErrorInfo(leafref));
+                    }
+                    curParent = curParent.getParent();
+                } else {
+                    curParent = currentSkippedParent;
+                    continue;
+                }
+                curParentCount = curParentCount + 1;
+                if (curParent instanceof YangAugment) {
+                    YangAugment augment = (YangAugment) curParent;
+                    List<String> valueInAugment = getPathWithAugment(
+                            augment, ancestorCount - curParentCount);
+                    return (T) valueInAugment;
+                }
+            }
+        }
+        return (T) curParent;
+    }
+
+    /**
+     * Finds and resolves with include list.
+     *
+     * @return true if resolved, false otherwise
+     * @throws DataModelException a violation in data model rule
+     */
+    private boolean resolveWithInclude() throws DataModelException {
+        /*
+         * Run through all the nodes in include list and search for referred
+         * typedef/grouping at the root level.
+         */
+        for (YangInclude yangInclude : curRefResolver.getIncludeList()) {
+            YangNode linkedNode = getLinkedNode(yangInclude.getIncludedNode());
+            if (linkedNode != null) {
+                return addUnResolvedRefToStack(linkedNode);
+            }
+        }
+        // If referred node can't be found return false.
+        return false;
+    }
+
+    /**
+     * Finds and resolves with import list.
+     *
+     * @return true if resolved, false otherwise
+     * @throws DataModelException a violation in data model rule
+     */
+    private boolean resolveWithImport() throws DataModelException {
+
+        // Run through import list to find the referred typedef/grouping.
+        for (YangImport yangImport : curRefResolver.getImportList()) {
+            /*
+             * Match the prefix attached to entity under resolution with the
+             * imported/included module/sub-module's prefix. If found, search
+             * for the referred typedef/grouping at the root level.
+             */
+            if (yangImport.getPrefixId().contentEquals(getRefPrefix())) {
+                YangNode linkedNode = getLinkedNode(yangImport.getImportedNode());
+                if (linkedNode != null) {
+                    return addUnResolvedRefToStack(linkedNode);
+                }
+                /*
+                 * If referred node can't be found at root level break for loop,
+                 * and return false.
+                 */
+                break;
+            }
+        }
+        // If referred node can't be found return false.
+        return false;
+    }
+
+    //Add unresolved constructs to stack.
+    private boolean addUnResolvedRefToStack(YangNode linkedNode)
+            throws DataModelException {
+        // Add the link to external entity.
+        addReferredEntityLink(linkedNode, INTER_FILE_LINKED);
+
+        // Add the type/uses of referred typedef/grouping to the stack.
+        addUnresolvedRecursiveReferenceToStack(linkedNode);
+        return true;
+    }
+
+    //Returns linked node from entity of stack.
+    private YangNode getLinkedNode(YangNode node) {
+        T entity = getCurEntityToResolveFromStack();
+        if (entity instanceof YangType) {
+            return findRefTypedef(node);
+        }
+        if (entity instanceof YangUses) {
+            return findRefGrouping(node);
+        }
+        if (entity instanceof YangIfFeature) {
+            return findRefFeature(node);
+        }
+        if (entity instanceof YangBase) {
+            return findRefIdentity(node);
+        }
+        if (entity instanceof YangIdentityRef) {
+            return findRefIdentityRef(node);
+        }
+        return null;
+    }
+
+    /**
+     * Returns referred typedef/grouping node.
+     *
+     * @return referred typedef/grouping node
+     * @throws DataModelException a violation in data model rule
+     */
+    private T getRefNode() throws DataModelException {
+        T entity = getCurEntityToResolveFromStack();
+        if (entity instanceof YangType) {
+            YangDerivedInfo<?> derivedInfo = (YangDerivedInfo<?>)
+                    ((YangType<?>) entity).getDataTypeExtendedInfo();
+            return (T) derivedInfo.getReferredTypeDef();
+        }
+        if (entity instanceof YangUses) {
+            return (T) ((YangUses) entity).getRefGroup();
+        }
+        if (entity instanceof YangIfFeature) {
+            return (T) ((YangIfFeature) entity).getReferredFeatureHolder();
+        }
+        if (entity instanceof YangLeafRef) {
+            return (T) ((YangLeafRef) entity).getReferredLeafOrLeafList();
+        }
+        if (entity instanceof YangBase) {
+            return (T) ((YangBase) entity).getReferredIdentity();
+        }
+        if (entity instanceof YangIdentityRef) {
+            return (T) ((YangIdentityRef) entity).getReferredIdentity();
+        }
+        throw new DataModelException(LINKER_ERROR);
+    }
+
+    /**
+     * Finds the referred grouping node at the root level of imported/included node.
+     *
+     * @param refNode module/sub-module node
+     * @return referred grouping
+     */
+    private YangNode findRefGrouping(YangNode refNode) {
+        YangNode tmpNode = refNode.getChild();
+        while (tmpNode != null) {
+            if (tmpNode instanceof YangGrouping) {
+                if (tmpNode.getName()
+                        .equals(((YangUses) getCurEntityToResolveFromStack())
+                                        .getName())) {
+                    return tmpNode;
+                }
+            }
+            tmpNode = tmpNode.getNextSibling();
+        }
+        return null;
+    }
+
+    /**
+     * Finds the referred feature node at the root level of imported/included node.
+     *
+     * @param refNode module/sub-module node
+     * @return referred feature
+     */
+    private YangNode findRefFeature(YangNode refNode) {
+        T entity = getCurEntityToResolveFromStack();
+        YangNodeIdentifier ifFeature = ((YangIfFeature) entity).getName();
+        List<YangFeature> featureList = ((YangFeatureHolder) refNode)
+                .getFeatureList();
+        if (featureList != null && !featureList.isEmpty()) {
+            for (YangFeature feature : featureList) {
+                if (ifFeature.getName().equals(feature.getName())) {
+                    ((YangIfFeature) entity).setReferredFeature(feature);
+                    return refNode;
+                }
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Finds the referred typedef node at the root level of imported/included node.
+     *
+     * @param refNode module/sub-module node
+     * @return referred typedef
+     */
+    private YangNode findRefTypedef(YangNode refNode) {
+        YangNode tmpNode = refNode.getChild();
+        while (tmpNode != null) {
+            if (tmpNode instanceof YangTypeDef) {
+                if (tmpNode.getName()
+                        .equals(((YangType) getCurEntityToResolveFromStack())
+                                        .getDataTypeName())) {
+                    return tmpNode;
+                }
+            }
+            tmpNode = tmpNode.getNextSibling();
+        }
+        return null;
+    }
+
+    /**
+     * Finds the referred identity node at the root level of imported/included node.
+     *
+     * @param refNode module/sub-module node
+     * @return referred identity
+     */
+    private YangNode findRefIdentity(YangNode refNode) {
+        YangNode tmpNode = refNode.getChild();
+        while (tmpNode != null) {
+            if (tmpNode instanceof YangIdentity) {
+                if (tmpNode.getName()
+                        .equals(((YangBase) getCurEntityToResolveFromStack())
+                                        .getBaseIdentifier().getName())) {
+                    return tmpNode;
+                }
+            }
+            tmpNode = tmpNode.getNextSibling();
+        }
+        return null;
+    }
+
+    /**
+     * Finds the referred identity node at the root level of imported/included node.
+     *
+     * @param refNode module/sub-module node
+     * @return referred identity
+     */
+    private YangNode findRefIdentityRef(YangNode refNode) {
+        YangNode tmpNode = refNode.getChild();
+        while (tmpNode != null) {
+            if (tmpNode instanceof YangIdentity) {
+                if (tmpNode.getName()
+                        .equals(((YangIdentityRef) getCurEntityToResolveFromStack())
+                                        .getBaseIdentity().getName())) {
+                    return tmpNode;
+                }
+            }
+            tmpNode = tmpNode.getNextSibling();
+        }
+        return null;
+    }
+
+    /**
+     * Sets descendant node augmented flag in ancestors.
+     *
+     * @param targetNode augmented YANG node
+     */
+    private void setAugmentedFlagInAncestors(YangNode targetNode) {
+        targetNode = targetNode.getParent();
+        while (targetNode != null) {
+            targetNode.setDescendantNodeAugmented(true);
+            targetNode = targetNode.getParent();
+        }
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/linker/src/main/java/org/onosproject/yang/compiler/linker/impl/YangXpathLinker.java b/compiler/base/linker/src/main/java/org/onosproject/yang/compiler/linker/impl/YangXpathLinker.java
new file mode 100644
index 0000000..02d1beb
--- /dev/null
+++ b/compiler/base/linker/src/main/java/org/onosproject/yang/compiler/linker/impl/YangXpathLinker.java
@@ -0,0 +1,774 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.linker.impl;
+
+import org.onosproject.yang.compiler.datamodel.LeafRefInvalidHolder;
+import org.onosproject.yang.compiler.datamodel.RpcNotificationContainer;
+import org.onosproject.yang.compiler.datamodel.YangAtomicPath;
+import org.onosproject.yang.compiler.datamodel.YangAugment;
+import org.onosproject.yang.compiler.datamodel.YangGrouping;
+import org.onosproject.yang.compiler.datamodel.YangImport;
+import org.onosproject.yang.compiler.datamodel.YangInclude;
+import org.onosproject.yang.compiler.datamodel.YangInput;
+import org.onosproject.yang.compiler.datamodel.YangLeaf;
+import org.onosproject.yang.compiler.datamodel.YangLeafList;
+import org.onosproject.yang.compiler.datamodel.YangLeafRef;
+import org.onosproject.yang.compiler.datamodel.YangLeavesHolder;
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangNodeIdentifier;
+import org.onosproject.yang.compiler.datamodel.YangOutput;
+import org.onosproject.yang.compiler.datamodel.YangSubModule;
+import org.onosproject.yang.compiler.datamodel.YangUses;
+import org.onosproject.yang.compiler.linker.exceptions.LinkerException;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Stack;
+
+import static org.onosproject.yang.compiler.datamodel.exceptions.ErrorMessages.getErrorMsg;
+import static org.onosproject.yang.compiler.linker.impl.PrefixResolverType.INTER_TO_INTER;
+import static org.onosproject.yang.compiler.linker.impl.PrefixResolverType.INTER_TO_INTRA;
+import static org.onosproject.yang.compiler.linker.impl.PrefixResolverType.INTRA_TO_INTER;
+import static org.onosproject.yang.compiler.linker.impl.PrefixResolverType.NO_PREFIX_CHANGE_FOR_INTER;
+import static org.onosproject.yang.compiler.linker.impl.PrefixResolverType.NO_PREFIX_CHANGE_FOR_INTRA;
+import static org.onosproject.yang.compiler.linker.impl.XpathLinkingTypes.AUGMENT_LINKING;
+import static org.onosproject.yang.compiler.utils.UtilConstants.COLON;
+import static org.onosproject.yang.compiler.utils.UtilConstants.ERROR_MSG_FOR_AUGMENT_LINKING;
+import static org.onosproject.yang.compiler.utils.UtilConstants.FAILED_TO_FIND_LEAD_INFO_HOLDER;
+import static org.onosproject.yang.compiler.utils.UtilConstants.INPUT;
+import static org.onosproject.yang.compiler.utils.UtilConstants.IS_INVALID;
+import static org.onosproject.yang.compiler.utils.UtilConstants.LEAFREF_ERROR;
+import static org.onosproject.yang.compiler.utils.UtilConstants.LEAF_HOLDER_ERROR;
+import static org.onosproject.yang.compiler.utils.UtilConstants.OUTPUT;
+import static org.onosproject.yang.compiler.utils.UtilConstants.SLASH_FOR_STRING;
+
+/**
+ * Represents x-path linking.
+ *
+ * @param <T> x-path linking can be done for target node or for target leaf/leaf-list
+ */
+public class YangXpathLinker<T> {
+
+    private List<YangAtomicPath> absPaths;
+    private YangNode rootNode;
+    private Map<YangAtomicPath, PrefixResolverType> prefixResolverTypes;
+    private String curPrefix;
+    private String constructsParentsPrefix;
+    private XpathLinkingTypes linkingType;
+
+    /**
+     * Creates an instance of x-path linker.
+     */
+    public YangXpathLinker() {
+        absPaths = new ArrayList<>();
+    }
+
+    /**
+     * Returns list of augment nodes.
+     *
+     * @param node root node
+     * @return list of augment nodes
+     */
+    public List<YangAugment> getListOfYangAugment(YangNode node) {
+        node = node.getChild();
+        List<YangAugment> augments = new ArrayList<>();
+        while (node != null) {
+            if (node instanceof YangAugment) {
+                augments.add((YangAugment) node);
+            }
+            node = node.getNextSibling();
+        }
+        return augments;
+    }
+
+    /**
+     * Process absolute node path for target leaf.
+     *
+     * @param atomicPaths atomic path node list
+     * @param root        root node
+     * @param leafref     instance of YANG leafref
+     * @param curLinking  x path linking type
+     * @return linked target node
+     */
+    T processLeafRefXpathLinking(List<YangAtomicPath> atomicPaths, YangNode root,
+                                 YangLeafRef leafref, XpathLinkingTypes curLinking) {
+
+        YangNode targetNode;
+        rootNode = root;
+        prefixResolverTypes = new HashMap<>();
+        linkingType = curLinking;
+        parsePrefixResolverList(atomicPaths);
+        YangAtomicPath leafRefPath = atomicPaths.get(atomicPaths.size() - 1);
+
+        // When leaf-ref path contains only one absolute path.
+        if (atomicPaths.size() == 1) {
+            targetNode = getTargetNodeWhenPathSizeIsOne(atomicPaths);
+        } else {
+            for (YangAtomicPath atomicPath : atomicPaths) {
+                if (atomicPath != leafRefPath) {
+                    absPaths.add(atomicPath);
+                }
+            }
+            targetNode = parseData(root);
+        }
+        if (targetNode == null) {
+            targetNode = searchInSubModule(root);
+        }
+
+        // Invalid path presence in the node list is checked.
+        validateInvalidNodesInThePath(leafref);
+
+        if (targetNode != null) {
+            YangLeaf targetLeaf = searchReferredLeaf(targetNode, leafRefPath
+                    .getNodeIdentifier().getName());
+            if (targetLeaf == null) {
+                YangLeafList targetLeafList = searchReferredLeafList(
+                        targetNode, leafRefPath.getNodeIdentifier().getName());
+                if (targetLeafList != null) {
+                    return (T) targetLeafList;
+                } else {
+                    LinkerException ex = new LinkerException(
+                            FAILED_TO_FIND_LEAD_INFO_HOLDER + leafref.getPath());
+                    ex.setCharPosition(leafref.getCharPosition());
+                    ex.setLine(leafref.getLineNumber());
+                    ex.setFileName(leafref.getFileName());
+                    throw ex;
+                }
+            }
+            return (T) targetLeaf;
+        }
+        return null;
+    }
+
+    /**
+     * Validates the nodes in the path for any invalid node.
+     *
+     * @param leafref instance of YANG leafref
+     */
+    private void validateInvalidNodesInThePath(YangLeafRef leafref) {
+        for (YangAtomicPath absolutePath : (Iterable<YangAtomicPath>) leafref
+                .getAtomicPath()) {
+            YangNode nodeInPath = absolutePath.getResolvedNode();
+
+            if (nodeInPath instanceof LeafRefInvalidHolder) {
+                LinkerException ex = new LinkerException(
+                        LEAFREF_ERROR + leafref.getPath() + IS_INVALID);
+                ex.setCharPosition(leafref.getCharPosition());
+                ex.setLine(leafref.getLineNumber());
+                ex.setFileName(leafref.getFileName());
+                throw ex;
+            }
+        }
+    }
+
+    /**
+     * Returns target node when leaf-ref has only one absolute path in list.
+     *
+     * @param paths absolute paths
+     * @return target node
+     */
+    private YangNode getTargetNodeWhenPathSizeIsOne(List<YangAtomicPath> paths) {
+        if (paths.get(0).getNodeIdentifier().getPrefix() != null
+                && !paths.get(0).getNodeIdentifier().getPrefix().equals
+                (getRootsPrefix(rootNode))) {
+            return getImportedNode(rootNode, paths.get(0).getNodeIdentifier());
+        }
+        return rootNode;
+    }
+
+    /**
+     * Process absolute node path linking for augment.
+     *
+     * @param paths      absolute path node list
+     * @param root       root node
+     * @param curLinking x path linker type
+     * @return linked target node
+     */
+    public YangNode processXpathLinking(List<YangAtomicPath> paths,
+                                        YangNode root, XpathLinkingTypes curLinking) {
+        absPaths = paths;
+        rootNode = root;
+        prefixResolverTypes = new HashMap<>();
+        linkingType = curLinking;
+        parsePrefixResolverList(paths);
+        YangNode targetNode = parseData(root);
+        if (targetNode == null) {
+            targetNode = searchInSubModule(root);
+        }
+        return targetNode;
+    }
+
+    /**
+     * Searches for the referred leaf in target node.
+     *
+     * @param targetNode target node
+     * @param leafName   leaf name
+     * @return target leaf
+     */
+    private YangLeaf searchReferredLeaf(YangNode targetNode, String leafName) {
+        if (!(targetNode instanceof YangLeavesHolder)) {
+            throw new LinkerException(getErrorMsg(
+                    LEAF_HOLDER_ERROR, targetNode.getName(), targetNode
+                            .getLineNumber(), targetNode.getCharPosition(),
+                    targetNode.getFileName()));
+        }
+        YangLeavesHolder holder = (YangLeavesHolder) targetNode;
+        List<YangLeaf> leaves = holder.getListOfLeaf();
+        if (leaves != null && !leaves.isEmpty()) {
+            for (YangLeaf leaf : leaves) {
+                if (leaf.getName().equals(leafName)) {
+                    return leaf;
+                }
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Searches for the referred leaf-list in target node.
+     *
+     * @param targetNode target node
+     * @param name       leaf-list name
+     * @return target leaf-list
+     */
+    private YangLeafList searchReferredLeafList(YangNode targetNode, String name) {
+        if (!(targetNode instanceof YangLeavesHolder)) {
+            throw new LinkerException(getErrorMsg(
+                    LEAF_HOLDER_ERROR, targetNode.getName(), targetNode
+                            .getLineNumber(), targetNode.getCharPosition(),
+                    targetNode.getFileName()));
+        }
+        YangLeavesHolder holder = (YangLeavesHolder) targetNode;
+        List<YangLeafList> leavesList = holder.getListOfLeafList();
+        if (leavesList != null && !leavesList.isEmpty()) {
+            for (YangLeafList leafList : leavesList) {
+                if (leafList.getName().equals(name)) {
+                    return leafList;
+                }
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Process linking using for node identifier for inter/intra file.
+     *
+     * @param root root node
+     * @return linked target node
+     */
+    private YangNode parseData(YangNode root) {
+        String rootPrefix = getRootsPrefix(root);
+        constructsParentsPrefix = rootPrefix;
+        Iterator<YangAtomicPath> pathIterator = absPaths.iterator();
+        YangAtomicPath path = pathIterator.next();
+        if (path.getNodeIdentifier().getPrefix() != null
+                && !path.getNodeIdentifier().getPrefix().equals(rootPrefix)) {
+            return parsePath(getImportedNode(root, path.getNodeIdentifier()));
+        } else {
+            return parsePath(root);
+        }
+    }
+
+    /**
+     * Process linking of target node in root node.
+     *
+     * @param root root node
+     * @return linked target node
+     */
+    private YangNode parsePath(YangNode root) {
+
+        YangNode tempNode = root;
+        Stack<YangNode> linkerStack = new Stack<>();
+        Iterator<YangAtomicPath> pathIterator = absPaths.iterator();
+        YangAtomicPath tempPath = pathIterator.next();
+        YangNodeIdentifier nodeId;
+        curPrefix = tempPath.getNodeIdentifier().getPrefix();
+        int index = 0;
+        YangNode tempAugment;
+        do {
+            nodeId = tempPath.getNodeIdentifier();
+            if (tempPath.getNodeIdentifier().getPrefix() == null) {
+                tempAugment = resolveIntraFileAugment(tempPath, root);
+            } else {
+                tempAugment = resolveInterFileAugment(tempPath, root);
+            }
+            if (tempAugment != null) {
+                linkerStack.push(tempNode);
+                tempNode = tempAugment;
+            }
+
+            tempNode = searchTargetNode(tempNode, nodeId);
+
+            if (tempNode == null && !linkerStack.isEmpty()) {
+                tempNode = linkerStack.peek();
+                linkerStack.pop();
+                tempNode = searchTargetNode(tempNode, nodeId);
+            }
+
+            if (tempNode != null) {
+                tempPath.setResolvedNode(tempNode);
+                validateTempPathNode(tempNode);
+            }
+
+            if (index == absPaths.size() - 1) {
+                break;
+            }
+            tempPath = pathIterator.next();
+            index++;
+        } while (validate(tempNode, index));
+        return tempNode;
+    }
+
+    /**
+     * Validates temp path nodes for augment linking.
+     *
+     * @param node temp path node
+     */
+    private void validateTempPathNode(YangNode node) {
+
+        if (linkingType != AUGMENT_LINKING) {
+            return;
+        }
+        if (node instanceof YangGrouping) {
+            LinkerException ex = new LinkerException(
+                    ERROR_MSG_FOR_AUGMENT_LINKING +
+                            getAugmentNodeIdentifier(
+                                    absPaths.get(absPaths.size() - 1).getNodeIdentifier(),
+                                    absPaths,
+                                    rootNode));
+            ex.setFileName(rootNode.getFileName());
+            throw ex;
+        }
+    }
+
+    /**
+     * Resolves intra file augment linking.
+     *
+     * @param tempPath temporary absolute path
+     * @param root     root node
+     * @return linked target node
+     */
+    private YangNode resolveIntraFileAugment(YangAtomicPath tempPath, YangNode root) {
+        YangNode tempAugment;
+        if (curPrefix != tempPath.getNodeIdentifier().getPrefix()) {
+            root = getIncludedNode(rootNode, tempPath.getNodeIdentifier().getName());
+            if (root == null) {
+                root = getIncludedNode(rootNode, getAugmentNodeIdentifier(
+                        tempPath.getNodeIdentifier(), absPaths, rootNode));
+                if (root == null) {
+                    root = rootNode;
+                }
+            }
+        } else {
+            if (curPrefix != null) {
+                root = getImportedNode(root, tempPath.getNodeIdentifier());
+            }
+        }
+
+        curPrefix = tempPath.getNodeIdentifier().getPrefix();
+        tempAugment = getAugment(tempPath.getNodeIdentifier(), root, absPaths);
+        if (tempAugment == null) {
+            tempAugment = getAugment(tempPath.getNodeIdentifier(), rootNode,
+                                     absPaths);
+        }
+        return tempAugment;
+    }
+
+    /**
+     * Resolves inter file augment linking.
+     *
+     * @param tempPath temporary absolute path
+     * @param root     root node
+     * @return linked target node
+     */
+    private YangNode resolveInterFileAugment(YangAtomicPath tempPath, YangNode root) {
+
+        YangNode tempAugment;
+        if (!tempPath.getNodeIdentifier().getPrefix().equals(curPrefix)) {
+            curPrefix = tempPath.getNodeIdentifier().getPrefix();
+            root = getImportedNode(rootNode, tempPath.getNodeIdentifier());
+        }
+        tempAugment = getAugment(tempPath.getNodeIdentifier(), root, absPaths);
+        if (tempAugment == null) {
+            return resolveInterToInterFileAugment(root);
+        }
+        return tempAugment;
+    }
+
+    /**
+     * Resolves augment when prefix changed from inter file to inter file.
+     * it may be possible that the prefix used in imported module is different the
+     * given list of node identifiers.
+     *
+     * @param root root node
+     * @return target node
+     */
+    private YangNode resolveInterToInterFileAugment(YangNode root) {
+        List<YangAugment> augments = getListOfYangAugment(root);
+        int index;
+        List<YangAtomicPath> paths = new ArrayList<>();
+        for (YangAugment augment : augments) {
+            index = 0;
+
+            for (YangAtomicPath path : augment.getTargetNode()) {
+
+                if (!searchForAugmentInImportedNode(path.getNodeIdentifier(), index)) {
+                    paths.clear();
+                    break;
+                }
+                paths.add(path);
+                index++;
+            }
+            if (!paths.isEmpty() && paths.size() == absPaths.size() - 1) {
+                return augment;
+            } else {
+                paths.clear();
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Searches for the augment node in imported module when prefix has changed from
+     * inter file to inter file.
+     *
+     * @param nodeId node id
+     * @param index  index
+     * @return true if found
+     */
+    private boolean searchForAugmentInImportedNode(YangNodeIdentifier nodeId,
+                                                   int index) {
+        if (index == absPaths.size()) {
+            return false;
+        }
+        YangNodeIdentifier tempNodeId = absPaths.get(index).getNodeIdentifier();
+        return nodeId.getName().equals(tempNodeId.getName());
+    }
+
+    /**
+     * Returns augment node.
+     *
+     * @param tempNodeId temporary absolute path id
+     * @param root       root node
+     * @return linked target node
+     */
+    private YangNode getAugment(YangNodeIdentifier tempNodeId, YangNode root,
+                                List<YangAtomicPath> absPaths) {
+        String augmentName = getAugmentNodeIdentifier(tempNodeId, absPaths, root);
+        if (augmentName != null) {
+            return searchAugmentNode(root, augmentName);
+        }
+        return null;
+    }
+
+    /**
+     * Process linking using import list.
+     *
+     * @param root   root node
+     * @param nodeId node identifier
+     * @return linked target node
+     */
+    private YangNode getImportedNode(YangNode root, YangNodeIdentifier nodeId) {
+
+        List<YangImport> importList;
+
+        if (root instanceof YangModule) {
+            importList = ((YangModule) root).getImportList();
+        } else {
+            importList = ((YangSubModule) root).getImportList();
+        }
+
+        for (YangImport imported : importList) {
+            if (imported.getPrefixId().equals(nodeId.getPrefix())) {
+                return imported.getImportedNode();
+            }
+        }
+
+        if (nodeId.getName() != null && nodeId.getPrefix()
+                .equals(constructsParentsPrefix)) {
+            return rootNode;
+        }
+        return root;
+    }
+
+    /**
+     * Searches in sub-module node.
+     *
+     * @param root root node
+     * @return target linked node
+     */
+    private YangNode searchInSubModule(YangNode root) {
+        List<YangInclude> includeList;
+        YangNode tempNode;
+        if (root instanceof YangModule) {
+            includeList = ((YangModule) root).getIncludeList();
+        } else {
+            includeList = ((YangSubModule) root).getIncludeList();
+        }
+
+        for (YangInclude included : includeList) {
+            tempNode = parseData(included.getIncludedNode());
+            if (tempNode != null) {
+                return tempNode;
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Process linking using include list.
+     *
+     * @param root         root node
+     * @param tempPathName temporary path node name
+     * @return linked target node
+     */
+    private YangNode getIncludedNode(YangNode root, String tempPathName) {
+
+        List<YangInclude> includeList;
+
+        if (root instanceof YangModule) {
+            includeList = ((YangModule) root).getIncludeList();
+        } else {
+            includeList = ((YangSubModule) root).getIncludeList();
+        }
+
+        for (YangInclude included : includeList) {
+            if (verifyChildNode(included.getIncludedNode(), tempPathName)) {
+                return included.getIncludedNode();
+            }
+        }
+
+        return null;
+    }
+
+    /**
+     * Verifies for child nodes in sub module.
+     *
+     * @param node submodule node
+     * @param name name of child node
+     * @return true if child node found
+     */
+    private boolean verifyChildNode(YangNode node, String name) {
+        node = node.getChild();
+        while (node != null) {
+            if (node.getName().equals(name)) {
+                return true;
+            }
+            node = node.getNextSibling();
+        }
+        return false;
+    }
+
+
+    /**
+     * Returns augment's node id.
+     *
+     * @param nodeId   node identifier
+     * @param absPaths absolute paths
+     * @param root     root node
+     * @return augment's node id
+     */
+    private String getAugmentNodeIdentifier(
+            YangNodeIdentifier nodeId, List<YangAtomicPath> absPaths, YangNode root) {
+        Iterator<YangAtomicPath> nodeIdIterator = absPaths.iterator();
+        YangAtomicPath tempNodeId;
+        StringBuilder builder = new StringBuilder();
+        String name;
+        String prefix;
+        String id;
+        PrefixResolverType type;
+        while (nodeIdIterator.hasNext()) {
+            tempNodeId = nodeIdIterator.next();
+            name = tempNodeId.getNodeIdentifier().getName();
+            prefix = tempNodeId.getNodeIdentifier().getPrefix();
+            if (!tempNodeId.getNodeIdentifier().equals(nodeId)) {
+                type = prefixResolverTypes.get(tempNodeId);
+                switch (type) {
+                    case INTER_TO_INTRA:
+                        id = SLASH_FOR_STRING + name;
+                        break;
+                    case INTRA_TO_INTER:
+                        if (!getRootsPrefix(root).equals(prefix)) {
+                            id = SLASH_FOR_STRING + prefix + COLON + name;
+                        } else {
+                            id = SLASH_FOR_STRING + name;
+                        }
+                        break;
+                    case INTER_TO_INTER:
+                        id = SLASH_FOR_STRING + prefix + COLON + name;
+                        break;
+                    case NO_PREFIX_CHANGE_FOR_INTRA:
+                        id = SLASH_FOR_STRING + name;
+                        break;
+                    case NO_PREFIX_CHANGE_FOR_INTER:
+                        if (!getRootsPrefix(root).equals(prefix)) {
+                            id = SLASH_FOR_STRING + prefix + COLON + name;
+                        } else {
+                            id = SLASH_FOR_STRING + name;
+                        }
+                        break;
+                    default:
+                        id = SLASH_FOR_STRING + name;
+                        break;
+                }
+                builder.append(id);
+            } else {
+                return builder.toString();
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Searches augment node in root node by name of the augment. For intra
+     * file augment, target augment name without prefix is taken and checked.
+     *
+     * @param root    root node
+     * @param augName current augment name
+     * @return target augment node
+     */
+    private YangNode searchAugmentNode(YangNode root, String augName) {
+        YangNode node = root;
+        node = node.getChild();
+        while (node != null) {
+            if (node instanceof YangAugment) {
+                String name = ((YangAugment) node).getPrefixRemovedName();
+                if (node.getName().equals(augName) || name.equals(augName)) {
+                    return node;
+                }
+            }
+            node = node.getNextSibling();
+        }
+        return null;
+    }
+
+    /**
+     * Validates for target node if target node found or not.
+     *
+     * @param tempNode temporary node
+     * @param index    current index of list
+     * @return false if target node found
+     */
+    private boolean validate(YangNode tempNode, int index) {
+
+        int size = absPaths.size();
+        if (tempNode != null && index != size) {
+            return true;
+        } else if (tempNode != null) {
+            return false;
+            // this is your target node.
+        } else if (index != size) {
+            return true;
+            // this could be in submodule as well.
+        }
+        return false;
+    }
+
+    /**
+     * Searches target node in root node.
+     *
+     * @param node      root node
+     * @param curNodeId YANG node identifier
+     * @return linked target node
+     */
+    private YangNode searchTargetNode(YangNode node, YangNodeIdentifier curNodeId) {
+
+        if (node != null) {
+            node = node.getChild();
+        }
+        while (node != null) {
+            if (node instanceof YangInput) {
+                if (curNodeId.getName().equalsIgnoreCase(INPUT)) {
+                    return node;
+                }
+            } else if (node instanceof YangOutput) {
+                if (curNodeId.getName().equalsIgnoreCase(OUTPUT)) {
+                    return node;
+                }
+            }
+            if (node.getName().equals(curNodeId.getName()) &&
+                    !(node instanceof YangUses)) {
+                return node;
+            }
+            node = node.getNextSibling();
+        }
+        return null;
+    }
+
+    /**
+     * Returns root prefix.
+     *
+     * @param root root node
+     * @return root prefix
+     */
+    private String getRootsPrefix(YangNode root) {
+        if (root instanceof YangModule) {
+            return ((YangModule) root).getPrefix();
+        } else {
+            return ((YangSubModule) root).getPrefix();
+        }
+    }
+
+    /**
+     * Resolves prefix and provides prefix resolver list.
+     *
+     * @param absolutePaths absolute paths
+     */
+    private void parsePrefixResolverList(List<YangAtomicPath> absolutePaths) {
+        Iterator<YangAtomicPath> pathIterator = absolutePaths.iterator();
+        YangAtomicPath absPath;
+        String prePrefix;
+        String curPrefix = null;
+        while (pathIterator.hasNext()) {
+            prePrefix = curPrefix;
+            absPath = pathIterator.next();
+            curPrefix = absPath.getNodeIdentifier().getPrefix();
+            if (curPrefix != null) {
+                if (!curPrefix.equals(prePrefix)) {
+                    if (prePrefix != null) {
+                        prefixResolverTypes.put(absPath, INTER_TO_INTER);
+                    } else {
+                        prefixResolverTypes.put(absPath, INTRA_TO_INTER);
+                    }
+                } else {
+                    prefixResolverTypes.put(absPath, NO_PREFIX_CHANGE_FOR_INTER);
+                }
+            } else {
+                if (prePrefix != null) {
+                    prefixResolverTypes.put(absPath, INTER_TO_INTRA);
+                } else {
+                    prefixResolverTypes.put(absPath, NO_PREFIX_CHANGE_FOR_INTRA);
+                }
+            }
+        }
+    }
+
+    /**
+     * Adds augment to rpc augmented list of input.
+     *
+     * @param augment  augment
+     * @param rootNode root node
+     */
+    void addInModuleIfInput(YangAugment augment,
+                            YangNode rootNode) {
+        ((RpcNotificationContainer) rootNode).addToAugmentList(augment);
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/linker/src/main/java/org/onosproject/yang/compiler/linker/impl/package-info.java b/compiler/base/linker/src/main/java/org/onosproject/yang/compiler/linker/impl/package-info.java
new file mode 100644
index 0000000..7ddaed2
--- /dev/null
+++ b/compiler/base/linker/src/main/java/org/onosproject/yang/compiler/linker/impl/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.
+ */
+
+/**
+ * Provide intra/inter file and inter jar linking implementation.
+ */
+package org.onosproject.yang.compiler.linker.impl;
diff --git a/compiler/base/linker/src/main/java/org/onosproject/yang/compiler/linker/package-info.java b/compiler/base/linker/src/main/java/org/onosproject/yang/compiler/linker/package-info.java
new file mode 100644
index 0000000..5cef2e8
--- /dev/null
+++ b/compiler/base/linker/src/main/java/org/onosproject/yang/compiler/linker/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.
+ */
+
+/**
+ * Provide inter jar and inter file linking abstract interface.
+ */
+package org.onosproject.yang.compiler.linker;
\ No newline at end of file
diff --git a/compiler/base/parser/pom.xml b/compiler/base/parser/pom.xml
new file mode 100644
index 0000000..671bd15
--- /dev/null
+++ b/compiler/base/parser/pom.xml
@@ -0,0 +1,147 @@
+<!--
+  ~ 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-yang-compiler-base</artifactId>
+        <version>1.12-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>onos-yang-compiler-parser</artifactId>
+    <version>1.12-SNAPSHOT</version>
+    <packaging>jar</packaging>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.onosproject</groupId>
+            <artifactId>onos-yang-compiler-datamodel</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.onosproject</groupId>
+            <artifactId>onos-yang-compiler-translator</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.onosproject</groupId>
+            <artifactId>onos-yang-compiler-linker</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.antlr</groupId>
+            <artifactId>antlr4-runtime</artifactId>
+            <version>4.5.3</version>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>4.12</version>
+            <scope>test</scope>
+        </dependency>
+
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.antlr</groupId>
+                <artifactId>antlr4-maven-plugin</artifactId>
+                <version>4.5</version>
+                <executions>
+                    <execution>
+                        <phase>generate-sources</phase>
+                        <goals>
+                            <goal>antlr4</goal>
+                        </goals>
+                    </execution>
+                </executions>
+                <configuration>
+                    <sourceDirectory>src/main/resources</sourceDirectory>
+                    <outputDirectory>
+                        target/generated-sources/org/onosproject/yang/compiler/parser/antlrgencode
+                    </outputDirectory>
+                    <visitor>false</visitor>
+                    <listener>true</listener>
+                </configuration>
+            </plugin>
+            <plugin>
+                <artifactId>maven-clean-plugin</artifactId>
+                <version>3.0.0</version>
+                <executions>
+                    <execution>
+                        <id>Deleting auto-generated listener interfaces</id>
+                        <phase>generate-sources</phase>
+                        <goals>
+                            <goal>clean</goal>
+                        </goals>
+                    </execution>
+                </executions>
+                <configuration>
+                    <excludeDefaultDirectories>true</excludeDefaultDirectories>
+                    <filesets>
+                        <fileset>
+                            <directory>target</directory>
+                            <followSymlinks>false</followSymlinks>
+                            <useDefaultExcludes>true</useDefaultExcludes>
+                            <excludes>
+                                <exclude>
+                                    **/generated-sources/org/onosproject/yang/compiler/parser/antlrgencode/GeneratedYangLexer.java
+                                </exclude>
+                                <exclude>
+                                    **/generated-sources/org/onosproject/yang/compiler/parser/antlrgencode/GeneratedYang.tokens
+                                </exclude>
+                                <exclude>
+                                    **/generated-sources/org/onosproject/yang/compiler/parser/antlrgencode/GeneratedYangParser.java
+                                </exclude>
+                                <exclude>
+                                    **/generated-sources/org/onosproject/yang/compiler/parser/antlrgencode/GeneratedYangLexer.tokens
+                                </exclude>
+                                <exclude>
+                                    **/generated-sources/org/onosproject/yang/compiler/parser/antlrgencode/YangLexer.java
+                                </exclude>
+                                <exclude>
+                                    **/generated-sources/org/onosproject/yang/compiler/parser/antlrgencode/YangLexer.tokens
+                                </exclude>
+                            </excludes>
+                        </fileset>
+                    </filesets>
+                    <verbose>false</verbose>
+                </configuration>
+            </plugin>
+
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-jar-plugin</artifactId>
+                <version>3.0.2</version>
+                <configuration>
+                    <skipIfEmpty>true</skipIfEmpty>
+                </configuration>
+                <executions>
+                    <execution>
+                        <id>default</id>
+                        <goals>
+                            <goal>test-jar</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+</project>
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/YangUtilsParser.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/YangUtilsParser.java
new file mode 100644
index 0000000..67c611f
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/YangUtilsParser.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser;
+
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+
+import java.io.IOException;
+
+/**
+ * Abstraction of entity which provides parser service of YANG files for yangutils-maven-plugin.
+ */
+public interface YangUtilsParser {
+
+    /**
+     * Returns the data model node. It is an entry function to initiate the YANG file parsing.
+     *
+     * @param file input YANG file
+     * @return YangNode root node of the data model tree
+     * @throws ParserException when fails to get the data model
+     * @throws IOException when there is an exception in IO operation
+     */
+    YangNode getDataModel(String file) throws IOException, ParserException;
+}
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/antlrgencode/GeneratedYangListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/antlrgencode/GeneratedYangListener.java
new file mode 100644
index 0000000..ff319df
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/antlrgencode/GeneratedYangListener.java
@@ -0,0 +1,2077 @@
+/*
+ * 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.
+ */
+
+// Generated from GeneratedYang.g4 by ANTLR 4.5
+
+package org.onosproject.yang.compiler.parser.antlrgencode;
+
+import org.antlr.v4.runtime.tree.ParseTreeListener;
+
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.AnyxmlStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.AppDataStructureContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.AppDataStructureStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.AppExtendedStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.ArgumentBodyContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.ArgumentStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.AugmentContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.AugmentStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.BaseStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.BelongstoStatementBodyContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.BelongstoStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.BitBodyStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.BitStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.BitsSpecificationContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.BodyStatementsContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.CaseStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.ChoiceStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.CommonStatementsContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.CompilerAnnotationBodyStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.CompilerAnnotationStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.ConfigContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.ConfigStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.ContactStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.ContainerStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.DataDefStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.DataStructureKeyStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.DateArgumentStringContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.Decimal64SpecificationContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.DefaultStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.DescriptionStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.DeviateAddStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.DeviateDeleteStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.DeviateNotSupportedStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.DeviateReplaceStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.DeviationContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.DeviationStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.EnumSpecificationContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.EnumStatementBodyContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.EnumStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.ErrorAppTagStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.ErrorMessageStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.ExtendedNameContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.ExtensionBodyContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.ExtensionStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.FeatureBodyContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.FeatureStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.FractionContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.FractionDigitStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.GroupingStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.IdentifierContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.IdentityBodyContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.IdentityStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.IdentityrefSpecificationContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.IfFeatureStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.ImportStatementBodyContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.ImportStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.IncludeStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.InputStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.InstanceIdentifierSpecificationContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.KeyContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.KeyStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.LeafListStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.LeafStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.LeafrefSpecificationContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.LengthContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.LengthStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.LinkageStatementsContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.ListStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.MandatoryContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.MandatoryStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.MaxElementsStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.MaxValueContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.MetaStatementsContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.MinElementsStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.MinValueContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.ModuleBodyContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.ModuleHeaderStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.ModuleStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.MustStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.NamespaceStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.NotificationStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.NumericalRestrictionsContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.OrderedByContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.OrderedByStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.OrganizationStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.OutputStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.PathContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.PathStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.PatternStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.PositionContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.PositionStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.PrefixStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.PresenceStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.RangeContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.RangeStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.ReferenceStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.RefineAnyxmlStatementsContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.RefineCaseStatementsContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.RefineChoiceStatementsContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.RefineContainerStatementsContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.RefineContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.RefineLeafListStatementsContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.RefineLeafStatementsContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.RefineListStatementsContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.RefineStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.RequireInstanceContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.RequireInstanceStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.RevisionDateStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.RevisionStatementBodyContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.RevisionStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.RevisionStatementsContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.RpcStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.ShortCaseStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.StatusContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.StatusStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.StringContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.StringRestrictionsContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.SubModuleStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.SubmoduleBodyContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.SubmoduleHeaderStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.TypeBodyStatementsContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.TypeStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.TypedefStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.UnionSpecificationContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.UniqueContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.UniqueStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.UnitsStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.UsesStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.ValueContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.ValueStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.VersionContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.WhenStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.YangConstructContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.YangVersionStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.YangfileContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.YinElementStatementContext;
+
+/**
+ * Represents ANTLR interfaces to be implemented by listener to traverse the parse tree.
+ */
+public interface GeneratedYangListener extends ParseTreeListener {
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule yangfile.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterYangfile(YangfileContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule yangfile.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitYangfile(YangfileContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule moduleStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterModuleStatement(ModuleStatementContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule moduleStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitModuleStatement(ModuleStatementContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule moduleBody.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterModuleBody(ModuleBodyContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule moduleBody.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitModuleBody(ModuleBodyContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule moduleHeaderStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterModuleHeaderStatement(ModuleHeaderStatementContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule moduleHeaderStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitModuleHeaderStatement(ModuleHeaderStatementContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule linkageStatements.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterLinkageStatements(LinkageStatementsContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule linkageStatements.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitLinkageStatements(LinkageStatementsContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule metaStatements.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterMetaStatements(MetaStatementsContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule metaStatements.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitMetaStatements(MetaStatementsContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule revisionStatements.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterRevisionStatements(RevisionStatementsContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule revisionStatements.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitRevisionStatements(RevisionStatementsContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule bodyStatements.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterBodyStatements(BodyStatementsContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule bodyStatements.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitBodyStatements(BodyStatementsContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule yangVersionStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterYangVersionStatement(YangVersionStatementContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule yangVersionStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitYangVersionStatement(YangVersionStatementContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule namespaceStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterNamespaceStatement(NamespaceStatementContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule namespaceStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitNamespaceStatement(NamespaceStatementContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule prefixStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterPrefixStatement(PrefixStatementContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule prefixStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitPrefixStatement(PrefixStatementContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule importStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterImportStatement(ImportStatementContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule importStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitImportStatement(ImportStatementContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule importStatementBody.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterImportStatementBody(ImportStatementBodyContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule importStatementBody.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitImportStatementBody(ImportStatementBodyContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule revisionDateStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterRevisionDateStatement(RevisionDateStatementContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule revisionDateStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitRevisionDateStatement(RevisionDateStatementContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule includeStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterIncludeStatement(IncludeStatementContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule includeStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitIncludeStatement(IncludeStatementContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule organizationStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterOrganizationStatement(OrganizationStatementContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule organizationStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitOrganizationStatement(OrganizationStatementContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule contactStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterContactStatement(ContactStatementContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule contactStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitContactStatement(ContactStatementContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule descriptionStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterDescriptionStatement(DescriptionStatementContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule descriptionStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitDescriptionStatement(DescriptionStatementContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule referenceStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterReferenceStatement(ReferenceStatementContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule referenceStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitReferenceStatement(ReferenceStatementContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule revisionStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterRevisionStatement(RevisionStatementContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule revisionStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitRevisionStatement(RevisionStatementContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule revisionStatementBody.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterRevisionStatementBody(RevisionStatementBodyContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule revisionStatementBody.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitRevisionStatementBody(RevisionStatementBodyContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule subModuleStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterSubModuleStatement(SubModuleStatementContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule subModuleStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitSubModuleStatement(SubModuleStatementContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule submoduleBody.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterSubmoduleBody(SubmoduleBodyContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule submoduleBody.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitSubmoduleBody(SubmoduleBodyContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule submoduleHeaderStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterSubmoduleHeaderStatement(SubmoduleHeaderStatementContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule submoduleHeaderStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitSubmoduleHeaderStatement(SubmoduleHeaderStatementContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule belongstoStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterBelongstoStatement(BelongstoStatementContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule belongstoStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitBelongstoStatement(BelongstoStatementContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule belongstoStatementBody.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterBelongstoStatementBody(BelongstoStatementBodyContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule belongstoStatementBody.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitBelongstoStatementBody(BelongstoStatementBodyContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule extensionStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterExtensionStatement(ExtensionStatementContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule extensionStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitExtensionStatement(ExtensionStatementContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule extensionBody.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterExtensionBody(ExtensionBodyContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule extensionBody.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitExtensionBody(ExtensionBodyContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule argumentStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterArgumentStatement(ArgumentStatementContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule argumentStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitArgumentStatement(ArgumentStatementContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule argumentBody.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterArgumentBody(ArgumentBodyContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule argumentBody.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitArgumentBody(ArgumentBodyContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule yinElementStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterYinElementStatement(YinElementStatementContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule yinElementStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitYinElementStatement(YinElementStatementContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule identityStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterIdentityStatement(IdentityStatementContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule identityStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitIdentityStatement(IdentityStatementContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule identityBody.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterIdentityBody(IdentityBodyContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule identityBody.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitIdentityBody(IdentityBodyContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule baseStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterBaseStatement(BaseStatementContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule baseStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitBaseStatement(BaseStatementContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule featureStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterFeatureStatement(FeatureStatementContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule featureStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitFeatureStatement(FeatureStatementContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule featureBody.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterFeatureBody(FeatureBodyContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule featureBody.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitFeatureBody(FeatureBodyContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule dataDefStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterDataDefStatement(DataDefStatementContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule dataDefStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitDataDefStatement(DataDefStatementContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule ifFeatureStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterIfFeatureStatement(IfFeatureStatementContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule ifFeatureStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitIfFeatureStatement(IfFeatureStatementContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule unitsStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterUnitsStatement(UnitsStatementContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule unitsStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitUnitsStatement(UnitsStatementContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule typedefStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterTypedefStatement(TypedefStatementContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule typedefStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitTypedefStatement(TypedefStatementContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule typeStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterTypeStatement(TypeStatementContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule typeStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitTypeStatement(TypeStatementContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule typeBodyStatements.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterTypeBodyStatements(TypeBodyStatementsContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule typeBodyStatements.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitTypeBodyStatements(TypeBodyStatementsContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule numericalRestrictions.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterDecimal64Specification(Decimal64SpecificationContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule numericalRestrictions.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitDecimal64Specification(Decimal64SpecificationContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule numericalRestrictions.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterFractionDigitStatement(FractionDigitStatementContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule
+     * numericalRestrictions.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitFractionDigitStatement(FractionDigitStatementContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule
+     * numericalRestrictions.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterNumericalRestrictions(NumericalRestrictionsContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule numericalRestrictions.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitNumericalRestrictions(NumericalRestrictionsContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule rangeStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterRangeStatement(RangeStatementContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule rangeStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitRangeStatement(RangeStatementContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule commonStatements.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterCommonStatements(CommonStatementsContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule commonStatements.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitCommonStatements(CommonStatementsContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule stringRestrictions.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterStringRestrictions(StringRestrictionsContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule stringRestrictions.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitStringRestrictions(StringRestrictionsContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule lengthStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterLengthStatement(LengthStatementContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule lengthStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitLengthStatement(LengthStatementContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule patternStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterPatternStatement(PatternStatementContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule patternStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitPatternStatement(PatternStatementContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule defaultStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterDefaultStatement(DefaultStatementContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule defaultStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitDefaultStatement(DefaultStatementContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule enumSpecification.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterEnumSpecification(EnumSpecificationContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule enumSpecification.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitEnumSpecification(EnumSpecificationContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule enumStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterEnumStatement(EnumStatementContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule enumStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitEnumStatement(EnumStatementContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule enumStatementBody.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterEnumStatementBody(EnumStatementBodyContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule enumStatementBody.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitEnumStatementBody(EnumStatementBodyContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule leafrefSpecification.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterLeafrefSpecification(LeafrefSpecificationContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule leafrefSpecification.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitLeafrefSpecification(LeafrefSpecificationContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule pathStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterPathStatement(PathStatementContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule pathStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitPathStatement(PathStatementContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule requireInstanceStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterRequireInstanceStatement(RequireInstanceStatementContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule requireInstanceStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitRequireInstanceStatement(RequireInstanceStatementContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule instanceIdentifierSpecification.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterInstanceIdentifierSpecification(
+            InstanceIdentifierSpecificationContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule instanceIdentifierSpecification.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitInstanceIdentifierSpecification(InstanceIdentifierSpecificationContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule identityrefSpecification.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterIdentityrefSpecification(IdentityrefSpecificationContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule identityrefSpecification.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitIdentityrefSpecification(IdentityrefSpecificationContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule unionSpecification.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterUnionSpecification(UnionSpecificationContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule unionSpecification.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitUnionSpecification(UnionSpecificationContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule bitsSpecification.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterBitsSpecification(BitsSpecificationContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule bitsSpecification.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitBitsSpecification(BitsSpecificationContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule bitStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterBitStatement(BitStatementContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule bitStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitBitStatement(BitStatementContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule bitBodyStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterBitBodyStatement(BitBodyStatementContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule bitBodyStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitBitBodyStatement(BitBodyStatementContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule positionStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterPositionStatement(PositionStatementContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule positionStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitPositionStatement(PositionStatementContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule statusStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterStatusStatement(StatusStatementContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule statusStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitStatusStatement(StatusStatementContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule configStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterConfigStatement(ConfigStatementContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule configStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitConfigStatement(ConfigStatementContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule mandatoryStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterMandatoryStatement(MandatoryStatementContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule mandatoryStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitMandatoryStatement(MandatoryStatementContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule presenceStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterPresenceStatement(PresenceStatementContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule presenceStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitPresenceStatement(PresenceStatementContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule orderedByStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterOrderedByStatement(OrderedByStatementContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule orderedByStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitOrderedByStatement(OrderedByStatementContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule mustStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterMustStatement(MustStatementContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule mustStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitMustStatement(MustStatementContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule errorMessageStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterErrorMessageStatement(ErrorMessageStatementContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule errorMessageStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitErrorMessageStatement(ErrorMessageStatementContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule errorAppTagStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterErrorAppTagStatement(ErrorAppTagStatementContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule errorAppTagStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitErrorAppTagStatement(ErrorAppTagStatementContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule minElementsStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterMinElementsStatement(MinElementsStatementContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule minElementsStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitMinElementsStatement(MinElementsStatementContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule maxElementsStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterMaxElementsStatement(MaxElementsStatementContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule maxElementsStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitMaxElementsStatement(MaxElementsStatementContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule valueStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterValueStatement(ValueStatementContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule valueStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitValueStatement(ValueStatementContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule groupingStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterGroupingStatement(GroupingStatementContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule groupingStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitGroupingStatement(GroupingStatementContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule containerStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterContainerStatement(ContainerStatementContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule containerStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitContainerStatement(ContainerStatementContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule leafStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterLeafStatement(LeafStatementContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule leafStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitLeafStatement(LeafStatementContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule leafListStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterLeafListStatement(LeafListStatementContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule leafListStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitLeafListStatement(LeafListStatementContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule listStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterListStatement(ListStatementContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule listStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitListStatement(ListStatementContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule keyStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterKeyStatement(KeyStatementContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule keyStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitKeyStatement(KeyStatementContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule uniqueStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterUniqueStatement(UniqueStatementContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule uniqueStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitUniqueStatement(UniqueStatementContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule choiceStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterChoiceStatement(ChoiceStatementContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule choiceStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitChoiceStatement(ChoiceStatementContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule shortCaseStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterShortCaseStatement(ShortCaseStatementContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule shortCaseStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitShortCaseStatement(ShortCaseStatementContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule caseStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterCaseStatement(CaseStatementContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule caseStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitCaseStatement(CaseStatementContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule anyxmlStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterAnyxmlStatement(AnyxmlStatementContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule anyxmlStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitAnyxmlStatement(AnyxmlStatementContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule usesStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterUsesStatement(UsesStatementContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule usesStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitUsesStatement(UsesStatementContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule refineStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterRefineStatement(RefineStatementContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule refineStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitRefineStatement(RefineStatementContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule refineContainerStatements.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterRefineContainerStatements(RefineContainerStatementsContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule refineContainerStatements.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitRefineContainerStatements(RefineContainerStatementsContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule refineLeafStatements.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterRefineLeafStatements(RefineLeafStatementsContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule refineLeafStatements.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitRefineLeafStatements(RefineLeafStatementsContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule refineLeafListStatements.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterRefineLeafListStatements(RefineLeafListStatementsContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule refineLeafListStatements.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitRefineLeafListStatements(RefineLeafListStatementsContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule refineListStatements.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterRefineListStatements(RefineListStatementsContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule refineListStatements.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitRefineListStatements(RefineListStatementsContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule refineChoiceStatements.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterRefineChoiceStatements(RefineChoiceStatementsContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule refineChoiceStatements.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitRefineChoiceStatements(RefineChoiceStatementsContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule refineCaseStatements.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterRefineCaseStatements(RefineCaseStatementsContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule refineCaseStatements.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitRefineCaseStatements(RefineCaseStatementsContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule refineAnyxmlStatements.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterRefineAnyxmlStatements(RefineAnyxmlStatementsContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule refineAnyxmlStatements.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitRefineAnyxmlStatements(RefineAnyxmlStatementsContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule augmentStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterAugmentStatement(AugmentStatementContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule augmentStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitAugmentStatement(AugmentStatementContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule whenStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterWhenStatement(WhenStatementContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule whenStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitWhenStatement(WhenStatementContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule rpcStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterRpcStatement(RpcStatementContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule rpcStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitRpcStatement(RpcStatementContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule inputStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterInputStatement(InputStatementContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule inputStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitInputStatement(InputStatementContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule outputStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterOutputStatement(OutputStatementContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule outputStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitOutputStatement(OutputStatementContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule notificationStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterNotificationStatement(NotificationStatementContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule notificationStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitNotificationStatement(NotificationStatementContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule deviationStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterDeviationStatement(DeviationStatementContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule deviationStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitDeviationStatement(DeviationStatementContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule deviateNotSupportedStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterDeviateNotSupportedStatement(DeviateNotSupportedStatementContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule deviateNotSupportedStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitDeviateNotSupportedStatement(DeviateNotSupportedStatementContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule deviateAddStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterDeviateAddStatement(DeviateAddStatementContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule deviateAddStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitDeviateAddStatement(DeviateAddStatementContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule deviateDeleteStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterDeviateDeleteStatement(DeviateDeleteStatementContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule deviateDeleteStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitDeviateDeleteStatement(DeviateDeleteStatementContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule deviateReplaceStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterDeviateReplaceStatement(DeviateReplaceStatementContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule deviateReplaceStatement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitDeviateReplaceStatement(DeviateReplaceStatementContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule string.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterString(StringContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule string.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitString(StringContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule identifier.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterIdentifier(IdentifierContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule identifier.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitIdentifier(IdentifierContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule version.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterVersion(VersionContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule version.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitVersion(VersionContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule range.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterRange(RangeContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule range.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitRange(RangeContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule dateArgumentString.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterDateArgumentString(DateArgumentStringContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule dateArgumentString.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitDateArgumentString(DateArgumentStringContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule length.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterLength(LengthContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule length.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitLength(LengthContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule path.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterPath(PathContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule path.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitPath(PathContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule position.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterPosition(PositionContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule position.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitPosition(PositionContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule status.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterStatus(StatusContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule status.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitStatus(StatusContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule config.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterConfig(ConfigContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule config.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitConfig(ConfigContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule mandatory.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterMandatory(MandatoryContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule mandatory.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitMandatory(MandatoryContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule ordered-by.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterOrderedBy(OrderedByContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule ordered-by.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitOrderedBy(OrderedByContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule min elements value.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterMinValue(MinValueContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule min elements value.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitMinValue(MinValueContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule  max elements value.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterMaxValue(MaxValueContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule max elements value.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitMaxValue(MaxValueContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule key.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterKey(KeyContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule key.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitKey(KeyContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule unique.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterUnique(UniqueContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule unique.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitUnique(UniqueContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule refine.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterRefine(RefineContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule refine.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitRefine(RefineContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule augment.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterAugment(AugmentContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule augment.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitAugment(AugmentContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule augment.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterFraction(FractionContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule augment.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitFraction(FractionContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule deviation.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterDeviation(DeviationContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule deviation.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitDeviation(DeviationContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule deviation.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterValue(ValueContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule deviation.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitValue(ValueContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule yang construct.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterYangConstruct(YangConstructContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule yang construct.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitYangConstruct(YangConstructContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule compiler annotation statement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterCompilerAnnotationStatement(CompilerAnnotationStatementContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule compiler annotation statement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitCompilerAnnotationStatement(CompilerAnnotationStatementContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule compiler annotation body statement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterCompilerAnnotationBodyStatement(CompilerAnnotationBodyStatementContext
+                                                      currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule compiler annotation body statement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitCompilerAnnotationBodyStatement(CompilerAnnotationBodyStatementContext
+                                                     currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule app data structure statement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterAppDataStructureStatement(AppDataStructureStatementContext
+                                                currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule app data structure statement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitAppDataStructureStatement(AppDataStructureStatementContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule app data structure.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterAppDataStructure(AppDataStructureContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule app data strcuture.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitAppDataStructure(AppDataStructureContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule app extended statement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterAppExtendedStatement(AppExtendedStatementContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule app extended statement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitAppExtendedStatement(AppExtendedStatementContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule extended name.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterExtendedName(ExtendedNameContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule extended name.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitExtendedName(ExtendedNameContext currentContext);
+
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule
+     * data structure key statement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterDataStructureKeyStatement(DataStructureKeyStatementContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar rule
+     * data structure key statement.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitDataStructureKeyStatement(DataStructureKeyStatementContext currentContext);
+
+    /**
+     * Enters a parse tree produced by GeneratedYangParser for grammar rule require instance.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void enterRequireInstance(RequireInstanceContext currentContext);
+
+    /**
+     * Exits a parse tree produced by GeneratedYangParser for grammar require instance.
+     *
+     * @param currentContext current context in the parsed tree
+     */
+    void exitRequireInstance(RequireInstanceContext currentContext);
+}
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/antlrgencode/package-info.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/antlrgencode/package-info.java
new file mode 100644
index 0000000..a8abeab
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/antlrgencode/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.
+ */
+
+/**
+ * ANTLR interfaces to be implemented by listener.
+ */
+package org.onosproject.yang.compiler.parser.antlrgencode;
\ No newline at end of file
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/exceptions/ParserException.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/exceptions/ParserException.java
new file mode 100644
index 0000000..dd019c8
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/exceptions/ParserException.java
@@ -0,0 +1,117 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.exceptions;
+
+/**
+ * Represents base class for exceptions in parser operations.
+ */
+public class ParserException extends RuntimeException {
+
+    private static final long serialVersionUID = 20160211L;
+    private transient int lineNumber;
+    private transient int charPositionInLine;
+    private transient String fileName;
+
+    /**
+     * Creates a new parser exception.
+     */
+    public ParserException() {
+        super();
+    }
+
+    /**
+     * Creates a new parser exception with given message.
+     *
+     * @param message the detail of exception in string
+     */
+    public ParserException(String message) {
+        super(message);
+    }
+
+    /**
+     * Creates a new parser exception from given message and cause.
+     *
+     * @param message the detail of exception in string
+     * @param cause   underlying cause of the error
+     */
+    public ParserException(final String message, final Throwable cause) {
+        super(message, cause);
+    }
+
+    /**
+     * Creates a new parser exception from cause.
+     *
+     * @param cause underlying cause of the error
+     */
+    public ParserException(final Throwable cause) {
+        super(cause);
+    }
+
+    /**
+     * Returns line number of the exception.
+     *
+     * @return line number of the exception
+     */
+    public int getLineNumber() {
+        return this.lineNumber;
+    }
+
+    /**
+     * Returns YANG file name of the exception.
+     *
+     * @return YANG file name of the exception
+     */
+    public String getFileName() {
+        return this.fileName;
+    }
+
+    /**
+     * 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;
+    }
+
+    /**
+     * Sets file name in parser exception.
+     *
+     * @param fileName YANG file name
+     */
+    public void setFileName(String fileName) {
+        this.fileName = fileName;
+    }
+}
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/exceptions/package-info.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/exceptions/package-info.java
new file mode 100644
index 0000000..f9cb0e4
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/exceptions/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.
+ */
+
+/**
+ * Custom parser exceptions.
+ */
+package org.onosproject.yang.compiler.parser.exceptions;
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/TreeWalkListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/TreeWalkListener.java
new file mode 100644
index 0000000..42fe6ca
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/TreeWalkListener.java
@@ -0,0 +1,1845 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl;
+
+import org.antlr.v4.runtime.ParserRuleContext;
+import org.antlr.v4.runtime.tree.ErrorNode;
+import org.antlr.v4.runtime.tree.TerminalNode;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.datamodel.utils.YangConstructType;
+import org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangListener;
+import org.onosproject.yang.compiler.parser.impl.listeners.AppDataStructureListener;
+import org.onosproject.yang.compiler.parser.impl.listeners.AppExtendedNameListener;
+import org.onosproject.yang.compiler.parser.impl.listeners.ArgumentListener;
+import org.onosproject.yang.compiler.parser.impl.listeners.AugmentListener;
+import org.onosproject.yang.compiler.parser.impl.listeners.BaseFileListener;
+import org.onosproject.yang.compiler.parser.impl.listeners.BaseListener;
+import org.onosproject.yang.compiler.parser.impl.listeners.BelongsToListener;
+import org.onosproject.yang.compiler.parser.impl.listeners.BitListener;
+import org.onosproject.yang.compiler.parser.impl.listeners.BitsListener;
+import org.onosproject.yang.compiler.parser.impl.listeners.CaseListener;
+import org.onosproject.yang.compiler.parser.impl.listeners.ChoiceListener;
+import org.onosproject.yang.compiler.parser.impl.listeners.CompilerAnnotationListener;
+import org.onosproject.yang.compiler.parser.impl.listeners.ConfigListener;
+import org.onosproject.yang.compiler.parser.impl.listeners.ContactListener;
+import org.onosproject.yang.compiler.parser.impl.listeners.ContainerListener;
+import org.onosproject.yang.compiler.parser.impl.listeners.DataStructureKeyListener;
+import org.onosproject.yang.compiler.parser.impl.listeners.Decimal64Listener;
+import org.onosproject.yang.compiler.parser.impl.listeners.DefaultListener;
+import org.onosproject.yang.compiler.parser.impl.listeners.DescriptionListener;
+import org.onosproject.yang.compiler.parser.impl.listeners.EnumListener;
+import org.onosproject.yang.compiler.parser.impl.listeners.EnumerationListener;
+import org.onosproject.yang.compiler.parser.impl.listeners.ErrorAppTagListener;
+import org.onosproject.yang.compiler.parser.impl.listeners.ErrorMessageListener;
+import org.onosproject.yang.compiler.parser.impl.listeners.ExtensionListener;
+import org.onosproject.yang.compiler.parser.impl.listeners.FeatureListener;
+import org.onosproject.yang.compiler.parser.impl.listeners.FractionDigitsListener;
+import org.onosproject.yang.compiler.parser.impl.listeners.GroupingListener;
+import org.onosproject.yang.compiler.parser.impl.listeners.IdentityListener;
+import org.onosproject.yang.compiler.parser.impl.listeners.IdentityRefListener;
+import org.onosproject.yang.compiler.parser.impl.listeners.IfFeatureListener;
+import org.onosproject.yang.compiler.parser.impl.listeners.ImportListener;
+import org.onosproject.yang.compiler.parser.impl.listeners.IncludeListener;
+import org.onosproject.yang.compiler.parser.impl.listeners.InputListener;
+import org.onosproject.yang.compiler.parser.impl.listeners.KeyListener;
+import org.onosproject.yang.compiler.parser.impl.listeners.LeafListListener;
+import org.onosproject.yang.compiler.parser.impl.listeners.LeafListener;
+import org.onosproject.yang.compiler.parser.impl.listeners.LeafrefListener;
+import org.onosproject.yang.compiler.parser.impl.listeners.LengthRestrictionListener;
+import org.onosproject.yang.compiler.parser.impl.listeners.ListListener;
+import org.onosproject.yang.compiler.parser.impl.listeners.MandatoryListener;
+import org.onosproject.yang.compiler.parser.impl.listeners.MaxElementsListener;
+import org.onosproject.yang.compiler.parser.impl.listeners.MinElementsListener;
+import org.onosproject.yang.compiler.parser.impl.listeners.ModuleListener;
+import org.onosproject.yang.compiler.parser.impl.listeners.MustListener;
+import org.onosproject.yang.compiler.parser.impl.listeners.NamespaceListener;
+import org.onosproject.yang.compiler.parser.impl.listeners.NotificationListener;
+import org.onosproject.yang.compiler.parser.impl.listeners.OrganizationListener;
+import org.onosproject.yang.compiler.parser.impl.listeners.OutputListener;
+import org.onosproject.yang.compiler.parser.impl.listeners.PathListener;
+import org.onosproject.yang.compiler.parser.impl.listeners.PatternRestrictionListener;
+import org.onosproject.yang.compiler.parser.impl.listeners.PositionListener;
+import org.onosproject.yang.compiler.parser.impl.listeners.PrefixListener;
+import org.onosproject.yang.compiler.parser.impl.listeners.PresenceListener;
+import org.onosproject.yang.compiler.parser.impl.listeners.RangeRestrictionListener;
+import org.onosproject.yang.compiler.parser.impl.listeners.ReferenceListener;
+import org.onosproject.yang.compiler.parser.impl.listeners.RequireInstanceListener;
+import org.onosproject.yang.compiler.parser.impl.listeners.RevisionDateListener;
+import org.onosproject.yang.compiler.parser.impl.listeners.RevisionListener;
+import org.onosproject.yang.compiler.parser.impl.listeners.RpcListener;
+import org.onosproject.yang.compiler.parser.impl.listeners.ShortCaseListener;
+import org.onosproject.yang.compiler.parser.impl.listeners.StatusListener;
+import org.onosproject.yang.compiler.parser.impl.listeners.SubModuleListener;
+import org.onosproject.yang.compiler.parser.impl.listeners.TypeDefListener;
+import org.onosproject.yang.compiler.parser.impl.listeners.TypeListener;
+import org.onosproject.yang.compiler.parser.impl.listeners.UnionListener;
+import org.onosproject.yang.compiler.parser.impl.listeners.UniqueListener;
+import org.onosproject.yang.compiler.parser.impl.listeners.UnitsListener;
+import org.onosproject.yang.compiler.parser.impl.listeners.UsesListener;
+import org.onosproject.yang.compiler.parser.impl.listeners.ValueListener;
+import org.onosproject.yang.compiler.parser.impl.listeners.VersionListener;
+import org.onosproject.yang.compiler.parser.impl.listeners.WhenListener;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil;
+import org.onosproject.yang.compiler.utils.UtilConstants;
+
+import java.util.Stack;
+
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.AnyxmlStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.AppDataStructureContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.AppDataStructureStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.AppExtendedStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.ArgumentBodyContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.ArgumentStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.AugmentContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.AugmentStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.BaseStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.BelongstoStatementBodyContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.BelongstoStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.BitBodyStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.BitStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.BitsSpecificationContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.BodyStatementsContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.CaseStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.ChoiceStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.CommonStatementsContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.CompilerAnnotationBodyStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.CompilerAnnotationStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.ConfigContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.ConfigStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.ContactStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.ContainerStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.DataDefStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.DataStructureKeyStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.DateArgumentStringContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.Decimal64SpecificationContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.DefaultStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.DescriptionStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.DeviateAddStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.DeviateDeleteStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.DeviateNotSupportedStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.DeviateReplaceStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.DeviationContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.DeviationStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.EnumSpecificationContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.EnumStatementBodyContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.EnumStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.ErrorAppTagStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.ErrorMessageStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.ExtendedNameContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.ExtensionBodyContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.ExtensionStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.FeatureBodyContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.FeatureStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.FractionContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.FractionDigitStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.GroupingStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.IdentifierContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.IdentityBodyContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.IdentityStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.IdentityrefSpecificationContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.IfFeatureStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.ImportStatementBodyContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.ImportStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.IncludeStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.InputStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.InstanceIdentifierSpecificationContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.KeyContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.KeyStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.LeafListStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.LeafStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.LeafrefSpecificationContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.LengthContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.LengthStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.LinkageStatementsContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.ListStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.MandatoryContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.MandatoryStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.MaxElementsStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.MaxValueContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.MetaStatementsContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.MinElementsStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.MinValueContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.ModuleBodyContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.ModuleHeaderStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.ModuleStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.MustStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.NamespaceStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.NotificationStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.NumericalRestrictionsContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.OrderedByContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.OrderedByStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.OrganizationStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.OutputStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.PathContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.PathStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.PatternStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.PositionContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.PositionStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.PrefixStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.PresenceStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.RangeContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.RangeStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.ReferenceStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.RefineAnyxmlStatementsContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.RefineCaseStatementsContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.RefineChoiceStatementsContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.RefineContainerStatementsContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.RefineContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.RefineLeafListStatementsContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.RefineLeafStatementsContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.RefineListStatementsContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.RefineStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.RequireInstanceContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.RequireInstanceStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.RevisionDateStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.RevisionStatementBodyContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.RevisionStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.RevisionStatementsContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.RpcStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.ShortCaseStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.StatusContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.StatusStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.StringContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.StringRestrictionsContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.SubModuleStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.SubmoduleBodyContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.SubmoduleHeaderStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.TypeBodyStatementsContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.TypeStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.TypedefStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.UnionSpecificationContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.UniqueContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.UniqueStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.UnitsStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.UsesStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.ValueContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.ValueStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.VersionContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.WhenStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.YangConstructContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.YangVersionStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.YangfileContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.YinElementStatementContext;
+
+/**
+ * Represents ANTLR generates parse-tree. ANTLR generates a parse-tree listener interface that responds to events
+ * triggered by the built-in tree walker. The methods in listener are just
+ * callbacks. This class implements listener interface and generates the
+ * corresponding data model tree.
+ */
+public class TreeWalkListener implements GeneratedYangListener {
+
+    // List of parsable node entries maintained in stack
+    private Stack<Parsable> parsedDataStack = new Stack<>();
+
+    // Parse tree root node
+    private YangNode rootNode;
+
+    // YANG file name.
+    private String fileName;
+
+    /**
+     * Parent depth of grouping count for any node.
+     */
+    private int groupingDepth;
+
+    /**
+     * Parent depth of unsupported yang construct count for any node.
+     */
+    private int unsupportedYangConstructDepth;
+
+    /**
+     * Returns number of unsupported yang constructs parents, by a node, at any level.
+     *
+     * @return depth of unsupported yang constructs
+     */
+    public int getUnsupportedYangConstructDepth() {
+        return unsupportedYangConstructDepth;
+    }
+
+    /**
+     * Sets number of unsupported yang constructs by a node at any level.
+     */
+    private void increaseUnsupportedYangConstructDepth() {
+        unsupportedYangConstructDepth++;
+    }
+
+    /**
+     * Sets number of unsupported yang constructs by a node at any level.
+     */
+    private void decreaseUnsupportedYangConstructDepth() {
+        unsupportedYangConstructDepth--;
+    }
+
+    /**
+     * Returns number of grouping parents, by a node, at any level.
+     *
+     * @return depth of grouping
+     */
+    public int getGroupingDepth() {
+        return groupingDepth;
+    }
+
+    /**
+     * Sets number of grouping parents by a node at any level.
+     */
+    public void increaseGroupingDepth() {
+        groupingDepth++;
+    }
+
+    /**
+     * Sets number of grouping parents by a node at any level.
+     */
+    public void decreaseGroupingDepth() {
+        groupingDepth--;
+    }
+
+    /**
+     * Returns stack of parsable data.
+     *
+     * @return stack of parsable data
+     */
+    public Stack<Parsable> getParsedDataStack() {
+        return parsedDataStack;
+    }
+
+    /**
+     * Set parsed data stack.
+     *
+     * @param parsedDataStack stack of parsable data objects
+     */
+    public void setParsedDataStack(Stack<Parsable> parsedDataStack) {
+        this.parsedDataStack = parsedDataStack;
+    }
+
+    /**
+     * Returns root node.
+     *
+     * @return rootNode of data model tree
+     */
+    public YangNode getRootNode() {
+        return rootNode;
+    }
+
+    /**
+     * Set root node.
+     *
+     * @param rootNode root node of data model tree
+     */
+    public void setRootNode(YangNode rootNode) {
+        this.rootNode = rootNode;
+    }
+
+    /**
+     * Returns YANG file name.
+     *
+     * @return YANG file name
+     */
+    public String getFileName() {
+        return fileName;
+    }
+
+    /**
+     * Sets YANG file name.
+     *
+     * @param fileName YANG file name
+     */
+    public void setFileName(String fileName) {
+        this.fileName = fileName;
+    }
+
+    @Override
+    public void enterYangfile(YangfileContext ctx) {
+        BaseFileListener.processYangFileEntry(this, ctx);
+    }
+
+    @Override
+    public void exitYangfile(YangfileContext ctx) {
+        BaseFileListener.processYangFileExit(this, ctx);
+    }
+
+    @Override
+    public void enterModuleStatement(ModuleStatementContext ctx) {
+        ModuleListener.processModuleEntry(this, ctx);
+    }
+
+    @Override
+    public void exitModuleStatement(ModuleStatementContext ctx) {
+        ModuleListener.processModuleExit(this, ctx);
+    }
+
+    @Override
+    public void enterModuleBody(ModuleBodyContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void exitModuleBody(ModuleBodyContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void enterModuleHeaderStatement(ModuleHeaderStatementContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void exitModuleHeaderStatement(ModuleHeaderStatementContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void enterLinkageStatements(LinkageStatementsContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void exitLinkageStatements(LinkageStatementsContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void enterMetaStatements(MetaStatementsContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void exitMetaStatements(MetaStatementsContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void enterRevisionStatements(RevisionStatementsContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void exitRevisionStatements(RevisionStatementsContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void enterBodyStatements(BodyStatementsContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void exitBodyStatements(BodyStatementsContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void enterYangVersionStatement(YangVersionStatementContext ctx) {
+        VersionListener.processVersionEntry(this, ctx);
+    }
+
+    @Override
+    public void exitYangVersionStatement(YangVersionStatementContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void enterNamespaceStatement(NamespaceStatementContext ctx) {
+        NamespaceListener.processNamespaceEntry(this, ctx);
+    }
+
+    @Override
+    public void exitNamespaceStatement(NamespaceStatementContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void enterPrefixStatement(PrefixStatementContext ctx) {
+        PrefixListener.processPrefixEntry(this, ctx);
+    }
+
+    @Override
+    public void exitPrefixStatement(PrefixStatementContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void enterImportStatement(ImportStatementContext ctx) {
+        ImportListener.processImportEntry(this, ctx);
+    }
+
+    @Override
+    public void exitImportStatement(ImportStatementContext ctx) {
+        ImportListener.processImportExit(this, ctx);
+    }
+
+    @Override
+    public void enterImportStatementBody(ImportStatementBodyContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void exitImportStatementBody(ImportStatementBodyContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void enterRevisionDateStatement(RevisionDateStatementContext ctx) {
+        RevisionDateListener.processRevisionDateEntry(this, ctx);
+    }
+
+    @Override
+    public void exitRevisionDateStatement(RevisionDateStatementContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void enterIncludeStatement(IncludeStatementContext ctx) {
+        IncludeListener.processIncludeEntry(this, ctx);
+    }
+
+    @Override
+    public void exitIncludeStatement(IncludeStatementContext ctx) {
+        IncludeListener.processIncludeExit(this, ctx);
+    }
+
+    @Override
+    public void enterOrganizationStatement(OrganizationStatementContext ctx) {
+        OrganizationListener.processOrganizationEntry(this, ctx);
+    }
+
+    @Override
+    public void exitOrganizationStatement(OrganizationStatementContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void enterContactStatement(ContactStatementContext ctx) {
+        ContactListener.processContactEntry(this, ctx);
+    }
+
+    @Override
+    public void exitContactStatement(ContactStatementContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void enterDescriptionStatement(DescriptionStatementContext ctx) {
+        if (getUnsupportedYangConstructDepth() == 0) {
+            DescriptionListener.processDescriptionEntry(this, ctx);
+        }
+    }
+
+    @Override
+    public void exitDescriptionStatement(DescriptionStatementContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void enterReferenceStatement(ReferenceStatementContext ctx) {
+        if (getUnsupportedYangConstructDepth() == 0) {
+            ReferenceListener.processReferenceEntry(this, ctx);
+        }
+    }
+
+    @Override
+    public void exitReferenceStatement(ReferenceStatementContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void enterRevisionStatement(RevisionStatementContext ctx) {
+        RevisionListener.processRevisionEntry(this, ctx);
+    }
+
+    @Override
+    public void exitRevisionStatement(RevisionStatementContext ctx) {
+        RevisionListener.processRevisionExit(this, ctx);
+    }
+
+    @Override
+    public void enterRevisionStatementBody(RevisionStatementBodyContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void exitRevisionStatementBody(RevisionStatementBodyContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void enterSubModuleStatement(SubModuleStatementContext ctx) {
+        SubModuleListener.processSubModuleEntry(this, ctx);
+    }
+
+    @Override
+    public void exitSubModuleStatement(SubModuleStatementContext ctx) {
+        SubModuleListener.processSubModuleExit(this, ctx);
+    }
+
+    @Override
+    public void enterSubmoduleBody(SubmoduleBodyContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void exitSubmoduleBody(SubmoduleBodyContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void enterSubmoduleHeaderStatement(SubmoduleHeaderStatementContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void exitSubmoduleHeaderStatement(SubmoduleHeaderStatementContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void enterBelongstoStatement(BelongstoStatementContext ctx) {
+        BelongsToListener.processBelongsToEntry(this, ctx);
+    }
+
+    @Override
+    public void exitBelongstoStatement(BelongstoStatementContext ctx) {
+        BelongsToListener.processBelongsToExit(this, ctx);
+    }
+
+    @Override
+    public void enterBelongstoStatementBody(BelongstoStatementBodyContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void exitBelongstoStatementBody(BelongstoStatementBodyContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void enterExtensionStatement(ExtensionStatementContext ctx) {
+        ExtensionListener.processExtensionEntry(this, ctx);
+    }
+
+    @Override
+    public void exitExtensionStatement(ExtensionStatementContext ctx) {
+        ExtensionListener.processExtensionExit(this, ctx);
+    }
+
+    @Override
+    public void enterExtensionBody(ExtensionBodyContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void exitExtensionBody(ExtensionBodyContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void enterArgumentStatement(ArgumentStatementContext ctx) {
+        ArgumentListener.processArgumentEntry(this, ctx);
+    }
+
+    @Override
+    public void exitArgumentStatement(ArgumentStatementContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void enterArgumentBody(ArgumentBodyContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void exitArgumentBody(ArgumentBodyContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void enterYinElementStatement(YinElementStatementContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void exitYinElementStatement(YinElementStatementContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void enterIdentityStatement(IdentityStatementContext ctx) {
+        IdentityListener.processIdentityEntry(this, ctx);
+    }
+
+    @Override
+    public void exitIdentityStatement(IdentityStatementContext ctx) {
+        IdentityListener.processIdentityExit(this, ctx);
+    }
+
+    @Override
+    public void enterIdentityBody(IdentityBodyContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void exitIdentityBody(IdentityBodyContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void enterBaseStatement(BaseStatementContext ctx) {
+        if (getUnsupportedYangConstructDepth() == 0) {
+            BaseListener.processBaseEntry(this, ctx);
+        }
+    }
+
+    @Override
+    public void exitBaseStatement(BaseStatementContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void enterFeatureStatement(FeatureStatementContext ctx) {
+        FeatureListener.processFeatureEntry(this, ctx);
+    }
+
+    @Override
+    public void exitFeatureStatement(FeatureStatementContext ctx) {
+        FeatureListener.processFeatureExit(this, ctx);
+    }
+
+    @Override
+    public void enterFeatureBody(FeatureBodyContext ctx) {
+        // do nothing
+    }
+
+    @Override
+    public void exitFeatureBody(FeatureBodyContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void enterDataDefStatement(DataDefStatementContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void exitDataDefStatement(DataDefStatementContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void enterIfFeatureStatement(IfFeatureStatementContext ctx) {
+        if (getUnsupportedYangConstructDepth() == 0) {
+            IfFeatureListener.processIfFeatureEntry(this, ctx);
+        }
+    }
+
+    @Override
+    public void exitIfFeatureStatement(IfFeatureStatementContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void enterUnitsStatement(UnitsStatementContext ctx) {
+        if (getUnsupportedYangConstructDepth() == 0) {
+            UnitsListener.processUnitsEntry(this, ctx);
+        }
+    }
+
+    @Override
+    public void exitUnitsStatement(UnitsStatementContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void enterTypedefStatement(TypedefStatementContext ctx) {
+        TypeDefListener.processTypeDefEntry(this, ctx);
+    }
+
+    @Override
+    public void exitTypedefStatement(TypedefStatementContext ctx) {
+        TypeDefListener.processTypeDefExit(this, ctx);
+    }
+
+    @Override
+    public void enterTypeStatement(TypeStatementContext ctx) {
+        if (getUnsupportedYangConstructDepth() == 0) {
+            TypeListener.processTypeEntry(this, ctx);
+        }
+    }
+
+    @Override
+    public void exitTypeStatement(TypeStatementContext ctx) {
+        if (getUnsupportedYangConstructDepth() == 0) {
+            TypeListener.processTypeExit(this, ctx);
+        }
+    }
+
+    @Override
+    public void enterTypeBodyStatements(TypeBodyStatementsContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void exitTypeBodyStatements(TypeBodyStatementsContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void enterDecimal64Specification(Decimal64SpecificationContext ctx) {
+        if (getUnsupportedYangConstructDepth() == 0) {
+            Decimal64Listener.processDecimal64Entry(this, ctx);
+        }
+    }
+
+    @Override
+    public void exitDecimal64Specification(Decimal64SpecificationContext ctx) {
+        if (getUnsupportedYangConstructDepth() == 0) {
+            Decimal64Listener.processDecimal64Exit(this, ctx);
+        }
+    }
+
+    @Override
+    public void enterFractionDigitStatement(FractionDigitStatementContext ctx) {
+        if (getUnsupportedYangConstructDepth() == 0) {
+            FractionDigitsListener.processFractionDigitsEntry(this, ctx);
+        }
+    }
+
+    @Override
+    public void exitFractionDigitStatement(FractionDigitStatementContext currentContext) {
+        // do nothing
+    }
+
+    @Override
+    public void enterNumericalRestrictions(NumericalRestrictionsContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void exitNumericalRestrictions(NumericalRestrictionsContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void enterRangeStatement(RangeStatementContext ctx) {
+        if (getUnsupportedYangConstructDepth() == 0) {
+            RangeRestrictionListener.processRangeRestrictionEntry(this, ctx);
+        }
+    }
+
+    @Override
+    public void exitRangeStatement(RangeStatementContext ctx) {
+        if (getUnsupportedYangConstructDepth() == 0) {
+            RangeRestrictionListener.processRangeRestrictionExit(this, ctx);
+        }
+    }
+
+    @Override
+    public void enterCommonStatements(CommonStatementsContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void exitCommonStatements(CommonStatementsContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void enterStringRestrictions(StringRestrictionsContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void exitStringRestrictions(StringRestrictionsContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void enterLengthStatement(LengthStatementContext ctx) {
+        if (getUnsupportedYangConstructDepth() == 0) {
+            LengthRestrictionListener.processLengthRestrictionEntry(this, ctx);
+        }
+    }
+
+    @Override
+    public void exitLengthStatement(LengthStatementContext ctx) {
+        if (getUnsupportedYangConstructDepth() == 0) {
+            LengthRestrictionListener.processLengthRestrictionExit(this, ctx);
+        }
+    }
+
+    @Override
+    public void enterPatternStatement(PatternStatementContext ctx) {
+        if (getUnsupportedYangConstructDepth() == 0) {
+            PatternRestrictionListener.processPatternRestrictionEntry(this, ctx);
+        }
+    }
+
+    @Override
+    public void exitPatternStatement(PatternStatementContext ctx) {
+        if (getUnsupportedYangConstructDepth() == 0) {
+            PatternRestrictionListener.processPatternRestrictionExit(this, ctx);
+        }
+    }
+
+    @Override
+    public void enterDefaultStatement(DefaultStatementContext ctx) {
+        if (getUnsupportedYangConstructDepth() == 0) {
+            DefaultListener.processDefaultEntry(this, ctx);
+        }
+    }
+
+    @Override
+    public void exitDefaultStatement(DefaultStatementContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void enterEnumSpecification(EnumSpecificationContext ctx) {
+        if (getUnsupportedYangConstructDepth() == 0) {
+            EnumerationListener.processEnumerationEntry(this, ctx);
+        }
+    }
+
+    @Override
+    public void exitEnumSpecification(EnumSpecificationContext ctx) {
+        if (getUnsupportedYangConstructDepth() == 0) {
+            EnumerationListener.processEnumerationExit(this, ctx);
+        }
+    }
+
+    @Override
+    public void enterEnumStatement(EnumStatementContext ctx) {
+        if (getUnsupportedYangConstructDepth() == 0) {
+            EnumListener.processEnumEntry(this, ctx);
+        }
+    }
+
+    @Override
+    public void exitEnumStatement(EnumStatementContext ctx) {
+        if (getUnsupportedYangConstructDepth() == 0) {
+            EnumListener.processEnumExit(this, ctx);
+        }
+    }
+
+    @Override
+    public void enterEnumStatementBody(EnumStatementBodyContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void exitEnumStatementBody(EnumStatementBodyContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void enterLeafrefSpecification(LeafrefSpecificationContext ctx) {
+        if (getUnsupportedYangConstructDepth() == 0) {
+            LeafrefListener.processLeafrefEntry(this, ctx);
+        }
+    }
+
+    @Override
+    public void exitLeafrefSpecification(LeafrefSpecificationContext ctx) {
+        if (getUnsupportedYangConstructDepth() == 0) {
+            LeafrefListener.processLeafrefExit(this, ctx);
+        }
+    }
+
+    @Override
+    public void enterPathStatement(PathStatementContext ctx) {
+        if (getUnsupportedYangConstructDepth() == 0) {
+            PathListener.processPathEntry(this, ctx);
+        }
+    }
+
+    @Override
+    public void exitPathStatement(PathStatementContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void enterRequireInstanceStatement(RequireInstanceStatementContext ctx) {
+        if (getUnsupportedYangConstructDepth() == 0) {
+            RequireInstanceListener.processRequireInstanceEntry(this, ctx);
+        }
+    }
+
+    @Override
+    public void exitRequireInstanceStatement(RequireInstanceStatementContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void enterInstanceIdentifierSpecification(InstanceIdentifierSpecificationContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void exitInstanceIdentifierSpecification(InstanceIdentifierSpecificationContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void enterIdentityrefSpecification(IdentityrefSpecificationContext ctx) {
+        if (getUnsupportedYangConstructDepth() == 0) {
+            IdentityRefListener.processIdentityRefEntry(this, ctx);
+        }
+    }
+
+    @Override
+    public void exitIdentityrefSpecification(IdentityrefSpecificationContext ctx) {
+        if (getUnsupportedYangConstructDepth() == 0) {
+            IdentityRefListener.processIdentityRefExit(this, ctx);
+        }
+    }
+
+    @Override
+    public void enterUnionSpecification(UnionSpecificationContext ctx) {
+        if (getUnsupportedYangConstructDepth() == 0) {
+            UnionListener.processUnionEntry(this, ctx);
+        }
+    }
+
+    @Override
+    public void exitUnionSpecification(UnionSpecificationContext ctx) {
+        if (getUnsupportedYangConstructDepth() == 0) {
+            UnionListener.processUnionExit(this, ctx);
+        }
+    }
+
+    @Override
+    public void enterBitsSpecification(BitsSpecificationContext ctx) {
+        if (getUnsupportedYangConstructDepth() == 0) {
+            BitsListener.processBitsEntry(this, ctx);
+        }
+    }
+
+    @Override
+    public void exitBitsSpecification(BitsSpecificationContext ctx) {
+        if (getUnsupportedYangConstructDepth() == 0) {
+            BitsListener.processBitsExit(this, ctx);
+        }
+    }
+
+    @Override
+    public void enterBitStatement(BitStatementContext ctx) {
+        if (getUnsupportedYangConstructDepth() == 0) {
+            BitListener.processBitEntry(this, ctx);
+        }
+    }
+
+    @Override
+    public void exitBitStatement(BitStatementContext ctx) {
+        if (getUnsupportedYangConstructDepth() == 0) {
+            BitListener.processBitExit(this, ctx);
+        }
+    }
+
+    @Override
+    public void enterBitBodyStatement(BitBodyStatementContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void exitBitBodyStatement(BitBodyStatementContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void enterPositionStatement(PositionStatementContext ctx) {
+        if (getUnsupportedYangConstructDepth() == 0) {
+            PositionListener.processPositionEntry(this, ctx);
+        }
+    }
+
+    @Override
+    public void exitPositionStatement(PositionStatementContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void enterStatusStatement(StatusStatementContext ctx) {
+        if (getUnsupportedYangConstructDepth() == 0) {
+            StatusListener.processStatusEntry(this, ctx);
+        }
+    }
+
+    @Override
+    public void exitStatusStatement(StatusStatementContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void enterConfigStatement(ConfigStatementContext ctx) {
+        if (getUnsupportedYangConstructDepth() == 0) {
+            ConfigListener.processConfigEntry(this, ctx);
+        }
+    }
+
+    @Override
+    public void exitConfigStatement(ConfigStatementContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void enterMandatoryStatement(MandatoryStatementContext ctx) {
+        if (getUnsupportedYangConstructDepth() == 0) {
+            MandatoryListener.processMandatoryEntry(this, ctx);
+        }
+    }
+
+    @Override
+    public void exitMandatoryStatement(MandatoryStatementContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void enterPresenceStatement(PresenceStatementContext ctx) {
+        if (getUnsupportedYangConstructDepth() == 0) {
+            PresenceListener.processPresenceEntry(this, ctx);
+        }
+    }
+
+    @Override
+    public void exitPresenceStatement(PresenceStatementContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void enterOrderedByStatement(OrderedByStatementContext ctx) {
+        ListenerUtil.handleUnsupportedYangConstruct(YangConstructType.ORDERED_BY_DATA, ctx, UtilConstants.CURRENTLY_UNSUPPORTED, getFileName());
+    }
+
+    @Override
+    public void exitOrderedByStatement(OrderedByStatementContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void enterMustStatement(MustStatementContext ctx) {
+        if (getUnsupportedYangConstructDepth() == 0) {
+            MustListener.processMustEntry(this, ctx);
+        }
+    }
+
+    @Override
+    public void exitMustStatement(MustStatementContext ctx) {
+        if (getUnsupportedYangConstructDepth() == 0) {
+            MustListener.processMustExit(this, ctx);
+        }
+    }
+
+    @Override
+    public void enterErrorMessageStatement(ErrorMessageStatementContext ctx) {
+        if (getUnsupportedYangConstructDepth() == 0) {
+            ErrorMessageListener.processErrorMessageEntry(this, ctx);
+        }
+    }
+
+    @Override
+    public void exitErrorMessageStatement(ErrorMessageStatementContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void enterErrorAppTagStatement(ErrorAppTagStatementContext ctx) {
+        if (getUnsupportedYangConstructDepth() == 0) {
+            ErrorAppTagListener.processErrorAppTagMessageEntry(this, ctx);
+        }
+    }
+
+    @Override
+    public void exitErrorAppTagStatement(ErrorAppTagStatementContext ctx) {
+        //do nothing
+    }
+
+    @Override
+    public void enterMinElementsStatement(MinElementsStatementContext ctx) {
+        if (getUnsupportedYangConstructDepth() == 0) {
+            MinElementsListener.processMinElementsEntry(this, ctx);
+        }
+    }
+
+    @Override
+    public void exitMinElementsStatement(MinElementsStatementContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void enterMaxElementsStatement(MaxElementsStatementContext ctx) {
+        if (getUnsupportedYangConstructDepth() == 0) {
+            MaxElementsListener.processMaxElementsEntry(this, ctx);
+        }
+    }
+
+    @Override
+    public void exitMaxElementsStatement(MaxElementsStatementContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void enterValueStatement(ValueStatementContext ctx) {
+        if (getUnsupportedYangConstructDepth() == 0) {
+            ValueListener.processValueEntry(this, ctx);
+        }
+    }
+
+    @Override
+    public void exitValueStatement(ValueStatementContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void enterGroupingStatement(GroupingStatementContext ctx) {
+        GroupingListener.processGroupingEntry(this, ctx);
+    }
+
+    @Override
+    public void exitGroupingStatement(GroupingStatementContext ctx) {
+        GroupingListener.processGroupingExit(this, ctx);
+    }
+
+    @Override
+    public void enterContainerStatement(ContainerStatementContext ctx) {
+        ContainerListener.processContainerEntry(this, ctx);
+    }
+
+    @Override
+    public void exitContainerStatement(ContainerStatementContext ctx) {
+        ContainerListener.processContainerExit(this, ctx);
+    }
+
+    @Override
+    public void enterLeafStatement(LeafStatementContext ctx) {
+        LeafListener.processLeafEntry(this, ctx);
+    }
+
+    @Override
+    public void exitLeafStatement(LeafStatementContext ctx) {
+        LeafListener.processLeafExit(this, ctx);
+    }
+
+    @Override
+    public void enterLeafListStatement(LeafListStatementContext ctx) {
+        LeafListListener.processLeafListEntry(this, ctx);
+    }
+
+    @Override
+    public void exitLeafListStatement(LeafListStatementContext ctx) {
+        LeafListListener.processLeafListExit(this, ctx);
+    }
+
+    @Override
+    public void enterListStatement(ListStatementContext ctx) {
+        ListListener.processListEntry(this, ctx);
+    }
+
+    @Override
+    public void exitListStatement(ListStatementContext ctx) {
+        ListListener.processListExit(this, ctx);
+    }
+
+    @Override
+    public void enterKeyStatement(KeyStatementContext ctx) {
+        KeyListener.processKeyEntry(this, ctx);
+    }
+
+    @Override
+    public void exitKeyStatement(KeyStatementContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void enterUniqueStatement(UniqueStatementContext ctx) {
+        if (getUnsupportedYangConstructDepth() == 0) {
+            UniqueListener.processUniqueEntry(this, ctx);
+        }
+    }
+
+    @Override
+    public void exitUniqueStatement(UniqueStatementContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void enterChoiceStatement(ChoiceStatementContext ctx) {
+        ChoiceListener.processChoiceEntry(this, ctx);
+    }
+
+    @Override
+    public void exitChoiceStatement(ChoiceStatementContext ctx) {
+        ChoiceListener.processChoiceExit(this, ctx);
+    }
+
+    @Override
+    public void enterShortCaseStatement(ShortCaseStatementContext ctx) {
+        ShortCaseListener.processShortCaseEntry(this, ctx);
+    }
+
+    @Override
+    public void exitShortCaseStatement(ShortCaseStatementContext ctx) {
+        ShortCaseListener.processShortCaseExit(this, ctx);
+    }
+
+    @Override
+    public void enterCaseStatement(CaseStatementContext ctx) {
+        CaseListener.processCaseEntry(this, ctx);
+    }
+
+    @Override
+    public void exitCaseStatement(CaseStatementContext ctx) {
+        CaseListener.processCaseExit(this, ctx);
+    }
+
+    @Override
+    public void enterAnyxmlStatement(AnyxmlStatementContext ctx) {
+        increaseUnsupportedYangConstructDepth();
+        ListenerUtil.handleUnsupportedYangConstruct(YangConstructType.ANYXML_DATA, ctx, UtilConstants.UNSUPPORTED_YANG_CONSTRUCT, getFileName());
+    }
+
+    @Override
+    public void exitAnyxmlStatement(AnyxmlStatementContext ctx) {
+        decreaseUnsupportedYangConstructDepth();
+    }
+
+    @Override
+    public void enterUsesStatement(UsesStatementContext ctx) {
+        UsesListener.processUsesEntry(this, ctx);
+    }
+
+    @Override
+    public void exitUsesStatement(UsesStatementContext ctx) {
+        UsesListener.processUsesExit(this, ctx);
+    }
+
+    @Override
+    public void enterRefineStatement(RefineStatementContext ctx) {
+        increaseUnsupportedYangConstructDepth();
+        ListenerUtil.handleUnsupportedYangConstruct(YangConstructType.REFINE_DATA, ctx, UtilConstants.UNSUPPORTED_YANG_CONSTRUCT, getFileName());
+    }
+
+    @Override
+    public void exitRefineStatement(RefineStatementContext ctx) {
+        decreaseUnsupportedYangConstructDepth();
+    }
+
+    @Override
+    public void enterRefineContainerStatements(RefineContainerStatementsContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void exitRefineContainerStatements(RefineContainerStatementsContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void enterRefineLeafStatements(RefineLeafStatementsContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void exitRefineLeafStatements(RefineLeafStatementsContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void enterRefineLeafListStatements(RefineLeafListStatementsContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void exitRefineLeafListStatements(RefineLeafListStatementsContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void enterRefineListStatements(RefineListStatementsContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void exitRefineListStatements(RefineListStatementsContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void enterRefineChoiceStatements(RefineChoiceStatementsContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void exitRefineChoiceStatements(RefineChoiceStatementsContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void enterRefineCaseStatements(RefineCaseStatementsContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void exitRefineCaseStatements(RefineCaseStatementsContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void enterRefineAnyxmlStatements(RefineAnyxmlStatementsContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void exitRefineAnyxmlStatements(RefineAnyxmlStatementsContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void enterAugmentStatement(AugmentStatementContext ctx) {
+        AugmentListener.processAugmentEntry(this, ctx);
+    }
+
+    @Override
+    public void exitAugmentStatement(AugmentStatementContext ctx) {
+        AugmentListener.processAugmentExit(this, ctx);
+    }
+
+    @Override
+    public void enterWhenStatement(WhenStatementContext ctx) {
+        if (getUnsupportedYangConstructDepth() == 0) {
+            WhenListener.processWhenEntry(this, ctx);
+        }
+    }
+
+    @Override
+    public void exitWhenStatement(WhenStatementContext ctx) {
+        if (getUnsupportedYangConstructDepth() == 0) {
+            WhenListener.processWhenExit(this, ctx);
+        }
+    }
+
+    @Override
+    public void enterRpcStatement(RpcStatementContext ctx) {
+        RpcListener.processRpcEntry(this, ctx);
+    }
+
+    @Override
+    public void exitRpcStatement(RpcStatementContext ctx) {
+        RpcListener.processRpcExit(this, ctx);
+    }
+
+    @Override
+    public void enterInputStatement(InputStatementContext ctx) {
+        InputListener.processInputEntry(this, ctx);
+    }
+
+    @Override
+    public void exitInputStatement(InputStatementContext ctx) {
+        InputListener.processInputExit(this, ctx);
+    }
+
+    @Override
+    public void enterOutputStatement(OutputStatementContext ctx) {
+        OutputListener.processOutputEntry(this, ctx);
+    }
+
+    @Override
+    public void exitOutputStatement(OutputStatementContext ctx) {
+        OutputListener.processOutputExit(this, ctx);
+    }
+
+    @Override
+    public void enterNotificationStatement(NotificationStatementContext ctx) {
+        NotificationListener.processNotificationEntry(this, ctx);
+    }
+
+    @Override
+    public void exitNotificationStatement(NotificationStatementContext ctx) {
+        NotificationListener.processNotificationExit(this, ctx);
+    }
+
+    @Override
+    public void enterDeviationStatement(DeviationStatementContext ctx) {
+        increaseUnsupportedYangConstructDepth();
+        ListenerUtil.handleUnsupportedYangConstruct(YangConstructType.DEVIATION_DATA, ctx, UtilConstants.UNSUPPORTED_YANG_CONSTRUCT,
+                                                    getFileName());
+    }
+
+    @Override
+    public void exitDeviationStatement(DeviationStatementContext ctx) {
+        decreaseUnsupportedYangConstructDepth();
+    }
+
+    @Override
+    public void enterDeviateNotSupportedStatement(DeviateNotSupportedStatementContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void exitDeviateNotSupportedStatement(DeviateNotSupportedStatementContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void enterDeviateAddStatement(DeviateAddStatementContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void exitDeviateAddStatement(DeviateAddStatementContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void enterDeviateDeleteStatement(DeviateDeleteStatementContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void exitDeviateDeleteStatement(DeviateDeleteStatementContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void enterDeviateReplaceStatement(DeviateReplaceStatementContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void exitDeviateReplaceStatement(DeviateReplaceStatementContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void enterString(StringContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void exitString(StringContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void enterIdentifier(IdentifierContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void exitIdentifier(IdentifierContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void enterDateArgumentString(DateArgumentStringContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void exitDateArgumentString(DateArgumentStringContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void enterRange(RangeContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void exitRange(RangeContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void enterLength(LengthContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void exitLength(LengthContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void enterPath(PathContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void exitPath(PathContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void enterPosition(PositionContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void exitPosition(PositionContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void enterStatus(StatusContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void exitStatus(StatusContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void enterConfig(ConfigContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void exitConfig(ConfigContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void enterMandatory(MandatoryContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void exitMandatory(MandatoryContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void enterOrderedBy(OrderedByContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void exitOrderedBy(OrderedByContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void enterMinValue(MinValueContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void exitMinValue(MinValueContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void enterMaxValue(MaxValueContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void exitMaxValue(MaxValueContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void enterKey(KeyContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void exitKey(KeyContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void enterUnique(UniqueContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void exitUnique(UniqueContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void enterRefine(RefineContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void exitRefine(RefineContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void enterAugment(AugmentContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void exitAugment(AugmentContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void enterDeviation(DeviationContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void exitDeviation(DeviationContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void enterYangConstruct(YangConstructContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void exitYangConstruct(YangConstructContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void enterCompilerAnnotationStatement(CompilerAnnotationStatementContext ctx) {
+        CompilerAnnotationListener.processCompilerAnnotationEntry(this, ctx);
+    }
+
+    @Override
+    public void exitCompilerAnnotationStatement(CompilerAnnotationStatementContext ctx) {
+        CompilerAnnotationListener.processCompilerAnnotationExit(this, ctx);
+    }
+
+    @Override
+    public void enterCompilerAnnotationBodyStatement(CompilerAnnotationBodyStatementContext ctx) {
+        // do nothing
+    }
+
+    @Override
+    public void exitCompilerAnnotationBodyStatement(CompilerAnnotationBodyStatementContext ctx) {
+        // do nothing
+    }
+
+    @Override
+    public void enterAppDataStructureStatement(AppDataStructureStatementContext ctx) {
+        AppDataStructureListener.processAppDataStructureEntry(this, ctx);
+    }
+
+    @Override
+    public void exitAppDataStructureStatement(AppDataStructureStatementContext ctx) {
+        AppDataStructureListener.processAppDataStructureExit(this, ctx);
+    }
+
+    @Override
+    public void enterAppDataStructure(AppDataStructureContext currentContext) {
+        // do nothing
+    }
+
+    @Override
+    public void exitAppDataStructure(AppDataStructureContext currentContext) {
+        // do nothing
+    }
+
+    @Override
+    public void enterAppExtendedStatement(AppExtendedStatementContext currentContext) {
+        AppExtendedNameListener.processAppExtendedNameEntry(this, currentContext);
+    }
+
+    @Override
+    public void exitAppExtendedStatement(AppExtendedStatementContext currentContext) {
+        // TODO : to be implemented
+    }
+
+    @Override
+    public void enterExtendedName(ExtendedNameContext currentContext) {
+        // do nothing
+    }
+
+    @Override
+    public void exitExtendedName(ExtendedNameContext currentContext) {
+        // do nothing
+    }
+
+    @Override
+    public void enterDataStructureKeyStatement(DataStructureKeyStatementContext ctx) {
+        DataStructureKeyListener.processDataStructureKeyEntry(this, ctx);
+    }
+
+    @Override
+    public void exitDataStructureKeyStatement(DataStructureKeyStatementContext ctx) {
+        // do nothing
+    }
+
+    @Override
+    public void enterVersion(VersionContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void exitVersion(VersionContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void enterValue(ValueContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void exitValue(ValueContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void enterRequireInstance(RequireInstanceContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void exitRequireInstance(RequireInstanceContext ctx) {
+        // do nothing.
+    }
+
+    @Override
+    public void enterFraction(FractionContext ctx) {
+        // TODO: implement the method.
+    }
+
+    @Override
+    public void exitFraction(FractionContext ctx) {
+        // TODO: implement the method.
+    }
+
+    @Override
+    public void visitTerminal(TerminalNode terminalNode) {
+        // do nothing.
+    }
+
+    @Override
+    public void visitErrorNode(ErrorNode errorNode) {
+        // do nothing.
+    }
+
+    @Override
+    public void enterEveryRule(ParserRuleContext parserRuleContext) {
+        // do nothing.
+    }
+
+    @Override
+    public void exitEveryRule(ParserRuleContext parserRuleContext) {
+        // do nothing.
+    }
+}
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/YangUtilsParserManager.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/YangUtilsParserManager.java
new file mode 100644
index 0000000..e9f1bdc
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/YangUtilsParserManager.java
@@ -0,0 +1,104 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl;
+
+import org.antlr.v4.runtime.ANTLRFileStream;
+import org.antlr.v4.runtime.ANTLRInputStream;
+import org.antlr.v4.runtime.CommonTokenStream;
+import org.antlr.v4.runtime.tree.ParseTree;
+import org.antlr.v4.runtime.tree.ParseTreeWalker;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.parser.YangUtilsParser;
+import org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangLexer;
+import org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ParseTreeErrorListener;
+
+import java.io.IOException;
+
+/**
+ * Represents file parsing, parse tree creation and data model tree creation
+ * corresponding to an input YANG file.
+ */
+public class YangUtilsParserManager implements YangUtilsParser {
+
+    @Override
+    public YangNode getDataModel(String yangFile) throws IOException, ParserException {
+
+        /**
+         * Create a char stream that reads from YANG file. Throws an exception
+         * in case input YANG file is either null or non existent.
+         */
+        ANTLRInputStream input;
+        try {
+            input = new ANTLRFileStream(yangFile);
+        } catch (IOException e) {
+            throw new ParserException("YANG file error : YANG file does not exist. " + yangFile);
+        }
+
+        // Create a lexer that feeds off of input char stream.
+        GeneratedYangLexer lexer = new GeneratedYangLexer(input);
+
+        // Create a buffer of tokens pulled from the lexer.
+        CommonTokenStream tokens = new CommonTokenStream(lexer);
+
+        // Create a parser that feeds off the tokens buffer.
+        GeneratedYangParser parser = new GeneratedYangParser(tokens);
+
+        // Remove console error listener.
+        parser.removeErrorListeners();
+
+        // Create instance of customized error listener.
+        ParseTreeErrorListener parseTreeErrorListener = new ParseTreeErrorListener();
+
+        // Add customized error listener to catch errors during parsing.
+        parser.addErrorListener(parseTreeErrorListener);
+
+        ParseTree tree;
+
+        try {
+            // Begin parsing YANG file and generate parse tree.
+            tree = parser.yangfile();
+        } catch (ParserException parserException) {
+            parserException.setFileName(yangFile);
+            throw parserException;
+        }
+
+        // Create a walker to walk the parse tree.
+        ParseTreeWalker walker = new ParseTreeWalker();
+
+        // Create a listener implementation class object.
+        TreeWalkListener treeWalker = new TreeWalkListener();
+        treeWalker.setFileName(yangFile);
+        /**
+         * Walk parse tree, provide call backs to methods in listener and build
+         * data model tree.
+         */
+        try {
+            walker.walk(treeWalker, tree);
+        } catch (ParserException listenerException) {
+            // TODO free incomplete data model tree.
+            listenerException.setFileName(yangFile);
+            throw listenerException;
+        } finally {
+            // TODO free parsable stack
+        }
+
+        // Returns the Root Node of the constructed data model tree.
+        return treeWalker.getRootNode();
+    }
+}
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/AppDataStructureListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/AppDataStructureListener.java
new file mode 100644
index 0000000..931122f
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/AppDataStructureListener.java
@@ -0,0 +1,119 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.onosproject.yang.compiler.datamodel.YangAppDataStructure;
+import org.onosproject.yang.compiler.datamodel.YangCompilerAnnotation;
+import org.onosproject.yang.compiler.datamodel.YangDataStructure;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.TreeWalkListener;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation;
+
+import static org.onosproject.yang.compiler.datamodel.YangDataStructure.getDataStructureType;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.APP_DATA_STRUCTURE;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.AppDataStructureStatementContext;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.EXIT;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_CURRENT_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil.getValidPrefix;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
+
+/*
+ * Reference: RFC6020 and YANG ANTLR Grammar
+ *
+ * ABNF grammar as per RFC6020
+ *   app-data-structure-stmt = prefix:app-data-structure-keyword string
+ *                         (";" /
+ *                          "{"
+ *                              [data-structure-key-stmt stmtsep]
+ *                          "}")
+ *
+ * ANTLR grammar rule
+ *   appDataStructureStatement : APP_DATA_STRUCTURE appDataStructure (STMTEND | (LEFT_CURLY_BRACE
+ *       dataStructureKeyStatement? RIGHT_CURLY_BRACE));
+ */
+
+/**
+ * Represents listener based call back function corresponding to the "app-data-structure"
+ * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
+ */
+public final class AppDataStructureListener {
+
+    /**
+     * Creates a new app-data-structure listener.
+     */
+    private AppDataStructureListener() {
+    }
+
+    /**
+     * Performs validation and updates the data model tree. It is called when parser receives an
+     * input matching the grammar rule(app-data-structure).
+     *
+     * @param listener listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processAppDataStructureEntry(TreeWalkListener listener,
+                                                    AppDataStructureStatementContext ctx) {
+
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, APP_DATA_STRUCTURE, "", ENTRY);
+
+        String prefix = getValidPrefix(ctx.APP_DATA_STRUCTURE().getText(), APP_DATA_STRUCTURE, ctx);
+        YangDataStructure dataStructure = getDataStructureType(ctx.appDataStructure().getText());
+
+        YangAppDataStructure appDataStructure = new YangAppDataStructure();
+        appDataStructure.setPrefix(prefix);
+        appDataStructure.setDataStructure(dataStructure);
+        appDataStructure.setLineNumber(ctx.getStart().getLine());
+        appDataStructure.setCharPosition(ctx.getStart().getCharPositionInLine());
+        appDataStructure.setFileName(listener.getFileName());
+
+        Parsable curData = listener.getParsedDataStack().peek();
+        if (curData instanceof YangCompilerAnnotation) {
+            YangCompilerAnnotation compilerAnnotation = ((YangCompilerAnnotation) curData);
+            compilerAnnotation.setYangAppDataStructure(appDataStructure);
+            listener.getParsedDataStack().push(appDataStructure);
+        } else {
+            throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, APP_DATA_STRUCTURE,
+                    "", ENTRY));
+        }
+    }
+
+    /**
+     * Performs validation and updates the data model tree. It is called when parser
+     * exits from grammar rule (app-data-structure).
+     *
+     * @param listener listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processAppDataStructureExit(TreeWalkListener listener,
+                                                   AppDataStructureStatementContext ctx) {
+
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, APP_DATA_STRUCTURE, "", EXIT);
+        if (!(listener.getParsedDataStack().peek() instanceof YangAppDataStructure)) {
+            throw new ParserException(constructListenerErrorMessage(MISSING_CURRENT_HOLDER, APP_DATA_STRUCTURE,
+                    "", EXIT));
+        }
+        listener.getParsedDataStack().pop();
+    }
+}
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/AppExtendedNameListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/AppExtendedNameListener.java
new file mode 100644
index 0000000..24fc9c1
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/AppExtendedNameListener.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.yang.compiler.parser.impl.listeners;
+
+import org.onosproject.yang.compiler.datamodel.YangAppExtended;
+import org.onosproject.yang.compiler.datamodel.YangCompilerAnnotation;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.TreeWalkListener;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation;
+
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.APP_EXTENDED_NAME_DATA;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil.getValidPrefix;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil.removeQuotesAndHandleConcat;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
+
+/*
+ * Reference: RFC6020 and YANG ANTLR Grammar
+ *
+ * ABNF grammar as per RFC6020
+ *   app-extended-stmt = prefix:app-extended-name-keyword string ";"
+ *
+ * ANTLR grammar rule
+ * appExtendedStatement : APP_EXTENDED extendedName STMTEND;
+ */
+
+/**
+ * Represents listener based call back function corresponding to the "app-extended-name"
+ * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
+ */
+public final class AppExtendedNameListener {
+
+    /**
+     * Creates a new app-extended-name listener.
+     */
+    private AppExtendedNameListener() {
+    }
+
+    /**
+     * Performs validation and updates the data model tree. It is called when parser receives an
+     * input matching the grammar rule(app-extended-name).
+     *
+     * @param listener listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processAppExtendedNameEntry(TreeWalkListener listener,
+                                                   GeneratedYangParser.AppExtendedStatementContext ctx) {
+
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, APP_EXTENDED_NAME_DATA, ctx.extendedName().getText(), ENTRY);
+
+        String prefix = getValidPrefix(ctx.APP_EXTENDED().getText(), APP_EXTENDED_NAME_DATA, ctx);
+        YangAppExtended extendedName = new YangAppExtended();
+        extendedName.setPrefix(prefix);
+        extendedName.setYangAppExtendedName(removeQuotesAndHandleConcat(ctx.extendedName().getText()));
+
+        extendedName.setLineNumber(ctx.getStart().getLine());
+        extendedName.setCharPosition(ctx.getStart().getCharPositionInLine());
+        extendedName.setFileName(listener.getFileName());
+        Parsable curData = listener.getParsedDataStack().peek();
+        if (curData instanceof YangCompilerAnnotation) {
+            YangCompilerAnnotation compilerAnnotation = ((YangCompilerAnnotation) curData);
+            compilerAnnotation.setYangAppExtendedName(extendedName);
+        } else {
+            throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, APP_EXTENDED_NAME_DATA,
+                    ctx.extendedName().getText(), ENTRY));
+        }
+    }
+}
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/ArgumentListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/ArgumentListener.java
new file mode 100644
index 0000000..7da7699
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/ArgumentListener.java
@@ -0,0 +1,92 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.onosproject.yang.compiler.datamodel.YangExtension;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.TreeWalkListener;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation;
+
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.ARGUMENT_DATA;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.ArgumentStatementContext;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil.getValidIdentifier;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
+
+/*
+ * Reference: RFC6020 and YANG ANTLR Grammar
+ *
+ * ABNF grammar as per RFC6020
+ * argument-stmt       = argument-keyword sep identifier-arg-str optsep
+ *                       (";" /
+ *                        "{" stmtsep
+ *                            [yin-element-stmt stmtsep]
+ *                        "}")
+ * *
+ * ANTLR grammar rule
+ * argumentStatement : ARGUMENT_KEYWORD identifier (STMTEND | LEFT_CURLY_BRACE argumentBody RIGHT_CURLY_BRACE);
+ * argumentBody : yinElementStatement?;
+ */
+
+/**
+ * Represents listener based call back function corresponding to the "argument"
+ * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
+ */
+public final class ArgumentListener {
+
+    /**
+     * Creates a new argument listener.
+     */
+    private ArgumentListener() {
+    }
+
+    /**
+     * It is called when parser receives an input matching the grammar rule
+     * (argument), performs validation and updates the data model tree.
+     *
+     * @param listener listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processArgumentEntry(TreeWalkListener listener,
+                                            ArgumentStatementContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, ARGUMENT_DATA, ctx.identifier().getText(), ENTRY);
+
+        String identifier = getValidIdentifier(ctx.identifier().getText(), ARGUMENT_DATA, ctx);
+
+        Parsable curData = listener.getParsedDataStack().peek();
+        if (curData instanceof YangExtension) {
+            YangExtension extension = ((YangExtension) curData);
+
+            extension.setLineNumber(ctx.getStart().getLine());
+            extension.setCharPosition(ctx.getStart().getCharPositionInLine());
+            extension.setFileName(listener.getFileName());
+            extension.setArgumentName(identifier);
+        } else {
+            throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, ARGUMENT_DATA,
+                    ctx.identifier().getText(), ENTRY));
+        }
+    }
+}
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/AugmentListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/AugmentListener.java
new file mode 100644
index 0000000..77f5ca3
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/AugmentListener.java
@@ -0,0 +1,223 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.onosproject.yang.compiler.datamodel.YangAtomicPath;
+import org.onosproject.yang.compiler.datamodel.YangAugment;
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangSubModule;
+import org.onosproject.yang.compiler.datamodel.YangUses;
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.linker.impl.YangResolutionInfoImpl;
+import org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.AugmentStatementContext;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.TreeWalkListener;
+import org.onosproject.yang.compiler.utils.UtilConstants;
+
+import java.util.List;
+
+import static org.onosproject.yang.compiler.datamodel.utils.DataModelUtils.addResolutionInfo;
+import static org.onosproject.yang.compiler.datamodel.utils.GeneratedLanguage.JAVA_GENERATION;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.AUGMENT_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.CASE_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.DATA_DEF_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.DESCRIPTION_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.REFERENCE_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.STATUS_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.WHEN_DATA;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerCollisionDetector.detectCollidingChildUtil;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.EXIT;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructExtendedListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_CURRENT_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.UNHANDLED_PARSED_DATA;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil.getPrefixRemovedName;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil.getValidAbsoluteSchemaNodeId;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil.removeQuotesAndHandleConcat;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.validateCardinalityEitherOne;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.validateCardinalityMaxOne;
+import static org.onosproject.yang.compiler.translator.tojava.YangDataModelFactory.getYangAugmentNode;
+import static org.onosproject.yang.compiler.utils.UtilConstants.EMPTY_STRING;
+
+/*
+ * Reference: RFC6020 and YANG ANTLR Grammar
+ *
+ * ABNF grammar as per RFC6020
+ *  augment-stmt        = augment-keyword sep augment-arg-str optsep
+ *                        "{" stmtsep
+ *                            ;; these stmts can appear in any order
+ *                            [when-stmt stmtsep]
+ *                            *(if-feature-stmt stmtsep)
+ *                            [status-stmt stmtsep]
+ *                            [description-stmt stmtsep]
+ *                            [reference-stmt stmtsep]
+ *                            1*((data-def-stmt stmtsep) /
+ *                               (case-stmt stmtsep))
+ *                         "}"
+ *
+ * ANTLR grammar rule
+ * augmentStatement : AUGMENT_KEYWORD augment LEFT_CURLY_BRACE (whenStatement |
+ * ifFeatureStatement | statusStatement | descriptionStatement |
+ * referenceStatement | dataDefStatement  | caseStatement)* RIGHT_CURLY_BRACE;
+ */
+
+/**
+ * Represents listener based call back function corresponding to the "augment"
+ * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
+ */
+public final class AugmentListener {
+
+    // No instantiation.
+    private AugmentListener() {
+    }
+
+    /**
+     * Performs validation and updates the data model tree when parser
+     * receives an input matching the grammar rule (augment), performs
+     * validation and updates the data model tree.
+     *
+     * @param listener listener's object
+     * @param ctx      context object
+     */
+    public static void processAugmentEntry(TreeWalkListener listener,
+                                           AugmentStatementContext ctx) {
+
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, AUGMENT_DATA,
+                             ctx.augment().getText(), ENTRY);
+
+        Parsable curData = listener.getParsedDataStack().peek();
+
+        if (curData instanceof YangUses) {
+            throw new ParserException(constructListenerErrorMessage(
+                    UNHANDLED_PARSED_DATA, AUGMENT_DATA,
+                    ctx.augment().getText(), ENTRY));
+        }
+
+        if (!(curData instanceof YangModule) &&
+                !(curData instanceof YangSubModule)) {
+            throw new ParserException(constructListenerErrorMessage(
+                    INVALID_HOLDER, AUGMENT_DATA,
+                    ctx.augment().getText(), ENTRY));
+        }
+
+        // Validates augment argument string
+        List<YangAtomicPath> atomics =
+                getValidAbsoluteSchemaNodeId(ctx.augment().getText(),
+                                             AUGMENT_DATA, ctx);
+        valSubStatCardinality(ctx);
+
+        int line = ctx.getStart().getLine();
+        int pos = ctx.getStart().getCharPositionInLine();
+
+        detectCollidingChildUtil(listener, line, pos, EMPTY_STRING,
+                                 AUGMENT_DATA);
+
+        YangNode root = (YangNode) curData;
+        String name = getPrefixRemovedName(atomics, root);
+        YangAugment augment = getYangAugmentNode(JAVA_GENERATION);
+        augment.setLineNumber(line);
+        augment.setCharPosition(pos);
+        augment.setFileName(listener.getFileName());
+        augment.setTargetNode(atomics);
+        augment.setName(removeQuotesAndHandleConcat(ctx.augment().getText()));
+        augment.setPrefixRemovedName(name);
+
+        try {
+            root.addChild(augment);
+        } catch (DataModelException e) {
+            throw new ParserException(constructExtendedListenerErrorMessage(
+                    UNHANDLED_PARSED_DATA, AUGMENT_DATA,
+                    ctx.augment().getText(), ENTRY, e.getMessage()));
+        }
+        listener.getParsedDataStack().push(augment);
+
+        // Adds resolution info to the list
+        YangResolutionInfoImpl<YangAugment> info =
+                new YangResolutionInfoImpl<>(augment, root, line, pos);
+        addToResolution(info, ctx);
+    }
+
+    /**
+     * Performs validations and update the data model tree when parser exits
+     * from grammar rule (augment).
+     *
+     * @param listener listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processAugmentExit(TreeWalkListener listener,
+                                          AugmentStatementContext ctx) {
+
+        //Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, AUGMENT_DATA,
+                             ctx.augment().getText(), EXIT);
+
+        if (!(listener.getParsedDataStack().peek() instanceof YangAugment)) {
+            throw new ParserException(constructListenerErrorMessage(
+                    MISSING_CURRENT_HOLDER, AUGMENT_DATA,
+                    ctx.augment().getText(), EXIT));
+        }
+        listener.getParsedDataStack().pop();
+    }
+
+    /**
+     * Validates the cardinality of augment sub-statements as per grammar.
+     *
+     * @param ctx context object
+     */
+    private static void valSubStatCardinality(AugmentStatementContext ctx) {
+
+        validateCardinalityMaxOne(ctx.statusStatement(), STATUS_DATA,
+                                  AUGMENT_DATA, ctx.augment().getText());
+
+        validateCardinalityMaxOne(ctx.descriptionStatement(), DESCRIPTION_DATA,
+                                  AUGMENT_DATA, ctx.augment().getText());
+
+        validateCardinalityMaxOne(ctx.referenceStatement(), REFERENCE_DATA,
+                                  AUGMENT_DATA, ctx.augment().getText());
+
+        validateCardinalityMaxOne(ctx.whenStatement(), WHEN_DATA, AUGMENT_DATA,
+                                  ctx.augment().getText());
+
+        validateCardinalityEitherOne(ctx.dataDefStatement(), DATA_DEF_DATA,
+                                     ctx.caseStatement(), CASE_DATA,
+                                     AUGMENT_DATA, ctx.augment().getText(),
+                                     ctx);
+    }
+
+    /**
+     * Add to resolution list.
+     *
+     * @param info resolution info
+     * @param ctx  context object
+     */
+    private static void addToResolution(YangResolutionInfoImpl<YangAugment> info,
+                                        AugmentStatementContext ctx) {
+        try {
+            addResolutionInfo(info);
+        } catch (DataModelException e) {
+            throw new ParserException(constructExtendedListenerErrorMessage(
+                    UNHANDLED_PARSED_DATA, AUGMENT_DATA,
+                    ctx.augment().getText(), EXIT, e.getMessage()));
+        }
+    }
+}
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/BaseFileListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/BaseFileListener.java
new file mode 100644
index 0000000..b1130ca
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/BaseFileListener.java
@@ -0,0 +1,92 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangSubModule;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.TreeWalkListener;
+
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.YANGBASE_DATA;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.YangfileContext;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.EXIT;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.INVALID_CHILD;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.checkStackIsEmpty;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
+
+/*
+ * Reference: RFC6020 and YANG ANTLR Grammar
+ *
+ * ANTLR grammar rule
+ * yangfile : module_stmt
+ *          | submodule_stmt;
+ */
+
+/**
+ * Representation of call back function corresponding to the "base rule" defined in
+ * ANTLR grammar file.
+ */
+public final class BaseFileListener {
+
+    /**
+     * Creates a new base listener.
+     */
+    private BaseFileListener() {
+    }
+
+    /**
+     * It is called when parser receives an input matching the grammar rule
+     * (yangfile), perform validations and update the data model tree.
+     *
+     * @param listener Listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processYangFileEntry(TreeWalkListener listener, YangfileContext ctx) {
+
+        // Check if stack is empty.
+        checkStackIsEmpty(listener, INVALID_HOLDER, YANGBASE_DATA, "", ENTRY);
+    }
+
+    /**
+     * It is called when parser exits from grammar rule (yangfile), it perform
+     * validations and update the data model tree.
+     *
+     * @param listener Listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processYangFileExit(TreeWalkListener listener, YangfileContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, YANGBASE_DATA, "", EXIT);
+
+        // Data Model tree root node is set.
+        if (listener.getParsedDataStack().peek() instanceof YangModule
+                || listener.getParsedDataStack().peek() instanceof YangSubModule) {
+            listener.setRootNode((YangNode) listener.getParsedDataStack().pop());
+        } else {
+            throw new ParserException(constructListenerErrorMessage(INVALID_CHILD, YANGBASE_DATA, "", EXIT));
+        }
+
+        // Check if stack is empty.
+        checkStackIsEmpty(listener, INVALID_HOLDER, YANGBASE_DATA, "", EXIT);
+    }
+}
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/BaseListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/BaseListener.java
new file mode 100644
index 0000000..c05cd38
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/BaseListener.java
@@ -0,0 +1,123 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.onosproject.yang.compiler.datamodel.YangBase;
+import org.onosproject.yang.compiler.datamodel.YangIdentity;
+import org.onosproject.yang.compiler.datamodel.YangIdentityRef;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangNodeIdentifier;
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.datamodel.utils.DataModelUtils;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.linker.impl.YangResolutionInfoImpl;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.TreeWalkListener;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil;
+
+import static org.onosproject.yang.compiler.datamodel.utils.DataModelUtils.addResolutionInfo;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.BASE_DATA;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.BaseStatementContext;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.EXIT;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructExtendedListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.UNHANDLED_PARSED_DATA;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil.getValidNodeIdentifier;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
+
+/**
+ * base-stmt           = base-keyword sep identifier-ref-arg-str
+ * optsep stmtend*
+ * identifier-ref-arg  = [prefix ":"] identifier
+ */
+
+/**
+ * Represents listener based call back function corresponding to the "base"
+ * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
+ */
+public final class BaseListener {
+
+    //Creates a new base listener.
+    private BaseListener() {
+    }
+
+    /**
+     * Performs validation and updates the data model tree when parser receives an
+     * input matching the grammar rule (base).
+     *
+     * @param listener listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processBaseEntry(TreeWalkListener listener,
+                                        BaseStatementContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, BASE_DATA, ctx.string().getText(), ENTRY);
+
+        YangNodeIdentifier nodeIdentifier = getValidNodeIdentifier(ctx.string().getText(), BASE_DATA, ctx);
+
+        Parsable tmpData = listener.getParsedDataStack().peek();
+
+        /**
+         * For identityref base node identifier is copied in identity listener itself, so no need to process
+         * base statement for indentityref
+         */
+        if (tmpData instanceof YangIdentityRef) {
+            return;
+        }
+
+        if (!(tmpData instanceof YangIdentity)) {
+            throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, BASE_DATA,
+                                                                    ctx.string().getText(), ENTRY));
+        }
+
+        YangBase yangBase = new YangBase();
+        yangBase.setBaseIdentifier(nodeIdentifier);
+        ((YangIdentity) tmpData).setBaseNode(yangBase);
+
+        int errorLine = ctx.getStart().getLine();
+        int errorPosition = ctx.getStart().getCharPositionInLine();
+
+        yangBase.setLineNumber(errorLine);
+        yangBase.setCharPosition(errorPosition);
+        yangBase.setFileName(listener.getFileName());
+
+        // Add resolution information to the list
+        YangResolutionInfoImpl resolutionInfo =
+                new YangResolutionInfoImpl<YangBase>(yangBase, (YangNode) tmpData, errorLine, errorPosition);
+        addToResolutionList(resolutionInfo, ctx);
+    }
+
+    /**
+     * Add to resolution list.
+     *
+     * @param resolutionInfo resolution information
+     * @param ctx            context object of the grammar rule
+     */
+    private static void addToResolutionList(YangResolutionInfoImpl<YangBase> resolutionInfo,
+                                            BaseStatementContext ctx) {
+
+        try {
+            addResolutionInfo(resolutionInfo);
+        } catch (DataModelException e) {
+            throw new ParserException(constructExtendedListenerErrorMessage(UNHANDLED_PARSED_DATA,
+                                                                            BASE_DATA, ctx.string().getText(), EXIT, e.getMessage()));
+        }
+    }
+}
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/BelongsToListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/BelongsToListener.java
new file mode 100644
index 0000000..277f2e5
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/BelongsToListener.java
@@ -0,0 +1,145 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.onosproject.yang.compiler.datamodel.YangBelongsTo;
+import org.onosproject.yang.compiler.datamodel.YangSubModule;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.TreeWalkListener;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil;
+
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.BELONGS_TO_DATA;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.BelongstoStatementContext;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.EXIT;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_CURRENT_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil.getValidIdentifier;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
+
+/*
+ * Reference: RFC6020 and YANG ANTLR Grammar
+ *
+ * ABNF grammar as per RFC6020
+ * submodule-header-stmts =
+ *                            ;; these stmts can appear in any order
+ *                            [yang-version-stmt stmtsep]
+ *                             belongs-to-stmt stmtsep
+ *
+ * belongs-to-stmt     = belongs-to-keyword sep identifier-arg-str
+ *                       optsep
+ *                       "{" stmtsep
+ *                           prefix-stmt stmtsep
+ *                       "}"
+ *
+ * ANTLR grammar rule
+ * submodule_header_statement : yang_version_stmt? belongs_to_stmt
+ *                            | belongs_to_stmt yang_version_stmt?
+ *                            ;
+ * belongs_to_stmt : BELONGS_TO_KEYWORD identifier LEFT_CURLY_BRACE belongs_to_stmt_body RIGHT_CURLY_BRACE;
+ * belongs_to_stmt_body : prefix_stmt;
+ */
+
+/**
+ * Represents listener based call back function corresponding to the
+ * "belongs to" rule defined in ANTLR grammar file for corresponding ABNF rule
+ * in RFC 6020.
+ */
+public final class BelongsToListener {
+
+    /**
+     * Creates a new belongto listener.
+     */
+    private BelongsToListener() {
+    }
+
+    /**
+     * It is called when parser receives an input matching the grammar rule
+     * (belongsto), perform validations and update the data model tree.
+     *
+     * @param listener Listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processBelongsToEntry(TreeWalkListener listener,
+                                             BelongstoStatementContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, BELONGS_TO_DATA, ctx.identifier().getText(),
+                ENTRY);
+
+        String identifier = getValidIdentifier(ctx.identifier().getText(), BELONGS_TO_DATA, ctx);
+
+        YangBelongsTo belongstoNode = new YangBelongsTo();
+        belongstoNode.setBelongsToModuleName(identifier);
+
+        // Set the line number and character position in line for the belongs to.
+        int errorLine = ctx.getStart().getLine();
+        int errorPosition = ctx.getStart().getCharPositionInLine();
+        belongstoNode.setLineNumber(errorLine);
+        belongstoNode.setCharPosition(errorPosition);
+        belongstoNode.setFileName(listener.getFileName());
+
+        // Push belongsto into the stack.
+        listener.getParsedDataStack().push(belongstoNode);
+    }
+
+    /**
+     * It is called when parser exits from grammar rule (belongsto), it perform
+     * validations and update the data model tree.
+     *
+     * @param listener Listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processBelongsToExit(TreeWalkListener listener,
+                                            BelongstoStatementContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, BELONGS_TO_DATA, ctx.identifier().getText(),
+                EXIT);
+
+        Parsable tmpBelongstoNode = listener.getParsedDataStack().peek();
+        if (tmpBelongstoNode instanceof YangBelongsTo) {
+            listener.getParsedDataStack().pop();
+
+            // Check for stack to be empty.
+            checkStackIsNotEmpty(listener, MISSING_HOLDER, BELONGS_TO_DATA,
+                    ctx.identifier().getText(), EXIT);
+
+            Parsable tmpNode = listener.getParsedDataStack().peek();
+            switch (tmpNode.getYangConstructType()) {
+                case SUB_MODULE_DATA: {
+                    YangSubModule subModule = (YangSubModule) tmpNode;
+                    subModule.setBelongsTo((YangBelongsTo) tmpBelongstoNode);
+                    subModule.setPrefix(subModule.getBelongsTo().getPrefix());
+                    break;
+                }
+                default:
+                    throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, BELONGS_TO_DATA,
+                            ctx.identifier().getText(),
+                            EXIT));
+            }
+        } else {
+            throw new ParserException(constructListenerErrorMessage(MISSING_CURRENT_HOLDER, BELONGS_TO_DATA,
+                    ctx.identifier().getText(), EXIT));
+        }
+    }
+}
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/BitListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/BitListener.java
new file mode 100644
index 0000000..c1c0046
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/BitListener.java
@@ -0,0 +1,187 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+/*
+ * Reference: RFC6020 and YANG ANTLR Grammar
+ *
+ * ABNF grammar as per RFC6020
+ * bit-stmt            = bit-keyword sep identifier-arg-str optsep
+ *                       (";" /
+ *                        "{" stmtsep
+ *                            ;; these stmts can appear in any order
+ *                            [position-stmt stmtsep]
+ *                            [status-stmt stmtsep]
+ *                            [description-stmt stmtsep]
+ *                            [reference-stmt stmtsep]
+ *                          "}"
+ *                        "}")
+ *
+ * ANTLR grammar rule
+ * bitStatement : BIT_KEYWORD identifier (STMTEND | LEFT_CURLY_BRACE bitBodyStatement RIGHT_CURLY_BRACE);
+ *
+ * bitBodyStatement : positionStatement? statusStatement? descriptionStatement? referenceStatement?
+ *               | positionStatement? statusStatement? referenceStatement? descriptionStatement?
+ *               | positionStatement? descriptionStatement? statusStatement? referenceStatement?
+ *               | positionStatement? descriptionStatement? referenceStatement? statusStatement?
+ *               | positionStatement? referenceStatement? statusStatement? descriptionStatement?
+ *               | positionStatement? referenceStatement? descriptionStatement? statusStatement?
+ *               | statusStatement? positionStatement? descriptionStatement? referenceStatement?
+ *               | statusStatement? positionStatement? referenceStatement? descriptionStatement?
+ *               | statusStatement? descriptionStatement? descriptionStatement? positionStatement?
+ *               | statusStatement? descriptionStatement? positionStatement? descriptionStatement?
+ *               | statusStatement? referenceStatement? positionStatement? descriptionStatement?
+ *               | statusStatement? referenceStatement? descriptionStatement? positionStatement?
+ *               | descriptionStatement? positionStatement? statusStatement? referenceStatement?
+ *               | descriptionStatement? positionStatement? referenceStatement? statusStatement?
+ *               | descriptionStatement? statusStatement? positionStatement? referenceStatement?
+ *               | descriptionStatement? statusStatement? referenceStatement? positionStatement?
+ *               | descriptionStatement? referenceStatement? positionStatement? statusStatement?
+ *               | descriptionStatement? referenceStatement? statusStatement? positionStatement?
+ *               | referenceStatement? positionStatement? descriptionStatement? statusStatement?
+ *               | referenceStatement? positionStatement? statusStatement? descriptionStatement?
+ *               | referenceStatement? statusStatement? descriptionStatement? positionStatement?
+ *               | referenceStatement? statusStatement? positionStatement? descriptionStatement?
+ *               | referenceStatement? descriptionStatement? positionStatement? statusStatement?
+ *               | referenceStatement? descriptionStatement? statusStatement? positionStatement?
+ *               ;
+ */
+
+import org.onosproject.yang.compiler.datamodel.YangBit;
+import org.onosproject.yang.compiler.datamodel.YangBits;
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.TreeWalkListener;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation;
+
+import java.util.Map;
+
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.BIT_DATA;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.EXIT;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructExtendedListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.INVALID_CONTENT;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_CURRENT_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil.getValidIdentifier;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
+
+/**
+ * Represents listener based call back function corresponding to the "bit"
+ * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
+ */
+public final class BitListener {
+
+    /**
+     * Creates a new bit listener.
+     */
+    private BitListener() {
+    }
+
+    /**
+     * It is called when parser enters grammar rule (bit), it perform
+     * validations and updates the data model tree.
+     *
+     * @param listener listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processBitEntry(TreeWalkListener listener,
+                                       GeneratedYangParser.BitStatementContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, BIT_DATA, ctx.identifier().getText(), ENTRY);
+
+        String identifier = getValidIdentifier(ctx.identifier().getText(), BIT_DATA, ctx);
+
+        YangBit bitNode = new YangBit();
+        bitNode.setBitName(identifier);
+
+        bitNode.setLineNumber(ctx.getStart().getLine());
+        bitNode.setCharPosition(ctx.getStart().getCharPositionInLine());
+        bitNode.setFileName(listener.getFileName());
+        listener.getParsedDataStack().push(bitNode);
+    }
+
+    /**
+     * It is called when parser exits from grammar rule (bit), it perform
+     * validations and update the data model tree.
+     *
+     * @param listener Listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processBitExit(TreeWalkListener listener,
+                                      GeneratedYangParser.BitStatementContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, BIT_DATA, ctx.identifier().getText(), EXIT);
+
+        Parsable tmpBitNode = listener.getParsedDataStack().peek();
+        if (tmpBitNode instanceof YangBit) {
+            listener.getParsedDataStack().pop();
+
+            // Check for stack to be non empty.
+            checkStackIsNotEmpty(listener, MISSING_HOLDER, BIT_DATA, ctx.identifier().getText(), EXIT);
+
+            Parsable tmpNode = listener.getParsedDataStack().peek();
+            switch (tmpNode.getYangConstructType()) {
+                case BITS_DATA: {
+                    YangBits yangBits = (YangBits) tmpNode;
+                    if (ctx.bitBodyStatement() == null || ctx.bitBodyStatement().positionStatement() == null) {
+                        int maxPosition = 0;
+                        boolean isPositionPresent = false;
+
+                        for (Map.Entry<Integer, YangBit> element : yangBits.getBitPositionMap().entrySet()) {
+                            if (maxPosition <= element.getKey()) {
+                                maxPosition = element.getKey();
+                                isPositionPresent = true;
+                            }
+                        }
+
+                        if (isPositionPresent) {
+                            maxPosition++;
+                        }
+                        ((YangBit) tmpBitNode).setPosition(maxPosition);
+                    }
+                    try {
+                        yangBits.addBitInfo((YangBit) tmpBitNode);
+                    } catch (DataModelException e) {
+                        ParserException parserException = new ParserException(constructExtendedListenerErrorMessage(
+                                INVALID_CONTENT, BIT_DATA, ctx.identifier().getText(), EXIT, e.getMessage()));
+                        parserException.setLine(ctx.getStart().getLine());
+                        parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
+                        throw parserException;
+                    }
+                    break;
+                }
+                default:
+                    throw new ParserException(
+                            constructListenerErrorMessage(INVALID_HOLDER, BIT_DATA, ctx.identifier().getText(), EXIT));
+            }
+        } else {
+            throw new ParserException(
+                    constructListenerErrorMessage(MISSING_CURRENT_HOLDER, BIT_DATA, ctx.identifier().getText(), EXIT));
+        }
+    }
+}
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/BitsListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/BitsListener.java
new file mode 100644
index 0000000..c037aae
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/BitsListener.java
@@ -0,0 +1,165 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+/*
+ * Reference: RFC6020 and YANG ANTLR Grammar
+ *
+ * ABNF grammar as per RFC6020
+ * type-body-stmts     = numerical-restrictions /
+ *                       decimal64-specification /
+ *                      string-restrictions /
+ *                       enum-specification /
+ *                       leafref-specification /
+ *                       identityref-specification /
+ *                       instance-identifier-specification /
+ *                       bits-specification /
+ *                       union-specification
+ *
+ * bits-specification  = 1*(bit-stmt stmtsep)
+ *
+ * ANTLR grammar rule
+ *
+ * typeBodyStatements : numericalRestrictions | stringRestrictions | enumSpecification
+ *                 | leafrefSpecification | identityrefSpecification | instanceIdentifierSpecification
+ *                 | bitsSpecification | unionSpecification;
+ *
+ * bitsSpecification : bitStatement+;
+ */
+
+import org.onosproject.yang.compiler.datamodel.YangBits;
+import org.onosproject.yang.compiler.datamodel.YangLeaf;
+import org.onosproject.yang.compiler.datamodel.YangLeafList;
+import org.onosproject.yang.compiler.datamodel.YangType;
+import org.onosproject.yang.compiler.datamodel.YangTypeDef;
+import org.onosproject.yang.compiler.datamodel.YangUnion;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.TreeWalkListener;
+
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.BITS_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.TYPE_DATA;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.BitsSpecificationContext;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.EXIT;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_CURRENT_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
+
+/**
+ * Represents listener based call back function corresponding to the "bits" rule
+ * defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
+ */
+public final class BitsListener {
+
+    /**
+     * Creates a new bits listener.
+     */
+    private BitsListener() {
+    }
+
+    /**
+     * It is called when parser enters grammar rule (bits), it perform
+     * validations and updates the data model tree.
+     *
+     * @param listener listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processBitsEntry(TreeWalkListener listener,
+                                        BitsSpecificationContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, BITS_DATA, "", ENTRY);
+
+        if (listener.getParsedDataStack().peek() instanceof YangType) {
+            YangBits bitsNode = new YangBits();
+
+            bitsNode.setLineNumber(ctx.getStart().getLine());
+            bitsNode.setCharPosition(ctx.getStart().getCharPositionInLine());
+            bitsNode.setFileName(listener.getFileName());
+            Parsable typeData = listener.getParsedDataStack().pop();
+
+            // Check for stack to be non empty.
+            checkStackIsNotEmpty(listener, MISSING_HOLDER, BITS_DATA, "", ENTRY);
+
+            Parsable tmpData = listener.getParsedDataStack().peek();
+
+            switch (tmpData.getYangConstructType()) {
+                case LEAF_DATA:
+                    bitsNode.setBitsName(((YangLeaf) tmpData).getName());
+                    break;
+                case LEAF_LIST_DATA:
+                    bitsNode.setBitsName(((YangLeafList) tmpData).getName());
+                    break;
+                case TYPEDEF_DATA:
+                    bitsNode.setBitsName(((YangTypeDef) tmpData).getName());
+                    break;
+                case UNION_DATA:
+                    bitsNode.setBitsName(((YangUnion) tmpData).getName());
+                    break;
+                // TODO typedef, union, deviate.
+                default:
+                    throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, TYPE_DATA,
+                                                                            ((YangType<?>) typeData).getDataTypeName(), ENTRY));
+            }
+            listener.getParsedDataStack().push(typeData);
+            listener.getParsedDataStack().push(bitsNode);
+        } else {
+            throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, BITS_DATA, "", ENTRY));
+        }
+    }
+
+    /**
+     * It is called when parser exits from grammar rule (bits), it perform
+     * validations and update the data model tree.
+     *
+     * @param listener Listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processBitsExit(TreeWalkListener listener,
+                                       BitsSpecificationContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, BITS_DATA, "", EXIT);
+
+        Parsable tmpBitsNode = listener.getParsedDataStack().peek();
+        if (tmpBitsNode instanceof YangBits) {
+            YangBits bitsNode = (YangBits) tmpBitsNode;
+            listener.getParsedDataStack().pop();
+
+            // Check for stack to be non empty.
+            checkStackIsNotEmpty(listener, MISSING_HOLDER, BITS_DATA, "", EXIT);
+
+            Parsable tmpNode = listener.getParsedDataStack().peek();
+            switch (tmpNode.getYangConstructType()) {
+                case TYPE_DATA: {
+                    YangType<YangBits> typeNode = (YangType<YangBits>) tmpNode;
+                    typeNode.setDataTypeExtendedInfo(bitsNode);
+                    break;
+                }
+                default:
+                    throw new ParserException(
+                            constructListenerErrorMessage(INVALID_HOLDER, BITS_DATA, "", EXIT));
+            }
+        } else {
+            throw new ParserException(
+                    constructListenerErrorMessage(MISSING_CURRENT_HOLDER, BITS_DATA, "", EXIT));
+        }
+    }
+}
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/CaseListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/CaseListener.java
new file mode 100644
index 0000000..1ae7cbb
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/CaseListener.java
@@ -0,0 +1,166 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.onosproject.yang.compiler.datamodel.YangAugment;
+import org.onosproject.yang.compiler.datamodel.YangCase;
+import org.onosproject.yang.compiler.datamodel.YangChoice;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.TreeWalkListener;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerCollisionDetector;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation;
+
+import static org.onosproject.yang.compiler.datamodel.utils.GeneratedLanguage.JAVA_GENERATION;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.CASE_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.DESCRIPTION_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.REFERENCE_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.STATUS_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.WHEN_DATA;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerCollisionDetector.detectCollidingChildUtil;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.EXIT;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructExtendedListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_CURRENT_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.UNHANDLED_PARSED_DATA;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil.getValidIdentifier;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.validateCardinalityMaxOne;
+import static org.onosproject.yang.compiler.translator.tojava.YangDataModelFactory.getYangCaseNode;
+
+/*
+ * Reference: RFC6020 and YANG ANTLR Grammar
+ *
+ * ABNF grammar as per RFC6020
+ *  case-stmt           = case-keyword sep identifier-arg-str optsep
+ *                        (";" /
+ *                         "{" stmtsep
+ *                             ;; these stmts can appear in any order
+ *                             [when-stmt stmtsep]
+ *                             *(if-feature-stmt stmtsep)
+ *                             [status-stmt stmtsep]
+ *                             [description-stmt stmtsep]
+ *                             [reference-stmt stmtsep]
+ *                             *(data-def-stmt stmtsep)
+ *                         "}")
+ *
+ * ANTLR grammar rule
+ * caseStatement : CASE_KEYWORD identifier (STMTEND | LEFT_CURLY_BRACE (whenStatement | ifFeatureStatement
+ *               | statusStatement | descriptionStatement | referenceStatement | dataDefStatement)* RIGHT_CURLY_BRACE);
+ */
+
+/**
+ * Represents listener based call back function corresponding to the "case" rule
+ * defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
+ */
+public final class CaseListener {
+
+    /**
+     * Create a new case listener.
+     */
+    private CaseListener() {
+    }
+
+    /**
+     * It is called when parser enters grammar rule (case), it perform
+     * validations and updates the data model tree.
+     *
+     * @param listener listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processCaseEntry(TreeWalkListener listener,
+                                        GeneratedYangParser.CaseStatementContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, CASE_DATA, ctx.identifier().getText(), ENTRY);
+
+        // Check validity of identifier and remove double quotes.
+        String identifier = getValidIdentifier(ctx.identifier().getText(), CASE_DATA, ctx);
+
+        // Validate sub statement cardinality.
+        validateSubStatementsCardinality(ctx);
+
+        Parsable curData = listener.getParsedDataStack().peek();
+
+        // Check for identifier collision
+        int line = ctx.getStart().getLine();
+        int charPositionInLine = ctx.getStart().getCharPositionInLine();
+        detectCollidingChildUtil(listener, line, charPositionInLine, identifier, CASE_DATA);
+
+        if (curData instanceof YangChoice || curData instanceof YangAugment) {
+            YangCase caseNode = getYangCaseNode(JAVA_GENERATION);
+            caseNode.setName(identifier);
+            caseNode.setLineNumber(line);
+            caseNode.setCharPosition(charPositionInLine);
+            caseNode.setFileName(listener.getFileName());
+            YangNode curNode = (YangNode) curData;
+            try {
+                curNode.addChild(caseNode);
+            } catch (DataModelException e) {
+                throw new ParserException(constructExtendedListenerErrorMessage(UNHANDLED_PARSED_DATA,
+                        CASE_DATA, ctx.identifier().getText(), ENTRY, e.getMessage()));
+            }
+            listener.getParsedDataStack().push(caseNode);
+        } else {
+            throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, CASE_DATA,
+                    ctx.identifier().getText(), ENTRY));
+        }
+    }
+
+    /**
+     * It is called when parser exits from grammar rule (case), it perform
+     * validations and update the data model tree.
+     *
+     * @param listener Listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processCaseExit(TreeWalkListener listener,
+                                       GeneratedYangParser.CaseStatementContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, CASE_DATA, ctx.identifier().getText(), EXIT);
+
+        if (listener.getParsedDataStack().peek() instanceof YangCase) {
+            listener.getParsedDataStack().pop();
+        } else {
+            throw new ParserException(constructListenerErrorMessage(MISSING_CURRENT_HOLDER, CASE_DATA,
+                    ctx.identifier().getText(), EXIT));
+        }
+    }
+
+    /**
+     * Validates the cardinality of case sub-statements as per grammar.
+     *
+     * @param ctx context object of the grammar rule
+     */
+    private static void validateSubStatementsCardinality(GeneratedYangParser.CaseStatementContext ctx) {
+
+        validateCardinalityMaxOne(ctx.whenStatement(), WHEN_DATA, CASE_DATA, ctx.identifier().getText());
+        validateCardinalityMaxOne(ctx.statusStatement(), STATUS_DATA, CASE_DATA, ctx.identifier().getText());
+        validateCardinalityMaxOne(ctx.descriptionStatement(), DESCRIPTION_DATA, CASE_DATA, ctx.identifier().getText());
+        validateCardinalityMaxOne(ctx.referenceStatement(), REFERENCE_DATA, CASE_DATA, ctx.identifier().getText());
+    }
+}
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/ChoiceListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/ChoiceListener.java
new file mode 100644
index 0000000..cc078bf
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/ChoiceListener.java
@@ -0,0 +1,206 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.onosproject.yang.compiler.datamodel.YangAugment;
+import org.onosproject.yang.compiler.datamodel.YangCase;
+import org.onosproject.yang.compiler.datamodel.YangChoice;
+import org.onosproject.yang.compiler.datamodel.YangContainer;
+import org.onosproject.yang.compiler.datamodel.YangGrouping;
+import org.onosproject.yang.compiler.datamodel.YangInput;
+import org.onosproject.yang.compiler.datamodel.YangList;
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangNotification;
+import org.onosproject.yang.compiler.datamodel.YangOutput;
+import org.onosproject.yang.compiler.datamodel.YangSubModule;
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.TreeWalkListener;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerCollisionDetector;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil;
+
+import static org.onosproject.yang.compiler.datamodel.utils.GeneratedLanguage.JAVA_GENERATION;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.CHOICE_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.CONFIG_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.DEFAULT_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.DESCRIPTION_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.MANDATORY_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.REFERENCE_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.STATUS_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.WHEN_DATA;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.ChoiceStatementContext;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerCollisionDetector.detectCollidingChildUtil;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.EXIT;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructExtendedListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.INVALID_CONTENT;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_CURRENT_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.UNHANDLED_PARSED_DATA;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil.getValidIdentifier;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.getParentNodeConfig;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.validateCardinalityMaxOne;
+import static org.onosproject.yang.compiler.translator.tojava.YangDataModelFactory.getYangChoiceNode;
+
+/*
+ * Reference: RFC6020 and YANG ANTLR Grammar
+ *
+ * ABNF grammar as per RFC6020
+ *  choice-stmt         = choice-keyword sep identifier-arg-str optsep
+ *                        (";" /
+ *                         "{" stmtsep
+ *                             ;; these stmts can appear in any order
+ *                             [when-stmt stmtsep]
+ *                             *(if-feature-stmt stmtsep)
+ *                             [default-stmt stmtsep]
+ *                             [config-stmt stmtsep]
+ *                             [mandatory-stmt stmtsep]
+ *                             [status-stmt stmtsep]
+ *                             [description-stmt stmtsep]
+ *                             [reference-stmt stmtsep]
+ *                             *((short-case-stmt / case-stmt) stmtsep)
+ *                         "}")
+ *
+ * ANTLR grammar rule
+ * choiceStatement : CHOICE_KEYWORD identifier (STMTEND | LEFT_CURLY_BRACE (whenStatement | ifFeatureStatement
+ *                 | defaultStatement | configStatement | mandatoryStatement | statusStatement | descriptionStatement
+ *                 | referenceStatement | shortCaseStatement | caseStatement)* RIGHT_CURLY_BRACE);
+ */
+
+/**
+ * Represents listener based call back function corresponding to the "choice"
+ * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
+ */
+public final class ChoiceListener {
+
+    /**
+     * Create a new choice listener.
+     */
+    private ChoiceListener() {
+    }
+
+    /**
+     * It is called when parser receives an input matching the grammar rule
+     * (choice), perform validations and update the data model tree.
+     *
+     * @param listener Listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processChoiceEntry(TreeWalkListener listener,
+                                          ChoiceStatementContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, CHOICE_DATA, ctx.identifier().getText(), ENTRY);
+
+        // Check validity of identifier and remove double quotes.
+        String identifier = getValidIdentifier(ctx.identifier().getText(), CHOICE_DATA, ctx);
+
+        // Validate sub statement cardinality.
+        validateSubStatementsCardinality(ctx);
+
+        Parsable curData = listener.getParsedDataStack().peek();
+
+        // Check for identifier collision
+        int line = ctx.getStart().getLine();
+        int charPositionInLine = ctx.getStart().getCharPositionInLine();
+        detectCollidingChildUtil(listener, line, charPositionInLine, identifier, CHOICE_DATA);
+
+        if (curData instanceof YangModule || curData instanceof YangSubModule || curData instanceof YangContainer
+                || curData instanceof YangList || curData instanceof YangCase || curData instanceof YangGrouping
+                || curData instanceof YangAugment || curData instanceof YangInput || curData instanceof YangOutput
+                || curData instanceof YangNotification) {
+
+            YangChoice choiceNode = getYangChoiceNode(JAVA_GENERATION);
+            choiceNode.setName(identifier);
+            choiceNode.setLineNumber(line);
+            choiceNode.setCharPosition(charPositionInLine);
+            choiceNode.setFileName(listener.getFileName());
+            /*
+             * If "config" is not specified, the default is the same as the parent
+             * schema node's "config" value.
+             */
+            if (ctx.configStatement().isEmpty()) {
+                boolean parentConfig = getParentNodeConfig(listener);
+                choiceNode.setConfig(parentConfig);
+            }
+
+            YangNode curNode = (YangNode) curData;
+            try {
+                curNode.addChild(choiceNode);
+            } catch (DataModelException e) {
+                throw new ParserException(constructExtendedListenerErrorMessage(UNHANDLED_PARSED_DATA,
+                        CHOICE_DATA, ctx.identifier().getText(), ENTRY, e.getMessage()));
+            }
+            listener.getParsedDataStack().push(choiceNode);
+        } else {
+            throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER,
+                    CHOICE_DATA, ctx.identifier().getText(), ENTRY));
+        }
+    }
+
+    /**
+     * It is called when parser exits from grammar rule (choice), it perform
+     * validations and update the data model tree.
+     *
+     * @param listener Listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processChoiceExit(TreeWalkListener listener,
+                                         ChoiceStatementContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, CHOICE_DATA, ctx.identifier().getText(), EXIT);
+
+        if (listener.getParsedDataStack().peek() instanceof YangChoice) {
+            YangChoice choiceNode = (YangChoice) listener.getParsedDataStack().peek();
+            try {
+                choiceNode.validateDataOnExit();
+            } catch (DataModelException e) {
+                throw new ParserException(constructListenerErrorMessage(INVALID_CONTENT, CHOICE_DATA,
+                                                                        ctx.identifier().getText(), EXIT));
+            }
+            listener.getParsedDataStack().pop();
+        } else {
+            throw new ParserException(constructListenerErrorMessage(MISSING_CURRENT_HOLDER, CHOICE_DATA,
+                    ctx.identifier().getText(), EXIT));
+        }
+    }
+
+    /**
+     * Validates the cardinality of choice sub-statements as per grammar.
+     *
+     * @param ctx context object of the grammar rule.
+     */
+    private static void validateSubStatementsCardinality(ChoiceStatementContext ctx) {
+
+        validateCardinalityMaxOne(ctx.whenStatement(), WHEN_DATA, CHOICE_DATA, ctx.identifier().getText());
+        validateCardinalityMaxOne(ctx.defaultStatement(), DEFAULT_DATA, CHOICE_DATA, ctx.identifier().getText());
+        validateCardinalityMaxOne(ctx.configStatement(), CONFIG_DATA, CHOICE_DATA, ctx.identifier().getText());
+        validateCardinalityMaxOne(ctx.mandatoryStatement(), MANDATORY_DATA, CHOICE_DATA, ctx.identifier().getText());
+        validateCardinalityMaxOne(ctx.statusStatement(), STATUS_DATA, CHOICE_DATA, ctx.identifier().getText());
+        validateCardinalityMaxOne(ctx.descriptionStatement(), DESCRIPTION_DATA, CHOICE_DATA,
+                                  ctx.identifier().getText());
+        validateCardinalityMaxOne(ctx.referenceStatement(), REFERENCE_DATA, CHOICE_DATA, ctx.identifier().getText());
+    }
+}
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/CompilerAnnotationListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/CompilerAnnotationListener.java
new file mode 100644
index 0000000..22a68f7
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/CompilerAnnotationListener.java
@@ -0,0 +1,157 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.onosproject.yang.compiler.datamodel.YangAtomicPath;
+import org.onosproject.yang.compiler.datamodel.YangCompilerAnnotation;
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangSubModule;
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.datamodel.utils.DataModelUtils;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.linker.impl.YangResolutionInfoImpl;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.TreeWalkListener;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil;
+
+import java.util.List;
+
+import static org.onosproject.yang.compiler.datamodel.utils.DataModelUtils.addResolutionInfo;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.COMPILER_ANNOTATION_DATA;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.CompilerAnnotationStatementContext;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.EXIT;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructExtendedListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_CURRENT_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.UNHANDLED_PARSED_DATA;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil.getValidAbsoluteSchemaNodeId;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil.getValidPrefix;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil.removeQuotesAndHandleConcat;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
+
+/*
+ * Reference: RFC6020 and YANG ANTLR Grammar
+ *
+ * ABNF grammar as per RFC6020
+ *   compiler-annotation-stmt = prefix:compiler-annotation-keyword string
+ *                          "{"
+ *                              [app-data-structure-stmt stmtsep]
+ *                              [app-extended-stmt stmtsep]
+ *                          "}"
+ *
+ * ANTLR grammar rule
+ *   compilerAnnotationStatement : COMPILER_ANNOTATION string LEFT_CURLY_BRACE
+ *        compilerAnnotationBodyStatement RIGHT_CURLY_BRACE;
+ *
+ *   compilerAnnotationBodyStatement : appDataStructureStatement? appExtendedStatement? ;
+ */
+
+/**
+ * Represents listener based call back function corresponding to the "compiler-annotation"
+ * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
+ */
+public final class CompilerAnnotationListener {
+
+    /**
+     * Creates a new compiler-annotation listener.
+     */
+    private CompilerAnnotationListener() {
+    }
+
+    /**
+     * Performs validation and updates the data model tree. It is called when parser receives an
+     * input matching the grammar rule(compiler-annotation).
+     *
+     * @param listener listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processCompilerAnnotationEntry(TreeWalkListener listener,
+                                                      CompilerAnnotationStatementContext ctx) {
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, COMPILER_ANNOTATION_DATA, ctx.string().getText(), ENTRY);
+        String prefix = getValidPrefix(ctx.COMPILER_ANNOTATION().getText(), COMPILER_ANNOTATION_DATA, ctx);
+
+        YangCompilerAnnotation compilerAnnotation = new YangCompilerAnnotation();
+        compilerAnnotation.setPrefix(prefix);
+        compilerAnnotation.setPath(removeQuotesAndHandleConcat(ctx.string().getText()));
+
+        compilerAnnotation.setLineNumber(ctx.getStart().getLine());
+        compilerAnnotation.setCharPosition(ctx.getStart().getCharPositionInLine());
+        compilerAnnotation.setFileName(listener.getFileName());
+        // Validate augment argument string
+        List<YangAtomicPath> targetNodes = getValidAbsoluteSchemaNodeId(ctx.string().getText(),
+                                                                        COMPILER_ANNOTATION_DATA, ctx);
+
+        compilerAnnotation.setAtomicPathList(targetNodes);
+
+        int line = ctx.getStart().getLine();
+        int charPositionInLine = ctx.getStart().getCharPositionInLine();
+
+        Parsable curData = listener.getParsedDataStack().peek();
+        if (!(curData instanceof YangModule || curData instanceof YangSubModule)) {
+            throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, COMPILER_ANNOTATION_DATA,
+                                                                    ctx.string().getText(), ENTRY));
+        }
+
+        // Add resolution information to the list
+        YangResolutionInfoImpl resolutionInfo = new YangResolutionInfoImpl<>(
+                compilerAnnotation, (YangNode) curData, line, charPositionInLine);
+        addToResolutionList(resolutionInfo, ctx);
+
+        listener.getParsedDataStack().push(compilerAnnotation);
+    }
+
+    /**
+     * Performs validation and updates the data model tree. It is called when parser
+     * exits from grammar rule (compiler-annotation).
+     *
+     * @param listener listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processCompilerAnnotationExit(TreeWalkListener listener,
+                                                     CompilerAnnotationStatementContext ctx) {
+
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, COMPILER_ANNOTATION_DATA, ctx.string().getText(), EXIT);
+        if (!(listener.getParsedDataStack().peek() instanceof YangCompilerAnnotation)) {
+            throw new ParserException(constructListenerErrorMessage(MISSING_CURRENT_HOLDER, COMPILER_ANNOTATION_DATA,
+                    ctx.string().getText(), EXIT));
+        }
+        listener.getParsedDataStack().pop();
+    }
+
+    /**
+     * Adds to resolution list.
+     *
+     * @param resolutionInfo resolution information.
+     * @param ctx            context object of the grammar rule
+     */
+    private static void addToResolutionList(YangResolutionInfoImpl<YangCompilerAnnotation> resolutionInfo,
+                                            CompilerAnnotationStatementContext ctx) {
+
+        try {
+            addResolutionInfo(resolutionInfo);
+        } catch (DataModelException e) {
+            throw new ParserException(constructExtendedListenerErrorMessage(UNHANDLED_PARSED_DATA,
+                    COMPILER_ANNOTATION_DATA, ctx.COMPILER_ANNOTATION().getText(), ENTRY, e.getMessage()));
+        }
+    }
+}
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/ConfigListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/ConfigListener.java
new file mode 100644
index 0000000..186e1c8
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/ConfigListener.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.yang.compiler.parser.impl.listeners;
+
+import org.onosproject.yang.compiler.datamodel.YangContainer;
+import org.onosproject.yang.compiler.datamodel.YangLeaf;
+import org.onosproject.yang.compiler.datamodel.YangLeafList;
+import org.onosproject.yang.compiler.datamodel.YangList;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.TreeWalkListener;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation;
+
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.CONFIG_DATA;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil.getValidBooleanValue;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
+
+/*
+ * Reference: RFC6020 and YANG ANTLR Grammar
+ *
+ * ABNF grammar as per RFC6020
+ * config-stmt         = config-keyword sep
+ *                       config-arg-str stmtend
+ * config-arg-str      = < a string that matches the rule
+ *                         config-arg >
+ * config-arg          = true-keyword / false-keyword
+ *
+ * ANTLR grammar rule
+ * configStatement : CONFIG_KEYWORD config STMTEND;
+ * config          : string;
+ */
+
+/**
+ * Represents listener based call back function corresponding to the "config"
+ * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
+ */
+public final class ConfigListener {
+
+    /**
+     * Creates a new config listener.
+     */
+    private ConfigListener() {
+    }
+
+    /**
+     * It is called when parser receives an input matching the grammar rule
+     * (config), performs validation and updates the data model tree.
+     *
+     * @param listener listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processConfigEntry(TreeWalkListener listener,
+                                          GeneratedYangParser.ConfigStatementContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, CONFIG_DATA, "", ENTRY);
+
+        boolean isConfig = getValidBooleanValue(ctx.config().getText(), CONFIG_DATA, ctx);
+
+        Parsable tmpData = listener.getParsedDataStack().peek();
+        switch (tmpData.getYangConstructType()) {
+            case LEAF_DATA:
+                YangLeaf leaf = (YangLeaf) tmpData;
+                leaf.setConfig(isConfig);
+                break;
+            case CONTAINER_DATA:
+                YangContainer container = (YangContainer) tmpData;
+                container.setConfig(isConfig);
+                break;
+            case LEAF_LIST_DATA:
+                YangLeafList leafList = (YangLeafList) tmpData;
+                leafList.setConfig(isConfig);
+                break;
+            case LIST_DATA:
+                YangList yangList = (YangList) tmpData;
+                yangList.setConfig(isConfig);
+                break;
+            case CHOICE_DATA: // TODO
+                break;
+            default:
+                throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, CONFIG_DATA, "", ENTRY));
+        }
+    }
+}
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/ContactListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/ContactListener.java
new file mode 100644
index 0000000..d648e52
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/ContactListener.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.yang.compiler.parser.impl.listeners;
+
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangSubModule;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.TreeWalkListener;
+
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.CONTACT_DATA;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.ContactStatementContext;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
+
+/*
+ * Reference: RFC6020 and YANG ANTLR Grammar
+ *
+ * ABNF grammar as per RFC6020
+ * meta-stmts          = ;; these stmts can appear in any order
+ *                       [organization-stmt stmtsep]
+ *                       [contact-stmt stmtsep]
+ *                       [description-stmt stmtsep]
+ *                       [reference-stmt stmtsep]
+ * contact-stmt        = contact-keyword sep string optsep stmtend
+ *
+ * ANTLR grammar rule
+ * meta_stmts : organization_stmt? contact_stmt? description_stmt? reference_stmt?
+ *            | organization_stmt? contact_stmt? reference_stmt? description_stmt?
+ *            | organization_stmt? description_stmt? contact_stmt? reference_stmt?
+ *            | organization_stmt? description_stmt? reference_stmt? contact_stmt?
+ *            | organization_stmt? reference_stmt? contact_stmt? description_stmt?
+ *            | organization_stmt? reference_stmt? description_stmt? contact_stmt?
+ *            | contact_stmt? organization_stmt? description_stmt? reference_stmt?
+ *            | contact_stmt? organization_stmt? reference_stmt? description_stmt?
+ *            | contact_stmt? reference_stmt? organization_stmt? description_stmt?
+ *            | contact_stmt? reference_stmt? description_stmt? organization_stmt?
+ *            | contact_stmt? description_stmt? reference_stmt? organization_stmt?
+ *            | contact_stmt? description_stmt? organization_stmt? reference_stmt?
+ *            | reference_stmt? contact_stmt? organization_stmt? description_stmt?
+ *            | reference_stmt? contact_stmt? description_stmt? organization_stmt?
+ *            | reference_stmt? organization_stmt? contact_stmt? description_stmt?
+ *            | reference_stmt? organization_stmt? description_stmt? contact_stmt?
+ *            | reference_stmt? description_stmt? organization_stmt? contact_stmt?
+ *            | reference_stmt? description_stmt? contact_stmt? organization_stmt?
+ *            | description_stmt? reference_stmt? contact_stmt? organization_stmt?
+ *            | description_stmt? reference_stmt? organization_stmt? contact_stmt?
+ *            | description_stmt? contact_stmt? reference_stmt? organization_stmt?
+ *            | description_stmt? contact_stmt? organization_stmt? reference_stmt?
+ *            | description_stmt? organization_stmt? contact_stmt? reference_stmt?
+ *            | description_stmt? organization_stmt? reference_stmt? contact_stmt?
+ *            ;
+ * contact_stmt : CONTACT_KEYWORD string STMTEND;
+ */
+
+/**
+ * Represents listener based call back function corresponding to the "contact"
+ * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
+ */
+public final class ContactListener {
+
+    /**
+     * Creates a new contact listener.
+     */
+    private ContactListener() {
+    }
+
+    /**
+     * It is called when parser receives an input matching the grammar rule
+     * (contact), perform validations and update the data model tree.
+     *
+     * @param listener Listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processContactEntry(TreeWalkListener listener, ContactStatementContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, CONTACT_DATA, ctx.string().getText(), ENTRY);
+
+        // Obtain the node of the stack.
+        Parsable tmpNode = listener.getParsedDataStack().peek();
+        switch (tmpNode.getYangConstructType()) {
+            case MODULE_DATA: {
+                YangModule module = (YangModule) tmpNode;
+                module.setContact(ctx.string().getText());
+                break;
+            }
+            case SUB_MODULE_DATA: {
+                YangSubModule subModule = (YangSubModule) tmpNode;
+                subModule.setContact(ctx.string().getText());
+                break;
+            }
+            default:
+                throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, CONTACT_DATA,
+                                                                        ctx.string().getText(), ENTRY));
+        }
+    }
+}
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/ContainerListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/ContainerListener.java
new file mode 100644
index 0000000..abe01fa
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/ContainerListener.java
@@ -0,0 +1,204 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.onosproject.yang.compiler.datamodel.YangAugment;
+import org.onosproject.yang.compiler.datamodel.YangCase;
+import org.onosproject.yang.compiler.datamodel.YangContainer;
+import org.onosproject.yang.compiler.datamodel.YangGrouping;
+import org.onosproject.yang.compiler.datamodel.YangInput;
+import org.onosproject.yang.compiler.datamodel.YangList;
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangNotification;
+import org.onosproject.yang.compiler.datamodel.YangOutput;
+import org.onosproject.yang.compiler.datamodel.YangSubModule;
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.TreeWalkListener;
+
+import static org.onosproject.yang.compiler.datamodel.utils.GeneratedLanguage.JAVA_GENERATION;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.CONFIG_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.CONTAINER_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.DESCRIPTION_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.PRESENCE_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.REFERENCE_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.STATUS_DATA;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.ContainerStatementContext;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerCollisionDetector.detectCollidingChildUtil;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.EXIT;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructExtendedListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_CURRENT_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.UNHANDLED_PARSED_DATA;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil.getValidIdentifier;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.getParentNodeConfig;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.validateCardinalityMaxOne;
+import static org.onosproject.yang.compiler.translator.tojava.YangDataModelFactory.getYangContainerNode;
+
+/*
+ * Reference: RFC6020 and YANG ANTLR Grammar
+ *
+ * ABNF grammar as per RFC6020
+ *  container-stmt      = container-keyword sep identifier-arg-str optsep
+ *                        (";" /
+ *                         "{" stmtsep
+ *                             ;; these stmts can appear in any order
+ *                             [when-stmt stmtsep]
+ *                             *(if-feature-stmt stmtsep)
+ *                             *(must-stmt stmtsep)
+ *                             [presence-stmt stmtsep]
+ *                             [config-stmt stmtsep]
+ *                             [status-stmt stmtsep]
+ *                             [description-stmt stmtsep]
+ *                             [reference-stmt stmtsep]
+ *                             *((typedef-stmt /
+ *                                grouping-stmt) stmtsep)
+ *                             *(data-def-stmt stmtsep)
+ *                         "}")
+ *
+ * ANTLR grammar rule
+ *  containerStatement : CONTAINER_KEYWORD identifier
+ *                   (STMTEND | LEFT_CURLY_BRACE (whenStatement | ifFeatureStatement | mustStatement |
+ *                   presenceStatement | configStatement | statusStatement | descriptionStatement |
+ *                   referenceStatement | typedefStatement | groupingStatement
+ *                    | dataDefStatement)* RIGHT_CURLY_BRACE);
+ */
+
+/**
+ * Represents listener based call back function corresponding to the "container"
+ * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
+ */
+public final class ContainerListener {
+
+    /**
+     * Creates a new container listener.
+     */
+    private ContainerListener() {
+    }
+
+    /**
+     * It is called when parser receives an input matching the grammar rule
+     * (container), performs validation and updates the data model tree.
+     *
+     * @param listener listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processContainerEntry(TreeWalkListener listener,
+                                             ContainerStatementContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, CONTAINER_DATA, ctx.identifier().getText(), ENTRY);
+
+        String identifier = getValidIdentifier(ctx.identifier().getText(), CONTAINER_DATA, ctx);
+
+        // Validate sub statement cardinality.
+        validateSubStatementsCardinality(ctx);
+
+        // Check for identifier collision
+        int line = ctx.getStart().getLine();
+        int charPositionInLine = ctx.getStart().getCharPositionInLine();
+        detectCollidingChildUtil(listener, line, charPositionInLine, identifier, CONTAINER_DATA);
+
+        YangContainer container = getYangContainerNode(JAVA_GENERATION);
+        container.setName(identifier);
+
+        container.setLineNumber(line);
+        container.setCharPosition(charPositionInLine);
+        container.setFileName(listener.getFileName());
+        /*
+         * If "config" is not specified, the default is the same as the parent
+         * schema node's "config" value.
+         */
+        if (ctx.configStatement().isEmpty()) {
+            boolean parentConfig = getParentNodeConfig(listener);
+            container.setConfig(parentConfig);
+        }
+
+        Parsable curData = listener.getParsedDataStack().peek();
+        if (curData instanceof YangModule || curData instanceof YangSubModule
+                || curData instanceof YangContainer || curData instanceof YangList
+                || curData instanceof YangCase || curData instanceof YangNotification
+                || curData instanceof YangInput || curData instanceof YangOutput
+                || curData instanceof YangAugment || curData instanceof YangGrouping) {
+            YangNode curNode = (YangNode) curData;
+            try {
+                curNode.addChild(container);
+            } catch (DataModelException e) {
+                throw new ParserException(constructExtendedListenerErrorMessage(
+                        UNHANDLED_PARSED_DATA, CONTAINER_DATA,
+                        ctx.identifier().getText(), ENTRY, e.getMessage()));
+            }
+            listener.getParsedDataStack().push(container);
+        } else {
+            throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, CONTAINER_DATA,
+                                                                    ctx.identifier().getText(), ENTRY));
+        }
+    }
+
+    /**
+     * It is called when parser exits from grammar rule (container), it perform
+     * validations and updates the data model tree.
+     *
+     * @param listener listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processContainerExit(TreeWalkListener listener,
+                                            ContainerStatementContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, CONTAINER_DATA, ctx.identifier().getText(), EXIT);
+
+        if (listener.getParsedDataStack().peek() instanceof YangContainer) {
+            YangContainer yangContainer = (YangContainer) listener.getParsedDataStack().peek();
+            try {
+                yangContainer.validateDataOnExit();
+            } catch (DataModelException e) {
+                ParserException parserException = new ParserException(constructExtendedListenerErrorMessage(
+                        UNHANDLED_PARSED_DATA, CONTAINER_DATA, ctx.identifier().getText(), EXIT, e.getMessage()));
+                parserException.setLine(ctx.getStart().getLine());
+                parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
+                throw parserException;
+            }
+            listener.getParsedDataStack().pop();
+        } else {
+            throw new ParserException(constructListenerErrorMessage(MISSING_CURRENT_HOLDER, CONTAINER_DATA,
+                                                                    ctx.identifier().getText(), EXIT));
+        }
+    }
+
+    /**
+     * Validates the cardinality of container sub-statements as per grammar.
+     *
+     * @param ctx context object of the grammar rule
+     */
+    private static void validateSubStatementsCardinality(ContainerStatementContext ctx) {
+
+        validateCardinalityMaxOne(ctx.presenceStatement(), PRESENCE_DATA, CONTAINER_DATA, ctx.identifier().getText());
+        validateCardinalityMaxOne(ctx.configStatement(), CONFIG_DATA, CONTAINER_DATA, ctx.identifier().getText());
+        validateCardinalityMaxOne(ctx.descriptionStatement(), DESCRIPTION_DATA, CONTAINER_DATA,
+                                  ctx.identifier().getText());
+        validateCardinalityMaxOne(ctx.referenceStatement(), REFERENCE_DATA, CONTAINER_DATA, ctx.identifier().getText());
+        validateCardinalityMaxOne(ctx.statusStatement(), STATUS_DATA, CONTAINER_DATA, ctx.identifier().getText());
+        // TODO validate 'when' cardinality
+    }
+}
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/DataStructureKeyListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/DataStructureKeyListener.java
new file mode 100644
index 0000000..eed8185
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/DataStructureKeyListener.java
@@ -0,0 +1,93 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.onosproject.yang.compiler.datamodel.YangAppDataStructure;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.TreeWalkListener;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil;
+
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.KEY_DATA;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.DataStructureKeyStatementContext;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil.removeQuotesAndHandleConcat;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
+import static org.onosproject.yang.compiler.utils.UtilConstants.SPACE;
+
+/*
+ * Reference: RFC6020 and YANG ANTLR Grammar
+ *
+ * ABNF grammar as per RFC6020
+ *   data-structure-key-stmt = prefix:key-keyword string ";"
+ *
+ * ANTLR grammar rule
+ *   dataStructureKeyStatement : DATA_STRUCTURE_KEY string STMTEND;
+ */
+
+/**
+ * Represents listener based call back function corresponding to the "key"
+ * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
+ */
+public final class DataStructureKeyListener {
+
+    /**
+     * Creates a new data-structure-key listener.
+     */
+    private DataStructureKeyListener() {
+    }
+
+    /**
+     * Performs validation and updates the data model tree. It is called when parser receives an
+     * input matching the grammar rule(key).
+     *
+     * @param listener listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processDataStructureKeyEntry(TreeWalkListener listener,
+                                                    DataStructureKeyStatementContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, KEY_DATA, ctx.string().getText(), ENTRY);
+
+        Parsable tmpData = listener.getParsedDataStack().peek();
+        if (listener.getParsedDataStack().peek() instanceof YangAppDataStructure) {
+            YangAppDataStructure dataStructure = (YangAppDataStructure) tmpData;
+
+            dataStructure.setLineNumber(ctx.getStart().getLine());
+            dataStructure.setCharPosition(ctx.getStart().getCharPositionInLine());
+            dataStructure.setFileName(listener.getFileName());
+            String tmpKeyValue = removeQuotesAndHandleConcat(ctx.string().getText());
+            if (tmpKeyValue.contains(SPACE)) {
+                String[] keyValues = tmpKeyValue.split(SPACE);
+                for (String keyValue : keyValues) {
+                    dataStructure.addKey(keyValue);
+                }
+            } else {
+                dataStructure.addKey(tmpKeyValue);
+            }
+        } else {
+            throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, KEY_DATA, ctx.string().getText(),
+                    ENTRY));
+        }
+    }
+}
+
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/Decimal64Listener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/Decimal64Listener.java
new file mode 100644
index 0000000..5ebd7f1
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/Decimal64Listener.java
@@ -0,0 +1,153 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+/*
+ * Reference: RFC6020 and YANG ANTLR Grammar
+ *
+ * ABNF grammar as per RFC6020
+ * type-body-stmts     = numerical-restrictions /
+ *                       decimal64-specification /
+ *                       string-restrictions /
+ *                       enum-specification /
+ *                       leafref-specification /
+ *                       identityref-specification /
+ *                       instance-identifier-specification /
+ *                       bits-specification /
+ *                       union-specification
+ *
+ * decimal64-specification = fraction-digits-stmt [range-stmt stmtsep]
+ *
+ * fraction-digits-stmt = fraction-digits-keyword sep
+ *                         fraction-digits-arg-str stmtend
+ *
+ * fraction-digits-arg-str = < a string that matches the rule
+ *                             fraction-digits-arg >
+ *
+ * fraction-digits-arg = ("1" ["0" / "1" / "2" / "3" / "4" /
+ *                              "5" / "6" / "7" / "8"])
+ *                        / "2" / "3" / "4" / "5" / "6" / "7" / "8" / "9"
+ *
+ * range-stmt          = range-keyword sep range-arg-str optsep
+ *                        (";" /
+ *                         "{" stmtsep
+ *                             ;; these stmts can appear in any order
+ *                             [error-message-stmt stmtsep]
+ *                             [error-app-tag-stmt stmtsep]
+ *                             [description-stmt stmtsep]
+ *                             [reference-stmt stmtsep]
+ *                          "}")
+ * ANTLR grammar rule
+ *
+ * typeBodyStatements : numericalRestrictions | decimal64Specification | stringRestrictions | enumSpecification
+ *                     | leafrefSpecification | identityrefSpecification | instanceIdentifierSpecification
+ *                     | bitsSpecification | unionSpecification;
+ *
+ * decimal64Specification : fractionDigitStatement rangeStatement?;
+ *
+ * fractionDigitStatement : FRACTION_DIGITS_KEYWORD fraction STMTEND;
+ *
+ * fraction : string;
+ */
+
+import org.onosproject.yang.compiler.datamodel.YangDecimal64;
+import org.onosproject.yang.compiler.datamodel.YangRangeRestriction;
+import org.onosproject.yang.compiler.datamodel.YangType;
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.Decimal64SpecificationContext;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.TreeWalkListener;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType;
+
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.DECIMAL64_DATA;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.EXIT;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
+
+
+/**
+ * Represents listener based call back function corresponding to the "decimal64" rule
+ * defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
+ */
+public final class Decimal64Listener {
+
+    /**
+     * Creates a new Decimal64 listener.
+     */
+    private Decimal64Listener() {
+    }
+
+    /**
+     * It is called when parser enters grammar rule (decimal64), it perform
+     * validations and updates the data model tree.
+     *
+     * @param listener listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processDecimal64Entry(TreeWalkListener listener,
+                                             Decimal64SpecificationContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, DECIMAL64_DATA, "", ENTRY);
+
+        Parsable tmpNode = listener.getParsedDataStack().peek();
+        if (tmpNode instanceof YangType) {
+            YangType<YangDecimal64<YangRangeRestriction>> typeNode =
+                    (YangType<YangDecimal64<YangRangeRestriction>>) tmpNode;
+            YangDecimal64 decimal64Node = new YangDecimal64();
+            typeNode.setDataTypeExtendedInfo(decimal64Node);
+
+            decimal64Node.setLineNumber(ctx.getStart().getLine());
+            decimal64Node.setCharPosition(ctx.getStart().getCharPositionInLine());
+            decimal64Node.setFileName(listener.getFileName());
+        } else {
+            throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, DECIMAL64_DATA, "", ENTRY));
+        }
+    }
+
+    /**
+     * Performs validation and updates the data model tree.
+     * It is called when parser exits from grammar rule (decimal64).
+     *
+     * @param listener listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processDecimal64Exit(TreeWalkListener listener,
+                                            Decimal64SpecificationContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, DECIMAL64_DATA, "", EXIT);
+
+        Parsable tmpNode = listener.getParsedDataStack().peek();
+        if (tmpNode instanceof YangType) {
+            YangType<YangDecimal64<YangRangeRestriction>> typeNode =
+                    (YangType<YangDecimal64<YangRangeRestriction>>) tmpNode;
+            YangDecimal64<YangRangeRestriction> decimal64Node = typeNode.getDataTypeExtendedInfo();
+            try {
+                decimal64Node.validateRange();
+            } catch (DataModelException e) {
+                throw new ParserException(e);
+            }
+        } else {
+            throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, DECIMAL64_DATA, "", EXIT));
+        }
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/DefaultListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/DefaultListener.java
new file mode 100644
index 0000000..0000aff
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/DefaultListener.java
@@ -0,0 +1,104 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+/*
+ * Reference: RFC6020 and YANG ANTLR Grammar
+ *
+ * typedef-stmt        = typedef-keyword sep identifier-arg-str optsep
+ *                       "{" stmtsep
+ *                           ;; these stmts can appear in any order
+ *                           type-stmt stmtsep
+ *                          [units-stmt stmtsep]
+ *                           [default-stmt stmtsep]
+ *                           [status-stmt stmtsep]
+ *                           [description-stmt stmtsep]
+ *                           [reference-stmt stmtsep]
+ *                         "}"
+ * default-stmt        = default-keyword sep string stmtend
+
+ *
+ * ANTLR grammar rule
+ * typedefStatement : TYPEDEF_KEYWORD IDENTIFIER LEFT_CURLY_BRACE
+ *                (typeStatement | unitsStatement | defaultStatement | statusStatement
+ *                | descriptionStatement | referenceStatement)* RIGHT_CURLY_BRACE;
+ * defaultStatement : DEFAULT_KEYWORD string STMTEND;
+ */
+
+import org.onosproject.yang.compiler.datamodel.YangChoice;
+import org.onosproject.yang.compiler.datamodel.YangLeaf;
+import org.onosproject.yang.compiler.datamodel.YangTypeDef;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.TreeWalkListener;
+
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.DEFAULT_DATA;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.DefaultStatementContext;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil.removeQuotesAndHandleConcat;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
+
+/**
+ * Represents listener for default YANG statement.
+ */
+public final class DefaultListener {
+
+    /**
+     * Creates a new default listener.
+     */
+    private DefaultListener() {
+    }
+
+    /**
+     * It is called when parser enters grammar rule (default), it perform
+     * validations and updates the data model tree.
+     *
+     * @param listener listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processDefaultEntry(TreeWalkListener listener,
+                                           DefaultStatementContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, DEFAULT_DATA, ctx.string().getText(), ENTRY);
+
+        Parsable tmpNode = listener.getParsedDataStack().peek();
+        switch (tmpNode.getYangConstructType()) {
+            case TYPEDEF_DATA: {
+                YangTypeDef typeDef = (YangTypeDef) tmpNode;
+                typeDef.setDefaultValueInString(removeQuotesAndHandleConcat(ctx.string().getText()));
+                break;
+            }
+            case LEAF_DATA: {
+                YangLeaf leaf = (YangLeaf) tmpNode;
+                leaf.setDefaultValueInString(removeQuotesAndHandleConcat(ctx.string().getText()));
+                break;
+            }
+            case CHOICE_DATA: {
+                YangChoice choice = (YangChoice) tmpNode;
+                choice.setDefaultValueInString(removeQuotesAndHandleConcat(ctx.string().getText()));
+                break;
+            }
+            default:
+                throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER,
+                                                                        DEFAULT_DATA, ctx.string().getText(), ENTRY));
+        }
+    }
+}
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/DescriptionListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/DescriptionListener.java
new file mode 100644
index 0000000..fdc5cc4
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/DescriptionListener.java
@@ -0,0 +1,77 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.onosproject.yang.compiler.datamodel.YangDesc;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.TreeWalkListener;
+
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.DESCRIPTION_DATA;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.DescriptionStatementContext;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
+
+/*
+ * Reference: RFC6020 and YANG ANTLR Grammar
+ *
+ * ABNF grammar as per RFC6020
+ * description-stmt    = description-keyword sep string optsep stmtend
+ *
+ * ANTLR grammar rule
+ * descriptionStatement : DESCRIPTION_KEYWORD string STMTEND;
+ */
+
+/**
+ * Represents listener based call back function corresponding to the
+ * "description" rule defined in ANTLR grammar file for corresponding ABNF rule
+ * in RFC 6020.
+ */
+public final class DescriptionListener {
+
+    /**
+     * Creates a new description listener.
+     */
+    private DescriptionListener() {
+    }
+
+    /**
+     * It is called when parser receives an input matching the grammar rule
+     * (description), perform validations and updates the data model tree.
+     *
+     * @param listener listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processDescriptionEntry(TreeWalkListener listener,
+                                               DescriptionStatementContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, DESCRIPTION_DATA, ctx.string().getText(), ENTRY);
+
+        Parsable tmpData = listener.getParsedDataStack().peek();
+        if (tmpData instanceof YangDesc) {
+            YangDesc description = (YangDesc) tmpData;
+            description.setDescription(ctx.string().getText());
+        } else {
+            throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, DESCRIPTION_DATA,
+                                                                    ctx.string().getText(), ENTRY));
+        }
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/EnumListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/EnumListener.java
new file mode 100644
index 0000000..46f2e86
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/EnumListener.java
@@ -0,0 +1,191 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+/*
+ * Reference: RFC6020 and YANG ANTLR Grammar
+ *
+ * ABNF grammar as per RFC6020
+ *  enum-stmt           = enum-keyword sep string optsep
+ *                        (";" /
+ *                         "{" stmtsep
+ *                             ;; these stmts can appear in any order
+ *                             [value-stmt stmtsep]
+ *                             [status-stmt stmtsep]
+ *                             [description-stmt stmtsep]
+ *                             [reference-stmt stmtsep]
+ *                          "}")
+ *
+ * ANTLR grammar rule
+ * enumStatement : ENUM_KEYWORD string (STMTEND | LEFT_CURLY_BRACE enumStatementBody RIGHT_CURLY_BRACE);
+ *
+ *         enumStatementBody : valueStatement? statusStatement? descriptionStatement? referenceStatement?
+ *         | valueStatement? statusStatement? referenceStatement? descriptionStatement?
+ *         | valueStatement? descriptionStatement? statusStatement? referenceStatement?
+ *         | valueStatement? descriptionStatement? referenceStatement? statusStatement?
+ *         | valueStatement? referenceStatement? statusStatement? descriptionStatement?
+ *         | valueStatement? referenceStatement? descriptionStatement? statusStatement?
+ *         | statusStatement? valueStatement? descriptionStatement? referenceStatement?
+ *         | statusStatement? valueStatement? referenceStatement? descriptionStatement?
+ *         | statusStatement? descriptionStatement? descriptionStatement? valueStatement?
+ *         | statusStatement? descriptionStatement? valueStatement? descriptionStatement?
+ *         | statusStatement? referenceStatement? valueStatement? descriptionStatement?
+ *         | statusStatement? referenceStatement? descriptionStatement? valueStatement?
+ *         | descriptionStatement? valueStatement? statusStatement? referenceStatement?
+ *         | descriptionStatement? valueStatement? referenceStatement? statusStatement?
+ *         | descriptionStatement? statusStatement? valueStatement? referenceStatement?
+ *         | descriptionStatement? statusStatement? referenceStatement? valueStatement?
+ *         | descriptionStatement? referenceStatement? valueStatement? statusStatement?
+ *         | descriptionStatement? referenceStatement? statusStatement? valueStatement?
+ *         | referenceStatement? valueStatement? descriptionStatement? statusStatement?
+ *         | referenceStatement? valueStatement? statusStatement? descriptionStatement?
+ *         | referenceStatement? statusStatement? descriptionStatement? valueStatement?
+ *         | referenceStatement? statusStatement? valueStatement? descriptionStatement?
+ *         | referenceStatement? descriptionStatement? valueStatement? statusStatement?
+ *         | referenceStatement? descriptionStatement? statusStatement? valueStatement?
+ *         ;
+ */
+
+import org.onosproject.yang.compiler.datamodel.YangEnum;
+import org.onosproject.yang.compiler.datamodel.YangEnumeration;
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.TreeWalkListener;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType;
+
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.ENUM_DATA;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.EnumStatementContext;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.EXIT;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructExtendedListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.DUPLICATE_ENTRY;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_CURRENT_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
+import static org.onosproject.yang.compiler.utils.UtilConstants.EMPTY_STRING;
+import static org.onosproject.yang.compiler.utils.UtilConstants.QUOTES;
+
+/**
+ * Represents listener based call back function corresponding to the "enum" rule
+ * defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
+ */
+public final class EnumListener {
+
+    /**
+     * Creates a new enum listener.
+     */
+    private EnumListener() {
+    }
+
+    /**
+     * It is called when parser enters grammar rule (enum), it perform
+     * validations and updates the data model tree.
+     *
+     * @param listener listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processEnumEntry(TreeWalkListener listener, EnumStatementContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, ENUM_DATA, ctx.string().getText(), ENTRY);
+
+        YangEnum enumNode = new YangEnum();
+        enumNode.setNamedValue(getValidNamedValue(ctx.string().getText()));
+
+        enumNode.setLineNumber(ctx.getStart().getLine());
+        enumNode.setCharPosition(ctx.getStart().getCharPositionInLine());
+        enumNode.setFileName(listener.getFileName());
+        listener.getParsedDataStack().push(enumNode);
+    }
+
+    /*Removes quotes from the enum name if present.*/
+    private static String getValidNamedValue(String name) {
+        if (name.contains(QUOTES)) {
+            name = name.replace(QUOTES, EMPTY_STRING);
+        }
+        return name;
+    }
+
+    /**
+     * It is called when parser exits from grammar rule (enum), it perform
+     * validations and update the data model tree.
+     *
+     * @param listener Listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processEnumExit(TreeWalkListener listener, EnumStatementContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, ENUM_DATA, ctx.string().getText(), EXIT);
+
+        Parsable tmpEnumNode = listener.getParsedDataStack().peek();
+        if (tmpEnumNode instanceof YangEnum) {
+            listener.getParsedDataStack().pop();
+
+            // Check for stack to be non empty.
+            checkStackIsNotEmpty(listener, MISSING_HOLDER, ENUM_DATA, ctx.string().getText(), EXIT);
+
+            Parsable tmpNode = listener.getParsedDataStack().peek();
+            switch (tmpNode.getYangConstructType()) {
+                case ENUMERATION_DATA: {
+                    YangEnumeration yangEnumeration = (YangEnumeration) tmpNode;
+                    if (ctx.enumStatementBody() == null || ctx.enumStatementBody().valueStatement() == null) {
+                        int maxValue = 0;
+                        boolean isValuePresent = false;
+
+                        for (YangEnum curEnum : yangEnumeration.getEnumSet()) {
+                            if (curEnum.getValue() == Integer.MAX_VALUE) {
+                                ParserException parserException = new ParserException("YANG file error : "
+                                                                                              + "An enum value MUST be specified for enum substatements following the one"
+                                                                                              + "with the current highest value");
+                                parserException.setLine(ctx.getStart().getLine());
+                                parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
+                                throw parserException;
+                            } else if (maxValue <= curEnum.getValue()) {
+                                maxValue = curEnum.getValue();
+                                isValuePresent = true;
+                            }
+                        }
+                        if (isValuePresent) {
+                            maxValue++;
+                        }
+                        ((YangEnum) tmpEnumNode).setValue(maxValue);
+                    }
+                    try {
+                        yangEnumeration.addEnumInfo((YangEnum) tmpEnumNode);
+                    } catch (DataModelException e) {
+                        ParserException parserException = new ParserException(constructExtendedListenerErrorMessage(
+                                DUPLICATE_ENTRY, ENUM_DATA, ctx.string().getText(), EXIT, e.getMessage()));
+                        parserException.setLine(ctx.getStart().getLine());
+                        parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
+                        throw parserException;
+                    }
+                    break;
+                }
+                default:
+                    throw new ParserException(
+                            constructListenerErrorMessage(INVALID_HOLDER, ENUM_DATA, ctx.string().getText(), EXIT));
+            }
+        } else {
+            throw new ParserException(
+                    constructListenerErrorMessage(MISSING_CURRENT_HOLDER, ENUM_DATA, ctx.string().getText(), EXIT));
+        }
+    }
+}
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/EnumerationListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/EnumerationListener.java
new file mode 100644
index 0000000..c73ea68
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/EnumerationListener.java
@@ -0,0 +1,227 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+/*
+ * Reference: RFC6020 and YANG ANTLR Grammar
+ *
+ * ABNF grammar as per RFC6020
+ * type-body-stmts     = numerical-restrictions /
+ *                       decimal64-specification /
+ *                      string-restrictions /
+ *                       enum-specification /
+ *                       leafref-specification /
+ *                       identityref-specification /
+ *                       instance-identifier-specification /
+ *                       bits-specification /
+ *                       union-specification
+ *
+ * enum-specification  = 1*(enum-stmt stmtsep)
+ *
+ * ANTLR grammar rule
+ *
+ * typeBodyStatements : numericalRestrictions | stringRestrictions | enumSpecification
+ *                 | leafrefSpecification | identityrefSpecification | instanceIdentifierSpecification
+ *                 | bitsSpecification | unionSpecification;
+ *
+ * enumSpecification : enumStatement+;
+ */
+
+import org.onosproject.yang.compiler.datamodel.YangEnumeration;
+import org.onosproject.yang.compiler.datamodel.YangLeaf;
+import org.onosproject.yang.compiler.datamodel.YangLeafList;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangType;
+import org.onosproject.yang.compiler.datamodel.YangTypeDef;
+import org.onosproject.yang.compiler.datamodel.YangUnion;
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.EnumSpecificationContext;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.TreeWalkListener;
+
+import static org.onosproject.yang.compiler.datamodel.utils.GeneratedLanguage.JAVA_GENERATION;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.ENUMERATION_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.TYPE_DATA;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.EXIT;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructExtendedListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_CURRENT_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.UNHANDLED_PARSED_DATA;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
+import static org.onosproject.yang.compiler.translator.tojava.YangDataModelFactory.getYangEnumerationNode;
+
+/**
+ * Represents listener based call back function corresponding to the
+ * "enumeration" rule defined in ANTLR grammar file for corresponding ABNF rule
+ * in RFC 6020.
+ */
+public final class EnumerationListener {
+
+    /**
+     * Suffix to be used while creating enumeration class.
+     */
+    private static final String ENUMERATION_CLASS_SUFFIX = "_enum";
+
+    /**
+     * Creates a new enumeration listener.
+     */
+    private EnumerationListener() {
+    }
+
+    /**
+     * It is called when parser enters grammar rule (enumeration), it perform
+     * validations and updates the data model tree.
+     *
+     * @param listener listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processEnumerationEntry(TreeWalkListener listener,
+                                               EnumSpecificationContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, ENUMERATION_DATA, "", ENTRY);
+
+        if (listener.getParsedDataStack().peek() instanceof YangType) {
+            YangEnumeration enumerationNode = getYangEnumerationNode(JAVA_GENERATION);
+            enumerationNode.setLineNumber(ctx.getStart().getLine());
+            enumerationNode.setCharPosition(ctx.getStart().getCharPositionInLine());
+            enumerationNode.setFileName(listener.getFileName());
+            Parsable typeData = listener.getParsedDataStack().pop();
+
+            // Check for stack to be non empty.
+            checkStackIsNotEmpty(listener, MISSING_HOLDER, ENUMERATION_DATA, "", ENTRY);
+
+            Parsable tmpData = listener.getParsedDataStack().peek();
+
+            switch (tmpData.getYangConstructType()) {
+                case LEAF_DATA:
+                    // Set the name of enumeration same as leaf.
+                    enumerationNode.setName(((YangLeaf) tmpData).getName() + ENUMERATION_CLASS_SUFFIX);
+                    // Pop the stack entry to obtain the parent YANG node.
+                    Parsable leaf = listener.getParsedDataStack().pop();
+                    // Add the enumeration node to the parent holder of leaf.
+                    addChildToParentNode(listener, enumerationNode);
+                    // Push the popped entry back to the stack.
+                    listener.getParsedDataStack().push(leaf);
+                    break;
+                case LEAF_LIST_DATA:
+                    // Set the name of enumeration same as leaf list.
+                    enumerationNode.setName(((YangLeafList) tmpData).getName() + ENUMERATION_CLASS_SUFFIX);
+                    // Pop the stack entry to obtain the parent YANG node.
+                    Parsable leafList = listener.getParsedDataStack().pop();
+                    // Add the enumeration node to the parent holder of leaf.
+                    addChildToParentNode(listener, enumerationNode);
+                    // Push the popped entry back to the stack.
+                    listener.getParsedDataStack().push(leafList);
+                    break;
+                case UNION_DATA:
+                    YangUnion yangUnion = (YangUnion) tmpData;
+                    /*
+                     * In case parent of enumeration is a union, name of the
+                     * enumeration is parent union name suffixed with running
+                     * integer number, this is done because under union there
+                     * could be multiple child union types.
+                     */
+                    enumerationNode.setName(yangUnion.getName() + ENUMERATION_CLASS_SUFFIX
+                                                    + yangUnion.getChildUnionNumber());
+                    // Increment the running number.
+                    yangUnion.setChildUnionNumber(yangUnion.getChildUnionNumber() + 1);
+                    // Add union as a child to parent union.
+                    addChildToParentNode(listener, enumerationNode);
+                    break;
+                case TYPEDEF_DATA:
+                    YangTypeDef typeDef = (YangTypeDef) tmpData;
+                    // Set the name of enumeration same as typedef name.
+                    enumerationNode.setName(typeDef.getName() + ENUMERATION_CLASS_SUFFIX);
+                    // Add enumeration as a child to parent type def.
+                    addChildToParentNode(listener, enumerationNode);
+                    break;
+                // TODO deviate.
+                default:
+                    throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, TYPE_DATA,
+                                                                            ((YangType<?>) typeData).getDataTypeName(), ENTRY));
+            }
+            listener.getParsedDataStack().push(typeData);
+            listener.getParsedDataStack().push(enumerationNode);
+        } else {
+            throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, ENUMERATION_DATA, "", ENTRY));
+        }
+    }
+
+    /**
+     * It is called when parser exits from grammar rule (enumeration), it
+     * perform validations and update the data model tree.
+     *
+     * @param listener Listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processEnumerationExit(TreeWalkListener listener,
+                                              EnumSpecificationContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, ENUMERATION_DATA, "", EXIT);
+
+        Parsable tmpEnumerationNode = listener.getParsedDataStack().peek();
+        if (tmpEnumerationNode instanceof YangEnumeration) {
+            YangEnumeration enumerationNode = (YangEnumeration) tmpEnumerationNode;
+            listener.getParsedDataStack().pop();
+
+            // Check for stack to be non empty.
+            checkStackIsNotEmpty(listener, MISSING_HOLDER, ENUMERATION_DATA, "", EXIT);
+
+            Parsable tmpNode = listener.getParsedDataStack().peek();
+            switch (tmpNode.getYangConstructType()) {
+                case TYPE_DATA: {
+                    YangType<YangEnumeration> typeNode = (YangType<YangEnumeration>) tmpNode;
+                    typeNode.setDataTypeExtendedInfo(enumerationNode);
+                    break;
+                }
+                default:
+                    throw new ParserException(
+                            constructListenerErrorMessage(INVALID_HOLDER, ENUMERATION_DATA, "", EXIT));
+            }
+        } else {
+            throw new ParserException(
+                    constructListenerErrorMessage(MISSING_CURRENT_HOLDER, ENUMERATION_DATA, "", EXIT));
+        }
+    }
+
+    /**
+     * Adds the enumeration node to the parent holder.
+     *
+     * @param listener        listener's object
+     * @param enumerationNode enumeration node which needs to be added to parent
+     */
+    private static void addChildToParentNode(TreeWalkListener listener, YangEnumeration enumerationNode) {
+        if (!(listener.getParsedDataStack().peek() instanceof YangNode)) {
+            throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, ENUMERATION_DATA,
+                                                                    "", ENTRY));
+        } else {
+            YangNode curNode = (YangNode) listener.getParsedDataStack().peek();
+            try {
+                curNode.addChild(enumerationNode);
+            } catch (DataModelException e) {
+                throw new ParserException(constructExtendedListenerErrorMessage(
+                        UNHANDLED_PARSED_DATA, ENUMERATION_DATA, "", ENTRY, e.getMessage()));
+            }
+        }
+    }
+}
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/ErrorAppTagListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/ErrorAppTagListener.java
new file mode 100644
index 0000000..6c2c05f
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/ErrorAppTagListener.java
@@ -0,0 +1,87 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.onosproject.yang.compiler.datamodel.YangAppErrorHolder;
+import org.onosproject.yang.compiler.datamodel.YangAppErrorInfo;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.TreeWalkListener;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil;
+
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.ERROR_APP_TAG_DATA;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.ErrorAppTagStatementContext;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil.removeQuotesAndHandleConcat;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
+
+/*
+ * Reference: RFC 6020 and YANG ANTLR Grammar
+ *
+ * ABNF grammar as per RFC 6020
+ *
+ *  error-app-tag-stmt  = error-app-tag-keyword sep string stmtend
+ *
+ * ANTLR grammar rule
+ * errorAppTagStatement : ERROR_APP_TAG_KEYWORD string STMTEND;
+ */
+
+/**
+ * Represents listener based call back function corresponding to the
+ * error app tag defined in ANTLR grammar file for corresponding ABNF rule
+ * in RFC 6020.
+ */
+public final class ErrorAppTagListener {
+
+    /**
+     * Creates a new error app tag listener.
+     */
+    private ErrorAppTagListener() {
+    }
+
+    /**
+     * Performs validations and updates the data model tree. It is called when parser
+     * receives an input matching the grammar rule error app tag.
+     *
+     * @param listener listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processErrorAppTagMessageEntry(TreeWalkListener listener,
+                                                      ErrorAppTagStatementContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, ERROR_APP_TAG_DATA, ctx.string().getText(), ENTRY);
+        String errorMessage = removeQuotesAndHandleConcat(ctx.string().getText());
+        // Obtain the node of the stack.
+        Parsable tmpNode = listener.getParsedDataStack().peek();
+        if (tmpNode instanceof YangAppErrorHolder) {
+            YangAppErrorInfo yangAppErrorInfo = ((YangAppErrorHolder) tmpNode).getAppErrorInfo();
+            yangAppErrorInfo.setErrorAppTag(errorMessage);
+            yangAppErrorInfo.setLineNumber(ctx.getStart().getLine());
+            yangAppErrorInfo.setCharPosition(ctx.getStart().getCharPositionInLine());
+            yangAppErrorInfo.setFileName(listener.getFileName());
+        } else {
+            throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, ERROR_APP_TAG_DATA,
+                                                                    ctx.string().getText(), ENTRY));
+        }
+    }
+}
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/ErrorMessageListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/ErrorMessageListener.java
new file mode 100644
index 0000000..137502d
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/ErrorMessageListener.java
@@ -0,0 +1,86 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.onosproject.yang.compiler.datamodel.YangAppErrorHolder;
+import org.onosproject.yang.compiler.datamodel.YangAppErrorInfo;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.TreeWalkListener;
+
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.ERROR_MESSAGE_DATA;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.ErrorMessageStatementContext;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil.removeQuotesAndHandleConcat;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
+
+/*
+ * Reference: RFC6020 and YANG ANTLR Grammar
+ *
+ * ABNF grammar as per RFC6020
+ *
+ *  error-message-stmt  = error-message-keyword sep string stmtend
+ *
+ * ANTLR grammar rule
+ * errorMessageStatement : ERROR_MESSAGE_KEYWORD string STMTEND;
+ */
+
+/**
+ * Represents listener based call back function corresponding to the
+ * app error message defined in ANTLR grammar file for corresponding ABNF rule
+ * in RFC 6020.
+ */
+public final class ErrorMessageListener {
+
+    /**
+     * Creates a new must listener.
+     */
+    private ErrorMessageListener() {
+    }
+
+    /**
+     * Performs validations and updates the data model tree. It is called when parser
+     * receives an input matching the grammar rule (app error message).
+     *
+     * @param listener listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processErrorMessageEntry(TreeWalkListener listener,
+                                                ErrorMessageStatementContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, ERROR_MESSAGE_DATA, ctx.string().getText(), ENTRY);
+        String errorMessage = removeQuotesAndHandleConcat(ctx.string().getText());
+
+        // Obtain the node of the stack.
+        Parsable tmpNode = listener.getParsedDataStack().peek();
+        if (tmpNode instanceof YangAppErrorHolder) {
+            YangAppErrorInfo yangAppErrorInfo = ((YangAppErrorHolder) tmpNode).getAppErrorInfo();
+            yangAppErrorInfo.setErrorMessage(errorMessage);
+
+            yangAppErrorInfo.setLineNumber(ctx.getStart().getLine());
+            yangAppErrorInfo.setCharPosition(ctx.getStart().getCharPositionInLine());
+            yangAppErrorInfo.setFileName(listener.getFileName());
+        } else {
+            throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, ERROR_MESSAGE_DATA,
+                                                                    ctx.string().getText(), ENTRY));
+        }
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/ExtensionListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/ExtensionListener.java
new file mode 100644
index 0000000..d4d1749
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/ExtensionListener.java
@@ -0,0 +1,126 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.onosproject.yang.compiler.datamodel.YangExtension;
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangSubModule;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.TreeWalkListener;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil;
+
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.EXTENSION_DATA;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.ExtensionStatementContext;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.EXIT;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_CURRENT_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil.getValidIdentifier;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
+
+/*
+ * Reference: RFC6020 and YANG ANTLR Grammar
+ *
+ * ABNF grammar as per RFC6020
+ * extension-stmt      = extension-keyword sep identifier-arg-str optsep
+ *                       (";" /
+ *                        "{" stmtsep
+ *                            ;; these stmts can appear in any order
+ *                            [argument-stmt stmtsep]
+ *                            [status-stmt stmtsep]
+ *                            [description-stmt stmtsep]
+ *                            [reference-stmt stmtsep]
+ *                        "}")
+ *
+ * ANTLR grammar rule
+ * extensionStatement : EXTENSION_KEYWORD identifier (STMTEND | LEFT_CURLY_BRACE extensionBody RIGHT_CURLY_BRACE);
+ */
+
+/**
+ * Represents listener based call back function corresponding to the "extension"
+ * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
+ */
+public final class ExtensionListener {
+
+    /**
+     * Creates a new extension listener.
+     */
+    private ExtensionListener() {
+    }
+
+    /**
+     * Performs validation and updates the data model tree. It is called when parser
+     * receives an input matching the grammar rule (extension).
+     *
+     * @param listener listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processExtensionEntry(TreeWalkListener listener,
+                                             ExtensionStatementContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, EXTENSION_DATA, ctx.identifier().getText(), ENTRY);
+
+        String identifier = getValidIdentifier(ctx.identifier().getText(), EXTENSION_DATA, ctx);
+
+        YangExtension extension = new YangExtension();
+
+        extension.setLineNumber(ctx.getStart().getLine());
+        extension.setCharPosition(ctx.getStart().getCharPositionInLine());
+        extension.setFileName(listener.getFileName());
+        extension.setName(identifier);
+
+        Parsable curData = listener.getParsedDataStack().peek();
+        switch (curData.getYangConstructType()) {
+            case MODULE_DATA:
+                YangModule module = ((YangModule) curData);
+                module.addExtension(extension);
+                break;
+            case SUB_MODULE_DATA:
+                YangSubModule subModule = ((YangSubModule) curData);
+                subModule.addExtension(extension);
+                break;
+            default:
+                throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, EXTENSION_DATA,
+                                                                        ctx.identifier().getText(), ENTRY));
+        }
+        listener.getParsedDataStack().push(extension);
+    }
+
+    /**
+     * Performs validation and updates the data model tree. It is called when parser exits
+     * from grammar rule(extension).
+     *
+     * @param listener listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processExtensionExit(TreeWalkListener listener,
+                                            ExtensionStatementContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, EXTENSION_DATA, ctx.identifier().getText(), EXIT);
+
+        if (!(listener.getParsedDataStack().peek() instanceof YangExtension)) {
+            throw new ParserException(constructListenerErrorMessage(MISSING_CURRENT_HOLDER, EXTENSION_DATA,
+                                                                    ctx.identifier().getText(), EXIT));
+        }
+        listener.getParsedDataStack().pop();
+    }
+}
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/FeatureListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/FeatureListener.java
new file mode 100644
index 0000000..5b14c25
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/FeatureListener.java
@@ -0,0 +1,124 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+/*
+ * Reference: RFC6020 and YANG ANTLR Grammar
+ *
+ * ABNF grammar as per RFC6020
+ *  feature-stmt        = feature-keyword sep identifier-arg-str optsep
+ *                        (";" /
+ *                         "{" stmtsep
+ *                             ;; these stmts can appear in any order
+ *                             *(if-feature-stmt stmtsep)
+ *                             [status-stmt stmtsep]
+ *                             [description-stmt stmtsep]
+ *                             [reference-stmt stmtsep]
+ *                         "}")
+ *
+ *
+ *
+ * ANTLR grammar rule
+ * featureStatement : FEATURE_KEYWORD string (STMTEND | LEFT_CURLY_BRACE featureBody RIGHT_CURLY_BRACE);
+ */
+
+import org.onosproject.yang.compiler.datamodel.YangFeature;
+import org.onosproject.yang.compiler.datamodel.YangFeatureHolder;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.TreeWalkListener;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil;
+
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.FEATURE_DATA;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.FeatureStatementContext;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.EXIT;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_CURRENT_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil.getValidIdentifier;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
+
+/**
+ * Represents listener based call back function corresponding to the "feature"
+ * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
+ */
+public final class FeatureListener {
+
+    /**
+     * Creates a new feature listener.
+     */
+    private FeatureListener() {
+    }
+
+    /**
+     * Performs validation and updates the data model tree.It is called when parser receives
+     * an input matching the grammar rule (feature).
+     *
+     * @param listener listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processFeatureEntry(TreeWalkListener listener,
+                                           FeatureStatementContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, FEATURE_DATA, ctx.string().getText(), ENTRY);
+
+        String identifier = getValidIdentifier(ctx.string().getText(), FEATURE_DATA, ctx);
+
+        // Obtain the node of the stack.
+        Parsable tmpNode = listener.getParsedDataStack().peek();
+        if (tmpNode instanceof YangFeatureHolder) {
+            YangFeatureHolder featureHolder = (YangFeatureHolder) tmpNode;
+
+            YangFeature feature = new YangFeature();
+            feature.setName(identifier);
+
+            feature.setLineNumber(ctx.getStart().getLine());
+            feature.setCharPosition(ctx.getStart().getCharPositionInLine());
+            feature.setFileName(listener.getFileName());
+            featureHolder.addFeatureList(feature);
+            listener.getParsedDataStack().push(feature);
+        } else {
+            throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, FEATURE_DATA,
+                    ctx.string().getText(), ENTRY));
+        }
+    }
+
+    /**
+     * Perform validations and updates the data model tree.It is called when parser exits from
+     * grammar rule(feature).
+     *
+     * @param listener listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processFeatureExit(TreeWalkListener listener,
+                                          FeatureStatementContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, FEATURE_DATA, ctx.string().getText(), EXIT);
+
+        if (listener.getParsedDataStack().peek() instanceof YangFeature) {
+            listener.getParsedDataStack().pop();
+        } else {
+            throw new ParserException(constructListenerErrorMessage(MISSING_CURRENT_HOLDER, FEATURE_DATA,
+                    ctx.string().getText(), EXIT));
+        }
+    }
+}
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/FractionDigitsListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/FractionDigitsListener.java
new file mode 100644
index 0000000..ae68da0
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/FractionDigitsListener.java
@@ -0,0 +1,130 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+/*
+ * Reference: RFC6020 and YANG ANTLR Grammar
+ *
+ * ABNF grammar as per RFC6020
+ * decimal64-specification = fraction-digits-stmt
+ *
+ * fraction-digits-stmt = fraction-digits-keyword sep
+ *                        fraction-digits-arg-str stmtend
+ *
+ * fraction-digits-arg-str = < a string that matches the rule
+ *                             fraction-digits-arg >
+ *
+ * fraction-digits-arg = ("1" ["0" / "1" / "2" / "3" / "4" /
+ *                              "5" / "6" / "7" / "8"])
+ *                       / "2" / "3" / "4" / "5" / "6" / "7" / "8" / "9"
+ *
+ * ANTLR grammar rule
+ * decimal64Specification : FRACTION_DIGITS_KEYWORD fraction STMTEND;
+ *
+ * fraction : string;
+ */
+
+import org.onosproject.yang.compiler.datamodel.YangDecimal64;
+import org.onosproject.yang.compiler.datamodel.YangRangeRestriction;
+import org.onosproject.yang.compiler.datamodel.YangType;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.TreeWalkListener;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType;
+
+import static org.onosproject.yang.compiler.datamodel.YangDecimal64.MAX_FRACTION_DIGITS_VALUE;
+import static org.onosproject.yang.compiler.datamodel.YangDecimal64.MIN_FRACTION_DIGITS_VALUE;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.FRACTION_DIGITS_DATA;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.FractionDigitStatementContext;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.INVALID_CONTENT;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
+
+/**
+ * Represents listener based call back function corresponding to the "fraction-digits"
+ * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
+ */
+public final class FractionDigitsListener {
+
+    /**
+     * Creates a new bit listener.
+     */
+    private FractionDigitsListener() {
+    }
+
+    /**
+     * It is called when parser enters grammar rule (fraction-digits), it perform
+     * validations and updates the data model tree.
+     *
+     * @param listener listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processFractionDigitsEntry(TreeWalkListener listener,
+                                                  FractionDigitStatementContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, FRACTION_DIGITS_DATA,
+                             ctx.fraction().getText(), ENTRY);
+        int value = getValidFractionDigits(ctx);
+        Parsable tmpNode = listener.getParsedDataStack().peek();
+        if (tmpNode instanceof YangType) {
+            YangType<YangDecimal64<YangRangeRestriction>> typeNode =
+                    (YangType<YangDecimal64<YangRangeRestriction>>) tmpNode;
+            YangDecimal64 decimal64Node = typeNode.getDataTypeExtendedInfo();
+            decimal64Node.setFractionDigit(value);
+            if (!decimal64Node.isValidFractionDigit()) {
+                throw new ParserException(constructErrorMsg(ctx, INVALID_CONTENT));
+            }
+        } else {
+            throw new ParserException(constructErrorMsg(ctx, INVALID_HOLDER));
+        }
+    }
+
+    private static String constructErrorMsg(
+            FractionDigitStatementContext ctx,
+            ListenerErrorType type) {
+        return constructListenerErrorMessage(type, FRACTION_DIGITS_DATA,
+                                             ctx.fraction().getText(), ENTRY);
+    }
+
+    /**
+     * Validate fraction digits.
+     *
+     * @param ctx context object of the grammar rule
+     * @return validated fraction-digits
+     */
+    private static int getValidFractionDigits(FractionDigitStatementContext ctx) {
+        String value = ctx.fraction().getText().trim();
+        ParserException parserException;
+
+        int fractionDigits = Integer.parseInt(value);
+        if (fractionDigits >= MIN_FRACTION_DIGITS_VALUE &&
+                fractionDigits <= MAX_FRACTION_DIGITS_VALUE) {
+            return fractionDigits;
+        } else {
+            parserException =
+                    new ParserException("YANG file error : fraction-digits value" +
+                                                " should be between 1 and 18.");
+            parserException.setLine(ctx.getStart().getLine());
+            parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
+            throw parserException;
+        }
+    }
+}
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/GroupingListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/GroupingListener.java
new file mode 100644
index 0000000..d47d577
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/GroupingListener.java
@@ -0,0 +1,181 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.onosproject.yang.compiler.datamodel.YangContainer;
+import org.onosproject.yang.compiler.datamodel.YangGrouping;
+import org.onosproject.yang.compiler.datamodel.YangInput;
+import org.onosproject.yang.compiler.datamodel.YangList;
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangNotification;
+import org.onosproject.yang.compiler.datamodel.YangOutput;
+import org.onosproject.yang.compiler.datamodel.YangRpc;
+import org.onosproject.yang.compiler.datamodel.YangSubModule;
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.TreeWalkListener;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerCollisionDetector;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil;
+
+import static org.onosproject.yang.compiler.datamodel.utils.GeneratedLanguage.JAVA_GENERATION;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.DESCRIPTION_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.GROUPING_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.REFERENCE_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.STATUS_DATA;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.GroupingStatementContext;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerCollisionDetector.detectCollidingChildUtil;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.EXIT;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructExtendedListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_CURRENT_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.UNHANDLED_PARSED_DATA;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil.getValidIdentifier;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.validateCardinalityMaxOne;
+import static org.onosproject.yang.compiler.translator.tojava.YangDataModelFactory.getYangGroupingNode;
+
+/*
+ * Reference: RFC6020 and YANG ANTLR Grammar
+ *
+ * ABNF grammar as per RFC6020
+ * grouping-stmt       = grouping-keyword sep identifier-arg-str optsep
+ *                      (";" /
+ *                       "{" stmtsep
+ *                          ;; these stmts can appear in any order
+ *                          [status-stmt stmtsep]
+ *                           [description-stmt stmtsep]
+ *                           [reference-stmt stmtsep]
+ *                           *((typedef-stmt /
+ *                              grouping-stmt) stmtsep)
+ *                           *(data-def-stmt stmtsep)
+ *                       "}")
+ *
+ * ANTLR grammar rule
+ * groupingStatement : GROUPING_KEYWORD identifier (STMTEND | LEFT_CURLY_BRACE
+ *       (statusStatement | descriptionStatement | referenceStatement | typedefStatement | groupingStatement
+ *       | dataDefStatement)* RIGHT_CURLY_BRACE);
+ */
+
+/**
+ * Represents listener based call back function corresponding to the "grouping"
+ * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
+ */
+public final class GroupingListener {
+
+    /**
+     * Creates a new grouping listener.
+     */
+    private GroupingListener() {
+    }
+
+    /**
+     * It is called when parser enters grammar rule (grouping), it perform
+     * validations and updates the data model tree.
+     *
+     * @param listener listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processGroupingEntry(TreeWalkListener listener,
+                                            GroupingStatementContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, GROUPING_DATA, ctx.identifier().getText(), ENTRY);
+
+        // Check validity of identifier and remove double quotes.
+        String identifier = getValidIdentifier(ctx.identifier().getText(), GROUPING_DATA, ctx);
+
+        // Validate sub statement cardinality.
+        validateSubStatementsCardinality(ctx);
+
+        // Increase the grouping count by one.
+        listener.increaseGroupingDepth();
+        Parsable curData = listener.getParsedDataStack().peek();
+
+        // Check for identifier collision
+        int line = ctx.getStart().getLine();
+        int charPositionInLine = ctx.getStart().getCharPositionInLine();
+        detectCollidingChildUtil(listener, line, charPositionInLine, identifier, GROUPING_DATA);
+
+        if (curData instanceof YangModule || curData instanceof YangSubModule
+                || curData instanceof YangContainer || curData instanceof YangNotification
+                || curData instanceof YangList || curData instanceof YangGrouping
+                || curData instanceof YangRpc || curData instanceof YangInput
+                || curData instanceof YangOutput) {
+
+            YangGrouping groupingNode = getYangGroupingNode(JAVA_GENERATION);
+            groupingNode.setName(identifier);
+            groupingNode.setGroupingDepth(listener.getGroupingDepth());
+
+            groupingNode.setLineNumber(line);
+            groupingNode.setCharPosition(charPositionInLine);
+            groupingNode.setFileName(listener.getFileName());
+            YangNode curNode = (YangNode) curData;
+            try {
+                curNode.addChild(groupingNode);
+            } catch (DataModelException e) {
+                throw new ParserException(constructExtendedListenerErrorMessage(UNHANDLED_PARSED_DATA,
+                        GROUPING_DATA, ctx.identifier().getText(), ENTRY, e.getMessage()));
+            }
+            listener.getParsedDataStack().push(groupingNode);
+        } else {
+            throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER,
+                    GROUPING_DATA, ctx.identifier().getText(), ENTRY));
+        }
+    }
+
+    /**
+     * It is called when parser exits from grammar rule (grouping), it perform
+     * validations and update the data model tree.
+     *
+     * @param listener Listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processGroupingExit(TreeWalkListener listener,
+                                           GroupingStatementContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, GROUPING_DATA, ctx.identifier().getText(), EXIT);
+
+        // Decrease the grouping count by one.
+        listener.decreaseGroupingDepth();
+        if (listener.getParsedDataStack().peek() instanceof YangGrouping) {
+            listener.getParsedDataStack().pop();
+        } else {
+            throw new ParserException(constructListenerErrorMessage(MISSING_CURRENT_HOLDER, GROUPING_DATA,
+                    ctx.identifier().getText(), EXIT));
+        }
+    }
+
+    /**
+     * Validates the cardinality of case sub-statements as per grammar.
+     *
+     * @param ctx context object of the grammar rule
+     */
+    private static void validateSubStatementsCardinality(GroupingStatementContext ctx) {
+
+        validateCardinalityMaxOne(ctx.statusStatement(), STATUS_DATA, GROUPING_DATA, ctx.identifier().getText());
+        validateCardinalityMaxOne(ctx.descriptionStatement(), DESCRIPTION_DATA, GROUPING_DATA,
+                                  ctx.identifier().getText());
+        validateCardinalityMaxOne(ctx.referenceStatement(), REFERENCE_DATA, GROUPING_DATA, ctx.identifier().getText());
+    }
+}
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/IdentityListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/IdentityListener.java
new file mode 100644
index 0000000..e47b2d6
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/IdentityListener.java
@@ -0,0 +1,124 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.onosproject.yang.compiler.datamodel.YangIdentity;
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangSubModule;
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.TreeWalkListener;
+
+import static org.onosproject.yang.compiler.datamodel.utils.GeneratedLanguage.JAVA_GENERATION;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.IDENTITY_DATA;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.IdentityStatementContext;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.EXIT;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructExtendedListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_CURRENT_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.UNHANDLED_PARSED_DATA;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil.getValidIdentifier;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
+import static org.onosproject.yang.compiler.translator.tojava.YangDataModelFactory.getYangIdentityNode;
+
+/**
+ * Reference: RFC6020 and YANG ANTLR Grammar.
+ * <p>
+ * ABNF grammar as per RFC6020
+ * identity-stmt       = identity-keyword sep identifier-arg-str optsep
+ * (";" /
+ * "{" stmtsep
+ * ;; these stmts can appear in any order
+ * [base-stmt stmtsep]
+ * [status-stmt stmtsep]
+ * [description-stmt stmtsep]
+ * [reference-stmt stmtsep]
+ * "}")
+ */
+
+/**
+ * Represents listener based call back function corresponding to the "identity"
+ * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
+ */
+public final class IdentityListener {
+
+    //Creates a identity listener.
+    private IdentityListener() {
+    }
+
+    /**
+     * Performs validations and update the data model tree when parser receives an input
+     * matching the grammar rule (identity).
+     *
+     * @param listener Listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processIdentityEntry(TreeWalkListener listener,
+                                            IdentityStatementContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, IDENTITY_DATA, ctx.identifier().getText(), ENTRY);
+
+        String identifier = getValidIdentifier(ctx.identifier().getText(), IDENTITY_DATA, ctx);
+
+        YangIdentity identity = getYangIdentityNode(JAVA_GENERATION);
+        identity.setName(identifier);
+
+        identity.setLineNumber(ctx.getStart().getLine());
+        identity.setCharPosition(ctx.getStart().getCharPositionInLine());
+        identity.setFileName(listener.getFileName());
+        Parsable curData = listener.getParsedDataStack().peek();
+        if (curData instanceof YangModule || curData instanceof YangSubModule) {
+            YangNode curNode = (YangNode) curData;
+            try {
+                curNode.addChild(identity);
+            } catch (DataModelException e) {
+                throw new ParserException(constructExtendedListenerErrorMessage(UNHANDLED_PARSED_DATA,
+                                                                                IDENTITY_DATA, ctx.identifier().getText(), ENTRY, e.getMessage()));
+            }
+            // Push identity node to the stack.
+            listener.getParsedDataStack().push(identity);
+        } else {
+            throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, IDENTITY_DATA,
+                                                                    ctx.identifier().getText(), ENTRY));
+        }
+    }
+
+    /**
+     * Performs validations and update the data model tree when parser exits from grammar
+     * rule (identity).
+     *
+     * @param listener Listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processIdentityExit(TreeWalkListener listener,
+                                           IdentityStatementContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_CURRENT_HOLDER, IDENTITY_DATA, ctx.identifier().getText(), EXIT);
+
+        Parsable parsableType = listener.getParsedDataStack().pop();
+        if (!(parsableType instanceof YangIdentity)) {
+            throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, IDENTITY_DATA,
+                                                                    ctx.identifier().getText(), EXIT));
+        }
+    }
+}
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/IdentityRefListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/IdentityRefListener.java
new file mode 100644
index 0000000..adcdee1
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/IdentityRefListener.java
@@ -0,0 +1,188 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.onosproject.yang.compiler.datamodel.YangIdentityRef;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangNodeIdentifier;
+import org.onosproject.yang.compiler.datamodel.YangType;
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.datamodel.utils.ResolvableStatus;
+import org.onosproject.yang.compiler.linker.impl.YangResolutionInfoImpl;
+import org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.IdentityrefSpecificationContext;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.TreeWalkListener;
+
+import static org.onosproject.yang.compiler.datamodel.utils.DataModelUtils.addResolutionInfo;
+import static org.onosproject.yang.compiler.datamodel.utils.ResolvableStatus.UNRESOLVED;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.BASE_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.IDENTITYREF_DATA;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.EXIT;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructExtendedListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_CURRENT_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.UNHANDLED_PARSED_DATA;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil.getValidNodeIdentifier;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
+import static org.onosproject.yang.compiler.utils.UtilConstants.EMPTY_STRING;
+
+/*
+ * Reference: RFC6020 and YANG ANTLR Grammar
+ * <p/>
+ * ABNF grammar as per RFC6020
+ * identityref-specification =
+ * base-stmt stmtsep
+ * base-stmt           = base-keyword sep identifier-ref-arg-str
+ * optsep stmtend*
+ * identifier-ref-arg  = [prefix ":"] identifier
+ */
+
+/**
+ * Represents listener based call back function corresponding to the
+ * "identityref" rule defined in ANTLR grammar file for corresponding ABNF
+ * rule in RFC 6020.
+ */
+public final class IdentityRefListener {
+
+    // No instantiation.
+    private IdentityRefListener() {
+    }
+
+    /**
+     * Performs validation and updates the data model tree when parser receives an input
+     * matching the grammar rule (identity-ref).
+     *
+     * @param listener listener object
+     * @param ctx      context object
+     */
+    public static void processIdentityRefEntry(TreeWalkListener listener,
+                                               IdentityrefSpecificationContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, IDENTITYREF_DATA,
+                             EMPTY_STRING, ENTRY);
+
+        if (!(listener.getParsedDataStack().peek() instanceof YangType)) {
+            throw new ParserException(constructListenerErrorMessage(
+                    INVALID_HOLDER, IDENTITYREF_DATA, EMPTY_STRING, ENTRY));
+        }
+
+        YangIdentityRef idRef = new YangIdentityRef();
+        Parsable typeData = listener.getParsedDataStack().pop();
+        YangResolutionInfoImpl<YangIdentityRef> resolutionInfo;
+
+        // Validate node identifier.
+        YangNodeIdentifier nodeId = getValidNodeIdentifier(
+                ctx.baseStatement().string().getText(), BASE_DATA, ctx);
+        idRef.setBaseIdentity(nodeId);
+        ((YangType) typeData).setDataTypeExtendedInfo(idRef);
+
+        int errLine = ctx.getStart().getLine();
+        int errPos = ctx.getStart().getCharPositionInLine();
+
+        idRef.setLineNumber(errLine);
+        idRef.setCharPosition(errPos);
+        idRef.setFileName(listener.getFileName());
+
+        Parsable tmpData = listener.getParsedDataStack().peek();
+        Parsable parentNode;
+        switch (tmpData.getYangConstructType()) {
+
+            case LEAF_DATA:
+                Parsable leaf = listener.getParsedDataStack().pop();
+                parentNode = listener.getParsedDataStack().peek();
+                listener.getParsedDataStack().push(leaf);
+                break;
+
+            case LEAF_LIST_DATA:
+                Parsable leafList = listener.getParsedDataStack().pop();
+                parentNode = listener.getParsedDataStack().peek();
+                listener.getParsedDataStack().push(leafList);
+                break;
+
+            case UNION_DATA:
+                parentNode = listener.getParsedDataStack().peek();
+                break;
+
+            case TYPEDEF_DATA:
+                parentNode = listener.getParsedDataStack().peek();
+                break;
+
+            default:
+                throw new ParserException(
+                        constructListenerErrorMessage(INVALID_HOLDER,
+                                                      IDENTITYREF_DATA,
+                                                      ctx.getText(), EXIT));
+        }
+
+        if (!(parentNode instanceof YangNode)) {
+            throw new ParserException(
+                    constructListenerErrorMessage(INVALID_HOLDER,
+                                                  IDENTITYREF_DATA,
+                                                  ctx.getText(), EXIT));
+        }
+        idRef.setResolvableStatus(UNRESOLVED);
+        // Adds resolution information to the list
+        resolutionInfo = new YangResolutionInfoImpl<>(
+                idRef, (YangNode) parentNode, errLine, errPos);
+        addToResolution(resolutionInfo, ctx);
+
+        listener.getParsedDataStack().push(typeData);
+        listener.getParsedDataStack().push(idRef);
+    }
+
+    /**
+     * Performs validations and update the data model tree when parser exits
+     * from grammar rule (identity-ref).
+     *
+     * @param listener Listener's object
+     * @param ctx      context object
+     */
+    public static void processIdentityRefExit(TreeWalkListener listener,
+                                              IdentityrefSpecificationContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_CURRENT_HOLDER, IDENTITYREF_DATA,
+                             ctx.getText(), EXIT);
+
+        Parsable parsableType = listener.getParsedDataStack().pop();
+        if (!(parsableType instanceof YangIdentityRef)) {
+            throw new ParserException(constructListenerErrorMessage(
+                    INVALID_HOLDER, IDENTITYREF_DATA, ctx.getText(), EXIT));
+        }
+    }
+
+    /**
+     * Adds to resolution list.
+     *
+     * @param info resolution info
+     * @param ctx  context object
+     */
+    private static void addToResolution(YangResolutionInfoImpl<YangIdentityRef> info,
+                                        IdentityrefSpecificationContext ctx) {
+        try {
+            addResolutionInfo(info);
+        } catch (DataModelException e) {
+            throw new ParserException(constructExtendedListenerErrorMessage(
+                    UNHANDLED_PARSED_DATA, IDENTITYREF_DATA, ctx.getText(),
+                    ENTRY, e.getMessage()));
+        }
+    }
+}
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/IfFeatureListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/IfFeatureListener.java
new file mode 100644
index 0000000..9a56209
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/IfFeatureListener.java
@@ -0,0 +1,147 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+/*
+ * Reference: RFC6020 and YANG ANTLR Grammar
+ *
+ * ABNF grammar as per RFC6020
+ *
+ * if-feature-stmt     = if-feature-keyword sep identifier-ref-arg-str
+ *                        optsep stmtend
+ *
+ * ANTLR grammar rule
+ * ifFeatureStatement : IF_FEATURE_KEYWORD string STMTEND;
+ */
+
+import org.onosproject.yang.compiler.datamodel.YangFeature;
+import org.onosproject.yang.compiler.datamodel.YangIfFeature;
+import org.onosproject.yang.compiler.datamodel.YangIfFeatureHolder;
+import org.onosproject.yang.compiler.datamodel.YangLeaf;
+import org.onosproject.yang.compiler.datamodel.YangLeafList;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangNodeIdentifier;
+import org.onosproject.yang.compiler.datamodel.YangResolutionInfo;
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.linker.impl.YangResolutionInfoImpl;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.TreeWalkListener;
+
+import static org.onosproject.yang.compiler.datamodel.utils.DataModelUtils.addResolutionInfo;
+import static org.onosproject.yang.compiler.datamodel.utils.ResolvableStatus.UNRESOLVED;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.IF_FEATURE_DATA;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.IfFeatureStatementContext;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.EXIT;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructExtendedListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.UNHANDLED_PARSED_DATA;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil.getValidNodeIdentifier;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
+
+/**
+ * Represents listener based call back function corresponding to the "if-feature"
+ * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
+ */
+public final class IfFeatureListener {
+
+    /**
+     * Creates a new IfFeature listener.
+     */
+    private IfFeatureListener() {
+    }
+
+    /**
+     * Performs validation and updates the data model tree.It is called when parser receives
+     * an input matching the grammar rule (if-feature).
+     *
+     * @param listener listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processIfFeatureEntry(TreeWalkListener listener,
+                                             IfFeatureStatementContext ctx) {
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, IF_FEATURE_DATA, ctx.string().getText(), ENTRY);
+
+        // Validate if-feature argument string
+        YangNodeIdentifier nodeIdentifier = getValidNodeIdentifier(ctx.string().getText(),
+                                                                   IF_FEATURE_DATA, ctx);
+
+        YangIfFeature ifFeature = new YangIfFeature();
+        ifFeature.setName(nodeIdentifier);
+        ifFeature.setResolvableStatus(UNRESOLVED);
+
+        ifFeature.setLineNumber(ctx.getStart().getLine());
+        ifFeature.setCharPosition(ctx.getStart().getCharPositionInLine());
+        ifFeature.setFileName(listener.getFileName());
+        YangIfFeatureHolder ifFeatureHolder;
+
+        // Obtain the node of the stack.
+        Parsable tmpNode = listener.getParsedDataStack().peek();
+        if (tmpNode instanceof YangIfFeatureHolder) {
+            ifFeatureHolder = (YangIfFeatureHolder) tmpNode;
+            ifFeatureHolder.addIfFeatureList(ifFeature);
+        } else {
+            throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, IF_FEATURE_DATA,
+                                                                    ctx.string().getText(), ENTRY));
+        }
+
+        // Add resolution information to the list
+        Parsable parentNode;
+        if (tmpNode instanceof YangLeafList || tmpNode instanceof YangLeaf
+                || tmpNode instanceof YangFeature) {
+            Parsable leafData = listener.getParsedDataStack().pop();
+            parentNode = listener.getParsedDataStack().peek();
+            listener.getParsedDataStack().push(leafData);
+        } else {
+            parentNode = tmpNode;
+        }
+
+        // Verify parent node of leaf
+        if (!(parentNode instanceof YangNode)) {
+            throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, IF_FEATURE_DATA,
+                                                                    ctx.string().getText(), EXIT));
+        }
+
+        int errorLine = ctx.getStart().getLine();
+        int errorPosition = ctx.getStart().getCharPositionInLine();
+        YangResolutionInfoImpl resolutionInfo = new YangResolutionInfoImpl<YangIfFeature>(ifFeature,
+                                                                                          (YangNode) parentNode, errorLine,
+                                                                                          errorPosition);
+        addToResolutionList(resolutionInfo, ctx);
+    }
+
+    /**
+     * Add to resolution list.
+     *
+     * @param resolutionInfo resolution information.
+     * @param ctx            context object of the grammar rule
+     */
+    private static void addToResolutionList(YangResolutionInfo<YangIfFeature> resolutionInfo,
+                                            IfFeatureStatementContext ctx) {
+
+        try {
+            addResolutionInfo(resolutionInfo);
+        } catch (DataModelException e) {
+            throw new ParserException(constructExtendedListenerErrorMessage(UNHANDLED_PARSED_DATA,
+                                                                            IF_FEATURE_DATA, ctx.string().getText(), EXIT, e.getMessage()));
+        }
+    }
+}
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/ImportListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/ImportListener.java
new file mode 100644
index 0000000..57694f3
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/ImportListener.java
@@ -0,0 +1,141 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.onosproject.yang.compiler.datamodel.YangImport;
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangSubModule;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.TreeWalkListener;
+
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.IMPORT_DATA;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.ImportStatementContext;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.EXIT;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_CURRENT_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil.getValidIdentifier;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
+
+/*
+ * Reference: RFC6020 and YANG ANTLR Grammar
+ *
+ * ABNF grammar as per RFC6020
+ * linkage-stmts       = ;; these stmts can appear in any order
+ *                       *(import-stmt stmtsep)
+ *                       *(include-stmt stmtsep)
+ *
+ * import-stmt         = import-keyword sep identifier-arg-str optsep
+ *                       "{" stmtsep
+ *                           prefix-stmt stmtsep
+ *                           [revision-date-stmt stmtsep]
+ *                        "}"
+ *
+ * ANTLR grammar rule
+ * linkage_stmts : (import_stmt
+ *               | include_stmt)*;
+ * import_stmt : IMPORT_KEYWORD identifier LEFT_CURLY_BRACE import_stmt_body
+ *               RIGHT_CURLY_BRACE;
+ * import_stmt_body : prefix_stmt revision_date_stmt?;
+ */
+
+/**
+ * Represents listener based call back function corresponding to the "import"
+ * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
+ */
+public final class ImportListener {
+
+    /**
+     * Creates a new import listener.
+     */
+    private ImportListener() {
+    }
+
+    /**
+     * It is called when parser receives an input matching the grammar rule
+     * (import), perform validations and update the data model tree.
+     *
+     * @param listener Listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processImportEntry(TreeWalkListener listener, ImportStatementContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, IMPORT_DATA, ctx.identifier().getText(), ENTRY);
+
+        String identifier = getValidIdentifier(ctx.identifier().getText(), IMPORT_DATA, ctx);
+
+        YangImport importNode = new YangImport();
+        importNode.setModuleName(identifier);
+
+        // Set the line number and character position in line for the belongs to.
+        int errorLine = ctx.getStart().getLine();
+        int errorPosition = ctx.getStart().getCharPositionInLine();
+        importNode.setLineNumber(errorLine);
+        importNode.setCharPosition(errorPosition);
+        importNode.setFileName(listener.getFileName());
+
+        // Push import node to the stack.
+        listener.getParsedDataStack().push(importNode);
+    }
+
+    /**
+     * It is called when parser exits from grammar rule (import), it perform
+     * validations and update the data model tree.
+     *
+     * @param listener Listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processImportExit(TreeWalkListener listener, ImportStatementContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, IMPORT_DATA, ctx.identifier().getText(), EXIT);
+
+        Parsable tmpImportNode = listener.getParsedDataStack().peek();
+        if (tmpImportNode instanceof YangImport) {
+            listener.getParsedDataStack().pop();
+
+            // Check for stack to be non empty.
+            checkStackIsNotEmpty(listener, MISSING_HOLDER, IMPORT_DATA, ctx.identifier().getText(),
+                                 EXIT);
+
+            Parsable tmpNode = listener.getParsedDataStack().peek();
+            switch (tmpNode.getYangConstructType()) {
+                case MODULE_DATA: {
+                    YangModule module = (YangModule) tmpNode;
+                    module.addToImportList((YangImport) tmpImportNode);
+                    break;
+                }
+                case SUB_MODULE_DATA: {
+                    YangSubModule subModule = (YangSubModule) tmpNode;
+                    subModule.addToImportList((YangImport) tmpImportNode);
+                    break;
+                }
+                default:
+                    throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, IMPORT_DATA,
+                                                                            ctx.identifier().getText(),
+                                                                            EXIT));
+            }
+        } else {
+            throw new ParserException(constructListenerErrorMessage(MISSING_CURRENT_HOLDER, IMPORT_DATA,
+                                                                    ctx.identifier().getText(), EXIT));
+        }
+    }
+}
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/IncludeListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/IncludeListener.java
new file mode 100644
index 0000000..773a789
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/IncludeListener.java
@@ -0,0 +1,142 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.onosproject.yang.compiler.datamodel.YangInclude;
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangSubModule;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.TreeWalkListener;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil;
+
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.INCLUDE_DATA;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.IncludeStatementContext;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.EXIT;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_CURRENT_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil.getValidIdentifier;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
+
+/*
+ * Reference: RFC6020 and YANG ANTLR Grammar
+ *
+ * ABNF grammar as per RFC6020
+ * linkage-stmts       = ;; these stmts can appear in any order
+ *                       *(import-stmt stmtsep)
+ *                       *(include-stmt stmtsep)
+ *
+ * include-stmt        = include-keyword sep identifier-arg-str optsep
+ *                             (";" /
+ *                              "{" stmtsep
+ *                                  [revision-date-stmt stmtsep]
+ *                            "}")
+ *
+ * ANTLR grammar rule
+ * linkage_stmts : (import_stmt
+ *               | include_stmt)*;
+ * include_stmt : INCLUDE_KEYWORD identifier (STMTEND | LEFT_CURLY_BRACE
+ *                revision_date_stmt? RIGHT_CURLY_BRACE);
+ */
+
+/**
+ * Represents listener based call back function corresponding to the "include"
+ * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
+ */
+public final class IncludeListener {
+
+    /**
+     * Creates a new include listener.
+     */
+    private IncludeListener() {
+    }
+
+    /**
+     * It is called when parser receives an input matching the grammar rule
+     * (include), perform validations and update the data model tree.
+     *
+     * @param listener Listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processIncludeEntry(TreeWalkListener listener, IncludeStatementContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, INCLUDE_DATA, ctx.identifier().getText(),
+                ENTRY);
+
+        String identifier = getValidIdentifier(ctx.identifier().getText(), INCLUDE_DATA, ctx);
+
+        YangInclude includeNode = new YangInclude();
+        includeNode.setSubModuleName(identifier);
+
+        // Set the line number and character position in line for the belongs to.
+        int errorLine = ctx.getStart().getLine();
+        int errorPosition = ctx.getStart().getCharPositionInLine();
+        includeNode.setLineNumber(errorLine);
+        includeNode.setCharPosition(errorPosition);
+        includeNode.setFileName(listener.getFileName());
+
+        listener.getParsedDataStack().push(includeNode);
+    }
+
+    /**
+     * It is called when parser exits from grammar rule (include), it perform
+     * validations and update the data model tree.
+     *
+     * @param listener Listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processIncludeExit(TreeWalkListener listener, IncludeStatementContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, INCLUDE_DATA, ctx.identifier().getText(), EXIT);
+
+        Parsable tmpIncludeNode = listener.getParsedDataStack().peek();
+        if (tmpIncludeNode instanceof YangInclude) {
+            listener.getParsedDataStack().pop();
+
+            // Check for stack to be non empty.
+            checkStackIsNotEmpty(listener, MISSING_HOLDER, INCLUDE_DATA, ctx.identifier().getText(),
+                    EXIT);
+
+            Parsable tmpNode = listener.getParsedDataStack().peek();
+            switch (tmpNode.getYangConstructType()) {
+                case MODULE_DATA: {
+                    YangModule module = (YangModule) tmpNode;
+                    module.addToIncludeList((YangInclude) tmpIncludeNode);
+                    break;
+                }
+                case SUB_MODULE_DATA: {
+                    YangSubModule subModule = (YangSubModule) tmpNode;
+                    subModule.addToIncludeList((YangInclude) tmpIncludeNode);
+                    break;
+                }
+                default:
+                    throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, INCLUDE_DATA,
+                            ctx.identifier().getText(),
+                            EXIT));
+            }
+        } else {
+            throw new ParserException(constructListenerErrorMessage(MISSING_CURRENT_HOLDER, INCLUDE_DATA,
+                    ctx.identifier().getText(), EXIT));
+        }
+    }
+}
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/InputListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/InputListener.java
new file mode 100644
index 0000000..a350b18
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/InputListener.java
@@ -0,0 +1,130 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.onosproject.yang.compiler.datamodel.YangInput;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangRpc;
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.TreeWalkListener;
+import org.onosproject.yang.compiler.utils.UtilConstants;
+
+import static org.onosproject.yang.compiler.datamodel.utils.GeneratedLanguage.JAVA_GENERATION;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.INPUT_DATA;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.InputStatementContext;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.EXIT;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructExtendedListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_CURRENT_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.UNHANDLED_PARSED_DATA;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
+import static org.onosproject.yang.compiler.translator.tojava.YangDataModelFactory.getYangInputNode;
+import static org.onosproject.yang.compiler.utils.UtilConstants.INPUT;
+
+/*
+ * Reference: RFC6020 and YANG ANTLR Grammar
+ *
+ * ABNF grammar as per RFC6020
+ *
+ * input-stmt          = input-keyword optsep
+ *                       "{" stmtsep
+ *                           ;; these stmts can appear in any order
+ *                           *((typedef-stmt /
+ *                              grouping-stmt) stmtsep)
+ *                           1*(data-def-stmt stmtsep)
+ *                         "}"
+ *
+ * inputStatement : INPUT_KEYWORD LEFT_CURLY_BRACE inputStatementBody RIGHT_CURLY_BRACE;
+
+ * inputStatementBody : typedefStatement* dataDefStatement+
+ *                    | dataDefStatement+ typedefStatement*
+ *                    | groupingStatement* dataDefStatement+
+ *                    | dataDefStatement+ groupingStatement*;
+ */
+
+/**
+ * Represents listener based call back function corresponding to the "input"
+ * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
+ */
+public final class InputListener {
+
+    /**
+     * Creates a new input listener.
+     */
+    private InputListener() {
+    }
+
+    /**
+     * It is called when parser receives an input matching the grammar rule
+     * (input), performs validation and updates the data model tree.
+     *
+     * @param listener listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processInputEntry(TreeWalkListener listener,
+                                         InputStatementContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, INPUT_DATA, "", ENTRY);
+
+        Parsable curData = listener.getParsedDataStack().peek();
+        if (curData instanceof YangRpc) {
+
+            YangInput yangInput = getYangInputNode(JAVA_GENERATION);
+            yangInput.setName(INPUT);
+            yangInput.setLineNumber(ctx.getStart().getLine());
+            yangInput.setCharPosition(ctx.getStart().getCharPositionInLine());
+            yangInput.setFileName(listener.getFileName());
+            YangNode curNode = (YangNode) curData;
+            try {
+                curNode.addChild(yangInput);
+            } catch (DataModelException e) {
+                throw new ParserException(constructExtendedListenerErrorMessage(UNHANDLED_PARSED_DATA,
+                                                                                INPUT_DATA, "", ENTRY, e.getMessage()));
+            }
+            listener.getParsedDataStack().push(yangInput);
+        } else {
+            throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, INPUT_DATA,
+                                                                    "", ENTRY));
+        }
+    }
+
+    /**
+     * It is called when parser exits from grammar rule (input), it perform
+     * validations and updates the data model tree.
+     *
+     * @param listener listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processInputExit(TreeWalkListener listener,
+                                        InputStatementContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, INPUT_DATA, "", EXIT);
+
+        if (!(listener.getParsedDataStack().peek() instanceof YangInput)) {
+            throw new ParserException(constructListenerErrorMessage(MISSING_CURRENT_HOLDER, INPUT_DATA,
+                                                                    "", EXIT));
+        }
+        listener.getParsedDataStack().pop();
+    }
+}
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/KeyListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/KeyListener.java
new file mode 100644
index 0000000..5b67812
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/KeyListener.java
@@ -0,0 +1,103 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.onosproject.yang.compiler.datamodel.YangList;
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.TreeWalkListener;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation;
+
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.KEY_DATA;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.KeyStatementContext;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructExtendedListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.UNHANDLED_PARSED_DATA;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil.removeQuotesAndHandleConcat;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
+
+/*
+ * Reference: RFC6020 and YANG ANTLR Grammar
+ *
+ * ABNF grammar as per RFC6020
+ * key-stmt            = key-keyword sep key-arg-str stmtend
+ *
+ * ANTLR grammar rule
+ * keyStatement : KEY_KEYWORD key STMTEND;
+ * key          : string;
+ */
+
+/**
+ * Represesnts listener based call back function corresponding to the "key" rule
+ * defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
+ */
+public final class KeyListener {
+
+    /**
+     * Creates a new key listener.
+     */
+    private KeyListener() {
+    }
+
+    /**
+     * It is called when parser receives an input matching the grammar rule
+     * (key), perform validations and updates the data model tree.
+     *
+     * @param listener listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processKeyEntry(TreeWalkListener listener,
+                                       KeyStatementContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, KEY_DATA, ctx.key().getText(), ENTRY);
+
+        Parsable tmpData = listener.getParsedDataStack().peek();
+        if (listener.getParsedDataStack().peek() instanceof YangList) {
+            YangList yangList = (YangList) tmpData;
+            String tmpKeyValue = removeQuotesAndHandleConcat(ctx.key().getText());
+            if (tmpKeyValue.contains(" ")) {
+                String[] keyValues = tmpKeyValue.split(" ");
+                for (String keyValue : keyValues) {
+                    try {
+                        yangList.addKey(keyValue);
+                    } catch (DataModelException e) {
+                        throw new ParserException(constructExtendedListenerErrorMessage(UNHANDLED_PARSED_DATA, KEY_DATA,
+                                ctx.key().getText(), ENTRY, e.getMessage()));
+                    }
+                }
+            } else {
+                try {
+                    yangList.addKey(tmpKeyValue);
+                } catch (DataModelException e) {
+                    throw new ParserException(constructExtendedListenerErrorMessage(UNHANDLED_PARSED_DATA, KEY_DATA,
+                            ctx.key().getText(), ENTRY, e.getMessage()));
+                }
+            }
+        } else {
+            throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, KEY_DATA, ctx.key().getText(),
+                    ENTRY));
+        }
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/LeafListListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/LeafListListener.java
new file mode 100644
index 0000000..75dde98
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/LeafListListener.java
@@ -0,0 +1,181 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.onosproject.yang.compiler.datamodel.YangLeafList;
+import org.onosproject.yang.compiler.datamodel.YangLeavesHolder;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.TreeWalkListener;
+
+import static org.onosproject.yang.compiler.datamodel.utils.GeneratedLanguage.JAVA_GENERATION;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.CONFIG_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.DESCRIPTION_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.LEAF_LIST_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.MAX_ELEMENT_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.MIN_ELEMENT_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.REFERENCE_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.STATUS_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.TYPE_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.UNITS_DATA;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.LeafListStatementContext;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerCollisionDetector.detectCollidingChildUtil;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.EXIT;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_CURRENT_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil.getValidIdentifier;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.getParentNodeConfig;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.validateCardinalityEqualsOne;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.validateCardinalityMaxOne;
+import static org.onosproject.yang.compiler.translator.tojava.YangDataModelFactory.getYangLeafList;
+
+/*
+ * Reference: RFC6020 and YANG ANTLR Grammar
+ *
+ * ABNF grammar as per RFC6020
+ *  leaf-list-stmt      = leaf-list-keyword sep identifier-arg-str optsep
+ *                        "{" stmtsep
+ *                            ;; these stmts can appear in any order
+ *                            [when-stmt stmtsep]
+ *                            *(if-feature-stmt stmtsep)
+ *                            type-stmt stmtsep
+ *                            [units-stmt stmtsep]
+ *                            *(must-stmt stmtsep)
+ *                            [config-stmt stmtsep]
+ *                            [min-elements-stmt stmtsep]
+ *                            [max-elements-stmt stmtsep]
+ *                            [ordered-by-stmt stmtsep]
+ *                            [status-stmt stmtsep]
+ *                            [description-stmt stmtsep]
+ *                            [reference-stmt stmtsep]
+ *                         "}"
+ *
+ * ANTLR grammar rule
+ *  leafListStatement : LEAF_LIST_KEYWORD identifier LEFT_CURLY_BRACE (whenStatement | ifFeatureStatement |
+ *  typeStatement | unitsStatement | mustStatement | configStatement | minElementsStatement | maxElementsStatement |
+ *  orderedByStatement | statusStatement | descriptionStatement | referenceStatement)* RIGHT_CURLY_BRACE;
+ */
+
+/**
+ * Represents listener based call back function corresponding to the "leaf-list"
+ * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
+ */
+public final class LeafListListener {
+
+    /**
+     * Creates a new leaf list listener.
+     */
+    private LeafListListener() {
+    }
+
+    /**
+     * It is called when parser receives an input matching the grammar rule
+     * (leaf-list), performs validation and updates the data model tree.
+     *
+     * @param listener listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processLeafListEntry(TreeWalkListener listener,
+                                            LeafListStatementContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, LEAF_LIST_DATA, ctx.identifier().getText(), ENTRY);
+
+        String identifier = getValidIdentifier(ctx.identifier().getText(), LEAF_LIST_DATA, ctx);
+
+        // Validate sub statement cardinality.
+        validateSubStatementsCardinality(ctx);
+
+        // Check for identifier collision
+        int line = ctx.getStart().getLine();
+        int charPositionInLine = ctx.getStart().getCharPositionInLine();
+        detectCollidingChildUtil(listener, line, charPositionInLine, identifier, LEAF_LIST_DATA);
+
+        YangLeafList leafList = getYangLeafList(JAVA_GENERATION);
+        leafList.setName(identifier);
+        leafList.setLineNumber(line);
+        leafList.setCharPosition(charPositionInLine);
+        leafList.setFileName(listener.getFileName());
+        /*
+         * If "config" is not specified, the default is the same as the parent
+         * schema node's "config" value.
+         */
+        if (ctx.configStatement().isEmpty()) {
+            boolean parentConfig = getParentNodeConfig(listener);
+            leafList.setConfig(parentConfig);
+        }
+
+        Parsable tmpData = listener.getParsedDataStack().peek();
+        YangLeavesHolder leavesHolder;
+
+        if (tmpData instanceof YangLeavesHolder) {
+            leavesHolder = (YangLeavesHolder) tmpData;
+            leavesHolder.addLeafList(leafList);
+            leafList.setContainedIn(leavesHolder);
+        } else {
+            throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, LEAF_LIST_DATA,
+                                                                    ctx.identifier().getText(), ENTRY));
+        }
+        listener.getParsedDataStack().push(leafList);
+    }
+
+    /**
+     * It is called when parser exits from grammar rule (leaf-list), it performs
+     * validation and updates the data model tree.
+     *
+     * @param listener listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processLeafListExit(TreeWalkListener listener,
+                                           LeafListStatementContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, LEAF_LIST_DATA, ctx.identifier().getText(), EXIT);
+
+        if (listener.getParsedDataStack().peek() instanceof YangLeafList) {
+            listener.getParsedDataStack().pop();
+        } else {
+            throw new ParserException(constructListenerErrorMessage(MISSING_CURRENT_HOLDER, LEAF_LIST_DATA,
+                                                                    ctx.identifier().getText(), EXIT));
+        }
+    }
+
+    /**
+     * Validates the cardinality of leaf-list sub-statements as per grammar.
+     *
+     * @param ctx context object of the grammar rule
+     */
+    private static void validateSubStatementsCardinality(LeafListStatementContext ctx) {
+
+        validateCardinalityEqualsOne(ctx.typeStatement(), TYPE_DATA, LEAF_LIST_DATA, ctx.identifier().getText(), ctx);
+        validateCardinalityMaxOne(ctx.unitsStatement(), UNITS_DATA, LEAF_LIST_DATA, ctx.identifier().getText());
+        validateCardinalityMaxOne(ctx.configStatement(), CONFIG_DATA, LEAF_LIST_DATA, ctx.identifier().getText());
+        validateCardinalityMaxOne(ctx.maxElementsStatement(), MAX_ELEMENT_DATA, LEAF_LIST_DATA,
+                                  ctx.identifier().getText());
+        validateCardinalityMaxOne(ctx.minElementsStatement(), MIN_ELEMENT_DATA, LEAF_LIST_DATA,
+                                  ctx.identifier().getText());
+        validateCardinalityMaxOne(ctx.descriptionStatement(), DESCRIPTION_DATA, LEAF_LIST_DATA,
+                                  ctx.identifier().getText());
+        validateCardinalityMaxOne(ctx.referenceStatement(), REFERENCE_DATA, LEAF_LIST_DATA, ctx.identifier().getText());
+        validateCardinalityMaxOne(ctx.statusStatement(), STATUS_DATA, LEAF_LIST_DATA, ctx.identifier().getText());
+        //TODO ordered by
+    }
+}
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/LeafListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/LeafListener.java
new file mode 100644
index 0000000..6331361
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/LeafListener.java
@@ -0,0 +1,206 @@
+/*
+ * 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.
+ */
+
+/**
+ * Implements listener based call back function corresponding to the "leaf"
+ * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
+ */
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.onosproject.yang.compiler.datamodel.YangLeaf;
+import org.onosproject.yang.compiler.datamodel.YangLeavesHolder;
+import org.onosproject.yang.compiler.datamodel.YangList;
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.TreeWalkListener;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerCollisionDetector;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation;
+import org.onosproject.yang.compiler.translator.tojava.YangDataModelFactory;
+
+import static org.onosproject.yang.compiler.datamodel.utils.GeneratedLanguage.JAVA_GENERATION;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.CONFIG_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.DESCRIPTION_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.LEAF_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.MANDATORY_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.REFERENCE_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.STATUS_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.TYPE_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.UNITS_DATA;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.LeafStatementContext;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerCollisionDetector.detectCollidingChildUtil;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.EXIT;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.INVALID_CONTENT;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_CURRENT_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil.getValidIdentifier;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.getParentNodeConfig;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.validateCardinalityEqualsOne;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.validateCardinalityMaxOne;
+import static org.onosproject.yang.compiler.translator.tojava.YangDataModelFactory.getYangLeaf;
+
+/*
+ * Reference: RFC6020 and YANG ANTLR Grammar
+ *
+ * ABNF grammar as per RFC6020
+ *  leaf-stmt           = leaf-keyword sep identifier-arg-str optsep
+ *                        "{" stmtsep
+ *                            ;; these stmts can appear in any order
+ *                            [when-stmt stmtsep]
+ *                            *(if-feature-stmt stmtsep)
+ *                            type-stmt stmtsep
+ *                            [units-stmt stmtsep]
+ *                            *(must-stmt stmtsep)
+ *                            [default-stmt stmtsep]
+ *                            [config-stmt stmtsep]
+ *                            [mandatory-stmt stmtsep]
+ *                            [status-stmt stmtsep]
+ *                            [description-stmt stmtsep]
+ *                            [reference-stmt stmtsep]
+ *                         "}"
+ *
+ * ANTLR grammar rule
+ *  leafStatement : LEAF_KEYWORD identifier LEFT_CURLY_BRACE (whenStatement | ifFeatureStatement | typeStatement |
+ *  unitsStatement | mustStatement | defaultStatement | configStatement | mandatoryStatement | statusStatement  |
+ *  descriptionStatement | referenceStatement)* RIGHT_CURLY_BRACE;
+ */
+
+/**
+ * Represents listener based call back function corresponding to the "leaf" rule
+ * defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
+ */
+public final class LeafListener {
+
+    /**
+     * Creates a new leaf listener.
+     */
+    private LeafListener() {
+    }
+
+    /**
+     * It is called when parser receives an input matching the grammar rule
+     * (leaf), performs validation and updates the data model tree.
+     *
+     * @param listener listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processLeafEntry(TreeWalkListener listener,
+                                        LeafStatementContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, LEAF_DATA, ctx.identifier().getText(), ENTRY);
+
+        String identifier = getValidIdentifier(ctx.identifier().getText(), LEAF_DATA, ctx);
+
+        // Validate sub statement cardinality.
+        validateSubStatementsCardinality(ctx);
+
+        // Check for identifier collision
+        int line = ctx.getStart().getLine();
+        int charPositionInLine = ctx.getStart().getCharPositionInLine();
+        detectCollidingChildUtil(listener, line, charPositionInLine, identifier, LEAF_DATA);
+
+        YangLeaf leaf = getYangLeaf(JAVA_GENERATION);
+        leaf.setName(identifier);
+        leaf.setLineNumber(line);
+        leaf.setCharPosition(charPositionInLine);
+        leaf.setFileName(listener.getFileName());
+
+        /*
+         * If "config" is not specified, the default is the same as the parent
+         * schema node's "config" value.
+         */
+        if (ctx.configStatement().isEmpty()) {
+            boolean parentConfig = ListenerValidation.getParentNodeConfig(listener);
+            leaf.setConfig(parentConfig);
+        }
+
+        Parsable tmpData = listener.getParsedDataStack().peek();
+        YangLeavesHolder leavesHolder;
+
+        if (tmpData instanceof YangLeavesHolder) {
+            leavesHolder = (YangLeavesHolder) tmpData;
+            leavesHolder.addLeaf(leaf);
+            leaf.setContainedIn(leavesHolder);
+            if (tmpData instanceof YangList) {
+                YangList list = (YangList) tmpData;
+                if (list.isConfig()) {
+                    for (String key : list.getKeyList()) {
+                        if (key.equals(leaf.getName())) {
+                            leaf.setKeyLeaf(true);
+                        }
+                    }
+                }
+            }
+        } else {
+            throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, LEAF_DATA,
+                    ctx.identifier().getText(), ENTRY));
+        }
+
+        listener.getParsedDataStack().push(leaf);
+    }
+
+    /**
+     * It is called when parser exits from grammar rule (leaf), performs
+     * validation and updates the data model tree.
+     *
+     * @param listener listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processLeafExit(TreeWalkListener listener,
+                                       LeafStatementContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, LEAF_DATA, ctx.identifier().getText(), EXIT);
+
+        if (listener.getParsedDataStack().peek() instanceof YangLeaf) {
+            YangLeaf leafNode = (YangLeaf) listener.getParsedDataStack().peek();
+            try {
+                leafNode.validateDataOnExit();
+            } catch (DataModelException e) {
+                throw new ParserException(constructListenerErrorMessage(INVALID_CONTENT, LEAF_DATA,
+                        ctx.identifier().getText(), EXIT));
+            }
+            listener.getParsedDataStack().pop();
+        } else {
+            throw new ParserException(constructListenerErrorMessage(MISSING_CURRENT_HOLDER, LEAF_DATA,
+                    ctx.identifier().getText(), EXIT));
+        }
+    }
+
+    /**
+     * Validates the cardinality of leaf sub-statements as per grammar.
+     *
+     * @param ctx context object of the grammar rule
+     */
+    private static void validateSubStatementsCardinality(LeafStatementContext ctx) {
+
+        validateCardinalityEqualsOne(ctx.typeStatement(), TYPE_DATA, LEAF_DATA, ctx.identifier().getText(), ctx);
+        validateCardinalityMaxOne(ctx.unitsStatement(), UNITS_DATA, LEAF_DATA, ctx.identifier().getText());
+        validateCardinalityMaxOne(ctx.configStatement(), CONFIG_DATA, LEAF_DATA, ctx.identifier().getText());
+        validateCardinalityMaxOne(ctx.mandatoryStatement(), MANDATORY_DATA, LEAF_DATA, ctx.identifier().getText());
+        validateCardinalityMaxOne(ctx.descriptionStatement(), DESCRIPTION_DATA, LEAF_DATA, ctx.identifier().getText());
+        validateCardinalityMaxOne(ctx.referenceStatement(), REFERENCE_DATA, LEAF_DATA, ctx.identifier().getText());
+        validateCardinalityMaxOne(ctx.statusStatement(), STATUS_DATA, LEAF_DATA, ctx.identifier().getText());
+        //TODO when.
+    }
+}
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/LeafrefListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/LeafrefListener.java
new file mode 100644
index 0000000..4935a8e
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/LeafrefListener.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.yang.compiler.parser.impl.listeners;
+
+import org.onosproject.yang.compiler.datamodel.YangLeaf;
+import org.onosproject.yang.compiler.datamodel.YangLeafList;
+import org.onosproject.yang.compiler.datamodel.YangLeafRef;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangType;
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.datamodel.utils.DataModelUtils;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.linker.impl.YangResolutionInfoImpl;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.TreeWalkListener;
+
+import static org.onosproject.yang.compiler.datamodel.utils.DataModelUtils.addResolutionInfo;
+import static org.onosproject.yang.compiler.datamodel.utils.ResolvableStatus.UNRESOLVED;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.LEAFREF_DATA;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.LeafrefSpecificationContext;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.EXIT;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructExtendedListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_CURRENT_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.UNHANDLED_PARSED_DATA;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
+
+/*
+ * Reference: RFC6020 and YANG ANTLR Grammar
+ *
+ * ABNF grammar as per RFC6020
+ * type-body-stmts     = numerical-restrictions /
+ *                       decimal64-specification /
+ *                       string-restrictions /
+ *                       enum-specification /
+ *                       leafref-specification /
+ *                       identityref-specification /
+ *                       instance-identifier-specification /
+ *                       bits-specification /
+ *                       union-specification
+ *
+ * leafref-specification =
+ *                         ;; these stmts can appear in any order
+ *                        path-stmt stmtsep
+ *                        [require-instance-stmt stmtsep]
+ *
+ * ANTLR grammar rule
+ *
+ * typeBodyStatements : numericalRestrictions | stringRestrictions | enumSpecification
+ *                 | leafrefSpecification | identityrefSpecification | instanceIdentifierSpecification
+ *                 | bitsSpecification | unionSpecification;
+ *
+ * leafrefSpecification : (pathStatement (requireInstanceStatement)?) | ((requireInstanceStatement)? pathStatement);
+ */
+
+/**
+ * Represents listener based call back function corresponding to the
+ * "leafref" rule defined in ANTLR grammar file for corresponding ABNF rule
+ * in RFC 6020.
+ */
+public final class LeafrefListener {
+
+    /**
+     * Creates a new leafref listener.
+     */
+    private LeafrefListener() {
+    }
+
+    /**
+     * It is called when parser receives an input matching the grammar rule
+     * (leafref), perform validations and updates the data model tree.
+     *
+     * @param listener listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processLeafrefEntry(TreeWalkListener listener,
+                                           LeafrefSpecificationContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, LEAFREF_DATA, "", ENTRY);
+
+        int errorLine = ctx.getStart().getLine();
+        int errorPosition = ctx.getStart().getCharPositionInLine();
+
+        YangLeafRef<?> leafRef = new YangLeafRef<>();
+
+        leafRef.setLineNumber(errorLine);
+        leafRef.setCharPosition(errorPosition);
+        leafRef.setFileName(listener.getFileName());
+        Parsable typeData = listener.getParsedDataStack().pop();
+
+        if (!(typeData instanceof YangType)) {
+            throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, LEAFREF_DATA,
+                                                                    "", ENTRY));
+        }
+
+        YangType type = (YangType) typeData;
+        type.setDataTypeExtendedInfo(leafRef);
+
+        // Setting by default the value of require-instance as true.
+        leafRef.setRequireInstance(true);
+        Parsable tmpData = listener.getParsedDataStack().peek();
+
+        switch (tmpData.getYangConstructType()) {
+
+            case LEAF_DATA:
+
+                // Parent YANG node of leaf to be added in resolution information.
+                YangLeaf leaf = (YangLeaf) listener.getParsedDataStack().pop();
+                Parsable parentNodeOfLeaf = listener.getParsedDataStack().peek();
+                listener.getParsedDataStack().push(leaf);
+
+                // Verify parent node of leaf.
+                if (!(parentNodeOfLeaf instanceof YangNode)) {
+                    throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, LEAFREF_DATA,
+                                                                            "", ENTRY));
+                }
+
+                leafRef.setResolvableStatus(UNRESOLVED);
+                leafRef.setParentNode((YangNode) parentNodeOfLeaf);
+                if (listener.getGroupingDepth() == 0) {
+                    // Add resolution information to the list.
+                    YangResolutionInfoImpl resolutionInfo = new YangResolutionInfoImpl<YangLeafRef>(leafRef,
+                                                                                                    (YangNode) parentNodeOfLeaf, errorLine, errorPosition);
+                    addToResolutionList(resolutionInfo);
+                } else {
+                    leafRef.setInGrouping(true);
+                }
+                break;
+
+            case LEAF_LIST_DATA:
+
+                // Parent YANG node of leaf-list to be added in resolution information.
+                YangLeafList leafList = (YangLeafList) listener.getParsedDataStack().pop();
+                Parsable parentNodeOfLeafList = listener.getParsedDataStack().peek();
+                listener.getParsedDataStack().push(leafList);
+
+                // Verify parent node of leaf-list.
+                if (!(parentNodeOfLeafList instanceof YangNode)) {
+                    throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, LEAFREF_DATA,
+                                                                            "", ENTRY));
+                }
+
+                leafRef.setResolvableStatus(UNRESOLVED);
+                leafRef.setParentNode((YangNode) parentNodeOfLeafList);
+
+                if (listener.getGroupingDepth() == 0) {
+                    // Add resolution information to the list.
+                    YangResolutionInfoImpl resolutionInfoImpl = new YangResolutionInfoImpl<YangLeafRef>(leafRef,
+                                                                                                        (YangNode) parentNodeOfLeafList, errorLine, errorPosition);
+                    addToResolutionList(resolutionInfoImpl);
+                } else {
+                    leafRef.setInGrouping(true);
+                }
+                break;
+
+            case TYPEDEF_DATA:
+                Parsable parentNodeOfLeafref = listener.getParsedDataStack().peek();
+                leafRef.setParentNode((YangNode) parentNodeOfLeafref);
+                if (listener.getGroupingDepth() != 0) {
+                    leafRef.setInGrouping(true);
+                }
+                /*
+                 * Do not add the leaf ref to resolution list. It needs to be
+                 * added to resolution list, when leaf/leaf list references to
+                 * this typedef. At this time that leaf/leaf-list becomes the
+                 * parent for the leafref.
+                 */
+                break;
+
+            default:
+                throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, LEAFREF_DATA,
+                                                                        "", ENTRY));
+        }
+        listener.getParsedDataStack().push(typeData);
+        listener.getParsedDataStack().push(leafRef);
+    }
+
+    /**
+     * It is called when parser exits from grammar rule (leafref), it performs
+     * validation and updates the data model tree.
+     *
+     * @param listener listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processLeafrefExit(TreeWalkListener listener,
+                                          LeafrefSpecificationContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_CURRENT_HOLDER, LEAFREF_DATA, "", EXIT);
+
+        Parsable parsableType = listener.getParsedDataStack().pop();
+        if (!(parsableType instanceof YangLeafRef)) {
+            throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, LEAFREF_DATA,
+                                                                    "", EXIT));
+        }
+    }
+
+    /**
+     * Adds to resolution list.
+     *
+     * @param resolutionInfo resolution information
+     */
+    private static void addToResolutionList(YangResolutionInfoImpl resolutionInfo) {
+
+        try {
+            addResolutionInfo(resolutionInfo);
+        } catch (DataModelException e) {
+            throw new ParserException(constructExtendedListenerErrorMessage(UNHANDLED_PARSED_DATA,
+                                                                            LEAFREF_DATA, "", ENTRY, e.getMessage()));
+        }
+    }
+}
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/LengthRestrictionListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/LengthRestrictionListener.java
new file mode 100644
index 0000000..f682a30
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/LengthRestrictionListener.java
@@ -0,0 +1,190 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.onosproject.yang.compiler.datamodel.YangDerivedInfo;
+import org.onosproject.yang.compiler.datamodel.YangRangeRestriction;
+import org.onosproject.yang.compiler.datamodel.YangStringRestriction;
+import org.onosproject.yang.compiler.datamodel.YangType;
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.TreeWalkListener;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation;
+
+import static org.onosproject.yang.compiler.datamodel.utils.RestrictionResolver.processLengthRestriction;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.LENGTH_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.TYPE_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.getYangConstructType;
+import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes.BINARY;
+import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes.DERIVED;
+import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes.STRING;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.EXIT;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_CURRENT_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
+
+/*
+ * Reference: RFC6020 and YANG ANTLR Grammar
+ *
+ * ABNF grammar as per RFC6020
+ *  length-stmt         = length-keyword sep length-arg-str optsep
+ *                        (";" /
+ *                         "{" stmtsep
+ *                             ;; these stmts can appear in any order
+ *                             [error-message-stmt stmtsep]
+ *                             [error-app-tag-stmt stmtsep]
+ *                             [description-stmt stmtsep]
+ *                             [reference-stmt stmtsep]
+ *                          "}")
+ *
+ *
+ * ANTLR grammar rule
+ * lengthStatement : LENGTH_KEYWORD length
+ *                 (STMTEND | LEFT_CURLY_BRACE commonStatements RIGHT_CURLY_BRACE);
+ */
+
+/**
+ * Represents listener based call back function corresponding to the "length"
+ * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
+ */
+public final class LengthRestrictionListener {
+
+    /**
+     * Creates a new length restriction listener.
+     */
+    private LengthRestrictionListener() {
+    }
+
+    /**
+     * It is called when parser receives an input matching the grammar
+     * rule (length), performs validation and updates the data model
+     * tree.
+     *
+     * @param listener listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processLengthRestrictionEntry(TreeWalkListener listener,
+                                                     GeneratedYangParser.LengthStatementContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, LENGTH_DATA, ctx.length().getText(), ENTRY);
+
+        Parsable tmpData = listener.getParsedDataStack().peek();
+        if (tmpData.getYangConstructType() == TYPE_DATA) {
+            YangType type = (YangType) tmpData;
+            setLengthRestriction(listener, type, ctx);
+        } else {
+            throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, LENGTH_DATA,
+                                                                    ctx.length().getText(), ENTRY));
+        }
+    }
+
+    /**
+     * Sets the length restriction to type.
+     *
+     * @param listener listener's object
+     * @param type     Yang type for which length restriction to be set
+     * @param ctx      context object of the grammar rule
+     */
+    private static void setLengthRestriction(TreeWalkListener listener, YangType type,
+                                             GeneratedYangParser.LengthStatementContext ctx) {
+
+        if (type.getDataType() == DERIVED) {
+            ((YangDerivedInfo<YangRangeRestriction>) type.getDataTypeExtendedInfo())
+                    .setLengthRestrictionString(ctx.length().getText());
+            ((YangDerivedInfo<YangRangeRestriction>) type.getDataTypeExtendedInfo())
+                    .setLineNumber(ctx.getStart().getLine());
+            ((YangDerivedInfo<YangRangeRestriction>) type.getDataTypeExtendedInfo())
+                    .setCharPosition(ctx.getStart().getCharPositionInLine());
+            return;
+        }
+
+        if (type.getDataType() != STRING && type.getDataType() != BINARY) {
+            ParserException parserException =
+                    new ParserException(
+                            "YANG file error : " +
+                                    getYangConstructType(LENGTH_DATA) +
+                                    " name " + ctx.length().getText() +
+                                    " can be used to restrict the built-in type string/binary" +
+                                    " or types derived from string/binary.");
+            parserException.setLine(ctx.getStart().getLine());
+            parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
+            throw parserException;
+        }
+
+        YangRangeRestriction lengthRestriction = null;
+        try {
+            lengthRestriction = processLengthRestriction(null, ctx.getStart().getLine(),
+                                                         ctx.getStart().getCharPositionInLine(), false, ctx.length
+                            ().getText(), listener.getFileName());
+        } catch (DataModelException e) {
+            ParserException parserException = new ParserException(e.getMessage());
+            parserException.setCharPosition(e.getCharPositionInLine());
+            parserException.setLine(e.getLineNumber());
+            throw parserException;
+        }
+
+        if (type.getDataType() == STRING) {
+            YangStringRestriction stringRestriction = (YangStringRestriction) type.getDataTypeExtendedInfo();
+            if (stringRestriction == null) {
+                stringRestriction = new YangStringRestriction();
+                stringRestriction.setFileName(listener.getFileName());
+                stringRestriction.setCharPosition(ctx.getStart().getCharPositionInLine());
+                stringRestriction.setLineNumber(ctx.getStart().getLine());
+                type.setDataTypeExtendedInfo(stringRestriction);
+            }
+
+            stringRestriction.setLengthRestriction(lengthRestriction);
+        } else {
+            type.setDataTypeExtendedInfo(lengthRestriction);
+        }
+
+        listener.getParsedDataStack().push(lengthRestriction);
+    }
+
+    /**
+     * Performs validation and updates the data model tree.
+     * It is called when parser exits from grammar rule (length).
+     *
+     * @param listener listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processLengthRestrictionExit(TreeWalkListener listener,
+                                                    GeneratedYangParser.LengthStatementContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, LENGTH_DATA, ctx.length().getText(), EXIT);
+
+        Parsable tmpData = listener.getParsedDataStack().peek();
+        if (tmpData instanceof YangRangeRestriction) {
+            listener.getParsedDataStack().pop();
+        } else if (tmpData instanceof YangType
+                && ((YangType) tmpData).getDataType() == DERIVED) {
+            // TODO : need to handle in linker
+        } else {
+            throw new ParserException(constructListenerErrorMessage(MISSING_CURRENT_HOLDER, LENGTH_DATA,
+                                                                    ctx.length().getText(), EXIT));
+        }
+    }
+}
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/ListListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/ListListener.java
new file mode 100644
index 0000000..0048c16
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/ListListener.java
@@ -0,0 +1,213 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.onosproject.yang.compiler.datamodel.YangAugment;
+import org.onosproject.yang.compiler.datamodel.YangCase;
+import org.onosproject.yang.compiler.datamodel.YangContainer;
+import org.onosproject.yang.compiler.datamodel.YangGrouping;
+import org.onosproject.yang.compiler.datamodel.YangInput;
+import org.onosproject.yang.compiler.datamodel.YangList;
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangNotification;
+import org.onosproject.yang.compiler.datamodel.YangOutput;
+import org.onosproject.yang.compiler.datamodel.YangSubModule;
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.TreeWalkListener;
+import org.onosproject.yang.compiler.translator.tojava.YangDataModelFactory;
+
+import static org.onosproject.yang.compiler.datamodel.utils.GeneratedLanguage.JAVA_GENERATION;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.CONFIG_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.DATA_DEF_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.DESCRIPTION_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.KEY_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.LIST_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.MAX_ELEMENT_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.MIN_ELEMENT_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.REFERENCE_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.STATUS_DATA;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.ListStatementContext;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerCollisionDetector.detectCollidingChildUtil;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.EXIT;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructExtendedListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_CURRENT_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.UNHANDLED_PARSED_DATA;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil.getValidIdentifier;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil.validateUniqueInList;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.getParentNodeConfig;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.validateCardinalityMaxOne;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.validateCardinalityNonZero;
+import static org.onosproject.yang.compiler.translator.tojava.YangDataModelFactory.getYangListNode;
+
+/*
+ * Reference: RFC6020 and YANG ANTLR Grammar
+ *
+ * ABNF grammar as per RFC6020
+ *  list-stmt           = list-keyword sep identifier-arg-str optsep
+ *                        "{" stmtsep
+ *                            ;; these stmts can appear in any order
+ *                            [when-stmt stmtsep]
+ *                            *(if-feature-stmt stmtsep)
+ *                            *(must-stmt stmtsep)
+ *                            [key-stmt stmtsep]
+ *                            *(unique-stmt stmtsep)
+ *                            [config-stmt stmtsep]
+ *                            [min-elements-stmt stmtsep]
+ *                            [max-elements-stmt stmtsep]
+ *                            [ordered-by-stmt stmtsep]
+ *                            [status-stmt stmtsep]
+ *                            [description-stmt stmtsep]
+ *                            [reference-stmt stmtsep]
+ *                            *((typedef-stmt /
+ *                               grouping-stmt) stmtsep)
+ *                            1*(data-def-stmt stmtsep)
+ *                         "}"
+ *
+ * ANTLR grammar rule
+ *  listStatement : LIST_KEYWORD identifier LEFT_CURLY_BRACE (whenStatement | ifFeatureStatement | mustStatement |
+ *  keyStatement | uniqueStatement | configStatement | minElementsStatement | maxElementsStatement |
+ *  orderedByStatement | statusStatement | descriptionStatement | referenceStatement | typedefStatement |
+ *  groupingStatement| dataDefStatement)* RIGHT_CURLY_BRACE;
+ */
+
+/**
+ * Represents listener based call back function corresponding to the "list" rule
+ * defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
+ */
+public final class ListListener {
+
+    /**
+     * Creates a new list listener.
+     */
+    private ListListener() {
+    }
+
+    /**
+     * It is called when parser receives an input matching the grammar rule
+     * (list), performs validation and updates the data model tree.
+     *
+     * @param listener listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processListEntry(TreeWalkListener listener,
+                                        ListStatementContext ctx) {
+
+        YangNode curNode;
+
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, LIST_DATA, ctx.identifier().getText(), ENTRY);
+
+        String identifier = getValidIdentifier(ctx.identifier().getText(), LIST_DATA, ctx);
+
+        // Validate sub statement cardinality.
+        validateSubStatementsCardinality(ctx);
+
+        // Check for identifier collision
+        int line = ctx.getStart().getLine();
+        int charPositionInLine = ctx.getStart().getCharPositionInLine();
+        detectCollidingChildUtil(listener, line, charPositionInLine, identifier, LIST_DATA);
+
+        YangList yangList = getYangListNode(JAVA_GENERATION);
+        yangList.setName(identifier);
+        yangList.setLineNumber(line);
+        yangList.setCharPosition(charPositionInLine);
+        yangList.setFileName(listener.getFileName());
+        /*
+         * If "config" is not specified, the default is the same as the parent
+         * schema node's "config" value.
+         */
+        if (ctx.configStatement().isEmpty()) {
+            boolean parentConfig = getParentNodeConfig(listener);
+            yangList.setConfig(parentConfig);
+        }
+
+        Parsable curData = listener.getParsedDataStack().peek();
+        if (curData instanceof YangModule || curData instanceof YangContainer
+                || curData instanceof YangList || curData instanceof YangCase
+                || curData instanceof YangNotification || curData instanceof YangInput
+                || curData instanceof YangOutput || curData instanceof YangAugment
+                || curData instanceof YangGrouping || curData instanceof YangSubModule) {
+            curNode = (YangNode) curData;
+            try {
+                curNode.addChild(yangList);
+            } catch (DataModelException e) {
+                throw new ParserException(constructExtendedListenerErrorMessage(UNHANDLED_PARSED_DATA,
+                                                                                LIST_DATA, ctx.identifier().getText(), ENTRY, e.getMessage()));
+            }
+            listener.getParsedDataStack().push(yangList);
+        } else {
+            throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, LIST_DATA,
+                                                                    ctx.identifier().getText(), ENTRY));
+        }
+    }
+
+    /**
+     * It is called when parser exits from grammar rule (list), it performs
+     * validation and updates the data model tree.
+     *
+     * @param listener listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processListExit(TreeWalkListener listener,
+                                       ListStatementContext ctx) {
+
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, LIST_DATA, ctx.identifier().getText(), EXIT);
+
+        if (listener.getParsedDataStack().peek() instanceof YangList) {
+            YangList yangList = (YangList) listener.getParsedDataStack().peek();
+            try {
+                yangList.validateDataOnExit();
+                validateUniqueInList(yangList, ctx);
+            } catch (DataModelException e) {
+                ParserException parserException = new ParserException(constructExtendedListenerErrorMessage(
+                        UNHANDLED_PARSED_DATA, LIST_DATA, ctx.identifier().getText(), EXIT, e.getMessage()));
+                parserException.setLine(ctx.getStart().getLine());
+                parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
+                throw parserException;
+            }
+            listener.getParsedDataStack().pop();
+        } else {
+            throw new ParserException(constructListenerErrorMessage(MISSING_CURRENT_HOLDER, LIST_DATA,
+                                                                    ctx.identifier().getText(), EXIT));
+        }
+    }
+
+    /**
+     * Validates the cardinality of list sub-statements as per grammar.
+     *
+     * @param ctx context object of the grammar rule
+     */
+    private static void validateSubStatementsCardinality(ListStatementContext ctx) {
+
+        validateCardinalityMaxOne(ctx.keyStatement(), KEY_DATA, LIST_DATA, ctx.identifier().getText());
+        validateCardinalityMaxOne(ctx.configStatement(), CONFIG_DATA, LIST_DATA, ctx.identifier().getText());
+        validateCardinalityMaxOne(ctx.maxElementsStatement(), MAX_ELEMENT_DATA, LIST_DATA, ctx.identifier().getText());
+        validateCardinalityMaxOne(ctx.minElementsStatement(), MIN_ELEMENT_DATA, LIST_DATA, ctx.identifier().getText());
+        validateCardinalityMaxOne(ctx.descriptionStatement(), DESCRIPTION_DATA, LIST_DATA, ctx.identifier().getText());
+        validateCardinalityMaxOne(ctx.referenceStatement(), REFERENCE_DATA, LIST_DATA, ctx.identifier().getText());
+        validateCardinalityMaxOne(ctx.statusStatement(), STATUS_DATA, LIST_DATA, ctx.identifier().getText());
+        validateCardinalityNonZero(ctx.dataDefStatement(), DATA_DEF_DATA, LIST_DATA, ctx.identifier().getText(), ctx);
+        //TODO when, typedef, grouping, unique
+    }
+}
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/MandatoryListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/MandatoryListener.java
new file mode 100644
index 0000000..b711592
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/MandatoryListener.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.yang.compiler.parser.impl.listeners;
+
+import org.onosproject.yang.compiler.datamodel.YangLeaf;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.TreeWalkListener;
+
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.MANDATORY_DATA;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.MandatoryStatementContext;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil.getValidBooleanValue;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
+
+/*
+ * Reference: RFC6020 and YANG ANTLR Grammar
+ *
+ * ABNF grammar as per RFC6020
+ *  mandatory-stmt      = mandatory-keyword sep
+ *                        mandatory-arg-str stmtend
+ *
+ *  mandatory-arg-str   = < a string that matches the rule
+ *                          mandatory-arg >
+ *
+ *  mandatory-arg       = true-keyword / false-keyword
+ *
+ * ANTLR grammar rule
+ *  mandatoryStatement : MANDATORY_KEYWORD mandatory STMTEND;
+ *  mandatory          : string;
+ */
+
+/**
+ * Represents listener based call back function corresponding to the "mandatory"
+ * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
+ */
+public final class MandatoryListener {
+
+    /**
+     * Creates a new mandatory listener.
+     */
+    private MandatoryListener() {
+    }
+
+    /**
+     * It is called when parser receives an input matching the grammar
+     * rule (mandatory), performs validation and updates the data model
+     * tree.
+     *
+     * @param listener listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processMandatoryEntry(TreeWalkListener listener,
+                                             MandatoryStatementContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, MANDATORY_DATA, "", ENTRY);
+
+        boolean isMandatory = getValidBooleanValue(ctx.mandatory().getText(), MANDATORY_DATA, ctx);
+
+        Parsable tmpNode = listener.getParsedDataStack().peek();
+        switch (tmpNode.getYangConstructType()) {
+            case LEAF_DATA:
+                YangLeaf leaf = (YangLeaf) tmpNode;
+                leaf.setMandatory(isMandatory);
+                break;
+            case CHOICE_DATA: // TODO
+                break;
+            default:
+                throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, MANDATORY_DATA, "", ENTRY));
+        }
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/MaxElementsListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/MaxElementsListener.java
new file mode 100644
index 0000000..ee7f1ef
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/MaxElementsListener.java
@@ -0,0 +1,141 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.onosproject.yang.compiler.datamodel.YangLeafList;
+import org.onosproject.yang.compiler.datamodel.YangList;
+import org.onosproject.yang.compiler.datamodel.YangMaxElement;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.datamodel.utils.YangConstructType;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.TreeWalkListener;
+
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.MAX_ELEMENT_DATA;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.MaxElementsStatementContext;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil.removeQuotesAndHandleConcat;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
+
+/*
+ * Reference: RFC6020 and YANG ANTLR Grammar
+ *
+ * ABNF grammar as per RFC6020
+ *  max-elements-stmt   = max-elements-keyword sep
+ *                        max-value-arg-str stmtend
+ *  max-value-arg-str   = < a string that matches the rule
+ *                          max-value-arg >
+ *
+ * ANTLR grammar rule
+ * maxElementsStatement : MAX_ELEMENTS_KEYWORD maxValue STMTEND;
+ * maxValue             : string;
+ */
+
+/**
+ * Represents listener based call back function corresponding to the
+ * "max-elements" rule defined in ANTLR grammar file for corresponding ABNF rule
+ * in RFC 6020.
+ */
+public final class MaxElementsListener {
+
+    private static final String POSITIVE_INTEGER_PATTERN = "[1-9][0-9]*";
+    private static final String UNBOUNDED_KEYWORD = "unbounded";
+
+    /**
+     * Creates a new max-elements listener.
+     */
+    private MaxElementsListener() {
+    }
+
+    /**
+     * It is called when parser receives an input matching the grammar rule
+     * (max-elements), performs validation and updates the data model tree.
+     *
+     * @param listener listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processMaxElementsEntry(TreeWalkListener listener,
+                                               MaxElementsStatementContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, MAX_ELEMENT_DATA, "", ENTRY);
+
+        int maxElementsValue = getValidMaxElementValue(ctx);
+
+        YangMaxElement maxElement = new YangMaxElement();
+        maxElement.setMaxElement(maxElementsValue);
+
+        maxElement.setLineNumber(ctx.getStart().getLine());
+        maxElement.setCharPosition(ctx.getStart().getCharPositionInLine());
+        maxElement.setFileName(listener.getFileName());
+        Parsable tmpData = listener.getParsedDataStack().peek();
+        switch (tmpData.getYangConstructType()) {
+            case LEAF_LIST_DATA:
+                YangLeafList leafList = (YangLeafList) tmpData;
+                leafList.setMaxElements(maxElement);
+                break;
+            case LIST_DATA:
+                YangList yangList = (YangList) tmpData;
+                yangList.setMaxElements(maxElement);
+                break;
+            default:
+                throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, MAX_ELEMENT_DATA, "", ENTRY));
+        }
+    }
+
+    /**
+     * Validates max element value and returns the value from context.
+     *
+     * @param ctx context object of the grammar rule
+     * @return max element's value
+     */
+    private static int getValidMaxElementValue(MaxElementsStatementContext ctx) {
+
+        int maxElementsValue;
+
+        String value = removeQuotesAndHandleConcat(ctx.maxValue().getText());
+        if (value.equals(UNBOUNDED_KEYWORD)) {
+            maxElementsValue = Integer.MAX_VALUE;
+        } else if (value.matches(POSITIVE_INTEGER_PATTERN)) {
+            try {
+                maxElementsValue = Integer.parseInt(value);
+            } catch (NumberFormatException e) {
+                ParserException parserException = new ParserException("YANG file error : " +
+                                                                              YangConstructType.getYangConstructType(
+                                                                                      MAX_ELEMENT_DATA) + " value " +
+                                                                              value + " is not " +
+                                                                              "valid.");
+                parserException.setLine(ctx.getStart().getLine());
+                parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
+                throw parserException;
+            }
+        } else {
+            ParserException parserException = new ParserException("YANG file error : " +
+                                                                          YangConstructType.getYangConstructType(
+                                                                                  MAX_ELEMENT_DATA) + " value " +
+                                                                          value + " is not " +
+                                                                          "valid.");
+            parserException.setLine(ctx.getStart().getLine());
+            parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
+            throw parserException;
+        }
+
+        return maxElementsValue;
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/MinElementsListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/MinElementsListener.java
new file mode 100644
index 0000000..ed80c4c
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/MinElementsListener.java
@@ -0,0 +1,102 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.onosproject.yang.compiler.datamodel.YangLeafList;
+import org.onosproject.yang.compiler.datamodel.YangList;
+import org.onosproject.yang.compiler.datamodel.YangMinElement;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.TreeWalkListener;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil;
+
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.MIN_ELEMENT_DATA;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.MinElementsStatementContext;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil.getValidNonNegativeIntegerValue;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
+
+/*
+ * Reference: RFC6020 and YANG ANTLR Grammar
+ *
+ * ABNF grammar as per RFC6020
+ *  min-elements-stmt   = min-elements-keyword sep
+ *                        min-value-arg-str stmtend
+ *  min-value-arg-str   = < a string that matches the rule
+ *                          min-value-arg >
+ *  min-value-arg       = non-negative-integer-value
+ *
+ * ANTLR grammar rule
+ * minElementsStatement : MIN_ELEMENTS_KEYWORD minValue STMTEND;
+ * minValue             : string;
+ */
+
+/**
+ * Represents listener based call back function corresponding to the "min-elements"
+ * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
+ */
+public final class MinElementsListener {
+
+    /**
+     * Creates a new min-elements listener.
+     */
+    private MinElementsListener() {
+    }
+
+    /**
+     * It is called when parser receives an input matching the grammar
+     * rule (min-elements), performs validation and updates the data model
+     * tree.
+     *
+     * @param listener listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processMinElementsEntry(TreeWalkListener listener,
+                                               MinElementsStatementContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, MIN_ELEMENT_DATA, ctx.minValue().getText(), ENTRY);
+
+        int minElementValue = getValidNonNegativeIntegerValue(ctx.minValue().getText(), MIN_ELEMENT_DATA, ctx);
+
+        YangMinElement minElement = new YangMinElement();
+
+        minElement.setMinElement(minElementValue);
+        minElement.setLineNumber(ctx.getStart().getLine());
+        minElement.setCharPosition(ctx.getStart().getCharPositionInLine());
+        minElement.setFileName(listener.getFileName());
+        Parsable tmpData = listener.getParsedDataStack().peek();
+        switch (tmpData.getYangConstructType()) {
+            case LEAF_LIST_DATA:
+                YangLeafList leafList = (YangLeafList) tmpData;
+                leafList.setMinElements(minElement);
+                break;
+            case LIST_DATA:
+                YangList yangList = (YangList) tmpData;
+                yangList.setMinElements(minElement);
+                break;
+            default:
+                throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, MIN_ELEMENT_DATA,
+                                                                        ctx.minValue().getText(), ENTRY));
+        }
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/ModuleListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/ModuleListener.java
new file mode 100644
index 0000000..346e35c
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/ModuleListener.java
@@ -0,0 +1,158 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangReferenceResolver;
+import org.onosproject.yang.compiler.datamodel.YangResolutionInfo;
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.linker.exceptions.LinkerException;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.TreeWalkListener;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType;
+
+import java.util.List;
+
+import static org.onosproject.yang.compiler.datamodel.ResolvableType.YANG_BASE;
+import static org.onosproject.yang.compiler.datamodel.ResolvableType.YANG_COMPILER_ANNOTATION;
+import static org.onosproject.yang.compiler.datamodel.ResolvableType.YANG_DERIVED_DATA_TYPE;
+import static org.onosproject.yang.compiler.datamodel.ResolvableType.YANG_IDENTITYREF;
+import static org.onosproject.yang.compiler.datamodel.ResolvableType.YANG_IF_FEATURE;
+import static org.onosproject.yang.compiler.datamodel.ResolvableType.YANG_LEAFREF;
+import static org.onosproject.yang.compiler.datamodel.ResolvableType.YANG_USES;
+import static org.onosproject.yang.compiler.datamodel.utils.GeneratedLanguage.JAVA_GENERATION;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.MODULE_DATA;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.ModuleStatementContext;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.EXIT;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.INVALID_CHILD;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_CURRENT_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil.getValidIdentifier;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.checkStackIsEmpty;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
+import static org.onosproject.yang.compiler.translator.tojava.YangDataModelFactory.getYangModuleNode;
+
+/*
+ * Reference: RFC6020 and YANG ANTLR Grammar
+ *
+ * ABNF grammar as per RFC6020
+ * module-stmt         = optsep module-keyword sep identifier-arg-str
+ *                       optsep
+ *                       "{" stmtsep
+ *                           module-header-stmts
+ *                           linkage-stmts
+ *                           meta-stmts
+ *                           revision-stmts
+ *                           body-stmts
+ *                       "}" optsep
+ *
+ * ANTLR grammar rule
+ * module_stmt : MODULE_KEYWORD identifier LEFT_CURLY_BRACE module_body* RIGHT_CURLY_BRACE;
+ */
+
+/**
+ * Represents listener based call back function corresponding to the "module"
+ * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
+ */
+public final class ModuleListener {
+
+    /**
+     * Creates a new module listener.
+     */
+    private ModuleListener() {
+    }
+
+    /**
+     * It is called when parser receives an input matching the grammar rule
+     * (module), perform validations and update the data model tree.
+     *
+     * @param listener Listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processModuleEntry(TreeWalkListener listener,
+                                          ModuleStatementContext ctx) {
+
+        // Check if stack is empty.
+        checkStackIsEmpty(listener, INVALID_HOLDER, MODULE_DATA,
+                          ctx.identifier().getText(), ENTRY);
+        String identifier = getValidIdentifier(ctx.identifier().getText(),
+                                               MODULE_DATA, ctx);
+        YangModule yangModule = getYangModuleNode(JAVA_GENERATION);
+        yangModule.setName(identifier);
+        yangModule.setLineNumber(ctx.getStart().getLine());
+        yangModule.setCharPosition(ctx.getStart().getCharPositionInLine());
+        yangModule.setFileName(listener.getFileName());
+
+        if (ctx.moduleBody().moduleHeaderStatement().yangVersionStatement() == null) {
+            yangModule.setVersion((byte) 1);
+        }
+
+        listener.getParsedDataStack().push(yangModule);
+    }
+
+    /**
+     * It is called when parser exits from grammar rule (module), it perform
+     * validations and update the data model tree.
+     *
+     * @param listener Listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processModuleExit(TreeWalkListener listener,
+                                         ModuleStatementContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, MODULE_DATA,
+                             ctx.identifier().getText(), EXIT);
+        Parsable tmpNode = listener.getParsedDataStack().peek();
+        if (!(tmpNode instanceof YangModule)) {
+            throwError(MISSING_CURRENT_HOLDER, ctx);
+        }
+
+        YangModule module = (YangModule) tmpNode;
+        List<YangResolutionInfo> info = module.getUnresolvedResolutionList(
+                YANG_COMPILER_ANNOTATION);
+        if (info != null && !info.isEmpty() && module.getChild() != null) {
+            throwError(INVALID_CHILD, ctx);
+        }
+        YangReferenceResolver resolver = (YangReferenceResolver) listener
+                .getParsedDataStack().peek();
+        try {
+            resolver.resolveSelfFileLinking(YANG_IF_FEATURE);
+            resolver.resolveSelfFileLinking(YANG_USES);
+            resolver.resolveSelfFileLinking(YANG_DERIVED_DATA_TYPE);
+            resolver.resolveSelfFileLinking(YANG_LEAFREF);
+            resolver.resolveSelfFileLinking(YANG_BASE);
+            resolver.resolveSelfFileLinking(YANG_IDENTITYREF);
+        } catch (DataModelException e) {
+            LinkerException linkerException = new LinkerException(e.getMessage());
+            linkerException.setLine(e.getLineNumber());
+            linkerException.setCharPosition(e.getCharPositionInLine());
+            linkerException.setFileName(listener.getFileName());
+            throw linkerException;
+        }
+    }
+
+    private static void throwError(ListenerErrorType type,
+                                   ModuleStatementContext ctx) {
+        throw new ParserException(constructListenerErrorMessage(
+                type, MODULE_DATA, ctx.identifier().getText(), EXIT));
+    }
+}
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/MustListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/MustListener.java
new file mode 100644
index 0000000..b9e542d
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/MustListener.java
@@ -0,0 +1,122 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.onosproject.yang.compiler.datamodel.YangMust;
+import org.onosproject.yang.compiler.datamodel.YangMustHolder;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.TreeWalkListener;
+
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.MUST_DATA;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.MustStatementContext;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.EXIT;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_CURRENT_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil.removeQuotesAndHandleConcat;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
+
+/*
+ * Reference: RFC6020 and YANG ANTLR Grammar
+ *
+ * ABNF grammar as per RFC6020
+ *
+ *  must-stmt           = must-keyword sep string optsep
+ *                        (";" /
+ *                         "{" stmtsep
+ *                             ;; these stmts can appear in any order
+ *                             [error-message-stmt stmtsep]
+ *                             [error-app-tag-stmt stmtsep]
+ *                             [description-stmt stmtsep]
+ *                             [reference-stmt stmtsep]
+ *                          "}")
+ *
+ * ANTLR grammar rule
+ * mustStatement : MUST_KEYWORD string (STMTEND | LEFT_CURLY_BRACE commonStatements RIGHT_CURLY_BRACE);
+ */
+
+/**
+ * Represents listener based call back function corresponding to the
+ * "must" rule defined in ANTLR grammar file for corresponding ABNF rule
+ * in RFC 6020.
+ */
+public final class MustListener {
+
+    /**
+     * Creates a new must listener.
+     */
+    private MustListener() {
+    }
+
+    /**
+     * Perform validations and updates the data model tree.It is called when parser
+     * receives an input matching the grammar rule (must).
+     *
+     * @param listener listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processMustEntry(TreeWalkListener listener,
+                                        MustStatementContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, MUST_DATA, ctx.string().getText(), ENTRY);
+        String constraint = removeQuotesAndHandleConcat(ctx.string().getText());
+
+        // Obtain the node of the stack.
+        Parsable tmpNode = listener.getParsedDataStack().peek();
+        if (tmpNode instanceof YangMustHolder) {
+
+            YangMust must = new YangMust();
+            must.setConstraint(constraint);
+
+            must.setLineNumber(ctx.getStart().getLine());
+            must.setCharPosition(ctx.getStart().getCharPositionInLine());
+            must.setFileName(listener.getFileName());
+            YangMustHolder mustHolder = (YangMustHolder) tmpNode;
+            mustHolder.addMust(must);
+
+            listener.getParsedDataStack().push(must);
+        } else {
+            throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, MUST_DATA,
+                                                                    ctx.string().getText(), ENTRY));
+        }
+    }
+
+    /**
+     * Performs validation and updates the data model tree.It is called when parser
+     * exits from grammar rule (must).
+     *
+     * @param listener listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processMustExit(TreeWalkListener listener,
+                                       MustStatementContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, MUST_DATA, ctx.string().getText(), EXIT);
+
+        if (listener.getParsedDataStack().peek() instanceof YangMust) {
+            listener.getParsedDataStack().pop();
+        } else {
+            throw new ParserException(constructListenerErrorMessage(MISSING_CURRENT_HOLDER, MUST_DATA,
+                                                                    ctx.string().getText(), EXIT));
+        }
+    }
+}
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/NamespaceListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/NamespaceListener.java
new file mode 100644
index 0000000..b783c09
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/NamespaceListener.java
@@ -0,0 +1,118 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.TreeWalkListener;
+
+import java.net.URI;
+
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.NAMESPACE_DATA;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.NamespaceStatementContext;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil.removeQuotesAndHandleConcat;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
+
+/*
+ * Reference: RFC6020 and YANG ANTLR Grammar
+ *
+ * ABNF grammar as per RFC6020
+ * module-header-stmts = ;; these stmts can appear in any order
+ *                       [yang-version-stmt stmtsep]
+ *                        namespace-stmt stmtsep
+ *                        prefix-stmt stmtsep
+ *
+ * namespace-stmt      = namespace-keyword sep uri-str optsep stmtend
+ *
+ * ANTLR grammar rule
+ * module_header_statement : yang_version_stmt? namespace_stmt prefix_stmt
+ *                         | yang_version_stmt? prefix_stmt namespace_stmt
+ *                         | namespace_stmt yang_version_stmt? prefix_stmt
+ *                         | namespace_stmt prefix_stmt yang_version_stmt?
+ *                         | prefix_stmt namespace_stmt yang_version_stmt?
+ *                         | prefix_stmt yang_version_stmt? namespace_stmt
+ *                         ;
+ * namespace_stmt : NAMESPACE_KEYWORD string STMTEND;
+ */
+
+/**
+ * Represents listener based call back function corresponding to the "namespace"
+ * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
+ */
+public final class NamespaceListener {
+
+    /**
+     * Creates a new namespace listener.
+     */
+    private NamespaceListener() {
+    }
+
+    /**
+     * It is called when parser receives an input matching the grammar rule
+     * (namespace), perform validations and update the data model tree.
+     *
+     * @param listener Listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processNamespaceEntry(TreeWalkListener listener,
+                                             NamespaceStatementContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, NAMESPACE_DATA, ctx.string().getText(), ENTRY);
+
+        if (!validateUriValue(ctx.string().getText())) {
+            ParserException parserException = new ParserException("YANG file error: Invalid namespace URI");
+            parserException.setLine(ctx.string().STRING(0).getSymbol().getLine());
+            parserException.setCharPosition(ctx.string().STRING(0).getSymbol().getCharPositionInLine());
+            throw parserException;
+        }
+
+        // Obtain the node of the stack.
+        Parsable tmpNode = listener.getParsedDataStack().peek();
+        switch (tmpNode.getYangConstructType()) {
+            case MODULE_DATA: {
+                YangModule module = (YangModule) tmpNode;
+                module.setModuleNamespace(removeQuotesAndHandleConcat(ctx.string().getText()));
+                break;
+            }
+            default:
+                throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, NAMESPACE_DATA,
+                                                                        ctx.string().getText(), ENTRY));
+        }
+    }
+
+    /**
+     * Validate input URI.
+     *
+     * @param uri input namespace URI
+     * @return validation result
+     */
+    private static boolean validateUriValue(String uri) {
+        uri = uri.replace("\"", "");
+        try {
+            URI.create(uri);
+        } catch (Exception e1) {
+            return false;
+        }
+        return true;
+    }
+}
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/NotificationListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/NotificationListener.java
new file mode 100644
index 0000000..94bcee4
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/NotificationListener.java
@@ -0,0 +1,171 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.onosproject.yang.compiler.datamodel.RpcNotificationContainer;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangNotification;
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.TreeWalkListener;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType;
+
+import static org.onosproject.yang.compiler.datamodel.utils.GeneratedLanguage.JAVA_GENERATION;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.DESCRIPTION_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.NOTIFICATION_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.REFERENCE_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.STATUS_DATA;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.NotificationStatementContext;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerCollisionDetector.detectCollidingChildUtil;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.EXIT;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructExtendedListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_CURRENT_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.UNHANDLED_PARSED_DATA;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil.getValidIdentifier;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.validateCardinalityMaxOne;
+import static org.onosproject.yang.compiler.translator.tojava.YangDataModelFactory.getYangNotificationNode;
+
+/*
+ * Reference: RFC6020 and YANG ANTLR Grammar
+ *
+ * ABNF grammar as per RFC6020
+ *  notification-stmt   = notification-keyword sep
+ *                        identifier-arg-str optsep
+ *                        (";" /
+ *                         "{" stmtsep
+ *                             ;; these stmts can appear in any order
+ *                             *(if-feature-stmt stmtsep)
+ *                             [status-stmt stmtsep]
+ *                             [description-stmt stmtsep]
+ *                             [reference-stmt stmtsep]
+ *                             *((typedef-stmt /
+ *                                grouping-stmt) stmtsep)
+ *                             *(data-def-stmt stmtsep)
+ *                         "}")
+ *
+ * ANTLR grammar rule
+ *    notificationStatement : NOTIFICATION_KEYWORD identifier (STMTEND | LEFT_CURLY_BRACE (ifFeatureStatement
+ *                          | statusStatement | descriptionStatement | referenceStatement | typedefStatement
+ *                          | groupingStatement | dataDefStatement)* RIGHT_CURLY_BRACE);
+ */
+
+/**
+ * Represents listener based call back function corresponding to the "notification"
+ * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
+ */
+public final class NotificationListener {
+
+    /**
+     * Creates a new notification listener.
+     */
+    private NotificationListener() {
+    }
+
+    /**
+     * It is called when parser receives an input matching the grammar rule
+     * (notification), performs validation and updates the data model tree.
+     *
+     * @param listener listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processNotificationEntry(TreeWalkListener listener,
+                                                NotificationStatementContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, NOTIFICATION_DATA,
+                             ctx.identifier().getText(), ENTRY);
+
+        String identifier = getValidIdentifier(ctx.identifier().getText(),
+                                               NOTIFICATION_DATA, ctx);
+
+        // Validate sub statement cardinality.
+        validateSubStatementsCardinality(ctx);
+
+        // Check for identifier collision
+        int line = ctx.getStart().getLine();
+        int charPositionInLine = ctx.getStart().getCharPositionInLine();
+        detectCollidingChildUtil(listener, line, charPositionInLine, identifier,
+                                 NOTIFICATION_DATA);
+
+        Parsable curData = listener.getParsedDataStack().peek();
+        if (curData instanceof RpcNotificationContainer) {
+
+            YangNotification notification = getYangNotificationNode(JAVA_GENERATION);
+            notification.setName(identifier);
+
+            notification.setLineNumber(ctx.getStart().getLine());
+            notification.setCharPosition(ctx.getStart().getCharPositionInLine());
+            notification.setFileName(listener.getFileName());
+            ((RpcNotificationContainer) curData).setNotificationPresenceFlag(true);
+            YangNode curNode = (YangNode) curData;
+            try {
+                curNode.addChild(notification);
+            } catch (DataModelException e) {
+                throw new ParserException(constructExtendedListenerErrorMessage(UNHANDLED_PARSED_DATA,
+                                                                                NOTIFICATION_DATA, ctx.identifier().getText(), ENTRY, e.getMessage()));
+            }
+            listener.getParsedDataStack().push(notification);
+        } else {
+            throw new ParserException(constructListenerErrorMessage(ListenerErrorType.INVALID_HOLDER, NOTIFICATION_DATA,
+                                                                    ctx.identifier().getText(), ENTRY));
+        }
+    }
+
+    /**
+     * It is called when parser exits from grammar rule (notification), it perform
+     * validations and updates the data model tree.
+     *
+     * @param listener listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processNotificationExit(TreeWalkListener listener,
+                                               NotificationStatementContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, NOTIFICATION_DATA,
+                             ctx.identifier().getText(), EXIT);
+
+        if (listener.getParsedDataStack().peek() instanceof YangNotification) {
+            listener.getParsedDataStack().pop();
+        } else {
+            throw new ParserException(constructListenerErrorMessage(MISSING_CURRENT_HOLDER, NOTIFICATION_DATA,
+                                                                    ctx.identifier().getText(), EXIT));
+        }
+    }
+
+    /**
+     * Validates the cardinality of notification sub-statements as per grammar.
+     *
+     * @param ctx context object of the grammar rule
+     */
+    private static void validateSubStatementsCardinality(NotificationStatementContext ctx) {
+
+        validateCardinalityMaxOne(ctx.statusStatement(), STATUS_DATA,
+                                  NOTIFICATION_DATA, ctx.identifier().getText());
+        validateCardinalityMaxOne(ctx.descriptionStatement(),
+                                  DESCRIPTION_DATA, NOTIFICATION_DATA,
+                                  ctx.identifier().getText());
+        validateCardinalityMaxOne(ctx.referenceStatement(), REFERENCE_DATA,
+                                  NOTIFICATION_DATA,
+                                  ctx.identifier().getText());
+    }
+}
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/OrganizationListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/OrganizationListener.java
new file mode 100644
index 0000000..9fc259f
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/OrganizationListener.java
@@ -0,0 +1,119 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangSubModule;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.TreeWalkListener;
+
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.ORGANIZATION_DATA;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.OrganizationStatementContext;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
+
+/*
+ * Reference: RFC6020 and YANG ANTLR Grammar
+ *
+ * ABNF grammar as per RFC6020
+ * meta-stmts          = ;; these stmts can appear in any order
+ *                       [organization-stmt stmtsep]
+ *                       [contact-stmt stmtsep]
+ *                       [description-stmt stmtsep]
+ *                       [reference-stmt stmtsep]
+ * organization-stmt   = organization-keyword sep string
+ *                            optsep stmtend
+ *
+ * ANTLR grammar rule
+ * meta_stmts : organization_stmt? contact_stmt? description_stmt? reference_stmt?
+ *            | organization_stmt? contact_stmt? reference_stmt? description_stmt?
+ *            | organization_stmt? description_stmt? contact_stmt? reference_stmt?
+ *            | organization_stmt? description_stmt? reference_stmt? contact_stmt?
+ *            | organization_stmt? reference_stmt? contact_stmt? description_stmt?
+ *            | organization_stmt? reference_stmt? description_stmt? contact_stmt?
+ *            | contact_stmt? organization_stmt? description_stmt? reference_stmt?
+ *            | contact_stmt? organization_stmt? reference_stmt? description_stmt?
+ *            | contact_stmt? reference_stmt? organization_stmt? description_stmt?
+ *            | contact_stmt? reference_stmt? description_stmt? organization_stmt?
+ *            | contact_stmt? description_stmt? reference_stmt? organization_stmt?
+ *            | contact_stmt? description_stmt? organization_stmt? reference_stmt?
+ *            | reference_stmt? contact_stmt? organization_stmt? description_stmt?
+ *            | reference_stmt? contact_stmt? description_stmt? organization_stmt?
+ *            | reference_stmt? organization_stmt? contact_stmt? description_stmt?
+ *            | reference_stmt? organization_stmt? description_stmt? contact_stmt?
+ *            | reference_stmt? description_stmt? organization_stmt? contact_stmt?
+ *            | reference_stmt? description_stmt? contact_stmt? organization_stmt?
+ *            | description_stmt? reference_stmt? contact_stmt? organization_stmt?
+ *            | description_stmt? reference_stmt? organization_stmt? contact_stmt?
+ *            | description_stmt? contact_stmt? reference_stmt? organization_stmt?
+ *            | description_stmt? contact_stmt? organization_stmt? reference_stmt?
+ *            | description_stmt? organization_stmt? contact_stmt? reference_stmt?
+ *            | description_stmt? organization_stmt? reference_stmt? contact_stmt?
+ *            ;
+ * organization_stmt : ORGANIZATION_KEYWORD string STMTEND;
+ */
+
+/**
+ * Represents listener based call back function corresponding to the
+ * "organization" rule defined in ANTLR grammar file for corresponding ABNF rule
+ * in RFC 6020.
+ */
+public final class OrganizationListener {
+
+    /**
+     * Creates a new organization listener.
+     */
+    private OrganizationListener() {
+    }
+
+    /**
+     * It is called when parser receives an input matching the grammar rule
+     * (organization), perform validations and update the data model tree.
+     *
+     * @param listener Listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processOrganizationEntry(TreeWalkListener listener,
+                                                OrganizationStatementContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, ORGANIZATION_DATA, ctx.string().getText(),
+                             ENTRY);
+
+        // Obtain the node of the stack.
+        Parsable tmpNode = listener.getParsedDataStack().peek();
+        switch (tmpNode.getYangConstructType()) {
+            case MODULE_DATA: {
+                YangModule module = (YangModule) tmpNode;
+                module.setOrganization(ctx.string().getText());
+                break;
+            }
+            case SUB_MODULE_DATA: {
+                YangSubModule subModule = (YangSubModule) tmpNode;
+                subModule.setOrganization(ctx.string().getText());
+                break;
+            }
+            default:
+                throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, ORGANIZATION_DATA,
+                                                                        ctx.string().getText(), ENTRY));
+        }
+    }
+}
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/OutputListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/OutputListener.java
new file mode 100644
index 0000000..ae240b4
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/OutputListener.java
@@ -0,0 +1,130 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangOutput;
+import org.onosproject.yang.compiler.datamodel.YangRpc;
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.TreeWalkListener;
+import org.onosproject.yang.compiler.utils.UtilConstants;
+
+import static org.onosproject.yang.compiler.datamodel.utils.GeneratedLanguage.JAVA_GENERATION;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.OUTPUT_DATA;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.OutputStatementContext;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.EXIT;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructExtendedListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_CURRENT_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.UNHANDLED_PARSED_DATA;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
+import static org.onosproject.yang.compiler.translator.tojava.YangDataModelFactory.getYangOutputNode;
+import static org.onosproject.yang.compiler.utils.UtilConstants.OUTPUT;
+
+/*
+ * Reference: RFC6020 and YANG ANTLR Grammar
+ *
+ * ABNF grammar as per RFC6020
+ *
+ *  output-stmt         = output-keyword optsep
+ *                        "{" stmtsep
+ *                            ;; these stmts can appear in any order
+ *                            *((typedef-stmt /
+ *                               grouping-stmt) stmtsep)
+ *                            1*(data-def-stmt stmtsep)
+ *                        "}"
+ *
+ *  outputStatement : OUTPUT_KEYWORD LEFT_CURLY_BRACE outputStatementBody RIGHT_CURLY_BRACE;
+
+ *  outputStatementBody : typedefStatement* dataDefStatement+
+ *                      | dataDefStatement+ typedefStatement*
+ *                      | groupingStatement* dataDefStatement+
+ *                      | dataDefStatement+ groupingStatement*;
+ */
+
+/**
+ * Represents listener based call back function corresponding to the "output"
+ * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
+ */
+public final class OutputListener {
+
+    /**
+     * Creates a new output listener.
+     */
+    private OutputListener() {
+    }
+
+    /**
+     * It is called when parser receives an input matching the grammar rule
+     * (output), performs validation and updates the data model tree.
+     *
+     * @param listener listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processOutputEntry(TreeWalkListener listener,
+                                          OutputStatementContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, OUTPUT_DATA, "", ENTRY);
+
+        Parsable curData = listener.getParsedDataStack().peek();
+        if (curData instanceof YangRpc) {
+
+            YangOutput yangOutput = getYangOutputNode(JAVA_GENERATION);
+            yangOutput.setName(OUTPUT);
+            yangOutput.setLineNumber(ctx.getStart().getLine());
+            yangOutput.setCharPosition(ctx.getStart().getCharPositionInLine());
+            yangOutput.setFileName(listener.getFileName());
+            YangNode curNode = (YangNode) curData;
+            try {
+                curNode.addChild(yangOutput);
+            } catch (DataModelException e) {
+                throw new ParserException(constructExtendedListenerErrorMessage(UNHANDLED_PARSED_DATA,
+                                                                                OUTPUT_DATA, "", ENTRY, e.getMessage()));
+            }
+            listener.getParsedDataStack().push(yangOutput);
+        } else {
+            throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, OUTPUT_DATA,
+                                                                    "", ENTRY));
+        }
+    }
+
+    /**
+     * It is called when parser exits from grammar rule (output), it perform
+     * validations and updates the data model tree.
+     *
+     * @param listener listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processOutputExit(TreeWalkListener listener,
+                                         OutputStatementContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, OUTPUT_DATA, "", EXIT);
+
+        if (!(listener.getParsedDataStack().peek() instanceof YangOutput)) {
+            throw new ParserException(constructListenerErrorMessage(MISSING_CURRENT_HOLDER, OUTPUT_DATA,
+                                                                    "", EXIT));
+        }
+        listener.getParsedDataStack().pop();
+    }
+}
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/PathListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/PathListener.java
new file mode 100644
index 0000000..c1e8b7c
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/PathListener.java
@@ -0,0 +1,92 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.onosproject.yang.compiler.datamodel.YangLeafRef;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.PathStatementContext;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.TreeWalkListener;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil;
+
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.PATH_DATA;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil.validatePath;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
+
+/*
+ * Reference: RFC6020 and YANG ANTLR Grammar
+ *
+ * ABNF grammar as per RFC6020
+ *  leafref-specification =
+ *                        ;; these stmts can appear in any order
+ *                        path-stmt stmtsep
+ *                        [require-instance-stmt stmtsep]
+ *
+ * path-stmt           = path-keyword sep path-arg-str stmtend
+ *
+ * ANTLR grammar rule
+ *
+ * leafrefSpecification : (pathStatement (requireInstanceStatement)?) |
+ * ((requireInstanceStatement)? pathStatement);
+ *
+ * pathStatement : PATH_KEYWORD path STMTEND;
+ */
+
+/**
+ * Represents listener based call back function corresponding to the
+ * "path" rule defined in ANTLR grammar file for corresponding ABNF rule
+ * in RFC 6020.
+ */
+public final class PathListener {
+
+    // No instantiation.
+    private PathListener() {
+    }
+
+    /**
+     * It is called when parser receives an input matching the grammar rule
+     * (path), performs validation and updates the data model tree.
+     *
+     * @param listener listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processPathEntry(TreeWalkListener listener,
+                                        PathStatementContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, PATH_DATA,
+                             ctx.path().getText(), ENTRY);
+
+        Parsable curData = listener.getParsedDataStack().peek();
+
+        // Checks the holder of path as leaf-ref, else throws error.
+        if (curData instanceof YangLeafRef) {
+            // Parsing the path and updating in leaf-ref path.
+            validatePath(ctx.path().getText(), PATH_DATA, ctx,
+                         (YangLeafRef) curData);
+        } else {
+            throw new ParserException(
+                    constructListenerErrorMessage(INVALID_HOLDER, PATH_DATA,
+                                                  ctx.path().getText(), ENTRY));
+        }
+    }
+}
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/PatternRestrictionListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/PatternRestrictionListener.java
new file mode 100644
index 0000000..c522c4b
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/PatternRestrictionListener.java
@@ -0,0 +1,203 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.antlr.v4.runtime.tree.TerminalNode;
+import org.onosproject.yang.compiler.datamodel.YangDerivedInfo;
+import org.onosproject.yang.compiler.datamodel.YangPatternRestriction;
+import org.onosproject.yang.compiler.datamodel.YangStringRestriction;
+import org.onosproject.yang.compiler.datamodel.YangType;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.TreeWalkListener;
+
+import java.util.List;
+import java.util.regex.Pattern;
+import java.util.regex.PatternSyntaxException;
+
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.PATTERN_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.TYPE_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.getYangConstructType;
+import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes.DERIVED;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.PatternStatementContext;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.EXIT;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_CURRENT_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
+
+/*
+ * Reference: RFC6020 and YANG ANTLR Grammar
+ *
+ * ABNF grammar as per RFC6020
+ *  pattern-stmt        = pattern-keyword sep string optsep
+ *                        (";" /
+ *                         "{" stmtsep
+ *                             ;; these stmts can appear in any order
+ *                             [error-message-stmt stmtsep]
+ *                             [error-app-tag-stmt stmtsep]
+ *                             [description-stmt stmtsep]
+ *                             [reference-stmt stmtsep]
+ *                          "}")
+ *
+ * ANTLR grammar rule
+ *  patternStatement : PATTERN_KEYWORD string (STMTEND | LEFT_CURLY_BRACE commonStatements RIGHT_CURLY_BRACE);
+ */
+
+/**
+ * Represents listener based call back function corresponding to the "pattern"
+ * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
+ */
+public final class PatternRestrictionListener {
+
+    private static final String EMPTY_STRING = "";
+
+    /**
+     * Creates a new pattern restriction listener.
+     */
+    private PatternRestrictionListener() {
+    }
+
+    /**
+     * It is called when parser receives an input matching the grammar
+     * rule (pattern), performs validation and updates the data model
+     * tree.
+     *
+     * @param listener listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processPatternRestrictionEntry(TreeWalkListener listener,
+                                                      PatternStatementContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, PATTERN_DATA, ctx.string().getText(), ENTRY);
+
+        Parsable tmpData = listener.getParsedDataStack().peek();
+        if (tmpData.getYangConstructType() == TYPE_DATA) {
+            YangType type = (YangType) tmpData;
+            setPatternRestriction(listener, type, ctx);
+        } else {
+            throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, PATTERN_DATA,
+                                                                    ctx.string().getText(), ENTRY));
+        }
+    }
+
+    /**
+     * Sets the pattern restriction to type.
+     *
+     * @param listener listener's object
+     * @param type     Yang type for which pattern restriction to be set
+     * @param ctx      context object of the grammar rule
+     */
+    private static void setPatternRestriction(TreeWalkListener listener, YangType type,
+                                              PatternStatementContext ctx) {
+
+        if (type.getDataType() != YangDataTypes.STRING && type.getDataType() != YangDataTypes.DERIVED) {
+
+            ParserException parserException = new ParserException("YANG file error : " +
+                                                                          getYangConstructType(PATTERN_DATA) + " name " + ctx.string().getText() +
+                                                                          " can be used to restrict the built-in type string or types derived from string.");
+            parserException.setLine(ctx.getStart().getLine());
+            parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
+            throw parserException;
+        }
+
+        // Validate and get valid pattern restriction string.
+        String patternArgument = getValidPattern(ctx);
+
+        if (type.getDataType() == YangDataTypes.STRING) {
+            YangStringRestriction stringRestriction = (YangStringRestriction) type.getDataTypeExtendedInfo();
+            if (stringRestriction == null) {
+                stringRestriction = new YangStringRestriction();
+                stringRestriction.setFileName(listener.getFileName());
+                stringRestriction.setCharPosition(ctx.getStart().getCharPositionInLine());
+                stringRestriction.setLineNumber(ctx.getStart().getLine());
+                type.setDataTypeExtendedInfo(stringRestriction);
+                stringRestriction.addPattern(patternArgument);
+            } else {
+                stringRestriction.addPattern(patternArgument);
+            }
+            listener.getParsedDataStack().push(stringRestriction);
+        } else {
+            YangPatternRestriction patternRestriction = ((YangDerivedInfo<?>) type
+                    .getDataTypeExtendedInfo()).getPatternRestriction();
+            if (patternRestriction == null) {
+                patternRestriction = new YangPatternRestriction();
+                ((YangDerivedInfo<?>) type.getDataTypeExtendedInfo()).setPatternRestriction(patternRestriction);
+                patternRestriction.addPattern(patternArgument);
+            } else {
+                ((YangDerivedInfo<?>) type.getDataTypeExtendedInfo()).setPatternRestriction(patternRestriction);
+                patternRestriction.addPattern(patternArgument);
+            }
+        }
+    }
+
+    /**
+     * Performs validation and updates the data model tree.
+     * It is called when parser exits from grammar rule (pattern).
+     *
+     * @param listener listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processPatternRestrictionExit(TreeWalkListener listener,
+                                                     PatternStatementContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, PATTERN_DATA, ctx.string().getText(), EXIT);
+
+        Parsable tmpData = listener.getParsedDataStack().peek();
+        if (tmpData instanceof YangStringRestriction) {
+            listener.getParsedDataStack().pop();
+        } else if (tmpData instanceof YangType
+                && ((YangType) tmpData).getDataType() == DERIVED) {
+            // TODO : need to handle in linker
+        } else {
+            throw new ParserException(constructListenerErrorMessage(MISSING_CURRENT_HOLDER, PATTERN_DATA,
+                                                                    ctx.string().getText(), EXIT));
+        }
+    }
+
+    /**
+     * Validates and return the valid pattern.
+     *
+     * @param ctx context object of the grammar rule
+     * @return validated string
+     */
+    private static String getValidPattern(PatternStatementContext ctx) {
+        List<TerminalNode> patternList = ctx.string().STRING();
+        StringBuilder userInputPattern = new StringBuilder();
+        String compile;
+        for (TerminalNode pattern : patternList) {
+            userInputPattern.append(pattern.getText());
+        }
+        compile = userInputPattern.toString().replaceAll("[\'\"]", EMPTY_STRING);
+        try {
+            Pattern.compile(compile);
+        } catch (PatternSyntaxException exception) {
+            ParserException parserException = new ParserException("YANG file error : " +
+                                                                          getYangConstructType(PATTERN_DATA) + " name " + ctx.string().getText() +
+                                                                          " is not a valid regular expression");
+            parserException.setLine(ctx.getStart().getLine());
+            parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
+            throw parserException;
+        }
+        return compile;
+    }
+}
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/PositionListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/PositionListener.java
new file mode 100644
index 0000000..a29d3a0
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/PositionListener.java
@@ -0,0 +1,130 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+/*
+ * Reference: RFC6020 and YANG ANTLR Grammar
+ *
+ * ABNF grammar as per RFC6020
+ * position-stmt       = position-keyword sep
+ *                       position-value-arg-str stmtend
+ * position-value-arg-str = < a string that matches the rule
+ *                            position-value-arg >
+ * position-value-arg  = non-negative-integer-value
+ * non-negative-integer-value = "0" / positive-integer-value
+ * positive-integer-value = (non-zero-digit *DIGIT)
+ * zero-integer-value  = 1*DIGIT
+ *
+ * ANTLR grammar rule
+ * positionStatement : POSITION_KEYWORD position STMTEND;
+ * position          : string;
+ */
+
+import org.onosproject.yang.compiler.datamodel.YangBit;
+import org.onosproject.yang.compiler.datamodel.YangBits;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.TreeWalkListener;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil;
+
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.POSITION_DATA;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.PositionStatementContext;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil.getValidNonNegativeIntegerValue;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
+
+/**
+ * Represents listener based call back function corresponding to the "position"
+ * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
+ */
+public final class PositionListener {
+
+    /**
+     * Creates a new position listener.
+     */
+    private PositionListener() {
+    }
+
+    /**
+     * It is called when parser receives an input matching the grammar rule
+     * (position), perform validations and update the data model tree.
+     *
+     * @param listener Listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processPositionEntry(TreeWalkListener listener,
+                                            PositionStatementContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, POSITION_DATA, ctx.position().getText(), ENTRY);
+
+        // Obtain the node of the stack.
+        Parsable tmpNode = listener.getParsedDataStack().peek();
+        switch (tmpNode.getYangConstructType()) {
+            case BIT_DATA: {
+                YangBit bitNode = (YangBit) tmpNode;
+                int positionValue = getValidBitPosition(listener, ctx);
+                bitNode.setPosition(positionValue);
+                break;
+            }
+            default:
+                throw new ParserException(
+                        constructListenerErrorMessage(INVALID_HOLDER, POSITION_DATA, ctx.position().getText(), ENTRY));
+        }
+    }
+
+    /**
+     * Validates BITS position value correctness and uniqueness.
+     *
+     * @param listener Listener's object
+     * @param ctx      context object of the grammar rule
+     * @return position value
+     */
+    private static int getValidBitPosition(TreeWalkListener listener,
+                                           PositionStatementContext ctx) {
+        Parsable bitNode = listener.getParsedDataStack().pop();
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, POSITION_DATA, ctx.position().getText(), ENTRY);
+
+        int positionValue = getValidNonNegativeIntegerValue(ctx.position().getText(), POSITION_DATA, ctx);
+
+        Parsable tmpNode = listener.getParsedDataStack().peek();
+        switch (tmpNode.getYangConstructType()) {
+            case BITS_DATA: {
+                YangBits yangBits = (YangBits) tmpNode;
+                listener.getParsedDataStack().push(bitNode);
+                if (yangBits.isBitPositionExists(positionValue)) {
+                    ParserException parserException = new ParserException("YANG file error: Duplicate value of " +
+                                                                                  "position is invalid.");
+                    parserException.setLine(ctx.getStart().getLine());
+                    parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
+                    throw parserException;
+                }
+                return positionValue;
+            }
+            default:
+                listener.getParsedDataStack().push(bitNode);
+                throw new ParserException(
+                        constructListenerErrorMessage(INVALID_HOLDER, POSITION_DATA, ctx.position().getText(), ENTRY));
+        }
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/PrefixListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/PrefixListener.java
new file mode 100644
index 0000000..5aadc65
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/PrefixListener.java
@@ -0,0 +1,109 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.onosproject.yang.compiler.datamodel.YangBelongsTo;
+import org.onosproject.yang.compiler.datamodel.YangImport;
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.TreeWalkListener;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil;
+
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.PREFIX_DATA;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.PrefixStatementContext;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil.getValidIdentifier;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
+
+/*
+ * Reference: RFC6020 and YANG ANTLR Grammar
+ *
+ * ABNF grammar as per RFC6020
+ * module-header-stmts = ;; these stmts can appear in any order
+ *                       [yang-version-stmt stmtsep]
+ *                        namespace-stmt stmtsep
+ *                        prefix-stmt stmtsep
+ *
+ * prefix-stmt         = prefix-keyword sep prefix-arg-str
+ *                       optsep stmtend
+ *
+ * ANTLR grammar rule
+ * module_header_statement : yang_version_stmt? namespace_stmt prefix_stmt
+ *                         | yang_version_stmt? prefix_stmt namespace_stmt
+ *                         | namespace_stmt yang_version_stmt? prefix_stmt
+ *                         | namespace_stmt prefix_stmt yang_version_stmt?
+ *                         | prefix_stmt namespace_stmt yang_version_stmt?
+ *                         | prefix_stmt yang_version_stmt? namespace_stmt
+ *                         ;
+ * prefix_stmt : PREFIX_KEYWORD identifier STMTEND;
+ */
+
+/**
+ * Represents listener based call back function corresponding to the "prefix"
+ * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
+ */
+public final class PrefixListener {
+
+    /**
+     * Creates a new prefix listener.
+     */
+    private PrefixListener() {
+    }
+
+    /**
+     * It is called when parser receives an input matching the grammar rule
+     * (prefix),perform validations and update the data model tree.
+     *
+     * @param listener Listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processPrefixEntry(TreeWalkListener listener, PrefixStatementContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, PREFIX_DATA, ctx.identifier().getText(), ENTRY);
+
+        String identifier = getValidIdentifier(ctx.identifier().getText(), PREFIX_DATA, ctx);
+
+        // Obtain the node of the stack.
+        Parsable tmpNode = listener.getParsedDataStack().peek();
+        switch (tmpNode.getYangConstructType()) {
+            case MODULE_DATA: {
+                YangModule module = (YangModule) tmpNode;
+                module.setPrefix(identifier);
+                break;
+            }
+            case IMPORT_DATA: {
+                YangImport importNode = (YangImport) tmpNode;
+                importNode.setPrefixId(identifier);
+                break;
+            }
+            case BELONGS_TO_DATA: {
+                YangBelongsTo belongstoNode = (YangBelongsTo) tmpNode;
+                belongstoNode.setPrefix(identifier);
+                break;
+            }
+            default:
+                throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, PREFIX_DATA,
+                        ctx.identifier().getText(), ENTRY));
+        }
+    }
+}
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/PresenceListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/PresenceListener.java
new file mode 100644
index 0000000..27b9061
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/PresenceListener.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.onosproject.yang.compiler.datamodel.YangContainer;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.TreeWalkListener;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType;
+
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.CONTAINER_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.PRESENCE_DATA;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.PresenceStatementContext;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
+
+/*
+ * Reference: RFC6020 and YANG ANTLR Grammar
+ *
+ * ABNF grammar as per RFC6020
+ * presence-stmt       = presence-keyword sep string stmtend
+ *
+ * ANTLR grammar rule
+ * presenceStatement : PRESENCE_KEYWORD string STMTEND;
+ */
+
+/**
+ * Represents listener based call back function corresponding to the "presence"
+ * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
+ */
+public final class PresenceListener {
+
+    /**
+     * Creates a new presence listener.
+     */
+    private PresenceListener() {
+    }
+
+    /**
+     * It is called when parser receives an input matching the grammar
+     * rule (presence), performs validation and updates the data model
+     * tree.
+     *
+     * @param listener listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processPresenceEntry(TreeWalkListener listener,
+                                            PresenceStatementContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, PRESENCE_DATA, ctx.string().getText(), ENTRY);
+
+        Parsable tmpData = listener.getParsedDataStack().peek();
+        if (tmpData.getYangConstructType() == CONTAINER_DATA) {
+            YangContainer container = (YangContainer) tmpData;
+            container.setPresence(ctx.string().getText());
+        } else {
+            throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, PRESENCE_DATA,
+                    ctx.string().getText(), ENTRY));
+        }
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/RangeRestrictionListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/RangeRestrictionListener.java
new file mode 100644
index 0000000..418482f
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/RangeRestrictionListener.java
@@ -0,0 +1,186 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.onosproject.yang.compiler.datamodel.YangDecimal64;
+import org.onosproject.yang.compiler.datamodel.YangDerivedInfo;
+import org.onosproject.yang.compiler.datamodel.YangRangeRestriction;
+import org.onosproject.yang.compiler.datamodel.YangType;
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.TreeWalkListener;
+
+import static org.onosproject.yang.compiler.datamodel.utils.RestrictionResolver.processRangeRestriction;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.RANGE_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.TYPE_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypeUtils.isOfRangeRestrictedType;
+import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes.DECIMAL64;
+import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes.DERIVED;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.RangeStatementContext;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.EXIT;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_CURRENT_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
+
+/*
+ * Reference: RFC6020 and YANG ANTLR Grammar
+ *
+ * ABNF grammar as per RFC6020
+ *  range-stmt          = range-keyword sep range-arg-str optsep
+ *                        (";" /
+ *                         "{" stmtsep
+ *                             ;; these stmts can appear in any order
+ *                             [error-message-stmt stmtsep]
+ *                             [error-app-tag-stmt stmtsep]
+ *                             [description-stmt stmtsep]
+ *                             [reference-stmt stmtsep]
+ *                          "}")
+ *
+ * ANTLR grammar rule
+ *  rangeStatement : RANGE_KEYWORD range (STMTEND | LEFT_CURLY_BRACE commonStatements RIGHT_CURLY_BRACE);
+ */
+
+/**
+ * Represents listener based call back function corresponding to the "range"
+ * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
+ */
+public final class RangeRestrictionListener {
+
+    /**
+     * Creates a new range restriction listener.
+     */
+    private RangeRestrictionListener() {
+    }
+
+    /**
+     * It is called when parser receives an input matching the grammar
+     * rule (range), performs validation and updates the data model
+     * tree.
+     *
+     * @param listener listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processRangeRestrictionEntry(TreeWalkListener listener,
+                                                    RangeStatementContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, RANGE_DATA, ctx.range().getText(), ENTRY);
+
+        Parsable tmpData = listener.getParsedDataStack().peek();
+        if (tmpData.getYangConstructType() == TYPE_DATA) {
+            YangType type = (YangType) tmpData;
+            setRangeRestriction(listener, type, ctx);
+        } else {
+            throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, RANGE_DATA,
+                                                                    ctx.range().getText(), ENTRY));
+        }
+    }
+
+    /**
+     * Sets the range restriction to type.
+     *
+     * @param listener listener's object
+     * @param type     YANG type for which range restriction to be added
+     * @param ctx      context object of the grammar rule
+     */
+    private static void setRangeRestriction(TreeWalkListener listener, YangType type,
+                                            RangeStatementContext ctx) {
+
+        if (type.getDataType() == DERIVED) {
+            ((YangDerivedInfo<YangRangeRestriction>) type.getDataTypeExtendedInfo())
+                    .setRangeRestrictionString(ctx.range().getText());
+            ((YangDerivedInfo<YangRangeRestriction>) type.getDataTypeExtendedInfo())
+                    .setLineNumber(ctx.getStart().getLine());
+            ((YangDerivedInfo<YangRangeRestriction>) type.getDataTypeExtendedInfo())
+                    .setCharPosition(ctx.getStart().getCharPositionInLine());
+            return;
+        }
+
+        if (!(isOfRangeRestrictedType(type.getDataType())) && (type.getDataType() != DECIMAL64)) {
+            ParserException parserException = new ParserException("YANG file error: Range restriction can't be " +
+                                                                          "applied to a given type");
+            parserException.setLine(ctx.getStart().getLine());
+            parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
+            throw parserException;
+        }
+
+        YangRangeRestriction rangeRestriction = null;
+        try {
+            if (type.getDataType() == DECIMAL64) {
+                YangDecimal64 yangDecimal64 = (YangDecimal64) type.getDataTypeExtendedInfo();
+                rangeRestriction =
+                        processRangeRestriction(yangDecimal64.getDefaultRangeRestriction(),
+                                                ctx.getStart().getLine(),
+                                                ctx.getStart().getCharPositionInLine(),
+                                                true, ctx.range().getText(),
+                                                type.getDataType(), listener.getFileName());
+            } else {
+                rangeRestriction =
+                        processRangeRestriction(null, ctx.getStart().getLine(),
+                                                ctx.getStart().getCharPositionInLine(),
+                                                false, ctx.range()
+                                                        .getText(), type
+                                                        .getDataType(),
+                                                listener.getFileName());
+            }
+        } catch (DataModelException e) {
+            ParserException parserException = new ParserException(e.getMessage());
+            parserException.setCharPosition(e.getCharPositionInLine());
+            parserException.setLine(e.getLineNumber());
+            throw parserException;
+        }
+
+        if (rangeRestriction != null) {
+            if (type.getDataType() == DECIMAL64) {
+                ((YangDecimal64<YangRangeRestriction>) type.getDataTypeExtendedInfo())
+                        .setRangeRestrictedExtendedInfo(rangeRestriction);
+            } else {
+                type.setDataTypeExtendedInfo(rangeRestriction);
+            }
+        }
+        listener.getParsedDataStack().push(rangeRestriction);
+    }
+
+    /**
+     * Performs validation and updates the data model tree.
+     * It is called when parser exits from grammar rule (range).
+     *
+     * @param listener listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processRangeRestrictionExit(TreeWalkListener listener,
+                                                   RangeStatementContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, RANGE_DATA, ctx.range().getText(), EXIT);
+
+        Parsable tmpData = listener.getParsedDataStack().peek();
+        if (tmpData instanceof YangRangeRestriction) {
+            listener.getParsedDataStack().pop();
+        } else if (tmpData instanceof YangType
+                && ((YangType) tmpData).getDataType() == DERIVED) {
+            // TODO : need to handle in linker
+        } else {
+            throw new ParserException(constructListenerErrorMessage(MISSING_CURRENT_HOLDER, RANGE_DATA,
+                                                                    ctx.range().getText(), EXIT));
+        }
+    }
+}
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/ReferenceListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/ReferenceListener.java
new file mode 100644
index 0000000..877ad35
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/ReferenceListener.java
@@ -0,0 +1,77 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.onosproject.yang.compiler.datamodel.YangReference;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.TreeWalkListener;
+
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.REFERENCE_DATA;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.ReferenceStatementContext;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
+
+/*
+ * Reference: RFC6020 and YANG ANTLR Grammar
+ *
+ * ABNF grammar as per RFC6020
+ * reference-stmt      = reference-keyword sep string optsep stmtend
+ *
+ * ANTLR grammar rule
+ * referenceStatement : REFERENCE_KEYWORD string STMTEND;
+ */
+
+/**
+ * Represents listener based call back function corresponding to the "reference"
+ * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
+ */
+public final class ReferenceListener {
+
+    /**
+     * Creates a new reference listener.
+     */
+    private ReferenceListener() {
+    }
+
+    /**
+     * It is called when parser receives an input matching the grammar
+     * rule (reference), performs validation and updates the data model
+     * tree.
+     *
+     * @param listener listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processReferenceEntry(TreeWalkListener listener,
+                                             ReferenceStatementContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, REFERENCE_DATA, ctx.string().getText(), ENTRY);
+
+        Parsable tmpData = listener.getParsedDataStack().peek();
+        if (tmpData instanceof YangReference) {
+            YangReference reference = (YangReference) tmpData;
+            reference.setReference(ctx.string().getText());
+        } else {
+            throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, REFERENCE_DATA,
+                                                                    ctx.string().getText(), ENTRY));
+        }
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/RequireInstanceListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/RequireInstanceListener.java
new file mode 100644
index 0000000..c83623a
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/RequireInstanceListener.java
@@ -0,0 +1,109 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.onosproject.yang.compiler.datamodel.YangLeafRef;
+import org.onosproject.yang.compiler.datamodel.YangType;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.TreeWalkListener;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil;
+
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.REQUIRE_INSTANCE_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes.INSTANCE_IDENTIFIER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil.getValidBooleanValue;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
+
+/*
+ * Reference: RFC6020 and YANG ANTLR Grammar
+ *
+ * ABNF grammar as per RFC6020
+ * require-instance-stmt = require-instance-keyword sep
+ *                            require-instance-arg-str stmtend
+ *
+ * require-instance-arg-str = < a string that matches the rule
+ *                            require-instance-arg >
+ *
+ * require-instance-arg = true-keyword / false-keyword
+ *
+ * ANTLR grammar rule
+ *
+ * requireInstanceStatement : REQUIRE_INSTANCE_KEYWORD requireInstance STMTEND;
+ *
+ * requireInstance : string;
+ */
+
+/**
+ * Represents listener based call back function corresponding to the
+ * "require-instance" rule defined in ANTLR grammar file for corresponding ABNF rule
+ * in RFC 6020.
+ */
+public final class RequireInstanceListener {
+
+    /**
+     * Creates a new require instance listener.
+     */
+    private RequireInstanceListener() {
+    }
+
+    /**
+     * It is called when parser receives an input matching the grammar rule
+     * (require-instance), performs validation and updates the data model tree.
+     *
+     * @param listener listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processRequireInstanceEntry(TreeWalkListener listener,
+                                                   GeneratedYangParser.RequireInstanceStatementContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, REQUIRE_INSTANCE_DATA, "", ENTRY);
+
+        Parsable curData = listener.getParsedDataStack().peek();
+
+        // Gets the status of require instance
+        boolean isRequireInstance = getValidBooleanValue(ctx.requireInstance().getText(), REQUIRE_INSTANCE_DATA, ctx);
+
+        // Checks the holder of require-instance as leafref or type, else throws error.
+        if (curData instanceof YangLeafRef) {
+
+            // Sets the require-instance status to leafref.
+            ((YangLeafRef) curData).setRequireInstance(isRequireInstance);
+        } else if (curData instanceof YangType) {
+
+            // Checks type should be instance-identifier, else throw error.
+            if (((YangType) curData).getDataType() == INSTANCE_IDENTIFIER) {
+
+                // Sets the require-instance status to instance-identifier type.
+                ((YangType) curData).setDataTypeExtendedInfo(isRequireInstance);
+            } else {
+                throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, REQUIRE_INSTANCE_DATA,
+                        ctx.getText(), ENTRY));
+            }
+        } else {
+            throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, REQUIRE_INSTANCE_DATA,
+                    ctx.getText(), ENTRY));
+        }
+    }
+}
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/RevisionDateListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/RevisionDateListener.java
new file mode 100644
index 0000000..7a49388
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/RevisionDateListener.java
@@ -0,0 +1,114 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.onosproject.yang.compiler.datamodel.YangImport;
+import org.onosproject.yang.compiler.datamodel.YangInclude;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.TreeWalkListener;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil;
+
+import java.util.Date;
+
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.REVISION_DATE_DATA;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.RevisionDateStatementContext;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil.getValidDateFromString;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
+
+/*
+ * Reference: RFC6020 and YANG ANTLR Grammar
+ *
+ * ABNF grammar as per RFC6020
+ * import-stmt         = import-keyword sep identifier-arg-str optsep
+ *                       "{" stmtsep
+ *                           prefix-stmt stmtsep
+ *                           [revision-date-stmt stmtsep]
+ *                        "}"
+ * include-stmt        = include-keyword sep identifier-arg-str optsep
+ *                             (";" /
+ *                              "{" stmtsep
+ *                                  [revision-date-stmt stmtsep]
+ *                            "}")
+ * revision-date-stmt = revision-date-keyword sep revision-date stmtend
+ *
+ * ANTLR grammar rule
+ * import_stmt : IMPORT_KEYWORD IDENTIFIER LEFT_CURLY_BRACE import_stmt_body
+ *               RIGHT_CURLY_BRACE;
+ * import_stmt_body : prefix_stmt revision_date_stmt?;
+ *
+ * include_stmt : INCLUDE_KEYWORD IDENTIFIER (STMTEND | LEFT_CURLY_BRACE
+ *                revision_date_stmt_body? RIGHT_CURLY_BRACE);
+ *
+ * revision_date_stmt : REVISION_DATE_KEYWORD DATE_ARG STMTEND;
+ *
+ */
+
+/**
+ * Represents listener based call back function corresponding to the
+ * "revision date" rule defined in ANTLR grammar file for corresponding ABNF
+ * rule in RFC 6020.
+ */
+public final class RevisionDateListener {
+
+    /**
+     * Creates a new revision date listener.
+     */
+    private RevisionDateListener() {
+    }
+
+    /**
+     * It is called when parser receives an input matching the grammar rule
+     * (revision date),perform validations and update the data model tree.
+     *
+     * @param listener Listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processRevisionDateEntry(TreeWalkListener listener,
+                                                RevisionDateStatementContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, REVISION_DATE_DATA, ctx.dateArgumentString().getText(),
+                ENTRY);
+
+        Date date = getValidDateFromString(ctx.dateArgumentString().getText(), ctx);
+
+        // Obtain the node of the stack.
+        Parsable tmpNode = listener.getParsedDataStack().peek();
+        switch (tmpNode.getYangConstructType()) {
+            case IMPORT_DATA: {
+                YangImport importNode = (YangImport) tmpNode;
+                importNode.setRevision(date);
+                break;
+            }
+            case INCLUDE_DATA: {
+                YangInclude includeNode = (YangInclude) tmpNode;
+                includeNode.setRevision(date);
+                break;
+            }
+            default:
+                throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, REVISION_DATE_DATA,
+                        ctx.dateArgumentString().getText(), ENTRY));
+        }
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/RevisionListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/RevisionListener.java
new file mode 100644
index 0000000..50b630d
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/RevisionListener.java
@@ -0,0 +1,170 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangRevision;
+import org.onosproject.yang.compiler.datamodel.YangSubModule;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.TreeWalkListener;
+
+import java.util.Date;
+
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.REVISION_DATA;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.RevisionStatementContext;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.EXIT;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_CURRENT_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil.getValidDateFromString;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
+
+/*
+ * Reference: RFC6020 and YANG ANTLR Grammar
+ *
+ * ABNF grammar as per RFC6020
+ * module-stmt         = optsep module-keyword sep identifier-arg-str
+ *                       optsep
+ *                       "{" stmtsep
+ *                           module-header-stmts
+ *                           linkage-stmts
+ *                           meta-stmts
+ *                           revision-stmts
+ *                           body-stmts
+ *                       "}" optsep
+ *
+ * revision-stmt       = revision-keyword sep revision-date optsep
+ *                             (";" /
+ *                              "{" stmtsep
+ *                                  [description-stmt stmtsep]
+ *                                  [reference-stmt stmtsep]
+ *                              "}")
+ *
+ * ANTLR grammar rule
+ * module_stmt : MODULE_KEYWORD IDENTIFIER LEFT_CURLY_BRACE module_body* RIGHT_CURLY_BRACE;
+ *
+ * revision_stmt : REVISION_KEYWORD DATE_ARG (STMTEND | LEFT_CURLY_BRACE revision_stmt_body RIGHT_CURLY_BRACE);
+ * revision_stmt_body : description_stmt? reference_stmt?;
+ */
+
+/**
+ * Represents listener based call back function corresponding to the "revision"
+ * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
+ */
+public final class RevisionListener {
+
+    /**
+     * Creates a new revision listener.
+     */
+    private RevisionListener() {
+    }
+
+    /**
+     * It is called when parser receives an input matching the grammar rule
+     * (revision),perform validations and update the data model tree.
+     *
+     * @param listener Listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processRevisionEntry(TreeWalkListener listener,
+                                            RevisionStatementContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, REVISION_DATA, ctx.dateArgumentString().getText(), ENTRY);
+
+        Date date = getValidDateFromString(ctx.dateArgumentString().getText(), ctx);
+
+        YangRevision revisionNode = new YangRevision();
+        revisionNode.setRevDate(date);
+
+        listener.getParsedDataStack().push(revisionNode);
+    }
+
+    /**
+     * It is called when parser exits from grammar rule (revision), it perform
+     * validations and update the data model tree.
+     *
+     * @param listener Listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processRevisionExit(TreeWalkListener listener, RevisionStatementContext
+            ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, REVISION_DATA, ctx.dateArgumentString().getText(), EXIT);
+
+        Parsable tmpRevisionNode = listener.getParsedDataStack().peek();
+        if (tmpRevisionNode instanceof YangRevision) {
+            listener.getParsedDataStack().pop();
+
+            // Check for stack to be non empty.
+            checkStackIsNotEmpty(listener, MISSING_HOLDER, REVISION_DATA, ctx.dateArgumentString().getText(),
+                                 EXIT);
+
+            Parsable tmpNode = listener.getParsedDataStack().peek();
+            switch (tmpNode.getYangConstructType()) {
+                case MODULE_DATA: {
+                    YangModule module = (YangModule) tmpNode;
+                    if (module.getRevision() != null) {
+                        Date curRevisionDate = module.getRevision().getRevDate();
+                        if (curRevisionDate.before(((YangRevision) tmpRevisionNode).getRevDate())) {
+                            module.setRevision((YangRevision) tmpRevisionNode);
+                        }
+                    } else {
+                        module.setRevision((YangRevision) tmpRevisionNode);
+                    }
+                    break;
+                }
+                case SUB_MODULE_DATA: {
+                    YangSubModule subModule = (YangSubModule) tmpNode;
+                    if (subModule.getRevision() != null) {
+                        Date curRevisionDate = subModule.getRevision().getRevDate();
+                        if (curRevisionDate.before(((YangRevision) tmpRevisionNode).getRevDate())) {
+                            subModule.setRevision((YangRevision) tmpRevisionNode);
+                        }
+                    } else {
+                        subModule.setRevision((YangRevision) tmpRevisionNode);
+                    }
+                    break;
+                }
+                default:
+                    throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, REVISION_DATA,
+                                                                            ctx.dateArgumentString().getText(),
+                                                                            EXIT));
+            }
+        } else {
+            throw new ParserException(constructListenerErrorMessage(MISSING_CURRENT_HOLDER, REVISION_DATA,
+                                                                    ctx.dateArgumentString().getText(), EXIT));
+        }
+    }
+
+    /**
+     * Validate revision.
+     *
+     * @param listener Listener's object
+     * @param ctx      context object of the grammar rule
+     * @return validation result
+     */
+    private static boolean validateRevision(TreeWalkListener listener,
+                                            RevisionStatementContext ctx) {
+        // TODO to be implemented
+        return true;
+    }
+}
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/RpcListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/RpcListener.java
new file mode 100644
index 0000000..25baa54
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/RpcListener.java
@@ -0,0 +1,165 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangRpc;
+import org.onosproject.yang.compiler.datamodel.YangSubModule;
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.TreeWalkListener;
+
+import static org.onosproject.yang.compiler.datamodel.utils.GeneratedLanguage.JAVA_GENERATION;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.DESCRIPTION_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.INPUT_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.OUTPUT_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.REFERENCE_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.RPC_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.STATUS_DATA;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.RpcStatementContext;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerCollisionDetector.detectCollidingChildUtil;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.EXIT;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructExtendedListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_CURRENT_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.UNHANDLED_PARSED_DATA;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil.getValidIdentifier;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.validateCardinalityMaxOne;
+import static org.onosproject.yang.compiler.translator.tojava.YangDataModelFactory.getYangRpcNode;
+
+/*
+ * Reference: RFC6020 and YANG ANTLR Grammar
+ *
+ * ABNF grammar as per RFC6020
+ *  rpc-stmt            = rpc-keyword sep identifier-arg-str optsep
+ *                        (";" /
+ *                         "{" stmtsep
+ *                             ;; these stmts can appear in any order
+ *                             *(if-feature-stmt stmtsep)
+ *                             [status-stmt stmtsep]
+ *                             [description-stmt stmtsep]
+ *                             [reference-stmt stmtsep]
+ *                             *((typedef-stmt /
+ *                                grouping-stmt) stmtsep)
+ *                             [input-stmt stmtsep]
+ *                             [output-stmt stmtsep]
+ *                         "}")
+ *
+ * ANTLR grammar rule
+ *  rpcStatement : RPC_KEYWORD identifier (STMTEND | LEFT_CURLY_BRACE (ifFeatureStatement | statusStatement
+ *               | descriptionStatement | referenceStatement | typedefStatement | groupingStatement | inputStatement
+ *               | outputStatement)* RIGHT_CURLY_BRACE);
+ */
+
+/**
+ * Represents listener based call back function corresponding to the "rpc"
+ * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
+ */
+public final class RpcListener {
+
+    /**
+     * Creates a new rpc listener.
+     */
+    private RpcListener() {
+    }
+
+    /**
+     * It is called when parser receives an input matching the grammar rule
+     * (rpc), performs validation and updates the data model tree.
+     *
+     * @param listener listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processRpcEntry(TreeWalkListener listener,
+                                       RpcStatementContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, RPC_DATA, ctx.identifier().getText(), ENTRY);
+
+        String identifier = getValidIdentifier(ctx.identifier().getText(), RPC_DATA, ctx);
+
+        // Validate sub statement cardinality.
+        validateSubStatementsCardinality(ctx);
+
+        // Check for identifier collision
+        int line = ctx.getStart().getLine();
+        int charPositionInLine = ctx.getStart().getCharPositionInLine();
+        detectCollidingChildUtil(listener, line, charPositionInLine, identifier, RPC_DATA);
+
+        Parsable curData = listener.getParsedDataStack().peek();
+        if (curData instanceof YangModule || curData instanceof YangSubModule) {
+
+            YangNode curNode = (YangNode) curData;
+            YangRpc yangRpc = getYangRpcNode(JAVA_GENERATION);
+
+            yangRpc.setLineNumber(ctx.getStart().getLine());
+            yangRpc.setCharPosition(ctx.getStart().getCharPositionInLine());
+            yangRpc.setFileName(listener.getFileName());
+            yangRpc.setName(identifier);
+            try {
+                curNode.addChild(yangRpc);
+            } catch (DataModelException e) {
+                throw new ParserException(constructExtendedListenerErrorMessage(UNHANDLED_PARSED_DATA,
+                                                                                RPC_DATA, ctx.identifier().getText(), ENTRY, e.getMessage()));
+            }
+            listener.getParsedDataStack().push(yangRpc);
+        } else {
+            throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, RPC_DATA,
+                                                                    ctx.identifier().getText(), ENTRY));
+        }
+    }
+
+    /**
+     * It is called when parser exits from grammar rule (rpc), it perform
+     * validations and updates the data model tree.
+     *
+     * @param listener listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processRpcExit(TreeWalkListener listener,
+                                      RpcStatementContext ctx) {
+
+        //Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, RPC_DATA, ctx.identifier().getText(), EXIT);
+
+        if (!(listener.getParsedDataStack().peek() instanceof YangRpc)) {
+            throw new ParserException(constructListenerErrorMessage(MISSING_CURRENT_HOLDER, RPC_DATA,
+                                                                    ctx.identifier().getText(), EXIT));
+        }
+        listener.getParsedDataStack().pop();
+    }
+
+    /**
+     * Validates the cardinality of rpc sub-statements as per grammar.
+     *
+     * @param ctx context object of the grammar rule
+     */
+    private static void validateSubStatementsCardinality(RpcStatementContext ctx) {
+
+        validateCardinalityMaxOne(ctx.statusStatement(), STATUS_DATA, RPC_DATA, ctx.identifier().getText());
+        validateCardinalityMaxOne(ctx.descriptionStatement(), DESCRIPTION_DATA, RPC_DATA, ctx.identifier().getText());
+        validateCardinalityMaxOne(ctx.referenceStatement(), REFERENCE_DATA, RPC_DATA, ctx.identifier().getText());
+        validateCardinalityMaxOne(ctx.inputStatement(), INPUT_DATA, RPC_DATA, ctx.identifier().getText());
+        validateCardinalityMaxOne(ctx.outputStatement(), OUTPUT_DATA, RPC_DATA, ctx.identifier().getText());
+    }
+}
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/ShortCaseListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/ShortCaseListener.java
new file mode 100644
index 0000000..8876bda
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/ShortCaseListener.java
@@ -0,0 +1,160 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.antlr.v4.runtime.ParserRuleContext;
+import org.antlr.v4.runtime.tree.ParseTree;
+import org.onosproject.yang.compiler.datamodel.YangCase;
+import org.onosproject.yang.compiler.datamodel.YangChoice;
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.TreeWalkListener;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerCollisionDetector;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil;
+import org.onosproject.yang.compiler.translator.tojava.YangDataModelFactory;
+
+import static org.onosproject.yang.compiler.datamodel.utils.GeneratedLanguage.JAVA_GENERATION;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.CASE_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.SHORT_CASE_DATA;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.ShortCaseStatementContext;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerCollisionDetector.detectCollidingChildUtil;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.EXIT;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructExtendedListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.INVALID_CHILD;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_CURRENT_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.UNHANDLED_PARSED_DATA;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil.getValidIdentifier;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
+import static org.onosproject.yang.compiler.translator.tojava.YangDataModelFactory.getYangCaseNode;
+
+/*
+ * Reference: RFC6020 and YANG ANTLR Grammar
+ *
+ * ABNF grammar as per RFC6020
+ * short-case-stmt     = container-stmt /
+ *                       leaf-stmt /
+ *                       leaf-list-stmt /
+ *                       list-stmt /
+ *                       anyxml-stmt
+ *
+ * ANTLR grammar rule
+ * shortCaseStatement : containerStatement | leafStatement | leafListStatement | listStatement;
+ */
+
+/**
+ * Represents listener based call back function corresponding to the "short
+ * case" rule defined in ANTLR grammar file for corresponding ABNF rule in RFC
+ * 6020.
+ */
+public final class ShortCaseListener {
+
+    /**
+     * Create a new short case listener.
+     */
+    private ShortCaseListener() {
+    }
+
+    /**
+     * It is called when parser enters grammar rule (short case), it perform
+     * validations and updates the data model tree.
+     *
+     * @param listener listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processShortCaseEntry(TreeWalkListener listener,
+                                             ShortCaseStatementContext ctx) {
+
+        ParseTree errorConstructContext;
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, SHORT_CASE_DATA, "", ENTRY);
+
+        YangCase caseNode = getYangCaseNode(JAVA_GENERATION);
+
+        caseNode.setLineNumber(ctx.getStart().getLine());
+        caseNode.setCharPosition(ctx.getStart().getCharPositionInLine());
+        caseNode.setFileName(listener.getFileName());
+        if (ctx.containerStatement() != null) {
+            caseNode.setName(getValidIdentifier(ctx.containerStatement().identifier().getText(), CASE_DATA, ctx));
+            errorConstructContext = ctx.containerStatement();
+        } else if (ctx.listStatement() != null) {
+            caseNode.setName(getValidIdentifier(ctx.listStatement().identifier().getText(), CASE_DATA, ctx));
+            errorConstructContext = ctx.listStatement();
+        } else if (ctx.leafListStatement() != null) {
+            caseNode.setName(getValidIdentifier(ctx.leafListStatement().identifier().getText(), CASE_DATA, ctx));
+            errorConstructContext = ctx.leafListStatement();
+        } else if (ctx.leafStatement() != null) {
+            caseNode.setName(getValidIdentifier(ctx.leafStatement().identifier().getText(), CASE_DATA, ctx));
+            errorConstructContext = ctx.leafStatement();
+        } else if (ctx.anyxmlStatement() != null) {
+            // Anyxml statement is not supported
+            return;
+        } else {
+            throw new ParserException(constructListenerErrorMessage(INVALID_CHILD, SHORT_CASE_DATA, "", ENTRY));
+        }
+        // TODO implement for augment.
+
+        int line = ((ParserRuleContext) errorConstructContext).getStart().getLine();
+        int charPositionInLine = ((ParserRuleContext) errorConstructContext).getStart().getCharPositionInLine();
+
+        // Check for identifier collision
+        detectCollidingChildUtil(listener, line, charPositionInLine, caseNode.getName(), CASE_DATA);
+
+        if ((listener.getParsedDataStack().peek()) instanceof YangChoice) {
+            try {
+                ((YangChoice) listener.getParsedDataStack().peek()).addChild(caseNode);
+            } catch (DataModelException e) {
+                throw new ParserException(constructExtendedListenerErrorMessage(UNHANDLED_PARSED_DATA,
+                        SHORT_CASE_DATA, caseNode.getName(), ENTRY, e.getMessage()));
+            }
+            listener.getParsedDataStack().push(caseNode);
+        } else {
+            throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, SHORT_CASE_DATA,
+                    caseNode.getName(), ENTRY));
+        }
+    }
+
+    /**
+     * It is called when parser exits from grammar rule (short case), it perform
+     * validations and update the data model tree.
+     *
+     * @param listener Listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processShortCaseExit(TreeWalkListener listener,
+                                            ShortCaseStatementContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, SHORT_CASE_DATA, "", EXIT);
+
+        if (listener.getParsedDataStack().peek() instanceof YangCase) {
+            listener.getParsedDataStack().pop();
+        } else if (ctx.anyxmlStatement() != null) {
+            // Anyxml statement is not supported
+            return;
+        } else {
+            throw new ParserException(constructListenerErrorMessage(MISSING_CURRENT_HOLDER, SHORT_CASE_DATA,
+                    "", EXIT));
+        }
+    }
+}
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/StatusListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/StatusListener.java
new file mode 100644
index 0000000..d00afd1
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/StatusListener.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.yang.compiler.parser.impl.listeners;
+
+import org.onosproject.yang.compiler.datamodel.YangStatus;
+import org.onosproject.yang.compiler.datamodel.YangStatusType;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.datamodel.utils.YangConstructType;
+import org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.TreeWalkListener;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation;
+
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.STATUS_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.getYangConstructType;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil.removeQuotesAndHandleConcat;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
+
+/*
+ * Reference: RFC6020 and YANG ANTLR Grammar
+ *
+ * ABNF grammar as per RFC6020
+ *  status-stmt         = status-keyword sep status-arg-str stmtend
+ *  status-arg-str      = < a string that matches the rule
+ *                         status-arg >
+ *  status-arg          = current-keyword /
+ *                        obsolete-keyword /
+ *                        deprecated-keyword
+ *
+ * ANTLR grammar rule
+ * statusStatement : STATUS_KEYWORD status STMTEND;
+ */
+
+/**
+ * Represents listener based call back function corresponding to the "status"
+ * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
+ */
+public final class StatusListener {
+
+    private static final String CURRENT_KEYWORD = "current";
+    private static final String DEPRECATED_KEYWORD = "deprecated";
+    private static final String OBSOLETE_KEYWORD = "obsolete";
+
+    /**
+     * Creates a new status listener.
+     */
+    private StatusListener() {
+    }
+
+    /**
+     * It is called when parser receives an input matching the grammar
+     * rule (status), performs validation and updates the data model
+     * tree.
+     *
+     * @param listener listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processStatusEntry(TreeWalkListener listener,
+                                          GeneratedYangParser.StatusStatementContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, STATUS_DATA, "", ENTRY);
+
+        YangStatusType status = getValidStatus(ctx);
+
+        Parsable tmpData = listener.getParsedDataStack().peek();
+        if (tmpData instanceof YangStatus) {
+            YangStatus yangStatus = (YangStatus) tmpData;
+            yangStatus.setStatus(status);
+        } else {
+            throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, STATUS_DATA, "", ENTRY));
+        }
+    }
+
+    /**
+     * Validates status value and returns the value from context.
+     *
+     * @param ctx context object of the grammar rule
+     * @return status current/deprecated/obsolete
+     */
+    private static YangStatusType getValidStatus(GeneratedYangParser.StatusStatementContext ctx) {
+
+        YangStatusType status;
+
+        String value = removeQuotesAndHandleConcat(ctx.status().getText());
+        switch (value) {
+            case CURRENT_KEYWORD: {
+                status = YangStatusType.CURRENT;
+                break;
+            }
+            case DEPRECATED_KEYWORD: {
+                status = YangStatusType.DEPRECATED;
+                break;
+            }
+            case OBSOLETE_KEYWORD: {
+                status = YangStatusType.OBSOLETE;
+                break;
+            }
+            default: {
+                ParserException parserException = new ParserException("YANG file error : " +
+                        getYangConstructType(STATUS_DATA) + " " + ctx.status().getText() +
+                        " is not valid.");
+                parserException.setLine(ctx.getStart().getLine());
+                parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
+                throw parserException;
+            }
+        }
+
+        return status;
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/SubModuleListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/SubModuleListener.java
new file mode 100644
index 0000000..7b18d5b
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/SubModuleListener.java
@@ -0,0 +1,158 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.onosproject.yang.compiler.datamodel.ResolvableType;
+import org.onosproject.yang.compiler.datamodel.YangReferenceResolver;
+import org.onosproject.yang.compiler.datamodel.YangSubModule;
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.linker.exceptions.LinkerException;
+import org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.TreeWalkListener;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation;
+
+import static org.onosproject.yang.compiler.datamodel.utils.GeneratedLanguage.JAVA_GENERATION;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.MODULE_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.SUB_MODULE_DATA;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.EXIT;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.INVALID_CHILD;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_CURRENT_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil.getValidIdentifier;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.checkStackIsEmpty;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
+import static org.onosproject.yang.compiler.translator.tojava.YangDataModelFactory.getYangSubModuleNode;
+
+/*
+ * Reference: RFC6020 and YANG ANTLR Grammar
+ *
+ * ABNF grammar as per RFC6020
+ * submodule-stmt      = optsep submodule-keyword sep identifier-arg-str
+ *                             optsep
+ *                             "{" stmtsep
+ *                                 submodule-header-stmts
+ *                                 linkage-stmts
+ *                                 meta-stmts
+ *                                 revision-stmts
+ *                                 body-stmts
+ *                             "}" optsep
+ *
+ * ANTLR grammar rule
+ * submodule_stmt : SUBMODULE_KEYWORD identifier LEFT_CURLY_BRACE submodule_body* RIGHT_CURLY_BRACE;
+ * submodule_body : submodule_header_statement linkage_stmts meta_stmts revision_stmts body_stmts;
+ */
+
+/**
+ * Represents listener based call back function corresponding to the "submodule"
+ * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
+ */
+public final class SubModuleListener {
+
+    /**
+     * Creates a new sub module listener.
+     */
+    private SubModuleListener() {
+    }
+
+    /**
+     * It is called when parser receives an input matching the grammar rule (sub
+     * module), perform validations and update the data model tree.
+     *
+     * @param listener Listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processSubModuleEntry(TreeWalkListener listener,
+                                             GeneratedYangParser.SubModuleStatementContext ctx) {
+
+        // Check if stack is empty.
+        checkStackIsEmpty(listener, INVALID_HOLDER, SUB_MODULE_DATA, ctx.identifier().getText(),
+                          ENTRY);
+
+        String identifier = getValidIdentifier(ctx.identifier().getText(), SUB_MODULE_DATA, ctx);
+
+        YangSubModule yangSubModule = getYangSubModuleNode(JAVA_GENERATION);
+        yangSubModule.setName(identifier);
+
+        yangSubModule.setLineNumber(ctx.getStart().getLine());
+        yangSubModule.setCharPosition(ctx.getStart().getCharPositionInLine());
+        yangSubModule.setFileName(listener.getFileName());
+        if (ctx.submoduleBody().submoduleHeaderStatement().yangVersionStatement() == null) {
+            yangSubModule.setVersion((byte) 1);
+        }
+
+        listener.getParsedDataStack().push(yangSubModule);
+    }
+
+    /**
+     * It is called when parser exits from grammar rule (submodule), it perform
+     * validations and update the data model tree.
+     *
+     * @param listener Listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processSubModuleExit(TreeWalkListener listener,
+                                            GeneratedYangParser.SubModuleStatementContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, SUB_MODULE_DATA, ctx.identifier().getText(),
+                             EXIT);
+
+        Parsable tmpNode = listener.getParsedDataStack().peek();
+        if (!(tmpNode instanceof YangSubModule)) {
+            throw new ParserException(constructListenerErrorMessage(MISSING_CURRENT_HOLDER, SUB_MODULE_DATA,
+                                                                    ctx.identifier().getText(), EXIT));
+        }
+
+        YangSubModule subModule = (YangSubModule) tmpNode;
+        if (subModule.getUnresolvedResolutionList(ResolvableType.YANG_COMPILER_ANNOTATION) != null
+                && subModule.getUnresolvedResolutionList(ResolvableType.YANG_COMPILER_ANNOTATION).size() != 0
+                && subModule.getChild() != null) {
+            throw new ParserException(constructListenerErrorMessage(INVALID_CHILD, MODULE_DATA,
+                                                                    ctx.identifier().getText(), EXIT));
+        }
+
+        try {
+            ((YangReferenceResolver) listener.getParsedDataStack().peek())
+                    .resolveSelfFileLinking(ResolvableType.YANG_IF_FEATURE);
+            ((YangReferenceResolver) listener.getParsedDataStack().peek())
+                    .resolveSelfFileLinking(ResolvableType.YANG_USES);
+            ((YangReferenceResolver) listener.getParsedDataStack().peek())
+                    .resolveSelfFileLinking(ResolvableType.YANG_DERIVED_DATA_TYPE);
+            ((YangReferenceResolver) listener.getParsedDataStack().peek())
+                    .resolveSelfFileLinking(ResolvableType.YANG_LEAFREF);
+            ((YangReferenceResolver) listener.getParsedDataStack().peek())
+                    .resolveSelfFileLinking(ResolvableType.YANG_BASE);
+            ((YangReferenceResolver) listener.getParsedDataStack().peek())
+                    .resolveSelfFileLinking(ResolvableType.YANG_IDENTITYREF);
+        } catch (DataModelException e) {
+            LinkerException linkerException = new LinkerException(e.getMessage());
+            linkerException.setLine(e.getLineNumber());
+            linkerException.setCharPosition(e.getCharPositionInLine());
+            linkerException.setFileName(listener.getFileName());
+            throw linkerException;
+        }
+    }
+}
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/TypeDefListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/TypeDefListener.java
new file mode 100644
index 0000000..5e9d7a6
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/TypeDefListener.java
@@ -0,0 +1,204 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.onosproject.yang.compiler.datamodel.YangContainer;
+import org.onosproject.yang.compiler.datamodel.YangGrouping;
+import org.onosproject.yang.compiler.datamodel.YangInput;
+import org.onosproject.yang.compiler.datamodel.YangList;
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangNotification;
+import org.onosproject.yang.compiler.datamodel.YangOutput;
+import org.onosproject.yang.compiler.datamodel.YangRpc;
+import org.onosproject.yang.compiler.datamodel.YangSubModule;
+import org.onosproject.yang.compiler.datamodel.YangTypeDef;
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.TreeWalkListener;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerCollisionDetector;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil;
+
+import static org.onosproject.yang.compiler.datamodel.utils.GeneratedLanguage.JAVA_GENERATION;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.DEFAULT_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.DESCRIPTION_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.REFERENCE_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.STATUS_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.TYPEDEF_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.TYPE_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.UNITS_DATA;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.TypedefStatementContext;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerCollisionDetector.detectCollidingChildUtil;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.EXIT;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructExtendedListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.INVALID_CONTENT;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_CURRENT_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.UNHANDLED_PARSED_DATA;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil.getValidIdentifier;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.validateCardinalityEqualsOne;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.validateCardinalityMaxOne;
+import static org.onosproject.yang.compiler.translator.tojava.YangDataModelFactory.getYangTypeDefNode;
+
+/*
+ * Reference: RFC6020 and YANG ANTLR Grammar
+ *
+ * body-stmts          = *((extension-stmt /
+ *                          feature-stmt /
+ *                          identity-stmt /
+ *                          typedef-stmt /
+ *                          grouping-stmt /
+ *                          data-def-stmt /
+ *                          augment-stmt /
+ *                          rpc-stmt /
+ *                          notification-stmt /
+ *                          deviation-stmt) stmtsep)
+ *
+ * typedef-stmt        = typedef-keyword sep identifier-arg-str optsep
+ *                       "{" stmtsep
+ *                           ;; these stmts can appear in any order
+ *                           type-stmt stmtsep
+ *                          [units-stmt stmtsep]
+ *                           [default-stmt stmtsep]
+ *                           [status-stmt stmtsep]
+ *                           [description-stmt stmtsep]
+ *                           [reference-stmt stmtsep]
+ *                         "}"
+ *
+ * ANTLR grammar rule
+ * typedefStatement : TYPEDEF_KEYWORD identifier LEFT_CURLY_BRACE
+ *                (typeStatement | unitsStatement | defaultStatement | statusStatement
+ *                | descriptionStatement | referenceStatement)* RIGHT_CURLY_BRACE;
+ */
+
+/**
+ * Represents listener based call back function corresponding to the "typedef"
+ * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
+ */
+public final class TypeDefListener {
+
+    /**
+     * Creates a new typedef listener.
+     */
+    private TypeDefListener() {
+    }
+
+    /**
+     * It is called when parser enters grammar rule (typedef), it perform
+     * validations and updates the data model tree.
+     *
+     * @param listener listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processTypeDefEntry(TreeWalkListener listener,
+                                           TypedefStatementContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, TYPEDEF_DATA, ctx.identifier().getText(), ENTRY);
+
+        String identifier = getValidIdentifier(ctx.identifier().getText(), TYPEDEF_DATA, ctx);
+
+        // Validate sub statement cardinality.
+        validateSubStatementsCardinality(ctx);
+
+        // Check for identifier collision
+        int line = ctx.getStart().getLine();
+        int charPositionInLine = ctx.getStart().getCharPositionInLine();
+        detectCollidingChildUtil(listener, line, charPositionInLine, identifier, TYPEDEF_DATA);
+
+        /*
+         * Create a derived type information, the base type must be set in type
+         * listener.
+         */
+        YangTypeDef typeDefNode = getYangTypeDefNode(JAVA_GENERATION);
+        typeDefNode.setName(identifier);
+
+        typeDefNode.setLineNumber(ctx.getStart().getLine());
+        typeDefNode.setCharPosition(ctx.getStart().getCharPositionInLine());
+        typeDefNode.setFileName(listener.getFileName());
+        Parsable curData = listener.getParsedDataStack().peek();
+
+        if (curData instanceof YangModule || curData instanceof YangSubModule || curData instanceof YangContainer
+                || curData instanceof YangList || curData instanceof YangNotification || curData instanceof YangRpc
+                || curData instanceof YangInput || curData instanceof YangOutput || curData instanceof YangGrouping) {
+
+            YangNode curNode = (YangNode) curData;
+            try {
+                curNode.addChild(typeDefNode);
+            } catch (DataModelException e) {
+                throw new ParserException(constructExtendedListenerErrorMessage(UNHANDLED_PARSED_DATA,
+                        TYPEDEF_DATA, ctx.identifier().getText(), ENTRY, e.getMessage()));
+            }
+            listener.getParsedDataStack().push(typeDefNode);
+        } else {
+            throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER,
+                    TYPEDEF_DATA, ctx.identifier().getText(), ENTRY));
+        }
+    }
+
+    /**
+     * It is called when parser exits from grammar rule (typedef), it perform
+     * validations and updates the data model tree.
+     *
+     * @param listener listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processTypeDefExit(TreeWalkListener listener,
+                                          TypedefStatementContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, TYPEDEF_DATA, ctx.identifier().getText(), EXIT);
+
+        if (listener.getParsedDataStack().peek() instanceof YangTypeDef) {
+            YangTypeDef typeDefNode = (YangTypeDef) listener.getParsedDataStack().peek();
+            try {
+                typeDefNode.validateDataOnExit();
+            } catch (DataModelException e) {
+                throw new ParserException(constructListenerErrorMessage(INVALID_CONTENT, TYPEDEF_DATA,
+                        ctx.identifier().getText(), EXIT));
+            }
+
+            listener.getParsedDataStack().pop();
+        } else {
+            throw new ParserException(constructListenerErrorMessage(MISSING_CURRENT_HOLDER, TYPEDEF_DATA,
+                    ctx.identifier().getText(), EXIT));
+        }
+    }
+
+    /**
+     * Validates the cardinality of typedef sub-statements as per grammar.
+     *
+     * @param ctx context object of the grammar rule
+     */
+    private static void validateSubStatementsCardinality(TypedefStatementContext ctx) {
+
+        validateCardinalityMaxOne(ctx.unitsStatement(), UNITS_DATA, TYPEDEF_DATA, ctx.identifier().getText());
+        validateCardinalityMaxOne(ctx.defaultStatement(), DEFAULT_DATA, TYPEDEF_DATA, ctx.identifier().getText());
+        validateCardinalityEqualsOne(ctx.typeStatement(), TYPE_DATA, TYPEDEF_DATA, ctx.identifier().getText(), ctx);
+        validateCardinalityMaxOne(ctx.descriptionStatement(), DESCRIPTION_DATA, TYPEDEF_DATA,
+                                  ctx.identifier().getText());
+        validateCardinalityMaxOne(ctx.referenceStatement(), REFERENCE_DATA, TYPEDEF_DATA, ctx.identifier().getText());
+        validateCardinalityMaxOne(ctx.statusStatement(), STATUS_DATA, TYPEDEF_DATA, ctx.identifier().getText());
+    }
+}
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/TypeListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/TypeListener.java
new file mode 100644
index 0000000..0b16af7
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/TypeListener.java
@@ -0,0 +1,352 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.onosproject.yang.compiler.datamodel.YangDerivedInfo;
+import org.onosproject.yang.compiler.datamodel.YangLeaf;
+import org.onosproject.yang.compiler.datamodel.YangLeafList;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangNodeIdentifier;
+import org.onosproject.yang.compiler.datamodel.YangType;
+import org.onosproject.yang.compiler.datamodel.YangTypeDef;
+import org.onosproject.yang.compiler.datamodel.YangUnion;
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.datamodel.utils.DataModelUtils;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes;
+import org.onosproject.yang.compiler.linker.impl.YangResolutionInfoImpl;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.TreeWalkListener;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil;
+
+import static org.onosproject.yang.compiler.datamodel.utils.GeneratedLanguage.JAVA_GENERATION;
+import static org.onosproject.yang.compiler.datamodel.utils.ResolvableStatus.UNRESOLVED;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.TYPE_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes.DERIVED;
+import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes.INSTANCE_IDENTIFIER;
+import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes.getType;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.TypeStatementContext;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.EXIT;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructExtendedListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil.getValidNodeIdentifier;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
+import static org.onosproject.yang.compiler.translator.tojava.YangDataModelFactory.getYangType;
+
+/*
+ * Reference: RFC6020 and YANG ANTLR Grammar
+ *
+ * ABNF grammar as per RFC6020
+ *  type-stmt           = type-keyword sep identifier-ref-arg-str optsep
+ *                        (";" /
+ *                         "{" stmtsep
+ *                            type-body-stmts
+ *                         "}")
+ *
+ * ANTLR grammar rule
+ * typeStatement : TYPE_KEYWORD string (STMTEND | LEFT_CURLY_BRACE typeBodyStatements RIGHT_CURLY_BRACE);
+ */
+
+/**
+ * Represents listener based call back function corresponding to the "type" rule
+ * defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
+ */
+public final class TypeListener {
+
+    /**
+     * Creates a new type listener.
+     */
+    private TypeListener() {
+    }
+
+    /**
+     * It is called when parser receives an input matching the grammar rule
+     * (type), performs validation and updates the data model tree.
+     *
+     * @param listener listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processTypeEntry(TreeWalkListener listener,
+                                        TypeStatementContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, TYPE_DATA, ctx.string().getText(), ENTRY);
+
+        // Validate node identifier.
+        YangNodeIdentifier nodeIdentifier = getValidNodeIdentifier(ctx.string().getText(), TYPE_DATA,
+                                                                   ctx);
+
+        // Obtain the YANG data type.
+        YangDataTypes yangDataTypes = getType(ctx.string().getText());
+
+        // validate type sub-statement cardinality
+        validateTypeSubStatementCardinality(ctx, yangDataTypes);
+
+        // Create YANG type object and fill the values.
+        YangType<?> type = getYangType(JAVA_GENERATION);
+        type.setNodeId(nodeIdentifier);
+        type.setDataType(yangDataTypes);
+
+        type.setLineNumber(ctx.getStart().getLine());
+        type.setCharPosition(ctx.getStart().getCharPositionInLine());
+        type.setFileName(listener.getFileName());
+        // Set default require instance value as true for instance identifier.
+        setDefaultRequireInstanceForInstanceIdentifier(type);
+
+        int errorLine = ctx.getStart().getLine();
+        int errorPosition = ctx.getStart().getCharPositionInLine();
+
+        Parsable tmpData = listener.getParsedDataStack().peek();
+        switch (tmpData.getYangConstructType()) {
+            case LEAF_DATA:
+                YangLeaf leaf = (YangLeaf) tmpData;
+                leaf.setDataType(type);
+
+                /*
+                 * If data type is derived, resolution information to be added
+                 * in resolution list.
+                 */
+                if (yangDataTypes == DERIVED) {
+                    // Parent YANG node of leaf to be added in resolution information.
+                    Parsable leafData = listener.getParsedDataStack().pop();
+                    Parsable parentNodeOfLeaf = listener.getParsedDataStack().peek();
+                    listener.getParsedDataStack().push(leafData);
+
+                    // Verify parent node of leaf
+                    if (!(parentNodeOfLeaf instanceof YangNode)) {
+                        throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, TYPE_DATA,
+                                                                                ctx.string().getText(), EXIT));
+                    }
+
+                    // Create empty derived info and attach it to type extended info.
+                    YangDerivedInfo<?> yangDerivedInfo = new YangDerivedInfo<>();
+                    yangDerivedInfo.setLineNumber(ctx.getStart().getLine());
+                    yangDerivedInfo.setCharPosition(ctx.getStart().getCharPositionInLine());
+                    yangDerivedInfo.setFileName(listener.getFileName());
+                    ((YangType<YangDerivedInfo>) type).setDataTypeExtendedInfo(yangDerivedInfo);
+
+                    type.setResolvableStatus(UNRESOLVED);
+
+                    // Add resolution information to the list
+                    YangResolutionInfoImpl resolutionInfo =
+                            new YangResolutionInfoImpl<YangType>(
+                                    type, (YangNode) parentNodeOfLeaf, errorLine,
+                                    errorPosition);
+                    addToResolutionList(resolutionInfo, ctx);
+                }
+                break;
+            case LEAF_LIST_DATA:
+                YangLeafList leafList = (YangLeafList) tmpData;
+                leafList.setDataType(type);
+
+                /*
+                 * If data type is derived, resolution information to be added
+                 * in resolution list.
+                 */
+                if (yangDataTypes == DERIVED) {
+                    // Parent YANG node of leaf list to be added in resolution information.
+                    Parsable leafListData = listener.getParsedDataStack().pop();
+                    Parsable parentNodeOfLeafList = listener.getParsedDataStack().peek();
+                    listener.getParsedDataStack().push(leafListData);
+
+                    // Verify parent node of leaf
+                    if (!(parentNodeOfLeafList instanceof YangNode)) {
+                        throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, TYPE_DATA,
+                                                                                ctx.string().getText(), EXIT));
+                    }
+
+                    // Create empty derived info and attach it to type extended info.
+                    YangDerivedInfo<?> yangDerivedInfo = new YangDerivedInfo<>();
+                    yangDerivedInfo.setLineNumber(ctx.getStart().getLine());
+                    yangDerivedInfo.setCharPosition(ctx.getStart().getCharPositionInLine());
+                    yangDerivedInfo.setFileName(listener.getFileName());
+                    ((YangType<YangDerivedInfo>) type).setDataTypeExtendedInfo(yangDerivedInfo);
+
+                    // Add resolution information to the list
+                    YangResolutionInfoImpl resolutionInfo =
+                            new YangResolutionInfoImpl<YangType>(
+                                    type, (YangNode) parentNodeOfLeafList,
+                                    errorLine, errorPosition);
+                    addToResolutionList(resolutionInfo, ctx);
+                }
+                break;
+            case UNION_DATA:
+                YangUnion unionNode = (YangUnion) tmpData;
+                try {
+                    unionNode.addType(type);
+                } catch (DataModelException e) {
+                    ParserException parserException = new ParserException(e.getMessage());
+                    parserException.setLine(ctx.getStart().getLine());
+                    parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
+                    throw parserException;
+                }
+
+                /*
+                 * If data type is derived, resolution information to be added
+                 * in resolution list.
+                 */
+                if (yangDataTypes == DERIVED) {
+
+                    // Create empty derived info and attach it to type extended info.
+                    YangDerivedInfo<?> yangDerivedInfo = new YangDerivedInfo<>();
+                    yangDerivedInfo.setLineNumber(ctx.getStart().getLine());
+                    yangDerivedInfo.setCharPosition(ctx.getStart().getCharPositionInLine());
+                    yangDerivedInfo.setFileName(listener.getFileName());
+                    ((YangType<YangDerivedInfo>) type).setDataTypeExtendedInfo(yangDerivedInfo);
+
+                    type.setResolvableStatus(UNRESOLVED);
+
+                    // Add resolution information to the list
+                    YangResolutionInfoImpl resolutionInfo =
+                            new YangResolutionInfoImpl<YangType>(
+                                    type, unionNode, errorLine, errorPosition);
+                    addToResolutionList(resolutionInfo, ctx);
+                }
+
+                break;
+            case TYPEDEF_DATA:
+                /* Prepare the base type info and set in derived type */
+                YangTypeDef typeDef = (YangTypeDef) tmpData;
+                typeDef.setDataType(type);
+
+                /*
+                 * If data type is derived, resolution information to be added
+                 * in resolution list.
+                 */
+                if (yangDataTypes == DERIVED) {
+                    // Create empty derived info and attach it to type extended info.
+                    YangDerivedInfo<?> yangDerivedInfo = new YangDerivedInfo<>();
+                    yangDerivedInfo.setLineNumber(ctx.getStart().getLine());
+                    yangDerivedInfo.setCharPosition(ctx.getStart().getCharPositionInLine());
+                    yangDerivedInfo.setFileName(listener.getFileName());
+                    ((YangType<YangDerivedInfo>) type).setDataTypeExtendedInfo(yangDerivedInfo);
+
+                    type.setResolvableStatus(UNRESOLVED);
+                    // Add resolution information to the list
+                    YangResolutionInfoImpl resolutionInfo =
+                            new YangResolutionInfoImpl<YangType>(
+                                    type, typeDef, errorLine, errorPosition);
+                    addToResolutionList(resolutionInfo, ctx);
+                }
+                break;
+            //TODO: deviate replacement statement.
+
+            default:
+                throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, TYPE_DATA,
+                                                                        ctx.string().getText(), EXIT));
+        }
+
+        // Push the type to the stack.
+        listener.getParsedDataStack().push(type);
+    }
+
+    /**
+     * Sets the default require instance value as true when the type is instance identifier.
+     *
+     * @param type type to which the value has to be set
+     */
+    private static void setDefaultRequireInstanceForInstanceIdentifier(YangType<?> type) {
+
+        if (type.getDataType() == INSTANCE_IDENTIFIER) {
+            ((YangType<Boolean>) type).setDataTypeExtendedInfo(true);
+        }
+    }
+
+    /**
+     * It is called when parser exits from grammar rule (type), it perform
+     * validations and update the data model tree.
+     *
+     * @param listener Listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processTypeExit(TreeWalkListener listener,
+                                       TypeStatementContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, ListenerErrorType.MISSING_CURRENT_HOLDER, TYPE_DATA, ctx.string().getText(), EXIT);
+
+        Parsable parsableType = listener.getParsedDataStack().pop();
+        if (!(parsableType instanceof YangType)) {
+            throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, TYPE_DATA,
+                                                                    ctx.string().getText(), EXIT));
+        }
+    }
+
+    /**
+     * Adds to resolution list.
+     *
+     * @param resolutionInfo resolution information
+     * @param ctx            context object of the grammar rule
+     */
+    private static void addToResolutionList(YangResolutionInfoImpl<YangType> resolutionInfo,
+                                            TypeStatementContext ctx) {
+        try {
+            DataModelUtils.addResolutionInfo(resolutionInfo);
+        } catch (DataModelException e) {
+            throw new ParserException(constructExtendedListenerErrorMessage(ListenerErrorType.UNHANDLED_PARSED_DATA,
+                                                                            TYPE_DATA, ctx.string().getText(), ENTRY, e.getMessage()));
+        }
+    }
+
+    /**
+     * Validates type body statements cardinality.
+     *
+     * @param ctx          context object of the grammar rule
+     * @param yangDataType yang data type
+     */
+    private static void validateTypeSubStatementCardinality(TypeStatementContext ctx,
+                                                            YangDataTypes yangDataType) {
+        if (ctx.typeBodyStatements() == null || ctx.typeBodyStatements().isEmpty()) {
+            ParserException parserException;
+            switch (yangDataType) {
+                case UNION:
+                    parserException = new ParserException("YANG file error : a type union" +
+                                                                  " must have atleast one type statement.");
+                    break;
+                case ENUMERATION:
+                    parserException = new ParserException("YANG file error : a type enumeration" +
+                                                                  " must have atleast one enum statement.");
+                    break;
+                case BITS:
+                    parserException = new ParserException("YANG file error : a type bits" +
+                                                                  " must have atleast one bit statement.");
+                    break;
+                case DECIMAL64:
+                    parserException = new ParserException("YANG file error : a type decimal64" +
+                                                                  " must have fraction-digits statement.");
+                    break;
+                case LEAFREF:
+                    parserException = new ParserException("YANG file error : a type leafref" +
+                                                                  " must have one path statement.");
+                    break;
+                case IDENTITYREF:
+                    parserException = new ParserException("YANG file error : a type identityref" +
+                                                                  " must have base statement.");
+                    break;
+                default:
+                    return;
+            }
+            parserException.setLine(ctx.getStart().getLine());
+            parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
+            throw parserException;
+        }
+    }
+}
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/UnionListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/UnionListener.java
new file mode 100644
index 0000000..54aa1c0
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/UnionListener.java
@@ -0,0 +1,223 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+/*
+ * Reference: RFC6020 and YANG ANTLR Grammar
+ *
+ * ABNF grammar as per RFC6020
+ * type-body-stmts     = numerical-restrictions /
+ *                       decimal64-specification /
+ *                      string-restrictions /
+ *                       enum-specification /
+ *                       leafref-specification /
+ *                       identityref-specification /
+ *                       instance-identifier-specification /
+ *                       bits-specification /
+ *                       union-specification
+ *
+ * union-specification = 1*(type-stmt stmtsep)
+ *
+ * ANTLR grammar rule
+ * typeBodyStatements : numericalRestrictions | stringRestrictions | enumSpecification
+ *                 | leafrefSpecification | identityrefSpecification | instanceIdentifierSpecification
+ *                 | bitsSpecification | unionSpecification;
+ *
+ * unionSpecification : typeStatement+;
+ */
+
+import org.onosproject.yang.compiler.datamodel.YangLeaf;
+import org.onosproject.yang.compiler.datamodel.YangLeafList;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangType;
+import org.onosproject.yang.compiler.datamodel.YangTypeDef;
+import org.onosproject.yang.compiler.datamodel.YangUnion;
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.TreeWalkListener;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType;
+
+import static org.onosproject.yang.compiler.datamodel.utils.GeneratedLanguage.JAVA_GENERATION;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.TYPE_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.UNION_DATA;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.UnionSpecificationContext;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.EXIT;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructExtendedListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_CURRENT_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
+import static org.onosproject.yang.compiler.translator.tojava.YangDataModelFactory.getYangUnionNode;
+
+/**
+ * Represents listener based call back function corresponding to the "union" rule
+ * defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
+ */
+public final class UnionListener {
+
+    /**
+     * Suffix to be used while creating union class.
+     */
+    private static final String UNION_CLASS_SUFFIX = "_union";
+
+    /**
+     * Creates a new union listener.
+     */
+    private UnionListener() {
+    }
+
+    /**
+     * It is called when parser enters grammar rule (union), it perform
+     * validations and updates the data model tree.
+     *
+     * @param listener listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processUnionEntry(TreeWalkListener listener,
+                                         UnionSpecificationContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, UNION_DATA, "", ENTRY);
+
+        if (listener.getParsedDataStack().peek() instanceof YangType) {
+            YangUnion unionNode = getYangUnionNode(JAVA_GENERATION);
+            Parsable typeData = listener.getParsedDataStack().pop();
+
+            unionNode.setLineNumber(ctx.getStart().getLine());
+            unionNode.setCharPosition(ctx.getStart().getCharPositionInLine());
+            unionNode.setFileName(listener.getFileName());
+            // Check for stack to be non empty.
+            checkStackIsNotEmpty(listener, MISSING_HOLDER, UNION_DATA, "", ENTRY);
+
+            Parsable tmpData = listener.getParsedDataStack().peek();
+
+            switch (tmpData.getYangConstructType()) {
+                case LEAF_DATA:
+                    // Set the name of union same as leaf.
+                    unionNode.setName(((YangLeaf) tmpData).getName() + UNION_CLASS_SUFFIX);
+                    // Pop the stack entry to obtain the parent YANG node.
+                    Parsable leaf = listener.getParsedDataStack().pop();
+                    // Add the union node to the parent holder of leaf.
+                    addChildToParentNode(listener, unionNode);
+                    // Push the popped entry back to the stack.
+                    listener.getParsedDataStack().push(leaf);
+                    break;
+                case LEAF_LIST_DATA:
+                    // Set the name of union same as leaf list.
+                    unionNode.setName(((YangLeafList) tmpData).getName() + UNION_CLASS_SUFFIX);
+                    // Pop the stack entry to obtain the parent YANG node.
+                    Parsable leafList = listener.getParsedDataStack().pop();
+                    // Add the union node to the parent holder of leaf.
+                    addChildToParentNode(listener, unionNode);
+                    // Push the popped entry back to the stack.
+                    listener.getParsedDataStack().push(leafList);
+                    break;
+                case UNION_DATA:
+                    YangUnion parentUnion = (YangUnion) tmpData;
+                    /*
+                     * In case parent of union is again a union, name of the
+                     * child union is parent union name suffixed with running
+                     * integer number, this is done because under union there
+                     * could be multiple child union types.
+                     */
+                    unionNode.setName(parentUnion.getName() + UNION_CLASS_SUFFIX + parentUnion.getChildUnionNumber());
+                    // Increment the running number.
+                    parentUnion.setChildUnionNumber(parentUnion.getChildUnionNumber() + 1);
+                    // Add union as a child to parent union.
+                    addChildToParentNode(listener, unionNode);
+                    break;
+                case TYPEDEF_DATA:
+                    YangTypeDef typeDef = (YangTypeDef) tmpData;
+                    // Set the name of union same as typedef name.
+                    unionNode.setName(typeDef.getName() + UNION_CLASS_SUFFIX);
+                    // Add union as a child to parent type def.
+                    addChildToParentNode(listener, unionNode);
+                    break;
+                // TODO deviate.
+                default:
+                    throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, TYPE_DATA,
+                            ((YangType<?>) typeData).getDataTypeName(), ENTRY));
+            }
+            listener.getParsedDataStack().push(typeData);
+            listener.getParsedDataStack().push(unionNode);
+        } else {
+            throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, UNION_DATA, "", ENTRY));
+        }
+    }
+
+    /**
+     * It is called when parser exits from grammar rule (union), it perform
+     * validations and update the data model tree.
+     *
+     * @param listener Listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processUnionExit(TreeWalkListener listener,
+                                        UnionSpecificationContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, UNION_DATA, "", EXIT);
+
+        Parsable tmpUnionNode = listener.getParsedDataStack().peek();
+        if (tmpUnionNode instanceof YangUnion) {
+            YangUnion unionNode = (YangUnion) tmpUnionNode;
+            listener.getParsedDataStack().pop();
+
+            // Check for stack to be non empty.
+            checkStackIsNotEmpty(listener, MISSING_HOLDER, UNION_DATA, "", EXIT);
+
+            Parsable tmpNode = listener.getParsedDataStack().peek();
+            switch (tmpNode.getYangConstructType()) {
+                case TYPE_DATA: {
+                    YangType<YangUnion> typeNode = (YangType<YangUnion>) tmpNode;
+                    typeNode.setDataTypeExtendedInfo(unionNode);
+                    break;
+                }
+                default:
+                    throw new ParserException(
+                            constructListenerErrorMessage(INVALID_HOLDER, UNION_DATA, "", EXIT));
+            }
+        } else {
+            throw new ParserException(
+                    constructListenerErrorMessage(MISSING_CURRENT_HOLDER, UNION_DATA, "", EXIT));
+        }
+    }
+
+    /**
+     * Adds the union node to the parent holder.
+     *
+     * @param listener  listener's object
+     * @param unionNode union node which needs to be added to parent
+     */
+    private static void addChildToParentNode(TreeWalkListener listener, YangUnion unionNode) {
+        if (!(listener.getParsedDataStack().peek() instanceof YangNode)) {
+            throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, UNION_DATA,
+                    "", ENTRY));
+        } else {
+            YangNode curNode = (YangNode) listener.getParsedDataStack().peek();
+            try {
+                curNode.addChild(unionNode);
+            } catch (DataModelException e) {
+                throw new ParserException(constructExtendedListenerErrorMessage(ListenerErrorType.UNHANDLED_PARSED_DATA,
+                                                                                UNION_DATA, "", ENTRY, e.getMessage()));
+            }
+        }
+    }
+}
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/UniqueListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/UniqueListener.java
new file mode 100644
index 0000000..e222422
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/UniqueListener.java
@@ -0,0 +1,104 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.onosproject.yang.compiler.datamodel.YangList;
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.TreeWalkListener;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil;
+
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.UNIQUE_DATA;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructExtendedListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.UNHANDLED_PARSED_DATA;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil.removeQuotesAndHandleConcat;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
+
+/*
+ * Reference: RFC6020 and YANG ANTLR Grammar
+ *
+ * ABNF grammar as per RFC6020
+ * unique-stmt         = unique-keyword sep unique-arg-str stmtend
+ *
+ * ANTLR grammar rule
+ * uniqueStatement: UNIQUE_KEYWORD unique STMTEND;
+ * unique : string;
+ */
+
+/**
+ * Represesnts listener based call back function corresponding to the "unique" rule
+ * defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
+ */
+public final class UniqueListener {
+
+    /**
+     * Creates a new unique listener.
+     */
+    private UniqueListener() {
+    }
+
+    /**
+     * It is called when parser receives an input matching the grammar rule
+     * (unique), perform validations and updates the data model tree.
+     *
+     * @param listener listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processUniqueEntry(TreeWalkListener listener,
+                                          GeneratedYangParser.UniqueStatementContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, UNIQUE_DATA, ctx.unique().getText(), ENTRY);
+
+        Parsable tmpData = listener.getParsedDataStack().peek();
+        if (listener.getParsedDataStack().peek() instanceof YangList) {
+            YangList yangList = (YangList) tmpData;
+            String tmpUniqueValue = removeQuotesAndHandleConcat(ctx.unique().getText());
+
+            if (tmpUniqueValue.contains(" ")) {
+                String[] uniqueValues = tmpUniqueValue.split(" ");
+                for (String uniqueValue : uniqueValues) {
+                    try {
+                        yangList.addUnique(uniqueValue);
+                    } catch (DataModelException e) {
+                        throw new ParserException(constructExtendedListenerErrorMessage(UNHANDLED_PARSED_DATA,
+                                UNIQUE_DATA,
+                                ctx.unique().getText(), ENTRY, e.getMessage()));
+                    }
+                }
+            } else {
+                try {
+                    yangList.addUnique(tmpUniqueValue);
+                } catch (DataModelException e) {
+                    throw new ParserException(constructExtendedListenerErrorMessage(UNHANDLED_PARSED_DATA, UNIQUE_DATA,
+                            ctx.unique().getText(), ENTRY, e.getMessage()));
+                }
+            }
+        } else {
+            throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, UNIQUE_DATA, ctx.unique().getText(),
+                    ENTRY));
+        }
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/UnitsListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/UnitsListener.java
new file mode 100644
index 0000000..f8db2cf
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/UnitsListener.java
@@ -0,0 +1,88 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.onosproject.yang.compiler.datamodel.YangLeaf;
+import org.onosproject.yang.compiler.datamodel.YangLeafList;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.TreeWalkListener;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType;
+
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.UNITS_DATA;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.UnitsStatementContext;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
+
+/*
+ * Reference: RFC6020 and YANG ANTLR Grammar
+ *
+ * ABNF grammar as per RFC6020
+ * units-stmt          = units-keyword sep string optsep stmtend
+ *
+ * ANTLR grammar rule
+ * unitsStatement : UNITS_KEYWORD string STMTEND;
+ */
+
+/**
+ * Represents listener based call back function corresponding to the "units"
+ * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
+ */
+public final class UnitsListener {
+
+    /**
+     * Creates a new units listener.
+     */
+    private UnitsListener() {
+    }
+
+    /**
+     * It is called when parser receives an input matching the grammar
+     * rule (units), performs validation and updates the data model
+     * tree.
+     *
+     * @param listener listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processUnitsEntry(TreeWalkListener listener,
+                                         UnitsStatementContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, UNITS_DATA, ctx.string().getText(), ENTRY);
+
+        Parsable tmpData = listener.getParsedDataStack().peek();
+        switch (tmpData.getYangConstructType()) {
+            case LEAF_DATA:
+                YangLeaf leaf = (YangLeaf) tmpData;
+                leaf.setUnits(ctx.string().getText());
+                break;
+            case LEAF_LIST_DATA:
+                YangLeafList leafList = (YangLeafList) tmpData;
+                leafList.setUnits(ctx.string().getText());
+                break;
+            case TYPEDEF_DATA:
+                // TODO
+                break;
+            default:
+                throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, UNITS_DATA,
+                                ctx.string().getText(), ENTRY));
+        }
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/UsesListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/UsesListener.java
new file mode 100644
index 0000000..616d761
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/UsesListener.java
@@ -0,0 +1,231 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.onosproject.yang.compiler.datamodel.YangAugment;
+import org.onosproject.yang.compiler.datamodel.YangCase;
+import org.onosproject.yang.compiler.datamodel.YangContainer;
+import org.onosproject.yang.compiler.datamodel.YangGrouping;
+import org.onosproject.yang.compiler.datamodel.YangInput;
+import org.onosproject.yang.compiler.datamodel.YangList;
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangNodeIdentifier;
+import org.onosproject.yang.compiler.datamodel.YangNotification;
+import org.onosproject.yang.compiler.datamodel.YangOutput;
+import org.onosproject.yang.compiler.datamodel.YangSubModule;
+import org.onosproject.yang.compiler.datamodel.YangUses;
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.linker.impl.YangResolutionInfoImpl;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.TreeWalkListener;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerCollisionDetector;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType;
+import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil;
+
+import static org.onosproject.yang.compiler.datamodel.utils.DataModelUtils.addResolutionInfo;
+import static org.onosproject.yang.compiler.datamodel.utils.GeneratedLanguage.JAVA_GENERATION;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.DESCRIPTION_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.REFERENCE_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.STATUS_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.USES_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.WHEN_DATA;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.UsesStatementContext;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerCollisionDetector.detectCollidingChildUtil;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.EXIT;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructExtendedListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.UNHANDLED_PARSED_DATA;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil.getValidNodeIdentifier;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.validateCardinalityMaxOne;
+import static org.onosproject.yang.compiler.translator.tojava.YangDataModelFactory.getYangUsesNode;
+
+/*
+ * Reference: RFC6020 and YANG ANTLR Grammar
+ *
+ * ABNF grammar as per RFC6020
+ * data-def-stmt       = container-stmt /
+ *                      leaf-stmt /
+ *                      leaf-list-stmt /
+ *                      list-stmt /
+ *                      choice-stmt /
+ *                      anyxml-stmt /
+ *                      uses-stmt
+ *
+ * uses-stmt           = uses-keyword sep identifier-ref-arg-str optsep
+ *                       (";" /
+ *                        "{" stmtsep
+ *                            ;; these stmts can appear in any order
+ *                            [when-stmt stmtsep]
+ *                            *(if-feature-stmt stmtsep)
+ *                            [status-stmt stmtsep]
+ *                            [description-stmt stmtsep]
+ *                            [reference-stmt stmtsep]
+ *                            *(refine-stmt stmtsep)
+ *                            *(uses-augment-stmt stmtsep)
+ *                        "}")
+ *
+ * ANTLR grammar rule
+ * dataDefStatement : containerStatement
+ *                 | leafStatement
+ *                 | leafListStatement
+ *                 | listStatement
+ *                 | choiceStatement
+ *                 | usesStatement;
+ *
+ * usesStatement : USES_KEYWORD string (STMTEND | LEFT_CURLY_BRACE (whenStatement | ifFeatureStatement
+ *                 | statusStatement | descriptionStatement | referenceStatement | refineStatement
+ *                 | usesAugmentStatement)* RIGHT_CURLY_BRACE);
+ */
+
+/**
+ * Represents listener based call back function corresponding to the "uses"
+ * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
+ */
+public final class UsesListener {
+
+    /**
+     * Creates a new uses listener.
+     */
+    private UsesListener() {
+    }
+
+    /**
+     * It is called when parser enters grammar rule (uses), it perform
+     * validations and updates the data model tree.
+     *
+     * @param listener listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processUsesEntry(TreeWalkListener listener, UsesStatementContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, USES_DATA, ctx.string().getText(), ENTRY);
+
+        // Validate sub statement cardinality.
+        validateSubStatementsCardinality(ctx);
+
+        // Check for identifier collision
+        int line = ctx.getStart().getLine();
+        int charPositionInLine = ctx.getStart().getCharPositionInLine();
+
+        detectCollidingChildUtil(listener, line, charPositionInLine, ctx.string().getText(), USES_DATA);
+        Parsable curData = listener.getParsedDataStack().peek();
+
+        if (curData instanceof YangModule || curData instanceof YangSubModule
+                || curData instanceof YangContainer || curData instanceof YangList
+                || curData instanceof YangUses || curData instanceof YangAugment
+                || curData instanceof YangCase || curData instanceof YangGrouping
+                || curData instanceof YangInput || curData instanceof YangOutput
+                || curData instanceof YangNotification) {
+
+            YangUses usesNode = getYangUsesNode(JAVA_GENERATION);
+
+            usesNode.setLineNumber(ctx.getStart().getLine());
+            usesNode.setCharPosition(ctx.getStart().getCharPositionInLine());
+            usesNode.setFileName(listener.getFileName());
+            YangNodeIdentifier nodeIdentifier = getValidNodeIdentifier(ctx.string().getText(), USES_DATA, ctx);
+            usesNode.setNodeIdentifier(nodeIdentifier);
+            usesNode.setCurrentGroupingDepth(listener.getGroupingDepth());
+            YangNode curNode = (YangNode) curData;
+
+            try {
+                curNode.addChild(usesNode);
+            } catch (DataModelException e) {
+                throw new ParserException(constructExtendedListenerErrorMessage(UNHANDLED_PARSED_DATA,
+                        USES_DATA, ctx.string().getText(), ENTRY, e.getMessage()));
+            }
+            listener.getParsedDataStack().push(usesNode);
+        } else {
+            throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER,
+                    USES_DATA, ctx.string().getText(), ENTRY));
+        }
+    }
+
+    /**
+     * It is called when parser exits from grammar rule (uses), it perform
+     * validations and update the data model tree.
+     *
+     * @param listener Listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processUsesExit(TreeWalkListener listener,
+                                       UsesStatementContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, USES_DATA, ctx.string().getText(), EXIT);
+
+        Parsable parsableUses = listener.getParsedDataStack().pop();
+        if (!(parsableUses instanceof YangUses)) {
+            throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, USES_DATA,
+                    ctx.string().getText(), EXIT));
+        }
+        YangUses uses = (YangUses) parsableUses;
+        int errorLine = ctx.getStart().getLine();
+        int errorPosition = ctx.getStart().getCharPositionInLine();
+
+        // Parent YANG node of uses to be added in resolution information.
+        Parsable parentNode = listener.getParsedDataStack().peek();
+
+        // Verify parent node of leaf
+        if (!(parentNode instanceof YangNode)) {
+            throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, USES_DATA,
+                    ctx.string().getText(), EXIT));
+        }
+
+        // Add resolution information to the list
+        YangResolutionInfoImpl resolutionInfo = new YangResolutionInfoImpl<YangUses>(uses,
+                                                                                     (YangNode) parentNode, errorLine,
+                                                                                     errorPosition);
+        addToResolutionList(resolutionInfo, ctx);
+    }
+
+    // TODO linker to handle collision scenarios like leaf obtained by uses, conflicts with some existing leaf.
+
+    /**
+     * Validates the cardinality of case sub-statements as per grammar.
+     *
+     * @param ctx context object of the grammar rule
+     */
+    private static void validateSubStatementsCardinality(UsesStatementContext ctx) {
+        validateCardinalityMaxOne(ctx.whenStatement(), WHEN_DATA, USES_DATA, ctx.string().getText());
+        validateCardinalityMaxOne(ctx.statusStatement(), STATUS_DATA, USES_DATA, ctx.string().getText());
+        validateCardinalityMaxOne(ctx.descriptionStatement(), DESCRIPTION_DATA, USES_DATA, ctx.string().getText());
+        validateCardinalityMaxOne(ctx.referenceStatement(), REFERENCE_DATA, USES_DATA, ctx.string().getText());
+    }
+
+    /**
+     * Add to resolution list.
+     *
+     * @param resolutionInfo resolution information.
+     * @param ctx            context object of the grammar rule
+     */
+    private static void addToResolutionList(YangResolutionInfoImpl<YangUses> resolutionInfo,
+                                            UsesStatementContext ctx) {
+
+        try {
+            addResolutionInfo(resolutionInfo);
+        } catch (DataModelException e) {
+            throw new ParserException(constructExtendedListenerErrorMessage(UNHANDLED_PARSED_DATA,
+                    USES_DATA, ctx.string().getText(), EXIT, e.getMessage()));
+        }
+    }
+}
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/ValueListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/ValueListener.java
new file mode 100644
index 0000000..c28b694
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/ValueListener.java
@@ -0,0 +1,125 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+/*
+ * Reference: RFC6020 and YANG ANTLR Grammar
+ *
+ * ABNF grammar as per RFC6020
+ * value-stmt = value-keyword sep integer-value stmtend
+ *
+ * ANTLR grammar rule
+ * valueStatement : VALUE_KEYWORD ((MINUS INTEGER) | INTEGER) STMTEND;
+ */
+
+import org.onosproject.yang.compiler.datamodel.YangEnum;
+import org.onosproject.yang.compiler.datamodel.YangEnumeration;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.TreeWalkListener;
+
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.VALUE_DATA;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.ValueStatementContext;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil.getValidIntegerValue;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
+
+/**
+ * Represents listener based call back function corresponding to the "value"
+ * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
+ */
+public final class ValueListener {
+
+    /**
+     * Creates a new value listener.
+     */
+    private ValueListener() {
+    }
+
+    /**
+     * It is called when parser receives an input matching the grammar rule
+     * (value), perform validations and update the data model tree.
+     *
+     * @param listener Listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processValueEntry(TreeWalkListener listener, ValueStatementContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, VALUE_DATA, ctx.value().getText(), ENTRY);
+
+        // Validate value
+        int value = getValidIntegerValue(ctx.value().getText(), VALUE_DATA, ctx);
+
+        // Obtain the node of the stack.
+        Parsable tmpNode = listener.getParsedDataStack().peek();
+        switch (tmpNode.getYangConstructType()) {
+            case ENUM_DATA: {
+                YangEnum enumNode = (YangEnum) tmpNode;
+                if (!isEnumValueValid(listener, ctx, value)) {
+                    ParserException parserException = new ParserException("Duplicate Value Entry");
+                    parserException.setLine(ctx.getStart().getLine());
+                    parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
+                    throw parserException;
+                }
+                enumNode.setValue(value);
+                break;
+            }
+            default:
+                throw new ParserException(
+                        constructListenerErrorMessage(INVALID_HOLDER, VALUE_DATA, ctx.value().getText(), ENTRY));
+        }
+    }
+
+    /**
+     * Validates ENUM value uniqueness.
+     *
+     * @param listener Listener's object
+     * @param ctx      context object of the grammar rule
+     * @param value    enum value
+     * @return validation result
+     */
+    private static boolean isEnumValueValid(TreeWalkListener listener, ValueStatementContext ctx,
+                                            int value) {
+        Parsable enumNode = listener.getParsedDataStack().pop();
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, VALUE_DATA, ctx.value().getText(), ENTRY);
+
+        Parsable tmpNode = listener.getParsedDataStack().peek();
+        switch (tmpNode.getYangConstructType()) {
+            case ENUMERATION_DATA: {
+                YangEnumeration yangEnumeration = (YangEnumeration) tmpNode;
+                for (YangEnum curEnum : yangEnumeration.getEnumSet()) {
+                    if (value == curEnum.getValue()) {
+                        listener.getParsedDataStack().push(enumNode);
+                        return false;
+                    }
+                }
+                listener.getParsedDataStack().push(enumNode);
+                return true;
+            }
+            default:
+                listener.getParsedDataStack().push(enumNode);
+                throw new ParserException(
+                        constructListenerErrorMessage(INVALID_HOLDER, VALUE_DATA, ctx.value().getText(), ENTRY));
+        }
+    }
+}
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/VersionListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/VersionListener.java
new file mode 100644
index 0000000..9c46b26
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/VersionListener.java
@@ -0,0 +1,112 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangSubModule;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.TreeWalkListener;
+
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.VERSION_DATA;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil.getValidVersion;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
+
+/*
+ * Reference: RFC6020 and YANG ANTLR Grammar
+ *
+ * ABNF grammar as per RFC6020
+ * module-header-stmts = ;; these stmts can appear in any order
+ *                       [yang-version-stmt stmtsep]
+ *                        namespace-stmt stmtsep
+ *                        prefix-stmt stmtsep
+ *
+ * submodule-header-stmts =
+ *                            ;; these stmts can appear in any order
+ *                            [yang-version-stmt stmtsep]
+ *                             belongs-to-stmt stmtsep
+ *
+ * yang-version-stmt   = yang-version-keyword sep yang-version-arg-str
+ *                       optsep stmtend
+ *
+ *
+ * ANTLR grammar rule
+ * module_header_statement : yang_version_stmt? namespace_stmt prefix_stmt
+ *                         | yang_version_stmt? prefix_stmt namespace_stmt
+ *                         | namespace_stmt yang_version_stmt? prefix_stmt
+ *                         | namespace_stmt prefix_stmt yang_version_stmt?
+ *                         | prefix_stmt namespace_stmt yang_version_stmt?
+ *                         | prefix_stmt yang_version_stmt? namespace_stmt?
+ *                         ;
+ * submodule_header_statement : yang_version_stmt? belongs_to_stmt
+ *                            | belongs_to_stmt yang_version_stmt?
+ *                            ;
+ * yang_version_stmt : YANG_VERSION_KEYWORD version STMTEND;
+ * version           : string;
+ */
+
+/**
+ * Represents listener based call back function corresponding to the "version"
+ * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
+ */
+public final class VersionListener {
+
+    /**
+     * Creates a new version listener.
+     */
+    private VersionListener() {
+    }
+
+    /**
+     * It is called when parser receives an input matching the grammar rule
+     * (version), perform validations and update the data model tree.
+     *
+     * @param listener Listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processVersionEntry(TreeWalkListener listener,
+                                           GeneratedYangParser.YangVersionStatementContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, VERSION_DATA, ctx.version().getText(), ENTRY);
+
+        byte version = getValidVersion(ctx);
+
+        // Obtain the node of the stack.
+        Parsable tmpNode = listener.getParsedDataStack().peek();
+        switch (tmpNode.getYangConstructType()) {
+            case MODULE_DATA: {
+                YangModule module = (YangModule) tmpNode;
+                module.setVersion(version);
+                break;
+            }
+            case SUB_MODULE_DATA: {
+                YangSubModule subModule = (YangSubModule) tmpNode;
+                subModule.setVersion(version);
+                break;
+            }
+            default:
+                throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, VERSION_DATA,
+                        ctx.version().getText(), ENTRY));
+        }
+    }
+}
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/WhenListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/WhenListener.java
new file mode 100644
index 0000000..3f9602d
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/WhenListener.java
@@ -0,0 +1,123 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.onosproject.yang.compiler.datamodel.YangWhen;
+import org.onosproject.yang.compiler.datamodel.YangWhenHolder;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.TreeWalkListener;
+
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.WHEN_DATA;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.WhenStatementContext;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.EXIT;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_CURRENT_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil.removeQuotesAndHandleConcat;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
+
+/*
+ * Reference: RFC6020 and YANG ANTLR Grammar
+ *
+ * ABNF grammar as per RFC6020
+ *
+ *  when-stmt           = when-keyword sep string optsep
+ *                        (";" /
+ *                         "{" stmtsep
+ *                             ;; these stmts can appear in any order
+ *                             [description-stmt stmtsep]
+ *                             [reference-stmt stmtsep]
+ *                          "}")
+ *
+ * ANTLR grammar rule
+ * whenStatement : WHEN_KEYWORD string (STMTEND | LEFT_CURLY_BRACE ((descriptionStatement? referenceStatement?)
+ *       | (referenceStatement? descriptionStatement?)) RIGHT_CURLY_BRACE);
+ */
+
+/**
+ * Represents listener based call back function corresponding to the
+ * "when" rule defined in ANTLR grammar file for corresponding ABNF rule
+ * in RFC 6020.
+ */
+public final class WhenListener {
+
+    /**
+     * Creates a new when listener.
+     */
+    private WhenListener() {
+    }
+
+    /**
+     * Perform validations and updates the data model tree.It is called when parser
+     * receives an input matching the grammar rule (when).
+     *
+     * @param listener listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processWhenEntry(TreeWalkListener listener,
+                                        WhenStatementContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, WHEN_DATA, ctx.string().getText(), ENTRY);
+        String condition = removeQuotesAndHandleConcat(ctx.string().getText());
+
+        YangWhenHolder whenHolder;
+
+        // Obtain the node of the stack.
+        Parsable tmpNode = listener.getParsedDataStack().peek();
+        if (tmpNode instanceof YangWhenHolder) {
+            whenHolder = (YangWhenHolder) tmpNode;
+
+            YangWhen when = new YangWhen();
+            when.setCondition(condition);
+
+            when.setLineNumber(ctx.getStart().getLine());
+            when.setCharPosition(ctx.getStart().getCharPositionInLine());
+            when.setFileName(listener.getFileName());
+
+            whenHolder.setWhen(when);
+            listener.getParsedDataStack().push(when);
+        } else {
+            throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER,
+                                                                    WHEN_DATA, ctx.string().getText(), ENTRY));
+        }
+    }
+
+    /**
+     * Performs validation and updates the data model tree.It is called when parser
+     * exits from grammar rule (when).
+     *
+     * @param listener listener's object
+     * @param ctx      context object of the grammar rule
+     */
+    public static void processWhenExit(TreeWalkListener listener,
+                                       WhenStatementContext ctx) {
+
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, WHEN_DATA, ctx.string().getText(), EXIT);
+
+        if (listener.getParsedDataStack().peek() instanceof YangWhen) {
+            listener.getParsedDataStack().pop();
+        } else {
+            throw new ParserException(constructListenerErrorMessage(MISSING_CURRENT_HOLDER, WHEN_DATA,
+                                                                    ctx.string().getText(), EXIT));
+        }
+    }
+}
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/package-info.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/package-info.java
new file mode 100644
index 0000000..71a1796
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/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.
+ */
+
+/**
+ * Provide call back functions for listeners based tree walk.
+ */
+package org.onosproject.yang.compiler.parser.impl.listeners;
\ No newline at end of file
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/package-info.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/package-info.java
new file mode 100644
index 0000000..1dfb458
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/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.
+ */
+
+/**
+ * Parse the YANG information from ANTLR generated parse tree.
+ */
+package org.onosproject.yang.compiler.parser.impl;
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/parserutils/ListenerCollisionDetector.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/parserutils/ListenerCollisionDetector.java
new file mode 100644
index 0000000..d13e7f9
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/parserutils/ListenerCollisionDetector.java
@@ -0,0 +1,74 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.parserutils;
+
+import org.onosproject.yang.compiler.datamodel.CollisionDetector;
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.datamodel.utils.YangConstructType;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.TreeWalkListener;
+
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.EXIT;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
+
+/**
+ * Represents the detector of YANG construct collision in a YANG file.
+ */
+public final class ListenerCollisionDetector {
+
+    /**
+     * Creates a new listener collision.
+     */
+    private ListenerCollisionDetector() {
+    }
+
+    /**
+     * Detects that the identifiers of all these child nodes must be unique
+     * within all cases in a choice.
+     *
+     * @param listener listener's object
+     * @param line line of identifier in YANG file, required for error
+     *            reporting
+     * @param charPosition character position of identifier in YANG file,
+     *            required for error reporting
+     * @param identifierName name for which uniqueness is to be detected
+     * @param constructType type of YANG construct for which collision check is
+     *            to be performed
+     * @throws ParserException if identifier is not unique
+     */
+    public static void detectCollidingChildUtil(TreeWalkListener listener, int line, int charPosition,
+            String identifierName, YangConstructType constructType)
+            throws ParserException {
+
+        Object obj = listener.getParsedDataStack().peek();
+        if (obj instanceof CollisionDetector) {
+            try {
+                ((CollisionDetector) obj).detectCollidingChild(
+                        identifierName, constructType);
+            } catch (DataModelException e) {
+                ParserException parserException = new ParserException(e.getMessage());
+                parserException.setLine(line);
+                parserException.setCharPosition(charPosition);
+                throw parserException;
+            }
+        } else {
+            throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, constructType, identifierName,
+                    EXIT));
+        }
+    }
+}
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/parserutils/ListenerErrorLocation.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/parserutils/ListenerErrorLocation.java
new file mode 100644
index 0000000..8d98840
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/parserutils/ListenerErrorLocation.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.parserutils;
+
+/**
+ * Represents listener error location.
+ */
+public enum ListenerErrorLocation {
+    /**
+     * Represents that the error location is before processing.
+     */
+    ENTRY(),
+
+    /**
+     * Represents that the error location is before processing.
+     */
+    EXIT();
+
+    /**
+     * Returns the message corresponding to listener error location.
+     *
+     * @param errorLocation enum value for type of error
+     * @return message corresponding to listener error location
+     */
+    public static String getErrorLocationMessage(ListenerErrorLocation errorLocation) {
+
+        switch (errorLocation) {
+            case ENTRY:
+                return "before";
+            case EXIT:
+                return "after";
+            default:
+                return "during";
+        }
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/parserutils/ListenerErrorMessageConstruction.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/parserutils/ListenerErrorMessageConstruction.java
new file mode 100644
index 0000000..db20b50
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/parserutils/ListenerErrorMessageConstruction.java
@@ -0,0 +1,92 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.parserutils;
+
+import org.onosproject.yang.compiler.datamodel.utils.YangConstructType;
+
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.getYangConstructType;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.getErrorLocationMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.getErrorType;
+
+/**
+ * Represents a utility to help construct detailed error message.
+ */
+public final class ListenerErrorMessageConstruction {
+
+    /**
+     * Creates a object of listen error message.
+     */
+    private ListenerErrorMessageConstruction() {
+    }
+
+    /**
+     * Constructs message for error with extended information and returns the
+     * same.
+     *
+     * @param errorType error type needs to be set in error message
+     * @param yangConstructType type of parsable data in which error occurred
+     * @param parsableDataTypeName identifier/string of parsable data type in
+     *            which error occurred
+     * @param errorLocation location where error occurred
+     * @param extendedErrorInformation extended error information
+     * @return constructed error message
+     */
+    public static String constructExtendedListenerErrorMessage(ListenerErrorType errorType,
+                                                               YangConstructType yangConstructType,
+                                                               String parsableDataTypeName,
+                                                               ListenerErrorLocation errorLocation,
+                                                               String extendedErrorInformation) {
+        String newErrorMessage;
+        newErrorMessage = constructListenerErrorMessage(errorType, yangConstructType, parsableDataTypeName,
+                                                        errorLocation)
+                + "\n"
+                + "Error Information: "
+                + extendedErrorInformation;
+        return newErrorMessage;
+    }
+
+    /**
+     * Constructs message for error during listener based tree walk and returns
+     * the same.
+     *
+     * @param errorType error type needs to be set in error message
+     * @param yangConstructType type of parsable data in which error occurred
+     * @param parsableDataTypeName identifier/string of parsable data type in
+     *            which error occurred
+     * @param errorLocation location where error occurred
+     * @return constructed error message
+     */
+    public static String constructListenerErrorMessage(ListenerErrorType errorType,
+                                                       YangConstructType yangConstructType,
+                                                       String parsableDataTypeName,
+                                                       ListenerErrorLocation errorLocation) {
+
+        String errorMessage;
+
+        errorMessage = "Internal parser error detected: " + getErrorType(errorType) + " "
+                + getYangConstructType(yangConstructType);
+
+        if (!parsableDataTypeName.isEmpty()) {
+            errorMessage = errorMessage + " \"" + parsableDataTypeName + "\" ";
+        } else {
+            errorMessage = errorMessage + " ";
+
+        }
+        errorMessage = errorMessage + getErrorLocationMessage(errorLocation) + " processing.";
+        return errorMessage;
+    }
+}
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/parserutils/ListenerErrorType.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/parserutils/ListenerErrorType.java
new file mode 100644
index 0000000..7e0aa5c
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/parserutils/ListenerErrorType.java
@@ -0,0 +1,103 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.parserutils;
+
+/**
+ * Represents listener error type.
+ */
+public enum ListenerErrorType {
+    /**
+     * Represents the parent holder in parsable stack for given YANG construct
+     * is invalid.
+     */
+    INVALID_HOLDER(),
+
+    /**
+     * Represents the parent holder in parsable stack for given YANG construct
+     * is missing.
+     */
+    MISSING_HOLDER(),
+
+    /**
+     * Represents the current holder in parsable stack for given YANG construct
+     * is missing.
+     */
+    MISSING_CURRENT_HOLDER(),
+
+    /**
+     * Represents that the child in parsable stack for given YANG construct is
+     * invalid.
+     */
+    INVALID_CHILD(),
+
+    /**
+     * Represents that the cardinality for given YANG construct is invalid.
+     */
+    INVALID_CARDINALITY(),
+
+    /**
+     * Represents that the entry is duplicate.
+     */
+    DUPLICATE_ENTRY(),
+
+    /**
+     * Represents that the content is invalid.
+     */
+    INVALID_CONTENT(),
+
+    /**
+     * Represents that the identifier collision is detected.
+     */
+    IDENTIFIER_COLLISION(),
+
+    /**
+     * Represents that some of earlier parsed data is not handled correctly.
+     */
+    UNHANDLED_PARSED_DATA();
+
+    /**
+     * Returns the message corresponding to listener error type.
+     *
+     * @param errorType enum value for type of error
+     * @return message corresponding to listener error type
+     */
+    public static String getErrorType(ListenerErrorType errorType) {
+
+        switch (errorType) {
+            case INVALID_HOLDER:
+                return "Invalid holder for";
+            case MISSING_HOLDER:
+                return "Missing holder at";
+            case MISSING_CURRENT_HOLDER:
+                return "Missing";
+            case INVALID_CHILD:
+                return "Invalid child in";
+            case INVALID_CARDINALITY:
+                return "Invalid cardinality in";
+            case DUPLICATE_ENTRY:
+                return "Duplicate";
+            case INVALID_CONTENT:
+                return "Invalid content in";
+            case IDENTIFIER_COLLISION:
+                return "Identifier collision detected for";
+            case UNHANDLED_PARSED_DATA:
+                return "Unhandled parsed data at";
+            default:
+                return "Problem in";
+        }
+    }
+}
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/parserutils/ListenerUtil.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/parserutils/ListenerUtil.java
new file mode 100644
index 0000000..e71eb98
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/parserutils/ListenerUtil.java
@@ -0,0 +1,1061 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.parserutils;
+
+import org.antlr.v4.runtime.ParserRuleContext;
+import org.onosproject.yang.compiler.datamodel.YangAtomicPath;
+import org.onosproject.yang.compiler.datamodel.YangImport;
+import org.onosproject.yang.compiler.datamodel.YangLeaf;
+import org.onosproject.yang.compiler.datamodel.YangLeafRef;
+import org.onosproject.yang.compiler.datamodel.YangLeavesHolder;
+import org.onosproject.yang.compiler.datamodel.YangList;
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangNodeIdentifier;
+import org.onosproject.yang.compiler.datamodel.YangPathArgType;
+import org.onosproject.yang.compiler.datamodel.YangPathPredicate;
+import org.onosproject.yang.compiler.datamodel.YangReferenceResolver;
+import org.onosproject.yang.compiler.datamodel.YangRelativePath;
+import org.onosproject.yang.compiler.datamodel.YangSubModule;
+import org.onosproject.yang.compiler.datamodel.utils.YangConstructType;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import static org.onosproject.yang.compiler.datamodel.YangPathOperator.EQUALTO;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.UNIQUE_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.getYangConstructType;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.PathStatementContext;
+import static org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.YangVersionStatementContext;
+import static org.onosproject.yang.compiler.utils.UtilConstants.ADD;
+import static org.onosproject.yang.compiler.utils.UtilConstants.ANCESTOR;
+import static org.onosproject.yang.compiler.utils.UtilConstants.CARET;
+import static org.onosproject.yang.compiler.utils.UtilConstants.CHAR_OF_OPEN_SQUARE_BRACKET;
+import static org.onosproject.yang.compiler.utils.UtilConstants.CHAR_OF_SLASH;
+import static org.onosproject.yang.compiler.utils.UtilConstants.CLOSE_PARENTHESIS;
+import static org.onosproject.yang.compiler.utils.UtilConstants.COLON;
+import static org.onosproject.yang.compiler.utils.UtilConstants.CURRENT;
+import static org.onosproject.yang.compiler.utils.UtilConstants.EMPTY_STRING;
+import static org.onosproject.yang.compiler.utils.UtilConstants.FALSE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.INVALID_TREE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.OPEN_SQUARE_BRACKET;
+import static org.onosproject.yang.compiler.utils.UtilConstants.QUOTES;
+import static org.onosproject.yang.compiler.utils.UtilConstants.SLASH;
+import static org.onosproject.yang.compiler.utils.UtilConstants.SLASH_ANCESTOR;
+import static org.onosproject.yang.compiler.utils.UtilConstants.SLASH_FOR_STRING;
+import static org.onosproject.yang.compiler.utils.UtilConstants.TRUE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.YANG_FILE_ERROR;
+
+/**
+ * Represents an utility for listener.
+ */
+public final class ListenerUtil {
+
+    private static final Pattern IDENTIFIER_PATTERN =
+            Pattern.compile("[a-zA-Z_][a-zA-Z0-9_.-]*");
+    private static final String DATE_PATTERN =
+            "[0-9]{4}-([0-9]{2}|[0-9])-([0-9]{2}|[0-9])";
+    private static final String NON_NEGATIVE_INTEGER_PATTERN = "[0-9]+";
+    private static final Pattern INTEGER_PATTERN =
+            Pattern.compile("[-][0-9]+|[0-9]+");
+    private static final Pattern PREDICATE =
+            Pattern.compile("\\[(.*?)\\]");
+    private static final String XML = "xml";
+    private static final String ONE = "1";
+    private static final int IDENTIFIER_LENGTH = 64;
+    private static final String DATE_FORMAT = "yyyy-MM-dd";
+    private static final String REGEX_EQUAL = "[=]";
+    private static final String REGEX_OPEN_BRACE = "[(]";
+
+    // No instantiation.
+    private ListenerUtil() {
+    }
+
+    /**
+     * Removes doubles quotes and concatenates if string has plus symbol.
+     *
+     * @param yangStringData string from yang file
+     * @return concatenated string after removing double quotes
+     */
+    public 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();
+    }
+
+    /**
+     * Validates identifier and returns concatenated string if string contains plus symbol.
+     *
+     * @param identifier    string from yang file
+     * @param yangConstruct yang construct for creating error message
+     * @param ctx           yang construct's context to get the line number and character position
+     * @return concatenated string after removing double quotes
+     */
+    public static String getValidIdentifier(String identifier,
+                                            YangConstructType yangConstruct,
+                                            ParserRuleContext ctx) {
+
+        String identifierString = removeQuotesAndHandleConcat(identifier);
+        ParserException parserException;
+
+        if (identifierString.length() > IDENTIFIER_LENGTH) {
+            parserException = new ParserException("YANG file error : " +
+                                                          getYangConstructType(yangConstruct) + " name " + identifierString + " is " +
+                                                          "greater than 64 characters.");
+        } else if (!IDENTIFIER_PATTERN.matcher(identifierString).matches()) {
+            parserException = new ParserException("YANG file error : " +
+                                                          getYangConstructType(yangConstruct) + " name " + identifierString + " is not " +
+                                                          "valid.");
+        } else if (identifierString.toLowerCase().startsWith(XML)) {
+            parserException = new ParserException("YANG file error : " +
+                                                          getYangConstructType(yangConstruct) + " identifier " + identifierString +
+                                                          " must not start with (('X'|'x') ('M'|'m') ('L'|'l')).");
+        } else {
+            return identifierString;
+        }
+
+        parserException.setLine(ctx.getStart().getLine());
+        parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
+        throw parserException;
+    }
+
+    /**
+     * Validates the revision date.
+     *
+     * @param dateToValidate input revision date
+     * @return validation result, true for success, false for failure
+     */
+    public static boolean isDateValid(String dateToValidate) {
+        if (dateToValidate == null || !dateToValidate.matches(DATE_PATTERN)) {
+            return false;
+        }
+
+        SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT);
+        sdf.setLenient(false);
+
+        try {
+            //if not valid, it will throw ParseException
+            sdf.parse(dateToValidate);
+        } catch (ParseException e) {
+            return false;
+        }
+
+        return true;
+    }
+
+    /**
+     * Validates YANG version.
+     *
+     * @param ctx version context object of the grammar rule
+     * @return valid version
+     */
+    public static byte getValidVersion(YangVersionStatementContext ctx) {
+
+        String value = removeQuotesAndHandleConcat(ctx.version().getText());
+        if (!value.equals(ONE)) {
+            ParserException parserException = new ParserException("YANG file error: Input version not supported");
+            parserException.setLine(ctx.getStart().getLine());
+            parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
+            throw parserException;
+        }
+
+        return Byte.valueOf(value);
+    }
+
+    /**
+     * Validates non negative integer value.
+     *
+     * @param integerValue  integer to be validated
+     * @param yangConstruct yang construct for creating error message
+     * @param ctx           context object of the grammar rule
+     * @return valid non negative integer value
+     */
+    public static int getValidNonNegativeIntegerValue(String integerValue, YangConstructType yangConstruct,
+                                                      ParserRuleContext ctx) {
+
+        String value = removeQuotesAndHandleConcat(integerValue);
+        if (!value.matches(NON_NEGATIVE_INTEGER_PATTERN)) {
+            ParserException parserException = new ParserException("YANG file error : " +
+                                                                          getYangConstructType(yangConstruct) + " value " + value + " is not " +
+                                                                          "valid.");
+            parserException.setLine(ctx.getStart().getLine());
+            parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
+            throw parserException;
+        }
+
+        int valueInInteger;
+        try {
+            valueInInteger = Integer.parseInt(value);
+        } catch (NumberFormatException e) {
+            ParserException parserException = new ParserException("YANG file error : " +
+                                                                          getYangConstructType(yangConstruct) + " value " + value + " is not " +
+                                                                          "valid.");
+            parserException.setLine(ctx.getStart().getLine());
+            parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
+            throw parserException;
+        }
+        return valueInInteger;
+    }
+
+    /**
+     * Validates integer value.
+     *
+     * @param integerValue  integer to be validated
+     * @param yangConstruct yang construct for creating error message
+     * @param ctx           context object of the grammar rule
+     * @return valid integer value
+     */
+    public static int getValidIntegerValue(String integerValue, YangConstructType yangConstruct,
+                                           ParserRuleContext ctx) {
+
+        String value = removeQuotesAndHandleConcat(integerValue);
+        if (!INTEGER_PATTERN.matcher(value).matches()) {
+            ParserException parserException = new ParserException("YANG file error : " +
+                                                                          getYangConstructType(yangConstruct) + " value " + value + " is not " +
+                                                                          "valid.");
+            parserException.setLine(ctx.getStart().getLine());
+            parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
+            throw parserException;
+        }
+
+        int valueInInteger;
+        try {
+            valueInInteger = Integer.parseInt(value);
+        } catch (NumberFormatException e) {
+            ParserException parserException = new ParserException("YANG file error : " +
+                                                                          getYangConstructType(yangConstruct) + " value " + value + " is not " +
+                                                                          "valid.");
+            parserException.setLine(ctx.getStart().getLine());
+            parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
+            throw parserException;
+        }
+        return valueInInteger;
+    }
+
+    /**
+     * Validates boolean value.
+     *
+     * @param booleanValue  value to be validated
+     * @param yangConstruct yang construct for creating error message
+     * @param ctx           context object of the grammar rule
+     * @return boolean value either true or false
+     */
+    public static boolean getValidBooleanValue(String booleanValue, YangConstructType yangConstruct,
+                                               ParserRuleContext ctx) {
+
+        String value = removeQuotesAndHandleConcat(booleanValue);
+        if (value.equals(TRUE)) {
+            return true;
+        } else if (value.equals(FALSE)) {
+            return false;
+        } else {
+            ParserException parserException = new ParserException("YANG file error : " +
+                                                                          getYangConstructType(yangConstruct) + " value " + value + " is not " +
+                                                                          "valid.");
+            parserException.setLine(ctx.getStart().getLine());
+            parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
+            throw parserException;
+        }
+    }
+
+    /**
+     * Returns current date and makes it in usable format for revision.
+     *
+     * @return usable current date format for revision
+     */
+    public static Date getCurrentDateForRevision() {
+
+        SimpleDateFormat dateFormat = new SimpleDateFormat(DATE_FORMAT);
+
+        Date date = new Date();
+        String dateInString = dateFormat.format(date);
+        try {
+            //if not valid, it will throw ParseException
+            Date now = dateFormat.parse(dateInString);
+            return date;
+        } catch (ParseException e) {
+            ParserException parserException = new ParserException("YANG file error: Input date is not correct");
+            throw parserException;
+        }
+    }
+
+    /**
+     * Checks and return valid node identifier.
+     *
+     * @param nodeIdentifierString string from yang file
+     * @param yangConstruct        yang construct for creating error message
+     * @param ctx                  yang construct's context to get the line number and character position
+     * @return valid node identifier
+     */
+    public static YangNodeIdentifier getValidNodeIdentifier(String nodeIdentifierString,
+                                                            YangConstructType yangConstruct, ParserRuleContext ctx) {
+        String tmpIdentifierString = removeQuotesAndHandleConcat(nodeIdentifierString);
+        String[] tmpData = tmpIdentifierString.split(Pattern.quote(COLON));
+        if (tmpData.length == 1) {
+            YangNodeIdentifier nodeIdentifier = new YangNodeIdentifier();
+            nodeIdentifier.setName(getValidIdentifier(tmpData[0], yangConstruct, ctx));
+            return nodeIdentifier;
+        } else if (tmpData.length == 2) {
+            YangNodeIdentifier nodeIdentifier = new YangNodeIdentifier();
+            nodeIdentifier.setPrefix(getValidIdentifier(tmpData[0], yangConstruct, ctx));
+            nodeIdentifier.setName(getValidIdentifier(tmpData[1], yangConstruct, ctx));
+            return nodeIdentifier;
+        } else {
+            ParserException parserException = new ParserException("YANG file error : " +
+                                                                          getYangConstructType(yangConstruct) + " name " + nodeIdentifierString +
+                                                                          " is not valid.");
+            parserException.setLine(ctx.getStart().getLine());
+            parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
+            throw parserException;
+        }
+    }
+
+    /**
+     * Validates the prefix of the YANG file where leaf-ref is present and
+     * puts it in the map of node and prefix in leaf-ref.
+     *
+     * @param atomicList atomic content list in leaf-ref
+     * @param leafRef    YANG leaf-ref
+     */
+    private static void valPrefix(List<YangAtomicPath> atomicList,
+                                  YangLeafRef leafRef) {
+
+        for (YangAtomicPath atomicPath : atomicList) {
+            String prefix = atomicPath.getNodeIdentifier().getPrefix();
+            YangNode parent = leafRef.getParentNode();
+            YangNode rootNode = getRootNode(parent);
+
+            List<YangImport> imports;
+            if (rootNode instanceof YangModule) {
+                imports = ((YangModule) rootNode).getImportList();
+            } else {
+                imports = ((YangSubModule) rootNode).getImportList();
+            }
+            updatePrefixWithNode(rootNode, imports, prefix, leafRef);
+        }
+    }
+
+    /**
+     * Updates the prefix and its respective node in the leaf-ref by taking
+     * the node from the import list of the root node which matches with the
+     * prefix.
+     *
+     * @param root    root node
+     * @param imports import list
+     * @param prefix  prefix in path
+     * @param leafRef YANG leaf-ref
+     */
+    private static void updatePrefixWithNode(YangNode root,
+                                             List<YangImport> imports,
+                                             String prefix,
+                                             YangLeafRef<?> leafRef) {
+
+        Map<String, String> prefixMap = leafRef.getPrefixAndNode();
+        if (prefixMap == null) {
+            prefixMap = new HashMap<>();
+            leafRef.setPrefixAndNode(prefixMap);
+        }
+
+        if (prefix == null ||
+                prefix.equals(((YangReferenceResolver) root).getPrefix())) {
+            prefixMap.put(prefix, root.getName());
+            return;
+        }
+
+        if (imports != null) {
+            for (YangImport yangImp : imports) {
+                if (yangImp.getPrefixId().equals(prefix)) {
+                    prefixMap.put(prefix, yangImp.getModuleName());
+                }
+            }
+        }
+    }
+
+    /**
+     * Returns the root node from the current node.
+     *
+     * @param node YANG node
+     * @return root node
+     */
+    private static YangNode getRootNode(YangNode node) {
+
+        YangNode curNode = node;
+        while (!(curNode instanceof YangModule) &&
+                !(curNode instanceof YangSubModule)) {
+            if (curNode == null) {
+                throw new ParserException(INVALID_TREE);
+            }
+            curNode = curNode.getParent();
+        }
+        return curNode;
+    }
+
+    /**
+     * Validates the unique syntax from the reference path.
+     *
+     * @param uniquePath   path of unique
+     * @param prefixOfFile current file's prefix
+     * @param ctx          yang construct's context to get the line number and character position
+     * @return list of absolute path
+     */
+    private static List<YangAtomicPath> validateUniqueValues(String uniquePath, String prefixOfFile,
+                                                             ParserRuleContext ctx) {
+        List<YangAtomicPath> atomicPath = new LinkedList<>();
+        String[] pathInUnique = uniquePath.split(SLASH_FOR_STRING);
+        for (String uniqueValue : pathInUnique) {
+            YangAtomicPath yangAtomicPathPath = new YangAtomicPath();
+            YangNodeIdentifier nodeIdentifier = getValidNodeIdentifier(uniqueValue, UNIQUE_DATA, ctx);
+            yangAtomicPathPath.setNodeIdentifier(nodeIdentifier);
+            atomicPath.add(yangAtomicPathPath);
+            if (nodeIdentifier.getPrefix() != null && nodeIdentifier.getPrefix() != prefixOfFile) {
+                ParserException parserException = new ParserException("YANG file error : A leaf reference, in unique," +
+                                                                              " must refer to a leaf in the list");
+                parserException.setLine(ctx.getStart().getLine());
+                parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
+                throw parserException;
+            }
+        }
+        return atomicPath;
+    }
+
+    /**
+     * Validates unique field from the list.
+     *
+     * @param yangList instance of YANG list
+     * @param ctx      yang construct's context to get the line number and character position
+     */
+    public static void validateUniqueInList(YangList yangList, ParserRuleContext ctx) {
+        YangLeaf leaf;
+        // Returns the prefix for the file where unique is present.
+        String prefixOfTheFile = getRootPrefix(yangList);
+        List<String> uniques = yangList.getUniqueList();
+        if (uniques != null && !uniques.isEmpty()) {
+            Iterator<String> uniqueList = uniques.listIterator();
+            while (uniqueList.hasNext()) {
+                String pathInUnique = uniqueList.next();
+                List<YangAtomicPath> atomicPathInUnique = validateUniqueValues(pathInUnique, prefixOfTheFile, ctx);
+                YangAtomicPath leafInPath = atomicPathInUnique.get(atomicPathInUnique.size() - 1);
+                if (atomicPathInUnique.size() == 1) {
+                    leaf = getReferenceLeafFromUnique(yangList, leafInPath);
+                } else {
+                    atomicPathInUnique.remove(atomicPathInUnique.size() - 1);
+                    YangNode holderOfLeaf = getNodeUnderListFromPath(atomicPathInUnique, yangList, ctx);
+                    leaf = getReferenceLeafFromUnique(holderOfLeaf, leafInPath);
+                }
+                if (leaf == null) {
+                    ParserException parserException = new ParserException("YANG file error : A leaf reference, in " +
+                                                                                  "unique," +
+                                                                                  " must refer to a leaf under the list");
+                    parserException.setLine(ctx.getStart().getLine());
+                    parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
+                    throw parserException;
+                }
+            }
+        }
+    }
+
+    /**
+     * Returns the last node under the unique path.
+     *
+     * @param uniquePath atomic path list
+     * @param node       root node from where it starts searching
+     * @param ctx        yang construct's context to get the line number and character position
+     * @return last node in the list
+     */
+    private static YangNode getNodeUnderListFromPath(List<YangAtomicPath> uniquePath, YangNode node,
+                                                     ParserRuleContext ctx) {
+        Iterator<YangAtomicPath> nodesInReference = uniquePath.listIterator();
+        YangNode potentialReferredNode = node.getChild();
+        while (nodesInReference.hasNext()) {
+            YangAtomicPath nodeInUnique = nodesInReference.next();
+            YangNode referredNode = getReferredNodeFromTheUniqueNodes(nodeInUnique.getNodeIdentifier(),
+                                                                      potentialReferredNode);
+            if (referredNode == null) {
+                ParserException parserException = new ParserException("YANG file error : The target node in unique " +
+                                                                              "reference path is invalid");
+                parserException.setLine(ctx.getStart().getLine());
+                parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
+                throw parserException;
+            } else {
+                potentialReferredNode = referredNode.getChild();
+            }
+        }
+        return potentialReferredNode;
+    }
+
+    /**
+     * Returns the node that matches with the name of the node in path.
+     *
+     * @param nodeInUnique          node name in path
+     * @param potentialReferredNode node under which it has to match
+     * @return referred node
+     */
+    private static YangNode getReferredNodeFromTheUniqueNodes(YangNodeIdentifier nodeInUnique, YangNode
+            potentialReferredNode) {
+        while (potentialReferredNode != null) {
+            // Check if the potential referred node is the actual referred node
+            if (potentialReferredNode.getName().equals(nodeInUnique.getName())) {
+                return potentialReferredNode;
+            }
+            potentialReferredNode = potentialReferredNode.getNextSibling();
+        }
+        return null;
+    }
+
+    /**
+     * Returns the leaf which unique refers.
+     *
+     * @param nodeForLeaf  last node where leaf is referred
+     * @param leafInUnique leaf in unique path
+     * @return YANG leaf
+     */
+    private static YangLeaf getReferenceLeafFromUnique(YangNode nodeForLeaf, YangAtomicPath leafInUnique) {
+        YangLeavesHolder leavesHolder = (YangLeavesHolder) nodeForLeaf;
+        List<YangLeaf> leaves = leavesHolder.getListOfLeaf();
+        if (leaves != null && !leaves.isEmpty()) {
+            for (YangLeaf leaf : leaves) {
+                if (leafInUnique.getNodeIdentifier().getName().equals(leaf.getName())) {
+                    return leaf;
+                }
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Returns the prefix of the root node from any node inside it.
+     *
+     * @param curNode YANG node
+     * @return prefix of the root node
+     */
+    public static String getRootPrefix(YangNode curNode) {
+
+        String prefix;
+        YangNode node = getRootNode(curNode);
+        if (node instanceof YangModule) {
+            YangModule yangModule = (YangModule) node;
+            prefix = yangModule.getPrefix();
+        } else {
+            YangSubModule yangSubModule = (YangSubModule) node;
+            prefix = yangSubModule.getPrefix();
+        }
+        return prefix;
+    }
+
+    /**
+     * Returns the matched first path predicate in a given string. Returns
+     * null if match is not found.
+     *
+     * @param str string to be matched
+     * @return the matched string
+     */
+    private static String getMatchedPredicate(String str) {
+
+        Matcher matcher = PREDICATE.matcher(str);
+        if (matcher.find()) {
+            return matcher.group(0);
+        }
+        return null;
+    }
+
+    /**
+     * Checks and return valid absolute schema node id.
+     *
+     * @param argumentString    string from yang file
+     * @param yangConstructType yang construct for creating error message
+     * @param ctx               yang construct's context to get the line number and character position
+     * @return target nodes list of absolute schema node id
+     */
+    public static List<YangAtomicPath> getValidAbsoluteSchemaNodeId(String argumentString,
+                                                                    YangConstructType yangConstructType,
+                                                                    ParserRuleContext ctx) {
+
+        List<YangAtomicPath> targetNodes = new ArrayList<>();
+        YangNodeIdentifier yangNodeIdentifier;
+        String tmpSchemaNodeId = removeQuotesAndHandleConcat(argumentString);
+
+        // absolute-schema-nodeid = 1*("/" node-identifier)
+        if (!tmpSchemaNodeId.startsWith(SLASH)) {
+            ParserException parserException = new ParserException("YANG file error : " +
+                                                                          getYangConstructType(yangConstructType) + " name " + argumentString +
+                                                                          "is not valid");
+            parserException.setLine(ctx.getStart().getLine());
+            parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
+            throw parserException;
+        }
+        String[] tmpData = tmpSchemaNodeId.replaceFirst(CARET + SLASH, EMPTY_STRING).split(SLASH);
+        for (String nodeIdentifiers : tmpData) {
+            yangNodeIdentifier = getValidNodeIdentifier(nodeIdentifiers, yangConstructType, ctx);
+            YangAtomicPath yangAbsPath = new YangAtomicPath();
+            yangAbsPath.setNodeIdentifier(yangNodeIdentifier);
+            targetNodes.add(yangAbsPath);
+        }
+        return targetNodes;
+    }
+
+    /**
+     * Throws parser exception for unsupported YANG constructs.
+     *
+     * @param type      construct type
+     * @param ctx       construct context
+     * @param errorInfo error msg
+     * @param fileName  YANG file name
+     */
+    public static void handleUnsupportedYangConstruct(YangConstructType type,
+                                                      ParserRuleContext ctx,
+                                                      String errorInfo,
+                                                      String fileName) {
+        ParserException parserException = new ParserException(
+                YANG_FILE_ERROR + QUOTES + getYangConstructType(
+                        type) + QUOTES + errorInfo);
+        parserException.setLine(ctx.getStart().getLine());
+        parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
+        //FIXME this exception should probably be thrown rather than just logged
+        //throw parserException;
+    }
+
+    /**
+     * Returns date and makes it in usable format for revision.
+     *
+     * @param dateInString date argument string from yang file
+     * @param ctx          yang construct's context to get the line number and character position
+     * @return date format for revision
+     */
+    public static Date getValidDateFromString(String dateInString, ParserRuleContext ctx) {
+        String dateArgument = removeQuotesAndHandleConcat(dateInString);
+        if (!dateArgument.matches(DATE_PATTERN)) {
+            ParserException parserException = new ParserException("YANG file error: Input date is not correct");
+            parserException.setLine(ctx.getStart().getLine());
+            parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
+            throw parserException;
+        }
+
+        SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT);
+        sdf.setLenient(false);
+
+        try {
+            //if not valid, it will throw ParseException
+            return sdf.parse(dateArgument);
+        } catch (ParseException e) {
+            ParserException parserException = new ParserException("YANG file error: Input date is not correct");
+            parserException.setLine(ctx.getStart().getLine());
+            parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
+            throw parserException;
+        }
+    }
+
+    /**
+     * Checks and return valid prefix.
+     *
+     * @param inputString   string from yang file
+     * @param yangConstruct yang construct for creating error message
+     * @param ctx           yang construct's context to get the line number and character position
+     * @return valid prefix
+     */
+    public static String getValidPrefix(String inputString,
+                                        YangConstructType yangConstruct, ParserRuleContext ctx) {
+        String tmpPrefixString = removeQuotesAndHandleConcat(inputString);
+        String[] tmpData = tmpPrefixString.split(Pattern.quote(COLON));
+        if (tmpData.length == 2) {
+            return tmpData[0];
+        } else {
+            ParserException parserException = new ParserException("YANG file error : " +
+                                                                          getYangConstructType(yangConstruct) + " name " + inputString +
+                                                                          " is not valid.");
+            parserException.setLine(ctx.getStart().getLine());
+            parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
+            throw parserException;
+        }
+    }
+
+    /**
+     * Validates path under leaf-ref and parses the path and stores in the
+     * leaf-ref.
+     *
+     * @param path    path of leaf-ref
+     * @param type    construct type
+     * @param ctx     construct details
+     * @param leafRef YANG leaf-ref having path
+     */
+    public static void validatePath(String path, YangConstructType type,
+                                    PathStatementContext ctx,
+                                    YangLeafRef leafRef) {
+
+        String concatPath = removeQuotesAndHandleConcat(path);
+        if (!concatPath.startsWith(SLASH_FOR_STRING) &&
+                !concatPath.startsWith(ANCESTOR)) {
+            throw getPathException(ctx, leafRef);
+        }
+        leafRef.setPath(concatPath);
+        if (concatPath.startsWith(SLASH_FOR_STRING)) {
+            List<YangAtomicPath> atomicList = new LinkedList<>();
+            valAbsPath(concatPath, atomicList, ctx, leafRef, type);
+            leafRef.setPathType(YangPathArgType.ABSOLUTE_PATH);
+            valPrefix(atomicList, leafRef);
+            leafRef.setAtomicPath(atomicList);
+            return;
+        }
+        leafRef.setPathType(YangPathArgType.RELATIVE_PATH);
+        valRelPath(concatPath, leafRef, ctx, type);
+    }
+
+    /**
+     * Validates relative path, parses the string and stores it in the leaf-ref.
+     *
+     * @param path     leaf-ref path
+     * @param leafRef  YANG leaf-ref data model information
+     * @param pathType yang construct for creating error message
+     */
+    private static void valRelPath(String path, YangLeafRef leafRef,
+                                   PathStatementContext pathCtx,
+                                   YangConstructType pathType) {
+
+        YangRelativePath relPath = new YangRelativePath();
+        int count = 0;
+        while (path.startsWith(SLASH_ANCESTOR)) {
+            path = path.replaceFirst(SLASH_ANCESTOR, EMPTY_STRING);
+            count = count + 1;
+        }
+        if (path.isEmpty()) {
+            throw getPathException(pathCtx, leafRef);
+        }
+
+        List<YangAtomicPath> atomicList = new ArrayList<>();
+        relPath.setAncestorNodeCount(count);
+        valAbsPath(SLASH_FOR_STRING + path, atomicList, pathCtx, leafRef,
+                   pathType);
+        valPrefix(atomicList, leafRef);
+        relPath.setAtomicPathList(atomicList);
+        leafRef.setRelativePath(relPath);
+    }
+
+    /**
+     * Validates absolute path, parses the string and stores it in leaf-ref.
+     *
+     * @param path        leaf-ref path
+     * @param atomics     atomic content list
+     * @param pathCtx     path statement context
+     * @param yangLeafRef YANG leaf ref
+     * @param pathType    yang construct for creating error message
+     */
+    private static void valAbsPath(String path, List<YangAtomicPath> atomics,
+                                   PathStatementContext pathCtx,
+                                   YangLeafRef yangLeafRef,
+                                   YangConstructType pathType) {
+
+        String comPath = path;
+        while (comPath != null) {
+            comPath = comPath.substring(1);
+            if (comPath.isEmpty()) {
+                throw getPathException(pathCtx, yangLeafRef);
+            }
+            int nodeId = comPath.indexOf(CHAR_OF_SLASH);
+            int predicate = comPath.indexOf(CHAR_OF_OPEN_SQUARE_BRACKET);
+            if (predicate < nodeId && predicate != -1) {
+                comPath = getPathWithPredicate(comPath, atomics,
+                                               pathCtx, yangLeafRef, pathType);
+            } else {
+                comPath = getPath(comPath, atomics, pathType, pathCtx);
+            }
+        }
+    }
+
+    /**
+     * Returns the remaining path after parsing and the predicates of an atomic
+     * content.
+     *
+     * @param path        leaf-ref path
+     * @param atomics     atomic content list
+     * @param pathCtx     yang construct's context to get the line number and
+     *                    character position
+     * @param yangLeafRef YANG leaf-ref data model information
+     * @param pathType    yang construct for creating error message
+     * @return parsed path after removing one atomic content.
+     */
+    private static String getPathWithPredicate(String path,
+                                               List<YangAtomicPath> atomics,
+                                               PathStatementContext pathCtx,
+                                               YangLeafRef yangLeafRef,
+                                               YangConstructType pathType) {
+
+        String[] node = new String[2];
+        int bracket = path.indexOf(CHAR_OF_OPEN_SQUARE_BRACKET);
+        node[0] = path.substring(0, bracket);
+        node[1] = path.substring(bracket);
+        return getParsedPath(node[0], node[1], atomics, pathCtx, yangLeafRef,
+                             pathType);
+    }
+
+    /**
+     * Returns the path after taking all the path predicates of an atomic
+     * content.
+     *
+     * @param nodeId      atomic content nodeId
+     * @param path        leaf-ref path
+     * @param atomics     atomic content list
+     * @param pathCtx     yang construct's context to get the line number
+     *                    and character position
+     * @param yangLeafRef YANG leaf-ref data model information
+     * @param pathType    yang construct for creating error message
+     * @return parsed path after removing one atomic content.
+     */
+    public static String getParsedPath(String nodeId, String path,
+                                       List<YangAtomicPath> atomics,
+                                       PathStatementContext pathCtx,
+                                       YangLeafRef yangLeafRef,
+                                       YangConstructType pathType) {
+
+        String comPath = path;
+        List<String> predicateList = new ArrayList<>();
+        while (comPath.startsWith(OPEN_SQUARE_BRACKET)) {
+            String matchedVal = getMatchedPredicate(comPath);
+            if (matchedVal == null || matchedVal.isEmpty()) {
+                throw getPathException(pathCtx, yangLeafRef);
+            }
+            predicateList.add(matchedVal);
+            comPath = comPath.substring(matchedVal.length());
+        }
+
+        YangAtomicPath atomicPath = new YangAtomicPath();
+        YangNodeIdentifier validId =
+                getValidNodeIdentifier(nodeId, pathType, pathCtx);
+
+        List<YangPathPredicate> predicates = valPathPredicates(predicateList,
+                                                               pathType,
+                                                               pathCtx, yangLeafRef);
+        atomicPath.setNodeIdentifier(validId);
+        atomicPath.setPathPredicatesList(predicates);
+        atomics.add(atomicPath);
+        return comPath;
+    }
+
+    /**
+     * Validates the path predicates of an atomic content after parsing the
+     * predicates and storing it in the leaf-ref.
+     *
+     * @param predicates  list of predicates
+     * @param pathType    yang construct for creating error message
+     * @param pathCtx     yang construct's context to get the line number
+     *                    and character position
+     * @param yangLeafRef YANG leaf-ref data model information
+     * @return list of path predicates of an atomic content
+     */
+    private static List<YangPathPredicate> valPathPredicates(List<String> predicates,
+                                                             YangConstructType pathType,
+                                                             PathStatementContext pathCtx,
+                                                             YangLeafRef yangLeafRef) {
+
+        List<YangPathPredicate> result = new ArrayList<>();
+        for (String p : predicates) {
+            p = p.substring(1, p.length() - 1);
+            result.add(valPathEqualityExp(p.trim(), pathType, pathCtx, yangLeafRef));
+        }
+        return result;
+    }
+
+    /**
+     * Validates the path equality expression of a path predicate and after
+     * parsing the string assigns it to the YANG path predicate.
+     *
+     * @param predicate   path predicate
+     * @param pathType    yang construct for creating error message
+     * @param pathCtx     yang construct's context to get the line number
+     *                    and character position
+     * @param yangLeafRef YANG leaf-ref data model information
+     * @return YANG path predicate
+     */
+    private static YangPathPredicate valPathEqualityExp(String predicate,
+                                                        YangConstructType pathType,
+                                                        PathStatementContext pathCtx,
+                                                        YangLeafRef yangLeafRef) {
+
+        String[] exp = predicate.split(REGEX_EQUAL);
+        YangNodeIdentifier nodeId =
+                getValidNodeIdentifier(exp[0].trim(), pathType, pathCtx);
+        YangRelativePath relPath = valPathKeyExp(exp[1].trim(), pathType,
+                                                 pathCtx, yangLeafRef);
+
+        YangPathPredicate pathPredicate = new YangPathPredicate();
+        pathPredicate.setNodeId(nodeId);
+        pathPredicate.setPathOp(EQUALTO);
+        pathPredicate.setRelPath(relPath);
+        return pathPredicate;
+    }
+
+    /**
+     * Validates the path key expression of the path-predicate and stores it
+     * in the relative path of the leaf-ref.
+     *
+     * @param relPath     relative path
+     * @param pathType    yang construct for creating error message
+     * @param pathCtx     yang construct's context to get the line number
+     *                    and character position
+     * @param yangLeafRef YANG leaf-ref data model information
+     * @return YANG relative path
+     */
+    private static YangRelativePath valPathKeyExp(String relPath,
+                                                  YangConstructType pathType,
+                                                  PathStatementContext pathCtx,
+                                                  YangLeafRef yangLeafRef) {
+
+        String[] relative = relPath.split(SLASH_FOR_STRING);
+        int count = 0;
+        List<String> atomicContent = new ArrayList<>();
+        for (String val : relative) {
+            if (val.trim().equals(ANCESTOR)) {
+                count = count + 1;
+            } else {
+                atomicContent.add(val);
+            }
+        }
+
+        YangRelativePath relativePath = new YangRelativePath();
+        relativePath.setAncestorNodeCount(count);
+        relativePath.setAtomicPathList(valRelPathKeyExp(atomicContent,
+                                                        pathType,
+                                                        pathCtx, yangLeafRef));
+        return relativePath;
+    }
+
+    /**
+     * Validates relative path key expression in the right relative path of
+     * the path predicate, by taking every atomic content in it.
+     *
+     * @param content     atomic content list
+     * @param pathType    yang construct for creating error message
+     * @param pathCtx     yang construct's context to get the line number
+     *                    and character position
+     * @param yangLeafRef YANG leaf-ref data model information
+     * @return YANG atomic content list
+     */
+    private static List<YangAtomicPath> valRelPathKeyExp(List<String> content,
+                                                         YangConstructType pathType,
+                                                         PathStatementContext pathCtx,
+                                                         YangLeafRef yangLeafRef) {
+
+        String current = content.get(0);
+        String[] curStr = (current.trim()).split(REGEX_OPEN_BRACE);
+        if (!(curStr[0].trim().equals(CURRENT)) ||
+                !(curStr[1].trim().equals(CLOSE_PARENTHESIS))) {
+            throw getPathException(pathCtx, yangLeafRef);
+        }
+
+        content.remove(0);
+        List<YangAtomicPath> atomicList = new ArrayList<>();
+        for (String relPath : content) {
+            YangNodeIdentifier nodeId =
+                    getValidNodeIdentifier(relPath, pathType, pathCtx);
+            YangAtomicPath atomicPath = new YangAtomicPath();
+            atomicPath.setNodeIdentifier(nodeId);
+            atomicList.add(atomicPath);
+        }
+        return atomicList;
+    }
+
+    /**
+     * Returns the remaining path after parsing and processing an atomic
+     * content which doesn't have path-predicate.
+     *
+     * @param path       leaf-ref path
+     * @param atomicList atomic content list
+     * @param pathType   yang construct for creating error message
+     * @param pathCtx    yang construct's context to get the line number
+     *                   and character position
+     * @return remaining path after parsing one atomic content
+     */
+    public static String getPath(String path, List<YangAtomicPath> atomicList,
+                                 YangConstructType pathType,
+                                 PathStatementContext pathCtx) {
+
+        String comPath = path;
+        String nodeId;
+        if (comPath.contains(SLASH_FOR_STRING)) {
+            nodeId = comPath.substring(0, comPath.indexOf(CHAR_OF_SLASH));
+            comPath = comPath.substring(comPath.indexOf(CHAR_OF_SLASH));
+        } else {
+            nodeId = comPath;
+            comPath = null;
+        }
+
+        YangNodeIdentifier validNodeId =
+                getValidNodeIdentifier(nodeId, pathType, pathCtx);
+        YangAtomicPath atomicPath = new YangAtomicPath();
+        atomicPath.setNodeIdentifier(validNodeId);
+        atomicList.add(atomicPath);
+        return comPath;
+    }
+
+    /**
+     * Returns the path syntax parser exception.
+     *
+     * @param pathCtx     yang construct's context to get the line number
+     *                    and character position
+     * @param yangLeafRef YANG leaf-ref data model information
+     * @return parser exception
+     */
+    private static ParserException getPathException(PathStatementContext pathCtx,
+                                                    YangLeafRef yangLeafRef) {
+        ParserException exception = new ParserException(
+                "YANG file error : Path " + yangLeafRef.getPath() +
+                        " does not follow valid path syntax");
+        exception.setLine(pathCtx.getStart().getLine());
+        exception.setCharPosition(pathCtx.getStart().getCharPositionInLine());
+        return exception;
+    }
+
+    /**
+     * Returns the augment name, after removing the prefix, in each atomic
+     * content, which is equal to the root prefix.
+     *
+     * @param atomics atomic content list
+     * @param root    root node
+     * @return prefix removed augment name
+     */
+    public static String getPrefixRemovedName(List<YangAtomicPath> atomics,
+                                              YangNode root) {
+
+        String rootPrefix = getRootPrefix(root);
+        StringBuilder builder = new StringBuilder();
+        for (YangAtomicPath atomic : atomics) {
+            String id;
+            String prefix = atomic.getNodeIdentifier().getPrefix();
+            String name = atomic.getNodeIdentifier().getName();
+            if (rootPrefix.equals(prefix) || prefix == null) {
+                id = SLASH_FOR_STRING + name;
+            } else {
+                id = SLASH_FOR_STRING + prefix + COLON + name;
+            }
+            builder.append(id);
+        }
+        return builder.toString();
+    }
+}
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/parserutils/ListenerValidation.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/parserutils/ListenerValidation.java
new file mode 100644
index 0000000..eeb1dc9
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/parserutils/ListenerValidation.java
@@ -0,0 +1,243 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.parserutils;
+
+import org.antlr.v4.runtime.ParserRuleContext;
+import org.onosproject.yang.compiler.datamodel.YangCase;
+import org.onosproject.yang.compiler.datamodel.YangChoice;
+import org.onosproject.yang.compiler.datamodel.YangConfig;
+import org.onosproject.yang.compiler.datamodel.YangInput;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangNotification;
+import org.onosproject.yang.compiler.datamodel.YangOutput;
+import org.onosproject.yang.compiler.datamodel.YangRpc;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.datamodel.utils.YangConstructType;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.TreeWalkListener;
+
+import java.util.Iterator;
+import java.util.List;
+
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.getYangConstructType;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
+
+/**
+ * Represents a utility to carry out listener validation.
+ */
+public final class ListenerValidation {
+
+    /**
+     * Creates a new listener validation.
+     */
+    private ListenerValidation() {
+    }
+
+    /**
+     * Checks parsed data stack is not empty.
+     *
+     * @param listener Listener's object
+     * @param errorType error type needs to be set in error message
+     * @param yangConstructType type of parsable data in which error occurred
+     * @param parsableDataTypeName name of parsable data type in which error
+     *            occurred
+     * @param errorLocation location where error occurred
+     */
+    public static void checkStackIsNotEmpty(TreeWalkListener listener, ListenerErrorType errorType,
+                                            YangConstructType yangConstructType, String parsableDataTypeName,
+                                            ListenerErrorLocation errorLocation) {
+
+        if (listener.getParsedDataStack().empty()) {
+            /*
+             * If stack is empty it indicates error condition, value of
+             * parsableDataTypeName will be null in case there is no name
+             * attached to parsable data type.
+             */
+            String message = constructListenerErrorMessage(errorType, yangConstructType, parsableDataTypeName,
+                    errorLocation);
+            throw new ParserException(message);
+        }
+    }
+
+    /**
+     * Checks parsed data stack is empty.
+     *
+     * @param listener Listener's object
+     * @param errorType error type needs to be set in error message
+     * @param yangConstructType type of parsable data in which error occurred
+     * @param parsableDataTypeName name of parsable data type in which error
+     *            occurred
+     * @param errorLocation location where error occurred
+     */
+    public static void checkStackIsEmpty(TreeWalkListener listener, ListenerErrorType errorType,
+            YangConstructType yangConstructType, String parsableDataTypeName,
+            ListenerErrorLocation errorLocation) {
+
+        if (!listener.getParsedDataStack().empty()) {
+            /*
+             * If stack is empty it indicates error condition, value of
+             * parsableDataTypeName will be null in case there is no name
+             * attached to parsable data type.
+             */
+            String message = constructListenerErrorMessage(errorType, yangConstructType, parsableDataTypeName,
+                    errorLocation);
+            throw new ParserException(message);
+        }
+    }
+
+    /**
+     * Returns parent node config value, if top node does not specify a config
+     * statement then default value true is returned.
+     *
+     * @param listener listener's object
+     * @return true/false parent's config value
+     */
+    public static boolean getParentNodeConfig(TreeWalkListener listener) {
+        Parsable curData = listener.getParsedDataStack().peek();
+        YangNode parentNode = ((YangNode) curData).getParent();
+        if (curData instanceof YangConfig) {
+            return ((YangConfig) curData).isConfig();
+        } else if (curData instanceof YangRpc || curData instanceof YangOutput
+                || curData instanceof YangInput || curData instanceof YangNotification) {
+            return false;
+        } else if (curData instanceof YangCase && parentNode instanceof YangChoice) {
+            return ((YangChoice) parentNode).isConfig();
+        } else {
+            return true;
+        }
+    }
+
+    /**
+     * Checks if a rule occurrences is as per the expected YANG grammar's
+     * cardinality.
+     *
+     * @param childContext child's context
+     * @param yangChildConstruct child construct for whom cardinality is to be
+     *            validated
+     * @param yangParentConstruct parent construct
+     * @param parentName parent name
+     * @throws ParserException exception if cardinality check fails
+     */
+    public static void validateCardinalityMaxOne(List<?> childContext, YangConstructType yangChildConstruct,
+            YangConstructType yangParentConstruct, String parentName)
+            throws ParserException {
+
+        if (!childContext.isEmpty() && childContext.size() != 1) {
+            ParserException parserException = new ParserException("YANG file error: \""
+                    + getYangConstructType(yangChildConstruct) + "\" is defined more than once in \""
+                    + getYangConstructType(yangParentConstruct) + " " + parentName + "\".");
+
+            Iterator<?> context = childContext.iterator();
+            parserException.setLine(((ParserRuleContext) context.next()).getStart().getLine());
+            parserException.setCharPosition(((ParserRuleContext) context.next()).getStart().getCharPositionInLine());
+            throw parserException;
+        }
+    }
+
+    /**
+     * Checks if a rule occurrences is exactly 1.
+     *
+     * @param childContext child's context
+     * @param yangChildConstruct child construct for whom cardinality is to be
+     *                           validated
+     * @param yangParentConstruct parent construct
+     * @param parentName parent name
+     * @param parentContext parents's context
+     * @throws ParserException exception if cardinality check fails
+     */
+    public static void validateCardinalityEqualsOne(List<?> childContext, YangConstructType yangChildConstruct,
+            YangConstructType yangParentConstruct, String parentName,
+            ParserRuleContext parentContext)
+            throws ParserException {
+
+        if (childContext.isEmpty()) {
+            ParserException parserException = new ParserException("YANG file error: Missing \""
+                    + getYangConstructType(yangChildConstruct) + "\" in \"" + getYangConstructType(yangParentConstruct)
+                    + " " + parentName + "\".");
+            parserException.setLine(parentContext.getStart().getLine());
+            parserException.setCharPosition(parentContext.getStart().getCharPositionInLine());
+            throw parserException;
+        } else if (!childContext.isEmpty() && childContext.size() != 1) {
+            Iterator<?> childcontext = childContext.iterator();
+            ParserException parserException = new ParserException("YANG file error: \""
+                    + getYangConstructType(yangChildConstruct) + "\" is present more than once in \""
+                    + getYangConstructType(yangParentConstruct) + " " + parentName + "\".");
+            parserException.setLine(((ParserRuleContext) childcontext.next()).getStart().getLine());
+            parserException.setCharPosition(((ParserRuleContext) childcontext.next()).getStart()
+                    .getCharPositionInLine());
+            throw parserException;
+        }
+    }
+
+    /**
+     * Checks if a rule occurrences is minimum 1.
+     *
+     * @param childContext child's context
+     * @param yangChildConstruct child construct for whom cardinality is to be
+     *                           validated
+     * @param yangParentConstruct parent construct
+     * @param parentName parent name
+     * @param parentContext parents's context
+     * @throws ParserException exception if cardinality check fails
+     */
+    public static void validateCardinalityNonZero(List<?> childContext, YangConstructType yangChildConstruct,
+            YangConstructType yangParentConstruct, String parentName,
+            ParserRuleContext parentContext)
+            throws ParserException {
+
+        if (childContext.isEmpty()) {
+            ParserException parserException = new ParserException("YANG file error: Missing \""
+                    + getYangConstructType(yangChildConstruct) + "\" in \"" + getYangConstructType(yangParentConstruct)
+                    + " " + parentName + "\".");
+
+            parserException.setLine(parentContext.getStart().getLine());
+            parserException.setCharPosition(parentContext.getStart().getCharPositionInLine());
+            throw parserException;
+        }
+    }
+
+    /**
+     * Checks if a either of one construct occurrence.
+     *
+     * @param child1Context       first optional child's context
+     * @param yangChild1Construct first child construct for whom cardinality is
+     *                            to be validated
+     * @param child2Context       second optional child's context
+     * @param yangChild2Construct second child construct for whom cardinality is
+     *                            to be validated
+     * @param yangParentConstruct parent construct
+     * @param parentName          parent name
+     * @param parentContext       parents's context
+     * @throws ParserException exception if cardinality check fails
+     */
+    public static void validateCardinalityEitherOne(List<?> child1Context, YangConstructType yangChild1Construct,
+                                                    List<?> child2Context, YangConstructType yangChild2Construct,
+                                                    YangConstructType yangParentConstruct, String parentName,
+                                                    ParserRuleContext parentContext)
+            throws ParserException {
+
+        if (child1Context.isEmpty() && child2Context.isEmpty()) {
+            ParserException parserException = new ParserException("YANG file error: Either \""
+                    + getYangConstructType(yangChild1Construct) + "\" or \"" + getYangConstructType(yangChild2Construct)
+                    + "\" should be present in \"" + getYangConstructType(yangParentConstruct) + " "
+                    + parentName + "\".");
+            parserException.setLine(parentContext.getStart().getLine());
+            parserException.setCharPosition(parentContext.getStart().getCharPositionInLine());
+            throw parserException;
+        }
+    }
+}
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/parserutils/ParseTreeErrorListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/parserutils/ParseTreeErrorListener.java
new file mode 100644
index 0000000..e839e2c
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/parserutils/ParseTreeErrorListener.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.parserutils;
+
+import org.antlr.v4.runtime.BaseErrorListener;
+import org.antlr.v4.runtime.RecognitionException;
+import org.antlr.v4.runtime.Recognizer;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+
+/**
+ * Represent the parse tree error listener.
+ * By default, ANTLR sends all errors to standard error, this is changed by
+ * providing this new implementation of interface ANTLRErrorListener. The
+ * interface has a syntaxError() method that applies to both lexer and parser.
+ */
+public class ParseTreeErrorListener extends BaseErrorListener {
+
+    @Override
+    public void syntaxError(Recognizer<?, ?> recognizer, Object offendingSymbol, int line, int charPositionInLine,
+            String msg, RecognitionException e) {
+
+        ParserException parserException = new ParserException(msg);
+        parserException.setLine(line);
+        parserException.setCharPosition(charPositionInLine);
+        throw parserException;
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/parserutils/package-info.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/parserutils/package-info.java
new file mode 100644
index 0000000..5662cff
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/parserutils/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.
+ */
+
+/**
+ * Provide common utils for parser implementation.
+ */
+package org.onosproject.yang.compiler.parser.impl.parserutils;
\ No newline at end of file
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/package-info.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/package-info.java
new file mode 100644
index 0000000..ac4cd7d
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/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.
+ */
+
+/**
+ * Interfaces to process YANG information from ANTLR generated listeners.
+ */
+package org.onosproject.yang.compiler.parser;
diff --git a/compiler/base/parser/src/main/resources/GeneratedYang.g4 b/compiler/base/parser/src/main/resources/GeneratedYang.g4
new file mode 100644
index 0000000..3ba1201
--- /dev/null
+++ b/compiler/base/parser/src/main/resources/GeneratedYang.g4
@@ -0,0 +1,1347 @@
+/*
+ * 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.
+ */
+
+/**
+ * This is a YANG grammar for parser based on which ANTLR will generate YANG parser.
+ */
+
+grammar GeneratedYang;
+import YangLexer;
+
+@header {
+package org.onosproject.yang.compiler.parser.antlrgencode;
+}
+
+    yangfile : moduleStatement EOF
+             | subModuleStatement EOF;
+
+    /**
+     * module-stmt         = optsep module-keyword sep identifier-arg-str
+     *                       optsep
+     *                       "{" stmtsep
+     *                           module-header-stmts
+     *                           linkage-stmts
+     *                           meta-stmts
+     *                           revision-stmts
+     *                           body-stmts
+     *                       "}" optsep
+     */
+
+    moduleStatement : MODULE_KEYWORD identifier LEFT_CURLY_BRACE moduleBody RIGHT_CURLY_BRACE;
+
+    moduleBody : moduleHeaderStatement linkageStatements metaStatements revisionStatements bodyStatements;
+
+    /**
+     * module-header-stmts = ;; these stmts can appear in any order
+     *                       [yang-version-stmt stmtsep]
+     *                        namespace-stmt stmtsep
+     *                        prefix-stmt stmtsep
+     */
+
+    moduleHeaderStatement : yangVersionStatement? namespaceStatement prefixStatement
+                            | yangVersionStatement? prefixStatement namespaceStatement
+                            | namespaceStatement yangVersionStatement? prefixStatement
+                            | namespaceStatement prefixStatement yangVersionStatement?
+                            | prefixStatement namespaceStatement yangVersionStatement?
+                            | prefixStatement yangVersionStatement? namespaceStatement
+                            ;
+
+    /**
+     * linkage-stmts       = ;; these stmts can appear in any order
+     *                       *(import-stmt stmtsep)
+     *                       *(include-stmt stmtsep)
+     */
+    linkageStatements : (importStatement
+                  | includeStatement)*;
+
+    /**
+     * meta-stmts          = ;; these stmts can appear in any order
+     *                       [organization-stmt stmtsep]
+     *                       [contact-stmt stmtsep]
+     *                       [description-stmt stmtsep]
+     *                       [reference-stmt stmtsep]
+     */
+    metaStatements : organizationStatement? contactStatement? descriptionStatement? referenceStatement?
+               | organizationStatement? contactStatement? referenceStatement? descriptionStatement?
+               | organizationStatement? descriptionStatement? contactStatement? referenceStatement?
+               | organizationStatement? descriptionStatement? referenceStatement? contactStatement?
+               | organizationStatement? referenceStatement? contactStatement? descriptionStatement?
+               | organizationStatement? referenceStatement? descriptionStatement? contactStatement?
+               | contactStatement? organizationStatement? descriptionStatement? referenceStatement?
+               | contactStatement? organizationStatement? referenceStatement? descriptionStatement?
+               | contactStatement? referenceStatement? organizationStatement? descriptionStatement?
+               | contactStatement? referenceStatement? descriptionStatement? organizationStatement?
+               | contactStatement? descriptionStatement? referenceStatement? organizationStatement?
+               | contactStatement? descriptionStatement? organizationStatement? referenceStatement?
+               | referenceStatement? contactStatement? organizationStatement? descriptionStatement?
+               | referenceStatement? contactStatement? descriptionStatement? organizationStatement?
+               | referenceStatement? organizationStatement? contactStatement? descriptionStatement?
+               | referenceStatement? organizationStatement? descriptionStatement? contactStatement?
+               | referenceStatement? descriptionStatement? organizationStatement? contactStatement?
+               | referenceStatement? descriptionStatement? contactStatement? organizationStatement?
+               | descriptionStatement? referenceStatement? contactStatement? organizationStatement?
+               | descriptionStatement? referenceStatement? organizationStatement? contactStatement?
+               | descriptionStatement? contactStatement? referenceStatement? organizationStatement?
+               | descriptionStatement? contactStatement? organizationStatement? referenceStatement?
+               | descriptionStatement? organizationStatement? contactStatement? referenceStatement?
+               | descriptionStatement? organizationStatement? referenceStatement? contactStatement?
+               ;
+
+    // revision-stmts      = *(revision-stmt stmtsep)
+    revisionStatements : revisionStatement*;
+
+    /**
+     * body-stmts          = *((extension-stmt /
+     *                          feature-stmt /
+     *                          identity-stmt /
+     *                          typedef-stmt /
+     *                          grouping-stmt /
+     *                          data-def-stmt /
+     *                          augment-stmt /
+     *                          rpc-stmt /
+     *                          notification-stmt /
+     *                          deviation-stmt) stmtsep)
+     */
+    bodyStatements : (extensionStatement
+               | featureStatement
+               | identityStatement
+               | typedefStatement
+               | groupingStatement
+               | dataDefStatement
+               | augmentStatement
+               | rpcStatement
+               | notificationStatement
+               | deviationStatement
+               | compilerAnnotationStatement)*
+               ;
+
+    /**
+     * yang-version-stmt   = yang-version-keyword sep yang-version-arg-str
+     *                       optsep stmtend
+     */
+    yangVersionStatement :   YANG_VERSION_KEYWORD version STMTEND;
+
+
+    /**
+     * namespace-stmt      = namespace-keyword sep uri-str optsep stmtend
+     * For namespace validation TODO in Listener
+     */
+    namespaceStatement : NAMESPACE_KEYWORD string STMTEND;
+
+    /**
+     * prefix-stmt         = prefix-keyword sep prefix-arg-str
+     *                       optsep stmtend
+     */
+    prefixStatement : PREFIX_KEYWORD identifier STMTEND;
+
+    /**
+     * import-stmt         = import-keyword sep identifier-arg-str optsep
+     *                       "{" stmtsep
+     *                           prefix-stmt stmtsep
+     *                           [revision-date-stmt stmtsep]
+     *                        "}"
+     */
+    importStatement : IMPORT_KEYWORD identifier LEFT_CURLY_BRACE importStatementBody RIGHT_CURLY_BRACE;
+
+    importStatementBody : prefixStatement revisionDateStatement?;
+
+    // revision-date-stmt = revision-date-keyword sep revision-date stmtend
+    revisionDateStatement : REVISION_DATE_KEYWORD dateArgumentString STMTEND;
+
+    /**
+     * include-stmt        = include-keyword sep identifier-arg-str optsep
+     *                             (";" /
+     *                              "{" stmtsep
+     *                                  [revision-date-stmt stmtsep]
+     *                            "}")
+     */
+    includeStatement : INCLUDE_KEYWORD identifier (STMTEND | LEFT_CURLY_BRACE revisionDateStatement? RIGHT_CURLY_BRACE);
+
+    /**
+     * organization-stmt   = organization-keyword sep string
+     *                            optsep stmtend
+     */
+    organizationStatement : ORGANIZATION_KEYWORD string STMTEND;
+
+    // contact-stmt        = contact-keyword sep string optsep stmtend
+    contactStatement : CONTACT_KEYWORD string STMTEND;
+
+    // description-stmt    = description-keyword sep string optsep stmtend
+    descriptionStatement : DESCRIPTION_KEYWORD string STMTEND;
+
+    // reference-stmt      = reference-keyword sep string optsep stmtend
+    referenceStatement : REFERENCE_KEYWORD string STMTEND;
+
+    /**
+     * revision-stmt       = revision-keyword sep revision-date optsep
+     *                             (";" /
+     *                              "{" stmtsep
+     *                                  [description-stmt stmtsep]
+     *                                  [reference-stmt stmtsep]
+     *                              "}")
+     */
+    revisionStatement : REVISION_KEYWORD dateArgumentString (STMTEND | LEFT_CURLY_BRACE revisionStatementBody RIGHT_CURLY_BRACE);
+    revisionStatementBody : descriptionStatement? referenceStatement?;
+
+    /**
+     * submodule-stmt      = optsep submodule-keyword sep identifier-arg-str
+     *                             optsep
+     *                             "{" stmtsep
+     *                                 submodule-header-stmts
+     *                                 linkage-stmts
+     *                                 meta-stmts
+     *                                 revision-stmts
+     *                                 body-stmts
+     *                             "}" optsep
+     */
+    subModuleStatement : SUBMODULE_KEYWORD identifier LEFT_CURLY_BRACE submoduleBody RIGHT_CURLY_BRACE;
+    submoduleBody : submoduleHeaderStatement linkageStatements metaStatements revisionStatements bodyStatements;
+
+    /** submodule-header-stmts =
+     *                            ;; these stmts can appear in any order
+     *                            [yang-version-stmt stmtsep]
+     *                             belongs-to-stmt stmtsep
+     */
+    submoduleHeaderStatement : yangVersionStatement? belongstoStatement
+                               | belongstoStatement yangVersionStatement?
+                              ;
+
+    /**
+     * belongs-to-stmt     = belongs-to-keyword sep identifier-arg-str
+     *                       optsep
+     *                       "{" stmtsep
+     *                           prefix-stmt stmtsep
+     *                       "}"
+     */
+    belongstoStatement : BELONGS_TO_KEYWORD identifier LEFT_CURLY_BRACE belongstoStatementBody RIGHT_CURLY_BRACE;
+    belongstoStatementBody : prefixStatement;
+
+    /**
+     * extension-stmt      = extension-keyword sep identifier-arg-str optsep
+     *                       (";" /
+     *                        "{" stmtsep
+     *                            ;; these stmts can appear in any order
+     *                            [argument-stmt stmtsep]
+     *                            [status-stmt stmtsep]
+     *                            [description-stmt stmtsep]
+     *                            [reference-stmt stmtsep]
+     *                        "}")
+     */
+    extensionStatement : EXTENSION_KEYWORD identifier (STMTEND | LEFT_CURLY_BRACE extensionBody RIGHT_CURLY_BRACE);
+    extensionBody : argumentStatement? statusStatement? descriptionStatement? referenceStatement?
+                   | argumentStatement? statusStatement? referenceStatement? descriptionStatement?
+                   | argumentStatement? descriptionStatement? statusStatement? referenceStatement?
+                   | argumentStatement? descriptionStatement? referenceStatement? statusStatement?
+                   | argumentStatement? referenceStatement? descriptionStatement? statusStatement?
+                   | argumentStatement? referenceStatement? statusStatement? descriptionStatement?
+                   | statusStatement? referenceStatement? argumentStatement? descriptionStatement?
+                   | statusStatement? referenceStatement? descriptionStatement? argumentStatement?
+                   | statusStatement? descriptionStatement? referenceStatement? argumentStatement?
+                   | statusStatement? descriptionStatement? argumentStatement? referenceStatement?
+                   | statusStatement? argumentStatement? referenceStatement? descriptionStatement?
+                   | statusStatement? argumentStatement? descriptionStatement? referenceStatement?
+                   | descriptionStatement? argumentStatement? statusStatement? referenceStatement?
+                   | descriptionStatement? argumentStatement? referenceStatement? statusStatement?
+                   | descriptionStatement? statusStatement? argumentStatement? referenceStatement?
+                   | descriptionStatement? statusStatement? referenceStatement? argumentStatement?
+                   | descriptionStatement? referenceStatement? statusStatement? argumentStatement?
+                   | descriptionStatement? referenceStatement? argumentStatement? statusStatement?
+                   | referenceStatement? descriptionStatement? argumentStatement? statusStatement?
+                   | referenceStatement? descriptionStatement? statusStatement? argumentStatement?
+                   | referenceStatement? statusStatement? argumentStatement? descriptionStatement?
+                   | referenceStatement? statusStatement? descriptionStatement? argumentStatement?
+                   | referenceStatement? argumentStatement? descriptionStatement? statusStatement?
+                   | referenceStatement? argumentStatement? statusStatement? descriptionStatement?
+                   ;
+
+    /**
+     * argument-stmt       = argument-keyword sep identifier-arg-str optsep
+     *                       (";" /
+     *                        "{" stmtsep
+     *                            [yin-element-stmt stmtsep]
+     *                        "}")
+     */
+    argumentStatement : ARGUMENT_KEYWORD identifier (STMTEND | LEFT_CURLY_BRACE argumentBody RIGHT_CURLY_BRACE);
+    argumentBody : yinElementStatement?;
+
+    /**
+     * yin-element-stmt    = yin-element-keyword sep yin-element-arg-str
+     *                       stmtend
+     */
+    yinElementStatement : YIN_ELEMENT_KEYWORD (TRUE_KEYWORD | FALSE_KEYWORD) STMTEND;
+
+    /**
+     * identity-stmt       = identity-keyword sep identifier-arg-str optsep
+     *                       (";" /
+     *                        "{" stmtsep
+     *                            ;; these stmts can appear in any order
+     *                            [base-stmt stmtsep]
+     *                            [status-stmt stmtsep]
+     *                            [description-stmt stmtsep]
+     *                            [reference-stmt stmtsep]
+     *                        "}")
+     */
+    identityStatement : IDENTITY_KEYWORD identifier (STMTEND | LEFT_CURLY_BRACE identityBody RIGHT_CURLY_BRACE);
+    identityBody : baseStatement? statusStatement? descriptionStatement? referenceStatement?
+                  | baseStatement? statusStatement? referenceStatement? descriptionStatement?
+                  | baseStatement? descriptionStatement? statusStatement? referenceStatement?
+                  | baseStatement? descriptionStatement? referenceStatement? statusStatement?
+                  | baseStatement? referenceStatement? descriptionStatement? statusStatement?
+                  | baseStatement? referenceStatement? statusStatement? descriptionStatement?
+                  | referenceStatement? baseStatement? statusStatement? descriptionStatement?
+                  | referenceStatement? baseStatement? descriptionStatement? statusStatement?
+                  | referenceStatement? statusStatement? baseStatement? descriptionStatement?
+                  | referenceStatement? statusStatement? descriptionStatement? baseStatement?
+                  | referenceStatement? descriptionStatement? statusStatement? baseStatement?
+                  | referenceStatement? descriptionStatement? baseStatement? statusStatement?
+                  | descriptionStatement? referenceStatement? statusStatement? baseStatement?
+                  | descriptionStatement? referenceStatement? statusStatement? baseStatement?
+                  | descriptionStatement? referenceStatement? baseStatement? statusStatement?
+                  | descriptionStatement? statusStatement? baseStatement? referenceStatement?
+                  | descriptionStatement? statusStatement? referenceStatement? baseStatement?
+                  | descriptionStatement? baseStatement? referenceStatement? statusStatement?
+                  | descriptionStatement? baseStatement? statusStatement? referenceStatement?
+                  | statusStatement? baseStatement? descriptionStatement? referenceStatement?
+                  | statusStatement? baseStatement? referenceStatement? descriptionStatement?
+                  | statusStatement? descriptionStatement? baseStatement? referenceStatement?
+                  | statusStatement? descriptionStatement? referenceStatement? baseStatement?
+                  | statusStatement? referenceStatement? descriptionStatement? baseStatement?
+                  | statusStatement? referenceStatement? baseStatement? descriptionStatement?
+                  ;
+
+    /**
+     * base-stmt           = base-keyword sep identifier-ref-arg-str
+     *                          optsep stmtend*
+     * identifier-ref-arg  = [prefix ":"] identifier
+     */
+    baseStatement : BASE_KEYWORD string STMTEND;
+
+    /**
+     *  feature-stmt        = feature-keyword sep identifier-arg-str optsep
+     *                        (";" /
+     *                         "{" stmtsep
+     *                             ;; these stmts can appear in any order
+     *                             *(if-feature-stmt stmtsep)
+     *                             [status-stmt stmtsep]
+     *                             [description-stmt stmtsep]
+     *                             [reference-stmt stmtsep]
+     *                         "}")
+     */
+    featureStatement : FEATURE_KEYWORD string (STMTEND | LEFT_CURLY_BRACE featureBody RIGHT_CURLY_BRACE);
+    featureBody : ifFeatureStatement* statusStatement? descriptionStatement? referenceStatement?
+                 | ifFeatureStatement* statusStatement? referenceStatement? descriptionStatement?
+                 | ifFeatureStatement* descriptionStatement? statusStatement? referenceStatement?
+                 | ifFeatureStatement* descriptionStatement? referenceStatement? statusStatement?
+                 | ifFeatureStatement* referenceStatement? statusStatement? descriptionStatement?
+                 | ifFeatureStatement* referenceStatement? descriptionStatement? statusStatement?
+                 | statusStatement? ifFeatureStatement* descriptionStatement? referenceStatement?
+                 | statusStatement? ifFeatureStatement* referenceStatement? descriptionStatement?
+                 | statusStatement? descriptionStatement? ifFeatureStatement* referenceStatement?
+                 | statusStatement? descriptionStatement? referenceStatement? ifFeatureStatement*
+                 | statusStatement? referenceStatement? ifFeatureStatement* descriptionStatement?
+                 | statusStatement? referenceStatement? descriptionStatement? ifFeatureStatement*
+                 | descriptionStatement? ifFeatureStatement* statusStatement? referenceStatement?
+                 | descriptionStatement? ifFeatureStatement* referenceStatement? statusStatement?
+                 | descriptionStatement? statusStatement? ifFeatureStatement* referenceStatement?
+                 | descriptionStatement? statusStatement? referenceStatement? ifFeatureStatement*
+                 | descriptionStatement? referenceStatement* statusStatement? ifFeatureStatement*
+                 | descriptionStatement? referenceStatement* ifFeatureStatement? statusStatement?
+                 | referenceStatement? ifFeatureStatement* statusStatement? descriptionStatement?
+                 | referenceStatement? ifFeatureStatement* descriptionStatement? statusStatement?
+                 | referenceStatement? descriptionStatement? statusStatement? ifFeatureStatement*
+                 | referenceStatement? descriptionStatement? ifFeatureStatement* statusStatement?
+                 | referenceStatement? statusStatement? descriptionStatement? ifFeatureStatement*
+                 | referenceStatement? statusStatement? ifFeatureStatement* descriptionStatement?
+                 ;
+
+    /**
+     *  data-def-stmt       = container-stmt /
+     *                       leaf-stmt /
+     *                       leaf-list-stmt /
+     *                       list-stmt /
+     *                       choice-stmt /
+     *                       anyxml-stmt /
+     *                       uses-stmt
+     */
+    dataDefStatement : containerStatement
+                    | leafStatement
+                    | leafListStatement
+                    | listStatement
+                    | choiceStatement
+                    | anyxmlStatement
+                    | usesStatement;
+
+    /**
+     *  if-feature-stmt     = if-feature-keyword sep identifier-ref-arg-str
+     *                        optsep stmtend
+     */
+    ifFeatureStatement : IF_FEATURE_KEYWORD string STMTEND;
+
+    /**
+    *    units-stmt          = units-keyword sep string optsep stmtend
+    */
+    unitsStatement : UNITS_KEYWORD string STMTEND;
+
+    /**
+     *   typedef-stmt        = typedef-keyword sep identifier-arg-str optsep
+     *                         "{" stmtsep
+     *                             ;; these stmts can appear in any order
+     *                             type-stmt stmtsep
+     *                            [units-stmt stmtsep]
+     *                             [default-stmt stmtsep]
+     *                             [status-stmt stmtsep]
+     *                             [description-stmt stmtsep]
+     *                             [reference-stmt stmtsep]
+     *                           "}"
+     * TODO : 0..1 occurance to be validated in listener
+     */
+    typedefStatement : TYPEDEF_KEYWORD identifier LEFT_CURLY_BRACE
+                   (typeStatement | unitsStatement | defaultStatement | statusStatement | descriptionStatement | referenceStatement)*
+                   RIGHT_CURLY_BRACE;
+
+    /**
+     *  type-stmt           = type-keyword sep identifier-ref-arg-str optsep
+     *                        (";" /
+     *                         "{" stmtsep
+     *                            type-body-stmts
+     *                         "}")
+     */
+    typeStatement : TYPE_KEYWORD string (STMTEND | LEFT_CURLY_BRACE typeBodyStatements RIGHT_CURLY_BRACE);
+
+    /**
+     *  type-body-stmts     = numerical-restrictions /
+     *                        decimal64-specification /
+     *                       string-restrictions /
+     *                        enum-specification /
+     *                        leafref-specification /
+     *                        identityref-specification /
+     *                        instance-identifier-specification /
+     *                        bits-specification /
+     *                        union-specification
+     *
+     */
+    typeBodyStatements : numericalRestrictions | decimal64Specification | stringRestrictions | enumSpecification
+                    | leafrefSpecification | identityrefSpecification | instanceIdentifierSpecification
+                    | bitsSpecification | unionSpecification;
+
+    /**
+     *    decimal64-specification = ;; these stmts can appear in any order
+     *                               fraction-digits-stmt
+     *                               [range-stmt]
+     */
+     decimal64Specification : fractionDigitStatement rangeStatement?;
+
+    /**
+     *  fraction-digits-stmt = fraction-digits-keyword sep
+     *                         fraction-digits-arg-str stmtend
+     *
+     *  fraction-digits-arg-str = < a string that matches the rule
+     *                             fraction-digits-arg >
+     *
+     *  fraction-digits-arg = ("1" ["0" / "1" / "2" / "3" / "4" /
+     *                              "5" / "6" / "7" / "8"])
+     *                        / "2" / "3" / "4" / "5" / "6" / "7" / "8" / "9"
+     */
+    fractionDigitStatement : FRACTION_DIGITS_KEYWORD fraction STMTEND;
+
+    /**
+     *  numerical-restrictions = range-stmt stmtsep
+     */
+    numericalRestrictions : rangeStatement;
+
+    /**
+     *  range-stmt          = range-keyword sep range-arg-str optsep
+     *                        (";" /
+     *                         "{" stmtsep
+     *                             ;; these stmts can appear in any order
+     *                             [error-message-stmt stmtsep]
+     *                             [error-app-tag-stmt stmtsep]
+     *                             [description-stmt stmtsep]
+     *                             [reference-stmt stmtsep]
+     *                          "}")
+     */
+    rangeStatement : RANGE_KEYWORD range (STMTEND | LEFT_CURLY_BRACE commonStatements RIGHT_CURLY_BRACE);
+
+    commonStatements : errorMessageStatement? errorAppTagStatement? descriptionStatement? referenceStatement?
+                 | errorMessageStatement? errorAppTagStatement? referenceStatement? descriptionStatement?
+                 | errorMessageStatement? descriptionStatement? errorAppTagStatement? referenceStatement?
+                 | errorMessageStatement? descriptionStatement? referenceStatement? errorAppTagStatement?
+                 | errorMessageStatement? referenceStatement? errorAppTagStatement? descriptionStatement?
+                 | errorMessageStatement? referenceStatement? descriptionStatement? errorAppTagStatement?
+                 | errorAppTagStatement? errorMessageStatement? descriptionStatement? referenceStatement?
+                 | errorAppTagStatement? errorMessageStatement? referenceStatement? descriptionStatement?
+                 | errorAppTagStatement? descriptionStatement? descriptionStatement? errorMessageStatement?
+                 | errorAppTagStatement? descriptionStatement? errorMessageStatement? descriptionStatement?
+                 | errorAppTagStatement? referenceStatement? errorMessageStatement? descriptionStatement?
+                 | errorAppTagStatement? referenceStatement? descriptionStatement? errorMessageStatement?
+                 | descriptionStatement? errorMessageStatement? errorAppTagStatement? referenceStatement?
+                 | descriptionStatement? errorMessageStatement? referenceStatement? errorAppTagStatement?
+                 | descriptionStatement? errorAppTagStatement? errorMessageStatement? referenceStatement?
+                 | descriptionStatement? errorAppTagStatement? referenceStatement? errorMessageStatement?
+                 | descriptionStatement? referenceStatement? errorMessageStatement? errorAppTagStatement?
+                 | descriptionStatement? referenceStatement? errorAppTagStatement? errorMessageStatement?
+                 | referenceStatement? errorMessageStatement? descriptionStatement? errorAppTagStatement?
+                 | referenceStatement? errorMessageStatement? errorAppTagStatement? descriptionStatement?
+                 | referenceStatement? errorAppTagStatement? descriptionStatement? errorMessageStatement?
+                 | referenceStatement? errorAppTagStatement? errorMessageStatement? descriptionStatement?
+                 | referenceStatement? descriptionStatement? errorMessageStatement? errorAppTagStatement?
+                 | referenceStatement? descriptionStatement? errorAppTagStatement? errorMessageStatement?
+                 ;
+
+    /**
+     *  string-restrictions = ;; these stmts can appear in any order
+     *                        [length-stmt stmtsep]
+     *                        *(pattern-stmt stmtsep)
+     */
+    stringRestrictions : ((lengthStatement)? (patternStatement)*) | ((patternStatement)* (lengthStatement)?);
+
+    /**
+     *  length-stmt         = length-keyword sep length-arg-str optsep
+     *                        (";" /
+     *                         "{" stmtsep
+     *                             ;; these stmts can appear in any order
+     *                             [error-message-stmt stmtsep]
+     *                             [error-app-tag-stmt stmtsep]
+     *                             [description-stmt stmtsep]
+     *                             [reference-stmt stmtsep]
+     *                          "}")
+     */
+    lengthStatement : LENGTH_KEYWORD length
+                  (STMTEND | LEFT_CURLY_BRACE commonStatements RIGHT_CURLY_BRACE);
+
+    /**
+     *  pattern-stmt        = pattern-keyword sep string optsep
+     *                        (";" /
+     *                         "{" stmtsep
+     *                             ;; these stmts can appear in any order
+     *                             [error-message-stmt stmtsep]
+     *                             [error-app-tag-stmt stmtsep]
+     *                             [description-stmt stmtsep]
+     *                             [reference-stmt stmtsep]
+     *                          "}")
+     */
+    patternStatement : PATTERN_KEYWORD string (STMTEND | LEFT_CURLY_BRACE commonStatements RIGHT_CURLY_BRACE);
+
+    /**
+     *  default-stmt        = default-keyword sep string stmtend
+     */
+    defaultStatement : DEFAULT_KEYWORD string STMTEND;
+
+    /**
+     *  enum-specification  = 1*(enum-stmt stmtsep)
+     */
+    enumSpecification : enumStatement+;
+
+    /**
+     *  enum-stmt           = enum-keyword sep string optsep
+     *                        (";" /
+     *                         "{" stmtsep
+     *                             ;; these stmts can appear in any order
+     *                             [value-stmt stmtsep]
+     *                             [status-stmt stmtsep]
+     *                             [description-stmt stmtsep]
+     *                             [reference-stmt stmtsep]
+     *                          "}")
+     */
+    enumStatement : ENUM_KEYWORD string (STMTEND | LEFT_CURLY_BRACE enumStatementBody RIGHT_CURLY_BRACE);
+
+    enumStatementBody : valueStatement? statusStatement? descriptionStatement? referenceStatement?
+                   | valueStatement? statusStatement? referenceStatement? descriptionStatement?
+                   | valueStatement? descriptionStatement? statusStatement? referenceStatement?
+                   | valueStatement? descriptionStatement? referenceStatement? statusStatement?
+                   | valueStatement? referenceStatement? statusStatement? descriptionStatement?
+                   | valueStatement? referenceStatement? descriptionStatement? statusStatement?
+                   | statusStatement? valueStatement? descriptionStatement? referenceStatement?
+                   | statusStatement? valueStatement? referenceStatement? descriptionStatement?
+                   | statusStatement? descriptionStatement? descriptionStatement? valueStatement?
+                   | statusStatement? descriptionStatement? valueStatement? descriptionStatement?
+                   | statusStatement? referenceStatement? valueStatement? descriptionStatement?
+                   | statusStatement? referenceStatement? descriptionStatement? valueStatement?
+                   | descriptionStatement? valueStatement? statusStatement? referenceStatement?
+                   | descriptionStatement? valueStatement? referenceStatement? statusStatement?
+                   | descriptionStatement? statusStatement? valueStatement? referenceStatement?
+                   | descriptionStatement? statusStatement? referenceStatement? valueStatement?
+                   | descriptionStatement? referenceStatement? valueStatement? statusStatement?
+                   | descriptionStatement? referenceStatement? statusStatement? valueStatement?
+                   | referenceStatement? valueStatement? descriptionStatement? statusStatement?
+                   | referenceStatement? valueStatement? statusStatement? descriptionStatement?
+                   | referenceStatement? statusStatement? descriptionStatement? valueStatement?
+                   | referenceStatement? statusStatement? valueStatement? descriptionStatement?
+                   | referenceStatement? descriptionStatement? valueStatement? statusStatement?
+                   | referenceStatement? descriptionStatement? statusStatement? valueStatement?
+                   ;
+
+    /**
+     *  leafref-specification =
+     *                        ;; these stmts can appear in any order
+     *                        path-stmt stmtsep
+     *                        [require-instance-stmt stmtsep]
+     */
+    leafrefSpecification : (pathStatement (requireInstanceStatement)?) | ((requireInstanceStatement)? pathStatement);
+
+    /**
+     *  path-stmt           = path-keyword sep path-arg-str stmtend
+     */
+    pathStatement : PATH_KEYWORD path STMTEND;
+
+    /**
+     *  require-instance-stmt = require-instance-keyword sep
+     *                           require-instance-arg-str stmtend
+     *  require-instance-arg-str = < a string that matches the rule
+     *                             require-instance-arg >
+     *  require-instance-arg = true-keyword / false-keyword
+     */
+    requireInstanceStatement : REQUIRE_INSTANCE_KEYWORD requireInstance STMTEND;
+
+    /**
+     *  instance-identifier-specification =
+     *                        [require-instance-stmt stmtsep]
+     */
+    instanceIdentifierSpecification : requireInstanceStatement?;
+
+    /**
+     * identityref-specification =
+     *                        base-stmt stmtsep
+     */
+    identityrefSpecification : baseStatement;
+
+    /**
+     *  union-specification = 1*(type-stmt stmtsep)
+     */
+    unionSpecification : typeStatement+;
+
+    /**
+     *  bits-specification  = 1*(bit-stmt stmtsep)
+     */
+    bitsSpecification : bitStatement+;
+
+    /**
+     * bit-stmt            = bit-keyword sep identifier-arg-str optsep
+     *                       (";" /
+     *                        "{" stmtsep
+     *                            ;; these stmts can appear in any order
+     *                            [position-stmt stmtsep]
+     *                            [status-stmt stmtsep]
+     *                            [description-stmt stmtsep]
+     *                            [reference-stmt stmtsep]
+     *                          "}"
+     *                        "}")
+     */
+    bitStatement : BIT_KEYWORD identifier (STMTEND | LEFT_CURLY_BRACE bitBodyStatement RIGHT_CURLY_BRACE);
+
+    bitBodyStatement : positionStatement? statusStatement? descriptionStatement? referenceStatement?
+                  | positionStatement? statusStatement? referenceStatement? descriptionStatement?
+                  | positionStatement? descriptionStatement? statusStatement? referenceStatement?
+                  | positionStatement? descriptionStatement? referenceStatement? statusStatement?
+                  | positionStatement? referenceStatement? statusStatement? descriptionStatement?
+                  | positionStatement? referenceStatement? descriptionStatement? statusStatement?
+                  | statusStatement? positionStatement? descriptionStatement? referenceStatement?
+                  | statusStatement? positionStatement? referenceStatement? descriptionStatement?
+                  | statusStatement? descriptionStatement? descriptionStatement? positionStatement?
+                  | statusStatement? descriptionStatement? positionStatement? descriptionStatement?
+                  | statusStatement? referenceStatement? positionStatement? descriptionStatement?
+                  | statusStatement? referenceStatement? descriptionStatement? positionStatement?
+                  | descriptionStatement? positionStatement? statusStatement? referenceStatement?
+                  | descriptionStatement? positionStatement? referenceStatement? statusStatement?
+                  | descriptionStatement? statusStatement? positionStatement? referenceStatement?
+                  | descriptionStatement? statusStatement? referenceStatement? positionStatement?
+                  | descriptionStatement? referenceStatement? positionStatement? statusStatement?
+                  | descriptionStatement? referenceStatement? statusStatement? positionStatement?
+                  | referenceStatement? positionStatement? descriptionStatement? statusStatement?
+                  | referenceStatement? positionStatement? statusStatement? descriptionStatement?
+                  | referenceStatement? statusStatement? descriptionStatement? positionStatement?
+                  | referenceStatement? statusStatement? positionStatement? descriptionStatement?
+                  | referenceStatement? descriptionStatement? positionStatement? statusStatement?
+                  | referenceStatement? descriptionStatement? statusStatement? positionStatement?
+                  ;
+
+    /**
+     *  position-stmt       = position-keyword sep
+     *                        position-value-arg-str stmtend
+     *  position-value-arg-str = < a string that matches the rule
+     *                              position-value-arg >
+     *  position-value-arg  = non-negative-integer-value
+     */
+    positionStatement : POSITION_KEYWORD position STMTEND;
+
+    /**
+     *  status-stmt         = status-keyword sep status-arg-str stmtend
+     *  status-arg-str      = < a string that matches the rule
+     *                         status-arg >
+     *  status-arg          = current-keyword /
+     *                        obsolete-keyword /
+     *                        deprecated-keyword
+     */
+    statusStatement : STATUS_KEYWORD status STMTEND;
+
+    /**
+     *  config-stmt         = config-keyword sep
+     *                        config-arg-str stmtend
+     *  config-arg-str      = < a string that matches the rule
+     *                          config-arg >
+     *  config-arg          = true-keyword / false-keyword
+     */
+    configStatement : CONFIG_KEYWORD config STMTEND;
+
+    /**
+     *  mandatory-stmt      = mandatory-keyword sep
+     *                        mandatory-arg-str stmtend
+     *
+     *  mandatory-arg-str   = < a string that matches the rule
+     *                          mandatory-arg >
+     *
+     *  mandatory-arg       = true-keyword / false-keyword
+     */
+    mandatoryStatement : MANDATORY_KEYWORD mandatory STMTEND;
+
+    /**
+     *  presence-stmt       = presence-keyword sep string stmtend
+     */
+    presenceStatement : PRESENCE_KEYWORD string STMTEND;
+
+    /**
+     *  ordered-by-stmt     = ordered-by-keyword sep
+     *                        ordered-by-arg-str stmtend
+     *
+     *  ordered-by-arg-str  = < a string that matches the rule
+     *                          ordered-by-arg >
+     *
+     *  ordered-by-arg      = user-keyword / system-keyword
+     */
+    orderedByStatement : ORDERED_BY_KEYWORD orderedBy STMTEND;
+
+    /**
+     *  must-stmt           = must-keyword sep string optsep
+     *                        (";" /
+     *                         "{" stmtsep
+     *                             ;; these stmts can appear in any order
+     *                             [error-message-stmt stmtsep]
+     *                             [error-app-tag-stmt stmtsep]
+     *                             [description-stmt stmtsep]
+     *                             [reference-stmt stmtsep]
+     *                          "}")
+     */
+    mustStatement : MUST_KEYWORD string (STMTEND | LEFT_CURLY_BRACE commonStatements RIGHT_CURLY_BRACE);
+
+    /**
+     *   error-message-stmt  = error-message-keyword sep string stmtend
+     */
+    errorMessageStatement : ERROR_MESSAGE_KEYWORD string STMTEND;
+
+    /**
+     *  error-app-tag-stmt  = error-app-tag-keyword sep string stmtend
+     */
+    errorAppTagStatement : ERROR_APP_TAG_KEYWORD string STMTEND;
+
+    /**
+     *  min-elements-stmt   = min-elements-keyword sep
+     *                        min-value-arg-str stmtend
+     *  min-value-arg-str   = < a string that matches the rule
+     *                          min-value-arg >
+     *  min-value-arg       = non-negative-integer-value
+     */
+    minElementsStatement : MIN_ELEMENTS_KEYWORD minValue STMTEND;
+
+    /**
+     *  max-elements-stmt   = max-elements-keyword sep
+     *                        max-value-arg-str stmtend
+     *  max-value-arg-str   = < a string that matches the rule
+     *                          max-value-arg >
+     *  max-value-arg       = unbounded-keyword /
+     *                        positive-integer-value
+     */
+    maxElementsStatement :  MAX_ELEMENTS_KEYWORD maxValue STMTEND;
+
+    /**
+     *  value-stmt          = value-keyword sep integer-value stmtend
+     */
+    valueStatement : VALUE_KEYWORD value STMTEND;
+
+    /**
+     *   grouping-stmt       = grouping-keyword sep identifier-arg-str optsep
+     *                        (";" /
+     *                         "{" stmtsep
+     *                            ;; these stmts can appear in any order
+     *                            [status-stmt stmtsep]
+     *                             [description-stmt stmtsep]
+     *                             [reference-stmt stmtsep]
+     *                             *((typedef-stmt /
+     *                                grouping-stmt) stmtsep)
+     *                             *(data-def-stmt stmtsep)
+     *                         "}")
+     * TODO : 0..1 occurance to be checked in listener
+     */
+    groupingStatement : GROUPING_KEYWORD identifier (STMTEND | LEFT_CURLY_BRACE
+                      (statusStatement | descriptionStatement | referenceStatement | typedefStatement | groupingStatement
+                       | dataDefStatement)* RIGHT_CURLY_BRACE);
+
+    /**
+     *  container-stmt      = container-keyword sep identifier-arg-str optsep
+     *                        (";" /
+     *                         "{" stmtsep
+     *                             ;; these stmts can appear in any order
+     *                             [when-stmt stmtsep]
+     *                             *(if-feature-stmt stmtsep)
+     *                             *(must-stmt stmtsep)
+     *                             [presence-stmt stmtsep]
+     *                             [config-stmt stmtsep]
+     *                             [status-stmt stmtsep]
+     *                             [description-stmt stmtsep]
+     *                             [reference-stmt stmtsep]
+     *                             *((typedef-stmt /
+     *                                grouping-stmt) stmtsep)
+     *                             *(data-def-stmt stmtsep)
+     *                         "}")
+     * TODO : 0..1 occurance to be checked in listener
+     */
+    containerStatement : CONTAINER_KEYWORD identifier
+                     (STMTEND | LEFT_CURLY_BRACE (whenStatement | ifFeatureStatement | mustStatement | presenceStatement | configStatement
+                     | statusStatement | descriptionStatement | referenceStatement | typedefStatement | groupingStatement
+                     | dataDefStatement)* RIGHT_CURLY_BRACE);
+
+    /**
+     *  leaf-stmt           = leaf-keyword sep identifier-arg-str optsep
+     *                        "{" stmtsep
+     *                            ;; these stmts can appear in any order
+     *                            [when-stmt stmtsep]
+     *                            *(if-feature-stmt stmtsep)
+     *                            type-stmt stmtsep
+     *                            [units-stmt stmtsep]
+     *                            *(must-stmt stmtsep)
+     *                            [default-stmt stmtsep]
+     *                            [config-stmt stmtsep]
+     *                            [mandatory-stmt stmtsep]
+     *                            [status-stmt stmtsep]
+     *                            [description-stmt stmtsep]
+     *                            [reference-stmt stmtsep]
+     *                         "}"
+     * TODO : 0..1 occurance to be checked in listener
+     */
+    leafStatement : LEAF_KEYWORD identifier LEFT_CURLY_BRACE (whenStatement | ifFeatureStatement | typeStatement | unitsStatement
+              | mustStatement | defaultStatement | configStatement | mandatoryStatement | statusStatement  | descriptionStatement
+              | referenceStatement)* RIGHT_CURLY_BRACE;
+
+    /**
+     *  leaf-list-stmt      = leaf-list-keyword sep identifier-arg-str optsep
+     *                        "{" stmtsep
+     *                            ;; these stmts can appear in any order
+     *                            [when-stmt stmtsep]
+     *                            *(if-feature-stmt stmtsep)
+     *                            type-stmt stmtsep
+     *                            [units-stmt stmtsep]
+     *                            *(must-stmt stmtsep)
+     *                            [config-stmt stmtsep]
+     *                            [min-elements-stmt stmtsep]
+     *                            [max-elements-stmt stmtsep]
+     *                            [ordered-by-stmt stmtsep]
+     *                            [status-stmt stmtsep]
+     *                            [description-stmt stmtsep]
+     *                            [reference-stmt stmtsep]
+     *                         "}"
+     * TODO : 0..1 occurance to be checked in listener
+     */
+    leafListStatement : LEAF_LIST_KEYWORD identifier LEFT_CURLY_BRACE (whenStatement | ifFeatureStatement | typeStatement
+                     | unitsStatement | mustStatement | configStatement | minElementsStatement | maxElementsStatement | orderedByStatement
+                     | statusStatement | descriptionStatement | referenceStatement)* RIGHT_CURLY_BRACE;
+
+    /**
+     *  list-stmt           = list-keyword sep identifier-arg-str optsep
+     *                        "{" stmtsep
+     *                            ;; these stmts can appear in any order
+     *                            [when-stmt stmtsep]
+     *                            *(if-feature-stmt stmtsep)
+     *                            *(must-stmt stmtsep)
+     *                            [key-stmt stmtsep]
+     *                            *(unique-stmt stmtsep)
+     *                            [config-stmt stmtsep]
+     *                            [min-elements-stmt stmtsep]
+     *                            [max-elements-stmt stmtsep]
+     *                            [ordered-by-stmt stmtsep]
+     *                            [status-stmt stmtsep]
+     *                            [description-stmt stmtsep]
+     *                            [reference-stmt stmtsep]
+     *                            *((typedef-stmt /
+     *                               grouping-stmt) stmtsep)
+     *                            1*(data-def-stmt stmtsep)
+     *                         "}"
+     * TODO : 0..1 occurance to be checked in listener
+     */
+    listStatement : LIST_KEYWORD identifier LEFT_CURLY_BRACE (whenStatement | ifFeatureStatement | mustStatement | keyStatement
+              | uniqueStatement | configStatement | minElementsStatement | maxElementsStatement | orderedByStatement | statusStatement
+              | descriptionStatement | referenceStatement | typedefStatement | groupingStatement| dataDefStatement)* RIGHT_CURLY_BRACE;
+
+    /**
+     *  key-stmt            = key-keyword sep key-arg-str stmtend
+     */
+    keyStatement : KEY_KEYWORD key STMTEND;
+
+    /**
+     *  unique-stmt         = unique-keyword sep unique-arg-str stmtend
+     */
+    uniqueStatement: UNIQUE_KEYWORD unique STMTEND;
+
+    /**
+     *  choice-stmt         = choice-keyword sep identifier-arg-str optsep
+     *                        (";" /
+     *                         "{" stmtsep
+     *                             ;; these stmts can appear in any order
+     *                             [when-stmt stmtsep]
+     *                             *(if-feature-stmt stmtsep)
+     *                             [default-stmt stmtsep]
+     *                             [config-stmt stmtsep]
+     *                             [mandatory-stmt stmtsep]
+     *                             [status-stmt stmtsep]
+     *                             [description-stmt stmtsep]
+     *                             [reference-stmt stmtsep]
+     *                             *((short-case-stmt / case-stmt) stmtsep)
+     *                         "}")
+     * TODO : 0..1 occurance to be checked in listener
+     */
+    choiceStatement : CHOICE_KEYWORD identifier (STMTEND | LEFT_CURLY_BRACE (whenStatement | ifFeatureStatement | defaultStatement
+                  | configStatement | mandatoryStatement | statusStatement | descriptionStatement | referenceStatement | shortCaseStatement
+                  | caseStatement)* RIGHT_CURLY_BRACE);
+
+    /**
+     *  short-case-stmt     = container-stmt /
+     *                        leaf-stmt /
+     *                        leaf-list-stmt /
+     *                        list-stmt /
+     *                        anyxml-stmt
+     */
+    shortCaseStatement : containerStatement | leafStatement | leafListStatement | listStatement | anyxmlStatement;
+
+    /**
+     *  case-stmt           = case-keyword sep identifier-arg-str optsep
+     *                        (";" /
+     *                         "{" stmtsep
+     *                             ;; these stmts can appear in any order
+     *                             [when-stmt stmtsep]
+     *                             *(if-feature-stmt stmtsep)
+     *                             [status-stmt stmtsep]
+     *                             [description-stmt stmtsep]
+     *                             [reference-stmt stmtsep]
+     *                             *(data-def-stmt stmtsep)
+     *                         "}")
+     * TODO : 0..1 occurance to be checked in listener
+     */
+    caseStatement : CASE_KEYWORD identifier (STMTEND | LEFT_CURLY_BRACE (whenStatement | ifFeatureStatement | statusStatement
+              | descriptionStatement | referenceStatement | dataDefStatement)* RIGHT_CURLY_BRACE);
+
+    /**
+     *    anyxml-stmt         = anyxml-keyword sep identifier-arg-str optsep
+     *                         (";" /
+     *                         "{" stmtsep
+     *                             ;; these stmts can appear in any order
+     *                             [when-stmt stmtsep]
+     *                             *(if-feature-stmt stmtsep)
+     *                             *(must-stmt stmtsep)
+     *                             [config-stmt stmtsep]
+     *                             [mandatory-stmt stmtsep]
+     *                             [status-stmt stmtsep]
+     *                             [description-stmt stmtsep]
+     *                             [reference-stmt stmtsep]
+     *                          "}")
+     */
+     anyxmlStatement : ANYXML_KEYWORD identifier (STMTEND | LEFT_CURLY_BRACE (whenStatement | ifFeatureStatement
+                     | mustStatement | configStatement | mandatoryStatement | statusStatement | descriptionStatement
+                     | referenceStatement)* RIGHT_CURLY_BRACE);
+
+    /**
+     *  uses-stmt           = uses-keyword sep identifier-ref-arg-str optsep
+     *                        (";" /
+     *                         "{" stmtsep
+     *                             ;; these stmts can appear in any order
+     *                             [when-stmt stmtsep]
+     *                             *(if-feature-stmt stmtsep)
+     *                             [status-stmt stmtsep]
+     *                             [description-stmt stmtsep]
+     *                             [reference-stmt stmtsep]
+     *                             *(refine-stmt stmtsep)
+     *                             *(uses-augment-stmt stmtsep)
+     *                         "}")
+     * TODO : 0..1 occurance to be checked in listener
+     */
+    usesStatement : USES_KEYWORD string (STMTEND | LEFT_CURLY_BRACE (whenStatement | ifFeatureStatement | statusStatement
+                | descriptionStatement | referenceStatement | refineStatement | augmentStatement)* RIGHT_CURLY_BRACE);
+
+    /**
+     *  refine-stmt         = refine-keyword sep refine-arg-str optsep
+     *                        (";" /
+     *                         "{" stmtsep
+     *                             (refine-container-stmts /
+     *                              refine-leaf-stmts /
+     *                              refine-leaf-list-stmts /
+     *                              refine-list-stmts /
+     *                              refine-choice-stmts /
+     *                              refine-case-stmts /
+     *                              refine-anyxml-stmts)
+     *                         "}")
+     */
+    refineStatement : REFINE_KEYWORD refine (STMTEND  | LEFT_CURLY_BRACE (refineContainerStatements
+                    | refineLeafStatements | refineLeafListStatements | refineListStatements | refineChoiceStatements
+                    | refineCaseStatements | refineAnyxmlStatements) RIGHT_CURLY_BRACE);
+
+    /**
+     *  refine-container-stmts =
+     *                        ;; these stmts can appear in any order
+     *                        *(must-stmt stmtsep)
+     *                        [presence-stmt stmtsep]
+     *                        [config-stmt stmtsep]
+     *                        [description-stmt stmtsep]
+     *                         [reference-stmt stmtsep]
+     * TODO : 0..1 occurance to be checked in listener
+     */
+    refineContainerStatements : (mustStatement | presenceStatement | configStatement | descriptionStatement | referenceStatement)* ;
+
+    /**
+     *   refine-leaf-stmts   = ;; these stmts can appear in any order
+     *                         *(must-stmt stmtsep)
+     *                         [default-stmt stmtsep]
+     *                         [config-stmt stmtsep]
+     *                        [mandatory-stmt stmtsep]
+     *                        [description-stmt stmtsep]
+     *                        [reference-stmt stmtsep]
+     * TODO : 0..1 occurance to be checked in listener
+     */
+    refineLeafStatements : (mustStatement | defaultStatement | configStatement | mandatoryStatement | descriptionStatement | referenceStatement)*;
+
+    /**
+     *  refine-leaf-list-stmts =
+     *                        ;; these stmts can appear in any order
+     *                        *(must-stmt stmtsep)
+     *                        [config-stmt stmtsep]
+     *                        [min-elements-stmt stmtsep]
+     *                        [max-elements-stmt stmtsep]
+     *                        [description-stmt stmtsep]
+     *                        [reference-stmt stmtsep]
+     * TODO : 0..1 occurance to be checked in listener
+     */
+    refineLeafListStatements : (mustStatement | configStatement | minElementsStatement | maxElementsStatement | descriptionStatement
+                             | referenceStatement)*;
+
+    /**
+     *  refine-list-stmts   = ;; these stmts can appear in any order
+     *                        *(must-stmt stmtsep)
+     *                        [config-stmt stmtsep]
+     *                        [min-elements-stmt stmtsep]
+     *                        [max-elements-stmt stmtsep]
+     *                        [description-stmt stmtsep]
+     *                        [reference-stmt stmtsep]
+     * TODO : 0..1 occurance to be checked in listener
+     */
+    refineListStatements : (mustStatement | configStatement | minElementsStatement | maxElementsStatement | descriptionStatement
+                        | referenceStatement)*;
+
+    /**
+     *  refine-choice-stmts = ;; these stmts can appear in any order
+     *                        [default-stmt stmtsep]
+     *                        [config-stmt stmtsep]
+     *                        [mandatory-stmt stmtsep]
+     *                        [description-stmt stmtsep]
+     *                        [reference-stmt stmtsep]
+     * TODO : 0..1 occurance to be checked in listener
+     */
+    refineChoiceStatements : (defaultStatement | configStatement | mandatoryStatement | descriptionStatement | referenceStatement)*;
+
+    /**
+     *  refine-case-stmts   = ;; these stmts can appear in any order
+     *                        [description-stmt stmtsep]
+     *                        [reference-stmt stmtsep]
+     *
+     */
+    refineCaseStatements : (descriptionStatement | referenceStatement)? | (referenceStatement | descriptionStatement)?;
+
+    /**
+     *  refine-anyxml-stmts = ;; these stmts can appear in any order
+     *                        *(must-stmt stmtsep)
+     *                        [config-stmt stmtsep]
+     *                        [mandatory-stmt stmtsep]
+     *                        [description-stmt stmtsep]
+     *                        [reference-stmt stmtsep]
+     */
+     refineAnyxmlStatements : (mustStatement | configStatement | mandatoryStatement | descriptionStatement
+                            | referenceStatement)*;
+
+    /**
+     *  augment-stmt        = augment-keyword sep augment-arg-str optsep
+     *                        "{" stmtsep
+     *                            ;; these stmts can appear in any order
+     *                            [when-stmt stmtsep]
+     *                            *(if-feature-stmt stmtsep)
+     *                            [status-stmt stmtsep]
+     *                            [description-stmt stmtsep]
+     *                            [reference-stmt stmtsep]
+     *                            1*((data-def-stmt stmtsep) /
+     *                               (case-stmt stmtsep))
+     *                         "}"
+     * TODO : 0..1 occurance to be checked in listener
+     */
+    augmentStatement : AUGMENT_KEYWORD augment LEFT_CURLY_BRACE (whenStatement | ifFeatureStatement | statusStatement
+                   | descriptionStatement | referenceStatement | dataDefStatement  | caseStatement)* RIGHT_CURLY_BRACE;
+
+    /**
+     *  when-stmt           = when-keyword sep string optsep
+     *                        (";" /
+     *                         "{" stmtsep
+     *                             ;; these stmts can appear in any order
+     *                             [description-stmt stmtsep]
+     *                             [reference-stmt stmtsep]
+     *                          "}")
+     *
+     */
+    whenStatement : WHEN_KEYWORD string (STMTEND | LEFT_CURLY_BRACE ((descriptionStatement? referenceStatement?)
+                       | (referenceStatement? descriptionStatement?)) RIGHT_CURLY_BRACE);
+
+    /**
+     *  rpc-stmt            = rpc-keyword sep identifier-arg-str optsep
+     *                        (";" /
+     *                         "{" stmtsep
+     *                             ;; these stmts can appear in any order
+     *                             *(if-feature-stmt stmtsep)
+     *                             [status-stmt stmtsep]
+     *                             [description-stmt stmtsep]
+     *                             [reference-stmt stmtsep]
+     *                             *((typedef-stmt /
+     *                                grouping-stmt) stmtsep)
+     *                             [input-stmt stmtsep]
+     *                             [output-stmt stmtsep]
+     *                         "}")
+     */
+    rpcStatement : RPC_KEYWORD identifier (STMTEND | LEFT_CURLY_BRACE (ifFeatureStatement | statusStatement | descriptionStatement
+                | referenceStatement | typedefStatement | groupingStatement | inputStatement | outputStatement)* RIGHT_CURLY_BRACE);
+
+    /**
+     * input-stmt          = input-keyword optsep
+     *                       "{" stmtsep
+     *                           ;; these stmts can appear in any order
+     *                           *((typedef-stmt /
+     *                              grouping-stmt) stmtsep)
+     *                           1*(data-def-stmt stmtsep)
+     *                         "}"
+     */
+    inputStatement : INPUT_KEYWORD LEFT_CURLY_BRACE (typedefStatement | groupingStatement | dataDefStatement)* RIGHT_CURLY_BRACE;
+
+    /**
+     *  output-stmt         = output-keyword optsep
+     *                        "{" stmtsep
+     *                            ;; these stmts can appear in any order
+     *                            *((typedef-stmt /
+     *                               grouping-stmt) stmtsep)
+     *                            1*(data-def-stmt stmtsep)
+     *                        "}"
+     */
+    outputStatement : OUTPUT_KEYWORD LEFT_CURLY_BRACE (typedefStatement | groupingStatement | dataDefStatement)* RIGHT_CURLY_BRACE;
+
+    /**
+     *  notification-stmt   = notification-keyword sep
+     *                        identifier-arg-str optsep
+     *                        (";" /
+     *                         "{" stmtsep
+     *                             ;; these stmts can appear in any order
+     *                             *(if-feature-stmt stmtsep)
+     *                             [status-stmt stmtsep]
+     *                             [description-stmt stmtsep]
+     *                             [reference-stmt stmtsep]
+     *                             *((typedef-stmt /
+     *                                grouping-stmt) stmtsep)
+     *                             *(data-def-stmt stmtsep)
+     *                         "}")
+     * TODO : 0..1 occurance to be checked in listener
+     */
+     notificationStatement : NOTIFICATION_KEYWORD identifier (STMTEND | LEFT_CURLY_BRACE (ifFeatureStatement
+                           | statusStatement | descriptionStatement | referenceStatement | typedefStatement
+                           | groupingStatement | dataDefStatement)* RIGHT_CURLY_BRACE);
+
+    /**
+     *  deviation-stmt      = deviation-keyword sep
+     *                        deviation-arg-str optsep
+     *                        "{" stmtsep
+     *                            ;; these stmts can appear in any order
+     *                            [description-stmt stmtsep]
+     *                            [reference-stmt stmtsep]
+     *                            (deviate-not-supported-stmt /
+     *                              1*(deviate-add-stmt /
+     *                                 deviate-replace-stmt /
+     *                                 deviate-delete-stmt))
+     *                        "}"
+     * TODO : 0..1 occurance to be checked in listener
+     */
+    deviationStatement: DEVIATION_KEYWORD deviation LEFT_CURLY_BRACE (descriptionStatement | referenceStatement
+                      | deviateNotSupportedStatement | deviateAddStatement | deviateReplaceStatement
+                      | deviateDeleteStatement)* RIGHT_CURLY_BRACE;
+
+    /**
+     * deviate-not-supported-stmt =
+     *                       deviate-keyword sep
+     *                       not-supported-keyword optsep
+     *                       (";" /
+     *                        "{" stmtsep
+     *                        "}")
+     */
+    deviateNotSupportedStatement: DEVIATE_KEYWORD NOT_SUPPORTED_KEYWORD (STMTEND | LEFT_CURLY_BRACE RIGHT_CURLY_BRACE);
+
+    /**
+     *  deviate-add-stmt    = deviate-keyword sep add-keyword optsep
+     *                        (";" /
+     *                         "{" stmtsep
+     *                             [units-stmt stmtsep]
+     *                             *(must-stmt stmtsep)
+     *                             *(unique-stmt stmtsep)
+     *                             [default-stmt stmtsep]
+     *                             [config-stmt stmtsep]
+     *                             [mandatory-stmt stmtsep]
+     *                             [min-elements-stmt stmtsep]
+     *                             [max-elements-stmt stmtsep]
+     *                         "}")
+     */
+    deviateAddStatement: DEVIATE_KEYWORD ADD_KEYWORD (STMTEND | (LEFT_CURLY_BRACE unitsStatement? mustStatement* uniqueStatement*
+                      defaultStatement? configStatement? mandatoryStatement? minElementsStatement? maxElementsStatement?
+                      RIGHT_CURLY_BRACE));
+
+    /**
+     *  deviate-delete-stmt = deviate-keyword sep delete-keyword optsep
+     *                        (";" /
+     *                         "{" stmtsep
+     *                             [units-stmt stmtsep]
+     *                             *(must-stmt stmtsep)
+     *                             *(unique-stmt stmtsep)
+     *                               [default-stmt stmtsep]
+     *                           "}")
+     */
+    deviateDeleteStatement: DEVIATE_KEYWORD DELETE_KEYWORD (STMTEND
+                       | (LEFT_CURLY_BRACE  unitsStatement? mustStatement* uniqueStatement* defaultStatement? RIGHT_CURLY_BRACE));
+
+    /**
+     *   deviate-replace-stmt = deviate-keyword sep replace-keyword optsep
+     *                         (";" /
+     *                          "{" stmtsep
+     *                              [type-stmt stmtsep]
+     *                              [units-stmt stmtsep]
+     *                              [default-stmt stmtsep]
+     *                              [config-stmt stmtsep]
+     *                              [mandatory-stmt stmtsep]
+     *                              [min-elements-stmt stmtsep]
+     *                              [max-elements-stmt stmtsep]
+     *                          "}")
+     */
+    deviateReplaceStatement: DEVIATE_KEYWORD REPLACE_KEYWORD (STMTEND | (LEFT_CURLY_BRACE typeStatement? unitsStatement?
+                           defaultStatement? configStatement? mandatoryStatement? minElementsStatement?
+                           maxElementsStatement? RIGHT_CURLY_BRACE));
+
+    /**
+     *   compiler-annotation-stmt = prefix:compiler-annotation-keyword string
+     *                          "{"
+     *                              [app-data-structure-stmt stmtsep]
+     *                              [app-extended-stmt stmtsep]
+     *                          "}"
+     */
+    compilerAnnotationStatement : COMPILER_ANNOTATION string LEFT_CURLY_BRACE
+                                       compilerAnnotationBodyStatement RIGHT_CURLY_BRACE;
+
+    compilerAnnotationBodyStatement : appDataStructureStatement? appExtendedStatement? ;
+
+    /**
+     *   app-data-structure-stmt = prefix:app-data-structure-keyword string
+     *                         (";" /
+     *                          "{"
+     *                              [data-structure-key-stmt stmtsep]
+     *                          "}")
+     */
+    appDataStructureStatement : APP_DATA_STRUCTURE appDataStructure (STMTEND | (LEFT_CURLY_BRACE
+                  dataStructureKeyStatement? RIGHT_CURLY_BRACE));
+
+    /**
+     *   data-structure-key-stmt = prefix:key-keyword string ";"
+     */
+    dataStructureKeyStatement : DATA_STRUCTURE_KEY string STMTEND;
+
+    /**
+     *   app-extended-stmt = prefix:app-extended-name-keyword string ";"
+     */
+    appExtendedStatement : APP_EXTENDED extendedName STMTEND;
+
+    string : STRING (PLUS STRING)*
+           | IDENTIFIER
+           | INTEGER
+           | yangConstruct;
+
+    identifier : STRING (PLUS STRING)*
+               | IDENTIFIER
+               | yangConstruct;
+
+    dateArgumentString : DATE_ARG
+                       | STRING (PLUS STRING)*;
+
+    version : string;
+
+    range : string;
+
+    length : string;
+
+    path : string;
+
+    position : string;
+
+    status : string;
+
+    config : string;
+
+    mandatory : string;
+
+    orderedBy : string;
+
+    minValue : string;
+
+    maxValue : string;
+
+    key : string;
+
+    unique : string;
+
+    refine : string;
+
+    requireInstance : string;
+
+    augment : string;
+
+    deviation : string;
+
+    value : string;
+
+    fraction : string;
+
+    appDataStructure : string;
+
+    extendedName : string;
+
+    yangConstruct : ANYXML_KEYWORD | ARGUMENT_KEYWORD | AUGMENT_KEYWORD | BASE_KEYWORD | BELONGS_TO_KEYWORD
+                  | BIT_KEYWORD | CASE_KEYWORD | CHOICE_KEYWORD | CONFIG_KEYWORD | CONTACT_KEYWORD | CONTAINER_KEYWORD
+                  | DEFAULT_KEYWORD | DESCRIPTION_KEYWORD | ENUM_KEYWORD | ERROR_APP_TAG_KEYWORD | ERROR_MESSAGE_KEYWORD
+                  | EXTENSION_KEYWORD | DEVIATION_KEYWORD | DEVIATE_KEYWORD | FEATURE_KEYWORD
+                  | FRACTION_DIGITS_KEYWORD | GROUPING_KEYWORD | IDENTITY_KEYWORD | IF_FEATURE_KEYWORD
+                  | IMPORT_KEYWORD | INCLUDE_KEYWORD | INPUT_KEYWORD | KEY_KEYWORD | LEAF_KEYWORD | LEAF_LIST_KEYWORD
+                  | LENGTH_KEYWORD | LIST_KEYWORD | MANDATORY_KEYWORD | MAX_ELEMENTS_KEYWORD | MIN_ELEMENTS_KEYWORD
+                  | MODULE_KEYWORD | MUST_KEYWORD | NAMESPACE_KEYWORD | NOTIFICATION_KEYWORD | ORDERED_BY_KEYWORD
+                  | ORGANIZATION_KEYWORD | OUTPUT_KEYWORD | PATH_KEYWORD | PATTERN_KEYWORD | POSITION_KEYWORD
+                  | PREFIX_KEYWORD | PRESENCE_KEYWORD | RANGE_KEYWORD | REFERENCE_KEYWORD | REFINE_KEYWORD
+                  | REQUIRE_INSTANCE_KEYWORD | REVISION_KEYWORD | REVISION_DATE_KEYWORD | RPC_KEYWORD
+                  | STATUS_KEYWORD | SUBMODULE_KEYWORD | TYPE_KEYWORD | TYPEDEF_KEYWORD | UNIQUE_KEYWORD
+                  | UNITS_KEYWORD | USES_KEYWORD | VALUE_KEYWORD | WHEN_KEYWORD | YANG_VERSION_KEYWORD
+                  | YIN_ELEMENT_KEYWORD | ADD_KEYWORD | CURRENT_KEYWORD | DELETE_KEYWORD | DEPRECATED_KEYWORD
+                  | FALSE_KEYWORD | MAX_KEYWORD | MIN_KEYWORD | NOT_SUPPORTED_KEYWORD | OBSOLETE_KEYWORD
+                  | REPLACE_KEYWORD | SYSTEM_KEYWORD | TRUE_KEYWORD | UNBOUNDED_KEYWORD | USER_KEYWORD
+                  | COMPILER_ANNOTATION_KEYWORD | APP_DATA_STRUCTURE_KEYWORD | DATA_STRUCTURE_KEYWORD
+                  | APP_EXTENDED_KEYWORD;
diff --git a/compiler/base/parser/src/main/resources/YangLexer.g4 b/compiler/base/parser/src/main/resources/YangLexer.g4
new file mode 100644
index 0000000..51a9231
--- /dev/null
+++ b/compiler/base/parser/src/main/resources/YangLexer.g4
@@ -0,0 +1,146 @@
+/*
+ * 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.
+ */
+
+/**
+ * This is a YANG grammar for lexer based on which ANTLR will generate YANG lexer.
+ */
+
+lexer grammar YangLexer;
+
+    // Statements keywords
+    ANYXML_KEYWORD      : 'anyxml';
+    ARGUMENT_KEYWORD    : 'argument';
+    AUGMENT_KEYWORD     : 'augment';
+    BASE_KEYWORD        : 'base';
+    BELONGS_TO_KEYWORD  : 'belongs-to';
+    BIT_KEYWORD         : 'bit';
+    CASE_KEYWORD        : 'case';
+    CHOICE_KEYWORD      : 'choice';
+    CONFIG_KEYWORD      : 'config';
+    CONTACT_KEYWORD     : 'contact';
+    CONTAINER_KEYWORD   : 'container';
+    DEFAULT_KEYWORD     : 'default';
+    DESCRIPTION_KEYWORD : 'description';
+    ENUM_KEYWORD        : 'enum';
+    ERROR_APP_TAG_KEYWORD : 'error-app-tag';
+    ERROR_MESSAGE_KEYWORD : 'error-message';
+    EXTENSION_KEYWORD   : 'extension';
+    DEVIATION_KEYWORD   : 'deviation';
+    DEVIATE_KEYWORD     : 'deviate';
+    FEATURE_KEYWORD     : 'feature';
+    FRACTION_DIGITS_KEYWORD : 'fraction-digits';
+    GROUPING_KEYWORD    : 'grouping';
+    IDENTITY_KEYWORD    : 'identity';
+    IF_FEATURE_KEYWORD  : 'if-feature';
+    IMPORT_KEYWORD      : 'import';
+    INCLUDE_KEYWORD     : 'include';
+    INPUT_KEYWORD       : 'input';
+    KEY_KEYWORD         : 'key';
+    LEAF_KEYWORD        : 'leaf';
+    LEAF_LIST_KEYWORD   : 'leaf-list';
+    LENGTH_KEYWORD      : 'length';
+    LIST_KEYWORD        : 'list';
+    MANDATORY_KEYWORD   : 'mandatory';
+    MAX_ELEMENTS_KEYWORD : 'max-elements';
+    MIN_ELEMENTS_KEYWORD : 'min-elements';
+    MODULE_KEYWORD      : 'module';
+    MUST_KEYWORD        : 'must';
+    NAMESPACE_KEYWORD   : 'namespace';
+    NOTIFICATION_KEYWORD: 'notification';
+    ORDERED_BY_KEYWORD  : 'ordered-by';
+    ORGANIZATION_KEYWORD: 'organization';
+    OUTPUT_KEYWORD      : 'output';
+    PATH_KEYWORD        : 'path';
+    PATTERN_KEYWORD     : 'pattern';
+    POSITION_KEYWORD    : 'position';
+    PREFIX_KEYWORD      : 'prefix';
+    PRESENCE_KEYWORD    : 'presence';
+    RANGE_KEYWORD       : 'range';
+    REFERENCE_KEYWORD   : 'reference';
+    REFINE_KEYWORD      : 'refine';
+    REQUIRE_INSTANCE_KEYWORD : 'require-instance';
+    REVISION_KEYWORD    : 'revision';
+    REVISION_DATE_KEYWORD : 'revision-date';
+    RPC_KEYWORD         : 'rpc';
+    STATUS_KEYWORD      : 'status';
+    SUBMODULE_KEYWORD   : 'submodule';
+    TYPE_KEYWORD        : 'type';
+    TYPEDEF_KEYWORD     : 'typedef';
+    UNIQUE_KEYWORD      : 'unique';
+    UNITS_KEYWORD       : 'units';
+    USES_KEYWORD        : 'uses';
+    VALUE_KEYWORD       : 'value';
+    WHEN_KEYWORD        : 'when';
+    YANG_VERSION_KEYWORD: 'yang-version';
+    YIN_ELEMENT_KEYWORD : 'yin-element';
+    ADD_KEYWORD         : 'add';
+    CURRENT_KEYWORD     : 'current';
+    DELETE_KEYWORD      : 'delete';
+    DEPRECATED_KEYWORD  : 'deprecated';
+    FALSE_KEYWORD       : 'false';
+    MAX_KEYWORD         : 'max';
+    MIN_KEYWORD         : 'min';
+    NOT_SUPPORTED_KEYWORD : 'not-supported';
+    OBSOLETE_KEYWORD    : 'obsolete';
+    REPLACE_KEYWORD     : 'replace';
+    SYSTEM_KEYWORD      : 'system';
+    TRUE_KEYWORD        : 'true';
+    UNBOUNDED_KEYWORD   : 'unbounded';
+    USER_KEYWORD        : 'user';
+    COMPILER_ANNOTATION_KEYWORD : 'compiler-annotation';
+    COMPILER_ANNOTATION : IDENTIFIER COLON COMPILER_ANNOTATION_KEYWORD;
+    APP_DATA_STRUCTURE_KEYWORD : 'app-data-structure';
+    APP_DATA_STRUCTURE : IDENTIFIER COLON APP_DATA_STRUCTURE_KEYWORD;
+    DATA_STRUCTURE_KEYWORD : 'data-structure';
+    DATA_STRUCTURE : IDENTIFIER COLON DATA_STRUCTURE_KEYWORD;
+    DATA_STRUCTURE_KEY : IDENTIFIER COLON KEY_KEYWORD;
+    APP_EXTENDED_KEYWORD : 'app-extended-name';
+    APP_EXTENDED : IDENTIFIER COLON APP_EXTENDED_KEYWORD;
+
+    // Lexer tokens to be skipped
+    COMMENT
+        :   '/*' .*? '*/'    -> channel(HIDDEN)
+        ;
+    WS  :   [ \r\t\u000C\n]+ -> channel(HIDDEN)
+        ;
+    LINE_COMMENT
+        : '//' ~[\r\n]* '\r'? '\n' -> channel(HIDDEN)
+        ;
+
+    // Additional rules
+    INTEGER             : DIGIT+;
+    DATE_ARG            : DIGIT DIGIT DIGIT DIGIT '-' DIGIT DIGIT '-' DIGIT DIGIT;
+    LEFT_CURLY_BRACE    : '{';
+    RIGHT_CURLY_BRACE   : '}';
+    IDENTIFIER          : (ALPHA | '_')
+                          (ALPHA | DIGIT | '_' | '-' | '.')*;
+    STMTEND             : ';';
+    DQUOTE              : '"';
+    COLON               : ':';
+    PLUS : '+';
+    MINUS: '-';
+
+    STRING : ((~( '\r' | '\n' | '\t' | ' ' | ';' | '{' | '"' | '+' | '\'')~( '\r' | '\n' | '\t' | ' ' | ';' | '{' | '+')* ) | SUB_STRING );
+
+    //Fragment rules
+    fragment SUB_STRING : ('"' (ESC | ~["])*'"') | ('\'' (ESC | ~['])*'\'') ;
+    fragment ESC :  '\\' (["\\/bfnrt] | UNICODE) ;
+    fragment UNICODE : 'u' HEX HEX HEX HEX ;
+    fragment HEX : [0-9a-fA-F] ;
+    fragment ALPHA      : [A-Za-z];
+    fragment DIGIT      : [0-9];
+    fragment URN        : [u][r][n];
+    fragment HTTP       : [h][t][t][p];
\ No newline at end of file
diff --git a/compiler/base/parser/src/main/resources/YangLexer.tokens b/compiler/base/parser/src/main/resources/YangLexer.tokens
new file mode 100644
index 0000000..6111f71
--- /dev/null
+++ b/compiler/base/parser/src/main/resources/YangLexer.tokens
@@ -0,0 +1,192 @@
+ANYXML_KEYWORD=1
+ARGUMENT_KEYWORD=2
+AUGMENT_KEYWORD=3
+BASE_KEYWORD=4
+BELONGS_TO_KEYWORD=5
+BIT_KEYWORD=6
+CASE_KEYWORD=7
+CHOICE_KEYWORD=8
+CONFIG_KEYWORD=9
+CONTACT_KEYWORD=10
+CONTAINER_KEYWORD=11
+DEFAULT_KEYWORD=12
+DESCRIPTION_KEYWORD=13
+ENUM_KEYWORD=14
+ERROR_APP_TAG_KEYWORD=15
+ERROR_MESSAGE_KEYWORD=16
+EXTENSION_KEYWORD=17
+DEVIATION_KEYWORD=18
+DEVIATE_KEYWORD=19
+FEATURE_KEYWORD=20
+FRACTION_DIGITS_KEYWORD=21
+GROUPING_KEYWORD=22
+IDENTITY_KEYWORD=23
+IF_FEATURE_KEYWORD=24
+IMPORT_KEYWORD=25
+INCLUDE_KEYWORD=26
+INPUT_KEYWORD=27
+KEY_KEYWORD=28
+LEAF_KEYWORD=29
+LEAF_LIST_KEYWORD=30
+LENGTH_KEYWORD=31
+LIST_KEYWORD=32
+MANDATORY_KEYWORD=33
+MAX_ELEMENTS_KEYWORD=34
+MIN_ELEMENTS_KEYWORD=35
+MODULE_KEYWORD=36
+MUST_KEYWORD=37
+NAMESPACE_KEYWORD=38
+NOTIFICATION_KEYWORD=39
+ORDERED_BY_KEYWORD=40
+ORGANIZATION_KEYWORD=41
+OUTPUT_KEYWORD=42
+PATH_KEYWORD=43
+PATTERN_KEYWORD=44
+POSITION_KEYWORD=45
+PREFIX_KEYWORD=46
+PRESENCE_KEYWORD=47
+RANGE_KEYWORD=48
+REFERENCE_KEYWORD=49
+REFINE_KEYWORD=50
+REQUIRE_INSTANCE_KEYWORD=51
+REVISION_KEYWORD=52
+REVISION_DATE_KEYWORD=53
+RPC_KEYWORD=54
+STATUS_KEYWORD=55
+SUBMODULE_KEYWORD=56
+TYPE_KEYWORD=57
+TYPEDEF_KEYWORD=58
+UNIQUE_KEYWORD=59
+UNITS_KEYWORD=60
+USES_KEYWORD=61
+VALUE_KEYWORD=62
+WHEN_KEYWORD=63
+YANG_VERSION_KEYWORD=64
+YIN_ELEMENT_KEYWORD=65
+ADD_KEYWORD=66
+CURRENT_KEYWORD=67
+DELETE_KEYWORD=68
+DEPRECATED_KEYWORD=69
+FALSE_KEYWORD=70
+MAX_KEYWORD=71
+MIN_KEYWORD=72
+NOT_SUPPORTED_KEYWORD=73
+OBSOLETE_KEYWORD=74
+REPLACE_KEYWORD=75
+SYSTEM_KEYWORD=76
+TRUE_KEYWORD=77
+UNBOUNDED_KEYWORD=78
+USER_KEYWORD=79
+COMPILER_ANNOTATION_KEYWORD=80
+COMPILER_ANNOTATION=81
+APP_DATA_STRUCTURE_KEYWORD=82
+APP_DATA_STRUCTURE=83
+DATA_STRUCTURE_KEYWORD=84
+DATA_STRUCTURE=85
+DATA_STRUCTURE_KEY=86
+APP_EXTENDED_KEYWORD=87
+APP_EXTENDED=88
+COMMENT=89
+WS=90
+LINE_COMMENT=91
+INTEGER=92
+DATE_ARG=93
+LEFT_CURLY_BRACE=94
+RIGHT_CURLY_BRACE=95
+IDENTIFIER=96
+STMTEND=97
+DQUOTE=98
+COLON=99
+PLUS=100
+MINUS=101
+STRING=102
+'anyxml'=1
+'argument'=2
+'augment'=3
+'base'=4
+'belongs-to'=5
+'bit'=6
+'case'=7
+'choice'=8
+'config'=9
+'contact'=10
+'container'=11
+'default'=12
+'description'=13
+'enum'=14
+'error-app-tag'=15
+'error-message'=16
+'extension'=17
+'deviation'=18
+'deviate'=19
+'feature'=20
+'fraction-digits'=21
+'grouping'=22
+'identity'=23
+'if-feature'=24
+'import'=25
+'include'=26
+'input'=27
+'key'=28
+'leaf'=29
+'leaf-list'=30
+'length'=31
+'list'=32
+'mandatory'=33
+'max-elements'=34
+'min-elements'=35
+'module'=36
+'must'=37
+'namespace'=38
+'notification'=39
+'ordered-by'=40
+'organization'=41
+'output'=42
+'path'=43
+'pattern'=44
+'position'=45
+'prefix'=46
+'presence'=47
+'range'=48
+'reference'=49
+'refine'=50
+'require-instance'=51
+'revision'=52
+'revision-date'=53
+'rpc'=54
+'status'=55
+'submodule'=56
+'type'=57
+'typedef'=58
+'unique'=59
+'units'=60
+'uses'=61
+'value'=62
+'when'=63
+'yang-version'=64
+'yin-element'=65
+'add'=66
+'current'=67
+'delete'=68
+'deprecated'=69
+'false'=70
+'max'=71
+'min'=72
+'not-supported'=73
+'obsolete'=74
+'replace'=75
+'system'=76
+'true'=77
+'unbounded'=78
+'user'=79
+'compiler-annotation'=80
+'app-data-structure'=82
+'data-structure'=84
+'app-extended-name'=87
+'{'=94
+'}'=95
+';'=97
+'"'=98
+':'=99
+'+'=100
+'-'=101
diff --git a/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/CustomExceptionMatcher.java b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/CustomExceptionMatcher.java
new file mode 100644
index 0000000..2f3e9ed
--- /dev/null
+++ b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/CustomExceptionMatcher.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl;
+
+import org.hamcrest.Description;
+import org.hamcrest.TypeSafeMatcher;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+
+/**
+ * ExpectedException framework can use the Hamcrest matcher's to test
+ * custom/extended exceptions. This class extends the type safe matcher to
+ * define the custom exception matcher.
+ */
+public final class CustomExceptionMatcher extends TypeSafeMatcher<ParserException> {
+
+    private int actualLine;
+    private final int expectedLine;
+    private int actualCharPosition;
+    private final int expectedCharPosition;
+
+    /**
+     * Customized exception matcher to match error location.
+     *
+     * @param line error line
+     * @param charPosition error character position
+     * @return customized exception matcher to match error location
+     */
+    public static CustomExceptionMatcher errorLocation(int line, int charPosition) {
+        return new CustomExceptionMatcher(line, charPosition);
+    }
+
+    private CustomExceptionMatcher(int expectedLine, int expectedCharPosition) {
+        this.expectedLine = expectedLine;
+        this.expectedCharPosition = expectedCharPosition;
+    }
+
+    @Override
+    protected boolean matchesSafely(final ParserException exception) {
+        actualLine = exception.getLineNumber();
+        actualCharPosition = exception.getCharPositionInLine();
+        return ((actualLine == expectedLine) && (actualCharPosition == expectedCharPosition));
+    }
+
+    @Override
+    public void describeTo(Description description) {
+        description.appendText(" Error reported location ")
+                .appendText("Line " + actualLine + ", " + "CharPosition " + actualCharPosition)
+                .appendText(" instead of expected ")
+                .appendText("Line " + expectedLine + ", " + "CharPosition " + expectedCharPosition);
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/TreeWalkListenerTest.java b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/TreeWalkListenerTest.java
new file mode 100644
index 0000000..d199b38
--- /dev/null
+++ b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/TreeWalkListenerTest.java
@@ -0,0 +1,83 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+
+import java.io.IOException;
+
+/**
+ * Test cases for testing tree walk listener functionality.
+ */
+public class TreeWalkListenerTest {
+
+    private final YangUtilsParserManager manager = new YangUtilsParserManager();
+
+    @Rule
+    public ExpectedException thrown = ExpectedException.none();
+
+    /**
+     * Checks whether exception is thrown for ordered statement.
+     */
+    @Test
+    public void processOrderedByStatement() throws IOException, ParserException {
+        // Now no exception should be thrown. logs should come.
+        manager.getDataModel("src/test/resources/OrderedByStatement.yang");
+    }
+
+    /**
+     * Checks whether exception is thrown for anyxml statement.
+     */
+    @Test
+    public void processAnyXmlStatement() throws IOException, ParserException {
+        // Now no exception should be thrown. logs should come.
+        manager.getDataModel("src/test/resources/AnyxmlStatement.yang");
+    }
+
+    /**
+     * Checks whether exception is thrown when extra brace is added in the EOF.
+     */
+    @Test
+    public void processFileWithExtraBrace() throws IOException, ParserException {
+        thrown.expect(ParserException.class);
+        thrown.expectMessage("mismatched input '}' expecting <EOF>");
+        manager.getDataModel("src/test/resources/ProcessFileWithExtraBrace.yang");
+    }
+
+    /**
+     * Checks whether exception is thrown when leaf is given after module ends.
+     */
+    @Test
+    public void processFileWithExtraLeaf() throws IOException, ParserException {
+        thrown.expect(ParserException.class);
+        thrown.expectMessage("mismatched input 'leaf' expecting <EOF>");
+        manager.getDataModel("src/test/resources/ProcessFileWithExtraLeaf.yang");
+    }
+
+    /**
+     * Checks whether exception is thrown when extra brace is added in between the EOF.
+     */
+    @Test
+    public void processFileWithExtraBraceInBetween() throws IOException, ParserException {
+        thrown.expect(ParserException.class);
+        thrown.expectMessage("mismatched input 'container' expecting <EOF>");
+        manager.getDataModel("src/test/resources/ProcessFileWithExtraBraceInBetween.yang");
+    }
+}
diff --git a/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/YangUtilsParserManagerTest.java b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/YangUtilsParserManagerTest.java
new file mode 100644
index 0000000..c74869b
--- /dev/null
+++ b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/YangUtilsParserManagerTest.java
@@ -0,0 +1,104 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+
+/**
+ * Test case for testing YANG utils parser manager.
+ */
+public class YangUtilsParserManagerTest {
+
+    YangUtilsParserManager manager = new YangUtilsParserManager();
+    File file;
+    BufferedWriter out;
+
+    @Before
+    public void setUp() throws Exception {
+        file = new File("demo.yang");
+        out = new BufferedWriter(new FileWriter(file));
+    }
+
+    @After
+    public void tearDown() throws Exception {
+        file.delete();
+    }
+
+    /**
+     * This test case checks whether the null pointer exception is generated
+     * when the input YANG file is null.
+     */
+    @Test(expected = NullPointerException.class)
+    public void getDataModelNullFileTest() throws IOException, ParserException {
+        YangUtilsParserManager manager = new YangUtilsParserManager();
+        YangNode node = manager.getDataModel(null);
+    }
+
+    /**
+     * This test case checks whether the io exception is generated
+     * when the input YANG file is non existent.
+     */
+    @Test(expected = ParserException.class)
+    public void getDataModelNonExistentFileTest() throws IOException, ParserException {
+
+        YangUtilsParserManager manager = new YangUtilsParserManager();
+        YangNode node = manager.getDataModel("nonexistent.yang");
+    }
+
+    /**
+     * This test case checks if the input YANG file is correct no exception
+     * should be generated.
+     */
+    @Test
+    public void getDataModelCorrectFileTest() throws IOException, ParserException {
+
+        out.write("module ONOS {\n");
+        out.write("yang-version 1;\n");
+        out.write("namespace urn:ietf:params:xml:ns:yang:ietf-ospf;\n");
+        out.write("prefix On;\n");
+        out.write("}\n");
+        out.close();
+
+        YangNode node = manager.getDataModel("demo.yang");
+    }
+
+    /**
+     * This test case checks if the input YANG file with wrong YANG constructs
+     * than parser exception should be generated.
+     */
+    @Test(expected = ParserException.class)
+    public void getDataModelIncorrectFileTest() throws IOException, ParserException {
+
+        out.write("module ONOS {\n");
+        out.write("yang-version 1\n");
+        out.write("namespace urn:ietf:params:xml:ns:yang:ietf-ospf;\n");
+        out.write("prefix On;\n");
+        out.write("}\n");
+        out.close();
+
+        YangNode node = manager.getDataModel("demo.yang");
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/AugmentListenerTest.java b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/AugmentListenerTest.java
new file mode 100644
index 0000000..0e0fd10
--- /dev/null
+++ b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/AugmentListenerTest.java
@@ -0,0 +1,70 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.hamcrest.core.Is;
+import org.junit.Test;
+import org.onosproject.yang.compiler.datamodel.YangAtomicPath;
+import org.onosproject.yang.compiler.datamodel.YangAugment;
+import org.onosproject.yang.compiler.datamodel.YangLeaf;
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangNodeType;
+import org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.YangUtilsParserManager;
+
+import java.io.IOException;
+import java.util.ListIterator;
+
+import static org.hamcrest.core.Is.is;
+import static org.junit.Assert.assertThat;
+
+/**
+ * Test cases for testing augment listener functionality.
+ */
+public class AugmentListenerTest {
+
+    private final YangUtilsParserManager manager = new YangUtilsParserManager();
+
+    /**
+     * Checks valid augment statement.
+     */
+    @Test
+    public void processValidAugmentStatement() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/ValidAugmentStatement.yang");
+
+        assertThat(node instanceof YangModule, is(true));
+        assertThat(node.getNodeType(), Is.is(YangNodeType.MODULE_NODE));
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        YangAugment yangAugment = (YangAugment) yangNode.getChild();
+        ListIterator<YangAtomicPath> absPathIterator = yangAugment.getTargetNode().listIterator();
+        YangAtomicPath absPathIdentifier = absPathIterator.next();
+        assertThat(absPathIdentifier.getNodeIdentifier().getPrefix(), is("if"));
+        assertThat(absPathIdentifier.getNodeIdentifier().getName(), is("interfaces"));
+
+        ListIterator<YangLeaf> leafIterator = yangAugment.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("ds0ChannelNumber"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("ChannelNumber"));
+        assertThat(leafInfo.getDataType().getDataType(), Is.is(YangDataTypes.DERIVED));
+    }
+}
diff --git a/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/BaseFileListenerTest.java b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/BaseFileListenerTest.java
new file mode 100644
index 0000000..3a3c744
--- /dev/null
+++ b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/BaseFileListenerTest.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.yang.compiler.parser.impl.listeners;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.javadatamodel.YangJavaModule;
+import org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.TreeWalkListener;
+
+/**
+ * Test cases for testing base rule listener functionality.
+ */
+public class BaseFileListenerTest {
+
+    @Rule
+    public ExpectedException thrown = ExpectedException.none();
+
+    /**
+     * Checks for exception if stack of parsable data is not empty at the entry
+     * of yang base rule.
+     */
+    @Test
+    public void processYangFileEntryNonEmptyStack() {
+        thrown.expect(ParserException.class);
+        thrown.expectMessage("Internal parser error detected: Invalid holder for yangbase before processing.");
+
+        YangModule tmpModule = new YangJavaModule();
+        TreeWalkListener listener = new TreeWalkListener();
+        listener.getParsedDataStack().push(tmpModule);
+        GeneratedYangParser.YangfileContext ctx = null;
+        BaseFileListener.processYangFileEntry(listener, ctx);
+    }
+
+    /**
+     * Checks that exception shouldn't be generated if stack of parsable data is
+     * empty at the entry of yang base rule.
+     */
+    @Test
+    public void processYangFileEntryEmptyStack() {
+
+        TreeWalkListener listener = new TreeWalkListener();
+        GeneratedYangParser.YangfileContext ctx = null;
+        BaseFileListener.processYangFileEntry(listener, ctx);
+    }
+
+    /**
+     * Checks that exception should be generated if stack of parsable data is
+     * not empty at the exit of yang base rule.
+     */
+    @Test
+    public void processYangFileExitEmptyStack() {
+        thrown.expect(ParserException.class);
+        thrown.expectMessage("Internal parser error detected: Missing holder at yangbase after processing.");
+
+        TreeWalkListener listener = new TreeWalkListener();
+        GeneratedYangParser.YangfileContext ctx = null;
+        BaseFileListener.processYangFileExit(listener, ctx);
+    }
+
+    /**
+     * Checks that exception shouldn't be generated if stack of parsable data is
+     * empty at the exit of yang base rule.
+     */
+    @Test
+    public void processYangFileExitNonEmptyStack() {
+
+        TreeWalkListener listener = new TreeWalkListener();
+        GeneratedYangParser.YangfileContext ctx = null;
+        BaseFileListener.processYangFileEntry(listener, ctx);
+    }
+
+    /**
+     * Checks that after popping out the parsable node from stack it should be
+     * empty.
+     */
+    @Test
+    public void processYangFileExitStackErrorExtraEntryTest() {
+        thrown.expect(ParserException.class);
+        thrown.expectMessage("Internal parser error detected: Invalid holder for yangbase after processing.");
+
+        YangModule tmpModule = new YangJavaModule();
+        YangModule tmpModule2 = new YangJavaModule();
+        TreeWalkListener listener = new TreeWalkListener();
+        listener.getParsedDataStack().push(tmpModule);
+        listener.getParsedDataStack().push(tmpModule2);
+        GeneratedYangParser.YangfileContext ctx = null;
+        BaseFileListener.processYangFileExit(listener, ctx);
+    }
+}
diff --git a/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/BelongstoListenerTest.java b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/BelongstoListenerTest.java
new file mode 100644
index 0000000..c9336ce
--- /dev/null
+++ b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/BelongstoListenerTest.java
@@ -0,0 +1,86 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangSubModule;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.CustomExceptionMatcher;
+import org.onosproject.yang.compiler.parser.impl.YangUtilsParserManager;
+
+import java.io.IOException;
+
+import static org.hamcrest.core.Is.is;
+import static org.junit.Assert.assertThat;
+
+/**
+ * Test cases for testing belongsto listener functionality.
+ */
+public class BelongstoListenerTest {
+
+    @Rule
+    public ExpectedException thrown = ExpectedException.none();
+
+    private final YangUtilsParserManager manager = new YangUtilsParserManager();
+
+    /**
+     * Checks if mandatory belongsto parameter "prefix" is not present.
+     */
+    @Test
+    public void processBelongsToWithoutPrefix() throws IOException, ParserException {
+        thrown.expect(ParserException.class);
+        thrown.expectMessage("mismatched input '}' expecting 'prefix'");
+        thrown.expect(CustomExceptionMatcher.errorLocation(4, 0));
+        YangNode node = manager.getDataModel("src/test/resources/BelongsToWithoutPrefix.yang");
+    }
+
+    /**
+     * Checks that prefix must be present only once in belongsto.
+     */
+    @Test
+    public void processBelongsToDualPrefix() throws IOException, ParserException {
+        thrown.expect(ParserException.class);
+        thrown.expectMessage("mismatched input 'prefix' expecting '}'");
+        thrown.expect(CustomExceptionMatcher.errorLocation(5, 0));
+        YangNode node = manager.getDataModel("src/test/resources/BelongsToDualPrefix.yang");
+    }
+
+    /**
+     * Checks if belongsto listener updates the date model tree.
+     */
+    @Test
+    public void processBelongsToWithPrefix() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/BelongsToWithPrefix.yang");
+        YangSubModule yangNode = (YangSubModule) node;
+        assertThat(yangNode.getBelongsTo().getBelongsToModuleName(), is("ONOS"));
+    }
+
+    /**
+     * Checks if mandatory parameter "belongsto" is present.
+     */
+    @Test
+    public void processSubModuleWithoutBelongsTo() throws IOException, ParserException {
+        thrown.expect(ParserException.class);
+        thrown.expectMessage("mismatched input '}' expecting 'belongs-to'");
+        thrown.expect(CustomExceptionMatcher.errorLocation(3, 0));
+        YangNode node = manager.getDataModel("src/test/resources/SubModuleWithoutBelongsTo.yang");
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/BitListenerTest.java b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/BitListenerTest.java
new file mode 100644
index 0000000..b6f6c64
--- /dev/null
+++ b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/BitListenerTest.java
@@ -0,0 +1,362 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.hamcrest.core.Is;
+import org.junit.Test;
+import org.onosproject.yang.compiler.datamodel.YangBit;
+import org.onosproject.yang.compiler.datamodel.YangBits;
+import org.onosproject.yang.compiler.datamodel.YangDerivedInfo;
+import org.onosproject.yang.compiler.datamodel.YangLeaf;
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangNodeType;
+import org.onosproject.yang.compiler.datamodel.YangType;
+import org.onosproject.yang.compiler.datamodel.YangTypeDef;
+import org.onosproject.yang.compiler.datamodel.YangUnion;
+import org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.YangUtilsParserManager;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Map;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.Is.is;
+
+/**
+ * Test cases for bit listener.
+ */
+public class BitListenerTest {
+
+    private final YangUtilsParserManager manager = new YangUtilsParserManager();
+
+    /**
+     * Checks bit statement without position.
+     */
+    @Test
+    public void processBitTypeStatement() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/BitTypeStatement.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), Is.is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("mybits"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("bits"));
+        assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.BITS));
+        assertThat(((YangBits) leafInfo.getDataType().getDataTypeExtendedInfo()).getBitsName(),
+                is("mybits"));
+
+        // Check bit name map
+        Map<String, YangBit> bitNameMap = ((YangBits) leafInfo.getDataType().getDataTypeExtendedInfo()).getBitNameMap();
+        assertThat(bitNameMap.size(), is(3));
+        for (Map.Entry<String, YangBit> element : bitNameMap.entrySet()) {
+            String bitName = element.getKey();
+            YangBit yangBit = element.getValue();
+            if (bitName.equals("disable-nagle")) {
+                assertThat(yangBit.getPosition(), is(0));
+            } else if (bitName.equals("auto-sense-speed")) {
+                assertThat(yangBit.getPosition(), is(1));
+            } else if (bitName.equals("Ten-Mb-only")) {
+                assertThat(yangBit.getPosition(), is(2));
+            } else {
+                throw new IOException("Invalid bit name: " + bitName);
+            }
+        }
+
+        // Check bit position map
+        Map<Integer, YangBit> bitPositionMap = ((YangBits) leafInfo.getDataType().getDataTypeExtendedInfo())
+                                                                                 .getBitPositionMap();
+        assertThat(bitPositionMap.size(), is(3));
+        for (Map.Entry<Integer, YangBit> element : bitPositionMap.entrySet()) {
+            int position = element.getKey();
+            YangBit yangBit = element.getValue();
+            if (position == 0) {
+                assertThat(yangBit.getBitName(), is("disable-nagle"));
+            } else if (position == 1) {
+                assertThat(yangBit.getBitName(), is("auto-sense-speed"));
+            } else if (position == 2) {
+                assertThat(yangBit.getBitName(), is("Ten-Mb-only"));
+            } else {
+                throw new IOException("Invalid bit position: " + position);
+            }
+        }
+    }
+
+    /**
+     * Checks bit statement with typedef.
+     */
+    @Test
+    public void processBitTypedefStatement() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/BitTypedefStatement.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        YangTypeDef typedef = (YangTypeDef) yangNode.getChild();
+        assertThat(typedef.getName(), is("type15"));
+
+        YangType type = typedef.getTypeList().iterator().next();
+        assertThat(type.getDataType(), is(YangDataTypes.BITS));
+        assertThat(type.getDataTypeName(), is("bits"));
+
+        // Check bit name map
+        Map<String, YangBit> bitNameMap = ((YangBits) type.getDataTypeExtendedInfo()).getBitNameMap();
+        assertThat(bitNameMap.size(), is(3));
+        for (Map.Entry<String, YangBit> element : bitNameMap.entrySet()) {
+            String bitName = element.getKey();
+            YangBit yangBit = element.getValue();
+            if (bitName.equals("disable-nagle")) {
+                assertThat(yangBit.getPosition(), is(0));
+            } else if (bitName.equals("auto-sense-speed")) {
+                assertThat(yangBit.getPosition(), is(1));
+            } else if (bitName.equals("Mb-only")) {
+                assertThat(yangBit.getPosition(), is(2));
+            } else {
+                throw new IOException("Invalid bit name: " + bitName);
+            }
+        }
+
+        // Check bit position map
+        Map<Integer, YangBit> bitPositionMap = ((YangBits) type.getDataTypeExtendedInfo()).getBitPositionMap();
+        assertThat(bitPositionMap.size(), is(3));
+        for (Map.Entry<Integer, YangBit> element : bitPositionMap.entrySet()) {
+            int position = element.getKey();
+            YangBit yangBit = element.getValue();
+            if (position == 0) {
+                assertThat(yangBit.getBitName(), is("disable-nagle"));
+            } else if (position == 1) {
+                assertThat(yangBit.getBitName(), is("auto-sense-speed"));
+            } else if (position == 2) {
+                assertThat(yangBit.getBitName(), is("Mb-only"));
+            } else {
+                throw new IOException("Invalid bit position: " + position);
+            }
+        }
+    }
+
+    /**
+     * Checks bit statement with typedef with referred leaf.
+     */
+    @Test
+    public void processBitTypedefReferredLeafStatement() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/BitTypedefReferredLeafStatement.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        YangTypeDef typedef = (YangTypeDef) yangNode.getChild();
+        assertThat(typedef.getName(), is("topBits"));
+
+        YangType type = typedef.getTypeList().iterator().next();
+        assertThat(type.getDataType(), is(YangDataTypes.BITS));
+        assertThat(type.getDataTypeName(), is("bits"));
+
+        // Check bit name map
+        Map<String, YangBit> bitNameMap = ((YangBits) type.getDataTypeExtendedInfo()).getBitNameMap();
+        assertThat(bitNameMap.size(), is(3));
+        for (Map.Entry<String, YangBit> element : bitNameMap.entrySet()) {
+            String bitName = element.getKey();
+            YangBit yangBit = element.getValue();
+            if (bitName.equals("disable-nagle")) {
+                assertThat(yangBit.getPosition(), is(0));
+            } else if (bitName.equals("auto-sense-speed")) {
+                assertThat(yangBit.getPosition(), is(1));
+            } else if (bitName.equals("Mb-only")) {
+                assertThat(yangBit.getPosition(), is(2));
+            } else {
+                throw new IOException("Invalid bit name: " + bitName);
+            }
+        }
+
+        // Check bit position map
+        Map<Integer, YangBit> bitPositionMap = ((YangBits) type.getDataTypeExtendedInfo()).getBitPositionMap();
+        assertThat(bitPositionMap.size(), is(3));
+        for (Map.Entry<Integer, YangBit> element : bitPositionMap.entrySet()) {
+            int position = element.getKey();
+            YangBit yangBit = element.getValue();
+            if (position == 0) {
+                assertThat(yangBit.getBitName(), is("disable-nagle"));
+            } else if (position == 1) {
+                assertThat(yangBit.getBitName(), is("auto-sense-speed"));
+            } else if (position == 2) {
+                assertThat(yangBit.getBitName(), is("Mb-only"));
+            } else {
+                throw new IOException("Invalid bit position: " + position);
+            }
+        }
+
+        // Check leaf reffered typedef
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("myBits"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("topBits"));
+        assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.DERIVED));
+        YangType<YangDerivedInfo> typeDerived = (YangType<YangDerivedInfo>) leafInfo.getDataType();
+        YangDerivedInfo derivedInfo = (YangDerivedInfo) typeDerived.getDataTypeExtendedInfo();
+        YangTypeDef prevTypedef = (YangTypeDef) derivedInfo.getReferredTypeDef();
+        assertThat(prevTypedef.getName(), is("topBits"));
+        YangType topType = prevTypedef.getTypeList().iterator().next();
+        assertThat(topType.getDataType(), is(YangDataTypes.BITS));
+        assertThat(topType.getDataTypeName(), is("bits"));
+        YangType<YangBits> typeBits = (YangType<YangBits>) topType;
+        YangBits bits = typeBits.getDataTypeExtendedInfo();
+
+        // Check bit name map
+        bitNameMap = bits.getBitNameMap();
+        assertThat(bitNameMap.size(), is(3));
+        for (Map.Entry<String, YangBit> element : bitNameMap.entrySet()) {
+            String bitName = element.getKey();
+            YangBit yangBit = element.getValue();
+            if (bitName.equals("disable-nagle")) {
+                assertThat(yangBit.getPosition(), is(0));
+            } else if (bitName.equals("auto-sense-speed")) {
+                assertThat(yangBit.getPosition(), is(1));
+            } else if (bitName.equals("Mb-only")) {
+                assertThat(yangBit.getPosition(), is(2));
+            } else {
+                throw new IOException("Invalid bit name: " + bitName);
+            }
+        }
+
+        // Check bit position map
+        bitPositionMap = bits.getBitPositionMap();
+        assertThat(bitPositionMap.size(), is(3));
+        for (Map.Entry<Integer, YangBit> element : bitPositionMap.entrySet()) {
+            int position = element.getKey();
+            YangBit yangBit = element.getValue();
+            if (position == 0) {
+                assertThat(yangBit.getBitName(), is("disable-nagle"));
+            } else if (position == 1) {
+                assertThat(yangBit.getBitName(), is("auto-sense-speed"));
+            } else if (position == 2) {
+                assertThat(yangBit.getBitName(), is("Mb-only"));
+            } else {
+                throw new IOException("Invalid bit position: " + position);
+            }
+        }
+    }
+
+    /**
+     * Checks bit statement with union.
+     */
+    @Test
+    public void processBitUnionStatement() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/BitUnionStatement.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("type15"));
+
+        assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.UNION));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("union"));
+
+        YangUnion yangUnion = (YangUnion) leafInfo.getDataType().getDataTypeExtendedInfo();
+
+        List<YangType<?>> typeList = yangUnion.getTypeList();
+        ListIterator<YangType<?>> typeListIterator = typeList.listIterator();
+        YangType<?> yangType = typeListIterator.next();
+
+        assertThat(yangType.getDataType(), is(YangDataTypes.BITS));
+        assertThat(yangType.getDataTypeName(), is("bits"));
+
+        // Check bit name map
+        Map<String, YangBit> bitNameMap = ((YangBits) yangType.getDataTypeExtendedInfo()).getBitNameMap();
+        assertThat(bitNameMap.size(), is(3));
+        for (Map.Entry<String, YangBit> element : bitNameMap.entrySet()) {
+            String bitName = element.getKey();
+            YangBit yangBit = element.getValue();
+            if (bitName.equals("disable-nagle")) {
+                assertThat(yangBit.getPosition(), is(0));
+            } else if (bitName.equals("auto-sense-speed")) {
+                assertThat(yangBit.getPosition(), is(1));
+            } else if (bitName.equals("Mb-only")) {
+                assertThat(yangBit.getPosition(), is(2));
+            } else {
+                throw new IOException("Invalid bit name: " + bitName);
+            }
+        }
+
+        // Check bit position map
+        Map<Integer, YangBit> bitPositionMap = ((YangBits) yangType.getDataTypeExtendedInfo()).getBitPositionMap();
+        assertThat(bitPositionMap.size(), is(3));
+        for (Map.Entry<Integer, YangBit> element : bitPositionMap.entrySet()) {
+            int position = element.getKey();
+            YangBit yangBit = element.getValue();
+            if (position == 0) {
+                assertThat(yangBit.getBitName(), is("disable-nagle"));
+            } else if (position == 1) {
+                assertThat(yangBit.getBitName(), is("auto-sense-speed"));
+            } else if (position == 2) {
+                assertThat(yangBit.getBitName(), is("Mb-only"));
+            } else {
+                throw new IOException("Invalid bit position: " + position);
+            }
+        }
+    }
+
+    /**
+     * Checks if enum with same name is not allowed.
+     */
+    @Test(expected = ParserException.class)
+    public void processBitWithDuplicateName() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/BitWithDuplicateName.yang");
+    }
+}
diff --git a/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/CaseListenerTest.java b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/CaseListenerTest.java
new file mode 100644
index 0000000..a032297
--- /dev/null
+++ b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/CaseListenerTest.java
@@ -0,0 +1,239 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.junit.Test;
+import org.onosproject.yang.compiler.datamodel.YangAugment;
+import org.onosproject.yang.compiler.datamodel.YangCase;
+import org.onosproject.yang.compiler.datamodel.YangChoice;
+import org.onosproject.yang.compiler.datamodel.YangContainer;
+import org.onosproject.yang.compiler.datamodel.YangLeaf;
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangNodeType;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.YangUtilsParserManager;
+
+import java.io.IOException;
+import java.util.ListIterator;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.Is.is;
+
+/**
+ * Test cases for case listener.
+ */
+public class CaseListenerTest {
+
+    private final YangUtilsParserManager manager = new YangUtilsParserManager();
+
+    /**
+     * Checks multiple case statement.
+     */
+    @Test
+    public void processCaseStatement() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/CaseStatement.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        YangContainer yangContainer = (YangContainer) yangNode.getChild();
+        assertThat(yangContainer.getName(), is("food"));
+
+        YangChoice yangChoice = (YangChoice) yangContainer.getChild();
+        assertThat(yangChoice.getName(), is("snack"));
+
+        YangCase yangCase1 = (YangCase) yangChoice.getChild();
+        assertThat(yangCase1.getName(), is("sports-arena"));
+
+        // Check whether leaf properties as set correctly.
+        ListIterator<YangLeaf> leafIterator1 = yangCase1.getListOfLeaf().listIterator();
+        YangLeaf leafInfo1 = leafIterator1.next();
+
+        assertThat(leafInfo1.getName(), is("pretzel"));
+
+        YangCase yangCase2 = (YangCase) yangCase1.getNextSibling();
+        assertThat(yangCase2.getName(), is("late-night"));
+
+        // Check whether leaf properties as set correctly.
+        ListIterator<YangLeaf> leafIterator2 = yangCase2.getListOfLeaf().listIterator();
+        YangLeaf leafInfo2 = leafIterator2.next();
+
+        assertThat(leafInfo2.getName(), is("chocolate"));
+    }
+
+    /**
+     * Checks duplicate case in choice.
+     */
+    @Test(expected = ParserException.class)
+    public void processDuplicateCaseInChoice() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/DuplicateCaseInChoice.yang");
+    }
+
+    /**
+     * Checks duplicate leaf at different hierarchy.
+     */
+    @Test(expected = ParserException.class)
+    public void processDuplicateLeafInHierarchy() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/DuplicateLeafInHierarchy.yang");
+    }
+
+    /**
+     * Checks duplicate leaf in different case within choice.
+     */
+    @Test(expected = ParserException.class)
+    public void processDuplicateLeafInChoice() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/DuplicateLeafInChoice.yang");
+    }
+
+    /**
+     * Checks same case within different choice.
+     */
+    @Test
+    public void processCaseStatementSameEntryDifferentChoice() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/CaseStatementSameEntryDifferentChoice.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        YangContainer yangContainer = (YangContainer) yangNode.getChild();
+        assertThat(yangContainer.getName(), is("food"));
+
+        YangChoice yangChoice = (YangChoice) yangContainer.getChild();
+        assertThat(yangChoice.getName(), is("snack"));
+
+        YangCase yangCase1 = (YangCase) yangChoice.getChild();
+        assertThat(yangCase1.getName(), is("sports-arena"));
+
+        // Check whether leaf properties as set correctly.
+        ListIterator<YangLeaf> leafIterator1 = yangCase1.getListOfLeaf().listIterator();
+        YangLeaf leafInfo1 = leafIterator1.next();
+
+        assertThat(leafInfo1.getName(), is("pretzel"));
+
+        YangChoice yangChoice2 = (YangChoice) yangChoice.getNextSibling();
+        assertThat(yangChoice2.getName(), is("lunch"));
+
+        YangCase yangCase2 = (YangCase) yangChoice2.getChild();
+        assertThat(yangCase2.getName(), is("sports-arena"));
+
+        // Check whether leaf properties as set correctly.
+        ListIterator<YangLeaf> leafIterator2 = yangCase2.getListOfLeaf().listIterator();
+        YangLeaf leafInfo2 = leafIterator2.next();
+
+        assertThat(leafInfo2.getName(), is("chocolate"));
+    }
+
+    /**
+     * Checks case choice hierarchy.
+     */
+    @Test
+    public void processCaseChoiceHierarchy() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/CaseChoiceHierarchy.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        YangContainer yangContainer = (YangContainer) yangNode.getChild();
+        assertThat(yangContainer.getName(), is("food"));
+
+        YangChoice yangChoice1 = (YangChoice) yangContainer.getChild();
+        assertThat(yangChoice1.getName(), is("snack"));
+
+        YangCase yangCase1 = (YangCase) yangChoice1.getChild();
+        assertThat(yangCase1.getName(), is("sports-arena"));
+
+        // Check whether leaf properties as set correctly.
+        ListIterator<YangLeaf> leafIterator1 = yangCase1.getListOfLeaf().listIterator();
+        YangLeaf leafInfo1 = leafIterator1.next();
+
+        assertThat(leafInfo1.getName(), is("pretzel"));
+
+        YangCase yangCase2 = (YangCase) yangCase1.getNextSibling();
+        assertThat(yangCase2.getName(), is("late-night"));
+
+        YangChoice yangChoice2 = (YangChoice) yangCase2.getChild();
+        assertThat(yangChoice2.getName(), is("dinner"));
+
+        YangCase yangCase3 = (YangCase) yangChoice2.getChild();
+        assertThat(yangCase3.getName(), is("late-night"));
+
+        // Check whether leaf properties as set correctly.
+        ListIterator<YangLeaf> leafIterator2 = yangCase3.getListOfLeaf().listIterator();
+        YangLeaf leafInfo2 = leafIterator2.next();
+        assertThat(leafInfo2.getName(), is("beer"));
+    }
+
+    /**
+     * Checks case substatement of augment.
+     */
+    @Test
+    public void processCaseSubStatementOfAugment() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/CaseSubStatementOfAugment.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("event"));
+
+        YangAugment augment = ((YangAugment) yangNode.getChild());
+        assertThat(augment.getName(), is("/snmp:snmp/snmp:engine/snmp:listen/snmp:transport"));
+
+        YangCase yangCase = ((YangCase) augment.getChild());
+        assertThat(yangCase.getName(), is("tls"));
+
+        YangCase yangCase1 = ((YangCase) yangCase.getNextSibling());
+        assertThat(yangCase1.getName(), is("dtls"));
+
+        YangContainer container = ((YangContainer) yangCase.getChild());
+        assertThat(container.getName(), is("tls"));
+        assertThat(container.getListOfLeaf().iterator().next().getName(), is("ip"));
+    }
+}
diff --git a/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/ChoiceListenerTest.java b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/ChoiceListenerTest.java
new file mode 100644
index 0000000..834acb8
--- /dev/null
+++ b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/ChoiceListenerTest.java
@@ -0,0 +1,129 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.junit.Test;
+import org.onosproject.yang.compiler.datamodel.YangChoice;
+import org.onosproject.yang.compiler.datamodel.YangContainer;
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangNodeType;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.YangUtilsParserManager;
+
+import java.io.IOException;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.Is.is;
+
+/**
+ * Test cases for choice listener.
+ */
+public class ChoiceListenerTest {
+
+    private final YangUtilsParserManager manager = new YangUtilsParserManager();
+
+    /**
+     * Checks choice statement without body.
+     */
+    @Test
+    public void processChoiceStatementWithoutBody() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/ChoiceStatementWithoutBody.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        YangContainer yangContainer = (YangContainer) yangNode.getChild();
+        assertThat(yangContainer.getName(), is("food"));
+
+        YangChoice yangChoice = (YangChoice) yangContainer.getChild();
+        assertThat(yangChoice.getName(), is("snack"));
+    }
+
+    /**
+     * Checks choice statement with stmt end.
+     */
+    @Test
+    public void processChoiceStatementWithStmtend() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/ChoiceStatementWithStmtend.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        YangContainer yangContainer = (YangContainer) yangNode.getChild();
+        assertThat(yangContainer.getName(), is("food"));
+
+        YangChoice yangChoice = (YangChoice) yangContainer.getChild();
+        assertThat(yangChoice.getName(), is("snack"));
+    }
+
+    /**
+     * Checks choice statement duplicate entry.
+     */
+    @Test(expected = ParserException.class)
+    public void processChoiceStatementDuplicateEntry() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/ChoiceStatementDuplicateEntry.yang");
+    }
+
+    /**
+     * Checks choice statement with same entry in two different container.
+     */
+    @Test
+    public void processChoiceStatementSameEntryDifferentContainer() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/ChoiceStatementSameEntryDifferentContainer.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        YangContainer yangContainer1 = (YangContainer) yangNode.getChild();
+        assertThat(yangContainer1.getName(), is("food1"));
+
+        YangChoice yangChoice1 = (YangChoice) yangContainer1.getChild();
+        assertThat(yangChoice1.getName(), is("snack"));
+
+        YangContainer yangContainer2 = (YangContainer) yangNode.getChild().getNextSibling();
+        assertThat(yangContainer2.getName(), is("food2"));
+
+        YangChoice yangChoice2 = (YangChoice) yangContainer2.getChild();
+        assertThat(yangChoice2.getName(), is("snack"));
+    }
+}
diff --git a/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/ConfigListenerTest.java b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/ConfigListenerTest.java
new file mode 100644
index 0000000..b7a0d41
--- /dev/null
+++ b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/ConfigListenerTest.java
@@ -0,0 +1,495 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.onosproject.yang.compiler.datamodel.YangContainer;
+import org.onosproject.yang.compiler.datamodel.YangLeaf;
+import org.onosproject.yang.compiler.datamodel.YangLeafList;
+import org.onosproject.yang.compiler.datamodel.YangList;
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangNodeType;
+import org.onosproject.yang.compiler.datamodel.YangStatusType;
+import org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.YangUtilsParserManager;
+
+import java.io.IOException;
+import java.util.ListIterator;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.Is.is;
+
+/**
+ * Test cases for config listener.
+ */
+public class ConfigListenerTest {
+
+    @Rule
+    public ExpectedException thrown = ExpectedException.none();
+
+    private final YangUtilsParserManager manager = new YangUtilsParserManager();
+
+    /**
+     * Checks valid config statement.
+     */
+    @Test
+    public void processConfigTrue() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/ConfigTrue.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        // Check whether the Config value is set correctly.
+        assertThat(leafInfo.getName(), is("invalid-interval"));
+        assertThat(leafInfo.isConfig(), is(true));
+    }
+
+    /**
+     * Checks valid config statement.
+     */
+    @Test
+    public void processConfigFalse() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/ConfigFalse.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        // Check whether the Config value is set correctly.
+        assertThat(leafInfo.getName(), is("invalid-interval"));
+        assertThat(leafInfo.isConfig(), is(false));
+    }
+
+    /**
+     * Checks invalid config statement and expects parser exception.
+     */
+    @Test
+    public void processConfigWithoutStatementEnd() throws IOException, ParserException {
+        thrown.expect(ParserException.class);
+        thrown.expectMessage("missing ';' at '}'");
+        YangNode node = manager.getDataModel("src/test/resources/ConfigWithoutStatementEnd.yang");
+    }
+
+    /**
+     * Checks invalid config statement and expects parser exception.
+     */
+    @Test
+    public void processConfigInvalidValue() throws IOException, ParserException {
+        thrown.expect(ParserException.class);
+        thrown.expectMessage("YANG file error : config value invalid is not valid.");
+        YangNode node = manager.getDataModel("src/test/resources/ConfigInvalidValue.yang");
+    }
+
+    /**
+     * Checks invalid config statement and expects parser exception.
+     */
+    @Test
+    public void processConfigEmptyValue() throws IOException, ParserException {
+        thrown.expect(ParserException.class);
+        thrown.expectMessage("no viable alternative at input ';'");
+        YangNode node = manager.getDataModel("src/test/resources/ConfigEmptyValue.yang");
+    }
+
+    /**
+     * Checks config statement as sub-statement of container.
+     */
+    @Test
+    public void processContainerSubStatementConfig() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/ContainerSubStatementConfig.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        // Check whether the config value is set correctly.
+        YangContainer container = (YangContainer) yangNode.getChild();
+        assertThat(container.getName(), is("valid"));
+        assertThat(container.isConfig(), is(true));
+
+        // Check whether leaf properties as set correctly.
+        ListIterator<YangLeaf> leafIterator = container.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("invalid-interval"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("uint16"));
+        assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.UINT16));
+        assertThat(leafInfo.getUnits(), is("\"seconds\""));
+        assertThat(leafInfo.getDescription(), is("\"Interval before a route is declared invalid\""));
+        assertThat(leafInfo.isMandatory(), is(true));
+        assertThat(leafInfo.getStatus(), is(YangStatusType.CURRENT));
+        assertThat(leafInfo.getReference(), is("\"RFC 6020\""));
+    }
+
+    /**
+     * Checks config statement as sub-statement of list.
+     */
+    @Test
+    public void processListSubStatementConfig() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/ListSubStatementConfig.yang");
+
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        // Check whether the list is child of module and config value is set.
+        YangList yangList = (YangList) yangNode.getChild();
+        assertThat(yangList.getName(), is("valid"));
+        assertThat(yangList.isConfig(), is(true));
+
+        // Check whether leaf properties as set correctly.
+        ListIterator<YangLeaf> leafIterator = yangList.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("invalid-interval"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("uint16"));
+        assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.UINT16));
+        assertThat(leafInfo.getUnits(), is("\"seconds\""));
+        assertThat(leafInfo.getDescription(), is("\"Interval before a route is declared invalid\""));
+        assertThat(leafInfo.isMandatory(), is(true));
+        assertThat(leafInfo.getStatus(), is(YangStatusType.CURRENT));
+        assertThat(leafInfo.getReference(), is("\"RFC 6020\""));
+    }
+
+    /**
+     * Checks valid config statement as sub-statement of leaf-list.
+     */
+    @Test
+    public void processLeafListSubStatementConfig() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/LeafListSubStatementConfig.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeafList> leafListIterator = yangNode.getListOfLeafList().listIterator();
+        YangLeafList leafListInfo = leafListIterator.next();
+
+        // Check whether config value is set correctly.
+        assertThat(leafListInfo.getName(), is("invalid-interval"));
+        assertThat(leafListInfo.isConfig(), is(true));
+    }
+
+    /**
+     * Checks config statement's default Value.
+     */
+    @Test
+    public void processConfigDefaultValue() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/ConfigDefaultValue.yang");
+
+        assertThat((node instanceof YangModule), is(true));
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        // Check whether the config value is set correctly.
+        YangContainer container = (YangContainer) yangNode.getChild();
+        assertThat(container.getName(), is("valid"));
+        assertThat(container.isConfig(), is(true));
+
+        // Check whether leaf properties as set correctly.
+        ListIterator<YangLeaf> leafIterator = container.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("invalid-interval"));
+        assertThat(leafInfo.isConfig(), is(true));
+    }
+
+    /**
+     * Checks whether exception is throw when node's parent config set to false,
+     * no node underneath it can have config set to true.
+     */
+    @Test
+    public void processConfigFalseParentContainerChildLeafList() throws IOException, ParserException {
+        thrown.expect(ParserException.class);
+        thrown.expectMessage("Internal parser error detected: Unhandled parsed data at container \"valid\" after "
+                + "processing.\nError Information: If a container has \"config\" set to \"false\", no node underneath "
+                + "it can have \"config\" set to \"true\".");
+        YangNode node = manager.getDataModel("src/test/resources/ConfigFalseParentContainerChildLeafList.yang");
+    }
+
+    /**
+     * Checks whether exception is throw when node's parent config set to false,
+     * no node underneath it can have config set to true.
+     */
+    @Test
+    public void processConfigFalseParentContainerChildLeaf() throws IOException, ParserException {
+        thrown.expect(ParserException.class);
+        thrown.expectMessage("Internal parser error detected: Unhandled parsed data at container \"valid\" after "
+                + "processing.\nError Information: If a container has \"config\" set to \"false\", no node underneath "
+                + "it can have \"config\" set to \"true\".");
+        YangNode node = manager.getDataModel("src/test/resources/ConfigFalseParentContainerChildLeaf.yang");
+    }
+
+    /**
+     * Checks whether exception is throw when node's parent config set to false,
+     * no node underneath it can have config set to true.
+     */
+    @Test
+    public void processConfigFalseParentListChildLeafList() throws IOException, ParserException {
+        thrown.expect(ParserException.class);
+        thrown.expectMessage("Internal parser error detected: Unhandled parsed data at list \"valid\" after"
+                + " processing.\nError Information: If a list has \"config\" set to \"false\", no node underneath"
+                + " it can have \"config\" set to \"true\".");
+        YangNode node = manager.getDataModel("src/test/resources/ConfigFalseParentListChildLeafList.yang");
+    }
+
+    /**
+     * Checks whether exception is throw when node's parent config set to false,
+     * no node underneath it can have config set to true.
+     */
+    @Test
+    public void processConfigFalseParentListChildLeaf() throws IOException, ParserException {
+        thrown.expect(ParserException.class);
+        thrown.expectMessage("Internal parser error detected: Unhandled parsed data at list \"valid\" after"
+                + " processing.\nError Information: If a list has \"config\" set to \"false\", no node underneath"
+                + " it can have \"config\" set to \"true\".");
+        YangNode node = manager.getDataModel("src/test/resources/ConfigFalseParentListChildLeaf.yang");
+    }
+
+    /**
+     * Checks when config is not specified, the default is same as the parent's schema node's
+     * config statement's value.
+     */
+    @Test
+    public void processNoConfigContainerSubStatementContainer() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/NoConfigContainerSubStatementContainer.yang");
+
+        assertThat((node instanceof YangModule), is(true));
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        // Check whether the config value is set correctly.
+        YangContainer container = (YangContainer) yangNode.getChild();
+        assertThat(container.getName(), is("hello"));
+        assertThat(container.isConfig(), is(true));
+
+        YangNode containerNode = container.getChild();
+        assertThat(containerNode instanceof YangContainer, is(true));
+        YangContainer childContainer = (YangContainer) containerNode;
+        assertThat(childContainer.getName(), is("valid"));
+        assertThat(childContainer.isConfig(), is(true));
+    }
+
+    /**
+     * Checks when config is not specified, the default is same as the parent's schema node's
+     * config statement's value.
+     */
+    @Test
+    public void processNoConfigContainerSubStatementLeafList() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/NoConfigContainerSubStatementLeafList.yang");
+
+        assertThat((node instanceof YangModule), is(true));
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        // Check whether the config value is set correctly.
+        YangContainer container = (YangContainer) yangNode.getChild();
+        assertThat(container.getName(), is("valid"));
+        assertThat(container.isConfig(), is(true));
+
+        ListIterator<YangLeafList> leafListIterator = container.getListOfLeafList().listIterator();
+        YangLeafList leafListInfo = leafListIterator.next();
+
+        // Check whether config value is set correctly.
+        assertThat(leafListInfo.getName(), is("invalid-interval"));
+        assertThat(leafListInfo.isConfig(), is(true));
+
+    }
+
+    /**
+     * Checks when config is not specified, the default is same as the parent's schema node's
+     * config statement's value.
+     */
+    @Test
+    public void processNoConfigContainerSubStatementLeaf() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/NoConfigContainerSubStatementLeaf.yang");
+
+        assertThat((node instanceof YangModule), is(true));
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        // Check whether the config value is set correctly.
+        YangContainer container = (YangContainer) yangNode.getChild();
+        assertThat(container.getName(), is("valid"));
+        assertThat(container.isConfig(), is(true));
+
+        // Check whether leaf properties as set correctly.
+        ListIterator<YangLeaf> leafIterator = container.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("invalid-interval"));
+        assertThat(leafInfo.isConfig(), is(true));
+    }
+
+    /**
+     * Checks when config is not specified, the default is same as the parent's schema node's
+     * config statement's value.
+     */
+    @Test
+    public void processNoConfigContainerSubStatementList() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/NoConfigContainerSubStatementList.yang");
+
+        assertThat((node instanceof YangModule), is(true));
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        // Check whether the config value is set correctly.
+        YangContainer container = (YangContainer) yangNode.getChild();
+        assertThat(container.getName(), is("hello"));
+        assertThat(container.isConfig(), is(true));
+
+        YangNode listNode = container.getChild();
+        assertThat(listNode instanceof YangList, is(true));
+        YangList childList = (YangList) listNode;
+        assertThat(childList.getName(), is("valid"));
+        assertThat(childList.isConfig(), is(true));
+
+    }
+
+    /**
+     * Checks when config is not specified, the default is same as the parent's schema node's
+     * config statement's value.
+     */
+    @Test
+    public void processNoConfigListSubStatementContainer() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/NoConfigListSubStatementContainer.yang");
+
+        assertThat((node instanceof YangModule), is(true));
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        // Check whether the config value is set correctly.
+        YangList list1 = (YangList) yangNode.getChild();
+        assertThat(list1.getName(), is("list1"));
+        assertThat(list1.isConfig(), is(true));
+
+        YangNode containerNode = list1.getChild();
+        assertThat(containerNode instanceof YangContainer, is(true));
+        YangContainer childContainer = (YangContainer) containerNode;
+        assertThat(childContainer.getName(), is("container1"));
+        assertThat(childContainer.isConfig(), is(true));
+    }
+
+    /**
+     * Checks when config is not specified, the default is same as the parent's schema node's
+     * config statement's value.
+     */
+    @Test
+    public void processNoConfigListSubStatementLeaf() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/NoConfigListSubStatementLeaf.yang");
+
+        assertThat((node instanceof YangModule), is(true));
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        // Check whether the config value is set correctly.
+        YangList list1 = (YangList) yangNode.getChild();
+        assertThat(list1.getName(), is("valid"));
+        assertThat(list1.isConfig(), is(true));
+
+        // Check whether leaf properties as set correctly.
+        ListIterator<YangLeaf> leafIterator = list1.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("invalid-interval"));
+        assertThat(leafInfo.isConfig(), is(true));
+    }
+
+    /**
+     * Checks when config is not specified, the default is same as the parent's schema node's
+     * config statement's value.
+     */
+    @Test
+    public void processNoConfigListSubStatementList() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/NoConfigListSubStatementList.yang");
+
+        assertThat((node instanceof YangModule), is(true));
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        // Check whether the config value is set correctly.
+        YangList list1 = (YangList) yangNode.getChild();
+        assertThat(list1.getName(), is("valid"));
+        assertThat(list1.isConfig(), is(true));
+
+        YangNode listNode = list1.getChild();
+        assertThat(listNode instanceof YangList, is(true));
+        YangList childList = (YangList) listNode;
+        assertThat(childList.getName(), is("list1"));
+        assertThat(childList.isConfig(), is(true));
+    }
+}
diff --git a/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/ContactListenerTest.java b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/ContactListenerTest.java
new file mode 100644
index 0000000..4b1ef2d
--- /dev/null
+++ b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/ContactListenerTest.java
@@ -0,0 +1,94 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.YangUtilsParserManager;
+
+import java.io.IOException;
+
+import static org.hamcrest.core.Is.is;
+import static org.junit.Assert.assertThat;
+
+/**
+ * Test cases for testing contact listener functionality.
+ */
+public class ContactListenerTest {
+
+    @Rule
+    public ExpectedException thrown = ExpectedException.none();
+
+    private final YangUtilsParserManager manager = new YangUtilsParserManager();
+
+    /**
+     * Checks if contact listener updates the data model tree.
+     */
+    @Test
+    public void processContactValidEntry() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/ContactValidEntry.yang");
+
+        // Checks for the contact value in data model tree.
+        assertThat(((YangModule) node).getContact(), is("\"WG List:  <mailto:spring@ietf.org>\nEditor:    "
+                + "Stephane Litkowski\n           " + "<mailto:stephane.litkowski@orange.com>\""));
+    }
+
+    /**
+     * Checks that contact must be present only once.
+     */
+    @Test(expected = ParserException.class)
+    public void processContactDualEntryTest() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/ContactDualEntryTest.yang");
+
+    }
+
+    /**
+     * Checks that contact can have a string value without double quotes.
+     */
+    @Test
+    public void processContactWithoutQuotes() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/ContactWithoutQuotes.yang");
+
+        // Checks for the contact value in data model tree.
+        assertThat(((YangModule) node).getContact(), is("WG"));
+    }
+
+    /**
+     * Checks if contact is not empty.
+     */
+    @Test(expected = ParserException.class)
+    public void processContactWithEmptyString() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/ContactWithEmptyString.yang");
+    }
+
+    /**
+     * Checks that contact must be present after namespace.
+     */
+    @Test(expected = ParserException.class)
+    public void processContactIncorrectOrder() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/ContactIncorrectOrder.yang");
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/ContainerListenerTest.java b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/ContainerListenerTest.java
new file mode 100644
index 0000000..572131e
--- /dev/null
+++ b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/ContainerListenerTest.java
@@ -0,0 +1,232 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.onosproject.yang.compiler.datamodel.YangContainer;
+import org.onosproject.yang.compiler.datamodel.YangLeaf;
+import org.onosproject.yang.compiler.datamodel.YangList;
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangNodeType;
+import org.onosproject.yang.compiler.datamodel.YangStatusType;
+import org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.YangUtilsParserManager;
+
+import java.io.IOException;
+import java.util.ListIterator;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.Is.is;
+
+/**
+ * Test cases for testing container listener.
+ */
+public class ContainerListenerTest {
+
+    @Rule
+    public ExpectedException thrown = ExpectedException.none();
+
+    private final YangUtilsParserManager manager = new YangUtilsParserManager();
+
+    /**
+     * Checks container statement as sub-statement of module.
+     */
+    @Test
+    public void processModuleSubStatementContainer() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/ModuleSubStatementContainer.yang");
+
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        // Check whether the container is child of module
+        YangContainer yangContainer = (YangContainer) yangNode.getChild();
+        assertThat(yangContainer.getName(), is("valid"));
+    }
+
+    /**
+     * Checks if container identifier in module is duplicate.
+     */
+    @Test(expected = ParserException.class)
+    public void processModuleDuplicateContainer() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/ModuleDuplicateContainer.yang");
+    }
+
+    /**
+     * Checks if container identifier in container is duplicate.
+     */
+    @Test(expected = ParserException.class)
+    public void processContainerDuplicateContainer() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/ContainerDuplicateContainer.yang");
+    }
+
+    /**
+     * Checks if container identifier in list is duplicate.
+     */
+    @Test(expected = ParserException.class)
+    public void processListDuplicateContainer() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/ListDuplicateContainer.yang");
+    }
+
+    /**
+     * Checks if container identifier collides with list at same level.
+     */
+    @Test(expected = ParserException.class)
+    public void processDuplicateContainerAndList() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/DuplicateContainerAndList.yang");
+    }
+
+    /**
+     * Checks container statement as sub-statement of container.
+     */
+    @Test
+    public void processContainerSubStatementContainer() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/ContainerSubStatementContainer.yang");
+
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        // Check whether the container is child of module
+        YangContainer yangContainer = (YangContainer) yangNode.getChild();
+        assertThat(yangContainer.getName(), is("ospf"));
+
+        // Check whether the container is child of container
+        YangContainer yangContainer1 = (YangContainer) yangContainer.getChild();
+        assertThat(yangContainer1.getName(), is("valid"));
+    }
+
+    /**
+     * Checks container statement as sub-statement of list.
+     */
+    @Test
+    public void processListSubStatementContainer() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/ListSubStatementContainer.yang");
+
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        // Check whether the list is child of module
+        YangList yangList1 = (YangList) yangNode.getChild();
+        assertThat(yangList1.getName(), is("ospf"));
+
+        ListIterator<String> keyList = yangList1.getKeyList().listIterator();
+        assertThat(keyList.next(), is("process-id"));
+
+        // Check whether the list is child of list
+        YangContainer yangContainer = (YangContainer) yangList1.getChild();
+        assertThat(yangContainer.getName(), is("interface"));
+    }
+
+    /**
+     * Checks container with all its sub-statements.
+     */
+    @Test
+    public void processContainerSubStatements() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/ContainerSubStatements.yang");
+
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        // Check whether the container is child of module
+        YangContainer yangContainer = (YangContainer) yangNode.getChild();
+
+        // Check whether container properties as set correctly.
+        assertThat(yangContainer.getName(), is("ospf"));
+
+        assertThat(yangContainer.isConfig(), is(true));
+        assertThat(yangContainer.getPresence(), is("\"ospf logs\""));
+        assertThat(yangContainer.getDescription(), is("\"container description\""));
+        assertThat(yangContainer.getStatus(), is(YangStatusType.CURRENT));
+        assertThat(yangContainer.getReference(), is("\"container reference\""));
+
+        // Check whether leaf properties as set correctly.
+        ListIterator<YangLeaf> leafIterator = yangContainer.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("invalid-interval"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("uint16"));
+        assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.UINT16));
+        assertThat(leafInfo.getUnits(), is("\"seconds\""));
+        assertThat(leafInfo.getStatus(), is(YangStatusType.CURRENT));
+        assertThat(leafInfo.getReference(), is("\"RFC 6020\""));
+    }
+
+    /**
+     * Checks cardinality of sub-statements of container.
+     */
+    @Test
+    public void processContainerSubStatementCardinality() throws IOException, ParserException {
+        thrown.expect(ParserException.class);
+        thrown.expectMessage("YANG file error: \"reference\" is defined more than once in \"container valid\".");
+        YangNode node = manager.getDataModel("src/test/resources/ContainerSubStatementCardinality.yang");
+    }
+
+    /**
+     * Checks container as root node.
+     */
+    @Test
+    public void processContainerRootNode() throws IOException, ParserException {
+        thrown.expect(ParserException.class);
+        thrown.expectMessage("no viable alternative at input 'container'");
+        YangNode node = manager.getDataModel("src/test/resources/ContainerRootNode.yang");
+    }
+
+    /**
+     * Checks invalid identifier for container statement.
+     */
+    @Test
+    public void processContainerInvalidIdentifier() throws IOException, ParserException {
+        thrown.expect(ParserException.class);
+        thrown.expectMessage("YANG file error : container name 1valid is not valid.");
+        YangNode node = manager.getDataModel("src/test/resources/ContainerInvalidIdentifier.yang");
+    }
+}
diff --git a/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/Decimal64ListenerTest.java b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/Decimal64ListenerTest.java
new file mode 100644
index 0000000..8a54a51
--- /dev/null
+++ b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/Decimal64ListenerTest.java
@@ -0,0 +1,636 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.hamcrest.core.Is;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.onosproject.yang.compiler.datamodel.YangDecimal64;
+import org.onosproject.yang.compiler.datamodel.YangDerivedInfo;
+import org.onosproject.yang.compiler.datamodel.YangLeaf;
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangNodeType;
+import org.onosproject.yang.compiler.datamodel.YangRangeInterval;
+import org.onosproject.yang.compiler.datamodel.YangRangeRestriction;
+import org.onosproject.yang.compiler.datamodel.YangType;
+import org.onosproject.yang.compiler.datamodel.YangTypeDef;
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes;
+import org.onosproject.yang.compiler.linker.exceptions.LinkerException;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.YangUtilsParserManager;
+
+import java.io.IOException;
+import java.math.BigDecimal;
+import java.util.ListIterator;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.Is.is;
+
+/**
+ * Test cases for decimal64 listener.
+ */
+public class Decimal64ListenerTest {
+    private final YangUtilsParserManager manager = new YangUtilsParserManager();
+    @Rule
+    public ExpectedException thrown = ExpectedException.none();
+
+    /**
+     * Checks decimal64 statement with fraction-digits.
+     */
+    @Test
+    public void processDecimal64TypeStatement() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/decimal64/Decimal64TypeStatement.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), Is.is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("validDecimal"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("decimal64"));
+        assertThat(leafInfo.getDataType().getDataType(), Is.is(YangDataTypes.DECIMAL64));
+        assertThat(((YangDecimal64) leafInfo.getDataType().getDataTypeExtendedInfo()).getFractionDigit(),
+                   is(2));
+    }
+
+    /**
+     * Checks decimal64 statement with range statement.
+     */
+    @Test
+    public void processDecimal64TypeWithRangeStatement() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/decimal64/Decimal64TypeWithRangeStatement.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("validDecimal"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("decimal64"));
+        assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.DECIMAL64));
+        assertThat(((YangDecimal64) leafInfo.getDataType().getDataTypeExtendedInfo()).getFractionDigit(),
+                   is(8));
+
+        YangRangeRestriction rangeRestriction = ((YangDecimal64<YangRangeRestriction>) leafInfo.getDataType()
+                .getDataTypeExtendedInfo())
+                .getRangeRestrictedExtendedInfo();
+
+        ListIterator<YangRangeInterval> rangeListIterator = rangeRestriction.getAscendingRangeIntervals()
+                .listIterator();
+        YangRangeInterval rangeInterval = rangeListIterator.next();
+        assertThat(((YangDecimal64) rangeInterval.getStartValue()).getValue().doubleValue(), is(-92233720368.54775808));
+        assertThat(((YangDecimal64) rangeInterval.getEndValue()).getValue().doubleValue(), is(92233720368.54775807));
+    }
+
+    /**
+     * Successful validation of decimal64 statement.
+     */
+    @Test
+    public void processDecimal64ValueSuccessfulValidation() throws IOException, ParserException, DataModelException {
+
+        YangNode node = manager.getDataModel("src/test/resources/decimal64/Decimal64TypeValidation.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+        YangDecimal64 decimal64 = (YangDecimal64) leafInfo.getDataType().getDataTypeExtendedInfo();
+
+        assertThat(leafInfo.getName(), is("validDecimal"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("decimal64"));
+        assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.DECIMAL64));
+        assertThat(decimal64.getFractionDigit(), is(18));
+
+        decimal64.setValue(new BigDecimal(-9.223372036854775808));
+        decimal64.validateDecimal64();
+        decimal64.setValue(new BigDecimal(9.223372036854775807));
+        decimal64.validateDecimal64();
+    }
+
+    /**
+     * Failure validation of decimal64 statement.
+     */
+    @Test
+    public void processDecimal64ValueFailureValidation() throws IOException, ParserException, DataModelException {
+        thrown.expect(DataModelException.class);
+        thrown.expectMessage(
+                "YANG file error : value is not in decimal64 range.");
+
+        YangNode node = manager.getDataModel("src/test/resources/decimal64/Decimal64TypeValidation.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+        YangDecimal64 decimal64 = (YangDecimal64) leafInfo.getDataType().getDataTypeExtendedInfo();
+
+        assertThat(leafInfo.getName(), is("validDecimal"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("decimal64"));
+        assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.DECIMAL64));
+        assertThat(decimal64.getFractionDigit(), is(18));
+
+        decimal64.setValue(new BigDecimal(-92233720368547758.08));
+        // validation should fail
+        decimal64.validateDecimal64();
+    }
+
+    /**
+     * Validation of invalid maximum value limit of fraction-digits.
+     */
+    @Test
+    public void processDecimal64InvalidMaxFraction() throws IOException, ParserException, DataModelException {
+        thrown.expect(ParserException.class);
+        thrown.expectMessage("YANG file error : fraction-digits value should be between 1 and 18.");
+
+        manager.getDataModel("src/test/resources/decimal64/Decimal64TypeInvalidMaxValueFraction.yang");
+    }
+
+    /**
+     * Validation of invalid (0) minimum value limit of fraction-digits.
+     */
+    @Test
+    public void processDecimal64InvalidMinFraction1() throws IOException, ParserException, DataModelException {
+        thrown.expect(ParserException.class);
+        thrown.expectMessage("YANG file error : fraction-digits value should be between 1 and 18.");
+
+        manager.getDataModel("src/test/resources/decimal64/Decimal64TypeInvalidMinValueFraction1.yang");
+    }
+
+    /**
+     * Validation of invalid (-1) minimum value limit of fraction-digits.
+     */
+    @Test
+    public void processDecimal64InvalidMinFraction2() throws IOException, ParserException, DataModelException {
+        thrown.expect(ParserException.class);
+        thrown.expectMessage("YANG file error : fraction-digits value should be between 1 and 18.");
+
+        manager.getDataModel("src/test/resources/decimal64/Decimal64TypeInvalidMinValueFraction2.yang");
+    }
+
+    /**
+     * Validation of decimal64 range statement.
+     */
+    @Test
+    public void processDecimal64TypeWithMultiValueRangeStatement() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/decimal64/Decimal64TypeWithMultiValueRangeStmnt.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("validDecimal"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("decimal64"));
+        assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.DECIMAL64));
+        assertThat(((YangDecimal64) leafInfo.getDataType().getDataTypeExtendedInfo()).getFractionDigit(),
+                   is(18));
+
+        YangRangeRestriction rangeRestriction = ((YangDecimal64<YangRangeRestriction>) leafInfo.getDataType()
+                .getDataTypeExtendedInfo())
+                .getRangeRestrictedExtendedInfo();
+
+        ListIterator<YangRangeInterval> rangeListIterator = rangeRestriction.getAscendingRangeIntervals()
+                .listIterator();
+        // range "1 .. 3.14 | 10 | 20..max";
+        // check first range 1 .. 3.14
+        YangRangeInterval rangeInterval = rangeListIterator.next();
+        assertThat(((YangDecimal64) rangeInterval.getStartValue()).getValue().doubleValue(), is(-9.22));
+        assertThat(((YangDecimal64) rangeInterval.getEndValue()).getValue().doubleValue(), is(7.22));
+        // check second range 10
+        rangeInterval = rangeListIterator.next();
+        assertThat(((YangDecimal64) rangeInterval.getStartValue()).getValue().doubleValue(), is(8.0));
+        assertThat(((YangDecimal64) rangeInterval.getEndValue()).getValue().doubleValue(), is(8.0));
+        // check third range 20..max
+        rangeInterval = rangeListIterator.next();
+        assertThat(((YangDecimal64) rangeInterval.getStartValue()).getValue().doubleValue(), is(9.0));
+        assertThat(((YangDecimal64) rangeInterval.getEndValue()).getValue().doubleValue(), is(9.223372036854776));
+    }
+
+    /**
+     * Validation of decimal64 with invalid range.
+     */
+    @Test
+    public void processDecimal64InvalidRange() throws IOException, ParserException, DataModelException {
+        thrown.expect(ParserException.class);
+        thrown.expectMessage(
+                "YANG file error : decimal64 validation failed.decimal64 in 7 at 12" +
+                        " in src/test/resources/decimal64/Decimal64TypeInvalidRangeStmnt.yang\"");
+
+        manager.getDataModel("src/test/resources/decimal64/Decimal64TypeInvalidRangeStmnt.yang");
+    }
+
+    /**
+     * Validation of decimal64 without fraction-digits. Fraction-digits must be present for decimal64.
+     */
+    @Test
+    public void processDecimal64WithoutFraction() throws IOException, ParserException, DataModelException {
+        thrown.expect(ParserException.class);
+        thrown.expectMessage("YANG file error : a type decimal64 must have fraction-digits statement.");
+
+        manager.getDataModel("src/test/resources/decimal64/Decimal64TypeWithoutFraction.yang");
+    }
+
+    /**
+     * Checks decimal64 with typedef statement.
+     */
+    @Test
+    public void processDecimal64TypedefStatement() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/decimal64/Decimal64TypedefStatement.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("setFourDecimal"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("validDecimal"));
+        YangType<YangDerivedInfo> derivedInfoType = (YangType<YangDerivedInfo>) leafInfo.getDataType();
+        YangDerivedInfo derivedInfo = (YangDerivedInfo) derivedInfoType.getDataTypeExtendedInfo();
+        YangTypeDef typedef = (YangTypeDef) derivedInfo.getReferredTypeDef();
+        assertThat(typedef.getName(), is("validDecimal"));
+
+        assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.DERIVED));
+        YangType type = typedef.getTypeList().iterator().next();
+        assertThat(type.getDataType(), is(YangDataTypes.DECIMAL64));
+        assertThat(type.getDataTypeName(), is("decimal64"));
+        YangType<YangDecimal64> decimal64Type = (YangType<YangDecimal64>) typedef.getTypeList().iterator().next();
+        YangDecimal64 decimal64 = decimal64Type.getDataTypeExtendedInfo();
+        assertThat(decimal64.getFractionDigit(), is(4));
+    }
+
+    /**
+     * Checks decimal64 with multiple typedef statement.
+     */
+    @Test
+    public void processDecimal64MultiTypedefStatement() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/decimal64/Decimal64MultiTypedefStatement.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        // check leaf type
+        assertThat(leafInfo.getName(), is("lowerDecimal"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("midDecimal"));
+        YangType<YangDerivedInfo> derivedInfoType = (YangType<YangDerivedInfo>) leafInfo.getDataType();
+        assertThat(derivedInfoType.getDataType(), is(YangDataTypes.DERIVED));
+        YangDerivedInfo derivedInfo = (YangDerivedInfo) derivedInfoType.getDataTypeExtendedInfo();
+
+        // check previous typedef
+        YangTypeDef prevTypedef = (YangTypeDef) derivedInfo.getReferredTypeDef();
+        assertThat(prevTypedef.getName(), is("midDecimal"));
+        YangType type = prevTypedef.getTypeList().iterator().next();
+        assertThat(type.getDataType(), is(YangDataTypes.DERIVED));
+        derivedInfo = (YangDerivedInfo) type.getDataTypeExtendedInfo();
+
+        // check top typedef
+        YangTypeDef topTypedef = (YangTypeDef) derivedInfo.getReferredTypeDef();
+        assertThat(topTypedef.getName(), is("topDecimal"));
+        type = topTypedef.getTypeList().iterator().next();
+        assertThat(type.getDataType(), is(YangDataTypes.DECIMAL64));
+        assertThat(type.getDataTypeName(), is("decimal64"));
+        YangType<YangDecimal64> decimal64Type = (YangType<YangDecimal64>) type;
+        YangDecimal64 decimal64 = decimal64Type.getDataTypeExtendedInfo();
+        assertThat(decimal64.getFractionDigit(), is(4));
+    }
+
+    /**
+     * Checks decimal64 with multiple typedef with single range statement.
+     * Range value in typedef statement.
+     */
+    @Test
+    public void processDecimal64MultiTypedefRangeStatement() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/decimal64/Decimal64MultiTypedefRangeStatement.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        // check leaf type
+        assertThat(leafInfo.getName(), is("lowerDecimal"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("midDecimal"));
+        YangType<YangDerivedInfo> derivedInfoType = (YangType<YangDerivedInfo>) leafInfo.getDataType();
+        assertThat(derivedInfoType.getDataType(), is(YangDataTypes.DERIVED));
+        YangDerivedInfo derivedInfo = (YangDerivedInfo) derivedInfoType.getDataTypeExtendedInfo();
+
+        // Check range restriction
+        YangRangeRestriction rangeRestriction = (YangRangeRestriction) derivedInfo.getResolvedExtendedInfo();
+        ListIterator<YangRangeInterval> rangeListIterator = rangeRestriction.getAscendingRangeIntervals()
+                .listIterator();
+        YangRangeInterval rangeInterval = rangeListIterator.next();
+        assertThat(((YangDecimal64) rangeInterval.getStartValue()).getValue().doubleValue(), is(1.0));
+        assertThat(((YangDecimal64) rangeInterval.getEndValue()).getValue().doubleValue(), is(12.0));
+
+        // check previous typedef
+        YangTypeDef prevTypedef = (YangTypeDef) derivedInfo.getReferredTypeDef();
+        assertThat(prevTypedef.getName(), is("midDecimal"));
+        YangType type = prevTypedef.getTypeList().iterator().next();
+        assertThat(type.getDataType(), is(YangDataTypes.DERIVED));
+        derivedInfo = (YangDerivedInfo) type.getDataTypeExtendedInfo();
+
+        // check top typedef
+        YangTypeDef topTypedef = (YangTypeDef) derivedInfo.getReferredTypeDef();
+        assertThat(topTypedef.getName(), is("topDecimal"));
+        type = topTypedef.getTypeList().iterator().next();
+        assertThat(type.getDataType(), is(YangDataTypes.DECIMAL64));
+        assertThat(type.getDataTypeName(), is("decimal64"));
+        YangType<YangDecimal64> decimal64Type = (YangType<YangDecimal64>) type;
+        YangDecimal64 decimal64 = decimal64Type.getDataTypeExtendedInfo();
+        assertThat(decimal64.getFractionDigit(), is(4));
+
+        // Check range restriction
+        rangeRestriction = (YangRangeRestriction) decimal64.getRangeRestrictedExtendedInfo();
+        rangeListIterator = rangeRestriction.getAscendingRangeIntervals().listIterator();
+        rangeInterval = rangeListIterator.next();
+        assertThat(((YangDecimal64) rangeInterval.getStartValue()).getValue().doubleValue(), is(1.0));
+        assertThat(((YangDecimal64) rangeInterval.getEndValue()).getValue().doubleValue(), is(12.0));
+    }
+
+    /**
+     * Checks decimal64 with multiple typedef with single range statement.
+     * Range value in leaf statement.
+     */
+    @Test
+    public void processDecimal64MultiTypedefRangeInLeafStatement() throws IOException, ParserException {
+
+        YangNode node = manager
+                .getDataModel("src/test/resources/decimal64/Decimal64MultiTypedefRangeInLeafStatement.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        // check leaf type
+        assertThat(leafInfo.getName(), is("lowerDecimal"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("midDecimal"));
+        YangType<YangDerivedInfo> derivedInfoType = (YangType<YangDerivedInfo>) leafInfo.getDataType();
+        assertThat(derivedInfoType.getDataType(), is(YangDataTypes.DERIVED));
+        YangDerivedInfo derivedInfo = (YangDerivedInfo) derivedInfoType.getDataTypeExtendedInfo();
+
+        // Check range restriction
+        YangRangeRestriction rangeRestriction = (YangRangeRestriction) derivedInfo.getResolvedExtendedInfo();
+        ListIterator<YangRangeInterval> rangeListIterator = rangeRestriction.getAscendingRangeIntervals()
+                .listIterator();
+        YangRangeInterval rangeInterval = rangeListIterator.next();
+        assertThat(((YangDecimal64) rangeInterval.getStartValue()).getValue().doubleValue(), is(1.0));
+        assertThat(((YangDecimal64) rangeInterval.getEndValue()).getValue().doubleValue(), is(12.0));
+
+        // check previous typedef
+        YangTypeDef prevTypedef = (YangTypeDef) derivedInfo.getReferredTypeDef();
+        assertThat(prevTypedef.getName(), is("midDecimal"));
+        YangType type = prevTypedef.getTypeList().iterator().next();
+        assertThat(type.getDataType(), is(YangDataTypes.DERIVED));
+        derivedInfo = (YangDerivedInfo) type.getDataTypeExtendedInfo();
+
+        // check top typedef
+        YangTypeDef topTypedef = (YangTypeDef) derivedInfo.getReferredTypeDef();
+        assertThat(topTypedef.getName(), is("topDecimal"));
+        type = topTypedef.getTypeList().iterator().next();
+        assertThat(type.getDataType(), is(YangDataTypes.DECIMAL64));
+        assertThat(type.getDataTypeName(), is("decimal64"));
+        YangType<YangDecimal64> decimal64Type = (YangType<YangDecimal64>) type;
+        YangDecimal64 decimal64 = decimal64Type.getDataTypeExtendedInfo();
+        assertThat(decimal64.getFractionDigit(), is(4));
+    }
+
+    /**
+     * Checks decimal64 with multiple typedef with multiple range statement.
+     * Having more restricted range at leaf.
+     */
+    @Test
+    public void processDecimal64MultiTypedefMultipleRangeStatement() throws IOException, ParserException {
+
+        YangNode node = manager
+                .getDataModel("src/test/resources/decimal64/Decimal64MultiTypedefMultiRangeStatement.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        // check leaf type
+        assertThat(leafInfo.getName(), is("lowerDecimal"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("midDecimal"));
+        YangType<YangDerivedInfo> derivedInfoType = (YangType<YangDerivedInfo>) leafInfo.getDataType();
+        assertThat(derivedInfoType.getDataType(), is(YangDataTypes.DERIVED));
+        YangDerivedInfo derivedInfo = (YangDerivedInfo) derivedInfoType.getDataTypeExtendedInfo();
+
+        // Check range restriction
+        YangRangeRestriction rangeRestriction = (YangRangeRestriction) derivedInfo.getResolvedExtendedInfo();
+
+        ListIterator<YangRangeInterval> rangeListIterator = rangeRestriction.getAscendingRangeIntervals()
+                .listIterator();
+        YangRangeInterval rangeInterval = rangeListIterator.next();
+        assertThat(((YangDecimal64) rangeInterval.getStartValue()).getValue().doubleValue(), is(4.0));
+        assertThat(((YangDecimal64) rangeInterval.getEndValue()).getValue().doubleValue(), is(11.0));
+
+        // check previous typedef
+        YangTypeDef prevTypedef = (YangTypeDef) derivedInfo.getReferredTypeDef();
+        assertThat(prevTypedef.getName(), is("midDecimal"));
+        YangType type = prevTypedef.getTypeList().iterator().next();
+        assertThat(type.getDataType(), is(YangDataTypes.DERIVED));
+        derivedInfo = (YangDerivedInfo) type.getDataTypeExtendedInfo();
+
+        // check top typedef
+        YangTypeDef topTypedef = (YangTypeDef) derivedInfo.getReferredTypeDef();
+        assertThat(topTypedef.getName(), is("topDecimal"));
+        type = topTypedef.getTypeList().iterator().next();
+        assertThat(type.getDataType(), is(YangDataTypes.DECIMAL64));
+        assertThat(type.getDataTypeName(), is("decimal64"));
+        YangType<YangDecimal64> decimal64Type = (YangType<YangDecimal64>) type;
+        YangDecimal64 decimal64 = decimal64Type.getDataTypeExtendedInfo();
+        assertThat(decimal64.getFractionDigit(), is(4));
+
+        // Check range restriction
+        rangeRestriction = (YangRangeRestriction) decimal64.getRangeRestrictedExtendedInfo();
+        rangeListIterator = rangeRestriction.getAscendingRangeIntervals().listIterator();
+        rangeInterval = rangeListIterator.next();
+        assertThat(((YangDecimal64) rangeInterval.getStartValue()).getValue().doubleValue(), is(1.0));
+        assertThat(((YangDecimal64) rangeInterval.getEndValue()).getValue().doubleValue(), is(12.0));
+    }
+
+    /**
+     * Checks decimal64 with multiple typedef with multiple range statement.
+     * But having more restricted range at top of typedef.
+     */
+    @Test
+    public void processDecimal64MultiTypedefMultiInvalidRangeStatement() throws IOException, LinkerException {
+        thrown.expect(LinkerException.class);
+        thrown.expectMessage(
+                "Range interval doesn't fall within the referred restriction ranges" +
+                        " restriction ranges. in 0 at 0 in src/test/resources/decimal64/" +
+                        "Decimal64MultiTypedefMultiInvalidRangeStatement.yang\"type." +
+                        " in 19 at 12 in src/test/resources/decimal64/Decimal64MultiTypedef" +
+                        "MultiInvalidRangeStatement.yang");
+
+        manager.getDataModel("src/test/resources/decimal64/Decimal64MultiTypedefMultiInvalidRangeStatement.yang");
+    }
+
+    /**
+     * Checks decimal64 with multiple typedef with max range statement.
+     */
+    @Test
+    public void processDecimal64MultiTypedefWithMaxRange() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/decimal64/Decimal64MultiTypedefWithMaxRange.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        // check leaf type
+        assertThat(leafInfo.getName(), is("lowerDecimal"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("midDecimal"));
+        YangType<YangDerivedInfo> derivedInfoType = (YangType<YangDerivedInfo>) leafInfo.getDataType();
+        assertThat(derivedInfoType.getDataType(), is(YangDataTypes.DERIVED));
+        YangDerivedInfo derivedInfo = (YangDerivedInfo) derivedInfoType.getDataTypeExtendedInfo();
+
+        // Check range restriction
+        YangRangeRestriction rangeRestriction = (YangRangeRestriction) derivedInfo.getResolvedExtendedInfo();
+
+        ListIterator<YangRangeInterval> rangeListIterator = rangeRestriction.getAscendingRangeIntervals()
+                .listIterator();
+        YangRangeInterval rangeInterval = rangeListIterator.next();
+        assertThat(((YangDecimal64) rangeInterval.getStartValue()).getValue().doubleValue(), is(4.0));
+        assertThat(((YangDecimal64) rangeInterval.getEndValue()).getValue().doubleValue(), is(12.0));
+
+        // check previous typedef
+        YangTypeDef prevTypedef = (YangTypeDef) derivedInfo.getReferredTypeDef();
+        assertThat(prevTypedef.getName(), is("midDecimal"));
+        YangType type = prevTypedef.getTypeList().iterator().next();
+        assertThat(type.getDataType(), is(YangDataTypes.DERIVED));
+        derivedInfo = (YangDerivedInfo) type.getDataTypeExtendedInfo();
+
+        // check top typedef
+        YangTypeDef topTypedef = (YangTypeDef) derivedInfo.getReferredTypeDef();
+        assertThat(topTypedef.getName(), is("topDecimal"));
+        type = topTypedef.getTypeList().iterator().next();
+        assertThat(type.getDataType(), is(YangDataTypes.DECIMAL64));
+        assertThat(type.getDataTypeName(), is("decimal64"));
+        YangType<YangDecimal64> decimal64Type = (YangType<YangDecimal64>) type;
+        YangDecimal64 decimal64 = decimal64Type.getDataTypeExtendedInfo();
+        assertThat(decimal64.getFractionDigit(), is(4));
+
+        // Check range restriction
+        rangeRestriction = (YangRangeRestriction) decimal64.getRangeRestrictedExtendedInfo();
+        rangeListIterator = rangeRestriction.getAscendingRangeIntervals().listIterator();
+        rangeInterval = rangeListIterator.next();
+        assertThat(((YangDecimal64) rangeInterval.getStartValue()).getValue().doubleValue(), is(1.0));
+        assertThat(((YangDecimal64) rangeInterval.getEndValue()).getValue().doubleValue(), is(12.0));
+    }
+}
diff --git a/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/DefaultListenerTest.java b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/DefaultListenerTest.java
new file mode 100644
index 0000000..b2c0ef0
--- /dev/null
+++ b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/DefaultListenerTest.java
@@ -0,0 +1,525 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.onosproject.yang.compiler.datamodel.YangChoice;
+import org.onosproject.yang.compiler.datamodel.YangContainer;
+import org.onosproject.yang.compiler.datamodel.YangDerivedInfo;
+import org.onosproject.yang.compiler.datamodel.YangLeaf;
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangNodeType;
+import org.onosproject.yang.compiler.datamodel.YangType;
+import org.onosproject.yang.compiler.datamodel.YangTypeDef;
+import org.onosproject.yang.compiler.datamodel.utils.builtindatatype.DataTypeException;
+import org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes;
+import org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangInt64;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.YangUtilsParserManager;
+
+import java.io.IOException;
+import java.util.ListIterator;
+
+import static org.hamcrest.core.Is.is;
+import static org.junit.Assert.assertThat;
+
+/**
+ * Test cases for testing default listener functionality.
+ */
+public class DefaultListenerTest {
+    @Rule
+    public ExpectedException thrown = ExpectedException.none();
+
+    private final YangUtilsParserManager manager = new YangUtilsParserManager();
+
+    /**
+     * Checks if default value is set correctly.
+     */
+    @Test
+    public void processDefaultValueInLeafSubStatement() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/default/DefaultValueInLeafSubStatement.yang");
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("invalid-interval"));
+        assertThat(leafInfo.getDefaultValueInString(), is("1"));
+    }
+
+    /**
+     * Validates default invalid value in leaf.
+     */
+    @Test
+    public void processDefaultInalueInLeafSubStatement() throws IOException, ParserException {
+
+        thrown.expect(DataTypeException.class);
+        thrown.expectMessage("YANG file error : Input value \"x\" is not a valid uint16.");
+
+        manager.getDataModel("src/test/resources/default/DefaultInvalidValueInLeafSubStatement.yang");
+    }
+
+    /**
+     * Validates default case value in choice statement.
+     */
+    @Test
+    public void processDefaultCaseInChoiceSubStatement() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/default/DefaultCaseInChoiceSubStatement.yang");
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        YangContainer yangContainer = (YangContainer) yangNode.getChild();
+        assertThat(yangContainer.getName(), is("food"));
+
+        YangChoice yangChoice = (YangChoice) yangContainer.getChild();
+        assertThat(yangChoice.getName(), is("snack"));
+        assertThat(yangChoice.getDefaultValueInString(), is("sports-arena"));
+    }
+
+    /**
+     * Validates default invalide case in choice statement.
+     */
+    @Test
+    public void processDefaultInvalidCaseInChoiceSubStatement() throws IOException, ParserException {
+
+        thrown.expect(ParserException.class);
+        thrown.expectMessage("Internal parser error detected: Invalid content in choice \"snack\" after processing.");
+
+        manager.getDataModel("src/test/resources/default/DefaultInvalidValueInChoiceSubStmt.yang");
+    }
+
+    /**
+     * Validates default value in typedef.
+     */
+    @Test
+    public void processDefaultInTypedef() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/default/DefaultValueInTypeDef.yang");
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        // check typedef
+        YangTypeDef typedef = (YangTypeDef) yangNode.getChild();
+        assertThat(typedef.getName(), is("topInt"));
+        assertThat(typedef.getDefaultValueInString(), is("10"));
+
+        YangType type = typedef.getTypeList().iterator().next();
+        assertThat(type.getDataType(), is(YangDataTypes.INT64));
+        assertThat(type.getDataTypeName(), is("int64"));
+
+        // check leaf
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+        assertThat(leafInfo.getName(), is("myValue"));
+
+        // Check leaf reffered typedef
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("topInt"));
+        assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.DERIVED));
+        YangType<YangDerivedInfo> typeDerived = (YangType<YangDerivedInfo>) leafInfo.getDataType();
+        YangDerivedInfo derivedInfo = (YangDerivedInfo) typeDerived.getDataTypeExtendedInfo();
+        YangTypeDef prevTypedef = (YangTypeDef) derivedInfo.getReferredTypeDef();
+        assertThat(prevTypedef.getName(), is("topInt"));
+        assertThat(prevTypedef.getDefaultValueInString(), is("10"));
+        YangType topType = prevTypedef.getTypeList().iterator().next();
+        assertThat(topType.getDataType(), is(YangDataTypes.INT64));
+        assertThat(topType.getDataTypeName(), is("int64"));
+        YangType<YangInt64> typeInt64 = (YangType<YangInt64>) topType;
+        YangInt64 int64Obj = typeInt64.getDataTypeExtendedInfo();
+    }
+
+    /**
+     * Validates invalid default value in typedef.
+     */
+    @Test
+    public void processInvalidDefaultValueInTypdeDef() throws IOException, ParserException {
+        thrown.expect(DataTypeException.class);
+        thrown.expectMessage("YANG file error : Input value \"x\" is not a valid int64.");
+
+        manager.getDataModel("src/test/resources/default/DefaultInvalidValueInTypeDef.yang");
+    }
+
+    /**
+     * Validates default invalid value in typedef.
+     */
+    @Test
+    public void processDefaultInvalidValueInTypedef() throws IOException, ParserException {
+        thrown.expect(DataTypeException.class);
+        thrown.expectMessage("YANG file error : Input value \"0\" is not a valid INT32");
+
+        manager.getDataModel("src/test/resources/default/DefaultInvalidValueWithRangeInTypedef.yang");
+    }
+
+    /**
+     * Validates default value decimal64 in leaf.
+     */
+    @Test
+    public void processDefaultValueDecimal64InLeaf() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/default/DefaultValueDecimal64InLeaf.yang");
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        // check leaf
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        // check the default value
+        // This default value is verified by YangType.isValidValue() called from LeafListener.processLeafExit()
+        assertThat(leafInfo.getName(), is("mydecimal"));
+        assertThat(leafInfo.getDefaultValueInString(), is("5"));
+    }
+
+    /**
+     * Validates default invalid value decimal64 in leaf.
+     */
+    @Test
+    public void processDefaultInvalidValueDecimal64InLeaf() throws IOException, ParserException {
+        thrown.expect(DataTypeException.class);
+        thrown.expectMessage("YANG file error : Input value \"x\" is not a valid decimal64.");
+
+        manager.getDataModel("src/test/resources/default/DefaultInvalidValueDecimal64InLeaf.yang");
+    }
+
+    /**
+     * Validates default value string in leaf.
+     */
+    @Test
+    public void processDefaultValueStringInLeaf() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/default/DefaultValueStringInLeaf.yang");
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        // check leaf
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        // check the default value
+        // This default value is verified by YangType.isValidValue() called from LeafListener.processLeafExit()
+        assertThat(leafInfo.getName(), is("MyString"));
+        assertThat(leafInfo.getDefaultValueInString(), is("2bB"));
+    }
+
+    /**
+     * Validates default invalid value string in leaf.
+     */
+    @Test
+    public void processDefaultInvalidValueStringInLeaf() throws IOException, ParserException {
+        thrown.expect(DataTypeException.class);
+        thrown.expectMessage("YANG file error : Input value \"2bB2bB\" is not a valid STRING");
+
+        manager.getDataModel("src/test/resources/default/DefaultInvalidValueStringInLeaf.yang");
+    }
+
+    /**
+     * Validates default value boolean in leaf.
+     */
+    @Test
+    public void processDefaultValueBooleanInLeaf() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/default/DefaultValueBooleanInLeaf.yang");
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        // check leaf
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        // check the default value
+        // This default value is verified by YangType.isValidValue() called from LeafListener.processLeafExit()
+        assertThat(leafInfo.getName(), is("myboolean"));
+        assertThat(leafInfo.getDefaultValueInString(), is("true"));
+    }
+
+    /**
+     * Validates default invalid value boolean in leaf.
+     */
+    @Test
+    public void processDefaultInvalidValueBooleanInLeaf() throws IOException, ParserException {
+        thrown.expect(DataTypeException.class);
+        thrown.expectMessage("YANG file error : Input value \"yes\" is not a valid BOOLEAN");
+
+        manager.getDataModel("src/test/resources/default/DefaultInvalidValueBooleanInLeaf.yang");
+    }
+
+    /**
+     * Validates default value enumeration in leaf.
+     */
+    @Test
+    public void processDefaultValueEnumberationInLeaf() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/default/DefaultValueEnumerationInLeaf.yang");
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        // check leaf
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        // check the default value
+        // This default value is verified by YangType.isValidValue() called from LeafListener.processLeafExit()
+        assertThat(leafInfo.getName(), is("myenum"));
+        assertThat(leafInfo.getDefaultValueInString(), is("one"));
+    }
+
+    /**
+     * Validates default invalid value enumeration in leaf.
+     */
+    @Test
+    public void processDefaultInvalidValueEnumberationInLeaf() throws IOException, ParserException {
+        thrown.expect(DataTypeException.class);
+        thrown.expectMessage("YANG file error : Input value \"xyz\" is not a valid ENUMERATION");
+
+        manager.getDataModel("src/test/resources/default/DefaultInvalidValueEnumerationInLeaf.yang");
+    }
+
+    /**
+     * Validates default value bits in leaf.
+     */
+    @Test
+    public void processDefaultValueBitsInLeaf() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/default/DefaultValueBitsInLeaf.yang");
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        // check leaf
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        // check the default value
+        // This default value is verified by YangType.isValidValue() called from LeafListener.processLeafExit()
+        assertThat(leafInfo.getName(), is("mybits"));
+        assertThat(leafInfo.getDefaultValueInString(), is("auto-sense-speed"));
+    }
+
+    /**
+     * Validates default invalid value bits in leaf.
+     */
+    @Test
+    public void processDefaultInvalidValueBitsInLeaf() throws IOException, ParserException {
+        thrown.expect(DataTypeException.class);
+        thrown.expectMessage("YANG file error : Input value \"xyz\" is not a valid BITS");
+
+        manager.getDataModel("src/test/resources/default/DefaultInvalidValueBitsInLeaf.yang");
+    }
+
+    /**
+     * Validates default value binary in leaf.
+     */
+    @Test
+    public void processDefaultValueBinaryInLeaf() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/default/DefaultValueBinaryInLeaf.yang");
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        // check leaf
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        // check the default value
+        // This default value is verified by YangType.isValidValue() called from LeafListener.processLeafExit()
+        assertThat(leafInfo.getName(), is("message"));
+        assertThat(leafInfo.getDefaultValueInString(), is("10010010"));
+    }
+
+    /**
+     * Validates default invalid value binary in leaf.
+     */
+    @Test
+    public void processDefaultInvlaidValueBinaryInLeaf() throws IOException, ParserException {
+        thrown.expect(DataTypeException.class);
+        thrown.expectMessage("YANG file error : Input value \"000\" is not a valid BINARY");
+
+        manager.getDataModel("src/test/resources/default/DefaultInvalidValueBinaryInLeaf.yang");
+    }
+
+    /**
+     * Validates default value empty in leaf.
+     */
+    @Test
+    public void processDefaultValueEmptyInLeaf() throws IOException, ParserException {
+        thrown.expect(DataTypeException.class);
+        thrown.expectMessage("YANG file error : Input value \"something\" is not allowed for a data type EMPTY");
+
+        manager.getDataModel("src/test/resources/default/DefaultValueEmptyInLeaf.yang");
+    }
+
+    /**
+     * Validates default value union in leaf.
+     */
+    @Test
+    public void processDefaultValueUnionInLeaf() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/default/DefaultValueUnionInLeaf.yang");
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        // check leaf
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        // check the default value
+        // This default value is verified by YangType.isValidValue() called from LeafListener.processLeafExit()
+        assertThat(leafInfo.getName(), is("message"));
+        assertThat(leafInfo.getDefaultValueInString(), is("unbounded"));
+    }
+
+    /**
+     * Validates default invalid value union in leaf.
+     */
+    @Test
+    public void processDefaultInvalidValueUnionInLeaf() throws IOException, ParserException {
+        thrown.expect(DataTypeException.class);
+        thrown.expectMessage("YANG file error : Input value \"xyz\" is not a valid UNION");
+
+        manager.getDataModel("src/test/resources/default/DefaultInvalidValueUnionInLeaf.yang");
+    }
+
+    /**
+     * Validates default value in multiple typedef.
+     */
+    @Test
+    public void processDefaultInMultiTypedef() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/default/DefaultValueInMultiTypeDef.yang");
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        // check typedef
+        YangTypeDef typedef = (YangTypeDef) yangNode.getChild();
+        assertThat(typedef.getName(), is("topInt"));
+        assertThat(typedef.getDefaultValueInString(), is("10"));
+
+        YangType type = typedef.getTypeList().iterator().next();
+        assertThat(type.getDataType(), is(YangDataTypes.INT64));
+        assertThat(type.getDataTypeName(), is("int64"));
+
+        // check leaf
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+        assertThat(leafInfo.getName(), is("lowInt"));
+
+        // check leaf type
+        assertThat(leafInfo.getName(), is("lowInt"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("midInt"));
+        YangType<YangDerivedInfo> derivedInfoType = (YangType<YangDerivedInfo>) leafInfo.getDataType();
+        assertThat(derivedInfoType.getDataType(), is(YangDataTypes.DERIVED));
+        YangDerivedInfo derivedInfo = (YangDerivedInfo) derivedInfoType.getDataTypeExtendedInfo();
+
+        // check previous typedef
+        YangTypeDef prevTypedef = (YangTypeDef) derivedInfo.getReferredTypeDef();
+        assertThat(prevTypedef.getName(), is("midInt"));
+        type = prevTypedef.getTypeList().iterator().next();
+        assertThat(type.getDataType(), is(YangDataTypes.DERIVED));
+        derivedInfo = (YangDerivedInfo) type.getDataTypeExtendedInfo();
+
+        // check top typedef
+        YangTypeDef topTypedef = (YangTypeDef) derivedInfo.getReferredTypeDef();
+        assertThat(topTypedef.getName(), is("topInt"));
+        assertThat(topTypedef.getDefaultValueInString(), is("10"));
+        YangType topType = topTypedef.getTypeList().iterator().next();
+        assertThat(topType.getDataType(), is(YangDataTypes.INT64));
+        assertThat(topType.getDataTypeName(), is("int64"));
+        YangType<YangInt64> typeInt64 = (YangType<YangInt64>) topType;
+        YangInt64 int64Obj = typeInt64.getDataTypeExtendedInfo();
+    }
+}
diff --git a/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/DescriptionListenerTest.java b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/DescriptionListenerTest.java
new file mode 100644
index 0000000..43b73d4
--- /dev/null
+++ b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/DescriptionListenerTest.java
@@ -0,0 +1,252 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.onosproject.yang.compiler.datamodel.YangContainer;
+import org.onosproject.yang.compiler.datamodel.YangLeaf;
+import org.onosproject.yang.compiler.datamodel.YangLeafList;
+import org.onosproject.yang.compiler.datamodel.YangList;
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangNodeType;
+import org.onosproject.yang.compiler.datamodel.YangStatusType;
+import org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.YangUtilsParserManager;
+
+import java.io.IOException;
+import java.util.ListIterator;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.Is.is;
+
+/**
+ * Test cases for description listener.
+ */
+public class DescriptionListenerTest {
+
+    @Rule
+    public ExpectedException thrown = ExpectedException.none();
+
+    private final YangUtilsParserManager manager = new YangUtilsParserManager();
+
+    /**
+     * Checks valid description statement.
+     */
+    @Test
+    public void processDescriptionValidStatement() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/DescriptionValidStatement.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        // Check whether the description is set correctly.
+        assertThat(leafInfo.getName(), is("invalid-interval"));
+        assertThat(leafInfo.getDescription(), is("\"Interval before a route is declared invalid\""));
+    }
+
+    /**
+     * Checks whether exception is thrown for invalid description statement.
+     */
+    @Test
+    public void processDescriptionWithoutStatementEnd() throws IOException, ParserException {
+        thrown.expect(ParserException.class);
+        thrown.expectMessage("extraneous input '}' expecting {';', '+'}");
+        YangNode node = manager.getDataModel("src/test/resources/DescriptionWithoutStatementEnd.yang");
+    }
+
+    /**
+     * Checks valid description statement as sub-statement of module.
+     */
+    @Test
+    public void processModuleSubStatementDescription() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/ModuleSubStatementDescription.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        // Check whether the description is set correctly.
+        assertThat(yangNode.getDescription(), is("\"Interval before a route is declared invalid\""));
+    }
+
+    /**
+     * Checks valid description statement as sub-statement of module.
+     */
+    @Test
+    public void processDescriptionEmptyStatement() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/DescriptionEmptyStatement.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        // Check whether the description is set correctly.
+        assertThat(yangNode.getDescription(), is("\"\""));
+    }
+
+    /**
+     * Checks valid description statement as sub-statement of revision.
+     */
+    @Test
+    public void processRevisionSubStatementRevision() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/RevisionSubStatementRevision.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        // Check whether the description is set correctly.
+        assertThat(yangNode.getDescription(), is("\"module description\""));
+        assertThat(yangNode.getRevision().getDescription(), is("\"revision description\""));
+    }
+
+    /**
+     * Checks description statement as sub-statement of container.
+     */
+    @Test
+    public void processContainerSubStatementDescription() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/ContainerSubStatementDescription.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        // Check whether the description value is set correctly.
+        YangContainer container = (YangContainer) yangNode.getChild();
+        assertThat(container.getName(), is("valid"));
+        assertThat(container.getDescription(), is("\"container description\""));
+
+        // Check whether leaf properties as set correctly.
+        ListIterator<YangLeaf> leafIterator = container.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("invalid-interval"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("uint16"));
+        assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.UINT16));
+        assertThat(leafInfo.getUnits(), is("\"seconds\""));
+        assertThat(leafInfo.getDescription(), is("\"Interval before a route is declared invalid\""));
+        assertThat(leafInfo.isMandatory(), is(true));
+        assertThat(leafInfo.getStatus(), is(YangStatusType.CURRENT));
+        assertThat(leafInfo.getReference(), is("\"RFC 6020\""));
+    }
+
+    /**
+     * Checks description statement as sub-statement of list.
+     */
+    @Test
+    public void processListSubStatementDescription() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/ListSubStatementDescription.yang");
+
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        // Check whether the list is child of module and description value is set correctly.
+        YangList yangList = (YangList) yangNode.getChild();
+        assertThat(yangList.getName(), is("valid"));
+        assertThat(yangList.isConfig(), is(true));
+        assertThat(yangList.getDescription(), is("\"list description\""));
+
+        // Check whether leaf properties as set correctly.
+        ListIterator<YangLeaf> leafIterator = yangList.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("invalid-interval"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("uint16"));
+        assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.UINT16));
+        assertThat(leafInfo.getUnits(), is("\"seconds\""));
+        assertThat(leafInfo.getDescription(), is("\"Interval before a route is declared invalid\""));
+        assertThat(leafInfo.isMandatory(), is(true));
+        assertThat(leafInfo.getStatus(), is(YangStatusType.CURRENT));
+        assertThat(leafInfo.getReference(), is("\"RFC 6020\""));
+    }
+
+    /**
+     * Checks valid description statement as sub-statement of leaf-list.
+     */
+    @Test
+    public void processLeafListSubStatementDescription() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/LeafListSubStatementDescription.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeafList> leafListIterator = yangNode.getListOfLeafList().listIterator();
+        YangLeafList leafListInfo = leafListIterator.next();
+
+        // Check whether description value is set correctly.
+        assertThat(leafListInfo.getName(), is("invalid-interval"));
+        assertThat(leafListInfo.getDescription(), is("\"Interval before a route is declared invalid\""));
+    }
+}
diff --git a/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/EnumListenerTest.java b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/EnumListenerTest.java
new file mode 100644
index 0000000..4f56ef8
--- /dev/null
+++ b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/EnumListenerTest.java
@@ -0,0 +1,148 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.onosproject.yang.compiler.datamodel.YangEnum;
+import org.onosproject.yang.compiler.datamodel.YangEnumeration;
+import org.onosproject.yang.compiler.datamodel.YangLeaf;
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangNodeType;
+import org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.YangUtilsParserManager;
+
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.ListIterator;
+import java.util.SortedSet;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.Is.is;
+
+/**
+ * Test cases for enum listener.
+ */
+public class EnumListenerTest {
+
+    @Rule
+    public ExpectedException thrown = ExpectedException.none();
+
+    private final YangUtilsParserManager manager = new YangUtilsParserManager();
+
+    /**
+     * Checks enum statement without value.
+     */
+    @Test
+    public void processEnumTypeStatement() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/EnumTypeStatement.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("speed"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("enumeration"));
+        assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.ENUMERATION));
+        assertThat(((YangEnumeration) leafInfo.getDataType().getDataTypeExtendedInfo()).getName(),
+                is("speed_enum"));
+
+        SortedSet<YangEnum> enumSet = ((YangEnumeration) leafInfo.getDataType().getDataTypeExtendedInfo()).getEnumSet();
+        for (YangEnum tmp : enumSet) {
+            if (tmp.getNamedValue().equals("10m")) {
+                assertThat(tmp.getValue(), is(0));
+            } else if (tmp.getNamedValue().equals("100m")) {
+                assertThat(tmp.getValue(), is(1));
+            } else if (tmp.getNamedValue().equals("auto")) {
+                assertThat(tmp.getValue(), is(2));
+            }
+        }
+    }
+
+    /**
+     * Checks if enum with same name is not allowed.
+     */
+    @Test(expected = ParserException.class)
+    public void processEnumWithDuplicateName() throws IOException, ParserException {
+        YangNode node = manager.getDataModel("src/test/resources/EnumWithDuplicateName.yang");
+    }
+
+    /**
+     * Checks enum boundary value.
+     */
+    @Test
+    public void processEnumBoundaryValue() throws IOException, ParserException {
+        thrown.expect(ParserException.class);
+        thrown.expectMessage("YANG file error : value value 21474836472147483647 is not valid.");
+        YangNode node = manager.getDataModel("src/test/resources/EnumBoundaryValue.yang");
+    }
+
+    /**
+     * Checks whether exception is thrown if value is not specified following max enum value.
+     */
+    @Test
+    public void processEnumMaxNextValue() throws IOException, ParserException {
+        thrown.expect(ParserException.class);
+        thrown.expectMessage("YANG file error : "
+                + "An enum value MUST be specified for enum substatements following the one"
+                + "with the current highest value");
+        YangNode node = manager.getDataModel("src/test/resources/EnumMaxNextValue.yang");
+    }
+
+    /**
+     * Checks enum values stored are sorted.
+     */
+    @Test
+    public void processEnumSorted() throws IOException, ParserException {
+        YangNode node = manager.getDataModel("src/test/resources/EnumSorted.yang");
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("ifType"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("enumeration"));
+        assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.ENUMERATION));
+        assertThat(((YangEnumeration) leafInfo.getDataType().getDataTypeExtendedInfo()).getName(),
+                is("ifType_enum"));
+
+        SortedSet<YangEnum> enumSet = ((YangEnumeration) leafInfo.getDataType().getDataTypeExtendedInfo()).getEnumSet();
+        Iterator<YangEnum> enumIterator = enumSet.iterator();
+        assertThat(enumIterator.next().getNamedValue(), is("five"));
+    }
+}
diff --git a/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/ErrorAppTagListenerTest.java b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/ErrorAppTagListenerTest.java
new file mode 100644
index 0000000..8bd140c
--- /dev/null
+++ b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/ErrorAppTagListenerTest.java
@@ -0,0 +1,83 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.junit.Test;
+import org.onosproject.yang.compiler.datamodel.YangAppErrorInfo;
+import org.onosproject.yang.compiler.datamodel.YangContainer;
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangMust;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.YangUtilsParserManager;
+
+import java.io.IOException;
+import java.util.List;
+
+import static org.hamcrest.core.Is.is;
+import static org.junit.Assert.assertThat;
+
+/**
+ * Test-cases for testing error app tag message listener functionality.
+ */
+public class ErrorAppTagListenerTest {
+    private final YangUtilsParserManager manager = new YangUtilsParserManager();
+
+    /**
+     * Checks if error app tag message is default updated in the data model.
+     */
+    @Test
+    public void processContainerSubStatementErrorDefaultAppTag() throws IOException, ParserException {
+        YangNode node = manager.getDataModel("src/test/resources/ContainerSubStatementErrorDefaultAppTag.yang");
+
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("ErrorAppTag"));
+
+        YangContainer yangContainer = (YangContainer) yangNode.getChild();
+        assertThat(yangContainer.getName(), is("interface"));
+
+        String expectedConstraint = "ifType != 'ethernet' or (ifType = 'ethernet' and ifMTU = 1500)";
+        List<YangMust> mustConstraintList = yangContainer.getListOfMust();
+        assertThat(mustConstraintList.iterator().next().getConstraint(), is(expectedConstraint));
+
+        YangAppErrorInfo yangAppErrorInfo = mustConstraintList.iterator().next().getAppErrorInfo();
+        assertThat(yangAppErrorInfo.getGetErrorAppTag(), is("must-violation"));
+        assertThat(yangAppErrorInfo.getGetErrorTag(), is("operation-failed"));
+    }
+
+    /**
+     * Checks if error app tag message listener updates the data model.
+     */
+    @Test
+    public void processContainerSubStatementErrorAppTag() throws IOException, ParserException {
+        YangNode node = manager.getDataModel("src/test/resources/ContainerSubStatementErrorAppTag.yang");
+
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("ErrorAppTag"));
+
+        YangContainer yangContainer = (YangContainer) yangNode.getChild();
+        assertThat(yangContainer.getName(), is("interface"));
+
+        String expectedConstraint = "ifType != 'ethernet' or (ifType = 'ethernet' and ifMTU = 1500)";
+        List<YangMust> mustConstraintList = yangContainer.getListOfMust();
+        assertThat(mustConstraintList.iterator().next().getConstraint(), is(expectedConstraint));
+
+        YangAppErrorInfo yangAppErrorInfo = mustConstraintList.iterator().next().getAppErrorInfo();
+        assertThat(yangAppErrorInfo.getGetErrorAppTag(), is("An ethernet MTU must be 1500"));
+        assertThat(yangAppErrorInfo.getGetErrorTag(), is("operation-failed"));
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/ErrorMessageListnerTest.java b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/ErrorMessageListnerTest.java
new file mode 100644
index 0000000..7080ef4
--- /dev/null
+++ b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/ErrorMessageListnerTest.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.junit.Test;
+import org.onosproject.yang.compiler.datamodel.YangAppErrorInfo;
+import org.onosproject.yang.compiler.datamodel.YangContainer;
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangMust;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.YangUtilsParserManager;
+
+import java.io.IOException;
+import java.util.List;
+
+import static org.hamcrest.core.Is.is;
+import static org.junit.Assert.assertThat;
+
+/**
+ * Test-cases for testing error message listener functionality.
+ */
+public class ErrorMessageListnerTest {
+    private final YangUtilsParserManager manager = new YangUtilsParserManager();
+
+    /**
+     * Checks if error message listener updates the data model.
+     */
+    @Test
+    public void processContainerSubStatementErrorMessage() throws IOException, ParserException {
+        YangNode node = manager.getDataModel("src/test/resources/ContainerSubStatementErrorMessage.yang");
+
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("ErrorMessage"));
+
+        YangContainer yangContainer = (YangContainer) yangNode.getChild();
+        assertThat(yangContainer.getName(), is("interface"));
+
+        String expectedConstraint = "ifType != 'ethernet' or (ifType = 'ethernet' and ifMTU = 1500)";
+        List<YangMust> mustConstraintList = yangContainer.getListOfMust();
+        assertThat(mustConstraintList.iterator().next().getConstraint(), is(expectedConstraint));
+
+        YangAppErrorInfo yangAppErrorInfo = mustConstraintList.iterator().next().getAppErrorInfo();
+        assertThat(yangAppErrorInfo.getGetErrorMessage(), is("An ethernet MTU must be 1500"));
+        assertThat(yangAppErrorInfo.getGetErrorTag(), is("operation-failed"));
+    }
+}
diff --git a/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/ExtensionListenerTest.java b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/ExtensionListenerTest.java
new file mode 100644
index 0000000..9fcc24d
--- /dev/null
+++ b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/ExtensionListenerTest.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.junit.Test;
+import org.onosproject.yang.compiler.datamodel.YangExtension;
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangNodeType;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.YangUtilsParserManager;
+
+import java.io.IOException;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.Is.is;
+
+/**
+ * Test cases for testing extension listener.
+ */
+public class ExtensionListenerTest {
+
+    private final YangUtilsParserManager manager = new YangUtilsParserManager();
+
+    /**
+     * Checks extension statement as sub-statement of module.
+     */
+    @Test
+    public void processValidExtensionStatement() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/ValidExtensionStatement.yang");
+
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("ietf-yang-compiler-annotation"));
+
+        YangExtension extension = yangNode.getExtensionList().iterator().next();
+        assertThat(extension.getName(), is("compiler-annotation"));
+        assertThat(extension.getArgumentName(), is("target"));
+        assertThat(extension.getDescription(), is("\"This extension allows for defining compiler annotations\""));
+    }
+}
+
diff --git a/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/GroupingListenerTest.java b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/GroupingListenerTest.java
new file mode 100644
index 0000000..a017265
--- /dev/null
+++ b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/GroupingListenerTest.java
@@ -0,0 +1,190 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.junit.Test;
+import org.onosproject.yang.compiler.datamodel.YangContainer;
+import org.onosproject.yang.compiler.datamodel.YangGrouping;
+import org.onosproject.yang.compiler.datamodel.YangLeaf;
+import org.onosproject.yang.compiler.datamodel.YangList;
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangNodeType;
+import org.onosproject.yang.compiler.datamodel.YangStatusType;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.YangUtilsParserManager;
+
+import java.io.IOException;
+import java.util.ListIterator;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.Is.is;
+
+/**
+ * Test cases for testing grouping listener.
+ */
+public class GroupingListenerTest {
+
+    private final YangUtilsParserManager manager = new YangUtilsParserManager();
+
+    /**
+     * Checks grouping statement inside module.
+     */
+    @Test
+    public void processGroupingInModule() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/GroupingInModule.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        YangGrouping yangGrouping = (YangGrouping) yangNode.getChild();
+        assertThat(yangGrouping.getName(), is("endpoint"));
+
+        ListIterator<YangLeaf> leafIterator = yangGrouping.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("address"));
+    }
+
+    /**
+     * Checks grouping statement inside container.
+     */
+    @Test
+    public void processGroupingInContainer() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/GroupingInContainer.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        YangContainer yangContainer = (YangContainer) yangNode.getChild();
+        assertThat(yangContainer.getName(), is("valid"));
+
+        YangGrouping yangGrouping = (YangGrouping) yangContainer.getChild();
+        assertThat(yangGrouping.getName(), is("endpoint"));
+
+        ListIterator<YangLeaf> leafIterator = yangGrouping.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("address"));
+    }
+
+    /**
+     * Checks grouping statement inside list.
+     */
+    @Test
+    public void processGroupingInList() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/GroupingInList.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        YangList yangList = (YangList) yangNode.getChild();
+        assertThat(yangList.getName(), is("valid"));
+
+        YangGrouping yangGrouping = (YangGrouping) yangList.getChild();
+        assertThat(yangGrouping.getName(), is("endpoint"));
+
+        ListIterator<YangLeaf> leafIterator = yangGrouping.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("address"));
+    }
+
+    /**
+     * Checks grouping with attributes.
+     */
+    @Test
+    public void processGroupingAttributes() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/GroupingAttributes.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        YangList yangList = (YangList) yangNode.getChild();
+        assertThat(yangList.getName(), is("valid"));
+
+        YangGrouping yangGrouping = (YangGrouping) yangList.getChild();
+        assertThat(yangGrouping.getName(), is("endpoint"));
+        assertThat(yangGrouping.getStatus(), is(YangStatusType.CURRENT));
+        assertThat(yangGrouping.getReference(), is("\"RFC 6020\""));
+        assertThat(yangGrouping.getDescription(), is("\"grouping under test\""));
+
+        ListIterator<YangLeaf> leafIterator = yangGrouping.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("address"));
+    }
+
+    /**
+     * Checks duplicate grouping in list.
+     */
+    @Test(expected = ParserException.class)
+    public void processDuplicateGroupingInList() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/DuplicateGroupingInList.yang");
+    }
+
+    /**
+     * Checks duplicate grouping in container.
+     */
+    @Test (expected = ParserException.class)
+    public void processDuplicateGroupingInContainer() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/DuplicateGroupingInContainer.yang");
+    }
+
+    /**
+     * Checks duplicate grouping in module.
+     */
+    @Test (expected = ParserException.class)
+    public void processDuplicateGroupingInModule() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/DuplicateGroupingInModule.yang");
+    }
+}
diff --git a/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/IdentityListenerTest.java b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/IdentityListenerTest.java
new file mode 100644
index 0000000..f657ded
--- /dev/null
+++ b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/IdentityListenerTest.java
@@ -0,0 +1,231 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.hamcrest.core.Is;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.onosproject.yang.compiler.datamodel.YangDerivedInfo;
+import org.onosproject.yang.compiler.datamodel.YangIdentity;
+import org.onosproject.yang.compiler.datamodel.YangIdentityRef;
+import org.onosproject.yang.compiler.datamodel.YangLeaf;
+import org.onosproject.yang.compiler.datamodel.YangLeafList;
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangNodeType;
+import org.onosproject.yang.compiler.datamodel.YangType;
+import org.onosproject.yang.compiler.datamodel.YangTypeDef;
+import org.onosproject.yang.compiler.datamodel.utils.ResolvableStatus;
+import org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.YangUtilsParserManager;
+
+import java.io.IOException;
+import java.util.ListIterator;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.Is.is;
+import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes.IDENTITYREF;
+
+/**
+ * Test case for identity listener.
+ */
+public class IdentityListenerTest {
+
+    private final YangUtilsParserManager manager = new YangUtilsParserManager();
+
+    @Rule
+    public ExpectedException thrown = ExpectedException.none();
+
+    /**
+     * Checks for updating datamodel for identity/identityref.
+     */
+    @Test
+    public void processIdentityrefType() throws IOException, ParserException {
+
+        YangNode node = manager
+                .getDataModel("src/test/resources/IdentityListener.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("IdentityListener"));
+
+        YangIdentity yangIdentity = (YangIdentity) yangNode.getChild();
+        assertThat(yangIdentity.getName(), is("tunnel"));
+
+        yangIdentity = (YangIdentity) yangNode.getChild().getNextSibling();
+        assertThat(yangIdentity.getName(), is("tunnel-type"));
+
+        yangIdentity = (YangIdentity) yangNode.getChild().getNextSibling().getNextSibling();
+        assertThat(yangIdentity.getName(), is("ref-address-family"));
+
+        yangIdentity = (YangIdentity) yangNode.getChild().getNextSibling().getNextSibling()
+                .getNextSibling();
+        assertThat(yangIdentity.getName(), is("ipv4-address-family"));
+        assertThat(yangIdentity.getBaseNode().getBaseIdentifier().getName(), is("ref-address-family"));
+        assertThat(yangIdentity.getBaseNode().getReferredIdentity().getName(), is("ref-address-family"));
+
+        yangIdentity = (YangIdentity) yangNode.getChild().getNextSibling().getNextSibling()
+                .getNextSibling().getNextSibling();
+        assertThat(yangIdentity.getName(), is("ipv6-address-family"));
+        assertThat(yangIdentity.getBaseNode().getBaseIdentifier().getName(), is("ref-address-family"));
+        assertThat(yangIdentity.getBaseNode().getReferredIdentity().getName(), is("ref-address-family"));
+        assertThat(yangIdentity.getBaseNode().getResolvableStatus(), Is.is(ResolvableStatus.RESOLVED));
+
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("tunnel"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("identityref"));
+        assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.IDENTITYREF));
+        YangIdentityRef yangIdentityRef = (YangIdentityRef) leafInfo.getDataType().getDataTypeExtendedInfo();
+        assertThat(yangIdentityRef.getName(), is("ref-address-family"));
+        assertThat(yangIdentityRef.getBaseIdentity().getName(), is("ref-address-family"));
+        assertThat(yangIdentityRef.getReferredIdentity().getName(), is("ref-address-family"));
+        assertThat(yangIdentityRef.getResolvableStatus(), is(ResolvableStatus.RESOLVED));
+
+        ListIterator<YangLeafList> leafListIterator = yangNode.getListOfLeafList().listIterator();
+        YangLeafList leafListInfo = leafListIterator.next();
+
+        // Check whether the information in the leaf is correct.
+        assertThat(leafListInfo.getName(), is("network-ref"));
+        assertThat(leafListInfo.getDataType().getDataTypeName(), is("identityref"));
+        assertThat(leafListInfo.getDataType().getDataType(), is(YangDataTypes.IDENTITYREF));
+        yangIdentityRef = (YangIdentityRef) (leafListInfo.getDataType().getDataTypeExtendedInfo());
+
+        // Check whether identityref type got resolved.
+        assertThat(yangIdentityRef.getResolvableStatus(), is(ResolvableStatus.RESOLVED));
+    }
+
+    /**
+     * Checks for updating datamodel for intrafile resolution identity/identityref.
+     */
+    @Test
+    public void processIntraIdentityrefType() throws IOException, ParserException {
+
+        YangNode node = manager
+                .getDataModel("src/test/resources/IdentityIntraFile.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("IdentityIntraFile"));
+
+        YangIdentity yangIdentity = (YangIdentity) yangNode.getChild();
+        assertThat(yangIdentity.getName(), is("ipv4-address-family"));
+        assertThat(yangIdentity.getBaseNode().getBaseIdentifier().getName(), is("ref-address-family"));
+        assertThat(yangIdentity.getBaseNode().getResolvableStatus(), is(ResolvableStatus.INTRA_FILE_RESOLVED));
+    }
+
+    /**
+     * Checks for updating datamodel for identityref used in tydedef.
+     */
+    @Test
+    public void processIdentityTypedefStatement() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/IdentityTypedef.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        YangIdentity yangIdentity = (YangIdentity) yangNode.getChild();
+        assertThat(yangIdentity.getName(), is("tunnel"));
+
+        YangTypeDef typedef = (YangTypeDef) yangNode.getChild().getNextSibling();
+        assertThat(typedef.getName(), is("type15"));
+
+        YangType type = typedef.getTypeList().iterator().next();
+        assertThat(type.getDataType(), is(YangDataTypes.IDENTITYREF));
+        assertThat(type.getDataTypeName(), is("identityref"));
+
+        YangIdentityRef identityRef = (YangIdentityRef) type.getDataTypeExtendedInfo();
+        assertThat(identityRef.getName(), is("tunnel"));
+        assertThat(identityRef.getBaseIdentity().getName(), is("tunnel"));
+
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("tunnel-value"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("type15"));
+        assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.DERIVED));
+
+        YangDerivedInfo info = (YangDerivedInfo) leafInfo.getDataType()
+                .getDataTypeExtendedInfo();
+        assertThat(info.getEffectiveBuiltInType(), is(IDENTITYREF));
+        YangType type1 = info.getReferredTypeDef().getTypeList().get(0);
+        YangIdentityRef idRef1 =
+                (YangIdentityRef) type1.getDataTypeExtendedInfo();
+        assertThat(idRef1.getName(), is("tunnel"));
+        assertThat(idRef1.getBaseIdentity().getName(), is("tunnel"));
+        assertThat(idRef1.getReferredIdentity().getName(), is("tunnel"));
+        assertThat(idRef1.getResolvableStatus(), is(ResolvableStatus.RESOLVED));
+    }
+
+    /**
+     * Checks for updating datamodel for unresolved status of identityref used in tydedef.
+     */
+    @Test
+    public void processIdentityUnresolvedTypedefStatement() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/IdentityTypedefUnresolved.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        YangIdentity yangIdentity = (YangIdentity) yangNode.getChild();
+        assertThat(yangIdentity.getName(), is("tunnel"));
+
+        YangTypeDef typedef = (YangTypeDef) yangNode.getChild().getNextSibling();
+        assertThat(typedef.getName(), is("type15"));
+
+        YangType type = typedef.getTypeList().iterator().next();
+        assertThat(type.getDataType(), is(YangDataTypes.IDENTITYREF));
+        assertThat(type.getDataTypeName(), is("identityref"));
+
+        YangIdentityRef idRef =
+                (YangIdentityRef) type.getDataTypeExtendedInfo();
+        assertThat(idRef.getName(), is("tunnel"));
+        assertThat(idRef.getBaseIdentity().getName(), is("tunnel"));
+        assertThat(idRef.getResolvableStatus(), is(ResolvableStatus.RESOLVED));
+
+    }
+}
diff --git a/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/ImportListenerTest.java b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/ImportListenerTest.java
new file mode 100644
index 0000000..0f92904
--- /dev/null
+++ b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/ImportListenerTest.java
@@ -0,0 +1,116 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.junit.Test;
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.YangUtilsParserManager;
+
+import java.io.IOException;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+
+import static org.hamcrest.core.Is.is;
+import static org.junit.Assert.assertThat;
+
+/**
+ * Test cases for testing import listener functionality.
+ */
+public class ImportListenerTest {
+
+    private final YangUtilsParserManager manager = new YangUtilsParserManager();
+    private static final String DATE_FORMAT = "yyyy-MM-dd";
+    private final SimpleDateFormat simpleDateFormat = new SimpleDateFormat(DATE_FORMAT);
+
+    /**
+     * Checks if mandatory parameter prefix is present in import.
+     */
+    @Test(expected = ParserException.class)
+    public void processImportWithoutPrefix() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/ImportWithoutPrefix.yang");
+    }
+
+    /**
+     * Checks that prefix must be present only once in import.
+     */
+    @Test(expected = ParserException.class)
+    public void processImportWithDualPrefix() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/ImportWithDualPrefix.yang");
+    }
+
+    /**
+     * Checks for the correct order of prefix in import.
+     */
+    @Test(expected = ParserException.class)
+    public void processImportInvalidOrder() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/ImportInvalidOrder.yang");
+    }
+
+    /**
+     * Checks if import listener updates the data model tree.
+     */
+    @Test
+    public void processImportValidEntry() throws IOException, ParserException, ParseException {
+
+        YangNode node = manager.getDataModel("src/test/resources/ImportValidEntry.yang");
+
+        // Checks for the revision value in data model tree.
+        assertThat(((YangModule) node).getImportList().get(0).getRevision(), is(simpleDateFormat.parse("2015-02-03")));
+        // Checks for the prefix id in data model tree.
+        assertThat(((YangModule) node).getImportList().get(0).getPrefixId(), is("On2"));
+        // Checks for the module name in data model tree.
+        assertThat(((YangModule) node).getImportList().get(0).getModuleName(), is("ietf"));
+    }
+
+    /**
+     * Checks if optional parameter revision is not mandatory in import.
+     */
+    @Test
+    public void processImportWithoutRevision() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/ImportWithoutRevision.yang");
+
+        // Checks for the prefix id in data model tree.
+        assertThat(((YangModule) node).getImportList().get(0).getPrefixId(), is("On2"));
+        // Checks for the module name in data model tree.
+        assertThat(((YangModule) node).getImportList().get(0).getModuleName(), is("ietf"));
+    }
+
+    /**
+     * Checks if multiple imports are allowed.
+     */
+    @Test()
+    public void processImportMultipleInstance() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/ImportMultipleInstance.yang");
+
+        // Checks for the prefix id in data model tree.
+        assertThat(((YangModule) node).getImportList().get(0).getPrefixId(), is("On2"));
+        // Checks for the module name in data model tree.
+        assertThat(((YangModule) node).getImportList().get(0).getModuleName(), is("ietf"));
+
+        // Checks for the prefix id in data model tree.
+        assertThat(((YangModule) node).getImportList().get(1).getPrefixId(), is("On3"));
+        // Checks for the module name in data model tree.
+        assertThat(((YangModule) node).getImportList().get(1).getModuleName(), is("itut"));
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/IncludeListenerTest.java b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/IncludeListenerTest.java
new file mode 100644
index 0000000..6dabbae
--- /dev/null
+++ b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/IncludeListenerTest.java
@@ -0,0 +1,128 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.junit.Test;
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.YangUtilsParserManager;
+
+import java.io.IOException;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+
+import static org.hamcrest.core.Is.is;
+import static org.junit.Assert.assertThat;
+
+/**
+ * Test cases for testing include listener functionality.
+ */
+public class IncludeListenerTest {
+
+    private final YangUtilsParserManager manager = new YangUtilsParserManager();
+    private static final String DATE_FORMAT = "yyyy-MM-dd";
+    private final SimpleDateFormat simpleDateFormat = new SimpleDateFormat(DATE_FORMAT);
+
+    /**
+     * Checks if include listener with ; is valid and updates the data
+     * model tree.
+     */
+    @Test
+    public void processIncludeWithStmtend() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/IncludeWithStmtend.yang");
+
+        // Checks for the sub module name in data model tree.
+        assertThat(((YangModule) node).getIncludeList().get(0).getSubModuleName(), is("itut"));
+    }
+
+    /**
+     * Checks if include listener with braces and without revision date is valid
+     * and updates the data model tree.
+     */
+    @Test
+    public void processIncludeWithEmptyBody() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/IncludeWithEmptyBody.yang");
+
+        // Checks for the sub module name in data model tree.
+        assertThat(((YangModule) node).getIncludeList().get(0).getSubModuleName(), is("itut"));
+    }
+
+    /**
+     * Checks if include listener with braces and with revision date is valid
+     * and updates the data model tree.
+     */
+    @Test
+    public void processIncludeWithDate() throws IOException, ParserException, ParseException {
+
+        YangNode node = manager.getDataModel("src/test/resources/IncludeWithDate.yang");
+
+        // Checks for the sub module name in data model tree.
+        assertThat(((YangModule) node).getIncludeList().get(0).getSubModuleName(), is("itut"));
+        assertThat(((YangModule) node).getIncludeList().get(0).getRevision(), is(simpleDateFormat.parse("2016-02-03")));
+    }
+
+    /**
+     * Checks if include has more than one occurrence.
+     */
+    @Test
+    public void processIncludeMultiInstance() throws IOException, ParserException, ParseException {
+
+        YangNode node = manager.getDataModel("src/test/resources/IncludeMultiInstance.yang");
+
+        // Checks for the sub module name in data model tree.
+        assertThat(((YangModule) node).getIncludeList().get(0).getSubModuleName(), is("itut"));
+        assertThat(((YangModule) node).getIncludeList().get(0).getRevision(), is(simpleDateFormat.parse("2016-02-03")));
+        assertThat(((YangModule) node).getIncludeList().get(1).getSubModuleName(), is("sdn"));
+        assertThat(((YangModule) node).getIncludeList().get(1).getRevision(), is(simpleDateFormat.parse("2014-02-03")));
+    }
+
+    /**
+     * Checks if include and import can come in any order.
+     */
+    @Test
+    public void processIncludeImportAnyOrder() throws IOException, ParserException, ParseException {
+
+        YangNode node = manager.getDataModel("src/test/resources/IncludeImportAnyOrder.yang");
+
+        // Checks for the sub module name in data model tree.
+        assertThat(((YangModule) node).getIncludeList().get(0).getSubModuleName(), is("itut"));
+        assertThat(((YangModule) node).getIncludeList().get(0).getRevision(), is(simpleDateFormat.parse("2016-02-03")));
+        assertThat(((YangModule) node).getIncludeList().get(1).getSubModuleName(), is("sdn"));
+        assertThat(((YangModule) node).getIncludeList().get(1).getRevision(), is(simpleDateFormat.parse("2014-02-03")));
+    }
+
+    /**
+     * Checks if syntax of Include is not correct.
+     */
+    @Test(expected = ParserException.class)
+    public void processIncludeInvalidSyntax() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/IncludeInvalidSyntax.yang");
+    }
+
+    /**
+     * Checks if syntax of revision date in Include is not correct.
+     */
+    @Test(expected = ParserException.class)
+    public void processIncludeInvalidDateSyntax() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/IncludeInvalidDateSyntax.yang");
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/InputListenerTest.java b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/InputListenerTest.java
new file mode 100644
index 0000000..e0841a9
--- /dev/null
+++ b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/InputListenerTest.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.yang.compiler.parser.impl.listeners;
+
+import org.junit.Test;
+import org.onosproject.yang.compiler.datamodel.YangContainer;
+import org.onosproject.yang.compiler.datamodel.YangInput;
+import org.onosproject.yang.compiler.datamodel.YangLeaf;
+import org.onosproject.yang.compiler.datamodel.YangList;
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangNodeType;
+import org.onosproject.yang.compiler.datamodel.YangRpc;
+import org.onosproject.yang.compiler.datamodel.YangStatusType;
+import org.onosproject.yang.compiler.datamodel.YangTypeDef;
+import org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.YangUtilsParserManager;
+
+import java.io.IOException;
+import java.util.ListIterator;
+
+import static org.hamcrest.core.Is.is;
+import static org.junit.Assert.assertThat;
+
+/**
+ * Test cases for testing Input listener functionality.
+ */
+public class InputListenerTest {
+
+    private final YangUtilsParserManager manager = new YangUtilsParserManager();
+
+    /**
+     * Checks input statements with data definition statements as sub-statements.
+     */
+    @Test
+    public void processInputStatementWithDataDefinition() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/InputStatementWithDataDefinition.yang");
+
+        assertThat((node instanceof YangModule), is(true));
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("rock"));
+
+        YangRpc yangRpc = (YangRpc) yangNode.getChild();
+        assertThat(yangRpc.getName(), is("activate-software-image"));
+
+        YangInput yangInput = (YangInput) yangRpc.getChild();
+        assertThat(yangInput.getName(), is("input"));
+        ListIterator<YangLeaf> leafIterator = yangInput.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("image-name"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("string"));
+
+        YangList yangList = (YangList) yangInput.getChild();
+        assertThat(yangList.getName(), is("ospf"));
+        assertThat(yangList.getKeyList().contains("invalid-interval"), is(true));
+        assertThat(yangList.isConfig(), is(true));
+        assertThat(yangList.getMaxElements().getMaxElement(), is(10));
+        assertThat(yangList.getMinElements().getMinElement(), is(3));
+        leafIterator = yangList.getListOfLeaf().listIterator();
+        leafInfo = leafIterator.next();
+        assertThat(leafInfo.getName(), is("invalid-interval"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("uint16"));
+
+        YangContainer yangContainer = (YangContainer) yangList.getNextSibling();
+        assertThat(yangContainer.getName(), is("isis"));
+
+        leafIterator = yangContainer.getListOfLeaf().listIterator();
+        leafInfo = leafIterator.next();
+        assertThat(leafInfo.getName(), is("invalid-interval"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("uint16"));
+    }
+
+    /**
+     * Checks input statements with type-def statement as sub-statements.
+     */
+    @Test
+    public void processInputStatementWithTypedef() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/InputStatementWithTypedef.yang");
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("rock"));
+
+        YangRpc yangRpc = (YangRpc) yangNode.getChild();
+        assertThat(yangRpc.getName(), is("activate-software-image"));
+
+        YangInput yangInput = (YangInput) yangRpc.getChild();
+        assertThat(yangInput.getName(), is("input"));
+        YangTypeDef typeDef = (YangTypeDef) yangInput.getChild();
+        assertThat(typeDef.getName(), is("my-type"));
+        assertThat(typeDef.getStatus(), is(YangStatusType.DEPRECATED));
+        assertThat(typeDef.getTypeDefBaseType().getDataType(), is(YangDataTypes.INT32));
+    }
+}
diff --git a/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/KeyListenerTest.java b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/KeyListenerTest.java
new file mode 100644
index 0000000..b526d40
--- /dev/null
+++ b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/KeyListenerTest.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.yang.compiler.parser.impl.listeners;
+
+import org.hamcrest.core.Is;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.onosproject.yang.compiler.datamodel.YangList;
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangNodeType;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.YangUtilsParserManager;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.ListIterator;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.Is.is;
+
+/**
+ * Test cases for key listener.
+ */
+public class KeyListenerTest {
+
+    @Rule
+    public ExpectedException thrown = ExpectedException.none();
+
+    private final YangUtilsParserManager manager = new YangUtilsParserManager();
+
+    /**
+     * Checks key statement as sub-statement of list.
+     */
+    @Test
+    public void processListSubStatementKey() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/ListSubStatementKey.yang");
+
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), Is.is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        // Check whether the list is child of module
+        YangList yangList = (YangList) yangNode.getChild();
+        assertThat(yangList.getName(), is("valid"));
+
+        ListIterator<String> keyList = yangList.getKeyList().listIterator();
+        assertThat(keyList.next(), is("invalid-interval"));
+    }
+
+    /**
+     * Check multiple key values.
+     */
+    @Test
+    public void processMultipleKeyValues() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/MultipleKeyValues.yang");
+
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        // Check whether the list is child of module
+        YangList yangList = (YangList) yangNode.getChild();
+        assertThat(yangList.getName(), is("valid"));
+
+        List<String> keyList = yangList.getKeyList();
+        assertThat(keyList.contains("ospf"), is(true));
+        assertThat(keyList.contains("isis"), is(true));
+    }
+
+    /**
+     * Checks key statement without statement end.
+     */
+    @Test
+    public void processKeyWithoutStatementEnd() throws IOException, ParserException {
+        thrown.expect(ParserException.class);
+        thrown.expectMessage("mismatched input 'leaf' expecting {';', '+'}");
+        YangNode node = manager.getDataModel("src/test/resources/KeyWithoutStatementEnd.yang");
+    }
+
+    /**
+     * Checks key values are set correctly.
+     */
+    @Test
+    public void processConfigFalseNoKey() throws IOException, ParserException {
+        YangNode node = manager.getDataModel("src/test/resources/ConfigFalseNoKey.yang");
+
+        assertThat((node instanceof YangModule), is(true));
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        // Check whether the list is child of module
+        YangList yangList = (YangList) yangNode.getChild();
+        assertThat(yangList.getName(), is("valid"));
+    }
+
+    /**
+     * Checks key values are set correctly.
+     */
+    @Test
+    public void processConfigFalseValidKeyValidLeaf() throws IOException, ParserException {
+        YangNode node = manager.getDataModel("src/test/resources/ConfigFalseValidKeyValidLeaf.yang");
+
+        assertThat((node instanceof YangModule), is(true));
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        // Check whether the list is child of module
+        YangList yangList = (YangList) yangNode.getChild();
+        assertThat(yangList.getName(), is("valid"));
+
+        ListIterator<String> keyList = yangList.getKeyList().listIterator();
+        assertThat(keyList.next(), is("invalid-interval"));
+    }
+
+    /**
+     * Checks whether exception is thrown when list's config is set to true and there is no key.
+     */
+    @Test
+    public void processConfigTrueNoKey() throws IOException, ParserException {
+        thrown.expect(ParserException.class);
+        thrown.expectMessage("A list must have atleast one key leaf if config is true");
+        YangNode node = manager.getDataModel("src/test/resources/ConfigTrueNoKey.yang");
+    }
+
+    /**
+     * Checks whether exception is thrown when list's config is set to true and there is no leaf.
+     */
+    @Test
+    public void processConfigTrueNoleafNoLeafList() throws IOException, ParserException {
+        thrown.expect(ParserException.class);
+        thrown.expectMessage("A list must have atleast one key leaf if config is true");
+        YangNode node = manager.getDataModel("src/test/resources/ConfigTrueNoleafNoLeafList.yang");
+    }
+
+    /**
+     * Checks key values are set correctly.
+     */
+    @Test
+    public void processConfigTrueValidKeyValidLeaf() throws IOException, ParserException {
+        YangNode node = manager.getDataModel("src/test/resources/ConfigTrueValidKeyValidLeaf.yang");
+
+        assertThat((node instanceof YangModule), is(true));
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        // Check whether the list is child of module
+        YangList yangList = (YangList) yangNode.getChild();
+        assertThat(yangList.getName(), is("valid"));
+
+        ListIterator<String> keyList = yangList.getKeyList().listIterator();
+        assertThat(keyList.next(), is("invalid-interval"));
+    }
+
+    /**
+     * Checks key values are set correctly.
+     */
+    @Test
+    public void processKeyWithUsesInList() throws IOException, ParserException {
+        YangNode node = manager.getDataModel("src/test/resources/KeyWithUsesInList.yang");
+
+        assertThat((node instanceof YangModule), is(true));
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        // Check whether the list is child of module
+        YangList yangList = (YangList) yangNode.getChild().getNextSibling();
+        assertThat(yangList.getName(), is("valid"));
+
+        ListIterator<String> keyList = yangList.getKeyList().listIterator();
+        assertThat(keyList.next(), is("invalid-interval"));
+    }
+
+    /**
+     * Checks whether exception is thrown when key leaf identifier is not found in list.
+     */
+    @Test
+    public void processInvalidLeafIdentifier() throws IOException, ParserException {
+        thrown.expect(ParserException.class);
+        thrown.expectMessage("An identifier, in key, must refer to a child leaf of the list");
+        YangNode node = manager.getDataModel("src/test/resources/InvalidLeafIdentifier.yang");
+    }
+
+    /**
+     * Checks whether exception is thrown when key leaf is of type empty.
+     */
+    @Test
+    public void processKeyLeafTypeEmpty() throws IOException, ParserException {
+        thrown.expect(ParserException.class);
+        thrown.expectMessage("A leaf that is part of the key must not be the built-in type \"empty\".");
+        YangNode node = manager.getDataModel("src/test/resources/KeyLeafTypeEmpty.yang");
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/LeafListListenerTest.java b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/LeafListListenerTest.java
new file mode 100644
index 0000000..8a5711f
--- /dev/null
+++ b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/LeafListListenerTest.java
@@ -0,0 +1,208 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.hamcrest.core.Is;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.onosproject.yang.compiler.datamodel.YangContainer;
+import org.onosproject.yang.compiler.datamodel.YangLeafList;
+import org.onosproject.yang.compiler.datamodel.YangList;
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangNodeType;
+import org.onosproject.yang.compiler.datamodel.YangStatusType;
+import org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.YangUtilsParserManager;
+
+import java.io.IOException;
+import java.util.ListIterator;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.Is.is;
+
+/**
+ * Test cases for testing leaf-list listener.
+ */
+public class LeafListListenerTest {
+
+    @Rule
+    public ExpectedException thrown = ExpectedException.none();
+
+    private final YangUtilsParserManager manager = new YangUtilsParserManager();
+
+    /**
+     * Checks all the values of leaf-list sub-statements are set correctly.
+     */
+    @Test
+    public void processLeafListSubStatements() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/LeafListSubStatements.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeafList> leafListIterator = yangNode.getListOfLeafList().listIterator();
+        YangLeafList leafListInfo = leafListIterator.next();
+
+        assertThat(leafListInfo.getName(), is("invalid-interval"));
+        assertThat(leafListInfo.getDataType().getDataTypeName(), is("uint16"));
+        assertThat(leafListInfo.getDataType().getDataType(), is(YangDataTypes.UINT16));
+        assertThat(leafListInfo.getUnits(), is("\"seconds\""));
+        assertThat(leafListInfo.getDescription(), is("\"Interval before a route is declared invalid\""));
+        assertThat(leafListInfo.isConfig(), is(true));
+        assertThat(leafListInfo.getMaxElements().getMaxElement(), is(3));
+        assertThat(leafListInfo.getStatus(), Is.is(YangStatusType.CURRENT));
+        assertThat(leafListInfo.getReference(), is("\"RFC 6020\""));
+    }
+
+    /**
+     * Checks whether exception is thrown when leaf-list identifier starts with
+     * digit.
+     */
+    @Test
+    public void processLeafListInvalidIdentifier() throws IOException, ParserException {
+        thrown.expect(ParserException.class);
+        thrown.expectMessage("YANG file error : leaf-list name 1invalid-interval is not valid.");
+        YangNode node = manager.getDataModel("src/test/resources/LeafListInvalidIdentifier.yang");
+    }
+
+    /**
+     * Checks whether exception is thrown when leaf-list keyword is incorrect.
+     */
+    @Test(expected = ParserException.class)
+    public void processLeafListInvalidStatement() throws IOException, ParserException {
+        YangNode node = manager.getDataModel("src/test/resources/LeafListInvalidStatement.yang");
+    }
+
+    /**
+     * Checks whether exception is thrown when leaf-list keyword without Left
+     * brace as per grammar.
+     */
+    @Test
+    public void processLeafListWithoutLeftBrace() throws IOException, ParserException {
+        thrown.expect(ParserException.class);
+        thrown.expectMessage("missing '{' at 'type'");
+        YangNode node = manager.getDataModel("src/test/resources/LeafListWithoutLeftBrace.yang");
+    }
+
+    /**
+     * Checks whether exception is thrown when config statement cardinality is
+     * not as per grammar.
+     */
+    @Test
+    public void processLeafListConfigInvalidCardinality() throws IOException, ParserException {
+        thrown.expect(ParserException.class);
+        thrown.expectMessage("YANG file error: \"config\" is defined more than once in \"leaf-list " +
+                "invalid-interval\".");
+        YangNode node = manager.getDataModel("src/test/resources/LeafListConfigInvalidCardinality.yang");
+    }
+
+    /**
+     * Checks whether exception is thrown when units statement cardinality is
+     * not as per grammar.
+     */
+    @Test
+    public void processLeafListUnitsInvalidCardinality() throws IOException, ParserException {
+        thrown.expect(ParserException.class);
+        thrown.expectMessage("YANG file error: \"units\" is defined more than once in \"leaf-list invalid-interval\"");
+        YangNode node = manager.getDataModel("src/test/resources/LeafListUnitsInvalidCardinality.yang");
+    }
+
+    /**
+     * Checks leaf-list statement as sub-statement of container.
+     */
+    @Test
+    public void processContainerSubStatementLeafList() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/ContainerSubStatementLeafList.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        //Check whether the container is child of module.
+        YangContainer container = (YangContainer) yangNode.getChild();
+        assertThat(container.getName(), is("valid"));
+
+        // Check whether leaf-list properties as set correctly.
+        ListIterator<YangLeafList> leafListIterator = container.getListOfLeafList().listIterator();
+        YangLeafList leafListInfo = leafListIterator.next();
+
+        assertThat(leafListInfo.getName(), is("invalid-interval"));
+        assertThat(leafListInfo.getDataType().getDataTypeName(), is("uint16"));
+        assertThat(leafListInfo.getDataType().getDataType(), is(YangDataTypes.UINT16));
+        assertThat(leafListInfo.getUnits(), is("\"seconds\""));
+        assertThat(leafListInfo.getDescription(), is("\"Interval before a route is declared invalid\""));
+        assertThat(leafListInfo.isConfig(), is(true));
+        assertThat(leafListInfo.getMinElements().getMinElement(), is(1));
+        assertThat(leafListInfo.getMaxElements().getMaxElement(), is(2147483647));
+        assertThat(leafListInfo.getStatus(), is(YangStatusType.CURRENT));
+        assertThat(leafListInfo.getReference(), is("\"RFC 6020\""));
+    }
+
+    /**
+     * Checks leaf-list statement as sub-statement of list.
+     */
+    @Test
+    public void processListSubStatementLeafList() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/ListSubStatementLeafList.yang");
+
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        // Check whether the list is child of module
+        YangList yangList = (YangList) yangNode.getChild();
+        assertThat(yangList.getName(), is("valid"));
+
+        // Check whether leaf-list properties as set correctly.
+        ListIterator<YangLeafList> leafListIterator = yangList.getListOfLeafList().listIterator();
+        YangLeafList leafListInfo = leafListIterator.next();
+
+        assertThat(leafListInfo.getName(), is("invalid-interval"));
+        assertThat(leafListInfo.getDataType().getDataTypeName(), is("uint16"));
+        assertThat(leafListInfo.getDataType().getDataType(), is(YangDataTypes.UINT16));
+        assertThat(leafListInfo.getUnits(), is("\"seconds\""));
+        assertThat(leafListInfo.getDescription(), is("\"Interval before a route is declared invalid\""));
+        assertThat(leafListInfo.isConfig(), is(true));
+
+        assertThat(leafListInfo.getStatus(), is(YangStatusType.CURRENT));
+        assertThat(leafListInfo.getReference(), is("\"RFC 6020\""));
+    }
+}
diff --git a/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/LeafListenerTest.java b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/LeafListenerTest.java
new file mode 100644
index 0000000..216033c
--- /dev/null
+++ b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/LeafListenerTest.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.yang.compiler.parser.impl.listeners;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.onosproject.yang.compiler.datamodel.YangContainer;
+import org.onosproject.yang.compiler.datamodel.YangLeaf;
+import org.onosproject.yang.compiler.datamodel.YangList;
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangNodeType;
+import org.onosproject.yang.compiler.datamodel.YangStatusType;
+import org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.YangUtilsParserManager;
+
+import java.io.IOException;
+import java.util.ListIterator;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.Is.is;
+
+/**
+ * Test cases for testing leaf listener.
+ */
+public class LeafListenerTest {
+
+    @Rule
+    public ExpectedException thrown = ExpectedException.none();
+
+    private final YangUtilsParserManager manager = new YangUtilsParserManager();
+
+    /**
+     * Checks all the values of leaf sub-statements are set correctly.
+     */
+    @Test
+    public void processLeafSubStatements() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/LeafSubStatements.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("invalid-interval"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("uint16"));
+        assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.UINT16));
+        assertThat(leafInfo.getUnits(), is("\"seconds\""));
+        assertThat(leafInfo.getDescription(), is("\"Interval before a route is declared invalid\""));
+        assertThat(leafInfo.isConfig(), is(true));
+        assertThat(leafInfo.isMandatory(), is(true));
+        assertThat(leafInfo.getStatus(), is(YangStatusType.CURRENT));
+        assertThat(leafInfo.getReference(), is("\"RFC 6020\""));
+    }
+
+    /**
+     * Checks whether exception is thrown when leaf identifier starts with
+     * digit.
+     */
+    @Test
+    public void processLeafInvalidIdentifier() throws IOException, ParserException {
+        thrown.expect(ParserException.class);
+        thrown.expectMessage("YANG file error : leaf name 1invalid-interval is not valid.");
+        YangNode node = manager.getDataModel("src/test/resources/LeafInvalidIdentifier.yang");
+    }
+
+    /**
+     * Checks whether exception is thrown when leaf keyword without Left brace
+     * as per grammar.
+     */
+    @Test
+    public void processLeafWithoutLeftBrace() throws IOException, ParserException {
+        thrown.expect(ParserException.class);
+        thrown.expectMessage("missing '{' at 'type'");
+        YangNode node = manager.getDataModel("src/test/resources/LeafWithoutLeftBrace.yang");
+    }
+
+    /**
+     * Checks whether exception is thrown when config statement cardinality is
+     * not as per grammar.
+     */
+    @Test
+    public void processLeafConfigInvalidCardinality() throws IOException, ParserException {
+        thrown.expect(ParserException.class);
+        thrown.expectMessage("YANG file error: \"config\" is defined more than once in \"leaf invalid-interval\".");
+        YangNode node = manager.getDataModel("src/test/resources/LeafConfigInvalidCardinality.yang");
+    }
+
+    /**
+     * Checks whether exception is thrown when mandatory statement cardinality
+     * is not as per grammar.
+     */
+    @Test
+    public void processLeafMandatoryInvalidCardinality() throws IOException, ParserException {
+        thrown.expect(ParserException.class);
+        thrown.expectMessage("YANG file error: \"mandatory\" is defined more than once in \"leaf invalid-interval\".");
+        YangNode node = manager.getDataModel("src/test/resources/LeafMandatoryInvalidCardinality.yang");
+    }
+
+    /**
+     * Checks leaf statement as sub-statement of container.
+     */
+    @Test
+    public void processContainerSubStatementLeaf() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/ContainerSubStatementLeaf.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        //Check whether the container is child of module.
+        YangContainer container = (YangContainer) yangNode.getChild();
+        assertThat(container.getName(), is("valid"));
+
+        // Check whether leaf properties as set correctly.
+        ListIterator<YangLeaf> leafIterator = container.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("invalid-interval"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("uint16"));
+        assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.UINT16));
+        assertThat(leafInfo.getUnits(), is("\"seconds\""));
+        assertThat(leafInfo.getDescription(), is("\"Interval before a route is declared invalid\""));
+        assertThat(leafInfo.isConfig(), is(true));
+        assertThat(leafInfo.isMandatory(), is(true));
+        assertThat(leafInfo.getStatus(), is(YangStatusType.CURRENT));
+        assertThat(leafInfo.getReference(), is("\"RFC 6020\""));
+    }
+
+    /**
+     * Checks duplicate leaf statement as sub-statement of module.
+     */
+    @Test(expected = ParserException.class)
+    public void processModuleWithDuplicateLeaf() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/ModuleWithDuplicateLeaf.yang");
+    }
+
+    /**
+     * Checks duplicate leaf statement as sub-statement of container.
+     */
+    @Test(expected = ParserException.class)
+    public void processContainerWithDuplicateLeaf() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/ContainerWithDuplicateLeaf.yang");
+    }
+
+    /**
+     * Checks duplicate leaf statement as sub-statement of list.
+     */
+    @Test(expected = ParserException.class)
+    public void processListWithDuplicateLeaf() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/ListWithDuplicateLeaf.yang");
+    }
+
+    /**
+     * Checks leaf statement as sub-statement of list.
+     */
+    @Test
+    public void processListSubStatementLeaf() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/ListSubStatementLeaf.yang");
+
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        // Check whether the list is child of module
+        YangList yangList = (YangList) yangNode.getChild();
+        assertThat(yangList.getName(), is("valid"));
+
+        // Check whether leaf properties as set correctly.
+        ListIterator<YangLeaf> leafIterator = yangList.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("invalid-interval"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("uint16"));
+        assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.UINT16));
+        assertThat(leafInfo.getUnits(), is("\"seconds\""));
+        assertThat(leafInfo.getDescription(), is("\"Interval before a route is declared invalid\""));
+        assertThat(leafInfo.isConfig(), is(true));
+        assertThat(leafInfo.isMandatory(), is(true));
+        assertThat(leafInfo.getStatus(), is(YangStatusType.CURRENT));
+        assertThat(leafInfo.getReference(), is("\"RFC 6020\""));
+    }
+}
diff --git a/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/LengthRestrictionListenerTest.java b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/LengthRestrictionListenerTest.java
new file mode 100644
index 0000000..af9572f
--- /dev/null
+++ b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/LengthRestrictionListenerTest.java
@@ -0,0 +1,334 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.onosproject.yang.compiler.datamodel.YangLeaf;
+import org.onosproject.yang.compiler.datamodel.YangLeafList;
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangNodeType;
+import org.onosproject.yang.compiler.datamodel.YangRangeInterval;
+import org.onosproject.yang.compiler.datamodel.YangRangeRestriction;
+import org.onosproject.yang.compiler.datamodel.YangStringRestriction;
+import org.onosproject.yang.compiler.datamodel.YangTypeDef;
+import org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes;
+import org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangUint64;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.YangUtilsParserManager;
+
+import java.io.IOException;
+import java.math.BigInteger;
+import java.util.ListIterator;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.Is.is;
+
+/**
+ * Test cases for length restriction listener.
+ */
+public class LengthRestrictionListenerTest {
+
+    @Rule
+    public ExpectedException thrown = ExpectedException.none();
+
+    private final YangUtilsParserManager manager = new YangUtilsParserManager();
+
+    /**
+     * Checks valid length statement as sub-statement of leaf statement.
+     */
+    @Test
+    public void processValidLengthStatement() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/ValidLengthStatement.yang");
+
+        assertThat((node instanceof YangModule), is(true));
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("invalid-interval"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("string"));
+        assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.STRING));
+        YangStringRestriction stringRestriction = (YangStringRestriction) leafInfo
+                .getDataType().getDataTypeExtendedInfo();
+        YangRangeRestriction lengthRestriction = stringRestriction.getLengthRestriction();
+
+        ListIterator<YangRangeInterval> lengthListIterator = lengthRestriction.getAscendingRangeIntervals()
+                .listIterator();
+
+        YangRangeInterval rangeInterval = lengthListIterator.next();
+
+        assertThat(((YangUint64) rangeInterval.getStartValue()).getValue(), is(BigInteger.valueOf(0)));
+        assertThat(((YangUint64) rangeInterval.getEndValue()).getValue(), is(BigInteger.valueOf(100)));
+    }
+
+    /**
+     * Checks valid length statement as sub-statement of leaf-list.
+     */
+    @Test
+    public void processLengthStatementInsideLeafList() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/LengthStatementInsideLeafList.yang");
+
+        assertThat((node instanceof YangModule), is(true));
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeafList> leafListIterator = yangNode.getListOfLeafList().listIterator();
+        YangLeafList leafListInfo = leafListIterator.next();
+
+        assertThat(leafListInfo.getName(), is("invalid-interval"));
+        assertThat(leafListInfo.getDataType().getDataTypeName(), is("string"));
+        assertThat(leafListInfo.getDataType().getDataType(), is(YangDataTypes.STRING));
+        YangStringRestriction stringRestriction = (YangStringRestriction) leafListInfo
+                .getDataType().getDataTypeExtendedInfo();
+        YangRangeRestriction lengthRestriction = stringRestriction.getLengthRestriction();
+
+        ListIterator<YangRangeInterval> lengthListIterator = lengthRestriction.getAscendingRangeIntervals()
+                .listIterator();
+
+        YangRangeInterval rangeInterval = lengthListIterator.next();
+        assertThat(((YangUint64) rangeInterval.getStartValue()).getValue(), is(BigInteger.valueOf(1)));
+        assertThat(((YangUint64) rangeInterval.getEndValue()).getValue(), is(BigInteger.valueOf(100)));
+    }
+
+    /**
+     * Checks valid length statement as sub-statement of typedef.
+     */
+    @Test
+    public void processLengthStatementInsideTypeDef() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/LengthStatementInsideTypeDef.yang");
+
+        assertThat((node instanceof YangModule), is(true));
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        YangTypeDef typedef = (YangTypeDef) yangNode.getChild();
+        YangStringRestriction stringRestriction = (YangStringRestriction) typedef.getTypeDefBaseType()
+                .getDataTypeExtendedInfo();
+
+        YangRangeRestriction lengthRestriction = stringRestriction.getLengthRestriction();
+        ListIterator<YangRangeInterval> lengthListIterator = lengthRestriction.getAscendingRangeIntervals()
+                .listIterator();
+        YangRangeInterval rangeInterval = lengthListIterator.next();
+        assertThat(((YangUint64) rangeInterval.getStartValue()).getValue(), is(BigInteger.valueOf(1)));
+        assertThat(((YangUint64) rangeInterval.getEndValue()).getValue(), is(BigInteger.valueOf(100)));
+    }
+
+    /**
+     * Checks valid length statement as sub-statement of binary statement.
+     */
+    @Test
+    public void processValidBinaryLengthStatement() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/ValidBinaryLengthStatement.yang");
+
+        assertThat((node instanceof YangModule), is(true));
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("message"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("binary"));
+        assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.BINARY));
+        YangRangeRestriction lengthRestriction = (YangRangeRestriction) leafInfo
+                                                  .getDataType().getDataTypeExtendedInfo();
+
+        ListIterator<YangRangeInterval> lengthListIterator = lengthRestriction.getAscendingRangeIntervals()
+                .listIterator();
+
+        YangRangeInterval rangeInterval = lengthListIterator.next();
+
+        assertThat(((YangUint64) rangeInterval.getStartValue()).getValue(), is(BigInteger.valueOf(4)));
+        assertThat(((YangUint64) rangeInterval.getEndValue()).getValue(), is(BigInteger.valueOf(4)));
+    }
+
+    /**
+     * Checks length statement with invalid type.
+     */
+    @Test
+    public void processLengthWithInvalidType() throws IOException, ParserException {
+        thrown.expect(ParserException.class);
+        thrown.expectMessage("YANG file error : length name \"1..100\" can be used to restrict the built-in type" +
+                " string/binary or types derived from string/binary.");
+        YangNode node = manager.getDataModel("src/test/resources/LengthWithInvalidType.yang");
+    }
+
+    /**
+     * Checks length statement with only start interval.
+     */
+    @Test
+    public void processLengthWithOneInterval() throws IOException, ParserException {
+
+
+        YangNode node = manager.getDataModel("src/test/resources/LengthWithOneInterval.yang");
+
+        assertThat((node instanceof YangModule), is(true));
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeafList> leafListIterator = yangNode.getListOfLeafList().listIterator();
+        YangLeafList leafListInfo = leafListIterator.next();
+
+        assertThat(leafListInfo.getName(), is("invalid-interval"));
+        assertThat(leafListInfo.getDataType().getDataTypeName(), is("string"));
+        assertThat(leafListInfo.getDataType().getDataType(), is(YangDataTypes.STRING));
+        YangStringRestriction stringRestriction = (YangStringRestriction) leafListInfo
+                .getDataType().getDataTypeExtendedInfo();
+        YangRangeRestriction lengthRestriction = stringRestriction.getLengthRestriction();
+
+        ListIterator<YangRangeInterval> lengthListIterator = lengthRestriction.getAscendingRangeIntervals()
+                .listIterator();
+
+        YangRangeInterval rangeInterval = lengthListIterator.next();
+        assertThat(((YangUint64) rangeInterval.getStartValue()).getValue(), is(BigInteger.valueOf(1)));
+        assertThat(((YangUint64) rangeInterval.getEndValue()).getValue(), is(BigInteger.valueOf(1)));
+    }
+
+    /**
+     * Checks length statement with min and max.
+     */
+    @Test
+    public void processLengthWithMinMax() throws IOException, ParserException {
+
+
+        YangNode node = manager.getDataModel("src/test/resources/LengthWithMinMax.yang");
+
+        assertThat((node instanceof YangModule), is(true));
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeafList> leafListIterator = yangNode.getListOfLeafList().listIterator();
+        YangLeafList leafListInfo = leafListIterator.next();
+
+        assertThat(leafListInfo.getName(), is("invalid-interval"));
+        assertThat(leafListInfo.getDataType().getDataTypeName(), is("string"));
+        assertThat(leafListInfo.getDataType().getDataType(), is(YangDataTypes.STRING));
+        YangStringRestriction stringRestriction = (YangStringRestriction) leafListInfo
+                .getDataType().getDataTypeExtendedInfo();
+        YangRangeRestriction lengthRestriction = stringRestriction.getLengthRestriction();
+
+        ListIterator<YangRangeInterval> lengthListIterator = lengthRestriction.getAscendingRangeIntervals()
+                .listIterator();
+
+        YangRangeInterval rangeInterval = lengthListIterator.next();
+        assertThat(((YangUint64) rangeInterval.getStartValue()).getValue(), is(BigInteger.valueOf(0)));
+        assertThat(((YangUint64) rangeInterval.getEndValue()).getValue(), is(new BigInteger("18446744073709551615")));
+    }
+
+    /**
+     * Checks length statement with invalid integer pattern.
+     */
+    @Test
+    public void processLengthWithInvalidIntegerPattern() throws IOException, ParserException {
+        thrown.expect(ParserException.class);
+        thrown.expectMessage("YANG file error : Input value \"a\" is not a valid uint64.");
+        YangNode node = manager.getDataModel("src/test/resources/LengthWithInvalidIntegerPattern.yang");
+    }
+
+    /**
+     * Checks length statement with invalid interval.
+     */
+    @Test
+    public void processLengthWithInvalidInterval() throws IOException, ParserException {
+        thrown.expect(ParserException.class);
+        thrown.expectMessage("YANG file error : 18446744073709551617 is greater than maximum value" +
+                " 18446744073709551615.");
+        YangNode node = manager.getDataModel("src/test/resources/LengthWithInvalidInterval.yang");
+    }
+
+    /**
+     * Checks valid length substatements.
+     */
+    @Test
+    public void processLengthSubStatements() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/LengthSubStatements.yang");
+
+        assertThat((node instanceof YangModule), is(true));
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("invalid-interval"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("string"));
+        assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.STRING));
+        YangStringRestriction stringRestriction = (YangStringRestriction) leafInfo
+                .getDataType().getDataTypeExtendedInfo();
+        YangRangeRestriction lengthRestriction = stringRestriction.getLengthRestriction();
+
+        assertThat(lengthRestriction.getDescription(), is("\"length description\""));
+        assertThat(lengthRestriction.getReference(), is("\"length reference\""));
+
+        ListIterator<YangRangeInterval> lengthListIterator = lengthRestriction.getAscendingRangeIntervals()
+                .listIterator();
+
+        YangRangeInterval rangeInterval = lengthListIterator.next();
+
+        assertThat(((YangUint64) rangeInterval.getStartValue()).getValue(), is(BigInteger.valueOf(0)));
+        assertThat(((YangUint64) rangeInterval.getEndValue()).getValue(), is(BigInteger.valueOf(100)));
+    }
+
+    /**
+     * Checks whether space can be allowed when length statement is present.
+     */
+    @Test
+    public void processLengthStatementWithSpace() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/LengthStatementWithSpace.yang");
+
+        assertThat((node instanceof YangModule), is(true));
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("invalid-interval"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("string"));
+        assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.STRING));
+        YangStringRestriction stringRestriction = (YangStringRestriction) leafInfo
+                .getDataType().getDataTypeExtendedInfo();
+        YangRangeRestriction lengthRestriction = stringRestriction.getLengthRestriction();
+
+        ListIterator<YangRangeInterval> lengthListIterator = lengthRestriction.getAscendingRangeIntervals()
+                .listIterator();
+
+        YangRangeInterval rangeInterval = lengthListIterator.next();
+
+        assertThat(((YangUint64) rangeInterval.getStartValue()).getValue(), is(BigInteger.valueOf(0)));
+        assertThat(((YangUint64) rangeInterval.getEndValue()).getValue(), is(BigInteger.valueOf(100)));
+    }
+}
diff --git a/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/ListListenerTest.java b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/ListListenerTest.java
new file mode 100644
index 0000000..a8d1524
--- /dev/null
+++ b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/ListListenerTest.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.yang.compiler.parser.impl.listeners;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.onosproject.yang.compiler.datamodel.YangContainer;
+import org.onosproject.yang.compiler.datamodel.YangLeaf;
+import org.onosproject.yang.compiler.datamodel.YangList;
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangNodeType;
+import org.onosproject.yang.compiler.datamodel.YangStatusType;
+import org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.YangUtilsParserManager;
+
+import java.io.IOException;
+import java.util.ListIterator;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.Is.is;
+
+/**
+ * Test cases for testing list listener.
+ */
+public class ListListenerTest {
+
+    @Rule
+    public ExpectedException thrown = ExpectedException.none();
+
+    private final YangUtilsParserManager manager = new YangUtilsParserManager();
+
+    /**
+     * Checks list statement as sub-statement of module.
+     */
+    @Test
+    public void processModuleSubStatementList() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/ModuleSubStatementList.yang");
+
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        // Check whether the list is child of module
+        YangList yangList = (YangList) yangNode.getChild();
+        assertThat(yangList.getName(), is("valid"));
+
+        ListIterator<String> keyList = yangList.getKeyList().listIterator();
+        assertThat(keyList.next(), is("invalid-interval"));
+    }
+
+    /**
+     * Checks list statement as sub-statement of container.
+     */
+    @Test
+    public void processContainerSubStatementList() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/ContainerSubStatementList.yang");
+
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        // Check whether the container is child of module
+        YangContainer yangContainer = (YangContainer) yangNode.getChild();
+        assertThat(yangContainer.getName(), is("ospf"));
+
+        // Check whether the list is child of container
+        YangList yangList = (YangList) yangContainer.getChild();
+        assertThat(yangList.getName(), is("valid"));
+        assertThat(yangList.getKeyList().contains("invalid-interval"), is(true));
+    }
+
+    /**
+     * Checks list statement as sub-statement of list.
+     */
+    @Test
+    public void processListSubStatementList() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/ListSubStatementList.yang");
+
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        // Check whether the list is child of module
+        YangList yangList1 = (YangList) yangNode.getChild();
+        assertThat(yangList1.getName(), is("ospf"));
+        assertThat(yangList1.getKeyList().contains("process-id"), is(true));
+
+        // Check whether the list is child of list
+        YangList yangList = (YangList) yangList1.getChild();
+        assertThat(yangList.getName(), is("valid"));
+        assertThat(yangList.getKeyList().contains("invalid-interval"), is(true));
+    }
+
+    /**
+     * Checks list with all its sub-statements.
+     */
+    @Test
+    public void processListSubStatements() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/ListSubStatements.yang");
+
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        // Check whether the list is child of module
+        YangList yangList = (YangList) yangNode.getChild();
+
+        // Check whether list properties as set correctly.
+        assertThat(yangList.getName(), is("ospf"));
+        assertThat(yangList.getKeyList().contains("invalid-interval"), is(true));
+
+        assertThat(yangList.isConfig(), is(true));
+        assertThat(yangList.getMaxElements().getMaxElement(), is(10));
+        assertThat(yangList.getMinElements().getMinElement(), is(3));
+        assertThat(yangList.getDescription(), is("\"list description\""));
+        assertThat(yangList.getStatus(), is(YangStatusType.CURRENT));
+        assertThat(yangList.getReference(), is("\"list reference\""));
+
+        // Check whether leaf properties as set correctly.
+        ListIterator<YangLeaf> leafIterator = yangList.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("invalid-interval"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("uint16"));
+        assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.UINT16));
+        assertThat(leafInfo.getUnits(), is("\"seconds\""));
+        assertThat(leafInfo.getStatus(), is(YangStatusType.CURRENT));
+        assertThat(leafInfo.getReference(), is("\"RFC 6020\""));
+    }
+
+    /**
+     * Checks cardinality of sub-statements of list.
+     */
+    @Test
+    public void processListSubStatementsCardinality() throws IOException, ParserException {
+        thrown.expect(ParserException.class);
+        thrown.expectMessage("YANG file error: \"reference\" is defined more than once in \"list valid\".");
+        YangNode node = manager.getDataModel("src/test/resources/ListSubStatementsCardinality.yang");
+    }
+
+    /**
+     * Checks list statement without child.
+     */
+    @Test
+    public void processListStatementWithoutChild() throws IOException, ParserException {
+        thrown.expect(ParserException.class);
+        thrown.expectMessage("YANG file error: Missing \"data-def-substatements\" in \"list valid\".");
+        YangNode node = manager.getDataModel("src/test/resources/ListStatementWithoutChild.yang");
+    }
+
+    /**
+     * Checks list as root node.
+     */
+    @Test
+    public void processListAsRootNode() throws IOException, ParserException {
+        thrown.expect(ParserException.class);
+        thrown.expectMessage("no viable alternative at input 'list'");
+        YangNode node = manager.getDataModel("src/test/resources/ListAsRootNode.yang");
+    }
+
+    /**
+     * Checks invalid identifier for list statement.
+     */
+    @Test
+    public void processListInvalidIdentifier() throws IOException, ParserException {
+        thrown.expect(ParserException.class);
+        thrown.expectMessage("YANG file error : list name 1valid is not valid.");
+        YangNode node = manager.getDataModel("src/test/resources/ListInvalidIdentifier.yang");
+    }
+
+    /**
+     * Checks list with identifier name as enum.
+     */
+    @Test
+    public void processListWithIdentifierNameEnum() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/ListWithIdentifierNameEnum.yang");
+
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        // Check whether the list is child of module
+        YangList yangList = (YangList) yangNode.getChild();
+        assertThat(yangList.getName(), is("enumList"));
+        assertThat(yangList.getKeyList().contains("enum"), is(true));
+        YangLeaf leaf = yangList.getListOfLeaf().iterator().next();
+        assertThat(leaf.getName(), is("enum"));
+        assertThat(leaf.getDataType().getDataType(), is(YangDataTypes.ENUMERATION));
+    }
+}
diff --git a/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/MandatoryListenerTest.java b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/MandatoryListenerTest.java
new file mode 100644
index 0000000..31f0995
--- /dev/null
+++ b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/MandatoryListenerTest.java
@@ -0,0 +1,143 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.onosproject.yang.compiler.datamodel.YangLeaf;
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangNodeType;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.YangUtilsParserManager;
+
+import java.io.IOException;
+import java.util.ListIterator;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.Is.is;
+
+/**
+ * Test case for mandatory listener.
+ */
+public class MandatoryListenerTest {
+
+    @Rule
+    public ExpectedException thrown = ExpectedException.none();
+
+    private final YangUtilsParserManager manager = new YangUtilsParserManager();
+
+    /**
+     * Checks valid mandatory with value true statement.
+     */
+    @Test
+    public void processMandatoryTrue() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/MandatoryTrue.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        // Check whether the mandatory value is set correctly.
+        assertThat(leafInfo.getName(), is("invalid-interval"));
+        assertThat(leafInfo.isMandatory(), is(true));
+    }
+
+    /**
+     * Checks valid mandatory with value false statement.
+     */
+    @Test
+    public void processMandatoryFalse() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/MandatoryFalse.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        // Check whether the mandatory value is set correctly.
+        assertThat(leafInfo.getName(), is("invalid-interval"));
+        assertThat(leafInfo.isMandatory(), is(false));
+    }
+
+    /**
+     * Checks default value of mandatory statement.
+     */
+    @Test
+    public void processMandatoryDefaultValue() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/MandatoryDefaultValue.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        // Check whether the mandatory value is set correctly.
+        assertThat(leafInfo.getName(), is("invalid-interval"));
+        assertThat(leafInfo.isMandatory(), is(false));
+    }
+
+    /**
+     * Checks invalid of mandatory statement and expects exception.
+     */
+    @Test
+    public void processMandatoryEmptyStatement() throws IOException, ParserException {
+        thrown.expect(ParserException.class);
+        thrown.expectMessage("no viable alternative at input ';'");
+        YangNode node = manager.getDataModel("src/test/resources/MandatoryEmptyStatement.yang");
+    }
+
+    /**
+     * Checks invalid mandatory statement(without statement end) and expects
+     * exception.
+     */
+    @Test
+    public void processMandatoryWithoutStatementEnd() throws IOException, ParserException {
+        thrown.expect(ParserException.class);
+        thrown.expectMessage("missing ';' at '}'");
+        YangNode node = manager.getDataModel("src/test/resources/MandatoryWithoutStatementEnd.yang");
+    }
+}
diff --git a/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/MaxElementsListenerTest.java b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/MaxElementsListenerTest.java
new file mode 100644
index 0000000..7691acb
--- /dev/null
+++ b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/MaxElementsListenerTest.java
@@ -0,0 +1,177 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.onosproject.yang.compiler.datamodel.YangLeafList;
+import org.onosproject.yang.compiler.datamodel.YangList;
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangNodeType;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.YangUtilsParserManager;
+
+import java.io.IOException;
+import java.util.ListIterator;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.Is.is;
+
+/**
+ * Test cases for testing max-elements listener.
+ */
+public class MaxElementsListenerTest {
+
+    @Rule
+    public ExpectedException thrown = ExpectedException.none();
+
+    private final YangUtilsParserManager manager = new YangUtilsParserManager();
+
+    /**
+     * Checks max-elements as sub-statements of leaf-list.
+     */
+    @Test
+    public void processLeafListSubStatementMaxElements() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/LeafListSubStatementMaxElements.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeafList> leafListIterator = yangNode.getListOfLeafList().listIterator();
+        YangLeafList leafListInfo = leafListIterator.next();
+
+        assertThat(leafListInfo.getName(), is("invalid-interval"));
+        assertThat(leafListInfo.getMaxElements().getMaxElement(), is(3));
+    }
+
+    /**
+     * Checks max-elements as sub-statements of list.
+     */
+    @Test
+    public void processListSubStatementMaxElements() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/ListSubStatementMaxElements.yang");
+
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        // Check whether the list is child of module
+        YangList yangList = (YangList) yangNode.getChild();
+        assertThat(yangList.getName(), is("valid"));
+        assertThat(yangList.getMaxElements().getMaxElement(), is(3));
+    }
+
+    /**
+     * Checks whether exception is thrown when max-elements statement without
+     * statement end is given as input.
+     */
+    @Test
+    public void processMaxElementsWithoutStatementEnd() throws IOException, ParserException {
+        thrown.expect(ParserException.class);
+        thrown.expectMessage("missing ';' at 'description'");
+        YangNode node = manager.getDataModel("src/test/resources/MaxElementsWithoutStatementEnd.yang");
+    }
+
+    /**
+     * Checks whether exception is thrown when max-elements cardinality is not
+     * as per the grammar.
+     */
+    @Test
+    public void processMaxElementsCardinality() throws IOException, ParserException {
+        thrown.expect(ParserException.class);
+        thrown.expectMessage("YANG file error: \"max-elements\" is defined more than once in \"leaf-list " +
+                "invalid-interval\".");
+        YangNode node = manager.getDataModel("src/test/resources/MaxElementsCardinality.yang");
+    }
+
+    /**
+     * Checks unbounded value of max-elements statement.
+     */
+    @Test
+    public void processMaxElementsUnbounded() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/MaxElementsUnbounded.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeafList> leafListIterator = yangNode.getListOfLeafList().listIterator();
+        YangLeafList leafListInfo = leafListIterator.next();
+
+        assertThat(leafListInfo.getName(), is("invalid-interval"));
+        assertThat(leafListInfo.getMaxElements().getMaxElement(), is(2147483647));
+    }
+
+    /**
+     * Checks default value of max-elements statement.
+     */
+    @Test
+    public void processMaxElementsDefaultValue() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/MaxElementsDefaultValue.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeafList> leafListIterator = yangNode.getListOfLeafList().listIterator();
+        YangLeafList leafListInfo = leafListIterator.next();
+
+        assertThat(leafListInfo.getName(), is("invalid-interval"));
+        assertThat(leafListInfo.getMaxElements().getMaxElement(), is(2147483647));
+    }
+
+    /**
+     * Checks whether exception is thrown when invalid min-elements value is
+     * given as input.
+     */
+    @Test
+    public void processMaxElementsMaxValue() throws IOException, ParserException {
+        thrown.expect(ParserException.class);
+        thrown.expectMessage("YANG file error : max-elements value 77777777777777777777777 is not valid.");
+        YangNode node = manager.getDataModel("src/test/resources/MaxElementsMaxValue.yang");
+    }
+}
diff --git a/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/MinElementsListenerTest.java b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/MinElementsListenerTest.java
new file mode 100644
index 0000000..e43c4e0
--- /dev/null
+++ b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/MinElementsListenerTest.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.yang.compiler.parser.impl.listeners;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.onosproject.yang.compiler.datamodel.YangLeafList;
+import org.onosproject.yang.compiler.datamodel.YangList;
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangNodeType;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.YangUtilsParserManager;
+
+import java.io.IOException;
+import java.util.ListIterator;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.Is.is;
+
+/**
+ * Test cases for testing min-elements listener.
+ */
+public class MinElementsListenerTest {
+
+    @Rule
+    public ExpectedException thrown = ExpectedException.none();
+
+    private final YangUtilsParserManager manager = new YangUtilsParserManager();
+
+    /**
+     * Checks min-elements as sub-statements of leaf-list.
+     */
+    @Test
+    public void processLeafListSubStatementMinElements() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/LeafListSubStatementMinElements.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeafList> leafListIterator = yangNode.getListOfLeafList().listIterator();
+        YangLeafList leafListInfo = leafListIterator.next();
+
+        assertThat(leafListInfo.getName(), is("invalid-interval"));
+        assertThat(leafListInfo.getMinElements().getMinElement(), is(3));
+    }
+
+    /**
+     * Checks min-elements as sub-statements of list.
+     */
+    @Test
+    public void processListSubStatementMinElements() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/ListSubStatementMinElements.yang");
+
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        // Check whether the list is child of module
+        YangList yangList = (YangList) yangNode.getChild();
+        assertThat(yangList.getName(), is("valid"));
+        assertThat(yangList.getMinElements().getMinElement(), is(3));
+    }
+
+    /**
+     * Checks whether exception is thrown when invalid min-elements value is
+     * given as input.
+     */
+    @Test
+    public void processMinElementsInvalidValue() throws IOException, ParserException {
+        thrown.expect(ParserException.class);
+        thrown.expectMessage("YANG file error : min-elements value asd is not valid.");
+        YangNode node = manager.getDataModel("src/test/resources/MinElementsInvalidValue.yang");
+    }
+
+    /**
+     * Checks whether exception is thrown when invalid min-elements value is
+     * given as input.
+     */
+    @Test
+    public void processMinElementsMaxValue() throws IOException, ParserException {
+        thrown.expect(ParserException.class);
+        thrown.expectMessage("YANG file error : min-elements value 77777777777777777777777 is not valid.");
+        YangNode node = manager.getDataModel("src/test/resources/MinElementsMaxValue.yang");
+    }
+
+    /**
+     * Checks whether exception is thrown when min-elements statement without
+     * statement end is given as input.
+     */
+    @Test
+    public void processMinElementsWithoutStatementEnd() throws IOException, ParserException {
+        thrown.expect(ParserException.class);
+        thrown.expectMessage("missing ';' at 'description'");
+        YangNode node = manager.getDataModel("src/test/resources/MinElementsWithoutStatementEnd.yang");
+    }
+
+    /**
+     * Checks whether exception is thrown when min-elements cardinality is not
+     * as per the grammar.
+     */
+    @Test
+    public void processMinElementsInvalidCardinality() throws IOException, ParserException {
+        thrown.expect(ParserException.class);
+        thrown.expectMessage("YANG file error: \"min-elements\" is defined more than once in \"leaf-list " +
+                "invalid-interval\".");
+        YangNode node = manager.getDataModel("src/test/resources/MinElementsInvalidCardinality.yang");
+    }
+
+    /**
+     * Checks min-element's default value.
+     */
+    @Test
+    public void processMinElementsDefaultValue() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/MinElementsDefaultValue.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeafList> leafListIterator = yangNode.getListOfLeafList().listIterator();
+        YangLeafList leafListInfo = leafListIterator.next();
+
+        assertThat(leafListInfo.getName(), is("invalid-interval"));
+        assertThat(leafListInfo.getMinElements().getMinElement(), is(0));
+    }
+}
diff --git a/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/ModuleListenerTest.java b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/ModuleListenerTest.java
new file mode 100644
index 0000000..5483ea6
--- /dev/null
+++ b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/ModuleListenerTest.java
@@ -0,0 +1,81 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangNodeType;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.YangUtilsParserManager;
+
+import java.io.IOException;
+
+import static org.hamcrest.core.Is.is;
+import static org.junit.Assert.assertThat;
+
+/**
+ * Test cases for testing module listener functionality.
+ */
+public class ModuleListenerTest {
+
+    private final YangUtilsParserManager manager = new YangUtilsParserManager();
+
+    @Rule
+    public ExpectedException thrown = ExpectedException.none();
+
+    /**
+     * Checks if module listener updates the data model root node.
+     */
+    @Test
+    public void processModuleValidEntry() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/ModuleValidEntry.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+    }
+
+    /**
+     * Checks if module name is set correctly.
+     */
+    @Test(expected = ParserException.class)
+    public void processModuleInvalidEntryTest() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/ModuleWithInvalidIdentifier.yang");
+    }
+
+    /**
+     * Checks whether exception is thrown when module length is greater than 64 characters.
+     */
+    @Test
+    public void processModuleInvalidIdentifierLength() throws IOException, ParserException {
+        thrown.expect(ParserException.class);
+        thrown.expectMessage("YANG file error : module name Testttttttttttttttttttttttttttttttttttttttttttttttttttt" +
+                "tttttttttt is greater than 64 characters.");
+        YangNode node = manager.getDataModel("src/test/resources/ModuleInvalidIdentifierLength.yang");
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/MustListenerTest.java b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/MustListenerTest.java
new file mode 100644
index 0000000..2793420
--- /dev/null
+++ b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/MustListenerTest.java
@@ -0,0 +1,84 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.junit.Test;
+import org.onosproject.yang.compiler.datamodel.YangContainer;
+import org.onosproject.yang.compiler.datamodel.YangLeaf;
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangMust;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.YangUtilsParserManager;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.ListIterator;
+
+import static org.hamcrest.core.Is.is;
+import static org.junit.Assert.assertThat;
+
+/**
+ * Test cases for testing must listener functionality.
+ */
+public class MustListenerTest {
+
+    private final YangUtilsParserManager manager = new YangUtilsParserManager();
+
+    /**
+     * Checks if must listener updates the data model.
+     */
+    @Test
+    public void processContainerSubStatementMust() throws IOException, ParserException {
+        YangNode node = manager.getDataModel("src/test/resources/ContainerSubStatementMust.yang");
+
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        YangContainer yangContainer = (YangContainer) yangNode.getChild();
+        assertThat(yangContainer.getName(), is("interface"));
+
+        String expectedConstraint = "ifType != 'ethernet' or (ifType = 'ethernet' and ifMTU = 1500)";
+        List<YangMust> mustConstraintList = yangContainer.getListOfMust();
+        assertThat(mustConstraintList.iterator().next().getConstraint(), is(expectedConstraint));
+    }
+
+    /**
+     * Checks if must listener updates the data model.
+     */
+    @Test
+    public void processLeafSubStatementMust() throws IOException, ParserException {
+        YangNode node = manager.getDataModel("src/test/resources/LeafSubStatementMust.yang");
+
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getListOfMust().iterator().next().getConstraint(), is("ifType != 'ethernet'"));
+    }
+
+    /**
+     * Checks whether there is no parser exception when must statement is sub-statement of
+     * unsupported yang construct.
+     */
+    @Test
+    public void processUnsupportedSubStatementMust() throws IOException, ParserException {
+        YangNode node = manager.getDataModel("src/test/resources/UnsupportedYangConstructSubStatementMust.yang");
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/NamespaceListenerTest.java b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/NamespaceListenerTest.java
new file mode 100644
index 0000000..745b882
--- /dev/null
+++ b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/NamespaceListenerTest.java
@@ -0,0 +1,88 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.junit.Test;
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.YangUtilsParserManager;
+
+import java.io.IOException;
+
+import static org.hamcrest.core.Is.is;
+import static org.junit.Assert.assertThat;
+
+/**
+ * Test cases for testing namespace listener functionality.
+ */
+public class NamespaceListenerTest {
+
+    private final YangUtilsParserManager manager = new YangUtilsParserManager();
+
+    /**
+     * Checks that value of namespace shouldn't have invalid spaces.
+     */
+    @Test(expected = ParserException.class)
+    public void processNamespaceWithInvalidSpaces() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/NamespaceWithInvalidSpaces.yang");
+    }
+
+    /**
+     * Checks if namespace with double quotes is allowed.
+     */
+    @Test()
+    public void processNamespaceInDoubleQuotes() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/NamespaceInDoubleQuotes.yang");
+
+        // Checks for the version value in data model tree.
+        assertThat(((YangModule) node).getModuleNamespace(), is
+                ("urn:ietf:params:xml:ns:yang:ietf-ospf"));
+    }
+
+    /**
+     * Checks if namespace without double quotes is allowed.
+     */
+    @Test()
+    public void processNamespaceWithoutQuotes() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/NamespaceWithoutQuotes.yang");
+
+        // Checks for the version value in data model tree.
+        assertThat(((YangModule) node).getModuleNamespace(), is("urn:ietf:params:xml:ns:yang:ietf-ospf"));
+    }
+
+    /**
+     * Checks if namespace is present only once.
+     */
+    @Test(expected = ParserException.class)
+    public void processNamespaceDualEntry() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/NamespaceDualEntry.yang");
+    }
+
+    /**
+     * Checks if mandatory parameter namespace is present.
+     */
+    @Test(expected = ParserException.class)
+    public void processNamespaceNoEntryTest() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/NamespaceNoEntryTest.yang");
+    }
+}
diff --git a/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/NotificationListenerTest.java b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/NotificationListenerTest.java
new file mode 100644
index 0000000..2741786
--- /dev/null
+++ b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/NotificationListenerTest.java
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.junit.Test;
+import org.onosproject.yang.compiler.datamodel.YangLeaf;
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangNodeType;
+import org.onosproject.yang.compiler.datamodel.YangNotification;
+import org.onosproject.yang.compiler.datamodel.YangStatusType;
+import org.onosproject.yang.compiler.datamodel.YangTypeDef;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.YangUtilsParserManager;
+
+import java.io.IOException;
+import java.util.ListIterator;
+
+import static org.hamcrest.core.Is.is;
+import static org.junit.Assert.assertThat;
+
+/**
+ * Test cases for testing notification listener functionality.
+ */
+public class NotificationListenerTest {
+
+    private final YangUtilsParserManager manager = new YangUtilsParserManager();
+
+    /**
+     * Checks valid notification statement.
+     */
+    @Test
+    public void processValidNotificationStatement() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/ValidNotificationStatement.yang");
+
+        assertThat((node instanceof YangModule), is(true));
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("rock"));
+
+        YangNotification yangNotification = (YangNotification) yangNode.getChild();
+        assertThat(yangNotification.getName(), is("link-failure"));
+        assertThat(yangNotification.getDescription(), is("\"A link failure has been detected\""));
+        assertThat(yangNotification.getStatus(), is(YangStatusType.DEPRECATED));
+        assertThat(yangNotification.getReference(), is("\"reference\""));
+
+        YangTypeDef typeDef = (YangTypeDef) yangNotification.getChild();
+        assertThat(typeDef.getName(), is("my-type"));
+        assertThat(typeDef.getStatus(), is(YangStatusType.DEPRECATED));
+
+        ListIterator<YangLeaf> leafIterator = yangNotification.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("if-name"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("string"));
+    }
+}
diff --git a/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/OrganizationListenerTest.java b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/OrganizationListenerTest.java
new file mode 100644
index 0000000..b0b7fb0
--- /dev/null
+++ b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/OrganizationListenerTest.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.yang.compiler.parser.impl.listeners;
+
+import org.junit.Test;
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.YangUtilsParserManager;
+
+import java.io.IOException;
+
+import static org.hamcrest.core.Is.is;
+import static org.junit.Assert.assertThat;
+
+/**
+ * Test cases for testing organization listener functionality.
+ */
+public class OrganizationListenerTest {
+
+    private final YangUtilsParserManager manager = new YangUtilsParserManager();
+
+    /**
+     * Checks if organization listener updates the data model tree.
+     */
+    @Test
+    public void processOrganizationValidEntry() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/OrganizationValidEntry.yang");
+
+        // Checks for the version value in data model tree.
+        assertThat(((YangModule) node).getOrganization(), is("\"IETF SPRING Working Group\""));
+    }
+
+    /**
+     * Checks that organization must be present only once.
+     */
+    @Test(expected = ParserException.class)
+    public void processOrganizationDualEntry() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/OrganizationDualEntry.yang");
+    }
+
+    /**
+     * Checks if organization entry syntax is correct.
+     */
+    @Test(expected = ParserException.class)
+    public void processOrganizationMissingValue() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/OrganizationMissingValue.yang");
+    }
+
+    /**
+     * Checks if organization and namespace is present in correct order.
+     */
+    @Test(expected = ParserException.class)
+    public void processOrganizationInvalidOrder() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/OrganizationInvalidOrder.yang");
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/OutputListenerTest.java b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/OutputListenerTest.java
new file mode 100644
index 0000000..4a73a99
--- /dev/null
+++ b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/OutputListenerTest.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.yang.compiler.parser.impl.listeners;
+
+import org.junit.Test;
+import org.onosproject.yang.compiler.datamodel.YangContainer;
+import org.onosproject.yang.compiler.datamodel.YangLeaf;
+import org.onosproject.yang.compiler.datamodel.YangList;
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangNodeType;
+import org.onosproject.yang.compiler.datamodel.YangOutput;
+import org.onosproject.yang.compiler.datamodel.YangRpc;
+import org.onosproject.yang.compiler.datamodel.YangStatusType;
+import org.onosproject.yang.compiler.datamodel.YangTypeDef;
+import org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.YangUtilsParserManager;
+
+import java.io.IOException;
+import java.util.ListIterator;
+
+import static org.hamcrest.core.Is.is;
+import static org.junit.Assert.assertThat;
+
+/**
+ * Test cases for testing output listener functionality.
+ */
+public class OutputListenerTest {
+
+    private final YangUtilsParserManager manager = new YangUtilsParserManager();
+
+    /**
+     * Checks output statements with data definition statements as sub-statements.
+     */
+    @Test
+    public void processOutputStatementWithDataDefinition() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/OutputStatementWithDataDefinition.yang");
+
+        assertThat((node instanceof YangModule), is(true));
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("rock"));
+
+        YangRpc yangRpc = (YangRpc) yangNode.getChild();
+        assertThat(yangRpc.getName(), is("activate-software-image"));
+
+        YangOutput yangOutput = (YangOutput) yangRpc.getChild();
+        assertThat(yangOutput.getName(), is("output"));
+
+        ListIterator<YangLeaf> leafIterator = yangOutput.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("image-name"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("string"));
+
+        YangList yangList = (YangList) yangOutput.getChild();
+        assertThat(yangList.getName(), is("ospf"));
+        assertThat(yangList.getKeyList().contains("invalid-interval"), is(true));
+        assertThat(yangList.isConfig(), is(true));
+        assertThat(yangList.getMaxElements().getMaxElement(), is(10));
+        assertThat(yangList.getMinElements().getMinElement(), is(3));
+        leafIterator = yangList.getListOfLeaf().listIterator();
+        leafInfo = leafIterator.next();
+        assertThat(leafInfo.getName(), is("invalid-interval"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("uint16"));
+
+        YangContainer yangContainer = (YangContainer) yangList.getNextSibling();
+        assertThat(yangContainer.getName(), is("isis"));
+
+        leafIterator = yangContainer.getListOfLeaf().listIterator();
+        leafInfo = leafIterator.next();
+        assertThat(leafInfo.getName(), is("invalid-interval"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("uint16"));
+    }
+
+    /**
+     * Checks output statements with type-def statement as sub-statements.
+     */
+    @Test
+    public void processOutputStatementWithTypedef() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/OutputStatementWithTypedef.yang");
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("rock"));
+
+        YangRpc yangRpc = (YangRpc) yangNode.getChild();
+        assertThat(yangRpc.getName(), is("activate-software-image"));
+
+        YangOutput yangOutput = (YangOutput) yangRpc.getChild();
+        assertThat(yangOutput.getName(), is("output"));
+
+        YangTypeDef typeDef = (YangTypeDef) yangOutput.getChild();
+        assertThat(typeDef.getName(), is("my-type"));
+        assertThat(typeDef.getStatus(), is(YangStatusType.DEPRECATED));
+        assertThat(typeDef.getName(), is("my-type"));
+        assertThat(typeDef.getStatus(), is(YangStatusType.DEPRECATED));
+        assertThat(typeDef.getTypeDefBaseType().getDataType(), is(YangDataTypes.INT32));
+    }
+}
diff --git a/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/PatternRestrictionListenerTest.java b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/PatternRestrictionListenerTest.java
new file mode 100644
index 0000000..ce63ef2
--- /dev/null
+++ b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/PatternRestrictionListenerTest.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.yang.compiler.parser.impl.listeners;
+
+import org.hamcrest.core.Is;
+import org.junit.Test;
+import org.onosproject.yang.compiler.datamodel.YangLeaf;
+import org.onosproject.yang.compiler.datamodel.YangLeafList;
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangNodeType;
+import org.onosproject.yang.compiler.datamodel.YangPatternRestriction;
+import org.onosproject.yang.compiler.datamodel.YangStringRestriction;
+import org.onosproject.yang.compiler.datamodel.YangTypeDef;
+import org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.YangUtilsParserManager;
+
+import java.io.IOException;
+import java.util.ListIterator;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.Is.is;
+
+/**
+ * Test cases for pattern restriction listener.
+ */
+public class PatternRestrictionListenerTest {
+
+    private final YangUtilsParserManager manager = new YangUtilsParserManager();
+
+    /**
+     * Checks valid pattern statement as sub-statement of leaf statement.
+     */
+    @Test
+    public void processValidPatternStatement() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/ValidPatternStatement.yang");
+
+        assertThat((node instanceof YangModule), is(true));
+        assertThat(node.getNodeType(), Is.is(YangNodeType.MODULE_NODE));
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("invalid-interval"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("string"));
+        assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.STRING));
+        YangStringRestriction stringRestriction = (YangStringRestriction) leafInfo
+                .getDataType().getDataTypeExtendedInfo();
+        ListIterator<String> patternListIterator = stringRestriction.getPatternRestriction()
+                .getPatternList().listIterator();
+        assertThat(patternListIterator.next(), is("[a-zA-Z]"));
+
+        leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("ipv4-address"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("string"));
+        assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.STRING));
+        stringRestriction = (YangStringRestriction) leafInfo
+                .getDataType().getDataTypeExtendedInfo();
+        patternListIterator = stringRestriction.getPatternRestriction()
+                .getPatternList().listIterator();
+        assertThat(patternListIterator.next(), is(
+                "(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.){3}" +
+                        "([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])" +
+                        "(%[\\p{N}\\p{L}]+)?"));
+    }
+
+    /**
+     * Checks valid pattern statement as sub-statement of leaf-list.
+     */
+    @Test
+    public void processPatternStatementInsideLeafList() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/PatternStatementInsideLeafList.yang");
+
+        assertThat((node instanceof YangModule), is(true));
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeafList> leafListIterator = yangNode.getListOfLeafList().listIterator();
+        YangLeafList leafListInfo = leafListIterator.next();
+
+        assertThat(leafListInfo.getName(), is("invalid-interval"));
+        assertThat(leafListInfo.getDataType().getDataTypeName(), is("string"));
+        assertThat(leafListInfo.getDataType().getDataType(), is(YangDataTypes.STRING));
+        YangStringRestriction stringRestriction = (YangStringRestriction) leafListInfo
+                .getDataType().getDataTypeExtendedInfo();
+        ListIterator<String> patternListIterator = stringRestriction.getPatternRestriction()
+                .getPatternList().listIterator();
+        assertThat(patternListIterator.next(), is("[a-zA-Z]"));
+    }
+
+    /**
+     * Checks valid pattern statement as sub-statement of typedef.
+     */
+    @Test
+    public void processPatternStatementInsideTypeDef() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/PatternStatementInsideTypeDef.yang");
+
+        assertThat((node instanceof YangModule), is(true));
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        YangTypeDef typedef = (YangTypeDef) yangNode.getChild();
+        YangStringRestriction stringRestriction = (YangStringRestriction) typedef.getTypeDefBaseType()
+                .getDataTypeExtendedInfo();
+
+        YangPatternRestriction yangPatternRestriction = stringRestriction.getPatternRestriction();
+        assertThat(yangPatternRestriction.getPatternList().listIterator().next(), is("[a-zA-Z]"));
+    }
+
+    /**
+     * Checks valid multiple pattern statements.
+     */
+    @Test
+    public void processMultiplePatternStatement() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/MultiplePatternStatement.yang");
+
+        assertThat((node instanceof YangModule), is(true));
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeafList> leafListIterator = yangNode.getListOfLeafList().listIterator();
+        YangLeafList leafListInfo = leafListIterator.next();
+
+        assertThat(leafListInfo.getName(), is("invalid-interval"));
+        assertThat(leafListInfo.getDataType().getDataTypeName(), is("string"));
+        assertThat(leafListInfo.getDataType().getDataType(), is(YangDataTypes.STRING));
+        YangStringRestriction stringRestriction = (YangStringRestriction) leafListInfo
+                .getDataType().getDataTypeExtendedInfo();
+        ListIterator<String> patternListIterator = stringRestriction.getPatternRestriction()
+                .getPatternList().listIterator();
+        assertThat(patternListIterator.next(), is("[a-zA-Z]"));
+    }
+
+    /**
+     * Checks valid pattern statement with plus symbol in pattern.
+     */
+    @Test
+    public void processPatternStatementWithPlus() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/PatternStatementWithPlus.yang");
+
+        assertThat((node instanceof YangModule), is(true));
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeafList> leafListIterator = yangNode.getListOfLeafList().listIterator();
+        YangLeafList leafListInfo = leafListIterator.next();
+
+        assertThat(leafListInfo.getName(), is("invalid-interval"));
+        assertThat(leafListInfo.getDataType().getDataTypeName(), is("string"));
+        assertThat(leafListInfo.getDataType().getDataType(), is(YangDataTypes.STRING));
+        YangStringRestriction stringRestriction = (YangStringRestriction) leafListInfo
+                .getDataType().getDataTypeExtendedInfo();
+        ListIterator<String> patternListIterator = stringRestriction.getPatternRestriction()
+                .getPatternList().listIterator();
+        //FIXME: + should not be remove from the end.
+        //assertThat(patternListIterator.next(), is("-[0-9]+|[0-9]+"));
+    }
+
+    /**
+     * Checks valid pattern substatement.
+     */
+    @Test
+    public void processPatternSubStatements() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/PatternSubStatements.yang");
+
+        assertThat((node instanceof YangModule), is(true));
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("invalid-interval"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("string"));
+        assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.STRING));
+        YangStringRestriction stringRestriction = (YangStringRestriction) leafInfo
+                .getDataType().getDataTypeExtendedInfo();
+        assertThat(stringRestriction.getDescription(), is("\"pattern description\""));
+        assertThat(stringRestriction.getReference(), is("\"pattern reference\""));
+        ListIterator<String> patternListIterator = stringRestriction.getPatternRestriction()
+                .getPatternList().listIterator();
+        assertThat(patternListIterator.next(), is("[a-zA-Z]"));
+    }
+
+    /**
+     * Checks invalid pattern sub-statement.
+     */
+    @Test(expected = ParserException.class)
+    public void processInvalidPatternSubStatements() throws IOException, ParserException {
+        YangNode node = manager.getDataModel("src/test/resources/InvalidPatternSubStatements.yang");
+    }
+}
diff --git a/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/PositionListenerTest.java b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/PositionListenerTest.java
new file mode 100644
index 0000000..ec9d0fc
--- /dev/null
+++ b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/PositionListenerTest.java
@@ -0,0 +1,260 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.hamcrest.core.Is;
+import org.junit.Test;
+import org.onosproject.yang.compiler.datamodel.YangBit;
+import org.onosproject.yang.compiler.datamodel.YangBits;
+import org.onosproject.yang.compiler.datamodel.YangLeaf;
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangNodeType;
+import org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.YangUtilsParserManager;
+
+import java.io.IOException;
+import java.util.ListIterator;
+import java.util.Map;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.Is.is;
+
+/**
+ * Test cases for position listener.
+ */
+public class PositionListenerTest {
+
+    private final YangUtilsParserManager manager = new YangUtilsParserManager();
+
+    /**
+     * Checks explicitly configured value.
+     */
+    @Test
+    public void processPositionStatement() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/PositionStatement.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), Is.is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("mybits"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("bits"));
+        assertThat(leafInfo.getDataType().getDataType(), Is.is(YangDataTypes.BITS));
+        assertThat(((YangBits) leafInfo.getDataType().getDataTypeExtendedInfo()).getBitsName(),
+                is("mybits"));
+
+        // Check bit name map
+        Map<String, YangBit> bitNameMap = ((YangBits) leafInfo.getDataType().getDataTypeExtendedInfo()).getBitNameMap();
+        assertThat(bitNameMap.size(), is(3));
+        for (Map.Entry<String, YangBit> element : bitNameMap.entrySet()) {
+            String bitName = element.getKey();
+            YangBit yangBit = element.getValue();
+            if (bitName.equals("disable-nagle")) {
+                assertThat(yangBit.getPosition(), is(0));
+            } else if (bitName.equals("auto-sense-speed")) {
+                assertThat(yangBit.getPosition(), is(1));
+            } else if (bitName.equals("Ten-Mb-only")) {
+                assertThat(yangBit.getPosition(), is(2));
+            } else {
+                throw new IOException("Invalid bit name: " + bitName);
+            }
+        }
+
+        // Check bit position map
+        Map<Integer, YangBit> bitPositionMap = ((YangBits) leafInfo.getDataType().getDataTypeExtendedInfo())
+                                                                                 .getBitPositionMap();
+        assertThat(bitPositionMap.size(), is(3));
+        for (Map.Entry<Integer, YangBit> element : bitPositionMap.entrySet()) {
+            int position = element.getKey();
+            YangBit yangBit = element.getValue();
+            if (position == 0) {
+                assertThat(yangBit.getBitName(), is("disable-nagle"));
+            } else if (position == 1) {
+                assertThat(yangBit.getBitName(), is("auto-sense-speed"));
+            } else if (position == 2) {
+                assertThat(yangBit.getBitName(), is("Ten-Mb-only"));
+            } else {
+                throw new IOException("Invalid bit position: " + position);
+            }
+        }
+    }
+
+    /**
+     * Checks position value with double quotes.
+     */
+    @Test
+    public void processPositionWithDoubleQuotes() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/PositionWithDoubleQuotes.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("mybits"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("bits"));
+        assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.BITS));
+        assertThat(((YangBits) leafInfo.getDataType().getDataTypeExtendedInfo()).getBitsName(),
+                is("mybits"));
+
+        // Check bit name map
+        Map<String, YangBit> bitNameMap = ((YangBits) leafInfo.getDataType().getDataTypeExtendedInfo()).getBitNameMap();
+        assertThat(bitNameMap.size(), is(3));
+        for (Map.Entry<String, YangBit> element : bitNameMap.entrySet()) {
+            String bitName = element.getKey();
+            YangBit yangBit = element.getValue();
+            if (bitName.equals("disable-nagle")) {
+                assertThat(yangBit.getPosition(), is(0));
+            } else if (bitName.equals("auto-sense-speed")) {
+                assertThat(yangBit.getPosition(), is(1));
+            } else if (bitName.equals("Ten-Mb-only")) {
+                assertThat(yangBit.getPosition(), is(2));
+            } else {
+                throw new IOException("Invalid bit name: " + bitName);
+            }
+        }
+
+        // Check bit position map
+        Map<Integer, YangBit> bitPositionMap = ((YangBits) leafInfo.getDataType().getDataTypeExtendedInfo())
+                                                                                 .getBitPositionMap();
+        assertThat(bitPositionMap.size(), is(3));
+        for (Map.Entry<Integer, YangBit> element : bitPositionMap.entrySet()) {
+            int position = element.getKey();
+            YangBit yangBit = element.getValue();
+            if (position == 0) {
+                assertThat(yangBit.getBitName(), is("disable-nagle"));
+            } else if (position == 1) {
+                assertThat(yangBit.getBitName(), is("auto-sense-speed"));
+            } else if (position == 2) {
+                assertThat(yangBit.getBitName(), is("Ten-Mb-only"));
+            } else {
+                throw new IOException("Invalid bit position: " + position);
+            }
+        }
+    }
+
+    /**
+     * Checks explicit value and auto generated value.
+     */
+    @Test
+    public void processPositionImplicitAndExplicit() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/PositionImplicitAndExplicit.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("mybits"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("bits"));
+        assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.BITS));
+        assertThat(((YangBits) leafInfo.getDataType().getDataTypeExtendedInfo()).getBitsName(),
+                is("mybits"));
+
+        // Check bit name map
+        Map<String, YangBit> bitNameMap = ((YangBits) leafInfo.getDataType().getDataTypeExtendedInfo()).getBitNameMap();
+        assertThat(bitNameMap.size(), is(3));
+        for (Map.Entry<String, YangBit> element : bitNameMap.entrySet()) {
+            String bitName = element.getKey();
+            YangBit yangBit = element.getValue();
+            if (bitName.equals("disable-nagle")) {
+                assertThat(yangBit.getPosition(), is(0));
+            } else if (bitName.equals("auto-sense-speed")) {
+                assertThat(yangBit.getPosition(), is(1));
+            } else if (bitName.equals("Ten-Mb-only")) {
+                assertThat(yangBit.getPosition(), is(2));
+            } else {
+                throw new IOException("Invalid bit name: " + bitName);
+            }
+        }
+
+        // Check bit position map
+        Map<Integer, YangBit> bitPositionMap = ((YangBits) leafInfo.getDataType().getDataTypeExtendedInfo())
+                                                                                 .getBitPositionMap();
+        assertThat(bitPositionMap.size(), is(3));
+        for (Map.Entry<Integer, YangBit> element : bitPositionMap.entrySet()) {
+            int position = element.getKey();
+            YangBit yangBit = element.getValue();
+            if (position == 0) {
+                assertThat(yangBit.getBitName(), is("disable-nagle"));
+            } else if (position == 1) {
+                assertThat(yangBit.getBitName(), is("auto-sense-speed"));
+            } else if (position == 2) {
+                assertThat(yangBit.getBitName(), is("Ten-Mb-only"));
+            } else {
+                throw new IOException("Invalid bit position: " + position);
+            }
+        }
+    }
+
+    /**
+     * Checks explicit value should not be repeated.
+     */
+    @Test(expected = ParserException.class)
+    public void processPositionDuplication() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/PositionDuplication.yang");
+    }
+
+    /**
+     * Checks explicit or auto generated value should not be repeated.
+     */
+    @Test(expected = ParserException.class)
+    public void processPositionImplicitAndExplicitDuplication() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/PositionImplicitAndExplicitDuplication.yang");
+    }
+
+    /**
+     * Checks if negative value of position is not allowed.
+     */
+    @Test(expected = ParserException.class)
+    public void processPositionNegativeValue() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/PositionNegativeValue.yang");
+    }
+}
diff --git a/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/PrefixListenerTest.java b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/PrefixListenerTest.java
new file mode 100644
index 0000000..7de221d
--- /dev/null
+++ b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/PrefixListenerTest.java
@@ -0,0 +1,94 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.junit.Test;
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.YangUtilsParserManager;
+
+import java.io.IOException;
+
+import static org.hamcrest.core.Is.is;
+import static org.junit.Assert.assertThat;
+
+/**
+ * Test cases for testing prefix listener functionality.
+ */
+public class PrefixListenerTest {
+
+    private final YangUtilsParserManager manager = new YangUtilsParserManager();
+
+    /**
+     * Checks if value of prefix is correct.
+     */
+    @Test(expected = ParserException.class)
+    public void processPrefixInvalidValue() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/PrefixInvalidValue.yang");
+    }
+
+    /**
+     * Checks if prefix listener updates the data model tree.
+     */
+    @Test
+    public void processPrefixValidEntry() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/PrefixValidEntry.yang");
+
+        // Checks for the version value in data model tree.
+        assertThat(((YangModule) node).getPrefix(), is("On"));
+    }
+
+    /**
+     * Checks prefix value with double quotes.
+     */
+    @Test
+    public void processPrefixWithDoubleQuotes() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/PrefixWithDoubleQuotes.yang");
+        assertThat(((YangModule) node).getPrefix(), is("On"));
+    }
+
+    /**
+     * Checks that prefix should be present just once.
+     */
+    @Test(expected = ParserException.class)
+    public void processPrefixDualEntry() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/PrefixDualEntry.yang");
+    }
+
+    /**
+     * Checks if prefix syntax is followed.
+     */
+    @Test(expected = ParserException.class)
+    public void processPrefixMissingValue() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/PrefixMissingValue.yang");
+    }
+
+    /**
+     * Checks that exception should be reported if prefix is missing.
+     */
+    @Test(expected = ParserException.class)
+    public void processPrefixOrder() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/PrefixOrder.yang");
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/PresenceListenerTest.java b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/PresenceListenerTest.java
new file mode 100644
index 0000000..1a1da94
--- /dev/null
+++ b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/PresenceListenerTest.java
@@ -0,0 +1,100 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.onosproject.yang.compiler.datamodel.YangContainer;
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangNodeType;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.YangUtilsParserManager;
+
+import java.io.IOException;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.nullValue;
+
+/**
+ * Test cases for presence listener.
+ */
+public class PresenceListenerTest {
+
+    @Rule
+    public ExpectedException thrown = ExpectedException.none();
+
+    private final YangUtilsParserManager manager = new YangUtilsParserManager();
+
+    /**
+     * Checks presence statement as sub-statement of container.
+     */
+    @Test
+    public void processContainerSubStatementPresence() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/ContainerSubStatementPresence.yang");
+
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        // Check whether the list is child of module
+        YangContainer yangContainer = (YangContainer) yangNode.getChild();
+        assertThat(yangContainer.getName(), is("valid"));
+        assertThat(yangContainer.getPresence(), is("\"invalid\""));
+    }
+
+    /**
+     * checks default value of presence statement.
+     */
+    @Test
+    public void processPresenceDefaultValue() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/PresenceDefaultValue.yang");
+
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        // Check whether the list is child of module
+        YangContainer yangContainer = (YangContainer) yangNode.getChild();
+        assertThat(yangContainer.getName(), is("valid"));
+        assertThat(yangContainer.getPresence(), is(nullValue()));
+    }
+
+    /**
+     * Checks presence statement without statement end.
+     */
+    @Test
+    public void processPresenceWithoutStatementEnd() throws IOException, ParserException {
+        thrown.expect(ParserException.class);
+        thrown.expectMessage("mismatched input 'leaf' expecting {';', '+'}");
+        YangNode node = manager.getDataModel("src/test/resources/PresenceWithoutStatementEnd.yang");
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/RangeRestrictionListenerTest.java b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/RangeRestrictionListenerTest.java
new file mode 100644
index 0000000..ab3cc4c
--- /dev/null
+++ b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/RangeRestrictionListenerTest.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.yang.compiler.parser.impl.listeners;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.onosproject.yang.compiler.datamodel.YangLeaf;
+import org.onosproject.yang.compiler.datamodel.YangLeafList;
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangNodeType;
+import org.onosproject.yang.compiler.datamodel.YangRangeInterval;
+import org.onosproject.yang.compiler.datamodel.YangRangeRestriction;
+import org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes;
+import org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangInt32;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.YangUtilsParserManager;
+
+import java.io.IOException;
+import java.util.ListIterator;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.Is.is;
+
+/**
+ * Test cases for range restriction listener.
+ */
+public class RangeRestrictionListenerTest {
+
+    @Rule
+    public ExpectedException thrown = ExpectedException.none();
+
+    private final YangUtilsParserManager manager = new YangUtilsParserManager();
+
+    /**
+     * Checks valid range statement as sub-statement of leaf statement.
+     */
+    @Test
+    public void processValidRangeStatement() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/ValidRangeStatement.yang");
+
+        assertThat((node instanceof YangModule), is(true));
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("invalid-interval"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("int32"));
+        assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.INT32));
+        YangRangeRestriction rangeRestriction = (YangRangeRestriction) leafInfo
+                .getDataType().getDataTypeExtendedInfo();
+
+        ListIterator<YangRangeInterval> rangeListIterator = rangeRestriction.getAscendingRangeIntervals()
+                .listIterator();
+        YangRangeInterval rangeInterval = rangeListIterator.next();
+        assertThat(((YangInt32) rangeInterval.getStartValue()).getValue(), is(1));
+        assertThat(((YangInt32) rangeInterval.getEndValue()).getValue(), is(4));
+    }
+
+    /**
+     * Checks valid range statement as sub-statement of leaf-list.
+     */
+    @Test
+    public void processRangeStatementInsideLeafList() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/RangeStatementInsideLeafList.yang");
+
+        assertThat((node instanceof YangModule), is(true));
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeafList> leafListIterator = yangNode.getListOfLeafList().listIterator();
+        YangLeafList leafListInfo = leafListIterator.next();
+
+        assertThat(leafListInfo.getName(), is("invalid-interval"));
+        assertThat(leafListInfo.getDataType().getDataTypeName(), is("int32"));
+        assertThat(leafListInfo.getDataType().getDataType(), is(YangDataTypes.INT32));
+        YangRangeRestriction rangeRestriction = (YangRangeRestriction) leafListInfo
+                .getDataType().getDataTypeExtendedInfo();
+
+        ListIterator<YangRangeInterval> rangeListIterator = rangeRestriction.getAscendingRangeIntervals()
+                .listIterator();
+        YangRangeInterval rangeInterval = rangeListIterator.next();
+
+        assertThat(((YangInt32) rangeInterval.getStartValue()).getValue(), is(1));
+        assertThat(((YangInt32) rangeInterval.getEndValue()).getValue(), is(4));
+    }
+
+    /**
+     * Checks valid range statement with one interval.
+     */
+    @Test
+    public void processRangeWithOneInterval() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/RangeWithOneInterval.yang");
+
+        assertThat((node instanceof YangModule), is(true));
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeafList> leafListIterator = yangNode.getListOfLeafList().listIterator();
+        YangLeafList leafListInfo = leafListIterator.next();
+
+        assertThat(leafListInfo.getName(), is("invalid-interval"));
+        assertThat(leafListInfo.getDataType().getDataTypeName(), is("int32"));
+        assertThat(leafListInfo.getDataType().getDataType(), is(YangDataTypes.INT32));
+        YangRangeRestriction rangeRestriction = (YangRangeRestriction) leafListInfo
+                .getDataType().getDataTypeExtendedInfo();
+
+        ListIterator<YangRangeInterval> rangeListIterator = rangeRestriction.getAscendingRangeIntervals()
+                .listIterator();
+        YangRangeInterval rangeInterval = rangeListIterator.next();
+
+        assertThat(((YangInt32) rangeInterval.getStartValue()).getValue(), is(1));
+        assertThat(((YangInt32) rangeInterval.getEndValue()).getValue(), is(1));
+    }
+
+    /**
+     * Checks valid range statement with min and max.
+     */
+    @Test
+    public void processRangeWithMinMax() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/RangeWithMinMax.yang");
+
+        assertThat((node instanceof YangModule), is(true));
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeafList> leafListIterator = yangNode.getListOfLeafList().listIterator();
+        YangLeafList leafListInfo = leafListIterator.next();
+
+        assertThat(leafListInfo.getName(), is("invalid-interval"));
+        assertThat(leafListInfo.getDataType().getDataTypeName(), is("int32"));
+        assertThat(leafListInfo.getDataType().getDataType(), is(YangDataTypes.INT32));
+        YangRangeRestriction rangeRestriction = (YangRangeRestriction) leafListInfo
+                .getDataType().getDataTypeExtendedInfo();
+
+        ListIterator<YangRangeInterval> rangeListIterator = rangeRestriction.getAscendingRangeIntervals()
+                .listIterator();
+        YangRangeInterval rangeInterval = rangeListIterator.next();
+
+        assertThat(((YangInt32) rangeInterval.getStartValue()).getValue(), is(-2147483648));
+        assertThat(((YangInt32) rangeInterval.getEndValue()).getValue(), is(2147483647));
+    }
+
+    /**
+     * Checks valid range statement with invalid integer pattern.
+     */
+    @Test
+    public void processRangeWithInvalidIntegerPattern() throws IOException, ParserException {
+        thrown.expect(ParserException.class);
+        thrown.expectMessage("YANG file error : Input value \"a\" is not a valid int32.");
+        YangNode node = manager.getDataModel("src/test/resources/RangeWithInvalidIntegerPattern.yang");
+    }
+
+    /**
+     * Checks valid range statement with description.
+     */
+    @Test
+    public void processRangeSubStatements() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/RangeSubStatements.yang");
+
+        assertThat((node instanceof YangModule), is(true));
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("invalid-interval"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("int32"));
+        assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.INT32));
+        YangRangeRestriction rangeRestriction = (YangRangeRestriction) leafInfo
+                .getDataType().getDataTypeExtendedInfo();
+
+        assertThat(rangeRestriction.getDescription(), is("\"range description\""));
+        assertThat(rangeRestriction.getReference(), is("\"range reference\""));
+
+        ListIterator<YangRangeInterval> rangeListIterator = rangeRestriction.getAscendingRangeIntervals()
+                .listIterator();
+        YangRangeInterval rangeInterval = rangeListIterator.next();
+        assertThat(((YangInt32) rangeInterval.getStartValue()).getValue(), is(1));
+        assertThat(((YangInt32) rangeInterval.getEndValue()).getValue(), is(4));
+        assertThat(((YangInt32) rangeInterval.getEndValue()).getValue(), is(4));
+    }
+
+    /**
+     * Checks whether space can be allowed when range statement is present.
+     */
+    @Test
+    public void processRangeStatementWithSpace() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/RangeStatementWithSpace.yang");
+
+        assertThat((node instanceof YangModule), is(true));
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("invalid-interval"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("int32"));
+        assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.INT32));
+        YangRangeRestriction rangeRestriction = (YangRangeRestriction) leafInfo
+                .getDataType().getDataTypeExtendedInfo();
+
+        ListIterator<YangRangeInterval> rangeListIterator = rangeRestriction.getAscendingRangeIntervals()
+                .listIterator();
+        YangRangeInterval rangeInterval = rangeListIterator.next();
+        assertThat(((YangInt32) rangeInterval.getStartValue()).getValue(), is(1));
+        assertThat(((YangInt32) rangeInterval.getEndValue()).getValue(), is(4));
+    }
+}
diff --git a/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/ReferenceListenerTest.java b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/ReferenceListenerTest.java
new file mode 100644
index 0000000..f55bf42
--- /dev/null
+++ b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/ReferenceListenerTest.java
@@ -0,0 +1,251 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.onosproject.yang.compiler.datamodel.YangContainer;
+import org.onosproject.yang.compiler.datamodel.YangLeaf;
+import org.onosproject.yang.compiler.datamodel.YangLeafList;
+import org.onosproject.yang.compiler.datamodel.YangList;
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangNodeType;
+import org.onosproject.yang.compiler.datamodel.YangStatusType;
+import org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.YangUtilsParserManager;
+
+import java.io.IOException;
+import java.util.ListIterator;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.Is.is;
+
+/**
+ * Test case for reference listener.
+ */
+public class ReferenceListenerTest {
+
+    @Rule
+    public ExpectedException thrown = ExpectedException.none();
+
+    private final YangUtilsParserManager manager = new YangUtilsParserManager();
+
+    /**
+     * Checks valid reference statement.
+     */
+    @Test
+    public void processReferenceStatement() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/ReferenceStatement.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        // Check whether the reference is set correctly.
+        assertThat(leafInfo.getName(), is("invalid-interval"));
+        assertThat(leafInfo.getReference(), is("\"RFC 6020\""));
+    }
+
+    /**
+     * Checks whether exception is thrown for invalid reference statement.
+     */
+    @Test
+    public void processReferenceWithoutStatementEnd() throws IOException, ParserException {
+        thrown.expect(ParserException.class);
+        thrown.expectMessage("mismatched input '}' expecting {';', '+'}");
+        YangNode node = manager.getDataModel("src/test/resources/ReferenceWithoutStatementEnd.yang");
+    }
+
+    /**
+     * Checks valid reference statement under module.
+     */
+    @Test
+    public void processModuleSubStatementReference() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/ModuleSubStatementReference.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        // Check whether the reference is set correctly.
+        assertThat(yangNode.getReference(), is("\"RFC 6020\""));
+    }
+
+    /**
+     * Checks valid reference statement under module.
+     */
+    @Test
+    public void processReferenceEmptyStatement() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/ReferenceEmptyStatement.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        // Check whether the reference is set correctly.
+        assertThat(yangNode.getReference(), is("\"\""));
+    }
+
+    /**
+     * Checks valid reference statement as sub-statement of revision.
+     */
+    @Test
+    public void processRevisionSubStatementReference() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/RevisionSubStatementReference.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        // Check whether the reference is set correctly.
+        assertThat(yangNode.getRevision().getReference(), is("\"revision reference\""));
+    }
+
+    /**
+     * Checks reference statement as sub-statement of container.
+     */
+    @Test
+    public void processContainerSubStatementReference() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/ContainerSubStatementReference.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        // Check whether the reference value is set correctly.
+        YangContainer container = (YangContainer) yangNode.getChild();
+        assertThat(container.getName(), is("valid"));
+        assertThat(container.getReference(), is("\"container reference\""));
+
+        // Check whether leaf properties as set correctly.
+        ListIterator<YangLeaf> leafIterator = container.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("invalid-interval"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("uint16"));
+        assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.UINT16));
+        assertThat(leafInfo.getUnits(), is("\"seconds\""));
+        assertThat(leafInfo.getDescription(), is("\"Interval before a route is declared invalid\""));
+        assertThat(leafInfo.isMandatory(), is(true));
+        assertThat(leafInfo.getStatus(), is(YangStatusType.CURRENT));
+        assertThat(leafInfo.getReference(), is("\"RFC 6020\""));
+    }
+
+    /**
+     * Checks reference statement as sub-statement of list.
+     */
+    @Test
+    public void processListSubStatementReference() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/ListSubStatementReference.yang");
+
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        // Check whether the list is child of module and description value is set correctly.
+        YangList yangList = (YangList) yangNode.getChild();
+        assertThat(yangList.getName(), is("valid"));
+        assertThat(yangList.isConfig(), is(true));
+        assertThat(yangList.getReference(), is("\"list reference\""));
+
+        // Check whether leaf properties as set correctly.
+        ListIterator<YangLeaf> leafIterator = yangList.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("invalid-interval"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("uint16"));
+        assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.UINT16));
+        assertThat(leafInfo.getUnits(), is("\"seconds\""));
+        assertThat(leafInfo.getDescription(), is("\"Interval before a route is declared invalid\""));
+        assertThat(leafInfo.isMandatory(), is(true));
+        assertThat(leafInfo.getStatus(), is(YangStatusType.CURRENT));
+        assertThat(leafInfo.getReference(), is("\"RFC 6020\""));
+    }
+
+    /**
+     * Checks valid reference statement as sub-statement of leaf-list.
+     */
+    @Test
+    public void processLeafListSubStatementReference() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/LeafListSubStatementReference.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeafList> leafListIterator = yangNode.getListOfLeafList().listIterator();
+        YangLeafList leafListInfo = leafListIterator.next();
+
+        // Check whether description value is set correctly.
+        assertThat(leafListInfo.getName(), is("invalid-interval"));
+        assertThat(leafListInfo.getReference(), is("\"RFC 6020\""));
+    }
+}
diff --git a/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/RequireInstanceListenerTest.java b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/RequireInstanceListenerTest.java
new file mode 100644
index 0000000..ba578fe
--- /dev/null
+++ b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/RequireInstanceListenerTest.java
@@ -0,0 +1,168 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.onosproject.yang.compiler.datamodel.YangContainer;
+import org.onosproject.yang.compiler.datamodel.YangLeaf;
+import org.onosproject.yang.compiler.datamodel.YangLeafRef;
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangNodeType;
+import org.onosproject.yang.compiler.datamodel.YangType;
+import org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.YangUtilsParserManager;
+
+import java.io.IOException;
+import java.util.ListIterator;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.Is.is;
+
+/**
+ * Test cases for require-instance listener.
+ */
+public class RequireInstanceListenerTest {
+
+    @Rule
+    public ExpectedException thrown = ExpectedException.none();
+
+    private final YangUtilsParserManager manager = new YangUtilsParserManager();
+
+    /**
+     * Checks require-statement with true as status.
+     */
+    @Test
+    public void processRequireInstanceTrue() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/RequireInstanceTrue.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("PathListener"));
+
+        YangContainer container = (YangContainer) yangNode.getChild().getNextSibling();
+        ListIterator<YangLeaf> leafIterator = container.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        // Check whether the require-instance value is set correctly in leafref.
+        assertThat(leafInfo.getName(), is("ifname"));
+        YangLeafRef yangLeafRef = (YangLeafRef) leafInfo.getDataType().getDataTypeExtendedInfo();
+        assertThat(yangLeafRef.getRequireInstance(), is(true));
+    }
+
+    /**
+     * Checks require-statement with false as status.
+     */
+    @Test
+    public void processRequireInstanceFalse() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/RequireInstanceFalse.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("PathListener"));
+
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        // Check whether the require-instance value is set correctly in instance-identifier.
+        assertThat(leafInfo.getName(), is("admin-status"));
+
+        YangType type = leafInfo.getDataType();
+
+        assertThat(type.getDataType(), is(YangDataTypes.INSTANCE_IDENTIFIER));
+        boolean status = ((YangType<Boolean>) type).getDataTypeExtendedInfo();
+
+        assertThat(status, is(false));
+    }
+
+    /**
+     * Checks require-statement default value when its not there in YANG under instance-identifier.
+     */
+    @Test
+    public void processRequireInstanceDefaultValueInInstanceIdentifier() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/RequireInstanceDefaultValueInInstanceIdentifier.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("PathListener"));
+
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        // Check whether the require-instance value is set correctly in instance-identifier.
+        assertThat(leafInfo.getName(), is("admin-status"));
+
+        YangType type = leafInfo.getDataType();
+
+        assertThat(type.getDataType(), is(YangDataTypes.INSTANCE_IDENTIFIER));
+
+        boolean status = ((YangType<Boolean>) type).getDataTypeExtendedInfo();
+        assertThat(status, is(true));
+    }
+
+    /**
+     * Checks require-statement default value when its not there in YANG under leafref.
+     */
+    @Test
+    public void processRequireInstanceDefaultValueForLeafref() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/RequireInstanceDefaultValueForLeafref.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("PathListener"));
+
+        YangContainer container = (YangContainer) yangNode.getChild().getNextSibling();
+        ListIterator<YangLeaf> leafIterator = container.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        // Check whether the require-instance value is set correctly in leafref.
+        assertThat(leafInfo.getName(), is("ifname"));
+        YangLeafRef yangLeafRef = (YangLeafRef) leafInfo.getDataType().getDataTypeExtendedInfo();
+        assertThat(yangLeafRef.getRequireInstance(), is(true));
+    }
+}
diff --git a/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/RevisionDateListenerTest.java b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/RevisionDateListenerTest.java
new file mode 100644
index 0000000..bdcf28c
--- /dev/null
+++ b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/RevisionDateListenerTest.java
@@ -0,0 +1,116 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.junit.Test;
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.YangUtilsParserManager;
+
+import java.io.IOException;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+
+import static org.hamcrest.core.Is.is;
+import static org.junit.Assert.assertThat;
+
+/**
+ * Test cases for testing revision date listener functionality.
+ */
+public class RevisionDateListenerTest {
+
+    private final YangUtilsParserManager manager = new YangUtilsParserManager();
+    private static final String DATE_FORMAT = "yyyy-MM-dd";
+    private final SimpleDateFormat simpleDateFormat = new SimpleDateFormat(DATE_FORMAT);
+
+    /**
+     * Checks if revision date syntax is correct in include.
+     */
+    @Test(expected = ParserException.class)
+    public void processRevisionDateInvalidSyntaxAtInclude() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/RevisionDateInvalidSyntaxAtInclude.yang");
+    }
+
+    /**
+     * Checks if revision date syntax is correct in import.
+     */
+    @Test(expected = ParserException.class)
+    public void processRevisionDateInvalidSyntaxAtImport() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/RevisionDateInvalidSyntaxAtImport.yang");
+    }
+
+    /**
+     * Checks revision date in quotes inside include.
+     */
+    @Test
+    public void processRevisionDateInQuotesAtInclude() throws IOException, ParserException, ParseException {
+
+        YangNode node = manager.getDataModel("src/test/resources/RevisionDateInQuotesAtInclude.yang");
+        // Checks for the version value in data model tree.
+        assertThat(((YangModule) node).getImportList().get(0).getRevision(), is(simpleDateFormat.parse("2015-02-03")));
+        assertThat(((YangModule) node).getIncludeList().get(0).getRevision(), is(simpleDateFormat.parse("2016-02-03")));
+        assertThat(((YangModule) node).getIncludeList().get(1).getRevision(), is(simpleDateFormat.parse("2014-02-03")));
+    }
+
+    /**
+     * Checks revision date in quotes inside import.
+     */
+    @Test
+    public void processRevisionDateInQuotesAtImport() throws IOException, ParserException, ParseException {
+
+        YangNode node = manager.getDataModel("src/test/resources/RevisionDateInQuotesAtImport.yang");
+        // Checks for the version value in data model tree.
+        assertThat(((YangModule) node).getImportList().get(0).getRevision(), is(simpleDateFormat.parse("2015-02-03")));
+        assertThat(((YangModule) node).getIncludeList().get(0).getRevision(), is(simpleDateFormat.parse("2016-02-03")));
+        assertThat(((YangModule) node).getIncludeList().get(1).getRevision(), is(simpleDateFormat.parse("2014-02-03")));
+    }
+
+    /**
+     * Checks if revision date follows YYYY-MM-DD format.
+     */
+    @Test(expected = ParserException.class)
+    public void processRevisionDateInvalidFormat() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/RevisionDateInvalidFormat.yang");
+    }
+
+    /**
+     * Checks if revision date is correct.
+     */
+    @Test(expected = ParserException.class)
+    public void processRevisionDateInvalid() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/RevisionDateInvalid.yang");
+    }
+
+    /**
+     * Checks if revision date listener updates the data model tree.
+     */
+    @Test
+    public void processRevisionDateValidEntry() throws IOException, ParserException, ParseException {
+
+        YangNode node = manager.getDataModel("src/test/resources/RevisionDateValidEntry.yang");
+
+        // Checks for the version value in data model tree.
+        assertThat(((YangModule) node).getImportList().get(0).getRevision(), is(simpleDateFormat.parse("2015-02-03")));
+        assertThat(((YangModule) node).getIncludeList().get(0).getRevision(), is(simpleDateFormat.parse("2016-02-03")));
+        assertThat(((YangModule) node).getIncludeList().get(1).getRevision(), is(simpleDateFormat.parse("2014-02-03")));
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/RevisionListenerTest.java b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/RevisionListenerTest.java
new file mode 100644
index 0000000..d8bedbe
--- /dev/null
+++ b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/RevisionListenerTest.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.yang.compiler.parser.impl.listeners;
+
+import org.junit.Test;
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.YangUtilsParserManager;
+
+import java.io.IOException;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+
+import static org.hamcrest.core.Is.is;
+import static org.junit.Assert.assertThat;
+
+/**
+ * Test cases for testing revision listener functionality.
+ */
+public class RevisionListenerTest {
+
+    private final YangUtilsParserManager manager = new YangUtilsParserManager();
+    private static final String DATE_FORMAT = "yyyy-MM-dd";
+    private final SimpleDateFormat simpleDateFormat = new SimpleDateFormat(DATE_FORMAT);
+
+    /**
+     * Checks if revision doesn't have optional parameters "revision and
+     * description".
+     */
+    @Test
+    public void processRevisionNoOptionalParameter() throws IOException, ParserException, ParseException {
+
+        YangNode node = manager.getDataModel("src/test/resources/RevisionNoOptionalParameter.yang");
+        // Checks for the version value in data model tree.
+        assertThat(((YangModule) node).getRevision().getRevDate(), is(simpleDateFormat.parse("2016-02-03")));
+    }
+
+    /**
+     * Checks if the syntax of revision is correct.
+     */
+    @Test(expected = ParserException.class)
+    public void processRevisionInValidSyntax() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/RevisionInValidSyntax.yang");
+    }
+
+    /**
+     * Checks if the correct order is followed.
+     */
+    @Test(expected = ParserException.class)
+    public void processRevisionInValidOrder() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/RevisionInValidOrder.yang");
+    }
+
+    /**
+     * Checks the revision with current date is created for empty revision statement.
+     */
+    @Test
+    public void processWithoutRevision() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/RevisionAbsence.yang");
+        assertThat(true, is((node).getRevision() == null));
+    }
+
+    /**
+     * Checks latest date is stored when there are multiple revisions.
+     */
+    @Test
+    public void processWithMultipleRevision() throws IOException, ParserException, ParseException {
+
+        YangNode node = manager.getDataModel("src/test/resources/MultipleRevision.yang");
+        assertThat((node).getRevision().getRevDate(), is(simpleDateFormat.parse("2013-07-15")));
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/RpcListenerTest.java b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/RpcListenerTest.java
new file mode 100644
index 0000000..902a324
--- /dev/null
+++ b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/RpcListenerTest.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.junit.Test;
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangNodeType;
+import org.onosproject.yang.compiler.datamodel.YangRpc;
+import org.onosproject.yang.compiler.datamodel.YangStatusType;
+import org.onosproject.yang.compiler.datamodel.YangTypeDef;
+import org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.YangUtilsParserManager;
+
+import java.io.IOException;
+
+import static org.hamcrest.core.Is.is;
+import static org.junit.Assert.assertThat;
+
+/**
+ * Test cases for testing Rpc listener functionality.
+ */
+public class RpcListenerTest {
+
+    private final YangUtilsParserManager manager = new YangUtilsParserManager();
+
+    /**
+     * Checks valid rpc statements.
+     */
+    @Test
+    public void processValidRpcStatement() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/ValidRpcStatement.yang");
+
+        assertThat((node instanceof YangModule), is(true));
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("rock"));
+
+        YangRpc yangRpc = (YangRpc) yangNode.getChild();
+        assertThat(yangRpc.getName(), is("rock-the-house"));
+        assertThat(yangRpc.getDescription(), is("\"description\""));
+        assertThat(yangRpc.getReference(), is("\"reference\""));
+        assertThat(yangRpc.getStatus(), is(YangStatusType.CURRENT));
+
+        YangTypeDef typeDef = (YangTypeDef) yangRpc.getChild();
+        assertThat(typeDef.getName(), is("my-type"));
+        assertThat(typeDef.getStatus(), is(YangStatusType.DEPRECATED));
+        assertThat(typeDef.getTypeDefBaseType().getDataType(), is(YangDataTypes.INT32));
+    }
+}
diff --git a/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/ShortCaseListenerTest.java b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/ShortCaseListenerTest.java
new file mode 100644
index 0000000..f809be2
--- /dev/null
+++ b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/ShortCaseListenerTest.java
@@ -0,0 +1,103 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.junit.Test;
+import org.onosproject.yang.compiler.datamodel.YangCase;
+import org.onosproject.yang.compiler.datamodel.YangChoice;
+import org.onosproject.yang.compiler.datamodel.YangContainer;
+import org.onosproject.yang.compiler.datamodel.YangList;
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangNodeType;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.YangUtilsParserManager;
+
+import java.io.IOException;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.Is.is;
+
+/**
+ * Test cases for short case listener.
+ */
+public class ShortCaseListenerTest {
+
+    private final YangUtilsParserManager manager = new YangUtilsParserManager();
+
+    /**
+     * Checks short case listener with container.
+     */
+    @Test
+    public void processShortCaseListenerWithContainer() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/ShortCaseListenerWithContainer.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        YangContainer yangContainer = (YangContainer) yangNode.getChild();
+        assertThat(yangContainer.getName(), is("food"));
+
+        YangChoice yangChoice = (YangChoice) yangContainer.getChild();
+        assertThat(yangChoice.getName(), is("snack"));
+
+        YangCase yangCase = (YangCase) yangChoice.getChild();
+        assertThat(yangCase.getName(), is("sports-arena"));
+
+        YangContainer yangContainer1 = (YangContainer) yangCase.getChild();
+        assertThat(yangContainer1.getName(), is("sports-arena"));
+    }
+
+    /**
+     * Checks short case listener with list.
+     */
+    @Test
+    public void processShortCaseListenerWithList() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/ShortCaseListenerWithList.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        YangContainer yangContainer = (YangContainer) yangNode.getChild();
+        assertThat(yangContainer.getName(), is("food"));
+
+        YangChoice yangChoice = (YangChoice) yangContainer.getChild();
+        assertThat(yangChoice.getName(), is("snack"));
+
+        YangCase yangCase = (YangCase) yangChoice.getChild();
+        assertThat(yangCase.getName(), is("sports-arena"));
+
+        YangList yangList = (YangList) yangCase.getChild();
+        assertThat(yangList.getName(), is("sports-arena"));
+    }
+}
diff --git a/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/StatusListenerTest.java b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/StatusListenerTest.java
new file mode 100644
index 0000000..57a0b2c
--- /dev/null
+++ b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/StatusListenerTest.java
@@ -0,0 +1,276 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.onosproject.yang.compiler.datamodel.YangContainer;
+import org.onosproject.yang.compiler.datamodel.YangLeaf;
+import org.onosproject.yang.compiler.datamodel.YangLeafList;
+import org.onosproject.yang.compiler.datamodel.YangList;
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangNodeType;
+import org.onosproject.yang.compiler.datamodel.YangStatusType;
+import org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.YangUtilsParserManager;
+
+import java.io.IOException;
+import java.util.ListIterator;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.Is.is;
+
+/**
+ * Test cases for status listener.
+ */
+public class StatusListenerTest {
+
+    @Rule
+    public ExpectedException thrown = ExpectedException.none();
+
+    private final YangUtilsParserManager manager = new YangUtilsParserManager();
+
+    /**
+     * Checks valid status statement.
+     */
+    @Test
+    public void processStatusStatementCurrent() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/StatusStatementCurrent.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        // Check whether the status is set correctly.
+        assertThat(leafInfo.getName(), is("invalid-interval"));
+        assertThat(leafInfo.getStatus(), is(YangStatusType.CURRENT));
+    }
+
+    /**
+     * Checks valid status statement.
+     */
+    @Test
+    public void processStatusStatementDeprecated() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/StatusStatementDeprecated.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        // Check whether the status is set correctly.
+        assertThat(leafInfo.getName(), is("invalid-interval"));
+        assertThat(leafInfo.getStatus(), is(YangStatusType.DEPRECATED));
+    }
+
+    /**
+     * Checks valid status statement.
+     */
+    @Test
+    public void processStatusStatementObsolete() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/StatusStatementObsolete.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        // Check whether the status is set correctly.
+        assertThat(leafInfo.getName(), is("invalid-interval"));
+        assertThat(leafInfo.getStatus(), is(YangStatusType.OBSOLETE));
+    }
+
+    /**
+     * Checks whether exception is thrown for invalid status statement.
+     */
+    @Test
+    public void processStatusWithoutStatementEnd() throws IOException, ParserException {
+        thrown.expect(ParserException.class);
+        thrown.expectMessage("missing ';' at '}'");
+        YangNode node = manager.getDataModel("src/test/resources/StatusWithoutStatementEnd.yang");
+    }
+
+    /**
+     * Checks whether exception is thrown for invalid status statement.
+     */
+    @Test
+    public void processStatusInvalidValue() throws IOException, ParserException {
+        thrown.expect(ParserException.class);
+        thrown.expectMessage("YANG file error : status invalid is not valid.");
+        YangNode node = manager.getDataModel("src/test/resources/StatusInvalidValue.yang");
+    }
+
+    /**
+     * Checks status statement as sub-statement of container.
+     */
+    @Test
+    public void processContainerSubStatementStatus() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/ContainerSubStatementStatus.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        // Check whether status is set correctly.
+        YangContainer container = (YangContainer) yangNode.getChild();
+        assertThat(container.getName(), is("valid"));
+        assertThat(container.isConfig(), is(true));
+        assertThat(container.getStatus(), is(YangStatusType.OBSOLETE));
+
+        // Check whether leaf properties as set correctly.
+        ListIterator<YangLeaf> leafIterator = container.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("invalid-interval"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("uint16"));
+        assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.UINT16));
+        assertThat(leafInfo.getUnits(), is("\"seconds\""));
+        assertThat(leafInfo.getDescription(), is("\"Interval before a route is declared invalid\""));
+        assertThat(leafInfo.isMandatory(), is(true));
+        assertThat(leafInfo.getStatus(), is(YangStatusType.CURRENT));
+        assertThat(leafInfo.getReference(), is("\"RFC 6020\""));
+    }
+
+    /**
+     * Checks status statement as sub-statement of list.
+     */
+    @Test
+    public void processListSubStatementStatus() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/ListSubStatementStatus.yang");
+
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        // Check whether the list is child of module and status is set.
+        YangList yangList = (YangList) yangNode.getChild();
+        assertThat(yangList.getName(), is("valid"));
+        assertThat(yangList.isConfig(), is(true));
+        assertThat(yangList.getStatus(), is(YangStatusType.CURRENT));
+
+        // Check whether leaf properties as set correctly.
+        ListIterator<YangLeaf> leafIterator = yangList.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("invalid-interval"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("uint16"));
+        assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.UINT16));
+        assertThat(leafInfo.getUnits(), is("\"seconds\""));
+        assertThat(leafInfo.getDescription(), is("\"Interval before a route is declared invalid\""));
+        assertThat(leafInfo.isMandatory(), is(true));
+        assertThat(leafInfo.getStatus(), is(YangStatusType.CURRENT));
+        assertThat(leafInfo.getReference(), is("\"RFC 6020\""));
+    }
+
+    /**
+     * Checks valid status statement as sub-statement of leaf-list.
+     */
+    @Test
+    public void processLeafListSubStatementStatus() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/LeafListSubStatementStatus.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeafList> leafListIterator = yangNode.getListOfLeafList().listIterator();
+        YangLeafList leafListInfo = leafListIterator.next();
+
+        // Check whether status is set correctly.
+        assertThat(leafListInfo.getName(), is("invalid-interval"));
+        assertThat(leafListInfo.isConfig(), is(true));
+        assertThat(leafListInfo.getStatus(), is(YangStatusType.CURRENT));
+    }
+
+    /**
+     * Checks default value of status statement.
+     */
+    @Test
+    public void processStatusDefaultValue() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/StatusDefaultValue.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeafList> leafListIterator = yangNode.getListOfLeafList().listIterator();
+        YangLeafList leafListInfo = leafListIterator.next();
+
+        // Check whether status is set correctly.
+        assertThat(leafListInfo.getName(), is("invalid-interval"));
+        assertThat(leafListInfo.isConfig(), is(true));
+        assertThat(leafListInfo.getStatus(), is(YangStatusType.CURRENT));
+    }
+}
diff --git a/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/SubModuleListenerTest.java b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/SubModuleListenerTest.java
new file mode 100644
index 0000000..7adf00f
--- /dev/null
+++ b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/SubModuleListenerTest.java
@@ -0,0 +1,131 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.junit.Test;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangNodeType;
+import org.onosproject.yang.compiler.datamodel.YangSubModule;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.YangUtilsParserManager;
+
+import java.io.IOException;
+
+import static org.hamcrest.core.Is.is;
+import static org.junit.Assert.assertThat;
+
+/**
+ * Test cases for testing submodule listener functionality.
+ */
+public class SubModuleListenerTest {
+
+    private final YangUtilsParserManager manager = new YangUtilsParserManager();
+
+    /**
+     * Checks if the sub module listeners updates the data model tree.
+     */
+    @Test
+    public void processSubModuleValidEntry() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/SubModuleValidEntry.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangSubModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.SUB_MODULE_NODE));
+
+        YangSubModule yangNode = (YangSubModule) node;
+        // Check whether the module name is set correctly.
+        assertThat(yangNode.getName(), is("Test"));
+        // Checks for the version value in data model tree.
+        assertThat(yangNode.getVersion(), is((byte) 1));
+        // Checks identifier of belongsto in data model tree.
+        assertThat(yangNode.getBelongsTo().getBelongsToModuleName(), is("ONOS"));
+        // Checks for the version value in data model tree.
+        assertThat(yangNode.getBelongsTo().getPrefix(), is("On1"));
+    }
+
+    /**
+     * Checks if the yang version and belongs to can come in any order in sub
+     * module.
+     */
+    @Test
+    public void processSubModuleOrder() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/SubModuleOrder.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangSubModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.SUB_MODULE_NODE));
+
+        YangSubModule yangNode = (YangSubModule) node;
+        // Check whether the module name is set correctly.
+        assertThat(yangNode.getName(), is("Test"));
+        // Checks for the version value in data model tree.
+        assertThat(yangNode.getVersion(), is((byte) 1));
+        // Checks identifier of belongsto in data model tree.
+        assertThat(yangNode.getBelongsTo().getBelongsToModuleName(), is("ONOS"));
+        // Checks for the version value in data model tree.
+        assertThat(yangNode.getBelongsTo().getPrefix(), is("On1"));
+    }
+
+    /**
+     * Checks if yang version is optional.
+     */
+    @Test
+    public void processSubModuleWithoutVersion() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/SubModuleWithoutVersion.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangSubModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.SUB_MODULE_NODE));
+
+        YangSubModule yangNode = (YangSubModule) node;
+        // Check whether the module name is set correctly.
+        assertThat(yangNode.getName(), is("Test"));
+        // Checks identifier of belongsto in data model tree.
+        assertThat(yangNode.getBelongsTo().getBelongsToModuleName(), is("ONOS"));
+        // Checks for the version value in data model tree.
+        assertThat(yangNode.getBelongsTo().getPrefix(), is("On1"));
+        //Checks the revision with current date is created for empty revision statement.
+        assertThat(true, is(node.getRevision() == null));
+    }
+
+    /**
+     * Checks if sub module name is correct.
+     */
+    @Test(expected = ParserException.class)
+    public void processSubModuleInvalidName() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/SubModuleInvalidName.yang");
+    }
+
+    /**
+     * Checks if sub module has invalid modules construct eg namespace.
+     */
+    @Test(expected = ParserException.class)
+    public void processSubModuleWithNamespace() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/SubModuleWithNamespace.yang");
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/TypeListenerTest.java b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/TypeListenerTest.java
new file mode 100644
index 0000000..e95bf50
--- /dev/null
+++ b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/TypeListenerTest.java
@@ -0,0 +1,175 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.hamcrest.core.Is;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.onosproject.yang.compiler.datamodel.YangContainer;
+import org.onosproject.yang.compiler.datamodel.YangLeaf;
+import org.onosproject.yang.compiler.datamodel.YangLeafList;
+import org.onosproject.yang.compiler.datamodel.YangLeafRef;
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangNodeType;
+import org.onosproject.yang.compiler.datamodel.YangTypeDef;
+import org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.YangUtilsParserManager;
+
+import java.io.IOException;
+import java.util.ListIterator;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.Is.is;
+
+/**
+ * Test case for type listener.
+ */
+public class TypeListenerTest {
+
+    @Rule
+    public ExpectedException thrown = ExpectedException.none();
+
+    private final YangUtilsParserManager manager = new YangUtilsParserManager();
+
+    /**
+     * Checks derived statement without contraints.
+     */
+    @Test
+    public void processDerivedTypeStatement() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/DerivedTypeStatement.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), Is.is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("invalid-interval"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("hello"));
+        assertThat(leafInfo.getDataType().getDataType(), Is.is(YangDataTypes.DERIVED));
+    }
+
+    /**
+     * Checks valid yang data type.
+     */
+    @Test
+    public void processIntegerTypeStatement() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/IntegerTypeStatement.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("invalid-interval"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("uint16"));
+        assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.UINT16));
+    }
+
+    /**
+     * Checks type for leaf-list.
+     */
+    @Test
+    public void processLeafListSubStatementType() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/LeafListSubStatementType.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeafList> leafListIterator = yangNode.getListOfLeafList().listIterator();
+        YangLeafList leafListInfo = leafListIterator.next();
+
+        assertThat(leafListInfo.getName(), is("invalid-interval"));
+        assertThat(leafListInfo.getDataType().getDataTypeName(), is("uint16"));
+        assertThat(leafListInfo.getDataType().getDataType(), is(YangDataTypes.UINT16));
+    }
+
+    /**
+     * Checks for type instance-identifier.
+     */
+    @Test
+    public void processInstanceIdentifierType() throws IOException, ParserException {
+
+        YangNode node = manager
+                .getDataModel("src/test/resources/InstanceIdentifierListener.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+        YangContainer container = (YangContainer) yangNode.getChild();
+        ListIterator<YangLeaf> leafIterator = container.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("invalid-interval"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("instance-identifier"));
+        assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.INSTANCE_IDENTIFIER));
+    }
+
+    /**
+     * Checks for leaf ref path concatenation.
+     */
+    @Test
+    public void processLeafRefPathConcatenation() throws IOException, ParserException {
+
+        YangNode node = manager
+                .getDataModel("src/test/resources/leafRefPathConcatenation.yang");
+
+        assertThat((node instanceof YangModule), is(true));
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("test"));
+
+        YangTypeDef typeDef = (YangTypeDef) yangNode.getChild();
+        assertThat(typeDef.getName(), is("isis-instance-state-ref"));
+        assertThat(typeDef.getTypeDefBaseType().getDataType(), is(YangDataTypes.LEAFREF));
+        YangLeafRef leafRef = ((YangLeafRef) typeDef.getTypeDefBaseType().getDataTypeExtendedInfo());
+        assertThat(leafRef.getPath(), is("/isis-prefix-ipv4-std/default-metric"));
+    }
+}
diff --git a/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/UnionListenerTest.java b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/UnionListenerTest.java
new file mode 100644
index 0000000..545624a
--- /dev/null
+++ b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/UnionListenerTest.java
@@ -0,0 +1,150 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.junit.Test;
+import org.onosproject.yang.compiler.datamodel.YangLeaf;
+import org.onosproject.yang.compiler.datamodel.YangLeafList;
+import org.onosproject.yang.compiler.datamodel.YangList;
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangNodeType;
+import org.onosproject.yang.compiler.datamodel.YangType;
+import org.onosproject.yang.compiler.datamodel.YangUnion;
+import org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.YangUtilsParserManager;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.ListIterator;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.Is.is;
+
+/**
+ * Test cases for testing union listener.
+ */
+public class UnionListenerTest {
+
+    private final YangUtilsParserManager manager = new YangUtilsParserManager();
+
+    /**
+     * Checks union when type is in leaf.
+     */
+    @Test
+    public void processUnionWhenTypeInLeaf() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/UnionWhenTypeInLeaf.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        YangList yangList = (YangList) yangNode.getChild();
+        assertThat(yangList.getName(), is("valid"));
+
+        ListIterator<YangLeaf> leafIterator = yangList.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("invalid-interval"));
+
+        assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.UNION));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("union"));
+
+        YangUnion yangUnion = (YangUnion) leafInfo.getDataType().getDataTypeExtendedInfo();
+
+        List<YangType<?>> typeList = yangUnion.getTypeList();
+        ListIterator<YangType<?>> typeListIterator = typeList.listIterator();
+        YangType<?> yangType = typeListIterator.next();
+
+        assertThat(yangType.getDataTypeName(), is("int32"));
+        assertThat(yangType.getDataType(), is(YangDataTypes.INT32));
+
+        YangType<?> yangTypeEnum = typeListIterator.next();
+
+        assertThat(yangTypeEnum.getDataTypeName(), is("enumeration"));
+        assertThat(yangTypeEnum.getDataType(), is(YangDataTypes.ENUMERATION));
+    }
+
+    /**
+     * Checks union when type is in leaflist.
+     */
+    @Test
+    public void processUnionWhenTypeInLeafList() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/UnionWhenTypeInLeafList.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        YangList yangList = (YangList) yangNode.getChild();
+        assertThat(yangList.getName(), is("valid"));
+
+        ListIterator<YangLeafList> leafListIterator = yangList.getListOfLeafList().listIterator();
+        YangLeafList leafListInfo = leafListIterator.next();
+
+        assertThat(leafListInfo.getName(), is("invalid-interval"));
+
+        assertThat(leafListInfo.getDataType().getDataType(), is(YangDataTypes.UNION));
+        assertThat(leafListInfo.getDataType().getDataTypeName(), is("union"));
+
+        YangUnion yangUnion = (YangUnion) leafListInfo.getDataType().getDataTypeExtendedInfo();
+
+        List<YangType<?>> typeList = yangUnion.getTypeList();
+        ListIterator<YangType<?>> typeListIterator = typeList.listIterator();
+        YangType<?> yangType = typeListIterator.next();
+
+        assertThat(yangType.getDataTypeName(), is("int32"));
+        assertThat(yangType.getDataType(), is(YangDataTypes.INT32));
+
+        YangType<?> yangTypeEnum = typeListIterator.next();
+
+        assertThat(yangTypeEnum.getDataTypeName(), is("enumeration"));
+        assertThat(yangTypeEnum.getDataType(), is(YangDataTypes.ENUMERATION));
+    }
+
+    /**
+     * Checks union with empty type.
+     */
+    @Test (expected = ParserException.class)
+    public void processUnionWithEmptyType() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/UnionWithEmptyType.yang");
+    }
+
+    /**
+     * Checks whether type union has atleast one type statement.
+     */
+    @Test (expected = ParserException.class)
+    public void processUnionWithoutChild() throws IOException, ParserException {
+        manager.getDataModel("src/test/resources/UnionWithoutChild.yang");
+    }
+}
diff --git a/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/UniqueListenerTest.java b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/UniqueListenerTest.java
new file mode 100644
index 0000000..ababd08
--- /dev/null
+++ b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/UniqueListenerTest.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.yang.compiler.parser.impl.listeners;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.onosproject.yang.compiler.datamodel.YangList;
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangNodeType;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.YangUtilsParserManager;
+
+import java.io.IOException;
+import java.util.ListIterator;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.Is.is;
+
+/**
+ * Test cases for unique listener.
+ */
+public class UniqueListenerTest {
+
+    @Rule
+    public ExpectedException thrown = ExpectedException.none();
+
+    private final YangUtilsParserManager manager = new YangUtilsParserManager();
+
+    /**
+     * Checks unique statement as sub-statement of list.
+     */
+    @Test
+    public void processListSubStatementUnique() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/ListSubStatementUnique.yang");
+
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        // Check whether the list is child of module
+        YangList yangList = (YangList) yangNode.getChild();
+        assertThat(yangList.getName(), is("valid"));
+        assertThat(yangList.getUniqueList().listIterator().next(), is("invalid-interval"));
+    }
+
+    /**
+     * Check multiple unique values.
+     */
+    @Test
+    public void processMultipleUniqueValues() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/MultipleUniqueValues.yang");
+
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        // Check whether the list is child of module
+        YangList yangList = (YangList) yangNode.getChild();
+        assertThat(yangList.getName(), is("valid"));
+        ListIterator<String> listIterator;
+        String list;
+        listIterator = yangList.getUniqueList().listIterator();
+        list = listIterator.next();
+        assertThat(list, is("ospf"));
+        list = listIterator.next();
+        assertThat(list, is("isis"));
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/UnitsListenerTest.java b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/UnitsListenerTest.java
new file mode 100644
index 0000000..41e6660
--- /dev/null
+++ b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/UnitsListenerTest.java
@@ -0,0 +1,177 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.hamcrest.core.Is;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.onosproject.yang.compiler.datamodel.YangLeaf;
+import org.onosproject.yang.compiler.datamodel.YangLeafList;
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangNodeType;
+import org.onosproject.yang.compiler.datamodel.YangStatusType;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.YangUtilsParserManager;
+
+import java.io.IOException;
+import java.util.ListIterator;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.nullValue;
+import static org.hamcrest.core.Is.is;
+
+/**
+ * Test cases for units listener.
+ */
+public class UnitsListenerTest {
+
+    @Rule
+    public ExpectedException thrown = ExpectedException.none();
+
+    private final YangUtilsParserManager manager = new YangUtilsParserManager();
+
+    /**
+     * Checks valid units statement.
+     */
+    @Test
+    public void processUnitsStatement() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/UnitsStatement.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat(node instanceof YangModule, is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        // Check whether units value is set correctly.
+        assertThat(leafInfo.getName(), is("invalid-interval"));
+        assertThat(leafInfo.getUnits(), is("\"seconds\""));
+    }
+
+    /**
+     * Checks invalid units statement(without statement end).
+     */
+    @Test
+    public void processUnitsWithoutStatementEnd() throws IOException, ParserException {
+        thrown.expect(ParserException.class);
+        thrown.expectMessage("mismatched input '}' expecting {';', '+'}");
+        YangNode node = manager.getDataModel("src/test/resources/UnitsWithoutStatementEnd.yang");
+    }
+
+    /**
+     * Checks order of units statement in leaf.
+     */
+    @Test
+    public void processUnitsStatementOrder() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/UnitsStatementOrder.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat(node instanceof YangModule, is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        // Check whether leaf properties is set correctly.
+        assertThat(leafInfo.getName(), is("invalid-interval"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("uint16"));
+        assertThat(leafInfo.getUnits(), is("\"seconds\""));
+        assertThat(leafInfo.getDescription(), is("\"Interval before a route is declared invalid\""));
+        assertThat(leafInfo.isConfig(), is(true));
+        assertThat(leafInfo.isMandatory(), is(true));
+        assertThat(leafInfo.getStatus(), Is.is(YangStatusType.CURRENT));
+        assertThat(leafInfo.getReference(), is("\"RFC 6020\""));
+    }
+
+    /**
+     * Checks the default value of unit statement.
+     */
+    @Test
+    public void processUnitsDefaultValue() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/UnitsDefaultValue.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat(node instanceof YangModule, is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("invalid-interval"));
+        assertThat(leafInfo.getUnits(), is(nullValue()));
+    }
+
+    /**
+     * Checks invalid occurance of units statement as sub-statement of leaf.
+     */
+    @Test
+    public void processUnitsStatementCardinality() throws IOException, ParserException {
+        thrown.expect(ParserException.class);
+        thrown.expectMessage("YANG file error: \"units\" is defined more than once in \"leaf invalid-interval\".");
+        YangNode node = manager.getDataModel("src/test/resources/UnitsStatementCardinality.yang");
+    }
+
+    /**
+     * Checks valid units statement as sub-statement of leaf-list.
+     */
+    @Test
+    public void processLeafListSubStatementUnits() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/LeafListSubStatementUnits.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat(node instanceof YangModule, is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeafList> leafListIterator = yangNode.getListOfLeafList().listIterator();
+        YangLeafList leafListInfo = leafListIterator.next();
+
+        // Check whether units value is set correctly.
+        assertThat(leafListInfo.getName(), is("invalid-interval"));
+        assertThat(leafListInfo.getUnits(), is("\"seconds\""));
+    }
+}
diff --git a/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/UsesListenerTest.java b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/UsesListenerTest.java
new file mode 100644
index 0000000..01412b2
--- /dev/null
+++ b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/UsesListenerTest.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.yang.compiler.parser.impl.listeners;
+
+import org.junit.Test;
+import org.onosproject.yang.compiler.datamodel.YangContainer;
+import org.onosproject.yang.compiler.datamodel.YangGrouping;
+import org.onosproject.yang.compiler.datamodel.YangList;
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangNodeType;
+import org.onosproject.yang.compiler.datamodel.YangStatusType;
+import org.onosproject.yang.compiler.datamodel.YangUses;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.YangUtilsParserManager;
+
+import java.io.IOException;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.Is.is;
+
+/**
+ * Test cases for testing uses listener.
+ */
+public class UsesListenerTest {
+
+    private final YangUtilsParserManager manager = new YangUtilsParserManager();
+
+    /**
+     * Checks uses statement inside module.
+     */
+    @Test
+    public void processUsesInModule() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/UsesInModule.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        YangGrouping yangGrouping = (YangGrouping) yangNode.getChild();
+        assertThat(yangGrouping.getName(), is("endpoint"));
+
+        YangUses yangUses = (YangUses) yangGrouping.getNextSibling();
+        assertThat(yangUses.getName(), is("endpoint"));
+    }
+
+    /**
+     * Checks uses statement inside container.
+     */
+    @Test
+    public void processUsesInContainer() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/UsesInContainer.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        YangGrouping yangGrouping = (YangGrouping) yangNode.getChild();
+        assertThat(yangGrouping.getName(), is("endpoint"));
+
+        YangContainer yangContainer = (YangContainer) yangGrouping.getNextSibling();
+        assertThat(yangContainer.getName(), is("valid"));
+
+        YangUses yangUses = (YangUses) yangContainer.getChild();
+        assertThat(yangUses.getName(), is("endpoint"));
+
+        // Check attributes associated with uses.
+        assertThat(yangUses.getStatus(), is(YangStatusType.CURRENT));
+        assertThat(yangUses.getReference(), is("\"RFC 6020\""));
+        assertThat(yangUses.getDescription(), is("\"grouping under test\""));
+    }
+
+    /**
+     * Checks uses statement inside list.
+     */
+    @Test
+    public void processUsesInList() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/UsesInList.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        YangGrouping yangGrouping = (YangGrouping) yangNode.getChild();
+        assertThat(yangGrouping.getName(), is("endpoint"));
+
+        YangList yangList = (YangList) yangGrouping.getNextSibling();
+        assertThat(yangList.getName(), is("valid"));
+
+        YangUses yangUses = (YangUses) yangList.getChild();
+        assertThat(yangUses.getName(), is("endpoint"));
+
+        // Check attributes associated with uses.
+        assertThat(yangUses.getStatus(), is(YangStatusType.CURRENT));
+        assertThat(yangUses.getReference(), is("\"RFC 6020\""));
+        assertThat(yangUses.getDescription(), is("\"grouping under test\""));
+    }
+}
diff --git a/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/ValueListenerTest.java b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/ValueListenerTest.java
new file mode 100644
index 0000000..4d14406
--- /dev/null
+++ b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/ValueListenerTest.java
@@ -0,0 +1,218 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.hamcrest.core.Is;
+import org.junit.Test;
+import org.onosproject.yang.compiler.datamodel.YangEnum;
+import org.onosproject.yang.compiler.datamodel.YangEnumeration;
+import org.onosproject.yang.compiler.datamodel.YangLeaf;
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangNodeType;
+import org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.YangUtilsParserManager;
+
+import java.io.IOException;
+import java.util.ListIterator;
+import java.util.Set;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.Is.is;
+
+/**
+ * Test cases for value listener.
+ */
+public class ValueListenerTest {
+
+    private final YangUtilsParserManager manager = new YangUtilsParserManager();
+
+    /**
+     * Checks explicitly configured value.
+     */
+    @Test
+    public void processValueStatement() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/ValueStatement.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), Is.is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("speed"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("enumeration"));
+        assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.ENUMERATION));
+        assertThat(((YangEnumeration) leafInfo.getDataType().getDataTypeExtendedInfo()).getName(),
+                is("speed_enum"));
+
+        Set<YangEnum> enumSet = ((YangEnumeration) leafInfo.getDataType().getDataTypeExtendedInfo()).getEnumSet();
+        for (YangEnum tmp : enumSet) {
+            if (tmp.getNamedValue().equals("10m")) {
+                assertThat(tmp.getValue(), is(10));
+            } else if (tmp.getNamedValue().equals("100m")) {
+                assertThat(tmp.getValue(), is(100));
+            } else if (tmp.getNamedValue().equals("auto")) {
+                assertThat(tmp.getValue(), is(1000));
+            }
+        }
+    }
+
+    /**
+     * Checks explicitly configured negative value.
+     */
+    @Test
+    public void processValueStatementWithNegativeValue() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/ValueStatementWithNegativeValue.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("speed"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("enumeration"));
+        assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.ENUMERATION));
+        assertThat(((YangEnumeration) leafInfo.getDataType().getDataTypeExtendedInfo()).getName(),
+                is("speed_enum"));
+
+        Set<YangEnum> enumSet = ((YangEnumeration) leafInfo.getDataType().getDataTypeExtendedInfo()).getEnumSet();
+        for (YangEnum tmp : enumSet) {
+            if (tmp.getNamedValue().equals("10m")) {
+                assertThat(tmp.getValue(), is(-2));
+            } else if (tmp.getNamedValue().equals("100m")) {
+                assertThat(tmp.getValue(), is(-1));
+            } else if (tmp.getNamedValue().equals("auto")) {
+                assertThat(tmp.getValue(), is(0));
+            }
+        }
+    }
+
+    /**
+     * Checks explicitly configured value with double quotes.
+     */
+    @Test
+    public void processValueStatementWithQuotes() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/ValueStatementWithQuotes.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("speed"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("enumeration"));
+        assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.ENUMERATION));
+        assertThat(((YangEnumeration) leafInfo.getDataType().getDataTypeExtendedInfo()).getName(),
+                is("speed_enum"));
+
+        Set<YangEnum> enumSet = ((YangEnumeration) leafInfo.getDataType().getDataTypeExtendedInfo()).getEnumSet();
+        for (YangEnum tmp : enumSet) {
+            if (tmp.getNamedValue().equals("10m")) {
+                assertThat(tmp.getValue(), is(10));
+            } else if (tmp.getNamedValue().equals("100m")) {
+                assertThat(tmp.getValue(), is(100));
+            } else if (tmp.getNamedValue().equals("auto")) {
+                assertThat(tmp.getValue(), is(1000));
+            }
+        }
+    }
+
+    /**
+     * Checks explicit value and auto generated value.
+     */
+    @Test
+    public void processValueAndAutoStatement() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/ValueAndAutoStatement.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("speed"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("enumeration"));
+        assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.ENUMERATION));
+        assertThat(((YangEnumeration) leafInfo.getDataType().getDataTypeExtendedInfo()).getName(),
+                is("speed_enum"));
+
+        Set<YangEnum> enumSet = ((YangEnumeration) leafInfo.getDataType().getDataTypeExtendedInfo()).getEnumSet();
+        for (YangEnum tmp : enumSet) {
+            if (tmp.getNamedValue().equals("10m")) {
+                assertThat(tmp.getValue(), is(10));
+            } else if (tmp.getNamedValue().equals("100m")) {
+                assertThat(tmp.getValue(), is(11));
+            } else if (tmp.getNamedValue().equals("auto")) {
+                assertThat(tmp.getValue(), is(1000));
+            }
+        }
+    }
+
+    /**
+     * Checks explicit value should not be repeated.
+     */
+    @Test(expected = ParserException.class)
+    public void processValueDuplication() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/ValueDuplication.yang");
+    }
+
+    /**
+     * Checks explicit or auto generated value should not be repeated.
+     */
+    @Test(expected = ParserException.class)
+    public void processValueExplicitAndAutoDuplication() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/ValueExplicitAndAutoDuplication.yang");
+    }
+}
diff --git a/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/VersionListenerTest.java b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/VersionListenerTest.java
new file mode 100644
index 0000000..219201a
--- /dev/null
+++ b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/VersionListenerTest.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.yang.compiler.parser.impl.listeners;
+
+import org.junit.Test;
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.YangUtilsParserManager;
+
+import java.io.IOException;
+
+import static org.hamcrest.core.Is.is;
+import static org.junit.Assert.assertThat;
+
+/**
+ * Test cases for testing version listener functionality.
+ */
+public class VersionListenerTest {
+
+    private final YangUtilsParserManager manager = new YangUtilsParserManager();
+
+    /**
+     * Checks if value of version is correct.
+     */
+    @Test(expected = ParserException.class)
+    public void processVersionInvalidValue() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/VersionInvalidValue.yang");
+    }
+
+    /**
+     * Checks if version listener updates the data model tree.
+     */
+    @Test
+    public void processVersionValidEntry() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/VersionValidEntry.yang");
+
+        // Checks for the version value in data model tree.
+        assertThat(((YangModule) node).getVersion(), is((byte) 1));
+    }
+
+    /**
+     * Checks version in double quotes.
+     */
+    @Test
+    public void processValidVersionWithDoubleQuotes() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/ValidVersionWithDoubleQuotes.yang");
+
+        // Checks for the version value in data model tree.
+        assertThat(((YangModule) node).getVersion(), is((byte) 1));
+    }
+
+    /**
+     * Checks if version which is optional paramater is not present.
+     */
+    @Test
+    public void processVersionNotPresent() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/VersionNotPresent.yang");
+
+        // Checks for the version value in data model tree.
+        assertThat(((YangModule) node).getVersion(), is((byte) 1));
+    }
+
+    /**
+     * Checks that version should be present only once.
+     */
+    @Test(expected = ParserException.class)
+    public void processVersionDualEntry() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/VersionDualEntry.yang");
+    }
+
+    /**
+     * Checks if version can appear in any order in module header.
+     */
+    @Test
+    public void processVersionOrder() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/VersionOrder.yang");
+
+        // Checks for the version value in data model tree.
+        assertThat(((YangModule) node).getVersion(), is((byte) 1));
+    }
+
+    /**
+     * Checks if sytax of version entry is not correct.
+     */
+    @Test(expected = ParserException.class)
+    public void processVersionInvalidSyntax() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/VersionInvalidSyntax.yang");
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/WhenListenerTest.java b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/WhenListenerTest.java
new file mode 100644
index 0000000..c673b1a
--- /dev/null
+++ b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/WhenListenerTest.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.junit.Test;
+import org.onosproject.yang.compiler.datamodel.YangContainer;
+import org.onosproject.yang.compiler.datamodel.YangLeaf;
+import org.onosproject.yang.compiler.datamodel.YangList;
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.YangUtilsParserManager;
+
+import java.io.IOException;
+import java.util.ListIterator;
+
+import static org.hamcrest.core.Is.is;
+import static org.junit.Assert.assertThat;
+
+/**
+ * Test cases for testing when listener functionality.
+ */
+public class WhenListenerTest {
+
+    private final YangUtilsParserManager manager = new YangUtilsParserManager();
+
+    /**
+     * Checks if when listener updates the data model.
+     */
+    @Test
+    public void processContainerSubStatementWhen() throws IOException, ParserException {
+        YangNode node = manager.getDataModel("src/test/resources/ContainerSubStatementWhen.yang");
+
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        YangList yangList = (YangList) yangNode.getChild();
+        String expectedConstraint = "../switching-capability = 'TDM'";
+        assertThat(yangList.getName(), is("interface-switching-capability"));
+        assertThat(yangList.getWhen().getCondition(), is(expectedConstraint));
+
+        YangContainer container = (YangContainer) yangList.getNextSibling();
+        assertThat(container.getName(), is("time-division-multiplex-capable"));
+        assertThat(container.getWhen().getCondition(), is(expectedConstraint));
+    }
+
+    /**
+     * Checks if when listener updates the data model.
+     */
+    @Test
+    public void processLeafSubStatementWhen() throws IOException, ParserException {
+        YangNode node = manager.getDataModel("src/test/resources/LeafSubStatementWhen.yang");
+
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getWhen().getCondition(), is("ifType != 'ethernet'"));
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/parserutils/ListenerErrorMessageConstructionTest.java b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/parserutils/ListenerErrorMessageConstructionTest.java
new file mode 100644
index 0000000..1301c8b
--- /dev/null
+++ b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/parserutils/ListenerErrorMessageConstructionTest.java
@@ -0,0 +1,92 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.parserutils;
+
+import org.junit.Test;
+import org.onosproject.yang.compiler.datamodel.utils.YangConstructType;
+
+import static org.hamcrest.core.Is.is;
+import static org.junit.Assert.assertThat;
+
+/**
+ * Test case for testing listener error message construction util.
+ */
+public class ListenerErrorMessageConstructionTest {
+
+    /**
+     * Checks for error message construction with parsable data type name.
+     */
+    @Test
+    public void checkErrorMsgConstructionWithName() {
+
+        // Create an test error message
+        String testErrorMessage = ListenerErrorMessageConstruction.constructListenerErrorMessage(ListenerErrorType.INVALID_HOLDER, YangConstructType.CONTACT_DATA, "Test Instance", ListenerErrorLocation.ENTRY);
+
+        // Check message.
+        assertThat(testErrorMessage, is("Internal parser error detected: Invalid holder for contact "
+                + "\"Test Instance\" before processing."));
+    }
+
+    /**
+     * Checks for error message construction without parsable data type name.
+     */
+    @Test
+    public void checkErrorMsgConstructionWithoutName() {
+
+        // Create an test error message
+        String testErrorMessage = ListenerErrorMessageConstruction.constructListenerErrorMessage(ListenerErrorType.INVALID_HOLDER, YangConstructType.CONTACT_DATA, "Test Instance", ListenerErrorLocation.ENTRY);
+
+        // Check message.
+        assertThat(testErrorMessage,
+                   is("Internal parser error detected: Invalid holder for contact \"Test Instance\""
+                           + " before processing."));
+    }
+
+    /**
+     * Checks for extended error message construction with parsable data type
+     * name.
+     */
+    @Test
+    public void checkExtendedErrorMsgConstructionWithName() {
+
+        // Create an test error message
+        String testErrorMessage = ListenerErrorMessageConstruction.constructExtendedListenerErrorMessage(ListenerErrorType.INVALID_HOLDER, YangConstructType.CONTACT_DATA,
+                                                                                                         "Test Instance", ListenerErrorLocation.ENTRY,
+                                                                                                         "Extended Information");
+
+        // Check message.
+        assertThat(testErrorMessage,
+                   is("Internal parser error detected: Invalid holder for contact \"Test Instance\""
+                           + " before processing.\n" + "Error Information: Extended Information"));
+    }
+
+    /**
+     * Checks for extended error message construction without parsable data type
+     * name.
+     */
+    @Test
+    public void checkExtendedErrorMsgConstructionWithoutName() {
+
+        // Create an test error message
+        String testErrorMessage = ListenerErrorMessageConstruction.constructExtendedListenerErrorMessage(ListenerErrorType.INVALID_HOLDER, YangConstructType.CONTACT_DATA, "", ListenerErrorLocation.ENTRY,
+                                                                                                         "Extended Information");
+
+        // Check message.
+        assertThat(testErrorMessage, is("Internal parser error detected: Invalid holder for contact"
+                + " before processing.\n" + "Error Information: Extended Information"));
+    }
+}
diff --git a/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/parserutils/ListenerUtilTest.java b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/parserutils/ListenerUtilTest.java
new file mode 100644
index 0000000..b58cb33
--- /dev/null
+++ b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/parserutils/ListenerUtilTest.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.parserutils;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.YangUtilsParserManager;
+
+import java.io.IOException;
+
+/**
+ * Test case for testing listener util.
+ */
+public class ListenerUtilTest {
+
+    @Rule
+    public ExpectedException thrown = ExpectedException.none();
+
+    private final YangUtilsParserManager manager = new YangUtilsParserManager();
+
+    /**
+     * Checks whether exception is thrown when identifier starts with xml.
+     */
+    @Test
+    public void validateIdentifierStartsWithXml() throws IOException {
+        thrown.expect(ParserException.class);
+        thrown.expectMessage("YANG file error : module identifier xMlTest must not start" +
+                " with (('X'|'x') ('M'|'m') ('L'|'l'))");
+        manager.getDataModel("src/test/resources/InValidIdentifierXML.yang");
+    }
+}
diff --git a/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/parserutils/ListenerValidationTest.java b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/parserutils/ListenerValidationTest.java
new file mode 100644
index 0000000..6ed3d3b
--- /dev/null
+++ b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/parserutils/ListenerValidationTest.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.yang.compiler.parser.impl.parserutils;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.onosproject.yang.compiler.datamodel.YangRevision;
+import org.onosproject.yang.compiler.datamodel.utils.YangConstructType;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.TreeWalkListener;
+
+/**
+ * Test case for testing listener validation util.
+ */
+public class ListenerValidationTest {
+
+    @Rule
+    public ExpectedException thrown = ExpectedException.none();
+
+    /**
+     * Checks for exception in case parsable stack is empty while validating for
+     * not empty scenario.
+     */
+    @Test
+    public void validateStackIsNotEmptyForEmptyStack() {
+
+        String expectedError = ListenerErrorMessageConstruction.constructListenerErrorMessage(ListenerErrorType.MISSING_HOLDER, YangConstructType.YANGBASE_DATA, "", ListenerErrorLocation.EXIT);
+
+        // Get the exception occurred during parsing.
+        thrown.expect(ParserException.class);
+        thrown.expectMessage(expectedError);
+
+        // Create test walker and assign test error to it.
+        TreeWalkListener testWalker = new TreeWalkListener();
+
+        ListenerValidation.checkStackIsNotEmpty(testWalker, ListenerErrorType.MISSING_HOLDER, YangConstructType.YANGBASE_DATA, "", ListenerErrorLocation.EXIT);
+    }
+
+    /**
+     * Checks if there is no exception in case parsable stack is not empty while
+     * validating for not empty scenario.
+     */
+    @Test
+    public void validateStackIsNotEmptyForNonEmptyStack() {
+
+        // Create test walker and assign test error to it.
+        TreeWalkListener testWalker = new TreeWalkListener();
+
+        // Create a temporary node of parsable.
+        YangRevision tmpNode = new YangRevision();
+        testWalker.getParsedDataStack().push(tmpNode);
+
+        ListenerValidation.checkStackIsNotEmpty(testWalker, ListenerErrorType.MISSING_HOLDER, YangConstructType.YANGBASE_DATA, "", ListenerErrorLocation.EXIT);
+    }
+
+    /**
+     * Checks for exception in case parsable stack is not empty while validating
+     * for empty scenario.
+     */
+    @Test
+    public void validateStackIsEmptyForNonEmptyStack() {
+
+        String expectedError = ListenerErrorMessageConstruction.constructListenerErrorMessage(ListenerErrorType.MISSING_HOLDER, YangConstructType.YANGBASE_DATA, "", ListenerErrorLocation.EXIT);
+
+        // Get the exception occurred during parsing.
+        thrown.expect(ParserException.class);
+        thrown.expectMessage(expectedError);
+
+        // Create test walker and assign test error to it.
+        TreeWalkListener testWalker = new TreeWalkListener();
+
+        // Create a temporary node of parsable.
+        YangRevision tmpNode = new YangRevision();
+        testWalker.getParsedDataStack().push(tmpNode);
+
+        ListenerValidation.checkStackIsEmpty(testWalker, ListenerErrorType.MISSING_HOLDER, YangConstructType.YANGBASE_DATA, "", ListenerErrorLocation.EXIT);
+    }
+
+    /**
+     * Checks if there is no exception in case parsable stack is empty while
+     * validating for empty scenario.
+     */
+    @Test
+    public void validateStackIsEmptyForEmptyStack() {
+
+        // Create test walker and assign test error to it.
+        TreeWalkListener testWalker = new TreeWalkListener();
+
+        ListenerValidation.checkStackIsEmpty(testWalker, ListenerErrorType.MISSING_HOLDER, YangConstructType.YANGBASE_DATA, "", ListenerErrorLocation.EXIT);
+    }
+}
diff --git a/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/parserutils/ParseTreeErrorListenerTest.java b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/parserutils/ParseTreeErrorListenerTest.java
new file mode 100644
index 0000000..da0c399
--- /dev/null
+++ b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/parserutils/ParseTreeErrorListenerTest.java
@@ -0,0 +1,100 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.parserutils;
+
+import org.antlr.v4.runtime.ANTLRFileStream;
+import org.antlr.v4.runtime.ANTLRInputStream;
+import org.antlr.v4.runtime.CommonTokenStream;
+import org.antlr.v4.runtime.tree.ParseTree;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangLexer;
+import org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.CustomExceptionMatcher;
+import org.onosproject.yang.compiler.parser.impl.YangUtilsParserManager;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.IOException;
+
+/**
+ * Test case for testing parse tree error listener.
+ */
+public class ParseTreeErrorListenerTest {
+
+    YangUtilsParserManager manager = new YangUtilsParserManager();
+    File file;
+    BufferedWriter out;
+
+    @Rule
+    public ExpectedException thrown = ExpectedException.none();
+
+    /**
+     * Checks that no exception is generated for YANG file with valid syntax.
+     */
+    @Test
+    public void checkValidYangFileForNoSyntaxError() throws IOException {
+
+        ANTLRInputStream input = new ANTLRFileStream("src/test/resources/YangFileWithoutSyntaxError.yang");
+
+        // Create a lexer that feeds off of input char stream.
+        GeneratedYangLexer lexer = new GeneratedYangLexer(input);
+        // Create a buffer of tokens pulled from the lexer.
+        CommonTokenStream tokens = new CommonTokenStream(lexer);
+        // Create a parser that feeds off the tokens buffer.
+        GeneratedYangParser parser = new GeneratedYangParser(tokens);
+        // Remove console error listener.
+        parser.removeErrorListeners();
+        // Create instance of customized error listener.
+        ParseTreeErrorListener parseTreeErrorListener = new ParseTreeErrorListener();
+        // Add customized error listener to catch errors during parsing.
+        parser.addErrorListener(parseTreeErrorListener);
+        // Begin parsing YANG file and generate parse tree.
+        ParseTree tree = parser.yangfile();
+    }
+
+    /**
+     * Checks that exception is generated for YANG file with invalid syntax.
+     */
+    @Test
+    public void checkInvalidYangFileForSyntaxError() throws IOException {
+
+        // Get the exception occurred during parsing.
+        thrown.expect(ParserException.class);
+        thrown.expect(CustomExceptionMatcher.errorLocation(3, 0));
+        thrown.expectMessage("no viable alternative at input 'yang-version 1\\nnamespace'");
+
+        ANTLRInputStream input = new ANTLRFileStream("src/test/resources/YangFileWithSyntaxError.yang");
+
+        // Create a lexer that feeds off of input char stream.
+        GeneratedYangLexer lexer = new GeneratedYangLexer(input);
+        // Create a buffer of tokens pulled from the lexer.
+        CommonTokenStream tokens = new CommonTokenStream(lexer);
+        // Create a parser that feeds off the tokens buffer.
+        GeneratedYangParser parser = new GeneratedYangParser(tokens);
+        // Remove console error listener.
+        parser.removeErrorListeners();
+        // Create instance of customized error listener.
+        ParseTreeErrorListener parseTreeErrorListener = new ParseTreeErrorListener();
+        // Add customized error listener to catch errors during parsing.
+        parser.addErrorListener(parseTreeErrorListener);
+        // Begin parsing YANG file and generate parse tree.
+        ParseTree tree = parser.yangfile();
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/AnyxmlStatement.yang b/compiler/base/parser/src/test/resources/AnyxmlStatement.yang
new file mode 100644
index 0000000..4b1e421
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/AnyxmlStatement.yang
@@ -0,0 +1,16 @@
+module event {
+
+    namespace "http://example.com/event";
+    prefix "ev";
+
+    notification event {
+        leaf event-class {
+            type string;
+        }
+        anyxml reporting-entity;
+        leaf severity {
+            type string;
+        }
+    }
+}
+
diff --git a/compiler/base/parser/src/test/resources/BelongsToDualPrefix.yang b/compiler/base/parser/src/test/resources/BelongsToDualPrefix.yang
new file mode 100644
index 0000000..37973da
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/BelongsToDualPrefix.yang
@@ -0,0 +1,8 @@
+submodule Test {
+yang-version 1;
+belongs-to ONOS {
+prefix On1;
+prefix On2;
+}
+}
+
diff --git a/compiler/base/parser/src/test/resources/BelongsToWithPrefix.yang b/compiler/base/parser/src/test/resources/BelongsToWithPrefix.yang
new file mode 100644
index 0000000..75a13ca
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/BelongsToWithPrefix.yang
@@ -0,0 +1,6 @@
+submodule Test {
+yang-version 1;
+belongs-to ONOS {
+prefix On1;
+}
+}
diff --git a/compiler/base/parser/src/test/resources/BelongsToWithoutPrefix.yang b/compiler/base/parser/src/test/resources/BelongsToWithoutPrefix.yang
new file mode 100644
index 0000000..eaf9885
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/BelongsToWithoutPrefix.yang
@@ -0,0 +1,6 @@
+submodule Test {
+yang-version 1;
+belongs-to ONOS {
+}
+}
+
diff --git a/compiler/base/parser/src/test/resources/BitTypeStatement.yang b/compiler/base/parser/src/test/resources/BitTypeStatement.yang
new file mode 100644
index 0000000..9d13495
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/BitTypeStatement.yang
@@ -0,0 +1,12 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+     leaf mybits {
+         type bits {
+             bit disable-nagle;
+             bit auto-sense-speed;
+             bit Ten-Mb-only;
+         }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/BitTypedefReferredLeafStatement.yang b/compiler/base/parser/src/test/resources/BitTypedefReferredLeafStatement.yang
new file mode 100644
index 0000000..cda6381
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/BitTypedefReferredLeafStatement.yang
@@ -0,0 +1,22 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    typedef topBits { 
+        type bits {
+             bit disable-nagle {
+                 position 0;
+             }
+             bit auto-sense-speed {
+                 position 1;
+             }
+             bit Mb-only {
+                 position 2;
+             }
+         }
+    }
+
+    leaf myBits {
+        type topBits;
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/BitTypedefStatement.yang b/compiler/base/parser/src/test/resources/BitTypedefStatement.yang
new file mode 100644
index 0000000..d3dc26a
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/BitTypedefStatement.yang
@@ -0,0 +1,18 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    typedef type15 { 
+        type bits {
+             bit disable-nagle {
+                 position 0;
+             }
+             bit auto-sense-speed {
+                 position 1;
+             }
+             bit Mb-only {
+                 position 2;
+             }
+         }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/BitUnionStatement.yang b/compiler/base/parser/src/test/resources/BitUnionStatement.yang
new file mode 100644
index 0000000..dd62eae
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/BitUnionStatement.yang
@@ -0,0 +1,20 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf type15 { 
+        type union {
+            type bits {
+                bit disable-nagle {
+                    position 0;
+                }
+                bit auto-sense-speed {
+                    position 1;
+                }
+                bit Mb-only {
+                    position 2;
+                }
+            }
+        }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/BitWithDuplicateName.yang b/compiler/base/parser/src/test/resources/BitWithDuplicateName.yang
new file mode 100644
index 0000000..ed5cc32
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/BitWithDuplicateName.yang
@@ -0,0 +1,12 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+     leaf mybits {
+         type bits {
+             bit disable-nagle;
+             bit disable-nagle;
+             bit Ten-Mb-only;
+         }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/CaseChoiceHierarchy.yang b/compiler/base/parser/src/test/resources/CaseChoiceHierarchy.yang
new file mode 100644
index 0000000..28d110e
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/CaseChoiceHierarchy.yang
@@ -0,0 +1,23 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    container food {
+        choice snack {
+            case sports-arena {
+                leaf pretzel {
+                    type empty;
+                }
+            }
+            case late-night {
+                choice dinner {
+                    case late-night {
+                        leaf beer {
+                            type empty;
+                        }
+                    }
+                }
+            }
+        }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/CaseStatement.yang b/compiler/base/parser/src/test/resources/CaseStatement.yang
new file mode 100644
index 0000000..bb3f6c9
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/CaseStatement.yang
@@ -0,0 +1,26 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+     container food {
+       choice snack {
+           case sports-arena {
+               leaf pretzel {
+                   type empty;
+               }
+               leaf beer {
+                   type empty;
+               }
+           }
+           case late-night {
+               leaf chocolate {
+                   type enumeration {
+                       enum dark;
+                       enum milk;
+                       enum first-available;
+                   }
+               }
+           }
+       }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/CaseStatementSameEntryDifferentChoice.yang b/compiler/base/parser/src/test/resources/CaseStatementSameEntryDifferentChoice.yang
new file mode 100644
index 0000000..b42cdf9
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/CaseStatementSameEntryDifferentChoice.yang
@@ -0,0 +1,28 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+     container food {
+       choice snack {
+           case sports-arena {
+               leaf pretzel {
+                   type empty;
+               }
+               leaf beer {
+                   type empty;
+               }
+           }
+       }
+       choice lunch {
+           case sports-arena {
+               leaf chocolate {
+                   type enumeration {
+                       enum dark;
+                       enum milk;
+                       enum first-available;
+                   }
+               }
+           }
+       }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/CaseSubStatementOfAugment.yang b/compiler/base/parser/src/test/resources/CaseSubStatementOfAugment.yang
new file mode 100644
index 0000000..7123f91
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/CaseSubStatementOfAugment.yang
@@ -0,0 +1,58 @@
+module event {
+
+    namespace "http://example.com/event";
+    prefix "ev";
+
+    augment /snmp:snmp/snmp:engine/snmp:listen/snmp:transport {
+    if-feature tlstm;
+    case tls {
+      container tls {
+        description
+          "A list of IPv4 and IPv6 addresses and ports to which the
+           engine listens for SNMP messages over TLS.";
+        leaf ip {
+          type inet:ip-address;
+          mandatory true;
+          description
+            "The IPv4 or IPv6 address on which the engine listens
+             for SNMP messages over TLS.";
+        }
+        leaf port {
+          type inet:port-number;
+          description
+            "The TCP port on which the engine listens for SNMP
+             messages over TLS.
+             If the port is not configured, an engine that
+             acts as a Command Responder uses port 10161, and
+             an engine that acts as a Notification Receiver
+             uses port 10162.";
+        }
+      }
+    }
+    case dtls {
+      container dtls1 {
+        description
+          "A list of IPv4 and IPv6 addresses and ports to which the
+           engine listens for SNMP messages over DTLS.";
+        leaf ip {
+          type inet:ip-address;
+          mandatory true;
+          description
+            "The IPv4 or IPv6 address on which the engine listens
+             for SNMP messages over DTLS.";
+        }
+        leaf port {
+          type inet:port-number;
+          description
+            "The UDP port on which the engine listens for SNMP
+             messages over DTLS.
+             If the port is not configured, an engine that
+             acts as a Command Responder uses port 10161, and
+             an engine that acts as a Notification Receiver
+             uses port 10162.";
+        }
+      }
+    }
+  }
+}
+
diff --git a/compiler/base/parser/src/test/resources/ChoiceStatementDuplicateEntry.yang b/compiler/base/parser/src/test/resources/ChoiceStatementDuplicateEntry.yang
new file mode 100644
index 0000000..d2a6371
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ChoiceStatementDuplicateEntry.yang
@@ -0,0 +1,10 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+     container food {
+       choice snack;
+       choice lunch;
+       choice snack;
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/ChoiceStatementSameEntryDifferentContainer.yang b/compiler/base/parser/src/test/resources/ChoiceStatementSameEntryDifferentContainer.yang
new file mode 100644
index 0000000..39ba626
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ChoiceStatementSameEntryDifferentContainer.yang
@@ -0,0 +1,13 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+     container food1 {
+       choice snack;
+       choice lunch;
+    }
+     container food2 {
+       choice snack;
+       choice lunch;
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/ChoiceStatementWithStmtend.yang b/compiler/base/parser/src/test/resources/ChoiceStatementWithStmtend.yang
new file mode 100644
index 0000000..4b85f59
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ChoiceStatementWithStmtend.yang
@@ -0,0 +1,8 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+     container food {
+       choice snack;
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/ChoiceStatementWithoutBody.yang b/compiler/base/parser/src/test/resources/ChoiceStatementWithoutBody.yang
new file mode 100644
index 0000000..2de7787
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ChoiceStatementWithoutBody.yang
@@ -0,0 +1,9 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+     container food {
+       choice snack {
+       }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/ChoiceSubStatementDefault.yang b/compiler/base/parser/src/test/resources/ChoiceSubStatementDefault.yang
new file mode 100644
index 0000000..b9fd60d
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ChoiceSubStatementDefault.yang
@@ -0,0 +1,23 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    container food {
+       choice snack {
+           case sports-arena {
+               leaf pretzel {
+                   type string;
+               }
+               leaf beer {
+                   type string;
+               }
+           }
+           case late-night {
+               leaf chocolate {
+                   type string;
+               }
+           }
+           default "hello";
+       }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/ConfigDefaultValue.yang b/compiler/base/parser/src/test/resources/ConfigDefaultValue.yang
new file mode 100644
index 0000000..7e19946
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ConfigDefaultValue.yang
@@ -0,0 +1,15 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    container valid {
+        leaf invalid-interval {
+            type "uint16";
+            units "seconds";
+            description "Interval before a route is declared invalid";
+            mandatory true;
+            status current;
+            reference "RFC 6020";
+        }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/ConfigEmptyValue.yang b/compiler/base/parser/src/test/resources/ConfigEmptyValue.yang
new file mode 100644
index 0000000..0d62956
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ConfigEmptyValue.yang
@@ -0,0 +1,9 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf invalid-interval {
+        type "uint16";
+        config ;
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/ConfigFalse.yang b/compiler/base/parser/src/test/resources/ConfigFalse.yang
new file mode 100644
index 0000000..79dc5ac
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ConfigFalse.yang
@@ -0,0 +1,14 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf invalid-interval {
+        type "uint16";
+        units "seconds";
+        description "Interval before a route is declared invalid";
+        config false;
+        mandatory true;
+        status current;
+        reference "RFC 6020";
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/ConfigFalseNoKey.yang b/compiler/base/parser/src/test/resources/ConfigFalseNoKey.yang
new file mode 100644
index 0000000..66f141e
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ConfigFalseNoKey.yang
@@ -0,0 +1,14 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    list valid {
+        config false;
+        leaf invalid-interval {
+            type "string";
+            units "seconds";
+            status current;
+            reference "RFC 6020";
+        }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/ConfigFalseParentContainerChildLeaf.yang b/compiler/base/parser/src/test/resources/ConfigFalseParentContainerChildLeaf.yang
new file mode 100644
index 0000000..ecc0806
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ConfigFalseParentContainerChildLeaf.yang
@@ -0,0 +1,15 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    container valid {
+        config false;
+        leaf invalid-interval {
+            type "uint16";
+            units "seconds";
+            status current;
+            config true;
+            reference "RFC 6020";
+        }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/ConfigFalseParentContainerChildLeafList.yang b/compiler/base/parser/src/test/resources/ConfigFalseParentContainerChildLeafList.yang
new file mode 100644
index 0000000..e3c7836
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ConfigFalseParentContainerChildLeafList.yang
@@ -0,0 +1,15 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    container valid {
+        config false;
+        leaf-list invalid-interval {
+            type "uint16";
+            units "seconds";
+            status current;
+            config true;
+            reference "RFC 6020";
+        }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/ConfigFalseParentContainerChildList.yang b/compiler/base/parser/src/test/resources/ConfigFalseParentContainerChildList.yang
new file mode 100644
index 0000000..ffc6f60
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ConfigFalseParentContainerChildList.yang
@@ -0,0 +1,18 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    container valid {
+        config false;
+        list valid {
+            key "invalid-interval";
+            config true;
+            leaf invalid-interval {
+                type "uint16";
+                units "seconds";
+                status current;
+                reference "RFC 6020";
+            }
+        }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/ConfigFalseParentListChildContainer.yang b/compiler/base/parser/src/test/resources/ConfigFalseParentListChildContainer.yang
new file mode 100644
index 0000000..3158dd4
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ConfigFalseParentListChildContainer.yang
@@ -0,0 +1,24 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    list valid {
+        config false;
+        key "invalid-interval";
+        leaf invalid-interval {
+            type "uint16";
+            units "seconds";
+            status current;
+            reference "RFC 6020";
+        }
+        container valid {
+            config true;
+            leaf invalid-interval {
+                type "uint16";
+                units "seconds";
+                status current;
+                reference "RFC 6020";
+            }
+        }
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/ConfigFalseParentListChildLeaf.yang b/compiler/base/parser/src/test/resources/ConfigFalseParentListChildLeaf.yang
new file mode 100644
index 0000000..65171dd
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ConfigFalseParentListChildLeaf.yang
@@ -0,0 +1,16 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    list valid {
+        key "invalid-interval";
+        config false;
+        leaf invalid-interval {
+            type "uint16";
+            config true;
+            units "seconds";
+            status current;
+            reference "RFC 6020";
+        }
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/ConfigFalseParentListChildLeafList.yang b/compiler/base/parser/src/test/resources/ConfigFalseParentListChildLeafList.yang
new file mode 100644
index 0000000..33132cd
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ConfigFalseParentListChildLeafList.yang
@@ -0,0 +1,16 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    list valid {
+        key "invalid-interval";
+        config false;
+        leaf-list invalid-interval {
+            type "uint16";
+            config true;
+            units "seconds";
+            status current;
+            reference "RFC 6020";
+        }
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/ConfigFalseValidKeyValidLeaf.yang b/compiler/base/parser/src/test/resources/ConfigFalseValidKeyValidLeaf.yang
new file mode 100644
index 0000000..368a4b5
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ConfigFalseValidKeyValidLeaf.yang
@@ -0,0 +1,15 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    list valid {
+        key "invalid-interval";
+        config false;
+        leaf invalid-interval {
+            type "string";
+            units "seconds";
+            status current;
+            reference "RFC 6020";
+        }
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/ConfigInvalidValue.yang b/compiler/base/parser/src/test/resources/ConfigInvalidValue.yang
new file mode 100644
index 0000000..b2e7659
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ConfigInvalidValue.yang
@@ -0,0 +1,9 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf invalid-interval {
+        type "uint16";
+        config invalid;
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/ConfigTrue.yang b/compiler/base/parser/src/test/resources/ConfigTrue.yang
new file mode 100644
index 0000000..70349a0
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ConfigTrue.yang
@@ -0,0 +1,14 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf invalid-interval {
+        type "uint16";
+        units "seconds";
+        description "Interval before a route is declared invalid";
+        config true;
+        mandatory true;
+        status current;
+        reference "RFC 6020";
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/ConfigTrueNoKey.yang b/compiler/base/parser/src/test/resources/ConfigTrueNoKey.yang
new file mode 100644
index 0000000..7a0a538
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ConfigTrueNoKey.yang
@@ -0,0 +1,14 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    list valid {
+        config true;
+        leaf invalid-interval {
+            type "string";
+            units "seconds";
+            status current;
+            reference "RFC 6020";
+        }
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/ConfigTrueNoleafNoLeafList.yang b/compiler/base/parser/src/test/resources/ConfigTrueNoleafNoLeafList.yang
new file mode 100644
index 0000000..c553e60
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ConfigTrueNoleafNoLeafList.yang
@@ -0,0 +1,13 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    list valid {
+        config true;
+        container container1 {
+           leaf leaf1 {
+              type "string";
+           }
+        }
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/ConfigTrueValidKeyValidLeaf.yang b/compiler/base/parser/src/test/resources/ConfigTrueValidKeyValidLeaf.yang
new file mode 100644
index 0000000..fe8efe3
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ConfigTrueValidKeyValidLeaf.yang
@@ -0,0 +1,14 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    list valid {
+        key "invalid-interval";
+        leaf invalid-interval {
+            type "string";
+            units "seconds";
+            status current;
+            reference "RFC 6020";
+        }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/ConfigTrueValidKeyValidLeafList.yang b/compiler/base/parser/src/test/resources/ConfigTrueValidKeyValidLeafList.yang
new file mode 100644
index 0000000..4196be4
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ConfigTrueValidKeyValidLeafList.yang
@@ -0,0 +1,14 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    list valid {
+        key "invalid-interval";
+        leaf-list invalid-interval {
+            type "string";
+            units "seconds";
+            status current;
+            reference "RFC 6020";
+        }
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/ConfigWithoutStatementEnd.yang b/compiler/base/parser/src/test/resources/ConfigWithoutStatementEnd.yang
new file mode 100644
index 0000000..0ae02af
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ConfigWithoutStatementEnd.yang
@@ -0,0 +1,9 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf invalid-interval {
+        type "uint16";
+        config false
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/ContactDualEntryTest.yang b/compiler/base/parser/src/test/resources/ContactDualEntryTest.yang
new file mode 100644
index 0000000..2dca10e
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ContactDualEntryTest.yang
@@ -0,0 +1,9 @@
+module Test {
+yang-version 1;
+namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
+prefix On;
+organization "IETF SPRING Working Group";
+contact "WG List";
+contact "Invalid";
+}
+
diff --git a/compiler/base/parser/src/test/resources/ContactIncorrectOrder.yang b/compiler/base/parser/src/test/resources/ContactIncorrectOrder.yang
new file mode 100644
index 0000000..237d003
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ContactIncorrectOrder.yang
@@ -0,0 +1,7 @@
+module Test {
+yang-version 1;
+contact "Test";
+namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
+prefix On;
+organization "IETF SPRING Working Group";
+}
diff --git a/compiler/base/parser/src/test/resources/ContactValidEntry.yang b/compiler/base/parser/src/test/resources/ContactValidEntry.yang
new file mode 100644
index 0000000..f88e147
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ContactValidEntry.yang
@@ -0,0 +1,9 @@
+module Test {
+yang-version 1;
+namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
+prefix On;
+organization "IETF SPRING Working Group";
+contact "WG List:  <mailto:spring@ietf.org>
+Editor:    Stephane Litkowski
+           <mailto:stephane.litkowski@orange.com>";
+}
diff --git a/compiler/base/parser/src/test/resources/ContactWithEmptyString.yang b/compiler/base/parser/src/test/resources/ContactWithEmptyString.yang
new file mode 100644
index 0000000..34c6008
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ContactWithEmptyString.yang
@@ -0,0 +1,7 @@
+module Test {
+yang-version 1;
+namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
+prefix On;
+organization "IETF SPRING Working Group";
+contact;
+}
diff --git a/compiler/base/parser/src/test/resources/ContactWithoutQuotes.yang b/compiler/base/parser/src/test/resources/ContactWithoutQuotes.yang
new file mode 100644
index 0000000..20ab72b
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ContactWithoutQuotes.yang
@@ -0,0 +1,8 @@
+module Test {
+yang-version 1;
+namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
+prefix On;
+organization "IETF SPRING Working Group";
+contact WG;
+}
+
diff --git a/compiler/base/parser/src/test/resources/ContainerDuplicateContainer.yang b/compiler/base/parser/src/test/resources/ContainerDuplicateContainer.yang
new file mode 100644
index 0000000..4928463
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ContainerDuplicateContainer.yang
@@ -0,0 +1,23 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    container ospf {
+        container valid {
+            leaf invalid-interval {
+                type "uint16";
+                units "seconds";
+                status current;
+                reference "RFC 6020";
+            }
+        }
+        container valid {
+            leaf invalid-interval {
+                type "uint16";
+                units "seconds";
+                status current;
+                reference "RFC 6020";
+            }
+        }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/ContainerInvalidIdentifier.yang b/compiler/base/parser/src/test/resources/ContainerInvalidIdentifier.yang
new file mode 100644
index 0000000..eee1acd
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ContainerInvalidIdentifier.yang
@@ -0,0 +1,14 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    container 1valid {
+        reference "RFC 6020";
+        leaf invalid-interval {
+            type "uint16";
+            units "seconds";
+            status current;
+            reference "RFC 6020";
+        }
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/ContainerRootNode.yang b/compiler/base/parser/src/test/resources/ContainerRootNode.yang
new file mode 100644
index 0000000..441d717
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ContainerRootNode.yang
@@ -0,0 +1,9 @@
+container valid {
+    reference "RFC 6020";
+    leaf invalid-interval {
+        type "uint16";
+        units "seconds";
+        status current;
+        reference "RFC 6020";
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/ContainerSubStatementCardinality.yang b/compiler/base/parser/src/test/resources/ContainerSubStatementCardinality.yang
new file mode 100644
index 0000000..731e389
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ContainerSubStatementCardinality.yang
@@ -0,0 +1,15 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    container valid {
+        reference "RFC 6020";
+        reference "RFC 6020";
+        leaf invalid-interval {
+            type "uint16";
+            units "seconds";
+            status current;
+            reference "RFC 6020";
+        }
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/ContainerSubStatementConfig.yang b/compiler/base/parser/src/test/resources/ContainerSubStatementConfig.yang
new file mode 100644
index 0000000..736dcbc
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ContainerSubStatementConfig.yang
@@ -0,0 +1,16 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    container valid {
+        config true;
+        leaf invalid-interval {
+            type "uint16";
+            units "seconds";
+            description "Interval before a route is declared invalid";
+            mandatory true;
+            status current;
+            reference "RFC 6020";
+        }
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/ContainerSubStatementContainer.yang b/compiler/base/parser/src/test/resources/ContainerSubStatementContainer.yang
new file mode 100644
index 0000000..1f9f810
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ContainerSubStatementContainer.yang
@@ -0,0 +1,15 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    container ospf {
+        container valid {
+            leaf invalid-interval {
+                type "uint16";
+                units "seconds";
+                status current;
+                reference "RFC 6020";
+            }
+        }
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/ContainerSubStatementDescription.yang b/compiler/base/parser/src/test/resources/ContainerSubStatementDescription.yang
new file mode 100644
index 0000000..dc75d00
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ContainerSubStatementDescription.yang
@@ -0,0 +1,18 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    container valid {
+        description "container description";
+        config true;
+        leaf invalid-interval {
+            type "uint16";
+            units "seconds";
+            description "Interval before a route is declared invalid";
+            mandatory true;
+            status current;
+            reference "RFC 6020";
+        }
+    }
+}
+
diff --git a/compiler/base/parser/src/test/resources/ContainerSubStatementErrorAppTag.yang b/compiler/base/parser/src/test/resources/ContainerSubStatementErrorAppTag.yang
new file mode 100644
index 0000000..644b890
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ContainerSubStatementErrorAppTag.yang
@@ -0,0 +1,25 @@
+module ErrorAppTag {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    container interface {
+        leaf ifType {
+            type enumeration {
+                enum ethernet;
+                enum atm;
+            }
+        }
+        leaf ifMTU {
+            type uint32;
+        }
+        must "ifType != 'ethernet' or " +
+             "(ifType = 'ethernet' and ifMTU = 1500)" {
+            description "An ethernet MTU must be 1500";
+            error-app-tag "An ethernet MTU must be 1500";
+        }
+        must "ifType != 'atm' or " +
+             "(ifType = 'atm' and ifMTU <= 17966 and ifMTU >= 64)" {
+            description "An atm MTU must be  64 .. 17966";
+        }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/ContainerSubStatementErrorDefaultAppTag.yang b/compiler/base/parser/src/test/resources/ContainerSubStatementErrorDefaultAppTag.yang
new file mode 100644
index 0000000..c265ea2
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ContainerSubStatementErrorDefaultAppTag.yang
@@ -0,0 +1,24 @@
+module ErrorAppTag {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    container interface {
+        leaf ifType {
+            type enumeration {
+                enum ethernet;
+                enum atm;
+            }
+        }
+        leaf ifMTU {
+            type uint32;
+        }
+        must "ifType != 'ethernet' or " +
+             "(ifType = 'ethernet' and ifMTU = 1500)" {
+            description "An ethernet MTU must be 1500";
+        }
+        must "ifType != 'atm' or " +
+             "(ifType = 'atm' and ifMTU <= 17966 and ifMTU >= 64)" {
+            description "An atm MTU must be  64 .. 17966";
+        }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/ContainerSubStatementErrorMessage.yang b/compiler/base/parser/src/test/resources/ContainerSubStatementErrorMessage.yang
new file mode 100644
index 0000000..4726d0c
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ContainerSubStatementErrorMessage.yang
@@ -0,0 +1,25 @@
+module ErrorMessage {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    container interface {
+        leaf ifType {
+            type enumeration {
+                enum ethernet;
+                enum atm;
+            }
+        }
+        leaf ifMTU {
+            type uint32;
+        }
+        must "ifType != 'ethernet' or " +
+             "(ifType = 'ethernet' and ifMTU = 1500)" {
+            description "An ethernet MTU must be 1500";
+            error-message "An ethernet MTU must be 1500";
+        }
+        must "ifType != 'atm' or " +
+             "(ifType = 'atm' and ifMTU <= 17966 and ifMTU >= 64)" {
+            description "An atm MTU must be  64 .. 17966";
+        }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/ContainerSubStatementLeaf.yang b/compiler/base/parser/src/test/resources/ContainerSubStatementLeaf.yang
new file mode 100644
index 0000000..c9a64e3
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ContainerSubStatementLeaf.yang
@@ -0,0 +1,17 @@
+
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    container valid {
+        leaf invalid-interval {
+            type "uint16";
+            units "seconds";
+            description "Interval before a route is declared invalid";
+            config true;
+            mandatory true;
+            status current;
+            reference "RFC 6020";
+        }
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/ContainerSubStatementLeafList.yang b/compiler/base/parser/src/test/resources/ContainerSubStatementLeafList.yang
new file mode 100644
index 0000000..a1877b6
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ContainerSubStatementLeafList.yang
@@ -0,0 +1,17 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    container valid {
+        leaf-list invalid-interval {
+            type "uint16";
+            units "seconds";
+            description "Interval before a route is declared invalid";
+            config true;
+            min-elements 1;
+            max-elements unbounded;
+            status current;
+            reference "RFC 6020";
+        }
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/ContainerSubStatementList.yang b/compiler/base/parser/src/test/resources/ContainerSubStatementList.yang
new file mode 100644
index 0000000..19810c7
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ContainerSubStatementList.yang
@@ -0,0 +1,16 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    container ospf {
+        list valid {
+            key "invalid-interval";
+            leaf invalid-interval {
+                type "uint16";
+                units "seconds";
+                status current;
+                reference "RFC 6020";
+            }
+        }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/ContainerSubStatementMust.yang b/compiler/base/parser/src/test/resources/ContainerSubStatementMust.yang
new file mode 100644
index 0000000..c089850
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ContainerSubStatementMust.yang
@@ -0,0 +1,24 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    container interface {
+        leaf ifType {
+            type enumeration {
+                enum ethernet;
+                enum atm;
+            }
+        }
+        leaf ifMTU {
+            type uint32;
+        }
+        must "ifType != 'ethernet' or " +
+             "(ifType = 'ethernet' and ifMTU = 1500)" {
+            description "An ethernet MTU must be 1500";
+        }
+        must "ifType != 'atm' or " +
+             "(ifType = 'atm' and ifMTU <= 17966 and ifMTU >= 64)" {
+            description "An atm MTU must be  64 .. 17966";
+        }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/ContainerSubStatementPresence.yang b/compiler/base/parser/src/test/resources/ContainerSubStatementPresence.yang
new file mode 100644
index 0000000..d3a30dc
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ContainerSubStatementPresence.yang
@@ -0,0 +1,14 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    container valid {
+        presence "invalid";
+        leaf invalid-interval {
+            type "uint16";
+            units "seconds";
+            status current;
+            reference "RFC 6020";
+        }
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/ContainerSubStatementReference.yang b/compiler/base/parser/src/test/resources/ContainerSubStatementReference.yang
new file mode 100644
index 0000000..33f37fd
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ContainerSubStatementReference.yang
@@ -0,0 +1,17 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    container valid {
+        reference "container reference";
+        config true;
+        leaf invalid-interval {
+        type "uint16";
+        units "seconds";
+        description "Interval before a route is declared invalid";
+        mandatory true;
+        status current;
+        reference "RFC 6020";
+        }
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/ContainerSubStatementStatus.yang b/compiler/base/parser/src/test/resources/ContainerSubStatementStatus.yang
new file mode 100644
index 0000000..fdf907d
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ContainerSubStatementStatus.yang
@@ -0,0 +1,17 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    container valid {
+        config true;
+        status obsolete;
+        leaf invalid-interval {
+            type "uint16";
+            units "seconds";
+            description "Interval before a route is declared invalid";
+            mandatory true;
+            status current;
+            reference "RFC 6020";
+        }
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/ContainerSubStatementWhen.yang b/compiler/base/parser/src/test/resources/ContainerSubStatementWhen.yang
new file mode 100644
index 0000000..c25b499
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ContainerSubStatementWhen.yang
@@ -0,0 +1,37 @@
+module Test {
+    yang-version 1;
+    namespace "http://huawei.com";
+    prefix Ant;
+    list interface-switching-capability {
+         when "../switching-capability = 'TDM'" {
+                 description "Valid only for TDM";
+         }
+         key "switching-capability";
+         description
+           "List of Interface Switching Capabilities Descriptors (ISCD)
+            for this link.";
+         reference
+           "RFC3471: Generalized Multi-Protocol Label Switching (GMPLS)
+            Signaling Functional Description.
+            RFC4203: OSPF Extensions in Support of Generalized
+            Multi-Protocol Label Switching (GMPLS).";
+         leaf switching-capability {
+           type string;
+           description
+             "Switching Capability for this interface.";
+         }
+     }
+     container time-division-multiplex-capable {
+         when "../switching-capability = 'TDM'" {
+             description "Valid only for TDM";
+         }
+         description
+             "Interface has time-division multiplex capabilities.";
+
+         leaf minimum-lsp-bandwidth {
+             type decimal64 {
+                fraction-digits 4;
+             } 
+         }
+     }
+}
diff --git a/compiler/base/parser/src/test/resources/ContainerSubStatements.yang b/compiler/base/parser/src/test/resources/ContainerSubStatements.yang
new file mode 100644
index 0000000..2611f97
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ContainerSubStatements.yang
@@ -0,0 +1,18 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    container ospf {
+        presence "ospf logs";
+        config true;
+        description "container description";
+        status current;
+        reference "container reference";
+        leaf invalid-interval {
+            type "uint16";
+            units "seconds";
+            status current;
+            reference "RFC 6020";
+        }
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/ContainerWithDuplicateLeaf.yang b/compiler/base/parser/src/test/resources/ContainerWithDuplicateLeaf.yang
new file mode 100644
index 0000000..3adaccd
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ContainerWithDuplicateLeaf.yang
@@ -0,0 +1,34 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    container valid {
+        leaf invalid-interval {
+            type "uint16";
+            units "seconds";
+            description "Interval before a route is declared invalid";
+            config true;
+            mandatory true;
+            status current;
+            reference "RFC 6020";
+        }
+        leaf valid-interval {
+            type "uint16";
+            units "seconds";
+            description "Interval before a route is declared invalid";
+            config true;
+            mandatory true;
+            status current;
+            reference "RFC 6020";
+        }
+        leaf valid-interval {
+            type "uint16";
+            units "seconds";
+            description "Interval before a route is declared invalid";
+            config true;
+            mandatory true;
+            status current;
+            reference "RFC 6020";
+        }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/DerivedTypeStatement.yang b/compiler/base/parser/src/test/resources/DerivedTypeStatement.yang
new file mode 100644
index 0000000..afbfd1d
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/DerivedTypeStatement.yang
@@ -0,0 +1,11 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    import ietf-yang-types {
+             prefix "P";
+         }
+    leaf invalid-interval {
+        type P:hello;
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/DescriptionEmptyStatement.yang b/compiler/base/parser/src/test/resources/DescriptionEmptyStatement.yang
new file mode 100644
index 0000000..f6c1c3d
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/DescriptionEmptyStatement.yang
@@ -0,0 +1,6 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    description "";
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/DescriptionStringConcat.yang b/compiler/base/parser/src/test/resources/DescriptionStringConcat.yang
new file mode 100644
index 0000000..8bf0519
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/DescriptionStringConcat.yang
@@ -0,0 +1,9 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf invalid-interval {
+        type "uint16";
+        description "Interval before a " + "route is declared invalid";
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/DescriptionValidStatement.yang b/compiler/base/parser/src/test/resources/DescriptionValidStatement.yang
new file mode 100644
index 0000000..70349a0
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/DescriptionValidStatement.yang
@@ -0,0 +1,14 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf invalid-interval {
+        type "uint16";
+        units "seconds";
+        description "Interval before a route is declared invalid";
+        config true;
+        mandatory true;
+        status current;
+        reference "RFC 6020";
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/DescriptionWithoutStatementEnd.yang b/compiler/base/parser/src/test/resources/DescriptionWithoutStatementEnd.yang
new file mode 100644
index 0000000..ebd8c24
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/DescriptionWithoutStatementEnd.yang
@@ -0,0 +1,9 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf invalid-interval {
+      type "uint16";
+      description "Interval before a " + "route is declared invalid"
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/DuplicateCaseInChoice.yang b/compiler/base/parser/src/test/resources/DuplicateCaseInChoice.yang
new file mode 100644
index 0000000..a7b6b50
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/DuplicateCaseInChoice.yang
@@ -0,0 +1,26 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+     container food {
+       choice snack {
+           case sports-arena {
+               leaf pretzel {
+                   type empty;
+               }
+               leaf beer {
+                   type empty;
+               }
+           }
+           case sports-arena {
+               leaf chocolate {
+                   type enumeration {
+                       enum dark;
+                       enum milk;
+                       enum first-available;
+                   }
+               }
+           }
+       }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/DuplicateContainerAndList.yang b/compiler/base/parser/src/test/resources/DuplicateContainerAndList.yang
new file mode 100644
index 0000000..74c7721
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/DuplicateContainerAndList.yang
@@ -0,0 +1,29 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    container ospf {
+        container valid {
+            leaf invalid-interval {
+                type "uint16";
+                units "seconds";
+                status current;
+                reference "RFC 6020";
+            }
+        }
+        list valid {
+            key "process-id";
+            container interface {
+                leaf invalid-interval {
+                    type "uint16";
+                    units "seconds";
+                    status current;
+                    reference "RFC 6020";
+                }
+            }
+            leaf process-id {
+                type "string";
+            }
+        }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/DuplicateGroupingInContainer.yang b/compiler/base/parser/src/test/resources/DuplicateGroupingInContainer.yang
new file mode 100644
index 0000000..f130797
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/DuplicateGroupingInContainer.yang
@@ -0,0 +1,23 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    container valid {
+        grouping endpoint {
+            leaf address {
+                type ip-address;
+            }
+            leaf port {
+                type port-number;
+            }
+        }
+        grouping endpoint {
+            leaf address {
+                type ip-address;
+            }
+            leaf port {
+                type port-number;
+            }
+        }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/DuplicateGroupingInList.yang b/compiler/base/parser/src/test/resources/DuplicateGroupingInList.yang
new file mode 100644
index 0000000..a9d1b3b
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/DuplicateGroupingInList.yang
@@ -0,0 +1,36 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    import ietf-yang-types {
+             prefix "P";
+         }
+    list valid {
+        key address;
+        grouping endpoint {
+            description "grouping under test";
+            status current;
+            reference "RFC 6020";
+            leaf address {
+                type ip-address;
+            }
+            leaf port {
+                type port-number;
+            }
+        }
+        leaf address {
+            type ip;
+        }
+        grouping endpoint {
+            description "grouping under test";
+            status current;
+            reference "RFC 6020";
+            leaf address {
+                type ip-address;
+            }
+            leaf port {
+                type port-number;
+            }
+        }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/DuplicateGroupingInModule.yang b/compiler/base/parser/src/test/resources/DuplicateGroupingInModule.yang
new file mode 100644
index 0000000..ec01781
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/DuplicateGroupingInModule.yang
@@ -0,0 +1,24 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    import ietf-yang-types {
+             prefix "P";
+         }
+    grouping endpoint {
+        leaf address {
+            type P:ip-address;
+        }
+        leaf port {
+            type P:port-number;
+        }
+    }
+    grouping endpoint {
+        leaf address {
+            type P:pip-address;
+        }
+        leaf port {
+            type P:port-number;
+        }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/DuplicateLeafInChoice.yang b/compiler/base/parser/src/test/resources/DuplicateLeafInChoice.yang
new file mode 100644
index 0000000..f951c7f
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/DuplicateLeafInChoice.yang
@@ -0,0 +1,21 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+     container food {
+       choice snack {
+           case sports-arena {
+               leaf pretzel {
+                   type empty;
+               }
+               leaf beer {
+                   type empty;
+               }
+           }
+           case late-night {
+               leaf pretzel {
+                   type empty;
+               }
+           }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/DuplicateLeafInHierarchy.yang b/compiler/base/parser/src/test/resources/DuplicateLeafInHierarchy.yang
new file mode 100644
index 0000000..e23f04c
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/DuplicateLeafInHierarchy.yang
@@ -0,0 +1,23 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    container food {
+        choice snack {
+            case sports-arena {
+                leaf pretzel {
+                    type empty;
+                }
+            }
+            case late-night {
+                choice lunch {
+                    case late {
+                        leaf pretzel {
+                            type empty;
+                        }
+                    }
+                }
+            }
+        }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/EnumBoundaryValue.yang b/compiler/base/parser/src/test/resources/EnumBoundaryValue.yang
new file mode 100644
index 0000000..ac87ef0
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/EnumBoundaryValue.yang
@@ -0,0 +1,16 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf ifType {
+        type enumeration {
+             enum "unbounded";
+             enum ZERO;
+             enum two;
+             enum four;
+             enum seven {
+                 value 21474836472147483647;
+             }
+         }
+     }
+}
diff --git a/compiler/base/parser/src/test/resources/EnumMaxNextValue.yang b/compiler/base/parser/src/test/resources/EnumMaxNextValue.yang
new file mode 100644
index 0000000..4e4a373
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/EnumMaxNextValue.yang
@@ -0,0 +1,18 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf ifType {
+        type enumeration {
+             enum "unbounded";
+             enum ZERO;
+             enum two;
+             enum four;
+             enum seven {
+                 value 2147483647;
+             }
+             enum five;    
+            
+         }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/EnumSorted.yang b/compiler/base/parser/src/test/resources/EnumSorted.yang
new file mode 100644
index 0000000..3760e83
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/EnumSorted.yang
@@ -0,0 +1,18 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf ifType {
+        type enumeration {
+             enum four{
+                 value 7;
+             }
+             enum seven {
+                 value 2147483647;
+             }
+             enum five {
+                 value 5;
+             }       
+         }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/EnumTypeStatement.yang b/compiler/base/parser/src/test/resources/EnumTypeStatement.yang
new file mode 100644
index 0000000..1d64805
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/EnumTypeStatement.yang
@@ -0,0 +1,12 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf speed {
+        type enumeration {
+          enum 10m;
+          enum 100m;
+          enum auto;
+        }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/EnumWithDuplicateName.yang b/compiler/base/parser/src/test/resources/EnumWithDuplicateName.yang
new file mode 100644
index 0000000..47c3a85
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/EnumWithDuplicateName.yang
@@ -0,0 +1,14 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf speed {
+        type enumeration {
+            enum 10m;
+            enum 100m;
+            enum 10m {
+                value 11;
+            }
+        }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/GroupingAttributes.yang b/compiler/base/parser/src/test/resources/GroupingAttributes.yang
new file mode 100644
index 0000000..f04641f
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/GroupingAttributes.yang
@@ -0,0 +1,25 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    import ietf-yang-types {
+             prefix "P";
+         }
+    list valid {
+        key address;
+        leaf address {
+            type P:ip;
+        }
+        grouping endpoint {
+            description "grouping under test";
+            status current;
+            reference "RFC 6020";
+            leaf address {
+                type P:ip-address;
+            }
+            leaf port {
+                type P:port-number;
+            }
+        }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/GroupingInContainer.yang b/compiler/base/parser/src/test/resources/GroupingInContainer.yang
new file mode 100644
index 0000000..dfa8259
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/GroupingInContainer.yang
@@ -0,0 +1,18 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    import ietf-yang-types {
+             prefix "P";
+         }
+    container valid {
+        grouping endpoint {
+            leaf address {
+                type P:ip-address;
+            }
+            leaf port {
+                type P:port-number;
+            }
+        }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/GroupingInList.yang b/compiler/base/parser/src/test/resources/GroupingInList.yang
new file mode 100644
index 0000000..c5966fc
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/GroupingInList.yang
@@ -0,0 +1,22 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    import ietf-yang-types {
+             prefix "P";
+         }
+    list valid {
+        key address;
+        leaf address {
+            type P:ip;
+        }
+        grouping endpoint {
+            leaf address {
+                type P:ip-address;
+            }
+            leaf port {
+                type P:port-number;
+            }
+        }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/GroupingInModule.yang b/compiler/base/parser/src/test/resources/GroupingInModule.yang
new file mode 100644
index 0000000..77fef1f
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/GroupingInModule.yang
@@ -0,0 +1,16 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    import ietf-yang-types {
+             prefix "P";
+         }
+    grouping endpoint {
+        leaf address {
+            type P:ip-address;
+        }
+        leaf port {
+            type P:port-number;
+        }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/IdentityInModule.yang b/compiler/base/parser/src/test/resources/IdentityInModule.yang
new file mode 100644
index 0000000..5688615
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/IdentityInModule.yang
@@ -0,0 +1,14 @@
+module IdentityInModule{
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix IdentityInModule;
+
+    identity tunnel-type {
+        description
+           "Base identity from which specific tunnel types are derived.";
+    }
+
+    identity ref-address-family {
+        reference "http://www.iana.org/assignments/address-family-numbers/address-family-numbers.xhtml#address-family-numbers-2";
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/IdentityIntraFile.yang b/compiler/base/parser/src/test/resources/IdentityIntraFile.yang
new file mode 100644
index 0000000..c61fcfb
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/IdentityIntraFile.yang
@@ -0,0 +1,23 @@
+module IdentityIntraFile {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix IdentityIntraFile;
+
+    import "IdentityInModule" {
+        prefix "IdentityInModule";
+    }
+
+    identity ipv4-address-family {
+        base IdentityInModule:ref-address-family;
+    }
+
+    identity ipv6-address-family {
+        base IdentityInModule:ref-address-family;
+    }
+
+    leaf tunnel {
+        type identityref {
+            base IdentityInModule:ref-address-family;
+        }
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/IdentityListener.yang b/compiler/base/parser/src/test/resources/IdentityListener.yang
new file mode 100644
index 0000000..a7ef4d2
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/IdentityListener.yang
@@ -0,0 +1,39 @@
+module IdentityListener{
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix IdentityListener;
+
+    identity tunnel {
+        description
+           "Base identity from which specific tunnel types are derived.";
+    }
+
+    identity tunnel-type {
+        description
+           "Base identity from which specific tunnel types are derived.";
+    }
+
+    identity ref-address-family {
+        reference "http://www.iana.org/assignments/address-family-numbers/address-family-numbers.xhtml#address-family-numbers-2";
+    }
+
+    identity ipv4-address-family {
+        base ref-address-family;
+    }
+
+    identity ipv6-address-family {
+        base ref-address-family;
+    }
+
+    leaf tunnel {
+        type identityref {
+            base ref-address-family;
+        }
+    }
+
+    leaf-list network-ref {
+        type identityref {
+            base ref-address-family;
+        }
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/IdentityTypedef.yang b/compiler/base/parser/src/test/resources/IdentityTypedef.yang
new file mode 100644
index 0000000..6e8f603
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/IdentityTypedef.yang
@@ -0,0 +1,20 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+
+    identity tunnel {
+        description
+           "Base identity from which specific tunnel types are derived.";
+    }
+
+    leaf tunnel-value {
+        type type15;
+    }
+
+    typedef type15 {
+        type identityref {
+             base tunnel;
+         }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/IdentityTypedefUnresolved.yang b/compiler/base/parser/src/test/resources/IdentityTypedefUnresolved.yang
new file mode 100644
index 0000000..d837fd1
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/IdentityTypedefUnresolved.yang
@@ -0,0 +1,16 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+
+    identity tunnel {
+        description
+           "Base identity from which specific tunnel types are derived.";
+    }
+
+    typedef type15 {
+        type identityref {
+             base tunnel;
+         }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/ImportInvalidOrder.yang b/compiler/base/parser/src/test/resources/ImportInvalidOrder.yang
new file mode 100644
index 0000000..6bfc685
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ImportInvalidOrder.yang
@@ -0,0 +1,10 @@
+module Test {
+yang-version 1;
+namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
+prefix On;
+import ietf {
+revision-date 2015-02-03;
+prefix On1;
+}
+contact "Test";
+}
diff --git a/compiler/base/parser/src/test/resources/ImportMultipleInstance.yang b/compiler/base/parser/src/test/resources/ImportMultipleInstance.yang
new file mode 100644
index 0000000..175f2ff
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ImportMultipleInstance.yang
@@ -0,0 +1,14 @@
+module Test {
+yang-version 1;
+namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
+prefix On;
+import ietf {
+prefix On2;
+revision-date 2015-02-03;
+}
+import itut {
+prefix On3;
+revision-date 2016-02-03;
+}
+contact "Test";
+}
diff --git a/compiler/base/parser/src/test/resources/ImportValidEntry.yang b/compiler/base/parser/src/test/resources/ImportValidEntry.yang
new file mode 100644
index 0000000..b725d39
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ImportValidEntry.yang
@@ -0,0 +1,10 @@
+module Test {
+yang-version 1;
+namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
+prefix On;
+import ietf {
+prefix On2;
+revision-date 2015-02-03;
+}
+contact "Test";
+}
diff --git a/compiler/base/parser/src/test/resources/ImportWithDualPrefix.yang b/compiler/base/parser/src/test/resources/ImportWithDualPrefix.yang
new file mode 100644
index 0000000..8b40bb0
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ImportWithDualPrefix.yang
@@ -0,0 +1,11 @@
+module Test {
+yang-version 1;
+namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
+prefix On;
+import ietf {
+prefix On1;
+prefix On2;
+revision-date 2015-02-03;
+}
+contact "Test";
+}
diff --git a/compiler/base/parser/src/test/resources/ImportWithoutPrefix.yang b/compiler/base/parser/src/test/resources/ImportWithoutPrefix.yang
new file mode 100644
index 0000000..ee68e59
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ImportWithoutPrefix.yang
@@ -0,0 +1,9 @@
+module Test {
+yang-version 1;
+namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
+prefix On;
+import ietf {
+revision-date 2015-02-03;
+}
+contact "Test";
+}
diff --git a/compiler/base/parser/src/test/resources/ImportWithoutRevision.yang b/compiler/base/parser/src/test/resources/ImportWithoutRevision.yang
new file mode 100644
index 0000000..af47b7a
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ImportWithoutRevision.yang
@@ -0,0 +1,9 @@
+module Test {
+yang-version 1;
+namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
+prefix On;
+import ietf {
+prefix On2;
+}
+contact "Test";
+}
diff --git a/compiler/base/parser/src/test/resources/InValidIdentifierXML.yang b/compiler/base/parser/src/test/resources/InValidIdentifierXML.yang
new file mode 100644
index 0000000..c6a5a42
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/InValidIdentifierXML.yang
@@ -0,0 +1,5 @@
+module xMlTest {
+yang-version 1;
+namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
+prefix On;
+}
diff --git a/compiler/base/parser/src/test/resources/IncludeImportAnyOrder.yang b/compiler/base/parser/src/test/resources/IncludeImportAnyOrder.yang
new file mode 100644
index 0000000..05339a6
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/IncludeImportAnyOrder.yang
@@ -0,0 +1,16 @@
+module Test {
+yang-version 1;
+namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
+prefix On;
+include itut {
+revision-date 2016-02-03;
+}
+import ietf {
+prefix On2;
+revision-date 2015-02-03;
+}
+include sdn {
+revision-date 2014-02-03;
+}
+contact "Test";
+}
diff --git a/compiler/base/parser/src/test/resources/IncludeInvalidDateSyntax.yang b/compiler/base/parser/src/test/resources/IncludeInvalidDateSyntax.yang
new file mode 100644
index 0000000..3716209
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/IncludeInvalidDateSyntax.yang
@@ -0,0 +1,16 @@
+module Test {
+yang-version 1;
+namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
+prefix On;
+import ietf {
+prefix On2;
+revision-date 2015-02-03;
+}
+include itut {
+revision-date 16-02-03;
+}
+include sdn {
+revision-date 2014-02-03;
+}
+contact "Test";
+}
diff --git a/compiler/base/parser/src/test/resources/IncludeInvalidSyntax.yang b/compiler/base/parser/src/test/resources/IncludeInvalidSyntax.yang
new file mode 100644
index 0000000..91ae17b
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/IncludeInvalidSyntax.yang
@@ -0,0 +1,16 @@
+module Test {
+yang-version 1;
+namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
+prefix On;
+import ietf {
+prefix On2;
+revision-date 2015-02-03;
+}
+include itut; {
+revision-date 2016-02-03;
+}
+include sdn {
+revision-date 2014-02-03;
+}
+contact "Test";
+}
diff --git a/compiler/base/parser/src/test/resources/IncludeMultiInstance.yang b/compiler/base/parser/src/test/resources/IncludeMultiInstance.yang
new file mode 100644
index 0000000..81a527a
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/IncludeMultiInstance.yang
@@ -0,0 +1,16 @@
+module Test {
+yang-version 1;
+namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
+prefix On;
+import ietf {
+prefix On2;
+revision-date 2015-02-03;
+}
+include itut {
+revision-date 2016-02-03;
+}
+include sdn {
+revision-date 2014-02-03;
+}
+contact "Test";
+}
diff --git a/compiler/base/parser/src/test/resources/IncludeWithDate.yang b/compiler/base/parser/src/test/resources/IncludeWithDate.yang
new file mode 100644
index 0000000..9701a2d
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/IncludeWithDate.yang
@@ -0,0 +1,13 @@
+module Test {
+yang-version 1;
+namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
+prefix On;
+import ietf {
+prefix On2;
+revision-date 2015-02-03;
+}
+include itut {
+revision-date 2016-02-03;
+}
+contact "Test";
+}
diff --git a/compiler/base/parser/src/test/resources/IncludeWithEmptyBody.yang b/compiler/base/parser/src/test/resources/IncludeWithEmptyBody.yang
new file mode 100644
index 0000000..471fdb3
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/IncludeWithEmptyBody.yang
@@ -0,0 +1,12 @@
+module Test {
+yang-version 1;
+namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
+prefix On;
+import ietf {
+prefix On2;
+revision-date 2015-02-03;
+}
+include itut {
+}
+contact "Test";
+}
diff --git a/compiler/base/parser/src/test/resources/IncludeWithStmtend.yang b/compiler/base/parser/src/test/resources/IncludeWithStmtend.yang
new file mode 100644
index 0000000..e40813b
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/IncludeWithStmtend.yang
@@ -0,0 +1,11 @@
+module Test {
+yang-version 1;
+namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
+prefix On;
+import ietf {
+prefix On2;
+revision-date 2015-02-03;
+}
+include itut;
+contact "Test";
+}
diff --git a/compiler/base/parser/src/test/resources/InputStatementWithDataDefinition.yang b/compiler/base/parser/src/test/resources/InputStatementWithDataDefinition.yang
new file mode 100644
index 0000000..0adf3d3
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/InputStatementWithDataDefinition.yang
@@ -0,0 +1,28 @@
+module rock {
+    namespace "http://example.net/rock";
+    prefix "rock";
+
+    rpc activate-software-image {
+        description "description";
+        input {
+            leaf image-name {
+                type string;
+            }
+            list ospf {
+                key "invalid-interval";
+                config true;
+                max-elements 10;
+                min-elements 3;
+                leaf invalid-interval {
+                    type uint16;
+                }
+            }
+            container isis {
+               config true;
+               leaf invalid-interval {
+                   type uint16;
+               }
+           }
+        }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/InputStatementWithTypedef.yang b/compiler/base/parser/src/test/resources/InputStatementWithTypedef.yang
new file mode 100644
index 0000000..25ca73d
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/InputStatementWithTypedef.yang
@@ -0,0 +1,17 @@
+module rock {
+    namespace "http://example.net/rock";
+    prefix "rock";
+
+    rpc activate-software-image {
+        description "description";
+        input {
+            leaf image-name {
+                type string;
+            }
+            typedef my-type {
+                status deprecated;
+                type int32;
+            }
+        }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/InstanceIdentifierListener.yang b/compiler/base/parser/src/test/resources/InstanceIdentifierListener.yang
new file mode 100644
index 0000000..0bbe2f1
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/InstanceIdentifierListener.yang
@@ -0,0 +1,10 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    container currentcheck {
+        leaf invalid-interval {
+            type instance-identifier;
+        }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/IntegerTypeStatement.yang b/compiler/base/parser/src/test/resources/IntegerTypeStatement.yang
new file mode 100644
index 0000000..ca2be38
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/IntegerTypeStatement.yang
@@ -0,0 +1,8 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf invalid-interval {
+        type "uint16";
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/InvalidLeafIdentifier.yang b/compiler/base/parser/src/test/resources/InvalidLeafIdentifier.yang
new file mode 100644
index 0000000..6faf092
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/InvalidLeafIdentifier.yang
@@ -0,0 +1,14 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    list valid {
+        key "invalid-interval";
+        leaf invalid {
+            type "string";
+            units "seconds";
+            status current;
+            reference "RFC 6020";
+        }
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/InvalidPatternSubStatements.yang b/compiler/base/parser/src/test/resources/InvalidPatternSubStatements.yang
new file mode 100644
index 0000000..76ff75e
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/InvalidPatternSubStatements.yang
@@ -0,0 +1,13 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf invalid-interval {
+        type string {
+            pattern "[a-zA-Z]\" {
+                description "pattern description";
+                reference "pattern reference";
+            }
+         }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/KeyLeafTypeEmpty.yang b/compiler/base/parser/src/test/resources/KeyLeafTypeEmpty.yang
new file mode 100644
index 0000000..859520c
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/KeyLeafTypeEmpty.yang
@@ -0,0 +1,14 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    list valid {
+        key "invalid-interval";
+        leaf invalid-interval {
+            type "empty";
+            units "seconds";
+            status current;
+            reference "RFC 6020";
+        }
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/KeyWithUsesInList.yang b/compiler/base/parser/src/test/resources/KeyWithUsesInList.yang
new file mode 100644
index 0000000..d076d0a
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/KeyWithUsesInList.yang
@@ -0,0 +1,23 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    grouping network {
+        leaf invalid-interval {
+            type "string";
+            units "seconds";
+            status current;
+            reference "RFC 6020";
+        }
+    }
+    list valid {
+        key "invalid-interval";
+        leaf invalid {
+            type "string";
+            units "seconds";
+            status current;
+            reference "RFC 6020";
+        }
+        uses "network";
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/KeyWithoutStatementEnd.yang b/compiler/base/parser/src/test/resources/KeyWithoutStatementEnd.yang
new file mode 100644
index 0000000..f56101a
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/KeyWithoutStatementEnd.yang
@@ -0,0 +1,14 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    list valid {
+        key "invalid"
+        leaf invalid-interval {
+            type "uint16";
+            units "seconds";
+            status current;
+            reference "RFC 6020";
+        }
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/LeafConfigInvalidCardinality.yang b/compiler/base/parser/src/test/resources/LeafConfigInvalidCardinality.yang
new file mode 100644
index 0000000..d403a56
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/LeafConfigInvalidCardinality.yang
@@ -0,0 +1,15 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf invalid-interval {
+       type "uint16";
+       units "seconds";
+       description "Interval before a route is declared invalid";
+       config true;
+       config false;
+       mandatory true;
+       status current;
+       reference "RFC 6020";
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/LeafInvalidIdentifier.yang b/compiler/base/parser/src/test/resources/LeafInvalidIdentifier.yang
new file mode 100644
index 0000000..dbfff13
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/LeafInvalidIdentifier.yang
@@ -0,0 +1,14 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf 1invalid-interval {
+        type "uint16";
+        units "seconds";
+        description "Interval before a route is declared invalid";
+        config true;
+        mandatory true;
+        status current;
+        reference "RFC 6020";
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/LeafListConfigInvalidCardinality.yang b/compiler/base/parser/src/test/resources/LeafListConfigInvalidCardinality.yang
new file mode 100644
index 0000000..361a852
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/LeafListConfigInvalidCardinality.yang
@@ -0,0 +1,14 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf-list invalid-interval {
+        type "uint16";
+        units "seconds";
+        description "Interval before a route is declared invalid";
+        config true;
+        config false;
+        status current;
+        reference "RFC 6020";
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/LeafListInvalidIdentifier.yang b/compiler/base/parser/src/test/resources/LeafListInvalidIdentifier.yang
new file mode 100644
index 0000000..77c24d2
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/LeafListInvalidIdentifier.yang
@@ -0,0 +1,13 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf-list 1invalid-interval {
+        type "uint16";
+        units "seconds";
+        description "Interval before a route is declared invalid";
+        config true;
+        status current;
+        reference "RFC 6020";
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/LeafListInvalidStatement.yang b/compiler/base/parser/src/test/resources/LeafListInvalidStatement.yang
new file mode 100644
index 0000000..13e4b5f
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/LeafListInvalidStatement.yang
@@ -0,0 +1,13 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaflist invalid-interval {
+        type "uint16";
+        units "seconds";
+        description "Interval before a route is declared invalid";
+        config true;
+        status current;
+        reference "RFC 6020";
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/LeafListSubStatementConfig.yang b/compiler/base/parser/src/test/resources/LeafListSubStatementConfig.yang
new file mode 100644
index 0000000..293e4a5
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/LeafListSubStatementConfig.yang
@@ -0,0 +1,13 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf-list invalid-interval {
+        type "uint16";
+        units "seconds";
+        description "Interval before a route is declared invalid";
+        config true;
+        status current;
+        reference "RFC 6020";
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/LeafListSubStatementDescription.yang b/compiler/base/parser/src/test/resources/LeafListSubStatementDescription.yang
new file mode 100644
index 0000000..293e4a5
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/LeafListSubStatementDescription.yang
@@ -0,0 +1,13 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf-list invalid-interval {
+        type "uint16";
+        units "seconds";
+        description "Interval before a route is declared invalid";
+        config true;
+        status current;
+        reference "RFC 6020";
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/LeafListSubStatementMaxElements.yang b/compiler/base/parser/src/test/resources/LeafListSubStatementMaxElements.yang
new file mode 100644
index 0000000..5ab2d0f
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/LeafListSubStatementMaxElements.yang
@@ -0,0 +1,9 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf-list invalid-interval {
+        type "uint16";
+        max-elements 3;
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/LeafListSubStatementMinElements.yang b/compiler/base/parser/src/test/resources/LeafListSubStatementMinElements.yang
new file mode 100644
index 0000000..fd71281
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/LeafListSubStatementMinElements.yang
@@ -0,0 +1,9 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf-list invalid-interval {
+        type "uint16";
+        min-elements 3;
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/LeafListSubStatementReference.yang b/compiler/base/parser/src/test/resources/LeafListSubStatementReference.yang
new file mode 100644
index 0000000..293e4a5
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/LeafListSubStatementReference.yang
@@ -0,0 +1,13 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf-list invalid-interval {
+        type "uint16";
+        units "seconds";
+        description "Interval before a route is declared invalid";
+        config true;
+        status current;
+        reference "RFC 6020";
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/LeafListSubStatementStatus.yang b/compiler/base/parser/src/test/resources/LeafListSubStatementStatus.yang
new file mode 100644
index 0000000..293e4a5
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/LeafListSubStatementStatus.yang
@@ -0,0 +1,13 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf-list invalid-interval {
+        type "uint16";
+        units "seconds";
+        description "Interval before a route is declared invalid";
+        config true;
+        status current;
+        reference "RFC 6020";
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/LeafListSubStatementType.yang b/compiler/base/parser/src/test/resources/LeafListSubStatementType.yang
new file mode 100644
index 0000000..0e5ab56
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/LeafListSubStatementType.yang
@@ -0,0 +1,8 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf-list invalid-interval {
+        type "uint16";
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/LeafListSubStatementUnits.yang b/compiler/base/parser/src/test/resources/LeafListSubStatementUnits.yang
new file mode 100644
index 0000000..293e4a5
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/LeafListSubStatementUnits.yang
@@ -0,0 +1,13 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf-list invalid-interval {
+        type "uint16";
+        units "seconds";
+        description "Interval before a route is declared invalid";
+        config true;
+        status current;
+        reference "RFC 6020";
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/LeafListSubStatements.yang b/compiler/base/parser/src/test/resources/LeafListSubStatements.yang
new file mode 100644
index 0000000..29dfdb2
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/LeafListSubStatements.yang
@@ -0,0 +1,14 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf-list invalid-interval {
+        type "uint16";
+        units "seconds";
+        max-elements 3;
+        description "Interval before a route is declared invalid";
+        config true;
+        status current;
+        reference "RFC 6020";
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/LeafListUnitsInvalidCardinality.yang b/compiler/base/parser/src/test/resources/LeafListUnitsInvalidCardinality.yang
new file mode 100644
index 0000000..996e49e
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/LeafListUnitsInvalidCardinality.yang
@@ -0,0 +1,14 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf-list invalid-interval {
+        type "uint16";
+        units "seconds";
+        units "minutes";
+        description "Interval before a route is declared invalid";
+        config true;
+        status current;
+        reference "RFC 6020";
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/LeafListWithoutLeftBrace.yang b/compiler/base/parser/src/test/resources/LeafListWithoutLeftBrace.yang
new file mode 100644
index 0000000..1196422
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/LeafListWithoutLeftBrace.yang
@@ -0,0 +1,13 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf-list invalid-interval 
+        type "uint16";
+        units "seconds";
+        description "Interval before a route is declared invalid";
+        config true;
+        status current;
+        reference "RFC 6020";
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/LeafMandatoryInvalidCardinality.yang b/compiler/base/parser/src/test/resources/LeafMandatoryInvalidCardinality.yang
new file mode 100644
index 0000000..c275dd7
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/LeafMandatoryInvalidCardinality.yang
@@ -0,0 +1,15 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf invalid-interval {
+        type "uint16";
+        units "seconds";
+        description "Interval before a route is declared invalid";
+        config true;
+        mandatory true;
+        mandatory false;
+        status current;
+        reference "RFC 6020";
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/LeafSubStatementDefault.yang b/compiler/base/parser/src/test/resources/LeafSubStatementDefault.yang
new file mode 100644
index 0000000..a78131d
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/LeafSubStatementDefault.yang
@@ -0,0 +1,15 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf invalid-interval {
+        type "uint16";
+        units "seconds";
+        default "1";
+        description "Interval before a route is declared invalid";
+        config true;
+        mandatory true;
+        status current;
+        reference "RFC 6020";
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/LeafSubStatementMust.yang b/compiler/base/parser/src/test/resources/LeafSubStatementMust.yang
new file mode 100644
index 0000000..6d7e626
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/LeafSubStatementMust.yang
@@ -0,0 +1,14 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf ifType {
+        type enumeration {
+            enum ethernet;
+            enum atm;
+        }
+        must "ifType != 'ethernet'" {
+            description "ifType is not ethernet";
+        }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/LeafSubStatementWhen.yang b/compiler/base/parser/src/test/resources/LeafSubStatementWhen.yang
new file mode 100644
index 0000000..239e0b6
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/LeafSubStatementWhen.yang
@@ -0,0 +1,14 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf ifType {
+        when "ifType != 'ethernet'" {
+            description "ifType is not ethernet";
+        }
+        type enumeration {
+            enum ethernet;
+            enum atm;
+        }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/LeafSubStatements.yang b/compiler/base/parser/src/test/resources/LeafSubStatements.yang
new file mode 100644
index 0000000..70349a0
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/LeafSubStatements.yang
@@ -0,0 +1,14 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf invalid-interval {
+        type "uint16";
+        units "seconds";
+        description "Interval before a route is declared invalid";
+        config true;
+        mandatory true;
+        status current;
+        reference "RFC 6020";
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/LeafWithoutLeftBrace.yang b/compiler/base/parser/src/test/resources/LeafWithoutLeftBrace.yang
new file mode 100644
index 0000000..c2aa979
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/LeafWithoutLeftBrace.yang
@@ -0,0 +1,14 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf invalid-interval 
+    type "uint16";
+    units "seconds";
+    description "Interval before a route is declared invalid";
+    config true;
+    mandatory true;
+    status current;
+    reference "RFC 6020";
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/LengthStatementInsideLeafList.yang b/compiler/base/parser/src/test/resources/LengthStatementInsideLeafList.yang
new file mode 100644
index 0000000..06d08db
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/LengthStatementInsideLeafList.yang
@@ -0,0 +1,10 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf-list invalid-interval {
+        type string {
+            length "1..100";
+         }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/LengthStatementInsideTypeDef.yang b/compiler/base/parser/src/test/resources/LengthStatementInsideTypeDef.yang
new file mode 100644
index 0000000..c1195dc
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/LengthStatementInsideTypeDef.yang
@@ -0,0 +1,15 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    typedef invalid-interval {
+        type string {
+            length "1..100";
+         }
+    }
+    leaf xyz {
+       type invalid-interval {
+           length "2..100";
+       }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/LengthStatementWithSpace.yang b/compiler/base/parser/src/test/resources/LengthStatementWithSpace.yang
new file mode 100644
index 0000000..e8612d1
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/LengthStatementWithSpace.yang
@@ -0,0 +1,10 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf invalid-interval {
+        type string {
+            length "                                               0                                                                                      ..                                                                                                                                                                      100                                                                                         ";
+         }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/LengthSubStatements.yang b/compiler/base/parser/src/test/resources/LengthSubStatements.yang
new file mode 100644
index 0000000..f61f979
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/LengthSubStatements.yang
@@ -0,0 +1,13 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf invalid-interval {
+        type string {
+            length "0..100" {
+                description "length description";
+                reference "length reference";
+            }
+         }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/LengthWithInvalidIntegerPattern.yang b/compiler/base/parser/src/test/resources/LengthWithInvalidIntegerPattern.yang
new file mode 100644
index 0000000..f5c8a69
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/LengthWithInvalidIntegerPattern.yang
@@ -0,0 +1,10 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf-list invalid-interval {
+        type string {
+            length "a..z";
+         }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/LengthWithInvalidInterval.yang b/compiler/base/parser/src/test/resources/LengthWithInvalidInterval.yang
new file mode 100644
index 0000000..7b4ae18
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/LengthWithInvalidInterval.yang
@@ -0,0 +1,10 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf-list invalid-interval {
+        type string {
+            length "0..18446744073709551617";
+         }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/LengthWithInvalidType.yang b/compiler/base/parser/src/test/resources/LengthWithInvalidType.yang
new file mode 100644
index 0000000..74b183c
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/LengthWithInvalidType.yang
@@ -0,0 +1,10 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf-list invalid-interval {
+        type int8 {
+            length "1..100";
+         }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/LengthWithMinMax.yang b/compiler/base/parser/src/test/resources/LengthWithMinMax.yang
new file mode 100644
index 0000000..5884266
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/LengthWithMinMax.yang
@@ -0,0 +1,10 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf-list invalid-interval {
+        type string {
+            length "min..max";
+         }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/LengthWithOneInterval.yang b/compiler/base/parser/src/test/resources/LengthWithOneInterval.yang
new file mode 100644
index 0000000..b160f02
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/LengthWithOneInterval.yang
@@ -0,0 +1,10 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf-list invalid-interval {
+        type string {
+            length "1";
+         }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/ListAsRootNode.yang b/compiler/base/parser/src/test/resources/ListAsRootNode.yang
new file mode 100644
index 0000000..289525f
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ListAsRootNode.yang
@@ -0,0 +1,9 @@
+list valid {
+    reference "RFC 6020";
+    leaf invalid-interval {
+        type "uint16";
+        units "seconds";
+        status current;
+        reference "RFC 6020";
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/ListDuplicateContainer.yang b/compiler/base/parser/src/test/resources/ListDuplicateContainer.yang
new file mode 100644
index 0000000..8c152b2
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ListDuplicateContainer.yang
@@ -0,0 +1,27 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    list ospf {
+        key "process-id";
+        container interface {
+            leaf invalid-interval {
+                type "uint16";
+                units "seconds";
+                status current;
+                reference "RFC 6020";
+            }
+        }
+        leaf process-id {
+            type "string";
+        }
+        container interface {
+            leaf invalid-interval {
+                type "uint16";
+                units "seconds";
+                status current;
+                reference "RFC 6020";
+            }
+        }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/ListInvalidIdentifier.yang b/compiler/base/parser/src/test/resources/ListInvalidIdentifier.yang
new file mode 100644
index 0000000..c5f6a3a
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ListInvalidIdentifier.yang
@@ -0,0 +1,15 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    list 1valid {
+        key "invalid-interval";
+        reference "RFC 6020";
+        leaf invalid-interval {
+            type "uint16";
+            units "seconds";
+            status current;
+            reference "RFC 6020";
+        }
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/ListStatementWithoutChild.yang b/compiler/base/parser/src/test/resources/ListStatementWithoutChild.yang
new file mode 100644
index 0000000..5c006d7
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ListStatementWithoutChild.yang
@@ -0,0 +1,8 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    list valid {
+        reference "RFC 6020";
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/ListSubStatementConfig.yang b/compiler/base/parser/src/test/resources/ListSubStatementConfig.yang
new file mode 100644
index 0000000..55432fb
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ListSubStatementConfig.yang
@@ -0,0 +1,17 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    list valid {
+        key "invalid-interval";
+        config true;
+        leaf invalid-interval {
+            type "uint16";
+            units "seconds";
+            description "Interval before a route is declared invalid";
+            mandatory true;
+            status current;
+            reference "RFC 6020";
+        }
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/ListSubStatementContainer.yang b/compiler/base/parser/src/test/resources/ListSubStatementContainer.yang
new file mode 100644
index 0000000..4ce6da4
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ListSubStatementContainer.yang
@@ -0,0 +1,19 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    list ospf {
+        key "process-id";
+        container interface {
+            leaf invalid-interval {
+                type "uint16";
+                units "seconds";
+                status current;
+                reference "RFC 6020";
+            }
+        }
+        leaf process-id {
+            type "string";
+        }
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/ListSubStatementDescription.yang b/compiler/base/parser/src/test/resources/ListSubStatementDescription.yang
new file mode 100644
index 0000000..a8df3d7
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ListSubStatementDescription.yang
@@ -0,0 +1,18 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    list valid {
+    key "invalid-interval";
+    description "list description";
+    config true;
+    leaf invalid-interval {
+        type "uint16";
+        units "seconds";
+        description "Interval before a route is declared invalid";
+        mandatory true;
+        status current;
+        reference "RFC 6020";
+        }
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/ListSubStatementKey.yang b/compiler/base/parser/src/test/resources/ListSubStatementKey.yang
new file mode 100644
index 0000000..791013d
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ListSubStatementKey.yang
@@ -0,0 +1,14 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    list valid {
+        key "invalid-interval";
+        leaf invalid-interval {
+            type "uint16";
+            units "seconds";
+            status current;
+            reference "RFC 6020";
+        }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/ListSubStatementLeaf.yang b/compiler/base/parser/src/test/resources/ListSubStatementLeaf.yang
new file mode 100644
index 0000000..59b92cc
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ListSubStatementLeaf.yang
@@ -0,0 +1,17 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    list valid {
+        key "invalid-interval";
+        leaf invalid-interval {
+            type "uint16";
+            units "seconds";
+            description "Interval before a route is declared invalid";
+            config true;
+            mandatory true;
+            status current;
+            reference "RFC 6020";
+        }
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/ListSubStatementLeafList.yang b/compiler/base/parser/src/test/resources/ListSubStatementLeafList.yang
new file mode 100644
index 0000000..672ebdd
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ListSubStatementLeafList.yang
@@ -0,0 +1,20 @@
+
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    list valid {
+        key "invalid";
+        leaf-list invalid-interval {
+            type "uint16";
+            units "seconds";
+            description "Interval before a route is declared invalid";
+            config true;
+            status current;
+            reference "RFC 6020";
+        }
+        leaf invalid {
+            type "uint16";
+        }
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/ListSubStatementList.yang b/compiler/base/parser/src/test/resources/ListSubStatementList.yang
new file mode 100644
index 0000000..2021469
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ListSubStatementList.yang
@@ -0,0 +1,20 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    list ospf {
+        key "process-id";
+        list valid {
+            key "invalid-interval";
+            leaf invalid-interval {
+                type "uint16";
+                units "seconds";
+                status current;
+                reference "RFC 6020";
+            }
+        }
+        leaf process-id {
+            type "string";
+        }
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/ListSubStatementMaxElements.yang b/compiler/base/parser/src/test/resources/ListSubStatementMaxElements.yang
new file mode 100644
index 0000000..e74a5a8
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ListSubStatementMaxElements.yang
@@ -0,0 +1,17 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    list valid {
+        key "invalid";
+        max-elements 3;
+        leaf-list invalid-interval {
+            type "uint16";
+            units "seconds";
+            description "Interval before a route is declared invalid";
+        }
+        leaf invalid {
+            type "uint16";
+        }
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/ListSubStatementMinElements.yang b/compiler/base/parser/src/test/resources/ListSubStatementMinElements.yang
new file mode 100644
index 0000000..8454fdd
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ListSubStatementMinElements.yang
@@ -0,0 +1,17 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    list valid {
+        key "invalid";
+        min-elements 3;
+        leaf-list invalid-interval {
+            type "uint16";
+            units "seconds";
+            description "Interval before a route is declared invalid";
+        }
+        leaf invalid {
+            type "uint16";
+        }
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/ListSubStatementReference.yang b/compiler/base/parser/src/test/resources/ListSubStatementReference.yang
new file mode 100644
index 0000000..8adfa04
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ListSubStatementReference.yang
@@ -0,0 +1,18 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    list valid {
+        key "invalid-interval";
+        reference "list reference";
+        config true;
+        leaf invalid-interval {
+            type "uint16";
+            units "seconds";
+            description "Interval before a route is declared invalid";
+            mandatory true;
+            status current;
+            reference "RFC 6020";
+        }
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/ListSubStatementStatus.yang b/compiler/base/parser/src/test/resources/ListSubStatementStatus.yang
new file mode 100644
index 0000000..b88ac74
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ListSubStatementStatus.yang
@@ -0,0 +1,18 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    list valid {
+        key "invalid-interval";
+        status current;
+        config true;
+        leaf invalid-interval {
+            type "uint16";
+            units "seconds";
+            description "Interval before a route is declared invalid";
+            mandatory true;
+            status current;
+            reference "RFC 6020";
+        }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/ListSubStatementUnique.yang b/compiler/base/parser/src/test/resources/ListSubStatementUnique.yang
new file mode 100644
index 0000000..b500aa4
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ListSubStatementUnique.yang
@@ -0,0 +1,15 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    list valid {
+        unique "invalid-interval";
+        key "invalid-interval";
+        leaf invalid-interval {
+            type "uint16";
+            units "seconds";
+            status current;
+            reference "RFC 6020";
+        }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/ListSubStatements.yang b/compiler/base/parser/src/test/resources/ListSubStatements.yang
new file mode 100644
index 0000000..109fc17
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ListSubStatements.yang
@@ -0,0 +1,20 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    list ospf {
+        key "invalid-interval";
+        config true;
+        max-elements 10;
+        min-elements 3;
+        description "list description";
+        status current;
+        reference "list reference";
+        leaf invalid-interval {
+            type "uint16";
+            units "seconds";
+            status current;
+            reference "RFC 6020";
+        }
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/ListSubStatementsCardinality.yang b/compiler/base/parser/src/test/resources/ListSubStatementsCardinality.yang
new file mode 100644
index 0000000..9c4077c
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ListSubStatementsCardinality.yang
@@ -0,0 +1,16 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    list valid {
+        key "invalid-interval";
+        reference "RFC 6020";
+        reference "RFC 6020";
+        leaf invalid-interval {
+            type "uint16";
+            units "seconds";
+            status current;
+            reference "RFC 6020";
+        }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/ListWithDuplicateLeaf.yang b/compiler/base/parser/src/test/resources/ListWithDuplicateLeaf.yang
new file mode 100644
index 0000000..55a78f6
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ListWithDuplicateLeaf.yang
@@ -0,0 +1,26 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    list valid {
+        key "invalid-interval";
+        leaf invalid-interval {
+            type "uint16";
+            units "seconds";
+            description "Interval before a route is declared invalid";
+            config true;
+            mandatory true;
+            status current;
+            reference "RFC 6020";
+        }
+        leaf invalid-interval {
+            type "uint16";
+            units "seconds";
+            description "Interval before a route is declared invalid";
+            config true;
+            mandatory true;
+            status current;
+            reference "RFC 6020";
+        }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/ListWithIdentifierNameEnum.yang b/compiler/base/parser/src/test/resources/ListWithIdentifierNameEnum.yang
new file mode 100644
index 0000000..afa82a4
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ListWithIdentifierNameEnum.yang
@@ -0,0 +1,16 @@
+module Test {
+    yang-version 1;
+    namespace "ydt.enum";
+    prefix "t";
+
+    list enumList {
+        key enum;
+        leaf enum {
+            type enumeration {
+                enum ten { value "10";}
+                enum hundred { value "100";}
+                enum thousand { value "1000"; }
+            }
+        }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/MandatoryDefaultValue.yang b/compiler/base/parser/src/test/resources/MandatoryDefaultValue.yang
new file mode 100644
index 0000000..c71d5ea
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/MandatoryDefaultValue.yang
@@ -0,0 +1,8 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf invalid-interval {
+        type "uint16";
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/MandatoryEmptyStatement.yang b/compiler/base/parser/src/test/resources/MandatoryEmptyStatement.yang
new file mode 100644
index 0000000..e2af869
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/MandatoryEmptyStatement.yang
@@ -0,0 +1,9 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf invalid-interval {
+        type "uint16";
+        mandatory ;
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/MandatoryFalse.yang b/compiler/base/parser/src/test/resources/MandatoryFalse.yang
new file mode 100644
index 0000000..3ae4601
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/MandatoryFalse.yang
@@ -0,0 +1,9 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf invalid-interval {
+        type "uint16";
+        mandatory false;
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/MandatoryTrue.yang b/compiler/base/parser/src/test/resources/MandatoryTrue.yang
new file mode 100644
index 0000000..70349a0
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/MandatoryTrue.yang
@@ -0,0 +1,14 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf invalid-interval {
+        type "uint16";
+        units "seconds";
+        description "Interval before a route is declared invalid";
+        config true;
+        mandatory true;
+        status current;
+        reference "RFC 6020";
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/MandatoryWithoutStatementEnd.yang b/compiler/base/parser/src/test/resources/MandatoryWithoutStatementEnd.yang
new file mode 100644
index 0000000..055f556
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/MandatoryWithoutStatementEnd.yang
@@ -0,0 +1,9 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf invalid-interval {
+    type "uint16";
+    mandatory false
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/MaxElementsCardinality.yang b/compiler/base/parser/src/test/resources/MaxElementsCardinality.yang
new file mode 100644
index 0000000..bff2fd7
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/MaxElementsCardinality.yang
@@ -0,0 +1,15 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf-list invalid-interval {
+        type "uint16";
+        units "seconds";
+        max-elements 4;
+        max-elements 6;
+        description "Interval before a route is declared invalid";
+        config true;
+        status current;
+        reference "RFC 6020";
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/MaxElementsDefaultValue.yang b/compiler/base/parser/src/test/resources/MaxElementsDefaultValue.yang
new file mode 100644
index 0000000..a591146
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/MaxElementsDefaultValue.yang
@@ -0,0 +1,8 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf-list invalid-interval {
+       type "uint16";
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/MaxElementsMaxValue.yang b/compiler/base/parser/src/test/resources/MaxElementsMaxValue.yang
new file mode 100644
index 0000000..7bdfbb0
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/MaxElementsMaxValue.yang
@@ -0,0 +1,9 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf-list invalid-interval {
+        type "uint16";
+        max-elements 77777777777777777777777;
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/MaxElementsUnbounded.yang b/compiler/base/parser/src/test/resources/MaxElementsUnbounded.yang
new file mode 100644
index 0000000..afaca4f
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/MaxElementsUnbounded.yang
@@ -0,0 +1,9 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf-list invalid-interval {
+       type "uint16";
+       max-elements unbounded;
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/MaxElementsWithoutStatementEnd.yang b/compiler/base/parser/src/test/resources/MaxElementsWithoutStatementEnd.yang
new file mode 100644
index 0000000..5973dd0
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/MaxElementsWithoutStatementEnd.yang
@@ -0,0 +1,14 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf-list invalid-interval {
+    type "uint16";
+    units "seconds";
+    max-elements 3
+    description "Interval before a route is declared invalid";
+    config true;
+    status current;
+    reference "RFC 6020";
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/MinElementsDefaultValue.yang b/compiler/base/parser/src/test/resources/MinElementsDefaultValue.yang
new file mode 100644
index 0000000..a591146
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/MinElementsDefaultValue.yang
@@ -0,0 +1,8 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf-list invalid-interval {
+       type "uint16";
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/MinElementsInvalidCardinality.yang b/compiler/base/parser/src/test/resources/MinElementsInvalidCardinality.yang
new file mode 100644
index 0000000..18f6019
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/MinElementsInvalidCardinality.yang
@@ -0,0 +1,15 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf-list invalid-interval {
+        type "uint16";
+        units "seconds";
+        min-elements 4;
+        min-elements 6;
+        description "Interval before a route is declared invalid";
+        config true;
+        status current;
+        reference "RFC 6020";
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/MinElementsInvalidValue.yang b/compiler/base/parser/src/test/resources/MinElementsInvalidValue.yang
new file mode 100644
index 0000000..a381184
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/MinElementsInvalidValue.yang
@@ -0,0 +1,14 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf-list invalid-interval {
+        type "uint16";
+        units "seconds";
+        min-elements asd;
+        description "Interval before a route is declared invalid";
+        config true;
+        status current;
+        reference "RFC 6020";
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/MinElementsMaxValue.yang b/compiler/base/parser/src/test/resources/MinElementsMaxValue.yang
new file mode 100644
index 0000000..785482b
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/MinElementsMaxValue.yang
@@ -0,0 +1,9 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf-list invalid-interval {
+        type "uint16";
+        min-elements 77777777777777777777777;
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/MinElementsWithoutStatementEnd.yang b/compiler/base/parser/src/test/resources/MinElementsWithoutStatementEnd.yang
new file mode 100644
index 0000000..699a8b8
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/MinElementsWithoutStatementEnd.yang
@@ -0,0 +1,14 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf-list invalid-interval {
+    type "uint16";
+    units "seconds";
+    min-elements 3
+    description "Interval before a route is declared invalid";
+    config true;
+    status current;
+    reference "RFC 6020";
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/ModuleDuplicateContainer.yang b/compiler/base/parser/src/test/resources/ModuleDuplicateContainer.yang
new file mode 100644
index 0000000..bc58896
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ModuleDuplicateContainer.yang
@@ -0,0 +1,29 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    container valid {
+        leaf invalid-interval {
+            type "uint16";
+            units "seconds";
+            status current;
+            reference "RFC 6020";
+        }
+    }
+    container invalid {
+        leaf invalid-interval {
+            type "uint16";
+            units "seconds";
+            status current;
+            reference "RFC 6020";
+        }
+    }
+    container valid {
+        leaf invalid-interval {
+            type "uint16";
+            units "seconds";
+            status current;
+            reference "RFC 6020";
+        }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/ModuleInvalidIdentifierLength.yang b/compiler/base/parser/src/test/resources/ModuleInvalidIdentifierLength.yang
new file mode 100644
index 0000000..fac16bc
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ModuleInvalidIdentifierLength.yang
@@ -0,0 +1,5 @@
+module Testttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt {
+yang-version 1;
+namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
+prefix On;
+}
diff --git a/compiler/base/parser/src/test/resources/ModuleSubStatementContainer.yang b/compiler/base/parser/src/test/resources/ModuleSubStatementContainer.yang
new file mode 100644
index 0000000..35a91ad
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ModuleSubStatementContainer.yang
@@ -0,0 +1,13 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    container valid {
+        leaf invalid-interval {
+            type "uint16";
+            units "seconds";
+            status current;
+            reference "RFC 6020";
+        }
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/ModuleSubStatementDescription.yang b/compiler/base/parser/src/test/resources/ModuleSubStatementDescription.yang
new file mode 100644
index 0000000..02643b1
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ModuleSubStatementDescription.yang
@@ -0,0 +1,6 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    description "Interval before a route is declared invalid";
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/ModuleSubStatementList.yang b/compiler/base/parser/src/test/resources/ModuleSubStatementList.yang
new file mode 100644
index 0000000..1bb3bf5
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ModuleSubStatementList.yang
@@ -0,0 +1,14 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    list valid {
+        key "invalid-interval";
+        leaf invalid-interval {
+            type "uint16";
+            units "seconds";
+            status current;
+            reference "RFC 6020";
+        }
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/ModuleSubStatementReference.yang b/compiler/base/parser/src/test/resources/ModuleSubStatementReference.yang
new file mode 100644
index 0000000..20b2fb6
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ModuleSubStatementReference.yang
@@ -0,0 +1,6 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    reference "RFC 6020";
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/ModuleValidEntry.yang b/compiler/base/parser/src/test/resources/ModuleValidEntry.yang
new file mode 100644
index 0000000..439ded8
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ModuleValidEntry.yang
@@ -0,0 +1,5 @@
+module Test {
+yang-version 1;
+namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
+prefix On;
+}
diff --git a/compiler/base/parser/src/test/resources/ModuleWithDuplicateLeaf.yang b/compiler/base/parser/src/test/resources/ModuleWithDuplicateLeaf.yang
new file mode 100644
index 0000000..2c3ecbc
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ModuleWithDuplicateLeaf.yang
@@ -0,0 +1,32 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf invalid-interval {
+        type "uint16";
+        units "seconds";
+        description "Interval before a route is declared invalid";
+        config true;
+        mandatory true;
+        status current;
+        reference "RFC 6020";
+    }
+    leaf valid-interval {
+        type "uint16";
+        units "seconds";
+        description "Interval before a route is declared invalid";
+        config true;
+        mandatory true;
+        status current;
+        reference "RFC 6020";
+    }
+    leaf invalid-interval {
+        type "uint16";
+        units "seconds";
+        description "Interval before a route is declared invalid";
+        config true;
+        mandatory true;
+        status current;
+        reference "RFC 6020";
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/ModuleWithInvalidIdentifier.yang b/compiler/base/parser/src/test/resources/ModuleWithInvalidIdentifier.yang
new file mode 100644
index 0000000..d89340a
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ModuleWithInvalidIdentifier.yang
@@ -0,0 +1,5 @@
+module Test:Test {
+yang-version 1;
+namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
+prefix On;
+}
diff --git a/compiler/base/parser/src/test/resources/MultipleKeyValues.yang b/compiler/base/parser/src/test/resources/MultipleKeyValues.yang
new file mode 100644
index 0000000..a9d25a2
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/MultipleKeyValues.yang
@@ -0,0 +1,20 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    list valid {
+        key "ospf isis";
+        leaf ospf {
+            type "uint16";
+            units "seconds";
+            status current;
+            reference "RFC 6020";
+        }
+        leaf isis {
+            type "uint16";
+            units "seconds";
+            status current;
+            reference "RFC 6020";
+        }
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/MultiplePatternStatement.yang b/compiler/base/parser/src/test/resources/MultiplePatternStatement.yang
new file mode 100644
index 0000000..7a47bfc
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/MultiplePatternStatement.yang
@@ -0,0 +1,11 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf-list invalid-interval {
+        type string {
+            pattern "[a-zA-Z]";
+            pattern "[a-z]";
+         }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/MultipleRevision.yang b/compiler/base/parser/src/test/resources/MultipleRevision.yang
new file mode 100755
index 0000000..4ce440c
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/MultipleRevision.yang
@@ -0,0 +1,26 @@
+module Test {
+    yang-version 1;
+    namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
+    prefix test;
+
+     revision 2013-07-15 {
+       description
+        "This revision adds the following new data types:
+         - yang-identifier
+         - hex-string
+         - uuid
+         - dotted-quad";
+       reference
+        "RFC 6991: Common YANG Data Types";
+     }
+     revision 2013-07-14 {
+       description
+        "This revision adds the following new data types:
+         - yang-identifier
+         - hex-string
+         - uuid
+         - dotted-quad";
+       reference
+        "RFC 6991: Common YANG Data Types";
+     }
+}
diff --git a/compiler/base/parser/src/test/resources/MultipleUniqueValues.yang b/compiler/base/parser/src/test/resources/MultipleUniqueValues.yang
new file mode 100644
index 0000000..28f7978
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/MultipleUniqueValues.yang
@@ -0,0 +1,21 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    list valid {
+        key "ospf";
+        unique "ospf isis";
+        leaf ospf {
+            type "uint16";
+            units "seconds";
+            status current;
+            reference "RFC 6020";
+        }
+        leaf isis {
+            type "uint16";
+            units "seconds";
+            status current;
+            reference "RFC 6020";
+        }
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/NamespaceDualEntry.yang b/compiler/base/parser/src/test/resources/NamespaceDualEntry.yang
new file mode 100644
index 0000000..09c9b54
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/NamespaceDualEntry.yang
@@ -0,0 +1,6 @@
+module Test {
+yang-version 1;
+namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
+namespace urn:ietf:params:xml:ns:yang:ietf-segment-routing;
+prefix On;
+}
diff --git a/compiler/base/parser/src/test/resources/NamespaceInDoubleQuotes.yang b/compiler/base/parser/src/test/resources/NamespaceInDoubleQuotes.yang
new file mode 100644
index 0000000..aec0042
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/NamespaceInDoubleQuotes.yang
@@ -0,0 +1,5 @@
+module Test {
+yang-version 1;
+namespace "urn:ietf:params:xml:ns:yang:ietf-ospf";
+prefix On;
+}
diff --git a/compiler/base/parser/src/test/resources/NamespaceNoEntryTest.yang b/compiler/base/parser/src/test/resources/NamespaceNoEntryTest.yang
new file mode 100644
index 0000000..ac30ae4
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/NamespaceNoEntryTest.yang
@@ -0,0 +1,4 @@
+module Test {
+yang-version 1;
+prefix On;
+}
diff --git a/compiler/base/parser/src/test/resources/NamespaceWithConcatenationTest.yang b/compiler/base/parser/src/test/resources/NamespaceWithConcatenationTest.yang
new file mode 100644
index 0000000..c9ac4b0
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/NamespaceWithConcatenationTest.yang
@@ -0,0 +1,6 @@
+module Test {
+yang-version 1;
+namespace "urn:ietf:params:xml:ns:"
+             + "yang:ietf-segment-routing";
+prefix On;
+}
diff --git a/compiler/base/parser/src/test/resources/NamespaceWithInvalidSpaces.yang b/compiler/base/parser/src/test/resources/NamespaceWithInvalidSpaces.yang
new file mode 100644
index 0000000..f8f91c5
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/NamespaceWithInvalidSpaces.yang
@@ -0,0 +1,5 @@
+module Test {
+yang-version 1;
+namespace "urn:ietf:params:xml :ns:yang:ietf-ospf";
+prefix On;
+}
diff --git a/compiler/base/parser/src/test/resources/NamespaceWithoutQuotes.yang b/compiler/base/parser/src/test/resources/NamespaceWithoutQuotes.yang
new file mode 100644
index 0000000..439ded8
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/NamespaceWithoutQuotes.yang
@@ -0,0 +1,5 @@
+module Test {
+yang-version 1;
+namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
+prefix On;
+}
diff --git a/compiler/base/parser/src/test/resources/NoConfigContainerSubStatementContainer.yang b/compiler/base/parser/src/test/resources/NoConfigContainerSubStatementContainer.yang
new file mode 100644
index 0000000..1aded2d
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/NoConfigContainerSubStatementContainer.yang
@@ -0,0 +1,15 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    container hello {
+        container valid {
+            leaf invalid-interval {
+                type "uint16";
+                units "seconds";
+                status current;
+                reference "RFC 6020";
+            }
+        }
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/NoConfigContainerSubStatementLeaf.yang b/compiler/base/parser/src/test/resources/NoConfigContainerSubStatementLeaf.yang
new file mode 100644
index 0000000..35a91ad
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/NoConfigContainerSubStatementLeaf.yang
@@ -0,0 +1,13 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    container valid {
+        leaf invalid-interval {
+            type "uint16";
+            units "seconds";
+            status current;
+            reference "RFC 6020";
+        }
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/NoConfigContainerSubStatementLeafList.yang b/compiler/base/parser/src/test/resources/NoConfigContainerSubStatementLeafList.yang
new file mode 100644
index 0000000..79687c2
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/NoConfigContainerSubStatementLeafList.yang
@@ -0,0 +1,13 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    container valid {
+        leaf-list invalid-interval {
+            type "uint16";
+            units "seconds";
+            status current;
+            reference "RFC 6020";
+        }
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/NoConfigContainerSubStatementList.yang b/compiler/base/parser/src/test/resources/NoConfigContainerSubStatementList.yang
new file mode 100644
index 0000000..f10c686
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/NoConfigContainerSubStatementList.yang
@@ -0,0 +1,16 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    container hello {
+        list valid {
+            key "invalid-interval";
+            leaf invalid-interval {
+                type "uint16";
+                units "seconds";
+                status current;
+                reference "RFC 6020";
+            }
+        }
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/NoConfigListSubStatementContainer.yang b/compiler/base/parser/src/test/resources/NoConfigListSubStatementContainer.yang
new file mode 100644
index 0000000..19b4291
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/NoConfigListSubStatementContainer.yang
@@ -0,0 +1,22 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    list list1 {
+        key "invalid-interval";
+        leaf invalid-interval {
+            type "uint16";
+            units "seconds";
+            status current;
+            reference "RFC 6020";
+        }
+        container container1 {
+            leaf leaf1 {
+                type "uint16";
+                units "seconds";
+                status current;
+                reference "RFC 6020";
+            }
+        }
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/NoConfigListSubStatementLeaf.yang b/compiler/base/parser/src/test/resources/NoConfigListSubStatementLeaf.yang
new file mode 100644
index 0000000..1bb3bf5
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/NoConfigListSubStatementLeaf.yang
@@ -0,0 +1,14 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    list valid {
+        key "invalid-interval";
+        leaf invalid-interval {
+            type "uint16";
+            units "seconds";
+            status current;
+            reference "RFC 6020";
+        }
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/NoConfigListSubStatementList.yang b/compiler/base/parser/src/test/resources/NoConfigListSubStatementList.yang
new file mode 100644
index 0000000..4de40cb
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/NoConfigListSubStatementList.yang
@@ -0,0 +1,23 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    list valid {
+        key "invalid-interval";
+        leaf invalid-interval {
+            type "uint16";
+            units "seconds";
+            status current;
+            reference "RFC 6020";
+        }
+        list list1 {
+            key "leaf1";
+            leaf leaf1 {
+                type "uint16";
+                units "seconds";
+                status current;
+                reference "RFC 6020";
+            }
+        }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/OrderedByStatement.yang b/compiler/base/parser/src/test/resources/OrderedByStatement.yang
new file mode 100644
index 0000000..f6b4336
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/OrderedByStatement.yang
@@ -0,0 +1,10 @@
+module rock {
+    namespace "http://example.net/rock";
+    prefix "rock";
+    leaf-list cipher  {
+         type string;
+         ordered-by user;
+         description "A list of ciphers";
+    }
+}
+
diff --git a/compiler/base/parser/src/test/resources/OrganizationDualEntry.yang b/compiler/base/parser/src/test/resources/OrganizationDualEntry.yang
new file mode 100644
index 0000000..64bf23d
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/OrganizationDualEntry.yang
@@ -0,0 +1,18 @@
+module Test {
+yang-version 1;
+namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
+prefix On;
+import ietf {
+prefix On2;
+revision-date 2015-02-03;
+}
+include itut {
+revision-date 2016-02-03;
+}
+include sdn {
+revision-date 2014-02-03;
+}
+contact "Test";
+organization "IETF SPRING Working Group";
+organization "ITUT SPRING Working Group";
+}
diff --git a/compiler/base/parser/src/test/resources/OrganizationInvalidOrder.yang b/compiler/base/parser/src/test/resources/OrganizationInvalidOrder.yang
new file mode 100644
index 0000000..333f2e5
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/OrganizationInvalidOrder.yang
@@ -0,0 +1,17 @@
+module Test {
+yang-version 1;
+organization "ONOS";
+namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
+prefix On;
+import ietf {
+prefix On2;
+revision-date 2015-02-03;
+}
+include itut; {
+revision-date 2016-02-03;
+}
+include sdn {
+revision-date 2014-02-03;
+}
+contact "Test";
+}
diff --git a/compiler/base/parser/src/test/resources/OrganizationMissingValue.yang b/compiler/base/parser/src/test/resources/OrganizationMissingValue.yang
new file mode 100644
index 0000000..e9e3f46
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/OrganizationMissingValue.yang
@@ -0,0 +1,17 @@
+module Test {
+yang-version 1;
+namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
+prefix On;
+import ietf {
+prefix On2;
+revision-date 2015-02-03;
+}
+include itut {
+revision-date 2016-02-03;
+}
+include sdn {
+revision-date 2014-02-03;
+}
+contact "Test";
+organization ;
+}
diff --git a/compiler/base/parser/src/test/resources/OrganizationValidEntry.yang b/compiler/base/parser/src/test/resources/OrganizationValidEntry.yang
new file mode 100644
index 0000000..25ae1ec
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/OrganizationValidEntry.yang
@@ -0,0 +1,17 @@
+module Test {
+yang-version 1;
+namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
+prefix On;
+import ietf {
+prefix On2;
+revision-date 2015-02-03;
+}
+include itut {
+revision-date 2016-02-03;
+}
+include sdn {
+revision-date 2014-02-03;
+}
+contact "Test";
+organization "IETF SPRING Working Group";
+}
diff --git a/compiler/base/parser/src/test/resources/OutputStatementWithDataDefinition.yang b/compiler/base/parser/src/test/resources/OutputStatementWithDataDefinition.yang
new file mode 100644
index 0000000..527b399
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/OutputStatementWithDataDefinition.yang
@@ -0,0 +1,28 @@
+module rock {
+    namespace "http://example.net/rock";
+    prefix "rock";
+
+    rpc activate-software-image {
+        description "description";
+        output {
+            leaf image-name {
+                type string;
+            }
+            list ospf {
+                key "invalid-interval";
+                config true;
+                max-elements 10;
+                min-elements 3;
+                leaf invalid-interval {
+                    type uint16;
+                }
+            }
+            container isis {
+               config true;
+               leaf invalid-interval {
+                   type uint16;
+               }
+           }
+        }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/OutputStatementWithTypedef.yang b/compiler/base/parser/src/test/resources/OutputStatementWithTypedef.yang
new file mode 100644
index 0000000..6027c2d
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/OutputStatementWithTypedef.yang
@@ -0,0 +1,17 @@
+module rock {
+    namespace "http://example.net/rock";
+    prefix "rock";
+
+    rpc activate-software-image {
+        description "description";
+        output {
+            leaf image-name {
+                type string;
+            }
+            typedef my-type {
+                status deprecated;
+                type int32;
+            }
+        }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/PatternStatementInsideLeafList.yang b/compiler/base/parser/src/test/resources/PatternStatementInsideLeafList.yang
new file mode 100644
index 0000000..d21c0f6
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/PatternStatementInsideLeafList.yang
@@ -0,0 +1,10 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf-list invalid-interval {
+        type string {
+            pattern "[a-zA-Z]";
+         }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/PatternStatementInsideTypeDef.yang b/compiler/base/parser/src/test/resources/PatternStatementInsideTypeDef.yang
new file mode 100644
index 0000000..edb625e
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/PatternStatementInsideTypeDef.yang
@@ -0,0 +1,15 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    typedef invalid-interval {
+        type string {
+            pattern "[a-zA-Z]";
+         }
+    }
+    leaf xyz {
+       type invalid-interval {
+           pattern "[a-z]";
+       }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/PatternStatementWithPlus.yang b/compiler/base/parser/src/test/resources/PatternStatementWithPlus.yang
new file mode 100644
index 0000000..417e1d1
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/PatternStatementWithPlus.yang
@@ -0,0 +1,10 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf-list invalid-interval {
+        type string {
+            pattern "-[0-9]+|[0-9]+";
+         }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/PatternSubStatements.yang b/compiler/base/parser/src/test/resources/PatternSubStatements.yang
new file mode 100644
index 0000000..3e792c6
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/PatternSubStatements.yang
@@ -0,0 +1,13 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf invalid-interval {
+        type string {
+            pattern "[a-zA-Z]" {
+                description "pattern description";
+                reference "pattern reference";
+            }
+         }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/PositionDuplication.yang b/compiler/base/parser/src/test/resources/PositionDuplication.yang
new file mode 100644
index 0000000..81eeb16
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/PositionDuplication.yang
@@ -0,0 +1,18 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+     leaf mybits {
+         type bits {
+             bit disable-nagle {
+                 position 0;
+             }
+             bit auto-sense-speed {
+                 position 1;
+             }
+             bit Ten-Mb-only {
+                 position 1;
+             }
+         }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/PositionImplicitAndExplicit.yang b/compiler/base/parser/src/test/resources/PositionImplicitAndExplicit.yang
new file mode 100644
index 0000000..bef9712
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/PositionImplicitAndExplicit.yang
@@ -0,0 +1,15 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf mybits {
+        type bits {
+            bit disable-nagle;
+            bit auto-sense-speed {
+                position 1;
+            }
+            bit Ten-Mb-only;
+        }
+    }
+}
+
diff --git a/compiler/base/parser/src/test/resources/PositionImplicitAndExplicitDuplication.yang b/compiler/base/parser/src/test/resources/PositionImplicitAndExplicitDuplication.yang
new file mode 100644
index 0000000..30b81ab
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/PositionImplicitAndExplicitDuplication.yang
@@ -0,0 +1,15 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+     leaf mybits {
+         type bits {
+             bit disable-nagle;
+             bit auto-sense-speed {
+                 position 0;
+             }
+             bit Ten-Mb-only;
+             }
+         }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/PositionNegativeValue.yang b/compiler/base/parser/src/test/resources/PositionNegativeValue.yang
new file mode 100644
index 0000000..60330e0
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/PositionNegativeValue.yang
@@ -0,0 +1,15 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+     leaf mybits {
+         type bits {
+             bit disable-nagle;
+             bit auto-sense-speed {
+                 position -2;
+             }
+             bit Ten-Mb-only;
+             }
+         }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/PositionStatement.yang b/compiler/base/parser/src/test/resources/PositionStatement.yang
new file mode 100644
index 0000000..afa0a4c
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/PositionStatement.yang
@@ -0,0 +1,18 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf mybits {
+        type bits {
+            bit disable-nagle {
+                position 0;
+            }
+            bit auto-sense-speed {
+                position 1;
+            }
+            bit Ten-Mb-only {
+                position 2;
+            }
+        }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/PositionWithDoubleQuotes.yang b/compiler/base/parser/src/test/resources/PositionWithDoubleQuotes.yang
new file mode 100644
index 0000000..0c9d358
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/PositionWithDoubleQuotes.yang
@@ -0,0 +1,18 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+     leaf mybits {
+         type bits {
+             bit disable-nagle {
+                 position "0";
+             }
+             bit auto-sense-speed {
+                 position "1";
+             }
+             bit Ten-Mb-only {
+                 position "2";
+             }
+         }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/PrefixDualEntry.yang b/compiler/base/parser/src/test/resources/PrefixDualEntry.yang
new file mode 100644
index 0000000..e999774
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/PrefixDualEntry.yang
@@ -0,0 +1,18 @@
+module Test {
+yang-version 1;
+namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
+prefix On;
+import ietf {
+prefix On2;
+prefix On3;
+revision-date 2015-02-03;
+}
+include itut {
+revision-date 2016-02-03;
+}
+include sdn {
+revision-date 2014-02-03;
+}
+contact "Test";
+organization "ONOS";
+}
diff --git a/compiler/base/parser/src/test/resources/PrefixInvalidValue.yang b/compiler/base/parser/src/test/resources/PrefixInvalidValue.yang
new file mode 100644
index 0000000..40f7617
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/PrefixInvalidValue.yang
@@ -0,0 +1,17 @@
+module Test {
+yang-version 1;
+namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
+prefix -On;
+import ietf {
+prefix On2;
+revision-date 2015-02-03;
+}
+include itut {
+revision-date 2016-02-03;
+}
+include sdn {
+revision-date 2014-02-03;
+}
+contact "Test";
+organization "ONOS";
+}
diff --git a/compiler/base/parser/src/test/resources/PrefixMissingValue.yang b/compiler/base/parser/src/test/resources/PrefixMissingValue.yang
new file mode 100644
index 0000000..4d92ee1
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/PrefixMissingValue.yang
@@ -0,0 +1,17 @@
+module Test {
+yang-version 1;
+namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
+prefix ;
+import ietf {
+prefix On2;
+revision-date 2015-02-03;
+}
+include itut {
+revision-date 2016-02-03;
+}
+include sdn {
+revision-date 2014-02-03;
+}
+contact "Test";
+organization "ONOS";
+}
diff --git a/compiler/base/parser/src/test/resources/PrefixOrder.yang b/compiler/base/parser/src/test/resources/PrefixOrder.yang
new file mode 100644
index 0000000..d14e8b1
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/PrefixOrder.yang
@@ -0,0 +1,17 @@
+module Test {
+yang-version 1;
+namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
+import ietf {
+prefix On2;
+revision-date 2015-02-03;
+}
+prefix test;
+include itut {
+revision-date 2016-02-03;
+}
+include sdn {
+revision-date 2014-02-03;
+}
+contact "Test";
+organization "ONOS";
+}
diff --git a/compiler/base/parser/src/test/resources/PrefixValidEntry.yang b/compiler/base/parser/src/test/resources/PrefixValidEntry.yang
new file mode 100644
index 0000000..826dee4
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/PrefixValidEntry.yang
@@ -0,0 +1,17 @@
+module Test {
+yang-version 1;
+namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
+prefix On;
+import ietf {
+prefix On2;
+revision-date 2015-02-03;
+}
+include itut {
+revision-date 2016-02-03;
+}
+include sdn {
+revision-date 2014-02-03;
+}
+contact "Test";
+organization "ONOS";
+}
diff --git a/compiler/base/parser/src/test/resources/PrefixWithDoubleQuotes.yang b/compiler/base/parser/src/test/resources/PrefixWithDoubleQuotes.yang
new file mode 100644
index 0000000..e9590f1
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/PrefixWithDoubleQuotes.yang
@@ -0,0 +1,17 @@
+module Test {
+yang-version 1;
+namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
+prefix "On";
+import ietf {
+prefix On2;
+revision-date 2015-02-03;
+}
+include itut {
+revision-date 2016-02-03;
+}
+include sdn {
+revision-date 2014-02-03;
+}
+contact "Test";
+organization "ONOS";
+}
diff --git a/compiler/base/parser/src/test/resources/PresenceDefaultValue.yang b/compiler/base/parser/src/test/resources/PresenceDefaultValue.yang
new file mode 100644
index 0000000..6418e20
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/PresenceDefaultValue.yang
@@ -0,0 +1,13 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    container valid {
+        leaf ospf {
+            type "uint16";
+            units "seconds";
+            status current;
+            reference "RFC 6020";
+        }
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/PresenceWithoutStatementEnd.yang b/compiler/base/parser/src/test/resources/PresenceWithoutStatementEnd.yang
new file mode 100644
index 0000000..1427c5f
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/PresenceWithoutStatementEnd.yang
@@ -0,0 +1,14 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    container valid {
+        presence "invalid"
+        leaf invalid-interval {
+            type "uint16";
+            units "seconds";
+            status current;
+            reference "RFC 6020";
+        }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/ProcessFileWithExtraBrace.yang b/compiler/base/parser/src/test/resources/ProcessFileWithExtraBrace.yang
new file mode 100644
index 0000000..ca3f0d0
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ProcessFileWithExtraBrace.yang
@@ -0,0 +1,15 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+        container food {
+            choice snack {
+                list sports-arena {
+                }
+            }
+        }
+    }
+}
+}
+}
+}
diff --git a/compiler/base/parser/src/test/resources/ProcessFileWithExtraBraceInBetween.yang b/compiler/base/parser/src/test/resources/ProcessFileWithExtraBraceInBetween.yang
new file mode 100644
index 0000000..580d270
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ProcessFileWithExtraBraceInBetween.yang
@@ -0,0 +1,35 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    import ietf-yang-types {
+        prefix "P";
+    }
+    grouping Percentage {
+        leaf hello{
+            type string;
+        }
+        leaf invalid1{
+            type string;
+        }
+        }
+        leaf invalid2{
+            type string;
+        }
+    }
+    container ospf {
+        list valid {
+            key "invalid";
+            leaf invalid{
+                type string;
+            }
+            uses Ant:FirstClass;
+            grouping FirstClass {
+                uses P:PassingClass;
+            }
+        }
+        grouping PassingClass {
+            uses Ant:Percentage;
+        }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/ProcessFileWithExtraLeaf.yang b/compiler/base/parser/src/test/resources/ProcessFileWithExtraLeaf.yang
new file mode 100644
index 0000000..5624b7a
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ProcessFileWithExtraLeaf.yang
@@ -0,0 +1,13 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    container food {
+        choice snack {
+            list sports-arena {
+            }
+        }
+    }
+}
+leaf invalid {
+
diff --git a/compiler/base/parser/src/test/resources/RangeStatementInsideLeafList.yang b/compiler/base/parser/src/test/resources/RangeStatementInsideLeafList.yang
new file mode 100644
index 0000000..9f5808d
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/RangeStatementInsideLeafList.yang
@@ -0,0 +1,10 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf-list invalid-interval {
+        type int32 {
+            range "1..4 | 10..20";
+         }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/RangeStatementWithSpace.yang b/compiler/base/parser/src/test/resources/RangeStatementWithSpace.yang
new file mode 100644
index 0000000..a41d68a
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/RangeStatementWithSpace.yang
@@ -0,0 +1,11 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf invalid-interval {
+        type int32 {
+            range "                          1                        ..                                        4 |                        10               ..                                          20                  ";
+         }
+    }
+}
+
diff --git a/compiler/base/parser/src/test/resources/RangeSubStatements.yang b/compiler/base/parser/src/test/resources/RangeSubStatements.yang
new file mode 100644
index 0000000..4b57bd0
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/RangeSubStatements.yang
@@ -0,0 +1,14 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf invalid-interval {
+        type int32 {
+            range "1..4 | 10..20" {
+                description "range description";
+                reference "range reference";
+            }
+         }
+    }
+}
+
diff --git a/compiler/base/parser/src/test/resources/RangeWithInvalidIntegerPattern.yang b/compiler/base/parser/src/test/resources/RangeWithInvalidIntegerPattern.yang
new file mode 100644
index 0000000..60c7992
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/RangeWithInvalidIntegerPattern.yang
@@ -0,0 +1,10 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf-list invalid-interval {
+        type int32 {
+            range "a..z";
+         }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/RangeWithMinMax.yang b/compiler/base/parser/src/test/resources/RangeWithMinMax.yang
new file mode 100644
index 0000000..373d45e
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/RangeWithMinMax.yang
@@ -0,0 +1,10 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf-list invalid-interval {
+        type int32 {
+            range "min..max";
+         }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/RangeWithOneInterval.yang b/compiler/base/parser/src/test/resources/RangeWithOneInterval.yang
new file mode 100644
index 0000000..85d0288
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/RangeWithOneInterval.yang
@@ -0,0 +1,10 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf-list invalid-interval {
+        type int32 {
+            range "1";
+         }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/ReferenceEmptyStatement.yang b/compiler/base/parser/src/test/resources/ReferenceEmptyStatement.yang
new file mode 100644
index 0000000..ff3525a
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ReferenceEmptyStatement.yang
@@ -0,0 +1,6 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    reference "";
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/ReferenceStatement.yang b/compiler/base/parser/src/test/resources/ReferenceStatement.yang
new file mode 100644
index 0000000..70349a0
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ReferenceStatement.yang
@@ -0,0 +1,14 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf invalid-interval {
+        type "uint16";
+        units "seconds";
+        description "Interval before a route is declared invalid";
+        config true;
+        mandatory true;
+        status current;
+        reference "RFC 6020";
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/ReferenceWithoutStatementEnd.yang b/compiler/base/parser/src/test/resources/ReferenceWithoutStatementEnd.yang
new file mode 100644
index 0000000..f2fcf43
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ReferenceWithoutStatementEnd.yang
@@ -0,0 +1,9 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf invalid-interval {
+        type "uint16";
+        reference "RFC 6020"
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/RequireInstanceDefaultValueForLeafref.yang b/compiler/base/parser/src/test/resources/RequireInstanceDefaultValueForLeafref.yang
new file mode 100644
index 0000000..c4dae28
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/RequireInstanceDefaultValueForLeafref.yang
@@ -0,0 +1,31 @@
+module PathListener {
+    namespace "test";
+    prefix test;
+     list interface {
+         key "name";
+         leaf name {
+             type string;
+         }
+         leaf admin-status {
+             type string;
+         }
+         list address {
+             key "ip";
+             leaf ip {
+                 type string;
+             }
+         }
+     }
+     container default-address {
+         leaf ifname {
+             type leafref {
+                 path "../../test:interface/test:name";
+             }
+         }
+         leaf status {
+             type leafref {
+                 path "/test:interface[name = current()/../ifname]/test:admin-status";
+             }
+         }
+     }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/RequireInstanceDefaultValueInInstanceIdentifier.yang b/compiler/base/parser/src/test/resources/RequireInstanceDefaultValueInInstanceIdentifier.yang
new file mode 100644
index 0000000..e3e15bf
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/RequireInstanceDefaultValueInInstanceIdentifier.yang
@@ -0,0 +1,7 @@
+module PathListener {
+    namespace "test";
+    prefix test;
+    leaf admin-status {
+        type instance-identifier;
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/RequireInstanceFalse.yang b/compiler/base/parser/src/test/resources/RequireInstanceFalse.yang
new file mode 100644
index 0000000..0a2ba4f
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/RequireInstanceFalse.yang
@@ -0,0 +1,9 @@
+module PathListener {
+    namespace "test";
+    prefix test;
+    leaf admin-status {
+        type instance-identifier {
+            require-instance "false";
+        }
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/RequireInstanceTrue.yang b/compiler/base/parser/src/test/resources/RequireInstanceTrue.yang
new file mode 100644
index 0000000..cace8c5
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/RequireInstanceTrue.yang
@@ -0,0 +1,32 @@
+module PathListener {
+    namespace "test";
+    prefix test;
+     list interface {
+         key "name";
+         leaf name {
+             type string;
+         }
+         leaf admin-status {
+             type string;
+         }
+         list address {
+             key "ip";
+             leaf ip {
+                 type string;
+             }
+         }
+     }
+     container default-address {
+         leaf ifname {
+             type leafref {
+                 path "../../test:interface/test:name";
+                 require-instance true;
+             }
+         }
+         leaf status {
+             type leafref {
+                 path "/test:interface[name = current()/../ifname]/test:admin-status";
+             }
+         }
+     }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/RevisionAbsence.yang b/compiler/base/parser/src/test/resources/RevisionAbsence.yang
new file mode 100644
index 0000000..eb1d1d9
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/RevisionAbsence.yang
@@ -0,0 +1,5 @@
+module Test {
+yang-version 1;
+namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
+prefix test;
+}
diff --git a/compiler/base/parser/src/test/resources/RevisionDateInQuotesAtImport.yang b/compiler/base/parser/src/test/resources/RevisionDateInQuotesAtImport.yang
new file mode 100644
index 0000000..5f8bcb8
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/RevisionDateInQuotesAtImport.yang
@@ -0,0 +1,17 @@
+module Test {
+yang-version 1;
+namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
+prefix test;
+import ietf {
+prefix On2;
+revision-date "2015-02-03";
+}
+include itut {
+revision-date 2016-02-03;
+}
+include sdn {
+revision-date 2014-02-03;
+}
+contact "Test";
+organization "ONOS";
+}
diff --git a/compiler/base/parser/src/test/resources/RevisionDateInQuotesAtInclude.yang b/compiler/base/parser/src/test/resources/RevisionDateInQuotesAtInclude.yang
new file mode 100644
index 0000000..de405a3
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/RevisionDateInQuotesAtInclude.yang
@@ -0,0 +1,17 @@
+module Test {
+yang-version 1;
+namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
+prefix test;
+import ietf {
+prefix On2;
+revision-date 2015-02-03;
+}
+include itut {
+revision-date "2016-02-03";
+}
+include sdn {
+revision-date 2014-02-03;
+}
+contact "Test";
+organization "ONOS";
+}
diff --git a/compiler/base/parser/src/test/resources/RevisionDateInvalid.yang b/compiler/base/parser/src/test/resources/RevisionDateInvalid.yang
new file mode 100644
index 0000000..c219d11
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/RevisionDateInvalid.yang
@@ -0,0 +1,17 @@
+module Test {
+yang-version 1;
+namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
+prefix test;
+import ietf {
+prefix On2;
+revision-date 2015-02-30;
+}
+include itut {
+revision-date 2016-02-03;
+}
+include sdn {
+revision-date 2014-02-03;
+}
+contact "Test";
+organization "ONOS";
+}
diff --git a/compiler/base/parser/src/test/resources/RevisionDateInvalidFormat.yang b/compiler/base/parser/src/test/resources/RevisionDateInvalidFormat.yang
new file mode 100644
index 0000000..8a6c717
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/RevisionDateInvalidFormat.yang
@@ -0,0 +1,17 @@
+module Test {
+yang-version 1;
+namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
+prefix test;
+import ietf {
+prefix On2;
+revision-date 15-02-03;
+}
+include itut {
+revision-date 2016-02-03;
+}
+include sdn {
+revision-date 2014-02-03;
+}
+contact "Test";
+organization "ONOS";
+}
diff --git a/compiler/base/parser/src/test/resources/RevisionDateInvalidSyntaxAtImport.yang b/compiler/base/parser/src/test/resources/RevisionDateInvalidSyntaxAtImport.yang
new file mode 100644
index 0000000..df726bf
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/RevisionDateInvalidSyntaxAtImport.yang
@@ -0,0 +1,17 @@
+module Test {
+yang-version 1;
+namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
+prefix test;
+import ietf {
+prefix On2;
+revision-date 2015/02/03;
+}
+include itut {
+revision-date 2016-02-03;
+}
+include sdn {
+revision-date 2014-02-03;
+}
+contact "Test";
+organization "ONOS";
+}
diff --git a/compiler/base/parser/src/test/resources/RevisionDateInvalidSyntaxAtInclude.yang b/compiler/base/parser/src/test/resources/RevisionDateInvalidSyntaxAtInclude.yang
new file mode 100644
index 0000000..ea5631e
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/RevisionDateInvalidSyntaxAtInclude.yang
@@ -0,0 +1,17 @@
+module Test {
+yang-version 1;
+namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
+prefix test;
+import ietf {
+prefix On2;
+revision-date 2015-02-03;
+}
+include itut {
+revision-date 2016/02/03;
+}
+include sdn {
+revision-date 2014-02-03;
+}
+contact "Test";
+organization "ONOS";
+}
diff --git a/compiler/base/parser/src/test/resources/RevisionDateValidEntry.yang b/compiler/base/parser/src/test/resources/RevisionDateValidEntry.yang
new file mode 100644
index 0000000..dbf4d3a
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/RevisionDateValidEntry.yang
@@ -0,0 +1,17 @@
+module Test {
+yang-version 1;
+namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
+prefix test;
+import ietf {
+prefix On2;
+revision-date 2015-02-03;
+}
+include itut {
+revision-date 2016-02-03;
+}
+include sdn {
+revision-date 2014-02-03;
+}
+contact "Test";
+organization "ONOS";
+}
diff --git a/compiler/base/parser/src/test/resources/RevisionInValidOrder.yang b/compiler/base/parser/src/test/resources/RevisionInValidOrder.yang
new file mode 100644
index 0000000..c60d434
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/RevisionInValidOrder.yang
@@ -0,0 +1,9 @@
+module Test {
+yang-version 1;
+namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
+prefix test;
+revision 2016-02-03;
+include itut {
+revision-date 2016-02-03;
+}
+}
diff --git a/compiler/base/parser/src/test/resources/RevisionInValidSyntax.yang b/compiler/base/parser/src/test/resources/RevisionInValidSyntax.yang
new file mode 100644
index 0000000..1795b3e
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/RevisionInValidSyntax.yang
@@ -0,0 +1,8 @@
+module Test {
+yang-version 1;
+namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
+prefix test;
+contact "Test";
+organization "ONOS";
+revision;
+}
diff --git a/compiler/base/parser/src/test/resources/RevisionNoOptionalParameter.yang b/compiler/base/parser/src/test/resources/RevisionNoOptionalParameter.yang
new file mode 100644
index 0000000..664204e
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/RevisionNoOptionalParameter.yang
@@ -0,0 +1,8 @@
+module Test {
+yang-version 1;
+namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
+prefix test;
+contact "Test";
+organization "ONOS";
+revision 2016-02-03;
+}
diff --git a/compiler/base/parser/src/test/resources/RevisionSubStatementReference.yang b/compiler/base/parser/src/test/resources/RevisionSubStatementReference.yang
new file mode 100644
index 0000000..d1ada14
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/RevisionSubStatementReference.yang
@@ -0,0 +1,9 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    description "module description";
+    revision 2007-06-09 {
+        reference "revision reference";
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/RevisionSubStatementRevision.yang b/compiler/base/parser/src/test/resources/RevisionSubStatementRevision.yang
new file mode 100644
index 0000000..3d1daa2
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/RevisionSubStatementRevision.yang
@@ -0,0 +1,10 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    description "module description";
+    revision 2007-06-09 {
+        description "revision description";
+    }
+}
+
diff --git a/compiler/base/parser/src/test/resources/ShortCaseListenerWithContainer.yang b/compiler/base/parser/src/test/resources/ShortCaseListenerWithContainer.yang
new file mode 100644
index 0000000..3322a66
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ShortCaseListenerWithContainer.yang
@@ -0,0 +1,14 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    container food {
+        choice snack {
+            container sports-arena {
+                leaf pretzel {
+                    type empty;
+                }
+            }
+        }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/ShortCaseListenerWithList.yang b/compiler/base/parser/src/test/resources/ShortCaseListenerWithList.yang
new file mode 100644
index 0000000..6eeec79
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ShortCaseListenerWithList.yang
@@ -0,0 +1,16 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    container food {
+        choice snack {
+            list sports-arena {
+                key "pretzel";
+                leaf pretzel {
+                    type int32;
+                }
+            }
+        }
+    }
+}
+
diff --git a/compiler/base/parser/src/test/resources/StatusDefaultValue.yang b/compiler/base/parser/src/test/resources/StatusDefaultValue.yang
new file mode 100644
index 0000000..0cc9e36
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/StatusDefaultValue.yang
@@ -0,0 +1,12 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf-list invalid-interval {
+        type "uint16";
+        units "seconds";
+        description "Interval before a route is declared invalid";
+        config true;
+        reference "RFC 6020";
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/StatusInvalidValue.yang b/compiler/base/parser/src/test/resources/StatusInvalidValue.yang
new file mode 100644
index 0000000..253b785
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/StatusInvalidValue.yang
@@ -0,0 +1,9 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+        leaf invalid-interval {
+        type "uint16";
+        status invalid;
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/StatusStatementCurrent.yang b/compiler/base/parser/src/test/resources/StatusStatementCurrent.yang
new file mode 100644
index 0000000..dd9a36d
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/StatusStatementCurrent.yang
@@ -0,0 +1,14 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf invalid-interval {
+        type "uint16";
+        units "seconds";
+        description "Interval before a route is declared invalid";
+        config true;
+        mandatory true;
+        status current;
+        reference "RFC 6020";
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/StatusStatementDeprecated.yang b/compiler/base/parser/src/test/resources/StatusStatementDeprecated.yang
new file mode 100644
index 0000000..9a257b1
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/StatusStatementDeprecated.yang
@@ -0,0 +1,9 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf invalid-interval {
+        type "uint16";
+        status deprecated;
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/StatusStatementObsolete.yang b/compiler/base/parser/src/test/resources/StatusStatementObsolete.yang
new file mode 100644
index 0000000..19325ed
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/StatusStatementObsolete.yang
@@ -0,0 +1,9 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf invalid-interval {
+        type "uint16";
+        status obsolete;
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/StatusWithoutStatementEnd.yang b/compiler/base/parser/src/test/resources/StatusWithoutStatementEnd.yang
new file mode 100644
index 0000000..27a8cfa
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/StatusWithoutStatementEnd.yang
@@ -0,0 +1,9 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf invalid-interval {
+        type "uint16";
+        status current
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/SubModuleInvalidName.yang b/compiler/base/parser/src/test/resources/SubModuleInvalidName.yang
new file mode 100644
index 0000000..7da9397
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/SubModuleInvalidName.yang
@@ -0,0 +1,18 @@
+submodule Test:Test {
+belongs-to ONOS {
+prefix On1;
+}
+yang-version 1;
+import ietf {
+prefix On2;
+revision-date 2015-02-03;
+}
+include itut {
+revision-date 2016-02-03;
+}
+include sdn {
+revision-date 2014-02-03;
+}
+contact "Test";
+organization "ONOS";
+}
diff --git a/compiler/base/parser/src/test/resources/SubModuleOrder.yang b/compiler/base/parser/src/test/resources/SubModuleOrder.yang
new file mode 100644
index 0000000..9779bbb
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/SubModuleOrder.yang
@@ -0,0 +1,18 @@
+submodule Test {
+belongs-to ONOS {
+prefix On1;
+}
+yang-version 1;
+import ietf {
+prefix On2;
+revision-date 2015-02-03;
+}
+include itut {
+revision-date 2016-02-03;
+}
+include sdn {
+revision-date 2014-02-03;
+}
+contact "Test";
+organization "ONOS";
+}
diff --git a/compiler/base/parser/src/test/resources/SubModuleValidEntry.yang b/compiler/base/parser/src/test/resources/SubModuleValidEntry.yang
new file mode 100644
index 0000000..00ecdca
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/SubModuleValidEntry.yang
@@ -0,0 +1,18 @@
+submodule Test {
+yang-version 1;
+belongs-to ONOS {
+prefix On1;
+}
+import ietf {
+prefix On2;
+revision-date 2015-02-03;
+}
+include itut {
+revision-date 2016-02-03;
+}
+include sdn {
+revision-date 2014-02-03;
+}
+contact "Test";
+organization "ONOS";
+}
diff --git a/compiler/base/parser/src/test/resources/SubModuleWithNamespace.yang b/compiler/base/parser/src/test/resources/SubModuleWithNamespace.yang
new file mode 100644
index 0000000..d7a38f7
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/SubModuleWithNamespace.yang
@@ -0,0 +1,19 @@
+submodule Test {
+belongs-to ONOS {
+prefix On1;
+}
+yang-version 1;
+namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
+import ietf {
+prefix On2;
+revision-date 2015-02-03;
+}
+include itut {
+revision-date 2016-02-03;
+}
+include sdn {
+revision-date 2014-02-03;
+}
+contact "Test";
+organization "ONOS";
+}
diff --git a/compiler/base/parser/src/test/resources/SubModuleWithoutBelongsTo.yang b/compiler/base/parser/src/test/resources/SubModuleWithoutBelongsTo.yang
new file mode 100644
index 0000000..4a25209
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/SubModuleWithoutBelongsTo.yang
@@ -0,0 +1,3 @@
+submodule Test {
+yang-version 1;
+}
diff --git a/compiler/base/parser/src/test/resources/SubModuleWithoutVersion.yang b/compiler/base/parser/src/test/resources/SubModuleWithoutVersion.yang
new file mode 100644
index 0000000..f44df8b
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/SubModuleWithoutVersion.yang
@@ -0,0 +1,17 @@
+submodule Test {
+belongs-to ONOS {
+prefix On1;
+}
+import ietf {
+prefix On2;
+revision-date 2015-02-03;
+}
+include itut {
+revision-date 2016-02-03;
+}
+include sdn {
+revision-date 2014-02-03;
+}
+contact "Test";
+organization "ONOS";
+}
diff --git a/compiler/base/parser/src/test/resources/UnionWhenTypeInLeaf.yang b/compiler/base/parser/src/test/resources/UnionWhenTypeInLeaf.yang
new file mode 100644
index 0000000..65c0369
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/UnionWhenTypeInLeaf.yang
@@ -0,0 +1,16 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    list valid {
+        key "invalid-interval";
+        leaf invalid-interval {
+            type union {
+                type int32;
+                type enumeration {
+                    enum "unbounded";
+                }
+            }
+        }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/UnionWhenTypeInLeafList.yang b/compiler/base/parser/src/test/resources/UnionWhenTypeInLeafList.yang
new file mode 100644
index 0000000..f335960
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/UnionWhenTypeInLeafList.yang
@@ -0,0 +1,19 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    list valid {
+        key "invalid";
+        leaf-list invalid-interval {
+            type union {
+            type int32;
+            type enumeration {
+                    enum "unbounded";
+                }
+            }
+        }
+        leaf invalid {
+            type string;
+        }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/UnionWithEmptyType.yang b/compiler/base/parser/src/test/resources/UnionWithEmptyType.yang
new file mode 100644
index 0000000..81e8795
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/UnionWithEmptyType.yang
@@ -0,0 +1,16 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    list valid {
+        key "invalid-interval";
+        leaf invalid-interval {
+            type union {
+                type empty;
+                type enumeration {
+                    enum "unbounded";
+                }
+            }
+        }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/UnionWithoutChild.yang b/compiler/base/parser/src/test/resources/UnionWithoutChild.yang
new file mode 100644
index 0000000..14d3329
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/UnionWithoutChild.yang
@@ -0,0 +1,14 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    list valid {
+        key "invalid-interval";
+        leaf invalid-interval {
+            type union {
+               type "union";
+            }
+        }
+    }
+}
+
diff --git a/compiler/base/parser/src/test/resources/UnitsDefaultValue.yang b/compiler/base/parser/src/test/resources/UnitsDefaultValue.yang
new file mode 100644
index 0000000..c71d5ea
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/UnitsDefaultValue.yang
@@ -0,0 +1,8 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf invalid-interval {
+        type "uint16";
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/UnitsStatement.yang b/compiler/base/parser/src/test/resources/UnitsStatement.yang
new file mode 100644
index 0000000..70349a0
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/UnitsStatement.yang
@@ -0,0 +1,14 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf invalid-interval {
+        type "uint16";
+        units "seconds";
+        description "Interval before a route is declared invalid";
+        config true;
+        mandatory true;
+        status current;
+        reference "RFC 6020";
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/UnitsStatementCardinality.yang b/compiler/base/parser/src/test/resources/UnitsStatementCardinality.yang
new file mode 100644
index 0000000..50a2ba0
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/UnitsStatementCardinality.yang
@@ -0,0 +1,10 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf invalid-interval {
+        type "uint16";
+        units "seconds";
+        units "minutes";
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/UnitsStatementOrder.yang b/compiler/base/parser/src/test/resources/UnitsStatementOrder.yang
new file mode 100644
index 0000000..e41e201
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/UnitsStatementOrder.yang
@@ -0,0 +1,14 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf invalid-interval {
+        units "seconds";
+        type "uint16";
+        description "Interval before a route is declared invalid";
+        config true;
+        mandatory true;
+        status current;
+        reference "RFC 6020";
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/UnitsWithoutStatementEnd.yang b/compiler/base/parser/src/test/resources/UnitsWithoutStatementEnd.yang
new file mode 100644
index 0000000..889d7b7
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/UnitsWithoutStatementEnd.yang
@@ -0,0 +1,9 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf invalid-interval {
+        type "uint16";
+        units "seconds"
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/UnsupportedYangConstructSubStatementMust.yang b/compiler/base/parser/src/test/resources/UnsupportedYangConstructSubStatementMust.yang
new file mode 100644
index 0000000..1529cfd
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/UnsupportedYangConstructSubStatementMust.yang
@@ -0,0 +1,17 @@
+module Test {
+    yang-version 1;
+    namespace "http://huawei.com";
+    prefix Ant;
+    list link-scope-lsa {
+        key "lsa-id adv-router";
+        description "List of OSPF link scope LSAs";
+        uses lsa {
+            refine "version/ospfv2/ospfv2" {
+                must "../../../../../../../../../../../"
+                   + "rt:type = 'ospf:ospfv2'" {
+                  description "OSPFv2 LSA.";
+                }
+            }
+        }
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/UsesInContainer.yang b/compiler/base/parser/src/test/resources/UsesInContainer.yang
new file mode 100644
index 0000000..df52fd6
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/UsesInContainer.yang
@@ -0,0 +1,14 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    grouping endpoint {
+    }
+    container valid {
+        uses endpoint {
+            description "grouping under test";
+            status current;
+            reference "RFC 6020";
+        }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/UsesInList.yang b/compiler/base/parser/src/test/resources/UsesInList.yang
new file mode 100644
index 0000000..6ac7795
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/UsesInList.yang
@@ -0,0 +1,21 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    import ietf-yang-types {
+             prefix "P";
+         }    
+    grouping endpoint {
+    }
+    list valid {
+        key address;
+        leaf address {
+            type P:ip;
+        }
+        uses endpoint {
+            description "grouping under test";
+            status current;
+            reference "RFC 6020";
+        }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/UsesInModule.yang b/compiler/base/parser/src/test/resources/UsesInModule.yang
new file mode 100644
index 0000000..02b9f09
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/UsesInModule.yang
@@ -0,0 +1,8 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    grouping endpoint {
+    }
+    uses endpoint;
+}
diff --git a/compiler/base/parser/src/test/resources/ValidAugmentStatement.yang b/compiler/base/parser/src/test/resources/ValidAugmentStatement.yang
new file mode 100644
index 0000000..f6c247e
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ValidAugmentStatement.yang
@@ -0,0 +1,17 @@
+module Test {
+    yang-version 1;
+    namespace http://example.com/schema/ds0;
+    prefix On;
+
+    import interface-module {
+        prefix "if";
+    }
+    import ietf-yang-types {
+             prefix "P";
+         }
+    augment "/if:interfaces/if:ifEntry" {
+        leaf ds0ChannelNumber {
+            type P:ChannelNumber;
+        }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/ValidBinaryLengthStatement.yang b/compiler/base/parser/src/test/resources/ValidBinaryLengthStatement.yang
new file mode 100644
index 0000000..7182eb3
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ValidBinaryLengthStatement.yang
@@ -0,0 +1,10 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf message {
+        type binary {
+            length "4";
+        }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/ValidExtensionStatement.yang b/compiler/base/parser/src/test/resources/ValidExtensionStatement.yang
new file mode 100644
index 0000000..ca134fa
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ValidExtensionStatement.yang
@@ -0,0 +1,36 @@
+module ietf-yang-compiler-annotation {
+
+   namespace "urn:ietf:params:xml:ns:yang:ietf-yang-compiler-annotation";
+
+   prefix "ca";
+
+   organization
+     "IETF NETMOD (NETCONF Data Modeling Language) Working Group";
+
+   contact
+     "WG Web:   <http://tools.ietf.org/wg/netmod/>
+      WG List:  <mailto:netmod@ietf.org>";
+
+   description
+     "This YANG module defines an extension statement that allows for
+      defining compiler annotations.
+
+      The key words 'MUST', 'MUST NOT', 'REQUIRED', 'SHALL', 'SHALL
+      NOT', 'SHOULD', 'SHOULD NOT', 'RECOMMENDED', 'MAY', and
+      'OPTIONAL' in the module text are to be interpreted as described
+      in RFC 2119 (http://tools.ietf.org/html/rfc2119).";
+
+     revision 2016-07-08 {
+     description
+       "Initial revision.";
+     reference
+       "draft-agv-netmod-yang-compiler-metadata:
+        Defining and Using compiler annotations with YANG";
+     }
+
+     extension compiler-annotation {
+        argument target;
+        description "This extension allows for defining compiler annotations";
+      } // compiler-annotation
+   } //module agv-yang-compiler-annotation
+
diff --git a/compiler/base/parser/src/test/resources/ValidLengthStatement.yang b/compiler/base/parser/src/test/resources/ValidLengthStatement.yang
new file mode 100644
index 0000000..57cb809
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ValidLengthStatement.yang
@@ -0,0 +1,10 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf invalid-interval {
+        type string {
+            length "0..100";
+         }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/ValidLengthStatementInsideBinary.yang b/compiler/base/parser/src/test/resources/ValidLengthStatementInsideBinary.yang
new file mode 100644
index 0000000..7182eb3
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ValidLengthStatementInsideBinary.yang
@@ -0,0 +1,10 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf message {
+        type binary {
+            length "4";
+        }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/ValidNotificationStatement.yang b/compiler/base/parser/src/test/resources/ValidNotificationStatement.yang
new file mode 100644
index 0000000..1e0f144
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ValidNotificationStatement.yang
@@ -0,0 +1,26 @@
+module rock {
+    namespace "http://example.net/rock";
+    prefix "rock";
+
+    import ietf-yang-types {
+             prefix "P";
+         }
+    notification link-failure {
+        description "A link failure has been detected";
+        status deprecated;
+        reference "reference";
+        typedef my-type {
+           status deprecated;
+           type int32;
+        }
+        leaf if-name {
+           type string;
+        }
+        leaf if-admin-status {
+           type P:admin-status;
+        }
+        leaf if-oper-status {
+           type P:oper-status;
+        }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/ValidPatternStatement.yang b/compiler/base/parser/src/test/resources/ValidPatternStatement.yang
new file mode 100644
index 0000000..0c93e9d
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ValidPatternStatement.yang
@@ -0,0 +1,30 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf invalid-interval {
+        type string {
+            pattern "[a-zA-Z]";
+         }
+    }
+    leaf ipv4-address {
+         type string {
+           pattern
+          '(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(%[\p{N}\p{L}]+)?';
+         }
+      description
+        "The ipv4-address type represents an IPv4 address in
+       dotted-quad notation.  The IPv4 address may include a zone
+       index, separated by a % sign.
+
+       The zone index is used to disambiguate identical address
+       values.  For link-local addresses, the zone index will
+       typically be the interface index number or the name of an
+       interface.  If the zone index is not present, the default
+       zone of the device will be used.
+
+       The canonical format for the zone index is the numerical
+       format";
+    }
+
+}
diff --git a/compiler/base/parser/src/test/resources/ValidRangeStatement.yang b/compiler/base/parser/src/test/resources/ValidRangeStatement.yang
new file mode 100644
index 0000000..4243040
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ValidRangeStatement.yang
@@ -0,0 +1,11 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf invalid-interval {
+        type int32 {
+            range "1..4 | 10..20";
+         }
+    }
+}
+
diff --git a/compiler/base/parser/src/test/resources/ValidRpcStatement.yang b/compiler/base/parser/src/test/resources/ValidRpcStatement.yang
new file mode 100644
index 0000000..f188227
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ValidRpcStatement.yang
@@ -0,0 +1,24 @@
+module rock {
+    namespace "http://example.net/rock";
+    prefix "rock";
+
+    rpc rock-the-house {
+        description "description";
+        status current;
+        reference "reference";
+        typedef my-type {
+           status deprecated;
+           type int32;
+        }
+        input {
+            leaf zip-code {
+                type string;
+            }
+        }
+        output {
+             leaf status {
+                 type string;
+             }
+        }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/ValidSameGroupingEntryInModuleAndContainer.yang b/compiler/base/parser/src/test/resources/ValidSameGroupingEntryInModuleAndContainer.yang
new file mode 100644
index 0000000..2580cdd
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ValidSameGroupingEntryInModuleAndContainer.yang
@@ -0,0 +1,23 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    grouping endpoint {
+        leaf address {
+            type ip-address;
+        }
+    leaf port {
+        type port-number;
+        }
+    }
+    container valid {
+        grouping endpoint {
+            leaf address {
+                type ip-address;
+            }
+            leaf port {
+                type port-number;
+            }
+        }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/ValidVersionWithDoubleQuotes.yang b/compiler/base/parser/src/test/resources/ValidVersionWithDoubleQuotes.yang
new file mode 100644
index 0000000..a2c718a
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ValidVersionWithDoubleQuotes.yang
@@ -0,0 +1,5 @@
+module Test {
+yang-version "1";
+namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
+prefix On;
+}
diff --git a/compiler/base/parser/src/test/resources/ValueAndAutoStatement.yang b/compiler/base/parser/src/test/resources/ValueAndAutoStatement.yang
new file mode 100644
index 0000000..89ba403
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ValueAndAutoStatement.yang
@@ -0,0 +1,16 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf speed {
+        type enumeration {
+            enum 10m {
+                value 10;
+            }
+            enum 100m;
+            enum auto {
+                value 1000;
+            }
+        }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/ValueDuplication.yang b/compiler/base/parser/src/test/resources/ValueDuplication.yang
new file mode 100644
index 0000000..339a737
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ValueDuplication.yang
@@ -0,0 +1,18 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf speed {
+        type enumeration {
+          enum 10m {
+	     value 10;
+          }
+          enum 100m {
+	     value 100;
+          }
+          enum auto {
+	     value 10;
+          }
+        }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/ValueExplicitAndAutoDuplication.yang b/compiler/base/parser/src/test/resources/ValueExplicitAndAutoDuplication.yang
new file mode 100644
index 0000000..3e58155
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ValueExplicitAndAutoDuplication.yang
@@ -0,0 +1,16 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf speed {
+        type enumeration {
+          enum 10m {
+	     value 10;
+          }
+          enum 100m;
+          enum auto {
+	     value 11;
+          }
+        }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/ValueStatement.yang b/compiler/base/parser/src/test/resources/ValueStatement.yang
new file mode 100644
index 0000000..f461359
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ValueStatement.yang
@@ -0,0 +1,18 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf speed {
+        type enumeration {
+          enum 10m {
+	     value 10;
+          }
+          enum 100m {
+	     value 100;
+          }
+          enum auto {
+	     value 1000;
+          }
+        }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/ValueStatementWithNegativeValue.yang b/compiler/base/parser/src/test/resources/ValueStatementWithNegativeValue.yang
new file mode 100644
index 0000000..a3f236b
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ValueStatementWithNegativeValue.yang
@@ -0,0 +1,18 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf speed {
+        type enumeration {
+          enum 10m {
+	     value -2;
+          }
+          enum 100m {
+	     value "-1";
+          }
+          enum auto {
+	     value 0;
+          }
+        }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/ValueStatementWithQuotes.yang b/compiler/base/parser/src/test/resources/ValueStatementWithQuotes.yang
new file mode 100644
index 0000000..e166ca4
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/ValueStatementWithQuotes.yang
@@ -0,0 +1,18 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf speed {
+        type enumeration {
+          enum 10m {
+	     value "10";
+          }
+          enum 100m {
+	     value "100";
+          }
+          enum auto {
+	     value "1000";
+          }
+        }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/VersionDualEntry.yang b/compiler/base/parser/src/test/resources/VersionDualEntry.yang
new file mode 100644
index 0000000..f8eaddd
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/VersionDualEntry.yang
@@ -0,0 +1,6 @@
+module Test {
+yang-version 1;
+namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
+prefix On;
+yang-version 1;
+}
diff --git a/compiler/base/parser/src/test/resources/VersionInvalidSyntax.yang b/compiler/base/parser/src/test/resources/VersionInvalidSyntax.yang
new file mode 100644
index 0000000..26cb0b2
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/VersionInvalidSyntax.yang
@@ -0,0 +1,5 @@
+module Test {
+namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
+prefix On;
+yang-version ;
+}
diff --git a/compiler/base/parser/src/test/resources/VersionInvalidValue.yang b/compiler/base/parser/src/test/resources/VersionInvalidValue.yang
new file mode 100644
index 0000000..e8e6107
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/VersionInvalidValue.yang
@@ -0,0 +1,5 @@
+module Test {
+yang-version 2;
+namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
+prefix On;
+}
diff --git a/compiler/base/parser/src/test/resources/VersionNotPresent.yang b/compiler/base/parser/src/test/resources/VersionNotPresent.yang
new file mode 100644
index 0000000..eed9953
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/VersionNotPresent.yang
@@ -0,0 +1,4 @@
+module Test {
+namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
+prefix On;
+}
diff --git a/compiler/base/parser/src/test/resources/VersionOrder.yang b/compiler/base/parser/src/test/resources/VersionOrder.yang
new file mode 100644
index 0000000..92463e9
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/VersionOrder.yang
@@ -0,0 +1,5 @@
+module Test {
+namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
+prefix On;
+yang-version 1;
+}
diff --git a/compiler/base/parser/src/test/resources/VersionValidEntry.yang b/compiler/base/parser/src/test/resources/VersionValidEntry.yang
new file mode 100644
index 0000000..439ded8
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/VersionValidEntry.yang
@@ -0,0 +1,5 @@
+module Test {
+yang-version 1;
+namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
+prefix On;
+}
diff --git a/compiler/base/parser/src/test/resources/YangFileWithSyntaxError.yang b/compiler/base/parser/src/test/resources/YangFileWithSyntaxError.yang
new file mode 100644
index 0000000..413a181
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/YangFileWithSyntaxError.yang
@@ -0,0 +1,6 @@
+module Antlrtest {
+yang-version 1
+namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
+prefix Ant;
+}
+
diff --git a/compiler/base/parser/src/test/resources/YangFileWithoutSyntaxError.yang b/compiler/base/parser/src/test/resources/YangFileWithoutSyntaxError.yang
new file mode 100644
index 0000000..4f4839f
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/YangFileWithoutSyntaxError.yang
@@ -0,0 +1,6 @@
+module Antlrtest {
+yang-version 1;
+namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
+prefix Ant;
+}
+
diff --git a/compiler/base/parser/src/test/resources/decimal64/Decimal64MultiTypedefMultiInvalidRangeStatement.yang b/compiler/base/parser/src/test/resources/decimal64/Decimal64MultiTypedefMultiInvalidRangeStatement.yang
new file mode 100644
index 0000000..966b387
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/decimal64/Decimal64MultiTypedefMultiInvalidRangeStatement.yang
@@ -0,0 +1,22 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+
+    typedef topDecimal {
+         type decimal64 {
+            fraction-digits 4;
+            range 4..11;
+         }
+    }
+
+    typedef midDecimal {
+         type topDecimal;
+    }
+
+    leaf lowerDecimal {
+         type midDecimal {
+            range 1..12;
+         }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/decimal64/Decimal64MultiTypedefMultiRangeStatement.yang b/compiler/base/parser/src/test/resources/decimal64/Decimal64MultiTypedefMultiRangeStatement.yang
new file mode 100644
index 0000000..76f215a
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/decimal64/Decimal64MultiTypedefMultiRangeStatement.yang
@@ -0,0 +1,22 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+
+    typedef topDecimal {
+         type decimal64 {
+            fraction-digits 4;
+            range 1..12;
+         }
+    }
+
+    typedef midDecimal {
+         type topDecimal;
+    }
+
+    leaf lowerDecimal {
+         type midDecimal {
+            range 4..11;
+         }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/decimal64/Decimal64MultiTypedefRangeInLeafStatement.yang b/compiler/base/parser/src/test/resources/decimal64/Decimal64MultiTypedefRangeInLeafStatement.yang
new file mode 100644
index 0000000..eea48f4
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/decimal64/Decimal64MultiTypedefRangeInLeafStatement.yang
@@ -0,0 +1,21 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+
+    typedef topDecimal {
+         type decimal64 {
+            fraction-digits 4;
+         }
+    }
+
+    typedef midDecimal {
+         type topDecimal;
+    }
+
+    leaf lowerDecimal {
+         type midDecimal {
+            range 1..12;
+         }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/decimal64/Decimal64MultiTypedefRangeStatement.yang b/compiler/base/parser/src/test/resources/decimal64/Decimal64MultiTypedefRangeStatement.yang
new file mode 100644
index 0000000..b4c0a36
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/decimal64/Decimal64MultiTypedefRangeStatement.yang
@@ -0,0 +1,20 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+
+    typedef topDecimal {
+         type decimal64 {
+            fraction-digits 4; 
+            range 1..12;
+         }
+    }
+
+    typedef midDecimal {
+         type topDecimal;
+    }
+
+    leaf lowerDecimal {
+         type midDecimal;
+    } 
+}
diff --git a/compiler/base/parser/src/test/resources/decimal64/Decimal64MultiTypedefStatement.yang b/compiler/base/parser/src/test/resources/decimal64/Decimal64MultiTypedefStatement.yang
new file mode 100644
index 0000000..8682aac
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/decimal64/Decimal64MultiTypedefStatement.yang
@@ -0,0 +1,19 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+
+    typedef topDecimal {
+         type decimal64 {
+            fraction-digits 4; 
+         }
+    }
+
+    typedef midDecimal {
+         type topDecimal;
+    }
+
+    leaf lowerDecimal {
+         type midDecimal;
+    } 
+}
diff --git a/compiler/base/parser/src/test/resources/decimal64/Decimal64MultiTypedefWithMaxRange.yang b/compiler/base/parser/src/test/resources/decimal64/Decimal64MultiTypedefWithMaxRange.yang
new file mode 100644
index 0000000..405d08c
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/decimal64/Decimal64MultiTypedefWithMaxRange.yang
@@ -0,0 +1,22 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+
+    typedef topDecimal {
+         type decimal64 {
+            fraction-digits 4;
+            range 1..12;
+         }
+    }
+
+    typedef midDecimal {
+         type topDecimal;
+    }
+
+    leaf lowerDecimal {
+         type midDecimal {
+            range 4..max;
+         }
+    } 
+}
diff --git a/compiler/base/parser/src/test/resources/decimal64/Decimal64TypeInvalidMaxValueFraction.yang b/compiler/base/parser/src/test/resources/decimal64/Decimal64TypeInvalidMaxValueFraction.yang
new file mode 100644
index 0000000..68bd8df
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/decimal64/Decimal64TypeInvalidMaxValueFraction.yang
@@ -0,0 +1,11 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+
+    leaf invalidDecimal1 {
+         type decimal64 {
+            fraction-digits 19; 
+         }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/decimal64/Decimal64TypeInvalidMinValueFraction1.yang b/compiler/base/parser/src/test/resources/decimal64/Decimal64TypeInvalidMinValueFraction1.yang
new file mode 100644
index 0000000..3d7445a
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/decimal64/Decimal64TypeInvalidMinValueFraction1.yang
@@ -0,0 +1,11 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+
+    leaf invalidDecimal2 {
+         type decimal64 {
+            fraction-digits 0; 
+         }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/decimal64/Decimal64TypeInvalidMinValueFraction2.yang b/compiler/base/parser/src/test/resources/decimal64/Decimal64TypeInvalidMinValueFraction2.yang
new file mode 100644
index 0000000..4e17bbe
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/decimal64/Decimal64TypeInvalidMinValueFraction2.yang
@@ -0,0 +1,11 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+
+    leaf invalidDecimal3 {
+         type decimal64 {
+            fraction-digits -1; 
+         }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/decimal64/Decimal64TypeInvalidRangeStmnt.yang b/compiler/base/parser/src/test/resources/decimal64/Decimal64TypeInvalidRangeStmnt.yang
new file mode 100644
index 0000000..2ac3d94
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/decimal64/Decimal64TypeInvalidRangeStmnt.yang
@@ -0,0 +1,11 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf validDecimal {
+         type decimal64 {
+            fraction-digits 18; 
+            range "1 .. 20.14";
+         }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/decimal64/Decimal64TypeStatement.yang b/compiler/base/parser/src/test/resources/decimal64/Decimal64TypeStatement.yang
new file mode 100644
index 0000000..9824c12
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/decimal64/Decimal64TypeStatement.yang
@@ -0,0 +1,10 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf validDecimal {
+         type decimal64 {
+            fraction-digits 2; 
+         }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/decimal64/Decimal64TypeValidation.yang b/compiler/base/parser/src/test/resources/decimal64/Decimal64TypeValidation.yang
new file mode 100644
index 0000000..06bf5b7
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/decimal64/Decimal64TypeValidation.yang
@@ -0,0 +1,10 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf validDecimal {
+         type decimal64 {
+            fraction-digits 18; 
+         }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/decimal64/Decimal64TypeWithMultiValueRangeStmnt.yang b/compiler/base/parser/src/test/resources/decimal64/Decimal64TypeWithMultiValueRangeStmnt.yang
new file mode 100644
index 0000000..f657134
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/decimal64/Decimal64TypeWithMultiValueRangeStmnt.yang
@@ -0,0 +1,11 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf validDecimal {
+         type decimal64 {
+            fraction-digits 18; 
+            range "-9.22..7.22 | 8 | 9..max";
+         }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/decimal64/Decimal64TypeWithRangeStatement.yang b/compiler/base/parser/src/test/resources/decimal64/Decimal64TypeWithRangeStatement.yang
new file mode 100644
index 0000000..f184927
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/decimal64/Decimal64TypeWithRangeStatement.yang
@@ -0,0 +1,11 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf validDecimal {
+         type decimal64 {
+            fraction-digits 8; 
+            range "-92233720368.54775808 .. 92233720368.54775807";
+         }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/decimal64/Decimal64TypeWithoutFraction.yang b/compiler/base/parser/src/test/resources/decimal64/Decimal64TypeWithoutFraction.yang
new file mode 100644
index 0000000..e7b8beb
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/decimal64/Decimal64TypeWithoutFraction.yang
@@ -0,0 +1,8 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf validDecimal {
+         type decimal64;
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/decimal64/Decimal64TypedefStatement.yang b/compiler/base/parser/src/test/resources/decimal64/Decimal64TypedefStatement.yang
new file mode 100644
index 0000000..66addd2
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/decimal64/Decimal64TypedefStatement.yang
@@ -0,0 +1,15 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+
+    typedef validDecimal {
+         type decimal64 {
+            fraction-digits 4; 
+         }
+    }
+
+    leaf setFourDecimal {
+         type validDecimal;
+    } 
+}
diff --git a/compiler/base/parser/src/test/resources/default/DefaultCaseInChoiceSubStatement.yang b/compiler/base/parser/src/test/resources/default/DefaultCaseInChoiceSubStatement.yang
new file mode 100644
index 0000000..72b597b
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/default/DefaultCaseInChoiceSubStatement.yang
@@ -0,0 +1,23 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    container food {
+       choice snack {
+           case sports-arena {
+               leaf pretzel {
+                   type string;
+               }
+               leaf beer {
+                   type string;
+               }
+           }
+           case late-night {
+               leaf chocolate {
+                   type string;
+               }
+           }
+           default "sports-arena";
+       }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/default/DefaultInvalidValueBinaryInLeaf.yang b/compiler/base/parser/src/test/resources/default/DefaultInvalidValueBinaryInLeaf.yang
new file mode 100644
index 0000000..aab417b
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/default/DefaultInvalidValueBinaryInLeaf.yang
@@ -0,0 +1,12 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+
+    leaf message {
+        type binary {
+            length "8";
+        }
+        default "000";
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/default/DefaultInvalidValueBitsInLeaf.yang b/compiler/base/parser/src/test/resources/default/DefaultInvalidValueBitsInLeaf.yang
new file mode 100644
index 0000000..2e84cf3
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/default/DefaultInvalidValueBitsInLeaf.yang
@@ -0,0 +1,20 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+
+     leaf mybits {
+         type bits {
+             bit disable-nagle {
+                 position 0;
+             }
+             bit auto-sense-speed {
+                 position 1;
+             }
+             bit Mb-only {
+                 position 2;
+             }
+         }
+         default "xyz";
+     }
+}
diff --git a/compiler/base/parser/src/test/resources/default/DefaultInvalidValueBooleanInLeaf.yang b/compiler/base/parser/src/test/resources/default/DefaultInvalidValueBooleanInLeaf.yang
new file mode 100644
index 0000000..1d98df9
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/default/DefaultInvalidValueBooleanInLeaf.yang
@@ -0,0 +1,10 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+
+    leaf myboolean {
+        type boolean;
+        default "yes";
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/default/DefaultInvalidValueDecimal64InLeaf.yang b/compiler/base/parser/src/test/resources/default/DefaultInvalidValueDecimal64InLeaf.yang
new file mode 100644
index 0000000..305235f
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/default/DefaultInvalidValueDecimal64InLeaf.yang
@@ -0,0 +1,13 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+
+    leaf mydecimal {
+        type decimal64 {
+           fraction-digits 4;
+           range 4..6;
+        } 
+        default "x";
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/default/DefaultInvalidValueEnumerationInLeaf.yang b/compiler/base/parser/src/test/resources/default/DefaultInvalidValueEnumerationInLeaf.yang
new file mode 100644
index 0000000..643dac3
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/default/DefaultInvalidValueEnumerationInLeaf.yang
@@ -0,0 +1,16 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+
+     leaf myenum {
+         type enumeration {
+             enum zero;
+             enum one;
+             enum seven {
+                 value 7;
+             }
+         }
+         default "xyz";
+     }
+}
diff --git a/compiler/base/parser/src/test/resources/default/DefaultInvalidValueInChoiceSubStmt.yang b/compiler/base/parser/src/test/resources/default/DefaultInvalidValueInChoiceSubStmt.yang
new file mode 100644
index 0000000..b9fd60d
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/default/DefaultInvalidValueInChoiceSubStmt.yang
@@ -0,0 +1,23 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    container food {
+       choice snack {
+           case sports-arena {
+               leaf pretzel {
+                   type string;
+               }
+               leaf beer {
+                   type string;
+               }
+           }
+           case late-night {
+               leaf chocolate {
+                   type string;
+               }
+           }
+           default "hello";
+       }
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/default/DefaultInvalidValueInLeafSubStatement.yang b/compiler/base/parser/src/test/resources/default/DefaultInvalidValueInLeafSubStatement.yang
new file mode 100644
index 0000000..9b20fa2
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/default/DefaultInvalidValueInLeafSubStatement.yang
@@ -0,0 +1,15 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf invalid-interval {
+        type "uint16";
+        units "seconds";
+        default "x";
+        description "Interval before a route is declared invalid";
+        config true;
+        mandatory true;
+        status current;
+        reference "RFC 6020";
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/default/DefaultInvalidValueInTypeDef.yang b/compiler/base/parser/src/test/resources/default/DefaultInvalidValueInTypeDef.yang
new file mode 100644
index 0000000..35f8554
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/default/DefaultInvalidValueInTypeDef.yang
@@ -0,0 +1,14 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+
+    typedef topInt {
+       type int64;
+       default "x";
+    }
+
+    leaf myValue {
+        type topInt;
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/default/DefaultInvalidValueStringInLeaf.yang b/compiler/base/parser/src/test/resources/default/DefaultInvalidValueStringInLeaf.yang
new file mode 100644
index 0000000..28d3d22
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/default/DefaultInvalidValueStringInLeaf.yang
@@ -0,0 +1,13 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+
+    leaf MyString {
+       type string {
+          length "0..4";
+          pattern "[0-9a-fA-F]*";
+       }
+       default "2bB2bB";
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/default/DefaultInvalidValueUnionInLeaf.yang b/compiler/base/parser/src/test/resources/default/DefaultInvalidValueUnionInLeaf.yang
new file mode 100644
index 0000000..2bbb698
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/default/DefaultInvalidValueUnionInLeaf.yang
@@ -0,0 +1,15 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+
+    leaf message {
+        type union {
+            type int32;
+            type enumeration {
+                enum "unbounded";
+            }
+        }
+        default "xyz";
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/default/DefaultInvalidValueWithRangeInTypedef.yang b/compiler/base/parser/src/test/resources/default/DefaultInvalidValueWithRangeInTypedef.yang
new file mode 100644
index 0000000..c4ca002
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/default/DefaultInvalidValueWithRangeInTypedef.yang
@@ -0,0 +1,11 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    typedef hello {
+        type int32 {
+            range "1..4 | 10..20";
+        }
+        default "0";
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/default/DefaultValueBinaryInLeaf.yang b/compiler/base/parser/src/test/resources/default/DefaultValueBinaryInLeaf.yang
new file mode 100644
index 0000000..fa6fb05
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/default/DefaultValueBinaryInLeaf.yang
@@ -0,0 +1,12 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+
+    leaf message {
+        type binary {
+            length "8";
+        }
+        default "10010010";
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/default/DefaultValueBitsInLeaf.yang b/compiler/base/parser/src/test/resources/default/DefaultValueBitsInLeaf.yang
new file mode 100644
index 0000000..574df85
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/default/DefaultValueBitsInLeaf.yang
@@ -0,0 +1,20 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+
+     leaf mybits {
+         type bits {
+             bit disable-nagle {
+                 position 0;
+             }
+             bit auto-sense-speed {
+                 position 1;
+             }
+             bit Mb-only {
+                 position 2;
+             }
+         }
+         default "auto-sense-speed";
+     }
+}
diff --git a/compiler/base/parser/src/test/resources/default/DefaultValueBooleanInLeaf.yang b/compiler/base/parser/src/test/resources/default/DefaultValueBooleanInLeaf.yang
new file mode 100644
index 0000000..bb126ff
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/default/DefaultValueBooleanInLeaf.yang
@@ -0,0 +1,10 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+
+    leaf myboolean {
+        type boolean;
+        default "true";
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/default/DefaultValueDecimal64InLeaf.yang b/compiler/base/parser/src/test/resources/default/DefaultValueDecimal64InLeaf.yang
new file mode 100644
index 0000000..18e566d
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/default/DefaultValueDecimal64InLeaf.yang
@@ -0,0 +1,13 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+
+    leaf mydecimal {
+        type decimal64 {
+           fraction-digits 4;
+           range 4..6;
+        } 
+        default "5";
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/default/DefaultValueDerivedInTypedef.yang b/compiler/base/parser/src/test/resources/default/DefaultValueDerivedInTypedef.yang
new file mode 100644
index 0000000..b787b18
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/default/DefaultValueDerivedInTypedef.yang
@@ -0,0 +1,14 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+
+    typedef topInt {
+       type int64;
+       default "10";
+    }
+
+    leaf myValue {
+        type topInt;
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/default/DefaultValueEmptyInLeaf.yang b/compiler/base/parser/src/test/resources/default/DefaultValueEmptyInLeaf.yang
new file mode 100644
index 0000000..8c8bbea
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/default/DefaultValueEmptyInLeaf.yang
@@ -0,0 +1,10 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+
+    leaf enable-qos {
+        type empty;
+        default "something";
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/default/DefaultValueEnumerationInLeaf.yang b/compiler/base/parser/src/test/resources/default/DefaultValueEnumerationInLeaf.yang
new file mode 100644
index 0000000..2545976
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/default/DefaultValueEnumerationInLeaf.yang
@@ -0,0 +1,16 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+
+     leaf myenum {
+         type enumeration {
+             enum zero;
+             enum one;
+             enum seven {
+                 value 7;
+             }
+         }
+         default "one";
+     }
+}
diff --git a/compiler/base/parser/src/test/resources/default/DefaultValueInLeafSubStatement.yang b/compiler/base/parser/src/test/resources/default/DefaultValueInLeafSubStatement.yang
new file mode 100644
index 0000000..a78131d
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/default/DefaultValueInLeafSubStatement.yang
@@ -0,0 +1,15 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf invalid-interval {
+        type "uint16";
+        units "seconds";
+        default "1";
+        description "Interval before a route is declared invalid";
+        config true;
+        mandatory true;
+        status current;
+        reference "RFC 6020";
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/default/DefaultValueInMultiTypeDef.yang b/compiler/base/parser/src/test/resources/default/DefaultValueInMultiTypeDef.yang
new file mode 100644
index 0000000..d25b7c2
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/default/DefaultValueInMultiTypeDef.yang
@@ -0,0 +1,18 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+
+    typedef topInt {
+       type int64;
+       default "10";
+    }
+
+    typedef midInt {
+       type topInt;
+    }
+
+    leaf lowInt {
+        type midInt;
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/default/DefaultValueInTypeDef.yang b/compiler/base/parser/src/test/resources/default/DefaultValueInTypeDef.yang
new file mode 100644
index 0000000..b787b18
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/default/DefaultValueInTypeDef.yang
@@ -0,0 +1,14 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+
+    typedef topInt {
+       type int64;
+       default "10";
+    }
+
+    leaf myValue {
+        type topInt;
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/default/DefaultValueStringInLeaf.yang b/compiler/base/parser/src/test/resources/default/DefaultValueStringInLeaf.yang
new file mode 100644
index 0000000..1bdb1e8
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/default/DefaultValueStringInLeaf.yang
@@ -0,0 +1,13 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+
+    leaf MyString {
+       type string {
+          length "0..4";
+          pattern "[0-9a-fA-F]*";
+       }
+       default "2bB";
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/default/DefaultValueUnionInLeaf.yang b/compiler/base/parser/src/test/resources/default/DefaultValueUnionInLeaf.yang
new file mode 100644
index 0000000..e2b39c9
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/default/DefaultValueUnionInLeaf.yang
@@ -0,0 +1,15 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+
+    leaf message {
+        type union {
+            type int32;
+            type enumeration {
+                enum "unbounded";
+            }
+        }
+        default "unbounded";
+    }
+}
diff --git a/compiler/base/parser/src/test/resources/leafRefPathConcatenation.yang b/compiler/base/parser/src/test/resources/leafRefPathConcatenation.yang
new file mode 100644
index 0000000..a9b688e
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/leafRefPathConcatenation.yang
@@ -0,0 +1,20 @@
+module test {
+    namespace "urn:ietf:params:xml:ns:yang:ietf-isis";
+    prefix isis;
+    typedef isis-instance-state-ref {
+        type leafref {
+            path "/isis-prefix-ipv4-std/"
+            +"default-metric";
+        }
+    }
+    container isis-route-content {
+        leaf metric {
+            type isis-instance-state-ref ;
+        }
+    }
+    container isis-prefix-ipv4-std {
+        leaf default-metric {
+            type string;
+        }
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/processTypeDef.yang b/compiler/base/parser/src/test/resources/processTypeDef.yang
new file mode 100644
index 0000000..2875752
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/processTypeDef.yang
@@ -0,0 +1,11 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    typedef hello {
+        type String;
+    }
+    leaf invalid-interval {
+        type hello;
+    }
+}
diff --git a/compiler/base/pom.xml b/compiler/base/pom.xml
new file mode 100644
index 0000000..d29c6a3
--- /dev/null
+++ b/compiler/base/pom.xml
@@ -0,0 +1,59 @@
+<!--
+  ~ 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-yang-compiler</artifactId>
+        <version>1.12-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>onos-yang-compiler-base</artifactId>
+    <packaging>pom</packaging>
+
+    <modules>
+        <module>datamodel</module>
+        <module>translator</module>
+        <module>linker</module>
+        <module>utils</module>
+        <module>parser</module>
+        <module>tool</module>
+    </modules>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-jar-plugin</artifactId>
+                <version>3.0.2</version>
+                <configuration>
+                    <skipIfEmpty>true</skipIfEmpty>
+                </configuration>
+                <executions>
+                    <execution>
+                        <id>default</id>
+                        <goals>
+                            <goal>test-jar</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+</project>
diff --git a/compiler/base/tool/pom.xml b/compiler/base/tool/pom.xml
new file mode 100644
index 0000000..005b2a7
--- /dev/null
+++ b/compiler/base/tool/pom.xml
@@ -0,0 +1,86 @@
+<!--
+  ~ 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-yang-compiler-base</artifactId>
+        <version>1.12-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>onos-yang-compiler-tool</artifactId>
+    <version>1.12-SNAPSHOT</version>
+    <packaging>jar</packaging>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+            <version>1.7.21</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.onosproject</groupId>
+            <artifactId>onos-yang-compiler-datamodel</artifactId>
+            <version>1.12-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.onosproject</groupId>
+            <artifactId>onos-yang-compiler-translator</artifactId>
+            <version>1.12-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.onosproject</groupId>
+            <artifactId>onos-yang-compiler-linker</artifactId>
+            <version>1.12-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.onosproject</groupId>
+            <artifactId>onos-yang-compiler-utils</artifactId>
+            <version>1.12-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.onosproject</groupId>
+            <artifactId>onos-yang-compiler-parser</artifactId>
+            <version>1.12-SNAPSHOT</version>
+        </dependency>
+    </dependencies>
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-jar-plugin</artifactId>
+                <version>3.0.2</version>
+                <configuration>
+                    <skipIfEmpty>true</skipIfEmpty>
+                </configuration>
+                <executions>
+                    <execution>
+                        <id>default</id>
+                        <goals>
+                            <goal>test-jar</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+</project>
diff --git a/compiler/base/tool/src/main/java/org/onosproject/yang/compiler/base/tool/CallablePlugin.java b/compiler/base/tool/src/main/java/org/onosproject/yang/compiler/base/tool/CallablePlugin.java
new file mode 100644
index 0000000..46cc1c1
--- /dev/null
+++ b/compiler/base/tool/src/main/java/org/onosproject/yang/compiler/base/tool/CallablePlugin.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.base.tool;
+
+import java.io.IOException;
+
+/**
+ * Abstractions of the hooks that needs to be supported by plugins, which
+ * will be used in by tool to be plugin agnostic.
+ */
+public interface CallablePlugin {
+
+    /**
+     * Adds generated source directory to the compilation root.
+     */
+    void addGeneratedCodeToBundle();
+
+    /**
+     * serialize the compiled schema and place it in the appropriate location
+     * so that it will be part of the generated OSGi bundle.
+     *
+     * @throws IOException when fails to do IO operations
+     */
+    void addCompiledSchemaToBundle()
+            throws IOException;
+
+
+    /**
+     * Add the YANG files in the bundle, to support YANG display in protocols
+     * like RESTCONF.
+     *
+     * @throws IOException when fails to do IO operations
+     */
+    void addYangFilesToBundle() throws IOException;
+}
diff --git a/compiler/base/tool/src/main/java/org/onosproject/yang/compiler/base/tool/ToolConstants.java b/compiler/base/tool/src/main/java/org/onosproject/yang/compiler/base/tool/ToolConstants.java
new file mode 100644
index 0000000..b5640b6
--- /dev/null
+++ b/compiler/base/tool/src/main/java/org/onosproject/yang/compiler/base/tool/ToolConstants.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.base.tool;
+
+/**
+ * Represents common constant utility for YANG tool.
+ */
+final class ToolConstants {
+    private ToolConstants() {
+
+    }
+
+    static final String E_MISSING_INPUT = "Missing extected input ";
+    static final String E_CODE_GEN_PATH = "Missing plugin code gen directory";
+}
diff --git a/compiler/base/tool/src/main/java/org/onosproject/yang/compiler/base/tool/YangFileInfo.java b/compiler/base/tool/src/main/java/org/onosproject/yang/compiler/base/tool/YangFileInfo.java
new file mode 100644
index 0000000..84b201e
--- /dev/null
+++ b/compiler/base/tool/src/main/java/org/onosproject/yang/compiler/base/tool/YangFileInfo.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.yang.compiler.base.tool;
+
+
+import org.onosproject.yang.compiler.datamodel.YangNode;
+
+import java.util.Objects;
+
+/**
+ * Represents YANG file information.
+ */
+public class YangFileInfo {
+
+    /**
+     * YANG file name.
+     */
+    private String yangFileName;
+
+    /**
+     * Data model node after parsing YANG file.
+     */
+    private YangNode rootNode;
+
+    /**
+     * Flag to know if the root node require to be translated.
+     */
+    private boolean isForTranslator = true;
+
+    /**
+     * Returns data model node for YANG file.
+     *
+     * @return data model node for YANG file
+     */
+    public YangNode getRootNode() {
+        return rootNode;
+    }
+
+    /**
+     * Sets data model node for YANG file.
+     *
+     * @param rootNode of the Yang file
+     */
+    public void setRootNode(YangNode rootNode) {
+        this.rootNode = rootNode;
+    }
+
+    /**
+     * Returns YANG file name.
+     *
+     * @return yangFileName YANG file name
+     */
+    public String getYangFileName() {
+        return yangFileName;
+    }
+
+    /**
+     * Sets YANG file name.
+     *
+     * @param yangFileName YANG file name
+     */
+    public void setYangFileName(String yangFileName) {
+        this.yangFileName = yangFileName;
+    }
+
+    /**
+     * Returns true if node need to be translated.
+     *
+     * @return isForTranslator true if node need to be translated
+     */
+    public boolean isForTranslator() {
+        return isForTranslator;
+    }
+
+    /**
+     * Sets true if node need to be translated.
+     *
+     * @param isForTranslator true if node need to be translated
+     */
+    public void setForTranslator(boolean isForTranslator) {
+        this.isForTranslator = isForTranslator;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+
+        if (this == obj) {
+            return true;
+        }
+        if (obj instanceof YangFileInfo) {
+            final YangFileInfo other = (YangFileInfo) obj;
+            return Objects.equals(yangFileName, other.yangFileName);
+        }
+        return false;
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hashCode(yangFileName);
+    }
+}
diff --git a/compiler/base/tool/src/main/java/org/onosproject/yang/compiler/base/tool/YangToolManager.java b/compiler/base/tool/src/main/java/org/onosproject/yang/compiler/base/tool/YangToolManager.java
new file mode 100644
index 0000000..7378728
--- /dev/null
+++ b/compiler/base/tool/src/main/java/org/onosproject/yang/compiler/base/tool/YangToolManager.java
@@ -0,0 +1,332 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.base.tool;
+
+import org.onosproject.yang.compiler.parser.YangUtilsParser;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.YangUtilsParserManager;
+import org.onosproject.yang.compiler.base.tool.exception.YangToolException;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangReferenceResolver;
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.linker.YangLinker;
+import org.onosproject.yang.compiler.linker.exceptions.LinkerException;
+import org.onosproject.yang.compiler.linker.impl.YangLinkerManager;
+import org.onosproject.yang.compiler.utils.io.YangPluginConfig;
+import org.slf4j.Logger;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.ObjectOutputStream;
+import java.nio.file.Files;
+import java.nio.file.StandardCopyOption;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import static java.util.Collections.sort;
+import static org.onosproject.yang.compiler.base.tool.ToolConstants.E_CODE_GEN_PATH;
+import static org.onosproject.yang.compiler.base.tool.ToolConstants.E_MISSING_INPUT;
+import static org.onosproject.yang.compiler.datamodel.ResolvableType.YANG_DERIVED_DATA_TYPE;
+import static org.onosproject.yang.compiler.datamodel.ResolvableType.YANG_IDENTITYREF;
+import static org.onosproject.yang.compiler.linker.impl.YangLinkerUtils.resolveGroupingInDefinationScope;
+import static org.onosproject.yang.compiler.translator.tojava.JavaCodeGeneratorUtil.generateJavaCode;
+import static org.onosproject.yang.compiler.translator.tojava.JavaCodeGeneratorUtil.translatorErrorHandler;
+import static org.onosproject.yang.compiler.utils.UtilConstants.NEW_LINE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.SLASH;
+import static org.onosproject.yang.compiler.utils.UtilConstants.TEMP;
+import static org.onosproject.yang.compiler.utils.UtilConstants.YANG_RESOURCES;
+import static org.onosproject.yang.compiler.utils.io.impl.YangIoUtils.createDirectories;
+import static org.slf4j.LoggerFactory.getLogger;
+
+/**
+ * Represents ONOS YANG tool manager.
+ */
+public class YangToolManager {
+
+    public static final String DEFAULT_JAR_RES_PATH = SLASH + TEMP + SLASH +
+            YANG_RESOURCES + SLASH;
+    public static final String YANG_META_DATA = "YangMetaData";
+    public static final String SERIALIZED_FILE_EXTENSION = ".ser";
+    private static final Logger log = getLogger(YangToolManager.class);
+    private final YangUtilsParser yangUtilsParser = new YangUtilsParserManager();
+    private final YangLinker yangLinker = new YangLinkerManager();
+    private final Set<YangNode> yangNodeSet = new HashSet<>();
+    // YANG file information set.
+    private Set<YangFileInfo> yangFileInfoSet; //initialize in tool invocation;
+    private YangFileInfo curYangFileInfo = new YangFileInfo();
+
+    /**
+     * Provides a list of files from list of strings.
+     *
+     * @param yangFileInfo set of yang file information
+     * @return list of files
+     */
+    private static List<File> getListOfFile(Set<YangFileInfo> yangFileInfo) {
+        List<File> files = new ArrayList<>();
+        Iterator<YangFileInfo> yangFileIterator = yangFileInfo.iterator();
+        while (yangFileIterator.hasNext()) {
+            YangFileInfo yangFile = yangFileIterator.next();
+            if (yangFile.isForTranslator()) {
+                files.add(new File(yangFile.getYangFileName()));
+            }
+        }
+        return files;
+    }
+
+    /**
+     * Creates a YANG file info set.
+     *
+     * @param yangFileList YANG files list
+     * @return yang file info set
+     */
+    public Set<YangFileInfo> createYangFileInfoSet(List<String> yangFileList) {
+        if (yangFileInfoSet == null) {
+            yangFileInfoSet = new HashSet<>();
+        }
+        for (String yangFile : yangFileList) {
+            YangFileInfo yangFileInfo = new YangFileInfo();
+            yangFileInfo.setYangFileName(yangFile);
+            yangFileInfoSet.add(yangFileInfo);
+        }
+        return yangFileInfoSet;
+    }
+
+    /**
+     * Compile te YANG files and generate the corresponding Java files.
+     * Update the generated bundle with the schema metadata.
+     *
+     * @param yangFiles       Application YANG files
+     * @param dependentSchema inter jar linked schema nodes
+     * @param config          tool configuration
+     * @param plugin          invoking plugin
+     * @throws IOException when fails to do IO operations
+     */
+    public void compileYangFiles(Set<YangFileInfo> yangFiles,
+                                 List<YangNode> dependentSchema,
+                                 YangPluginConfig config,
+                                 CallablePlugin plugin) throws IOException {
+
+        synchronized (yangFiles) {
+            try {
+
+                if (config == null) {
+                    throw new YangToolException(E_MISSING_INPUT);
+                }
+                yangFileInfoSet = yangFiles;
+
+                if (config.getCodeGenDir() == null) {
+                    throw new YangToolException(E_CODE_GEN_PATH);
+                }
+
+                // Check if there are any file to translate, if not return.
+                if (yangFileInfoSet == null || yangFileInfoSet.isEmpty()) {
+                    // No files to translate
+                    return;
+                }
+
+                createDirectories(config.resourceGenDir());
+
+                // Resolve inter jar dependency.
+                addSchemaToFileSet(dependentSchema);
+
+                // Carry out the parsing for all the YANG files.
+                parseYangFileInfoSet();
+
+                // Resolve dependencies using linker.
+                resolveDependenciesUsingLinker();
+
+                // Perform translation to JAVA.
+                translateToJava(config);
+
+                // Serialize data model.
+                Set<YangNode> compiledSchemas = new HashSet<>();
+                for (YangFileInfo fileInfo : yangFileInfoSet) {
+                    compiledSchemas.add(fileInfo.getRootNode());
+                }
+
+                String serFileName = config.resourceGenDir() + YANG_META_DATA + SERIALIZED_FILE_EXTENSION;
+                FileOutputStream fileOutputStream = new FileOutputStream(serFileName);
+                ObjectOutputStream objectOutputStream = new ObjectOutputStream(fileOutputStream);
+                objectOutputStream.writeObject(compiledSchemas);
+                objectOutputStream.close();
+                fileOutputStream.close();
+
+                //add YANG files to JAR
+                List<File> files = getListOfFile(yangFileInfoSet);
+                String path = config.resourceGenDir();
+                File targetDir = new File(path);
+                targetDir.mkdirs();
+
+                for (File file : files) {
+                    Files.copy(file.toPath(),
+                               new File(path + file.getName()).toPath(),
+                               StandardCopyOption.REPLACE_EXISTING);
+                }
+
+                if (plugin != null) {
+                    plugin.addCompiledSchemaToBundle();
+                    plugin.addGeneratedCodeToBundle();
+                    plugin.addYangFilesToBundle();
+                }
+            } catch (IOException | ParserException e) {
+                YangToolException exception =
+                        new YangToolException(e.getMessage(), e);
+                exception.setCurYangFile(curYangFileInfo);
+
+                if (curYangFileInfo != null &&
+                        curYangFileInfo.getRootNode() != null) {
+                    try {
+                        translatorErrorHandler(curYangFileInfo.getRootNode(),
+                                               config);
+                    } catch (IOException ex) {
+                        e.printStackTrace();
+                        throw ex;
+                    }
+                }
+
+                throw exception;
+            }
+        }
+    }
+
+    /**
+     * Resolved inter-jar dependencies.
+     *
+     * @param dependentSchema dependent schema list
+     * @throws IOException when fails to do IO operations
+     */
+    private void addSchemaToFileSet(List<YangNode> dependentSchema)
+            throws IOException {
+        if (dependentSchema == null || dependentSchema.isEmpty()) {
+            return;
+        }
+
+        for (YangNode node : dependentSchema) {
+            YangFileInfo dependentFileInfo = new YangFileInfo();
+            node.setToTranslate(false);
+            dependentFileInfo.setRootNode(node);
+            dependentFileInfo.setForTranslator(false);
+            dependentFileInfo.setYangFileName(node.getName());
+            yangFileInfoSet.add(dependentFileInfo);
+        }
+    }
+
+    /**
+     * Links all the provided schema in the YANG file info set.
+     *
+     * @throws YangToolException failed to link schema
+     */
+    public void resolveDependenciesUsingLinker() {
+        createYangNodeSet();
+        try {
+            yangLinker.resolveDependencies(yangNodeSet);
+        } catch (LinkerException e) {
+            printLog(e.getFileName(), e.getLineNumber(), e.getCharPositionInLine(),
+                     e.getMessage(), e.getLocalizedMessage());
+            throw new YangToolException(e.getMessage());
+        }
+    }
+
+    /**
+     * Creates YANG nodes set.
+     */
+    public void createYangNodeSet() {
+        for (YangFileInfo yangFileInfo : yangFileInfoSet) {
+            yangNodeSet.add(yangFileInfo.getRootNode());
+        }
+    }
+
+    /**
+     * Parses all the provided YANG files and generates YANG data model tree.
+     *
+     * @throws IOException a violation in IO
+     */
+    public void parseYangFileInfoSet()
+            throws IOException {
+        for (YangFileInfo yangFileInfo : yangFileInfoSet) {
+            curYangFileInfo = yangFileInfo;
+            if (yangFileInfo.isForTranslator()) {
+                try {
+                    YangNode yangNode = yangUtilsParser.getDataModel(
+                            yangFileInfo.getYangFileName());
+                    yangFileInfo.setRootNode(yangNode);
+                    resolveGroupingInDefinationScope((YangReferenceResolver) yangNode);
+                    try {
+                        ((YangReferenceResolver) yangNode)
+                                .resolveSelfFileLinking(YANG_DERIVED_DATA_TYPE);
+                        ((YangReferenceResolver) yangNode)
+                                .resolveSelfFileLinking(YANG_IDENTITYREF);
+                    } catch (DataModelException e) {
+                        printLog(e.getFileName(), e.getLineNumber(), e
+                                .getCharPositionInLine(), e.getMessage(), e
+                                         .getLocalizedMessage());
+                    }
+                } catch (ParserException e) {
+                    printLog(e.getFileName(), e.getLineNumber(), e
+                            .getCharPositionInLine(), e.getMessage(), e
+                                     .getLocalizedMessage());
+                    throw e;
+                }
+            }
+        }
+    }
+
+    /**
+     * Translates to java code corresponding to the YANG schema.
+     *
+     * @param pluginConfig YANG plugin config
+     * @throws IOException when fails to generate java code file the current node
+     */
+    public void translateToJava(YangPluginConfig pluginConfig)
+            throws IOException {
+        List<YangNode> yangNodeSortedList = new LinkedList<>();
+        yangNodeSortedList.addAll(yangNodeSet);
+        sort(yangNodeSortedList);
+        for (YangNode node : yangNodeSortedList) {
+            if (node.isToTranslate()) {
+                generateJavaCode(node, pluginConfig);
+            }
+        }
+    }
+
+    /**
+     * Adds log info for exception.
+     *
+     * @param fileName file name
+     * @param line     line number
+     * @param position character position
+     * @param msg      error message
+     * @param localMsg local message
+     */
+    private void printLog(String fileName, int line, int position, String
+            msg, String localMsg) {
+        String logInfo = "Error in file: " + fileName;
+        if (line != 0) {
+            logInfo = logInfo + " at line: " + line + " at position: "
+                    + position;
+        }
+        if (msg != null) {
+            logInfo = logInfo + NEW_LINE + localMsg;
+        }
+        log.info(logInfo);
+    }
+}
diff --git a/compiler/base/tool/src/main/java/org/onosproject/yang/compiler/base/tool/exception/YangToolException.java b/compiler/base/tool/src/main/java/org/onosproject/yang/compiler/base/tool/exception/YangToolException.java
new file mode 100644
index 0000000..39bee83
--- /dev/null
+++ b/compiler/base/tool/src/main/java/org/onosproject/yang/compiler/base/tool/exception/YangToolException.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.base.tool.exception;
+
+import org.onosproject.yang.compiler.base.tool.YangFileInfo;
+
+/**
+ * Represents base class for exceptions in YANG tool operations.
+ */
+public class YangToolException extends RuntimeException {
+
+    private static final long serialVersionUID = 20161028L;
+
+    private YangFileInfo curYangFile;
+
+    /**
+     * Creates a new YANG tool exception with given message.
+     *
+     * @param message the detail of exception in string
+     */
+    public YangToolException(String message) {
+        super(message);
+    }
+
+    /**
+     * Creates a new tool exception from given message and cause.
+     *
+     * @param message the detail of exception in string
+     * @param cause   underlying cause of the error
+     */
+    public YangToolException(final String message, final Throwable cause) {
+        super(message, cause);
+    }
+
+    /**
+     * Creates a new tool exception from cause.
+     *
+     * @param cause underlying cause of the error
+     */
+    public YangToolException(final Throwable cause) {
+        super(cause);
+    }
+
+    /**
+     * Retrieves the current YANG files for which exception has occured.
+     *
+     * @return current YANG file
+     */
+    public YangFileInfo getCurYangFile() {
+        return curYangFile;
+    }
+
+
+    /**
+     * Update the YANG file which caused the exception.
+     *
+     * @param curYangFile YANG files being processed
+     */
+    public void setCurYangFile(YangFileInfo curYangFile) {
+        this.curYangFile = curYangFile;
+    }
+}
diff --git a/compiler/base/translator/pom.xml b/compiler/base/translator/pom.xml
new file mode 100644
index 0000000..907c084
--- /dev/null
+++ b/compiler/base/translator/pom.xml
@@ -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.
+  -->
+<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-yang-compiler-base</artifactId>
+        <version>1.12-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>onos-yang-compiler-translator</artifactId>
+    <packaging>jar</packaging>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.onosproject</groupId>
+            <artifactId>onos-yang-compiler-datamodel</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.onosproject</groupId>
+            <artifactId>onos-yang-compiler-utils</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>4.8.2</version>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-jar-plugin</artifactId>
+                <version>3.0.2</version>
+                <configuration>
+                    <skipIfEmpty>true</skipIfEmpty>
+                </configuration>
+                <executions>
+                    <execution>
+                        <id>default</id>
+                        <goals>
+                            <goal>test-jar</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+</project>
diff --git a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/exception/InvalidNodeForTranslatorException.java b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/exception/InvalidNodeForTranslatorException.java
new file mode 100644
index 0000000..b3bde15
--- /dev/null
+++ b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/exception/InvalidNodeForTranslatorException.java
@@ -0,0 +1,117 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.translator.exception;
+
+/**
+ * Represents custom translator exception for translator's operations.
+ */
+public class InvalidNodeForTranslatorException extends RuntimeException {
+
+    private static final long serialVersionUID = 20160311L;
+    private transient String fileName;
+    private transient int lineNumber;
+    private transient int charPosition;
+
+    /**
+     * Creates a new exception.
+     */
+    public InvalidNodeForTranslatorException() {
+        super();
+    }
+
+    /**
+     * Creates a new exception with given message.
+     *
+     * @param message the detail of exception in string
+     */
+    public InvalidNodeForTranslatorException(String message) {
+        super(message);
+    }
+
+    /**
+     * Creates a new exception from given message and cause.
+     *
+     * @param message the detail of exception in string
+     * @param cause   underlying cause of the error
+     */
+    public InvalidNodeForTranslatorException(final String message, final Throwable cause) {
+        super(message, cause);
+    }
+
+    /**
+     * Creates a new exception from cause.
+     *
+     * @param cause underlying cause of the error
+     */
+    public InvalidNodeForTranslatorException(final Throwable cause) {
+        super(cause);
+    }
+
+    /**
+     * Returns generated file name for the exception.
+     *
+     * @return generated file name for the exception
+     */
+    public String getFileName() {
+        return this.fileName;
+    }
+
+    /**
+     * 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.charPosition;
+    }
+
+    /**
+     * 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.charPosition = charPosition;
+    }
+
+    /**
+     * Sets file name in exception.
+     *
+     * @param fileName YANG file name
+     */
+    public void setFileName(String fileName) {
+        this.fileName = fileName;
+    }
+}
diff --git a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/exception/TranslatorException.java b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/exception/TranslatorException.java
new file mode 100644
index 0000000..4664977
--- /dev/null
+++ b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/exception/TranslatorException.java
@@ -0,0 +1,117 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.translator.exception;
+
+/**
+ * Represents custom translator exception for translator's operations.
+ */
+public class TranslatorException extends RuntimeException {
+
+    private static final long serialVersionUID = 20160311L;
+    private transient String fileName;
+    private transient int lineNumber;
+    private transient int charPosition;
+
+    /**
+     * Create a new translator exception.
+     */
+    public TranslatorException() {
+        super();
+    }
+
+    /**
+     * Creates a new translator exception with given message.
+     *
+     * @param message the detail of exception in string
+     */
+    public TranslatorException(String message) {
+        super(message);
+    }
+
+    /**
+     * Creates a new translator exception from given message and cause.
+     *
+     * @param message the detail of exception in string
+     * @param cause   underlying cause of the error
+     */
+    public TranslatorException(final String message, final Throwable cause) {
+        super(message, cause);
+    }
+
+    /**
+     * Creates a new translator exception from cause.
+     *
+     * @param cause underlying cause of the error
+     */
+    public TranslatorException(final Throwable cause) {
+        super(cause);
+    }
+
+    /**
+     * Returns line number of the exception.
+     *
+     * @return line number of the exception
+     */
+    public int getLineNumber() {
+        return this.lineNumber;
+    }
+
+    /**
+     * Returns YANG file name of the exception.
+     *
+     * @return YANG file name of the exception
+     */
+    public String getFileName() {
+        return this.fileName;
+    }
+
+    /**
+     * Returns position of the exception.
+     *
+     * @return position of the exception
+     */
+    public int getCharPositionInLine() {
+        return this.charPosition;
+    }
+
+    /**
+     * 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.charPosition = charPosition;
+    }
+
+    /**
+     * Sets file name in translator exception.
+     *
+     * @param fileName YANG file name
+     */
+    public void setFileName(String fileName) {
+        this.fileName = fileName;
+    }
+}
diff --git a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/exception/package-info.java b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/exception/package-info.java
new file mode 100644
index 0000000..57e11dc
--- /dev/null
+++ b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/exception/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.
+ */
+
+/**
+ * Custom exception for translator.
+ */
+package org.onosproject.yang.compiler.translator.exception;
diff --git a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/package-info.java b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/package-info.java
new file mode 100644
index 0000000..8589edb
--- /dev/null
+++ b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/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.
+ */
+
+/**
+ * Translator to generate class definition corresponding to YANG definition.
+ */
+package org.onosproject.yang.compiler.translator;
diff --git a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/GeneratedJavaFileType.java b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/GeneratedJavaFileType.java
new file mode 100644
index 0000000..d0ac3b6
--- /dev/null
+++ b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/GeneratedJavaFileType.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.yang.compiler.translator.tojava;
+
+/**
+ * Represents type of java files generated.
+ */
+public final class GeneratedJavaFileType {
+
+    /**
+     * Interface file.
+     */
+    public static final int INTERFACE_MASK = 1;
+
+    /**
+     * Builder interface file.
+     */
+    public static final int BUILDER_INTERFACE_MASK = 2;
+
+    /**
+     * Builder class file.
+     */
+    public static final int BUILDER_CLASS_MASK = 4;
+
+    /**
+     * Impl class file.
+     */
+    public static final int DEFAULT_CLASS_MASK = 8;
+
+    /**
+     * Interface and class file.
+     */
+    public static final int GENERATE_INTERFACE_WITH_BUILDER = 8207;
+
+    /**
+     * Java interface corresponding to rpc.
+     */
+    public static final int GENERATE_SERVICE_AND_MANAGER = 16;
+
+    /**
+     * Java class corresponding to YANG enumeration.
+     */
+    public static final int GENERATE_ENUM_CLASS = 32;
+
+    /**
+     * Java class corresponding to typedef.
+     */
+    public static final int GENERATE_TYPEDEF_CLASS = 64;
+
+    /**
+     * Java class corresponding to union.
+     */
+    public static final int GENERATE_UNION_CLASS = 128;
+
+    /**
+     * Java class corresponding to typedef.
+     */
+    static final int GENERATE_TYPE_CLASS = GENERATE_TYPEDEF_CLASS
+            | GENERATE_UNION_CLASS;
+
+    /**
+     * Event class.
+     */
+    public static final int GENERATE_EVENT_CLASS = 256;
+
+    /**
+     * Event listener class.
+     */
+    public static final int GENERATE_EVENT_LISTENER_INTERFACE = 512;
+
+    /**
+     * Event listener class.
+     */
+    public static final int GENERATE_EVENT_SUBJECT_CLASS = 1024;
+
+    /**
+     * Java classes for events.
+     */
+    public static final int GENERATE_ALL_EVENT_CLASS_MASK = GENERATE_EVENT_CLASS | GENERATE_EVENT_LISTENER_INTERFACE
+            | GENERATE_EVENT_SUBJECT_CLASS;
+
+    /**
+     * Identity listener class.
+     */
+    public static final int GENERATE_IDENTITY_CLASS = 2048;
+
+    /**
+     * Identity key class.
+     */
+    public static final int GENERATE_KEY_CLASS = 4096;
+
+    /**
+     * Creates an instance of generate java file type.
+     */
+    private GeneratedJavaFileType() {
+    }
+}
diff --git a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/GeneratedTempFileType.java b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/GeneratedTempFileType.java
new file mode 100644
index 0000000..ad410a1
--- /dev/null
+++ b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/GeneratedTempFileType.java
@@ -0,0 +1,162 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.translator.tojava;
+
+/**
+ * Represents type of temporary files generated.
+ */
+public final class GeneratedTempFileType {
+
+    /**
+     * Attributes definition temporary file.
+     */
+    public static final int ATTRIBUTES_MASK = 1; // 1 << 0
+
+    /**
+     * Getter methods for interface.
+     */
+    public static final int GETTER_FOR_INTERFACE_MASK = 1 << 1;
+
+    /**
+     * Getter methods for class.
+     */
+    public static final int GETTER_FOR_CLASS_MASK = 1 << 2;
+
+    /**
+     * Setter methods for interface.
+     */
+    public static final int SETTER_FOR_INTERFACE_MASK = 1 << 3;
+
+    /**
+     * Setter methods for class.
+     */
+    public static final int SETTER_FOR_CLASS_MASK = 1 << 4;
+
+    /**
+     * Constructor method of class.
+     */
+    public static final int CONSTRUCTOR_IMPL_MASK = 1 << 5;
+
+    /**
+     * Hash code implementation of class.
+     */
+    public static final int HASH_CODE_IMPL_MASK = 1 << 6;
+
+    /**
+     * Equals implementation of class.
+     */
+    public static final int EQUALS_IMPL_MASK = 1 << 7;
+
+    /**
+     * To string implementation of class.
+     */
+    public static final int TO_STRING_IMPL_MASK = 1 << 8;
+
+    /**
+     * Of string implementation of class.
+     */
+    public static final int OF_STRING_IMPL_MASK = 1 << 9;
+
+    /**
+     * Constructor for type class like typedef, union.
+     */
+    public static final int CONSTRUCTOR_FOR_TYPE_MASK = 1 << 10;
+
+    /**
+     * From string implementation of class.
+     */
+    public static final int FROM_STRING_IMPL_MASK = 1 << 11;
+
+    /**
+     * Enum implementation of class.
+     */
+    public static final int ENUM_IMPL_MASK = 1 << 12;
+
+    /**
+     * Rpc interface of module / sub module.
+     */
+    public static final int RPC_INTERFACE_MASK = 1 << 13;
+
+    /**
+     * Rpc implementation of module / sub module.
+     */
+    public static final int RPC_IMPL_MASK = 1 << 14;
+
+    /**
+     * Event enum implementation of class.
+     */
+    public static final int EVENT_ENUM_MASK = 1 << 15;
+
+    /**
+     * Event method implementation of class.
+     */
+    public static final int EVENT_METHOD_MASK = 1 << 16;
+
+    /**
+     * Event subject attribute implementation of class.
+     */
+    public static final int EVENT_SUBJECT_ATTRIBUTE_MASK = 1 << 17;
+
+    /**
+     * Event subject getter implementation of class.
+     */
+    public static final int EVENT_SUBJECT_GETTER_MASK = 1 << 18;
+
+    /**
+     * Event subject setter implementation of class.
+     */
+    public static final int EVENT_SUBJECT_SETTER_MASK = 1 << 19;
+
+    /**
+     * Add to list method interface for class.
+     */
+    public static final int ADD_TO_LIST_INTERFACE_MASK = 1 << 20;
+
+    /**
+     * Add to list method implementation for class.
+     */
+    public static final int ADD_TO_LIST_IMPL_MASK = 1 << 21;
+
+    /**
+     * Leaf identifier enum attributes for class.
+     */
+    public static final int LEAF_IDENTIFIER_ENUM_ATTRIBUTES_MASK = 1 << 22;
+
+    /**
+     * Is filter content match for leaves class.
+     */
+    public static final int FILTER_CONTENT_MATCH_FOR_LEAF_MASK = 1 << 23;
+
+    /**
+     * Is filter content match for leaf lists class.
+     */
+    public static final int FILTER_CONTENT_MATCH_FOR_LEAF_LIST_MASK = 1 << 24;
+
+    /**
+     * Is filter content match for nodes class.
+     */
+    public static final int FILTER_CONTENT_MATCH_FOR_NODES_MASK = 1 << 25;
+
+    /**
+     * Edit config class content for class.
+     */
+    public static final int EDIT_CONTENT_MASK = 1 << 26;
+
+    // No instantiation.
+    private GeneratedTempFileType() {
+    }
+}
diff --git a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/JavaAttributeInfo.java b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/JavaAttributeInfo.java
new file mode 100644
index 0000000..ae33803
--- /dev/null
+++ b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/JavaAttributeInfo.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.yang.compiler.translator.tojava;
+
+import org.onosproject.yang.compiler.datamodel.YangCompilerAnnotation;
+import org.onosproject.yang.compiler.datamodel.YangType;
+import org.onosproject.yang.compiler.datamodel.javadatamodel.JavaQualifiedTypeInfo;
+import org.onosproject.yang.compiler.translator.exception.TranslatorException;
+
+import static org.onosproject.yang.compiler.translator.tojava.utils.JavaFileGeneratorUtils.isTypeLeafref;
+import static org.onosproject.yang.compiler.translator.tojava.utils.JavaFileGeneratorUtils.isTypeNameLeafref;
+
+/**
+ * Represents the attribute info corresponding to class/interface generated.
+ */
+public final class JavaAttributeInfo {
+
+    /**
+     * The data type info of attribute.
+     */
+    private YangType<?> attrType;
+
+    /**
+     * Name of the attribute.
+     */
+    private String name;
+
+    /**
+     * If the added attribute is a list of info.
+     */
+    private boolean isListAttr;
+
+    /**
+     * If the added attribute has to be accessed in a fully qualified manner.
+     */
+    private boolean isQualifiedName;
+
+    /**
+     * The class info will be used to set the attribute type and package info
+     * will be use for qualified name.
+     */
+    private JavaQualifiedTypeInfoTranslator importInfo;
+
+    /**
+     * Compiler annotation attribute info.
+     */
+    private YangCompilerAnnotation compilerAnnotation;
+
+    /**
+     * If conflict occurs.
+     */
+    private boolean isIntConflict;
+
+    /**
+     * If conflict occurs.
+     */
+    private boolean isLongConflict;
+
+    /**
+     * If conflict occurs.
+     */
+    private boolean isShortConflict;
+
+    /**
+     * current holder or count in type list of attribute for from string method.
+     */
+    private String curHolderOrCount;
+
+    /**
+     * Creates a java attribute info object.
+     */
+    private JavaAttributeInfo() {
+    }
+
+    /**
+     * Creates object of java attribute info.
+     *
+     * @param attrType        YANG type
+     * @param name            attribute name
+     * @param isListAttr      is list attribute
+     * @param isQualifiedName is qualified name
+     */
+    public JavaAttributeInfo(YangType<?> attrType, String name, boolean isListAttr, boolean isQualifiedName) {
+        this.attrType = attrType;
+        this.name = name;
+        this.isListAttr = isListAttr;
+        this.isQualifiedName = isQualifiedName;
+    }
+
+    /**
+     * Returns the data type info of attribute.
+     *
+     * @return the data type info of attribute
+     */
+    public YangType<?> getAttributeType() {
+        return attrType;
+    }
+
+    /**
+     * Sets the data type info of attribute.
+     *
+     * @param type the data type info of attribute
+     */
+    public void setAttributeType(YangType<?> type) {
+        attrType = type;
+    }
+
+    /**
+     * Returns name of the attribute.
+     *
+     * @return name of the attribute
+     */
+    public String getAttributeName() {
+
+        if (name == null) {
+            throw new TranslatorException("Expected java attribute name is null");
+        }
+        return name;
+    }
+
+    /**
+     * Sets name of the attribute.
+     *
+     * @param attrName name of the attribute
+     */
+    public void setAttributeName(String attrName) {
+        name = attrName;
+    }
+
+    /**
+     * Returns if the added attribute is a list of info.
+     *
+     * @return the if the added attribute is a list of info
+     */
+    public boolean isListAttr() {
+        return isListAttr;
+    }
+
+    /**
+     * Sets if the added attribute is a list of info.
+     *
+     * @param isList if the added attribute is a list of info
+     */
+    private void setListAttr(boolean isList) {
+        isListAttr = isList;
+    }
+
+    /**
+     * Returns if the added attribute has to be accessed in a fully qualified
+     * manner.
+     *
+     * @return the if the added attribute has to be accessed in a fully
+     * qualified manner.
+     */
+    public boolean isQualifiedName() {
+        return isQualifiedName;
+    }
+
+    /**
+     * Sets if the added attribute has to be accessed in a fully qualified
+     * manner.
+     *
+     * @param isQualified if the added attribute has to be accessed in a fully
+     *                    qualified manner
+     */
+    public void setIsQualifiedAccess(boolean isQualified) {
+        isQualifiedName = isQualified;
+    }
+
+    /**
+     * Returns the import info for the attribute type. It will be null, if the type
+     * is basic built-in java type.
+     *
+     * @return import info
+     */
+    public JavaQualifiedTypeInfoTranslator getImportInfo() {
+        return importInfo;
+    }
+
+    /**
+     * Sets the import info for the attribute type.
+     *
+     * @param importInfo import info for the attribute type
+     */
+    public void setImportInfo(JavaQualifiedTypeInfoTranslator importInfo) {
+        this.importInfo = importInfo;
+    }
+
+    /**
+     * Returns the compiler annotation.
+     *
+     * @return compiler annotation info
+     */
+    public YangCompilerAnnotation getCompilerAnnotation() {
+        return compilerAnnotation;
+    }
+
+    /**
+     * Sets the compiler annotation.
+     *
+     * @param compilerAnnotation the compiler annotation to set
+     */
+    public void setCompilerAnnotation(YangCompilerAnnotation compilerAnnotation) {
+        this.compilerAnnotation = compilerAnnotation;
+    }
+
+    /**
+     * Returns true if conflict between int and uint.
+     *
+     * @return true if conflict between int and uInt
+     */
+    public boolean isIntConflict() {
+        return isIntConflict;
+    }
+
+    /**
+     * Sets true if conflict between int and uInt.
+     *
+     * @param intConflict true if conflict between int and uInt
+     */
+    void setIntConflict(boolean intConflict) {
+        isIntConflict = intConflict;
+    }
+
+    /**
+     * Returns true if conflict between long and uLong.
+     *
+     * @return true if conflict between long and uLong
+     */
+    public boolean isLongConflict() {
+        return isLongConflict;
+    }
+
+    /**
+     * Sets true if conflict between long and uLong.
+     *
+     * @param longConflict true if conflict between long and uLong
+     */
+    void setLongConflict(boolean longConflict) {
+        isLongConflict = longConflict;
+    }
+
+    /**
+     * Returns true if conflict between short and uint8.
+     *
+     * @return true if conflict between short and uint8
+     */
+    public boolean isShortConflict() {
+        return isShortConflict;
+    }
+
+    /**
+     * Sets true if conflict between short and uint8.
+     *
+     * @param shortConflict true if conflict between short and uint8
+     */
+    public void setShortConflict(boolean shortConflict) {
+        isShortConflict = shortConflict;
+    }
+
+    /**
+     * Returns java attribute info.
+     *
+     * @param importInfo        java qualified type info
+     * @param attributeName     attribute name
+     * @param attributeType     attribute type
+     * @param isQualifiedAccess is the attribute a qualified access
+     * @param isListAttribute   is list attribute
+     * @return java attribute info.
+     */
+    public static JavaAttributeInfo getAttributeInfoForTheData(JavaQualifiedTypeInfo importInfo,
+                                                               String attributeName,
+                                                               YangType<?> attributeType, boolean isQualifiedAccess,
+                                                               boolean isListAttribute) {
+
+        if (attributeType != null) {
+            attributeType = isTypeLeafref(attributeType);
+        }
+        attributeName = isTypeNameLeafref(attributeName, attributeType);
+        JavaAttributeInfo newAttr = new JavaAttributeInfo();
+        newAttr.setImportInfo((JavaQualifiedTypeInfoTranslator) importInfo);
+        newAttr.setAttributeName(attributeName);
+        newAttr.setAttributeType(attributeType);
+        newAttr.setIsQualifiedAccess(isQualifiedAccess);
+        newAttr.setListAttr(isListAttribute);
+
+        return newAttr;
+    }
+
+    /**
+     * Returns java attribute info.
+     *
+     * @param importInfo         java qualified type info
+     * @param attributeName      attribute name
+     * @param attributeType      attribute type
+     * @param isQualifiedAccess  is the attribute a qualified access
+     * @param isListAttribute    is list attribute
+     * @param compilerAnnotation compiler annotation
+     * @return java attribute info.
+     */
+    static JavaAttributeInfo getAttributeInfoForTheData(JavaQualifiedTypeInfoTranslator importInfo,
+                                                        String attributeName, YangType<?> attributeType,
+                                                        boolean isQualifiedAccess, boolean isListAttribute,
+                                                        YangCompilerAnnotation compilerAnnotation) {
+        JavaAttributeInfo newAttr = getAttributeInfoForTheData(importInfo, attributeName, attributeType,
+                                                               isQualifiedAccess, isListAttribute);
+
+        newAttr.setCompilerAnnotation(compilerAnnotation);
+
+        return newAttr;
+    }
+
+    /**
+     * Returns current holder or count in type list of attribute for from string method.
+     *
+     * @return current holder or count in type list of attribute for from string method
+     */
+    public String getCurHolderOrCount() {
+        return curHolderOrCount;
+    }
+
+    /**
+     * Sets current holder or count in type list of attribute for from string method.
+     *
+     * @param curHolderOrCount current holder or count in type list of attribute for from string method
+     */
+    public void setCurHolderOrCount(String curHolderOrCount) {
+        this.curHolderOrCount = curHolderOrCount;
+    }
+}
diff --git a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/JavaCodeGenerator.java b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/JavaCodeGenerator.java
new file mode 100644
index 0000000..d0f499e
--- /dev/null
+++ b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/JavaCodeGenerator.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.translator.tojava;
+
+import org.onosproject.yang.compiler.translator.exception.TranslatorException;
+import org.onosproject.yang.compiler.utils.io.YangPluginConfig;
+
+import java.io.IOException;
+
+/**
+ * Abstraction of an entity which provides Code generator functionalities.
+ */
+public interface JavaCodeGenerator {
+
+    /**
+     * Traverse the schema of application and generate corresponding code.
+     *
+     * @param yangPlugin YANG plugin config
+     * @throws TranslatorException when fails to translate the data model tree
+     */
+    void generateCodeEntry(YangPluginConfig yangPlugin)
+            throws TranslatorException;
+
+    /**
+     * Traverse the schema of application and generate corresponding code.
+     *
+     * @throws TranslatorException when fails to generate java code
+     * @throws IOException         a violation in IO rule
+     */
+    void generateCodeExit()
+            throws TranslatorException, IOException;
+}
diff --git a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/JavaCodeGeneratorInfo.java b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/JavaCodeGeneratorInfo.java
new file mode 100644
index 0000000..4724afb
--- /dev/null
+++ b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/JavaCodeGeneratorInfo.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.translator.tojava;
+
+import org.onosproject.yang.compiler.datamodel.LocationInfo;
+
+/**
+ * Represents YANG java info containing interface for java code generator, java
+ * file information, java import data and temp java code fragment files. This
+ * interface serves as a generic interface and help to unify the generate code
+ * entry function.
+ */
+public interface JavaCodeGeneratorInfo
+        extends JavaFileInfoContainer, TempJavaCodeFragmentFilesContainer, LocationInfo {
+}
diff --git a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/JavaCodeGeneratorUtil.java b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/JavaCodeGeneratorUtil.java
new file mode 100644
index 0000000..1910d65
--- /dev/null
+++ b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/JavaCodeGeneratorUtil.java
@@ -0,0 +1,316 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.translator.tojava;
+
+import org.onosproject.yang.compiler.datamodel.TraversalType;
+import org.onosproject.yang.compiler.datamodel.YangInput;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangNodeType;
+import org.onosproject.yang.compiler.datamodel.YangOutput;
+import org.onosproject.yang.compiler.translator.exception.InvalidNodeForTranslatorException;
+import org.onosproject.yang.compiler.translator.exception.TranslatorException;
+import org.onosproject.yang.compiler.utils.io.YangPluginConfig;
+
+import java.io.IOException;
+
+import static org.onosproject.yang.compiler.datamodel.TraversalType.CHILD;
+import static org.onosproject.yang.compiler.datamodel.TraversalType.PARENT;
+import static org.onosproject.yang.compiler.datamodel.TraversalType.ROOT;
+import static org.onosproject.yang.compiler.datamodel.TraversalType.SIBILING;
+import static org.onosproject.yang.compiler.utils.io.impl.YangIoUtils.searchAndDeleteTempDir;
+
+/**
+ * Representation of java code generator based on application schema.
+ */
+public final class JavaCodeGeneratorUtil {
+
+    /**
+     * Creates a java code generator utility object.
+     */
+    private JavaCodeGeneratorUtil() {
+    }
+
+    /**
+     * Generates Java code files corresponding to the YANG schema.
+     *
+     * @param rootNode   root node of the data model tree
+     * @param yangPlugin YANG plugin config
+     * @throws TranslatorException when fails to generate java code file the current node
+     * @throws IOException         when fails to do IO operations
+     */
+    public static void generateJavaCode(YangNode rootNode, YangPluginConfig yangPlugin)
+            throws TranslatorException, IOException {
+
+        YangNode codeGenNode = rootNode;
+        TraversalType curTraversal = ROOT;
+
+        while (codeGenNode != null) {
+            if (curTraversal != PARENT) {
+                if (!(codeGenNode instanceof JavaCodeGenerator)) {
+                    throw new TranslatorException("Unsupported node to generate code " +
+                                                          codeGenNode.getName() + " in " + codeGenNode.getLineNumber() + " at "
+                                                          + codeGenNode.getCharPosition() + " in " + codeGenNode.getFileName());
+                }
+                try {
+                    generateCodeEntry(codeGenNode, yangPlugin, rootNode);
+                    codeGenNode.setNameSpaceAndAddToParentSchemaMap();
+                } catch (InvalidNodeForTranslatorException e) {
+                    if (codeGenNode.getNextSibling() != null) {
+                        curTraversal = SIBILING;
+                        codeGenNode = codeGenNode.getNextSibling();
+                    } else {
+                        curTraversal = PARENT;
+                        codeGenNode = codeGenNode.getParent();
+                    }
+                    continue;
+                } catch (Exception e) {
+                    e.printStackTrace();
+                    close(codeGenNode, yangPlugin, rootNode);
+                    throw new TranslatorException(e.getMessage());
+                }
+            }
+            if (curTraversal != PARENT && codeGenNode.getChild() != null) {
+                curTraversal = CHILD;
+                codeGenNode = codeGenNode.getChild();
+            } else if (codeGenNode.getNextSibling() != null) {
+                try {
+                    generateCodeExit(codeGenNode, yangPlugin, rootNode);
+                } catch (Exception e) {
+                    e.printStackTrace();
+                    close(codeGenNode, yangPlugin, rootNode);
+                    throw new TranslatorException(e.getMessage());
+                }
+                curTraversal = SIBILING;
+                codeGenNode = codeGenNode.getNextSibling();
+            } else {
+                try {
+                    generateCodeExit(codeGenNode, yangPlugin, rootNode);
+                } catch (Exception e) {
+                    e.printStackTrace();
+                    close(codeGenNode, yangPlugin, rootNode);
+                    throw new TranslatorException(e.getMessage());
+                }
+                curTraversal = PARENT;
+                codeGenNode = codeGenNode.getParent();
+            }
+        }
+    }
+
+    /**
+     * Generates the current nodes code snippet.
+     *
+     * @param codeGenNode current data model node for which the code needs to be generated
+     * @param yangPlugin  YANG plugin config
+     * @param rootNode    YANG root node
+     * @throws TranslatorException when fails to generate java code file the current node
+     * @throws IOException         when fails to do IO operations
+     */
+    private static void generateCodeEntry(YangNode codeGenNode,
+                                          YangPluginConfig yangPlugin,
+                                          YangNode rootNode)
+            throws TranslatorException, IOException {
+
+        if (codeGenNode instanceof JavaCodeGenerator) {
+            ((JavaCodeGenerator) codeGenNode).generateCodeEntry(yangPlugin);
+        } else {
+            close(codeGenNode, yangPlugin, rootNode);
+            throw new TranslatorException(
+                    "Generated data model node cannot be translated to target language code for " +
+                            codeGenNode.getName() + " in " + codeGenNode.getLineNumber()
+                            + " at " + codeGenNode.getCharPosition() + " in " + codeGenNode.getFileName());
+        }
+    }
+
+    /**
+     * Generates the current nodes code target code from the snippet.
+     *
+     * @param codeGenNode  current data model node for which the code needs to be generated
+     * @param pluginConfig plugin configurations
+     * @param rootNode     YANG root node
+     * @throws TranslatorException when fails to generate java code file the current node
+     * @throws IOException         when fails to do IO operations
+     */
+    private static void generateCodeExit(YangNode codeGenNode,
+                                         YangPluginConfig pluginConfig,
+                                         YangNode rootNode)
+            throws TranslatorException, IOException {
+
+        if (codeGenNode instanceof JavaCodeGenerator) {
+            ((JavaCodeGenerator) codeGenNode).generateCodeExit();
+        } else {
+            close(codeGenNode, pluginConfig, rootNode);
+            throw new TranslatorException(
+                    "Generated data model node cannot be translated to target language code for " +
+                            codeGenNode.getName() + " in " + codeGenNode.getLineNumber()
+                            + " at " + codeGenNode.getCharPosition() + " in " + codeGenNode.getFileName());
+        }
+    }
+
+    /**
+     * Free other YANG nodes of data-model tree when error occurs while file generation of current node.
+     *
+     * @param freedNode current data model node
+     */
+    private static void freeRestResources(YangNode freedNode) {
+
+        if (freedNode != null) {
+            YangNode tempNode = freedNode;
+            TraversalType curTraversal = ROOT;
+
+            while (freedNode != tempNode.getParent()) {
+
+                if (curTraversal != PARENT && freedNode.getChild() != null) {
+                    curTraversal = CHILD;
+                    freedNode = freedNode.getChild();
+                } else if (freedNode.getNextSibling() != null) {
+                    curTraversal = SIBILING;
+                    if (freedNode != tempNode) {
+                        free(freedNode);
+                    }
+                    freedNode = freedNode.getNextSibling();
+                } else {
+                    curTraversal = PARENT;
+                    if (freedNode != tempNode) {
+                        free(freedNode);
+                    }
+                    freedNode = freedNode.getParent();
+                }
+            }
+        }
+    }
+
+    /**
+     * Free the current node.
+     *
+     * @param node YANG node
+     */
+    private static void free(YangNode node) {
+
+        YangNode parent = node.getParent();
+        parent.setChild(null);
+
+        if (node.getNextSibling() != null) {
+            parent.setChild(node.getNextSibling());
+        } else if (node.getPreviousSibling() != null) {
+            parent.setChild(node.getPreviousSibling());
+        }
+        node = null;
+    }
+
+    /**
+     * Delete Java code files corresponding to the YANG schema.
+     *
+     * @param rootNode         root node of data-model tree
+     * @param yangPluginConfig plugin configurations
+     * @throws IOException when fails to delete java code file the current node
+     */
+    public static void translatorErrorHandler(YangNode rootNode, YangPluginConfig yangPluginConfig)
+            throws IOException {
+
+        if (rootNode != null) {
+
+            // Start removing all open files.
+            YangNode tempNode = rootNode;
+            YangNode curNode = tempNode.getChild();
+            TraversalType curTraversal = ROOT;
+
+            while (tempNode != null) {
+
+                if (curTraversal != PARENT) {
+                    close(tempNode, yangPluginConfig, rootNode);
+                }
+                if (curTraversal != PARENT && tempNode.getChild() != null) {
+                    curTraversal = CHILD;
+                    tempNode = tempNode.getChild();
+                } else if (tempNode.getNextSibling() != null) {
+                    curTraversal = SIBILING;
+                    tempNode = tempNode.getNextSibling();
+                } else {
+                    curTraversal = PARENT;
+                    tempNode = tempNode.getParent();
+                }
+            }
+
+            freeRestResources(curNode);
+        }
+    }
+
+    /**
+     * Closes all the current open file handles of node and delete all generated files.
+     *
+     * @param node       current YANG node
+     * @param yangPlugin plugin configurations
+     * @param rootNode   YANG root node
+     * @throws IOException when fails to do IO operations
+     */
+    private static void close(YangNode node, YangPluginConfig yangPlugin,
+                              YangNode rootNode)
+            throws IOException {
+        if (node instanceof JavaCodeGenerator && ((TempJavaCodeFragmentFilesContainer) node)
+                .getTempJavaCodeFragmentFiles() != null) {
+            ((TempJavaCodeFragmentFilesContainer) node).getTempJavaCodeFragmentFiles().freeTemporaryResources(true);
+        }
+        if (rootNode != null) {
+            JavaFileInfoTranslator javaFileInfo = ((JavaFileInfoContainer) rootNode).getJavaFileInfo();
+            if (javaFileInfo.getPackage() != null) {
+                searchAndDeleteTempDir(javaFileInfo.getBaseCodeGenPath() +
+                                               javaFileInfo.getPackageFilePath());
+            } else {
+                searchAndDeleteTempDir(yangPlugin.getCodeGenDir());
+            }
+        }
+    }
+
+    /**
+     * Searches child node in data model tree.
+     *
+     * @param parentNode parent node
+     * @param nodeType   node type
+     * @param nodeName   node name
+     * @return child node
+     */
+    public static YangNode searchYangNode(YangNode parentNode, YangNodeType nodeType, String nodeName) {
+        YangNode child = parentNode.getChild();
+        TraversalType curTraversal = ROOT;
+        if (child == null) {
+            throw new IllegalArgumentException("Given parent node does not contain any child nodes");
+        }
+
+        while (child != null) {
+            if (curTraversal != PARENT) {
+                if (child instanceof YangInput || child instanceof YangOutput) {
+                    if (child.getNodeType().equals(nodeType)) {
+                        return child;
+                    }
+                } else if (child.getName().equals(nodeName) && child.getNodeType().equals(nodeType)) {
+                    return child;
+                }
+            }
+            if (curTraversal != PARENT && child.getChild() != null) {
+                curTraversal = CHILD;
+                child = child.getChild();
+            } else if (child.getNextSibling() != null) {
+                curTraversal = SIBILING;
+                child = child.getNextSibling();
+            } else {
+                curTraversal = PARENT;
+                child = child.getParent();
+            }
+        }
+        return null;
+    }
+}
diff --git a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/JavaFileInfoContainer.java b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/JavaFileInfoContainer.java
new file mode 100644
index 0000000..f7db41b
--- /dev/null
+++ b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/JavaFileInfoContainer.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.yang.compiler.translator.tojava;
+
+/**
+ * Represents data model nodes which are required to generate java classes, need to support
+ * java file info.
+ */
+public interface JavaFileInfoContainer {
+
+    /**
+     * Returns the generated java file information.
+     *
+     * @return generated java file information
+     */
+    JavaFileInfoTranslator getJavaFileInfo();
+
+    /**
+     * Sets the java file info object.
+     *
+     * @param javaInfo java file info object
+     */
+    void setJavaFileInfo(JavaFileInfoTranslator javaInfo);
+}
diff --git a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/JavaFileInfoTranslator.java b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/JavaFileInfoTranslator.java
new file mode 100644
index 0000000..053e3db
--- /dev/null
+++ b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/JavaFileInfoTranslator.java
@@ -0,0 +1,137 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.translator.tojava;
+
+import org.onosproject.yang.compiler.datamodel.javadatamodel.JavaFileInfo;
+import org.onosproject.yang.compiler.utils.io.YangPluginConfig;
+
+/**
+ * Represents cached java file handle, which supports the addition of member attributes and
+ * methods.
+ */
+public class JavaFileInfoTranslator extends JavaFileInfo {
+
+    private static final long serialVersionUID = 806102633L;
+
+    /**
+     * The type(s) of java source file(s) to be generated when the cached file
+     * handle is closed.
+     */
+    private transient int genFileTypes;
+
+    /**
+     * File generation directory path.
+     */
+    private transient String relativeFilePath;
+
+    /**
+     * File generation base directory path.
+     */
+    private transient String codeGenDirFilePath;
+
+    /**
+     * Plugin configuration for naming convention.
+     */
+    private transient YangPluginConfig pluginConfig;
+
+    /**
+     * Returns the types of files being generated corresponding to the YANG
+     * definition.
+     *
+     * @return the types of files being generated corresponding to the YANG
+     * definition
+     */
+    public int getGeneratedFileTypes() {
+        return genFileTypes;
+    }
+
+    /**
+     * Sets the types of files being generated corresponding to the YANG
+     * definition.
+     *
+     * @param fileTypes the types of files being generated corresponding to the
+     *                  YANG definition
+     */
+    public void setGeneratedFileTypes(int fileTypes) {
+        genFileTypes = fileTypes;
+    }
+
+    /**
+     * Adds the types of files being generated corresponding to the YANG
+     * definition.
+     *
+     * @param fileTypes the types of files being generated corresponding to the
+     *                  YANG definition
+     */
+    public void addGeneratedFileTypes(int fileTypes) {
+        genFileTypes |= fileTypes;
+    }
+
+    /**
+     * Sets directory package path for code generation.
+     *
+     * @param path directory package path for code generation
+     */
+    public void setPackageFilePath(String path) {
+        relativeFilePath = path;
+    }
+
+    /**
+     * Returns directory package path for code generation.
+     *
+     * @return directory package path for code generation
+     */
+    public String getPackageFilePath() {
+        return relativeFilePath;
+    }
+
+    /**
+     * Returns base directory package path for code generation.
+     *
+     * @return directory package path for code generation
+     */
+    public String getBaseCodeGenPath() {
+        return codeGenDirFilePath;
+    }
+
+    /**
+     * Sets base directory package path for code generation.
+     *
+     * @param path base directory path
+     */
+    public void setBaseCodeGenPath(String path) {
+        codeGenDirFilePath = path;
+    }
+
+    /**
+     * Returns plugin configurations.
+     *
+     * @return the pluginConfig
+     */
+    public YangPluginConfig getPluginConfig() {
+        return pluginConfig;
+    }
+
+    /**
+     * Sets plugin configurations.
+     *
+     * @param pluginConfig the pluginConfig to set
+     */
+    public void setPluginConfig(YangPluginConfig pluginConfig) {
+        this.pluginConfig = pluginConfig;
+    }
+}
diff --git a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/JavaImportData.java b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/JavaImportData.java
new file mode 100644
index 0000000..59647f9
--- /dev/null
+++ b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/JavaImportData.java
@@ -0,0 +1,334 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.yang.compiler.translator.tojava;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.SortedSet;
+import java.util.TreeSet;
+
+import static java.util.Collections.sort;
+import static java.util.Collections.unmodifiableSortedSet;
+import static org.onosproject.yang.compiler.translator.tojava.utils.StringGenerator.getImportString;
+import static org.onosproject.yang.compiler.utils.UtilConstants.ABSTRACT_EVENT;
+import static org.onosproject.yang.compiler.utils.UtilConstants.ARRAY_LIST_IMPORT;
+import static org.onosproject.yang.compiler.utils.UtilConstants.BIG_INTEGER;
+import static org.onosproject.yang.compiler.utils.UtilConstants.BITSET;
+import static org.onosproject.yang.compiler.utils.UtilConstants.COLLECTION_IMPORTS;
+import static org.onosproject.yang.compiler.utils.UtilConstants.EMPTY_STRING;
+import static org.onosproject.yang.compiler.utils.UtilConstants.EVENT_LISTENER;
+import static org.onosproject.yang.compiler.utils.UtilConstants.JAVA_LANG;
+import static org.onosproject.yang.compiler.utils.UtilConstants.JAVA_MATH;
+import static org.onosproject.yang.compiler.utils.UtilConstants.JAVA_UTIL_OBJECTS_IMPORT_CLASS;
+import static org.onosproject.yang.compiler.utils.UtilConstants.JAVA_UTIL_PKG;
+import static org.onosproject.yang.compiler.utils.UtilConstants.JAVA_UTIL_REGEX_PKG;
+import static org.onosproject.yang.compiler.utils.UtilConstants.LIST;
+import static org.onosproject.yang.compiler.utils.UtilConstants.LISTENER_SERVICE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.MAP;
+import static org.onosproject.yang.compiler.utils.UtilConstants.ONOS_EVENT_PKG;
+import static org.onosproject.yang.compiler.utils.UtilConstants.PATTERN;
+import static org.onosproject.yang.compiler.utils.UtilConstants.QUEUE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.SET;
+
+/**
+ * Represents that generated Java file can contain imports.
+ */
+public class JavaImportData {
+
+    /**
+     * Flag to denote if any list in imported.
+     */
+    private boolean isListToImport;
+    /**
+     * Flag to denote if any queue is imported due to compiler annotation.
+     */
+    private boolean isQueueToImport;
+    /**
+     * Flag to denote if any set is imported due to compiler annotation.
+     */
+    private boolean isSetToImport;
+    /**
+     * Flag to denote if any map is imported due to compiler annotation.
+     */
+    private boolean isMapToImport;
+
+    /**
+     * Sorted set of import info, to be used to maintain the set of classes to
+     * be imported in the generated class.
+     */
+    private final SortedSet<JavaQualifiedTypeInfoTranslator> importSet;
+
+    /**
+     * Creates java import data object.
+     */
+    public JavaImportData() {
+        importSet = new TreeSet<>();
+    }
+
+
+    /**
+     * Sets the status of importing list.
+     *
+     * @param isList status to mention list is bing imported
+     */
+    void setIfListImported(boolean isList) {
+        isListToImport = isList;
+    }
+
+
+    /**
+     * Sets the status of the queue to be imported due to compiler annotations.
+     *
+     * @param queueToImport status of queue to import
+     */
+    void setQueueToImport(boolean queueToImport) {
+        isQueueToImport = queueToImport;
+    }
+
+    /**
+     * Sets the status of the set to be imported due to compiler annotations.
+     *
+     * @param setToImport status of set to import
+     */
+    void setSetToImport(boolean setToImport) {
+        isSetToImport = setToImport;
+    }
+
+    /**
+     * Sets true if map is imported due to compiler annotations.
+     *
+     * @param mapToImport true if map is imported due to compiler annotations
+     */
+    void setMapToImport(boolean mapToImport) {
+        isMapToImport = mapToImport;
+    }
+
+    /**
+     * Returns the set containing the imported class/interface info.
+     *
+     * @return the set containing the imported class/interface info
+     */
+    public SortedSet<JavaQualifiedTypeInfoTranslator> getImportSet() {
+        return unmodifiableSortedSet(importSet);
+    }
+
+    /**
+     * Adds an imported class/interface info if it is not already part of the
+     * collection.
+     * <p>
+     * If already part of the collection, check if the packages are same, if so
+     * then return true, to denote it is already in the import collection, and
+     * it can be accessed without qualified access. If the packages do not
+     * match, then do not add to the import collection, and return false to
+     * denote, it is not added to import collection and needs to be accessed in
+     * a qualified manner.
+     *
+     * @param newImportInfo class/interface info being imported
+     * @param className     name of the call being generated
+     * @param classPkg      generated class package
+     * @return qualified access status of the import node being added
+     */
+    public boolean addImportInfo(JavaQualifiedTypeInfoTranslator newImportInfo,
+                                 String className, String classPkg) {
+
+        if (newImportInfo.getClassInfo().contentEquals(className)) {
+            /*
+             * If the current class name is same as the attribute class name,
+             * then the attribute must be accessed in a qualified manner.
+             */
+            return true;
+        } else if (newImportInfo.getPkgInfo() == null) {
+            /*
+             * If the package info is null, then it is not a candidate for import
+              * / qualified access
+             */
+            return false;
+        }
+
+        /*
+         * If the attribute type is having the package info, it is contender
+         * for import list and also need to check if it needs to be a
+         * qualified access.
+         */
+        if (newImportInfo.getPkgInfo().contentEquals(classPkg)) {
+            /*
+             * Package of the referred attribute and the generated class is same,
+              * so no need import
+             * or qualified access.
+             */
+            return false;
+        }
+
+        for (JavaQualifiedTypeInfoTranslator curImportInfo : getImportSet()) {
+            if (curImportInfo.getClassInfo()
+                    .contentEquals(newImportInfo.getClassInfo())) {
+                return !curImportInfo.getPkgInfo()
+                        .contentEquals(newImportInfo.getPkgInfo());
+            }
+        }
+
+        /*
+         * Import is added, so it is a member for non qualified access
+         */
+        importSet.add(newImportInfo);
+        return false;
+    }
+
+    /**
+     * Returns import for class.
+     *
+     * @param isForInterface if needs to check for interface
+     * @return imports for class
+     */
+    public List<String> getImports(boolean isForInterface) {
+
+        String importString;
+        List<String> imports = new ArrayList<>();
+        boolean check;
+        for (JavaQualifiedTypeInfoTranslator importInfo : getImportSet()) {
+            check = importInfo.isForInterface();
+            if (!isForInterface) {
+                check = true;
+            }
+            if (!importInfo.getPkgInfo().equals(EMPTY_STRING) &&
+                    importInfo.getClassInfo() != null &&
+                    !importInfo.getPkgInfo().equals(JAVA_LANG) &&
+                    check) {
+                importString = getImportString(importInfo.getPkgInfo(), importInfo
+                        .getClassInfo());
+                imports.add(importString);
+            }
+        }
+        if (isListToImport) {
+            imports.add(getImportForList());
+            if (!isForInterface) {
+                imports.add(ARRAY_LIST_IMPORT);
+            }
+        }
+        if (isQueueToImport) {
+            imports.add(getImportForQueue());
+        }
+        if (isSetToImport) {
+            imports.add(getImportForSet());
+        }
+        if (isMapToImport) {
+            imports.add(getImportForMap());
+        }
+
+        sort(imports);
+        return imports;
+    }
+
+    /**
+     * Returns import for hash and equals method.
+     *
+     * @return import for hash and equals method
+     */
+    String getImportForHashAndEquals() {
+        return getImportString(JAVA_UTIL_PKG,
+                               JAVA_UTIL_OBJECTS_IMPORT_CLASS);
+    }
+
+    /**
+     * Returns import for to bitset method.
+     *
+     * @return import for to bitset method
+     */
+    public String getImportForToBitSet() {
+        return getImportString(JAVA_UTIL_PKG, BITSET);
+    }
+
+    /**
+     * Returns import for to bitset method.
+     *
+     * @return import for to bitset method
+     */
+    public String getImportForPattern() {
+        return getImportString(JAVA_UTIL_REGEX_PKG, PATTERN);
+    }
+
+    /**
+     * Returns import for list attribute.
+     *
+     * @return import for list attribute
+     */
+    private String getImportForList() {
+        return getImportString(COLLECTION_IMPORTS, LIST);
+    }
+
+    /**
+     * Returns import for map attribute.
+     *
+     * @return import for map attribute
+     */
+    private String getImportForMap() {
+        return getImportString(COLLECTION_IMPORTS, MAP);
+    }
+
+    /**
+     * Returns import for queue attribute.
+     *
+     * @return import for queue attribute
+     */
+    private String getImportForQueue() {
+        return getImportString(COLLECTION_IMPORTS, QUEUE);
+    }
+
+    /**
+     * Returns import for set attribute.
+     *
+     * @return import for set attribute
+     */
+    private String getImportForSet() {
+        return getImportString(COLLECTION_IMPORTS, SET);
+    }
+
+    /**
+     * Returns import string for ListenerService class.
+     *
+     * @return import string for ListenerService class
+     */
+    public String getListenerServiceImport() {
+        return getImportString(ONOS_EVENT_PKG, LISTENER_SERVICE);
+    }
+
+    /**
+     * Returns import string for AbstractEvent class.
+     *
+     * @return import string for AbstractEvent class
+     */
+    String getAbstractEventsImport() {
+        return getImportString(ONOS_EVENT_PKG, ABSTRACT_EVENT);
+    }
+
+    /**
+     * Returns import string for EventListener class.
+     *
+     * @return import string for EventListener class
+     */
+    String getEventListenerImport() {
+        return getImportString(ONOS_EVENT_PKG, EVENT_LISTENER);
+    }
+
+    /**
+     * Returns import for big integer.
+     *
+     * @return import for big integer
+     */
+    public String getBigIntegerImport() {
+        return getImportString(JAVA_MATH, BIG_INTEGER);
+    }
+}
diff --git a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/JavaQualifiedTypeInfoTranslator.java b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/JavaQualifiedTypeInfoTranslator.java
new file mode 100644
index 0000000..f6e5c28
--- /dev/null
+++ b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/JavaQualifiedTypeInfoTranslator.java
@@ -0,0 +1,310 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.translator.tojava;
+
+import com.google.common.base.MoreObjects;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.javadatamodel.JavaQualifiedTypeInfo;
+import org.onosproject.yang.compiler.translator.exception.TranslatorException;
+import org.onosproject.yang.compiler.translator.tojava.javamodel.JavaLeafInfoContainer;
+import org.onosproject.yang.compiler.utils.io.YangToJavaNamingConflictUtil;
+
+import java.io.Serializable;
+import java.util.Objects;
+
+import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes.BINARY;
+import static org.onosproject.yang.compiler.translator.tojava.javamodel.AttributesJavaDataType.getJavaDataType;
+import static org.onosproject.yang.compiler.translator.tojava.javamodel.AttributesJavaDataType.getJavaImportClass;
+import static org.onosproject.yang.compiler.translator.tojava.javamodel.AttributesJavaDataType.getJavaImportPackage;
+import static org.onosproject.yang.compiler.utils.UtilConstants.BASE64;
+import static org.onosproject.yang.compiler.utils.UtilConstants.COLLECTION_IMPORTS;
+
+/**
+ * Represents the information about individual imports in the generated file.
+ */
+public class JavaQualifiedTypeInfoTranslator
+        extends JavaQualifiedTypeInfo
+        implements Comparable<JavaQualifiedTypeInfoTranslator>, Serializable {
+    private static final long serialVersionUID = 806201634L;
+    private boolean isQualified;
+    private boolean isForInterface = true;
+
+    /**
+     * Creates a java qualified type info object.
+     */
+    public JavaQualifiedTypeInfoTranslator() {
+        super();
+    }
+
+    /**
+     * Returns the imported package info.
+     *
+     * @return the imported package info
+     */
+    public String getPkgInfo() {
+        return pkgInfo;
+    }
+
+    /**
+     * Sets the imported package info.
+     *
+     * @param pkgInfo the imported package info
+     */
+    public void setPkgInfo(String pkgInfo) {
+        this.pkgInfo = pkgInfo;
+    }
+
+    /**
+     * Returns the imported class/interface info.
+     *
+     * @return the imported class/interface info
+     */
+    public String getClassInfo() {
+        return classInfo;
+    }
+
+    /**
+     * Sets the imported class/interface info.
+     *
+     * @param classInfo the imported class/interface info
+     */
+    public void setClassInfo(String classInfo) {
+        this.classInfo = classInfo;
+    }
+
+    /**
+     * Updates the leaf's java information.
+     *
+     * @param leaf leaf whose java information is being updated
+     */
+    public static void updateLeavesJavaQualifiedInfo(
+            JavaLeafInfoContainer leaf) {
+
+        JavaQualifiedTypeInfoTranslator importInfo =
+                (JavaQualifiedTypeInfoTranslator) leaf.getJavaQualifiedInfo();
+
+        if (leaf.getDataType() == null) {
+            throw new TranslatorException(
+                    "missing data type of leaf " + leaf.getName()
+                            + " in " + leaf.getLineNumber() + " at" +
+                            leaf.getCharPosition() + " in " +
+                            leaf.getFileName());
+        }
+
+        /*
+         * Current leaves holder is adding a leaf info as a attribute to the
+         * current class.
+         */
+        String className =
+                getJavaImportClass(leaf.getDataType(), leaf.isLeafList(),
+                                   leaf.getConflictResolveConfig());
+        if (className != null) {
+            /*
+             * Corresponding to the attribute type a class needs to be imported,
+             * since it can be a derived type or a usage of wrapper classes.
+             */
+            importInfo.setClassInfo(className);
+            String classPkg = getJavaImportPackage(leaf.getDataType(),
+                                                   leaf.isLeafList(),
+                                                   leaf.getConflictResolveConfig());
+            if (classPkg == null) {
+                throw new TranslatorException(
+                        "import package cannot be null when the class is used" +
+                                " for "
+                                + leaf.getName()
+                                + " in " + leaf.getLineNumber() + " at" +
+                                leaf.getCharPosition() + " in " +
+                                leaf.getFileName());
+            }
+            importInfo.setPkgInfo(classPkg);
+        } else {
+            /*
+             * The attribute does not need a class to be imported, for example
+             * built in java types.
+             */
+            String dataTypeName =
+                    getJavaDataType(leaf.getDataType());
+            if (dataTypeName == null) {
+                throw new TranslatorException("not supported data type for "
+                                                      + leaf.getName()
+                                                      + " in " +
+                                                      leaf.getLineNumber() +
+                                                      " at" +
+                                                      leaf.getCharPosition() +
+                                                      " in " +
+                                                      leaf.getFileName());
+            }
+            importInfo.setClassInfo(dataTypeName);
+        }
+
+        leaf.getJavaQualifiedInfo().setJavaAttributeName(leaf.getJavaName(
+                leaf.getConflictResolveConfig()));
+    }
+
+    /**
+     * Returns the import info for an attribute, which needs to be used for code
+     * generation for import or for qualified access.
+     *
+     * @param curNode       current data model node for which the java file
+     *                      is being
+     *                      generated
+     * @param attributeName name of the attribute being added, it will used in
+     *                      import info for child class
+     * @return return the import info for this attribute
+     */
+    public static JavaQualifiedTypeInfoTranslator getQualifiedTypeInfoOfCurNode(
+            YangNode curNode,
+            String attributeName) {
+
+        JavaQualifiedTypeInfoTranslator importInfo =
+                new JavaQualifiedTypeInfoTranslator();
+
+        if (!(curNode instanceof JavaFileInfoContainer)) {
+            throw new TranslatorException(
+                    "missing java file information to get the package details "
+                            + "of attribute corresponding to child node " +
+                            curNode.getName() +
+                            " in " + curNode.getLineNumber() + " at " +
+                            curNode.getCharPosition() + " in " +
+                            curNode.getFileName());
+        }
+
+        importInfo.setClassInfo(attributeName);
+        importInfo.setPkgInfo(((JavaFileInfoContainer) curNode)
+                                      .getJavaFileInfo().getPackage());
+
+        return importInfo;
+    }
+
+    /**
+     * Returns the java qualified type information for the wrapper classes.
+     *
+     * @param referredTypesAttrInfo attribute of referred type
+     * @param conflictResolver      plugin configurations
+     * @return return the import info for this attribute
+     */
+    static JavaQualifiedTypeInfoTranslator getQualifiedInfoOfFromString(
+            JavaAttributeInfo referredTypesAttrInfo,
+            YangToJavaNamingConflictUtil conflictResolver) {
+
+        /*
+         * Get the java qualified type information for the wrapper classes and
+         * set it in new java attribute information.
+         */
+        JavaQualifiedTypeInfoTranslator qualifiedInfoOfFromString =
+                new JavaQualifiedTypeInfoTranslator();
+
+        if (referredTypesAttrInfo.getAttributeType().getDataType() == BINARY) {
+            qualifiedInfoOfFromString.setClassInfo(BASE64);
+            qualifiedInfoOfFromString.setPkgInfo(COLLECTION_IMPORTS);
+        } else {
+            qualifiedInfoOfFromString.setClassInfo(
+                    getJavaImportClass(referredTypesAttrInfo.getAttributeType(),
+                                       true, conflictResolver));
+            qualifiedInfoOfFromString.setPkgInfo(
+                    getJavaImportPackage(
+                            referredTypesAttrInfo.getAttributeType(), true,
+                            conflictResolver));
+        }
+        return qualifiedInfoOfFromString;
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(pkgInfo, classInfo);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+
+        if (this == obj) {
+            return true;
+        }
+        if (obj instanceof JavaQualifiedTypeInfoTranslator) {
+            JavaQualifiedTypeInfoTranslator other =
+                    (JavaQualifiedTypeInfoTranslator) obj;
+            return Objects.equals(pkgInfo, other.pkgInfo) &&
+                    Objects.equals(classInfo, other.classInfo);
+        }
+        return false;
+    }
+
+    /**
+     * Checks if the import info matches.
+     *
+     * @param importInfo matched import
+     * @return if equal or not
+     */
+    public boolean exactMatch(JavaQualifiedTypeInfoTranslator importInfo) {
+        return equals(importInfo)
+                && Objects.equals(pkgInfo, importInfo.getPkgInfo())
+                && Objects.equals(classInfo, importInfo.getClassInfo());
+    }
+
+    @Override
+    public String toString() {
+        return MoreObjects.toStringHelper(getClass())
+                .add("pkgInfo", pkgInfo)
+                .add("classInfo", classInfo).toString();
+    }
+
+    /**
+     * Checks that there is no 2 objects with the same class name.
+     *
+     * @param other compared import info.
+     */
+    @Override
+    public int compareTo(JavaQualifiedTypeInfoTranslator other) {
+        return getClassInfo().compareTo(other.getClassInfo());
+    }
+
+    /**
+     * Returns true if import is qualified.
+     *
+     * @return true if import is qualified
+     */
+    public boolean isQualified() {
+        return isQualified;
+    }
+
+    /**
+     * Sets true if import is qualified.
+     *
+     * @param qualified true if import is qualified
+     */
+    public void setQualified(boolean qualified) {
+        isQualified = qualified;
+    }
+
+    /**
+     * Returns true if import should be added to interface.
+     *
+     * @return true if import should be added to interface
+     */
+    boolean isForInterface() {
+        return isForInterface;
+    }
+
+    /**
+     * Sets true if import should be added to interface.
+     *
+     * @param forInterface true if import should be added to interface
+     */
+    void setForInterface(boolean forInterface) {
+        isForInterface = forInterface;
+    }
+}
diff --git a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/TempJavaBeanFragmentFiles.java b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/TempJavaBeanFragmentFiles.java
new file mode 100644
index 0000000..69c29bc
--- /dev/null
+++ b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/TempJavaBeanFragmentFiles.java
@@ -0,0 +1,117 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.translator.tojava;
+
+import org.onosproject.yang.compiler.utils.io.YangPluginConfig;
+
+import java.io.File;
+import java.io.IOException;
+
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedTempFileType.CONSTRUCTOR_IMPL_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.utils.MethodsGenerator.getConstructor;
+import static org.onosproject.yang.compiler.utils.io.impl.FileSystemUtil.closeFile;
+
+/**
+ * Represents implementation of java bean code fragments temporary implementations.
+ * Maintains the temp files required specific for bean java snippet generation.
+ */
+public class TempJavaBeanFragmentFiles
+        extends TempJavaFragmentFiles {
+
+    /**
+     * File name for constructor.
+     */
+    private static final String CONSTRUCTOR_FILE_NAME = "Constructor";
+
+    /**
+     * Temporary file handle for constructor of class.
+     */
+    private final File constructorImplTempFileHandle;
+
+    /**
+     * Creates an instance of temporary java code fragment.
+     *
+     * @param javaFileInfo generated java file info
+     * @throws IOException when fails to create new file handle
+     */
+    TempJavaBeanFragmentFiles(JavaFileInfoTranslator javaFileInfo)
+            throws IOException {
+
+        super(javaFileInfo);
+
+        /*
+         * Initialize getterImpl, attributes, constructor, hash code, equals and
+         * to strings when generation file type matches to impl class mask.
+         */
+        addGeneratedTempFile(CONSTRUCTOR_IMPL_MASK);
+        constructorImplTempFileHandle = getTemporaryFileHandle(CONSTRUCTOR_FILE_NAME);
+    }
+
+    /**
+     * Returns constructor's temporary file handle.
+     *
+     * @return temporary file handle
+     */
+    public File getConstructorImplTempFileHandle() {
+        return constructorImplTempFileHandle;
+    }
+
+    /**
+     * Adds constructor for class.
+     *
+     * @param attr attribute info
+     * @throws IOException when fails to append to temporary file
+     */
+    private void addConstructor(JavaAttributeInfo attr)
+            throws IOException {
+        appendToFile(constructorImplTempFileHandle,
+                     getConstructor(attr, getGeneratedJavaFiles()));
+    }
+
+    /**
+     * Adds the new attribute info to the target generated temporary files.
+     *
+     * @param newAttrInfo the attribute info that needs to be added to temporary
+     *                    files
+     * @throws IOException IO operation fail
+     */
+    @Override
+    void addJavaSnippetInfoToApplicableTempFiles(JavaAttributeInfo newAttrInfo,
+                                                 YangPluginConfig pluginConfig)
+            throws IOException {
+        super.addJavaSnippetInfoToApplicableTempFiles(newAttrInfo, pluginConfig);
+        addConstructor(newAttrInfo);
+    }
+
+    /**
+     * Removes all temporary file handles.
+     *
+     * @param isErrorOccurred flag to tell translator that error has occurred
+     *                        while code generation
+     * @throws IOException when failed to delete the temporary files
+     */
+    @Override
+    public void freeTemporaryResources(boolean isErrorOccurred)
+            throws IOException {
+
+        /*
+         * Close constructor temporary file handle and delete the file.
+         */
+        closeFile(constructorImplTempFileHandle, true);
+        super.freeTemporaryResources(isErrorOccurred);
+    }
+}
diff --git a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/TempJavaCodeFragmentFiles.java b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/TempJavaCodeFragmentFiles.java
new file mode 100644
index 0000000..766e70e
--- /dev/null
+++ b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/TempJavaCodeFragmentFiles.java
@@ -0,0 +1,283 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.translator.tojava;
+
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangTypeHolder;
+import org.onosproject.yang.compiler.translator.exception.TranslatorException;
+import org.onosproject.yang.compiler.utils.io.YangPluginConfig;
+
+import java.io.IOException;
+
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedJavaFileType.GENERATE_ALL_EVENT_CLASS_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedJavaFileType.GENERATE_ENUM_CLASS;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedJavaFileType.GENERATE_INTERFACE_WITH_BUILDER;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedJavaFileType.GENERATE_SERVICE_AND_MANAGER;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedJavaFileType.GENERATE_TYPE_CLASS;
+import static org.onosproject.yang.compiler.utils.UtilConstants.BUILDER;
+
+/**
+ * Represents implementation of java code fragments temporary implementations.
+ * Contains fragment file object of different types of java file.
+ * Uses required object(s) to generate the target java file(s).
+ */
+public class TempJavaCodeFragmentFiles {
+
+    /**
+     * Has the temporary files required for bean generated classes.
+     */
+    private TempJavaBeanFragmentFiles beanTempFiles;
+
+    /**
+     * Has the temporary files required for bean generated classes.
+     */
+    private TempJavaTypeFragmentFiles typeTempFiles;
+
+    /**
+     * Has the temporary files required for service generated classes.
+     */
+    private TempJavaServiceFragmentFiles serviceTempFiles;
+
+    /**
+     * Has the temporary files required for enumeration generated classes.
+     */
+    private TempJavaEnumerationFragmentFiles enumTempFiles;
+
+    /**
+     * Has the temporary files required for enumeration generated classes.
+     */
+    private TempJavaEventFragmentFiles eventTempFiles;
+
+    /**
+     * Creates an instance of temporary java code fragment.
+     *
+     * @param javaFileInfo generated java file info
+     * @throws IOException when fails to create new file handle
+     */
+    public TempJavaCodeFragmentFiles(JavaFileInfoTranslator javaFileInfo)
+            throws IOException {
+
+        int genType = javaFileInfo.getGeneratedFileTypes();
+        if ((genType & GENERATE_INTERFACE_WITH_BUILDER) != 0) {
+            beanTempFiles = new TempJavaBeanFragmentFiles(javaFileInfo);
+        }
+
+        if ((genType & GENERATE_TYPE_CLASS) != 0) {
+            typeTempFiles = new TempJavaTypeFragmentFiles(javaFileInfo);
+        }
+
+        if ((genType & GENERATE_ENUM_CLASS) != 0) {
+            enumTempFiles = new TempJavaEnumerationFragmentFiles(javaFileInfo);
+        }
+
+        if ((genType & GENERATE_SERVICE_AND_MANAGER) != 0) {
+            serviceTempFiles = new TempJavaServiceFragmentFiles(javaFileInfo);
+        }
+
+        if ((genType & GENERATE_ALL_EVENT_CLASS_MASK) != 0) {
+            eventTempFiles = new TempJavaEventFragmentFiles(javaFileInfo);
+        }
+    }
+
+    /**
+     * Retrieves the temp file handle for bean file generation.
+     *
+     * @return temp file handle for bean file generation
+     */
+    public TempJavaBeanFragmentFiles getBeanTempFiles() {
+        return beanTempFiles;
+    }
+
+    /**
+     * Retrieves the temp file handle for data type file generation.
+     *
+     * @return temp file handle for data type file generation
+     */
+    public TempJavaTypeFragmentFiles getTypeTempFiles() {
+        return typeTempFiles;
+    }
+
+
+    /**
+     * Retrieves the temp file handle for service file generation.
+     *
+     * @return temp file handle for service file generation
+     */
+    public TempJavaServiceFragmentFiles getServiceTempFiles() {
+        return serviceTempFiles;
+    }
+
+    /**
+     * Retrieves the temp file handle for enumeration file generation.
+     *
+     * @return temp file handle for enumeration file generation
+     */
+    public TempJavaEnumerationFragmentFiles getEnumTempFiles() {
+        return enumTempFiles;
+    }
+
+    /**
+     * Retrieves the temp file handle for event file generation.
+     *
+     * @return temp file handle for enumeration file generation
+     */
+    public TempJavaEventFragmentFiles getEventFragmentFiles() {
+        return eventTempFiles;
+    }
+
+    /**
+     * Constructs java code exit.
+     *
+     * @param fileType generated file type
+     * @param curNode  current YANG node
+     * @throws IOException when fails to generate java files
+     */
+    public void generateJavaFile(int fileType, YangNode curNode)
+            throws IOException {
+
+        if ((fileType & GENERATE_INTERFACE_WITH_BUILDER) != 0) {
+            beanTempFiles.generateJavaFile(fileType, curNode);
+        }
+
+        /*
+         * Creates user defined data type class file.
+         */
+        if ((fileType & GENERATE_TYPE_CLASS) != 0) {
+            typeTempFiles.generateJavaFile(fileType, curNode);
+        }
+
+        /*
+         * Creates service and manager class file.
+         */
+        if (fileType == GENERATE_SERVICE_AND_MANAGER) {
+            serviceTempFiles.generateJavaFile(GENERATE_SERVICE_AND_MANAGER, curNode);
+        }
+
+        /*
+         * Creates event, event listener and event subject files.
+         */
+        if (fileType == GENERATE_ALL_EVENT_CLASS_MASK) {
+            eventTempFiles.generateJavaFile(GENERATE_ALL_EVENT_CLASS_MASK, curNode);
+        }
+
+        /*
+         * Creates enumeration class file.
+         */
+        if (fileType == GENERATE_ENUM_CLASS) {
+            enumTempFiles.generateJavaFile(GENERATE_ENUM_CLASS, curNode);
+        }
+    }
+
+    /**
+     * Add all the type in the current data model node as part of the
+     * generated temporary file.
+     *
+     * @param typeHolder YANG java data model node which has type info, eg union / typedef
+     * @param config     plugin configurations for naming convention
+     * @throws IOException IO operation fail
+     */
+    void addTypeInfoToTempFiles(YangTypeHolder typeHolder, YangPluginConfig config)
+            throws IOException {
+        typeTempFiles.addTypeInfoToTempFiles(typeHolder, config);
+    }
+
+    /**
+     * Adds build method for interface.
+     *
+     * @return build method for interface
+     * @throws IOException when fails to append to temporary file
+     */
+    public String addBuildMethodForInterface()
+            throws IOException {
+        if (beanTempFiles != null) {
+            return beanTempFiles.addBuildMethodForInterface();
+        }
+        throw new TranslatorException("build method only supported for bean class");
+    }
+
+    /**
+     * Adds default constructor for class.
+     *
+     * @param modifier modifier for constructor.
+     * @param toAppend string which need to be appended with the class name
+     * @return default constructor for class
+     * @throws IOException when fails to append to file
+     */
+    public String addDefaultConstructor(String modifier, String toAppend)
+            throws IOException {
+        boolean isSuffix = false;
+        if (toAppend.equals(BUILDER)) {
+            isSuffix = true;
+        }
+        if (typeTempFiles != null) {
+            return typeTempFiles.addDefaultConstructor(modifier, toAppend,
+                                                       isSuffix);
+        }
+        if (beanTempFiles != null) {
+            return beanTempFiles.addDefaultConstructor(modifier, toAppend,
+                                                       isSuffix);
+        }
+
+        throw new TranslatorException("default constructor should not be added");
+    }
+
+    /**
+     * Adds build method's implementation for class.
+     *
+     * @return build method implementation for class
+     * @throws IOException when fails to append to temporary file
+     */
+    public String addBuildMethodImpl()
+            throws IOException {
+        if (beanTempFiles != null) {
+            return beanTempFiles.addBuildMethodImpl();
+        }
+        throw new TranslatorException("build should not be added");
+    }
+
+    /**
+     * Removes all temporary file handles.
+     * when translator fails to generate java files we need to close
+     * all open file handles include temporary files and java files
+     *
+     * @param isErrorOccurred if error occurred
+     * @throws IOException when failed to delete the temporary files
+     */
+    public void freeTemporaryResources(boolean isErrorOccurred)
+            throws IOException {
+
+        if (beanTempFiles != null) {
+            beanTempFiles.freeTemporaryResources(isErrorOccurred);
+        }
+
+        if (typeTempFiles != null) {
+            typeTempFiles.freeTemporaryResources(isErrorOccurred);
+        }
+
+        if (enumTempFiles != null) {
+            enumTempFiles.freeTemporaryResources(isErrorOccurred);
+        }
+
+        if (serviceTempFiles != null) {
+            serviceTempFiles.freeTemporaryResources(isErrorOccurred);
+        }
+
+        if (eventTempFiles != null) {
+            eventTempFiles.freeTemporaryResources(isErrorOccurred);
+        }
+    }
+}
diff --git a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/TempJavaCodeFragmentFilesContainer.java b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/TempJavaCodeFragmentFilesContainer.java
new file mode 100644
index 0000000..8cde603
--- /dev/null
+++ b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/TempJavaCodeFragmentFilesContainer.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.yang.compiler.translator.tojava;
+
+/**
+ * Represents Has temporary file handle.
+ */
+public interface TempJavaCodeFragmentFilesContainer {
+
+    /**
+     * Returns the temporary file handle.
+     *
+     * @return temporary file handle
+     */
+    TempJavaCodeFragmentFiles getTempJavaCodeFragmentFiles();
+
+    /**
+     * Sets temporary file handle.
+     *
+     * @param fileHandle temporary file handle
+     */
+    void setTempJavaCodeFragmentFiles(TempJavaCodeFragmentFiles fileHandle);
+}
diff --git a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/TempJavaEnumerationFragmentFiles.java b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/TempJavaEnumerationFragmentFiles.java
new file mode 100644
index 0000000..2443211
--- /dev/null
+++ b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/TempJavaEnumerationFragmentFiles.java
@@ -0,0 +1,216 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.yang.compiler.translator.tojava;
+
+import org.onosproject.yang.compiler.datamodel.YangEnum;
+import org.onosproject.yang.compiler.datamodel.YangEnumeration;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.translator.exception.TranslatorException;
+import org.onosproject.yang.compiler.translator.tojava.javamodel.YangJavaTypeTranslator;
+import org.onosproject.yang.compiler.utils.io.YangPluginConfig;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.List;
+
+import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes.INT32;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedTempFileType.ENUM_IMPL_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.JavaAttributeInfo.getAttributeInfoForTheData;
+import static org.onosproject.yang.compiler.translator.tojava.utils.JavaCodeSnippetGen.generateEnumAttributeStringWithSchemaName;
+import static org.onosproject.yang.compiler.translator.tojava.utils.JavaFileGenerator.generateEnumClassFile;
+import static org.onosproject.yang.compiler.translator.tojava.utils.JavaIdentifierSyntax.createPackage;
+import static org.onosproject.yang.compiler.utils.UtilConstants.EMPTY_STRING;
+import static org.onosproject.yang.compiler.utils.UtilConstants.INT;
+import static org.onosproject.yang.compiler.utils.UtilConstants.REGEX_FOR_FIRST_DIGIT;
+import static org.onosproject.yang.compiler.utils.UtilConstants.YANG_AUTO_PREFIX;
+import static org.onosproject.yang.compiler.utils.io.impl.FileSystemUtil.closeFile;
+import static org.onosproject.yang.compiler.utils.io.impl.YangIoUtils.getPrefixForIdentifier;
+
+/**
+ * Represents implementation of java code fragments temporary implementations. Maintains the temp files required
+ * specific for enumeration java snippet generation.
+ */
+public class TempJavaEnumerationFragmentFiles
+        extends TempJavaFragmentFiles {
+
+    /**
+     * File name for temporary enum class.
+     */
+    private static final String ENUM_CLASS_TEMP_FILE_NAME = "EnumClass";
+
+    /**
+     * Temporary file handle for enum class file.
+     */
+    private final File enumClassTempFileHandle;
+
+    /**
+     * Java file handle for enum class.
+     */
+    private File enumClassJavaFileHandle;
+    private boolean isEnumClass;
+
+    /**
+     * Creates an instance of temporary java code fragment.
+     *
+     * @param javaFileInfo generated java file info
+     * @throws IOException when fails to create new file handle
+     */
+    public TempJavaEnumerationFragmentFiles(JavaFileInfoTranslator javaFileInfo)
+            throws IOException {
+
+        super(javaFileInfo);
+        /*
+         * Initialize enum when generation file type matches to enum class mask.
+         */
+        addGeneratedTempFile(ENUM_IMPL_MASK);
+        enumClassTempFileHandle = getTemporaryFileHandle(ENUM_CLASS_TEMP_FILE_NAME);
+    }
+
+    /**
+     * Returns temporary file handle for enum class file.
+     *
+     * @return temporary file handle for enum class file
+     */
+    public File getEnumClassTempFileHandle() {
+        return enumClassTempFileHandle;
+    }
+
+    /**
+     * Adds enum class attributes to temporary file.
+     *
+     * @param yangEnum YANG enum
+     * @throws IOException when fails to do IO operations.
+     */
+    private void addAttributesForEnumClass(YangEnum yangEnum)
+            throws IOException {
+        appendToFile(enumClassTempFileHandle,
+                     generateEnumAttributeStringWithSchemaName(yangEnum.getNamedValue(),
+                                                               yangEnum.getValue()));
+    }
+
+    /**
+     * Adds enum attributes to temporary files.
+     *
+     * @param curNode current YANG node
+     * @param config  plugin configurations
+     * @throws IOException when fails to do IO operations
+     */
+    public void addEnumAttributeToTempFiles(YangNode curNode,
+                                            YangPluginConfig config)
+            throws IOException {
+
+        addJavaSnippetInfoToApplicableTempFiles(getJavaAttributeForEnum(config),
+                                                config);
+        if (curNode instanceof YangEnumeration) {
+            YangEnumeration enumeration = (YangEnumeration) curNode;
+            for (YangEnum curEnum : enumeration.getEnumSet()) {
+                String enumName = curEnum.getNamedValue();
+                String prefix;
+                if (enumName.matches(REGEX_FOR_FIRST_DIGIT)) {
+                    prefix = getPrefixForIdentifier(
+                            config.getConflictResolver());
+                    if (prefix != null) {
+                        curEnum.setNamedValue(prefix + enumName);
+                    } else {
+                        curEnum.setNamedValue(YANG_AUTO_PREFIX + enumName);
+                    }
+                }
+                addJavaSnippetInfoToApplicableTempFiles(curEnum);
+            }
+        } else {
+            throw new TranslatorException(
+                    "current node should be of enumeration type. " +
+                            curNode.getName() + " in " + curNode.getLineNumber() +
+                            " at " + curNode.getCharPosition() + " in " + curNode
+                            .getFileName());
+        }
+    }
+
+    /**
+     * Returns java attribute for enum class.
+     *
+     * @param config plugin configurations
+     * @return java attribute
+     */
+    private JavaAttributeInfo getJavaAttributeForEnum(YangPluginConfig config) {
+        YangJavaTypeTranslator javaType = new YangJavaTypeTranslator();
+        javaType.setDataType(INT32);
+        javaType.setDataTypeName(INT);
+        javaType.updateJavaQualifiedInfo(config.getConflictResolver());
+        return getAttributeInfoForTheData(
+                javaType.getJavaQualifiedInfo(),
+                javaType.getDataTypeName(), javaType,
+                getIsQualifiedAccessOrAddToImportList(javaType.getJavaQualifiedInfo()),
+                false);
+    }
+
+    /**
+     * Adds the new attribute info to the target generated temporary files.
+     *
+     * @param yangEnum @throws IOException IO operation fail
+     */
+    private void addJavaSnippetInfoToApplicableTempFiles(YangEnum yangEnum)
+            throws IOException {
+        addAttributesForEnumClass(yangEnum);
+    }
+
+    /**
+     * Constructs java code exit.
+     *
+     * @param fileType generated file type
+     * @param curNode  current YANG node
+     * @throws IOException when fails to generate java files
+     */
+    @Override
+    public void generateJavaFile(int fileType, YangNode curNode)
+            throws IOException {
+
+        List<String> imports = this.getJavaImportData().getImports(true);
+        createPackage(curNode);
+        enumClassJavaFileHandle = getJavaFileHandle(getJavaClassName(EMPTY_STRING));
+        generateEnumClassFile(enumClassJavaFileHandle, curNode, imports);
+        freeTemporaryResources(false);
+    }
+
+    /**
+     * Removes all temporary file handles.
+     *
+     * @param isErrorOccurred flag to tell translator that error has occurred while file generation
+     * @throws IOException when failed to delete the temporary files
+     */
+    @Override
+    public void freeTemporaryResources(boolean isErrorOccurred)
+            throws IOException {
+        closeFile(enumClassJavaFileHandle, isErrorOccurred);
+        closeFile(enumClassTempFileHandle, true);
+        if (isEnumClass) {
+            super.freeTemporaryResources(isErrorOccurred);
+        }
+    }
+
+    public boolean isEnumClass() {
+        return isEnumClass;
+    }
+
+    /**
+     * Sets  true if free super resources is required.
+     *
+     * @param enumClass true if free super resources is required
+     */
+    public void setEnumClass(boolean enumClass) {
+        isEnumClass = enumClass;
+    }
+}
diff --git a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/TempJavaEventFragmentFiles.java b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/TempJavaEventFragmentFiles.java
new file mode 100644
index 0000000..efc860b
--- /dev/null
+++ b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/TempJavaEventFragmentFiles.java
@@ -0,0 +1,437 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.translator.tojava;
+
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.translator.tojava.utils.JavaExtendsListHolder;
+import org.onosproject.yang.compiler.utils.io.YangPluginConfig;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedJavaFileType.GENERATE_EVENT_SUBJECT_CLASS;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedTempFileType.EVENT_ENUM_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedTempFileType.EVENT_METHOD_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedTempFileType.EVENT_SUBJECT_ATTRIBUTE_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedTempFileType.EVENT_SUBJECT_GETTER_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedTempFileType.EVENT_SUBJECT_SETTER_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.JavaAttributeInfo.getAttributeInfoForTheData;
+import static org.onosproject.yang.compiler.translator.tojava.JavaQualifiedTypeInfoTranslator.getQualifiedTypeInfoOfCurNode;
+import static org.onosproject.yang.compiler.translator.tojava.utils.JavaFileGenerator.generateEventFile;
+import static org.onosproject.yang.compiler.translator.tojava.utils.JavaFileGenerator.generateEventListenerFile;
+import static org.onosproject.yang.compiler.translator.tojava.utils.JavaFileGenerator.generateEventSubjectFile;
+import static org.onosproject.yang.compiler.translator.tojava.utils.JavaFileGeneratorUtils.getFileObject;
+import static org.onosproject.yang.compiler.translator.tojava.utils.JavaIdentifierSyntax.getEnumJavaAttribute;
+import static org.onosproject.yang.compiler.translator.tojava.utils.MethodsGenerator.getGetterForClass;
+import static org.onosproject.yang.compiler.translator.tojava.utils.MethodsGenerator.getSetterForClass;
+import static org.onosproject.yang.compiler.utils.UtilConstants.COMMA;
+import static org.onosproject.yang.compiler.utils.UtilConstants.EIGHT_SPACE_INDENTATION;
+import static org.onosproject.yang.compiler.utils.UtilConstants.EVENT_LISTENER;
+import static org.onosproject.yang.compiler.utils.UtilConstants.EVENT_STRING;
+import static org.onosproject.yang.compiler.utils.UtilConstants.NEW_LINE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.SLASH;
+import static org.onosproject.yang.compiler.utils.io.impl.FileSystemUtil.closeFile;
+import static org.onosproject.yang.compiler.utils.io.impl.JavaDocGen.JavaDocType.GETTER_METHOD;
+import static org.onosproject.yang.compiler.utils.io.impl.JavaDocGen.JavaDocType.MANAGER_SETTER_METHOD;
+import static org.onosproject.yang.compiler.utils.io.impl.JavaDocGen.enumJavaDocForInnerClass;
+import static org.onosproject.yang.compiler.utils.io.impl.JavaDocGen.getJavaDoc;
+import static org.onosproject.yang.compiler.utils.io.impl.YangIoUtils.getAbsolutePackagePath;
+import static org.onosproject.yang.compiler.utils.io.impl.YangIoUtils.getCamelCase;
+import static org.onosproject.yang.compiler.utils.io.impl.YangIoUtils.getCapitalCase;
+
+/**
+ * Represent temporary java fragments for event files.
+ */
+public class TempJavaEventFragmentFiles
+        extends TempJavaFragmentFiles {
+    /**
+     * File name for generated class file for special type like union, typedef suffix.
+     */
+    private static final String EVENT_SUBJECT_NAME_SUFFIX = "EventSubject";
+
+    /**
+     * File name for event enum temp file.
+     */
+    private static final String EVENT_ENUM_FILE_NAME = "EventEnum";
+
+    /**
+     * File name for event method temp file.
+     */
+    private static final String EVENT_METHOD_FILE_NAME = "EventMethod";
+
+    /**
+     * File name for event subject attribute temp file.
+     */
+    private static final String EVENT_SUBJECT_ATTRIBUTE_FILE_NAME
+            = "EventSubjectAttribute";
+
+    /**
+     * File name for event subject getter temp file.
+     */
+    private static final String EVENT_SUBJECT_GETTER_FILE_NAME
+            = "EventSubjectGetter";
+
+    /**
+     * File name for event subject setter temp file.
+     */
+    private static final String EVENT_SUBJECT_SETTER_FILE_NAME
+            = "EventSubjectSetter";
+
+    private static final String JAVA_FILE_EXTENSION = ".java";
+    /**
+     * Java file handle for event subject file.
+     */
+    private File eventSubjectJavaFileHandle;
+
+    /**
+     * Java file handle for event listener file.
+     */
+    private File eventListenerJavaFileHandle;
+
+    /**
+     * Java file handle for event file.
+     */
+    private File eventJavaFileHandle;
+
+    /**
+     * Java file handle for event enum impl file.
+     */
+    private final File eventEnumTempFileHandle;
+    /**
+     * Java file handle for event method impl file.
+     */
+    private final File eventMethodTempFileHandle;
+    /**
+     * Java file handle for event subject attribute file.
+     */
+    private final File eventSubjectAttributeTempFileHandle;
+    /**
+     * Java file handle for event subject getter impl file.
+     */
+    private final File eventSubjectGetterTempFileHandle;
+    /**
+     * Java file handle for event subject setter impl file.
+     */
+    private final File eventSubjectSetterTempFileHandle;
+
+    /**
+     * Creates an instance of temporary java code fragment.
+     *
+     * @param javaFileInfo generated file information
+     * @throws IOException when fails to create new file handle
+     */
+    TempJavaEventFragmentFiles(JavaFileInfoTranslator javaFileInfo)
+            throws IOException {
+        setJavaExtendsListHolder(new JavaExtendsListHolder());
+        setJavaImportData(new JavaImportData());
+        setJavaFileInfo(javaFileInfo);
+        setAbsoluteDirPath(getAbsolutePackagePath(
+                getJavaFileInfo().getBaseCodeGenPath(),
+                getJavaFileInfo().getPackageFilePath()));
+
+        addGeneratedTempFile(EVENT_ENUM_MASK);
+        addGeneratedTempFile(EVENT_METHOD_MASK);
+        addGeneratedTempFile(EVENT_SUBJECT_ATTRIBUTE_MASK);
+        addGeneratedTempFile(EVENT_SUBJECT_GETTER_MASK);
+        addGeneratedTempFile(EVENT_SUBJECT_SETTER_MASK);
+
+        eventEnumTempFileHandle = getTemporaryFileHandle(EVENT_ENUM_FILE_NAME);
+        eventMethodTempFileHandle = getTemporaryFileHandle(
+                EVENT_METHOD_FILE_NAME);
+        eventSubjectAttributeTempFileHandle = getTemporaryFileHandle
+                (EVENT_SUBJECT_ATTRIBUTE_FILE_NAME);
+        eventSubjectGetterTempFileHandle = getTemporaryFileHandle(
+                EVENT_SUBJECT_GETTER_FILE_NAME);
+        eventSubjectSetterTempFileHandle = getTemporaryFileHandle(
+                EVENT_SUBJECT_SETTER_FILE_NAME);
+    }
+
+    /**
+     * Returns event enum temp file.
+     *
+     * @return event enum temp file
+     */
+    public File getEventEnumTempFileHandle() {
+        return eventEnumTempFileHandle;
+    }
+
+    /**
+     * Returns event method temp file.
+     *
+     * @return event method temp file
+     */
+    public File getEventMethodTempFileHandle() {
+        return eventMethodTempFileHandle;
+    }
+
+    /**
+     * Returns event subject attribute temp file.
+     *
+     * @return event subject attribute temp file
+     */
+    public File getEventSubjectAttributeTempFileHandle() {
+        return eventSubjectAttributeTempFileHandle;
+    }
+
+    /**
+     * Returns event subject getter temp file.
+     *
+     * @return event subject getter temp file
+     */
+    public File getEventSubjectGetterTempFileHandle() {
+        return eventSubjectGetterTempFileHandle;
+    }
+
+    /**
+     * Returns event subject setter temp file.
+     *
+     * @return event subject setter temp file
+     */
+    public File getEventSubjectSetterTempFileHandle() {
+        return eventSubjectSetterTempFileHandle;
+    }
+
+    /*Adds event method contents to event file.*/
+    private static String getEventFileContents(String eventClassname, String classname) {
+        return "\n" +
+                "    /**\n" +
+                "     * Creates " + classname + " event with type and subject.\n" +
+                "     *\n" +
+                "     * @param type event type\n" +
+                "     * @param subject subject " + classname + "\n" +
+                "     */\n" +
+                "    public " + eventClassname + "(Type type, " +
+                getCapitalCase(classname) + " subject) {\n" +
+                "        super(type, subject);\n" +
+                "    }\n" +
+                "\n" +
+                "    /**\n" +
+                "     * Creates " + classname + " event with type, subject and time.\n" +
+                "     *\n" +
+                "     * @param type event type\n" +
+                "     * @param subject subject " + classname + "\n" +
+                "     * @param time time of event\n" +
+                "     */\n" +
+                "    public " + eventClassname + "(Type type, " + getCapitalCase(classname)
+                + " subject, long time) {\n" +
+                "        super(type, subject, time);\n" +
+                "    }\n" +
+                "\n";
+    }
+
+    public void generateJavaFile(int fileType, YangNode curNode)
+            throws IOException {
+        generateEventJavaFile(curNode);
+        generateEventListenerJavaFile(curNode);
+        generateEventSubjectJavaFile(curNode);
+
+        // Close all the file handles.
+        freeTemporaryResources(false);
+    }
+
+    /**
+     * Constructs java code exit.
+     *
+     * @param curNode current YANG node
+     * @throws IOException when fails to generate java files
+     */
+    private void generateEventJavaFile(YangNode curNode)
+            throws IOException {
+
+        List<String> imports = new ArrayList<>();
+
+        imports.add(getJavaImportData().getAbstractEventsImport());
+        String curNodeInfo = getCapitalCase(((JavaFileInfoContainer) curNode)
+                                                    .getJavaFileInfo().getJavaName());
+        String nodeName = curNodeInfo + EVENT_STRING;
+
+        addEnumMethod(nodeName, curNodeInfo + EVENT_SUBJECT_NAME_SUFFIX);
+
+        //Creates event interface file.
+        eventJavaFileHandle = getJavaFileHandle(curNode, curNodeInfo +
+                EVENT_STRING);
+        generateEventFile(eventJavaFileHandle, curNode, imports);
+    }
+
+    /**
+     * Constructs java code exit.
+     *
+     * @param curNode current YANG node
+     * @throws IOException when fails to generate java files
+     */
+    private void generateEventListenerJavaFile(YangNode curNode)
+            throws IOException {
+
+        List<String> imports = new ArrayList<>();
+
+        imports.add(getJavaImportData().getEventListenerImport());
+        String curNodeInfo = getCapitalCase(((JavaFileInfoContainer) curNode)
+                                                    .getJavaFileInfo().getJavaName());
+
+        // Creates event listener interface file.
+        eventListenerJavaFileHandle =
+                getJavaFileHandle(curNode, curNodeInfo + EVENT_LISTENER);
+        generateEventListenerFile(eventListenerJavaFileHandle, curNode, imports);
+    }
+
+    /**
+     * Constructs java code exit.
+     *
+     * @param curNode current YANG node
+     * @throws IOException when fails to generate java files
+     */
+    private void generateEventSubjectJavaFile(YangNode curNode)
+            throws IOException {
+
+        String curNodeInfo = getCapitalCase(((JavaFileInfoContainer) curNode)
+                                                    .getJavaFileInfo().getJavaName());
+
+        //Creates event interface file.
+        eventSubjectJavaFileHandle = getJavaFileHandle(curNode, curNodeInfo +
+                EVENT_SUBJECT_NAME_SUFFIX);
+        generateEventSubjectFile(eventSubjectJavaFileHandle, curNode);
+    }
+
+    /**
+     * Adds java snippet for events to event subject file.
+     *
+     * @param curNode      current node
+     * @param pluginConfig plugin configurations
+     * @throws IOException when fails to do IO operations
+     */
+    void addJavaSnippetOfEvent(YangNode curNode, YangPluginConfig pluginConfig)
+            throws IOException {
+
+        String currentInfo = getCamelCase(curNode.getName(), pluginConfig
+                .getConflictResolver());
+        String notificationName = curNode.getName();
+
+        JavaQualifiedTypeInfoTranslator qualifiedTypeInfo
+                = getQualifiedTypeInfoOfCurNode(curNode, getCapitalCase(currentInfo));
+
+        JavaAttributeInfo javaAttributeInfo
+                = getAttributeInfoForTheData(qualifiedTypeInfo, currentInfo,
+                                             null, false, false);
+
+        /*Adds java info for event in respective temp files.*/
+        addEventEnum(notificationName);
+        addEventSubjectAttribute(javaAttributeInfo);
+        addEventSubjectGetter(javaAttributeInfo);
+        addEventSubjectSetter(javaAttributeInfo, currentInfo);
+    }
+
+    /*Adds event to enum temp file.*/
+    private void addEventEnum(String notificationName)
+            throws IOException {
+        appendToFile(getEventEnumTempFileHandle(), enumJavaDocForInnerClass(
+                notificationName) + EIGHT_SPACE_INDENTATION
+                + getEnumJavaAttribute(notificationName).toUpperCase() +
+                COMMA + NEW_LINE);
+    }
+
+    /*Adds event method in event class*/
+    private void addEnumMethod(String eventClassname, String className)
+            throws IOException {
+        appendToFile(getEventMethodTempFileHandle(),
+                     getEventFileContents(eventClassname, className));
+    }
+
+    /*Adds events to event subject file.*/
+    private void addEventSubjectAttribute(JavaAttributeInfo attr)
+            throws IOException {
+        appendToFile(getEventSubjectAttributeTempFileHandle(),
+                     parseAttribute(attr));
+    }
+
+    /*Adds getter method for event in event subject class.*/
+    private void addEventSubjectGetter(JavaAttributeInfo attr)
+            throws IOException {
+        String appDataStructure = null;
+        if (attr.getCompilerAnnotation() != null) {
+            appDataStructure = attr.getCompilerAnnotation()
+                    .getYangAppDataStructure().getDataStructure().name();
+        }
+        appendToFile(getEventSubjectGetterTempFileHandle(), getJavaDoc(
+                GETTER_METHOD, attr.getAttributeName(), false,
+                appDataStructure) + getGetterForClass(
+                attr, GENERATE_EVENT_SUBJECT_CLASS) + NEW_LINE);
+    }
+
+    /*Adds setter method for event in event subject class.*/
+    private void addEventSubjectSetter(JavaAttributeInfo attr,
+                                       String className)
+            throws IOException {
+        String appDataStructure = null;
+        if (attr.getCompilerAnnotation() != null) {
+            appDataStructure = attr.getCompilerAnnotation()
+                    .getYangAppDataStructure().getDataStructure().name();
+        }
+        appendToFile(getEventSubjectSetterTempFileHandle(), getJavaDoc(
+                MANAGER_SETTER_METHOD, attr.getAttributeName(),
+                false, appDataStructure) + getSetterForClass(
+                attr, className, GENERATE_EVENT_SUBJECT_CLASS) + NEW_LINE);
+    }
+
+    /**
+     * Returns a temporary file handle for the event's file type.
+     *
+     * @param name file name
+     * @return temporary file handle
+     */
+    private File getJavaFileHandle(YangNode curNode, String name) {
+
+        JavaFileInfoTranslator parentInfo = ((JavaFileInfoContainer) curNode)
+                .getJavaFileInfo();
+        return getFileObject(getDirPath(parentInfo), name, JAVA_FILE_EXTENSION,
+                             parentInfo);
+    }
+
+    /**
+     * Returns the directory path.
+     *
+     * @return directory path
+     */
+    private String getDirPath(JavaFileInfoTranslator parentInfo) {
+        return (parentInfo.getPackageFilePath() + SLASH +
+                parentInfo.getJavaName()).toLowerCase();
+    }
+
+    /**
+     * Removes all temporary file handles.
+     *
+     * @param isErrorOccurred flag to tell translator that error has occurred while file generation
+     * @throws IOException when failed to delete the temporary files
+     */
+    @Override
+    public void freeTemporaryResources(boolean isErrorOccurred)
+            throws IOException {
+
+        closeFile(eventJavaFileHandle, isErrorOccurred);
+        closeFile(eventListenerJavaFileHandle, isErrorOccurred);
+        closeFile(eventSubjectJavaFileHandle, isErrorOccurred);
+
+        closeFile(eventEnumTempFileHandle, true);
+        closeFile(eventSubjectAttributeTempFileHandle, true);
+        closeFile(eventMethodTempFileHandle, true);
+        closeFile(eventSubjectGetterTempFileHandle, true);
+        closeFile(eventSubjectSetterTempFileHandle, true);
+
+        super.freeTemporaryResources(isErrorOccurred);
+    }
+}
diff --git a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/TempJavaFragmentFiles.java b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/TempJavaFragmentFiles.java
new file mode 100644
index 0000000..7b47f96
--- /dev/null
+++ b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/TempJavaFragmentFiles.java
@@ -0,0 +1,2149 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.yang.compiler.translator.tojava;
+
+import org.onosproject.yang.compiler.datamodel.RpcNotificationContainer;
+import org.onosproject.yang.compiler.datamodel.YangAugment;
+import org.onosproject.yang.compiler.datamodel.YangCase;
+import org.onosproject.yang.compiler.datamodel.YangChoice;
+import org.onosproject.yang.compiler.datamodel.YangDataStructure;
+import org.onosproject.yang.compiler.datamodel.YangLeaf;
+import org.onosproject.yang.compiler.datamodel.YangLeafList;
+import org.onosproject.yang.compiler.datamodel.YangLeavesHolder;
+import org.onosproject.yang.compiler.datamodel.YangList;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangSchemaNode;
+import org.onosproject.yang.compiler.datamodel.YangType;
+import org.onosproject.yang.compiler.datamodel.javadatamodel.JavaFileInfo;
+import org.onosproject.yang.compiler.datamodel.javadatamodel.JavaQualifiedTypeInfo;
+import org.onosproject.yang.compiler.translator.exception.TranslatorException;
+import org.onosproject.yang.compiler.translator.tojava.javamodel.JavaLeafInfoContainer;
+import org.onosproject.yang.compiler.translator.tojava.javamodel.YangJavaGroupingTranslator;
+import org.onosproject.yang.compiler.translator.tojava.javamodel.YangJavaLeafTranslator;
+import org.onosproject.yang.compiler.translator.tojava.utils.JavaExtendsListHolder;
+import org.onosproject.yang.compiler.utils.io.YangPluginConfig;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import static org.onosproject.yang.compiler.datamodel.utils.DataModelUtils.getParentNodeInGenCode;
+import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes.BITS;
+import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes.IDENTITYREF;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedJavaFileType.BUILDER_CLASS_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedJavaFileType.BUILDER_INTERFACE_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedJavaFileType.DEFAULT_CLASS_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedJavaFileType.GENERATE_INTERFACE_WITH_BUILDER;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedJavaFileType.GENERATE_TYPE_CLASS;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedJavaFileType.GENERATE_UNION_CLASS;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedJavaFileType.INTERFACE_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedTempFileType.ADD_TO_LIST_IMPL_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedTempFileType.ADD_TO_LIST_INTERFACE_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedTempFileType.ATTRIBUTES_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedTempFileType.EDIT_CONTENT_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedTempFileType.EQUALS_IMPL_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedTempFileType.FILTER_CONTENT_MATCH_FOR_LEAF_LIST_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedTempFileType.FILTER_CONTENT_MATCH_FOR_LEAF_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedTempFileType.FILTER_CONTENT_MATCH_FOR_NODES_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedTempFileType.FROM_STRING_IMPL_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedTempFileType.GETTER_FOR_CLASS_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedTempFileType.GETTER_FOR_INTERFACE_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedTempFileType.HASH_CODE_IMPL_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedTempFileType.LEAF_IDENTIFIER_ENUM_ATTRIBUTES_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedTempFileType.SETTER_FOR_CLASS_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedTempFileType.SETTER_FOR_INTERFACE_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedTempFileType.TO_STRING_IMPL_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.JavaAttributeInfo.getAttributeInfoForTheData;
+import static org.onosproject.yang.compiler.translator.tojava.JavaQualifiedTypeInfoTranslator.getQualifiedInfoOfFromString;
+import static org.onosproject.yang.compiler.translator.tojava.JavaQualifiedTypeInfoTranslator.getQualifiedTypeInfoOfCurNode;
+import static org.onosproject.yang.compiler.translator.tojava.YangJavaModelUtils.generateBitsFile;
+import static org.onosproject.yang.compiler.translator.tojava.javamodel.AttributesJavaDataType.updateJavaFileInfo;
+import static org.onosproject.yang.compiler.translator.tojava.utils.JavaCodeSnippetGen.generateEnumAttributeString;
+import static org.onosproject.yang.compiler.translator.tojava.utils.JavaCodeSnippetGen.getJavaAttributeDefinition;
+import static org.onosproject.yang.compiler.translator.tojava.utils.JavaFileGenerator.generateBuilderClassFile;
+import static org.onosproject.yang.compiler.translator.tojava.utils.JavaFileGenerator.generateBuilderInterfaceFile;
+import static org.onosproject.yang.compiler.translator.tojava.utils.JavaFileGenerator.generateDefaultClassFile;
+import static org.onosproject.yang.compiler.translator.tojava.utils.JavaFileGenerator.generateInterfaceFile;
+import static org.onosproject.yang.compiler.translator.tojava.utils.JavaFileGenerator.generateKeyClassFile;
+import static org.onosproject.yang.compiler.translator.tojava.utils.JavaFileGeneratorUtils.getFileObject;
+import static org.onosproject.yang.compiler.translator.tojava.utils.JavaIdentifierSyntax.createPackage;
+import static org.onosproject.yang.compiler.translator.tojava.utils.MethodsGenerator.getAddToListMethodImpl;
+import static org.onosproject.yang.compiler.translator.tojava.utils.MethodsGenerator.getAddToListMethodInterface;
+import static org.onosproject.yang.compiler.translator.tojava.utils.MethodsGenerator.getBuildString;
+import static org.onosproject.yang.compiler.translator.tojava.utils.MethodsGenerator.getDefaultConstructorString;
+import static org.onosproject.yang.compiler.translator.tojava.utils.MethodsGenerator.getEqualsMethod;
+import static org.onosproject.yang.compiler.translator.tojava.utils.MethodsGenerator.getFromStringMethod;
+import static org.onosproject.yang.compiler.translator.tojava.utils.MethodsGenerator.getGetterForClass;
+import static org.onosproject.yang.compiler.translator.tojava.utils.MethodsGenerator.getGetterString;
+import static org.onosproject.yang.compiler.translator.tojava.utils.MethodsGenerator.getHashCodeMethod;
+import static org.onosproject.yang.compiler.translator.tojava.utils.MethodsGenerator.getSetterForClass;
+import static org.onosproject.yang.compiler.translator.tojava.utils.MethodsGenerator.getSetterString;
+import static org.onosproject.yang.compiler.translator.tojava.utils.MethodsGenerator.getToStringMethod;
+import static org.onosproject.yang.compiler.translator.tojava.utils.MethodsGenerator.getYangDataStructure;
+import static org.onosproject.yang.compiler.translator.tojava.utils.MethodsGenerator.parseBuilderInterfaceBuildMethodString;
+import static org.onosproject.yang.compiler.translator.tojava.utils.StringGenerator.getImportString;
+import static org.onosproject.yang.compiler.translator.tojava.utils.StringGenerator.getOverRideString;
+import static org.onosproject.yang.compiler.translator.tojava.utils.SubtreeFilteringMethodsGenerator.getSubtreeFilteringForLeaf;
+import static org.onosproject.yang.compiler.translator.tojava.utils.SubtreeFilteringMethodsGenerator.getSubtreeFilteringForLeafList;
+import static org.onosproject.yang.compiler.translator.tojava.utils.SubtreeFilteringMethodsGenerator.getSubtreeFilteringForNode;
+import static org.onosproject.yang.compiler.translator.tojava.utils.TranslatorErrorType.INVALID_LEAF_HOLDER;
+import static org.onosproject.yang.compiler.translator.tojava.utils.TranslatorErrorType.INVALID_NODE;
+import static org.onosproject.yang.compiler.translator.tojava.utils.TranslatorErrorType.INVALID_PARENT_NODE;
+import static org.onosproject.yang.compiler.translator.tojava.utils.TranslatorErrorType.MISSING_PARENT_NODE;
+import static org.onosproject.yang.compiler.translator.tojava.utils.TranslatorUtils.getBeanFiles;
+import static org.onosproject.yang.compiler.translator.tojava.utils.TranslatorUtils.getErrorMsg;
+import static org.onosproject.yang.compiler.utils.UtilConstants.AUGMENT_MAP_TYPE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.BIT_SET;
+import static org.onosproject.yang.compiler.utils.UtilConstants.BOOLEAN_DATA_TYPE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.BUILDER;
+import static org.onosproject.yang.compiler.utils.UtilConstants.CLASS_STRING;
+import static org.onosproject.yang.compiler.utils.UtilConstants.CLOSE_CURLY_BRACKET;
+import static org.onosproject.yang.compiler.utils.UtilConstants.COLLECTION_IMPORTS;
+import static org.onosproject.yang.compiler.utils.UtilConstants.DEFAULT;
+import static org.onosproject.yang.compiler.utils.UtilConstants.DEFAULT_CAPS;
+import static org.onosproject.yang.compiler.utils.UtilConstants.DIAMOND_CLOSE_BRACKET;
+import static org.onosproject.yang.compiler.utils.UtilConstants.DIAMOND_OPEN_BRACKET;
+import static org.onosproject.yang.compiler.utils.UtilConstants.EMPTY_STRING;
+import static org.onosproject.yang.compiler.utils.UtilConstants.EXTEND;
+import static org.onosproject.yang.compiler.utils.UtilConstants.FOUR_SPACE_INDENTATION;
+import static org.onosproject.yang.compiler.utils.UtilConstants.GOOGLE_MORE_OBJECT_IMPORT_CLASS;
+import static org.onosproject.yang.compiler.utils.UtilConstants.GOOGLE_MORE_OBJECT_IMPORT_PKG;
+import static org.onosproject.yang.compiler.utils.UtilConstants.HASH_MAP;
+import static org.onosproject.yang.compiler.utils.UtilConstants.INTERFACE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.INVOCATION_TARGET_EXCEPTION;
+import static org.onosproject.yang.compiler.utils.UtilConstants.JAVA_UTIL_OBJECTS_IMPORT_CLASS;
+import static org.onosproject.yang.compiler.utils.UtilConstants.JAVA_UTIL_PKG;
+import static org.onosproject.yang.compiler.utils.UtilConstants.KEYS;
+import static org.onosproject.yang.compiler.utils.UtilConstants.MAP;
+import static org.onosproject.yang.compiler.utils.UtilConstants.NEW_LINE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.OPERATION_TYPE_ATTRIBUTE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.OPERATION_TYPE_CLASS;
+import static org.onosproject.yang.compiler.utils.UtilConstants.OP_PARAM;
+import static org.onosproject.yang.compiler.utils.UtilConstants.PERIOD;
+import static org.onosproject.yang.compiler.utils.UtilConstants.PRIVATE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.PROTECTED;
+import static org.onosproject.yang.compiler.utils.UtilConstants.QUESTION_MARK;
+import static org.onosproject.yang.compiler.utils.UtilConstants.REFLECT_IMPORTS;
+import static org.onosproject.yang.compiler.utils.UtilConstants.SELECT_LEAF;
+import static org.onosproject.yang.compiler.utils.UtilConstants.SERVICE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.SLASH;
+import static org.onosproject.yang.compiler.utils.UtilConstants.SPACE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.SUBTREE_FILTERED;
+import static org.onosproject.yang.compiler.utils.UtilConstants.VALUE_LEAF;
+import static org.onosproject.yang.compiler.utils.UtilConstants.YANG;
+import static org.onosproject.yang.compiler.utils.UtilConstants.YANG_AUGMENTED_INFO_MAP;
+import static org.onosproject.yang.compiler.utils.io.impl.FileSystemUtil.*;
+import static org.onosproject.yang.compiler.utils.io.impl.JavaDocGen.JavaDocType.ADD_TO_LIST;
+import static org.onosproject.yang.compiler.utils.io.impl.JavaDocGen.JavaDocType.GETTER_METHOD;
+import static org.onosproject.yang.compiler.utils.io.impl.JavaDocGen.JavaDocType.SETTER_METHOD;
+import static org.onosproject.yang.compiler.utils.io.impl.JavaDocGen.getJavaDoc;
+import static org.onosproject.yang.compiler.utils.io.impl.YangIoUtils.getAbsolutePackagePath;
+import static org.onosproject.yang.compiler.utils.io.impl.YangIoUtils.getCamelCase;
+import static org.onosproject.yang.compiler.utils.io.impl.YangIoUtils.getCapitalCase;
+import static org.onosproject.yang.compiler.utils.io.impl.YangIoUtils.getPackageDirPathFromJavaJPackage;
+import static org.onosproject.yang.compiler.utils.io.impl.YangIoUtils.insertDataIntoJavaFile;
+import static org.onosproject.yang.compiler.utils.io.impl.YangIoUtils.mergeJavaFiles;
+import static org.onosproject.yang.compiler.utils.io.impl.YangIoUtils.validateLineLength;
+import static org.onosproject.yang.compiler.utils.UtilConstants.BIT_SET;
+import static org.onosproject.yang.compiler.utils.UtilConstants.JAVA_UTIL_PKG;
+import static org.onosproject.yang.compiler.utils.UtilConstants.VALUE_LEAF;
+
+/**
+ * Represents implementation of java code fragments temporary implementations.
+ * Manages the common temp file required for Java file(s) generated.
+ */
+public class TempJavaFragmentFiles {
+
+    /**
+     * File type extension for java classes.
+     */
+    private static final String JAVA_FILE_EXTENSION = ".java";
+
+    /**
+     * File type extension for temporary classes.
+     */
+    private static final String TEMP_FILE_EXTENSION = ".tmp";
+
+    /**
+     * Folder suffix for temporary files folder.
+     */
+    private static final String TEMP_FOLDER_NAME_SUFFIX = "-Temp";
+
+    /**
+     * File name for getter method.
+     */
+    private static final String GETTER_METHOD_FILE_NAME = "GetterMethod";
+
+    /**
+     * File name for setter method.
+     */
+    private static final String SETTER_METHOD_FILE_NAME = "SetterMethod";
+
+    /**
+     * File name for getter method implementation.
+     */
+    private static final String GETTER_METHOD_IMPL_FILE_NAME =
+            "GetterMethodImpl";
+
+    /**
+     * File name for setter method implementation.
+     */
+    private static final String SETTER_METHOD_IMPL_FILE_NAME =
+            "SetterMethodImpl";
+
+    /**
+     * File name for attributes.
+     */
+    private static final String ATTRIBUTE_FILE_NAME = "Attributes";
+
+    /**
+     * File name for to string method.
+     */
+    private static final String TO_STRING_METHOD_FILE_NAME = "ToString";
+
+    /**
+     * File name for hash code method.
+     */
+    private static final String HASH_CODE_METHOD_FILE_NAME = "HashCode";
+
+    /**
+     * File name for equals method.
+     */
+    private static final String EQUALS_METHOD_FILE_NAME = "Equals";
+
+    /**
+     * File name for from string method.
+     */
+    private static final String FROM_STRING_METHOD_FILE_NAME = "FromString";
+
+    /**
+     * File name for from add to list interface method.
+     */
+    private static final String ADD_TO_LIST_INTERFACE_METHOD_FILE_NAME =
+            "addToList";
+
+    /**
+     * File name for from add to list impl method.
+     */
+    private static final String ADD_TO_LIST_IMPL_METHOD_FILE_NAME =
+            "addToListImpl";
+
+    /**
+     * File name for from leaf identifier attributes.
+     */
+    private static final String LEAF_IDENTIFIER_ATTRIBUTES_FILE_NAME =
+            "leafIdentifierAtr";
+
+    /**
+     * File name for is filter content leaf match.
+     */
+    private static final String FILTER_CONTENT_MATCH_LEAF_FILE_NAME =
+            "isFilterContentMatchLeafMask";
+
+    /**
+     * File name for is filter content leaf-list match.
+     */
+    private static final String FILTER_CONTENT_MATCH_LEAF_LIST_FILE_NAME =
+            "isFilterContentMatchLeafListMask";
+
+    /**
+     * File name for is filter content node match.
+     */
+    private static final String FILTER_CONTENT_MATCH_NODE_FILE_NAME =
+            "isFilterContentMatchNodeMask";
+
+    /**
+     * File name for edit content file.
+     */
+    private static final String EDIT_CONTENT_FILE_NAME = "editContentFile";
+
+    /**
+     * File name for interface java file name suffix.
+     */
+    private static final String INTERFACE_FILE_NAME_SUFFIX = EMPTY_STRING;
+
+    /**
+     * File name for builder interface file name suffix.
+     */
+    private static final String BUILDER_INTERFACE_FILE_NAME_SUFFIX =
+            BUILDER + INTERFACE;
+
+    /**
+     * File name for builder class file name suffix.
+     */
+    private static final String BUILDER_CLASS_FILE_NAME_SUFFIX = BUILDER;
+
+    /**
+     * File name for list key class file name suffix.
+     */
+    private static final String KEY_CLASS_FILE_NAME_SUFFIX = KEYS;
+
+    /**
+     * Current attributes YANG node
+     */
+    private YangNode attrNode;
+
+    /**
+     * Information about the java files being generated.
+     */
+    private JavaFileInfoTranslator javaFileInfo;
+
+    /**
+     * Imported class info.
+     */
+    private JavaImportData javaImportData;
+
+    /**
+     * The variable which guides the types of temporary files generated using
+     * the temporary generated file types mask.
+     */
+    private int tempFilesFlagSet;
+
+    /**
+     * Absolute path where the target java file needs to be generated.
+     */
+    private String absoluteDirPath;
+
+    /**
+     * Contains all the interface(s)/class name which will be extended by
+     * generated files.
+     */
+    private JavaExtendsListHolder javaExtendsListHolder;
+
+    /**
+     * Java file handle for interface file.
+     */
+    private File interfaceJavaFileHandle;
+
+    /**
+     * Java file handle for builder interface file.
+     */
+    private File builderInterfaceJavaFileHandle;
+
+    /**
+     * Java file handle for builder class file.
+     */
+    private File builderClassJavaFileHandle;
+
+    /**
+     * Java file handle for impl class file.
+     */
+    private File implClassJavaFileHandle;
+
+    /**
+     * Temporary file handle for attribute.
+     */
+    private File attributesTempFileHandle;
+
+    /**
+     * Temporary file handle for getter of interface.
+     */
+    private File getterInterfaceTempFileHandle;
+
+    /**
+     * Temporary file handle for setter of interface.
+     */
+    private File setterInterfaceTempFileHandle;
+
+    /**
+     * Temporary file handle for getter of class.
+     */
+    private File getterImplTempFileHandle;
+
+    /**
+     * Temporary file handle for setter of class.
+     */
+    private File setterImplTempFileHandle;
+
+    /**
+     * Temporary file handle for hash code method of class.
+     */
+    private File hashCodeImplTempFileHandle;
+
+    /**
+     * Temporary file handle for equals method of class.
+     */
+    private File equalsImplTempFileHandle;
+
+    /**
+     * Temporary file handle for to string method of class.
+     */
+    private File toStringImplTempFileHandle;
+
+    /**
+     * Temporary file handle for from string method of class.
+     */
+    private File fromStringImplTempFileHandle;
+
+    /**
+     * Temporary file handle for add to list interface method of class.
+     */
+    private File addToListInterfaceTempFileHandle;
+
+    /**
+     * Temporary file handle for add to list impl method of class.
+     */
+    private File addToListImplTempFileHandle;
+
+    /**
+     * Temporary file handle for leaf id attributes of enum.
+     */
+    private File leafIdAttributeTempFileHandle;
+
+    /**
+     * Temporary file handle for is content match method for leaf-list.
+     */
+    private File getSubtreeFilteringForListTempFileHandle;
+
+    /**
+     * Temporary file handle for is content match method for node.
+     */
+    private File getSubtreeFilteringForChildNodeTempFileHandle;
+
+    /**
+     * Temporary file handle for is content match method for leaf.
+     */
+    private File subtreeFilteringForLeafTempFileHandle;
+
+    /**
+     * Temporary file handle for edit content file.
+     */
+    private File editContentTempFileHandle;
+
+    /**
+     * Leaf count.
+     */
+    private int leafCount;
+
+    /**
+     * If current node is root node.
+     */
+    private boolean rootNode;
+
+    /**
+     * Is attribute added.
+     */
+    private boolean isAttributePresent;
+
+    /**
+     * Creates an instance of temp JAVA fragment files.
+     */
+    TempJavaFragmentFiles() {
+    }
+
+    /**
+     * Creates an instance of temporary java code fragment.
+     *
+     * @param fileInfo generated java file information
+     * @throws IOException when fails to create new file handle
+     */
+    protected TempJavaFragmentFiles(JavaFileInfoTranslator fileInfo)
+            throws IOException {
+        javaExtendsListHolder = new JavaExtendsListHolder();
+        javaImportData = new JavaImportData();
+        javaFileInfo = fileInfo;
+        absoluteDirPath = getAbsolutePackagePath(fileInfo.getBaseCodeGenPath(),
+                                                 fileInfo.getPackageFilePath());
+        /*
+         * Initialize getter when generation file type matches to interface
+         * mask.
+         */
+        if (javaFlagSet(INTERFACE_MASK)) {
+            addGeneratedTempFile(GETTER_FOR_INTERFACE_MASK |
+                                         ADD_TO_LIST_INTERFACE_MASK |
+                                         LEAF_IDENTIFIER_ENUM_ATTRIBUTES_MASK);
+        }
+        /*
+         * Initialize getter and setter when generation file type matches to
+         * builder interface mask.
+         */
+        if (javaFlagSet(BUILDER_INTERFACE_MASK)) {
+            addGeneratedTempFile(GETTER_FOR_INTERFACE_MASK |
+                                         SETTER_FOR_INTERFACE_MASK);
+        }
+        /*
+         * Initialize getterImpl, setterImpl and attributes when generation file
+         * type matches to builder class mask.
+         */
+        if (javaFlagSet(BUILDER_CLASS_MASK)) {
+            addGeneratedTempFile(ATTRIBUTES_MASK | GETTER_FOR_CLASS_MASK |
+                                         SETTER_FOR_CLASS_MASK);
+        }
+        /*
+         * Initialize getterImpl, attributes, constructor, hash code, equals and
+         * to strings when generation file type matches to impl class mask.
+         */
+        if (javaFlagSet(DEFAULT_CLASS_MASK)) {
+            addGeneratedTempFile(
+                    ATTRIBUTES_MASK | GETTER_FOR_CLASS_MASK |
+                            HASH_CODE_IMPL_MASK | EQUALS_IMPL_MASK |
+                            TO_STRING_IMPL_MASK | ADD_TO_LIST_IMPL_MASK |
+                            FILTER_CONTENT_MATCH_FOR_LEAF_LIST_MASK |
+                            FILTER_CONTENT_MATCH_FOR_LEAF_MASK |
+                            FILTER_CONTENT_MATCH_FOR_NODES_MASK);
+        }
+        /*
+         * Initialize temp files to generate type class.
+         */
+        if (javaFlagSet(GENERATE_TYPE_CLASS)) {
+            addGeneratedTempFile(ATTRIBUTES_MASK | GETTER_FOR_CLASS_MASK |
+                                         HASH_CODE_IMPL_MASK | EQUALS_IMPL_MASK |
+                                         FROM_STRING_IMPL_MASK);
+
+            if (getGeneratedJavaFiles() != GENERATE_UNION_CLASS) {
+                addGeneratedTempFile(TO_STRING_IMPL_MASK);
+            }
+        }
+
+        //Set temporary file handles
+        if (tempFlagSet(ATTRIBUTES_MASK)) {
+            attributesTempFileHandle =
+                    getTemporaryFileHandle(ATTRIBUTE_FILE_NAME);
+        }
+        if (tempFlagSet(GETTER_FOR_INTERFACE_MASK)) {
+            getterInterfaceTempFileHandle =
+                    getTemporaryFileHandle(GETTER_METHOD_FILE_NAME);
+        }
+        if (tempFlagSet(SETTER_FOR_INTERFACE_MASK)) {
+            setterInterfaceTempFileHandle =
+                    getTemporaryFileHandle(SETTER_METHOD_FILE_NAME);
+        }
+        if (tempFlagSet(GETTER_FOR_CLASS_MASK)) {
+            getterImplTempFileHandle =
+                    getTemporaryFileHandle(GETTER_METHOD_IMPL_FILE_NAME);
+        }
+        if (tempFlagSet(SETTER_FOR_CLASS_MASK)) {
+            setterImplTempFileHandle =
+                    getTemporaryFileHandle(SETTER_METHOD_IMPL_FILE_NAME);
+        }
+        if (tempFlagSet(HASH_CODE_IMPL_MASK)) {
+            hashCodeImplTempFileHandle =
+                    getTemporaryFileHandle(HASH_CODE_METHOD_FILE_NAME);
+        }
+        if (tempFlagSet(EQUALS_IMPL_MASK)) {
+            equalsImplTempFileHandle =
+                    getTemporaryFileHandle(EQUALS_METHOD_FILE_NAME);
+        }
+        if (tempFlagSet(TO_STRING_IMPL_MASK)) {
+            toStringImplTempFileHandle =
+                    getTemporaryFileHandle(TO_STRING_METHOD_FILE_NAME);
+        }
+        if (tempFlagSet(FROM_STRING_IMPL_MASK)) {
+            fromStringImplTempFileHandle =
+                    getTemporaryFileHandle(FROM_STRING_METHOD_FILE_NAME);
+        }
+        if (tempFlagSet(ADD_TO_LIST_INTERFACE_MASK)) {
+            addToListInterfaceTempFileHandle =
+                    getTemporaryFileHandle(ADD_TO_LIST_INTERFACE_METHOD_FILE_NAME);
+        }
+        if (tempFlagSet(ADD_TO_LIST_IMPL_MASK)) {
+            addToListImplTempFileHandle =
+                    getTemporaryFileHandle(ADD_TO_LIST_IMPL_METHOD_FILE_NAME);
+        }
+        if (tempFlagSet(LEAF_IDENTIFIER_ENUM_ATTRIBUTES_MASK)) {
+            leafIdAttributeTempFileHandle =
+                    getTemporaryFileHandle(LEAF_IDENTIFIER_ATTRIBUTES_FILE_NAME);
+        }
+        if (tempFlagSet(FILTER_CONTENT_MATCH_FOR_LEAF_MASK)) {
+            subtreeFilteringForLeafTempFileHandle =
+                    getTemporaryFileHandle(FILTER_CONTENT_MATCH_LEAF_FILE_NAME);
+        }
+        if (tempFlagSet(FILTER_CONTENT_MATCH_FOR_LEAF_LIST_MASK)) {
+            getSubtreeFilteringForListTempFileHandle =
+                    getTemporaryFileHandle(FILTER_CONTENT_MATCH_LEAF_LIST_FILE_NAME);
+        }
+        if (tempFlagSet(FILTER_CONTENT_MATCH_FOR_NODES_MASK)) {
+            getSubtreeFilteringForChildNodeTempFileHandle =
+                    getTemporaryFileHandle(FILTER_CONTENT_MATCH_NODE_FILE_NAME);
+        }
+        if (tempFlagSet(EDIT_CONTENT_MASK)) {
+            editContentTempFileHandle =
+                    getTemporaryFileHandle(EDIT_CONTENT_FILE_NAME);
+        }
+    }
+
+    /**
+     * Adds current node info as and attribute to the parent generated file.
+     *
+     * @param curNode current node
+     * @param isList  is list construct
+     * @param config  plugin configurations
+     * @throws IOException IO operation exception
+     */
+    protected static void addCurNodeInfoInParentTempFile(YangNode curNode,
+                                                         boolean isList,
+                                                         YangPluginConfig config)
+            throws IOException {
+        YangNode parent = getParentNodeInGenCode(curNode);
+        if (!(parent instanceof JavaCodeGenerator)) {
+            throw new TranslatorException(getErrorMsg(MISSING_PARENT_NODE,
+                                                      curNode));
+        }
+        if (parent instanceof YangJavaGroupingTranslator) {
+            /*
+             * In case of grouping, there is no need to add the information, it
+             * will be taken care in uses.
+             */
+            return;
+        }
+        addCurNodeInfoInParentTempFile(curNode, isList, config, parent);
+    }
+
+    /**
+     * Adds current node info as and attribute to a specified parent generated
+     * file. In case of grouping parent will be referred grouping node or
+     * referred node in grouping.
+     *
+     * @param curNode current node
+     * @param isList  is list construct
+     * @param config  plugin configurations
+     * @param parent  parent node
+     * @throws IOException IO operation exception
+     */
+    protected static void addCurNodeInfoInParentTempFile(
+            YangNode curNode, boolean isList, YangPluginConfig config,
+            YangNode parent)
+            throws IOException {
+        TempJavaBeanFragmentFiles tempFiles =
+                getBeanFiles((JavaCodeGeneratorInfo) parent);
+        tempFiles.setAttrNode(curNode);
+        JavaFileInfoTranslator fileInfo = ((JavaCodeGeneratorInfo) parent)
+                .getJavaFileInfo();
+        if (curNode instanceof YangChoice && curNode.isOpTypeReq()) {
+            JavaQualifiedTypeInfoTranslator info = new
+                    JavaQualifiedTypeInfoTranslator();
+            info.setClassInfo(INVOCATION_TARGET_EXCEPTION);
+            info.setPkgInfo(REFLECT_IMPORTS);
+            info.setForInterface(false);
+            tempFiles.getJavaImportData().addImportInfo(
+                    info, getCapitalCase(fileInfo.getJavaName()),
+                    fileInfo.getPackage());
+        }
+        JavaAttributeInfo attr = getCurNodeAsAttributeInTarget(
+                curNode, parent, isList, tempFiles);
+        tempFiles.addJavaSnippetInfoToApplicableTempFiles(attr, config);
+    }
+
+    /**
+     * Creates an attribute info object corresponding to a data model node
+     * and return it.
+     *
+     * @param curNode    current node
+     * @param targetNode target node
+     * @param listNode   flag indicating if a node is a list node
+     * @param tempFiles  temp java fragment files
+     * @return java attribute info
+     */
+    public static JavaAttributeInfo
+    getCurNodeAsAttributeInTarget(YangNode curNode, YangNode targetNode,
+                                  boolean listNode,
+                                  TempJavaFragmentFiles tempFiles) {
+        JavaFileInfoTranslator translator =
+                ((JavaFileInfoContainer) curNode).getJavaFileInfo();
+        String curNodeName = translator.getJavaName();
+        if (curNodeName == null) {
+            updateJavaFileInfo(curNode, null);
+            curNodeName = translator.getJavaName();
+        }
+        /*
+         * Get the import info corresponding to the attribute for import in
+         * generated java files or qualified access.
+         */
+        JavaQualifiedTypeInfoTranslator typeInfo =
+                getQualifiedTypeInfoOfCurNode(curNode,
+                                              getCapitalCase(curNodeName));
+        if (!(targetNode instanceof TempJavaCodeFragmentFilesContainer)) {
+            throw new TranslatorException(getErrorMsg(INVALID_PARENT_NODE,
+                                                      curNode));
+        }
+        JavaImportData parentImportData = tempFiles.getJavaImportData();
+        JavaFileInfoTranslator fileInfo =
+                ((JavaFileInfoContainer) targetNode).getJavaFileInfo();
+
+        boolean qualified;
+        if (tempFiles instanceof TempJavaServiceFragmentFiles &&
+                typeInfo.getClassInfo().contentEquals(SERVICE) ||
+                typeInfo.getClassInfo()
+                        .contentEquals(getCapitalCase(fileInfo.getJavaName() +
+                                                              SERVICE))) {
+            qualified = true;
+        } else {
+            String className;
+            if (tempFiles instanceof TempJavaServiceFragmentFiles) {
+                className = getCapitalCase(fileInfo.getJavaName()) + SERVICE;
+            } else {
+                className = getCapitalCase(fileInfo.getJavaName());
+            }
+            qualified = parentImportData.addImportInfo(typeInfo, className,
+                                                       fileInfo.getPackage());
+            if (!qualified && !(curNode instanceof YangChoice) &&
+                    targetNode.isOpTypeReq()) {
+                String name = DEFAULT_CAPS + typeInfo.getClassInfo();
+                JavaQualifiedTypeInfoTranslator qInfo =
+                        new JavaQualifiedTypeInfoTranslator();
+                qInfo.setForInterface(false);
+                qInfo.setPkgInfo(typeInfo.getPkgInfo());
+                qInfo.setClassInfo(name);
+                parentImportData.addImportInfo(qInfo, className,
+                                               fileInfo.getPackage());
+            }
+        }
+        boolean collectionSet = false;
+        if (curNode instanceof YangList) {
+            YangList yangList = (YangList) curNode;
+            YangDataStructure ds = getYangDataStructure(
+                    yangList.getCompilerAnnotation());
+            if (ds != null) {
+                switch (ds) {
+                    case QUEUE:
+                        parentImportData.setQueueToImport(true);
+                        collectionSet = true;
+                        break;
+
+                    case SET:
+                        parentImportData.setSetToImport(true);
+                        collectionSet = true;
+                        break;
+
+                    case MAP:
+                        parentImportData.setMapToImport(true);
+                        collectionSet = true;
+                        break;
+
+                    default: {
+                        parentImportData.setIfListImported(true);
+                        collectionSet = true;
+                    }
+                }
+            }
+        }
+        if (listNode && !collectionSet) {
+            parentImportData.setIfListImported(true);
+        }
+        if (curNode instanceof YangList) {
+            return getAttributeInfoForTheData(typeInfo, curNodeName,
+                                              null, qualified, listNode,
+                                              ((YangList) curNode)
+                                                      .getCompilerAnnotation());
+        }
+        return getAttributeInfoForTheData(typeInfo, curNodeName, null,
+                                          qualified, listNode);
+    }
+
+    /**
+     * Returns java attribute for leaf.
+     *
+     * @param tempFiles temporary generated file
+     * @param container JAVA leaf info container
+     * @param config    plugin configurations
+     * @param leafList  flag indicating if it's leaf list
+     * @return java attribute info
+     */
+    private static JavaAttributeInfo
+    getJavaAttributeOfLeaf(TempJavaFragmentFiles tempFiles,
+                           JavaLeafInfoContainer container,
+                           YangPluginConfig config, boolean leafList) throws IOException {
+        if (leafList) {
+            tempFiles.getJavaImportData().setIfListImported(true);
+            return getAttributeOfLeafInfoContainer(tempFiles, container, config,
+                                                   true);
+        }
+        return getAttributeOfLeafInfoContainer(tempFiles, container, config,
+                                               false);
+    }
+
+    /**
+     * Returns java attribute for leaf container.
+     *
+     * @param tempFiles     temporary generated file
+     * @param container     JAVA leaf info container
+     * @param config        plugin configurations
+     * @param listAttribute flag indicating if list attribute
+     * @return JAVA attribute information
+     * @throws IOException when fails to do IO operations
+     */
+    private static JavaAttributeInfo
+    getAttributeOfLeafInfoContainer(TempJavaFragmentFiles tempFiles,
+                                    JavaLeafInfoContainer container,
+                                    YangPluginConfig config,
+                                    boolean listAttribute) throws IOException {
+        container.setConflictResolveConfig(config.getConflictResolver());
+        container.updateJavaQualifiedInfo();
+        addImportForLeafInfo(tempFiles, container);
+        JavaAttributeInfo attr = getAttributeInfoForTheData(
+                container.getJavaQualifiedInfo(),
+                container.getJavaName(config.getConflictResolver()),
+                container.getDataType(),
+                tempFiles.getIsQualifiedAccessOrAddToImportList(
+                        container.getJavaQualifiedInfo()), listAttribute);
+        boolean condition =
+                ((YangSchemaNode) container).getReferredSchema() == null &&
+                        container.getDataType().getDataType() == BITS;
+        if (condition) {
+            addBitsHandler(attr, container.getDataType(), tempFiles);
+        }
+        return attr;
+    }
+
+    /**
+     * Returns list of java attribute for keys of list node.
+     *
+     * @param curNode current list node
+     * @return attribute list
+     * @throws IOException when fails to do IO operations
+     */
+    public static List<JavaAttributeInfo> getListOfAttributesForKey(
+            YangNode curNode) throws IOException {
+        List<String> keys = ((YangList) curNode).getKeyList();
+
+        JavaFileInfoTranslator fileInfo =
+                ((JavaFileInfoContainer) curNode).getJavaFileInfo();
+        YangLeavesHolder holder = (YangLeavesHolder) curNode;
+        Iterator<String> keyIt = keys.iterator();
+        Iterator<YangLeaf> leafIt;
+        String key;
+        YangJavaLeafTranslator leaf;
+        TempJavaBeanFragmentFiles beanFile = getBeanFiles(curNode);
+        List<JavaAttributeInfo> attrs = new ArrayList<>();
+        while (keyIt.hasNext()) {
+            key = keyIt.next();
+            leafIt = holder.getListOfLeaf().iterator();
+            while (leafIt.hasNext()) {
+                leaf = (YangJavaLeafTranslator) leafIt.next();
+                if (key.equals(leaf.getName())) {
+                    attrs.add(getAttributeOfLeafInfoContainer(
+                            beanFile, leaf,
+                            fileInfo.getPluginConfig(), false));
+                }
+            }
+        }
+        return attrs;
+    }
+
+    /**
+     * Adds bits handler attribute for bits to string method.
+     *
+     * @param attr      attribute
+     * @param type      type
+     * @param tempFiles temp fragment file
+     */
+    static void addBitsHandler(JavaAttributeInfo attr, YangType type,
+                               TempJavaFragmentFiles tempFiles)
+            throws IOException {
+        generateBitsFile(attr, type, tempFiles.getJavaFileInfo(), tempFiles);
+    }
+
+    /**
+     * Adds attribute types import to leaf info container's parent.
+     *
+     * @param tempFiles temp java file
+     * @param container leaf info container
+     */
+    private static void addImportForLeafInfo(TempJavaFragmentFiles tempFiles,
+                                             JavaLeafInfoContainer container) {
+        String containedInCls = getCapitalCase(tempFiles.getJavaFileInfo()
+                                                       .getJavaName());
+        String containedInPkg = tempFiles.getJavaFileInfo().getPackage();
+        JavaQualifiedTypeInfoTranslator info;
+        if (container.getDataType().getDataType() == BITS) {
+            //Add bitset import for type and leaf value flags.
+            info = new JavaQualifiedTypeInfoTranslator();
+            info.setClassInfo(BIT_SET);
+            info.setPkgInfo(JAVA_UTIL_PKG);
+            tempFiles.getJavaImportData().addImportInfo(info, containedInCls,
+                                                        containedInPkg);
+        }
+        tempFiles.getJavaImportData().addImportInfo(
+                (JavaQualifiedTypeInfoTranslator) container
+                        .getJavaQualifiedInfo(), containedInCls, containedInPkg);
+    }
+
+    /**
+     * Sets absolute path where the file needs to be generated.
+     *
+     * @param absoluteDirPath absolute path where the file needs to be
+     *                        generated
+     */
+    protected void setAbsoluteDirPath(String absoluteDirPath) {
+        this.absoluteDirPath = absoluteDirPath;
+    }
+
+    /**
+     * Returns the generated java file information.
+     *
+     * @return generated java file information
+     */
+    protected JavaFileInfoTranslator getJavaFileInfo() {
+        return javaFileInfo;
+    }
+
+    /**
+     * Sets the generated java file information.
+     *
+     * @param javaFileInfo generated java file information
+     */
+    protected void setJavaFileInfo(JavaFileInfoTranslator javaFileInfo) {
+        this.javaFileInfo = javaFileInfo;
+    }
+
+    /**
+     * Returns the flag-set for generated temp files.
+     *
+     * @return flag-set
+     */
+    protected int getGeneratedTempFiles() {
+        return tempFilesFlagSet;
+    }
+
+    /**
+     * Adds to the flag-set for generated temp files.
+     *
+     * @param flags generated temp files flag-set
+     */
+    protected void addGeneratedTempFile(int flags) {
+        tempFilesFlagSet |= flags;
+    }
+
+    /**
+     * Returns the generated Java files.
+     *
+     * @return generated Java files
+     */
+    protected int getGeneratedJavaFiles() {
+        return javaFileInfo.getGeneratedFileTypes();
+    }
+
+    /**
+     * Retrieves the mapped Java class name.
+     *
+     * @return mapped Java class name
+     */
+    protected String getGeneratedJavaClassName() {
+        return getCapitalCase(javaFileInfo.getJavaName());
+    }
+
+    /**
+     * Retrieves the import data for the generated Java file.
+     *
+     * @return import data for the generated Java file
+     */
+    public JavaImportData getJavaImportData() {
+        return javaImportData;
+    }
+
+    /**
+     * Sets import data for the generated Java file.
+     *
+     * @param data import data for the generated Java file
+     */
+    protected void setJavaImportData(JavaImportData data) {
+        javaImportData = data;
+    }
+
+    /**
+     * Retrieves the status of any attributes added.
+     *
+     * @return status of any attributes added
+     */
+    protected boolean isAttributePresent() {
+        return isAttributePresent;
+    }
+
+    /**
+     * Returns getter methods's temporary file handle.
+     *
+     * @return temporary file handle
+     */
+    public File getGetterInterfaceTempFileHandle() {
+        return getterInterfaceTempFileHandle;
+    }
+
+    /**
+     * Returns setter method's temporary file handle.
+     *
+     * @return temporary file handle
+     */
+    public File getSetterInterfaceTempFileHandle() {
+        return setterInterfaceTempFileHandle;
+    }
+
+    /**
+     * Returns setter method's impl's temporary file handle.
+     *
+     * @return temporary file handle
+     */
+    public File getSetterImplTempFileHandle() {
+        return setterImplTempFileHandle;
+    }
+
+    /**
+     * Returns from string method's temporary file handle.
+     *
+     * @return from string method's temporary file handle
+     */
+    public File getFromStringImplTempFileHandle() {
+        return fromStringImplTempFileHandle;
+    }
+
+    /**
+     * Returns attribute's temporary file handle.
+     *
+     * @return temporary file handle
+     */
+    public File getAttributesTempFileHandle() {
+        return attributesTempFileHandle;
+    }
+
+    /**
+     * Returns getter method's impl's temporary file handle.
+     *
+     * @return temporary file handle
+     */
+    public File getGetterImplTempFileHandle() {
+        return getterImplTempFileHandle;
+    }
+
+    /**
+     * Returns hash code method's temporary file handle.
+     *
+     * @return temporary file handle
+     */
+    public File getHashCodeImplTempFileHandle() {
+        return hashCodeImplTempFileHandle;
+    }
+
+    /**
+     * Returns equals method's temporary file handle.
+     *
+     * @return temporary file handle
+     */
+    public File getEqualsImplTempFileHandle() {
+        return equalsImplTempFileHandle;
+    }
+
+    /**
+     * Returns to string method's temporary file handle.
+     *
+     * @return temporary file handle
+     */
+    public File getToStringImplTempFileHandle() {
+        return toStringImplTempFileHandle;
+    }
+
+    /**
+     * Returns java extends list holder.
+     *
+     * @return java extends list holder
+     */
+    public JavaExtendsListHolder getJavaExtendsListHolder() {
+        return javaExtendsListHolder;
+    }
+
+    /**
+     * Sets java extends list holder.
+     *
+     * @param holder java extends list holder
+     */
+    protected void setJavaExtendsListHolder(
+            JavaExtendsListHolder holder) {
+        javaExtendsListHolder = holder;
+    }
+
+    /**
+     * Adds is filter content match for leaf.
+     *
+     * @param attr java attribute
+     * @throws IOException when fails to do IO operations
+     */
+    private void addSubTreeFilteringForLeaf(JavaAttributeInfo attr)
+            throws IOException {
+        appendToFile(subtreeFilteringForLeafTempFileHandle,
+                     getSubtreeFilteringForLeaf(attr, attr.getAttributeType()) +
+                             NEW_LINE);
+    }
+
+    /**
+     * Adds is filter content match for leaf-list.
+     *
+     * @param attr java attribute
+     * @throws IOException when fails to do IO operations
+     */
+    private void addSubtreeFilteringForLeafList(JavaAttributeInfo attr)
+            throws IOException {
+        appendToFile(getSubtreeFilteringForListTempFileHandle,
+                     getSubtreeFilteringForLeafList(attr) + NEW_LINE);
+    }
+
+    /**
+     * Adds is filter content match for nodes.
+     *
+     * @param attr java attribute
+     * @throws IOException when fails to do IO operations
+     */
+    private void addSubtreeFilteringForChildNode(JavaAttributeInfo attr)
+            throws IOException {
+        appendToFile(getSubtreeFilteringForChildNodeTempFileHandle,
+                     getSubtreeFilteringForNode(attr, attrNode) + NEW_LINE);
+    }
+
+    /**
+     * Adds attribute for class.
+     *
+     * @param attr attribute info
+     * @throws IOException when fails to append to temporary file
+     */
+    private void addAttribute(JavaAttributeInfo attr)
+            throws IOException {
+        appendToFile(attributesTempFileHandle, parseAttribute(attr));
+    }
+
+    /**
+     * Adds getter for interface.
+     *
+     * @param attr attribute info
+     * @throws IOException when fails to append to temporary file
+     */
+    private void addGetterForInterface(JavaAttributeInfo attr)
+            throws IOException {
+        appendToFile(getterInterfaceTempFileHandle,
+                     getGetterString(attr, getGeneratedJavaFiles()) +
+                             NEW_LINE);
+    }
+
+    /**
+     * Adds setter for interface.
+     *
+     * @param attr attribute info
+     * @throws IOException when fails to append to temporary file
+     */
+    private void addSetterForInterface(JavaAttributeInfo attr)
+            throws IOException {
+        appendToFile(setterInterfaceTempFileHandle,
+                     getSetterString(attr, getGeneratedJavaClassName(),
+                                     getGeneratedJavaFiles()) + NEW_LINE);
+    }
+
+    /**
+     * Adds setter's implementation for class.
+     *
+     * @param attr attribute info
+     * @throws IOException when fails to append to temporary file
+     */
+    private void addSetterImpl(JavaAttributeInfo attr)
+            throws IOException {
+        String setter = getSetterForClass(attr, getGeneratedJavaClassName(),
+                                          getGeneratedJavaFiles());
+        String javadoc = getOverRideString();
+        if (attr.getAttributeName().equals(SUBTREE_FILTERED)) {
+            javadoc = getJavaDoc(SETTER_METHOD, attr.getAttributeName(),
+                                 false, null);
+        }
+        appendToFile(setterImplTempFileHandle, javadoc + setter);
+    }
+
+    /**
+     * Adds getter method's impl for class.
+     *
+     * @param attr attribute info
+     * @throws IOException when fails to append to temporary file
+     */
+    protected void addGetterImpl(JavaAttributeInfo attr)
+            throws IOException {
+        String getter = getGetterForClass(attr, getGeneratedJavaFiles());
+        String javadoc = getOverRideString();
+        YangDataStructure ds = getYangDataStructure(
+                attr.getCompilerAnnotation());
+        String annotation = null;
+        if (ds != null) {
+            annotation = ds.name();
+        }
+        if (attr.getAttributeName().equals(SUBTREE_FILTERED)) {
+            javadoc = getJavaDoc(GETTER_METHOD, attr.getAttributeName(),
+                                 false, annotation);
+        }
+        if (javaFlagSet(BUILDER_CLASS_MASK)) {
+            appendToFile(getterImplTempFileHandle, javadoc + getter);
+        } else {
+            appendToFile(getterImplTempFileHandle,
+                         getJavaDoc(GETTER_METHOD, attr.getAttributeName(),
+                                    false, annotation) + getter);
+        }
+    }
+
+    /**
+     * Adds add to list interface method.
+     *
+     * @param attr attribute
+     * @throws IOException when fails to do IO operations
+     */
+    private void addAddToListInterface(JavaAttributeInfo attr)
+            throws IOException {
+        YangDataStructure ds = getYangDataStructure(
+                attr.getCompilerAnnotation());
+        String annotation = null;
+        if (ds != null) {
+            annotation = ds.name();
+        }
+        appendToFile(addToListInterfaceTempFileHandle,
+                     getJavaDoc(ADD_TO_LIST, attr.getAttributeName(), false,
+                                annotation) + getAddToListMethodInterface(
+                             attr, getGeneratedJavaClassName()) + NEW_LINE);
+    }
+
+    /**
+     * Adds add to list interface method.
+     *
+     * @param attr attribute
+     * @throws IOException when fails to do IO operations
+     */
+    private void addAddToListImpl(JavaAttributeInfo attr)
+            throws IOException {
+        appendToFile(addToListImplTempFileHandle,
+                     getAddToListMethodImpl(attr, getGeneratedJavaClassName()
+                     ) + NEW_LINE);
+    }
+
+    /**
+     * Adds leaf identifier enum attributes.
+     *
+     * @param attr  attribute
+     * @param value value
+     * @throws IOException when fails to do IO operations
+     */
+    private void addLeafIdAttributes(JavaAttributeInfo attr, int value)
+            throws IOException {
+        appendToFile(leafIdAttributeTempFileHandle, FOUR_SPACE_INDENTATION +
+                generateEnumAttributeString(attr.getAttributeName(), value));
+    }
+
+    /**
+     * Adds build method for interface.
+     *
+     * @return build method for interface
+     * @throws IOException when fails to append to temporary file
+     */
+    protected String addBuildMethodForInterface()
+            throws IOException {
+        return parseBuilderInterfaceBuildMethodString(
+                getGeneratedJavaClassName());
+    }
+
+    /**
+     * Adds build method's implementation for class.
+     *
+     * @return build method implementation for class
+     * @throws IOException when fails to append to temporary file
+     */
+    protected String addBuildMethodImpl()
+            throws IOException {
+        return getBuildString(getGeneratedJavaClassName(), rootNode) + NEW_LINE;
+    }
+
+    /**
+     * Adds default constructor for class.
+     *
+     * @param modifier modifier for constructor
+     * @param toAppend string which need to be appended with the class name
+     * @param suffix   is value need to be appended as suffix
+     * @return default constructor for class
+     * @throws IOException when fails to append to file
+     */
+    protected String addDefaultConstructor(String modifier, String toAppend,
+                                           boolean suffix)
+            throws IOException {
+        StringBuilder name = new StringBuilder();
+        name.append(getGeneratedJavaClassName());
+        if (rootNode && !toAppend.equals(BUILDER)) {
+            name.append(OP_PARAM);
+            return getDefaultConstructorString(name.toString(), modifier);
+        }
+        if (suffix) {
+            name.append(toAppend);
+            return getDefaultConstructorString(name.toString(), modifier);
+        }
+        StringBuilder appended = new StringBuilder();
+        if (toAppend.equals(DEFAULT)) {
+            appended.append(getCapitalCase(toAppend));
+        } else {
+            appended.append(toAppend);
+        }
+        return NEW_LINE + getDefaultConstructorString(appended.append(
+                name).toString(), modifier);
+        // TODO getDefaultConstructorString to handle new line.
+    }
+
+    /**
+     * Adds hash code method for class.
+     *
+     * @param attr attribute info
+     * @throws IOException when fails to append to temporary file
+     */
+    private void addHashCodeMethod(JavaAttributeInfo attr)
+            throws IOException {
+        appendToFile(hashCodeImplTempFileHandle,
+                     getHashCodeMethod(attr) + NEW_LINE);
+    }
+
+    /**
+     * Adds equals method for class.
+     *
+     * @param attr attribute info
+     * @throws IOException when fails to append to temporary file
+     */
+    private void addEqualsMethod(JavaAttributeInfo attr)
+            throws IOException {
+        appendToFile(equalsImplTempFileHandle,
+                     getEqualsMethod(attr) + NEW_LINE);
+    }
+
+    /**
+     * Adds ToString method for class.
+     *
+     * @param attr attribute info
+     * @throws IOException when fails to append to temporary file
+     */
+    private void addToStringMethod(JavaAttributeInfo attr)
+            throws IOException {
+        appendToFile(toStringImplTempFileHandle,
+                     getToStringMethod(attr) + NEW_LINE);
+    }
+
+    /**
+     * Adds from string method for union class.
+     *
+     * @param attr           type attribute info
+     * @param fromStringAttr from string attribute info
+     * @throws IOException when fails to append to temporary file
+     */
+    void addFromStringMethod(JavaAttributeInfo attr,
+                             JavaAttributeInfo fromStringAttr)
+            throws IOException {
+        appendToFile(fromStringImplTempFileHandle,
+                     getFromStringMethod(attr, fromStringAttr) + NEW_LINE);
+    }
+
+    /**
+     * Returns a temporary file handle for the specific file type.
+     *
+     * @param fileName file name
+     * @return temporary file handle
+     * @throws IOException when fails to create new file handle
+     */
+    protected File getTemporaryFileHandle(String fileName)
+            throws IOException {
+        String path = getTempDirPath(absoluteDirPath);
+        File dir = new File(path);
+        boolean isCreated;
+        if (!dir.exists()) {
+            isCreated = dir.mkdirs();
+            if (!isCreated) {
+                throw new IOException("failed to create temporary directory " +
+                                              "for " + fileName);
+            }
+        }
+        File file = new File(path + fileName + TEMP_FILE_EXTENSION);
+        if (!file.exists()) {
+            isCreated = file.createNewFile();
+            if (!isCreated) {
+                throw new IOException("failed to create temporary file for " +
+                                              fileName);
+            }
+        } else {
+            throw new IOException(fileName + " is reused due to YANG naming. " +
+                                          "probably your previous build " +
+                                          "would have failed");
+        }
+        return file;
+    }
+
+    /**
+     * Returns a temporary file handle for the specific file type.
+     *
+     * @param fileName file name
+     * @return temporary file handle
+     * @throws IOException when fails to create new file handle
+     */
+    public File getJavaFileHandle(String fileName)
+            throws IOException {
+        return getFileObject(getDirPath(), fileName, JAVA_FILE_EXTENSION,
+                             javaFileInfo);
+    }
+
+    /**
+     * Returns data from the temporary files.
+     *
+     * @param file         temporary file handle
+     * @param absolutePath absolute path
+     * @return stored data from temporary files
+     * @throws IOException when failed to get data from the given file
+     */
+    public String getTemporaryDataFromFileHandle(File file, String absolutePath)
+            throws IOException {
+        String path = getTempDirPath(absolutePath);
+        if (new File(path + file.getName()).exists()) {
+            return readAppendFile(path + file.getName(), EMPTY_STRING);
+        }
+        throw new IOException("Unable to get data from the given " +
+                                      file.getName() + " file for " +
+                                      getGeneratedJavaClassName() + PERIOD);
+    }
+
+    /**
+     * Returns temporary directory path.
+     *
+     * @param path absolute path
+     * @return directory path
+     */
+    private String getTempDirPath(String path) {
+        return getPackageDirPathFromJavaJPackage(path) + SLASH +
+                getGeneratedJavaClassName() + TEMP_FOLDER_NAME_SUFFIX + SLASH;
+    }
+
+    /**
+     * Parses attribute to get the attribute string.
+     *
+     * @param attr attribute info
+     * @return attribute string
+     */
+    protected String parseAttribute(JavaAttributeInfo attr) {
+        /*
+         * TODO: check if this utility needs to be called or move to the caller
+         */
+        String attrName = attr.getAttributeName();
+        String attrAccessType = PRIVATE;
+        if ((getGeneratedJavaFiles() & GENERATE_INTERFACE_WITH_BUILDER) != 0) {
+            attrAccessType = PROTECTED;
+        }
+        String pkg = null;
+        if (attr.isQualifiedName()) {
+            pkg = attr.getImportInfo().getPkgInfo();
+        }
+        String attrType = attr.getImportInfo().getClassInfo();
+        if (attr.getAttributeType() != null &&
+                attr.getAttributeType().getDataType() == IDENTITYREF) {
+            String type = attrType;
+            if (pkg != null) {
+                type = pkg + PERIOD + attrType;
+            }
+            attrType = CLASS_STRING + DIAMOND_OPEN_BRACKET +
+                    QUESTION_MARK + SPACE + EXTEND + SPACE + type +
+                    DIAMOND_CLOSE_BRACKET;
+            return getJavaAttributeDefinition(
+                    null, attrType, attrName, attr.isListAttr(), attrAccessType,
+                    attr.getCompilerAnnotation());
+        }
+
+        return getJavaAttributeDefinition(
+                pkg, attrType, attrName, attr.isListAttr(), attrAccessType,
+                attr.getCompilerAnnotation());
+    }
+
+    /**
+     * Appends content to temporary file.
+     *
+     * @param file temporary file
+     * @param data data to be appended
+     * @throws IOException when fails to append to file
+     */
+    protected void appendToFile(File file, String data)
+            throws IOException {
+        try {
+            insertDataIntoJavaFile(file, data);
+        } catch (IOException ex) {
+            throw new IOException("failed to write in temp file.");
+        }
+    }
+
+    /**
+     * Adds parent's info to current node import list.
+     *
+     * @param curNode current node
+     * @param config  plugin configurations
+     */
+    protected void addParentInfoInCurNodeTempFile(YangNode curNode,
+                                                  YangPluginConfig config) {
+        JavaQualifiedTypeInfoTranslator caseImportInfo =
+                new JavaQualifiedTypeInfoTranslator();
+        YangNode parent = getParentNodeInGenCode(curNode);
+        if (curNode instanceof YangCase && parent instanceof YangAugment) {
+            return;
+        }
+        if (!(parent instanceof JavaCodeGenerator)) {
+            throw new TranslatorException(getErrorMsg(INVALID_PARENT_NODE, curNode));
+        }
+        if (!(curNode instanceof JavaFileInfoContainer)) {
+            throw new TranslatorException(getErrorMsg(INVALID_NODE, curNode));
+        }
+        caseImportInfo.setClassInfo(
+                getCapitalCase(getCamelCase(parent.getName(),
+                                            config.getConflictResolver())));
+        caseImportInfo.setPkgInfo(((JavaFileInfoContainer) parent).getJavaFileInfo()
+                                          .getPackage());
+
+        JavaFileInfoTranslator fileInfo =
+                ((JavaFileInfoContainer) curNode).getJavaFileInfo();
+
+        getBeanFiles(curNode).getJavaImportData().addImportInfo(
+                caseImportInfo, getCapitalCase(fileInfo.getJavaName()),
+                fileInfo.getPackage());
+    }
+
+    /**
+     * Adds leaf attributes in generated files.
+     *
+     * @param entry    JAVA leaf info container
+     * @param config   plugin config
+     * @param curNode  current node
+     * @param leafList flag indicating whether leaf container is leafList
+     * @throws IOException IO operation fail
+     */
+    private void addLeafInfoToTempFiles(JavaLeafInfoContainer entry,
+                                        YangPluginConfig config,
+                                        YangNode curNode,
+                                        boolean leafList)
+            throws IOException {
+        if (entry != null) {
+            if (curNode instanceof RpcNotificationContainer) {
+                TempJavaBeanFragmentFiles tempFiles = getBeanFiles(curNode);
+                addJavaSnippetInfoToApplicableTempFiles(
+                        getJavaAttributeOfLeaf(tempFiles, entry,
+                                               config, leafList), config);
+            } else {
+                addJavaSnippetInfoToApplicableTempFiles(
+                        getJavaAttributeOfLeaf(this, entry,
+                                               config, leafList), config);
+            }
+        }
+    }
+
+    /**
+     * Adds all the leaves in the current data model node as part of the
+     * generated temporary file.
+     *
+     * @param curNode current node
+     * @param config  plugin config
+     * @throws IOException IO operation fail
+     */
+    protected void addCurNodeLeavesInfoToTempFiles(YangNode curNode,
+                                                   YangPluginConfig config)
+            throws IOException {
+        if (!(curNode instanceof YangLeavesHolder)) {
+            throw new TranslatorException(getErrorMsg(INVALID_LEAF_HOLDER,
+                                                      curNode));
+        }
+        YangLeavesHolder leavesHolder = (YangLeavesHolder) curNode;
+
+        for (YangLeaf leaf : leavesHolder.getListOfLeaf()) {
+            addLeafInfoToTempFiles((JavaLeafInfoContainer) leaf, config,
+                                   curNode, false);
+        }
+
+        for (YangLeafList leafList : leavesHolder.getListOfLeafList()) {
+            addLeafInfoToTempFiles((JavaLeafInfoContainer) leafList, config,
+                                   curNode, true);
+        }
+    }
+
+    /**
+     * Adds operation type to temp files.
+     *
+     * @param curNode current YANG node
+     * @param config  YANG plugin config
+     * @throws IOException IO exception
+     */
+    protected void addOperationTypeToTempFiles(YangNode curNode,
+                                               YangPluginConfig config)
+            throws IOException {
+        JavaQualifiedTypeInfoTranslator typeInfo =
+                new JavaQualifiedTypeInfoTranslator();
+        typeInfo.setClassInfo(OPERATION_TYPE_CLASS);
+        JavaFileInfo curInfo = ((JavaFileInfoContainer) curNode).getJavaFileInfo();
+        JavaFileInfo info;
+        if (curNode instanceof RpcNotificationContainer) {
+            info = ((JavaFileInfoContainer) curNode).getJavaFileInfo();
+        } else {
+            info = ((JavaFileInfoContainer) getModuleNode(curNode))
+                    .getJavaFileInfo();
+        }
+
+        typeInfo.setPkgInfo(info.getPackage().toLowerCase() + PERIOD +
+                                    getCapitalCase(info.getJavaName()));
+        String curNodeName = getCapitalCase(curInfo.getJavaName());
+        boolean isQualified = false;
+        if (!(curNode instanceof RpcNotificationContainer)) {
+            isQualified = javaImportData.addImportInfo(typeInfo, curNodeName,
+                                                       curInfo.getPackage());
+        }
+        JavaAttributeInfo attributeInfo =
+                getAttributeInfoForTheData(typeInfo, YANG + curNodeName +
+                        OPERATION_TYPE_ATTRIBUTE, null, isQualified, false);
+        addJavaSnippetInfoToApplicableTempFiles(attributeInfo, config);
+    }
+
+    private YangNode getModuleNode(YangNode curNode) {
+        YangNode tempNode = curNode.getParent();
+        while (!(tempNode instanceof RpcNotificationContainer)) {
+            tempNode = tempNode.getParent();
+        }
+        return tempNode;
+    }
+
+    /**
+     * Adds value leaf flag to temp files.
+     *
+     * @param config YANG plugin config
+     * @param node   YANG node
+     * @throws IOException IO exception
+     */
+    protected void addValueLeafFlag(YangPluginConfig config, YangNode node)
+            throws IOException {
+        JavaFileInfo info = ((JavaFileInfoContainer) node).getJavaFileInfo();
+        JavaQualifiedTypeInfoTranslator typeInfo =
+                new JavaQualifiedTypeInfoTranslator();
+        typeInfo.setClassInfo(BIT_SET);
+        typeInfo.setPkgInfo(JAVA_UTIL_PKG);
+        getJavaImportData().addImportInfo(typeInfo, info.getJavaName(),
+                                          info.getPackage());
+        JavaAttributeInfo attributeInfo =
+                getAttributeInfoForTheData(typeInfo, VALUE_LEAF, null, false, false);
+        addJavaSnippetInfoToApplicableTempFiles(attributeInfo, config);
+    }
+
+    /**
+     * Adds value leaf flag to temp files.
+     *
+     * @param config YANG plugin config
+     * @throws IOException IO exception
+     */
+    protected void addSelectLeafFlag(YangPluginConfig config)
+            throws IOException {
+        JavaQualifiedTypeInfoTranslator typeInfo =
+                new JavaQualifiedTypeInfoTranslator();
+        typeInfo.setClassInfo(BIT_SET);
+        typeInfo.setPkgInfo(JAVA_UTIL_PKG);
+        JavaAttributeInfo attributeInfo =
+                getAttributeInfoForTheData(typeInfo, SELECT_LEAF, null, false, false);
+        addJavaSnippetInfoToApplicableTempFiles(attributeInfo, config);
+    }
+
+    /**
+     * Adds sub tree filtering to temp files.
+     *
+     * @param config YANG plugin config
+     * @throws IOException IO exception
+     */
+    protected void addIsSubTreeFilteredFlag(YangPluginConfig config)
+            throws IOException {
+        JavaQualifiedTypeInfoTranslator typeInfo =
+                new JavaQualifiedTypeInfoTranslator();
+        typeInfo.setClassInfo(BOOLEAN_DATA_TYPE);
+        typeInfo.setPkgInfo(null);
+        JavaAttributeInfo attributeInfo =
+                getAttributeInfoForTheData(typeInfo, SUBTREE_FILTERED, null, false, false);
+        addJavaSnippetInfoToApplicableTempFiles(attributeInfo, config);
+    }
+
+    /**
+     * Adds value leaf flag to temp files.
+     *
+     * @param config  YANG plugin config
+     * @param curNode current yang node
+     * @throws IOException IO exception
+     */
+    protected void addYangAugmentedMap(YangPluginConfig config, YangNode curNode)
+            throws IOException {
+        JavaFileInfoTranslator info = ((JavaCodeGeneratorInfo) curNode)
+                .getJavaFileInfo();
+        JavaQualifiedTypeInfoTranslator typeInfo =
+                new JavaQualifiedTypeInfoTranslator();
+        typeInfo.setClassInfo(AUGMENT_MAP_TYPE);
+        //Fix for add yangAugmentedInfo in equals/hashcode/and to string method.
+        typeInfo.setPkgInfo(null);
+        typeInfo.setForInterface(false);
+        JavaAttributeInfo attributeInfo =
+                getAttributeInfoForTheData(typeInfo, YANG_AUGMENTED_INFO_MAP,
+                                           null, false, false);
+        //MAP
+        addImportInfoOfNode(MAP, COLLECTION_IMPORTS,
+                            getCapitalCase(info.getJavaName()),
+                            info.getPackage(), true);
+        //HASH map
+        addImportInfoOfNode(HASH_MAP, COLLECTION_IMPORTS,
+                            getCapitalCase(info.getJavaName()),
+                            info.getPackage(), false);
+
+        if (curNode.isOpTypeReq()) {
+            //exception
+            addImportInfoOfNode(INVOCATION_TARGET_EXCEPTION, REFLECT_IMPORTS,
+                                getCapitalCase(info.getJavaName()),
+                                info.getPackage(), false);
+        }
+        addJavaSnippetInfoToApplicableTempFiles(attributeInfo, config);
+    }
+
+    private JavaQualifiedTypeInfoTranslator addImportInfoOfNode(
+            String cls, String pkg, String nodeName, String nodePkg,
+            boolean isForInterface) {
+        JavaQualifiedTypeInfoTranslator typeInfo =
+                new JavaQualifiedTypeInfoTranslator();
+        typeInfo.setClassInfo(cls);
+        typeInfo.setPkgInfo(pkg);
+        typeInfo.setForInterface(isForInterface);
+
+        getJavaImportData().addImportInfo(typeInfo, nodeName, nodePkg);
+        return typeInfo;
+    }
+
+    /**
+     * Adds the new attribute info to the target generated temporary files.
+     *
+     * @param newAttrInfo  new attribute info
+     * @param pluginConfig plugin configurations
+     * @throws IOException IO operation fail
+     */
+    void addJavaSnippetInfoToApplicableTempFiles(JavaAttributeInfo newAttrInfo,
+                                                 YangPluginConfig pluginConfig)
+            throws IOException {
+        isAttributePresent = true;
+        String attrName = newAttrInfo.getAttributeName();
+        //Boolean flag for operation type attr info generation control.
+        boolean required = !attrName.equals(VALUE_LEAF) &&
+                !attrName.equals(SELECT_LEAF) &&
+                !attrName.equals(YANG_AUGMENTED_INFO_MAP);
+        //Boolean flag for subtree for nodes info generation control.
+        boolean subTreeForChild =
+                tempFlagSet(FILTER_CONTENT_MATCH_FOR_NODES_MASK) &&
+                        newAttrInfo.getAttributeType() == null &&
+                        !attrName.contains(OPERATION_TYPE_ATTRIBUTE) &&
+                        required && !attrName.equals(SUBTREE_FILTERED);
+        ;
+        if (tempFlagSet(ATTRIBUTES_MASK)) {
+            addAttribute(newAttrInfo);
+        }
+        if (tempFlagSet(GETTER_FOR_INTERFACE_MASK) &&
+                !attrName.equals(SUBTREE_FILTERED)) {
+            addGetterForInterface(newAttrInfo);
+        }
+        if (tempFlagSet(SETTER_FOR_INTERFACE_MASK) && required &&
+                !attrName.equals(SUBTREE_FILTERED)) {
+            addSetterForInterface(newAttrInfo);
+        }
+        if (tempFlagSet(SETTER_FOR_CLASS_MASK) && required) {
+            addSetterImpl(newAttrInfo);
+        }
+        if (tempFlagSet(HASH_CODE_IMPL_MASK)) {
+            addHashCodeMethod(newAttrInfo);
+        }
+        if (tempFlagSet(EQUALS_IMPL_MASK)) {
+            addEqualsMethod(newAttrInfo);
+        }
+        if (tempFlagSet(TO_STRING_IMPL_MASK)) {
+            addToStringMethod(newAttrInfo);
+        }
+        if (tempFlagSet(EDIT_CONTENT_MASK)) {
+            //TODO: add implementation for edit content match.
+        }
+        boolean listAttr = newAttrInfo.isListAttr();
+        if (tempFlagSet(ADD_TO_LIST_IMPL_MASK) && listAttr) {
+            addAddToListImpl(newAttrInfo);
+        }
+        if (tempFlagSet(ADD_TO_LIST_INTERFACE_MASK) && listAttr) {
+            addAddToListInterface(newAttrInfo);
+        }
+        YangType attrType = newAttrInfo.getAttributeType();
+        if (subTreeForChild) {
+            addSubtreeFilteringForChildNode(newAttrInfo);
+        }
+        if (tempFlagSet(FILTER_CONTENT_MATCH_FOR_LEAF_MASK) &&
+                !listAttr && attrType != null) {
+            addSubTreeFilteringForLeaf(newAttrInfo);
+        }
+        if (tempFlagSet(FILTER_CONTENT_MATCH_FOR_LEAF_LIST_MASK) &&
+                listAttr && attrType != null) {
+            addSubtreeFilteringForLeafList(newAttrInfo);
+        }
+        if (tempFlagSet(LEAF_IDENTIFIER_ENUM_ATTRIBUTES_MASK) &&
+                !listAttr && attrType != null) {
+            leafCount++;
+            addLeafIdAttributes(newAttrInfo, leafCount);
+        }
+        if (!newAttrInfo.isIntConflict() && !newAttrInfo.isLongConflict() &&
+                !newAttrInfo.isShortConflict()) {
+            if (tempFlagSet(GETTER_FOR_CLASS_MASK)) {
+                addGetterImpl(newAttrInfo);
+            }
+            if (tempFlagSet(FROM_STRING_IMPL_MASK)) {
+                JavaQualifiedTypeInfoTranslator typeInfo =
+                        getQualifiedInfoOfFromString(newAttrInfo,
+                                                     pluginConfig.getConflictResolver());
+            /*
+             * Create a new java attribute info with qualified information of
+             * wrapper classes.
+             */
+                JavaAttributeInfo fromStringAttributeInfo =
+                        getAttributeInfoForTheData(
+                                typeInfo, newAttrInfo.getAttributeName(),
+                                attrType, getIsQualifiedAccessOrAddToImportList(
+                                        typeInfo), false);
+                addFromStringMethod(newAttrInfo, fromStringAttributeInfo);
+            }
+        }
+    }
+
+    /**
+     * Returns JAVA class name for non implementation classes.
+     *
+     * @param suffix for the class name based on the file type
+     * @return java class name
+     */
+    protected String getJavaClassName(String suffix) {
+        return getCapitalCase(javaFileInfo.getJavaName()) + suffix;
+    }
+
+    /**
+     * Returns class name for implementation classes.
+     *
+     * @param node YANG node
+     * @return java class name
+     */
+    private String getImplClassName(YangNode node) {
+        if (node instanceof RpcNotificationContainer) {
+            return getGeneratedJavaClassName() + OP_PARAM;
+        }
+        return DEFAULT_CAPS + getGeneratedJavaClassName();
+    }
+
+    /**
+     * Returns the directory path.
+     *
+     * @return directory path
+     */
+    private String getDirPath() {
+        return javaFileInfo.getPackageFilePath();
+    }
+
+    /**
+     * Constructs java code exit.
+     *
+     * @param fileType generated file type
+     * @param curNode  current YANG node
+     * @throws IOException when fails to generate java files
+     */
+    public void generateJavaFile(int fileType, YangNode curNode)
+            throws IOException {
+
+        if (curNode.isOpTypeReq()) {
+            addImportInfoOfNode(BIT_SET, JAVA_UTIL_PKG, getGeneratedJavaClassName(),
+                                getJavaFileInfo().getPackage(), false);
+        }
+        if (isAttributePresent) {
+            //Object utils
+            addImportInfoOfNode(JAVA_UTIL_OBJECTS_IMPORT_CLASS, JAVA_UTIL_PKG,
+                                getGeneratedJavaClassName(),
+                                getJavaFileInfo().getPackage(), false);
+            //more objects.
+            addImportInfoOfNode(GOOGLE_MORE_OBJECT_IMPORT_CLASS,
+                                GOOGLE_MORE_OBJECT_IMPORT_PKG,
+                                getGeneratedJavaClassName(),
+                                getJavaFileInfo().getPackage(), false);
+        }
+
+        List<String> imports =
+                getBeanFiles(curNode).getJavaImportData().getImports(true);
+        createPackage(curNode);
+
+        //Generate java code.
+        if ((fileType & INTERFACE_MASK) != 0 ||
+                (fileType & BUILDER_INTERFACE_MASK) != 0) {
+
+            //Create interface file.
+            interfaceJavaFileHandle =
+                    getJavaFileHandle(getJavaClassName(INTERFACE_FILE_NAME_SUFFIX));
+            interfaceJavaFileHandle =
+                    generateInterfaceFile(interfaceJavaFileHandle, imports,
+                                          curNode, isAttributePresent);
+
+            //Create builder interface file.
+            if ((fileType & BUILDER_INTERFACE_MASK) != 0) {
+                builderInterfaceJavaFileHandle =
+                        getJavaFileHandle(getJavaClassName(
+                                BUILDER_INTERFACE_FILE_NAME_SUFFIX));
+                builderInterfaceJavaFileHandle =
+                        generateBuilderInterfaceFile(
+                                builderInterfaceJavaFileHandle,
+                                curNode, isAttributePresent);
+                    /*
+                     * Append builder interface file to interface file and
+                     * close it.
+                     */
+                mergeJavaFiles(builderInterfaceJavaFileHandle,
+                               interfaceJavaFileHandle);
+            }
+
+            insertDataIntoJavaFile(interfaceJavaFileHandle, CLOSE_CURLY_BRACKET);
+            validateLineLength(interfaceJavaFileHandle);
+        }
+
+        //add imports for default class.
+        imports = getBeanFiles(curNode).getJavaImportData().getImports(false);
+        if (!curNode.isOpTypeReq()) {
+            removeCaseParentImport(curNode, imports);
+        }
+
+        if ((fileType & BUILDER_CLASS_MASK) != 0 ||
+                (fileType & DEFAULT_CLASS_MASK) != 0) {
+
+            //Create impl class file.
+            implClassJavaFileHandle =
+                    getJavaFileHandle(getImplClassName(curNode));
+            implClassJavaFileHandle =
+                    generateDefaultClassFile(implClassJavaFileHandle,
+                                             curNode, isAttributePresent,
+                                             imports);
+
+            //Create builder class file.
+            if ((fileType & BUILDER_CLASS_MASK) != 0) {
+                builderClassJavaFileHandle =
+                        getJavaFileHandle(getJavaClassName(
+                                BUILDER_CLASS_FILE_NAME_SUFFIX));
+                builderClassJavaFileHandle =
+                        generateBuilderClassFile(builderClassJavaFileHandle,
+                                                 curNode,
+                                                 isAttributePresent);
+
+                //Append impl class to builder class and close it.
+                mergeJavaFiles(builderClassJavaFileHandle,
+                               implClassJavaFileHandle);
+            }
+            insertDataIntoJavaFile(implClassJavaFileHandle, CLOSE_CURLY_BRACKET);
+            validateLineLength(implClassJavaFileHandle);
+        }
+
+        if (curNode instanceof YangList) {
+            File keyClassJavaFileHandle;
+            YangList list = (YangList) curNode;
+            YangDataStructure data = getYangDataStructure(
+                    list.getCompilerAnnotation());
+            if (list.isConfig() && data == YangDataStructure.MAP) {
+                keyClassJavaFileHandle =
+                        getJavaFileHandle(getJavaClassName(
+                                KEY_CLASS_FILE_NAME_SUFFIX));
+                generateKeyClassFile(keyClassJavaFileHandle, curNode);
+            }
+        }
+        //Close all the file handles.
+        freeTemporaryResources(false);
+    }
+
+    //Removes case's parent import.
+    private void removeCaseParentImport(YangNode node, List<String> imports) {
+        YangNode parent = node.getParent();
+        JavaFileInfo info = ((JavaFileInfoContainer) parent).getJavaFileInfo();
+        String impt = getImportString(info.getPackage(),
+                                      getCapitalCase(info.getJavaName()));
+        imports.remove(impt);
+    }
+
+    /**
+     * Removes all temporary file handles.
+     *
+     * @param errorOccurred flag indicating if error occurred
+     * @throws IOException when failed to delete the temporary files
+     */
+    public void freeTemporaryResources(boolean errorOccurred)
+            throws IOException {
+        /*
+         * Close all java file handles and when error occurs delete the files.
+         */
+        if (javaFlagSet(INTERFACE_MASK)) {
+            closeFile(interfaceJavaFileHandle, errorOccurred);
+        }
+        if (javaFlagSet(BUILDER_CLASS_MASK)) {
+            closeFile(builderClassJavaFileHandle);
+        }
+        if (javaFlagSet(BUILDER_INTERFACE_MASK)) {
+            closeFile(builderInterfaceJavaFileHandle);
+        }
+        if (javaFlagSet(DEFAULT_CLASS_MASK)) {
+            closeFile(implClassJavaFileHandle, errorOccurred);
+        }
+        /*
+         * Close all temporary file handles and delete the files.
+         */
+        if (tempFlagSet(GETTER_FOR_CLASS_MASK)) {
+            closeFile(getterImplTempFileHandle);
+        }
+        if (tempFlagSet(ATTRIBUTES_MASK)) {
+            closeFile(attributesTempFileHandle);
+        }
+        if (tempFlagSet(HASH_CODE_IMPL_MASK)) {
+            closeFile(hashCodeImplTempFileHandle);
+        }
+        if (tempFlagSet(TO_STRING_IMPL_MASK)) {
+            closeFile(toStringImplTempFileHandle);
+        }
+        if (tempFlagSet(EQUALS_IMPL_MASK)) {
+            closeFile(equalsImplTempFileHandle);
+        }
+        if (tempFlagSet(FROM_STRING_IMPL_MASK)) {
+            closeFile(fromStringImplTempFileHandle);
+        }
+        if (tempFlagSet(ADD_TO_LIST_IMPL_MASK)) {
+            closeFile(addToListImplTempFileHandle);
+        }
+        if (tempFlagSet(ADD_TO_LIST_INTERFACE_MASK)) {
+            closeFile(addToListInterfaceTempFileHandle);
+        }
+        if (tempFlagSet(LEAF_IDENTIFIER_ENUM_ATTRIBUTES_MASK)) {
+            closeFile(leafIdAttributeTempFileHandle);
+        }
+        if (tempFlagSet(FILTER_CONTENT_MATCH_FOR_LEAF_MASK)) {
+            closeFile(subtreeFilteringForLeafTempFileHandle);
+        }
+        if (tempFlagSet(FILTER_CONTENT_MATCH_FOR_LEAF_LIST_MASK)) {
+            closeFile(getSubtreeFilteringForListTempFileHandle);
+        }
+        if (tempFlagSet(FILTER_CONTENT_MATCH_FOR_NODES_MASK)) {
+            closeFile(getSubtreeFilteringForChildNodeTempFileHandle);
+        }
+        if (tempFlagSet(EDIT_CONTENT_MASK)) {
+            closeFile(editContentTempFileHandle);
+        }
+    }
+
+    /**
+     * Returns if the attribute needs to be accessed in a qualified manner or
+     * not, if it needs to be imported, then the same needs to be done.
+     *
+     * @param importInfo import info
+     * @return status of the qualified access to the attribute
+     */
+    protected boolean getIsQualifiedAccessOrAddToImportList(
+            JavaQualifiedTypeInfo importInfo) {
+        return javaImportData
+                .addImportInfo((JavaQualifiedTypeInfoTranslator) importInfo,
+                               getGeneratedJavaClassName(),
+                               javaFileInfo.getPackage());
+    }
+
+    /**
+     * Returns temp file handle for add to list interface.
+     *
+     * @return temp file handle for add to list interface
+     */
+    public File getAddToListInterfaceTempFileHandle() {
+        return addToListInterfaceTempFileHandle;
+    }
+
+    /**
+     * Returns temp file handle for add to list impl.
+     *
+     * @return temp file handle for add to list impl
+     */
+    public File getAddToListImplTempFileHandle() {
+        return addToListImplTempFileHandle;
+    }
+
+    /**
+     * Returns temp file handle for leaf identifier attributes.
+     *
+     * @return temp file handle for leaf identifier attributes
+     */
+    public File getLeafIdAttributeTempFileHandle() {
+        return leafIdAttributeTempFileHandle;
+    }
+
+    /**
+     * Sets true if root node.
+     *
+     * @param rootNode true if root node
+     */
+    void setRootNode(boolean rootNode) {
+        this.rootNode = rootNode;
+    }
+
+    /**
+     * Returns temp file for is content match.
+     *
+     * @return temp file for is content match
+     */
+    public File getSubtreeFilteringForLeafTempFileHandle() {
+        return subtreeFilteringForLeafTempFileHandle;
+    }
+
+    /**
+     * Returns temp file for edit content file.
+     *
+     * @return temp file for edit content file
+     */
+    public File getEditContentTempFileHandle() {
+        return editContentTempFileHandle;
+    }
+
+    /**
+     * Returns temp file for is content match.
+     *
+     * @return temp file for is content match
+     */
+    public File getGetSubtreeFilteringForListTempFileHandle() {
+        return getSubtreeFilteringForListTempFileHandle;
+    }
+
+    /**
+     * Returns temp file for is content match.
+     *
+     * @return temp file for is content match
+     */
+    public File getGetSubtreeFilteringForChildNodeTempFileHandle() {
+        return getSubtreeFilteringForChildNodeTempFileHandle;
+    }
+
+    /**
+     * Checks if a given flag is set in generated java files.
+     * Returns true if ANY flag is set in a bitwise-ORed argument, e.g.
+     * <pre>
+     *    javaFlagSet(FOO | BAR)
+     * </pre>
+     * returns true if either FOO flag or BAR flag is set.
+     *
+     * @param flag input flag mask value
+     * @return true if set, else false
+     */
+    private boolean javaFlagSet(int flag) {
+        return (getGeneratedJavaFiles() & flag) != 0;
+    }
+
+    /**
+     * Checks if a given flag is set in temp files.
+     *
+     * @param flag input flag mask value
+     * @return true if set, else false
+     */
+    private boolean tempFlagSet(int flag) {
+        return (tempFilesFlagSet & flag) != 0;
+    }
+
+    /**
+     * Sets attribute's node.
+     *
+     * @param attrNode attribute's node
+     */
+    public void setAttrNode(YangNode attrNode) {
+        this.attrNode = attrNode;
+    }
+}
diff --git a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/TempJavaServiceFragmentFiles.java b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/TempJavaServiceFragmentFiles.java
new file mode 100644
index 0000000..5162b34
--- /dev/null
+++ b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/TempJavaServiceFragmentFiles.java
@@ -0,0 +1,312 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.translator.tojava;
+
+import org.onosproject.yang.compiler.datamodel.RpcNotificationContainer;
+import org.onosproject.yang.compiler.datamodel.YangAugment;
+import org.onosproject.yang.compiler.datamodel.YangInput;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangOutput;
+import org.onosproject.yang.compiler.datamodel.YangRpc;
+import org.onosproject.yang.compiler.translator.exception.TranslatorException;
+import org.onosproject.yang.compiler.translator.tojava.javamodel.YangJavaModuleTranslator;
+import org.onosproject.yang.compiler.translator.tojava.javamodel.YangJavaSubModuleTranslator;
+import org.onosproject.yang.compiler.translator.tojava.utils.JavaExtendsListHolder;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.List;
+
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedTempFileType.RPC_INTERFACE_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.JavaAttributeInfo.getAttributeInfoForTheData;
+import static org.onosproject.yang.compiler.translator.tojava.JavaQualifiedTypeInfoTranslator.getQualifiedTypeInfoOfCurNode;
+import static org.onosproject.yang.compiler.translator.tojava.utils.JavaCodeSnippetGen.addListenersImport;
+import static org.onosproject.yang.compiler.translator.tojava.utils.JavaFileGenerator.generateServiceInterfaceFile;
+import static org.onosproject.yang.compiler.translator.tojava.utils.JavaFileGeneratorUtils.addResolvedAugmentedDataNodeImports;
+import static org.onosproject.yang.compiler.translator.tojava.utils.JavaIdentifierSyntax.createPackage;
+import static org.onosproject.yang.compiler.translator.tojava.utils.MethodsGenerator.getRpcServiceMethod;
+import static org.onosproject.yang.compiler.utils.UtilConstants.EMPTY_STRING;
+import static org.onosproject.yang.compiler.utils.UtilConstants.HYPHEN;
+import static org.onosproject.yang.compiler.utils.UtilConstants.INPUT;
+import static org.onosproject.yang.compiler.utils.UtilConstants.OUTPUT;
+import static org.onosproject.yang.compiler.utils.UtilConstants.Operation.ADD;
+import static org.onosproject.yang.compiler.utils.UtilConstants.RPC_INPUT_VAR_NAME;
+import static org.onosproject.yang.compiler.utils.UtilConstants.SERVICE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.VOID;
+import static org.onosproject.yang.compiler.utils.io.impl.FileSystemUtil.closeFile;
+import static org.onosproject.yang.compiler.utils.io.impl.JavaDocGen.generateJavaDocForRpc;
+import static org.onosproject.yang.compiler.utils.io.impl.YangIoUtils.getAbsolutePackagePath;
+import static org.onosproject.yang.compiler.utils.io.impl.YangIoUtils.getCamelCase;
+import static org.onosproject.yang.compiler.utils.io.impl.YangIoUtils.getCapitalCase;
+
+/**
+ * Represents implementation of java service code fragments temporary
+ * implementations. Maintains the temp files required specific for service
+ * and manager java snippet generation.
+ */
+public class TempJavaServiceFragmentFiles extends TempJavaFragmentFiles {
+
+    /**
+     * File name for rpc method.
+     */
+    private static final String RPC_INTERFACE_FILE_NAME = "Rpc";
+
+    /**
+     * Temporary file handle for rpc interface.
+     */
+    private final File rpcInterfaceTempFileHandle;
+
+    /**
+     * Java file handle for rpc interface file.
+     */
+    private File serviceJavaFileHandle;
+
+    /**
+     * Creates an instance of temporary java code fragment.
+     *
+     * @param javaFileInfo generated file information
+     * @throws IOException when fails to create new file handle
+     */
+    TempJavaServiceFragmentFiles(JavaFileInfoTranslator javaFileInfo)
+            throws IOException {
+        setJavaExtendsListHolder(new JavaExtendsListHolder());
+        setJavaImportData(new JavaImportData());
+        setJavaFileInfo(javaFileInfo);
+        setAbsoluteDirPath(getAbsolutePackagePath(
+                getJavaFileInfo().getBaseCodeGenPath(),
+                getJavaFileInfo().getPackageFilePath()));
+        addGeneratedTempFile(RPC_INTERFACE_MASK);
+        rpcInterfaceTempFileHandle = getTemporaryFileHandle(RPC_INTERFACE_FILE_NAME);
+    }
+
+    /**
+     * Returns rpc method's temporary file handle.
+     *
+     * @return temporary file handle
+     */
+    public File getRpcInterfaceTempFileHandle() {
+        return rpcInterfaceTempFileHandle;
+    }
+
+    /**
+     * Constructs java code exit.
+     *
+     * @param fileType generated file type
+     * @param curNode  current YANG node
+     * @throws IOException when fails to generate java files
+     */
+    @Override
+    public void generateJavaFile(int fileType, YangNode curNode)
+            throws IOException {
+
+        addResolvedAugmentedDataNodeImports(curNode);
+        List<String> imports = ((JavaCodeGeneratorInfo) curNode)
+                .getTempJavaCodeFragmentFiles().getServiceTempFiles()
+                .getJavaImportData().getImports(true);
+        createPackage(curNode);
+        boolean notification = false;
+        if (curNode instanceof YangJavaModuleTranslator) {
+            if (!((YangJavaModuleTranslator) curNode).getNotificationNodes()
+                    .isEmpty()) {
+                notification = true;
+            }
+        } else if (curNode instanceof YangJavaSubModuleTranslator) {
+            if (!((YangJavaSubModuleTranslator) curNode).getNotificationNodes()
+                    .isEmpty()) {
+                notification = true;
+            }
+        }
+
+        if (notification) {
+            addListenersImport(curNode, imports, ADD);
+        }
+
+        serviceJavaFileHandle = getJavaFileHandle(getJavaClassName(SERVICE));
+        generateServiceInterfaceFile(serviceJavaFileHandle, curNode, imports);
+
+        // Close all the file handles.
+        freeTemporaryResources(false);
+    }
+
+    /**
+     * Adds rpc string information to applicable temp file.
+     *
+     * @param inAttr  RPCs input node attribute info
+     * @param outAttr RPCs output node attribute info
+     * @param rpcName name of the rpc function
+     * @throws IOException IO operation fail
+     */
+    private void addRpcString(JavaAttributeInfo inAttr, JavaAttributeInfo outAttr,
+                              String rpcName) throws IOException {
+        String rpcInput = null;
+        String rpcOutput = VOID;
+        String rpcIn = EMPTY_STRING;
+        if (inAttr != null) {
+            rpcInput = getCapitalCase(inAttr.getAttributeName());
+        }
+        if (outAttr != null) {
+            rpcOutput = getCapitalCase(outAttr.getAttributeName());
+        }
+        if (rpcInput != null) {
+            rpcIn = RPC_INPUT_VAR_NAME;
+        }
+        appendToFile(rpcInterfaceTempFileHandle,
+                     generateJavaDocForRpc(rpcName, rpcIn, rpcOutput) +
+                             getRpcServiceMethod(rpcName, rpcInput, rpcOutput));
+    }
+
+    /**
+     * Adds the JAVA rpc snippet information.
+     *
+     * @param inAttr  RPCs input node attribute info
+     * @param outAttr RPCs output node attribute info
+     * @param rpcName name of the rpc function
+     * @throws IOException IO operation fail
+     */
+    public void addJavaSnippetInfoToApplicableTempFiles(JavaAttributeInfo inAttr,
+                                                        JavaAttributeInfo outAttr,
+                                                        String rpcName)
+            throws IOException {
+        addRpcString(inAttr, outAttr, rpcName);
+    }
+
+    /**
+     * Creates an attribute info object corresponding to a data model node and
+     * return it.
+     *
+     * @param childNode  child data model node(input / output) for which the java code generation
+     *                   is being handled
+     * @param parentNode parent node (module / sub-module) in which the child node is an attribute
+     * @param rpcName    rpc name
+     * @return AttributeInfo attribute details required to add in temporary
+     * files
+     */
+    public JavaAttributeInfo getChildNodeAsAttributeInParentService(
+            YangNode childNode, YangNode parentNode, String rpcName) {
+
+        JavaFileInfoTranslator fileInfo = ((JavaFileInfoContainer) childNode)
+                .getJavaFileInfo();
+        String childNodeName = fileInfo.getJavaName();
+        if (childNodeName == null) {
+            if (childNode instanceof YangInput) {
+                childNodeName = rpcName + HYPHEN + INPUT;
+            } else {
+                childNodeName = rpcName + HYPHEN + OUTPUT;
+            }
+            childNodeName = getCamelCase(childNodeName, null);
+        }
+        /*
+         * Get the import info corresponding to the attribute for import in
+         * generated java files or qualified access
+         */
+        JavaQualifiedTypeInfoTranslator qualifiedTypeInfo =
+                getQualifiedTypeInfoOfCurNode(childNode,
+                                              getCapitalCase(childNodeName));
+        if (!(parentNode instanceof TempJavaCodeFragmentFilesContainer)) {
+            throw new TranslatorException("Parent node does not have file info");
+        }
+
+        boolean isQualified = addImportToService(qualifiedTypeInfo, parentNode);
+        return getAttributeInfoForTheData(qualifiedTypeInfo, childNodeName,
+                                          null, isQualified, false);
+    }
+
+    /**
+     * Adds to service class import list.
+     *
+     * @param importInfo import info
+     * @return true or false
+     */
+    private boolean addImportToService(
+            JavaQualifiedTypeInfoTranslator importInfo, YangNode curNode) {
+        JavaFileInfoTranslator fileInfo = ((JavaFileInfoContainer) curNode)
+                .getJavaFileInfo();
+        String name = fileInfo.getJavaName();
+        String clsInfo = importInfo.getClassInfo();
+
+        StringBuilder className = new StringBuilder()
+                .append(getCapitalCase(name))
+                .append(SERVICE);
+        return clsInfo.contentEquals(SERVICE) || clsInfo.contentEquals(className) ||
+                getJavaImportData().addImportInfo(importInfo, className.toString(),
+                                                  fileInfo.getPackage());
+    }
+
+    /**
+     * Adds augmented rpc methods to service temp file.
+     *
+     * @param module root node
+     * @throws IOException when fails to do IO operations
+     */
+    public void addAugmentedRpcMethod(RpcNotificationContainer module)
+            throws IOException {
+        JavaAttributeInfo in = null;
+        JavaAttributeInfo out = null;
+        YangNode rpcChild;
+        YangRpc rpc;
+        String rpcName;
+        YangInput input;
+
+        for (YangAugment info : module.getAugmentList()) {
+            input = (YangInput) info.getAugmentedNode();
+
+            if (input != null) {
+                rpc = (YangRpc) input.getParent();
+                if (!validateForIntraFile(module, (RpcNotificationContainer) rpc
+                        .getParent())) {
+                    rpcChild = rpc.getChild();
+
+                    rpcName = getCamelCase(rpc.getName(), null);
+                    while (rpcChild != null) {
+                        if (rpcChild instanceof YangInput) {
+                            in = getChildNodeAsAttributeInParentService(
+                                    rpcChild, (YangNode) module, rpcName);
+                        }
+                        if (rpcChild instanceof YangOutput) {
+                            out = getChildNodeAsAttributeInParentService(
+                                    rpcChild, (YangNode) module, rpcName);
+                        }
+                        rpcChild = rpcChild.getNextSibling();
+                    }
+                    addJavaSnippetInfoToApplicableTempFiles(in, out, rpcName);
+                }
+            }
+        }
+    }
+
+    private boolean validateForIntraFile(RpcNotificationContainer parent,
+                                         RpcNotificationContainer curModule) {
+        return parent.getPrefix().equals(curModule.getPrefix());
+    }
+
+    /**
+     * Removes all temporary file handles.
+     *
+     * @param errorOccurred flag indicating error
+     * @throws IOException when failed to delete the temporary files
+     */
+    @Override
+    public void freeTemporaryResources(boolean errorOccurred)
+            throws IOException {
+        closeFile(serviceJavaFileHandle, errorOccurred);
+        closeFile(rpcInterfaceTempFileHandle);
+        closeFile(getGetterInterfaceTempFileHandle());
+        closeFile(getSetterInterfaceTempFileHandle());
+        closeFile(getSetterImplTempFileHandle());
+        super.freeTemporaryResources(errorOccurred);
+    }
+}
diff --git a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/TempJavaTypeFragmentFiles.java b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/TempJavaTypeFragmentFiles.java
new file mode 100644
index 0000000..e65127f
--- /dev/null
+++ b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/TempJavaTypeFragmentFiles.java
@@ -0,0 +1,1033 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.translator.tojava;
+
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangType;
+import org.onosproject.yang.compiler.datamodel.YangTypeDef;
+import org.onosproject.yang.compiler.datamodel.YangTypeHolder;
+import org.onosproject.yang.compiler.datamodel.YangUnion;
+import org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes;
+import org.onosproject.yang.compiler.translator.exception.TranslatorException;
+import org.onosproject.yang.compiler.translator.tojava.javamodel.YangJavaTypeTranslator;
+import org.onosproject.yang.compiler.utils.io.YangPluginConfig;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.onosproject.yang.compiler.datamodel.exceptions.ErrorMessages.getErrorMsg;
+import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes.BINARY;
+import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes.BITS;
+import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes.INT16;
+import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes.INT32;
+import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes.INT64;
+import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes.UINT16;
+import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes.UINT32;
+import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes.UINT8;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedJavaFileType.GENERATE_TYPEDEF_CLASS;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedJavaFileType.GENERATE_UNION_CLASS;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedTempFileType.CONSTRUCTOR_FOR_TYPE_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedTempFileType.FROM_STRING_IMPL_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedTempFileType.OF_STRING_IMPL_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.JavaAttributeInfo.getAttributeInfoForTheData;
+import static org.onosproject.yang.compiler.translator.tojava.JavaQualifiedTypeInfoTranslator.getQualifiedInfoOfFromString;
+import static org.onosproject.yang.compiler.translator.tojava.utils.JavaFileGenerator.generateTypeDefClassFile;
+import static org.onosproject.yang.compiler.translator.tojava.utils.JavaFileGenerator.generateUnionClassFile;
+import static org.onosproject.yang.compiler.translator.tojava.utils.JavaIdentifierSyntax.createPackage;
+import static org.onosproject.yang.compiler.translator.tojava.utils.MethodsGenerator.getOfMethodStringAndJavaDoc;
+import static org.onosproject.yang.compiler.translator.tojava.utils.MethodsGenerator.getTypeConstructorStringAndJavaDoc;
+import static org.onosproject.yang.compiler.translator.tojava.utils.ValidatorTypeForUnionTypes.INT_TYPE_CONFLICT;
+import static org.onosproject.yang.compiler.translator.tojava.utils.ValidatorTypeForUnionTypes.LONG_TYPE_CONFLICT;
+import static org.onosproject.yang.compiler.translator.tojava.utils.ValidatorTypeForUnionTypes.SHORT_TYPE_CONFLICT;
+import static org.onosproject.yang.compiler.utils.UtilConstants.BASE64;
+import static org.onosproject.yang.compiler.utils.UtilConstants.EMPTY_STRING;
+import static org.onosproject.yang.compiler.utils.UtilConstants.HOLDER_TYPE_DEF;
+import static org.onosproject.yang.compiler.utils.UtilConstants.JAVA_UTIL_PKG;
+import static org.onosproject.yang.compiler.utils.UtilConstants.LAST;
+import static org.onosproject.yang.compiler.utils.UtilConstants.NEW_LINE;
+import static org.onosproject.yang.compiler.utils.io.impl.FileSystemUtil.closeFile;
+import static org.onosproject.yang.compiler.utils.io.impl.YangIoUtils.getCamelCase;
+
+/**
+ * Represents implementation of java data type code fragments temporary implementations. Maintains the temp files
+ * required specific for user defined data type java snippet generation.
+ */
+//TODO: Update with multi type handler framework.
+public class TempJavaTypeFragmentFiles
+        extends TempJavaFragmentFiles {
+
+    /**
+     * File name for of string method.
+     */
+    private static final String OF_STRING_METHOD_FILE_NAME = "OfString";
+
+    /**
+     * File name for construction for special type like union, typedef.
+     */
+    private static final String CONSTRUCTOR_FOR_TYPE_FILE_NAME = "ConstructorForType";
+
+    /**
+     * Integer index in type list.
+     */
+    private int intIndex = 0;
+
+    /**
+     * UInt index in type list.
+     */
+    private int uIntIndex = 0;
+
+    /**
+     * long index in type list.
+     */
+    private int longIndex = 0;
+
+    /**
+     * ULong index in type list.
+     */
+    private int uLongIndex = 0;
+
+    /**
+     * short index in type list.
+     */
+    private int shortIndex = 0;
+
+    /**
+     * Uint8 index in type list.
+     */
+    private int uInt8Index = 0;
+
+    /**
+     * Temporary file handle for of string method of class.
+     */
+    private File ofStringImplTempFileHandle;
+
+    /**
+     * Temporary file handle for constructor for type class.
+     */
+    private File constructorForTypeTempFileHandle;
+
+    /**
+     * Java file handle for typedef class file.
+     */
+    private File typedefClassJavaFileHandle;
+
+    /**
+     * Java file handle for type class like union, typedef file.
+     */
+    private File typeClassJavaFileHandle;
+
+    /**
+     * Java attribute for int.
+     */
+    private JavaAttributeInfo intAttribute;
+
+    /**
+     * Java attribute for long.
+     */
+    private JavaAttributeInfo longAttribute;
+
+    /**
+     * Java attribute for short.
+     */
+    private JavaAttributeInfo shortAttribute;
+
+    /**
+     * Java attribute for uint8.
+     */
+    private JavaAttributeInfo uInt8Attribute;
+
+    /**
+     * Java attribute for uInt.
+     */
+    private JavaAttributeInfo uIntAttribute;
+
+    /**
+     * Java attribute for uLong.
+     */
+    private JavaAttributeInfo uLongAttribute;
+
+    private List<YangType<?>> local = new ArrayList<>();
+
+    private List<JavaAttributeInfo> attrs = new ArrayList<>();
+
+    /**
+     * Creates an instance of temporary java code fragment.
+     *
+     * @param javaFileInfo generated java file info
+     * @throws IOException when fails to create new file handle
+     */
+    TempJavaTypeFragmentFiles(JavaFileInfoTranslator javaFileInfo)
+            throws IOException {
+
+        super(javaFileInfo);
+
+        /*
+         * Initialize getterImpl, attributes, hash code, equals and to strings
+         * when generation file type matches to typeDef class mask.
+         */
+        addGeneratedTempFile(OF_STRING_IMPL_MASK | CONSTRUCTOR_FOR_TYPE_MASK |
+                                     FROM_STRING_IMPL_MASK);
+
+        ofStringImplTempFileHandle = getTemporaryFileHandle(
+                OF_STRING_METHOD_FILE_NAME);
+        constructorForTypeTempFileHandle = getTemporaryFileHandle(
+                CONSTRUCTOR_FOR_TYPE_FILE_NAME);
+    }
+
+    /**
+     * Returns type class constructor method's temporary file handle.
+     *
+     * @return type class constructor method's temporary file handle
+     */
+
+    public File getConstructorForTypeTempFileHandle() {
+        return constructorForTypeTempFileHandle;
+    }
+
+    /**
+     * Returns java file handle for typedef class file.
+     *
+     * @return java file handle for typedef class file
+     */
+    private File getTypedefClassJavaFileHandle() {
+        return typedefClassJavaFileHandle;
+    }
+
+    /**
+     * Sets the java file handle for typedef class file.
+     *
+     * @param typedefClassJavaFileHandle java file handle
+     */
+    private void setTypedefClassJavaFileHandle(File typedefClassJavaFileHandle) {
+        this.typedefClassJavaFileHandle = typedefClassJavaFileHandle;
+    }
+
+    /**
+     * Returns java file handle for type class file.
+     *
+     * @return java file handle for type class file
+     */
+    private File getTypeClassJavaFileHandle() {
+        return typeClassJavaFileHandle;
+    }
+
+    /**
+     * Sets the java file handle for type class file.
+     *
+     * @param typeClassJavaFileHandle type file handle
+     */
+    private void setTypeClassJavaFileHandle(File typeClassJavaFileHandle) {
+        this.typeClassJavaFileHandle = typeClassJavaFileHandle;
+    }
+
+    /**
+     * Returns of string method's temporary file handle.
+     *
+     * @return of string method's temporary file handle
+     */
+
+    public File getOfStringImplTempFileHandle() {
+        return ofStringImplTempFileHandle;
+    }
+
+    private void verifyUnionTypes(List<YangType<?>> typeList,
+                                  YangTypeHolder yangTypeHolder) {
+        String msg;
+        YangUnion union = (YangUnion) yangTypeHolder;
+        for (YangType<?> yangType : typeList) {
+            YangDataTypes type = yangType.getDataType();
+            switch (type) {
+                case EMPTY:
+                    msg = "Union member derived type must not be one of the " +
+                            "type whose built-in types is \"empty\"";
+                    break;
+                case LEAFREF:
+                    msg = "Union member derived type must not be one of the " +
+                            "type whose built-in types is \"leafref\"";
+                    break;
+                default:
+                    msg = null;
+            }
+            if (msg != null) {
+                throw new TranslatorException(getErrorMsg(
+                        msg, union.getName(), union.getLineNumber(), union
+                                .getCharPosition(), union.getFileName()));
+            }
+        }
+    }
+
+    /**
+     * Adds all the type in the current data model node as part of the generated temporary file.
+     *
+     * @param yangTypeHolder YANG java data model node which has type info, eg union / typedef
+     * @param config         plugin configurations for naming conventions
+     * @throws IOException IO operation fail
+     */
+    void addTypeInfoToTempFiles(YangTypeHolder yangTypeHolder, YangPluginConfig config)
+            throws IOException {
+        List<YangType<?>> typeList = yangTypeHolder.getTypeList();
+        if (yangTypeHolder instanceof YangUnion) {
+            verifyUnionTypes(typeList, yangTypeHolder);
+        }
+        if (typeList != null) {
+            List<YangType<?>> types = validateTypes(typeList);
+            for (YangType<?> type : types) {
+                if (!(type instanceof YangJavaTypeTranslator)) {
+                    throw new TranslatorException(
+                            "Type does not have Java info " + type
+                                    .getDataTypeName() + " in " + type
+                                    .getLineNumber() + " at " + type
+                                    .getCharPosition() + " in " +
+                                    type.getFileName());
+                }
+                JavaAttributeInfo javaAttributeInfo = getAttributeForType(type,
+                                                                          config);
+                if (yangTypeHolder instanceof YangTypeDef) {
+                    javaAttributeInfo.setCurHolderOrCount(HOLDER_TYPE_DEF);
+                } else if (types.indexOf(type) == types.size() - 1) {
+                    javaAttributeInfo.setCurHolderOrCount(LAST);
+                }
+                if (type.getDataType() == BITS) {
+                    addBitsHandler(javaAttributeInfo, type, this);
+                }
+                if (type.getDataType() == BINARY) {
+                    JavaQualifiedTypeInfoTranslator info = new
+                            JavaQualifiedTypeInfoTranslator();
+                    info.setClassInfo(BASE64);
+                    info.setPkgInfo(JAVA_UTIL_PKG);
+                    getJavaImportData().addImportInfo(
+                            info, getGeneratedJavaClassName(), getJavaFileInfo()
+                                    .getPackage());
+                }
+                addJavaSnippetInfoToApplicableTempFiles(javaAttributeInfo,
+                                                        config, types);
+            }
+            addTypeConstructor();
+            addMethodsInConflictCase(config);
+            for (JavaAttributeInfo attr : attrs) {
+                super.addJavaSnippetInfoToApplicableTempFiles(attr, config);
+            }
+        }
+    }
+
+    /**
+     * Returns java attribute.
+     *
+     * @param type   YANG type
+     * @param config plugin configurations
+     * @return java attribute
+     */
+    private JavaAttributeInfo getAttributeForType(YangType type,
+                                                  YangPluginConfig config) {
+        YangJavaTypeTranslator javaType = (YangJavaTypeTranslator) type;
+        javaType.updateJavaQualifiedInfo(config.getConflictResolver());
+        String typeName = getCamelCase(javaType.getDataTypeName(), config
+                .getConflictResolver());
+        return getAttributeInfoForTheData(
+                javaType.getJavaQualifiedInfo(), typeName, javaType,
+                getIsQualifiedAccessOrAddToImportList(
+                        javaType.getJavaQualifiedInfo()), false);
+    }
+
+    /**
+     * Adds the new attribute info to the target generated temporary files for union class.
+     *
+     * @param attr   the attribute info that needs to be added to temporary files
+     * @param config plugin configurations
+     * @param types  type list
+     * @throws IOException IO operation fail
+     */
+    private void addJavaSnippetInfoToApplicableTempFiles(
+            JavaAttributeInfo attr, YangPluginConfig config, List<YangType<?>> types)
+            throws IOException {
+
+        YangDataTypes attrType = attr.getAttributeType().getDataType();
+
+        if (attrType == INT16 || attrType == UINT8) {
+            boolean isShortConflict = validateForConflictingShortTypes(types);
+            attr.setShortConflict(isShortConflict);
+            updateAttributeCondition(attr);
+            if (!isShortConflict) {
+                addMethodsWhenNoConflictingTypes(attr, config, types);
+            }
+        } else if (attrType == INT32 || attrType == UINT16) {
+            boolean isIntConflict = validateForConflictingIntTypes(types);
+            attr.setIntConflict(isIntConflict);
+            updateAttributeCondition(attr);
+            if (!isIntConflict) {
+                addMethodsWhenNoConflictingTypes(attr, config, types);
+            }
+        } else if (attrType == INT64 || attrType == UINT32) {
+            boolean isLongConflict = validateForConflictingLongTypes(types);
+            attr.setLongConflict(isLongConflict);
+            updateAttributeCondition(attr);
+            if (!isLongConflict) {
+                addMethodsWhenNoConflictingTypes(attr, config, types);
+            }
+        } else {
+            addMethodsWhenNoConflictingTypes(attr, config, types);
+        }
+        String attrHolder = attr.getCurHolderOrCount();
+        if (attrHolder != null && !attrHolder.equals(HOLDER_TYPE_DEF)) {
+            attrs.add(attr);
+        } else {
+            super.addJavaSnippetInfoToApplicableTempFiles(attr, config);
+        }
+    }
+
+    private List<YangType<?>> validateTypes(List<YangType<?>> types) {
+        String curType;
+        List<String> preType = new ArrayList<>();
+        for (YangType type : types) {
+            curType = type.getDataTypeName();
+            if (!preType.contains(curType)) {
+                preType.add(curType);
+                local.add(type);
+            }
+        }
+        return local;
+    }
+
+    /**
+     * Adds of method and constructor when there is no conflicting types.
+     *
+     * @param javaAttributeInfo java attribute info
+     * @param pluginConfig      plugin configurations
+     * @param types             YANG type
+     * @throws IOException when fails to do IO operations
+     */
+    private void addMethodsWhenNoConflictingTypes(JavaAttributeInfo javaAttributeInfo,
+                                                  YangPluginConfig pluginConfig, List<YangType<?>> types)
+            throws IOException {
+        if ((getGeneratedTempFiles() & OF_STRING_IMPL_MASK) != 0) {
+            addOfStringMethod(javaAttributeInfo, pluginConfig);
+        }
+
+        if ((getGeneratedTempFiles() & CONSTRUCTOR_FOR_TYPE_MASK) != 0) {
+            addTypeConstructor(javaAttributeInfo, types.indexOf
+                    (javaAttributeInfo.getAttributeType()));
+        }
+    }
+
+    /**
+     * Adds of, getter and from string method in conflict cases.
+     *
+     * @param pluginConfig plugin configurations
+     * @throws IOException when fails to do IO operations
+     */
+    private void addMethodsInConflictCase(YangPluginConfig pluginConfig)
+            throws IOException {
+        JavaAttributeInfo attr = getIntAttribute();
+        if (attr != null) {
+            attr = getUIntAttribute();
+        }
+        if (attr != null) {
+            if (attr.isIntConflict()) {
+                if (getIntIndex() < getUIntIndex()) {
+                    getIntAttribute().setCurHolderOrCount(
+                            getUIntAttribute().getCurHolderOrCount());
+                    appendToFile(getOfStringImplTempFileHandle(), getOfMethodStringAndJavaDoc(
+                            getIntAttribute(), getGeneratedJavaClassName())
+                            + NEW_LINE);
+                    addGetterImpl(getIntAttribute());
+
+                    addFromStringMethod(getIntAttribute(), pluginConfig);
+                } else {
+                    getUIntAttribute().setCurHolderOrCount(
+                            getIntAttribute().getCurHolderOrCount());
+                    appendToFile(getOfStringImplTempFileHandle(),
+                                 getOfMethodStringAndJavaDoc(getUIntAttribute(),
+                                                             getGeneratedJavaClassName())
+                                         + NEW_LINE);
+                    addGetterImpl(getUIntAttribute());
+                    addFromStringMethod(getUIntAttribute(), pluginConfig);
+                }
+            }
+        }
+        attr = getLongAttribute();
+        if (attr != null) {
+            attr = getULongAttribute();
+        }
+        if (attr != null) {
+            if (attr.isLongConflict()) {
+                if (getLongIndex() < getULongIndex()) {
+                    getLongAttribute().setCurHolderOrCount(
+                            getULongAttribute().getCurHolderOrCount());
+                    appendToFile(getOfStringImplTempFileHandle(),
+                                 getOfMethodStringAndJavaDoc(getLongAttribute(),
+                                                             getGeneratedJavaClassName())
+                                         + NEW_LINE);
+                    addGetterImpl(getLongAttribute());
+                    addFromStringMethod(getLongAttribute(), pluginConfig);
+                } else {
+                    getULongAttribute().setCurHolderOrCount(
+                            getLongAttribute().getCurHolderOrCount());
+                    appendToFile(getOfStringImplTempFileHandle(),
+                                 getOfMethodStringAndJavaDoc(getULongAttribute(),
+                                                             getGeneratedJavaClassName())
+                                         + NEW_LINE);
+                    addGetterImpl(getULongAttribute());
+                    addFromStringMethod(getULongAttribute(), pluginConfig);
+                }
+            }
+        }
+
+        attr = getShortAttribute();
+        if (attr != null) {
+            attr = getUInt8Attribute();
+        }
+        if (attr != null) {
+            if (attr.isShortConflict()) {
+                if (getShortIndex() < getUInt8Index()) {
+                    getShortAttribute().setCurHolderOrCount(
+                            getUInt8Attribute().getCurHolderOrCount());
+                    appendToFile(getOfStringImplTempFileHandle(),
+                                 getOfMethodStringAndJavaDoc(getShortAttribute(),
+                                                             getGeneratedJavaClassName())
+                                         + NEW_LINE);
+                    addGetterImpl(getShortAttribute());
+                    addFromStringMethod(getShortAttribute(), pluginConfig);
+                } else {
+                    getUInt8Attribute().setCurHolderOrCount(
+                            getShortAttribute().getCurHolderOrCount());
+                    appendToFile(getOfStringImplTempFileHandle(),
+                                 getOfMethodStringAndJavaDoc(getUInt8Attribute(),
+                                                             getGeneratedJavaClassName())
+                                         + NEW_LINE);
+                    addGetterImpl(getUInt8Attribute());
+                    addFromStringMethod(getUInt8Attribute(), pluginConfig);
+                }
+            }
+        }
+    }
+
+    /**
+     * Adds from string method for conflict case.
+     *
+     * @param newAttrInfo  new attribute
+     * @param pluginConfig plugin configurations
+     * @throws IOException when fails to do IO operations
+     */
+    private void addFromStringMethod(JavaAttributeInfo newAttrInfo, YangPluginConfig pluginConfig)
+            throws IOException {
+
+        JavaQualifiedTypeInfoTranslator qualifiedInfoOfFromString = getQualifiedInfoOfFromString(newAttrInfo,
+                                                                                                 pluginConfig.getConflictResolver());
+            /*
+             * Create a new java attribute info with qualified information of
+             * wrapper classes.
+             */
+        JavaAttributeInfo fromStringAttributeInfo =
+                getAttributeInfoForTheData(qualifiedInfoOfFromString,
+                                           newAttrInfo.getAttributeName(),
+                                           newAttrInfo.getAttributeType(),
+                                           getIsQualifiedAccessOrAddToImportList(
+                                                   qualifiedInfoOfFromString), false);
+
+        addFromStringMethod(newAttrInfo, fromStringAttributeInfo);
+    }
+
+    /**
+     * Adds type constructor.
+     *
+     * @param attr  attribute info
+     * @param count count of types
+     * @throws IOException when fails to append to temporary file
+     */
+    private void addTypeConstructor(JavaAttributeInfo attr, int count)
+            throws IOException {
+        appendToFile(getConstructorForTypeTempFileHandle(),
+                     getTypeConstructorStringAndJavaDoc(
+                             attr, getGeneratedJavaClassName(), getGeneratedJavaFiles(), count)
+                             + NEW_LINE);
+    }
+
+    /**
+     * Adds type constructor.
+     *
+     * @throws IOException when fails to append to temporary file
+     */
+    private void addTypeConstructor()
+            throws IOException {
+        JavaAttributeInfo attr = getIntAttribute();
+        if (attr != null) {
+            attr = getUIntAttribute();
+        }
+        boolean index = getIntIndex() < getUIntIndex();
+        int count;
+        if (index) {
+            count = getIntIndex();
+        } else {
+            count = getUIntIndex();
+        }
+        if (attr != null) {
+            if (attr.isIntConflict()) {
+                appendToFile(getConstructorForTypeTempFileHandle(),
+                             getTypeConstructorStringAndJavaDoc(
+                                     getIntAttribute(),
+                                     getUIntAttribute(), getGeneratedJavaClassName(),
+                                     INT_TYPE_CONFLICT,
+                                     index, count) + NEW_LINE);
+            }
+        }
+        attr = getLongAttribute();
+        if (attr != null) {
+            attr = getULongAttribute();
+        }
+        index = getLongIndex() < getULongIndex();
+        if (index) {
+            count = getLongIndex();
+        } else {
+            count = getULongIndex();
+        }
+        if (attr != null) {
+            if (attr.isLongConflict()) {
+                appendToFile(getConstructorForTypeTempFileHandle(),
+                             getTypeConstructorStringAndJavaDoc(
+                                     getLongAttribute(),
+                                     getULongAttribute(), getGeneratedJavaClassName(),
+                                     LONG_TYPE_CONFLICT,
+                                     index, count) + NEW_LINE);
+            }
+        }
+        attr = getShortAttribute();
+        if (attr != null) {
+            attr = getUInt8Attribute();
+        }
+        index = getShortIndex() < getUInt8Index();
+        if (index) {
+            count = getShortIndex();
+        } else {
+            count = getUInt8Index();
+        }
+        if (attr != null) {
+            if (attr.isShortConflict()) {
+                appendToFile(getConstructorForTypeTempFileHandle(),
+                             getTypeConstructorStringAndJavaDoc(
+                                     getShortAttribute(),
+                                     getUInt8Attribute(), getGeneratedJavaClassName(),
+                                     SHORT_TYPE_CONFLICT,
+                                     index, count) + NEW_LINE);
+            }
+        }
+    }
+
+    /**
+     * Adds of string for type.
+     *
+     * @param attr         attribute info
+     * @param pluginConfig plugin configurations
+     * @throws IOException when fails to append to temporary file
+     */
+    private void addOfStringMethod(JavaAttributeInfo attr, YangPluginConfig pluginConfig)
+            throws IOException {
+        appendToFile(getOfStringImplTempFileHandle(),
+                     getOfMethodStringAndJavaDoc(attr,
+                                                 getGeneratedJavaClassName())
+                             + NEW_LINE);
+    }
+
+    /**
+     * Removes all temporary file handles.
+     *
+     * @param isErrorOccurred flag to tell translator that error has occurred while file generation
+     * @throws IOException when failed to delete the temporary files
+     */
+    @Override
+    public void freeTemporaryResources(boolean isErrorOccurred)
+            throws IOException {
+
+        if ((getGeneratedJavaFiles() & GENERATE_TYPEDEF_CLASS) != 0 ||
+                (getGeneratedJavaFiles() & GENERATE_UNION_CLASS) != 0) {
+            closeFile(typeClassJavaFileHandle, isErrorOccurred);
+        }
+
+        if ((getGeneratedTempFiles() & CONSTRUCTOR_FOR_TYPE_MASK) != 0) {
+            closeFile(constructorForTypeTempFileHandle, true);
+        }
+        if ((getGeneratedTempFiles() & OF_STRING_IMPL_MASK) != 0) {
+            closeFile(ofStringImplTempFileHandle, true);
+        }
+        if ((getGeneratedTempFiles() & FROM_STRING_IMPL_MASK) != 0) {
+            closeFile(getFromStringImplTempFileHandle(), true);
+        }
+
+        super.freeTemporaryResources(isErrorOccurred);
+    }
+
+    /**
+     * Constructs java code exit.
+     *
+     * @param fileType generated file type
+     * @param curNode  current YANG node
+     * @throws IOException when fails to generate java files
+     */
+    @Override
+    public void generateJavaFile(int fileType, YangNode curNode)
+            throws IOException {
+        List<String> imports = new ArrayList<>();
+        if (isAttributePresent()) {
+            imports = getJavaImportData().getImports(true);
+        }
+
+        createPackage(curNode);
+        imports.add(getJavaImportData().getImportForHashAndEquals());
+
+        /*
+         * Creates type def class file.
+         */
+        if ((fileType & GENERATE_TYPEDEF_CLASS) != 0) {
+            setTypedefClassJavaFileHandle(getJavaFileHandle(
+                    getJavaClassName(EMPTY_STRING)));
+            generateTypeDefClassFile(getTypedefClassJavaFileHandle(), curNode, imports);
+        }
+        String bit = getJavaImportData().getImportForToBitSet();
+        if (!imports.contains(bit)) {
+            imports.add(bit);
+        }
+        /*
+         * Creates type class file.
+         */
+        if ((fileType & GENERATE_UNION_CLASS) != 0) {
+            setTypeClassJavaFileHandle(getJavaFileHandle(
+                    getJavaClassName(EMPTY_STRING)));
+            generateUnionClassFile(getTypeClassJavaFileHandle(), curNode, imports);
+        }
+
+        /*
+         * Close all the file handles.
+         */
+        freeTemporaryResources(false);
+    }
+
+    /**
+     * Returns short type index from type list.
+     *
+     * @return short type index from type list
+     */
+    public int getShortIndex() {
+        return shortIndex;
+    }
+
+    /**
+     * Sets short type index from type list.
+     *
+     * @param shortIndex short type index from type list.
+     */
+    private void setShortIndex(int shortIndex) {
+        this.shortIndex = shortIndex;
+    }
+
+    /**
+     * Returns uInt type index from type list.
+     *
+     * @return uInt type index from type list
+     */
+    public int getUInt8Index() {
+        return uInt8Index;
+    }
+
+    /**
+     * Sets uInt8 type index from type list.
+     *
+     * @param uInt8Index uInt8 type index from type list.
+     */
+    private void setUInt8Index(int uInt8Index) {
+        this.uInt8Index = uInt8Index;
+    }
+
+    /**
+     * Returns int type index from type list.
+     *
+     * @return int type index from type list
+     */
+    public int getIntIndex() {
+        return intIndex;
+    }
+
+    /**
+     * Sets int type index from type list.
+     *
+     * @param intIndex int type index from type list.
+     */
+    private void setIntIndex(int intIndex) {
+        this.intIndex = intIndex;
+    }
+
+    /**
+     * Returns uInt type index from type list.
+     *
+     * @return uInt type index from type list
+     */
+    public int getUIntIndex() {
+        return uIntIndex;
+    }
+
+    /**
+     * Sets uInt type index from type list.
+     *
+     * @param uIntIndex uInt type index from type list.
+     */
+    private void setUIntIndex(int uIntIndex) {
+        this.uIntIndex = uIntIndex;
+    }
+
+    /**
+     * Returns long type index from type list.
+     *
+     * @return long type index from type list
+     */
+    public int getLongIndex() {
+        return longIndex;
+    }
+
+    /**
+     * Sets long type index from type list.
+     *
+     * @param longIndex long type index from type list.
+     */
+    private void setLongIndex(int longIndex) {
+        this.longIndex = longIndex;
+    }
+
+    /**
+     * Returns uLong type index from type list.
+     *
+     * @return uLong type index from type list
+     */
+    public int getULongIndex() {
+        return uLongIndex;
+    }
+
+    /**
+     * Sets uLong type index from type list.
+     *
+     * @param uLongIndex uLong type index from type list.
+     */
+    private void setULongIndex(int uLongIndex) {
+        this.uLongIndex = uLongIndex;
+    }
+
+    /**
+     * Validates conflict for int and uInt.
+     *
+     * @param typeList type list
+     * @return true if conflict is there
+     */
+    private boolean validateForConflictingIntTypes(List<YangType<?>> typeList) {
+        boolean isIntPresent = false;
+        boolean isUIntPresent = false;
+        for (YangType type : typeList) {
+            if (type.getDataType().equals(INT32)) {
+                setIntIndex(typeList.indexOf(type));
+                isIntPresent = true;
+            }
+            if (type.getDataType().equals(UINT16)) {
+                setUIntIndex(typeList.indexOf(type));
+                isUIntPresent = true;
+            }
+        }
+
+        return isIntPresent && isUIntPresent;
+    }
+
+    /**
+     * Validates conflict for int and uInt.
+     *
+     * @param typeList type list
+     * @return true if conflict is there
+     */
+    private boolean validateForConflictingShortTypes(List<YangType<?>> typeList) {
+        boolean isShortPresent = false;
+        boolean isUInt8Present = false;
+        for (YangType type : typeList) {
+            if (type.getDataType().equals(INT16)) {
+                setShortIndex(typeList.indexOf(type));
+                isShortPresent = true;
+            }
+            if (type.getDataType().equals(UINT8)) {
+                setUInt8Index(typeList.indexOf(type));
+                isUInt8Present = true;
+            }
+        }
+
+        return isShortPresent && isUInt8Present;
+    }
+
+    /**
+     * Validates conflict for long and uLong.
+     *
+     * @param typeList type list
+     * @return true if conflict is there
+     */
+    private boolean validateForConflictingLongTypes(List<YangType<?>> typeList) {
+        boolean isLongPresent = false;
+        boolean isULongPresent = false;
+        for (YangType type : typeList) {
+            if (type.getDataType().equals(INT64)) {
+                setLongIndex(typeList.indexOf(type));
+                isLongPresent = true;
+            }
+            if (type.getDataType().equals(UINT32)) {
+                setULongIndex(typeList.indexOf(type));
+                isULongPresent = true;
+            }
+        }
+
+        return isLongPresent && isULongPresent;
+    }
+
+    /**
+     * Updates attribute info in case of conflicts.
+     *
+     * @param javaAttributeInfo java attribute info
+     */
+    private void updateAttributeCondition(JavaAttributeInfo javaAttributeInfo) {
+
+        if (javaAttributeInfo.isIntConflict()) {
+            if (javaAttributeInfo.getAttributeType().getDataType() == UINT16) {
+                setUIntAttribute(javaAttributeInfo);
+            } else if (javaAttributeInfo.getAttributeType().getDataType() == INT32) {
+                setIntAttribute(javaAttributeInfo);
+            }
+        }
+        if (javaAttributeInfo.isLongConflict()) {
+            if (javaAttributeInfo.getAttributeType().getDataType() == UINT32) {
+                setULongAttribute(javaAttributeInfo);
+            } else if (javaAttributeInfo.getAttributeType().getDataType() == INT64) {
+                setLongAttribute(javaAttributeInfo);
+            }
+        }
+        if (javaAttributeInfo.isShortConflict()) {
+            if (javaAttributeInfo.getAttributeType().getDataType() == UINT8) {
+                setUInt8Attribute(javaAttributeInfo);
+            } else if (javaAttributeInfo.getAttributeType().getDataType() == INT16) {
+                setShortAttribute(javaAttributeInfo);
+            }
+        }
+    }
+
+    /**
+     * Returns attribute for int.
+     *
+     * @return attribute for int
+     */
+    public JavaAttributeInfo getIntAttribute() {
+        return intAttribute;
+    }
+
+    /**
+     * Sets attribute for int.
+     *
+     * @param intAttribute attribute for int
+     */
+    private void setIntAttribute(JavaAttributeInfo intAttribute) {
+        this.intAttribute = intAttribute;
+    }
+
+    /**
+     * Returns attribute for long.
+     *
+     * @return attribute for long
+     */
+    public JavaAttributeInfo getLongAttribute() {
+        return longAttribute;
+    }
+
+    /**
+     * Sets attribute for long.
+     *
+     * @param longAttribute attribute for long
+     */
+    private void setLongAttribute(JavaAttributeInfo longAttribute) {
+        this.longAttribute = longAttribute;
+    }
+
+    /**
+     * Returns attribute for uInt.
+     *
+     * @return attribute for uInt
+     */
+    public JavaAttributeInfo getUIntAttribute() {
+        return uIntAttribute;
+    }
+
+    /**
+     * Sets attribute for uInt.
+     *
+     * @param uIntAttribute attribute for uInt
+     */
+    private void setUIntAttribute(JavaAttributeInfo uIntAttribute) {
+        this.uIntAttribute = uIntAttribute;
+    }
+
+    /**
+     * Returns attribute for uLong.
+     *
+     * @return attribute for uLong
+     */
+    public JavaAttributeInfo getULongAttribute() {
+        return uLongAttribute;
+    }
+
+    /**
+     * Sets attribute for uLong.
+     *
+     * @param uLongAttribute attribute for uLong
+     */
+    private void setULongAttribute(JavaAttributeInfo uLongAttribute) {
+        this.uLongAttribute = uLongAttribute;
+    }
+
+    /**
+     * Returns attribute for uInt8.
+     *
+     * @return attribute for uInt8
+     */
+    public JavaAttributeInfo getUInt8Attribute() {
+        return uInt8Attribute;
+    }
+
+    /**
+     * Sets attribute for uInt8.
+     *
+     * @param uInt8Attribute attribute for uInt8
+     */
+    private void setUInt8Attribute(JavaAttributeInfo uInt8Attribute) {
+        this.uInt8Attribute = uInt8Attribute;
+    }
+
+    /**
+     * Returns attribute for short.
+     *
+     * @return attribute for short
+     */
+    public JavaAttributeInfo getShortAttribute() {
+        return shortAttribute;
+    }
+
+    /**
+     * Sets attribute for short.
+     *
+     * @param shortAttribute attribute for short
+     */
+    private void setShortAttribute(JavaAttributeInfo shortAttribute) {
+        this.shortAttribute = shortAttribute;
+    }
+}
diff --git a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/YangDataModelFactory.java b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/YangDataModelFactory.java
new file mode 100644
index 0000000..9af9591
--- /dev/null
+++ b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/YangDataModelFactory.java
@@ -0,0 +1,429 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.yang.compiler.translator.tojava;
+
+import org.onosproject.yang.compiler.datamodel.YangAugment;
+import org.onosproject.yang.compiler.datamodel.YangCase;
+import org.onosproject.yang.compiler.datamodel.YangChoice;
+import org.onosproject.yang.compiler.datamodel.YangContainer;
+import org.onosproject.yang.compiler.datamodel.YangGrouping;
+import org.onosproject.yang.compiler.datamodel.YangIdentity;
+import org.onosproject.yang.compiler.datamodel.YangInput;
+import org.onosproject.yang.compiler.datamodel.YangLeaf;
+import org.onosproject.yang.compiler.datamodel.YangLeafList;
+import org.onosproject.yang.compiler.datamodel.YangList;
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangNotification;
+import org.onosproject.yang.compiler.datamodel.YangOutput;
+import org.onosproject.yang.compiler.datamodel.YangRpc;
+import org.onosproject.yang.compiler.datamodel.YangSubModule;
+import org.onosproject.yang.compiler.datamodel.YangType;
+import org.onosproject.yang.compiler.datamodel.YangTypeDef;
+import org.onosproject.yang.compiler.datamodel.YangUnion;
+import org.onosproject.yang.compiler.datamodel.YangUses;
+import org.onosproject.yang.compiler.datamodel.utils.GeneratedLanguage;
+import org.onosproject.yang.compiler.translator.exception.TranslatorException;
+import org.onosproject.yang.compiler.translator.tojava.javamodel.YangJavaAugmentTranslator;
+import org.onosproject.yang.compiler.translator.tojava.javamodel.YangJavaCaseTranslator;
+import org.onosproject.yang.compiler.translator.tojava.javamodel.YangJavaChoiceTranslator;
+import org.onosproject.yang.compiler.translator.tojava.javamodel.YangJavaContainerTranslator;
+import org.onosproject.yang.compiler.translator.tojava.javamodel.YangJavaEnumerationTranslator;
+import org.onosproject.yang.compiler.translator.tojava.javamodel.YangJavaGroupingTranslator;
+import org.onosproject.yang.compiler.translator.tojava.javamodel.YangJavaIdentityTranslator;
+import org.onosproject.yang.compiler.translator.tojava.javamodel.YangJavaInputTranslator;
+import org.onosproject.yang.compiler.translator.tojava.javamodel.YangJavaLeafListTranslator;
+import org.onosproject.yang.compiler.translator.tojava.javamodel.YangJavaLeafTranslator;
+import org.onosproject.yang.compiler.translator.tojava.javamodel.YangJavaListTranslator;
+import org.onosproject.yang.compiler.translator.tojava.javamodel.YangJavaModuleTranslator;
+import org.onosproject.yang.compiler.translator.tojava.javamodel.YangJavaNotificationTranslator;
+import org.onosproject.yang.compiler.translator.tojava.javamodel.YangJavaOutputTranslator;
+import org.onosproject.yang.compiler.translator.tojava.javamodel.YangJavaRpcTranslator;
+import org.onosproject.yang.compiler.translator.tojava.javamodel.YangJavaSubModuleTranslator;
+import org.onosproject.yang.compiler.translator.tojava.javamodel.YangJavaTypeDefTranslator;
+import org.onosproject.yang.compiler.translator.tojava.javamodel.YangJavaTypeTranslator;
+import org.onosproject.yang.compiler.translator.tojava.javamodel.YangJavaUnionTranslator;
+import org.onosproject.yang.compiler.translator.tojava.javamodel.YangJavaUsesTranslator;
+
+/**
+ * Represents factory to create data model objects based on the target file type.
+ */
+public final class YangDataModelFactory {
+
+    /**
+     * Creates a YANG data model factory object.
+     */
+    private YangDataModelFactory() {
+    }
+
+    /**
+     * Based on the target language generate the inherited data model node.
+     *
+     * @param targetLanguage target language in which YANG mapping needs to be
+     * generated
+     * @return the corresponding inherited node based on the target language
+     */
+    public static YangModule getYangModuleNode(GeneratedLanguage targetLanguage) {
+        switch (targetLanguage) {
+            case JAVA_GENERATION: {
+                return new YangJavaModuleTranslator();
+            }
+            default: {
+                throw new TranslatorException("Only YANG to Java is supported.");
+            }
+        }
+    }
+
+    /**
+     * Returns based on the target language generate the inherited data model node.
+     *
+     * @param targetLanguage target language in which YANG mapping needs to be
+     * generated
+     * @return the corresponding inherited node based on the target language
+     */
+    public static YangAugment getYangAugmentNode(GeneratedLanguage targetLanguage) {
+        switch (targetLanguage) {
+            case JAVA_GENERATION: {
+                return new YangJavaAugmentTranslator();
+            }
+            default: {
+                throw new TranslatorException("Only YANG to Java is supported.");
+            }
+        }
+    }
+
+    /**
+     * Returns based on the target language generate the inherited data model node.
+     *
+     * @param targetLanguage target language in which YANG mapping needs to be
+     * generated
+     * @return the corresponding inherited node based on the target language
+     */
+    public static YangCase getYangCaseNode(GeneratedLanguage targetLanguage) {
+        switch (targetLanguage) {
+            case JAVA_GENERATION: {
+                return new YangJavaCaseTranslator();
+            }
+            default: {
+                throw new TranslatorException("Only YANG to Java is supported.");
+            }
+        }
+    }
+
+    /**
+     * Returns based on the target language generate the inherited data model node.
+     *
+     * @param targetLanguage target language in which YANG mapping needs to be
+     * generated
+     * @return the corresponding inherited node based on the target language
+     */
+    public static YangChoice getYangChoiceNode(GeneratedLanguage targetLanguage) {
+        switch (targetLanguage) {
+            case JAVA_GENERATION: {
+                return new YangJavaChoiceTranslator();
+            }
+            default: {
+                throw new TranslatorException("Only YANG to Java is supported.");
+            }
+        }
+    }
+
+    /**
+     * Returns based on the target language generate the inherited data model node.
+     *
+     * @param targetLanguage target language in which YANG mapping needs to be
+     * generated
+     * @return the corresponding inherited node based on the target language
+     */
+    public static YangContainer getYangContainerNode(GeneratedLanguage targetLanguage) {
+        switch (targetLanguage) {
+            case JAVA_GENERATION: {
+                return new YangJavaContainerTranslator();
+            }
+            default: {
+                throw new TranslatorException("Only YANG to Java is supported.");
+            }
+        }
+    }
+
+    /**
+     * Returns based on the target language generate the inherited data model node.
+     *
+     * @param targetLanguage target language in which YANG mapping needs to be
+     * generated
+     * @return the corresponding inherited node based on the target language
+     */
+    public static YangIdentity getYangIdentityNode(GeneratedLanguage targetLanguage) {
+        switch (targetLanguage) {
+            case JAVA_GENERATION: {
+                return new YangJavaIdentityTranslator();
+            }
+            default: {
+                throw new TranslatorException("Only YANG to Java is supported.");
+            }
+        }
+    }
+
+    /**
+     * Returns based on the target language generate the inherited data model node.
+     *
+     * @param targetLanguage target language in which YANG mapping needs to be
+     * generated
+     * @return the corresponding inherited node based on the target language
+     */
+    public static YangGrouping getYangGroupingNode(GeneratedLanguage targetLanguage) {
+        switch (targetLanguage) {
+            case JAVA_GENERATION: {
+                return new YangJavaGroupingTranslator();
+            }
+            default: {
+                throw new TranslatorException("Only YANG to Java is supported.");
+            }
+        }
+    }
+
+    /**
+     * Returns based on the target language generate the inherited data model node.
+     *
+     * @param targetLanguage target language in which YANG mapping needs to be
+     * generated
+     * @return the corresponding inherited node based on the target language
+     */
+    public static YangList getYangListNode(GeneratedLanguage targetLanguage) {
+        switch (targetLanguage) {
+            case JAVA_GENERATION: {
+                return new YangJavaListTranslator();
+            }
+            default: {
+                throw new TranslatorException("Only YANG to Java is supported.");
+            }
+        }
+    }
+
+    /**
+     * Returns based on the target language generate the inherited data model node.
+     *
+     * @param targetLanguage target language in which YANG mapping needs to be
+     * generated
+     * @return the corresponding inherited node based on the target language
+     */
+    public static YangSubModule getYangSubModuleNode(GeneratedLanguage targetLanguage) {
+        switch (targetLanguage) {
+            case JAVA_GENERATION: {
+                return new YangJavaSubModuleTranslator();
+            }
+            default: {
+                throw new TranslatorException("Only YANG to Java is supported.");
+            }
+        }
+    }
+
+    /**
+     * Returns based on the target language generate the inherited data model node.
+     *
+     * @param targetLanguage target language in which YANG mapping needs to be
+     * generated
+     * @return the corresponding inherited node based on the target language
+     */
+    public static YangTypeDef getYangTypeDefNode(GeneratedLanguage targetLanguage) {
+        switch (targetLanguage) {
+            case JAVA_GENERATION: {
+                return new YangJavaTypeDefTranslator();
+            }
+            default: {
+                throw new TranslatorException("Only YANG to Java is supported.");
+            }
+        }
+    }
+
+    /**
+     * Returns based on the target language generate the inherited data model node.
+     *
+     * @param targetLanguage target language in which YANG mapping needs to be
+     * generated
+     * @return the corresponding inherited node based on the target language
+     */
+    public static YangUnion getYangUnionNode(GeneratedLanguage targetLanguage) {
+        switch (targetLanguage) {
+            case JAVA_GENERATION: {
+                return new YangJavaUnionTranslator();
+            }
+            default: {
+                throw new TranslatorException("Only YANG to Java is supported.");
+            }
+        }
+    }
+
+    /**
+     * Returns based on the target language generate the inherited data model node.
+     *
+     * @param targetLanguage target language in which YANG mapping needs to be
+     * generated
+     * @return the corresponding inherited node based on the target language
+     */
+    public static YangUses getYangUsesNode(GeneratedLanguage targetLanguage) {
+        switch (targetLanguage) {
+            case JAVA_GENERATION: {
+                return new YangJavaUsesTranslator();
+            }
+            default: {
+                throw new TranslatorException("Only YANG to Java is supported.");
+            }
+        }
+    }
+
+    /**
+     * Returns based on the target language generate the inherited data model node.
+     *
+     * @param targetLanguage target language in which YANG mapping needs to be
+     * generated
+     * @return the corresponding inherited node based on the target language
+     */
+    public static YangNotification getYangNotificationNode(GeneratedLanguage targetLanguage) {
+        switch (targetLanguage) {
+            case JAVA_GENERATION: {
+                return new YangJavaNotificationTranslator();
+            }
+            default: {
+                throw new TranslatorException("Only YANG to Java is supported.");
+            }
+        }
+    }
+
+    /**
+     * Returns based on the target language generate the inherited data model node.
+     *
+     * @param targetLanguage target language in which YANG mapping needs to be
+     * generated
+     * @return the corresponding inherited node based on the target language
+     */
+    public static YangLeaf getYangLeaf(GeneratedLanguage targetLanguage) {
+        switch (targetLanguage) {
+            case JAVA_GENERATION: {
+                return new YangJavaLeafTranslator();
+            }
+            default: {
+                throw new RuntimeException("Only YANG to Java is supported.");
+            }
+        }
+    }
+
+    /**
+     * Returns based on the target language generate the inherited data model node.
+     *
+     * @param targetLanguage target language in which YANG mapping needs to be
+     * generated
+     * @return the corresponding inherited node based on the target language
+     */
+    public static YangLeafList getYangLeafList(GeneratedLanguage targetLanguage) {
+        switch (targetLanguage) {
+            case JAVA_GENERATION: {
+                return new YangJavaLeafListTranslator();
+            }
+            default: {
+                throw new RuntimeException("Only YANG to Java is supported.");
+            }
+        }
+    }
+
+    /**
+     * Returns based on the target language generate the inherited data model node.
+     *
+     * @param targetLanguage target language in which YANG mapping needs to be
+     * generated
+     * @return the corresponding inherited node based on the target language
+     */
+    public static YangRpc getYangRpcNode(GeneratedLanguage targetLanguage) {
+        switch (targetLanguage) {
+            case JAVA_GENERATION: {
+                return new YangJavaRpcTranslator();
+            }
+            default: {
+                throw new TranslatorException("Only YANG to Java is supported.");
+            }
+        }
+    }
+
+    /**
+     * Returns based on the target language generate the inherited data model node.
+     *
+     * @param targetLanguage target language in which YANG mapping needs to be
+     * generated
+     * @return the corresponding inherited node based on the target language
+     */
+    public static YangInput getYangInputNode(GeneratedLanguage targetLanguage) {
+        switch (targetLanguage) {
+            case JAVA_GENERATION: {
+                return new YangJavaInputTranslator();
+            }
+            default: {
+                throw new TranslatorException("Only YANG to Java is supported.");
+            }
+        }
+    }
+
+    /**
+     * Returns based on the target language generate the inherited data model node.
+     *
+     * @param targetLanguage target language in which YANG mapping needs to be
+     * generated
+     * @return the corresponding inherited node based on the target language
+     */
+    public static YangOutput getYangOutputNode(GeneratedLanguage targetLanguage) {
+        switch (targetLanguage) {
+            case JAVA_GENERATION: {
+                return new YangJavaOutputTranslator();
+            }
+            default: {
+                throw new TranslatorException("Only YANG to Java is supported.");
+            }
+        }
+    }
+
+    /**
+     * Returns based on the target language generate the inherited data model node.
+     *
+     * @param targetLanguage target language in which YANG mapping needs to be
+     * generated
+     * @return the corresponding inherited node based on the target language
+     */
+    public static YangJavaEnumerationTranslator getYangEnumerationNode(GeneratedLanguage targetLanguage) {
+        switch (targetLanguage) {
+            case JAVA_GENERATION: {
+                return new YangJavaEnumerationTranslator();
+            }
+            default: {
+                throw new TranslatorException("Only YANG to Java is supported.");
+            }
+        }
+    }
+    /**
+     * Returns based on the target language generate the inherited data model node.
+     *
+     * @param targetLanguage target language in which YANG mapping needs to be
+     * generated
+     * @return the corresponding inherited node based on the target language
+     */
+    public static YangType getYangType(GeneratedLanguage targetLanguage) {
+        switch (targetLanguage) {
+            case JAVA_GENERATION: {
+                return new YangJavaTypeTranslator();
+            }
+            default: {
+                throw new RuntimeException("Only YANG to Java is supported.");
+            }
+        }
+    }
+}
diff --git a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/YangJavaModelUtils.java b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/YangJavaModelUtils.java
new file mode 100644
index 0000000..4cc70c2
--- /dev/null
+++ b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/YangJavaModelUtils.java
@@ -0,0 +1,813 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.translator.tojava;
+
+import org.onosproject.yang.compiler.datamodel.RpcNotificationContainer;
+import org.onosproject.yang.compiler.datamodel.YangAtomicPath;
+import org.onosproject.yang.compiler.datamodel.YangAugment;
+import org.onosproject.yang.compiler.datamodel.YangBit;
+import org.onosproject.yang.compiler.datamodel.YangBits;
+import org.onosproject.yang.compiler.datamodel.YangCase;
+import org.onosproject.yang.compiler.datamodel.YangChoice;
+import org.onosproject.yang.compiler.datamodel.YangEnum;
+import org.onosproject.yang.compiler.datamodel.YangEnumeration;
+import org.onosproject.yang.compiler.datamodel.YangGrouping;
+import org.onosproject.yang.compiler.datamodel.YangLeavesHolder;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangNodeIdentifier;
+import org.onosproject.yang.compiler.datamodel.YangSchemaNode;
+import org.onosproject.yang.compiler.datamodel.YangTranslatorOperatorNode;
+import org.onosproject.yang.compiler.datamodel.YangType;
+import org.onosproject.yang.compiler.datamodel.YangTypeHolder;
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.translator.exception.TranslatorException;
+import org.onosproject.yang.compiler.translator.tojava.javamodel.YangJavaAugmentTranslator;
+import org.onosproject.yang.compiler.translator.tojava.javamodel.YangJavaEnumerationTranslator;
+import org.onosproject.yang.compiler.translator.tojava.javamodel.YangJavaInputTranslator;
+import org.onosproject.yang.compiler.translator.tojava.javamodel.YangJavaModuleTranslator;
+import org.onosproject.yang.compiler.translator.tojava.javamodel.YangJavaOutputTranslator;
+import org.onosproject.yang.compiler.translator.tojava.javamodel.YangJavaSubModuleTranslator;
+import org.onosproject.yang.compiler.utils.io.YangPluginConfig;
+import org.slf4j.Logger;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import static org.onosproject.yang.compiler.datamodel.utils.DataModelUtils.getParentNodeInGenCode;
+import static org.onosproject.yang.compiler.datamodel.utils.DataModelUtils.isRpcChildNodePresent;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedJavaFileType.GENERATE_ENUM_CLASS;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedJavaFileType.GENERATE_SERVICE_AND_MANAGER;
+import static org.onosproject.yang.compiler.translator.tojava.TempJavaFragmentFiles.addCurNodeInfoInParentTempFile;
+import static org.onosproject.yang.compiler.translator.tojava.utils.JavaFileGenerator.generateInterfaceFile;
+import static org.onosproject.yang.compiler.translator.tojava.utils.JavaIdentifierSyntax.getRootPackage;
+import static org.onosproject.yang.compiler.translator.tojava.utils.TranslatorErrorType.INVALID_NODE;
+import static org.onosproject.yang.compiler.translator.tojava.utils.TranslatorErrorType.INVALID_PARENT_NODE;
+import static org.onosproject.yang.compiler.translator.tojava.utils.TranslatorErrorType.INVALID_TRANSLATION_NODE;
+import static org.onosproject.yang.compiler.translator.tojava.utils.TranslatorUtils.getBeanFiles;
+import static org.onosproject.yang.compiler.translator.tojava.utils.TranslatorUtils.getErrorMsg;
+import static org.onosproject.yang.compiler.translator.tojava.utils.TranslatorUtils.getErrorMsgForCodeGenerator;
+import static org.onosproject.yang.compiler.utils.UtilConstants.AUGMENTED;
+import static org.onosproject.yang.compiler.utils.UtilConstants.CLOSE_CURLY_BRACKET;
+import static org.onosproject.yang.compiler.utils.UtilConstants.HYPHEN;
+import static org.onosproject.yang.compiler.utils.UtilConstants.INPUT_KEYWORD;
+import static org.onosproject.yang.compiler.utils.UtilConstants.OUTPUT_KEYWORD;
+import static org.onosproject.yang.compiler.utils.UtilConstants.PERIOD;
+import static org.onosproject.yang.compiler.utils.io.impl.YangIoUtils.addPackageInfo;
+import static org.onosproject.yang.compiler.utils.io.impl.YangIoUtils.getCamelCase;
+import static org.onosproject.yang.compiler.utils.io.impl.YangIoUtils.getCapitalCase;
+import static org.onosproject.yang.compiler.utils.io.impl.YangIoUtils.getPackageDirPathFromJavaJPackage;
+import static org.onosproject.yang.compiler.utils.io.impl.YangIoUtils.insertDataIntoJavaFile;
+import static org.onosproject.yang.compiler.utils.io.impl.YangIoUtils.trimAtLast;
+import static org.onosproject.yang.compiler.utils.io.impl.YangIoUtils.validateLineLength;
+import static org.slf4j.LoggerFactory.getLogger;
+
+/**
+ * Represents utility class for YANG java model.
+ */
+public final class YangJavaModelUtils {
+
+    private static final Logger LOG = getLogger(YangJavaModelUtils.class);
+
+    // No instantiation.
+    private YangJavaModelUtils() {
+    }
+
+    /**
+     * Updates YANG java file package information.
+     *
+     * @param info   YANG java file info node
+     * @param config YANG plugin config
+     */
+    public static void updatePackageInfo(JavaCodeGeneratorInfo info,
+                                         YangPluginConfig config) {
+
+        JavaFileInfoTranslator translator = info.getJavaFileInfo();
+
+        if (info instanceof YangJavaAugmentTranslator) {
+            updatePackageForAugmentInfo(info, config);
+        } else {
+            setNodeJavaName(info, config);
+            translator.setJavaAttributeName(info.getJavaFileInfo()
+                                                    .getJavaName());
+            translator.setPackage(getCurNodePackage((YangNode) info));
+        }
+        updateCommonPackageInfo(translator, info, config);
+    }
+
+    /**
+     * The java name for input, output is prefixed with rpc name and other
+     * nodes are set by taking its own name from YANG.
+     *
+     * @param info   YANG java file info node
+     * @param config YANG plugin config
+     */
+    private static void setNodeJavaName(JavaCodeGeneratorInfo info,
+                                        YangPluginConfig config) {
+        String javaGenName;
+        if (info instanceof YangJavaInputTranslator) {
+            javaGenName = ((YangJavaInputTranslator) info).getParent().getName() +
+                    INPUT_KEYWORD;
+        } else if (info instanceof YangJavaOutputTranslator) {
+            javaGenName = ((YangJavaOutputTranslator) info).getParent().getName() +
+                    OUTPUT_KEYWORD;
+        } else {
+            javaGenName = ((YangNode) info).getName();
+        }
+        info.getJavaFileInfo().setJavaName(getCamelCase(
+                javaGenName, config.getConflictResolver()));
+    }
+
+    /**
+     * Updates YANG java file package information.
+     *
+     * @param info   YANG java file info node
+     * @param config YANG plugin config
+     */
+    private static void updatePackageForAugmentInfo(JavaCodeGeneratorInfo info,
+                                                    YangPluginConfig config) {
+
+        JavaFileInfoTranslator translator = info.getJavaFileInfo();
+
+        translator.setJavaName(getAugmentClassName(
+                (YangJavaAugmentTranslator) info, config));
+        translator.setPackage(getAugmentsNodePackage((YangNode) info));
+        updateCommonPackageInfo(translator, info, config);
+    }
+
+    /**
+     * Returns package for augment node.
+     *
+     * @param yangNode augment node
+     * @return package for augment node
+     */
+    private static String getAugmentsNodePackage(YangNode yangNode) {
+        YangAugment augment = (YangAugment) yangNode;
+        StringBuilder augmentPkg = new StringBuilder();
+        augmentPkg.append(getCurNodePackage(augment)).append(PERIOD)
+                .append(getPkgFromAugment(augment));
+        return augmentPkg.toString();
+    }
+
+    private static String getPkgFromAugment(YangAugment augment) {
+        StringBuilder pkg = new StringBuilder();
+        for (YangAtomicPath atomicPath : augment.getTargetNode()) {
+            pkg.append(getCamelCase(atomicPath.getNodeIdentifier().getName(),
+                                    null)).append(PERIOD);
+        }
+        return trimAtLast(pkg.toString(), PERIOD).toLowerCase();
+    }
+
+    /**
+     * Updates YANG java file package information for specified package.
+     *
+     * @param info   YANG java file info node
+     * @param config YANG plugin config
+     */
+    private static void updatePackageInfo(JavaCodeGeneratorInfo info,
+                                          YangPluginConfig config,
+                                          String pkg) {
+
+        JavaFileInfoTranslator translator = info.getJavaFileInfo();
+        translator.setJavaName(getCamelCase(((YangNode) info).getName(),
+                                            config.getConflictResolver()));
+        translator.setPackage(pkg);
+        updateCommonPackageInfo(translator, info, config);
+    }
+
+    /**
+     * Updates common package information.
+     *
+     * @param translator JAVA file info translator
+     * @param info       YANG java file info node
+     * @param config     YANG plugin config
+     */
+    private static void updateCommonPackageInfo(JavaFileInfoTranslator translator,
+                                                JavaCodeGeneratorInfo info,
+                                                YangPluginConfig config) {
+        translator.setPackageFilePath(getPackageDirPathFromJavaJPackage(
+                info.getJavaFileInfo().getPackage()));
+        translator.setBaseCodeGenPath(config.getCodeGenDir());
+        translator.setPluginConfig(config);
+    }
+
+    /**
+     * Updates temporary java code fragment files.
+     *
+     * @param info YANG java file info node
+     * @throws IOException IO operations fails
+     */
+    private static void createTempFragmentFile(JavaCodeGeneratorInfo info)
+            throws IOException {
+        info.setTempJavaCodeFragmentFiles(
+                new TempJavaCodeFragmentFiles(info.getJavaFileInfo()));
+    }
+
+    /**
+     * Updates leaf information in temporary java code fragment files.
+     *
+     * @param info YANG java file info node
+     * @throws IOException IO operations fails
+     */
+    private static void updateTempFragmentFiles(JavaCodeGeneratorInfo info,
+                                                YangPluginConfig config)
+            throws IOException {
+
+        TempJavaCodeFragmentFiles translator =
+                info.getTempJavaCodeFragmentFiles();
+        TempJavaBeanFragmentFiles bean = getBeanFiles(info);
+        if (info instanceof RpcNotificationContainer) {
+            bean.setRootNode(true);
+            /*
+             * event classes code generation.
+             */
+            updateNotificationNodeInfo(info, config);
+        }
+        if (info instanceof YangLeavesHolder) {
+
+            YangLeavesHolder holder = (YangLeavesHolder) info;
+            boolean isLeafPresent = holder.getListOfLeaf() != null && !holder
+                    .getListOfLeaf().isEmpty();
+            boolean isLeafListPresent = holder.getListOfLeafList() != null &&
+                    !holder.getListOfLeafList().isEmpty();
+            /*
+             * Container
+             * Case
+             * Grouping
+             * Input
+             * List
+             * Notification
+             * Output
+             */
+            if (isLeafPresent || isLeafListPresent) {
+                bean.addCurNodeLeavesInfoToTempFiles((YangNode) info,
+                                                     config);
+            }
+            //Add value leaf flag attribute to temp file.
+            if (isLeafPresent) {
+                bean.addValueLeafFlag(config, (YangNode) info);
+            }
+            if (((YangNode) info).isOpTypeReq()) {
+                // Add operation type as an attribute.
+                bean.addOperationTypeToTempFiles((YangNode) info,
+                                                 config);
+                bean.addIsSubTreeFilteredFlag(config);
+                if (isLeafPresent) {
+                    //Add select leaf flag attribute to temp file.
+                    bean.addSelectLeafFlag(config);
+                }
+            }
+        } else if (info instanceof YangTypeHolder) {
+            /*
+             * Typedef
+             * Union
+             */
+            translator.addTypeInfoToTempFiles((YangTypeHolder) info, config);
+        } else if (info instanceof YangJavaEnumerationTranslator) {
+            /*
+             * Enumeration
+             */
+            translator.getEnumTempFiles()
+                    .addEnumAttributeToTempFiles((YangNode) info, config);
+        } else if (!(info instanceof YangChoice)) {
+            /*Do nothing, only the interface needs to be generated for choice*/
+            throw new TranslatorException(
+                    getErrorMsgForCodeGenerator(INVALID_TRANSLATION_NODE, info));
+        }
+    }
+
+    /**
+     * Process generate code entry of YANG node.
+     *
+     * @param info   YANG java file info node
+     * @param config plugin configurations
+     * @throws IOException IO operations fails
+     */
+    private static void generateTempFiles(JavaCodeGeneratorInfo info,
+                                          YangPluginConfig config)
+            throws IOException {
+        if (!(info instanceof YangNode)) {
+            throw new TranslatorException(
+                    getErrorMsgForCodeGenerator(INVALID_TRANSLATION_NODE,
+                                                info));
+        }
+        createTempFragmentFile(info);
+        updateTempFragmentFiles(info, config);
+    }
+
+    /**
+     * Updates notification node info in service temporary file.
+     *
+     * @param info   java code generator info
+     * @param config plugin configurations
+     * @throws IOException when fails to do IO operations
+     */
+    private static void updateNotificationNodeInfo(JavaCodeGeneratorInfo info,
+                                                   YangPluginConfig config)
+            throws IOException {
+        TempJavaCodeFragmentFiles tempFile = info.getTempJavaCodeFragmentFiles();
+        for (YangNode notification :
+                ((RpcNotificationContainer) info).getNotificationNodes()) {
+            tempFile.getEventFragmentFiles()
+                    .addJavaSnippetOfEvent(notification, config);
+        }
+    }
+
+    /**
+     * Generates code for the current ata model node and adds itself as an
+     * attribute in the parent.
+     *
+     * @param info            YANG java file info node
+     * @param config          YANG plugin config
+     * @param isMultiInstance flag to indicate whether it's a list
+     * @throws IOException IO operations fails
+     */
+    public static void generateCodeAndUpdateInParent(JavaCodeGeneratorInfo info,
+                                                     YangPluginConfig config,
+                                                     boolean isMultiInstance)
+            throws IOException {
+        if (!(info instanceof YangNode)) {
+            throw new TranslatorException(
+                    getErrorMsgForCodeGenerator(INVALID_TRANSLATION_NODE,
+                                                info));
+        }
+
+        /*
+         * For second level and below cloned nodes code shouldn't be
+         * generated also they needn't be added in parent, since
+         * generated code will be under grouping, cloned node is only
+         * used for YANG namespace.
+         */
+        YangNode n = (YangNode) info;
+        if (n.getReferredSchema() != null &&
+                !(((YangNode) n.getReferredSchema()).getParent() instanceof
+                        YangGrouping)) {
+            return;
+        }
+        /*
+         * If first level cloned node, then it needs to be imported in the
+         * generated code. In case uses under grouping, it would further have
+         * second level uses, hence needn't add in parent grouping.
+         */
+        YangSchemaNode rn = getRefSchema(info);
+        if (rn != null) {
+            YangNode parent = ((YangNode) info).getParent();
+            if (!(parent instanceof YangGrouping)) {
+                addCurNodeInfoInParentTempFile((YangNode) rn, isMultiInstance,
+                                               config, parent);
+            }
+            return;
+        }
+
+        /*
+         * Generate the Java files corresponding to the current node.
+         */
+        generateCodeOfAugmentableNode(info, config);
+
+        /*
+         * Update the current nodes info in its parent nodes generated files.
+         */
+        addCurNodeInfoInParentTempFile((YangNode) info, isMultiInstance,
+                                       config);
+    }
+
+    /**
+     * Returns referred schema node in case of grouping uses.
+     *
+     * @param info YANG java file info node
+     * @return referred schema node
+     */
+    private static YangSchemaNode getRefSchema(JavaCodeGeneratorInfo info) {
+
+        YangSchemaNode node = (YangSchemaNode) info;
+        if (node.getReferredSchema() == null) {
+            return null;
+        }
+
+        /*
+         * Obtain last referred node in case grouping is embedded inside
+         * another grouping.
+         */
+        while (node.getReferredSchema() != null) {
+            node = node.getReferredSchema();
+        }
+        return node;
+    }
+
+    /**
+     * Generates code for the current data model node and adds support for it to
+     * be augmented.
+     *
+     * @param info   YANG java file info node
+     * @param config YANG plugin config
+     * @throws IOException IO operations fails
+     */
+    public static void generateCodeOfAugmentableNode(JavaCodeGeneratorInfo info,
+                                                     YangPluginConfig config)
+            throws IOException {
+        if (!(info instanceof YangNode)) {
+            throw new TranslatorException(
+                    getErrorMsgForCodeGenerator(INVALID_TRANSLATION_NODE,
+                                                info));
+        }
+
+        generateCodeOfNode(info, config);
+        TempJavaBeanFragmentFiles tempFiles = getBeanFiles(info);
+        if (!(info instanceof YangChoice)) {
+            tempFiles.addYangAugmentedMap(config, (YangNode) info);
+        }
+        if (info instanceof YangCase) {
+            YangNode parent = ((YangCase) info).getParent();
+            JavaQualifiedTypeInfoTranslator typeInfo =
+                    getQualifierInfoForCasesParent(parent, config);
+            tempFiles.getJavaExtendsListHolder()
+                    .addToExtendsList(typeInfo, (YangNode) info, tempFiles);
+
+            tempFiles.addParentInfoInCurNodeTempFile((YangNode) info, config);
+        }
+    }
+
+    /**
+     * Returns cases parent's qualified info.
+     *
+     * @param parent parent node
+     * @param config plugin configuration
+     * @return cases parent's qualified info
+     */
+    private static JavaQualifiedTypeInfoTranslator getQualifierInfoForCasesParent(
+            YangNode parent, YangPluginConfig config) {
+        String parentName;
+        String parentPkg;
+        JavaFileInfoTranslator parentInfo;
+        if (parent instanceof YangChoice) {
+            parentInfo = ((JavaFileInfoContainer) parent).getJavaFileInfo();
+        } else {
+            parent = ((YangAugment) parent).getAugmentedNode();
+            parentInfo = ((JavaFileInfoContainer) parent).getJavaFileInfo();
+        }
+        if (parentInfo.getPackage() != null) {
+            parentName = getCapitalCase(parentInfo.getJavaName());
+            parentPkg = parentInfo.getPackage();
+        } else {
+            parentName = getCapitalCase(getCamelCase(parent.getName(),
+                                                     config.getConflictResolver()));
+            parentPkg = getNodesPackage(parent, config);
+        }
+        JavaQualifiedTypeInfoTranslator qualifiedTypeInfo =
+                new JavaQualifiedTypeInfoTranslator();
+        qualifiedTypeInfo.setClassInfo(parentName);
+        qualifiedTypeInfo.setPkgInfo(parentPkg);
+        return qualifiedTypeInfo;
+    }
+
+    /**
+     * Generates code for the current data model node.
+     *
+     * @param info   YANG java file info node
+     * @param config YANG plugin config
+     * @throws IOException IO operations fails
+     */
+    public static void generateCodeOfNode(JavaCodeGeneratorInfo info,
+                                          YangPluginConfig config)
+            throws IOException {
+        if (!(info instanceof YangNode)) {
+            throw new TranslatorException(
+                    getErrorMsgForCodeGenerator(INVALID_TRANSLATION_NODE,
+                                                info));
+        }
+        updatePackageInfo(info, config);
+        generateTempFiles(info, config);
+    }
+
+    /**
+     * Generates code for the root module/sub-module node.
+     *
+     * @param info    YANG java file info node
+     * @param config  YANG plugin config
+     * @param rootPkg package of the root node
+     * @throws IOException IO operations fails
+     */
+    public static void generateCodeOfRootNode(JavaCodeGeneratorInfo info,
+                                              YangPluginConfig config,
+                                              String rootPkg)
+            throws IOException {
+        if (!(info instanceof YangNode)) {
+            throw new TranslatorException(
+                    getErrorMsgForCodeGenerator(INVALID_TRANSLATION_NODE,
+                                                info));
+        }
+        updatePackageInfo(info, config, rootPkg);
+
+        if (isRpcChildNodePresent((YangNode) info)) {
+            info.getJavaFileInfo().addGeneratedFileTypes(GENERATE_SERVICE_AND_MANAGER);
+        }
+        generateTempFiles(info, config);
+    }
+
+    /**
+     * Returns the node package string.
+     *
+     * @param curNode current java node whose package string needs to be set
+     * @return returns the root package string
+     */
+    public static String getCurNodePackage(YangNode curNode)
+            throws TranslatorException {
+
+        String pkg;
+        if (!(curNode instanceof JavaFileInfoContainer) ||
+                curNode.getParent() == null) {
+            throw new TranslatorException(getErrorMsg(INVALID_NODE, curNode));
+        }
+
+        YangNode parentNode = getParentNodeInGenCode(curNode);
+        if (!(parentNode instanceof JavaFileInfoContainer)) {
+            throw new TranslatorException(getErrorMsg(INVALID_PARENT_NODE,
+                                                      curNode));
+        }
+        JavaFileInfoTranslator handle =
+                ((JavaFileInfoContainer) parentNode).getJavaFileInfo();
+        pkg = handle.getPackage() + PERIOD + handle.getJavaName();
+        return pkg.toLowerCase();
+    }
+
+    /**
+     * Returns true if root node contains any data node.
+     *
+     * @param node root YANG node
+     * @return true if root node contains any data node
+     */
+    public static boolean isRootNodesCodeGenRequired(YangNode node) {
+        return isNodeCodeGenRequired(node, true);
+    }
+
+    /**
+     * Returns true if get/set method of root node are required.
+     *
+     * @param node root node
+     * @return true if get/set method of root node are required
+     */
+    public static boolean isGetSetOfRootNodeRequired(YangNode node) {
+        return isNodeCodeGenRequired(node, false);
+    }
+
+    /**
+     * Returns true if either get/set method of root node are required or root
+     * node contains any data node. This check is done depending on the
+     * boolean parameter indicating whether check to be performed for root
+     * node code generation or get/set method generation.
+     *
+     * @param node        root node
+     * @param rootNodeGen flag indicating check type
+     * @return true if check pass, false otherwise
+     */
+    private static boolean isNodeCodeGenRequired(YangNode node,
+                                                 boolean rootNodeGen) {
+        YangLeavesHolder holder = (YangLeavesHolder) node;
+
+        if (!holder.getListOfLeaf().isEmpty()) {
+            return true;
+        }
+        if (!holder.getListOfLeafList().isEmpty()) {
+            return true;
+        }
+        node = node.getChild();
+        if (node == null) {
+            return false;
+        }
+
+        if (rootNodeGen) {
+            while (node != null) {
+                if (!(node instanceof YangTranslatorOperatorNode)) {
+                    return true;
+                }
+                node = node.getNextSibling();
+            }
+            return false;
+        }
+        while (node != null) {
+            if (!(node instanceof YangAugment)) {
+                return true;
+            }
+            node = node.getNextSibling();
+        }
+        return false;
+    }
+
+    /**
+     * Returns nodes package.
+     *
+     * @param node   YANG node
+     * @param config plugin config
+     * @return java package
+     */
+    public static String getNodesPackage(YangNode node,
+                                         YangPluginConfig config) {
+
+        List<String> clsInfo = new ArrayList<>();
+        while (node.getParent() != null) {
+            if (node instanceof YangJavaAugmentTranslator) {
+                YangJavaAugmentTranslator augment =
+                        (YangJavaAugmentTranslator) node;
+                clsInfo.add(getAugmentClassName(augment, config));
+                clsInfo.add(getPkgFromAugment(augment));
+            } else {
+                clsInfo.add(getCamelCase(node.getName(), config
+                        .getConflictResolver()));
+            }
+            node = node.getParent();
+        }
+
+        StringBuilder pkg = new StringBuilder();
+        if (node instanceof YangJavaModuleTranslator) {
+            YangJavaModuleTranslator module = (YangJavaModuleTranslator) node;
+            pkg.append(getRootPackage(module.getVersion(),
+                                      module.getModuleNamespace(),
+                                      module.getRevision(),
+                                      config.getConflictResolver()));
+        } else if (node instanceof YangJavaSubModuleTranslator) {
+            YangJavaSubModuleTranslator subModule =
+                    (YangJavaSubModuleTranslator) node;
+            pkg.append(getRootPackage(subModule.getVersion(),
+                                      subModule.getNameSpaceFromModule(),
+                                      subModule.getRevision(),
+                                      config.getConflictResolver()));
+        }
+        clsInfo.add(getCamelCase(node.getName(), config.getConflictResolver()));
+
+        int size = clsInfo.size();
+        for (int i = size - 1; i > 0; i--) {
+            pkg.append(PERIOD).append(clsInfo.get(i));
+        }
+        return pkg.toString().toLowerCase();
+    }
+
+    /**
+     * Returns augment class name.
+     *
+     * @param augment YANG augment
+     * @param config  plugin configurations
+     * @return augment class name
+     */
+    private static String getAugmentClassName(YangAugment augment,
+                                              YangPluginConfig config) {
+        YangNodeIdentifier identifier =
+                augment.getTargetNode().get(augment.getTargetNode().size() - 1)
+                        .getNodeIdentifier();
+        String prefix = identifier.getPrefix();
+        String idName = identifier.getName();
+        StringBuilder name = new StringBuilder(AUGMENTED).append(HYPHEN);
+        if (identifier.getPrefix() != null) {
+            name.append(prefix).append(HYPHEN);
+        }
+        name.append(idName);
+        return getCapitalCase(getCamelCase(name.toString(),
+                                           config.getConflictResolver()));
+    }
+
+    /**
+     * Generated java code during exit.
+     *
+     * @param type generated file type
+     * @param node current YANG node
+     * @throws IOException when fails to generate java files
+     */
+    public static void generateJava(int type, YangNode node)
+            throws IOException {
+        /*
+         * Call for file generation if node is not under uses.
+         */
+        if (node.getReferredSchema() == null) {
+            ((TempJavaCodeFragmentFilesContainer) node)
+                    .getTempJavaCodeFragmentFiles().generateJavaFile(type, node);
+        }
+    }
+
+    private static void createAndAddEnum(String name, int value,
+                                         YangEnumeration enumeration) {
+        YangEnum yangEnum = new YangEnum();
+        yangEnum.setNamedValue(name);
+        yangEnum.setValue(value);
+        try {
+            enumeration.addEnumInfo(yangEnum);
+        } catch (DataModelException e) {
+            LOG.error("failed to add enum in bits enum class " + e);
+        }
+    }
+
+    /**
+     * Returns bits type enum file.
+     *
+     * @param attr     attribute
+     * @param type     data type
+     * @param fileInfo file info
+     * @param tempFile temp java fragment files
+     * @throws IOException when fails to do IO operations
+     */
+    static void generateBitsFile(
+            JavaAttributeInfo attr, YangType type,
+            JavaFileInfoTranslator fileInfo, TempJavaFragmentFiles tempFile) throws IOException {
+        String className = attr.getAttributeName();
+        JavaFileInfoTranslator attrInfo = new JavaFileInfoTranslator();
+        attrInfo.setJavaName(className);
+        attrInfo.setPackage((fileInfo.getPackage() + "." + fileInfo.getJavaName()
+                            ).toLowerCase());
+        attrInfo.setBaseCodeGenPath(fileInfo.getBaseCodeGenPath());
+        attrInfo.setGeneratedFileTypes(GENERATE_ENUM_CLASS);
+        attrInfo.setPackageFilePath(fileInfo.getPackageFilePath() + File.separator +
+                                            fileInfo.getJavaName().toLowerCase());
+        attrInfo.setPluginConfig(fileInfo.getPluginConfig());
+        TempJavaCodeFragmentFiles codeFile = new TempJavaCodeFragmentFiles(
+                attrInfo);
+        YangJavaEnumerationTranslator enumeration = new YangJavaEnumerationTranslator() {
+            @Override
+            public String getJavaPackage() {
+                return attr.getImportInfo().getPkgInfo();
+            }
+
+            @Override
+            public String getJavaClassNameOrBuiltInType() {
+                return className;
+            }
+
+            @Override
+            public String getJavaAttributeName() {
+                return className;
+            }
+        };
+
+        enumeration.setName(getCapitalCase(className));
+        enumeration.setJavaFileInfo(attrInfo);
+        enumeration.setTempJavaCodeFragmentFiles(codeFile);
+        YangBits yangBits = (YangBits) type.getDataTypeExtendedInfo();
+        Integer key;
+        YangBit bit;
+        String bitName;
+        for (Map.Entry<Integer, YangBit> entry : yangBits.getBitPositionMap()
+                .entrySet()) {
+            key = entry.getKey();
+            bit = entry.getValue();
+            if (bit != null) {
+                bitName = bit.getBitName();
+                createAndAddEnum(bitName, key, enumeration);
+            }
+        }
+
+        codeFile.getEnumTempFiles()
+                .addEnumAttributeToTempFiles(enumeration, fileInfo.getPluginConfig());
+        codeFile.getEnumTempFiles().setEnumClass(false);
+        codeFile.generateJavaFile(GENERATE_ENUM_CLASS, enumeration);
+
+        //Add to import list.
+        JavaQualifiedTypeInfoTranslator info = new
+                JavaQualifiedTypeInfoTranslator();
+        info.setClassInfo(getCapitalCase(attrInfo.getJavaName()));
+        info.setPkgInfo(attrInfo.getPackage());
+        if (tempFile instanceof TempJavaTypeFragmentFiles) {
+            tempFile.getJavaImportData().addImportInfo(info, fileInfo
+                    .getJavaName(), fileInfo.getPackage());
+        }
+    }
+
+    /**
+     * Generates interface file for those yang file which contains only any
+     * of these grouping, typedef and identity.
+     *
+     * @param rootNode root node
+     * @throws IOException when fails to do IO operations
+     */
+    public static void generateInterfaceFileForNonDataNodes(YangNode rootNode) throws
+            IOException {
+        JavaCodeGeneratorInfo info = (JavaCodeGeneratorInfo) rootNode;
+        TempJavaCodeFragmentFiles tempFile = info
+                .getTempJavaCodeFragmentFiles();
+        JavaFileInfoTranslator fileInfo = info.getJavaFileInfo();
+        File filePath = new File(fileInfo.getBaseCodeGenPath() + fileInfo
+                .getPackageFilePath());
+        String name = getCapitalCase(fileInfo.getJavaName());
+        //Add package info file for this.
+        addPackageInfo(filePath, name, fileInfo.getPackage(), false);
+        //Generate file handle for this.
+        File interFace = tempFile.getBeanTempFiles().getJavaFileHandle(
+                name);
+        //generate java code for interface file.
+        validateLineLength(generateInterfaceFile(interFace, null, rootNode,
+                                                 false));
+        insertDataIntoJavaFile(interFace, CLOSE_CURLY_BRACKET);
+    }
+}
diff --git a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/javamodel/AttributesJavaDataType.java b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/javamodel/AttributesJavaDataType.java
new file mode 100644
index 0000000..65b2a02
--- /dev/null
+++ b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/javamodel/AttributesJavaDataType.java
@@ -0,0 +1,578 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.translator.tojava.javamodel;
+
+import org.onosproject.yang.compiler.datamodel.YangDerivedInfo;
+import org.onosproject.yang.compiler.datamodel.YangEnumeration;
+import org.onosproject.yang.compiler.datamodel.YangIdentity;
+import org.onosproject.yang.compiler.datamodel.YangIdentityRef;
+import org.onosproject.yang.compiler.datamodel.YangLeafRef;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangType;
+import org.onosproject.yang.compiler.datamodel.YangUnion;
+import org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes;
+import org.onosproject.yang.compiler.translator.exception.TranslatorException;
+import org.onosproject.yang.compiler.translator.tojava.JavaCodeGeneratorInfo;
+import org.onosproject.yang.compiler.translator.tojava.JavaFileInfoContainer;
+import org.onosproject.yang.compiler.translator.tojava.JavaFileInfoTranslator;
+import org.onosproject.yang.compiler.utils.io.YangToJavaNamingConflictUtil;
+
+import java.util.Stack;
+
+import static org.onosproject.yang.compiler.translator.tojava.YangJavaModelUtils.getCurNodePackage;
+import static org.onosproject.yang.compiler.translator.tojava.utils.JavaIdentifierSyntax.getRootPackage;
+import static org.onosproject.yang.compiler.utils.UtilConstants.BIG_DECIMAL;
+import static org.onosproject.yang.compiler.utils.UtilConstants.BIG_INTEGER;
+import static org.onosproject.yang.compiler.utils.UtilConstants.BIT_SET;
+import static org.onosproject.yang.compiler.utils.UtilConstants.BOOLEAN_DATA_TYPE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.BOOLEAN_WRAPPER;
+import static org.onosproject.yang.compiler.utils.UtilConstants.BYTE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.BYTE_WRAPPER;
+import static org.onosproject.yang.compiler.utils.UtilConstants.COLLECTION_IMPORTS;
+import static org.onosproject.yang.compiler.utils.UtilConstants.INT;
+import static org.onosproject.yang.compiler.utils.UtilConstants.INTEGER_WRAPPER;
+import static org.onosproject.yang.compiler.utils.UtilConstants.JAVA_LANG;
+import static org.onosproject.yang.compiler.utils.UtilConstants.JAVA_MATH;
+import static org.onosproject.yang.compiler.utils.UtilConstants.LONG;
+import static org.onosproject.yang.compiler.utils.UtilConstants.LONG_WRAPPER;
+import static org.onosproject.yang.compiler.utils.UtilConstants.OBJECT_STRING;
+import static org.onosproject.yang.compiler.utils.UtilConstants.PERIOD;
+import static org.onosproject.yang.compiler.utils.UtilConstants.SHORT;
+import static org.onosproject.yang.compiler.utils.UtilConstants.SHORT_WRAPPER;
+import static org.onosproject.yang.compiler.utils.UtilConstants.SQUARE_BRACKETS;
+import static org.onosproject.yang.compiler.utils.UtilConstants.STRING_DATA_TYPE;
+import static org.onosproject.yang.compiler.utils.io.impl.YangIoUtils.getCamelCase;
+import static org.onosproject.yang.compiler.utils.io.impl.YangIoUtils.getCapitalCase;
+import static org.onosproject.yang.compiler.utils.io.impl.YangIoUtils.getPackageDirPathFromJavaJPackage;
+
+/**
+ * Represents java data types info corresponding to YANG type.
+ */
+public final class AttributesJavaDataType {
+
+    /**
+     * Creates an instance of attribute java data type.
+     */
+    private AttributesJavaDataType() {
+    }
+
+    /**
+     * Returns java type.
+     *
+     * @param yangType YANG type
+     * @return java type
+     */
+    public static String getJavaDataType(YangType<?> yangType) {
+
+        YangDataTypes type = yangType.getDataType();
+
+        switch (type) {
+            case INT8:
+                return BYTE;
+            case INT16:
+                return SHORT;
+            case INT32:
+                return INT;
+            case INT64:
+                return LONG;
+            case UINT8:
+                return SHORT;
+            case UINT16:
+                return INT;
+            case UINT32:
+                return LONG;
+            case UINT64:
+                return BIG_INTEGER;
+            case BITS:
+                return BIT_SET;
+            case BINARY:
+                return BYTE + SQUARE_BRACKETS;
+            case DECIMAL64:
+                return BIG_DECIMAL;
+            case STRING:
+                return STRING_DATA_TYPE;
+            case BOOLEAN:
+                return BOOLEAN_DATA_TYPE;
+            case INSTANCE_IDENTIFIER:
+                return STRING_DATA_TYPE;
+            case LEAFREF:
+                YangType refType = getReferredTypeFromLeafref(yangType);
+                if (refType == null) {
+                    return OBJECT_STRING;
+                }
+                return getJavaDataType(getReferredTypeFromLeafref(yangType));
+            default:
+                throw new TranslatorException("given data type is not supported. " +
+                                                      yangType.getDataTypeName() + " in " +
+                                                      yangType.getLineNumber() + " at " +
+                                                      yangType.getCharPosition()
+                                                      + " in " + yangType.getFileName());
+        }
+    }
+
+    /**
+     * Returns java import class.
+     *
+     * @param yangType     YANG type
+     * @param isListAttr   if the attribute need to be a list
+     * @param pluginConfig plugin configurations
+     * @return java import class
+     */
+    public static String getJavaImportClass(YangType<?> yangType, boolean isListAttr,
+                                            YangToJavaNamingConflictUtil pluginConfig) {
+
+        YangDataTypes type = yangType.getDataType();
+
+        if (isListAttr) {
+            switch (type) {
+                case INT8:
+                    return BYTE_WRAPPER;
+                case INT16:
+                    return SHORT_WRAPPER;
+                case INT32:
+                    return INTEGER_WRAPPER;
+                case INT64:
+                    return LONG_WRAPPER;
+                case UINT8:
+                    return SHORT_WRAPPER;
+                case UINT16:
+                    return INTEGER_WRAPPER;
+                case UINT32:
+                    return LONG_WRAPPER;
+                case UINT64:
+                    return BIG_INTEGER;
+                case DECIMAL64:
+                    return BIG_DECIMAL;
+                case STRING:
+                    return STRING_DATA_TYPE;
+                case BOOLEAN:
+                    return BOOLEAN_WRAPPER;
+                case ENUMERATION:
+                    return getCapitalCase(
+                            getCamelCase(((YangJavaEnumerationTranslator) yangType.getDataTypeExtendedInfo()).getName(),
+                                         pluginConfig));
+                case BITS:
+                    return BIT_SET;
+                case BINARY:
+                    return BYTE + SQUARE_BRACKETS;
+                case LEAFREF:
+                    return getLeafRefImpClass(yangType, pluginConfig, true);
+                case IDENTITYREF:
+                    return getIdentityRefImpClass(yangType, pluginConfig);
+                case EMPTY:
+                    return BOOLEAN_WRAPPER;
+                case UNION:
+                    return getCapitalCase(getCamelCase(((YangJavaUnionTranslator) yangType
+                            .getDataTypeExtendedInfo()).getName(), pluginConfig));
+                case INSTANCE_IDENTIFIER:
+                    return STRING_DATA_TYPE;
+                case DERIVED:
+                    return getCapitalCase(
+                            getCamelCase(yangType.getDataTypeName(), pluginConfig));
+                default:
+                    throw new TranslatorException("given data type is not supported ." +
+                                                          yangType.getDataTypeName() + " in " +
+                                                          yangType.getLineNumber() + " at " +
+                                                          yangType.getCharPosition()
+                                                          + " in " + yangType.getFileName());
+            }
+        } else {
+            switch (type) {
+                case UINT64:
+                    return BIG_INTEGER;
+                case STRING:
+                    return STRING_DATA_TYPE;
+                case ENUMERATION:
+                    return getCapitalCase(
+                            getCamelCase(((YangJavaEnumerationTranslator) yangType.getDataTypeExtendedInfo()).getName(),
+                                         pluginConfig));
+                case BITS:
+                    return BIT_SET;
+                case DECIMAL64:
+                    return BIG_DECIMAL;
+                case LEAFREF:
+                    return getLeafRefImpClass(yangType, pluginConfig, false);
+                case IDENTITYREF:
+                    return getIdentityRefImpClass(yangType, pluginConfig);
+                case EMPTY:
+                    return BOOLEAN_DATA_TYPE;
+                case UNION:
+                    return getCapitalCase(getCamelCase(((YangJavaUnionTranslator) yangType
+                            .getDataTypeExtendedInfo()).getName(), pluginConfig));
+                case INSTANCE_IDENTIFIER:
+                    return STRING_DATA_TYPE;
+                case DERIVED:
+                    return getCapitalCase(
+                            getCamelCase(yangType.getDataTypeName(), pluginConfig));
+                default:
+                    return null;
+            }
+        }
+    }
+
+    /**
+     * Returns java import package.
+     *
+     * @param yangType         YANG type
+     * @param isListAttr       if the attribute is of list type
+     * @param conflictResolver object of YANG to java naming conflict util
+     * @return java import package
+     */
+    public static String getJavaImportPackage(YangType<?> yangType, boolean isListAttr,
+                                              YangToJavaNamingConflictUtil conflictResolver) {
+
+        YangDataTypes type = yangType.getDataType();
+
+        if (isListAttr) {
+            switch (type) {
+                case INT8:
+                case INT16:
+                case INT32:
+                case INT64:
+                case UINT8:
+                case UINT16:
+                case UINT32:
+                case BINARY:
+                case STRING:
+                case BOOLEAN:
+                case EMPTY:
+                    return JAVA_LANG;
+                case UINT64:
+                case DECIMAL64:
+                    return JAVA_MATH;
+                case ENUMERATION:
+                    return getEnumsPackage(yangType, conflictResolver);
+                case BITS:
+                    return COLLECTION_IMPORTS;
+                case LEAFREF:
+                    return getLeafRefImpPkg(yangType, conflictResolver, true);
+                case IDENTITYREF:
+                    return getIdentityRefPackage(yangType, conflictResolver);
+                case UNION:
+                    return getUnionPackage(yangType, conflictResolver);
+                case INSTANCE_IDENTIFIER:
+                    return JAVA_LANG;
+                case DERIVED:
+                    return getTypeDefsPackage(yangType, conflictResolver);
+                default:
+                    throw new TranslatorException("given data type is not supported. " +
+                                                          yangType.getDataTypeName() + " in " +
+                                                          yangType.getLineNumber() + " at " +
+                                                          yangType.getCharPosition()
+                                                          + " in " + yangType.getFileName());
+            }
+        } else {
+            switch (type) {
+                case UINT64:
+                case DECIMAL64:
+                    return JAVA_MATH;
+                case EMPTY:
+                case STRING:
+                    return JAVA_LANG;
+                case ENUMERATION:
+                    return getEnumsPackage(yangType, conflictResolver);
+                case BITS:
+                    return COLLECTION_IMPORTS;
+                case LEAFREF:
+                    return getLeafRefImpPkg(yangType, conflictResolver, false);
+                case IDENTITYREF:
+                    return getIdentityRefPackage(yangType, conflictResolver);
+                case UNION:
+                    return getUnionPackage(yangType, conflictResolver);
+                case INSTANCE_IDENTIFIER:
+                    return JAVA_LANG;
+                case DERIVED:
+                    return getTypeDefsPackage(yangType, conflictResolver);
+                default:
+                    return null;
+            }
+        }
+    }
+
+    /**
+     * Returns java package for typedef node.
+     *
+     * @param type             YANG type
+     * @param conflictResolver object of YANG to java naming conflict util
+     * @return java package for typedef node
+     */
+    private static String getTypeDefsPackage(YangType<?> type,
+                                             YangToJavaNamingConflictUtil conflictResolver) {
+        Object var = type.getDataTypeExtendedInfo();
+        if (!(var instanceof YangDerivedInfo)) {
+            throw new TranslatorException("type should have been derived. " +
+                                                  type.getDataTypeName() + " in " +
+                                                  type.getLineNumber() + " at " +
+                                                  type.getCharPosition()
+                                                  + " in " + type.getFileName());
+        }
+
+        if ((((YangDerivedInfo<?>) var).getReferredTypeDef() == null)) {
+            throw new TranslatorException("derived info is not an instance of typedef. " +
+                                                  type.getDataTypeName() + " in " +
+                                                  type.getLineNumber() + " at " +
+                                                  type.getCharPosition()
+                                                  + " in " + type.getFileName());
+        }
+
+        YangJavaTypeDefTranslator typedef = (YangJavaTypeDefTranslator) ((YangDerivedInfo<?>) var).getReferredTypeDef();
+        return getTypePackage(typedef, conflictResolver);
+    }
+
+    /**
+     * Returns java package for union node.
+     *
+     * @param type             YANG type
+     * @param conflictResolver object of YANG to java naming conflict util
+     * @return java package for union node
+     */
+    private static String getUnionPackage(YangType<?> type,
+                                          YangToJavaNamingConflictUtil conflictResolver) {
+
+        if (!(type.getDataTypeExtendedInfo() instanceof YangUnion)) {
+            throw new TranslatorException("type should have been union. " +
+                                                  type.getDataTypeName() + " in " +
+                                                  type.getLineNumber() + " at " +
+                                                  type.getCharPosition()
+                                                  + " in " + type.getFileName());
+        }
+
+        YangJavaUnionTranslator union = (YangJavaUnionTranslator) type.getDataTypeExtendedInfo();
+        return getTypePackage(union, conflictResolver);
+    }
+
+    /**
+     * Returns YANG enumeration's java package.
+     *
+     * @param type             YANG type
+     * @param conflictResolver object of YANG to java naming conflict util
+     * @return YANG enumeration's java package
+     */
+    private static String getEnumsPackage(YangType<?> type,
+                                          YangToJavaNamingConflictUtil conflictResolver) {
+
+        if (!(type.getDataTypeExtendedInfo() instanceof YangEnumeration)) {
+            throw new TranslatorException("type should have been enumeration. " +
+                                                  type.getDataTypeName() + " in " +
+                                                  type.getLineNumber() + " at " +
+                                                  type.getCharPosition()
+                                                  + " in " + type.getFileName());
+        }
+        YangJavaEnumerationTranslator enumeration =
+                (YangJavaEnumerationTranslator) type.getDataTypeExtendedInfo();
+        return getTypePackage(enumeration, conflictResolver);
+    }
+
+    /**
+     * Returns YANG identity's java package.
+     *
+     * @param type             YANG type
+     * @param conflictResolver object of YANG to java naming conflict util
+     * @return YANG identity's java package
+     */
+    private static String getIdentityRefPackage(YangType<?> type,
+                                                YangToJavaNamingConflictUtil conflictResolver) {
+
+        if (!(type.getDataTypeExtendedInfo() instanceof YangIdentityRef)) {
+            throw new TranslatorException("type should have been identityref. " +
+                                                  type.getDataTypeName() + " in " +
+                                                  type.getLineNumber() + " at " +
+                                                  type.getCharPosition()
+                                                  + " in " + type.getFileName());
+        }
+        YangIdentityRef identityRef = (YangIdentityRef) type.getDataTypeExtendedInfo();
+        if (identityRef.isInGrouping()) {
+            return JAVA_LANG;
+        }
+        YangJavaIdentityTranslator identity =
+                (YangJavaIdentityTranslator) (identityRef.getReferredIdentity());
+        return getTypePackage(identity, conflictResolver);
+    }
+
+    /**
+     * Returns type package.
+     *
+     * @param info             YANG code generator info
+     * @param conflictResolver object of YANG to java naming conflict util
+     * @return type java package
+     */
+    private static String getTypePackage(JavaCodeGeneratorInfo info,
+                                         YangToJavaNamingConflictUtil conflictResolver) {
+        YangNode node = (YangNode) info;
+        // Check for referred schema type node for grouping scenario.
+        while (node.getReferredSchema() != null) {
+            node = (YangNode) node.getReferredSchema();
+        }
+        info = (JavaCodeGeneratorInfo) node;
+        if (info.getJavaFileInfo().getPackage() == null) {
+            return getPackageFromParent(node.getParent(), conflictResolver);
+        }
+        return info.getJavaFileInfo().getPackage();
+    }
+
+    /**
+     * Returns package from parent node.
+     *
+     * @param parent           parent YANG node
+     * @param conflictResolver object of YANG to java naming conflict util
+     * @return java package from parent node
+     */
+    private static String getPackageFromParent(YangNode parent,
+                                               YangToJavaNamingConflictUtil conflictResolver) {
+        if (!(parent instanceof JavaFileInfoContainer)) {
+            throw new TranslatorException("invalid child node is being processed. " +
+                                                  parent.getName() + " in " +
+                                                  parent.getLineNumber() + " at " +
+                                                  parent.getCharPosition()
+                                                  + " in " + parent.getFileName());
+        }
+        JavaFileInfoTranslator parentInfo = ((JavaFileInfoContainer) parent).getJavaFileInfo();
+        if (parentInfo.getPackage() == null) {
+            updateJavaFileInfo(parent, conflictResolver);
+        }
+        return parentInfo.getPackage() + PERIOD + parentInfo.getJavaName().toLowerCase();
+    }
+
+    /**
+     * Update the referred data model nodes java file info, this will be called,
+     * when the linked node is yet to translate. Then resolve until the parent hierarchy.
+     *
+     * @param yangNode         node whose java info needs to be updated
+     * @param conflictResolver yang plugin config
+     */
+    public static void updateJavaFileInfo(YangNode yangNode,
+                                          YangToJavaNamingConflictUtil conflictResolver) {
+        Stack<YangNode> nodesToUpdatePackage = new Stack<>();
+
+        /*
+         * Add the nodes to be updated for package info in a stack.
+         */
+        while (yangNode != null
+                && ((JavaFileInfoContainer) yangNode)
+                .getJavaFileInfo().getPackage() == null) {
+            nodesToUpdatePackage.push(yangNode);
+            yangNode = yangNode.getParent();
+        }
+
+        /*
+         * If the package is not updated till root node, then root package needs to
+         * be updated.
+         */
+        if (yangNode == null) {
+            yangNode = nodesToUpdatePackage.pop();
+            String pkg;
+            if (yangNode instanceof YangJavaModuleTranslator) {
+                YangJavaModuleTranslator module = (YangJavaModuleTranslator) yangNode;
+                pkg = getRootPackage(module.getVersion(), module.getModuleNamespace(),
+                                     module.getRevision(), conflictResolver);
+            } else if (yangNode instanceof YangJavaSubModuleTranslator) {
+                YangJavaSubModuleTranslator submodule = (YangJavaSubModuleTranslator) yangNode;
+                pkg = getRootPackage(submodule.getVersion(),
+                                     submodule.getNameSpaceFromModule(),
+                                     submodule.getRevision(), conflictResolver);
+            } else {
+                throw new TranslatorException("Invalid root node of data model tree " +
+                                                      yangNode.getName() + " in " +
+                                                      yangNode.getLineNumber() + " at " +
+                                                      yangNode.getCharPosition()
+                                                      + " in " + yangNode.getFileName());
+            }
+
+            ((JavaCodeGeneratorInfo) yangNode).getJavaFileInfo()
+                    .setJavaName(getCamelCase(yangNode.getName(), conflictResolver));
+            ((JavaCodeGeneratorInfo) yangNode).getJavaFileInfo()
+                    .setPackage(pkg);
+            ((JavaCodeGeneratorInfo) yangNode).getJavaFileInfo()
+                    .setPackageFilePath(getPackageDirPathFromJavaJPackage(
+                            ((JavaCodeGeneratorInfo) yangNode).getJavaFileInfo()
+                                    .getPackage()));
+        }
+
+        /*
+         * Parent of the node in stack is updated with java info,
+         * all the nodes can be popped and updated
+         */
+        while (nodesToUpdatePackage.size() != 0) {
+            yangNode = nodesToUpdatePackage.pop();
+            ((JavaCodeGeneratorInfo) yangNode).getJavaFileInfo()
+                    .setJavaName(getCamelCase(yangNode.getName(), conflictResolver));
+            ((JavaCodeGeneratorInfo) yangNode).getJavaFileInfo()
+                    .setPackage(getCurNodePackage(yangNode));
+            ((JavaCodeGeneratorInfo) yangNode).getJavaFileInfo()
+                    .setPackageFilePath(getPackageDirPathFromJavaJPackage(
+                            ((JavaCodeGeneratorInfo) yangNode).getJavaFileInfo()
+                                    .getPackage()));
+        }
+    }
+
+    /**
+     * Returns the referred type from leaf/leaf-list.
+     *
+     * @param type current type in leaf
+     * @return type from the leafref
+     */
+    private static YangType<?> getReferredTypeFromLeafref(YangType type) {
+        YangLeafRef<?> lri = (YangLeafRef<?>) type.getDataTypeExtendedInfo();
+        return lri.isInGrouping() ? null : lri.getEffectiveDataType();
+    }
+
+    /**
+     * Returns leaf ref import string.
+     *
+     * @param type   YANG type
+     * @param cnfg   YANG to java naming conflict util
+     * @param isList true if list, false otherwise
+     * @return import class
+     */
+    public static String getLeafRefImpClass(
+            YangType type, YangToJavaNamingConflictUtil cnfg, boolean isList) {
+        YangType<?> rt = getReferredTypeFromLeafref(type);
+        return rt == null ? OBJECT_STRING : getJavaImportClass(rt, isList,
+                                                               cnfg);
+    }
+
+    /**
+     * Returns identity ref import class.
+     *
+     * @param type YANG type
+     * @param cnfg YANG to java naming conflict util
+     * @return import class
+     */
+    public static String getIdentityRefImpClass(
+            YangType type, YangToJavaNamingConflictUtil cnfg) {
+        YangIdentityRef ir = (YangIdentityRef) type.getDataTypeExtendedInfo();
+        if (ir.isInGrouping()) {
+            return OBJECT_STRING;
+        }
+        YangIdentity identity = ir.getReferredIdentity();
+        return getCapitalCase(getCamelCase(identity.getName(), cnfg));
+    }
+
+    /**
+     * Returns leaf ref import package.
+     *
+     * @param type   YANG type
+     * @param cnfg   YANG to java naming conflict util
+     * @param isList true if list, false otherwise
+     * @return import package
+     */
+    private static String getLeafRefImpPkg(
+            YangType type, YangToJavaNamingConflictUtil cnfg, boolean isList) {
+        YangType<?> rt = getReferredTypeFromLeafref(type);
+        return rt == null ? JAVA_LANG : getJavaImportPackage(rt, isList, cnfg);
+    }
+}
diff --git a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/javamodel/JavaLeafInfoContainer.java b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/javamodel/JavaLeafInfoContainer.java
new file mode 100644
index 0000000..6622c3f
--- /dev/null
+++ b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/javamodel/JavaLeafInfoContainer.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.yang.compiler.translator.tojava.javamodel;
+
+import org.onosproject.yang.compiler.datamodel.LocationInfo;
+import org.onosproject.yang.compiler.datamodel.YangType;
+import org.onosproject.yang.compiler.datamodel.javadatamodel.JavaQualifiedTypeInfoContainer;
+import org.onosproject.yang.compiler.utils.io.YangToJavaNamingConflictUtil;
+
+/**
+ * Represent java based identification of the YANG leaves.
+ */
+public interface JavaLeafInfoContainer
+        extends JavaQualifiedTypeInfoContainer, LocationInfo {
+    /**
+     * Retrieves the data type of the leaf.
+     *
+     * @return data type of the leaf
+     */
+    YangType<?> getDataType();
+
+    /**
+     * Retrieves the name of the leaf.
+     *
+     * @return name of the leaf
+     */
+    String getName();
+
+    /**
+     * Retrieves the java name of the leaf.
+     *
+     * @param conflictResolveConfig user config to resolve conflicts
+     * @return name of the leaf
+     */
+    String getJavaName(YangToJavaNamingConflictUtil conflictResolveConfig);
+
+    /**
+     * Identifies if object is a leaf-list.
+     *
+     * @return true if leaf-list false otherwise
+     */
+    boolean isLeafList();
+
+    /**
+     * updates the qualified info.
+     */
+    void updateJavaQualifiedInfo();
+
+    /**
+     * Returns java naming conflict resolver.
+     *
+     * @return java naming conflict resolver
+     */
+    YangToJavaNamingConflictUtil getConflictResolveConfig();
+
+    /**
+     * Sets  java naming conflict resolver.
+     *
+     * @param conflictResolveConfig java naming conflict resolver
+     */
+    void setConflictResolveConfig(YangToJavaNamingConflictUtil conflictResolveConfig);
+}
diff --git a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/javamodel/JavaQualifiedTypeResolver.java b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/javamodel/JavaQualifiedTypeResolver.java
new file mode 100644
index 0000000..439c37a
--- /dev/null
+++ b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/javamodel/JavaQualifiedTypeResolver.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.yang.compiler.translator.tojava.javamodel;
+
+import org.onosproject.yang.compiler.utils.io.YangToJavaNamingConflictUtil;
+
+/**
+ * Represent java based identification of the YANG leaves.
+ */
+interface JavaQualifiedTypeResolver {
+
+    /**
+     * updates the qualified access details of the type.
+     *
+     * @param conflictResolver plugin configurations
+     */
+    void updateJavaQualifiedInfo(YangToJavaNamingConflictUtil conflictResolver);
+}
diff --git a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/javamodel/YangJavaAugmentTranslator.java b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/javamodel/YangJavaAugmentTranslator.java
new file mode 100644
index 0000000..6c6d80b
--- /dev/null
+++ b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/javamodel/YangJavaAugmentTranslator.java
@@ -0,0 +1,150 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.yang.compiler.translator.tojava.javamodel;
+
+import org.onosproject.yang.compiler.datamodel.YangChoice;
+import org.onosproject.yang.compiler.datamodel.javadatamodel.YangJavaAugment;
+import org.onosproject.yang.compiler.translator.exception.TranslatorException;
+import org.onosproject.yang.compiler.translator.tojava.JavaCodeGenerator;
+import org.onosproject.yang.compiler.translator.tojava.JavaCodeGeneratorInfo;
+import org.onosproject.yang.compiler.translator.tojava.JavaFileInfoTranslator;
+import org.onosproject.yang.compiler.translator.tojava.TempJavaCodeFragmentFiles;
+import org.onosproject.yang.compiler.utils.io.YangPluginConfig;
+
+import java.io.IOException;
+
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedJavaFileType.GENERATE_INTERFACE_WITH_BUILDER;
+import static org.onosproject.yang.compiler.translator.tojava.YangJavaModelUtils.generateCodeOfNode;
+
+/**
+ * Represents augment information extended to support java code generation.
+ */
+public class YangJavaAugmentTranslator
+        extends YangJavaAugment
+        implements JavaCodeGeneratorInfo, JavaCodeGenerator {
+
+    private static final long serialVersionUID = 806201632L;
+
+    /**
+     * File handle to maintain temporary java code fragments as per the code snippet types.
+     */
+    private transient TempJavaCodeFragmentFiles tempFileHandle;
+
+    /**
+     * Creates a YANG java augment object.
+     */
+    public YangJavaAugmentTranslator() {
+        super();
+        setJavaFileInfo(new JavaFileInfoTranslator());
+        getJavaFileInfo().setGeneratedFileTypes(GENERATE_INTERFACE_WITH_BUILDER);
+    }
+
+    /**
+     * Returns the generated java file information.
+     *
+     * @return generated java file information
+     */
+    @Override
+    public JavaFileInfoTranslator getJavaFileInfo() {
+
+        if (javaFileInfo == null) {
+            throw new TranslatorException("Missing java info in java datamodel node " +
+                                                  getName() + " in " +
+                                                  getLineNumber() + " at " +
+                                                  getCharPosition()
+                                                  + " in " + getFileName());
+        }
+        return (JavaFileInfoTranslator) javaFileInfo;
+    }
+
+    /**
+     * Sets the java file info object.
+     *
+     * @param javaInfo java file info object
+     */
+    @Override
+    public void setJavaFileInfo(JavaFileInfoTranslator javaInfo) {
+        javaFileInfo = javaInfo;
+    }
+
+    /**
+     * Returns the temporary file handle.
+     *
+     * @return temporary file handle
+     */
+    @Override
+    public TempJavaCodeFragmentFiles getTempJavaCodeFragmentFiles() {
+        return tempFileHandle;
+    }
+
+    /**
+     * Sets temporary file handle.
+     *
+     * @param fileHandle temporary file handle
+     */
+    @Override
+    public void setTempJavaCodeFragmentFiles(TempJavaCodeFragmentFiles fileHandle) {
+        tempFileHandle = fileHandle;
+    }
+
+    /**
+     * Prepare the information for java code generation corresponding to YANG augment info.
+     *
+     * @param yangPlugin YANG plugin config
+     * @throws TranslatorException translator operation fail
+     */
+    @Override
+    public void generateCodeEntry(YangPluginConfig yangPlugin) throws TranslatorException {
+        try {
+            generateCodeOfNode(this, yangPlugin);
+        } catch (IOException e) {
+            throw new TranslatorException("Failed to generate code for augmentable node " +
+                                                  getName() + " in " +
+                                                  getLineNumber() + " at " +
+                                                  getCharPosition()
+                                                  + " in " + getFileName() + " " + e.getLocalizedMessage());
+        }
+    }
+
+    /**
+     * Create a java file using the YANG augment info.
+     *
+     * @throws TranslatorException when failed to do translator operations
+     */
+    @Override
+    public void generateCodeExit() throws TranslatorException {
+        try {
+            if (validateAugmentNode()) {
+                getTempJavaCodeFragmentFiles().generateJavaFile(GENERATE_INTERFACE_WITH_BUILDER, this);
+            }
+        } catch (IOException e) {
+            throw new TranslatorException("Failed to generate code for augmentable node " +
+                                                  getName() + " in " +
+                                                  getLineNumber() + " at " +
+                                                  getCharPosition()
+                                                  + " in " + getFileName() + " " + e.getLocalizedMessage());
+        }
+    }
+
+    /**
+     * Returns true if augment does not have choice as target node.
+     *
+     * @return true if augment does not have choice as target node
+     */
+    private boolean validateAugmentNode() {
+        return !(getAugmentedNode() instanceof YangChoice);
+    }
+}
diff --git a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/javamodel/YangJavaCaseTranslator.java b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/javamodel/YangJavaCaseTranslator.java
new file mode 100644
index 0000000..880d117
--- /dev/null
+++ b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/javamodel/YangJavaCaseTranslator.java
@@ -0,0 +1,142 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.yang.compiler.translator.tojava.javamodel;
+
+import org.onosproject.yang.compiler.datamodel.javadatamodel.YangJavaCase;
+import org.onosproject.yang.compiler.translator.exception.TranslatorException;
+import org.onosproject.yang.compiler.translator.tojava.JavaCodeGenerator;
+import org.onosproject.yang.compiler.translator.tojava.JavaCodeGeneratorInfo;
+import org.onosproject.yang.compiler.translator.tojava.JavaFileInfoTranslator;
+import org.onosproject.yang.compiler.translator.tojava.TempJavaCodeFragmentFiles;
+import org.onosproject.yang.compiler.utils.io.YangPluginConfig;
+
+import java.io.IOException;
+
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedJavaFileType.GENERATE_INTERFACE_WITH_BUILDER;
+import static org.onosproject.yang.compiler.translator.tojava.YangJavaModelUtils.generateCodeOfAugmentableNode;
+import static org.onosproject.yang.compiler.translator.tojava.YangJavaModelUtils.generateJava;
+
+/**
+ * Represents case information extended to support java code generation.
+ */
+public class YangJavaCaseTranslator
+        extends YangJavaCase
+        implements JavaCodeGeneratorInfo, JavaCodeGenerator {
+
+    private static final long serialVersionUID = 806201631L;
+
+    /**
+     * File handle to maintain temporary java code fragments as per the code
+     * snippet types.
+     */
+    private transient TempJavaCodeFragmentFiles tempFileHandle;
+
+    /**
+     * Creates YANG java case object.
+     */
+    public YangJavaCaseTranslator() {
+        super();
+        setJavaFileInfo(new JavaFileInfoTranslator());
+        getJavaFileInfo().setGeneratedFileTypes(GENERATE_INTERFACE_WITH_BUILDER);
+    }
+
+    /**
+     * Returns the generated java file information.
+     *
+     * @return generated java file information
+     */
+    @Override
+    public JavaFileInfoTranslator getJavaFileInfo() {
+        if (javaFileInfo == null) {
+            throw new TranslatorException("Missing java info in java datamodel node" +
+                                                  getName() + " in " +
+                                                  getLineNumber() + " at " +
+                                                  getCharPosition()
+                                                  + " in " + getFileName());
+        }
+        return (JavaFileInfoTranslator) javaFileInfo;
+    }
+
+    /**
+     * Sets the java file info object.
+     *
+     * @param javaInfo java file info object
+     */
+    @Override
+    public void setJavaFileInfo(JavaFileInfoTranslator javaInfo) {
+        javaFileInfo = javaInfo;
+    }
+
+    /**
+     * Returns the temporary file handle.
+     *
+     * @return temporary file handle
+     */
+    @Override
+    public TempJavaCodeFragmentFiles getTempJavaCodeFragmentFiles() {
+        return tempFileHandle;
+    }
+
+    /**
+     * Sets temporary file handle.
+     *
+     * @param fileHandle temporary file handle
+     */
+    @Override
+    public void setTempJavaCodeFragmentFiles(TempJavaCodeFragmentFiles fileHandle) {
+        tempFileHandle = fileHandle;
+    }
+
+    /**
+     * Prepare the information for java code generation corresponding to YANG
+     * case info.
+     *
+     * @param yangPlugin YANG plugin config
+     * @throws TranslatorException translator operation fail
+     */
+    @Override
+    public void generateCodeEntry(YangPluginConfig yangPlugin) throws TranslatorException {
+        try {
+            if (getReferredSchema() != null) {
+                return;
+            }
+            generateCodeOfAugmentableNode(this, yangPlugin);
+        } catch (IOException e) {
+            throw new TranslatorException(
+                    "Failed to prepare generate code entry for case node " +
+                            getName() + " in " +
+                            getLineNumber() + " at " +
+                            getCharPosition()
+                            + " in " + getFileName() + " " + e.getLocalizedMessage());
+        }
+    }
+
+    /**
+     * Creates a java file using the YANG case info.
+     */
+    @Override
+    public void generateCodeExit() throws TranslatorException {
+        try {
+            generateJava(GENERATE_INTERFACE_WITH_BUILDER, this);
+        } catch (IOException e) {
+            throw new TranslatorException("Failed to generate code for case node " +
+                                                  getName() + " in " +
+                                                  getLineNumber() + " at " +
+                                                  getCharPosition()
+                                                  + " in " + getFileName() + " " + e.getLocalizedMessage());
+        }
+    }
+}
diff --git a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/javamodel/YangJavaChoiceTranslator.java b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/javamodel/YangJavaChoiceTranslator.java
new file mode 100644
index 0000000..b04e849
--- /dev/null
+++ b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/javamodel/YangJavaChoiceTranslator.java
@@ -0,0 +1,139 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.yang.compiler.translator.tojava.javamodel;
+
+import org.onosproject.yang.compiler.datamodel.javadatamodel.YangJavaChoice;
+import org.onosproject.yang.compiler.translator.exception.TranslatorException;
+import org.onosproject.yang.compiler.translator.tojava.JavaCodeGenerator;
+import org.onosproject.yang.compiler.translator.tojava.JavaCodeGeneratorInfo;
+import org.onosproject.yang.compiler.translator.tojava.JavaFileInfoTranslator;
+import org.onosproject.yang.compiler.translator.tojava.TempJavaCodeFragmentFiles;
+import org.onosproject.yang.compiler.utils.io.YangPluginConfig;
+
+import java.io.IOException;
+
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedJavaFileType.INTERFACE_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.YangJavaModelUtils.generateCodeAndUpdateInParent;
+import static org.onosproject.yang.compiler.translator.tojava.YangJavaModelUtils.generateJava;
+
+/**
+ * Represents choice information extended to support java code generation.
+ */
+public class YangJavaChoiceTranslator
+        extends YangJavaChoice
+        implements JavaCodeGeneratorInfo, JavaCodeGenerator {
+
+    private static final long serialVersionUID = 806201631L;
+
+    /**
+     * File handle to maintain temporary java code fragments as per the code
+     * snippet types.
+     */
+    private transient TempJavaCodeFragmentFiles tempFileHandle;
+
+    /**
+     * Creates YANG java choice object.
+     */
+    public YangJavaChoiceTranslator() {
+        super();
+        setJavaFileInfo(new JavaFileInfoTranslator());
+        getJavaFileInfo().setGeneratedFileTypes(INTERFACE_MASK);
+    }
+
+    /**
+     * Returns the generated java file information.
+     *
+     * @return generated java file information
+     */
+    @Override
+    public JavaFileInfoTranslator getJavaFileInfo() {
+        if (javaFileInfo == null) {
+            throw new TranslatorException("Missing java info in java datamodel node" +
+                                                  getName() + " in " +
+                                                  getLineNumber() + " at " +
+                                                  getCharPosition()
+                                                  + " in " + getFileName());
+        }
+        return (JavaFileInfoTranslator) javaFileInfo;
+    }
+
+    /**
+     * Sets the java file info object.
+     *
+     * @param javaInfo java file info object
+     */
+    @Override
+    public void setJavaFileInfo(JavaFileInfoTranslator javaInfo) {
+        javaFileInfo = javaInfo;
+    }
+
+    /**
+     * Returns the temporary file handle.
+     *
+     * @return temporary file handle
+     */
+    @Override
+    public TempJavaCodeFragmentFiles getTempJavaCodeFragmentFiles() {
+        return tempFileHandle;
+    }
+
+    /**
+     * Sets temporary file handle.
+     *
+     * @param fileHandle temporary file handle
+     */
+    @Override
+    public void setTempJavaCodeFragmentFiles(TempJavaCodeFragmentFiles fileHandle) {
+        tempFileHandle = fileHandle;
+    }
+
+    /**
+     * Prepare the information for java code generation corresponding to YANG
+     * choice info.
+     *
+     * @param yangPlugin YANG plugin config
+     * @throws TranslatorException translator operation fail
+     */
+    @Override
+    public void generateCodeEntry(YangPluginConfig yangPlugin) throws TranslatorException {
+        try {
+            generateCodeAndUpdateInParent(this, yangPlugin, false);
+        } catch (IOException e) {
+            throw new TranslatorException(
+                    "Failed to prepare generate code entry for choice node " +
+                            getName() + " in " +
+                            getLineNumber() + " at " +
+                            getCharPosition()
+                            + " in " + getFileName() + " " + e.getLocalizedMessage());
+        }
+    }
+
+    /**
+     * Creates a java file using the YANG choice info.
+     */
+    @Override
+    public void generateCodeExit() throws TranslatorException {
+        try {
+            generateJava(INTERFACE_MASK, this);
+        } catch (IOException e) {
+            throw new TranslatorException("Failed to generate code for choice node " +
+                                                  getName() + " in " +
+                                                  getLineNumber() + " at " +
+                                                  getCharPosition()
+                                                  + " in " + getFileName() + " " + e.getLocalizedMessage());
+        }
+    }
+}
diff --git a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/javamodel/YangJavaContainerTranslator.java b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/javamodel/YangJavaContainerTranslator.java
new file mode 100644
index 0000000..6230a71
--- /dev/null
+++ b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/javamodel/YangJavaContainerTranslator.java
@@ -0,0 +1,141 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.yang.compiler.translator.tojava.javamodel;
+
+import org.onosproject.yang.compiler.datamodel.javadatamodel.YangJavaContainer;
+import org.onosproject.yang.compiler.translator.exception.TranslatorException;
+import org.onosproject.yang.compiler.translator.tojava.JavaCodeGenerator;
+import org.onosproject.yang.compiler.translator.tojava.JavaCodeGeneratorInfo;
+import org.onosproject.yang.compiler.translator.tojava.JavaFileInfoTranslator;
+import org.onosproject.yang.compiler.translator.tojava.TempJavaCodeFragmentFiles;
+import org.onosproject.yang.compiler.utils.io.YangPluginConfig;
+
+import java.io.IOException;
+
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedJavaFileType.GENERATE_INTERFACE_WITH_BUILDER;
+import static org.onosproject.yang.compiler.translator.tojava.YangJavaModelUtils.generateCodeAndUpdateInParent;
+import static org.onosproject.yang.compiler.translator.tojava.YangJavaModelUtils.generateJava;
+
+/**
+ * Represents container information extended to support java code generation.
+ */
+public class YangJavaContainerTranslator
+        extends YangJavaContainer
+        implements JavaCodeGeneratorInfo, JavaCodeGenerator {
+
+    private static final long serialVersionUID = 806201630L;
+
+    /**
+     * File handle to maintain temporary java code fragments as per the code
+     * snippet types.
+     */
+    private transient TempJavaCodeFragmentFiles tempFileHandle;
+
+    /**
+     * Creates YANG java container object.
+     */
+    public YangJavaContainerTranslator() {
+        super();
+        setJavaFileInfo(new JavaFileInfoTranslator());
+        getJavaFileInfo().setGeneratedFileTypes(GENERATE_INTERFACE_WITH_BUILDER);
+    }
+
+    /**
+     * Returns the generated java file information.
+     *
+     * @return generated java file information
+     */
+    @Override
+    public JavaFileInfoTranslator getJavaFileInfo() {
+        if (javaFileInfo == null) {
+            throw new TranslatorException("Missing java info in java datamodel node " +
+                                                  getName() + " in " +
+                                                  getLineNumber() + " at " +
+                                                  getCharPosition()
+                                                  + " in " + getFileName());
+        }
+        return (JavaFileInfoTranslator) javaFileInfo;
+    }
+
+    /**
+     * Sets the java file info object.
+     *
+     * @param javaInfo java file info object
+     */
+    @Override
+    public void setJavaFileInfo(JavaFileInfoTranslator javaInfo) {
+        javaFileInfo = javaInfo;
+    }
+
+    /**
+     * Returns the temporary file handle.
+     *
+     * @return temporary file handle
+     */
+    @Override
+    public TempJavaCodeFragmentFiles getTempJavaCodeFragmentFiles() {
+        return tempFileHandle;
+    }
+
+    /**
+     * Sets temporary file handle.
+     *
+     * @param fileHandle temporary file handle
+     */
+    @Override
+    public void setTempJavaCodeFragmentFiles(TempJavaCodeFragmentFiles fileHandle) {
+        tempFileHandle = fileHandle;
+    }
+
+    /**
+     * Prepare the information for java code generation corresponding to YANG
+     * container info.
+     *
+     * @param yangPlugin YANG plugin config
+     * @throws TranslatorException translator operation fail
+     */
+    @Override
+    public void generateCodeEntry(YangPluginConfig yangPlugin) throws TranslatorException {
+        try {
+            generateCodeAndUpdateInParent(this, yangPlugin, false);
+        } catch (IOException e) {
+            throw new TranslatorException(
+                    "Failed to prepare generate code entry for container node " +
+                            getName() + " in " +
+                            getLineNumber() + " at " +
+                            getCharPosition()
+                            + " in " + getFileName() + " " + e.getLocalizedMessage());
+        }
+    }
+
+    /**
+     * Create a java file using the YANG container info.
+     *
+     * @throws TranslatorException translator operation fail
+     */
+    @Override
+    public void generateCodeExit() throws TranslatorException {
+        try {
+            generateJava(GENERATE_INTERFACE_WITH_BUILDER, this);
+        } catch (IOException e) {
+            throw new TranslatorException("Failed to generate code for container node " +
+                                                  getName() + " in " +
+                                                  getLineNumber() + " at " +
+                                                  getCharPosition()
+                                                  + " in " + getFileName() + " " + e.getLocalizedMessage());
+        }
+    }
+}
diff --git a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/javamodel/YangJavaEnumerationTranslator.java b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/javamodel/YangJavaEnumerationTranslator.java
new file mode 100644
index 0000000..3b81976
--- /dev/null
+++ b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/javamodel/YangJavaEnumerationTranslator.java
@@ -0,0 +1,140 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.translator.tojava.javamodel;
+
+import org.onosproject.yang.compiler.datamodel.javadatamodel.YangJavaEnumeration;
+import org.onosproject.yang.compiler.translator.exception.InvalidNodeForTranslatorException;
+import org.onosproject.yang.compiler.translator.exception.TranslatorException;
+import org.onosproject.yang.compiler.translator.tojava.JavaCodeGenerator;
+import org.onosproject.yang.compiler.translator.tojava.JavaCodeGeneratorInfo;
+import org.onosproject.yang.compiler.translator.tojava.JavaFileInfoTranslator;
+import org.onosproject.yang.compiler.translator.tojava.TempJavaCodeFragmentFiles;
+import org.onosproject.yang.compiler.utils.io.YangPluginConfig;
+
+import java.io.IOException;
+
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedJavaFileType.GENERATE_ENUM_CLASS;
+import static org.onosproject.yang.compiler.translator.tojava.YangJavaModelUtils.generateCodeOfNode;
+import static org.onosproject.yang.compiler.translator.tojava.YangJavaModelUtils.generateJava;
+import static org.onosproject.yang.compiler.translator.tojava.utils.TranslatorErrorType.FAIL_AT_ENTRY;
+import static org.onosproject.yang.compiler.translator.tojava.utils.TranslatorErrorType.FAIL_AT_EXIT;
+import static org.onosproject.yang.compiler.translator.tojava.utils.TranslatorUtils.getErrorMsg;
+
+/**
+ * Represents YANG java enumeration information extended to support java code generation.
+ */
+public class YangJavaEnumerationTranslator
+        extends YangJavaEnumeration
+        implements JavaCodeGenerator, JavaCodeGeneratorInfo {
+
+    private static final long serialVersionUID = 806201629L;
+
+    /**
+     * File handle to maintain temporary java code fragments as per the code
+     * snippet types.
+     */
+    private transient TempJavaCodeFragmentFiles tempFileHandle;
+
+    /**
+     * Creates YANG java enumeration object.
+     */
+    public YangJavaEnumerationTranslator() {
+        setJavaFileInfo(new JavaFileInfoTranslator());
+        getJavaFileInfo().setGeneratedFileTypes(GENERATE_ENUM_CLASS);
+    }
+
+    /**
+     * Returns the generated java file information.
+     *
+     * @return generated java file information
+     */
+    @Override
+    public JavaFileInfoTranslator getJavaFileInfo() {
+
+        if (javaFileInfo == null) {
+            throw new TranslatorException("Missing java info in java datamodel node " +
+                                                  getName());
+        }
+        return (JavaFileInfoTranslator) javaFileInfo;
+    }
+
+    /**
+     * Sets the java file info object.
+     *
+     * @param javaInfo java file info object
+     */
+    @Override
+    public void setJavaFileInfo(JavaFileInfoTranslator javaInfo) {
+        javaFileInfo = javaInfo;
+    }
+
+    /**
+     * Returns the temporary file handle.
+     *
+     * @return temporary file handle
+     */
+    @Override
+    public TempJavaCodeFragmentFiles getTempJavaCodeFragmentFiles() {
+        return tempFileHandle;
+    }
+
+    /**
+     * Sets temporary file handle.
+     *
+     * @param fileHandle temporary file handle
+     */
+    @Override
+    public void setTempJavaCodeFragmentFiles(TempJavaCodeFragmentFiles fileHandle) {
+        tempFileHandle = fileHandle;
+    }
+
+    /**
+     * Prepare the information for java code generation corresponding to YANG
+     * enumeration info.
+     *
+     * @param yangPlugin YANG plugin config
+     * @throws TranslatorException translator operations fails
+     */
+    @Override
+    public void generateCodeEntry(YangPluginConfig yangPlugin) throws TranslatorException {
+        try {
+            if (getReferredSchema() != null) {
+                throw new InvalidNodeForTranslatorException();
+            }
+            generateCodeOfNode(this, yangPlugin);
+            tempFileHandle.getEnumTempFiles().setEnumClass(true);
+        } catch (IOException e) {
+            throw new TranslatorException(getErrorMsg(FAIL_AT_ENTRY, this,
+                                                      e.getLocalizedMessage()));
+        }
+    }
+
+    /**
+     * Creates a java file using the YANG enumeration info.
+     *
+     * @throws TranslatorException translator operation fail
+     */
+    @Override
+    public void generateCodeExit() throws TranslatorException {
+        try {
+            generateJava(GENERATE_ENUM_CLASS, this);
+        } catch (IOException e) {
+            throw new TranslatorException(getErrorMsg(FAIL_AT_EXIT, this,
+                                                      e.getLocalizedMessage()));
+        }
+    }
+}
diff --git a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/javamodel/YangJavaGroupingTranslator.java b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/javamodel/YangJavaGroupingTranslator.java
new file mode 100644
index 0000000..ca2d3e0
--- /dev/null
+++ b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/javamodel/YangJavaGroupingTranslator.java
@@ -0,0 +1,113 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.yang.compiler.translator.tojava.javamodel;
+
+import org.onosproject.yang.compiler.datamodel.javadatamodel.YangJavaGrouping;
+import org.onosproject.yang.compiler.translator.exception.TranslatorException;
+import org.onosproject.yang.compiler.translator.tojava.JavaCodeGenerator;
+import org.onosproject.yang.compiler.translator.tojava.JavaCodeGeneratorInfo;
+import org.onosproject.yang.compiler.translator.tojava.JavaFileInfoTranslator;
+import org.onosproject.yang.compiler.translator.tojava.TempJavaCodeFragmentFiles;
+import org.onosproject.yang.compiler.utils.io.YangPluginConfig;
+
+import java.io.IOException;
+
+import static org.onosproject.yang.compiler.translator.tojava.YangJavaModelUtils.updatePackageInfo;
+import static org.onosproject.yang.compiler.translator.tojava.utils.JavaIdentifierSyntax.createPackage;
+
+/**
+ * Represents grouping information extended to support java code generation.
+ */
+public class YangJavaGroupingTranslator
+        extends YangJavaGrouping
+        implements JavaCodeGeneratorInfo, JavaCodeGenerator {
+
+    private static final long serialVersionUID = 806201628L;
+
+    /**
+     * File handle to maintain temporary java code fragments as per the code
+     * snippet types.
+     */
+    private transient TempJavaCodeFragmentFiles tempFileHandle;
+
+    /**
+     * Creates YANG Java grouping object.
+     */
+    public YangJavaGroupingTranslator() {
+        super();
+        setJavaFileInfo(new JavaFileInfoTranslator());
+    }
+
+    /**
+     * Returns the generated java file information.
+     *
+     * @return generated java file information
+     */
+    @Override
+    public JavaFileInfoTranslator getJavaFileInfo() {
+        if (javaFileInfo == null) {
+            throw new TranslatorException("Missing java info in java datamodel node " +
+                                                  getName() + " in " +
+                                                  getLineNumber() + " at " +
+                                                  getCharPosition()
+                                                  + " in " + getFileName());
+        }
+        return (JavaFileInfoTranslator) javaFileInfo;
+    }
+
+    /**
+     * Sets the java file info object.
+     *
+     * @param javaInfo java file info object
+     */
+    @Override
+    public void setJavaFileInfo(JavaFileInfoTranslator javaInfo) {
+        javaFileInfo = javaInfo;
+    }
+
+    /**
+     * Returns the temporary file handle.
+     *
+     * @return temporary file handle
+     */
+    @Override
+    public TempJavaCodeFragmentFiles getTempJavaCodeFragmentFiles() {
+        return tempFileHandle;
+    }
+
+    /**
+     * Sets temporary file handle.
+     *
+     * @param fileHandle temporary file handle
+     */
+    @Override
+    public void setTempJavaCodeFragmentFiles(TempJavaCodeFragmentFiles fileHandle) {
+        tempFileHandle = fileHandle;
+    }
+
+
+    @Override
+    public void generateCodeEntry(YangPluginConfig yangPlugin)
+            throws TranslatorException {
+        updatePackageInfo(this, yangPlugin);
+    }
+
+    @Override
+    public void generateCodeExit()
+            throws TranslatorException, IOException {
+        createPackage(this);
+    }
+}
diff --git a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/javamodel/YangJavaIdentityTranslator.java b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/javamodel/YangJavaIdentityTranslator.java
new file mode 100644
index 0000000..56f54c0
--- /dev/null
+++ b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/javamodel/YangJavaIdentityTranslator.java
@@ -0,0 +1,191 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.yang.compiler.translator.tojava.javamodel;
+
+import org.onosproject.yang.compiler.datamodel.javadatamodel.YangJavaIdentity;
+import org.onosproject.yang.compiler.translator.exception.TranslatorException;
+import org.onosproject.yang.compiler.translator.tojava.JavaCodeGenerator;
+import org.onosproject.yang.compiler.translator.tojava.JavaCodeGeneratorInfo;
+import org.onosproject.yang.compiler.translator.tojava.JavaFileInfoTranslator;
+import org.onosproject.yang.compiler.translator.tojava.JavaImportData;
+import org.onosproject.yang.compiler.translator.tojava.JavaQualifiedTypeInfoTranslator;
+import org.onosproject.yang.compiler.translator.tojava.TempJavaCodeFragmentFiles;
+import org.onosproject.yang.compiler.utils.io.YangPluginConfig;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.List;
+
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedJavaFileType.GENERATE_IDENTITY_CLASS;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedJavaFileType.GENERATE_INTERFACE_WITH_BUILDER;
+import static org.onosproject.yang.compiler.translator.tojava.YangJavaModelUtils.updatePackageInfo;
+import static org.onosproject.yang.compiler.translator.tojava.utils.JavaFileGeneratorUtils.getFileObject;
+import static org.onosproject.yang.compiler.translator.tojava.utils.JavaFileGeneratorUtils.initiateJavaFileGeneration;
+import static org.onosproject.yang.compiler.translator.tojava.utils.JavaIdentifierSyntax.createPackage;
+import static org.onosproject.yang.compiler.translator.tojava.utils.MethodsGenerator.getFromStringMethodForIdentity;
+import static org.onosproject.yang.compiler.translator.tojava.utils.MethodsGenerator.getToStringMethodForIdentity;
+import static org.onosproject.yang.compiler.translator.tojava.utils.TranslatorErrorType.FAIL_AT_ENTRY;
+import static org.onosproject.yang.compiler.translator.tojava.utils.TranslatorErrorType.FAIL_AT_EXIT;
+import static org.onosproject.yang.compiler.translator.tojava.utils.TranslatorUtils.getErrorMsg;
+import static org.onosproject.yang.compiler.utils.UtilConstants.CLOSE_CURLY_BRACKET;
+import static org.onosproject.yang.compiler.utils.UtilConstants.EMPTY_STRING;
+import static org.onosproject.yang.compiler.utils.UtilConstants.JAVA_FILE_EXTENSION;
+import static org.onosproject.yang.compiler.utils.io.impl.FileSystemUtil.closeFile;
+import static org.onosproject.yang.compiler.utils.io.impl.YangIoUtils.getCapitalCase;
+import static org.onosproject.yang.compiler.utils.io.impl.YangIoUtils.insertDataIntoJavaFile;
+import static org.onosproject.yang.compiler.utils.io.impl.YangIoUtils.validateLineLength;
+
+/**
+ * Represents input information extended to support java code generation.
+ */
+public class YangJavaIdentityTranslator extends YangJavaIdentity
+        implements JavaCodeGeneratorInfo, JavaCodeGenerator {
+
+    //Contains the information of the imported.
+    private transient JavaImportData importData;
+
+    /**
+     * File handle to maintain temporary java code fragments as per the code
+     * snippet types.
+     */
+    private transient TempJavaCodeFragmentFiles tempFileHandle;
+
+    /**
+     * Creates YANG java container object.
+     */
+    public YangJavaIdentityTranslator() {
+        setJavaFileInfo(new JavaFileInfoTranslator());
+        getJavaFileInfo().setGeneratedFileTypes(GENERATE_INTERFACE_WITH_BUILDER);
+        importData = new JavaImportData();
+    }
+
+    /**
+     * Returns the generated java file information.
+     *
+     * @return generated java file information
+     */
+    @Override
+    public JavaFileInfoTranslator getJavaFileInfo() {
+        if (javaFileInfo == null) {
+            throw new TranslatorException("Missing java info in java identity" +
+                                                  " node " + getName());
+        }
+        return (JavaFileInfoTranslator) javaFileInfo;
+    }
+
+    /**
+     * Sets the java file info object.
+     *
+     * @param javaInfo java file info object
+     */
+    @Override
+    public void setJavaFileInfo(JavaFileInfoTranslator javaInfo) {
+        javaFileInfo = javaInfo;
+    }
+
+    /**
+     * Returns the temporary file handle.
+     *
+     * @return temporary file handle
+     */
+    @Override
+    public TempJavaCodeFragmentFiles getTempJavaCodeFragmentFiles() {
+        return tempFileHandle;
+    }
+
+    /**
+     * Sets temporary file handle.
+     *
+     * @param fileHandle temporary file handle
+     */
+    @Override
+    public void setTempJavaCodeFragmentFiles(TempJavaCodeFragmentFiles fileHandle) {
+        tempFileHandle = fileHandle;
+    }
+
+    /**
+     * Prepare the information for java code generation corresponding to YANG
+     * container info.
+     *
+     * @param yangPlugin YANG plugin config
+     * @throws TranslatorException translator operation fail
+     */
+    @Override
+    public void generateCodeEntry(YangPluginConfig yangPlugin) throws TranslatorException {
+        try {
+
+            updatePackageInfo(this, yangPlugin);
+            JavaQualifiedTypeInfoTranslator basePkgInfo =
+                    new JavaQualifiedTypeInfoTranslator();
+            JavaFileInfoTranslator itsInfo = getJavaFileInfo();
+            String name = itsInfo.getJavaName();
+            String className = getCapitalCase(name);
+            String path = itsInfo.getPackageFilePath();
+            createPackage(this);
+            List<String> imports = null;
+            boolean isQualified;
+
+            if (getBaseNode() != null && getBaseNode().getReferredIdentity() != null) {
+                if (!(getBaseNode().getReferredIdentity() instanceof YangJavaIdentityTranslator)) {
+                    throw new TranslatorException(getErrorMsg(FAIL_AT_ENTRY, this,
+                                                              EMPTY_STRING));
+                }
+                YangJavaIdentityTranslator base =
+                        (YangJavaIdentityTranslator) getBaseNode().getReferredIdentity();
+                JavaFileInfoTranslator info = base.getJavaFileInfo();
+                String baseClassName = getCapitalCase(info.getJavaName());
+                String basePkg = info.getPackage();
+                basePkgInfo.setClassInfo(baseClassName);
+                basePkgInfo.setPkgInfo(basePkg);
+                isQualified = importData.addImportInfo(basePkgInfo, className,
+                                                       javaFileInfo.getPackage());
+                if (!isQualified) {
+                    imports = importData.getImports(true);
+                }
+            }
+
+            File file = getFileObject(path, className, JAVA_FILE_EXTENSION, itsInfo);
+
+            initiateJavaFileGeneration(file, GENERATE_IDENTITY_CLASS, imports, this, className);
+            file = validateLineLength(file);
+            //Add to string and from string method to class
+            addStringMethodsToClass(file, name);
+            insertDataIntoJavaFile(file, CLOSE_CURLY_BRACKET);
+
+            closeFile(file, false);
+        } catch (IOException e) {
+            throw new TranslatorException(getErrorMsg(FAIL_AT_EXIT, this,
+                                                      e.getLocalizedMessage()));
+        }
+    }
+
+    private void addStringMethodsToClass(File file, String className) throws IOException {
+        insertDataIntoJavaFile(file, getToStringMethodForIdentity(getName()));
+        insertDataIntoJavaFile(file, getFromStringMethodForIdentity(
+                className, getName()));
+    }
+
+    /**
+     * Create a java file using the YANG container info.
+     *
+     * @throws TranslatorException translator operation fail
+     */
+    @Override
+    public void generateCodeExit() throws TranslatorException {
+        /* Do nothing, file is already generated in entry*/
+    }
+}
+
diff --git a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/javamodel/YangJavaInputTranslator.java b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/javamodel/YangJavaInputTranslator.java
new file mode 100644
index 0000000..dc39964
--- /dev/null
+++ b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/javamodel/YangJavaInputTranslator.java
@@ -0,0 +1,141 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.translator.tojava.javamodel;
+
+import org.onosproject.yang.compiler.datamodel.javadatamodel.YangJavaInput;
+import org.onosproject.yang.compiler.translator.exception.TranslatorException;
+import org.onosproject.yang.compiler.translator.tojava.JavaCodeGenerator;
+import org.onosproject.yang.compiler.translator.tojava.JavaCodeGeneratorInfo;
+import org.onosproject.yang.compiler.translator.tojava.JavaFileInfoTranslator;
+import org.onosproject.yang.compiler.translator.tojava.TempJavaCodeFragmentFiles;
+import org.onosproject.yang.compiler.utils.io.YangPluginConfig;
+
+import java.io.IOException;
+
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedJavaFileType.GENERATE_INTERFACE_WITH_BUILDER;
+import static org.onosproject.yang.compiler.translator.tojava.YangJavaModelUtils.generateCodeOfAugmentableNode;
+
+/**
+ * Represents input information extended to support java code generation.
+ */
+public class YangJavaInputTranslator
+        extends YangJavaInput
+        implements JavaCodeGeneratorInfo, JavaCodeGenerator {
+
+    private static final long serialVersionUID = 806201627L;
+
+    /**
+     * File handle to maintain temporary java code fragments as per the code
+     * snippet types.
+     */
+    private transient TempJavaCodeFragmentFiles tempFileHandle;
+
+    /**
+     * Creates an instance of java input.
+     */
+    public YangJavaInputTranslator() {
+        super();
+        setJavaFileInfo(new JavaFileInfoTranslator());
+        getJavaFileInfo().setGeneratedFileTypes(GENERATE_INTERFACE_WITH_BUILDER);
+    }
+
+    /**
+     * Returns the generated java file information.
+     *
+     * @return generated java file information
+     */
+    @Override
+    public JavaFileInfoTranslator getJavaFileInfo() {
+        if (javaFileInfo == null) {
+            throw new TranslatorException("missing java info in java datamodel node " +
+                                                  getName() + " in " +
+                                                  getLineNumber() + " at " +
+                                                  getCharPosition()
+                                                  + " in " + getFileName());
+        }
+        return (JavaFileInfoTranslator) javaFileInfo;
+    }
+
+    /**
+     * Sets the java file info object.
+     *
+     * @param javaInfo java file info object
+     */
+    @Override
+    public void setJavaFileInfo(JavaFileInfoTranslator javaInfo) {
+        javaFileInfo = javaInfo;
+    }
+
+    /**
+     * Returns the temporary file handle.
+     *
+     * @return temporary file handle
+     */
+    @Override
+    public TempJavaCodeFragmentFiles getTempJavaCodeFragmentFiles() {
+        return tempFileHandle;
+    }
+
+    /**
+     * Sets temporary file handle.
+     *
+     * @param fileHandle temporary file handle
+     */
+    @Override
+    public void setTempJavaCodeFragmentFiles(TempJavaCodeFragmentFiles fileHandle) {
+        tempFileHandle = fileHandle;
+    }
+
+    /**
+     * Prepare the information for java code generation corresponding to YANG
+     * input info.
+     *
+     * @param yangPlugin YANG plugin config
+     * @throws TranslatorException translator operation fail
+     */
+    @Override
+    public void generateCodeEntry(YangPluginConfig yangPlugin) throws TranslatorException {
+        try {
+            generateCodeOfAugmentableNode(this, yangPlugin);
+        } catch (IOException e) {
+            throw new TranslatorException(
+                    "Failed to prepare generate code entry for input node " +
+                            getName() + " in " +
+                            getLineNumber() + " at " +
+                            getCharPosition()
+                            + " in " + getFileName() + " " + e.getLocalizedMessage());
+        }
+    }
+
+    /**
+     * Creates a java file using the YANG input info.
+     *
+     * @throws TranslatorException translator operation fail
+     */
+    @Override
+    public void generateCodeExit() throws TranslatorException {
+        try {
+            getTempJavaCodeFragmentFiles().generateJavaFile(GENERATE_INTERFACE_WITH_BUILDER, this);
+        } catch (IOException e) {
+            throw new TranslatorException("Failed to generate code for input node " +
+                                                  getName() + " in " +
+                                                  getLineNumber() + " at " +
+                                                  getCharPosition()
+                                                  + " in " + getFileName() + " " + e.getLocalizedMessage());
+        }
+    }
+}
diff --git a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/javamodel/YangJavaLeafListTranslator.java b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/javamodel/YangJavaLeafListTranslator.java
new file mode 100644
index 0000000..8333e9e
--- /dev/null
+++ b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/javamodel/YangJavaLeafListTranslator.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.yang.compiler.translator.tojava.javamodel;
+
+import org.onosproject.yang.compiler.datamodel.javadatamodel.YangJavaLeafList;
+import org.onosproject.yang.compiler.translator.tojava.JavaQualifiedTypeInfoTranslator;
+import org.onosproject.yang.compiler.utils.io.YangToJavaNamingConflictUtil;
+
+import static org.onosproject.yang.compiler.translator.tojava.JavaQualifiedTypeInfoTranslator.updateLeavesJavaQualifiedInfo;
+import static org.onosproject.yang.compiler.utils.io.impl.YangIoUtils.getCamelCase;
+
+/**
+ * Represents java information corresponding to the YANG leaf-list.
+ */
+public class YangJavaLeafListTranslator
+        extends YangJavaLeafList
+        implements JavaLeafInfoContainer {
+
+    private static final long serialVersionUID = 806201638L;
+
+    private transient YangToJavaNamingConflictUtil conflictResolveConfig;
+
+    /**
+     * Returns a new YANG leaf object with java qualified access details.
+     */
+    public YangJavaLeafListTranslator() {
+        super();
+        setJavaQualifiedInfo(new JavaQualifiedTypeInfoTranslator());
+    }
+
+    @Override
+    public String getJavaName(YangToJavaNamingConflictUtil conflictResolveConfig) {
+        return getCamelCase(getName(), conflictResolveConfig);
+    }
+
+    @Override
+    public boolean isLeafList() {
+        return true;
+    }
+
+    @Override
+    public void updateJavaQualifiedInfo() {
+        updateLeavesJavaQualifiedInfo(this);
+    }
+
+    /**
+     * Returns java naming conflict resolve configurations.
+     *
+     * @return java naming conflict resolve configurations
+     */
+    @Override
+    public YangToJavaNamingConflictUtil getConflictResolveConfig() {
+        return conflictResolveConfig;
+    }
+
+    /**
+     * Sets java naming conflict resolve configurations.
+     *
+     * @param conflictResolveConfig java naming conflict resolve configurations
+     */
+    @Override
+    public void setConflictResolveConfig(YangToJavaNamingConflictUtil conflictResolveConfig) {
+        this.conflictResolveConfig = conflictResolveConfig;
+    }
+}
diff --git a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/javamodel/YangJavaLeafTranslator.java b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/javamodel/YangJavaLeafTranslator.java
new file mode 100644
index 0000000..90a74f4
--- /dev/null
+++ b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/javamodel/YangJavaLeafTranslator.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.yang.compiler.translator.tojava.javamodel;
+
+import org.onosproject.yang.compiler.datamodel.javadatamodel.YangJavaLeaf;
+import org.onosproject.yang.compiler.translator.tojava.JavaQualifiedTypeInfoTranslator;
+import org.onosproject.yang.compiler.utils.io.YangToJavaNamingConflictUtil;
+
+import static org.onosproject.yang.compiler.translator.tojava.JavaQualifiedTypeInfoTranslator.updateLeavesJavaQualifiedInfo;
+import static org.onosproject.yang.compiler.utils.io.impl.YangIoUtils.getCamelCase;
+
+/**
+ * Represents java information corresponding to the YANG leaf.
+ */
+public class YangJavaLeafTranslator
+        extends YangJavaLeaf
+        implements JavaLeafInfoContainer {
+
+    private static final long serialVersionUID = 806201636L;
+
+    private transient YangToJavaNamingConflictUtil conflictResolveConfig;
+
+    /**
+     * Returns a new YANG leaf object with java qualified access details.
+     */
+    public YangJavaLeafTranslator() {
+        super();
+        setJavaQualifiedInfo(new JavaQualifiedTypeInfoTranslator());
+    }
+
+    @Override
+    public String getJavaName(YangToJavaNamingConflictUtil conflictResolveConfig) {
+        return getCamelCase(getName(), conflictResolveConfig);
+    }
+
+    @Override
+    public boolean isLeafList() {
+        return false;
+    }
+
+    @Override
+    public void updateJavaQualifiedInfo() {
+        updateLeavesJavaQualifiedInfo(this);
+    }
+
+    /**
+     * Returns java naming conflict resolve configurations.
+     *
+     * @return java naming conflict resolve configurations
+     */
+    @Override
+    public YangToJavaNamingConflictUtil getConflictResolveConfig() {
+        return conflictResolveConfig;
+    }
+
+    /**
+     * Sets java naming conflict resolve configurations.
+     *
+     * @param conflictResolveConfig java naming conflict resolve configurations
+     */
+    @Override
+    public void setConflictResolveConfig(YangToJavaNamingConflictUtil conflictResolveConfig) {
+        this.conflictResolveConfig = conflictResolveConfig;
+    }
+}
diff --git a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/javamodel/YangJavaListTranslator.java b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/javamodel/YangJavaListTranslator.java
new file mode 100644
index 0000000..49cb315
--- /dev/null
+++ b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/javamodel/YangJavaListTranslator.java
@@ -0,0 +1,141 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.yang.compiler.translator.tojava.javamodel;
+
+import org.onosproject.yang.compiler.datamodel.javadatamodel.YangJavaList;
+import org.onosproject.yang.compiler.translator.exception.TranslatorException;
+import org.onosproject.yang.compiler.translator.tojava.JavaCodeGenerator;
+import org.onosproject.yang.compiler.translator.tojava.JavaCodeGeneratorInfo;
+import org.onosproject.yang.compiler.translator.tojava.JavaFileInfoTranslator;
+import org.onosproject.yang.compiler.translator.tojava.TempJavaCodeFragmentFiles;
+import org.onosproject.yang.compiler.utils.io.YangPluginConfig;
+
+import java.io.IOException;
+
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedJavaFileType.GENERATE_INTERFACE_WITH_BUILDER;
+import static org.onosproject.yang.compiler.translator.tojava.YangJavaModelUtils.generateCodeAndUpdateInParent;
+import static org.onosproject.yang.compiler.translator.tojava.YangJavaModelUtils.generateJava;
+
+/**
+ * Represents YANG list information extended to support java code generation.
+ */
+public class YangJavaListTranslator
+        extends YangJavaList
+        implements JavaCodeGeneratorInfo, JavaCodeGenerator {
+
+    private static final long serialVersionUID = 806201626L;
+
+    /**
+     * File handle to maintain temporary java code fragments as per the code
+     * snippet types.
+     */
+    private transient TempJavaCodeFragmentFiles tempFileHandle;
+
+    /**
+     * Creates YANG java list object.
+     */
+    public YangJavaListTranslator() {
+        super();
+        setJavaFileInfo(new JavaFileInfoTranslator());
+        getJavaFileInfo().setGeneratedFileTypes(GENERATE_INTERFACE_WITH_BUILDER);
+    }
+
+    /**
+     * Returns the generated java file information.
+     *
+     * @return generated java file information
+     */
+    @Override
+    public JavaFileInfoTranslator getJavaFileInfo() {
+        if (javaFileInfo == null) {
+            throw new TranslatorException("Missing java info in java datamodel node " +
+                                                  getName() + " in " +
+                                                  getLineNumber() + " at " +
+                                                  getCharPosition()
+                                                  + " in " + getFileName());
+        }
+        return (JavaFileInfoTranslator) javaFileInfo;
+    }
+
+    /**
+     * Sets the java file info object.
+     *
+     * @param javaInfo java file info object
+     */
+    @Override
+    public void setJavaFileInfo(JavaFileInfoTranslator javaInfo) {
+        javaFileInfo = javaInfo;
+    }
+
+    /**
+     * Returns the temporary file handle.
+     *
+     * @return temporary file handle
+     */
+    @Override
+    public TempJavaCodeFragmentFiles getTempJavaCodeFragmentFiles() {
+        return tempFileHandle;
+    }
+
+    /**
+     * Sets temporary file handle.
+     *
+     * @param fileHandle temporary file handle
+     */
+    @Override
+    public void setTempJavaCodeFragmentFiles(TempJavaCodeFragmentFiles fileHandle) {
+        tempFileHandle = fileHandle;
+    }
+
+    /**
+     * Prepare the information for java code generation corresponding to YANG
+     * list info.
+     *
+     * @param yangPlugin YANG plugin config
+     * @throws TranslatorException translator operation fail
+     */
+    @Override
+    public void generateCodeEntry(YangPluginConfig yangPlugin) throws TranslatorException {
+        try {
+            generateCodeAndUpdateInParent(this, yangPlugin, true);
+        } catch (IOException e) {
+            throw new TranslatorException(
+                    "Failed to prepare generate code entry for list node " +
+                            getName() + " in " +
+                            getLineNumber() + " at " +
+                            getCharPosition()
+                            + " in " + getFileName() + " " + e.getLocalizedMessage());
+        }
+    }
+
+    /**
+     * Creates a java file using the YANG list info.
+     *
+     * @throws TranslatorException translator operation fail
+     */
+    @Override
+    public void generateCodeExit() throws TranslatorException {
+        try {
+            generateJava(GENERATE_INTERFACE_WITH_BUILDER, this);
+        } catch (IOException e) {
+            throw new TranslatorException("Failed to generate code for list node " +
+                                                  getName() + " in " +
+                                                  getLineNumber() + " at " +
+                                                  getCharPosition()
+                                                  + " in " + getFileName() + " " + e.getLocalizedMessage());
+        }
+    }
+}
diff --git a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/javamodel/YangJavaModuleTranslator.java b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/javamodel/YangJavaModuleTranslator.java
new file mode 100644
index 0000000..dbc6803
--- /dev/null
+++ b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/javamodel/YangJavaModuleTranslator.java
@@ -0,0 +1,218 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.yang.compiler.translator.tojava.javamodel;
+
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangNotification;
+import org.onosproject.yang.compiler.datamodel.javadatamodel.YangJavaModule;
+import org.onosproject.yang.compiler.translator.exception.TranslatorException;
+import org.onosproject.yang.compiler.translator.tojava.JavaCodeGenerator;
+import org.onosproject.yang.compiler.translator.tojava.JavaCodeGeneratorInfo;
+import org.onosproject.yang.compiler.translator.tojava.JavaFileInfoTranslator;
+import org.onosproject.yang.compiler.translator.tojava.TempJavaCodeFragmentFiles;
+import org.onosproject.yang.compiler.utils.io.YangPluginConfig;
+
+import java.io.IOException;
+import java.util.ArrayList;
+
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedJavaFileType.GENERATE_ALL_EVENT_CLASS_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedJavaFileType.GENERATE_INTERFACE_WITH_BUILDER;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedJavaFileType.GENERATE_SERVICE_AND_MANAGER;
+import static org.onosproject.yang.compiler.translator.tojava.YangJavaModelUtils.generateCodeOfRootNode;
+import static org.onosproject.yang.compiler.translator.tojava.YangJavaModelUtils.generateInterfaceFileForNonDataNodes;
+import static org.onosproject.yang.compiler.translator.tojava.YangJavaModelUtils.isRootNodesCodeGenRequired;
+import static org.onosproject.yang.compiler.translator.tojava.utils.JavaIdentifierSyntax.getRootPackage;
+import static org.onosproject.yang.compiler.translator.tojava.utils.TranslatorErrorType.FAIL_AT_ENTRY;
+import static org.onosproject.yang.compiler.translator.tojava.utils.TranslatorErrorType.FAIL_AT_EXIT;
+import static org.onosproject.yang.compiler.translator.tojava.utils.TranslatorUtils.getErrorMsg;
+import static org.onosproject.yang.compiler.utils.UtilConstants.SBI;
+import static org.onosproject.yang.compiler.utils.io.impl.YangIoUtils.removeEmptyDirectory;
+import static org.onosproject.yang.compiler.utils.io.impl.YangIoUtils.searchAndDeleteTempDir;
+
+/**
+ * Represents module information extended to support java code generation.
+ */
+public class YangJavaModuleTranslator
+        extends YangJavaModule
+        implements JavaCodeGeneratorInfo, JavaCodeGenerator {
+
+    private static final long serialVersionUID = 806201625L;
+
+    /**
+     * File handle to maintain temporary java code fragments as per the code
+     * snippet types.
+     */
+    private transient TempJavaCodeFragmentFiles tempFileHandle;
+
+    /**
+     * Creates a YANG node of module type.
+     */
+    public YangJavaModuleTranslator() {
+        setJavaFileInfo(new JavaFileInfoTranslator());
+        notificationNodes = new ArrayList<>();
+        getJavaFileInfo().setGeneratedFileTypes(
+                GENERATE_SERVICE_AND_MANAGER | GENERATE_INTERFACE_WITH_BUILDER);
+    }
+
+    /**
+     * Returns the generated java file information.
+     *
+     * @return generated java file information
+     */
+    @Override
+    public JavaFileInfoTranslator getJavaFileInfo() {
+        if (javaFileInfo == null) {
+            throw new TranslatorException(
+                    "Missing java info in java datamodel node " + getName());
+        }
+        return (JavaFileInfoTranslator) javaFileInfo;
+    }
+
+    /**
+     * Sets the java file info object.
+     *
+     * @param javaInfo java file info object
+     */
+    @Override
+    public void setJavaFileInfo(JavaFileInfoTranslator javaInfo) {
+        javaFileInfo = javaInfo;
+    }
+
+    /**
+     * Returns the temporary file handle.
+     *
+     * @return temporary file handle
+     */
+    @Override
+    public TempJavaCodeFragmentFiles getTempJavaCodeFragmentFiles() {
+        return tempFileHandle;
+    }
+
+    /**
+     * Sets temporary file handle.
+     *
+     * @param fileHandle temporary file handle
+     */
+    @Override
+    public void setTempJavaCodeFragmentFiles(
+            TempJavaCodeFragmentFiles fileHandle) {
+        tempFileHandle = fileHandle;
+    }
+
+    /**
+     * Generates java code for module.
+     *
+     * @param yangPlugin YANG plugin config
+     * @throws TranslatorException when fails to generate the source files
+     */
+    @Override
+    public void generateCodeEntry(YangPluginConfig yangPlugin)
+            throws TranslatorException {
+        String modulePkg = getRootPackage(getVersion(), getModuleNamespace(),
+                                          getRevision(),
+                                          yangPlugin.getConflictResolver());
+
+        if (isNotificationChildNodePresent(this)) {
+            getJavaFileInfo().setGeneratedFileTypes(
+                    getJavaFileInfo().getGeneratedFileTypes()
+                            | GENERATE_ALL_EVENT_CLASS_MASK);
+        }
+        try {
+            generateCodeOfRootNode(this, yangPlugin, modulePkg);
+            //Add augmented rpc name
+            tempFileHandle.getServiceTempFiles().addAugmentedRpcMethod(this);
+        } catch (IOException e) {
+            throw new TranslatorException(getErrorMsg(FAIL_AT_ENTRY, this,
+                                                      e.getLocalizedMessage()));
+        }
+    }
+
+    /**
+     * Creates a java file using the YANG module info.
+     */
+    @Override
+    public void generateCodeExit()
+            throws TranslatorException {
+        /*
+         * As part of the notification support the following files needs to be generated.
+         * 1) Subject of the notification(event), this is simple interface with builder class.
+         * 2) Event class extending "AbstractEvent" and defining event type enum.
+         * 3) Event listener interface extending "EventListener".
+         * 4) Event subject class.
+         *
+         * The manager class needs to extend the "ListenerRegistry".
+         */
+        try {
+            if ((getJavaFileInfo().getGeneratedFileTypes() &
+                    GENERATE_ALL_EVENT_CLASS_MASK) != 0) {
+                getTempJavaCodeFragmentFiles().generateJavaFile(
+                        GENERATE_ALL_EVENT_CLASS_MASK, this);
+            }
+
+            if (!isRootNodesCodeGenRequired(this)) {
+                if (getChild() != null) {
+                    generateInterfaceFileForNonDataNodes(this);
+                }
+            } else {
+                getTempJavaCodeFragmentFiles()
+                        .generateJavaFile(GENERATE_INTERFACE_WITH_BUILDER, this);
+                if (getJavaFileInfo().getPluginConfig()
+                        .getCodeGenerateForSbi() == null ||
+                        !getJavaFileInfo().getPluginConfig()
+                                .getCodeGenerateForSbi().equals(SBI)) {
+                    getTempJavaCodeFragmentFiles()
+                            .generateJavaFile(GENERATE_SERVICE_AND_MANAGER, this);
+                }
+            }
+
+            searchAndDeleteTempDir(getJavaFileInfo().getBaseCodeGenPath() +
+                                           getJavaFileInfo().getPackageFilePath());
+            removeEmptyDirectory(getJavaFileInfo().getBaseCodeGenPath() +
+                                         getJavaFileInfo().getPackageFilePath());
+        } catch (IOException e) {
+            throw new TranslatorException(getErrorMsg(FAIL_AT_EXIT, this,
+                                                      e.getLocalizedMessage()));
+        }
+    }
+
+    /**
+     * Adds to notification node list.
+     *
+     * @param curNode notification node
+     */
+    private void addToNotificationList(YangNode curNode) {
+        notificationNodes.add(curNode);
+    }
+
+    /**
+     * Checks if there is any notification node present.
+     *
+     * @param rootNode root node of the data model
+     * @return status of notification's existence
+     */
+    private boolean isNotificationChildNodePresent(YangNode rootNode) {
+        YangNode childNode = rootNode.getChild();
+
+        while (childNode != null) {
+            if (childNode instanceof YangNotification) {
+                addToNotificationList(childNode);
+            }
+            childNode = childNode.getNextSibling();
+        }
+
+        return !notificationNodes.isEmpty();
+    }
+}
diff --git a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/javamodel/YangJavaNotificationTranslator.java b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/javamodel/YangJavaNotificationTranslator.java
new file mode 100644
index 0000000..5d37e5a
--- /dev/null
+++ b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/javamodel/YangJavaNotificationTranslator.java
@@ -0,0 +1,192 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.translator.tojava.javamodel;
+
+import org.onosproject.yang.compiler.datamodel.RpcNotificationContainer;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.javadatamodel.YangJavaNotification;
+import org.onosproject.yang.compiler.translator.exception.TranslatorException;
+import org.onosproject.yang.compiler.translator.tojava.JavaCodeGenerator;
+import org.onosproject.yang.compiler.translator.tojava.JavaCodeGeneratorInfo;
+import org.onosproject.yang.compiler.translator.tojava.JavaFileInfoContainer;
+import org.onosproject.yang.compiler.translator.tojava.JavaFileInfoTranslator;
+import org.onosproject.yang.compiler.translator.tojava.JavaQualifiedTypeInfoTranslator;
+import org.onosproject.yang.compiler.translator.tojava.TempJavaCodeFragmentFiles;
+import org.onosproject.yang.compiler.translator.tojava.TempJavaCodeFragmentFilesContainer;
+import org.onosproject.yang.compiler.translator.tojava.TempJavaServiceFragmentFiles;
+import org.onosproject.yang.compiler.translator.tojava.utils.JavaExtendsListHolder;
+import org.onosproject.yang.compiler.utils.io.YangPluginConfig;
+
+import java.io.IOException;
+
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedJavaFileType.GENERATE_INTERFACE_WITH_BUILDER;
+import static org.onosproject.yang.compiler.translator.tojava.YangJavaModelUtils.generateCodeOfAugmentableNode;
+import static org.onosproject.yang.compiler.translator.tojava.utils.JavaIdentifierSyntax.getEnumJavaAttribute;
+import static org.onosproject.yang.compiler.translator.tojava.utils.TranslatorErrorType.FAIL_AT_ENTRY;
+import static org.onosproject.yang.compiler.translator.tojava.utils.TranslatorErrorType.FAIL_AT_EXIT;
+import static org.onosproject.yang.compiler.translator.tojava.utils.TranslatorErrorType.INVALID_NODE;
+import static org.onosproject.yang.compiler.translator.tojava.utils.TranslatorUtils.getErrorMsg;
+import static org.onosproject.yang.compiler.utils.UtilConstants.EVENT_LISTENER_STRING;
+import static org.onosproject.yang.compiler.utils.UtilConstants.EVENT_STRING;
+import static org.onosproject.yang.compiler.utils.io.impl.YangIoUtils.getCapitalCase;
+
+/**
+ * Represents notification information extended to support java code generation.
+ */
+public class YangJavaNotificationTranslator
+        extends YangJavaNotification
+        implements JavaCodeGenerator, JavaCodeGeneratorInfo {
+
+    private static final long serialVersionUID = 806201624L;
+
+    /**
+     * File handle to maintain temporary java code fragments as per the code
+     * snippet types.
+     */
+    private transient TempJavaCodeFragmentFiles tempFileHandle;
+
+    /**
+     * Creates an instance of java Notification.
+     */
+    public YangJavaNotificationTranslator() {
+        setJavaFileInfo(new JavaFileInfoTranslator());
+        getJavaFileInfo().setGeneratedFileTypes(GENERATE_INTERFACE_WITH_BUILDER);
+    }
+
+    /**
+     * Returns the generated java file information.
+     *
+     * @return generated java file information
+     */
+    @Override
+    public JavaFileInfoTranslator getJavaFileInfo() {
+
+        if (javaFileInfo == null) {
+            throw new TranslatorException(getErrorMsg(INVALID_NODE, this));
+        }
+        return (JavaFileInfoTranslator) javaFileInfo;
+    }
+
+    /**
+     * Sets the java file info object.
+     *
+     * @param javaInfo java file info object
+     */
+    @Override
+    public void setJavaFileInfo(JavaFileInfoTranslator javaInfo) {
+        javaFileInfo = javaInfo;
+    }
+
+    /**
+     * Returns the temporary file handle.
+     *
+     * @return temporary file handle
+     */
+    @Override
+    public TempJavaCodeFragmentFiles getTempJavaCodeFragmentFiles() {
+        return tempFileHandle;
+    }
+
+    /**
+     * Sets temporary file handle.
+     *
+     * @param fileHandle temporary file handle
+     */
+    @Override
+    public void setTempJavaCodeFragmentFiles(TempJavaCodeFragmentFiles fileHandle) {
+        tempFileHandle = fileHandle;
+    }
+
+    /**
+     * Prepare the information for java code generation corresponding to YANG
+     * notification info.
+     *
+     * @param yangPlugin YANG plugin config
+     * @throws TranslatorException translator operation fail
+     */
+    @Override
+    public void generateCodeEntry(YangPluginConfig yangPlugin)
+            throws TranslatorException {
+
+        // Obtain the notification name as per enum in notification.
+        String enumName = getEnumJavaAttribute(getName().toUpperCase());
+        ((RpcNotificationContainer) getParent())
+                .addToNotificationEnumMap(enumName, this);
+
+        /*
+         * As part of the notification support the following files needs to be
+         * generated.
+         * 1) Subject of the notification(event), this is simple interface with
+         * builder class.
+         * 2) Event class extending "AbstractEvent" and defining event type
+         * enum.
+         * 3) Event listener interface extending "EventListener".
+         *
+         * The manager class needs to extend the ListenerRegistry.
+         */
+
+        // Generate subject of the notification(event), this is simple interface
+        // with builder class.
+        try {
+            generateCodeOfAugmentableNode(this, yangPlugin);
+            addNotificationToExtendsList();
+        } catch (IOException e) {
+            throw new TranslatorException(getErrorMsg(FAIL_AT_ENTRY, this,
+                                                      e.getLocalizedMessage()));
+        }
+    }
+
+    /*Adds current notification info to the extends list so its parents service*/
+    private void addNotificationToExtendsList() {
+        YangNode parent = getParent();
+        TempJavaServiceFragmentFiles tempFiles =
+                ((TempJavaCodeFragmentFilesContainer) parent).getTempJavaCodeFragmentFiles()
+                        .getServiceTempFiles();
+        JavaExtendsListHolder holder = tempFiles.getJavaExtendsListHolder();
+        JavaQualifiedTypeInfoTranslator event =
+                new JavaQualifiedTypeInfoTranslator();
+
+        String parentInfo = getCapitalCase(((JavaFileInfoContainer) parent)
+                                                   .getJavaFileInfo()
+                                                   .getJavaName());
+        event.setClassInfo(parentInfo + EVENT_STRING);
+        event.setPkgInfo(getJavaFileInfo().getPackage());
+        holder.addToExtendsList(event, parent, tempFiles);
+
+        JavaQualifiedTypeInfoTranslator eventListener =
+                new JavaQualifiedTypeInfoTranslator();
+
+        eventListener.setClassInfo(parentInfo + EVENT_LISTENER_STRING);
+        eventListener.setPkgInfo(getJavaFileInfo().getPackage());
+        holder.addToExtendsList(eventListener, parent, tempFiles);
+    }
+
+    /**
+     * Creates a java file using the YANG notification info.
+     */
+    @Override
+    public void generateCodeExit()
+            throws TranslatorException {
+        try {
+            getTempJavaCodeFragmentFiles().generateJavaFile(
+                    GENERATE_INTERFACE_WITH_BUILDER, this);
+        } catch (IOException e) {
+            throw new TranslatorException(getErrorMsg(FAIL_AT_EXIT, this,
+                                                      e.getLocalizedMessage()));
+        }
+    }
+}
diff --git a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/javamodel/YangJavaOutputTranslator.java b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/javamodel/YangJavaOutputTranslator.java
new file mode 100644
index 0000000..d5c7f82
--- /dev/null
+++ b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/javamodel/YangJavaOutputTranslator.java
@@ -0,0 +1,142 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.translator.tojava.javamodel;
+
+import org.onosproject.yang.compiler.datamodel.javadatamodel.YangJavaOutput;
+import org.onosproject.yang.compiler.translator.exception.TranslatorException;
+import org.onosproject.yang.compiler.translator.tojava.JavaCodeGenerator;
+import org.onosproject.yang.compiler.translator.tojava.JavaCodeGeneratorInfo;
+import org.onosproject.yang.compiler.translator.tojava.JavaFileInfoTranslator;
+import org.onosproject.yang.compiler.translator.tojava.TempJavaCodeFragmentFiles;
+import org.onosproject.yang.compiler.utils.io.YangPluginConfig;
+
+import java.io.IOException;
+
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedJavaFileType.GENERATE_INTERFACE_WITH_BUILDER;
+import static org.onosproject.yang.compiler.translator.tojava.YangJavaModelUtils.generateCodeOfAugmentableNode;
+
+/**
+ * Represents output information extended to support java code generation.
+ */
+public class YangJavaOutputTranslator
+        extends YangJavaOutput
+        implements JavaCodeGeneratorInfo, JavaCodeGenerator {
+
+    private static final long serialVersionUID = 806201623L;
+
+    /**
+     * File handle to maintain temporary java code fragments as per the code
+     * snippet types.
+     */
+    private transient TempJavaCodeFragmentFiles tempFileHandle;
+
+    /**
+     * Creates an instance of java output.
+     */
+    public YangJavaOutputTranslator() {
+        super();
+        setJavaFileInfo(new JavaFileInfoTranslator());
+        getJavaFileInfo().setGeneratedFileTypes(GENERATE_INTERFACE_WITH_BUILDER);
+    }
+
+    /**
+     * Returns the generated java file information.
+     *
+     * @return generated java file information
+     */
+    @Override
+    public JavaFileInfoTranslator getJavaFileInfo() {
+        if (javaFileInfo == null) {
+            throw new TranslatorException("missing java info in java datamodel node " +
+                                                  getName() + " in " +
+                                                  getLineNumber() + " at " +
+                                                  getCharPosition()
+                                                  + " in " + getFileName());
+        }
+        return (JavaFileInfoTranslator) javaFileInfo;
+    }
+
+    /**
+     * Sets the java file info object.
+     *
+     * @param javaInfo java file info object
+     */
+    @Override
+    public void setJavaFileInfo(JavaFileInfoTranslator javaInfo) {
+        javaFileInfo = javaInfo;
+    }
+
+    /**
+     * Returns the temporary file handle.
+     *
+     * @return temporary file handle
+     */
+    @Override
+    public TempJavaCodeFragmentFiles getTempJavaCodeFragmentFiles() {
+        return tempFileHandle;
+    }
+
+    /**
+     * Sets temporary file handle.
+     *
+     * @param fileHandle temporary file handle
+     */
+    @Override
+    public void setTempJavaCodeFragmentFiles(TempJavaCodeFragmentFiles fileHandle) {
+        tempFileHandle = fileHandle;
+    }
+
+    /**
+     * Prepare the information for java code generation corresponding to YANG
+     * output info.
+     *
+     * @param yangPlugin YANG plugin config
+     * @throws TranslatorException translator operation fail
+     */
+    @Override
+    public void generateCodeEntry(YangPluginConfig yangPlugin) throws TranslatorException {
+        try {
+            generateCodeOfAugmentableNode(this, yangPlugin);
+        } catch (IOException e) {
+            throw new TranslatorException(
+                    "Failed to prepare generate code entry for output node " +
+                            getName() + " in " +
+                            getLineNumber() + " at " +
+                            getCharPosition()
+                            + " in " + getFileName() + " " + e.getLocalizedMessage());
+        }
+    }
+
+    /**
+     * Creates a java file using the YANG output info.
+     *
+     * @throws TranslatorException translator operation fail
+     */
+    @Override
+    public void generateCodeExit() throws TranslatorException {
+        try {
+            getTempJavaCodeFragmentFiles().generateJavaFile(GENERATE_INTERFACE_WITH_BUILDER, this);
+        } catch (IOException e) {
+            throw new TranslatorException(
+                    "Failed to prepare generate code exit for output node " +
+                            getName() + " in " +
+                            getLineNumber() + " at " +
+                            getCharPosition()
+                            + " in " + getFileName() + " " + e.getLocalizedMessage());
+        }
+    }
+}
diff --git a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/javamodel/YangJavaRpcTranslator.java b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/javamodel/YangJavaRpcTranslator.java
new file mode 100644
index 0000000..a23a7e4
--- /dev/null
+++ b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/javamodel/YangJavaRpcTranslator.java
@@ -0,0 +1,179 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.translator.tojava.javamodel;
+
+import org.onosproject.yang.compiler.datamodel.RpcNotificationContainer;
+import org.onosproject.yang.compiler.datamodel.YangInput;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangOutput;
+import org.onosproject.yang.compiler.datamodel.javadatamodel.YangJavaRpc;
+import org.onosproject.yang.compiler.translator.exception.TranslatorException;
+import org.onosproject.yang.compiler.translator.tojava.JavaAttributeInfo;
+import org.onosproject.yang.compiler.translator.tojava.JavaCodeGenerator;
+import org.onosproject.yang.compiler.translator.tojava.JavaCodeGeneratorInfo;
+import org.onosproject.yang.compiler.translator.tojava.JavaFileInfoTranslator;
+import org.onosproject.yang.compiler.translator.tojava.TempJavaCodeFragmentFiles;
+import org.onosproject.yang.compiler.translator.tojava.TempJavaCodeFragmentFilesContainer;
+import org.onosproject.yang.compiler.translator.tojava.TempJavaServiceFragmentFiles;
+import org.onosproject.yang.compiler.utils.io.YangPluginConfig;
+
+import java.io.IOException;
+
+import static org.onosproject.yang.compiler.datamodel.utils.DataModelUtils.getParentNodeInGenCode;
+import static org.onosproject.yang.compiler.translator.tojava.YangJavaModelUtils.updatePackageInfo;
+import static org.onosproject.yang.compiler.translator.tojava.utils.TranslatorErrorType.FAIL_AT_EXIT;
+import static org.onosproject.yang.compiler.translator.tojava.utils.TranslatorErrorType.INVALID_CHILD_NODE;
+import static org.onosproject.yang.compiler.translator.tojava.utils.TranslatorErrorType.INVALID_PARENT_NODE;
+import static org.onosproject.yang.compiler.translator.tojava.utils.TranslatorUtils.getErrorMsg;
+
+/**
+ * Represents rpc information extended to support java code generation.
+ */
+public class YangJavaRpcTranslator
+        extends YangJavaRpc
+        implements JavaCodeGenerator, JavaCodeGeneratorInfo {
+
+    private static final long serialVersionUID = 806201622L;
+
+    /**
+     * Temporary file for code generation.
+     */
+    private transient TempJavaCodeFragmentFiles tempJavaCodeFragmentFiles;
+
+    /**
+     * Creates an instance of YANG java rpc.
+     */
+    public YangJavaRpcTranslator() {
+        setJavaFileInfo(new JavaFileInfoTranslator());
+    }
+
+    /**
+     * Returns the generated java file information.
+     *
+     * @return generated java file information
+     */
+    @Override
+    public JavaFileInfoTranslator getJavaFileInfo() {
+
+        if (javaFileInfo == null) {
+            throw new TranslatorException("missing java info in java datamodel node " +
+                                                  getName());
+        }
+        return (JavaFileInfoTranslator) javaFileInfo;
+    }
+
+    /**
+     * Sets the java file info object.
+     *
+     * @param javaInfo java file info object
+     */
+    @Override
+    public void setJavaFileInfo(JavaFileInfoTranslator javaInfo) {
+        javaFileInfo = javaInfo;
+    }
+
+    @Override
+    public TempJavaCodeFragmentFiles getTempJavaCodeFragmentFiles() {
+        return tempJavaCodeFragmentFiles;
+    }
+
+    @Override
+    public void setTempJavaCodeFragmentFiles(TempJavaCodeFragmentFiles fileHandle) {
+        tempJavaCodeFragmentFiles = fileHandle;
+    }
+
+    /**
+     * Prepares the information for java code generation corresponding to YANG
+     * RPC info.
+     *
+     * @param yangPlugin YANG plugin config
+     * @throws TranslatorException translator operations fails
+     */
+    @Override
+    public void generateCodeEntry(YangPluginConfig yangPlugin)
+            throws TranslatorException {
+
+        // Add package information for rpc and create corresponding folder.
+        updatePackageInfo(this, yangPlugin);
+    }
+
+    /**
+     * Creates a java file using the YANG RPC info.
+     *
+     * @throws TranslatorException translator operations fails
+     */
+    @Override
+    public void generateCodeExit()
+            throws TranslatorException {
+        // Get the parent module/sub-module.
+        YangNode parent = getParentNodeInGenCode(this);
+
+        // Parent should be holder of rpc or notification.
+        if (!(parent instanceof RpcNotificationContainer)) {
+            throw new TranslatorException(getErrorMsg(INVALID_PARENT_NODE,
+                                                      this));
+        }
+
+        /*
+         * Create attribute info for input and output of rpc and add it to the
+         * parent import list.
+         */
+        TempJavaServiceFragmentFiles tempJavaFragmentFiles =
+                ((TempJavaCodeFragmentFilesContainer) getParent())
+                        .getTempJavaCodeFragmentFiles()
+                        .getServiceTempFiles();
+        JavaAttributeInfo javaAttributeInfoOfInput = null;
+        JavaAttributeInfo javaAttributeInfoOfOutput = null;
+
+        // Get the child input and output node and obtain create java attribute
+        // info.
+        YangNode yangNode = getChild();
+        while (yangNode != null) {
+            if (yangNode instanceof YangInput) {
+                javaAttributeInfoOfInput = tempJavaFragmentFiles
+                        .getChildNodeAsAttributeInParentService(yangNode,
+                                                                getParent(),
+                                                                getJavaClassNameOrBuiltInType());
+            } else if (yangNode instanceof YangOutput) {
+                javaAttributeInfoOfOutput = tempJavaFragmentFiles
+                        .getChildNodeAsAttributeInParentService(yangNode,
+                                                                getParent(),
+                                                                getJavaClassNameOrBuiltInType());
+            } else {
+                throw new TranslatorException(getErrorMsg(INVALID_CHILD_NODE,
+                                                          this));
+            }
+            yangNode = yangNode.getNextSibling();
+        }
+
+        /*
+         * Add the rpc information to the parent's service temp file.
+         */
+        try {
+
+            ((TempJavaCodeFragmentFilesContainer) parent)
+                    .getTempJavaCodeFragmentFiles().getServiceTempFiles()
+                    .addJavaSnippetInfoToApplicableTempFiles(
+                            javaAttributeInfoOfInput, javaAttributeInfoOfOutput,
+                            getJavaClassNameOrBuiltInType());
+        } catch (IOException e) {
+            throw new TranslatorException(getErrorMsg(FAIL_AT_EXIT, this,
+                                                      e.getLocalizedMessage()));
+        }
+        // No file will be generated during RPC exit.
+    }
+}
diff --git a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/javamodel/YangJavaSubModuleTranslator.java b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/javamodel/YangJavaSubModuleTranslator.java
new file mode 100644
index 0000000..5cee773
--- /dev/null
+++ b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/javamodel/YangJavaSubModuleTranslator.java
@@ -0,0 +1,228 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.yang.compiler.translator.tojava.javamodel;
+
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangNotification;
+import org.onosproject.yang.compiler.datamodel.javadatamodel.YangJavaSubModule;
+import org.onosproject.yang.compiler.translator.exception.TranslatorException;
+import org.onosproject.yang.compiler.translator.tojava.JavaCodeGenerator;
+import org.onosproject.yang.compiler.translator.tojava.JavaCodeGeneratorInfo;
+import org.onosproject.yang.compiler.translator.tojava.JavaFileInfoTranslator;
+import org.onosproject.yang.compiler.translator.tojava.TempJavaCodeFragmentFiles;
+import org.onosproject.yang.compiler.utils.io.YangPluginConfig;
+
+import java.io.IOException;
+import java.util.ArrayList;
+
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedJavaFileType.GENERATE_ALL_EVENT_CLASS_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedJavaFileType.GENERATE_INTERFACE_WITH_BUILDER;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedJavaFileType.GENERATE_SERVICE_AND_MANAGER;
+import static org.onosproject.yang.compiler.translator.tojava.YangJavaModelUtils.generateCodeOfRootNode;
+import static org.onosproject.yang.compiler.translator.tojava.YangJavaModelUtils.generateInterfaceFileForNonDataNodes;
+import static org.onosproject.yang.compiler.translator.tojava.YangJavaModelUtils.isRootNodesCodeGenRequired;
+import static org.onosproject.yang.compiler.translator.tojava.utils.JavaIdentifierSyntax.getRootPackage;
+import static org.onosproject.yang.compiler.translator.tojava.utils.TranslatorErrorType.FAIL_AT_ENTRY;
+import static org.onosproject.yang.compiler.translator.tojava.utils.TranslatorErrorType.FAIL_AT_EXIT;
+import static org.onosproject.yang.compiler.translator.tojava.utils.TranslatorUtils.getErrorMsg;
+import static org.onosproject.yang.compiler.utils.UtilConstants.SBI;
+import static org.onosproject.yang.compiler.utils.io.impl.YangIoUtils.removeEmptyDirectory;
+import static org.onosproject.yang.compiler.utils.io.impl.YangIoUtils.searchAndDeleteTempDir;
+
+/**
+ * Represents sub module information extended to support java code generation.
+ */
+public class YangJavaSubModuleTranslator
+        extends YangJavaSubModule
+        implements JavaCodeGeneratorInfo, JavaCodeGenerator {
+
+    private static final long serialVersionUID = 806201621L;
+
+    /**
+     * File handle to maintain temporary java code fragments as per the code snippet types.
+     */
+    private transient TempJavaCodeFragmentFiles tempFileHandle;
+
+    /**
+     * Creates YANG java sub module object.
+     */
+    public YangJavaSubModuleTranslator() {
+        setJavaFileInfo(new JavaFileInfoTranslator());
+        notificationNodes = new ArrayList<>();
+        int genType =
+                GENERATE_SERVICE_AND_MANAGER | GENERATE_INTERFACE_WITH_BUILDER;
+        if (isNotificationChildNodePresent(this)) {
+            genType = GENERATE_SERVICE_AND_MANAGER | GENERATE_ALL_EVENT_CLASS_MASK;
+        }
+        getJavaFileInfo().setGeneratedFileTypes(genType);
+    }
+
+    /**
+     * Returns the generated java file information.
+     *
+     * @return generated java file information
+     */
+    @Override
+    public JavaFileInfoTranslator getJavaFileInfo() {
+        if (javaFileInfo == null) {
+            throw new TranslatorException("Missing java info in java datamodel node " +
+                                                  getName());
+        }
+        return (JavaFileInfoTranslator) javaFileInfo;
+    }
+
+    /**
+     * Sets the java file info object.
+     *
+     * @param javaInfo java file info object
+     */
+    @Override
+    public void setJavaFileInfo(JavaFileInfoTranslator javaInfo) {
+        javaFileInfo = javaInfo;
+    }
+
+    /**
+     * Returns the temporary file handle.
+     *
+     * @return temporary file handle
+     */
+    @Override
+    public TempJavaCodeFragmentFiles getTempJavaCodeFragmentFiles() {
+        return tempFileHandle;
+    }
+
+    /**
+     * Sets temporary file handle.
+     *
+     * @param fileHandle temporary file handle
+     */
+    @Override
+    public void setTempJavaCodeFragmentFiles(TempJavaCodeFragmentFiles fileHandle) {
+        tempFileHandle = fileHandle;
+    }
+
+    /**
+     * Returns the name space of the module to which the sub module belongs to.
+     *
+     * @return the name space string of the module.
+     */
+    public String getNameSpaceFromModule() {
+        return ((YangModule) getBelongsTo().getModuleNode()).getModuleNamespace();
+    }
+
+    /**
+     * Prepares the information for java code generation corresponding to
+     * YANG submodule info.
+     *
+     * @param yangPlugin YANG plugin config
+     * @throws TranslatorException when fails to translate
+     */
+    @Override
+    public void generateCodeEntry(YangPluginConfig yangPlugin)
+            throws TranslatorException {
+        String subModulePkg = getRootPackage(
+                getVersion(), getNameSpaceFromModule(), getRevision(),
+                yangPlugin.getConflictResolver());
+
+        if (isNotificationChildNodePresent(this)) {
+            getJavaFileInfo().setGeneratedFileTypes(
+                    getJavaFileInfo().getGeneratedFileTypes()
+                            | GENERATE_ALL_EVENT_CLASS_MASK);
+        }
+        try {
+            generateCodeOfRootNode(this, yangPlugin, subModulePkg);
+            tempFileHandle.getServiceTempFiles().addAugmentedRpcMethod(
+                    this);
+        } catch (IOException e) {
+            throw new TranslatorException(getErrorMsg(FAIL_AT_ENTRY, this,
+                                                      e.getLocalizedMessage()));
+        }
+    }
+
+    /**
+     * Creates a java file using the YANG submodule info.
+     */
+    @Override
+    public void generateCodeExit()
+            throws TranslatorException {
+        /*
+         * As part of the notification support the following files needs to be generated.
+         * 1) Subject of the notification(event), this is simple interface with builder class.
+         * 2) Event class extending "AbstractEvent" and defining event type enum.
+         * 3) Event listener interface extending "EventListener".
+         * 4) Event subject class.
+         *
+         * The manager class needs to extend the "ListenerRegistry".
+         */
+        try {
+            if ((getJavaFileInfo().getGeneratedFileTypes() &
+                    GENERATE_ALL_EVENT_CLASS_MASK) != 0) {
+                getTempJavaCodeFragmentFiles().generateJavaFile(
+                        GENERATE_ALL_EVENT_CLASS_MASK, this);
+            }
+            if (!isRootNodesCodeGenRequired(this)) {
+                generateInterfaceFileForNonDataNodes(this);
+            } else {
+                getTempJavaCodeFragmentFiles()
+                        .generateJavaFile(GENERATE_INTERFACE_WITH_BUILDER, this);
+                if (getJavaFileInfo().getPluginConfig()
+                        .getCodeGenerateForSbi() == null ||
+                        !getJavaFileInfo().getPluginConfig()
+                                .getCodeGenerateForSbi().equals(SBI)) {
+                    getTempJavaCodeFragmentFiles().generateJavaFile(
+                            GENERATE_SERVICE_AND_MANAGER, this);
+                }
+            }
+
+            searchAndDeleteTempDir(getJavaFileInfo().getBaseCodeGenPath() +
+                                           getJavaFileInfo().getPackageFilePath());
+            removeEmptyDirectory(getJavaFileInfo().getBaseCodeGenPath() +
+                                         getJavaFileInfo().getPackageFilePath());
+        } catch (IOException e) {
+            throw new TranslatorException(getErrorMsg(FAIL_AT_EXIT, this,
+                                                      e.getLocalizedMessage()));
+        }
+    }
+
+    /**
+     * Adds to notification node list.
+     *
+     * @param curNode notification node
+     */
+    private void addToNotificationList(YangNode curNode) {
+        notificationNodes.add(curNode);
+    }
+
+    /**
+     * Checks if there is any notification node present.
+     *
+     * @param rootNode root node of the data model
+     * @return status of notification's existence
+     */
+    private boolean isNotificationChildNodePresent(YangNode rootNode) {
+        YangNode childNode = rootNode.getChild();
+
+        while (childNode != null) {
+            if (childNode instanceof YangNotification) {
+                addToNotificationList(childNode);
+            }
+            childNode = childNode.getNextSibling();
+        }
+
+        return !notificationNodes.isEmpty();
+    }
+}
diff --git a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/javamodel/YangJavaTypeDefTranslator.java b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/javamodel/YangJavaTypeDefTranslator.java
new file mode 100644
index 0000000..d9efd0f
--- /dev/null
+++ b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/javamodel/YangJavaTypeDefTranslator.java
@@ -0,0 +1,162 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.yang.compiler.translator.tojava.javamodel;
+
+import org.onosproject.yang.compiler.datamodel.YangDerivedInfo;
+import org.onosproject.yang.compiler.datamodel.YangType;
+import org.onosproject.yang.compiler.datamodel.javadatamodel.YangJavaTypeDef;
+import org.onosproject.yang.compiler.translator.exception.InvalidNodeForTranslatorException;
+import org.onosproject.yang.compiler.translator.exception.TranslatorException;
+import org.onosproject.yang.compiler.translator.tojava.JavaCodeGenerator;
+import org.onosproject.yang.compiler.translator.tojava.JavaCodeGeneratorInfo;
+import org.onosproject.yang.compiler.translator.tojava.JavaFileInfoTranslator;
+import org.onosproject.yang.compiler.translator.tojava.TempJavaCodeFragmentFiles;
+import org.onosproject.yang.compiler.utils.io.YangPluginConfig;
+
+import java.io.IOException;
+
+import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes.DERIVED;
+import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes.LEAFREF;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedJavaFileType.GENERATE_TYPEDEF_CLASS;
+import static org.onosproject.yang.compiler.translator.tojava.YangJavaModelUtils.generateCodeOfNode;
+import static org.onosproject.yang.compiler.translator.tojava.YangJavaModelUtils.generateJava;
+
+/**
+ * Represents type define information extended to support java code generation.
+ */
+public class YangJavaTypeDefTranslator
+        extends YangJavaTypeDef
+        implements JavaCodeGeneratorInfo, JavaCodeGenerator {
+
+    private static final long serialVersionUID = 806201620L;
+
+    /**
+     * File handle to maintain temporary java code fragments as per the code
+     * snippet types.
+     */
+    private transient TempJavaCodeFragmentFiles tempFileHandle;
+
+    /**
+     * Creates a YANG java typedef object.
+     */
+    public YangJavaTypeDefTranslator() {
+        super();
+        setJavaFileInfo(new JavaFileInfoTranslator());
+        getJavaFileInfo().setGeneratedFileTypes(GENERATE_TYPEDEF_CLASS);
+    }
+
+    /**
+     * Returns the generated java file information.
+     *
+     * @return generated java file information
+     */
+    @Override
+    public JavaFileInfoTranslator getJavaFileInfo() {
+
+        if (javaFileInfo == null) {
+            throw new TranslatorException("Missing java info in java datamodel node " +
+                                                  getName() + " in " +
+                                                  getLineNumber() + " at " +
+                                                  getCharPosition()
+                                                  + " in " + getFileName());
+        }
+        return (JavaFileInfoTranslator) javaFileInfo;
+    }
+
+    /**
+     * Sets the java file info object.
+     *
+     * @param javaInfo java file info object
+     */
+    @Override
+    public void setJavaFileInfo(JavaFileInfoTranslator javaInfo) {
+        javaFileInfo = javaInfo;
+    }
+
+    /**
+     * Returns the temporary file handle.
+     *
+     * @return temporary file handle
+     */
+    @Override
+    public TempJavaCodeFragmentFiles getTempJavaCodeFragmentFiles() {
+        return tempFileHandle;
+    }
+
+    /**
+     * Sets temporary file handle.
+     *
+     * @param fileHandle temporary file handle
+     */
+    @Override
+    public void setTempJavaCodeFragmentFiles(TempJavaCodeFragmentFiles fileHandle) {
+        tempFileHandle = fileHandle;
+    }
+
+    /**
+     * Prepare the information for java code generation corresponding to YANG
+     * typedef info.
+     *
+     * @param yangPlugin YANG plugin config
+     * @throws TranslatorException when fails to translate
+     */
+    @Override
+    public void generateCodeEntry(YangPluginConfig yangPlugin) throws TranslatorException {
+        if (getReferredSchema() != null) {
+            throw new InvalidNodeForTranslatorException();
+        }
+        // TODO update the below exception in all related places, remove file
+        // name and other information.
+        YangType typeInTypeDef = this.getTypeDefBaseType();
+        InvalidNodeForTranslatorException exception = new InvalidNodeForTranslatorException();
+        exception.setFileName(this.getFileName());
+        exception.setCharPosition(this.getCharPosition());
+        exception.setLine(this.getLineNumber());
+        if (typeInTypeDef.getDataType() == DERIVED) {
+            YangDerivedInfo derivedInfo = (YangDerivedInfo) typeInTypeDef.getDataTypeExtendedInfo();
+            if (derivedInfo.getEffectiveBuiltInType() == LEAFREF) {
+                throw exception;
+            }
+        } else if (typeInTypeDef.getDataType() == LEAFREF) {
+            throw exception;
+        }
+        try {
+            generateCodeOfNode(this, yangPlugin);
+        } catch (IOException e) {
+            throw new TranslatorException(
+                    "Failed to prepare generate code entry for typedef node " + getName()
+                            + "in " + getLineNumber() + " at " + getCharPosition() + " in " + getFileName()
+                            + " " + e.getLocalizedMessage());
+        }
+    }
+
+    /**
+     * Create a java file using the YANG typedef info.
+     *
+     * @throws TranslatorException when fails to translate
+     */
+    @Override
+    public void generateCodeExit() throws TranslatorException {
+        try {
+            generateJava(GENERATE_TYPEDEF_CLASS, this);
+        } catch (IOException e) {
+            throw new TranslatorException(
+                    "Failed to prepare generate code for typedef node " + getName()
+                            + "in " + getLineNumber() + " at " + getCharPosition() + " in " + getFileName()
+                            + " " + e.getLocalizedMessage());
+        }
+    }
+}
diff --git a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/javamodel/YangJavaTypeTranslator.java b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/javamodel/YangJavaTypeTranslator.java
new file mode 100644
index 0000000..f439c8d
--- /dev/null
+++ b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/javamodel/YangJavaTypeTranslator.java
@@ -0,0 +1,83 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.yang.compiler.translator.tojava.javamodel;
+
+import org.onosproject.yang.compiler.datamodel.javadatamodel.YangJavaType;
+import org.onosproject.yang.compiler.translator.exception.TranslatorException;
+import org.onosproject.yang.compiler.translator.tojava.JavaQualifiedTypeInfoTranslator;
+import org.onosproject.yang.compiler.utils.io.YangToJavaNamingConflictUtil;
+
+import static org.onosproject.yang.compiler.translator.tojava.javamodel.AttributesJavaDataType.getJavaDataType;
+import static org.onosproject.yang.compiler.translator.tojava.javamodel.AttributesJavaDataType.getJavaImportClass;
+import static org.onosproject.yang.compiler.translator.tojava.javamodel.AttributesJavaDataType.getJavaImportPackage;
+
+/**
+ * Represents java information corresponding to the YANG type.
+ */
+public class YangJavaTypeTranslator
+        extends YangJavaType
+        implements JavaQualifiedTypeResolver {
+
+    /**
+     * Create a YANG leaf object with java qualified access details.
+     */
+    public YangJavaTypeTranslator() {
+        super();
+        setJavaQualifiedInfo(new JavaQualifiedTypeInfoTranslator());
+    }
+
+    @Override
+    public void updateJavaQualifiedInfo(YangToJavaNamingConflictUtil conflictResolver) {
+        JavaQualifiedTypeInfoTranslator importInfo = (JavaQualifiedTypeInfoTranslator) getJavaQualifiedInfo();
+
+        /*
+         * Type is added as an attribute in the class.
+         */
+        String className = getJavaImportClass(this, false, conflictResolver);
+        if (className != null) {
+            /*
+             * Corresponding to the attribute type a class needs to be imported,
+             * since it can be a derived type or a usage of wrapper classes.
+             */
+            importInfo.setClassInfo(className);
+            String classPkg = getJavaImportPackage(this,
+                                                   false, conflictResolver);
+            if (classPkg == null) {
+                throw new TranslatorException("import package cannot be null when the class is used " +
+                                                      getDataTypeName() + " in " +
+                                                      getLineNumber() + " at " +
+                                                      getCharPosition()
+                                                      + " in " + getFileName());
+            }
+            importInfo.setPkgInfo(classPkg);
+        } else {
+            /*
+             * The attribute does not need a class to be imported, for example
+             * built in java types.
+             */
+            String dataTypeName = getJavaDataType(this);
+            if (dataTypeName == null) {
+                throw new TranslatorException("not supported data type " +
+                                                      getDataTypeName() + " in " +
+                                                      getLineNumber() + " at " +
+                                                      getCharPosition()
+                                                      + " in " + getFileName());
+            }
+            importInfo.setClassInfo(dataTypeName);
+        }
+        setJavaQualifiedInfo(importInfo);
+    }
+}
diff --git a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/javamodel/YangJavaUnionTranslator.java b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/javamodel/YangJavaUnionTranslator.java
new file mode 100644
index 0000000..6d65ded
--- /dev/null
+++ b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/javamodel/YangJavaUnionTranslator.java
@@ -0,0 +1,142 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.yang.compiler.translator.tojava.javamodel;
+
+import org.onosproject.yang.compiler.datamodel.javadatamodel.YangJavaUnion;
+import org.onosproject.yang.compiler.translator.exception.InvalidNodeForTranslatorException;
+import org.onosproject.yang.compiler.translator.exception.TranslatorException;
+import org.onosproject.yang.compiler.translator.tojava.JavaCodeGenerator;
+import org.onosproject.yang.compiler.translator.tojava.JavaCodeGeneratorInfo;
+import org.onosproject.yang.compiler.translator.tojava.JavaFileInfoTranslator;
+import org.onosproject.yang.compiler.translator.tojava.TempJavaCodeFragmentFiles;
+import org.onosproject.yang.compiler.utils.io.YangPluginConfig;
+
+import java.io.IOException;
+
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedJavaFileType.GENERATE_UNION_CLASS;
+import static org.onosproject.yang.compiler.translator.tojava.YangJavaModelUtils.generateCodeOfNode;
+import static org.onosproject.yang.compiler.translator.tojava.YangJavaModelUtils.generateJava;
+
+/**
+ * Represents union information extended to support java code generation.
+ */
+public class YangJavaUnionTranslator
+        extends YangJavaUnion
+        implements JavaCodeGeneratorInfo, JavaCodeGenerator {
+
+    private static final long serialVersionUID = 806201619L;
+
+    /**
+     * File handle to maintain temporary java code fragments as per the code
+     * snippet types.
+     */
+    private transient TempJavaCodeFragmentFiles tempFileHandle;
+
+    /**
+     * Creates an instance of YANG java union.
+     */
+    public YangJavaUnionTranslator() {
+        super();
+        setJavaFileInfo(new JavaFileInfoTranslator());
+        getJavaFileInfo().setGeneratedFileTypes(GENERATE_UNION_CLASS);
+    }
+
+    /**
+     * Returns the generated java file information.
+     *
+     * @return generated java file information
+     */
+    @Override
+    public JavaFileInfoTranslator getJavaFileInfo() {
+        if (javaFileInfo == null) {
+            throw new RuntimeException("Missing java info in java datamodel node " + getName() + " in " +
+                                               getLineNumber() + " at " +
+                                               getCharPosition()
+                                               + " in " + getFileName());
+        }
+        return (JavaFileInfoTranslator) javaFileInfo;
+    }
+
+    /**
+     * Sets the java file info object.
+     *
+     * @param javaInfo java file info object
+     */
+    @Override
+    public void setJavaFileInfo(JavaFileInfoTranslator javaInfo) {
+        javaFileInfo = javaInfo;
+    }
+
+    /**
+     * Returns the temporary file handle.
+     *
+     * @return temporary file handle
+     */
+    @Override
+    public TempJavaCodeFragmentFiles getTempJavaCodeFragmentFiles() {
+        return tempFileHandle;
+    }
+
+    /**
+     * Sets temporary file handle.
+     *
+     * @param fileHandle temporary file handle
+     */
+    @Override
+    public void setTempJavaCodeFragmentFiles(TempJavaCodeFragmentFiles fileHandle) {
+        tempFileHandle = fileHandle;
+    }
+
+    /**
+     * Prepare the information for java code generation corresponding to YANG
+     * union info.
+     *
+     * @param yangPlugin YANG plugin config
+     * @throws TranslatorException when fails to translate
+     */
+    @Override
+    public void generateCodeEntry(YangPluginConfig yangPlugin) throws TranslatorException {
+        try {
+            if (getReferredSchema() != null) {
+                throw new InvalidNodeForTranslatorException();
+            }
+            generateCodeOfNode(this, yangPlugin);
+        } catch (IOException e) {
+            throw new TranslatorException(
+                    "Failed to prepare generate code entry for union node " + getName() + " in " +
+                            getLineNumber() + " at " +
+                            getCharPosition()
+                            + " in " + getFileName() + " " + e.getLocalizedMessage());
+        }
+    }
+
+    /**
+     * Creates a java file using the YANG union info.
+     *
+     * @throws TranslatorException when fails to translate
+     */
+    @Override
+    public void generateCodeExit() throws TranslatorException {
+        try {
+            generateJava(GENERATE_UNION_CLASS, this);
+        } catch (IOException e) {
+            throw new TranslatorException("Failed to generate code for union node " + getName() + " in " +
+                                                  getLineNumber() + " at " +
+                                                  getCharPosition()
+                                                  + " in " + getFileName() + " " + e.getLocalizedMessage());
+        }
+    }
+}
diff --git a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/javamodel/YangJavaUsesTranslator.java b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/javamodel/YangJavaUsesTranslator.java
new file mode 100644
index 0000000..7176167
--- /dev/null
+++ b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/javamodel/YangJavaUsesTranslator.java
@@ -0,0 +1,113 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.yang.compiler.translator.tojava.javamodel;
+
+import org.onosproject.yang.compiler.datamodel.javadatamodel.YangJavaUses;
+import org.onosproject.yang.compiler.translator.exception.InvalidNodeForTranslatorException;
+import org.onosproject.yang.compiler.translator.exception.TranslatorException;
+import org.onosproject.yang.compiler.translator.tojava.JavaCodeGenerator;
+import org.onosproject.yang.compiler.translator.tojava.JavaCodeGeneratorInfo;
+import org.onosproject.yang.compiler.translator.tojava.JavaFileInfoTranslator;
+import org.onosproject.yang.compiler.translator.tojava.TempJavaCodeFragmentFiles;
+import org.onosproject.yang.compiler.utils.io.YangPluginConfig;
+
+/**
+ * Represents uses information extended to support java code generation.
+ */
+public class YangJavaUsesTranslator
+        extends YangJavaUses
+        implements JavaCodeGeneratorInfo, JavaCodeGenerator {
+
+    private static final long serialVersionUID = 806201618L;
+
+    /**
+     * File handle to maintain temporary java code fragments as per the code
+     * snippet types.
+     */
+    private transient TempJavaCodeFragmentFiles tempFileHandle;
+
+    /**
+     * Creates YANG java uses object.
+     */
+    public YangJavaUsesTranslator() {
+        super();
+        setJavaFileInfo(new JavaFileInfoTranslator());
+    }
+
+    /**
+     * Returns the generated java file information.
+     *
+     * @return generated java file information
+     */
+    @Override
+    public JavaFileInfoTranslator getJavaFileInfo() {
+        if (javaFileInfo == null) {
+            throw new TranslatorException("Missing java info in java datamodel node " + getName() + " in " +
+                    getLineNumber() + " at " +
+                    getCharPosition()
+                    + " in " + getFileName());
+        }
+        return (JavaFileInfoTranslator) javaFileInfo;
+    }
+
+    /**
+     * Sets the java file info object.
+     *
+     * @param javaInfo java file info object
+     */
+    @Override
+    public void setJavaFileInfo(JavaFileInfoTranslator javaInfo) {
+        javaFileInfo = javaInfo;
+    }
+
+    /**
+     * Returns the temporary file handle.
+     *
+     * @return temporary file handle
+     */
+    @Override
+    public TempJavaCodeFragmentFiles getTempJavaCodeFragmentFiles() {
+        return tempFileHandle;
+    }
+
+    /**
+     * Sets temporary file handle.
+     *
+     * @param fileHandle temporary file handle
+     */
+    @Override
+    public void setTempJavaCodeFragmentFiles(TempJavaCodeFragmentFiles fileHandle) {
+        tempFileHandle = fileHandle;
+    }
+
+    @Override
+    public void generateCodeEntry(YangPluginConfig yangPlugin)
+            throws TranslatorException {
+        InvalidNodeForTranslatorException exception = new InvalidNodeForTranslatorException();
+        exception.setFileName(this.getFileName());
+        exception.setCharPosition(this.getCharPosition());
+        exception.setLine(this.getLineNumber());
+        throw exception;
+    }
+
+    @Override
+    public void generateCodeExit()
+            throws TranslatorException {
+        /*
+         * Do nothing.
+         */
+    }
+}
diff --git a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/javamodel/package-info.java b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/javamodel/package-info.java
new file mode 100644
index 0000000..8f52890
--- /dev/null
+++ b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/javamodel/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 mapped to java classes / interfaces.
+ */
+package org.onosproject.yang.compiler.translator.tojava.javamodel;
diff --git a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/package-info.java b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/package-info.java
new file mode 100644
index 0000000..72ee575
--- /dev/null
+++ b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/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.
+ */
+
+/**
+ * Generates java class definition from data model.
+ */
+package org.onosproject.yang.compiler.translator.tojava;
diff --git a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/utils/BracketType.java b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/utils/BracketType.java
new file mode 100644
index 0000000..2b78eac
--- /dev/null
+++ b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/utils/BracketType.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.translator.tojava.utils;
+
+/**
+ * Represents different bracket types.
+ */
+enum BracketType {
+
+    //Open close bracket '()'.
+    OPEN_CLOSE_BRACKET,
+
+    //Open close bracket with value '(value)).
+    OPEN_CLOSE_BRACKET_WITH_VALUE,
+
+    //Open close bracket with value '(String value)).
+    OPEN_CLOSE_BRACKET_WITH_VALUE_AND_RETURN_TYPE,
+
+    //Open close bracket with value '(String value,.
+    OPEN_BRACKET_WITH_VALUE,
+
+    //Open close bracket with value ',String value)).
+    CLOSE_BRACKET_WITH_VALUE,
+
+    //Open close diamond bracket '<>'.
+    OPEN_CLOSE_DIAMOND,
+
+    //Open close diamond bracket with value '<String>'
+    OPEN_CLOSE_DIAMOND_WITH_VALUE
+}
diff --git a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/utils/ClassDefinitionGenerator.java b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/utils/ClassDefinitionGenerator.java
new file mode 100644
index 0000000..115d220
--- /dev/null
+++ b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/utils/ClassDefinitionGenerator.java
@@ -0,0 +1,475 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.translator.tojava.utils;
+
+import org.onosproject.yang.compiler.datamodel.RpcNotificationContainer;
+import org.onosproject.yang.compiler.datamodel.YangAugment;
+import org.onosproject.yang.compiler.datamodel.YangCase;
+import org.onosproject.yang.compiler.datamodel.YangIdentity;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangNotification;
+import org.onosproject.yang.compiler.translator.exception.TranslatorException;
+import org.onosproject.yang.compiler.translator.tojava.JavaFileInfoContainer;
+import org.onosproject.yang.compiler.translator.tojava.JavaFileInfoTranslator;
+import org.onosproject.yang.compiler.translator.tojava.JavaQualifiedTypeInfoTranslator;
+import org.onosproject.yang.compiler.translator.tojava.TempJavaCodeFragmentFilesContainer;
+
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedJavaFileType.BUILDER_CLASS_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedJavaFileType.BUILDER_INTERFACE_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedJavaFileType.DEFAULT_CLASS_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedJavaFileType.GENERATE_ENUM_CLASS;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedJavaFileType.GENERATE_EVENT_CLASS;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedJavaFileType.GENERATE_EVENT_LISTENER_INTERFACE;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedJavaFileType.GENERATE_EVENT_SUBJECT_CLASS;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedJavaFileType.GENERATE_IDENTITY_CLASS;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedJavaFileType.GENERATE_KEY_CLASS;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedJavaFileType.GENERATE_SERVICE_AND_MANAGER;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedJavaFileType.GENERATE_TYPEDEF_CLASS;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedJavaFileType.GENERATE_UNION_CLASS;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedJavaFileType.INTERFACE_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.utils.BracketType.OPEN_CLOSE_DIAMOND_WITH_VALUE;
+import static org.onosproject.yang.compiler.translator.tojava.utils.StringGenerator.brackets;
+import static org.onosproject.yang.compiler.translator.tojava.utils.StringGenerator.getBuilderImplStringClassDef;
+import static org.onosproject.yang.compiler.translator.tojava.utils.StringGenerator.getDefaultDefinition;
+import static org.onosproject.yang.compiler.translator.tojava.utils.StringGenerator.getDefaultDefinitionWithExtends;
+import static org.onosproject.yang.compiler.translator.tojava.utils.StringGenerator.getDefaultDefinitionWithImpl;
+import static org.onosproject.yang.compiler.translator.tojava.utils.StringGenerator.getDefaultName;
+import static org.onosproject.yang.compiler.translator.tojava.utils.StringGenerator.getDefinitionWithImplements;
+import static org.onosproject.yang.compiler.translator.tojava.utils.StringGenerator.getErrorMsg;
+import static org.onosproject.yang.compiler.translator.tojava.utils.StringGenerator.getEventExtendsString;
+import static org.onosproject.yang.compiler.translator.tojava.utils.StringGenerator.getSpecificModifier;
+import static org.onosproject.yang.compiler.translator.tojava.utils.StringGenerator.getSuffixedName;
+import static org.onosproject.yang.compiler.utils.UtilConstants.ABSTRACT;
+import static org.onosproject.yang.compiler.utils.UtilConstants.ABSTRACT_EVENT;
+import static org.onosproject.yang.compiler.utils.UtilConstants.BUILDER;
+import static org.onosproject.yang.compiler.utils.UtilConstants.CLASS;
+import static org.onosproject.yang.compiler.utils.UtilConstants.COMMA;
+import static org.onosproject.yang.compiler.utils.UtilConstants.COMPARABLE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.DEFAULT_CAPS;
+import static org.onosproject.yang.compiler.utils.UtilConstants.EMPTY_STRING;
+import static org.onosproject.yang.compiler.utils.UtilConstants.ENUM;
+import static org.onosproject.yang.compiler.utils.UtilConstants.ERROR_MSG_JAVA_IDENTITY;
+import static org.onosproject.yang.compiler.utils.UtilConstants.EVENT_LISTENER_STRING;
+import static org.onosproject.yang.compiler.utils.UtilConstants.EVENT_STRING;
+import static org.onosproject.yang.compiler.utils.UtilConstants.EVENT_TYPE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.EXTEND;
+import static org.onosproject.yang.compiler.utils.UtilConstants.FINAL;
+import static org.onosproject.yang.compiler.utils.UtilConstants.IMPLEMENTS;
+import static org.onosproject.yang.compiler.utils.UtilConstants.INTERFACE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.LISTENER_SERVICE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.NEW_LINE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.OPEN_CURLY_BRACKET;
+import static org.onosproject.yang.compiler.utils.UtilConstants.OP_PARAM;
+import static org.onosproject.yang.compiler.utils.UtilConstants.PERIOD;
+import static org.onosproject.yang.compiler.utils.UtilConstants.PUBLIC;
+import static org.onosproject.yang.compiler.utils.UtilConstants.REGEX_FOR_ANY_STRING_ENDING_WITH_SERVICE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.SERVICE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.SPACE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.STATIC;
+import static org.onosproject.yang.compiler.utils.UtilConstants.SUBJECT;
+import static org.onosproject.yang.compiler.utils.io.impl.YangIoUtils.getCapitalCase;
+import static org.onosproject.yang.compiler.utils.io.impl.YangIoUtils.trimAtLast;
+
+/**
+ * Represents generator for class definition of generated files.
+ */
+final class ClassDefinitionGenerator {
+
+    /**
+     * Creates an instance of class definition generator.
+     */
+    private ClassDefinitionGenerator() {
+    }
+
+    /**
+     * Based on the file type and the YANG name of the file, generate the class
+     * / interface definition start.
+     *
+     * @param genFileTypes generated file type
+     * @param yangName     class name
+     * @return class definition
+     */
+    static String generateClassDefinition(int genFileTypes, String yangName) {
+
+        /*
+         * Based on the file type and the YANG name of the file, generate the
+         * class / interface definition start.
+         */
+        switch (genFileTypes) {
+            case GENERATE_TYPEDEF_CLASS:
+            case GENERATE_UNION_CLASS:
+                return getTypeClassDefinition(yangName);
+            case GENERATE_ENUM_CLASS:
+                return getEnumClassDefinition(yangName);
+            default:
+                return null;
+        }
+    }
+
+    /**
+     * Based on the file type and the YANG name of the file, generate the class
+     * / interface definition start.
+     *
+     * @param genFileTypes generated file type
+     * @param yangName     class name
+     * @param curNode      current YANG node
+     * @return class definition
+     */
+    static String generateClassDefinition(int genFileTypes, String yangName,
+                                          YangNode curNode) {
+        /*
+         * Based on the file type and the YANG name of the file, generate the
+         * class / interface definition start.
+         */
+        switch (genFileTypes) {
+            case INTERFACE_MASK:
+                return getInterfaceDefinition(yangName, curNode);
+            case BUILDER_CLASS_MASK:
+                return getBuilderClassDefinition(yangName, curNode);
+            case DEFAULT_CLASS_MASK:
+                return getImplClassDefinition(yangName, curNode);
+            case BUILDER_INTERFACE_MASK:
+                return getBuilderInterfaceDefinition(yangName, curNode);
+            case GENERATE_SERVICE_AND_MANAGER:
+                return getRpcInterfaceDefinition(yangName, curNode);
+            case GENERATE_EVENT_CLASS:
+                String eventName = yangName + SUBJECT;
+                return getEventDefinition(yangName, eventName);
+            case GENERATE_EVENT_LISTENER_INTERFACE:
+                return getEventListenerDefinition(yangName);
+            case GENERATE_KEY_CLASS:
+                return getKeyClassDefinition(yangName);
+            case GENERATE_EVENT_SUBJECT_CLASS:
+                return getClassDefinition(yangName);
+            case GENERATE_IDENTITY_CLASS:
+                return getIdentityClassDefinition(yangName, curNode);
+            default:
+                return null;
+        }
+    }
+
+    /**
+     * Returns enum file class definition.
+     *
+     * @param yangName class name
+     * @return enum file class definition
+     */
+    private static String getEnumClassDefinition(String yangName) {
+        return getDefaultDefinition(ENUM, yangName, PUBLIC);
+    }
+
+    /**
+     * Returns interface file class definition.
+     *
+     * @param yangName file name
+     * @return definition
+     */
+    private static String getInterfaceDefinition(String yangName,
+                                                 YangNode curNode) {
+
+        String clsDef = getClassDefinitionForWhenExtended(curNode, yangName,
+                                                          INTERFACE_MASK);
+        if (clsDef != null) {
+            return clsDef;
+        }
+        return getDefaultDefinition(INTERFACE, yangName, PUBLIC);
+    }
+
+    /**
+     * Returns builder interface file class definition.
+     *
+     * @param yangName java class name, corresponding to which the builder
+     *                 class is being generated
+     * @return definition
+     */
+    private static String getBuilderInterfaceDefinition(String yangName,
+                                                        YangNode curNode) {
+        if (!(curNode instanceof YangCase) &&
+                !(curNode instanceof YangAugment)) {
+            String clsDef = getClassDefinitionForWhenExtended(
+                    curNode, yangName, BUILDER_INTERFACE_MASK);
+            if (clsDef != null) {
+                return clsDef;
+            }
+        }
+        return getDefaultDefinition(INTERFACE, getSuffixedName(yangName, BUILDER),
+                                    null);
+    }
+
+    /**
+     * Returns builder file class definition.
+     *
+     * @param yangName file name
+     * @return definition
+     */
+    private static String getBuilderClassDefinition(String yangName,
+                                                    YangNode curNode) {
+        String mod = getSpecificModifier(PUBLIC, STATIC);
+        String bName = getSuffixedName(yangName, BUILDER);
+        if (!(curNode instanceof YangCase)) {
+            String clsDef = getClassDefinitionForWhenExtended(curNode, yangName,
+                                                              BUILDER_CLASS_MASK);
+            if (clsDef != null) {
+                return clsDef;
+            }
+        }
+        return getDefaultDefinitionWithImpl(CLASS, bName, mod,
+                                            getBuilderImplStringClassDef(yangName));
+    }
+
+    /**
+     * Returns impl file class definition.
+     *
+     * @param yangName file name
+     * @return definition
+     */
+    private static String getImplClassDefinition(String yangName,
+                                                 YangNode curNode) {
+        if (!(curNode instanceof YangCase)) {
+            String clsDef = getClassDefinitionForWhenExtended(
+                    curNode, yangName, DEFAULT_CLASS_MASK);
+            if (clsDef != null) {
+                return clsDef;
+            }
+        }
+        if (curNode instanceof RpcNotificationContainer) {
+            return getDefaultDefinitionWithImpl(
+                    CLASS, getSuffixedName(yangName, OP_PARAM), PUBLIC, yangName);
+        }
+        return getDefaultDefinitionWithImpl(CLASS, getDefaultName(yangName),
+                                            PUBLIC, yangName);
+    }
+
+    /**
+     * Returns impl file class definition.
+     *
+     * @param yangName file name
+     * @return definition
+     */
+    private static String getClassDefinition(String yangName) {
+        return getDefaultDefinition(CLASS, yangName, PUBLIC);
+    }
+
+    /**
+     * Returns impl file class definition.
+     *
+     * @param yangName file name
+     * @return definition
+     */
+    private static String getKeyClassDefinition(String yangName) {
+        String compareName = COMPARABLE + brackets(
+                OPEN_CLOSE_DIAMOND_WITH_VALUE, yangName, null);
+        return getDefinitionWithImplements(CLASS, yangName, PUBLIC, compareName);
+    }
+
+    /**
+     * Returns implementation file identity class definition.
+     *
+     * @param yangName file name
+     * @return identity class definition
+     */
+    private static String getIdentityClassDefinition(String yangName, YangNode curNode) {
+        String error = getErrorMsg(ERROR_MSG_JAVA_IDENTITY, curNode.getName(),
+                                   curNode.getLineNumber(), curNode
+                                           .getCharPosition(), curNode
+                                           .getFileName());
+        if (!(curNode instanceof YangIdentity)) {
+            throw new TranslatorException(error);
+        }
+        YangIdentity identity = (YangIdentity) curNode;
+        String mod = getSpecificModifier(PUBLIC, ABSTRACT);
+        if (identity.getBaseNode() != null) {
+            YangIdentity baseIdentity = identity.getBaseNode().getReferredIdentity();
+            if (baseIdentity == null) {
+                throw new TranslatorException(error);
+            }
+
+            JavaFileInfoTranslator fileInfo = ((JavaFileInfoContainer) baseIdentity)
+                    .getJavaFileInfo();
+            return getDefaultDefinitionWithExtends(
+                    CLASS, yangName, mod, getCapitalCase(fileInfo.getJavaName()));
+        }
+        return getDefaultDefinition(CLASS, yangName, mod);
+    }
+
+    /**
+     * Returns type file class definition.
+     *
+     * @param yangName file name
+     * @return definition
+     */
+    private static String getTypeClassDefinition(String yangName) {
+        return getDefaultDefinition(CLASS, yangName,
+                                    getSpecificModifier(PUBLIC, FINAL));
+    }
+
+    /**
+     * Returns RPC file interface definition.
+     *
+     * @param yangName file name
+     * @param curNode  current YANG node
+     * @return definition
+     */
+    private static String getRpcInterfaceDefinition(String yangName, YangNode curNode) {
+        JavaExtendsListHolder holder = ((TempJavaCodeFragmentFilesContainer) curNode)
+                .getTempJavaCodeFragmentFiles().getServiceTempFiles()
+                .getJavaExtendsListHolder();
+        if (holder.getExtendsList() != null && !holder.getExtendsList().isEmpty()) {
+            curNode = curNode.getChild();
+            while (curNode != null) {
+                if (curNode instanceof YangNotification) {
+                    return getRpcInterfaceDefinitionWhenItExtends(yangName);
+                }
+                curNode = curNode.getNextSibling();
+            }
+        }
+        if (yangName.matches(REGEX_FOR_ANY_STRING_ENDING_WITH_SERVICE)) {
+            return getDefaultDefinition(INTERFACE, yangName, PUBLIC);
+        }
+        String name = getSuffixedName(
+                yangName.substring(0, yangName.length() - 7), SERVICE);
+        return getDefaultDefinitionWithImpl(CLASS, yangName, PUBLIC, name);
+    }
+
+    /* Provides class definition when RPC interface needs to extends any event.*/
+    private static String getRpcInterfaceDefinitionWhenItExtends(String yangName) {
+
+        StringBuilder newString = new StringBuilder(yangName);
+        newString.replace(yangName.lastIndexOf(SERVICE), yangName
+                .lastIndexOf(SERVICE) + 7, EMPTY_STRING);
+        return getDefaultDefinitionWithExtends(
+                INTERFACE, yangName, PUBLIC, getEventExtendsString(
+                        getSuffixedName(newString.toString(), EVENT_STRING),
+                        LISTENER_SERVICE, getSuffixedName(newString.toString(),
+                                                          EVENT_LISTENER_STRING)));
+    }
+
+    /**
+     * Returns event class definition.
+     *
+     * @param javaName file name
+     * @return definition
+     */
+    private static String getEventDefinition(String javaName, String eventName) {
+        return getDefaultDefinitionWithExtends(
+                CLASS, javaName, PUBLIC, getEventExtendsString(
+                        getSuffixedName(javaName, EVENT_TYPE), ABSTRACT_EVENT,
+                        eventName));
+    }
+
+    /**
+     * Returns event listener interface definition.
+     *
+     * @param javaName file name
+     * @return definition
+     */
+    private static String getEventListenerDefinition(String javaName) {
+
+        String name = javaName.substring(0, javaName.length() - 8);
+        return getDefaultDefinitionWithExtends(
+                INTERFACE, javaName, PUBLIC, EVENT_LISTENER_STRING +
+                        brackets(OPEN_CLOSE_DIAMOND_WITH_VALUE, name, null));
+    }
+
+    /**
+     * Returns class definition when class is extending another class.
+     *
+     * @param curNode      current node
+     * @param yangName     name
+     * @param genFileTypes gen file type
+     * @return class definition
+     */
+    private static String getClassDefinitionForWhenExtended(
+            YangNode curNode, String yangName, int genFileTypes) {
+        JavaExtendsListHolder holder = ((TempJavaCodeFragmentFilesContainer) curNode)
+                .getTempJavaCodeFragmentFiles().getBeanTempFiles()
+                .getJavaExtendsListHolder();
+        StringBuilder def = new StringBuilder();
+        if (holder.getExtendsList() != null && !holder.getExtendsList().isEmpty()) {
+            def.append(PUBLIC).append(SPACE);
+            switch (genFileTypes) {
+                case INTERFACE_MASK:
+                    def.append(INTERFACE).append(SPACE).append(yangName)
+                            .append(SPACE).append(EXTEND).append(SPACE);
+                    def = new StringBuilder(getDefinitionString(def.toString(),
+                                                                holder));
+                    break;
+                case BUILDER_INTERFACE_MASK:
+                    def.append(INTERFACE)
+                            .append(SPACE).append(yangName).append(BUILDER)
+                            .append(SPACE).append(EXTEND).append(SPACE);
+                    def = new StringBuilder(getDefinitionString(
+                            def.toString(), holder));
+                    break;
+                case BUILDER_CLASS_MASK:
+                    def.append(STATIC).append(SPACE).append(CLASS)
+                            .append(SPACE).append(yangName).append(BUILDER)
+                            .append(SPACE).append(EXTEND).append(SPACE);
+                    def = new StringBuilder(getDefinitionString(def.toString(),
+                                                                holder));
+                    def.append(SPACE).append(IMPLEMENTS).append(SPACE)
+                            .append(yangName).append(PERIOD)
+                            .append(yangName).append(BUILDER);
+                    break;
+                case DEFAULT_CLASS_MASK:
+                    if (curNode instanceof RpcNotificationContainer) {
+                        def.append(CLASS).append(SPACE).append(yangName)
+                                .append(OP_PARAM).append(SPACE).append(EXTEND)
+                                .append(SPACE);
+                    } else {
+                        def.append(CLASS).append(SPACE).append(DEFAULT_CAPS)
+                                .append(yangName).append(SPACE).append(EXTEND)
+                                .append(SPACE);
+                    }
+                    def = new StringBuilder(getDefinitionString(def.toString(),
+                                                                holder));
+                    def.append(SPACE).append(IMPLEMENTS).append(SPACE)
+                            .append(yangName);
+                    break;
+                default:
+                    return null;
+            }
+            return def.append(SPACE).append(OPEN_CURLY_BRACKET)
+                    .append(NEW_LINE).toString();
+        }
+        return null;
+    }
+
+    /**
+     * Returns updated class definition.
+     *
+     * @param def    current definition
+     * @param holder extend list holder
+     * @return updated class definition
+     */
+    private static String getDefinitionString(String def,
+                                              JavaExtendsListHolder holder) {
+        StringBuilder builder = new StringBuilder(def);
+        String str;
+        for (JavaQualifiedTypeInfoTranslator info : holder.getExtendsList()) {
+            if (!holder.getExtendedClassStore().get(info)) {
+                str = info.getClassInfo() + COMMA + SPACE;
+            } else {
+                str = info.getPkgInfo() + PERIOD + info.getClassInfo() +
+                        COMMA + SPACE;
+            }
+            builder.append(str);
+        }
+        def = builder.toString();
+        return trimAtLast(def, COMMA);
+    }
+}
diff --git a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/utils/IndentationType.java b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/utils/IndentationType.java
new file mode 100644
index 0000000..0eb34af
--- /dev/null
+++ b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/utils/IndentationType.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.translator.tojava.utils;
+
+/**
+ * Represents indentation type.
+ */
+public enum IndentationType {
+
+    //Four space indentation.
+    FOUR_SPACE,
+
+    //Eight space indentation.
+    EIGHT_SPACE,
+
+    //Twelve space indentation.
+    TWELVE_SPACE,
+
+    //Sixteen space indentation.
+    SIXTEEN_SPACE,
+
+    //Twenty space indentation.
+    TWENTY_SPACE,
+
+    //Twenty four space indentation.
+    TWENTY_FOUR_SPACE,
+
+    //Twenty eight space indentation.
+    TWENTY_EIGHT_SPACE
+
+}
diff --git a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/utils/JavaCodeSnippetGen.java b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/utils/JavaCodeSnippetGen.java
new file mode 100644
index 0000000..810123c
--- /dev/null
+++ b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/utils/JavaCodeSnippetGen.java
@@ -0,0 +1,453 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.translator.tojava.utils;
+
+import org.onosproject.yang.compiler.datamodel.YangCompilerAnnotation;
+import org.onosproject.yang.compiler.datamodel.YangDataStructure;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.translator.exception.TranslatorException;
+import org.onosproject.yang.compiler.translator.tojava.JavaCodeGeneratorInfo;
+import org.onosproject.yang.compiler.translator.tojava.JavaQualifiedTypeInfoTranslator;
+import org.onosproject.yang.compiler.translator.tojava.TempJavaServiceFragmentFiles;
+import org.onosproject.yang.compiler.utils.UtilConstants.Operation;
+
+import java.util.List;
+
+import static java.util.Collections.sort;
+import static org.onosproject.yang.compiler.translator.tojava.utils.JavaIdentifierSyntax.getEnumJavaAttribute;
+import static org.onosproject.yang.compiler.translator.tojava.utils.MethodsGenerator.getYangDataStructure;
+import static org.onosproject.yang.compiler.translator.tojava.utils.StringGenerator.getDefaultDefinition;
+import static org.onosproject.yang.compiler.translator.tojava.utils.StringGenerator.getImportString;
+import static org.onosproject.yang.compiler.translator.tojava.utils.StringGenerator.getOpenCloseParaWithValue;
+import static org.onosproject.yang.compiler.translator.tojava.utils.StringGenerator.signatureClose;
+import static org.onosproject.yang.compiler.utils.UtilConstants.BIT_SET;
+import static org.onosproject.yang.compiler.utils.UtilConstants.COMMA;
+import static org.onosproject.yang.compiler.utils.UtilConstants.DIAMOND_CLOSE_BRACKET;
+import static org.onosproject.yang.compiler.utils.UtilConstants.DIAMOND_OPEN_BRACKET;
+import static org.onosproject.yang.compiler.utils.UtilConstants.EIGHT_SPACE_INDENTATION;
+import static org.onosproject.yang.compiler.utils.UtilConstants.EMPTY_STRING;
+import static org.onosproject.yang.compiler.utils.UtilConstants.ENUM;
+import static org.onosproject.yang.compiler.utils.UtilConstants.EQUAL;
+import static org.onosproject.yang.compiler.utils.UtilConstants.FOUR_SPACE_INDENTATION;
+import static org.onosproject.yang.compiler.utils.UtilConstants.HASH_MAP;
+import static org.onosproject.yang.compiler.utils.UtilConstants.INT;
+import static org.onosproject.yang.compiler.utils.UtilConstants.INT_MAX_RANGE_ATTR;
+import static org.onosproject.yang.compiler.utils.UtilConstants.INT_MIN_RANGE_ATTR;
+import static org.onosproject.yang.compiler.utils.UtilConstants.KEYS;
+import static org.onosproject.yang.compiler.utils.UtilConstants.LIST;
+import static org.onosproject.yang.compiler.utils.UtilConstants.LONG_MAX_RANGE_ATTR;
+import static org.onosproject.yang.compiler.utils.UtilConstants.LONG_MIN_RANGE_ATTR;
+import static org.onosproject.yang.compiler.utils.UtilConstants.MAP;
+import static org.onosproject.yang.compiler.utils.UtilConstants.NEW;
+import static org.onosproject.yang.compiler.utils.UtilConstants.NEW_LINE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.OPEN_CLOSE_BRACKET_STRING;
+import static org.onosproject.yang.compiler.utils.UtilConstants.OPEN_CLOSE_DIAMOND_STRING;
+import static org.onosproject.yang.compiler.utils.UtilConstants.PERIOD;
+import static org.onosproject.yang.compiler.utils.UtilConstants.PRIVATE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.PUBLIC;
+import static org.onosproject.yang.compiler.utils.UtilConstants.QUEUE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.QUOTES;
+import static org.onosproject.yang.compiler.utils.UtilConstants.SCHEMA_NAME;
+import static org.onosproject.yang.compiler.utils.UtilConstants.SELECT_LEAF;
+import static org.onosproject.yang.compiler.utils.UtilConstants.SEMI_COLON;
+import static org.onosproject.yang.compiler.utils.UtilConstants.SET;
+import static org.onosproject.yang.compiler.utils.UtilConstants.SET_VALUE_PARA;
+import static org.onosproject.yang.compiler.utils.UtilConstants.SHORT_MAX_RANGE_ATTR;
+import static org.onosproject.yang.compiler.utils.UtilConstants.SHORT_MIN_RANGE_ATTR;
+import static org.onosproject.yang.compiler.utils.UtilConstants.SPACE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.STRING_DATA_TYPE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.TYPE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.UINT8_MAX_RANGE_ATTR;
+import static org.onosproject.yang.compiler.utils.UtilConstants.UINT8_MIN_RANGE_ATTR;
+import static org.onosproject.yang.compiler.utils.UtilConstants.UINT_MAX_RANGE_ATTR;
+import static org.onosproject.yang.compiler.utils.UtilConstants.UINT_MIN_RANGE_ATTR;
+import static org.onosproject.yang.compiler.utils.UtilConstants.ULONG_MAX_RANGE_ATTR;
+import static org.onosproject.yang.compiler.utils.UtilConstants.ULONG_MIN_RANGE_ATTR;
+import static org.onosproject.yang.compiler.utils.UtilConstants.VALUE_LEAF;
+import static org.onosproject.yang.compiler.utils.UtilConstants.YANG_AUGMENTED_INFO_MAP;
+import static org.onosproject.yang.compiler.utils.io.impl.JavaDocGen.JavaDocType.ENUM_ATTRIBUTE;
+import static org.onosproject.yang.compiler.utils.io.impl.JavaDocGen.enumJavaDocForInnerClass;
+import static org.onosproject.yang.compiler.utils.io.impl.JavaDocGen.getJavaDoc;
+import static org.onosproject.yang.compiler.utils.io.impl.YangIoUtils.trimAtLast;
+
+/**
+ * Represents utility class to generate the java snippet.
+ */
+public final class JavaCodeSnippetGen {
+
+    // No instantiation.
+    private JavaCodeSnippetGen() {
+    }
+
+    /**
+     * Returns the java file header comment.
+     *
+     * @return the java file header comment
+     */
+    public static String getFileHeaderComment() {
+
+        /*
+         * TODO return the file header.
+         */
+        return null;
+    }
+
+    /**
+     * Returns the textual java code information corresponding to the import
+     * list.
+     *
+     * @param importInfo import info
+     * @return the textual java code information corresponding to the import
+     * list
+     */
+    static String getImportText(JavaQualifiedTypeInfoTranslator importInfo) {
+        return getImportString(importInfo.getPkgInfo(), importInfo
+                .getClassInfo());
+    }
+
+    /**
+     * Returns the textual java code for attribute definition in class.
+     *
+     * @param typePkg    Package of the attribute type
+     * @param attrType   java attribute type
+     * @param attrName   name of the attribute
+     * @param isList     is list attribute
+     * @param accessType attribute access type
+     * @param annotation compiler annotation
+     * @return the textual java code for attribute definition in class
+     */
+    public static String getJavaAttributeDefinition(String typePkg,
+                                                    String attrType,
+                                                    String attrName,
+                                                    boolean isList,
+                                                    String accessType,
+                                                    YangCompilerAnnotation annotation) {
+        StringBuilder attrDef = new StringBuilder(FOUR_SPACE_INDENTATION);
+        attrDef.append(accessType).append(SPACE);
+
+        if (!isList) {
+            if (typePkg != null) {
+                attrDef.append(typePkg).append(PERIOD);
+            }
+
+            attrDef.append(attrType).append(SPACE)
+                    .append(attrName);
+            //Initialize select leaf/value leaf/ augment map attribute.
+            if (attrName.equals(SELECT_LEAF) || attrName.equals(VALUE_LEAF)) {
+                attrDef.append(SPACE).append(EQUAL).append(SPACE).append(NEW)
+                        .append(SPACE).append(BIT_SET)
+                        .append(OPEN_CLOSE_BRACKET_STRING);
+            } else if (attrName.equals(YANG_AUGMENTED_INFO_MAP)) {
+                attrDef.append(SPACE).append(EQUAL).append(SPACE).append(NEW)
+                        .append(SPACE).append(HASH_MAP)
+                        .append(OPEN_CLOSE_DIAMOND_STRING)
+                        .append(OPEN_CLOSE_BRACKET_STRING);
+            }
+
+            attrDef.append(signatureClose());
+        } else {
+            StringBuilder type = new StringBuilder();
+            if (typePkg != null) {
+                type.append(typePkg).append(PERIOD);
+            }
+
+            type.append(attrType);
+
+            // Add starting definition.
+            addAttrStartDef(annotation, attrDef, type.toString());
+
+            // Add ending definition.
+            addAttrEndDef(attrDef, attrName);
+        }
+        return attrDef.toString();
+    }
+
+    /**
+     * Adds starting attribute definition.
+     *
+     * @param annotation compiler annotation
+     * @param attrDef    JAVA attribute definition
+     * @param type       attr type
+     */
+    private static void addAttrStartDef(YangCompilerAnnotation annotation,
+                                        StringBuilder attrDef, String type) {
+        YangDataStructure ds = getYangDataStructure(annotation);
+        if (ds != null) {
+            switch (ds) {
+                case QUEUE: {
+                    attrDef.append(QUEUE)
+                            .append(DIAMOND_OPEN_BRACKET);
+                    break;
+                }
+                case SET: {
+                    attrDef.append(SET)
+                            .append(DIAMOND_OPEN_BRACKET);
+                    break;
+                }
+                case MAP:
+                    attrDef.append(MAP).append(DIAMOND_OPEN_BRACKET)
+                            .append(type).append(KEYS).append(COMMA);
+                    break;
+                default: {
+                    attrDef.append(LIST)
+                            .append(DIAMOND_OPEN_BRACKET);
+                }
+            }
+        } else {
+            attrDef.append(LIST).append(DIAMOND_OPEN_BRACKET);
+        }
+        attrDef.append(type);
+    }
+
+    /**
+     * Adds ending attribute definition.
+     *
+     * @param attrDef  JAVA attribute definition
+     * @param attrName name of attribute
+     */
+    private static void addAttrEndDef(StringBuilder attrDef, String attrName) {
+        attrDef.append(DIAMOND_CLOSE_BRACKET).append(SPACE)
+                .append(attrName).append(signatureClose());
+    }
+
+    /**
+     * Returns string for enum's attribute.
+     *
+     * @param name  name of attribute
+     * @param value value of the enum
+     * @return string for enum's attribute
+     */
+    public static String generateEnumAttributeString(String name, int value) {
+        String enumName = getEnumJavaAttribute(name);
+        return enumJavaDocForInnerClass(name) + EIGHT_SPACE_INDENTATION +
+                enumName.toUpperCase() + getOpenCloseParaWithValue(
+                value + EMPTY_STRING) + COMMA + NEW_LINE;
+    }
+
+    /**
+     * Returns string for enum's attribute for enum class.
+     *
+     * @param name  name of attribute
+     * @param value value of the enum
+     * @return string for enum's attribute
+     */
+    public static String generateEnumAttributeStringWithSchemaName(
+            String name, int value) {
+        String enumName = getEnumJavaAttribute(name);
+        String str = value + COMMA + SPACE + QUOTES + name + QUOTES;
+        return getJavaDoc(ENUM_ATTRIBUTE, name, false, null) +
+                FOUR_SPACE_INDENTATION + enumName.toUpperCase() +
+                getOpenCloseParaWithValue(str) + COMMA + NEW_LINE;
+    }
+
+    /**
+     * Returns sorted import list.
+     *
+     * @param imports import list
+     * @return sorted import list
+     */
+    public static List<String> sortImports(List<String> imports) {
+        sort(imports);
+        return imports;
+    }
+
+    /**
+     * Returns event enum start.
+     *
+     * @return event enum start
+     */
+    static String getEventEnumTypeStart() {
+        return NEW_LINE + FOUR_SPACE_INDENTATION +
+                getDefaultDefinition(ENUM, TYPE, PUBLIC);
+    }
+
+    /**
+     * Adds listener's imports.
+     *
+     * @param curNode   currentYangNode.
+     * @param imports   import list
+     * @param operation add or remove
+     */
+    public static void addListenersImport(YangNode curNode,
+                                          List<String> imports,
+                                          Operation operation) {
+        String thisImport;
+        TempJavaServiceFragmentFiles tempFiles =
+                ((JavaCodeGeneratorInfo) curNode).getTempJavaCodeFragmentFiles()
+                        .getServiceTempFiles();
+        thisImport = tempFiles.getJavaImportData().getListenerServiceImport();
+        performOperationOnImports(imports, thisImport, operation);
+    }
+
+    /**
+     * Performs given operations on import list.
+     *
+     * @param imports   list of imports
+     * @param curImport current import
+     * @param operation ADD or REMOVE
+     * @return import list
+     */
+    private static List<String> performOperationOnImports(List<String> imports,
+                                                          String curImport,
+                                                          Operation operation) {
+        switch (operation) {
+            case ADD:
+                imports.add(curImport);
+                break;
+            case REMOVE:
+                imports.remove(curImport);
+                break;
+            default:
+                throw new TranslatorException("Invalid operation type");
+        }
+        sortImports(imports);
+        return imports;
+    }
+
+    /**
+     * Returns integer attribute for enum's class to get the values.
+     *
+     * @param className enum's class name
+     * @return enum's attribute
+     */
+    static String getEnumsValueAttribute(String className) {
+        return getJavaAttributeDefinition(null, INT, className,
+                                          false, PRIVATE, null) +
+                getJavaAttributeDefinition(null, STRING_DATA_TYPE, SCHEMA_NAME,
+                                           false, PRIVATE, null) + NEW_LINE;
+    }
+
+    /**
+     * Adds attribute for int ranges.
+     *
+     * @param modifier modifier for attribute
+     * @param addFirst true if int need to be added fist.
+     * @return attribute for int ranges
+     */
+    static String addStaticAttributeIntRange(String modifier,
+                                             boolean addFirst) {
+        if (addFirst) {
+            return getTypeConflictAttributeStrings(modifier,
+                                                   INT_MIN_RANGE_ATTR,
+                                                   INT_MAX_RANGE_ATTR);
+        }
+        return getTypeConflictAttributeStrings(modifier,
+                                               UINT_MIN_RANGE_ATTR,
+                                               UINT_MAX_RANGE_ATTR);
+    }
+
+    /**
+     * Adds attribute for long ranges.
+     *
+     * @param modifier modifier for attribute
+     * @param addFirst if need to be added first
+     * @return attribute for long ranges
+     */
+    static String addStaticAttributeLongRange(String modifier,
+                                              boolean addFirst) {
+        if (addFirst) {
+            return getTypeConflictAttributeStrings(modifier,
+                                                   LONG_MIN_RANGE_ATTR,
+                                                   LONG_MAX_RANGE_ATTR);
+        }
+        return getTypeConflictAttributeStrings(modifier,
+                                               ULONG_MIN_RANGE_ATTR,
+                                               ULONG_MAX_RANGE_ATTR);
+    }
+
+    /**
+     * Adds attribute for long ranges.
+     *
+     * @param modifier modifier for attribute
+     * @param addFirst if need to be added first
+     * @return attribute for long ranges
+     */
+    static String addStaticAttributeShortRange(String modifier,
+                                               boolean addFirst) {
+        if (addFirst) {
+            return getTypeConflictAttributeStrings(modifier,
+                                                   SHORT_MIN_RANGE_ATTR,
+                                                   SHORT_MAX_RANGE_ATTR);
+        }
+        return getTypeConflictAttributeStrings(modifier,
+                                               UINT8_MIN_RANGE_ATTR,
+                                               UINT8_MAX_RANGE_ATTR);
+    }
+
+    /**
+     * Returns attribute for conflicting type in union.
+     *
+     * @param modifier modifier
+     * @param attr1    attribute one
+     * @param att2     attribute two
+     * @return attribute for conflicting type in union
+     */
+    private static String getTypeConflictAttributeStrings(String modifier,
+                                                          String attr1,
+                                                          String att2) {
+        return FOUR_SPACE_INDENTATION + modifier + SPACE +
+                attr1 + FOUR_SPACE_INDENTATION + modifier +
+                SPACE + att2 + NEW_LINE;
+    }
+
+    /**
+     * Returns operation type enum.
+     *
+     * @return operation type enum
+     */
+    static String getOperationTypeEnum() {
+        return "    /**\n" +
+                "     * Specify the node specific operation in protocols " +
+                "like NETCONF.\n" +
+                "     * Applicable in protocol edit operation, not applicable" +
+                " in query operation\n" +
+                "     */\n" +
+                "    public static enum OnosYangOpType {\n" +
+                "        MERGE,\n" +
+                "        REPLACE,\n" +
+                "        CREATE,\n" +
+                "        DELETE,\n" +
+                "        REMOVE,\n" +
+                "        NONE\n" +
+                "    }\n";
+    }
+
+    /**
+     * Returns attribute in constructor for yang augmented info map.
+     *
+     * @return augment info map
+     */
+    static String getYangAugmentedMapObjectForConstruct() {
+        return "        this.yangAugmentedInfoMap = builderObject" +
+                ".yangAugmentedInfoMap();\n";
+    }
+
+    /**
+     * Returns set value parameter for union class.
+     *
+     * @return set value parameter for union class.
+     */
+    static String getSetValueParaForUnionClass() {
+        String[] array = {NEW_LINE, SEMI_COLON};
+        return new StringBuilder().append(trimAtLast(
+                getJavaAttributeDefinition(null, BIT_SET, SET_VALUE_PARA,
+                                           false, PRIVATE, null), array))
+                .append(SPACE).append(EQUAL).append(SPACE).append(NEW)
+                .append(SPACE).append(BIT_SET).append(OPEN_CLOSE_BRACKET_STRING)
+                .append(signatureClose()).toString();
+    }
+}
diff --git a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/utils/JavaExtendsListHolder.java b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/utils/JavaExtendsListHolder.java
new file mode 100644
index 0000000..2ae1905
--- /dev/null
+++ b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/utils/JavaExtendsListHolder.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.yang.compiler.translator.tojava.utils;
+
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.translator.tojava.JavaFileInfoContainer;
+import org.onosproject.yang.compiler.translator.tojava.JavaFileInfoTranslator;
+import org.onosproject.yang.compiler.translator.tojava.JavaImportData;
+import org.onosproject.yang.compiler.translator.tojava.JavaQualifiedTypeInfoTranslator;
+import org.onosproject.yang.compiler.translator.tojava.TempJavaFragmentFiles;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import static org.onosproject.yang.compiler.utils.io.impl.YangIoUtils.getCapitalCase;
+
+/**
+ * Represent the extends list for generated java classes. It holds the class details which needs to be extended by the
+ * generated java code.
+ */
+public class JavaExtendsListHolder {
+
+    private Map<JavaQualifiedTypeInfoTranslator, Boolean> extendedClassStore;
+    private List<JavaQualifiedTypeInfoTranslator> extendsList;
+
+    /**
+     * Creates an instance of JavaExtendsListHolder.
+     */
+    public JavaExtendsListHolder() {
+        setExtendedClassStore(new HashMap<>());
+        setExtendsList(new ArrayList<>());
+    }
+
+    /**
+     * Returns extends list.
+     *
+     * @return extends list
+     */
+    Map<JavaQualifiedTypeInfoTranslator, Boolean> getExtendedClassStore() {
+        return extendedClassStore;
+    }
+
+    /**
+     * Sets extends list.
+     *
+     * @param extendedClass map of classes need to be extended
+     */
+    private void setExtendedClassStore(Map<JavaQualifiedTypeInfoTranslator, Boolean> extendedClass) {
+        extendedClassStore = extendedClass;
+    }
+
+    /**
+     * Adds to the extends list.
+     *
+     * @param info                  java file info
+     * @param node                  YANG node
+     * @param tempJavaFragmentFiles temp java fragment files
+     */
+    public void addToExtendsList(JavaQualifiedTypeInfoTranslator info, YangNode node,
+                                 TempJavaFragmentFiles tempJavaFragmentFiles) {
+        JavaFileInfoTranslator fileInfo = ((JavaFileInfoContainer) node).getJavaFileInfo();
+
+        JavaImportData importData = tempJavaFragmentFiles.getJavaImportData();
+        boolean qualified = importData.addImportInfo(info,
+                                                     getCapitalCase(fileInfo.getJavaName()), fileInfo.getPackage());
+
+            /*true means import should be added*/
+        getExtendedClassStore().put(info, qualified);
+
+        addToExtendsList(info);
+    }
+
+    /**
+     * Returns extends list.
+     *
+     * @return the extendsList
+     */
+    public List<JavaQualifiedTypeInfoTranslator> getExtendsList() {
+        return extendsList;
+    }
+
+    /**
+     * Sets extends info list.
+     *
+     * @param classInfoList the extends List to set
+     */
+    private void setExtendsList(List<JavaQualifiedTypeInfoTranslator> classInfoList) {
+        extendsList = classInfoList;
+    }
+
+    /**
+     * Adds extends info to list.
+     *
+     * @param classInfo class info
+     */
+    private void addToExtendsList(JavaQualifiedTypeInfoTranslator classInfo) {
+        getExtendsList().add(classInfo);
+    }
+}
diff --git a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/utils/JavaFileGenerator.java b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/utils/JavaFileGenerator.java
new file mode 100644
index 0000000..546ed05
--- /dev/null
+++ b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/utils/JavaFileGenerator.java
@@ -0,0 +1,1308 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.translator.tojava.utils;
+
+import org.onosproject.yang.compiler.datamodel.RpcNotificationContainer;
+import org.onosproject.yang.compiler.datamodel.YangAugmentableNode;
+import org.onosproject.yang.compiler.datamodel.YangChoice;
+import org.onosproject.yang.compiler.datamodel.YangEnumeration;
+import org.onosproject.yang.compiler.datamodel.YangLeavesHolder;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangType;
+import org.onosproject.yang.compiler.datamodel.YangTypeDef;
+import org.onosproject.yang.compiler.datamodel.YangUnion;
+import org.onosproject.yang.compiler.translator.tojava.JavaAttributeInfo;
+import org.onosproject.yang.compiler.translator.tojava.JavaCodeGeneratorInfo;
+import org.onosproject.yang.compiler.translator.tojava.JavaFileInfoContainer;
+import org.onosproject.yang.compiler.translator.tojava.JavaFileInfoTranslator;
+import org.onosproject.yang.compiler.translator.tojava.JavaImportData;
+import org.onosproject.yang.compiler.translator.tojava.JavaQualifiedTypeInfoTranslator;
+import org.onosproject.yang.compiler.translator.tojava.TempJavaCodeFragmentFilesContainer;
+import org.onosproject.yang.compiler.translator.tojava.TempJavaEnumerationFragmentFiles;
+import org.onosproject.yang.compiler.translator.tojava.TempJavaEventFragmentFiles;
+import org.onosproject.yang.compiler.translator.tojava.TempJavaServiceFragmentFiles;
+import org.onosproject.yang.compiler.translator.tojava.TempJavaTypeFragmentFiles;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import static java.util.Collections.sort;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedJavaFileType.BUILDER_CLASS_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedJavaFileType.BUILDER_INTERFACE_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedJavaFileType.DEFAULT_CLASS_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedJavaFileType.GENERATE_ENUM_CLASS;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedJavaFileType.GENERATE_EVENT_CLASS;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedJavaFileType.GENERATE_EVENT_LISTENER_INTERFACE;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedJavaFileType.GENERATE_EVENT_SUBJECT_CLASS;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedJavaFileType.GENERATE_KEY_CLASS;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedJavaFileType.GENERATE_SERVICE_AND_MANAGER;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedJavaFileType.GENERATE_TYPEDEF_CLASS;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedJavaFileType.GENERATE_UNION_CLASS;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedJavaFileType.INTERFACE_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedTempFileType.ADD_TO_LIST_IMPL_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedTempFileType.ADD_TO_LIST_INTERFACE_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedTempFileType.ATTRIBUTES_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedTempFileType.CONSTRUCTOR_FOR_TYPE_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedTempFileType.CONSTRUCTOR_IMPL_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedTempFileType.ENUM_IMPL_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedTempFileType.EQUALS_IMPL_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedTempFileType.EVENT_ENUM_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedTempFileType.EVENT_METHOD_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedTempFileType.EVENT_SUBJECT_ATTRIBUTE_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedTempFileType.EVENT_SUBJECT_GETTER_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedTempFileType.EVENT_SUBJECT_SETTER_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedTempFileType.FROM_STRING_IMPL_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedTempFileType.GETTER_FOR_CLASS_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedTempFileType.GETTER_FOR_INTERFACE_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedTempFileType.HASH_CODE_IMPL_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedTempFileType.LEAF_IDENTIFIER_ENUM_ATTRIBUTES_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedTempFileType.OF_STRING_IMPL_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedTempFileType.RPC_INTERFACE_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedTempFileType.SETTER_FOR_CLASS_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedTempFileType.SETTER_FOR_INTERFACE_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedTempFileType.TO_STRING_IMPL_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.TempJavaFragmentFiles.getCurNodeAsAttributeInTarget;
+import static org.onosproject.yang.compiler.translator.tojava.TempJavaFragmentFiles.getListOfAttributesForKey;
+import static org.onosproject.yang.compiler.translator.tojava.YangJavaModelUtils.isGetSetOfRootNodeRequired;
+import static org.onosproject.yang.compiler.translator.tojava.utils.IndentationType.FOUR_SPACE;
+import static org.onosproject.yang.compiler.translator.tojava.utils.JavaCodeSnippetGen.addStaticAttributeIntRange;
+import static org.onosproject.yang.compiler.translator.tojava.utils.JavaCodeSnippetGen.addStaticAttributeLongRange;
+import static org.onosproject.yang.compiler.translator.tojava.utils.JavaCodeSnippetGen.addStaticAttributeShortRange;
+import static org.onosproject.yang.compiler.translator.tojava.utils.JavaCodeSnippetGen.getEnumsValueAttribute;
+import static org.onosproject.yang.compiler.translator.tojava.utils.JavaCodeSnippetGen.getEventEnumTypeStart;
+import static org.onosproject.yang.compiler.translator.tojava.utils.JavaCodeSnippetGen.getJavaAttributeDefinition;
+import static org.onosproject.yang.compiler.translator.tojava.utils.JavaCodeSnippetGen.getOperationTypeEnum;
+import static org.onosproject.yang.compiler.translator.tojava.utils.JavaCodeSnippetGen.getSetValueParaForUnionClass;
+import static org.onosproject.yang.compiler.translator.tojava.utils.JavaFileGeneratorUtils.getDataFromTempFileHandle;
+import static org.onosproject.yang.compiler.translator.tojava.utils.JavaFileGeneratorUtils.initiateJavaFileGeneration;
+import static org.onosproject.yang.compiler.translator.tojava.utils.MethodBodyTypes.ENUM_METHOD_INT_VALUE;
+import static org.onosproject.yang.compiler.translator.tojava.utils.MethodBodyTypes.ENUM_METHOD_STRING_VALUE;
+import static org.onosproject.yang.compiler.translator.tojava.utils.MethodsGenerator.builderMethod;
+import static org.onosproject.yang.compiler.translator.tojava.utils.MethodsGenerator.generateBuildMethodForSubTree;
+import static org.onosproject.yang.compiler.translator.tojava.utils.MethodsGenerator.getAddAugmentInfoMethodImpl;
+import static org.onosproject.yang.compiler.translator.tojava.utils.MethodsGenerator.getAddAugmentInfoMethodInterface;
+import static org.onosproject.yang.compiler.translator.tojava.utils.MethodsGenerator.getAugmentsDataMethodForService;
+import static org.onosproject.yang.compiler.translator.tojava.utils.MethodsGenerator.getBitSetEnumClassFromString;
+import static org.onosproject.yang.compiler.translator.tojava.utils.MethodsGenerator.getBitSetEnumClassToString;
+import static org.onosproject.yang.compiler.translator.tojava.utils.MethodsGenerator.getCompareToForKeyClass;
+import static org.onosproject.yang.compiler.translator.tojava.utils.MethodsGenerator.getConstructorStart;
+import static org.onosproject.yang.compiler.translator.tojava.utils.MethodsGenerator.getEnumsConstructor;
+import static org.onosproject.yang.compiler.translator.tojava.utils.MethodsGenerator.getEnumsOfValueMethod;
+import static org.onosproject.yang.compiler.translator.tojava.utils.MethodsGenerator.getEqualsMethod;
+import static org.onosproject.yang.compiler.translator.tojava.utils.MethodsGenerator.getEqualsMethodClose;
+import static org.onosproject.yang.compiler.translator.tojava.utils.MethodsGenerator.getEqualsMethodOpen;
+import static org.onosproject.yang.compiler.translator.tojava.utils.MethodsGenerator.getFromStringMethodClose;
+import static org.onosproject.yang.compiler.translator.tojava.utils.MethodsGenerator.getFromStringMethodSignature;
+import static org.onosproject.yang.compiler.translator.tojava.utils.MethodsGenerator.getGetter;
+import static org.onosproject.yang.compiler.translator.tojava.utils.MethodsGenerator.getGetterForClass;
+import static org.onosproject.yang.compiler.translator.tojava.utils.MethodsGenerator.getGetterString;
+import static org.onosproject.yang.compiler.translator.tojava.utils.MethodsGenerator.getHashCodeMethod;
+import static org.onosproject.yang.compiler.translator.tojava.utils.MethodsGenerator.getHashCodeMethodClose;
+import static org.onosproject.yang.compiler.translator.tojava.utils.MethodsGenerator.getHashCodeMethodOpen;
+import static org.onosproject.yang.compiler.translator.tojava.utils.MethodsGenerator.getInterfaceLeafIdEnumSignature;
+import static org.onosproject.yang.compiler.translator.tojava.utils.MethodsGenerator.getRangeValidatorMethodForUnion;
+import static org.onosproject.yang.compiler.translator.tojava.utils.MethodsGenerator.getSetterForClass;
+import static org.onosproject.yang.compiler.translator.tojava.utils.MethodsGenerator.getSetterForSelectLeaf;
+import static org.onosproject.yang.compiler.translator.tojava.utils.MethodsGenerator.getSetterString;
+import static org.onosproject.yang.compiler.translator.tojava.utils.MethodsGenerator.getToStringForEnumClass;
+import static org.onosproject.yang.compiler.translator.tojava.utils.MethodsGenerator.getToStringForType;
+import static org.onosproject.yang.compiler.translator.tojava.utils.MethodsGenerator.getToStringMethodClose;
+import static org.onosproject.yang.compiler.translator.tojava.utils.MethodsGenerator.getToStringMethodOpen;
+import static org.onosproject.yang.compiler.translator.tojava.utils.MethodsGenerator.getUnionToStringMethod;
+import static org.onosproject.yang.compiler.translator.tojava.utils.MethodsGenerator.getYangAugmentInfoImpl;
+import static org.onosproject.yang.compiler.translator.tojava.utils.MethodsGenerator.getYangAugmentInfoInterface;
+import static org.onosproject.yang.compiler.translator.tojava.utils.MethodsGenerator.isLeafValueSetInterface;
+import static org.onosproject.yang.compiler.translator.tojava.utils.MethodsGenerator.isSelectLeafSetInterface;
+import static org.onosproject.yang.compiler.translator.tojava.utils.MethodsGenerator.setSelectLeafSetInterface;
+import static org.onosproject.yang.compiler.translator.tojava.utils.StringGenerator.getImportString;
+import static org.onosproject.yang.compiler.translator.tojava.utils.StringGenerator.getInterfaceLeafIdEnumMethods;
+import static org.onosproject.yang.compiler.translator.tojava.utils.StringGenerator.getIsSelectLeafSet;
+import static org.onosproject.yang.compiler.translator.tojava.utils.StringGenerator.getIsValueLeafSet;
+import static org.onosproject.yang.compiler.translator.tojava.utils.StringGenerator.methodClose;
+import static org.onosproject.yang.compiler.translator.tojava.utils.StringGenerator.signatureClose;
+import static org.onosproject.yang.compiler.translator.tojava.utils.SubtreeFilteringMethodsGenerator.getAugmentableSubTreeFiltering;
+import static org.onosproject.yang.compiler.translator.tojava.utils.SubtreeFilteringMethodsGenerator.getProcessChildNodeSubtreeFiltering;
+import static org.onosproject.yang.compiler.translator.tojava.utils.SubtreeFilteringMethodsGenerator.getProcessLeafListSubtreeFiltering;
+import static org.onosproject.yang.compiler.translator.tojava.utils.SubtreeFilteringMethodsGenerator.getProcessLeafSubtreeFiltering;
+import static org.onosproject.yang.compiler.translator.tojava.utils.SubtreeFilteringMethodsGenerator.getProcessSubTreeFilteringEnd;
+import static org.onosproject.yang.compiler.translator.tojava.utils.SubtreeFilteringMethodsGenerator.getProcessSubTreeForChoiceInterface;
+import static org.onosproject.yang.compiler.translator.tojava.utils.SubtreeFilteringMethodsGenerator.getProcessSubtreeFilteringStart;
+import static org.onosproject.yang.compiler.translator.tojava.utils.SubtreeFilteringMethodsGenerator.getProcessSubtreeFunctionBody;
+import static org.onosproject.yang.compiler.translator.tojava.utils.TranslatorUtils.addDefaultConstructor;
+import static org.onosproject.yang.compiler.translator.tojava.utils.TranslatorUtils.getBeanFiles;
+import static org.onosproject.yang.compiler.translator.tojava.utils.TranslatorUtils.getTypeFiles;
+import static org.onosproject.yang.compiler.utils.UtilConstants.BIG_INTEGER;
+import static org.onosproject.yang.compiler.utils.UtilConstants.BUILDER;
+import static org.onosproject.yang.compiler.utils.UtilConstants.BUILDER_CLASS;
+import static org.onosproject.yang.compiler.utils.UtilConstants.BUILDER_INTERFACE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.CLOSE_CURLY_BRACKET;
+import static org.onosproject.yang.compiler.utils.UtilConstants.COMMA;
+import static org.onosproject.yang.compiler.utils.UtilConstants.DEFAULT;
+import static org.onosproject.yang.compiler.utils.UtilConstants.DEFAULT_CAPS;
+import static org.onosproject.yang.compiler.utils.UtilConstants.EMPTY_STRING;
+import static org.onosproject.yang.compiler.utils.UtilConstants.ENUM_CLASS;
+import static org.onosproject.yang.compiler.utils.UtilConstants.EVENT_CLASS;
+import static org.onosproject.yang.compiler.utils.UtilConstants.EVENT_LISTENER_STRING;
+import static org.onosproject.yang.compiler.utils.UtilConstants.EVENT_STRING;
+import static org.onosproject.yang.compiler.utils.UtilConstants.EVENT_SUBJECT_NAME_SUFFIX;
+import static org.onosproject.yang.compiler.utils.UtilConstants.IMPL_CLASS;
+import static org.onosproject.yang.compiler.utils.UtilConstants.INT;
+import static org.onosproject.yang.compiler.utils.UtilConstants.INTERFACE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.JAVA_UTIL_OBJECTS_IMPORT_CLASS;
+import static org.onosproject.yang.compiler.utils.UtilConstants.JAVA_UTIL_PKG;
+import static org.onosproject.yang.compiler.utils.UtilConstants.KEYS;
+import static org.onosproject.yang.compiler.utils.UtilConstants.NEW_LINE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.OP_PARAM;
+import static org.onosproject.yang.compiler.utils.UtilConstants.PRIVATE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.PROTECTED;
+import static org.onosproject.yang.compiler.utils.UtilConstants.PUBLIC;
+import static org.onosproject.yang.compiler.utils.UtilConstants.RPC_CLASS;
+import static org.onosproject.yang.compiler.utils.UtilConstants.SEMI_COLON;
+import static org.onosproject.yang.compiler.utils.UtilConstants.SERVICE_METHOD_STRING;
+import static org.onosproject.yang.compiler.utils.UtilConstants.TYPEDEF_CLASS;
+import static org.onosproject.yang.compiler.utils.UtilConstants.UNION_CLASS;
+import static org.onosproject.yang.compiler.utils.io.impl.JavaDocGen.JavaDocType.GETTER_METHOD;
+import static org.onosproject.yang.compiler.utils.io.impl.JavaDocGen.JavaDocType.MANAGER_SETTER_METHOD;
+import static org.onosproject.yang.compiler.utils.io.impl.JavaDocGen.getJavaDoc;
+import static org.onosproject.yang.compiler.utils.io.impl.YangIoUtils.getCamelCase;
+import static org.onosproject.yang.compiler.utils.io.impl.YangIoUtils.getCapitalCase;
+import static org.onosproject.yang.compiler.utils.io.impl.YangIoUtils.insertDataIntoJavaFile;
+import static org.onosproject.yang.compiler.utils.io.impl.YangIoUtils.replaceLast;
+import static org.onosproject.yang.compiler.utils.io.impl.YangIoUtils.trimAtLast;
+import static org.onosproject.yang.compiler.utils.io.impl.YangIoUtils.validateLineLength;
+
+/**
+ * Representation of java file generator.
+ */
+public final class JavaFileGenerator {
+
+    // No instantiation
+    private JavaFileGenerator() {
+    }
+
+    /**
+     * Returns generated interface file for current node.
+     *
+     * @param file        file
+     * @param imports     imports for the file
+     * @param curNode     current YANG node
+     * @param attrPresent if any attribute is present or not
+     * @return interface file
+     * @throws IOException when fails to write in file
+     */
+    public static File generateInterfaceFile(File file, List<String> imports,
+                                             YangNode curNode,
+                                             boolean attrPresent)
+            throws IOException {
+
+        JavaFileInfoTranslator fileInfo =
+                ((JavaFileInfoContainer) curNode).getJavaFileInfo();
+
+        String path;
+        if (curNode instanceof RpcNotificationContainer) {
+            path = fileInfo.getPluginConfig().getCodeGenDir() +
+                    fileInfo.getPackageFilePath();
+        } else {
+            path = fileInfo.getBaseCodeGenPath() +
+                    fileInfo.getPackageFilePath();
+        }
+
+        String className = getCapitalCase(fileInfo.getJavaName());
+
+        boolean leavesPresent;
+        YangLeavesHolder leavesHolder;
+        if (curNode instanceof YangLeavesHolder) {
+            leavesHolder = (YangLeavesHolder) curNode;
+            leavesPresent = leavesPresent(leavesHolder);
+        } else {
+            leavesPresent = false;
+        }
+
+        initiateJavaFileGeneration(file, INTERFACE_MASK, imports, curNode,
+                                   className);
+
+        // Generate ENUM interface
+        if (curNode instanceof RpcNotificationContainer) {
+            insertDataIntoJavaFile(file, getOperationTypeEnum());
+        }
+        List<String> methods = new ArrayList<>();
+
+        //Add only for choice class
+        if (curNode instanceof YangChoice) {
+            insertDataIntoJavaFile(file, getProcessSubTreeForChoiceInterface(
+                    curNode));
+        }
+
+        if (attrPresent) {
+            // Add getter methods to interface file.
+            try {
+                //Leaf identifier enum.
+                if (leavesPresent) {
+                    insertDataIntoJavaFile(file, getInterfaceLeafIdEnumSignature(
+                            className) + trimAtLast(replaceLast(
+                            getDataFromTempFileHandle(
+                                    LEAF_IDENTIFIER_ENUM_ATTRIBUTES_MASK,
+                                    getBeanFiles(curNode), path),
+                            COMMA, SEMI_COLON), NEW_LINE) +
+                            getInterfaceLeafIdEnumMethods());
+                }
+
+                insertDataIntoJavaFile(file, NEW_LINE);
+                //Getter methods.
+                insertDataIntoJavaFile(file, getDataFromTempFileHandle(
+                        GETTER_FOR_INTERFACE_MASK, getBeanFiles(curNode), path));
+            } catch (IOException e) {
+                throw new IOException(getErrorMsg(className, INTERFACE));
+            }
+        }
+
+        if (curNode instanceof YangAugmentableNode &&
+                !(curNode instanceof YangChoice)) {
+            methods.add(getYangAugmentInfoInterface());
+        }
+
+        if (leavesPresent) {
+            methods.add(isLeafValueSetInterface());
+            if (curNode.isOpTypeReq()) {
+                methods.add(isSelectLeafSetInterface());
+            }
+        }
+        for (String method : methods) {
+            insertDataIntoJavaFile(file, method);
+        }
+        return file;
+    }
+
+    /**
+     * Returns generated builder interface file for current node.
+     *
+     * @param file        file
+     * @param curNode     current YANG node
+     * @param attrPresent if any attribute is present or not
+     * @return builder interface file
+     * @throws IOException when fails to write in file
+     */
+    public static File generateBuilderInterfaceFile(File file, YangNode curNode,
+                                                    boolean attrPresent)
+            throws IOException {
+
+        JavaFileInfoTranslator fileInfo =
+                ((JavaFileInfoContainer) curNode).getJavaFileInfo();
+
+        boolean leavesPresent;
+        YangLeavesHolder leavesHolder;
+        if (curNode instanceof YangLeavesHolder &&
+                curNode.isOpTypeReq()) {
+            leavesHolder = (YangLeavesHolder) curNode;
+            leavesPresent = leavesPresent(leavesHolder);
+        } else {
+            leavesPresent = false;
+        }
+
+        String className = getCapitalCase(fileInfo.getJavaName());
+        String path;
+        if (curNode instanceof RpcNotificationContainer) {
+            path = fileInfo.getPluginConfig().getCodeGenDir() +
+                    fileInfo.getPackageFilePath();
+        } else {
+            path = fileInfo.getBaseCodeGenPath() +
+                    fileInfo.getPackageFilePath();
+        }
+
+        initiateJavaFileGeneration(file, BUILDER_INTERFACE_MASK, null, curNode,
+                                   className);
+        List<String> methods = new ArrayList<>();
+        if (attrPresent) {
+            try {
+                //Getter methods.
+                methods.add(getDataFromTempFileHandle(
+                        GETTER_FOR_INTERFACE_MASK,
+                        getBeanFiles(curNode), path));
+
+                //Setter methods.
+                methods.add(getDataFromTempFileHandle(
+                        SETTER_FOR_INTERFACE_MASK,
+                        getBeanFiles(curNode), path));
+
+                //Add to list method.
+                insertDataIntoJavaFile(file, getDataFromTempFileHandle(
+                        ADD_TO_LIST_INTERFACE_MASK, getBeanFiles(curNode), path));
+            } catch (IOException e) {
+                throw new IOException(getErrorMsg(className, BUILDER_INTERFACE));
+            }
+        }
+
+        if (curNode instanceof YangAugmentableNode &&
+                !(curNode instanceof YangChoice)) {
+            methods.add(getAddAugmentInfoMethodInterface(className + BUILDER));
+            methods.add(getYangAugmentInfoInterface());
+        }
+
+        if (leavesPresent) {
+            methods.add(setSelectLeafSetInterface(className));
+        }
+        //Add build method to builder interface file.
+        methods.add(((TempJavaCodeFragmentFilesContainer) curNode)
+                            .getTempJavaCodeFragmentFiles()
+                            .addBuildMethodForInterface());
+
+        //Add getters and setters in builder interface.
+        for (String method : methods) {
+            insertDataIntoJavaFile(file, method);
+        }
+
+        insertDataIntoJavaFile(file, CLOSE_CURLY_BRACKET + NEW_LINE);
+        return file;
+    }
+
+    /**
+     * Returns generated builder class file for current node.
+     *
+     * @param file        file
+     * @param curNode     current YANG node
+     * @param attrPresent if any attribute is present or not
+     * @return builder class file
+     * @throws IOException when fails to write in file
+     */
+    public static File generateBuilderClassFile(File file, YangNode curNode,
+                                                boolean attrPresent)
+            throws IOException {
+
+        JavaFileInfoTranslator fileInfo =
+                ((JavaFileInfoContainer) curNode).getJavaFileInfo();
+
+        boolean leavesPresent;
+        YangLeavesHolder leavesHolder;
+        if (curNode instanceof YangLeavesHolder) {
+            leavesHolder = (YangLeavesHolder) curNode;
+            leavesPresent = leavesPresent(leavesHolder);
+        } else {
+            leavesPresent = false;
+        }
+
+        String className = getCapitalCase(fileInfo.getJavaName());
+        String path;
+        if (curNode instanceof RpcNotificationContainer) {
+            path = fileInfo.getPluginConfig().getCodeGenDir() +
+                    fileInfo.getPackageFilePath();
+        } else {
+            path = fileInfo.getBaseCodeGenPath() +
+                    fileInfo.getPackageFilePath();
+        }
+
+        initiateJavaFileGeneration(file, BUILDER_CLASS_MASK, null, curNode,
+                                   className);
+        List<String> methods = new ArrayList<>();
+        if (attrPresent) {
+
+            //Add attribute strings.
+            try {
+                insertDataIntoJavaFile(file, getDataFromTempFileHandle(
+                        ATTRIBUTES_MASK, getBeanFiles(curNode), path));
+            } catch (IOException e) {
+                throw new IOException(getErrorMsg(className, BUILDER_CLASS));
+            }
+            try {
+                //Getter methods.
+                methods.add(getDataFromTempFileHandle(
+                        GETTER_FOR_CLASS_MASK, getBeanFiles(curNode), path));
+                // Setter methods.
+                methods.add(getDataFromTempFileHandle(
+                        SETTER_FOR_CLASS_MASK, getBeanFiles(curNode), path));
+
+                //Add to list impl method.
+                methods.add(getDataFromTempFileHandle(
+                        ADD_TO_LIST_IMPL_MASK, getBeanFiles(curNode), path));
+
+                insertDataIntoJavaFile(file, NEW_LINE);
+
+                //Add operation attribute methods.
+                if (leavesPresent && curNode.isOpTypeReq()) {
+                    insertDataIntoJavaFile(file, NEW_LINE);
+                    methods.add(getSetterForSelectLeaf(className));
+                }
+            } catch (IOException e) {
+                throw new IOException(getErrorMsg(className, BUILDER_CLASS));
+            }
+        } else {
+            insertDataIntoJavaFile(file, NEW_LINE);
+        }
+
+        if (curNode instanceof YangAugmentableNode) {
+            methods.add(getAddAugmentInfoMethodImpl(className + BUILDER));
+            methods.add(getYangAugmentInfoImpl());
+        }
+
+        // Add default constructor and build method impl.
+        methods.add(((TempJavaCodeFragmentFilesContainer) curNode)
+                            .getTempJavaCodeFragmentFiles()
+                            .addBuildMethodImpl());
+        if (curNode.isOpTypeReq()) {
+            methods.add(generateBuildMethodForSubTree(curNode));
+        }
+        methods.add(addDefaultConstructor(curNode, PUBLIC, BUILDER));
+
+        //Add methods in builder class.
+        for (String method : methods) {
+            insertDataIntoJavaFile(file, method);
+        }
+        insertDataIntoJavaFile(file, CLOSE_CURLY_BRACKET);
+        return file;
+    }
+
+    /**
+     * Returns generated key class file for current list node.
+     *
+     * @param file    file
+     * @param curNode current YANG node
+     * @return key class file
+     * @throws IOException when fails to write in file
+     */
+    public static File generateKeyClassFile(File file, YangNode curNode)
+            throws IOException {
+
+        JavaFileInfoTranslator fileInfo =
+                ((JavaFileInfoContainer) curNode).getJavaFileInfo();
+
+        String className = getCapitalCase(fileInfo.getJavaName()) + KEYS;
+        List<String> imports = new ArrayList<>();
+
+        YangNode parent = curNode.getParent();
+        JavaImportData importData = ((JavaCodeGeneratorInfo) parent)
+                .getTempJavaCodeFragmentFiles().getBeanTempFiles()
+                .getJavaImportData();
+        JavaQualifiedTypeInfoTranslator info =
+                new JavaQualifiedTypeInfoTranslator();
+        info.setClassInfo(className);
+        info.setPkgInfo(fileInfo.getPackage());
+        importData.addImportInfo(info, parent.getJavaClassNameOrBuiltInType(),
+                                 parent.getJavaPackage());
+        List<JavaAttributeInfo> attrs = getListOfAttributesForKey(curNode);
+
+        Iterator<JavaAttributeInfo> attrIt = attrs.iterator();
+        JavaAttributeInfo attr;
+        JavaQualifiedTypeInfoTranslator typeInfo;
+        while (attrIt.hasNext()) {
+            attr = attrIt.next();
+            typeInfo = attr.getImportInfo();
+            if (!typeInfo.getClassInfo().equals(className)) {
+                imports.add(getImportString(attr.getImportInfo().getPkgInfo(),
+                                            attr.getImportInfo().getClassInfo()));
+            } else {
+                attr.setIsQualifiedAccess(true);
+            }
+        }
+
+        imports.add(getImportString(JAVA_UTIL_PKG,
+                                    JAVA_UTIL_OBJECTS_IMPORT_CLASS));
+
+        initiateJavaFileGeneration(file, GENERATE_KEY_CLASS, imports, curNode,
+                                   className);
+        String pkg = null;
+        attrIt = attrs.iterator();
+        while (attrIt.hasNext()) {
+            attr = attrIt.next();
+            if (attr.isQualifiedName()) {
+                pkg = attr.getImportInfo().getPkgInfo();
+            }
+            insertDataIntoJavaFile(file, getJavaAttributeDefinition(
+                    pkg, attr.getImportInfo().getClassInfo(),
+                    attr.getAttributeName(), false, PROTECTED, null));
+        }
+        attrIt = attrs.iterator();
+        while (attrIt.hasNext()) {
+            attr = attrIt.next();
+            //add getter methods
+            insertDataIntoJavaFile(file, getJavaDoc(GETTER_METHOD, attr
+                    .getAttributeName(), false, null));
+            insertDataIntoJavaFile(file, getGetterForClass(
+                    attr, GENERATE_KEY_CLASS));
+            insertDataIntoJavaFile(file, NEW_LINE);
+            //Add setter methods.
+            insertDataIntoJavaFile(file, getJavaDoc(MANAGER_SETTER_METHOD, attr
+                    .getAttributeName(), false, null));
+            insertDataIntoJavaFile(file, getSetterForClass(
+                    attr, className, GENERATE_EVENT_SUBJECT_CLASS));
+            insertDataIntoJavaFile(file, NEW_LINE);
+        }
+        //add hashcode and equals method.
+        insertDataIntoJavaFile(file, getHashCodeMethodOpen());
+        StringBuilder builder = new StringBuilder();
+        for (JavaAttributeInfo att : attrs) {
+            builder.append(getHashCodeMethod(att));
+        }
+        insertDataIntoJavaFile(file, getHashCodeMethodClose(builder.toString()));
+
+        insertDataIntoJavaFile(file, getEqualsMethodOpen(className));
+        StringBuilder builder2 = new StringBuilder();
+        for (JavaAttributeInfo att : attrs) {
+            builder2.append(getEqualsMethod(att)).append(NEW_LINE);
+        }
+        insertDataIntoJavaFile(file, getEqualsMethodClose(builder2.toString()));
+
+        insertDataIntoJavaFile(file, getCompareToForKeyClass(attrs, className));
+
+        insertDataIntoJavaFile(file, CLOSE_CURLY_BRACKET);
+        return file;
+    }
+
+    /**
+     * Returns generated default class file for current node.
+     *
+     * @param file        file
+     * @param curNode     current YANG node
+     * @param attrPresent if any attribute is present or not
+     * @param imports     list of imports
+     * @return impl class file
+     * @throws IOException when fails to write in file
+     */
+    public static File generateDefaultClassFile(File file, YangNode curNode,
+                                                boolean attrPresent,
+                                                List<String> imports)
+            throws IOException {
+
+        JavaFileInfoTranslator fileInfo =
+                ((JavaFileInfoContainer) curNode).getJavaFileInfo();
+        boolean leavesPresent;
+        YangLeavesHolder leavesHolder;
+        if (curNode instanceof YangLeavesHolder) {
+            leavesHolder = (YangLeavesHolder) curNode;
+            leavesPresent = leavesPresent(leavesHolder);
+        } else {
+            leavesPresent = false;
+        }
+
+        boolean rootNode = false;
+
+        String className = getCapitalCase(fileInfo.getJavaName());
+        String opParamClassName = className;
+        String name = DEFAULT_CAPS + className;
+        String path;
+        if (curNode instanceof RpcNotificationContainer) {
+            opParamClassName = className + OP_PARAM;
+            name = opParamClassName;
+            rootNode = true;
+            path = fileInfo.getPluginConfig().getCodeGenDir() +
+                    fileInfo.getPackageFilePath();
+        } else {
+            path = fileInfo.getBaseCodeGenPath() +
+                    fileInfo.getPackageFilePath();
+        }
+
+        initiateJavaFileGeneration(file, DEFAULT_CLASS_MASK, imports, curNode,
+                                   className);
+
+        List<String> methods = new ArrayList<>();
+        if (attrPresent) {
+            addDefaultClassAttributeInfo(file, curNode, className,
+                                         opParamClassName, path, methods,
+                                         rootNode);
+        } else {
+            insertDataIntoJavaFile(file, NEW_LINE);
+        }
+
+        if (curNode instanceof YangAugmentableNode) {
+            methods.add(getYangAugmentInfoImpl());
+        }
+        try {
+            //Constructor.
+            String constructor = getConstructorStart(className, rootNode) +
+                    getDataFromTempFileHandle(
+                            CONSTRUCTOR_IMPL_MASK, getBeanFiles(curNode), path)
+                    + methodClose(FOUR_SPACE);
+            methods.add(constructor);
+            if (curNode.isOpTypeReq()) {
+                String augmentableSubTreeFiltering = EMPTY_STRING;
+                if (curNode instanceof YangAugmentableNode) {
+                    // add is filter content match.
+                    augmentableSubTreeFiltering = getAugmentableSubTreeFiltering();
+                }
+                methods.add(getProcessSubtreeFilteringStart(curNode) +
+                                    getProcessSubtreeFunctionBody(curNode) +
+                                    augmentableSubTreeFiltering +
+                                    getProcessSubTreeFilteringEnd(name));
+
+                if (curNode instanceof YangLeavesHolder) {
+                    if (((YangLeavesHolder) curNode).getListOfLeaf() != null &&
+                            !((YangLeavesHolder) curNode).getListOfLeaf().isEmpty()) {
+                        methods.add(getProcessLeafSubtreeFiltering(curNode,
+                                                                   path));
+                    }
+                    if (((YangLeavesHolder) curNode).getListOfLeafList() != null &&
+                            !((YangLeavesHolder) curNode).getListOfLeafList().isEmpty()) {
+                        methods.add(getProcessLeafListSubtreeFiltering(curNode,
+                                                                       path));
+                    }
+                }
+
+                if (curNode.getChild() != null) {
+                    methods.add(getProcessChildNodeSubtreeFiltering(curNode,
+                                                                    path));
+                }
+            }
+        } catch (IOException e) {
+            throw new IOException(getErrorMsg(className, IMPL_CLASS));
+        }
+
+        methods.add(addDefaultConstructor(curNode, PROTECTED, DEFAULT));
+
+        methods.add(builderMethod(className));
+        if (leavesPresent) {
+            methods.add(getIsValueLeafSet());
+            if (curNode.isOpTypeReq()) {
+                methods.add(getIsSelectLeafSet());
+            }
+        }
+        // Add methods in impl class.
+        for (String method : methods) {
+            insertDataIntoJavaFile(file, method);
+        }
+
+        return file;
+    }
+
+    /**
+     * Add methods related to attributes.
+     *
+     * @param file             file
+     * @param curNode          current YANG node
+     * @param className        name of the class
+     * @param opParamClassName op param class name
+     * @param path             file path
+     * @param methods          list of methods string
+     * @param rootNode         flag indicating whether node is root node
+     * @throws IOException a violation in IO rule
+     */
+    private static void addDefaultClassAttributeInfo(File file, YangNode curNode,
+                                                     String className,
+                                                     String opParamClassName,
+                                                     String path, List<String> methods,
+                                                     boolean rootNode)
+            throws IOException {
+
+        //Add attribute strings.
+        try {
+            insertDataIntoJavaFile(file, getDataFromTempFileHandle(
+                    ATTRIBUTES_MASK, getBeanFiles(curNode), path));
+        } catch (IOException e) {
+            throw new IOException(getErrorMsg(className, IMPL_CLASS));
+        }
+
+        try {
+            //Getter methods.
+            methods.add(getDataFromTempFileHandle(
+                    GETTER_FOR_CLASS_MASK, getBeanFiles(curNode), path));
+
+            // Hash code method.
+            methods.add(getHashCodeMethodClose(
+                    getHashCodeMethodOpen() + getDataFromTempFileHandle(
+                            HASH_CODE_IMPL_MASK, getBeanFiles(curNode), path)
+                            .replace(NEW_LINE, EMPTY_STRING)));
+
+            //Equals method.
+            if (rootNode) {
+                methods.add(getEqualsMethodClose(
+                        getEqualsMethodOpen(opParamClassName) +
+                                getDataFromTempFileHandle(
+                                        EQUALS_IMPL_MASK,
+                                        getBeanFiles(curNode), path)));
+            } else {
+                methods.add(getEqualsMethodClose(
+                        getEqualsMethodOpen(DEFAULT_CAPS + className) +
+                                getDataFromTempFileHandle(EQUALS_IMPL_MASK,
+                                                          getBeanFiles(curNode),
+                                                          path)));
+            }
+            // To string method.
+            methods.add(getToStringMethodOpen() + getDataFromTempFileHandle(
+                    TO_STRING_IMPL_MASK, getBeanFiles(curNode), path) +
+                                getToStringMethodClose());
+        } catch (IOException e) {
+            throw new IOException(getErrorMsg(className, IMPL_CLASS));
+        }
+    }
+
+    /**
+     * Generates class file for type def.
+     *
+     * @param file    generated file
+     * @param curNode current YANG node
+     * @param imports imports for file
+     * @return type def class file
+     * @throws IOException when fails to generate class file
+     */
+    public static File generateTypeDefClassFile(File file, YangNode curNode,
+                                                List<String> imports)
+            throws IOException {
+
+        JavaFileInfoTranslator fileInfo =
+                ((JavaFileInfoContainer) curNode).getJavaFileInfo();
+        // import
+        String className = getCapitalCase(fileInfo.getJavaName());
+        String path = fileInfo.getBaseCodeGenPath() +
+                fileInfo.getPackageFilePath();
+        initiateJavaFileGeneration(file, className, GENERATE_TYPEDEF_CLASS,
+                                   imports, path);
+
+        List<String> methods = new ArrayList<>();
+        insertDataIntoJavaFile(file, NEW_LINE);
+        //Add attribute strings.
+        try {
+            insertDataIntoJavaFile(file, getDataFromTempFileHandle(
+                    ATTRIBUTES_MASK, getTypeFiles(curNode), path));
+        } catch (IOException e) {
+            throw new IOException(getErrorMsg(className, TYPEDEF_CLASS));
+        }
+
+        //Default constructor.
+        methods.add(addDefaultConstructor(curNode, PRIVATE, EMPTY_STRING));
+
+        try {
+
+            //Type constructor.
+            methods.add(getDataFromTempFileHandle(
+                    CONSTRUCTOR_FOR_TYPE_MASK, getTypeFiles(curNode), path));
+
+            //Of method.
+            methods.add(getDataFromTempFileHandle(
+                    OF_STRING_IMPL_MASK, getTypeFiles(curNode), path));
+
+            //Getter methods.
+            methods.add(getDataFromTempFileHandle(
+                    GETTER_FOR_CLASS_MASK, getTypeFiles(curNode), path));
+
+            // Hash code method.
+            methods.add(getHashCodeMethodClose(
+                    getHashCodeMethodOpen() + getDataFromTempFileHandle(
+                            HASH_CODE_IMPL_MASK, getTypeFiles(curNode), path)
+                            .replace(NEW_LINE, EMPTY_STRING)));
+
+            //Equals method.
+            methods.add(getEqualsMethodClose(
+                    getEqualsMethodOpen(className + EMPTY_STRING) +
+                            getDataFromTempFileHandle(EQUALS_IMPL_MASK,
+                                                      getTypeFiles(curNode), path)));
+
+            // To string method.
+            addTypedefToString(curNode, methods);
+
+            JavaCodeGeneratorInfo javaGenInfo = (JavaCodeGeneratorInfo) curNode;
+
+            //From string method.
+            methods.add(getFromStringMethodSignature(className) +
+                                getDataFromTempFileHandle(
+                                        FROM_STRING_IMPL_MASK,
+                                        javaGenInfo.getTempJavaCodeFragmentFiles()
+                                                .getTypeTempFiles(), path) +
+                                getFromStringMethodClose());
+        } catch (IOException e) {
+            throw new IOException(getErrorMsg(className, TYPEDEF_CLASS));
+        }
+
+        for (String method : methods) {
+            insertDataIntoJavaFile(file, method);
+        }
+        insertDataIntoJavaFile(file, CLOSE_CURLY_BRACKET + NEW_LINE);
+
+        return validateLineLength(file);
+    }
+
+    /**
+     * Adds typedef to string method.
+     *
+     * @param curNode current node
+     * @param methods list of methods string
+     */
+    private static void addTypedefToString(YangNode curNode,
+                                           List<String> methods) {
+        //To string method.
+
+        List<YangType<?>> types = ((YangTypeDef) curNode).getTypeList();
+        YangType type = types.get(0);
+        methods.add(getToStringForType(getCamelCase(type.getDataTypeName(),
+                                                    null), type));
+    }
+
+    /**
+     * Generates class file for union type.
+     *
+     * @param file    generated file
+     * @param curNode current YANG node
+     * @param imports imports for file
+     * @return type def class file
+     * @throws IOException when fails to generate class file
+     */
+    public static File generateUnionClassFile(File file, YangNode curNode,
+                                              List<String> imports)
+            throws IOException {
+
+        JavaFileInfoTranslator fileInfo =
+                ((JavaFileInfoContainer) curNode).getJavaFileInfo();
+
+        String className = getCapitalCase(fileInfo.getJavaName());
+        String path = fileInfo.getBaseCodeGenPath() +
+                fileInfo.getPackageFilePath();
+
+        TempJavaTypeFragmentFiles tempFiles =
+                ((JavaCodeGeneratorInfo) curNode).getTempJavaCodeFragmentFiles()
+                        .getTypeTempFiles();
+
+        boolean intConflict = false;
+        boolean longConflict = false;
+        boolean shortConflict = false;
+        JavaAttributeInfo intAttr = tempFiles.getIntAttribute();
+        if (intAttr == null) {
+            intAttr = tempFiles.getUIntAttribute();
+        }
+
+        JavaAttributeInfo longAttr =
+                tempFiles.getLongAttribute();
+        if (longAttr == null) {
+            longAttr = tempFiles.getULongAttribute();
+        }
+
+        JavaAttributeInfo shortAttr =
+                tempFiles.getShortAttribute();
+        if (shortAttr == null) {
+            shortAttr = tempFiles.getUInt8Attribute();
+        }
+
+        if (intAttr != null) {
+            intConflict = intAttr.isIntConflict();
+        }
+        if (longAttr != null) {
+            longConflict = longAttr.isLongConflict();
+        }
+        if (shortAttr != null) {
+            shortConflict = shortAttr.isShortConflict();
+        }
+        if (longConflict) {
+            String impt = tempFiles.getJavaImportData().getBigIntegerImport();
+            if (!imports.contains(impt)) {
+                imports.add(impt);
+                sort(imports);
+            }
+        }
+
+        initiateJavaFileGeneration(file, className, GENERATE_UNION_CLASS,
+                                   imports, path);
+
+        List<String> methods = new ArrayList<>();
+
+        // Add attribute strings.
+        try {
+            addUnionClassAttributeInfo(file, curNode, intConflict,
+                                       longConflict, shortConflict, path, tempFiles);
+        } catch (IOException e) {
+            throw new IOException(getErrorMsg(className, UNION_CLASS));
+        }
+
+        //Default constructor.
+        methods.add(addDefaultConstructor(curNode, PRIVATE, EMPTY_STRING));
+
+        try {
+
+            //Type constructor.
+            methods.add(getDataFromTempFileHandle(
+                    CONSTRUCTOR_FOR_TYPE_MASK, getTypeFiles(curNode), path));
+
+            // Of string method.
+            methods.add(getDataFromTempFileHandle(
+                    OF_STRING_IMPL_MASK, getTypeFiles(curNode), path));
+
+            //Getter methods.
+            methods.add(getDataFromTempFileHandle(
+                    GETTER_FOR_CLASS_MASK, getTypeFiles(curNode), path));
+
+            //Hash code method.
+            methods.add(getHashCodeMethodClose(
+                    getHashCodeMethodOpen() +
+                            getDataFromTempFileHandle(
+                                    HASH_CODE_IMPL_MASK, getTypeFiles(curNode),
+                                    path).replace(NEW_LINE, EMPTY_STRING)));
+
+            //Equals method.
+            methods.add(getEqualsMethodClose(
+                    getEqualsMethodOpen(className) +
+                            getDataFromTempFileHandle(
+                                    EQUALS_IMPL_MASK, getTypeFiles(curNode),
+                                    path)));
+
+            //To string method.
+            methods.add(getUnionToStringMethod(
+                    ((YangUnion) curNode).getTypeList()));
+
+            //From string method.
+            methods.add(getFromStringMethodSignature(className) +
+                                getDataFromTempFileHandle(
+                                        FROM_STRING_IMPL_MASK,
+                                        getTypeFiles(curNode), path) +
+                                getFromStringMethodClose());
+
+            if (intConflict) {
+                methods.add(getRangeValidatorMethodForUnion(INT));
+            }
+            if (longConflict) {
+                methods.add(getRangeValidatorMethodForUnion(BIG_INTEGER));
+            }
+            if (shortConflict && !intConflict) {
+                methods.add(getRangeValidatorMethodForUnion(INT));
+            }
+        } catch (IOException e) {
+            throw new IOException(getErrorMsg(className, UNION_CLASS));
+        }
+
+        for (String method : methods) {
+            insertDataIntoJavaFile(file, method);
+        }
+        insertDataIntoJavaFile(file, CLOSE_CURLY_BRACKET + NEW_LINE);
+
+        return validateLineLength(file);
+    }
+
+    /**
+     * Adds union class attribute information.
+     *
+     * @param file          generated file
+     * @param curNode       current YANG node
+     * @param intConflict   flag to indicate if there is a conflict in int
+     * @param longConflict  flag to indicate if there is a conflict in long
+     * @param shortConflict flag to indicate if there is a conflict in short
+     * @param path          file path
+     * @param tempFiles     temp java type fragment files
+     * @throws IOException a violation in IO rule
+     */
+    private static void addUnionClassAttributeInfo(File file,
+                                                   YangNode curNode,
+                                                   boolean intConflict,
+                                                   boolean longConflict,
+                                                   boolean shortConflict,
+                                                   String path,
+                                                   TempJavaTypeFragmentFiles tempFiles)
+            throws IOException {
+        if (intConflict) {
+            insertDataIntoJavaFile(file,
+                                   addStaticAttributeIntRange(PRIVATE,
+                                                              tempFiles.getIntIndex() <
+                                                                      tempFiles.getUIntIndex()));
+        }
+
+        if (longConflict) {
+            insertDataIntoJavaFile(file,
+                                   addStaticAttributeLongRange(PRIVATE,
+                                                               tempFiles.getLongIndex() <
+                                                                       tempFiles.getULongIndex()));
+        }
+
+        if (shortConflict) {
+            insertDataIntoJavaFile(file,
+                                   addStaticAttributeShortRange(PRIVATE,
+                                                                tempFiles.getShortIndex() <
+                                                                        tempFiles.getUInt8Index()));
+        }
+
+        insertDataIntoJavaFile(file, getDataFromTempFileHandle(
+                ATTRIBUTES_MASK, getTypeFiles(curNode), path));
+        insertDataIntoJavaFile(file, getSetValueParaForUnionClass());
+    }
+
+    /**
+     * Generates class file for type enum.
+     *
+     * @param file    generated file
+     * @param curNode current YANG node
+     * @param imports import list
+     * @return class file for type enum
+     * @throws IOException when fails to generate class file
+     */
+    public static File generateEnumClassFile(File file, YangNode curNode, List<String> imports)
+            throws IOException {
+
+        JavaFileInfoTranslator fileInfo =
+                ((JavaFileInfoContainer) curNode).getJavaFileInfo();
+
+        String className = fileInfo.getJavaName();
+        String path = fileInfo.getBaseCodeGenPath() +
+                fileInfo.getPackageFilePath();
+        TempJavaEnumerationFragmentFiles enumFile = ((JavaCodeGeneratorInfo)
+                curNode).getTempJavaCodeFragmentFiles().getEnumTempFiles();
+        JavaImportData data = enumFile.getJavaImportData();
+        if (!enumFile.isEnumClass()) {
+            imports.add(data.getImportForToBitSet());
+            imports.add(data.getImportForPattern());
+        }
+
+        initiateJavaFileGeneration(file, getCapitalCase(className),
+                                   GENERATE_ENUM_CLASS, imports, path);
+
+        //Add attribute strings.
+        try {
+            JavaCodeGeneratorInfo javaGenInfo = (JavaCodeGeneratorInfo) curNode;
+            String[] remove = {COMMA, NEW_LINE};
+            insertDataIntoJavaFile(file, trimAtLast(getDataFromTempFileHandle(
+                    ENUM_IMPL_MASK, javaGenInfo.getTempJavaCodeFragmentFiles()
+                            .getEnumTempFiles(), path), remove) +
+                    signatureClose());
+        } catch (IOException e) {
+            throw new IOException(getErrorMsg(getCapitalCase(className),
+                                              ENUM_CLASS));
+        }
+
+        insertDataIntoJavaFile(file, NEW_LINE);
+        // Add an attribute to get the enum's values.
+        insertDataIntoJavaFile(file, getEnumsValueAttribute(className));
+
+        // Add a constructor for enum.
+        //TODO: generate javadoc for method.
+        insertDataIntoJavaFile(file, getEnumsConstructor(getCapitalCase(className)) +
+                NEW_LINE);
+
+        insertDataIntoJavaFile(file,
+                               getEnumsOfValueMethod(className,
+                                                     (YangEnumeration) curNode,
+                                                     ENUM_METHOD_INT_VALUE));
+        insertDataIntoJavaFile(file,
+                               getEnumsOfValueMethod(className,
+                                                     (YangEnumeration) curNode,
+                                                     ENUM_METHOD_STRING_VALUE));
+
+        // Add a getter method for enum.
+        insertDataIntoJavaFile(file, getJavaDoc(GETTER_METHOD, className, false,
+                                                null) +
+                getGetter(INT, className, GENERATE_ENUM_CLASS) + NEW_LINE);
+
+        if (!enumFile.isEnumClass()) {
+            insertDataIntoJavaFile(file, getBitSetEnumClassFromString
+                    (getCapitalCase(className)));
+            insertDataIntoJavaFile(file, getBitSetEnumClassToString(
+                    getCapitalCase(className), (YangEnumeration) curNode));
+        } else {
+            insertDataIntoJavaFile(file, getToStringForEnumClass());
+        }
+
+        insertDataIntoJavaFile(file, CLOSE_CURLY_BRACKET + NEW_LINE);
+
+        return validateLineLength(file);
+    }
+
+    /**
+     * Generates interface file for rpc.
+     *
+     * @param file    generated file
+     * @param curNode current YANG node
+     * @param imports imports for file
+     * @return rpc class file
+     * @throws IOException when fails to generate class file
+     */
+    public static File generateServiceInterfaceFile(File file, YangNode curNode,
+                                                    List<String> imports)
+            throws IOException {
+
+        JavaFileInfoTranslator fileInfo =
+                ((JavaFileInfoContainer) curNode).getJavaFileInfo();
+
+        TempJavaServiceFragmentFiles tempFiles =
+                ((JavaCodeGeneratorInfo) curNode)
+                        .getTempJavaCodeFragmentFiles().getServiceTempFiles();
+        String className = getCapitalCase(fileInfo.getJavaName()) +
+                SERVICE_METHOD_STRING;
+        String path = fileInfo.getBaseCodeGenPath() +
+                fileInfo.getPackageFilePath();
+        initiateJavaFileGeneration(file, GENERATE_SERVICE_AND_MANAGER, imports,
+                                   curNode, className);
+
+        List<String> methods = new ArrayList<>();
+        JavaAttributeInfo rootAttribute =
+                getCurNodeAsAttributeInTarget(curNode, curNode, false,
+                                              tempFiles);
+
+        try {
+
+            if (isGetSetOfRootNodeRequired(curNode)) {
+                //Getter methods.
+                methods.add(getGetterString(rootAttribute,
+                                            GENERATE_SERVICE_AND_MANAGER) +
+                                    NEW_LINE);
+                // Setter methods.
+                methods.add(getSetterString(rootAttribute, className,
+                                            GENERATE_SERVICE_AND_MANAGER) +
+                                    NEW_LINE);
+            }
+
+            methods.add(getAugmentsDataMethodForService(curNode));
+
+            if (((JavaCodeGeneratorInfo) curNode).getTempJavaCodeFragmentFiles()
+                    .getServiceTempFiles() != null) {
+                JavaCodeGeneratorInfo javaGenInfo =
+                        (JavaCodeGeneratorInfo) curNode;
+
+                // Rpc methods
+                methods.add(getDataFromTempFileHandle(
+                        RPC_INTERFACE_MASK,
+                        javaGenInfo.getTempJavaCodeFragmentFiles()
+                                .getServiceTempFiles(), path));
+            }
+        } catch (IOException e) {
+            throw new IOException(getErrorMsg(className, RPC_CLASS));
+        }
+
+        for (String method : methods) {
+            insertDataIntoJavaFile(file, method);
+        }
+        insertDataIntoJavaFile(file, CLOSE_CURLY_BRACKET + NEW_LINE);
+
+        return validateLineLength(file);
+    }
+
+    /**
+     * Generates event file.
+     *
+     * @param file    generated file
+     * @param curNode current YANG node
+     * @param imports imports for file
+     * @throws IOException when fails to generate class file
+     */
+    public static void generateEventFile(File file, YangNode curNode,
+                                         List<String> imports)
+            throws IOException {
+
+        String className =
+                getCapitalCase(((JavaFileInfoContainer) curNode).getJavaFileInfo()
+                                       .getJavaName()) + EVENT_STRING;
+
+        TempJavaEventFragmentFiles tempFiles =
+                ((TempJavaCodeFragmentFilesContainer) curNode)
+                        .getTempJavaCodeFragmentFiles().getEventFragmentFiles();
+
+        String path = ((JavaFileInfoContainer) curNode).getJavaFileInfo()
+                .getBaseCodeGenPath() +
+                ((JavaFileInfoContainer) curNode).getJavaFileInfo()
+                        .getPackageFilePath();
+        initiateJavaFileGeneration(file, GENERATE_EVENT_CLASS, imports, curNode,
+                                   className);
+        try {
+            insertDataIntoJavaFile(file, getEventEnumTypeStart() +
+                    trimAtLast(getDataFromTempFileHandle(EVENT_ENUM_MASK,
+                                                         tempFiles, path),
+                               COMMA) + methodClose(FOUR_SPACE));
+
+            insertDataIntoJavaFile(file,
+                                   getDataFromTempFileHandle(EVENT_METHOD_MASK,
+                                                             tempFiles, path));
+        } catch (IOException e) {
+            throw new IOException(getErrorMsg(className, EVENT_CLASS));
+        }
+
+        insertDataIntoJavaFile(file, CLOSE_CURLY_BRACKET + NEW_LINE);
+        validateLineLength(file);
+    }
+
+    /**
+     * Generates event listener file.
+     *
+     * @param file    generated file
+     * @param curNode current YANG node
+     * @param imports imports for file
+     * @throws IOException when fails to generate class file
+     */
+    public static void generateEventListenerFile(File file, YangNode curNode,
+                                                 List<String> imports)
+            throws IOException {
+
+        String className =
+                getCapitalCase(((JavaFileInfoContainer) curNode).getJavaFileInfo()
+                                       .getJavaName()) + EVENT_LISTENER_STRING;
+
+        initiateJavaFileGeneration(file, GENERATE_EVENT_LISTENER_INTERFACE,
+                                   imports, curNode, className);
+        insertDataIntoJavaFile(file, CLOSE_CURLY_BRACKET + NEW_LINE);
+        validateLineLength(file);
+    }
+
+    /**
+     * Generates event subject's file.
+     *
+     * @param file    file handle
+     * @param curNode current YANG node
+     * @throws IOException when fails to do IO exceptions
+     */
+    public static void generateEventSubjectFile(File file, YangNode curNode)
+            throws IOException {
+
+        String className =
+                getCapitalCase(((JavaFileInfoContainer) curNode).getJavaFileInfo()
+                                       .getJavaName()) + EVENT_SUBJECT_NAME_SUFFIX;
+
+        initiateJavaFileGeneration(file, GENERATE_EVENT_SUBJECT_CLASS, null,
+                                   curNode, className);
+
+        String path = ((JavaFileInfoContainer) curNode).getJavaFileInfo()
+                .getBaseCodeGenPath() +
+                ((JavaFileInfoContainer) curNode).getJavaFileInfo()
+                        .getPackageFilePath();
+
+        TempJavaEventFragmentFiles tempFiles =
+                ((TempJavaCodeFragmentFilesContainer) curNode)
+                        .getTempJavaCodeFragmentFiles().getEventFragmentFiles();
+
+        insertDataIntoJavaFile(file, NEW_LINE);
+        try {
+            insertDataIntoJavaFile(
+                    file, getDataFromTempFileHandle(EVENT_SUBJECT_ATTRIBUTE_MASK,
+                                                    tempFiles, path));
+
+            insertDataIntoJavaFile(
+                    file, getDataFromTempFileHandle(EVENT_SUBJECT_GETTER_MASK,
+                                                    tempFiles, path));
+
+            insertDataIntoJavaFile(
+                    file, getDataFromTempFileHandle(EVENT_SUBJECT_SETTER_MASK,
+                                                    tempFiles, path));
+        } catch (IOException e) {
+            throw new IOException(getErrorMsg(className, EVENT_CLASS));
+        }
+
+        insertDataIntoJavaFile(file, CLOSE_CURLY_BRACKET + NEW_LINE);
+        validateLineLength(file);
+    }
+
+    /**
+     * Returns error message string.
+     *
+     * @param className name of the class
+     * @param fileType  type of file
+     * @return error message string
+     */
+    private static String getErrorMsg(String className, String fileType) {
+        return "No data found in temporary java code fragment files for " +
+                className + " while " + fileType + " file generation.";
+    }
+
+    /**
+     * Checks whether leaf is present in YANG leaves holder.
+     *
+     * @param holder holder of YANG leaves
+     * @return true if leaves are present, false otherwise
+     */
+    private static boolean leavesPresent(YangLeavesHolder holder) {
+        return holder.getListOfLeaf() != null &&
+                !holder.getListOfLeaf().isEmpty();
+    }
+}
diff --git a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/utils/JavaFileGeneratorUtils.java b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/utils/JavaFileGeneratorUtils.java
new file mode 100644
index 0000000..81c7cb1
--- /dev/null
+++ b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/utils/JavaFileGeneratorUtils.java
@@ -0,0 +1,851 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.translator.tojava.utils;
+
+import org.onosproject.yang.compiler.datamodel.InvalidOpTypeHolder;
+import org.onosproject.yang.compiler.datamodel.YangAtomicPath;
+import org.onosproject.yang.compiler.datamodel.YangAugment;
+import org.onosproject.yang.compiler.datamodel.YangLeafRef;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangNodeIdentifier;
+import org.onosproject.yang.compiler.datamodel.YangType;
+import org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes;
+import org.onosproject.yang.compiler.translator.exception.TranslatorException;
+import org.onosproject.yang.compiler.translator.tojava.JavaCodeGeneratorInfo;
+import org.onosproject.yang.compiler.translator.tojava.JavaFileInfoContainer;
+import org.onosproject.yang.compiler.translator.tojava.JavaFileInfoTranslator;
+import org.onosproject.yang.compiler.translator.tojava.JavaImportData;
+import org.onosproject.yang.compiler.translator.tojava.JavaQualifiedTypeInfoTranslator;
+import org.onosproject.yang.compiler.translator.tojava.TempJavaBeanFragmentFiles;
+import org.onosproject.yang.compiler.translator.tojava.TempJavaCodeFragmentFiles;
+import org.onosproject.yang.compiler.translator.tojava.TempJavaEnumerationFragmentFiles;
+import org.onosproject.yang.compiler.translator.tojava.TempJavaEventFragmentFiles;
+import org.onosproject.yang.compiler.translator.tojava.TempJavaFragmentFiles;
+import org.onosproject.yang.compiler.translator.tojava.TempJavaServiceFragmentFiles;
+import org.onosproject.yang.compiler.translator.tojava.TempJavaTypeFragmentFiles;
+import org.onosproject.yang.compiler.utils.io.YangPluginConfig;
+import org.onosproject.yang.compiler.utils.io.impl.JavaDocGen.JavaDocType;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedJavaFileType.BUILDER_CLASS_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedJavaFileType.BUILDER_INTERFACE_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedJavaFileType.DEFAULT_CLASS_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedJavaFileType.GENERATE_ENUM_CLASS;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedJavaFileType.GENERATE_EVENT_CLASS;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedJavaFileType.GENERATE_EVENT_LISTENER_INTERFACE;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedJavaFileType.GENERATE_EVENT_SUBJECT_CLASS;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedJavaFileType.GENERATE_IDENTITY_CLASS;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedJavaFileType.GENERATE_KEY_CLASS;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedJavaFileType.GENERATE_SERVICE_AND_MANAGER;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedJavaFileType.GENERATE_TYPEDEF_CLASS;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedJavaFileType.GENERATE_UNION_CLASS;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedJavaFileType.INTERFACE_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedTempFileType.ADD_TO_LIST_IMPL_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedTempFileType.ADD_TO_LIST_INTERFACE_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedTempFileType.ATTRIBUTES_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedTempFileType.CONSTRUCTOR_FOR_TYPE_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedTempFileType.CONSTRUCTOR_IMPL_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedTempFileType.EDIT_CONTENT_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedTempFileType.ENUM_IMPL_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedTempFileType.EQUALS_IMPL_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedTempFileType.EVENT_ENUM_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedTempFileType.EVENT_METHOD_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedTempFileType.EVENT_SUBJECT_ATTRIBUTE_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedTempFileType.EVENT_SUBJECT_GETTER_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedTempFileType.EVENT_SUBJECT_SETTER_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedTempFileType.FILTER_CONTENT_MATCH_FOR_LEAF_LIST_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedTempFileType.FILTER_CONTENT_MATCH_FOR_LEAF_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedTempFileType.FILTER_CONTENT_MATCH_FOR_NODES_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedTempFileType.FROM_STRING_IMPL_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedTempFileType.GETTER_FOR_CLASS_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedTempFileType.GETTER_FOR_INTERFACE_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedTempFileType.HASH_CODE_IMPL_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedTempFileType.LEAF_IDENTIFIER_ENUM_ATTRIBUTES_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedTempFileType.OF_STRING_IMPL_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedTempFileType.RPC_INTERFACE_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedTempFileType.SETTER_FOR_CLASS_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedTempFileType.SETTER_FOR_INTERFACE_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedTempFileType.TO_STRING_IMPL_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.JavaQualifiedTypeInfoTranslator.getQualifiedTypeInfoOfCurNode;
+import static org.onosproject.yang.compiler.translator.tojava.YangJavaModelUtils.getNodesPackage;
+import static org.onosproject.yang.compiler.translator.tojava.utils.ClassDefinitionGenerator.generateClassDefinition;
+import static org.onosproject.yang.compiler.utils.UtilConstants.AUGMENTED;
+import static org.onosproject.yang.compiler.utils.UtilConstants.ERROR_MSG_FOR_GEN_CODE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.LEAFREF;
+import static org.onosproject.yang.compiler.utils.UtilConstants.NEW_LINE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.OP_PARAM;
+import static org.onosproject.yang.compiler.utils.UtilConstants.PACKAGE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.PERIOD;
+import static org.onosproject.yang.compiler.utils.UtilConstants.SEMI_COLON;
+import static org.onosproject.yang.compiler.utils.UtilConstants.SET_METHOD_PREFIX;
+import static org.onosproject.yang.compiler.utils.UtilConstants.SLASH;
+import static org.onosproject.yang.compiler.utils.UtilConstants.SPACE;
+import static org.onosproject.yang.compiler.utils.io.impl.CopyrightHeader.parseCopyrightHeader;
+import static org.onosproject.yang.compiler.utils.io.impl.JavaDocGen.JavaDocType.BUILDER_CLASS;
+import static org.onosproject.yang.compiler.utils.io.impl.JavaDocGen.JavaDocType.BUILDER_INTERFACE;
+import static org.onosproject.yang.compiler.utils.io.impl.JavaDocGen.JavaDocType.DEFAULT_CLASS;
+import static org.onosproject.yang.compiler.utils.io.impl.JavaDocGen.JavaDocType.ENUM_CLASS;
+import static org.onosproject.yang.compiler.utils.io.impl.JavaDocGen.JavaDocType.EVENT;
+import static org.onosproject.yang.compiler.utils.io.impl.JavaDocGen.JavaDocType.EVENT_LISTENER;
+import static org.onosproject.yang.compiler.utils.io.impl.JavaDocGen.JavaDocType.EVENT_SUBJECT_CLASS;
+import static org.onosproject.yang.compiler.utils.io.impl.JavaDocGen.JavaDocType.INTERFACE;
+import static org.onosproject.yang.compiler.utils.io.impl.JavaDocGen.JavaDocType.RPC_INTERFACE;
+import static org.onosproject.yang.compiler.utils.io.impl.JavaDocGen.getJavaDoc;
+import static org.onosproject.yang.compiler.utils.io.impl.YangIoUtils.getCamelCase;
+import static org.onosproject.yang.compiler.utils.io.impl.YangIoUtils.getCapitalCase;
+import static org.onosproject.yang.compiler.utils.io.impl.YangIoUtils.getJavaPackageFromPackagePath;
+import static org.onosproject.yang.compiler.utils.io.impl.YangIoUtils.insertDataIntoJavaFile;
+import static org.onosproject.yang.compiler.utils.io.impl.YangIoUtils.parsePkg;
+
+/**
+ * Represents utilities for java file generator.
+ */
+public final class JavaFileGeneratorUtils {
+
+    /**
+     * Creates an instance of java file generator util.
+     */
+    private JavaFileGeneratorUtils() {
+    }
+
+    /**
+     * Returns a file object for generated file.
+     *
+     * @param filePath  file package path
+     * @param fileName  file name
+     * @param extension file extension
+     * @param handler   cached file handle
+     * @return file object
+     */
+    public static File getFileObject(String filePath, String fileName,
+                                     String extension,
+                                     JavaFileInfoTranslator handler) {
+        return new File(handler.getBaseCodeGenPath() + filePath + SLASH +
+                                fileName + extension);
+    }
+
+    /**
+     * Returns data stored in temporary files.
+     *
+     * @param tempFiles  temporary file types
+     * @param tempHandle temp java fragment files
+     * @param path       absolute path
+     * @return data stored in temporary files
+     * @throws IOException when failed to get the data from temporary file handle
+     */
+    static String getDataFromTempFileHandle(
+            int tempFiles, TempJavaFragmentFiles tempHandle, String path)
+            throws IOException {
+
+        TempJavaTypeFragmentFiles typeHandle = null;
+        if (tempHandle instanceof TempJavaTypeFragmentFiles) {
+            typeHandle = (TempJavaTypeFragmentFiles) tempHandle;
+        }
+
+        TempJavaBeanFragmentFiles beanHandle = null;
+        if (tempHandle instanceof TempJavaBeanFragmentFiles) {
+            beanHandle = (TempJavaBeanFragmentFiles) tempHandle;
+        }
+
+        TempJavaServiceFragmentFiles serviceHandle = null;
+        if (tempHandle instanceof TempJavaServiceFragmentFiles) {
+            serviceHandle = (TempJavaServiceFragmentFiles) tempHandle;
+        }
+
+        TempJavaEventFragmentFiles eventHandle = null;
+        if (tempHandle instanceof TempJavaEventFragmentFiles) {
+            eventHandle = (TempJavaEventFragmentFiles) tempHandle;
+        }
+
+        if ((tempFiles & ATTRIBUTES_MASK) != 0) {
+            return tempHandle.getTemporaryDataFromFileHandle(
+                    tempHandle.getAttributesTempFileHandle(),
+                    path);
+        }
+        if ((tempFiles & GETTER_FOR_INTERFACE_MASK) != 0) {
+            return tempHandle.getTemporaryDataFromFileHandle(
+                    tempHandle.getGetterInterfaceTempFileHandle(),
+                    path);
+        }
+        if ((tempFiles & SETTER_FOR_INTERFACE_MASK) != 0) {
+            return tempHandle.getTemporaryDataFromFileHandle(
+                    tempHandle.getSetterInterfaceTempFileHandle(),
+                    path);
+        }
+        if ((tempFiles & GETTER_FOR_CLASS_MASK) != 0) {
+            return tempHandle.getTemporaryDataFromFileHandle(
+                    tempHandle.getGetterImplTempFileHandle(),
+                    path);
+        }
+        if ((tempFiles & SETTER_FOR_CLASS_MASK) != 0) {
+            return tempHandle.getTemporaryDataFromFileHandle(
+                    tempHandle.getSetterImplTempFileHandle(),
+                    path);
+        }
+        if ((tempFiles & ADD_TO_LIST_INTERFACE_MASK) != 0) {
+            return tempHandle.getTemporaryDataFromFileHandle(
+                    tempHandle.getAddToListInterfaceTempFileHandle(),
+                    path);
+        }
+        if ((tempFiles & ADD_TO_LIST_IMPL_MASK) != 0) {
+            return tempHandle.getTemporaryDataFromFileHandle(
+                    tempHandle.getAddToListImplTempFileHandle(),
+                    path);
+        }
+        if ((tempFiles & FILTER_CONTENT_MATCH_FOR_LEAF_MASK) != 0) {
+            return tempHandle.getTemporaryDataFromFileHandle(
+                    tempHandle.getSubtreeFilteringForLeafTempFileHandle(),
+                    path);
+        }
+        if ((tempFiles & FILTER_CONTENT_MATCH_FOR_LEAF_LIST_MASK) != 0) {
+            return tempHandle.getTemporaryDataFromFileHandle(
+                    tempHandle.getGetSubtreeFilteringForListTempFileHandle(),
+                    path);
+        }
+        if ((tempFiles & FILTER_CONTENT_MATCH_FOR_NODES_MASK) != 0) {
+            return tempHandle.getTemporaryDataFromFileHandle(
+                    tempHandle.getGetSubtreeFilteringForChildNodeTempFileHandle(),
+                    path);
+        }
+        if ((tempFiles & EDIT_CONTENT_MASK) != 0) {
+            return tempHandle.getTemporaryDataFromFileHandle(
+                    tempHandle.getEditContentTempFileHandle(),
+                    path);
+        }
+        if ((tempFiles & LEAF_IDENTIFIER_ENUM_ATTRIBUTES_MASK) != 0) {
+            return tempHandle.getTemporaryDataFromFileHandle(
+                    tempHandle.getLeafIdAttributeTempFileHandle(),
+                    path);
+        }
+        if ((tempFiles & CONSTRUCTOR_IMPL_MASK) != 0) {
+            if (beanHandle == null) {
+                throw new TranslatorException("Required constructor info is" +
+                                                      " missing.");
+            }
+            return beanHandle.getTemporaryDataFromFileHandle(
+                    beanHandle.getConstructorImplTempFileHandle(),
+                    path);
+        }
+        if ((tempFiles & HASH_CODE_IMPL_MASK) != 0) {
+            return tempHandle.getTemporaryDataFromFileHandle(
+                    tempHandle.getHashCodeImplTempFileHandle(),
+                    path);
+        }
+        if ((tempFiles & EQUALS_IMPL_MASK) != 0) {
+            return tempHandle.getTemporaryDataFromFileHandle(
+                    tempHandle.getEqualsImplTempFileHandle(),
+                    path);
+        }
+        if ((tempFiles & TO_STRING_IMPL_MASK) != 0) {
+            return tempHandle.getTemporaryDataFromFileHandle(
+                    tempHandle.getToStringImplTempFileHandle(),
+                    path);
+        }
+        if ((tempFiles & OF_STRING_IMPL_MASK) != 0) {
+            if (typeHandle == null) {
+                throw new TranslatorException("Required of string implementation" +
+                                                      " info is missing.");
+            }
+            return typeHandle.getTemporaryDataFromFileHandle(
+                    typeHandle.getOfStringImplTempFileHandle(), path);
+        }
+        if ((tempFiles & CONSTRUCTOR_FOR_TYPE_MASK) != 0) {
+            if (typeHandle == null) {
+                throw new TranslatorException("Required constructor implementation" +
+                                                      " info is missing.");
+            }
+            return typeHandle.getTemporaryDataFromFileHandle(
+                    typeHandle.getConstructorForTypeTempFileHandle(),
+                    path);
+        }
+        if ((tempFiles & FROM_STRING_IMPL_MASK) != 0) {
+            return tempHandle.getTemporaryDataFromFileHandle(
+                    tempHandle.getFromStringImplTempFileHandle(),
+                    path);
+        }
+        if ((tempFiles & ENUM_IMPL_MASK) != 0) {
+            if (!(tempHandle instanceof TempJavaEnumerationFragmentFiles)) {
+                throw new TranslatorException("Required enum info is missing.");
+            }
+            TempJavaEnumerationFragmentFiles enumHandle =
+                    (TempJavaEnumerationFragmentFiles) tempHandle;
+            return enumHandle.getTemporaryDataFromFileHandle(
+                    enumHandle.getEnumClassTempFileHandle(), path);
+        }
+        if ((tempFiles & RPC_INTERFACE_MASK) != 0) {
+            if (serviceHandle == null) {
+                throw new TranslatorException("Required rpc interface info is" +
+                                                      " missing.");
+            }
+            return serviceHandle.getTemporaryDataFromFileHandle(
+                    serviceHandle.getRpcInterfaceTempFileHandle(),
+                    path);
+        }
+        if ((tempFiles & EVENT_ENUM_MASK) != 0) {
+            if (eventHandle == null) {
+                throw new TranslatorException(
+                        "Required event enum implementation info is missing.");
+            }
+            return eventHandle.getTemporaryDataFromFileHandle(
+                    eventHandle.getEventEnumTempFileHandle(),
+                    path);
+        }
+        if ((tempFiles & EVENT_METHOD_MASK) != 0) {
+            if (eventHandle == null) {
+                throw new TranslatorException(
+                        "Required event method implementation info is missing.");
+            }
+            return eventHandle.getTemporaryDataFromFileHandle(
+                    eventHandle.getEventMethodTempFileHandle(),
+                    path);
+        }
+        if ((tempFiles & EVENT_SUBJECT_GETTER_MASK) != 0) {
+            if (eventHandle == null) {
+                throw new TranslatorException(
+                        "Required event subject getter implementation info is" +
+                                " missing.");
+            }
+            return eventHandle.getTemporaryDataFromFileHandle(
+                    eventHandle.getEventSubjectGetterTempFileHandle(),
+                    path);
+        }
+        if ((tempFiles & EVENT_SUBJECT_SETTER_MASK) != 0) {
+            if (eventHandle == null) {
+                throw new TranslatorException(
+                        "Required event subject setter implementation info is" +
+                                " missing.");
+            }
+            return eventHandle.getTemporaryDataFromFileHandle(
+                    eventHandle.getEventSubjectSetterTempFileHandle(),
+                    path);
+        }
+        if ((tempFiles & EVENT_SUBJECT_ATTRIBUTE_MASK) != 0) {
+            if (eventHandle == null) {
+                throw new TranslatorException(
+                        "Required event subject attribute implementation info is" +
+                                " missing.");
+            }
+            return eventHandle.getTemporaryDataFromFileHandle(
+                    eventHandle.getEventSubjectAttributeTempFileHandle(),
+                    path);
+        }
+        return null;
+    }
+
+    /**
+     * Initiates generation of file based on generated file type.
+     *
+     * @param file      generated file
+     * @param className generated file class name
+     * @param genType   generated file type
+     * @param imports   imports for the file
+     * @param pkg       generated file package
+     * @throws IOException when fails to generate a file
+     */
+    public static void initiateJavaFileGeneration(File file, String className,
+                                                  int genType, List<String> imports,
+                                                  String pkg)
+            throws IOException {
+
+        if (file.exists()) {
+            throw new IOException(" file " + file.getName() + " is already generated." +
+                                          ERROR_MSG_FOR_GEN_CODE);
+        }
+
+        boolean isFileCreated;
+        try {
+            isFileCreated = file.createNewFile();
+            if (!isFileCreated) {
+                throw new IOException("Failed to create " + file.getName() +
+                                              " class file.");
+            }
+            appendContents(file, className, genType, imports, pkg);
+        } catch (IOException e) {
+            throw new IOException("Failed to append contents in " + file.getName() +
+                                          " class file.");
+        }
+    }
+
+    /**
+     * Initiates generation of file based on generated file type.
+     *
+     * @param file    generated file
+     * @param genType generated file type
+     * @param imports imports for the file
+     * @param curNode current YANG node
+     * @param name    class name
+     * @throws IOException when fails to generate a file
+     */
+    public static void initiateJavaFileGeneration(File file, int genType,
+                                                  List<String> imports,
+                                                  YangNode curNode, String name)
+            throws IOException {
+
+        if (file.exists()) {
+            throw new IOException(" file " + file.getName() + " is already generated." +
+                                          ERROR_MSG_FOR_GEN_CODE);
+        }
+        boolean isFileCreated;
+        try {
+            isFileCreated = file.createNewFile();
+            if (!isFileCreated) {
+                throw new IOException("Failed to create " + file.getName() +
+                                              " class file.");
+            }
+            appendContents(file, genType, imports, curNode, name);
+        } catch (IOException e) {
+            throw new IOException("Failed to append contents in " + file.getName() +
+                                          " class file.");
+        }
+    }
+
+    /**
+     * Appends all the contents into a generated java file.
+     *
+     * @param file        generated file
+     * @param genType     generated file type
+     * @param importsList list of java imports
+     * @param curNode     current YANG node
+     * @param className   class name
+     * @throws IOException when fails to do IO operations
+     */
+    private static void appendContents(File file, int genType,
+                                       List<String> importsList, YangNode curNode,
+                                       String className)
+            throws IOException {
+
+        JavaFileInfoTranslator javaFileInfo = ((JavaFileInfoContainer) curNode)
+                .getJavaFileInfo();
+
+        String name = javaFileInfo.getJavaName();
+        String path = javaFileInfo.getBaseCodeGenPath() + javaFileInfo
+                .getPackageFilePath();
+
+        String pkgString;
+        if (genType == GENERATE_EVENT_CLASS ||
+                genType == GENERATE_EVENT_LISTENER_INTERFACE ||
+                genType == GENERATE_EVENT_SUBJECT_CLASS) {
+            pkgString = parsePackageString((path + PERIOD + name)
+                                                   .toLowerCase(), importsList);
+        } else {
+            pkgString = parsePackageString(path, importsList);
+        }
+        switch (genType) {
+            case INTERFACE_MASK:
+                appendHeaderContents(file, pkgString, importsList);
+                write(file, genType, INTERFACE, curNode, className, false);
+                break;
+            case GENERATE_KEY_CLASS:
+                appendHeaderContents(file, pkgString, importsList);
+                write(file, genType, DEFAULT_CLASS, curNode, className, false);
+                break;
+            case DEFAULT_CLASS_MASK:
+                appendHeaderContents(file, pkgString, importsList);
+                write(file, genType, DEFAULT_CLASS, curNode, className,
+                      curNode.isOpTypeReq());
+                break;
+            case BUILDER_CLASS_MASK:
+                write(file, genType, BUILDER_CLASS, curNode, className, false);
+                break;
+            case BUILDER_INTERFACE_MASK:
+                write(file, genType, BUILDER_INTERFACE, curNode, className, false);
+                break;
+            case GENERATE_SERVICE_AND_MANAGER:
+                appendHeaderContents(file, pkgString, importsList);
+                write(file, genType, RPC_INTERFACE, curNode, className, false);
+                break;
+            case GENERATE_EVENT_CLASS:
+                appendHeaderContents(file, pkgString, importsList);
+                write(file, genType, EVENT, curNode, className, false);
+                break;
+            case GENERATE_EVENT_LISTENER_INTERFACE:
+                appendHeaderContents(file, pkgString, importsList);
+                write(file, genType, EVENT_LISTENER, curNode, className, false);
+                break;
+            case GENERATE_EVENT_SUBJECT_CLASS:
+                appendHeaderContents(file, pkgString, importsList);
+                write(file, genType, EVENT_SUBJECT_CLASS, curNode, className, false);
+                break;
+            case GENERATE_IDENTITY_CLASS:
+                appendHeaderContents(file, pkgString, importsList);
+                write(file, genType, EVENT_SUBJECT_CLASS, curNode, className, false);
+                break;
+            default:
+                break;
+        }
+    }
+
+    /**
+     * Appends all the contents into a generated java file.
+     *
+     * @param file        generated file
+     * @param fileName    generated file name
+     * @param genType     generated file type
+     * @param importsList list of java imports
+     * @param pkg         generated file package
+     * @throws IOException when fails to append contents
+     */
+    private static void appendContents(File file, String fileName, int genType,
+                                       List<String> importsList, String pkg)
+            throws IOException {
+
+        String pkgString = parsePackageString(pkg, importsList);
+
+        switch (genType) {
+            case GENERATE_TYPEDEF_CLASS:
+                appendHeaderContents(file, pkgString, importsList);
+                write(file, fileName, genType, DEFAULT_CLASS);
+                break;
+            case GENERATE_UNION_CLASS:
+                appendHeaderContents(file, pkgString, importsList);
+                write(file, fileName, genType, DEFAULT_CLASS);
+                break;
+            case GENERATE_ENUM_CLASS:
+                appendHeaderContents(file, pkgString, importsList);
+                write(file, fileName, genType, ENUM_CLASS);
+                break;
+            default:
+                break;
+        }
+    }
+
+    /**
+     * Removes base directory path from package and generates package string for file.
+     *
+     * @param javaPkg     generated java package
+     * @param importsList list of imports
+     * @return package string
+     */
+    private static String parsePackageString(String javaPkg,
+                                             List<String> importsList) {
+
+        javaPkg = parsePkg(getJavaPackageFromPackagePath(javaPkg));
+        if (importsList != null) {
+            if (!importsList.isEmpty()) {
+                return PACKAGE + SPACE + javaPkg + SEMI_COLON + NEW_LINE;
+            } else {
+                return PACKAGE + SPACE + javaPkg + SEMI_COLON;
+            }
+        } else {
+            return PACKAGE + SPACE + javaPkg + SEMI_COLON;
+        }
+    }
+
+    /**
+     * Appends other contents to interface, impl and typedef classes.
+     * for example : ONOS copyright, imports and package.
+     *
+     * @param file        generated file
+     * @param pkg         generated package
+     * @param importsList list of imports
+     * @throws IOException when fails to append contents
+     */
+    private static void appendHeaderContents(File file, String pkg,
+                                             List<String> importsList)
+            throws IOException {
+
+        insertDataIntoJavaFile(file, parseCopyrightHeader());
+        insertDataIntoJavaFile(file, pkg);
+
+        /*
+         * TODO: add the file header using comments for snippet of yang file.
+         * JavaCodeSnippetGen.getFileHeaderComment
+         */
+
+        if (importsList != null) {
+            insertDataIntoJavaFile(file, NEW_LINE);
+            for (String imports : importsList) {
+                insertDataIntoJavaFile(file, imports);
+            }
+        }
+    }
+
+    /**
+     * Writes data to the specific generated file.
+     *
+     * @param file        generated file
+     * @param genType     generated file type
+     * @param javaDocType java doc type
+     * @param curNode     current YANG node
+     * @param fileName    file name
+     * @param isForClass  is for default class
+     * @throws IOException when fails to write into a file
+     */
+    private static void write(File file, int genType, JavaDocType javaDocType,
+                              YangNode curNode, String fileName, boolean isForClass)
+            throws IOException {
+        insertDataIntoJavaFile(file, getJavaDoc(javaDocType, fileName,
+                                                isForClass, null));
+        insertDataIntoJavaFile(file, generateClassDefinition(genType,
+                                                             fileName, curNode));
+    }
+
+    /**
+     * Writes data to the specific generated file.
+     *
+     * @param file        generated file
+     * @param fileName    file name
+     * @param genType     generated file type
+     * @param javaDocType java doc type
+     * @throws IOException when fails to write into a file
+     */
+    private static void write(File file, String fileName, int genType,
+                              JavaDocType javaDocType) throws IOException {
+        insertDataIntoJavaFile(file, getJavaDoc(javaDocType, fileName, false,
+                                                null));
+        insertDataIntoJavaFile(file, generateClassDefinition(genType, fileName));
+    }
+
+    /**
+     * Returns set of node identifiers.
+     *
+     * @param parent parent node
+     * @return set of node identifiers
+     */
+    static List<YangAtomicPath> getSetOfNodeIdentifiers(YangNode parent) {
+
+        List<YangAtomicPath> targets = new ArrayList<>();
+        YangNodeIdentifier nodeId;
+        List<YangAugment> augments = getListOfAugments(parent);
+        for (YangAugment augment : augments) {
+            nodeId = augment.getTargetNode().get(0).getNodeIdentifier();
+            augment.setSetterMethodName(getAugmentSetterName(augment));
+            if (validateNodeIdentifierInSet(nodeId, targets)) {
+                targets.add(augment.getTargetNode().get(0));
+            }
+        }
+        return targets;
+    }
+
+    /* Returns list of augments.*/
+    private static List<YangAugment> getListOfAugments(YangNode parent) {
+        List<YangAugment> augments = new ArrayList<>();
+        YangNode child = parent.getChild();
+        while (child != null) {
+            if (child instanceof YangAugment) {
+                augments.add((YangAugment) child);
+            }
+            child = child.getNextSibling();
+        }
+        return augments;
+    }
+
+    /* Returns setter method name for augment.*/
+    private static String getAugmentSetterName(YangAugment augment) {
+        YangAtomicPath atomicPath = augment.getTargetNode().get(0);
+        YangNode augmentedNode = atomicPath.getResolvedNode();
+        String setterName = SET_METHOD_PREFIX + AUGMENTED
+                + getCapitalCase(((JavaFileInfoContainer) augmentedNode.getParent())
+                                         .getJavaFileInfo().getJavaName())
+                + getCapitalCase(((JavaFileInfoContainer) augmentedNode)
+                                         .getJavaFileInfo().getJavaName());
+        return setterName;
+    }
+
+    /*Validates the set for duplicate names of node identifiers.*/
+    private static boolean validateNodeIdentifierInSet(
+            YangNodeIdentifier nodeId, List<YangAtomicPath> targets) {
+        boolean isPresent = true;
+        for (YangAtomicPath target : targets) {
+            if (target.getNodeIdentifier().getName().equals(nodeId.getName())) {
+                if (target.getNodeIdentifier().getPrefix() != null) {
+                    isPresent = !target.getNodeIdentifier().getPrefix()
+                            .equals(nodeId.getPrefix());
+                } else {
+                    isPresent = nodeId.getPrefix() != null;
+                }
+            }
+        }
+        return isPresent;
+    }
+
+    /**
+     * Adds resolved augmented node imports to manager class.
+     *
+     * @param parent parent node
+     */
+    public static void addResolvedAugmentedDataNodeImports(YangNode parent) {
+        List<YangAtomicPath> targets = getSetOfNodeIdentifiers(parent);
+        if (targets.isEmpty()) {
+            return;
+        }
+
+        YangNode node = targets.get(0).getResolvedNode();
+        if (node instanceof InvalidOpTypeHolder) {
+            return;
+        }
+
+        TempJavaCodeFragmentFiles tempJavaCodeFragmentFiles = (
+                (JavaCodeGeneratorInfo) parent)
+                .getTempJavaCodeFragmentFiles();
+        YangNode augmentedNode;
+        JavaQualifiedTypeInfoTranslator typeInfo;
+        String curNodeName;
+        JavaFileInfoTranslator parentInfo = ((JavaFileInfoContainer) parent)
+                .getJavaFileInfo();
+        for (YangAtomicPath nodeId : targets) {
+            augmentedNode = nodeId.getResolvedNode().getParent();
+            curNodeName = getCurNodeName(augmentedNode, parentInfo
+                    .getPluginConfig());
+
+            typeInfo =
+                    getQTypeInfoOfNode(
+                            augmentedNode, curNodeName + OP_PARAM,
+                            parentInfo.getPluginConfig());
+
+            tempJavaCodeFragmentFiles.getServiceTempFiles()
+                    .getJavaImportData().addImportInfo(
+                    typeInfo, parentInfo.getJavaName(),
+                    parentInfo.getPackage());
+            typeInfo =
+                    getQTypeInfoOfNode(
+                            augmentedNode, curNodeName, parentInfo
+                                    .getPluginConfig());
+
+            tempJavaCodeFragmentFiles.getServiceTempFiles()
+                    .getJavaImportData().addImportInfo(
+                    typeInfo, parentInfo.getJavaName(),
+                    parentInfo.getPackage());
+        }
+    }
+
+    /**
+     * Returns qualified type info of augmented node.
+     *
+     * @param augmentedNode augmented node
+     * @param curNodeName   current node name
+     * @param pluginConfig  plugin configurations
+     * @return qualified type info of augmented node
+     */
+    private static JavaQualifiedTypeInfoTranslator getQTypeInfoOfNode(
+            YangNode augmentedNode, String curNodeName, YangPluginConfig pluginConfig) {
+        JavaQualifiedTypeInfoTranslator javaQualifiedTypeInfo =
+                getQualifiedTypeInfoOfCurNode(augmentedNode,
+                                              curNodeName);
+        if (javaQualifiedTypeInfo.getPkgInfo() == null) {
+            javaQualifiedTypeInfo.setPkgInfo(getNodesPackage(augmentedNode,
+                                                             pluginConfig));
+        }
+        return javaQualifiedTypeInfo;
+    }
+
+    /**
+     * Validates if augmented node is imported in parent node.
+     *
+     * @param javaQualifiedTypeInfo qualified type info
+     * @param importData            import data
+     * @return true if present in imports
+     */
+    private static boolean validateQualifiedInfoOfAugmentedNode(
+            JavaQualifiedTypeInfoTranslator javaQualifiedTypeInfo,
+            JavaImportData importData) {
+        for (JavaQualifiedTypeInfoTranslator curImportInfo : importData
+                .getImportSet()) {
+            if (curImportInfo.getClassInfo()
+                    .contentEquals(javaQualifiedTypeInfo.getClassInfo())) {
+                return curImportInfo.getPkgInfo()
+                        .contentEquals(javaQualifiedTypeInfo.getPkgInfo());
+            }
+        }
+        return true;
+    }
+
+    /**
+     * Return augmented class name for data methods in manager and service.
+     *
+     * @param augmentedNode augmented node
+     * @param parent        parent node
+     * @return augmented class name for data methods in manager and service
+     */
+    static String getAugmentedClassNameForDataMethods(YangNode augmentedNode,
+                                                      YangNode parent) {
+        String curNodeName;
+        JavaQualifiedTypeInfoTranslator javaQualifiedTypeInfo;
+        JavaFileInfoTranslator parentInfo = ((JavaFileInfoContainer) parent)
+                .getJavaFileInfo();
+        YangPluginConfig pluginConfig = parentInfo.getPluginConfig();
+        TempJavaServiceFragmentFiles tempJavaServiceFragmentFiles = (
+                (JavaCodeGeneratorInfo) parent).getTempJavaCodeFragmentFiles()
+                .getServiceTempFiles();
+        curNodeName = getCurNodeName(augmentedNode, pluginConfig);
+
+        javaQualifiedTypeInfo = getQTypeInfoOfNode(augmentedNode,
+                                                   getCapitalCase(curNodeName),
+                                                   parentInfo.getPluginConfig());
+        if (validateQualifiedInfoOfAugmentedNode(javaQualifiedTypeInfo,
+                                                 tempJavaServiceFragmentFiles
+                                                         .getJavaImportData())) {
+            return javaQualifiedTypeInfo.getClassInfo();
+        } else {
+            return javaQualifiedTypeInfo.getPkgInfo() + PERIOD +
+                    javaQualifiedTypeInfo.getClassInfo();
+        }
+    }
+
+    //Returns class name of current node
+    static String getCurNodeName(YangNode node, YangPluginConfig config) {
+        if (((JavaFileInfoContainer) node).getJavaFileInfo()
+                .getJavaName() != null) {
+            return getCapitalCase(((JavaFileInfoContainer) node)
+                                          .getJavaFileInfo()
+                                          .getJavaName());
+        } else {
+            return getCapitalCase(getCamelCase(node.getName(), config
+                    .getConflictResolver()));
+        }
+    }
+
+    /**
+     * Checks if the type name is leafref and returns the effective type name.
+     *
+     * @param attributeName name of the current type
+     * @param attributeType effective type
+     * @return name of the effective type
+     */
+    public static String isTypeNameLeafref(String attributeName,
+                                           YangType<?> attributeType) {
+        if (attributeName.equalsIgnoreCase(LEAFREF)) {
+            YangLeafRef leafRef = (YangLeafRef) attributeType.getDataTypeExtendedInfo();
+            if (leafRef != null && !leafRef.isInGrouping()) {
+                return attributeType.getDataTypeName();
+            }
+        }
+        return attributeName;
+        // TODO handle union scenario, having multiple leafref.
+    }
+
+    /**
+     * Checks if the type is leafref and returns the effective type.
+     *
+     * @param attributeType current type
+     * @return effective type
+     */
+    public static YangType isTypeLeafref(YangType<?> attributeType) {
+        if (attributeType.getDataType() == YangDataTypes.LEAFREF) {
+            YangLeafRef leafRef = (YangLeafRef) attributeType
+                    .getDataTypeExtendedInfo();
+            if (!leafRef.isInGrouping()) {
+                return leafRef.getEffectiveDataType();
+            }
+        }
+        return attributeType;
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/utils/JavaIdentifierSyntax.java b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/utils/JavaIdentifierSyntax.java
new file mode 100644
index 0000000..0a065d6
--- /dev/null
+++ b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/utils/JavaIdentifierSyntax.java
@@ -0,0 +1,257 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.translator.tojava.utils;
+
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangRevision;
+import org.onosproject.yang.compiler.translator.exception.TranslatorException;
+import org.onosproject.yang.compiler.translator.tojava.JavaFileInfoContainer;
+import org.onosproject.yang.compiler.translator.tojava.JavaFileInfoTranslator;
+import org.onosproject.yang.compiler.utils.io.YangToJavaNamingConflictUtil;
+
+import java.io.File;
+import java.io.IOException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Date;
+import java.util.List;
+
+import static org.onosproject.yang.compiler.datamodel.utils.DataModelUtils.getParentNodeInGenCode;
+import static org.onosproject.yang.compiler.utils.UtilConstants.COLON;
+import static org.onosproject.yang.compiler.utils.UtilConstants.DEFAULT_BASE_PKG;
+import static org.onosproject.yang.compiler.utils.UtilConstants.EMPTY_STRING;
+import static org.onosproject.yang.compiler.utils.UtilConstants.HYPHEN;
+import static org.onosproject.yang.compiler.utils.UtilConstants.JAVA_KEY_WORDS;
+import static org.onosproject.yang.compiler.utils.UtilConstants.PERIOD;
+import static org.onosproject.yang.compiler.utils.UtilConstants.QUOTES;
+import static org.onosproject.yang.compiler.utils.UtilConstants.REGEX_FOR_FIRST_DIGIT;
+import static org.onosproject.yang.compiler.utils.UtilConstants.REGEX_WITH_ALL_SPECIAL_CHAR;
+import static org.onosproject.yang.compiler.utils.UtilConstants.REVISION_PREFIX;
+import static org.onosproject.yang.compiler.utils.UtilConstants.SLASH;
+import static org.onosproject.yang.compiler.utils.UtilConstants.UNDER_SCORE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.VERSION_PREFIX;
+import static org.onosproject.yang.compiler.utils.io.impl.YangIoUtils.addPackageInfo;
+import static org.onosproject.yang.compiler.utils.io.impl.YangIoUtils.createDirectories;
+import static org.onosproject.yang.compiler.utils.io.impl.YangIoUtils.getAbsolutePackagePath;
+import static org.onosproject.yang.compiler.utils.io.impl.YangIoUtils.getJavaPackageFromPackagePath;
+import static org.onosproject.yang.compiler.utils.io.impl.YangIoUtils.getPackageDirPathFromJavaJPackage;
+import static org.onosproject.yang.compiler.utils.io.impl.YangIoUtils.getPrefixForIdentifier;
+
+/**
+ * Represents an utility Class for translating the name from YANG to java convention.
+ */
+public final class JavaIdentifierSyntax {
+
+    private static final int INDEX_ZERO = 0;
+    private static final int INDEX_ONE = 1;
+    private static final int VALUE_CHECK = 10;
+    private static final String ZERO = "0";
+    private static final String DATE_FORMAT = "yyyy-MM-dd";
+
+    /**
+     * Create instance of java identifier syntax.
+     */
+    private JavaIdentifierSyntax() {
+    }
+
+    /**
+     * Returns the root package string.
+     *
+     * @param version   YANG version
+     * @param nameSpace name space of the module
+     * @param revision  revision of the module defined
+     * @param resolver  object of YANG to java naming conflict util
+     * @return the root package string
+     */
+    public static String getRootPackage(byte version, String nameSpace,
+                                        YangRevision revision,
+                                        YangToJavaNamingConflictUtil resolver) {
+
+        StringBuilder pkg = new StringBuilder(DEFAULT_BASE_PKG)
+                .append(PERIOD)
+                .append(getYangVersion(version))
+                .append(PERIOD)
+                .append(getPkgFromNameSpace(nameSpace, resolver));
+        if (revision != null) {
+            pkg.append(PERIOD)
+                    .append(getYangRevisionStr(revision.getRevDate()));
+        }
+        return pkg.toString().toLowerCase();
+    }
+
+
+    /**
+     * Returns version.
+     *
+     * @param ver YANG version
+     * @return version
+     */
+    private static String getYangVersion(byte ver) {
+        return VERSION_PREFIX + ver;
+    }
+
+    /**
+     * Returns package name from name space.
+     *
+     * @param nameSpace name space of YANG module
+     * @param resolver  object of YANG to java naming conflict util
+     * @return java package name as per java rules
+     */
+    private static String getPkgFromNameSpace(String nameSpace,
+                                              YangToJavaNamingConflictUtil resolver) {
+
+        ArrayList<String> pkgArr = new ArrayList<>();
+        nameSpace = nameSpace.replace(QUOTES, EMPTY_STRING);
+        String properNameSpace = nameSpace.replaceAll
+                (REGEX_WITH_ALL_SPECIAL_CHAR, COLON);
+        String[] nameSpaceArr = properNameSpace.split(COLON);
+
+        Collections.addAll(pkgArr, nameSpaceArr);
+        return getPkgFrmArr(pkgArr, resolver);
+    }
+
+    /**
+     * Returns revision string array.
+     *
+     * @param date YANG module revision
+     * @return revision string
+     */
+    private static String getYangRevisionStr(Date date) {
+        SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT);
+        String dateInString = sdf.format(date);
+        String[] revisionArr = dateInString.split(HYPHEN);
+
+        StringBuilder rev = new StringBuilder(REVISION_PREFIX)
+                .append(revisionArr[INDEX_ZERO]);
+
+        for (int i = INDEX_ONE; i < revisionArr.length; i++) {
+            Integer val = Integer.parseInt(revisionArr[i]);
+            if (val < VALUE_CHECK) {
+                rev.append(ZERO);
+            }
+            rev.append(val);
+        }
+        return rev.toString();
+    }
+
+    /**
+     * Returns the package string.
+     *
+     * @param pkgArr           package array
+     * @param conflictResolver object of YANG to java naming conflict util
+     * @return package string
+     */
+    private static String getPkgFrmArr(ArrayList<String> pkgArr, YangToJavaNamingConflictUtil conflictResolver) {
+
+        StringBuilder pkg = new StringBuilder();
+        int size = pkgArr.size();
+        int i = 0;
+        for (String member : pkgArr) {
+            boolean presenceOfKeyword = JAVA_KEY_WORDS.contains(member.toLowerCase());
+            if (presenceOfKeyword || member.matches(REGEX_FOR_FIRST_DIGIT)) {
+                String prefix = getPrefixForIdentifier(conflictResolver);
+                member = prefix + member;
+            }
+            pkg.append(member);
+            if (i != size - 1) {
+                pkg.append(PERIOD);
+            }
+            i++;
+        }
+        return pkg.toString();
+    }
+
+    /**
+     * Returns enum's java name.
+     *
+     * @param name enum's name
+     * @return enum's java name
+     */
+    public static String getEnumJavaAttribute(String name) {
+
+        name = name.replaceAll(REGEX_WITH_ALL_SPECIAL_CHAR, COLON);
+        String[] strArray = name.split(COLON);
+        StringBuilder output = new StringBuilder();
+        if (strArray[0].isEmpty()) {
+            List<String> stringArrangement = new ArrayList<>();
+            stringArrangement.addAll(Arrays.asList(strArray).subList(1, strArray.length));
+            strArray = stringArrangement.toArray(new String[stringArrangement.size()]);
+        }
+        for (int i = 0; i < strArray.length; i++) {
+            if (i > 0 && i < strArray.length) {
+                output.append(UNDER_SCORE);
+            }
+            output.append(strArray[i]);
+        }
+        return output.toString();
+    }
+
+    /**
+     * Creates a package structure with package info java file if not present.
+     *
+     * @param yangNode YANG node for which code is being generated
+     * @throws IOException any IO exception
+     */
+    public static void createPackage(YangNode yangNode)
+            throws IOException {
+        if (!(yangNode instanceof JavaFileInfoContainer)) {
+            throw new TranslatorException("current node must have java file info " +
+                                                  yangNode.getName() + " in " +
+                                                  yangNode.getLineNumber() + " at " +
+                                                  yangNode.getCharPosition() +
+                                                  " in " + yangNode.getFileName());
+        }
+        String pkgInfo;
+        JavaFileInfoTranslator javaFileInfo = ((JavaFileInfoContainer) yangNode)
+                .getJavaFileInfo();
+        String pkg = getAbsolutePackagePath(javaFileInfo.getBaseCodeGenPath(),
+                                            javaFileInfo.getPackageFilePath());
+        JavaFileInfoTranslator parentInfo;
+        if (!doesPackageExist(pkg)) {
+            try {
+                File pack = createDirectories(pkg);
+                YangNode parent = getParentNodeInGenCode(yangNode);
+                if (parent != null) {
+                    parentInfo = ((JavaFileInfoContainer) parent).getJavaFileInfo();
+                    pkgInfo = parentInfo.getJavaName();
+                    addPackageInfo(pack, pkgInfo, getJavaPackageFromPackagePath(pkg),
+                                   true);
+                } else {
+                    pkgInfo = javaFileInfo.getJavaName();
+                    addPackageInfo(pack, pkgInfo, getJavaPackageFromPackagePath(pkg),
+                                   false);
+                }
+            } catch (IOException e) {
+                throw new IOException("failed to create package-info file");
+            }
+        }
+    }
+
+    /**
+     * Checks if the package directory structure created.
+     *
+     * @param pkg Package to check if it is created
+     * @return existence status of package
+     */
+    public static boolean doesPackageExist(String pkg) {
+        File pkgDir = new File(getPackageDirPathFromJavaJPackage(pkg));
+        File pkgWithFile = new File(pkgDir + SLASH + "package-info.java");
+        return pkgDir.exists() && pkgWithFile.isFile();
+    }
+}
diff --git a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/utils/MethodBodyTypes.java b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/utils/MethodBodyTypes.java
new file mode 100644
index 0000000..a5fcef3
--- /dev/null
+++ b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/utils/MethodBodyTypes.java
@@ -0,0 +1,81 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.translator.tojava.utils;
+
+/**
+ * Represents method body types.
+ */
+enum MethodBodyTypes {
+
+    //Getter method body.
+    GETTER,
+
+    //Setter method body.
+    SETTER,
+
+    //Build method body.
+    BUILD,
+
+    //Constructor method body.
+    CONSTRUCTOR,
+
+    //Default constructor method body.
+    DEFAULT_CONSTRUCTOR,
+
+    //Hash code method body.
+    HASH_CODE,
+
+    //To string method body.
+    TO_STRING,
+
+    //Equals method body.
+    EQUALS,
+
+    //add to list method body.
+    ADD_TO_LIST,
+
+    //Augment map getter for full map.
+    AUGMENTED_MAP_GETTER,
+
+    //Augment map getter for value.
+    AUGMENTED_MAP_GET_VALUE,
+
+    //Augment map add
+    AUGMENTED_MAP_ADD,
+
+    //Manager methods
+    MANAGER_METHODS,
+
+    //Of method.
+    OF_METHOD,
+
+    //Hash code method
+    HASH_CODE_METHOD,
+
+    //Equals method.
+    EQUALS_METHOD,
+
+    //To string method
+    TO_STRING_METHOD,
+
+    //Enum method int value.
+    ENUM_METHOD_INT_VALUE,
+
+    //Enum method string value.
+    ENUM_METHOD_STRING_VALUE
+
+}
diff --git a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/utils/MethodClassTypes.java b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/utils/MethodClassTypes.java
new file mode 100644
index 0000000..54322cb
--- /dev/null
+++ b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/utils/MethodClassTypes.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.translator.tojava.utils;
+
+/**
+ * Represents java method types for classes.
+ */
+enum MethodClassTypes {
+
+    //Method for interface files.
+    INTERFACE_TYPE,
+
+    //Method for implementation classes.
+    CLASS_TYPE
+}
diff --git a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/utils/MethodsGenerator.java b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/utils/MethodsGenerator.java
new file mode 100644
index 0000000..81e86a7
--- /dev/null
+++ b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/utils/MethodsGenerator.java
@@ -0,0 +1,2107 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.translator.tojava.utils;
+
+import org.onosproject.yang.compiler.datamodel.InvalidOpTypeHolder;
+import org.onosproject.yang.compiler.datamodel.RpcNotificationContainer;
+import org.onosproject.yang.compiler.datamodel.YangAppDataStructure;
+import org.onosproject.yang.compiler.datamodel.YangAtomicPath;
+import org.onosproject.yang.compiler.datamodel.YangCompilerAnnotation;
+import org.onosproject.yang.compiler.datamodel.YangDataStructure;
+import org.onosproject.yang.compiler.datamodel.YangEnum;
+import org.onosproject.yang.compiler.datamodel.YangEnumeration;
+import org.onosproject.yang.compiler.datamodel.YangIdentity;
+import org.onosproject.yang.compiler.datamodel.YangIdentityRef;
+import org.onosproject.yang.compiler.datamodel.YangLeafRef;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangType;
+import org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes;
+import org.onosproject.yang.compiler.translator.tojava.JavaAttributeInfo;
+import org.onosproject.yang.compiler.translator.tojava.JavaFileInfoContainer;
+import org.onosproject.yang.compiler.utils.io.YangPluginConfig;
+import org.onosproject.yang.compiler.utils.io.impl.JavaDocGen.JavaDocType;
+
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes.IDENTITYREF;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedJavaFileType.GENERATE_EVENT_SUBJECT_CLASS;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedJavaFileType.GENERATE_SERVICE_AND_MANAGER;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedJavaFileType.GENERATE_UNION_CLASS;
+import static org.onosproject.yang.compiler.translator.tojava.utils.BracketType.OPEN_CLOSE_BRACKET;
+import static org.onosproject.yang.compiler.translator.tojava.utils.IndentationType.EIGHT_SPACE;
+import static org.onosproject.yang.compiler.translator.tojava.utils.IndentationType.FOUR_SPACE;
+import static org.onosproject.yang.compiler.translator.tojava.utils.IndentationType.TWELVE_SPACE;
+import static org.onosproject.yang.compiler.translator.tojava.utils.JavaFileGeneratorUtils.getAugmentedClassNameForDataMethods;
+import static org.onosproject.yang.compiler.translator.tojava.utils.JavaFileGeneratorUtils.getCurNodeName;
+import static org.onosproject.yang.compiler.translator.tojava.utils.JavaFileGeneratorUtils.getSetOfNodeIdentifiers;
+import static org.onosproject.yang.compiler.translator.tojava.utils.JavaIdentifierSyntax.getEnumJavaAttribute;
+import static org.onosproject.yang.compiler.translator.tojava.utils.MethodBodyTypes.AUGMENTED_MAP_ADD;
+import static org.onosproject.yang.compiler.translator.tojava.utils.MethodBodyTypes.AUGMENTED_MAP_GET_VALUE;
+import static org.onosproject.yang.compiler.translator.tojava.utils.MethodBodyTypes.GETTER;
+import static org.onosproject.yang.compiler.translator.tojava.utils.MethodBodyTypes.MANAGER_METHODS;
+import static org.onosproject.yang.compiler.translator.tojava.utils.MethodBodyTypes.SETTER;
+import static org.onosproject.yang.compiler.translator.tojava.utils.MethodBodyTypes.TO_STRING;
+import static org.onosproject.yang.compiler.translator.tojava.utils.MethodClassTypes.CLASS_TYPE;
+import static org.onosproject.yang.compiler.translator.tojava.utils.MethodClassTypes.INTERFACE_TYPE;
+import static org.onosproject.yang.compiler.translator.tojava.utils.StringGenerator.brackets;
+import static org.onosproject.yang.compiler.translator.tojava.utils.StringGenerator.getBitSetAttr;
+import static org.onosproject.yang.compiler.translator.tojava.utils.StringGenerator.getCatchSubString;
+import static org.onosproject.yang.compiler.translator.tojava.utils.StringGenerator.getCompareToString;
+import static org.onosproject.yang.compiler.translator.tojava.utils.StringGenerator.getExceptionThrowString;
+import static org.onosproject.yang.compiler.translator.tojava.utils.StringGenerator.getForLoopString;
+import static org.onosproject.yang.compiler.translator.tojava.utils.StringGenerator.getGreaterThanCondition;
+import static org.onosproject.yang.compiler.translator.tojava.utils.StringGenerator.getIfConditionBegin;
+import static org.onosproject.yang.compiler.translator.tojava.utils.StringGenerator.getLeafFlagSetString;
+import static org.onosproject.yang.compiler.translator.tojava.utils.StringGenerator.getLesserThanCondition;
+import static org.onosproject.yang.compiler.translator.tojava.utils.StringGenerator.getListAttribute;
+import static org.onosproject.yang.compiler.translator.tojava.utils.StringGenerator.getNewInstance;
+import static org.onosproject.yang.compiler.translator.tojava.utils.StringGenerator.getNewLineAndSpace;
+import static org.onosproject.yang.compiler.translator.tojava.utils.StringGenerator.getOmitNullValueString;
+import static org.onosproject.yang.compiler.translator.tojava.utils.StringGenerator.getOpenCloseParaWithValue;
+import static org.onosproject.yang.compiler.translator.tojava.utils.StringGenerator.getOverRideString;
+import static org.onosproject.yang.compiler.translator.tojava.utils.StringGenerator.getParseFromStringMethod;
+import static org.onosproject.yang.compiler.translator.tojava.utils.StringGenerator.getPatternQuoteString;
+import static org.onosproject.yang.compiler.translator.tojava.utils.StringGenerator.getQuotedString;
+import static org.onosproject.yang.compiler.translator.tojava.utils.StringGenerator.getReturnOfSubString;
+import static org.onosproject.yang.compiler.translator.tojava.utils.StringGenerator.getReturnString;
+import static org.onosproject.yang.compiler.translator.tojava.utils.StringGenerator.getSetValueParaCondition;
+import static org.onosproject.yang.compiler.translator.tojava.utils.StringGenerator.getStringBuilderAttr;
+import static org.onosproject.yang.compiler.translator.tojava.utils.StringGenerator.getToStringCall;
+import static org.onosproject.yang.compiler.translator.tojava.utils.StringGenerator.getTrySubString;
+import static org.onosproject.yang.compiler.translator.tojava.utils.StringGenerator.getTwoParaEqualsString;
+import static org.onosproject.yang.compiler.translator.tojava.utils.StringGenerator.ifAndAndCondition;
+import static org.onosproject.yang.compiler.translator.tojava.utils.StringGenerator.ifConditionForIntInTypeDefConstructor;
+import static org.onosproject.yang.compiler.translator.tojava.utils.StringGenerator.ifEqualEqualCondition;
+import static org.onosproject.yang.compiler.translator.tojava.utils.StringGenerator.methodBody;
+import static org.onosproject.yang.compiler.translator.tojava.utils.StringGenerator.methodClose;
+import static org.onosproject.yang.compiler.translator.tojava.utils.StringGenerator.methodSignature;
+import static org.onosproject.yang.compiler.translator.tojava.utils.StringGenerator.methodSignatureClose;
+import static org.onosproject.yang.compiler.translator.tojava.utils.StringGenerator.multiAttrMethodSignature;
+import static org.onosproject.yang.compiler.translator.tojava.utils.StringGenerator.signatureClose;
+import static org.onosproject.yang.compiler.utils.UtilConstants.ADD;
+import static org.onosproject.yang.compiler.utils.UtilConstants.ADD_STRING;
+import static org.onosproject.yang.compiler.utils.UtilConstants.AND;
+import static org.onosproject.yang.compiler.utils.UtilConstants.APPEND;
+import static org.onosproject.yang.compiler.utils.UtilConstants.ARRAY_LIST_INIT;
+import static org.onosproject.yang.compiler.utils.UtilConstants.AUGMENTED;
+import static org.onosproject.yang.compiler.utils.UtilConstants.BASE64;
+import static org.onosproject.yang.compiler.utils.UtilConstants.BIG_INTEGER;
+import static org.onosproject.yang.compiler.utils.UtilConstants.BITS;
+import static org.onosproject.yang.compiler.utils.UtilConstants.BIT_SET;
+import static org.onosproject.yang.compiler.utils.UtilConstants.BOOLEAN_DATA_TYPE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.BUILD;
+import static org.onosproject.yang.compiler.utils.UtilConstants.BUILDER;
+import static org.onosproject.yang.compiler.utils.UtilConstants.BUILDER_LOWER_CASE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.BUILD_FOR_FILTER;
+import static org.onosproject.yang.compiler.utils.UtilConstants.CASE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.CLASS;
+import static org.onosproject.yang.compiler.utils.UtilConstants.CLASS_STRING;
+import static org.onosproject.yang.compiler.utils.UtilConstants.CLOSE_CURLY_BRACKET;
+import static org.onosproject.yang.compiler.utils.UtilConstants.CLOSE_PARENTHESIS;
+import static org.onosproject.yang.compiler.utils.UtilConstants.COLON;
+import static org.onosproject.yang.compiler.utils.UtilConstants.COMMA;
+import static org.onosproject.yang.compiler.utils.UtilConstants.COMPARE_TO;
+import static org.onosproject.yang.compiler.utils.UtilConstants.DECODE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.DEFAULT;
+import static org.onosproject.yang.compiler.utils.UtilConstants.DEFAULT_CAPS;
+import static org.onosproject.yang.compiler.utils.UtilConstants.DIAMOND_CLOSE_BRACKET;
+import static org.onosproject.yang.compiler.utils.UtilConstants.DIAMOND_OPEN_BRACKET;
+import static org.onosproject.yang.compiler.utils.UtilConstants.EIGHT_SPACE_INDENTATION;
+import static org.onosproject.yang.compiler.utils.UtilConstants.ELSE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.EMPTY_STRING;
+import static org.onosproject.yang.compiler.utils.UtilConstants.ENCODE_TO_STRING;
+import static org.onosproject.yang.compiler.utils.UtilConstants.ENUM;
+import static org.onosproject.yang.compiler.utils.UtilConstants.EQUAL;
+import static org.onosproject.yang.compiler.utils.UtilConstants.EQUALS_STRING;
+import static org.onosproject.yang.compiler.utils.UtilConstants.EXTEND;
+import static org.onosproject.yang.compiler.utils.UtilConstants.FALSE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.FOR;
+import static org.onosproject.yang.compiler.utils.UtilConstants.FOR_TYPE_STRING;
+import static org.onosproject.yang.compiler.utils.UtilConstants.FOUR_SPACE_INDENTATION;
+import static org.onosproject.yang.compiler.utils.UtilConstants.FROM_STRING_METHOD_NAME;
+import static org.onosproject.yang.compiler.utils.UtilConstants.FROM_STRING_PARAM_NAME;
+import static org.onosproject.yang.compiler.utils.UtilConstants.GET;
+import static org.onosproject.yang.compiler.utils.UtilConstants.GET_DECODER;
+import static org.onosproject.yang.compiler.utils.UtilConstants.GET_ENCODER;
+import static org.onosproject.yang.compiler.utils.UtilConstants.GET_METHOD_PREFIX;
+import static org.onosproject.yang.compiler.utils.UtilConstants.GOOGLE_MORE_OBJECT_METHOD_STRING;
+import static org.onosproject.yang.compiler.utils.UtilConstants.HASH;
+import static org.onosproject.yang.compiler.utils.UtilConstants.HASH_CODE_STRING;
+import static org.onosproject.yang.compiler.utils.UtilConstants.IF;
+import static org.onosproject.yang.compiler.utils.UtilConstants.INSTANCE_OF;
+import static org.onosproject.yang.compiler.utils.UtilConstants.INT;
+import static org.onosproject.yang.compiler.utils.UtilConstants.IS_EMPTY;
+import static org.onosproject.yang.compiler.utils.UtilConstants.IS_SELECT_LEAF;
+import static org.onosproject.yang.compiler.utils.UtilConstants.KEYS;
+import static org.onosproject.yang.compiler.utils.UtilConstants.LEAF;
+import static org.onosproject.yang.compiler.utils.UtilConstants.LEAF_IDENTIFIER;
+import static org.onosproject.yang.compiler.utils.UtilConstants.LINKED_HASH_MAP;
+import static org.onosproject.yang.compiler.utils.UtilConstants.LINKED_HASH_SET;
+import static org.onosproject.yang.compiler.utils.UtilConstants.LONG;
+import static org.onosproject.yang.compiler.utils.UtilConstants.MAX_RANGE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.MIN_RANGE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.NEG_ONE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.NEW;
+import static org.onosproject.yang.compiler.utils.UtilConstants.NEW_LINE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.NOT;
+import static org.onosproject.yang.compiler.utils.UtilConstants.NULL;
+import static org.onosproject.yang.compiler.utils.UtilConstants.OBJ;
+import static org.onosproject.yang.compiler.utils.UtilConstants.OBJECT;
+import static org.onosproject.yang.compiler.utils.UtilConstants.OBJECT_STRING;
+import static org.onosproject.yang.compiler.utils.UtilConstants.OF;
+import static org.onosproject.yang.compiler.utils.UtilConstants.OF_CAPS;
+import static org.onosproject.yang.compiler.utils.UtilConstants.ONE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.OPEN_CLOSE_BRACKET_STRING;
+import static org.onosproject.yang.compiler.utils.UtilConstants.OPEN_CURLY_BRACKET;
+import static org.onosproject.yang.compiler.utils.UtilConstants.OPEN_PARENTHESIS;
+import static org.onosproject.yang.compiler.utils.UtilConstants.OPERATION_TYPE_ATTRIBUTE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.OP_PARAM;
+import static org.onosproject.yang.compiler.utils.UtilConstants.OTHER;
+import static org.onosproject.yang.compiler.utils.UtilConstants.OVERRIDE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.PERIOD;
+import static org.onosproject.yang.compiler.utils.UtilConstants.PRIORITY_QUEUE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.PRIVATE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.PROCESS_SUBTREE_FILTERING;
+import static org.onosproject.yang.compiler.utils.UtilConstants.PROTECTED;
+import static org.onosproject.yang.compiler.utils.UtilConstants.PUBLIC;
+import static org.onosproject.yang.compiler.utils.UtilConstants.PUT;
+import static org.onosproject.yang.compiler.utils.UtilConstants.QUESTION_MARK;
+import static org.onosproject.yang.compiler.utils.UtilConstants.QUOTES;
+import static org.onosproject.yang.compiler.utils.UtilConstants.RETURN;
+import static org.onosproject.yang.compiler.utils.UtilConstants.RPC_INPUT_VAR_NAME;
+import static org.onosproject.yang.compiler.utils.UtilConstants.SCHEMA_NAME;
+import static org.onosproject.yang.compiler.utils.UtilConstants.SELECT_ALL_CHILD;
+import static org.onosproject.yang.compiler.utils.UtilConstants.SEMI_COLON;
+import static org.onosproject.yang.compiler.utils.UtilConstants.SET_METHOD_PREFIX;
+import static org.onosproject.yang.compiler.utils.UtilConstants.SET_SELECT_LEAF;
+import static org.onosproject.yang.compiler.utils.UtilConstants.SET_VALUE_PARA;
+import static org.onosproject.yang.compiler.utils.UtilConstants.SIXTEEN_SPACE_INDENTATION;
+import static org.onosproject.yang.compiler.utils.UtilConstants.SPACE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.SPLIT_STRING;
+import static org.onosproject.yang.compiler.utils.UtilConstants.SQUARE_BRACKETS;
+import static org.onosproject.yang.compiler.utils.UtilConstants.STATIC;
+import static org.onosproject.yang.compiler.utils.UtilConstants.STRING_BUILDER_VAR;
+import static org.onosproject.yang.compiler.utils.UtilConstants.STRING_DATA_TYPE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.SUBTREE_FILTERED;
+import static org.onosproject.yang.compiler.utils.UtilConstants.SUFFIX_S;
+import static org.onosproject.yang.compiler.utils.UtilConstants.SWITCH;
+import static org.onosproject.yang.compiler.utils.UtilConstants.THIS;
+import static org.onosproject.yang.compiler.utils.UtilConstants.TMP_VAL;
+import static org.onosproject.yang.compiler.utils.UtilConstants.TO_CAPS;
+import static org.onosproject.yang.compiler.utils.UtilConstants.TO_STRING_METHOD;
+import static org.onosproject.yang.compiler.utils.UtilConstants.TRIM_STRING;
+import static org.onosproject.yang.compiler.utils.UtilConstants.TRUE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.TWELVE_SPACE_INDENTATION;
+import static org.onosproject.yang.compiler.utils.UtilConstants.VALIDATE_RANGE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.VALUE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.VALUE_CAPS;
+import static org.onosproject.yang.compiler.utils.UtilConstants.VALUE_LEAF;
+import static org.onosproject.yang.compiler.utils.UtilConstants.VALUE_LEAF_SET;
+import static org.onosproject.yang.compiler.utils.UtilConstants.VOID;
+import static org.onosproject.yang.compiler.utils.UtilConstants.YANG_AUGMENTED_INFO;
+import static org.onosproject.yang.compiler.utils.UtilConstants.YANG_AUGMENTED_INFO_LOWER_CASE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.ZERO;
+import static org.onosproject.yang.compiler.utils.io.impl.JavaDocGen.JavaDocType.BUILD_METHOD;
+import static org.onosproject.yang.compiler.utils.io.impl.JavaDocGen.JavaDocType.CONSTRUCTOR;
+import static org.onosproject.yang.compiler.utils.io.impl.JavaDocGen.JavaDocType.DEFAULT_CONSTRUCTOR;
+import static org.onosproject.yang.compiler.utils.io.impl.JavaDocGen.JavaDocType.FROM_METHOD;
+import static org.onosproject.yang.compiler.utils.io.impl.JavaDocGen.JavaDocType.GETTER_METHOD;
+import static org.onosproject.yang.compiler.utils.io.impl.JavaDocGen.JavaDocType.MANAGER_SETTER_METHOD;
+import static org.onosproject.yang.compiler.utils.io.impl.JavaDocGen.JavaDocType.OF_METHOD;
+import static org.onosproject.yang.compiler.utils.io.impl.JavaDocGen.JavaDocType.SETTER_METHOD;
+import static org.onosproject.yang.compiler.utils.io.impl.JavaDocGen.JavaDocType.TYPE_CONSTRUCTOR;
+import static org.onosproject.yang.compiler.utils.io.impl.JavaDocGen.generateForAddAugmentation;
+import static org.onosproject.yang.compiler.utils.io.impl.JavaDocGen.generateForBuilderMethod;
+import static org.onosproject.yang.compiler.utils.io.impl.JavaDocGen.generateForGetAugmentation;
+import static org.onosproject.yang.compiler.utils.io.impl.JavaDocGen.generateForGetMethodWithAttribute;
+import static org.onosproject.yang.compiler.utils.io.impl.JavaDocGen.generateForValidatorMethod;
+import static org.onosproject.yang.compiler.utils.io.impl.JavaDocGen.getJavaDoc;
+import static org.onosproject.yang.compiler.utils.io.impl.YangIoUtils.getCamelCase;
+import static org.onosproject.yang.compiler.utils.io.impl.YangIoUtils.getCapitalCase;
+import static org.onosproject.yang.compiler.utils.io.impl.YangIoUtils.getSmallCase;
+import static org.onosproject.yang.compiler.utils.io.impl.YangIoUtils.trimAtLast;
+
+/**
+ * Represents generator for methods of generated files based on the file type.
+ */
+public final class MethodsGenerator {
+    private static final String BIT_NAMES_VAR = "bitNames";
+    private static final String BIT_NAME_VAR = "bitName";
+
+    /**
+     * Creates an instance of method generator.
+     */
+    private MethodsGenerator() {
+    }
+
+    /**
+     * Returns the methods strings for builder interface.
+     *
+     * @param name attribute name
+     * @return method string for builder interface
+     */
+    public static String parseBuilderInterfaceBuildMethodString(String name) {
+        return getJavaDoc(BUILD_METHOD, name, false, null) +
+                getBuildForInterface(name);
+    }
+
+    /**
+     * Returns getter string.
+     *
+     * @param attr    attribute info
+     * @param genType generated java files
+     * @return getter string
+     */
+    public static String getGetterString(JavaAttributeInfo attr, int genType) {
+
+        String returnType = getReturnType(attr);
+        String attributeName = attr.getAttributeName();
+        String appDataStructure = null;
+        StringBuilder builder = new StringBuilder();
+        if (attr.getCompilerAnnotation() != null) {
+            YangDataStructure data = getYangDataStructure(
+                    attr.getCompilerAnnotation());
+            if (data != null) {
+                appDataStructure = data.name();
+            }
+        }
+        if (genType == GENERATE_SERVICE_AND_MANAGER) {
+            builder.append(generateForGetMethodWithAttribute(returnType))
+                    .append(getGetterForInterface(
+                            attributeName, returnType, attr.isListAttr(),
+                            genType, attr.getCompilerAnnotation()));
+
+            return builder.toString();
+        }
+
+        builder.append(getJavaDoc(GETTER_METHOD, attributeName, attr
+                .isListAttr(), appDataStructure))
+                .append(getGetterForInterface(
+                        attributeName, returnType, attr.isListAttr(),
+                        genType, attr.getCompilerAnnotation()));
+
+        return builder.toString();
+    }
+
+    /**
+     * Returns setter string.
+     *
+     * @param attr      attribute info
+     * @param className java class name
+     * @param genType   generated java files
+     * @return setter string
+     */
+    public static String getSetterString(JavaAttributeInfo attr,
+                                         String className, int genType) {
+
+        String attrType = getReturnType(attr);
+        String attributeName = attr.getAttributeName();
+        JavaDocType type;
+        StringBuilder builder = new StringBuilder();
+        if (genType == GENERATE_SERVICE_AND_MANAGER) {
+            type = MANAGER_SETTER_METHOD;
+        } else {
+            type = SETTER_METHOD;
+        }
+
+        String appDataStructure = null;
+        YangDataStructure ds = getYangDataStructure(
+                attr.getCompilerAnnotation());
+        if (ds != null) {
+            appDataStructure = ds.name();
+        }
+        builder.append(getJavaDoc(type, attributeName, attr.isListAttr(),
+                                  appDataStructure))
+                .append(getSetterForInterface(attributeName, attrType, className,
+                                              attr.isListAttr(), genType,
+                                              attr.getCompilerAnnotation()));
+        return builder.toString();
+    }
+
+    /**
+     * Returns constructor method string.
+     *
+     * @param name class name
+     * @return constructor string
+     */
+    private static String getConstructorString(String name) {
+        return getJavaDoc(CONSTRUCTOR, name, false, null);
+    }
+
+    /**
+     * Returns default constructor method string.
+     *
+     * @param name         class name
+     * @param modifierType modifier type
+     * @return default constructor string
+     */
+    public static String getDefaultConstructorString(String name,
+                                                     String modifierType) {
+        return getJavaDoc(DEFAULT_CONSTRUCTOR, name, false, null)
+                + getDefaultConstructor(name, modifierType) + NEW_LINE;
+    }
+
+    /**
+     * Returns build method string.
+     *
+     * @param name   class name
+     * @param isRoot true if root node
+     * @return build string
+     */
+    public static String getBuildString(String name, boolean isRoot) {
+        return FOUR_SPACE_INDENTATION + OVERRIDE + NEW_LINE +
+                getBuild(name, isRoot);
+    }
+
+    /**
+     * Returns the getter method strings for class file.
+     *
+     * @param attr               attribute info
+     * @param generatedJavaFiles for the type of java file being generated
+     * @return getter method for class
+     */
+    public static String getGetterForClass(JavaAttributeInfo attr,
+                                           int generatedJavaFiles) {
+
+        String attrQualifiedType = getReturnType(attr);
+        String attributeName = attr.getAttributeName();
+
+        if (!attr.isListAttr()) {
+            return getGetter(attrQualifiedType, attributeName,
+                             generatedJavaFiles);
+        }
+        String attrParam = getListAttribute(attrQualifiedType,
+                                            attr.getCompilerAnnotation());
+        return getGetter(attrParam, attributeName, generatedJavaFiles);
+    }
+
+    /**
+     * Returns getter for attribute.
+     *
+     * @param type    return type
+     * @param name    attribute name
+     * @param genType generated java files
+     * @return getter for attribute
+     */
+    static String getGetter(String type, String name, int genType) {
+        StringBuilder builder = new StringBuilder();
+        if (genType == GENERATE_SERVICE_AND_MANAGER) {
+            //Append method signature.
+            builder.append(methodSignature(getCapitalCase(name), GET,
+                                           PUBLIC, null, type, null,
+                                           CLASS_TYPE))
+                    //Append method body.
+                    .append(methodBody(MANAGER_METHODS, null, null,
+                                       EIGHT_SPACE_INDENTATION, null,
+                                       type, false, null))
+                    .append(signatureClose())
+                    //Append method close.
+                    .append(methodClose(FOUR_SPACE));
+            return builder.toString();
+        }
+        builder.append(methodSignature(name, EMPTY_STRING,
+                                       PUBLIC, null, type, null,
+                                       CLASS_TYPE))
+                //Append method body.
+                .append(methodBody(GETTER, name, name,
+                                   EIGHT_SPACE_INDENTATION, null,
+                                   type, false, null))
+                .append(signatureClose())
+                //Append method close.
+                .append(methodClose(FOUR_SPACE));
+        return builder.toString();
+    }
+
+    /**
+     * Returns the setter method strings for class file.
+     *
+     * @param attr               attribute info
+     * @param className          name of the class
+     * @param generatedJavaFiles generated java files
+     * @return setter method for class
+     */
+    public static String getSetterForClass(JavaAttributeInfo attr,
+                                           String className,
+                                           int generatedJavaFiles) {
+        String attrQualifiedType = getReturnType(attr);
+        String attributeName = attr.getAttributeName();
+        boolean isTypeNull = false;
+        if (attr.getAttributeType() == null) {
+            isTypeNull = true;
+        }
+        if (!attr.isListAttr()) {
+            return getSetter(className, attributeName, attrQualifiedType,
+                             generatedJavaFiles, isTypeNull, false);
+        }
+        String attrParam = getListAttribute(attrQualifiedType,
+                                            attr.getCompilerAnnotation());
+        return getSetter(className, attributeName, attrParam,
+                         generatedJavaFiles, isTypeNull, true);
+    }
+
+    /**
+     * Returns setter for attribute.
+     *
+     * @param className  class name
+     * @param name       attribute name
+     * @param type       return type
+     * @param isTypeNull if attribute type is null
+     * @param isList     true if leaf-list
+     * @return setter for attribute
+     */
+    private static String getSetter(String className, String name, String type,
+                                    int genType,
+                                    boolean isTypeNull, boolean isList) {
+        StringBuilder builder = new StringBuilder();
+        if (genType == GENERATE_SERVICE_AND_MANAGER) {
+            //Append method signature.
+            builder.append(methodSignature(getCapitalCase(name),
+                                           SET_METHOD_PREFIX,
+                                           PUBLIC, name, VOID, type,
+                                           CLASS_TYPE))
+                    //Append method body.
+                    .append(methodBody(MANAGER_METHODS, null, null,
+                                       EIGHT_SPACE_INDENTATION, null, null,
+                                       false, null))
+                    .append(methodClose(FOUR_SPACE));
+            return builder.toString();
+        }
+        if (genType == GENERATE_EVENT_SUBJECT_CLASS) {
+            builder.append(methodSignature(name, EMPTY_STRING, PUBLIC, name, VOID,
+                                           type, CLASS_TYPE))
+
+                    //Append method body.
+                    .append(methodBody(SETTER, name, name,
+                                       EIGHT_SPACE_INDENTATION, null, null,
+                                       false, null))
+                    .append(methodClose(FOUR_SPACE));
+            return builder.toString();
+        }
+        builder.append(methodSignature(name, EMPTY_STRING,
+                                       PUBLIC, name, getCapitalCase(className) +
+                                               BUILDER, type, CLASS_TYPE));
+        if (!isTypeNull && !isList) {
+            builder.append(getLeafFlagSetString(name, VALUE_LEAF, EIGHT_SPACE_INDENTATION,
+                                                SET_METHOD_PREFIX)).append(signatureClose());
+        } else {
+            builder.append(EMPTY_STRING);
+        }
+        //Append method body.
+        builder.append(methodBody(SETTER, name, name,
+                                  EIGHT_SPACE_INDENTATION, null, null,
+                                  true, null))
+                //Append method close.
+                .append(methodClose(FOUR_SPACE));
+        return builder.toString();
+    }
+
+    /**
+     * Returns the setter method strings for class file.
+     *
+     * @param attr attribute info
+     * @return setter method for class
+     */
+    static String getSetterForTypeDefClass(JavaAttributeInfo attr) {
+
+        String attrQualifiedType = getReturnType(attr);
+        String attributeName = attr.getAttributeName();
+        return getTypeDefSetter(attrQualifiedType, attributeName);
+    }
+
+    /**
+     * Returns type def's setter for attribute.
+     *
+     * @param type data type
+     * @param name attribute name
+     * @return setter for type def's attribute
+     */
+    private static String getTypeDefSetter(String type, String name) {
+        return methodSignature(getCapitalCase(name), SET_METHOD_PREFIX, PUBLIC,
+                               name, VOID, type, CLASS_TYPE) +
+                methodBody(SETTER, name, name, EIGHT_SPACE_INDENTATION, null,
+                           null, false, null) + methodClose(FOUR_SPACE);
+    }
+
+    /**
+     * Returns the getter method strings for interface file.
+     *
+     * @param yangName   name of the attribute
+     * @param returnType return type of attribute
+     * @param isList     is list attribute
+     * @param genType    generated java files
+     * @param annotation compiler annotation
+     * @return getter method for interface
+     */
+    static String getGetterForInterface(String yangName, String returnType,
+                                        boolean isList,
+                                        int genType,
+                                        YangCompilerAnnotation annotation) {
+        if (!isList) {
+            return getGetterInterfaceString(returnType, yangName,
+                                            genType);
+        }
+        String listAttr = getListAttribute(returnType, annotation);
+        return getGetterInterfaceString(listAttr, yangName, genType);
+    }
+
+    /**
+     * Returns getter for attribute in interface.
+     *
+     * @param returnType return type
+     * @param yangName   attribute name
+     * @return getter for interface
+     */
+    private static String getGetterInterfaceString(String returnType,
+                                                   String yangName,
+                                                   int genType) {
+        switch (genType) {
+            case GENERATE_SERVICE_AND_MANAGER:
+                return getGetMethodWithArgument(returnType, yangName);
+            default:
+                return methodSignature(yangName, EMPTY_STRING, null,
+                                       null, returnType, null, INTERFACE_TYPE);
+        }
+    }
+
+    /**
+     * Returns the setter method strings for interface file.
+     *
+     * @param attrName   name of the attribute
+     * @param attrType   return type of attribute
+     * @param className  name of the java class being generated
+     * @param isList     is list attribute
+     * @param genType    generated java files
+     * @param annotation compiler annotations
+     * @return setter method for interface
+     */
+    static String getSetterForInterface(String attrName, String attrType,
+                                        String className,
+                                        boolean isList, int genType,
+                                        YangCompilerAnnotation annotation) {
+        if (!isList) {
+            return getSetterInterfaceString(className, attrName, attrType,
+                                            genType);
+        }
+
+        String listAttr = getListAttribute(attrType, annotation);
+        return getSetterInterfaceString(className, attrName, listAttr, genType);
+    }
+
+    /**
+     * Returns setter string for interface.
+     *
+     * @param name     class name
+     * @param attrName attribute name
+     * @param attrType attribute type
+     * @return setter string
+     */
+    private static String getSetterInterfaceString(String name,
+                                                   String attrName,
+                                                   String attrType,
+                                                   int genType) {
+        if (genType == GENERATE_SERVICE_AND_MANAGER) {
+            return methodSignature(getCapitalCase(attrName),
+                                   SET_METHOD_PREFIX,
+                                   null, attrName, VOID, attrType +
+                                           OP_PARAM, INTERFACE_TYPE);
+        }
+        return methodSignature(attrName, EMPTY_STRING, null,
+                               attrName, name + BUILDER, attrType, INTERFACE_TYPE);
+    }
+
+    /**
+     * Returns return type for attribute.
+     *
+     * @param attr attribute info
+     * @return return type
+     */
+    private static String getReturnType(JavaAttributeInfo attr) {
+        StringBuilder builder = new StringBuilder();
+
+        if (attr.isQualifiedName() &&
+                attr.getImportInfo().getPkgInfo() != null) {
+            builder.append(attr.getImportInfo().getPkgInfo()).append(PERIOD);
+        }
+        builder.append(attr.getImportInfo().getClassInfo());
+
+        if (attr.getAttributeType() != null &&
+                attr.getAttributeType().getDataType() == IDENTITYREF) {
+            return CLASS_STRING + DIAMOND_OPEN_BRACKET +
+                    QUESTION_MARK + SPACE + EXTEND + SPACE +
+                    builder.toString() + DIAMOND_CLOSE_BRACKET;
+        }
+        return builder.toString();
+    }
+
+    /**
+     * Returns the build method strings for interface file.
+     *
+     * @param yangName name of the interface
+     * @return build method for interface
+     */
+    static String getBuildForInterface(String yangName) {
+        return methodSignature(BUILD, EMPTY_STRING, null, null,
+                               yangName, null, INTERFACE_TYPE);
+    }
+
+    /**
+     * Returns constructor string for impl class.
+     *
+     * @param yangName   class name
+     * @param isRootNode if root node
+     * @return constructor string
+     */
+    static String getConstructorStart(String yangName,
+                                      boolean isRootNode) {
+        StringBuilder builder = new StringBuilder(
+                getConstructorString(yangName));
+
+        String name = getCapitalCase(yangName);
+        String returnType = DEFAULT_CAPS + name;
+        if (isRootNode) {
+            returnType = name + OP_PARAM;
+        }
+        builder.append(methodSignature(
+                returnType, EMPTY_STRING, PROTECTED, BUILDER_LOWER_CASE + OBJECT,
+                null, name + BUILDER, CLASS_TYPE));
+        return builder.toString();
+    }
+
+    /**
+     * Returns the constructor strings for class file.
+     *
+     * @param attr    attribute info
+     * @param genType generated java files
+     * @return constructor for class
+     */
+    public static String getConstructor(JavaAttributeInfo attr, int genType) {
+        String attrName = attr.getAttributeName();
+        String attrCaps = getCapitalCase(attrName);
+        switch (genType) {
+            case GENERATE_SERVICE_AND_MANAGER:
+                return methodBody(MethodBodyTypes.CONSTRUCTOR, attrName,
+                                  attrCaps, EIGHT_SPACE_INDENTATION, GET, null,
+                                  false, null);
+            default:
+                return methodBody(MethodBodyTypes.CONSTRUCTOR, attrName,
+                                  attrName, EIGHT_SPACE_INDENTATION, EMPTY_STRING,
+                                  null, false, null);
+        }
+    }
+
+    /**
+     * Returns the rpc strings for service interface.
+     *
+     * @param rpcName name of the rpc
+     * @param input   name of input
+     * @param output  name of output
+     * @return rpc method string
+     */
+    public static String getRpcServiceMethod(String rpcName, String input,
+                                             String output) {
+        String inputVal = null;
+        if (input != null) {
+            inputVal = RPC_INPUT_VAR_NAME;
+        }
+        return methodSignature(rpcName, EMPTY_STRING, null,
+                               inputVal, output, input, INTERFACE_TYPE) +
+                NEW_LINE;
+    }
+
+    /**
+     * Returns the build method strings for class file.
+     *
+     * @param yangName   class name
+     * @param isRootNode if root node
+     * @return build method string for class
+     */
+    static String getBuild(String yangName, boolean isRootNode) {
+        String type = DEFAULT_CAPS + yangName;
+        if (isRootNode) {
+            type = yangName + OP_PARAM;
+        }
+        return methodSignature(BUILD, EMPTY_STRING, PUBLIC, null,
+                               yangName, null,
+                               CLASS_TYPE) +
+                methodBody(MethodBodyTypes.BUILD, type, BUILD,
+                           EIGHT_SPACE_INDENTATION, EMPTY_STRING,
+                           null, false, null) +
+                methodClose(FOUR_SPACE);
+    }
+
+    /**
+     * Returns the Default constructor strings for class file.
+     *
+     * @param name         name of the class
+     * @param modifierType modifier type for default constructor
+     * @return Default constructor for class
+     */
+    private static String getDefaultConstructor(String name,
+                                                String modifierType) {
+        return methodSignature(name, EMPTY_STRING, modifierType, null,
+                               null, null, CLASS_TYPE) +
+                methodClose(FOUR_SPACE);
+    }
+
+    /**
+     * Returns to string method's open strings.
+     *
+     * @return string method's open string
+     */
+    static String getToStringMethodOpen() {
+        StringBuilder builder = new StringBuilder(getOverRideString());
+        builder.append(methodSignature(TO_STRING_METHOD, EMPTY_STRING,
+                                       PUBLIC, null, STRING_DATA_TYPE, null,
+                                       CLASS_TYPE));
+        builder.append(getReturnString(GOOGLE_MORE_OBJECT_METHOD_STRING,
+                                       EIGHT_SPACE_INDENTATION)).append(NEW_LINE)
+                .append(getOmitNullValueString());
+        return builder.toString();
+    }
+
+    /**
+     * Returns to string method's close string.
+     *
+     * @return to string method close string
+     */
+    static String getToStringMethodClose() {
+        return TWELVE_SPACE_INDENTATION + PERIOD + TO_STRING_METHOD +
+                brackets(OPEN_CLOSE_BRACKET, null, null) + signatureClose() +
+                methodClose(FOUR_SPACE);
+    }
+
+    /**
+     * Returns to string method for class.
+     *
+     * @param attr java attribute
+     * @return to string method for class
+     */
+    public static String getToStringMethod(JavaAttributeInfo attr) {
+        return methodBody(TO_STRING, attr.getAttributeName(), null,
+                          TWELVE_SPACE_INDENTATION, null, null, false, null);
+    }
+
+    /**
+     * Returns from string method's open string.
+     *
+     * @param className name of the class
+     * @return from string method's open string
+     */
+    static String getFromStringMethodSignature(String className) {
+        return getJavaDoc(FROM_METHOD, className, false, null) +
+                methodSignature(FROM_STRING_METHOD_NAME, EMPTY_STRING, PUBLIC +
+                                        SPACE + STATIC, FROM_STRING_PARAM_NAME,
+                                className, STRING_DATA_TYPE,
+                                CLASS_TYPE);
+    }
+
+    /**
+     * Return from string method's close string.
+     *
+     * @return from string method's close string
+     */
+    static String getFromStringMethodClose() {
+        return methodClose(FOUR_SPACE);
+    }
+
+    /**
+     * Return from string method's body string.
+     *
+     * @param attr     attribute info
+     * @param fromAttr attribute info for the from string wrapper
+     *                 type
+     * @return from string method's body string
+     */
+    public static String getFromStringMethod(JavaAttributeInfo attr,
+                                             JavaAttributeInfo fromAttr) {
+
+        return EIGHT_SPACE_INDENTATION + getTrySubString() +
+                getNewLineAndSpace(TWELVE_SPACE_INDENTATION) +
+                getParsedSubString(attr, fromAttr) +
+                getReturnOfSubString() + EIGHT_SPACE_INDENTATION +
+                getCatchSubString(attr.getCurHolderOrCount());
+    }
+
+    /**
+     * Returns sub string with parsed statement for union's from string method.
+     *
+     * @param attr attribute info
+     * @return sub string with parsed statement for union's from string method
+     */
+    private static String getParsedSubString(JavaAttributeInfo attr,
+                                             JavaAttributeInfo fromStringAttr) {
+
+        String targetDataType = getReturnType(attr);
+        YangDataTypes types = fromStringAttr.getAttributeType()
+                .getDataType();
+        StringBuilder method = new StringBuilder();
+        switch (types) {
+            case BITS:
+                return targetDataType + SPACE + TMP_VAL + SPACE + EQUAL +
+                        SPACE + getCapitalCase(attr.getAttributeName()) +
+                        PERIOD + FROM_STRING_METHOD_NAME +
+                        getOpenCloseParaWithValue(FROM_STRING_PARAM_NAME) +
+                        signatureClose();
+            case BINARY:
+                return method.append(targetDataType).append(SPACE).append(TMP_VAL)
+                        .append(SPACE).append(EQUAL).append(SPACE).append(
+                                geStringConverterForBinary(FROM_STRING_PARAM_NAME))
+                        .append(signatureClose()).toString();
+            default:
+                return targetDataType + SPACE + TMP_VAL + SPACE + EQUAL +
+                        SPACE + getParseFromStringMethod(
+                        targetDataType, fromStringAttr.getAttributeType()) +
+                        getOpenCloseParaWithValue(FROM_STRING_PARAM_NAME) +
+                        signatureClose();
+        }
+    }
+
+    /**
+     * Returns from string converter for binary type.
+     *
+     * @param var variable name
+     * @return to string method body
+     */
+    private static String geStringConverterForBinary(String var) {
+        StringBuilder builder = new StringBuilder();
+        return builder.append(BASE64).append(PERIOD)
+                .append(GET_DECODER).append(OPEN_CLOSE_BRACKET_STRING).append(PERIOD)
+                .append(DECODE).append(getOpenCloseParaWithValue(var)).toString();
+    }
+
+    /**
+     * Returns to string converter for binary type.
+     *
+     * @param var variable name
+     * @return to string method body
+     */
+    private static String getToStringForBinary(String var) {
+        StringBuilder builder = new StringBuilder();
+        return builder.append(BASE64).append(PERIOD)
+                .append(GET_ENCODER).append(OPEN_CLOSE_BRACKET_STRING)
+                .append(PERIOD).append(ENCODE_TO_STRING)
+                .append(getOpenCloseParaWithValue(var)).toString();
+    }
+
+    /**
+     * Returns hash code method open strings.
+     *
+     * @return hash code method open string
+     */
+    static String getHashCodeMethodOpen() {
+        String line;
+        StringBuilder builder = new StringBuilder(getOverRideString());
+        builder.append(methodSignature(HASH_CODE_STRING, EMPTY_STRING, PUBLIC,
+                                       null, INT, null, CLASS_TYPE));
+        line = getReturnString(OBJECT_STRING + SUFFIX_S + PERIOD + HASH +
+                                       OPEN_PARENTHESIS, EIGHT_SPACE_INDENTATION);
+        builder.append(line);
+        return builder.toString();
+    }
+
+    /**
+     * Returns hash code methods close string.
+     *
+     * @param hashcodeString hash code string
+     * @return to hash code method close string
+     */
+    static String getHashCodeMethodClose(String hashcodeString) {
+        String[] array = {SPACE, COMMA};
+        hashcodeString = trimAtLast(hashcodeString, array);
+        return hashcodeString + CLOSE_PARENTHESIS + signatureClose() +
+                methodClose(FOUR_SPACE);
+    }
+
+    /**
+     * Returns hash code method for class.
+     *
+     * @param attr attribute info
+     * @return hash code method
+     */
+    public static String getHashCodeMethod(JavaAttributeInfo attr) {
+        return attr.getAttributeName() + COMMA + SPACE;
+    }
+
+    /**
+     * Returns equals method open strings.
+     *
+     * @param className class name
+     * @return equals method open string
+     */
+    static String getEqualsMethodOpen(String className) {
+        return getOverRideString() +
+                methodSignature(EQUALS_STRING, EMPTY_STRING, PUBLIC, OBJ,
+                                BOOLEAN_DATA_TYPE, OBJECT_STRING,
+                                CLASS_TYPE) +
+                getEqualsMethodsCommonIfCondition() +
+                getEqualsMethodsSpecificIfCondition(className);
+    }
+
+    /**
+     * Returns equal methods if condition string.
+     *
+     * @return if condition string
+     */
+    private static String getEqualsMethodsCommonIfCondition() {
+        return getIfConditionBegin(EIGHT_SPACE_INDENTATION, THIS + SPACE +
+                EQUAL + EQUAL + SPACE + OBJ) + getReturnString(
+                TRUE, TWELVE_SPACE_INDENTATION) + signatureClose()
+                + methodClose(EIGHT_SPACE);
+    }
+
+    /**
+     * Returns if condition for specific class object in equals method.
+     *
+     * @param className class name
+     * @return if condition string
+     */
+    private static String getEqualsMethodsSpecificIfCondition(String className) {
+        return EIGHT_SPACE_INDENTATION + IF + SPACE + OPEN_PARENTHESIS + OBJ +
+                INSTANCE_OF + className + CLOSE_PARENTHESIS + SPACE +
+                OPEN_CURLY_BRACKET + NEW_LINE + TWELVE_SPACE_INDENTATION +
+                className + SPACE + OTHER + SPACE + EQUAL + SPACE +
+                OPEN_PARENTHESIS + className + CLOSE_PARENTHESIS + SPACE + OBJ +
+                SEMI_COLON + NEW_LINE + TWELVE_SPACE_INDENTATION + RETURN +
+                NEW_LINE;
+    }
+
+    /**
+     * Returns equals methods close string.
+     *
+     * @param equalMethodString equal method string
+     * @return equals method close string
+     */
+    static String getEqualsMethodClose(String equalMethodString) {
+        String[] array = {NEW_LINE, AND, AND, SPACE};
+        equalMethodString = trimAtLast(equalMethodString, array) +
+                signatureClose();
+        return equalMethodString + methodClose(EIGHT_SPACE) +
+                getReturnString(FALSE, EIGHT_SPACE_INDENTATION) +
+                signatureClose() + methodClose(FOUR_SPACE);
+    }
+
+    /**
+     * Returns equals method for class.
+     *
+     * @param attr attribute info
+     * @return equals method
+     */
+    public static String getEqualsMethod(JavaAttributeInfo attr) {
+        String attributeName = attr.getAttributeName();
+        if (attributeName.contains(OPERATION_TYPE_ATTRIBUTE)) {
+            return SIXTEEN_SPACE_INDENTATION + OBJECT_STRING + SUFFIX_S +
+                    NEW_LINE + SIXTEEN_SPACE_INDENTATION +
+                    PERIOD + EQUALS_STRING + OPEN_PARENTHESIS + attributeName +
+                    COMMA + NEW_LINE + SIXTEEN_SPACE_INDENTATION + SPACE + OTHER
+                    + PERIOD + attributeName + CLOSE_PARENTHESIS + SPACE + AND +
+                    AND;
+        }
+        return SIXTEEN_SPACE_INDENTATION + OBJECT_STRING + SUFFIX_S +
+                PERIOD + EQUALS_STRING + OPEN_PARENTHESIS + attributeName +
+                COMMA + SPACE + OTHER + PERIOD + attributeName +
+                CLOSE_PARENTHESIS + SPACE + AND + AND;
+    }
+
+    /**
+     * Returns of method's string and java doc for special type.
+     *
+     * @param attr      attribute info
+     * @param className class name
+     * @return of method's string and java doc for special type
+     */
+
+    public static String getOfMethodStringAndJavaDoc(JavaAttributeInfo attr,
+                                                     String className) {
+        String attrType = getReturnType(attr);
+        String attrName = attr.getAttributeName();
+
+        return getJavaDoc(OF_METHOD, className + FOR_TYPE_STRING + attrName,
+                          false, null) + getOfMethodString(attrType, className);
+    }
+
+    /**
+     * Returns of method's string.
+     *
+     * @param type data type
+     * @param name class name
+     * @return of method's string
+     */
+    private static String getOfMethodString(String type, String name) {
+        return methodSignature(OF, EMPTY_STRING, PUBLIC + SPACE + STATIC,
+                               VALUE, name, type, CLASS_TYPE) +
+                methodBody(MethodBodyTypes.OF_METHOD, name, null,
+                           EIGHT_SPACE_INDENTATION, EMPTY_STRING, null, false, null) +
+                methodClose(FOUR_SPACE);
+    }
+
+    /**
+     * Returns string and java doc for constructor of type class.
+     *
+     * @param attr      attribute info
+     * @param className class name
+     * @param genType   generate file type
+     * @param count     type count
+     * @return string and java doc for constructor of type class
+     */
+    public static String getTypeConstructorStringAndJavaDoc(
+            JavaAttributeInfo attr, String className, int genType, int count) {
+        String attrType = getReturnType(attr);
+        String attrName = attr.getAttributeName();
+        return getJavaDoc(TYPE_CONSTRUCTOR, attrName, false, null) +
+                getTypeConstructorString(attrType, attrName, className,
+                                         genType, count);
+    }
+
+    /**
+     * Returns string and java doc for constructor of type class.
+     *
+     * @param attr1    first attribute info
+     * @param attr2    second attribute info
+     * @param genType  class name
+     * @param type     conflict validate type
+     * @param addFirst whether int came first or uInt came first
+     * @param count    type count
+     * @return string and java doc for constructor of type class
+     */
+    public static String getTypeConstructorStringAndJavaDoc(
+            JavaAttributeInfo attr1, JavaAttributeInfo attr2, String genType,
+            ValidatorTypeForUnionTypes type, boolean addFirst, int count) {
+
+        String attrType = getReturnType(attr1);
+        String attrName1 = "";
+        String attrName2 = "";
+        if (attr1 != null) {
+            if (addFirst) {
+                attrName1 = attr1.getAttributeName();
+            } else {
+                attrName2 = attr1.getAttributeName();
+            }
+        }
+        if (attr2 != null) {
+            if (addFirst) {
+                attrName2 = attr2.getAttributeName();
+            } else {
+                attrName1 = attr2.getAttributeName();
+            }
+        }
+
+        String appDataStructure = null;
+        if (attr1 != null && attr1.getCompilerAnnotation() != null) {
+            appDataStructure =
+                    attr1.getCompilerAnnotation().getYangAppDataStructure()
+                            .getDataStructure().name();
+        }
+        String doc;
+        if (attrName1.isEmpty()) {
+            doc = attrName2;
+        } else {
+            doc = attrName1;
+        }
+        return getJavaDoc(TYPE_CONSTRUCTOR, doc, false, appDataStructure) +
+                getTypeConstructorString(attrType, attrName1,
+                                         attrName2, genType,
+                                         type, addFirst, count);
+    }
+
+    /**
+     * Returns type constructor string.
+     *
+     * @param type      data type
+     * @param name      attribute name
+     * @param className class name
+     * @param genType   generated file type
+     * @param count     type count
+     * @return type constructor string
+     */
+    private static String getTypeConstructorString(String type, String name,
+                                                   String className, int genType, int count) {
+        StringBuilder builder = new StringBuilder();
+        builder.append(
+                methodSignature(className, EMPTY_STRING, PUBLIC, name,
+                                null, type, CLASS_TYPE));
+        if (genType == GENERATE_UNION_CLASS) {
+            builder.append(EIGHT_SPACE_INDENTATION).append(SET_VALUE_PARA)
+                    .append(PERIOD).append(SET_METHOD_PREFIX).append(
+                    getOpenCloseParaWithValue(count + EMPTY_STRING))
+                    .append(signatureClose());
+        }
+        builder.append(methodBody(SETTER, name, null, EIGHT_SPACE_INDENTATION,
+                                  EMPTY_STRING, null, false, null))
+                .append(methodClose(FOUR_SPACE));
+        return builder.toString();
+    }
+
+    /**
+     * Returns type constructor string.
+     *
+     * @param type      data type
+     * @param attr1     attribute attr1
+     * @param className class attr1
+     * @param count     type count
+     * @return type constructor string
+     */
+    private static String getTypeConstructorString(
+            String type, String attr1, String attr2, String className,
+            ValidatorTypeForUnionTypes validatorType, boolean addInt, int count) {
+        StringBuilder constructor = new StringBuilder(
+                methodSignature(className, EMPTY_STRING, PUBLIC, attr1,
+                                null, type, CLASS_TYPE))
+                .append(EIGHT_SPACE_INDENTATION).append(SET_VALUE_PARA)
+                .append(PERIOD).append(SET_METHOD_PREFIX).append(
+                        getOpenCloseParaWithValue(count + EMPTY_STRING))
+                .append(signatureClose())
+                .append(ifConditionForIntInTypeDefConstructor(validatorType,
+                                                              addInt, attr1))
+                .append(methodBody(SETTER, attr1, null,
+                                   TWELVE_SPACE_INDENTATION, EMPTY_STRING,
+                                   null, false, attr1));
+        String str = EIGHT_SPACE_INDENTATION + CLOSE_CURLY_BRACKET +
+                ELSE + OPEN_CURLY_BRACKET + NEW_LINE;
+        constructor.append(str)
+                .append(methodBody(SETTER, attr2, null,
+                                   TWELVE_SPACE_INDENTATION, EMPTY_STRING,
+                                   null, false, attr1))
+                .append(methodClose(FOUR_SPACE))
+                .append(methodClose(EIGHT_SPACE));
+
+        return constructor.toString();
+    }
+
+    /**
+     * Returns interface of add augmentation.
+     *
+     * @param className class name
+     * @return interface of add augmentation
+     */
+    static String getAddAugmentInfoMethodInterface(String className) {
+        StringBuilder builder = new StringBuilder(generateForAddAugmentation(className));
+        LinkedHashMap<String, String> map = new LinkedHashMap<>();
+        map.put(VALUE, OBJECT_STRING);
+        map.put(CLASS + OBJECT_STRING, CLASS_STRING);
+        builder.append(multiAttrMethodSignature(ADD_STRING + YANG_AUGMENTED_INFO,
+                                                null, null, className, map,
+                                                INTERFACE_TYPE));
+        return builder.toString();
+    }
+
+    /**
+     * Returns implementation of add augmentation.
+     *
+     * @param className class name
+     * @return implementation of add augmentation
+     */
+    static String getAddAugmentInfoMethodImpl(String className) {
+        StringBuilder builder = new StringBuilder(getOverRideString());
+        LinkedHashMap<String, String> map = new LinkedHashMap<>();
+        map.put(VALUE, OBJECT_STRING);
+        map.put(CLASS + OBJECT_STRING, CLASS_STRING);
+        builder.append(multiAttrMethodSignature(ADD_STRING + YANG_AUGMENTED_INFO,
+                                                null, PUBLIC,
+                                                className, map, CLASS_TYPE))
+                .append(methodBody(AUGMENTED_MAP_ADD, null, null,
+                                   EIGHT_SPACE_INDENTATION, null, null, false, null))
+                .append(getReturnString(THIS, EIGHT_SPACE_INDENTATION))
+                .append(signatureClose())
+                .append(methodClose(FOUR_SPACE));
+        return builder.toString();
+    }
+
+    /**
+     * Returns interface of get YANG augment info.
+     *
+     * @return interface of get YANG augment info
+     */
+    static String getYangAugmentInfoInterface() {
+        return generateForGetAugmentation() +
+                methodSignature(YANG_AUGMENTED_INFO_LOWER_CASE, EMPTY_STRING,
+                                null, CLASS + OBJECT_STRING,
+                                OBJECT_STRING, CLASS_STRING, INTERFACE_TYPE);
+    }
+
+    /**
+     * Returns implementation of get YANG augment info.
+     *
+     * @return implementation of get YANG augment info
+     */
+    static String getYangAugmentInfoImpl() {
+        return getOverRideString() +
+                methodSignature(YANG_AUGMENTED_INFO_LOWER_CASE, EMPTY_STRING,
+                                PUBLIC, CLASS + OBJECT_STRING, OBJECT_STRING,
+                                CLASS_STRING, CLASS_TYPE) +
+                methodBody(AUGMENTED_MAP_GET_VALUE, null, null,
+                           EIGHT_SPACE_INDENTATION, null, null, false, null) +
+                methodClose(FOUR_SPACE);
+    }
+
+    /**
+     * Returns enum's constructor.
+     *
+     * @param className enum's class name
+     * @return enum's constructor
+     */
+    static String getEnumsConstructor(String className) {
+        StringBuilder builder = new StringBuilder(
+                getJavaDoc(TYPE_CONSTRUCTOR, className, false, null));
+        String clsName = getSmallCase(className);
+        LinkedHashMap<String, String> map = new LinkedHashMap<>();
+        map.put(clsName, INT);
+        map.put(SCHEMA_NAME, STRING_DATA_TYPE);
+        builder.append(multiAttrMethodSignature(className, EMPTY_STRING,
+                                                EMPTY_STRING, null,
+                                                map, CLASS_TYPE))
+                .append(methodBody(SETTER, clsName, EMPTY_STRING,
+                                   EIGHT_SPACE_INDENTATION, EMPTY_STRING,
+                                   EMPTY_STRING, false, null))
+                .append(methodBody(SETTER, SCHEMA_NAME, EMPTY_STRING,
+                                   EIGHT_SPACE_INDENTATION, EMPTY_STRING,
+                                   EMPTY_STRING, false, null))
+                .append(methodClose(FOUR_SPACE));
+
+        return builder.toString();
+    }
+
+    /**
+     * Returns of method for enum class.
+     *
+     * @param className class name
+     * @param type      method body type
+     * @return of method
+     */
+    static String getEnumsOfValueMethod(String className,
+                                        YangEnumeration enumeration,
+                                        MethodBodyTypes type) {
+        String name = getCapitalCase(className);
+        StringBuilder builder = new StringBuilder(getJavaDoc(
+                OF_METHOD, name + SPACE + FOR,
+                false, null));
+        //Switch statement.
+        String sw = EIGHT_SPACE_INDENTATION + SWITCH + SPACE +
+                getOpenCloseParaWithValue(VALUE) +
+                methodSignatureClose(CLASS_TYPE);
+        String str;
+        switch (type) {
+            case ENUM_METHOD_INT_VALUE:
+                builder.append(getEnumValueMethodSignature(name, INT))
+                        .append(sw);
+                for (YangEnum yangEnum : enumeration.getEnumSet()) {
+                    str = getEnumJavaAttribute(yangEnum.getNamedValue())
+                            .toUpperCase();
+                    builder.append(getEnumValueMethodCases(
+                            EMPTY_STRING + yangEnum.getValue(), str, name));
+                }
+                break;
+            case ENUM_METHOD_STRING_VALUE:
+                builder.append(getEnumValueMethodSignature(name,
+                                                           STRING_DATA_TYPE))
+                        .append(sw);
+                for (YangEnum yangEnum : enumeration.getEnumSet()) {
+                    str = getEnumJavaAttribute(yangEnum.getNamedValue())
+                            .toUpperCase();
+                    builder.append(getEnumValueMethodCases(
+                            QUOTES + yangEnum.getNamedValue() + QUOTES, str,
+                            name));
+                }
+                break;
+            default:
+                return null;
+        }
+
+        String method = TWELVE_SPACE_INDENTATION + DEFAULT + SPACE + COLON +
+                NEW_LINE;
+        builder.append(method)
+                .append(getExceptionThrowString(SIXTEEN_SPACE_INDENTATION))
+                .append(methodClose(EIGHT_SPACE))
+                .append(methodClose(FOUR_SPACE));
+
+        return builder.toString();
+    }
+
+    /**
+     * Returns enum value method signature.
+     *
+     * @param name method name
+     * @param type param type
+     * @return enum value method signature
+     */
+    private static String getEnumValueMethodSignature(String name, String type) {
+        return methodSignature(OF, EMPTY_STRING, PUBLIC + SPACE +
+                STATIC, VALUE, name, type, CLASS_TYPE);
+    }
+
+    /**
+     * Returns enum value method's cases.
+     *
+     * @param caseType case type
+     * @param value    return value
+     * @param name     name of class
+     * @return enum value method's cases
+     */
+    private static String getEnumValueMethodCases(String caseType, String value,
+                                                  String name) {
+        return TWELVE_SPACE_INDENTATION + CASE + SPACE + caseType +
+                COLON + NEW_LINE + getReturnString(name,
+                                                   SIXTEEN_SPACE_INDENTATION) +
+                PERIOD + value + signatureClose();
+    }
+
+    /**
+     * Returns augmented data getter and setter methods for service class.
+     *
+     * @param parent parent node
+     * @return augmented data getter and setter methods for service class
+     */
+    static String getAugmentsDataMethodForService(YangNode parent) {
+        List<YangAtomicPath> targets = getSetOfNodeIdentifiers(parent);
+        if (targets.isEmpty()) {
+            return EMPTY_STRING;
+        }
+        YangNode first = targets.get(0).getResolvedNode();
+        //If target path is for notification then no need to generate get/set
+        // for that augment in service class.
+        if (first instanceof InvalidOpTypeHolder) {
+            return EMPTY_STRING;
+        }
+        YangNode augmentedNode;
+        String curNodeName;
+        String method;
+        StringBuilder methods = new StringBuilder();
+        String parentName;
+        String returnType;
+        YangNode methodNode;
+        YangPluginConfig pluginConfig =
+                ((JavaFileInfoContainer) parent).getJavaFileInfo()
+                        .getPluginConfig();
+        for (YangAtomicPath nodeId : targets) {
+            augmentedNode = nodeId.getResolvedNode().getParent();
+            methodNode = nodeId.getResolvedNode();
+            if (((JavaFileInfoContainer) methodNode).getJavaFileInfo()
+                    .getJavaName() != null) {
+                curNodeName =
+                        ((JavaFileInfoContainer) methodNode).getJavaFileInfo()
+                                .getJavaName();
+            } else {
+                curNodeName = getCapitalCase(
+                        getCamelCase(methodNode.getName(),
+                                     pluginConfig.getConflictResolver()));
+            }
+            returnType =
+                    getAugmentedClassNameForDataMethods(augmentedNode, parent);
+            parentName = getCurNodeName(augmentedNode,
+                                        pluginConfig);
+            method = generateForGetMethodWithAttribute(returnType) +
+                    getGetMethodWithArgument(returnType, AUGMENTED +
+                            parentName + getCapitalCase(curNodeName)) + NEW_LINE;
+            methods.append(method);
+
+            method = getJavaDoc(MANAGER_SETTER_METHOD,
+                                AUGMENTED + getCapitalCase(parentName) +
+                                        getCapitalCase(curNodeName), false,
+                                null) +
+                    getSetterForInterface(getSmallCase(AUGMENTED) + parentName +
+                                                  getCapitalCase(curNodeName),
+                                          returnType, parentName, false,
+                                          GENERATE_SERVICE_AND_MANAGER, null) +
+                    NEW_LINE;
+            methods.append(method);
+        }
+        return methods.toString();
+    }
+
+    /**
+     * Returns validator method for range in union class.
+     *
+     * @param type type
+     * @return validator method for range in union class
+     */
+    static String getRangeValidatorMethodForUnion(String type) {
+        String newType;
+        if (type.contentEquals(BIG_INTEGER)) {
+            newType = LONG;
+        } else {
+            newType = INT;
+        }
+        StringBuilder builder = new StringBuilder(generateForValidatorMethod());
+        String var = getSmallCase(BIG_INTEGER);
+        LinkedHashMap<String, String> map = new LinkedHashMap<>();
+        map.put(MIN_RANGE, type);
+        map.put(MAX_RANGE, type);
+        map.put(VALUE, newType);
+        builder.append(multiAttrMethodSignature(VALIDATE_RANGE, EMPTY_STRING,
+                                                PRIVATE, BOOLEAN_DATA_TYPE, map,
+                                                CLASS_TYPE));
+        if (type.contentEquals(BIG_INTEGER)) {
+            //Create new instance of big integer.
+            builder.append(getNewInstance(BIG_INTEGER, var, EIGHT_SPACE_INDENTATION,
+                                          QUOTES + SPACE + QUOTES + SPACE +
+                                                  ADD + SPACE + VALUE))
+                    //Add return string.
+                    .append(getReturnString(var, EIGHT_SPACE_INDENTATION))
+                    //Add compareTo string
+                    .append(getCompareToString())
+                    //Add && condition.
+                    .append(ifAndAndCondition(
+                            //Add == condition
+                            ifEqualEqualCondition(
+                                    getOpenCloseParaWithValue(MIN_RANGE), ONE),
+                            var))
+                    //Add compareTo string.
+                    .append(getCompareToString())
+                    //Add == condition.
+                    .append(ifEqualEqualCondition(
+                            getOpenCloseParaWithValue(MAX_RANGE), ONE))
+                    .append(signatureClose());
+        } else {
+            builder.append(getReturnString(VALUE, EIGHT_SPACE_INDENTATION))
+                    .append(getGreaterThanCondition())
+                    .append(ifAndAndCondition(MIN_RANGE, VALUE))
+                    .append(getLesserThanCondition())
+                    .append(MAX_RANGE)
+                    .append(signatureClose());
+        }
+        builder.append(methodClose(FOUR_SPACE));
+        return builder.toString();
+    }
+
+    //Get method with arguments.
+    private static String getGetMethodWithArgument(String returnType,
+                                                   String yangName) {
+        return methodSignature(getCapitalCase(yangName), GET_METHOD_PREFIX,
+                               null, getSmallCase(returnType),
+                               returnType, returnType + OP_PARAM,
+                               INTERFACE_TYPE);
+    }
+
+    /**
+     * Returns add to list method interface.
+     *
+     * @param attr      java attribute
+     * @param className name of the class
+     * @return add to list method interface
+     */
+    public static String getAddToListMethodInterface(JavaAttributeInfo attr,
+                                                     String className) {
+
+        String methodName = ADD_STRING + TO_CAPS + getCapitalCase(
+                attr.getAttributeName());
+        String retType = getReturnType(attr);
+        YangDataStructure struct = getYangDataStructure(attr.getCompilerAnnotation());
+        if (struct != null) {
+            switch (struct) {
+                case MAP:
+                    Map<String, String> param = new LinkedHashMap<>();
+                    param.put(attr.getAttributeName() + KEYS, retType + KEYS);
+                    param.put(attr.getAttributeName() + VALUE_CAPS, retType);
+                    return multiAttrMethodSignature(methodName, null, null,
+                                                    className + BUILDER, param,
+                                                    INTERFACE_TYPE);
+                default:
+                    return methodSignature(methodName, null, null, ADD_STRING + TO_CAPS,
+                                           className + BUILDER, retType,
+                                           INTERFACE_TYPE);
+            }
+        }
+        return methodSignature(methodName, null, null, ADD_STRING + TO_CAPS,
+                               className + BUILDER, getReturnType(attr),
+                               INTERFACE_TYPE);
+    }
+
+    /**
+     * Returns YANG data structure from java attribute.
+     *
+     * @param annotation compiler annotation
+     * @return YANG data structure from java attribute
+     */
+    public static YangDataStructure getYangDataStructure(
+            YangCompilerAnnotation annotation) {
+        if (annotation != null) {
+            YangAppDataStructure data = annotation.getYangAppDataStructure();
+            if (data != null) {
+                return data.getDataStructure();
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Returns add to list method impl.
+     *
+     * @param attr java attribute
+     * @param name class name
+     * @return add to list method impl
+     */
+    public static String getAddToListMethodImpl(JavaAttributeInfo attr,
+                                                String name) {
+        String attrName = attr.getAttributeName();
+        String retString = getOverRideString();
+        String methodName = ADD_STRING + TO_CAPS + getCapitalCase(attrName);
+        StringBuilder builder = new StringBuilder(retString);
+        String retType = getReturnType(attr);
+        YangDataStructure struct = getYangDataStructure(attr.getCompilerAnnotation());
+        if (struct != null) {
+            switch (struct) {
+                case MAP:
+                    Map<String, String> param = new LinkedHashMap<>();
+                    param.put(attr.getAttributeName() + KEYS, retType + KEYS);
+                    param.put(attr.getAttributeName() + VALUE_CAPS, retType);
+                    builder.append(multiAttrMethodSignature(methodName,
+                                                            null, PUBLIC,
+                                                            name + BUILDER, param,
+                                                            CLASS_TYPE))
+                            .append(getIfConditionForAddToListMethod(attr));
+                    retString = EIGHT_SPACE_INDENTATION + attrName + PERIOD +
+                            PUT + getOpenCloseParaWithValue(
+                            attrName + KEYS + COMMA + SPACE + attrName +
+                                    VALUE_CAPS);
+                    break;
+                default:
+                    builder.append(methodSignature(methodName,
+                                                   null, PUBLIC,
+                                                   ADD_STRING + TO_CAPS,
+                                                   name + BUILDER, retType,
+                                                   CLASS_TYPE))
+                            .append(getIfConditionForAddToListMethod(attr));
+                    retString = EIGHT_SPACE_INDENTATION + attrName + PERIOD + ADD_STRING +
+                            OPEN_PARENTHESIS + ADD_STRING + TO_CAPS + CLOSE_PARENTHESIS;
+            }
+        } else {
+            builder.append(methodSignature(ADD_STRING + TO_CAPS +
+                                                   getCapitalCase(attrName),
+                                           null, PUBLIC, ADD_STRING + TO_CAPS,
+                                           name + BUILDER, retType,
+                                           CLASS_TYPE))
+                    .append(getIfConditionForAddToListMethod(attr));
+            retString = EIGHT_SPACE_INDENTATION + attrName + PERIOD + ADD_STRING +
+                    OPEN_PARENTHESIS + ADD_STRING + TO_CAPS + CLOSE_PARENTHESIS;
+        }
+        builder.append(retString)
+                .append(signatureClose())
+                .append(getReturnString(THIS, EIGHT_SPACE_INDENTATION))
+                .append(signatureClose())
+                .append(methodClose(FOUR_SPACE));
+        return builder.toString();
+    }
+
+    // Returns if condition for add to list method.
+
+    private static String getIfConditionForAddToListMethod(JavaAttributeInfo attr) {
+        String name = attr.getAttributeName();
+        String type;
+        YangDataStructure struct = getYangDataStructure(attr.getCompilerAnnotation());
+        if (struct != null) {
+            switch (struct) {
+                case QUEUE:
+                    type = PRIORITY_QUEUE;
+                    break;
+
+                case LIST:
+                    type = ARRAY_LIST_INIT;
+                    break;
+
+                case MAP:
+                    type = LINKED_HASH_MAP;
+                    break;
+
+                case SET:
+                    type = LINKED_HASH_SET;
+                    break;
+
+                default:
+                    type = ARRAY_LIST_INIT;
+                    break;
+            }
+        } else {
+            type = ARRAY_LIST_INIT;
+        }
+        return getIfConditionBegin(EIGHT_SPACE_INDENTATION, name + SPACE + EQUAL +
+                EQUAL + SPACE + NULL) + TWELVE_SPACE_INDENTATION +
+                name + SPACE + EQUAL + SPACE +
+                NEW + SPACE + type + signatureClose() + methodClose(
+                EIGHT_SPACE);
+    }
+
+    /**
+     * Returns builder method for class.
+     *
+     * @param name name of class
+     * @return builder method for class
+     */
+    static String builderMethod(String name) {
+        return generateForBuilderMethod(name) +
+                methodSignature(BUILDER_LOWER_CASE,
+                                EMPTY_STRING, PUBLIC + SPACE +
+                                        STATIC, null, name + BUILDER, null, CLASS_TYPE) +
+                getReturnString(NEW + SPACE + name + BUILDER,
+                                EIGHT_SPACE_INDENTATION) +
+                brackets(OPEN_CLOSE_BRACKET, null, null) + signatureClose() +
+                methodClose(FOUR_SPACE);
+    }
+
+    /**
+     * Returns is value set interface.
+     *
+     * @return is value set interface
+     */
+    static String isLeafValueSetInterface() {
+        String method = "\n    /**\n" +
+                "     * Checks if the leaf value is set.\n" +
+                "     *\n" +
+                "     * @param leaf leaf whose value status needs to checked\n" +
+                "     * @return result of leaf value set in object\n" +
+                "     */\n";
+        return method + methodSignature(VALUE_LEAF_SET, EMPTY_STRING, null,
+                                        LEAF, BOOLEAN_DATA_TYPE,
+                                        LEAF_IDENTIFIER, INTERFACE_TYPE);
+    }
+
+    /**
+     * Returns is select leaf set interface.
+     *
+     * @return is select leaf set interface
+     */
+    static String isSelectLeafSetInterface() {
+        String method = "\n    /**\n" +
+                "     * Checks if the leaf is set to be a selected leaf.\n" +
+                "     *\n" +
+                "     * @param leaf if leaf needs to be selected\n" +
+                "     * @return result of leaf value set in object\n" +
+                "     */\n";
+        return method + methodSignature(IS_SELECT_LEAF, EMPTY_STRING, null,
+                                        LEAF, BOOLEAN_DATA_TYPE, LEAF_IDENTIFIER,
+                                        INTERFACE_TYPE);
+    }
+
+    /**
+     * Returns set select leaf set interface.
+     *
+     * @param name node name
+     * @return set select leaf set interface
+     */
+    static String setSelectLeafSetInterface(String name) {
+        String method = "    /**\n" +
+                "     * Set a leaf to be selected.\n" +
+                "     *\n" +
+                "     * @param leaf leaf needs to be selected\n" +
+                "     * @return builder object for select leaf\n" +
+                "     */\n";
+        return method + methodSignature(SET_SELECT_LEAF, EMPTY_STRING,
+                                        null, LEAF, name +
+                                                BUILDER, LEAF_IDENTIFIER,
+                                        INTERFACE_TYPE) + NEW_LINE;
+    }
+
+    /**
+     * Returns leaf identifier interface enum signature.
+     *
+     * @param name name of node
+     * @return leaf identifier interface enum signature
+     */
+    static String getInterfaceLeafIdEnumSignature(String name) {
+        String start = "\n    /**\n" +
+                "     * Identify the leaf of " + name + PERIOD + NEW_LINE +
+                "     */\n";
+        return start + FOUR_SPACE_INDENTATION + PUBLIC + SPACE + ENUM + SPACE +
+                LEAF_IDENTIFIER + SPACE + OPEN_CURLY_BRACKET + NEW_LINE;
+    }
+
+    /**
+     * Returns setter for select leaf.
+     *
+     * @param name name of node
+     * @return setter for select leaf
+     */
+    static String getSetterForSelectLeaf(String name) {
+        return "\n" +
+                "    " + OVERRIDE + "\n" +
+                "    public " + name + BUILDER +
+                " selectLeaf(LeafIdentifier leaf) {\n" +
+                "        selectLeafFlags.set(leaf.getLeafIndex());\n" +
+                "        return this;\n" +
+                "    }\n";
+    }
+
+    /**
+     * Generates fromString code for bits.
+     *
+     * @return generated fromString code for bits.
+     */
+    private static String getFromStringForBits(String bitClassName) {
+     /* generate code will look like this.
+       public static BitSet fromString(String valInString) {
+            BitSet tmpVal = new BitSet();
+            String[] bitNames = valInString.trim().split(Pattern.quote(" "));
+            for (String bitName : bitNames) {
+                Bits bits = of(bitName);
+                if (bits != null) {
+                    tmpVal.set(bits.bits());
+                }
+            }
+            if (tmpVal.isEmpty()) {
+                throw new NoSuchElementException("no such element found in bits");
+            }
+            return tmpVal;
+        }*/
+        StringBuilder sBuild = new StringBuilder();
+        sBuild.append(methodSignature(FROM_STRING_METHOD_NAME, null,
+                                      PUBLIC + SPACE + STATIC,
+                                      FROM_STRING_PARAM_NAME,
+                                      BIT_SET, STRING_DATA_TYPE, CLASS_TYPE))
+                .append(EIGHT_SPACE_INDENTATION)
+                .append(getBitSetAttr(EMPTY_STRING));
+        // Split the input string and check each bit name falls in configured yang file
+        sBuild.append(EIGHT_SPACE_INDENTATION).append(STRING_DATA_TYPE)
+                .append(SQUARE_BRACKETS).append(SPACE).append(BIT_NAMES_VAR)
+                .append(SPACE).append(EQUAL).append(SPACE).append(FROM_STRING_PARAM_NAME)
+                .append(PERIOD).append(TRIM_STRING).append(OPEN_CLOSE_BRACKET_STRING)
+                .append(PERIOD).append(SPLIT_STRING).append(getOpenCloseParaWithValue(
+                getPatternQuoteString(SPACE))).append(signatureClose()).append(
+                getForLoopString(EIGHT_SPACE_INDENTATION, STRING_DATA_TYPE, BIT_NAME_VAR,
+                                 BIT_NAMES_VAR));
+
+        String small = getSmallCase(bitClassName);
+        sBuild.append(TWELVE_SPACE_INDENTATION).append(bitClassName).append(
+                SPACE).append(small).append(SPACE).append(EQUAL).append(
+                SPACE).append(OF).append(
+                getOpenCloseParaWithValue(BIT_NAME_VAR)).append(signatureClose());
+        String condition = small + SPACE + NOT + EQUAL + SPACE + NULL;
+        sBuild.append(getIfConditionBegin(TWELVE_SPACE_INDENTATION, condition))
+                .append(SIXTEEN_SPACE_INDENTATION)
+                .append(TMP_VAL).append(PERIOD).append(SET_METHOD_PREFIX)
+                .append(OPEN_PARENTHESIS)
+                .append(small).append(PERIOD).append(small).append(
+                OPEN_CLOSE_BRACKET_STRING).append(CLOSE_PARENTHESIS)
+                .append(signatureClose()).append(methodClose(TWELVE_SPACE))
+                .append(methodClose(EIGHT_SPACE));
+
+        condition = TMP_VAL + PERIOD + IS_EMPTY;
+        sBuild.append(getIfConditionBegin(EIGHT_SPACE_INDENTATION, condition));
+        sBuild.append(getExceptionThrowString(TWELVE_SPACE_INDENTATION))
+                .append(methodClose(EIGHT_SPACE))
+                .append(getReturnString(TMP_VAL, EIGHT_SPACE_INDENTATION))
+                .append(signatureClose()).append(methodClose(FOUR_SPACE));
+        return sBuild.toString();
+    }
+
+
+    /**
+     * Returns to string method for typedef.
+     *
+     * @param attr attribute name
+     * @return to string method for typedef
+     */
+    static String getToStringForType(String attr, YangType type) {
+        StringBuilder builder = new StringBuilder(getOverRideString())
+                .append(methodSignature(TO_STRING_METHOD, null, PUBLIC, null,
+                                        STRING_DATA_TYPE, null, CLASS_TYPE));
+        builder.append(getReturnString(
+                getToStringForSpecialType(type, attr), EIGHT_SPACE_INDENTATION))
+                .append(signatureClose()).append(methodClose(FOUR_SPACE));
+        return builder.toString();
+    }
+
+    /**
+     * Returns to string method body for type class.
+     *
+     * @param type type of attribute
+     * @param name @return to string method body for typedef class
+     */
+    private static String getToStringForSpecialType(YangType type, String name) {
+        switch (type.getDataType()) {
+            case INT8:
+            case INT16:
+            case INT32:
+            case INT64:
+            case UINT8:
+            case UINT16:
+            case UINT32:
+                return STRING_DATA_TYPE + PERIOD + VALUE + OF_CAPS +
+                        getOpenCloseParaWithValue(name);
+
+            case BINARY:
+                return getToStringCall(getToStringForBinary(name));
+
+            case BITS:
+                return getCapitalCase(name) + PERIOD +
+                        TO_STRING_METHOD + getOpenCloseParaWithValue(name);
+
+            case BOOLEAN:
+            case EMPTY:
+                return name + SPACE + QUESTION_MARK + SPACE + getQuotedString(TRUE)
+                        + SPACE + COLON + SPACE + getQuotedString(FALSE);
+
+            case LEAFREF:
+                YangLeafRef<?> lri = (YangLeafRef<?>) type.getDataTypeExtendedInfo();
+                YangType<?> rt = lri.isInGrouping() ? null : lri
+                        .getEffectiveDataType();
+                return rt == null ? getToStringCall(name) :
+                        getToStringForSpecialType(rt, name);
+
+            case IDENTITYREF:
+                YangIdentityRef ir = (YangIdentityRef) type
+                        .getDataTypeExtendedInfo();
+                YangIdentity identity = ir.getReferredIdentity();
+                String idName = getCamelCase(identity.getName(), null);
+                return getCapitalCase(idName) + PERIOD + idName + TO_CAPS +
+                        STRING_DATA_TYPE + OPEN_CLOSE_BRACKET_STRING;
+            case ENUMERATION:
+            case INSTANCE_IDENTIFIER:
+            case UINT64:
+            case DECIMAL64:
+            case DERIVED:
+            case UNION:
+                return getToStringCall(name);
+
+            default:
+                return name;
+        }
+    }
+
+    /**
+     * Returns union class's to string method.
+     *
+     * @param types list of types
+     * @return union class's to string method
+     */
+    static String getUnionToStringMethod(List<YangType<?>> types) {
+
+        StringBuilder builder = new StringBuilder(getOverRideString());
+        builder.append(methodSignature(TO_STRING_METHOD, null, PUBLIC, null,
+                                       STRING_DATA_TYPE, null, CLASS_TYPE));
+        for (YangType type : types) {
+            builder.append(getIfConditionBegin(
+                    EIGHT_SPACE_INDENTATION, getSetValueParaCondition(
+                            types.indexOf(type)))).append(getReturnString(
+                    getToStringForSpecialType(type,
+                                              getCamelCase(type.getDataTypeName(), null)),
+                    TWELVE_SPACE_INDENTATION))
+                    .append(signatureClose()).append(methodClose(EIGHT_SPACE));
+        }
+        builder.append(getReturnString(NULL, EIGHT_SPACE_INDENTATION)).append(signatureClose())
+                .append(methodClose(FOUR_SPACE));
+        return builder.toString();
+    }
+
+    /**
+     * Returns from string method for bits class.
+     *
+     * @param className bits class name
+     * @return from string method for bits class
+     */
+    static String getBitSetEnumClassFromString(String className) {
+        return getJavaDoc(FROM_METHOD, className, false, null) +
+                getFromStringForBits(className);
+    }
+
+    /**
+     * Returns to string method for bits type.
+     *
+     * @param className   class name
+     * @param enumeration enumeration
+     * @return to string method
+     */
+    static String getBitSetEnumClassToString(String className,
+                                             YangEnumeration enumeration) {
+
+        StringBuilder builder = new StringBuilder();
+        builder.append(methodSignature(TO_STRING_METHOD, null,
+                                       PUBLIC + SPACE + STATIC, BITS,
+                                       STRING_DATA_TYPE, BIT_SET, CLASS_TYPE))
+                .append(getStringBuilderAttr(EMPTY_STRING, EIGHT_SPACE_INDENTATION));
+        String condition;
+        String name;
+        for (YangEnum yangEnum : enumeration.getEnumSet()) {
+            name = yangEnum.getNamedValue();
+            condition = BITS + PERIOD + GET + OPEN_PARENTHESIS +
+                    className + PERIOD + getEnumJavaAttribute(name).toUpperCase()
+                    + PERIOD + getSmallCase(className)
+                    + OPEN_CLOSE_BRACKET_STRING + CLOSE_PARENTHESIS;
+
+            builder.append(getIfConditionBegin(
+                    EIGHT_SPACE_INDENTATION, condition))
+                    .append(TWELVE_SPACE_INDENTATION).append(STRING_BUILDER_VAR).append(
+                    PERIOD).append(APPEND).append(OPEN_PARENTHESIS)
+                    .append(getQuotedString(name)).append(CLOSE_PARENTHESIS)
+                    .append(signatureClose())
+                    .append(TWELVE_SPACE_INDENTATION).append(STRING_BUILDER_VAR).append(
+                    PERIOD).append(APPEND).append(OPEN_PARENTHESIS)
+                    .append(getQuotedString(SPACE)).append(CLOSE_PARENTHESIS)
+                    .append(signatureClose()).append(methodClose(EIGHT_SPACE));
+        }
+        builder.append(getReturnString(STRING_BUILDER_VAR, EIGHT_SPACE_INDENTATION))
+                .append(PERIOD).append(TO_STRING_METHOD)
+                .append(OPEN_CLOSE_BRACKET_STRING).append(signatureClose())
+                .append(methodClose(FOUR_SPACE));
+        return builder.toString();
+    }
+
+    /**
+     * Returns to string method for enum class.
+     *
+     * @return to string method for enum class
+     */
+    static String getToStringForEnumClass() {
+        StringBuilder builder = new StringBuilder(getOverRideString());
+        builder.append(methodSignature(TO_STRING_METHOD, EMPTY_STRING,
+                                       PUBLIC, null, STRING_DATA_TYPE, null,
+                                       CLASS_TYPE));
+        builder.append(getReturnString(SCHEMA_NAME, EIGHT_SPACE_INDENTATION))
+                .append(signatureClose()).append(methodClose(FOUR_SPACE));
+        return builder.toString();
+    }
+
+    /**
+     * Returns is filter content match interface.
+     *
+     * @param name name of node
+     * @return is filter content match interface
+     */
+    static String processSubtreeFilteringInterface(String name) {
+        String method = "   /**\n" +
+                "     * Checks if the passed " + name +
+                " maps the content match query condition.\n" +
+                "     *\n" +
+                "     * @param " + getSmallCase(name) + SPACE +
+                getSmallCase(name) + SPACE + "being passed to check" +
+                " for" +
+                " content match\n" +
+                "     * @param isSelectAllSchemaChild is select all schema child\n" +
+                "     * @return match result\n" +
+                "     */\n";
+        LinkedHashMap<String, String> map = new LinkedHashMap<>();
+        map.put(getSmallCase(name), name);
+        map.put(SELECT_ALL_CHILD, BOOLEAN_DATA_TYPE);
+
+        return method + multiAttrMethodSignature(PROCESS_SUBTREE_FILTERING,
+                                                 EMPTY_STRING, EMPTY_STRING,
+                                                 name, map, INTERFACE_TYPE);
+    }
+
+    /**
+     * Returns build method for subtree filtering in class.
+     *
+     * @param node YANG node
+     * @return build method for subtree filtering in class
+     */
+    static String generateBuildMethodForSubTree(YangNode node) {
+        String name = getCapitalCase(node.getJavaClassNameOrBuiltInType());
+        StringBuilder builder = new StringBuilder(getJavaDoc(BUILD_METHOD,
+                                                             name, false, null));
+        String def = DEFAULT_CAPS + name;
+        if (node instanceof RpcNotificationContainer) {
+            def = name + OP_PARAM;
+        }
+        builder.append(methodSignature(BUILD_FOR_FILTER, null, PUBLIC, null,
+                                       name, null, CLASS_TYPE))
+                .append(EIGHT_SPACE_INDENTATION).append(SUBTREE_FILTERED)
+                .append(SPACE).append(EQUAL).append(SPACE).append(TRUE)
+                .append(signatureClose()).append(methodBody(
+                MethodBodyTypes.BUILD, def, null, EIGHT_SPACE_INDENTATION,
+                null, null, false, null)).append(methodClose(FOUR_SPACE));
+        return builder.toString();
+    }
+
+    /**
+     * To string method for identity.
+     *
+     * @param name name of identity
+     * @return to string method
+     */
+    public static String getToStringMethodForIdentity(String name) {
+        StringBuilder builder = new StringBuilder(NEW_LINE);
+        builder.append(getJavaDoc(GETTER_METHOD, name, false, null));
+        String returnVal = getQuotedString(name);
+        String methodName = getCamelCase(name, null) + TO_CAPS + STRING_DATA_TYPE;
+        builder.append(methodSignature(methodName, null, PUBLIC + SPACE + STATIC,
+                                       null, STRING_DATA_TYPE, null, CLASS_TYPE))
+                .append(getReturnString(returnVal, EIGHT_SPACE_INDENTATION))
+                .append(signatureClose()).append(methodClose(FOUR_SPACE));
+        return builder.toString();
+    }
+
+    /**
+     * Returns from string method for identity class.
+     *
+     * @param name       name of identity
+     * @param schemaName schema name
+     * @return from string method
+     */
+    public static String getFromStringMethodForIdentity(String name,
+                                                        String schemaName) {
+        StringBuilder builder = new StringBuilder(NEW_LINE);
+        builder.append(getJavaDoc(FROM_METHOD, name, false, null));
+        String caps = getCapitalCase(name);
+        String returnVal = caps + PERIOD + CLASS;
+        String cond = getTwoParaEqualsString(FROM_STRING_PARAM_NAME,
+                                             getQuotedString(schemaName));
+        builder.append(methodSignature(FROM_STRING_METHOD_NAME, null,
+                                       PUBLIC + SPACE + STATIC,
+                                       FROM_STRING_PARAM_NAME, CLASS_STRING,
+                                       STRING_DATA_TYPE, CLASS_TYPE))
+                .append(getIfConditionBegin(EIGHT_SPACE_INDENTATION, cond))
+                .append(getReturnString(returnVal, TWELVE_SPACE_INDENTATION))
+                .append(signatureClose()).append(methodClose(EIGHT_SPACE))
+                .append(getExceptionThrowString(EIGHT_SPACE_INDENTATION))
+                .append(methodClose(FOUR_SPACE));
+        return builder.toString();
+    }
+
+    /**
+     * Returns compare to method for key class.
+     *
+     * @param attrs     attribute list
+     * @param className class name
+     * @return compare to method
+     */
+    public static String getCompareToForKeyClass(
+            List<JavaAttributeInfo> attrs, String className) {
+
+        StringBuilder builder = new StringBuilder(getOverRideString());
+        builder.append(methodSignature(COMPARE_TO, null, PUBLIC, VALUE, INT,
+                                       className, CLASS_TYPE));
+        String cond;
+        String attrName;
+        String para;
+        StringBuilder space = new StringBuilder();
+        List<String> spaces = new ArrayList<>();
+        int count = 1;
+        for (JavaAttributeInfo attr : attrs) {
+            attrName = attr.getAttributeName();
+            para = VALUE + PERIOD + attrName;
+            cond = getTwoParaEqualsString(attrName, para);
+            if (count == 1) {
+                space.append(EIGHT_SPACE_INDENTATION);
+            } else {
+                space.append(FOUR_SPACE_INDENTATION);
+            }
+            spaces.add(space.toString());
+            count++;
+            builder.append(getIfConditionBegin(space.toString(), cond));
+        }
+        space.append(FOUR_SPACE_INDENTATION);
+        builder.append(getReturnString(ZERO, space.toString()))
+                .append(signatureClose());
+        for (int i = spaces.size() - 1; i >= 0; i--) {
+            builder.append(spaces.get(i)).append(CLOSE_CURLY_BRACKET)
+                    .append(NEW_LINE);
+        }
+        builder.append(getReturnString(NEG_ONE, EIGHT_SPACE_INDENTATION))
+                .append(signatureClose()).append(methodClose(FOUR_SPACE));
+        return builder.toString();
+    }
+}
diff --git a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/utils/StringGenerator.java b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/utils/StringGenerator.java
new file mode 100644
index 0000000..2befdde
--- /dev/null
+++ b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/utils/StringGenerator.java
@@ -0,0 +1,1347 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.translator.tojava.utils;
+
+import org.onosproject.yang.compiler.datamodel.YangCompilerAnnotation;
+import org.onosproject.yang.compiler.datamodel.YangDataStructure;
+import org.onosproject.yang.compiler.datamodel.YangIdentity;
+import org.onosproject.yang.compiler.datamodel.YangIdentityRef;
+import org.onosproject.yang.compiler.datamodel.YangType;
+import org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes;
+import org.onosproject.yang.compiler.translator.exception.TranslatorException;
+
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes.BOOLEAN;
+import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes.DECIMAL64;
+import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes.EMPTY;
+import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes.INT16;
+import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes.INT32;
+import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes.INT64;
+import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes.INT8;
+import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes.UINT16;
+import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes.UINT32;
+import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes.UINT64;
+import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes.UINT8;
+import static org.onosproject.yang.compiler.translator.tojava.utils.BracketType.OPEN_CLOSE_BRACKET;
+import static org.onosproject.yang.compiler.translator.tojava.utils.BracketType.OPEN_CLOSE_BRACKET_WITH_VALUE;
+import static org.onosproject.yang.compiler.translator.tojava.utils.BracketType.OPEN_CLOSE_BRACKET_WITH_VALUE_AND_RETURN_TYPE;
+import static org.onosproject.yang.compiler.translator.tojava.utils.MethodClassTypes.CLASS_TYPE;
+import static org.onosproject.yang.compiler.translator.tojava.utils.MethodsGenerator.getYangDataStructure;
+import static org.onosproject.yang.compiler.utils.UtilConstants.ADD_STRING;
+import static org.onosproject.yang.compiler.utils.UtilConstants.AND;
+import static org.onosproject.yang.compiler.utils.UtilConstants.APPEND;
+import static org.onosproject.yang.compiler.utils.UtilConstants.APP_INSTANCE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.AT;
+import static org.onosproject.yang.compiler.utils.UtilConstants.BIG_DECIMAL;
+import static org.onosproject.yang.compiler.utils.UtilConstants.BIG_INTEGER;
+import static org.onosproject.yang.compiler.utils.UtilConstants.BITSET;
+import static org.onosproject.yang.compiler.utils.UtilConstants.BOOLEAN_DATA_TYPE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.BOOLEAN_WRAPPER;
+import static org.onosproject.yang.compiler.utils.UtilConstants.BUILDER;
+import static org.onosproject.yang.compiler.utils.UtilConstants.BUILDER_LOWER_CASE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.BYTE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.BYTE_WRAPPER;
+import static org.onosproject.yang.compiler.utils.UtilConstants.CATCH;
+import static org.onosproject.yang.compiler.utils.UtilConstants.CHECK_NOT_NULL_STRING;
+import static org.onosproject.yang.compiler.utils.UtilConstants.CLASS;
+import static org.onosproject.yang.compiler.utils.UtilConstants.CLOSE_CURLY_BRACKET;
+import static org.onosproject.yang.compiler.utils.UtilConstants.CLOSE_PARENTHESIS;
+import static org.onosproject.yang.compiler.utils.UtilConstants.COLON;
+import static org.onosproject.yang.compiler.utils.UtilConstants.COMMA;
+import static org.onosproject.yang.compiler.utils.UtilConstants.COMPARE_TO;
+import static org.onosproject.yang.compiler.utils.UtilConstants.DEFAULT_CAPS;
+import static org.onosproject.yang.compiler.utils.UtilConstants.DIAMOND_CLOSE_BRACKET;
+import static org.onosproject.yang.compiler.utils.UtilConstants.DIAMOND_OPEN_BRACKET;
+import static org.onosproject.yang.compiler.utils.UtilConstants.DOUBLE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.EIGHT_SPACE_INDENTATION;
+import static org.onosproject.yang.compiler.utils.UtilConstants.ELSE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.EMPTY_STRING;
+import static org.onosproject.yang.compiler.utils.UtilConstants.EQUAL;
+import static org.onosproject.yang.compiler.utils.UtilConstants.EQUALS_STRING;
+import static org.onosproject.yang.compiler.utils.UtilConstants.EXCEPTION;
+import static org.onosproject.yang.compiler.utils.UtilConstants.EXCEPTION_STRING;
+import static org.onosproject.yang.compiler.utils.UtilConstants.EXCEPTION_VAR;
+import static org.onosproject.yang.compiler.utils.UtilConstants.EXTEND;
+import static org.onosproject.yang.compiler.utils.UtilConstants.FALSE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.FOR;
+import static org.onosproject.yang.compiler.utils.UtilConstants.FOUR_SPACE_INDENTATION;
+import static org.onosproject.yang.compiler.utils.UtilConstants.FROM_STRING_METHOD_NAME;
+import static org.onosproject.yang.compiler.utils.UtilConstants.GET;
+import static org.onosproject.yang.compiler.utils.UtilConstants.GOOGLE_MORE_OBJECT_METHOD_STATIC_STRING;
+import static org.onosproject.yang.compiler.utils.UtilConstants.IF;
+import static org.onosproject.yang.compiler.utils.UtilConstants.IMPLEMENTS;
+import static org.onosproject.yang.compiler.utils.UtilConstants.IMPORT;
+import static org.onosproject.yang.compiler.utils.UtilConstants.IN;
+import static org.onosproject.yang.compiler.utils.UtilConstants.INT;
+import static org.onosproject.yang.compiler.utils.UtilConstants.INTEGER_WRAPPER;
+import static org.onosproject.yang.compiler.utils.UtilConstants.INT_MAX_RANGE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.INT_MIN_RANGE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.KEYS;
+import static org.onosproject.yang.compiler.utils.UtilConstants.LEAF_IDENTIFIER;
+import static org.onosproject.yang.compiler.utils.UtilConstants.LIST;
+import static org.onosproject.yang.compiler.utils.UtilConstants.LONG;
+import static org.onosproject.yang.compiler.utils.UtilConstants.LONG_MAX_RANGE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.LONG_MIN_RANGE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.LONG_WRAPPER;
+import static org.onosproject.yang.compiler.utils.UtilConstants.MAP;
+import static org.onosproject.yang.compiler.utils.UtilConstants.MORE_OBJ_ATTR;
+import static org.onosproject.yang.compiler.utils.UtilConstants.NEW;
+import static org.onosproject.yang.compiler.utils.UtilConstants.NEW_LINE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.OBJECT;
+import static org.onosproject.yang.compiler.utils.UtilConstants.OBJECT_STRING;
+import static org.onosproject.yang.compiler.utils.UtilConstants.OF;
+import static org.onosproject.yang.compiler.utils.UtilConstants.OMIT_NULL_VALUE_STRING;
+import static org.onosproject.yang.compiler.utils.UtilConstants.OPEN_CLOSE_BRACKET_STRING;
+import static org.onosproject.yang.compiler.utils.UtilConstants.OPEN_CURLY_BRACKET;
+import static org.onosproject.yang.compiler.utils.UtilConstants.OPEN_PARENTHESIS;
+import static org.onosproject.yang.compiler.utils.UtilConstants.OVERRIDE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.PARSE_BOOLEAN;
+import static org.onosproject.yang.compiler.utils.UtilConstants.PARSE_BYTE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.PARSE_INT;
+import static org.onosproject.yang.compiler.utils.UtilConstants.PARSE_LONG;
+import static org.onosproject.yang.compiler.utils.UtilConstants.PARSE_SHORT;
+import static org.onosproject.yang.compiler.utils.UtilConstants.PATTERN;
+import static org.onosproject.yang.compiler.utils.UtilConstants.PERIOD;
+import static org.onosproject.yang.compiler.utils.UtilConstants.PUT;
+import static org.onosproject.yang.compiler.utils.UtilConstants.QUEUE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.QUOTES;
+import static org.onosproject.yang.compiler.utils.UtilConstants.QUOTE_STRING;
+import static org.onosproject.yang.compiler.utils.UtilConstants.RETURN;
+import static org.onosproject.yang.compiler.utils.UtilConstants.SEMI_COLON;
+import static org.onosproject.yang.compiler.utils.UtilConstants.SET;
+import static org.onosproject.yang.compiler.utils.UtilConstants.SET_VALUE_PARA;
+import static org.onosproject.yang.compiler.utils.UtilConstants.SHORT;
+import static org.onosproject.yang.compiler.utils.UtilConstants.SHORT_MAX_RANGE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.SHORT_MIN_RANGE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.SHORT_WRAPPER;
+import static org.onosproject.yang.compiler.utils.UtilConstants.SIXTEEN_SPACE_INDENTATION;
+import static org.onosproject.yang.compiler.utils.UtilConstants.SPACE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.STRING_BUILDER;
+import static org.onosproject.yang.compiler.utils.UtilConstants.STRING_BUILDER_VAR;
+import static org.onosproject.yang.compiler.utils.UtilConstants.THIS;
+import static org.onosproject.yang.compiler.utils.UtilConstants.THROW_NEW;
+import static org.onosproject.yang.compiler.utils.UtilConstants.TMP_VAL;
+import static org.onosproject.yang.compiler.utils.UtilConstants.TO_STRING_METHOD;
+import static org.onosproject.yang.compiler.utils.UtilConstants.TRY;
+import static org.onosproject.yang.compiler.utils.UtilConstants.TWELVE_SPACE_INDENTATION;
+import static org.onosproject.yang.compiler.utils.UtilConstants.TWENTY_SPACE_INDENTATION;
+import static org.onosproject.yang.compiler.utils.UtilConstants.UINT8_MAX_RANGE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.UINT8_MIN_RANGE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.UINT_MAX_RANGE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.UINT_MIN_RANGE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.ULONG_MAX_RANGE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.ULONG_MIN_RANGE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.VALIDATE_RANGE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.VALUE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.YANG_AUGMENTED_INFO_MAP;
+import static org.onosproject.yang.compiler.utils.UtilConstants.YANG_UTILS_TODO;
+import static org.onosproject.yang.compiler.utils.UtilConstants.ZERO;
+import static org.onosproject.yang.compiler.utils.io.impl.YangIoUtils.getCamelCase;
+import static org.onosproject.yang.compiler.utils.io.impl.YangIoUtils.getCapitalCase;
+import static org.onosproject.yang.compiler.utils.io.impl.YangIoUtils.trimAtLast;
+
+/**
+ * Represents string generator for translator.
+ */
+public final class StringGenerator {
+
+    private static final Set<YangDataTypes> PRIMITIVE_TYPES =
+            new HashSet<>(Arrays.asList(INT8, INT16, INT32, INT64, UINT8,
+                                        UINT16, UINT32, UINT64, DECIMAL64,
+                                        BOOLEAN, EMPTY));
+
+    // No instantiation.
+    private StringGenerator() {
+    }
+
+    /**
+     * Returns compare to string.
+     *
+     * @return compare to string
+     */
+    static String getCompareToString() {
+        return PERIOD + COMPARE_TO;
+    }
+
+    /**
+     * Returns lesser than and equals condition.
+     *
+     * @return lesser than and equals condition
+     */
+    static String getLesserThanCondition() {
+        return SPACE + DIAMOND_OPEN_BRACKET + EQUAL + SPACE;
+    }
+
+    /**
+     * Returns greater than and equals condition.
+     *
+     * @return greater than and equals condition
+     */
+    static String getGreaterThanCondition() {
+        return SPACE + DIAMOND_CLOSE_BRACKET + EQUAL + SPACE;
+    }
+
+    /**
+     * Returns && conditional string.
+     *
+     * @param cond1 condition one
+     * @param cond2 condition two
+     * @return && conditional string
+     */
+    static String ifAndAndCondition(String cond1, String cond2) {
+        return cond1 + SPACE + AND + AND + SPACE + cond2;
+    }
+
+    /**
+     * Returns equal equal conditional string.
+     *
+     * @param cond1 condition one
+     * @param cond2 condition two
+     * @return equal equal conditional string
+     */
+    static String ifEqualEqualCondition(String cond1, String cond2) {
+        return cond1 + SPACE + EQUAL + EQUAL + SPACE + cond2;
+    }
+
+    /**
+     * Returns new instance string.
+     *
+     * @param returnType return type
+     * @param varName    variable name
+     * @param space      spaces
+     * @param value      value
+     * @return new instance string
+     */
+    static String getNewInstance(String returnType, String varName,
+                                 String space, String value) {
+        return space + returnType + SPACE + varName + SPACE + EQUAL + SPACE +
+                NEW + SPACE + returnType + getOpenCloseParaWithValue(value) +
+                signatureClose();
+    }
+
+    /**
+     * Returns return string.
+     *
+     * @param value value to be returned
+     * @param space spaces
+     * @return return string
+     */
+    static String getReturnString(String value, String space) {
+        return space + RETURN + SPACE + value;
+    }
+
+    /**
+     * Returns illegal argument exception string.
+     *
+     * @param space indentation
+     * @return illegal argument exception string
+     */
+    static String getExceptionThrowString(String space) {
+        return space + THROW_NEW + EXCEPTION_STRING;
+    }
+
+    /**
+     * Returns new line string with spaces.
+     *
+     * @param space spaces
+     * @return new line string with spaces
+     */
+    static String getNewLineAndSpace(String space) {
+        return NEW_LINE + space;
+    }
+
+    /**
+     * Returns method close string.
+     *
+     * @param type indentation type
+     * @return method close string
+     */
+    public static String methodClose(IndentationType type) {
+        switch (type) {
+            case EIGHT_SPACE:
+                return EIGHT_SPACE_INDENTATION + CLOSE_CURLY_BRACKET +
+                        NEW_LINE;
+            case TWELVE_SPACE:
+                return TWELVE_SPACE_INDENTATION + CLOSE_CURLY_BRACKET +
+                        NEW_LINE;
+            case SIXTEEN_SPACE:
+                return SIXTEEN_SPACE_INDENTATION + CLOSE_CURLY_BRACKET +
+                        NEW_LINE;
+            case TWENTY_SPACE:
+                return TWENTY_SPACE_INDENTATION + CLOSE_CURLY_BRACKET +
+                        NEW_LINE;
+            case TWENTY_EIGHT_SPACE:
+                return TWENTY_SPACE_INDENTATION + EIGHT_SPACE_INDENTATION +
+                        CLOSE_CURLY_BRACKET + NEW_LINE;
+            case TWENTY_FOUR_SPACE:
+                return TWENTY_SPACE_INDENTATION + FOUR_SPACE_INDENTATION +
+                        CLOSE_CURLY_BRACKET + NEW_LINE;
+            case FOUR_SPACE:
+                return FOUR_SPACE_INDENTATION + CLOSE_CURLY_BRACKET +
+                        NEW_LINE;
+            default:
+                return CLOSE_CURLY_BRACKET + NEW_LINE;
+        }
+    }
+
+    /**
+     * Returns body of the method.
+     *
+     * @param type            type of method body
+     * @param paraName        parameter name
+     * @param methodName      method name
+     * @param space           space to be given before body
+     * @param prefix          prefix for internal method
+     * @param paramType       parameter type
+     * @param isBuilderSetter is for builder setter
+     * @param setterVal       value to set in setter
+     * @return body of the method
+     */
+    static String methodBody(MethodBodyTypes type, String paraName,
+                             String methodName,
+                             String space, String prefix,
+                             String paramType, boolean isBuilderSetter, String setterVal) {
+        StringBuilder builder = new StringBuilder();
+        String body;
+        switch (type) {
+            case GETTER:
+                return getReturnString(paraName, space);
+            case SETTER:
+                if (setterVal == null) {
+                    setterVal = paraName;
+                }
+                body = space + THIS + PERIOD + paraName + SPACE + EQUAL + SPACE +
+                        setterVal + signatureClose();
+                builder.append(body);
+                if (isBuilderSetter) {
+                    body = getReturnString(THIS + signatureClose(), space);
+                    builder.append(body);
+                }
+                return builder.toString();
+            case BUILD:
+                return getReturnString(
+                        NEW + SPACE + paraName + getOpenCloseParaWithValue(
+                                THIS) + signatureClose(), space);
+            case CONSTRUCTOR:
+                return space + paraName + SPACE +
+                        EQUAL + SPACE + BUILDER_LOWER_CASE + OBJECT + PERIOD +
+                        prefix + methodName +
+                        brackets(OPEN_CLOSE_BRACKET, null, null) +
+                        signatureClose();
+            case DEFAULT_CONSTRUCTOR:
+                return EMPTY_STRING;
+            case AUGMENTED_MAP_ADD:
+                return space + YANG_AUGMENTED_INFO_MAP +
+                        PERIOD + PUT + OPEN_PARENTHESIS + CLASS +
+                        OBJECT_STRING + COMMA + SPACE + VALUE +
+                        CLOSE_PARENTHESIS + signatureClose();
+            case AUGMENTED_MAP_GET_VALUE:
+                return getReturnString(
+                        YANG_AUGMENTED_INFO_MAP + PERIOD + GET + getOpenCloseParaWithValue(
+                                CLASS + OBJECT_STRING) + signatureClose(), space);
+            case AUGMENTED_MAP_GETTER:
+                return getReturnString(YANG_AUGMENTED_INFO_MAP +
+                                               signatureClose(), space);
+            case MANAGER_METHODS:
+                body = space + YANG_UTILS_TODO + NEW_LINE;
+                builder.append(body);
+                if (paramType != null) {
+                    body = getReturnString(parseTypeForReturnValue(paramType),
+                                           space);
+                    builder.append(body)
+                            .append(signatureClose());
+                }
+                return builder.toString();
+            case OF_METHOD:
+                return getReturnString(
+                        NEW + SPACE + paraName + getOpenCloseParaWithValue(
+                                VALUE) + signatureClose(), space);
+            case TO_STRING:
+                return getToStringMethodsAddString(space, paraName) + paraName +
+                        CLOSE_PARENTHESIS;
+            case EQUALS_METHOD:
+            default:
+                return null;
+        }
+    }
+
+    /**
+     * Returns to string method's add string.
+     *
+     * @param space    indentation
+     * @param paraName parameter name
+     * @return to string method's add string
+     */
+    static String getToStringMethodsAddString(String space, String paraName) {
+        return space + PERIOD + ADD_STRING + OPEN_PARENTHESIS +
+                getQuotedString(paraName) + COMMA + SPACE;
+    }
+
+    /**
+     * Returns end of line.
+     *
+     * @return end of line
+     */
+    static String signatureClose() {
+        return SEMI_COLON + NEW_LINE;
+    }
+
+
+    /**
+     * Returns value assignment.
+     *
+     * @return value assignment
+     */
+    static String valueAssign(String param, String value, String indentation) {
+        return indentation + param + SPACE + EQUAL + SPACE + value +
+                signatureClose();
+    }
+
+    /**
+     * Returns method signature close for method class type.
+     *
+     * @param type method class type
+     * @return method signature close for method class type
+     */
+    static String methodSignatureClose(MethodClassTypes type) {
+        switch (type) {
+            case INTERFACE_TYPE:
+                return signatureClose();
+            case CLASS_TYPE:
+                return SPACE + OPEN_CURLY_BRACKET + NEW_LINE;
+            default:
+                return null;
+        }
+    }
+
+    /**
+     * Returns method param.
+     *
+     * @param type type of param
+     * @param name name of param
+     * @return method param
+     */
+    private static String methodParam(String type, String name) {
+        return type + SPACE + name;
+    }
+
+    /**
+     * Returns comma followed by a space.
+     *
+     * @return comma followed by a space
+     */
+    private static String commaWithSpace() {
+        return COMMA + SPACE;
+    }
+
+    /**
+     * Returns bracket string for the given type.
+     *
+     * @param type       bracket type
+     * @param value      value to be added in brackets
+     * @param returnType returns type to be added for value
+     * @return bracket for the given type.
+     */
+    static String brackets(BracketType type, String value,
+                           String returnType) {
+        String ret = EMPTY_STRING;
+        switch (type) {
+            case OPEN_CLOSE_BRACKET:
+                return OPEN_PARENTHESIS + CLOSE_PARENTHESIS;
+            case OPEN_CLOSE_BRACKET_WITH_VALUE:
+                return OPEN_PARENTHESIS + value + CLOSE_PARENTHESIS;
+            case OPEN_CLOSE_BRACKET_WITH_VALUE_AND_RETURN_TYPE:
+                if (returnType != null) {
+                    ret = returnType + SPACE;
+                }
+                return OPEN_PARENTHESIS + ret + value +
+                        CLOSE_PARENTHESIS;
+            case OPEN_BRACKET_WITH_VALUE:
+                ret = EMPTY_STRING;
+                if (returnType != null) {
+                    ret = returnType + SPACE;
+                }
+                return OPEN_PARENTHESIS + ret + value +
+                        COMMA;
+            case CLOSE_BRACKET_WITH_VALUE:
+                ret = EMPTY_STRING;
+                if (returnType != null) {
+                    ret = returnType + SPACE;
+                }
+                return SPACE + ret + value +
+                        CLOSE_PARENTHESIS;
+            case OPEN_CLOSE_DIAMOND:
+                return DIAMOND_OPEN_BRACKET + DIAMOND_CLOSE_BRACKET;
+            case OPEN_CLOSE_DIAMOND_WITH_VALUE:
+                return DIAMOND_OPEN_BRACKET + value + DIAMOND_CLOSE_BRACKET;
+            default:
+                return null;
+        }
+    }
+
+    /**
+     * Returns method signature for multi attribute methods.
+     *
+     * @param methodName       method name
+     * @param prefix           prefix for method
+     * @param modifier         modifier for method
+     * @param methodReturnType method's return type
+     * @param params           parameters
+     * @param type             type of method
+     * @return method signature for multi attribute methods
+     */
+    static String multiAttrMethodSignature(String methodName, String
+            prefix, String modifier, String methodReturnType,
+                                           Map<String, String> params,
+                                           MethodClassTypes type) {
+        StringBuilder methodBuilder = new StringBuilder(FOUR_SPACE_INDENTATION);
+        String method = EMPTY_STRING;
+        if (modifier != null) {
+            method = modifier + SPACE;
+        }
+        methodBuilder.append(method);
+        if (prefix == null) {
+            prefix = EMPTY_STRING;
+        }
+        if (methodReturnType != null) {
+            method = methodReturnType + SPACE + prefix + methodName;
+        } else {
+            method = prefix + methodName;
+        }
+        //Append method beginning.
+        methodBuilder.append(method)
+                .append(OPEN_PARENTHESIS);
+        for (Map.Entry<String, String> param : params.entrySet()) {
+            methodBuilder.append(methodParam(param.getValue(), param.getKey()));
+            methodBuilder.append(commaWithSpace());
+        }
+        String para = methodBuilder.toString();
+        String[] array = {SPACE, COMMA};
+        para = trimAtLast(para, array);
+        methodBuilder = new StringBuilder(para)
+                .append(CLOSE_PARENTHESIS)
+                .append(methodSignatureClose(type));
+
+        return methodBuilder.toString();
+    }
+
+    /**
+     * Returns method signature for interface and implementation classes.
+     *
+     * @param methodName       name of the method
+     * @param prefix           prefix which needs to be added for method
+     * @param modifier         modifier which needs to be added for method
+     * @param paraVal          value which needs to be added as parameter
+     * @param methodReturnType returns type to be added for method
+     * @param paraReturnType   return type to be added for parameter
+     * @param type             method class type
+     * @return method signature for interface and implementation classes
+     */
+    static String methodSignature(
+            String methodName, String prefix, String modifier, String paraVal,
+            String methodReturnType, String paraReturnType,
+            MethodClassTypes type) {
+        StringBuilder methodBuilder = new StringBuilder(FOUR_SPACE_INDENTATION);
+        String method = EMPTY_STRING;
+        if (modifier != null) {
+            method = modifier + SPACE;
+        }
+        if (prefix == null) {
+            prefix = EMPTY_STRING;
+        }
+        methodBuilder.append(method);
+        if (methodReturnType != null) {
+            method = methodReturnType + SPACE + prefix + methodName;
+        } else {
+            method = prefix + methodName;
+        }
+        //Append method beginning.
+        methodBuilder.append(method);
+
+        if (paraVal != null) {
+            methodBuilder.append(brackets(
+                    OPEN_CLOSE_BRACKET_WITH_VALUE_AND_RETURN_TYPE,
+                    paraVal, paraReturnType));
+        } else {
+            methodBuilder.append(brackets(OPEN_CLOSE_BRACKET, null,
+                                          null));
+        }
+
+        methodBuilder.append(methodSignatureClose(type));
+
+        return methodBuilder.toString();
+    }
+
+    /**
+     * Returns list attribute.
+     *
+     * @param attrType           attribute type
+     * @param compilerAnnotation compiler annotations
+     * @return list attribute
+     */
+
+    static String getListAttribute(String attrType,
+                                   YangCompilerAnnotation compilerAnnotation) {
+        String listAttr;
+        YangDataStructure ds = getYangDataStructure(compilerAnnotation);
+        if (ds != null) {
+            switch (ds) {
+                case QUEUE: {
+                    listAttr = QUEUE + DIAMOND_OPEN_BRACKET + attrType +
+                            DIAMOND_CLOSE_BRACKET;
+                    break;
+                }
+                case SET: {
+                    listAttr = SET + DIAMOND_OPEN_BRACKET + attrType +
+                            DIAMOND_CLOSE_BRACKET;
+                    break;
+                }
+                case LIST: {
+                    listAttr = getListString() + attrType +
+                            DIAMOND_CLOSE_BRACKET;
+                    break;
+                }
+                case MAP:
+                    listAttr = MAP + DIAMOND_OPEN_BRACKET + attrType + KEYS +
+                            COMMA + attrType + DIAMOND_CLOSE_BRACKET;
+                    break;
+                default: {
+                    listAttr = getListString() + attrType +
+                            DIAMOND_CLOSE_BRACKET;
+                }
+            }
+        } else {
+            listAttr = getListString() + attrType + DIAMOND_CLOSE_BRACKET;
+        }
+        return listAttr;
+    }
+
+    /**
+     * Returns getters for value and select leaf.
+     *
+     * @return getters for value and select leaf
+     */
+    static String getIsValueLeafSet() {
+        return "\n" +
+                "    @Override\n" +
+                "    public boolean isLeafValueSet(LeafIdentifier leaf) {\n" +
+                "        return valueLeafFlags.get(leaf.getLeafIndex());\n" +
+                "    }\n" +
+                "\n";
+    }
+
+    /**
+     * Returns is select leaf set.
+     *
+     * @return is select leaf set
+     */
+    static String getIsSelectLeafSet() {
+        return "    @Override\n" +
+                "    public boolean isSelectLeaf(LeafIdentifier leaf) {\n" +
+                "        return selectLeafFlags.get(leaf.getLeafIndex());\n" +
+                "    }\n";
+    }
+
+    /**
+     * Returns getter methods for operation attributes.
+     *
+     * @return getter methods for operation attributes
+     */
+    static String getValueLeafGetters() {
+        return "\n" +
+                "    /**\n" +
+                "     * Returns the valueLeafFlags.\n" +
+                "     *\n" +
+                "     * @return value of valueLeafFlags\n" +
+                "     */\n" +
+                "    public BitSet getValueLeafFlags() {\n" +
+                "        return valueLeafFlags;\n" +
+                "    }\n" +
+                "\n";
+    }
+
+    /**
+     * Returns getter methods for operation attributes.
+     *
+     * @return getter methods for operation attributes
+     */
+    static String getSelectLeafGetters() {
+        return "    /**\n" +
+                "     * Returns the selectLeafFlags.\n" +
+                "     *\n" +
+                "     * @return value of selectLeafFlags\n" +
+                "     */\n" +
+                "    public BitSet getSelectLeafFlags() {\n" +
+                "        return selectLeafFlags;\n" +
+                "    }\n" +
+                "\n";
+    }
+
+    /**
+     * Returns interface leaf identifier enum method.
+     *
+     * @return interface leaf identifier enum method
+     */
+    static String getInterfaceLeafIdEnumMethods() {
+        return "\n\n        private int leafIndex;\n" +
+                "\n" +
+                "        public int getLeafIndex() {\n" +
+                "            return leafIndex;\n" +
+                "        }\n" +
+                "\n" +
+                "        LeafIdentifier(int value) {\n" +
+                "            this.leafIndex = value;\n" +
+                "        }\n" +
+                "    }\n";
+    }
+
+    /**
+     * Returns if condition string for typedef constructor.
+     *
+     * @param type     type of conflict
+     * @param addFirst true int/long need to be added first
+     * @param val      value to set
+     * @return if condition string for typedef constructor
+     */
+    static String ifConditionForIntInTypeDefConstructor(ValidatorTypeForUnionTypes type,
+                                                        boolean addFirst, String val) {
+        String condition =
+                EIGHT_SPACE_INDENTATION + IF + SPACE + OPEN_PARENTHESIS +
+                        VALIDATE_RANGE + OPEN_PARENTHESIS;
+
+        switch (type) {
+            case INT_TYPE_CONFLICT:
+                if (addFirst) {
+                    condition = condition + INT_MIN_RANGE + COMMA + SPACE +
+                            INT_MAX_RANGE + COMMA + SPACE + val;
+                } else {
+                    condition = condition + UINT_MIN_RANGE + COMMA + SPACE +
+                            UINT_MAX_RANGE + COMMA + SPACE + val;
+                }
+                break;
+            case LONG_TYPE_CONFLICT:
+                if (addFirst) {
+                    condition = condition + LONG_MIN_RANGE + COMMA + SPACE +
+                            LONG_MAX_RANGE + COMMA + SPACE + val;
+                } else {
+                    condition = condition + ULONG_MIN_RANGE + COMMA + SPACE +
+                            ULONG_MAX_RANGE + COMMA + SPACE + val;
+                }
+                break;
+            case SHORT_TYPE_CONFLICT:
+                if (addFirst) {
+                    condition = condition + SHORT_MIN_RANGE + COMMA + SPACE +
+                            SHORT_MAX_RANGE + COMMA + SPACE + val;
+                } else {
+                    condition = condition + UINT8_MIN_RANGE + COMMA + SPACE +
+                            UINT8_MAX_RANGE + COMMA + SPACE + val;
+                }
+                break;
+            default:
+                return null;
+        }
+
+        return condition + CLOSE_PARENTHESIS + CLOSE_PARENTHESIS + SPACE +
+                OPEN_CURLY_BRACKET + NEW_LINE;
+    }
+
+    /**
+     * Returns from string method parsed string.
+     *
+     * @param targetDataType target data type
+     * @param yangType       YANG type
+     * @return parsed string
+     */
+    static String getParseFromStringMethod(String targetDataType,
+                                           YangType<?> yangType) {
+
+        YangDataTypes type = yangType.getDataType();
+        switch (type) {
+            case INT8:
+                return BYTE_WRAPPER + PERIOD + PARSE_BYTE;
+
+            case INT16:
+                return SHORT_WRAPPER + PERIOD + PARSE_SHORT;
+
+            case INT32:
+                return INTEGER_WRAPPER + PERIOD + PARSE_INT;
+
+            case INT64:
+                return LONG_WRAPPER + PERIOD + PARSE_LONG;
+
+            case UINT8:
+                return SHORT_WRAPPER + PERIOD + PARSE_SHORT;
+
+            case UINT16:
+                return INTEGER_WRAPPER + PERIOD + PARSE_INT;
+
+            case UINT32:
+                return LONG_WRAPPER + PERIOD + PARSE_LONG;
+
+            case UINT64:
+                return NEW + SPACE + BIG_INTEGER;
+
+            case DECIMAL64:
+                return NEW + SPACE + BIG_DECIMAL;
+
+            case INSTANCE_IDENTIFIER:
+            case STRING:
+                return EMPTY_STRING;
+            case EMPTY:
+            case BOOLEAN:
+                return BOOLEAN_WRAPPER + PERIOD + PARSE_BOOLEAN;
+
+            case ENUMERATION:
+                return targetDataType + PERIOD + OF;
+
+            case IDENTITYREF:
+                YangIdentityRef ir = (YangIdentityRef) yangType
+                        .getDataTypeExtendedInfo();
+                YangIdentity identity = ir.getReferredIdentity();
+                return getCapitalCase(getCamelCase(identity.getName(), null))
+                        + PERIOD + FROM_STRING_METHOD_NAME;
+            case DERIVED:
+            case UNION:
+                return targetDataType + PERIOD + FROM_STRING_METHOD_NAME;
+
+            default:
+                throw new TranslatorException(
+                        "Given data type is not supported. " +
+                                yangType.getDataTypeName() + " in " +
+                                yangType.getLineNumber() + " at " +
+                                yangType.getCharPosition() + " in " +
+                                yangType.getFileName());
+        }
+    }
+
+    /**
+     * Returns sub string with catch statement for union's from string method.
+     *
+     * @param attrHolder attribute holder/count for from string
+     * @return sub string with catch statement for union's from string method
+     */
+    static String getCatchSubString(String attrHolder) {
+        StringBuilder builder = new StringBuilder();
+        builder.append(CLOSE_CURLY_BRACKET).append(SPACE).append(CATCH)
+                .append(SPACE).append(
+                brackets(OPEN_CLOSE_BRACKET_WITH_VALUE_AND_RETURN_TYPE, EXCEPTION_VAR,
+                         EXCEPTION)).append(SPACE).append(OPEN_CURLY_BRACKET)
+                .append(NEW_LINE);
+        if (attrHolder != null) {
+            builder.append(getExceptionThrowString(TWELVE_SPACE_INDENTATION));
+        }
+        builder.append(EIGHT_SPACE_INDENTATION).append(CLOSE_CURLY_BRACKET);
+        return builder.toString();
+    }
+
+    /**
+     * Returns sub string with return statement for union's from string method.
+     *
+     * @return sub string with return statement for union's from string method
+     */
+    static String getReturnOfSubString() {
+        return getReturnString(OF, TWELVE_SPACE_INDENTATION) +
+                getOpenCloseParaWithValue(TMP_VAL) + signatureClose();
+    }
+
+    /**
+     * Returns sub string with try statement for union's from string method.
+     *
+     * @return sub string with try statement for union's from string method
+     */
+    static String getTrySubString() {
+        return TRY + SPACE + OPEN_CURLY_BRACKET;
+    }
+
+    /*
+         * Returns omit null value string.
+         *
+         * @return omit null value string
+         */
+    static String getOmitNullValueString() {
+        return TWELVE_SPACE_INDENTATION + PERIOD + OMIT_NULL_VALUE_STRING +
+                NEW_LINE;
+    }
+
+    /**
+     * Returns collection's iterator method.
+     *
+     * @param indentation indentation
+     * @param loopVar     loop variable
+     * @param collection  collection
+     * @return collection's iterator method
+     */
+    static String getCollectionIteratorForLoopBegin(String indentation,
+                                                    String loopVar,
+                                                    String collection) {
+        return indentation + FOR + SPACE + OPEN_PARENTHESIS + loopVar + SPACE +
+                COLON + SPACE + collection + CLOSE_PARENTHESIS + SPACE +
+                OPEN_CURLY_BRACKET + NEW_LINE;
+    }
+
+    /**
+     * Returns if else condition's signature.
+     *
+     * @param indentation indentation
+     * @param condition   conditions
+     * @return if else condition's signature
+     */
+    static String getElseIfConditionBegin(String indentation,
+                                          String condition) {
+        return indentation + CLOSE_CURLY_BRACKET + ELSE +
+                getIfConditionBegin(EMPTY_STRING, condition);
+    }
+
+    /**
+     * Returns if condition's signature.
+     *
+     * @param indentation indentation
+     * @param condition   conditions
+     * @return if condition's signature
+     */
+    static String getIfConditionBegin(String indentation, String condition) {
+        return indentation + IF + SPACE + getOpenCloseParaWithValue(condition) +
+                methodSignatureClose(CLASS_TYPE);
+    }
+
+    /**
+     * Returns true, if the data type is primitive; false otherwise.
+     *
+     * @param dataType data type
+     * @return true if the data type is primitive; false otherwise
+     */
+    public static boolean isPrimitiveDataType(YangDataTypes dataType) {
+        return PRIMITIVE_TYPES.contains(dataType);
+    }
+
+    /**
+     * Returns list string.
+     *
+     * @return list string
+     */
+    private static String getListString() {
+        return LIST + DIAMOND_OPEN_BRACKET;
+    }
+
+    /**
+     * Returns override string.
+     *
+     * @return override string
+     */
+    public static String getOverRideString() {
+        return NEW_LINE + FOUR_SPACE_INDENTATION + OVERRIDE + NEW_LINE;
+    }
+
+    /**
+     * Returns value leaf flag setter.
+     *
+     * @param name        name of leaf
+     * @param flag        flag to set values
+     * @param indentation indentation
+     * @param prefix      prefix of method
+     * @return value leaf flag setter
+     */
+    static String getLeafFlagSetString(String name, String flag, String indentation, String prefix) {
+        return indentation + flag + PERIOD + prefix +
+                getOpenCloseParaWithValue(LEAF_IDENTIFIER + PERIOD + name
+                        .toUpperCase() + ".getLeafIndex()");
+    }
+
+    /*Provides string to return for type.*/
+    private static String parseTypeForReturnValue(String type) {
+        switch (type) {
+            case BYTE:
+            case INT:
+            case SHORT:
+            case LONG:
+            case DOUBLE:
+                return ZERO;
+            case BOOLEAN_DATA_TYPE:
+                return FALSE;
+            default:
+                return null;
+        }
+    }
+
+    /**
+     * Returns check not null string.
+     *
+     * @param name attribute name
+     * @return check not null string
+     */
+    static String getCheckNotNull(String name) {
+        return EIGHT_SPACE_INDENTATION + CHECK_NOT_NULL_STRING +
+                OPEN_PARENTHESIS + name + COMMA + SPACE + name +
+                CLOSE_PARENTHESIS + SEMI_COLON + NEW_LINE;
+    }
+
+    /**
+     * Returns definition close string.
+     *
+     * @return definition close string
+     */
+    private static String defCloseString() {
+        return SPACE + OPEN_CURLY_BRACKET + NEW_LINE;
+    }
+
+    /**
+     * Returns default class definition for java file when extends a
+     * interface.
+     *
+     * @param classType class type
+     * @param name      name of class
+     * @param modifier  modifier for class
+     * @param extend    extends class name
+     * @return class definition
+     */
+    static String getDefaultDefinitionWithExtends(String classType,
+                                                  String name, String
+                                                          modifier,
+                                                  String extend) {
+        String mod = EMPTY_STRING;
+        if (modifier != null) {
+            mod = modifier + SPACE;
+        }
+        return mod + classType + SPACE + name + SPACE + EXTEND + SPACE
+                + extend + defCloseString();
+    }
+
+    /**
+     * Returns default class definition for java file when implements a
+     * interface.
+     *
+     * @param classType class type
+     * @param name      name of class
+     * @param modifier  modifier for class
+     * @param impl      implements class name
+     * @return class definition
+     */
+    static String getDefaultDefinitionWithImpl(String classType,
+                                               String name, String
+                                                       modifier,
+                                               String impl) {
+        String mod = EMPTY_STRING;
+        if (modifier != null) {
+            mod = modifier + SPACE;
+        }
+        return mod + classType + SPACE + name + SPACE + IMPLEMENTS +
+                SPACE + impl + defCloseString();
+    }
+
+    /**
+     * Returns default class definition for java file.
+     *
+     * @param classType class type
+     * @param name      name of class
+     * @param modifier  modifier for class
+     * @return class definition
+     */
+    static String getDefaultDefinition(String classType,
+                                       String name, String modifier) {
+        String mod = EMPTY_STRING;
+        if (modifier != null) {
+            mod = modifier + SPACE;
+        }
+        return mod + classType + SPACE + name + defCloseString();
+    }
+
+    /**
+     * Returns class definition for implements.
+     *
+     * @param classType class type
+     * @param name      name of class
+     * @param modifier  modifier
+     * @param implClass implements class
+     * @return class definition
+     */
+    static String getDefinitionWithImplements(String classType, String name,
+                                              String modifier, String
+                                                      implClass) {
+        String mod = EMPTY_STRING;
+        if (modifier != null) {
+            mod = modifier + SPACE;
+        }
+        return mod + classType + SPACE + name + SPACE + IMPLEMENTS + SPACE +
+                implClass + defCloseString();
+    }
+
+    /**
+     * Returns string for service class.
+     *
+     * @param name1 name of even listener class
+     * @param name2 name of even class
+     * @return listener service string for service class
+     */
+    static String getEventExtendsString(String name1, String type,
+                                        String name2) {
+        StringBuilder builder = new StringBuilder();
+        builder.append(type).append(DIAMOND_OPEN_BRACKET).append(name1)
+                .append(COMMA).append(SPACE).append(name2).append
+                (DIAMOND_CLOSE_BRACKET);
+        return builder.toString();
+    }
+
+    /**
+     * Returns import string.
+     *
+     * @param pkg package
+     * @param cls class
+     * @return import string
+     */
+    public static String getImportString(String pkg, String cls) {
+        StringBuilder builder = new StringBuilder()
+                .append(IMPORT).append(pkg).append(PERIOD).append(cls)
+                .append(signatureClose());
+        return builder.toString();
+    }
+
+    /**
+     * Returns static modifier string.
+     *
+     * @param modifier modifier
+     * @return static modifier string
+     */
+    static String getSpecificModifier(String modifier, String keyWord) {
+        return new StringBuilder(modifier).append(SPACE).append(keyWord)
+                .toString();
+    }
+
+    /**
+     * Returns builder string for class definition.
+     *
+     * @param yangName class name
+     * @return builder string for class definition
+     */
+    static String getBuilderImplStringClassDef(String yangName) {
+        return new StringBuilder(yangName).append(PERIOD).append(yangName)
+                .append(BUILDER).toString();
+    }
+
+    /**
+     * Returns default name string.
+     *
+     * @param yangName class name
+     * @return default name string
+     */
+    static String getDefaultName(String yangName) {
+        return new StringBuilder(DEFAULT_CAPS).append(yangName).toString();
+    }
+
+    /**
+     * Returns suffixed name string.
+     *
+     * @param yangName class name
+     * @param suffix   suffix to append to name
+     * @return suffixed name string
+     */
+    static String getSuffixedName(String yangName, String suffix) {
+        return new StringBuilder(yangName).append(suffix).toString();
+    }
+
+    /**
+     * Returns error msg string.
+     *
+     * @param msg      message
+     * @param name     name of node
+     * @param line     line number
+     * @param position char position
+     * @param fileName file name
+     * @return error message string
+     */
+    static String getErrorMsg(String msg, String name, int line, int position,
+                              String fileName) {
+        return new StringBuilder().append(msg).append(name).append(IN)
+                .append(line).append(AT).append(position).append(IN)
+                .append(fileName).toString();
+    }
+
+    /**
+     * Returns string builder attribute string;
+     *
+     * @param init  first param to be appended to string builder
+     * @param space indentation space
+     * @return string builder attribute
+     */
+    static String getStringBuilderAttr(String init, String space) {
+        StringBuilder builder = new StringBuilder(space);
+        builder.append(STRING_BUILDER).append(SPACE).append(STRING_BUILDER_VAR)
+                .append(SPACE).append(EQUAL).append(SPACE).append(NEW)
+                .append(SPACE).append(STRING_BUILDER).append(
+                getOpenCloseParaWithValue(getQuotedString(init)))
+                .append(signatureClose());
+        return builder.toString();
+    }
+
+    /**
+     * Returns quoted string.
+     *
+     * @param name name to be quoted
+     * @return quoted string
+     */
+    static String getQuotedString(String name) {
+        return QUOTES + name + QUOTES;
+    }
+
+    /**
+     * Returns string builder's append string.
+     *
+     * @param append data to be append
+     * @param space  indentation
+     * @return string builder's append string
+     */
+    static String getStringBuilderAppendString(String append, String space) {
+        return space + STRING_BUILDER_VAR + PERIOD + APPEND + OPEN_PARENTHESIS +
+                append + CLOSE_PARENTHESIS + signatureClose();
+    }
+
+    /**
+     * Returns pattern quote string.
+     *
+     * @param type type for pattern is needed
+     * @return pattern quote string
+     */
+    static String getPatternQuoteString(String type) {
+        return PATTERN + PERIOD + QUOTE_STRING + getOpenCloseParaWithValue(
+                getQuotedString(type));
+    }
+
+    /**
+     * Returns bitset attribute.
+     *
+     * @param indentation indentation
+     * @return bitset attribute
+     */
+    static String getBitSetAttr(String indentation) {
+        StringBuilder builder = new StringBuilder(indentation);
+        return builder.append(BITSET).append(SPACE).append(TMP_VAL)
+                .append(SPACE).append(EQUAL).append(SPACE).append(NEW)
+                .append(SPACE).append(BITSET).append(OPEN_CLOSE_BRACKET_STRING)
+                .append(signatureClose()).toString();
+    }
+
+    /**
+     * Returns for loop string
+     *
+     * @param space indentation
+     * @param type  data type
+     * @param var   variable
+     * @param data  data variable/collection
+     * @return for loop string
+     */
+    static String getForLoopString(String space, String type, String var,
+                                   String data) {
+        return space + FOR + SPACE + OPEN_PARENTHESIS + type + SPACE + var +
+                SPACE + COLON + SPACE + data + CLOSE_PARENTHESIS +
+                methodSignatureClose(CLASS_TYPE);
+    }
+
+    /**
+     * Returns set value parameter's get string for union to string method.
+     *
+     * @param count count of type
+     * @return get string
+     */
+    static String getSetValueParaCondition(int count) {
+        return SET_VALUE_PARA + PERIOD + GET + getOpenCloseParaWithValue(
+                count + EMPTY_STRING);
+    }
+
+    /**
+     * Returns more object attr for union to string method.
+     *
+     * @param name name of generate class
+     * @return more object attr for union to string method
+     */
+    static String getMoreObjectAttr(String name) {
+        String cls = name + PERIOD + CLASS;
+        StringBuilder attr = new StringBuilder(EIGHT_SPACE_INDENTATION);
+        String[] array = {NEW_LINE};
+        attr.append(MORE_OBJ_ATTR).append(GOOGLE_MORE_OBJECT_METHOD_STATIC_STRING)
+                .append(getOpenCloseParaWithValue(cls)).append(NEW_LINE)
+                .append(FOUR_SPACE_INDENTATION).append(trimAtLast(
+                getOmitNullValueString(), array)).append(signatureClose());
+        return attr.toString();
+    }
+
+    /**
+     * Returns to string call.
+     *
+     * @param name name of attribute
+     * @return to string call for attribute
+     */
+    static String getToStringCall(String name) {
+        return name + PERIOD +
+                TO_STRING_METHOD + OPEN_CLOSE_BRACKET_STRING;
+    }
+
+    /**
+     * Returns value in brackets.
+     *
+     * @param name value
+     * @return value in brackets
+     */
+    static String getOpenCloseParaWithValue(String name) {
+        return brackets(OPEN_CLOSE_BRACKET_WITH_VALUE, name, null);
+    }
+
+    /**
+     * Returns equals comparision.
+     *
+     * @param para1 param
+     * @param para2 param
+     * @return equals comparision
+     */
+    static String getTwoParaEqualsString(String para1, String para2) {
+        return para1 + PERIOD + EQUALS_STRING + getOpenCloseParaWithValue(para2);
+    }
+
+    /**
+     * Returns equal equal condition.
+     *
+     * @param para param
+     * @param val  value
+     * @return equal equal condition
+     */
+    static String getEqualEqualString(String para, String val) {
+        return para + SPACE + EQUAL + EQUAL + SPACE + val;
+    }
+
+    /**
+     * Returns app instance method call.
+     *
+     * @param name attr name
+     * @return app instance method call
+     */
+    static String getAppInstanceAttrString(String name) {
+        return APP_INSTANCE + PERIOD + name + OPEN_CLOSE_BRACKET_STRING;
+    }
+
+    /**
+     * Returns qualified name.
+     *
+     * @param pkg package
+     * @param cls class info
+     * @return qualified name
+     */
+    static String getQualifiedString(String pkg, String cls) {
+        return pkg + PERIOD + cls;
+    }
+}
diff --git a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/utils/SubtreeFilteringMethodsGenerator.java b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/utils/SubtreeFilteringMethodsGenerator.java
new file mode 100644
index 0000000..51f236d
--- /dev/null
+++ b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/utils/SubtreeFilteringMethodsGenerator.java
@@ -0,0 +1,1238 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.translator.tojava.utils;
+
+import org.onosproject.yang.compiler.datamodel.RpcNotificationContainer;
+import org.onosproject.yang.compiler.datamodel.YangAugment;
+import org.onosproject.yang.compiler.datamodel.YangCase;
+import org.onosproject.yang.compiler.datamodel.YangChoice;
+import org.onosproject.yang.compiler.datamodel.YangDataStructure;
+import org.onosproject.yang.compiler.datamodel.YangLeafRef;
+import org.onosproject.yang.compiler.datamodel.YangLeavesHolder;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangType;
+import org.onosproject.yang.compiler.translator.exception.TranslatorException;
+import org.onosproject.yang.compiler.translator.tojava.JavaAttributeInfo;
+import org.onosproject.yang.compiler.translator.tojava.JavaCodeGeneratorInfo;
+import org.onosproject.yang.compiler.translator.tojava.JavaFileInfoContainer;
+import org.onosproject.yang.compiler.translator.tojava.JavaFileInfoTranslator;
+
+import java.io.IOException;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes.IDENTITYREF;
+import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes.LEAFREF;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedTempFileType.FILTER_CONTENT_MATCH_FOR_LEAF_LIST_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedTempFileType.FILTER_CONTENT_MATCH_FOR_LEAF_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedTempFileType.FILTER_CONTENT_MATCH_FOR_NODES_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.utils.IndentationType.EIGHT_SPACE;
+import static org.onosproject.yang.compiler.translator.tojava.utils.IndentationType.FOUR_SPACE;
+import static org.onosproject.yang.compiler.translator.tojava.utils.IndentationType.SIXTEEN_SPACE;
+import static org.onosproject.yang.compiler.translator.tojava.utils.IndentationType.TWELVE_SPACE;
+import static org.onosproject.yang.compiler.translator.tojava.utils.IndentationType.TWENTY_EIGHT_SPACE;
+import static org.onosproject.yang.compiler.translator.tojava.utils.IndentationType.TWENTY_FOUR_SPACE;
+import static org.onosproject.yang.compiler.translator.tojava.utils.IndentationType.TWENTY_SPACE;
+import static org.onosproject.yang.compiler.translator.tojava.utils.JavaFileGeneratorUtils.getDataFromTempFileHandle;
+import static org.onosproject.yang.compiler.translator.tojava.utils.MethodClassTypes.CLASS_TYPE;
+import static org.onosproject.yang.compiler.translator.tojava.utils.MethodsGenerator.getYangDataStructure;
+import static org.onosproject.yang.compiler.translator.tojava.utils.StringGenerator.getAppInstanceAttrString;
+import static org.onosproject.yang.compiler.translator.tojava.utils.StringGenerator.getElseIfConditionBegin;
+import static org.onosproject.yang.compiler.translator.tojava.utils.StringGenerator.getEqualEqualString;
+import static org.onosproject.yang.compiler.translator.tojava.utils.StringGenerator.getForLoopString;
+import static org.onosproject.yang.compiler.translator.tojava.utils.StringGenerator.getIfConditionBegin;
+import static org.onosproject.yang.compiler.translator.tojava.utils.StringGenerator.getLeafFlagSetString;
+import static org.onosproject.yang.compiler.translator.tojava.utils.StringGenerator.getNewInstance;
+import static org.onosproject.yang.compiler.translator.tojava.utils.StringGenerator.getOpenCloseParaWithValue;
+import static org.onosproject.yang.compiler.translator.tojava.utils.StringGenerator.getReturnString;
+import static org.onosproject.yang.compiler.translator.tojava.utils.StringGenerator.getTwoParaEqualsString;
+import static org.onosproject.yang.compiler.translator.tojava.utils.StringGenerator.methodClose;
+import static org.onosproject.yang.compiler.translator.tojava.utils.StringGenerator.multiAttrMethodSignature;
+import static org.onosproject.yang.compiler.translator.tojava.utils.StringGenerator.signatureClose;
+import static org.onosproject.yang.compiler.translator.tojava.utils.TranslatorUtils.getBeanFiles;
+import static org.onosproject.yang.compiler.utils.UtilConstants.ADD_STRING;
+import static org.onosproject.yang.compiler.utils.UtilConstants.AND_OPERATION;
+import static org.onosproject.yang.compiler.utils.UtilConstants.APP_INSTANCE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.BIT_SET;
+import static org.onosproject.yang.compiler.utils.UtilConstants.BOOLEAN_DATA_TYPE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.BREAK;
+import static org.onosproject.yang.compiler.utils.UtilConstants.BUILDER;
+import static org.onosproject.yang.compiler.utils.UtilConstants.BUILDER_LOWER_CASE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.BUILD_FOR_FILTER;
+import static org.onosproject.yang.compiler.utils.UtilConstants.CLASS_STRING;
+import static org.onosproject.yang.compiler.utils.UtilConstants.CLOSE_CURLY_BRACKET;
+import static org.onosproject.yang.compiler.utils.UtilConstants.CLOSE_PARENTHESIS;
+import static org.onosproject.yang.compiler.utils.UtilConstants.COMMA;
+import static org.onosproject.yang.compiler.utils.UtilConstants.DEFAULT;
+import static org.onosproject.yang.compiler.utils.UtilConstants.DEFAULT_CAPS;
+import static org.onosproject.yang.compiler.utils.UtilConstants.DIAMOND_CLOSE_BRACKET;
+import static org.onosproject.yang.compiler.utils.UtilConstants.DIAMOND_OPEN_BRACKET;
+import static org.onosproject.yang.compiler.utils.UtilConstants.EIGHT_SPACE_INDENTATION;
+import static org.onosproject.yang.compiler.utils.UtilConstants.ELSE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.EMPTY_STRING;
+import static org.onosproject.yang.compiler.utils.UtilConstants.ENTRY;
+import static org.onosproject.yang.compiler.utils.UtilConstants.ENTRY_SET;
+import static org.onosproject.yang.compiler.utils.UtilConstants.EQUAL;
+import static org.onosproject.yang.compiler.utils.UtilConstants.EQUALS_STRING;
+import static org.onosproject.yang.compiler.utils.UtilConstants.EXTEND;
+import static org.onosproject.yang.compiler.utils.UtilConstants.FALSE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.FLAG;
+import static org.onosproject.yang.compiler.utils.UtilConstants.GET;
+import static org.onosproject.yang.compiler.utils.UtilConstants.GET_KEY;
+import static org.onosproject.yang.compiler.utils.UtilConstants.GET_VALUE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.INSTANCE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.IS_ANY_SELECT_OR_CONTAINMENT_NODE_FLAG;
+import static org.onosproject.yang.compiler.utils.UtilConstants.IS_EMPTY;
+import static org.onosproject.yang.compiler.utils.UtilConstants.IS_SELECT_ALL_SCHEMA_CHILD_FLAG;
+import static org.onosproject.yang.compiler.utils.UtilConstants.KEYS;
+import static org.onosproject.yang.compiler.utils.UtilConstants.LEAF_IDENTIFIER;
+import static org.onosproject.yang.compiler.utils.UtilConstants.MAP;
+import static org.onosproject.yang.compiler.utils.UtilConstants.NEW_LINE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.NOT;
+import static org.onosproject.yang.compiler.utils.UtilConstants.NULL;
+import static org.onosproject.yang.compiler.utils.UtilConstants.OPEN_CLOSE_BRACKET_STRING;
+import static org.onosproject.yang.compiler.utils.UtilConstants.OPEN_CURLY_BRACKET;
+import static org.onosproject.yang.compiler.utils.UtilConstants.OPEN_PARENTHESIS;
+import static org.onosproject.yang.compiler.utils.UtilConstants.OP_PARAM;
+import static org.onosproject.yang.compiler.utils.UtilConstants.OR_OPERATION;
+import static org.onosproject.yang.compiler.utils.UtilConstants.PERIOD;
+import static org.onosproject.yang.compiler.utils.UtilConstants.PRIVATE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.PROCESS_CHILD_NODE_STF_PARAM;
+import static org.onosproject.yang.compiler.utils.UtilConstants.PROCESS_LEAF_LIST_STF_PARAM;
+import static org.onosproject.yang.compiler.utils.UtilConstants.PROCESS_LEAF_STF_PARAM;
+import static org.onosproject.yang.compiler.utils.UtilConstants.PROCESS_SUBTREE_FILTERING;
+import static org.onosproject.yang.compiler.utils.UtilConstants.PUBLIC;
+import static org.onosproject.yang.compiler.utils.UtilConstants.QUESTION_MARK;
+import static org.onosproject.yang.compiler.utils.UtilConstants.RESULT;
+import static org.onosproject.yang.compiler.utils.UtilConstants.SELECT_ALL_CHILD;
+import static org.onosproject.yang.compiler.utils.UtilConstants.SELECT_ALL_CHILD_SCHEMA_PARAM;
+import static org.onosproject.yang.compiler.utils.UtilConstants.SELECT_LEAF;
+import static org.onosproject.yang.compiler.utils.UtilConstants.SELECT_OR_CONTAINMENT_NODE_PARAM;
+import static org.onosproject.yang.compiler.utils.UtilConstants.SEMI_COLON;
+import static org.onosproject.yang.compiler.utils.UtilConstants.SET_METHOD_PREFIX;
+import static org.onosproject.yang.compiler.utils.UtilConstants.SIXTEEN_SPACE_INDENTATION;
+import static org.onosproject.yang.compiler.utils.UtilConstants.SPACE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.STF_BUILDER_PARAM;
+import static org.onosproject.yang.compiler.utils.UtilConstants.SUBTREE_FILTERED;
+import static org.onosproject.yang.compiler.utils.UtilConstants.SUBTREE_FILTERING_RESULT_BUILDER;
+import static org.onosproject.yang.compiler.utils.UtilConstants.THIRTY_TWO_SPACE_INDENTATION;
+import static org.onosproject.yang.compiler.utils.UtilConstants.TO;
+import static org.onosproject.yang.compiler.utils.UtilConstants.TRUE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.TWELVE_SPACE_INDENTATION;
+import static org.onosproject.yang.compiler.utils.UtilConstants.TWENTY_EIGHT_SPACE_INDENTATION;
+import static org.onosproject.yang.compiler.utils.UtilConstants.TWENTY_FOUR_SPACE_INDENTATION;
+import static org.onosproject.yang.compiler.utils.UtilConstants.TWENTY_SPACE_INDENTATION;
+import static org.onosproject.yang.compiler.utils.UtilConstants.TWO;
+import static org.onosproject.yang.compiler.utils.UtilConstants.VALUE_LEAF;
+import static org.onosproject.yang.compiler.utils.UtilConstants.VALUE_LEAF_SET;
+import static org.onosproject.yang.compiler.utils.UtilConstants.ZERO;
+import static org.onosproject.yang.compiler.utils.io.impl.YangIoUtils.getCamelCase;
+import static org.onosproject.yang.compiler.utils.io.impl.YangIoUtils.getCapitalCase;
+
+/**
+ * Represents generator for subtree filtering methods of generated files
+ * based on the file type.
+ */
+public final class SubtreeFilteringMethodsGenerator {
+
+    /**
+     * private to make it a util.
+     */
+    private SubtreeFilteringMethodsGenerator() {
+    }
+
+    /**
+     * Returns process sub tree for choice interface class.
+     *
+     * @param node choice node
+     * @return process sub tree for choice interface class
+     */
+    static String getProcessSubTreeForChoiceInterface(YangNode node) {
+        if (!(node instanceof YangChoice)) {
+            throw new TranslatorException("process sub tree for interface is " +
+                                                  "only allowed in choice " +
+                                                  "node.");
+        }
+        JavaFileInfoTranslator info = ((JavaCodeGeneratorInfo) node)
+                .getJavaFileInfo();
+
+        String name = info.getJavaName();
+        String returnType = getCapitalCase(name);
+
+        String javadoc = "\n   /**\n" +
+                "     * Applications need not to implement process subtree " +
+                "of " + name + "\n     * it will be overridden by " +
+                "corresponding case class.\n" +
+                "     *\n" +
+                "     * @param " + APP_INSTANCE + SPACE +
+                APP_INSTANCE + SPACE + "being passed to check" +
+                " for" +
+                " content match\n" +
+                "     * @param isSelectAllSchemaChild is select all schema child\n" +
+                "     * @return match result\n" +
+                "     */\n";
+        StringBuilder builder = new StringBuilder(javadoc);
+        Map<String, String> param = new LinkedHashMap<>();
+        param.put(APP_INSTANCE, returnType);
+        param.put(SELECT_ALL_CHILD_SCHEMA_PARAM, BOOLEAN_DATA_TYPE);
+        builder.append(multiAttrMethodSignature(PROCESS_SUBTREE_FILTERING, null,
+                                                DEFAULT, returnType, param,
+                                                CLASS_TYPE))
+                .append(getReturnString(NULL, EIGHT_SPACE_INDENTATION))
+                .append(signatureClose()).append(methodClose(FOUR_SPACE));
+        return builder.toString();
+    }
+
+    /**
+     * Returns is filter content match for leaf.
+     *
+     * @param javaAttributeInfo java attribute
+     * @param type              data type
+     * @return is filter content match for leaf
+     */
+    public static String getSubtreeFilteringForLeaf(
+            JavaAttributeInfo javaAttributeInfo, YangType<?> type) {
+        String attrQualifiedType;
+        String attributeName = javaAttributeInfo.getAttributeName();
+        attrQualifiedType = getIfFilterContentMatchMethodImpl(attributeName,
+                                                              type);
+        /* if (valueLeafFlags.get(LeafIdentifier.LEAF.getLeafIndex())) {
+         * if (appInstance.leaf() != leaf()) {
+         * return false;
+         * } else {
+         * subTreeFilteringResultBuilder.leaf(appInstance.leaf());
+         * }
+         * } else if (selectLeafFlags.get(LeafIdentifier.LEAF.getLeafIndex()) ||
+         * isSelectAllSchemaChild) {
+         * isAnySelectOrContainmentNode = true;
+         * subTreeFilteringResultBuilder.leaf(appInstance.leaf());
+         * }*/
+
+/*        if (isSubTreeFiltered && !appInstance.isLeafValueSet(
+                LeafIdentifier.LEAF2)) {
+            subTreeFilteringResultBuilder.leaf2(leaf2());
+        } else {
+            return false;
+        }*/
+        String condition = SUBTREE_FILTERED + SPACE + AND_OPERATION + SPACE + NOT +
+                APP_INSTANCE + PERIOD + VALUE_LEAF_SET +
+                getOpenCloseParaWithValue(
+                        LEAF_IDENTIFIER + PERIOD + attributeName.toUpperCase());
+        return getIfConditionBegin(EIGHT_SPACE_INDENTATION, getLeafFlagSetString(
+                attributeName, VALUE_LEAF, EMPTY_STRING, GET)) +
+                getIfConditionBegin(TWELVE_SPACE_INDENTATION, attrQualifiedType) +
+                getIfConditionBegin(SIXTEEN_SPACE_INDENTATION, condition) +
+                TWENTY_SPACE_INDENTATION + SUBTREE_FILTERING_RESULT_BUILDER +
+                PERIOD + attributeName + getOpenCloseParaWithValue(
+                attributeName + OPEN_CLOSE_BRACKET_STRING) + signatureClose() +
+                SIXTEEN_SPACE_INDENTATION + CLOSE_CURLY_BRACKET + ELSE +
+                OPEN_CURLY_BRACKET + NEW_LINE + getReturnString(
+                FALSE, TWENTY_SPACE_INDENTATION) + signatureClose() +
+                SIXTEEN_SPACE_INDENTATION + CLOSE_CURLY_BRACKET + NEW_LINE +
+                TWELVE_SPACE_INDENTATION + CLOSE_CURLY_BRACKET + ELSE +
+                OPEN_CURLY_BRACKET + NEW_LINE +
+                getSubTreeBuilderCallString(SIXTEEN_SPACE_INDENTATION, attributeName,
+                                            TWELVE_SPACE) +
+                getElseIfConditionBegin(EIGHT_SPACE_INDENTATION, getLeafFlagSetString(
+                        attributeName, SELECT_LEAF, EMPTY_STRING, GET) + SPACE +
+                        OR_OPERATION + SPACE + IS_SELECT_ALL_SCHEMA_CHILD_FLAG) +
+                getSelectOrContainmentAssignString() +
+                getSubTreeBuilderCallString(TWELVE_SPACE_INDENTATION, attributeName,
+                                            EIGHT_SPACE);
+    }
+
+    private static String getSubTreeBuilderCallString(String indent, String
+            name, IndentationType type) {
+        return indent + SUBTREE_FILTERING_RESULT_BUILDER + PERIOD + name +
+                getOpenCloseParaWithValue(APP_INSTANCE + PERIOD + name +
+                                                  OPEN_CLOSE_BRACKET_STRING) +
+                signatureClose() + methodClose(type);
+    }
+
+    private static String getAttrTypeForFcmWhenPrimitiveDataType(
+            String attributeName) {
+        return/* TODO: Need to check if we can expose the value leaf flag in
+         interface.
+                NOT + APP_INSTANCE + PERIOD + GET_VALUE_LEAF_FLAGS +
+                OPEN_PARENTHESIS + CLOSE_PARENTHESIS +
+                GET_METHOD_PREFIX + OPEN_PARENTHESIS + LEAF_IDENTIFIER +
+                PERIOD + attributeName.toUpperCase() + PERIOD
+                + GET_LEAF_INDEX + OR_OPERATION +*/
+                APP_INSTANCE + PERIOD + attributeName + OPEN_PARENTHESIS +
+                        CLOSE_PARENTHESIS + SPACE + NOT + EQUAL + SPACE +
+                        attributeName + OPEN_PARENTHESIS +
+                        CLOSE_PARENTHESIS;
+    }
+
+    private static String attrTypeForFcmWhenNonPrimitiveDataTypes(String name) {
+        /*
+         * appInstance.name() == null || name().equals(appInstance.name())
+         */
+        return getEqualEqualString(getAppInstanceAttrString(name), NULL) +
+                SPACE + OR_OPERATION + SPACE + NOT + OPEN_PARENTHESIS +
+                getTwoParaEqualsString(name + OPEN_CLOSE_BRACKET_STRING,
+                                       getAppInstanceAttrString(name))
+                + CLOSE_PARENTHESIS;
+    }
+
+    private static String getIfFilterContentMatchMethodImpl(
+            String name, YangType dataType) {
+        String attrQualifiedType;
+        if (dataType.getDataType().isPrimitiveDataType()) {
+            attrQualifiedType = getAttrTypeForFcmWhenPrimitiveDataType(name);
+        } else if (dataType.getDataType() == LEAFREF) {
+
+            // When leafref in grouping.
+            if (((YangLeafRef) dataType.getDataTypeExtendedInfo())
+                    .isInGrouping()) {
+                attrQualifiedType = attrTypeForFcmWhenNonPrimitiveDataTypes(name);
+            } else {
+                YangType type = ((YangLeafRef) dataType.getDataTypeExtendedInfo())
+                        .getEffectiveDataType();
+                if (type.getDataType().isPrimitiveDataType()) {
+                    attrQualifiedType = getAttrTypeForFcmWhenPrimitiveDataType(name);
+                } else {
+                    attrQualifiedType = attrTypeForFcmWhenNonPrimitiveDataTypes(
+                            name);
+                }
+            }
+        } else {
+            attrQualifiedType = attrTypeForFcmWhenNonPrimitiveDataTypes(name);
+        }
+        return attrQualifiedType;
+    }
+
+    /**
+     * Returns is filter content match for leaf.
+     *
+     * @param javaAttributeInfo java attribute
+     * @return is filter content match for leaf
+     */
+    public static String getSubtreeFilteringForLeafList(
+            JavaAttributeInfo javaAttributeInfo) {
+        return getSubtreeFilteringForList(javaAttributeInfo, true, null);
+    }
+
+    /**
+     * Returns is filter content match for child node.
+     *
+     * @param curNode current node
+     * @param path    path of temp file
+     * @return is filter content match for child node
+     */
+    static String getProcessChildNodeSubtreeFiltering(YangNode curNode, String path)
+            throws IOException {
+       /* Generate code will look like this.
+        private boolean processChildNodesSubTreeFiltering(Link
+ appInstance, LinkBuilder subTreeFilteringResultBuilder,
+                Boolean isAnySelectOrContainmentNode, boolean isSelectAllSchemaChild) {
+            if (isSelectAllSchemaChild) {
+                for (Areas areas : appInstance.areas()) {
+                    subTreeFilteringResultBuilder.addToAreas(areas);
+                }
+            } else if (areas() != null) {
+                isAnySelectOrContainmentNode = true;
+                if (!areas().isEmpty()) {
+                    if (appInstance.areas() != null && !appInstance.areas().isEmpty()) {
+                        for (Areas areas : areas()) {
+                            for (Areas areas2 : appInstance.areas()) {
+                                Areas result = areas.processSubtreeFiltering(areas2, false);
+                                if (result != null) {
+                                    subTreeFilteringResultBuilder.addToAreas(result);
+                                }
+                            }
+                        }
+                    }
+                } else {
+                    if (appInstance.areas() != null && !appInstance.areas().isEmpty()) {
+                        for (Areas areas : appInstance.areas()) {
+                            subTreeFilteringResultBuilder.addToAreas(areas);
+                        }
+                    }
+                }
+            }
+
+            return true;
+        }*/
+        return getProcessStfMethods(PROCESS_CHILD_NODE_STF_PARAM, curNode,
+                                    path, FILTER_CONTENT_MATCH_FOR_NODES_MASK);
+    }
+
+    /**
+     * Returns is filter content match for leaf list.
+     *
+     * @param curNode current node
+     * @param path    path of temp file
+     * @return is filter content match for leaf list
+     */
+    static String getProcessLeafListSubtreeFiltering(YangNode curNode, String path)
+            throws IOException {
+       /* Generate code will look like this.
+        private boolean processLeafListSubTreeFiltering(Link appInstance, LinkBuilder subTreeFilteringResultBuilder,
+                Boolean isAnySelectOrContainmentNode, boolean isSelectAllSchemaChild) {
+            if (isSelectAllSchemaChild) {
+                for (String portId : appInstance.portId()) {
+                    subTreeFilteringResultBuilder.addToPortId(portId);
+                }
+            } else if (portId() != null) {
+                if (!portId().isEmpty()) {
+                    if (appInstance.portId() == null || appInstance.portId().isEmpty()) {
+                        return false;
+                    }
+                    for (String portId : portId()) {
+                        boolean flag = false;
+                        for (String portId2 : appInstance.portId()) {
+                            if (portId.equals(portId2)) {
+                                flag = true;
+                                subTreeFilteringResultBuilder.addToPortId(portId2);
+                                break;
+                            }
+                        }
+                        if (!flag) {
+                            return false;
+                        }
+                    }
+                } else {
+                    isAnySelectOrContainmentNode = true;
+                    if (appInstance.portId() != null && !appInstance.portId().isEmpty()) {
+                        for (String portId : appInstance.portId()) {
+                            subTreeFilteringResultBuilder.addToPortId(portId);
+                        }
+                    }
+                }
+            }
+
+            return true;
+        }*/
+        return getProcessStfMethods(PROCESS_LEAF_LIST_STF_PARAM, curNode, path,
+                                    FILTER_CONTENT_MATCH_FOR_LEAF_LIST_MASK);
+    }
+
+    /**
+     * Returns is filter content match for leaf.
+     *
+     * @param curNode current node
+     * @param path    path of temp file
+     * @return is filter content match for leaf
+     */
+    static String getProcessLeafSubtreeFiltering(YangNode curNode, String path)
+            throws IOException {
+     /* Generate code will look like this.
+      private boolean processLeafSubtreeFiltering(Link appInstance, LinkBuilder subTreeFilteringResultBuilder,
+                Boolean isAnySelectOrContainmentNode, boolean isSelectAllSchemaChild) {
+            if (valueLeafFlags.get(LeafIdentifier.PORT.getLeafIndex())) {
+                if (appInstance.port() != port()) {
+                    return false;
+                } else {
+                    subTreeFilteringResultBuilder.port(appInstance.port());
+                }
+            } else if (selectLeafFlags.get(LeafIdentifier.PORT.getLeafIndex()) || isSelectAllSchemaChild) {
+                isAnySelectOrContainmentNode = true;
+                subTreeFilteringResultBuilder.port(appInstance.port());
+            }
+
+            return true;
+        }*/
+        return getProcessStfMethods(PROCESS_LEAF_STF_PARAM, curNode, path,
+                                    FILTER_CONTENT_MATCH_FOR_LEAF_MASK);
+    }
+
+    /**
+     * Returns is filter content match for leaf.
+     *
+     * @param curNode current node
+     * @return is filter content match for leaf
+     */
+    static String getProcessSubtreeFilteringStart(YangNode curNode) {
+
+       /* Generate code will look like this.
+       public Link processSubtreeFiltering(Link appInstance, boolean isSelectAllSchemaChild) {
+            LinkBuilder subTreeFilteringResultBuilder = new LinkBuilder();
+            Boolean isAnySelectOrContainmentNode = false;
+        */
+        StringBuilder builder = new StringBuilder();
+        JavaFileInfoTranslator javaFileInfo =
+                ((JavaFileInfoContainer) curNode).getJavaFileInfo();
+        String instance = APP_INSTANCE;
+        String name = getCapitalCase(javaFileInfo.getJavaName());
+        String builderNamePrefix = getCapitalCase(javaFileInfo.getJavaName());
+        String caseName = getNameOfClassForIfCase(curNode);
+        String returnType;
+        if (curNode instanceof RpcNotificationContainer) {
+            returnType = name + OP_PARAM;
+        } else {
+            returnType = DEFAULT_CAPS + name;
+        }
+        if (caseName != null) {
+            instance = INSTANCE;
+            name = caseName;
+        }
+
+        String javadoc = "\n    /**\n" +
+                "     * Checks if the passed " + name + " maps the content " +
+                "match query condition.\n" +
+                "     *\n" +
+                "     * @param " + instance + SPACE + instance + SPACE +
+                "being passed to check for content match\n" +
+                "     * @param isSelectAllSchemaChild is select all schema " +
+                "child\n" +
+                "     * @return match result\n" +
+                "     */\n";
+        Map<String, String> param = new LinkedHashMap<>();
+        param.put(instance, name);
+        param.put(SELECT_ALL_CHILD_SCHEMA_PARAM, BOOLEAN_DATA_TYPE);
+        builder.append(javadoc)
+                .append(multiAttrMethodSignature(PROCESS_SUBTREE_FILTERING, null,
+                                                 PUBLIC, returnType, param,
+                                                 CLASS_TYPE));
+
+        builder.append(getNewInstance(builderNamePrefix + BUILDER,
+                                      SUBTREE_FILTERING_RESULT_BUILDER,
+                                      EIGHT_SPACE_INDENTATION, EMPTY_STRING));
+        builder.append(getNewInstance(BIT_SET,
+                                      IS_ANY_SELECT_OR_CONTAINMENT_NODE_FLAG,
+                                      EIGHT_SPACE_INDENTATION, EMPTY_STRING));
+        if (caseName != null) {
+            builder.append(getCaseCastString(javaFileInfo, instance, curNode));
+        }
+
+        return builder.toString();
+    }
+
+    /**
+     * Returns all process sub tree method implementations.
+     *
+     * @param methodName method name
+     * @param curNode    current node
+     * @param path       path for temporary file
+     * @param file       temp file
+     * @return method implementations
+     * @throws IOException when fails to fetch data from temp files
+     */
+    private static String getProcessStfMethods(
+            String methodName, YangNode curNode, String path, int file)
+            throws IOException {
+        StringBuilder builder = new StringBuilder(EMPTY_STRING);
+        JavaFileInfoTranslator javaFileInfo =
+                ((JavaFileInfoContainer) curNode).getJavaFileInfo();
+        String instance = APP_INSTANCE;
+        String name = getCapitalCase(javaFileInfo.getJavaName());
+        String builderNamePrefix = getCapitalCase(javaFileInfo.getJavaName());
+        String caseName = getNameOfClassForIfCase(curNode);
+        if (caseName != null) {
+            instance = INSTANCE;
+            name = caseName;
+        }
+
+        Map<String, String> param = new LinkedHashMap<>();
+        param.put(instance, name);
+        param.put(STF_BUILDER_PARAM, builderNamePrefix + BUILDER);
+        param.put(SELECT_OR_CONTAINMENT_NODE_PARAM, BIT_SET);
+        param.put(SELECT_ALL_CHILD_SCHEMA_PARAM, BOOLEAN_DATA_TYPE);
+
+        builder.append(multiAttrMethodSignature(methodName, null,
+                                                PRIVATE, BOOLEAN_DATA_TYPE, param, CLASS_TYPE));
+
+        if (caseName != null) {
+            builder.append(getCaseCastString(javaFileInfo, instance, curNode));
+        }
+        builder.append(getDataFromTempFileHandle(file,
+                                                 getBeanFiles(curNode), path))
+                .append(getReturnString(TRUE, EIGHT_SPACE_INDENTATION)).append(
+                signatureClose()).append(methodClose(FOUR_SPACE))
+                .append(NEW_LINE);
+        return builder.toString();
+    }
+
+    /**
+     * Returns the body for process subtree filtering.
+     *
+     * @param curNode node for which the code is being generated
+     * @return body of subtree filtering
+     */
+    static String getProcessSubtreeFunctionBody(YangNode curNode) {
+        StringBuilder builder = new StringBuilder();
+
+       /* if (!processLeafSubtreeFiltering(appInstance, subTreeFilteringResultBuilder,
+                                         isAnySelectOrContainmentNode, isSelectAllSchemaChild)) {
+            return null;
+        }
+        if (!processLeafListSubTreeFiltering(appInstance, subTreeFilteringResultBuilder,
+                                             isAnySelectOrContainmentNode, isSelectAllSchemaChild)) {
+            return null;
+        }
+        if (!processChildNodesSubTreeFiltering(appInstance, subTreeFilteringResultBuilder,
+                                               isAnySelectOrContainmentNode, isSelectAllSchemaChild)) {
+            return null;
+        }
+      */
+        if (curNode instanceof YangLeavesHolder) {
+            YangLeavesHolder holder = (YangLeavesHolder) curNode;
+            if (!holder.getListOfLeaf().isEmpty()) {
+                builder.append(getInnerStfMethodClass(PROCESS_LEAF_STF_PARAM));
+            }
+            if (!holder.getListOfLeafList().isEmpty()) {
+                builder.append(getInnerStfMethodClass(PROCESS_LEAF_LIST_STF_PARAM));
+            }
+        }
+        if (curNode.getChild() != null) {
+            builder.append(getInnerStfMethodClass(PROCESS_CHILD_NODE_STF_PARAM));
+        }
+
+        return builder.toString();
+    }
+
+    //Method calls for process subtree filtering method.
+    private static String getInnerStfMethodClass(String name) {
+        StringBuilder builder = new StringBuilder()
+                .append(getIfConditionBegin(EIGHT_SPACE_INDENTATION,
+                                            getMethodCallsConditionsForStfMethods(name)))
+                .append(getReturnString(NULL, TWELVE_SPACE_INDENTATION)).append(
+                        signatureClose()).append(methodClose(EIGHT_SPACE));
+        return builder.toString();
+    }
+
+    // Condition for if check in process sub tree method.
+    private static String getMethodCallsConditionsForStfMethods(String name) {
+        return NOT + name + getOpenCloseParaWithValue(getConditionString());
+    }
+
+    //variable call for conditional method call
+    private static String getConditionString() {
+        return APP_INSTANCE + COMMA + SPACE + SUBTREE_FILTERING_RESULT_BUILDER +
+                COMMA + SPACE + SELECT_OR_CONTAINMENT_NODE_PARAM + COMMA + SPACE +
+                SELECT_ALL_CHILD;
+    }
+
+    /**
+     * Returns is filter content match for node.
+     *
+     * @param attr attribute info
+     * @param node YANG node
+     * @return is filter content match for node
+     */
+    public static String getSubtreeFilteringForNode(JavaAttributeInfo attr, YangNode node) {
+        boolean isList = attr.isListAttr();
+        if (isList) {
+            return getSubtreeFilteringForList(attr, false, node);
+        } else {
+            return getSubtreeFilteringForChildNode(attr, node);
+        }
+    }
+
+    /**
+     * Returns is filter content match close.
+     *
+     * @param name name of class
+     * @return is filter content match close
+     */
+    static String getProcessSubTreeFilteringEnd(String name) {
+        /* generate code will look like this.
+        if (!isSelectAllSchemaChild && !isAnySelectOrContainmentNode) {
+            return processSubtreeFiltering(appInstance, true);
+        }
+        return subTreeFilteringResultBuilder.build();
+        */
+
+        StringBuilder builder = new StringBuilder();
+        String cond1 = NOT + IS_SELECT_ALL_SCHEMA_CHILD_FLAG + SPACE + AND_OPERATION +
+                SPACE + NOT + IS_ANY_SELECT_OR_CONTAINMENT_NODE_FLAG +
+                PERIOD + GET + getOpenCloseParaWithValue(ZERO);
+        String call = PROCESS_SUBTREE_FILTERING + getOpenCloseParaWithValue(
+                APP_INSTANCE + COMMA + SPACE + TRUE);
+        builder.append(getIfConditionBegin(EIGHT_SPACE_INDENTATION, cond1))
+                .append(getReturnString(call, TWELVE_SPACE_INDENTATION))
+                .append(signatureClose()).append(methodClose(EIGHT_SPACE));
+
+        call = getOpenCloseParaWithValue(name) + SPACE +
+                SUBTREE_FILTERING_RESULT_BUILDER + PERIOD + BUILD_FOR_FILTER +
+                OPEN_CLOSE_BRACKET_STRING;
+        builder.append(getReturnString(call, EIGHT_SPACE_INDENTATION))
+                .append(signatureClose()).append(methodClose(FOUR_SPACE))
+                .append(NEW_LINE);
+        return builder.toString();
+    }
+
+    /**
+     * Returns filter content match for child nodes.
+     *
+     * @param attr attribute to be added
+     * @param node YANG node
+     * @return filter content match for child nodes
+     */
+    private static String getSubtreeFilteringForChildNode(JavaAttributeInfo attr,
+                                                          YangNode node) {
+        StringBuilder builder = new StringBuilder();
+        String name = attr.getAttributeName();
+        String clsInfo = attr.getImportInfo()
+                .getClassInfo();
+        String type = DEFAULT_CAPS + attr.getImportInfo()
+                .getClassInfo();
+        if (attr.isQualifiedName()) {
+            type = attr.getImportInfo().getPkgInfo() + PERIOD +
+                    type;
+            clsInfo = attr.getImportInfo().getPkgInfo() + PERIOD +
+                    clsInfo;
+        }
+        String classCast = getOpenCloseParaWithValue(type) + SPACE;
+        String cast = getOpenCloseParaWithValue(classCast + name);
+        if (node != null && node instanceof YangChoice) {
+            cast = name;
+        }
+
+        String resultString = cast + NEW_LINE + TWENTY_EIGHT_SPACE_INDENTATION +
+                PERIOD + PROCESS_SUBTREE_FILTERING + OPEN_PARENTHESIS
+                + APP_INSTANCE + PERIOD + name + OPEN_CLOSE_BRACKET_STRING
+                + COMMA + SPACE + FALSE + CLOSE_PARENTHESIS + SEMI_COLON +
+                NEW_LINE;
+
+        String cond1 = name + OPEN_CLOSE_BRACKET_STRING + SPACE + NOT + EQUAL +
+                SPACE + NULL + SPACE + OR_OPERATION + SPACE + SELECT_ALL_CHILD;
+        builder.append(getIfConditionBegin(EIGHT_SPACE_INDENTATION, cond1))
+                .append(getSelectOrContainmentAssignString());
+
+        builder.append(getIfConditionBegin(TWELVE_SPACE_INDENTATION,
+                                           getAppInstanceCondition(name, NOT)));
+
+        String assignment = SIXTEEN_SPACE_INDENTATION + clsInfo + SPACE + RESULT +
+                SPACE + EQUAL + SPACE + NULL + signatureClose();
+
+        builder.append(assignment)
+                .append(getIfConditionBegin(SIXTEEN_SPACE_INDENTATION,
+                                            SELECT_ALL_CHILD));
+/*
+        result = ((DefaultInterfaces)(DefaultInterfaces.builder()
+                .build())).processSubtreeFiltering(appInstance.interfaces(),
+                                                   true);*/
+
+        assignment = getDummyObjectCreation(node, name, clsInfo, type,
+                                            classCast, false, false);
+        builder.append(assignment).append(SIXTEEN_SPACE_INDENTATION).append(
+                CLOSE_CURLY_BRACKET).append(ELSE).append(OPEN_CURLY_BRACKET)
+                .append(NEW_LINE);
+
+        assignment = TWENTY_SPACE_INDENTATION + RESULT + SPACE + EQUAL + SPACE
+                + resultString;
+        cond1 = RESULT + SPACE + NOT + EQUAL + SPACE + NULL;
+
+        builder.append(assignment).append(methodClose(SIXTEEN_SPACE))
+                .append(getIfConditionBegin(SIXTEEN_SPACE_INDENTATION, cond1));
+
+        assignment = TWENTY_SPACE_INDENTATION + SUBTREE_FILTERING_RESULT_BUILDER +
+                PERIOD + name + getOpenCloseParaWithValue(RESULT) +
+                signatureClose();
+        builder.append(assignment).append(methodClose(SIXTEEN_SPACE)).append(
+                TWELVE_SPACE_INDENTATION).append(CLOSE_CURLY_BRACKET)
+                .append(getSubTreeFilteredCondition(name)).append(methodClose(EIGHT_SPACE));
+        return builder.toString();
+    }
+
+    private static String getAppInstanceCondition(String name, String condition) {
+        return APP_INSTANCE + PERIOD + name + OPEN_CLOSE_BRACKET_STRING + SPACE +
+                condition + EQUAL + SPACE + NULL;
+    }
+
+    private static String getSelectOrContainmentAssignString() {
+        return TWELVE_SPACE_INDENTATION + IS_ANY_SELECT_OR_CONTAINMENT_NODE_FLAG +
+                PERIOD + SET_METHOD_PREFIX + getOpenCloseParaWithValue(ZERO) +
+                signatureClose();
+    }
+
+    /**
+     * Returns filter content match for list types.
+     *
+     * @param javaAttributeInfo attribute information
+     * @param isLeafList        if for leaf list
+     * @param node              YANG node
+     * @return filter content match for list types
+     */
+    private static String getSubtreeFilteringForList(
+            JavaAttributeInfo javaAttributeInfo, boolean isLeafList,
+            YangNode node) {
+        StringBuilder builder = new StringBuilder();
+        String caps = getCapitalCase(javaAttributeInfo.getAttributeName());
+        String name = javaAttributeInfo.getAttributeName();
+        String type = javaAttributeInfo.getImportInfo().getClassInfo();
+        if (javaAttributeInfo.getAttributeType() != null && javaAttributeInfo
+                .getAttributeType().getDataType() == IDENTITYREF) {
+            type = CLASS_STRING + DIAMOND_OPEN_BRACKET +
+                    QUESTION_MARK + SPACE + EXTEND + SPACE +
+                    type + DIAMOND_CLOSE_BRACKET;
+        }
+
+        YangDataStructure struct =
+                getYangDataStructure(javaAttributeInfo.getCompilerAnnotation());
+
+        boolean isMap = false;
+        if (struct != null && struct == YangDataStructure.MAP) {
+            isMap = true;
+        }
+
+        String clsInfo = DEFAULT_CAPS + type;
+        if (javaAttributeInfo.isQualifiedName()) {
+            if (javaAttributeInfo.getAttributeType() != null && javaAttributeInfo
+                    .getAttributeType().getDataType() == IDENTITYREF) {
+                type = CLASS_STRING + DIAMOND_OPEN_BRACKET +
+                        QUESTION_MARK + SPACE + EXTEND + SPACE +
+                        javaAttributeInfo.getImportInfo().getPkgInfo() + PERIOD +
+                        type + DIAMOND_CLOSE_BRACKET;
+            } else {
+                type = javaAttributeInfo.getImportInfo().getPkgInfo() + PERIOD +
+                        type;
+            }
+            clsInfo = javaAttributeInfo.getImportInfo().getPkgInfo() + PERIOD +
+                    clsInfo;
+        }
+
+        String classCast = getOpenCloseParaWithValue(clsInfo) + SPACE;
+        String cast = getOpenCloseParaWithValue(classCast + name);
+
+        if (node != null && node instanceof YangChoice) {
+            cast = name;
+        }
+        String validPass;
+        //If map is in DS then need to pass name.getValue() to processSubTree.
+        if (isMap) {
+            validPass = name + TWO + PERIOD + GET_VALUE;
+        } else {
+            validPass = name + TWO;
+        }
+        String resultString = cast + NEW_LINE + TWENTY_EIGHT_SPACE_INDENTATION +
+                PERIOD + PROCESS_SUBTREE_FILTERING + OPEN_PARENTHESIS +
+                validPass + COMMA + SPACE + FALSE + CLOSE_PARENTHESIS + SEMI_COLON +
+                NEW_LINE;
+        /*
+         * If select all schema child
+         */
+        String forCondition;
+        String mapEntry;
+        String para;
+        //If map is there in DS the for loop should run for map entry.
+        if (!isMap) {
+            forCondition = getForLoopString(SIXTEEN_SPACE_INDENTATION, type, name,
+                                            getAppInstanceAttrString(name));
+        } else {
+            mapEntry = MAP + PERIOD + ENTRY + DIAMOND_OPEN_BRACKET + type +
+                    KEYS + COMMA + SPACE + type + DIAMOND_CLOSE_BRACKET + SPACE;
+            para = getAppInstanceAttrString(name) + PERIOD + ENTRY_SET;
+            forCondition = getForLoopString(SIXTEEN_SPACE_INDENTATION,
+                                            mapEntry, name, para);
+        }
+        builder.append(getIfConditionBegin(EIGHT_SPACE_INDENTATION,
+                                           IS_SELECT_ALL_SCHEMA_CHILD_FLAG))
+                .append(getIfConditionBegin(TWELVE_SPACE_INDENTATION,
+                                            getAppInstanceCondition(name, NOT)))
+                .append(forCondition);
+        String assignment;
+        String result;
+        //If map is added then while creating dummy object need to used name
+        // .getValue() and to add the result in subTreeBuilder need to pass
+        // using key and value, key will be name.getKey() and value will be
+        // result.
+        if (isMap) {
+            result = getOpenCloseParaWithValue(name + PERIOD + GET_KEY + COMMA +
+                                                       SPACE + RESULT);
+        } else {
+            result = getOpenCloseParaWithValue(RESULT);
+        }
+        if (!isLeafList) {
+            builder.append(TWENTY_SPACE_INDENTATION).append(type).append(SPACE)
+                    .append(RESULT).append(signatureClose());
+            assignment = getDummyObjectCreation(node, name, type, clsInfo,
+                                                classCast, true, isMap);
+            builder.append(assignment);
+            assignment = TWENTY_SPACE_INDENTATION +
+                    SUBTREE_FILTERING_RESULT_BUILDER + PERIOD + ADD_STRING +
+                    getCapitalCase(TO) + caps + result +
+                    signatureClose();
+            builder.append(assignment);
+        } else {
+            assignment = TWENTY_SPACE_INDENTATION +
+                    SUBTREE_FILTERING_RESULT_BUILDER + PERIOD + ADD_STRING +
+                    getCapitalCase(TO) + caps + getOpenCloseParaWithValue(name) +
+                    signatureClose();
+            builder.append(assignment);
+        }
+        builder.append(methodClose(SIXTEEN_SPACE))
+                .append(TWELVE_SPACE_INDENTATION).append(CLOSE_CURLY_BRACKET);
+
+/*    } else {
+        if (isSubTreeFiltered && leafList2() != null) {
+            subTreeFilteringResultBuilder.addToLeafList2(leafList2());
+        }
+    }*/
+        builder.append(getSubTreeFilteredCondition(name));
+
+        String cond = name + OPEN_CLOSE_BRACKET_STRING + SPACE + NOT + EQUAL +
+                SPACE + NULL;
+
+        //If need to explicitly participate in query
+        builder.append(getElseIfConditionBegin(EIGHT_SPACE_INDENTATION, cond));
+
+        if (!isLeafList) {
+            builder.append(getSelectOrContainmentAssignString());
+        }
+
+        //If there is any parameter in the query condition
+        cond = NOT + name + OPEN_CLOSE_BRACKET_STRING + PERIOD + IS_EMPTY;
+        builder.append(getIfConditionBegin(TWELVE_SPACE_INDENTATION, cond));
+
+        if (isLeafList) {
+            cond = getAppInstanceCondition(name, EQUAL) + SPACE + OR_OPERATION +
+                    SPACE + APP_INSTANCE + PERIOD + name +
+                    OPEN_CLOSE_BRACKET_STRING + PERIOD + IS_EMPTY;
+            /*
+             * If there is no app instance to perform content match
+             */
+            builder.append(getIfConditionBegin(SIXTEEN_SPACE_INDENTATION, cond))
+                    .append(getReturnString(FALSE, TWENTY_SPACE_INDENTATION))
+                    .append(signatureClose())
+                    .append(methodClose(SIXTEEN_SPACE))
+                    // for instance iterator
+                    .append(getForLoopString(SIXTEEN_SPACE_INDENTATION, type, name,
+                                             name + OPEN_CLOSE_BRACKET_STRING));
+
+            assignment = TWENTY_SPACE_INDENTATION + BOOLEAN_DATA_TYPE + SPACE +
+                    FLAG + SPACE + EQUAL + SPACE + FALSE + signatureClose();
+            builder.append(assignment)
+                    // for app instance iterator
+                    .append(getForLoopString(TWENTY_SPACE_INDENTATION, type,
+                                             name + TWO,
+                                             getAppInstanceAttrString(name)));
+
+            cond = name + PERIOD + EQUALS_STRING
+                    + OPEN_PARENTHESIS + name + TWO + CLOSE_PARENTHESIS;
+            //the content match leaf list attribute value matches
+            builder.append(getIfConditionBegin(TWENTY_FOUR_SPACE_INDENTATION,
+                                               cond));
+
+            assignment = TWENTY_EIGHT_SPACE_INDENTATION + FLAG + SPACE + EQUAL +
+                    SPACE + TRUE + SEMI_COLON + NEW_LINE;
+            builder.append(assignment);
+            assignment = TWENTY_EIGHT_SPACE_INDENTATION +
+                    SUBTREE_FILTERING_RESULT_BUILDER + PERIOD + ADD_STRING +
+                    getCapitalCase(TO) + caps + getOpenCloseParaWithValue(name + TWO) +
+                    signatureClose();
+            builder.append(assignment).append(TWENTY_EIGHT_SPACE_INDENTATION)
+                    .append(BREAK).append(signatureClose())
+                    //the content match leaf list attribute value matches
+                    .append(methodClose(TWENTY_FOUR_SPACE))
+                    // for app instance iterator
+                    .append(methodClose(TWENTY_SPACE))
+                    //if the content match failed
+                    .append(getIfConditionBegin(TWENTY_SPACE_INDENTATION, NOT +
+                            FLAG))
+                    .append(getReturnString(FALSE, TWENTY_FOUR_SPACE_INDENTATION))
+                    .append(signatureClose()).append(methodClose(TWENTY_SPACE))// if flag == false
+                    .append(methodClose(SIXTEEN_SPACE)); // for instance iterator
+        } else {
+            cond = getAppInstanceCondition(name, NOT) + SPACE + AND_OPERATION +
+                    SPACE + NOT + getAppInstanceAttrString(name) +
+                    PERIOD + IS_EMPTY;
+            //Same here for loop for map entry.
+            if (!isMap) {
+                forCondition = getForLoopString(TWENTY_SPACE_INDENTATION, type,
+                                                name + TWO,
+                                                getAppInstanceAttrString(name));
+            } else {
+                mapEntry = MAP + PERIOD + ENTRY + DIAMOND_OPEN_BRACKET + type +
+                        KEYS + COMMA + SPACE + type + DIAMOND_CLOSE_BRACKET + SPACE;
+                para = getAppInstanceAttrString(name) + PERIOD + ENTRY_SET;
+                forCondition = getForLoopString(TWENTY_SPACE_INDENTATION,
+                                                mapEntry, name + TWO, para);
+            }
+            String forCondition2;
+            //Same here for loop for map entry.
+            if (!isMap) {
+                forCondition2 = getForLoopString(SIXTEEN_SPACE_INDENTATION, type, name,
+                                                 name + OPEN_CLOSE_BRACKET_STRING);
+            } else {
+                mapEntry = MAP + PERIOD + ENTRY + DIAMOND_OPEN_BRACKET + type +
+                        KEYS + COMMA + SPACE + type + DIAMOND_CLOSE_BRACKET + SPACE;
+                para = name + OPEN_CLOSE_BRACKET_STRING + PERIOD + ENTRY_SET;
+                forCondition2 = getForLoopString(SIXTEEN_SPACE_INDENTATION,
+                                                 mapEntry, name, para);
+            }
+            /*if there is any app instance entry*/
+            builder.append(getIfConditionBegin(SIXTEEN_SPACE_INDENTATION,
+                                               cond))
+                    //loop all the app instance(s)
+                    .append(forCondition2)
+                    .append(forCondition);
+
+            assignment = TWENTY_EIGHT_SPACE_INDENTATION + type + SPACE +
+                    RESULT + SPACE + EQUAL + SPACE + resultString;
+            builder.append(assignment);
+            cond = RESULT + SPACE + NOT + EQUAL + SPACE + NULL;
+            builder.append(getIfConditionBegin(TWENTY_EIGHT_SPACE_INDENTATION, cond));
+
+            //If map is added then while creating dummy object need to used name
+            // .getValue() and to add the result in subTreeBuilder need to pass
+            // using key and value, key will be name.getKey() and value will be
+            // result.
+            if (isMap) {
+                result = getOpenCloseParaWithValue(name + TWO + PERIOD + GET_KEY +
+                                                           COMMA +
+                                                           SPACE + RESULT);
+            } else {
+                result = getOpenCloseParaWithValue(RESULT);
+            }
+            assignment = THIRTY_TWO_SPACE_INDENTATION +
+                    SUBTREE_FILTERING_RESULT_BUILDER + PERIOD + ADD_STRING +
+                    getCapitalCase(TO) + caps + result + signatureClose();
+            builder.append(assignment).append(methodClose(TWENTY_EIGHT_SPACE))
+                    //loop all the app instance(s)
+                    .append(methodClose(TWENTY_FOUR_SPACE))
+                    //loop all the query condition instance(s)
+                    .append(methodClose(TWENTY_SPACE))
+                    .append(SIXTEEN_SPACE_INDENTATION).append(CLOSE_CURLY_BRACKET)
+                    .append(getSubTreeFilteredCondition(name));
+            //if there is any app instance entry
+        }
+
+        cond = TWELVE_SPACE_INDENTATION + CLOSE_CURLY_BRACKET
+                + ELSE + OPEN_CURLY_BRACKET + NEW_LINE;
+        builder.append(cond);
+
+        if (isLeafList) {
+            builder.append(getSelectOrContainmentAssignString());
+        }
+
+        //need to pass name.getKey() and name.getValue() while adding to
+        // subtree builder.
+        if (!isMap) {
+            forCondition = getForLoopString(SIXTEEN_SPACE_INDENTATION, type,
+                                            name, getAppInstanceAttrString(name));
+        } else {
+            mapEntry = MAP + PERIOD + ENTRY + DIAMOND_OPEN_BRACKET + type +
+                    KEYS + COMMA + SPACE + type + DIAMOND_CLOSE_BRACKET + SPACE;
+            para = getAppInstanceAttrString(name) + PERIOD + ENTRY_SET;
+            forCondition = getForLoopString(SIXTEEN_SPACE_INDENTATION,
+                                            mapEntry, name, para);
+        }
+        cond = getAppInstanceCondition(name, NOT) + SPACE + AND_OPERATION +
+                SPACE + NOT + getAppInstanceAttrString(name) + PERIOD + IS_EMPTY;
+        builder.append(getIfConditionBegin(SIXTEEN_SPACE_INDENTATION, cond))
+                .append(forCondition);
+        if (isMap) {
+            result = getOpenCloseParaWithValue(name + PERIOD + GET_KEY + COMMA +
+                                                       SPACE + name + PERIOD +
+                                                       GET_VALUE);
+        } else {
+            result = getOpenCloseParaWithValue(name);
+        }
+        assignment = TWENTY_FOUR_SPACE_INDENTATION +
+                SUBTREE_FILTERING_RESULT_BUILDER + PERIOD + ADD_STRING +
+                getCapitalCase(TO) + caps + result + signatureClose();
+        builder.append(assignment).append(methodClose(TWENTY_SPACE))// Close collection Iteration loop
+                // close  if condition
+                .append(methodClose(SIXTEEN_SPACE))
+                .append(methodClose(TWELVE_SPACE))// close  else condition
+                .append(methodClose(EIGHT_SPACE));// close else if condition
+
+        return builder.toString();
+    }
+
+    public static String getAugmentableSubTreeFiltering() {
+        return "        if (yangAugmentedInfoMap.isEmpty()) {\n" +
+                "            java.util.Set<Map.Entry<Class<?>, Object>> " +
+                "augment =" +
+                " appInstance.yangAugmentedInfoMap().entrySet();\n" +
+                "            if (augment != null && !augment.isEmpty()) {\n" +
+                "                java.util.Iterator<Map.Entry<Class<?>, " +
+                "Object>> augItr =" +
+                " augment.iterator();\n" +
+                "                while (augItr.hasNext()) {\n" +
+                "                    Map.Entry<Class<?>, Object> aug =" +
+                " augItr.next();\n" +
+                "                    Class<?> augClass = aug.getKey();\n" +
+                "                    String augClassName = augClass.getName();\n" +
+                "                    int index = augClassName.lastIndexOf('.');\n" +
+                "                    String classPackage = augClassName.substring(0, index) +\n" +
+                "                            \".\" + \"Default\" + augClass.getSimpleName() + \"$\"\n" +
+                "                            + augClass.getSimpleName() + \"Builder\";\n" +
+                "                    ClassLoader classLoader = augClass.getClassLoader();\n" +
+                "                    try {\n" +
+                "                        Class<?> builderClass;\n" +
+                "                        builderClass = classLoader.loadClass(classPackage);\n" +
+                "                        Object builderObj = builderClass.newInstance();\n" +
+                "                        java.lang.reflect.Method method = " +
+                "builderClass.getMethod(\"build\");\n" +
+                "                        Object defaultObj = method.invoke(builderObj);\n" +
+                "                        Class<?> defaultClass = defaultObj.getClass();\n" +
+                "                        method = defaultClass.getMethod(" +
+                "\"processSubtreeFiltering\", augClass, boolean.class);\n" +
+                "                        Object result = method.invoke(" +
+                "defaultObj, aug.getValue(), true);\n" +
+                "                        subTreeFilteringResultBuilder." +
+                "addYangAugmentedInfo(result, augClass);\n" +
+                "                    } catch (ClassNotFoundException | InstantiationException\n" +
+                "                            | NoSuchMethodException |\n" +
+                "                            InvocationTargetException | IllegalAccessException e) {\n" +
+                "                    }\n" +
+                "                }\n" +
+                "            }\n" +
+                "        } else {\n" +
+                "            java.util.Set<Map.Entry<Class<?>, Object>> augment = yangAugmentedInfoMap\n" +
+                "                    .entrySet();\n" +
+                "            java.util.Iterator<Map.Entry<Class<?>, Object>> augItr = augment.iterator();\n" +
+                "            while (augItr.hasNext()) {\n" +
+                "                Map.Entry<Class<?>, Object> aug = augItr.next();\n" +
+                "                Class<?> augClass = aug.getKey();\n" +
+                "                Object appInstanceInfo = appInstance." +
+                "yangAugmentedInfo(augClass);\n" +
+                "                if (appInstanceInfo == null) {\n" +
+                "                    subTreeFilteringResultBuilder." +
+                "addYangAugmentedInfo(aug.getValue(), aug.getKey());\n" +
+                "                } else {\n" +
+                "                    Object processSubtreeFiltering;\n" +
+                "                    try {\n" +
+                "                        processSubtreeFiltering = " +
+                "aug.getValue().getClass()\n" +
+                "                                .getMethod(\"processSubtreeFiltering\"," +
+                " aug.getKey(), boolean.class)\n" +
+                "                                .invoke(aug.getValue(), appInstanceInfo, true);\n" +
+                "                        if (processSubtreeFiltering != null) {\n" +
+                "                            subTreeFilteringResultBuilder\n" +
+                "                                    .addYangAugmentedInfo(" +
+                "processSubtreeFiltering, aug.getKey());\n" +
+                "                        }\n" +
+                "                    } catch (NoSuchMethodException | InvocationTargetException |\n" +
+                "                            IllegalAccessException e) {\n" +
+                "                    }\n" +
+                "                }\n" +
+                "            }\n" +
+                "        }\n";
+    }
+
+    private static String getSubTreeFilteredCondition(String name) {
+        StringBuilder builder = new StringBuilder();
+        String cond = SUBTREE_FILTERED + SPACE + AND_OPERATION + SPACE + name +
+                OPEN_CLOSE_BRACKET_STRING + SPACE + NOT + EQUAL + SPACE + NULL;
+
+        builder.append(ELSE).append(OPEN_CURLY_BRACKET).append(NEW_LINE)
+                .append(getIfConditionBegin(SIXTEEN_SPACE_INDENTATION, cond))
+                .append(TWENTY_SPACE_INDENTATION)
+                .append(SUBTREE_FILTERING_RESULT_BUILDER).append(PERIOD)
+                .append(name).append(getOpenCloseParaWithValue(name)).append(
+                signatureClose()).append(SIXTEEN_SPACE_INDENTATION).append(
+                CLOSE_CURLY_BRACKET).append(NEW_LINE).append(TWELVE_SPACE_INDENTATION)
+                .append(CLOSE_CURLY_BRACKET).append(NEW_LINE);
+        return builder.toString();
+    }
+
+    private static String getNameOfClassForIfCase(YangNode curNode) {
+        String name = null;
+        JavaFileInfoTranslator parentInfo;
+        if (curNode instanceof YangCase) {
+            YangNode parent = curNode.getParent();
+            if (parent instanceof YangChoice) {
+                parentInfo = ((JavaFileInfoContainer) parent).getJavaFileInfo();
+                name = getCapitalCase(parentInfo.getJavaName());
+            } else if (parent instanceof YangAugment) {
+                parentInfo = ((JavaFileInfoContainer) ((YangAugment) parent)
+                        .getAugmentedNode()).getJavaFileInfo();
+                if (parentInfo != null) {
+                    name = getCapitalCase(parentInfo.getJavaName());
+                } else {
+                    name = getCapitalCase(getCamelCase(
+                            ((YangAugment) parent).getAugmentedNode().getName(),
+                            null));
+                }
+            }
+        }
+        return name;
+    }
+
+    private static String getCaseCastString(
+            JavaFileInfoTranslator javaFileInfo, String instance, YangNode curNode) {
+        if (curNode instanceof YangCase) {
+            String caseName = DEFAULT_CAPS + getCapitalCase(
+                    javaFileInfo.getJavaName());
+            return EIGHT_SPACE_INDENTATION + caseName + SPACE + APP_INSTANCE + SPACE +
+                    EQUAL + SPACE + OPEN_PARENTHESIS + caseName +
+                    CLOSE_PARENTHESIS + SPACE + instance + signatureClose();
+        }
+        return null;
+    }
+
+    private static String getDummyObjectCreation(YangNode node, String name,
+                                                 String clsInfo, String type,
+                                                 String classCast, boolean isList,
+                                                 boolean isMap) {
+        String para = getAppInstanceAttrString(name);
+        if (isList) {
+            if (isMap) {
+                para = name + PERIOD + GET_VALUE;
+            } else {
+                para = name;
+            }
+        }
+        if (node != null && node instanceof YangChoice) {
+            return getChoiceReflectionResult(name, clsInfo);
+        }
+        return TWENTY_SPACE_INDENTATION + RESULT + SPACE + EQUAL + SPACE +
+                getOpenCloseParaWithValue(
+                        classCast + type + PERIOD + BUILDER_LOWER_CASE +
+                                OPEN_CLOSE_BRACKET_STRING + NEW_LINE +
+                                TWENTY_EIGHT_SPACE_INDENTATION + PERIOD +
+                                BUILD_FOR_FILTER + OPEN_CLOSE_BRACKET_STRING) +
+                PERIOD + PROCESS_SUBTREE_FILTERING + getOpenCloseParaWithValue(
+                para + COMMA + SPACE + TRUE) + signatureClose();
+    }
+
+    private static String getChoiceReflectionResult(String name, String returnType) {
+        String call = "appInstance." + name + "()";
+        return "                    Class<?>[] classArray = " + call + "" +
+                ".getClass()" +
+                ".getInterfaces();\n" +
+                "                    Class<?> caseIntf = classArray[0];\n" +
+                "                    try {\n" +
+                "                        ClassLoader classLoader = this" +
+                ".getClass().getClassLoader();\n" +
+                "                        String className = \"Default\" + " +
+                "caseIntf.getSimpleName();\n" +
+                "                        className = caseIntf.getPackage()" +
+                ".getName() + \".\" + className;\n" +
+                "                        Class<?> caseClass = classLoader" +
+                ".loadClass(className);\n" +
+                "                        java.lang.reflect.Constructor<?> " +
+                "constructor = caseClass.getDeclaredConstructor();\n" +
+                "                        constructor.setAccessible(true);\n" +
+                "                        Object obj1 = constructor" +
+                ".newInstance();\n" +
+                "                        java.lang.reflect.Method method =" +
+                " caseClass.getMethod(\"builder\");\n" +
+                "                        Object obj = method.invoke(obj1);\n" +
+                "                        Class<?> builderClass = obj.getClass();\n" +
+                "                        method = builderClass.getMethod(\"build\");\n" +
+                "                        Object obj2 = method.invoke(obj);\n" +
+                "                        Class<?> input = this.getClass()" +
+                ".getMethod(" + "\"" + name + "\").getReturnType();\n" +
+                "                        method = caseClass.getMethod" +
+                "(\"processSubtreeFiltering\", input,\n" +
+                "                                     boolean.class);\n" +
+                "                        result = (" + returnType + ") method.invoke" +
+                "(obj2, " + call + ", true);\n" +
+                "                    } catch (NoSuchMethodException | InstantiationException |\n" +
+                "                            IllegalAccessException | " +
+                "InvocationTargetException |\n" +
+                "                            ClassNotFoundException e) {\n" +
+                "                        e.printStackTrace();\n" +
+                "                    }\n";
+    }
+}
diff --git a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/utils/TranslatorErrorType.java b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/utils/TranslatorErrorType.java
new file mode 100644
index 0000000..d9d5e70
--- /dev/null
+++ b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/utils/TranslatorErrorType.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.yang.compiler.translator.tojava.utils;
+
+/**
+ * Represents translator error type.
+ */
+public enum TranslatorErrorType {
+    /**
+     * Represents the invalid node for translation.
+     */
+    INVALID_TRANSLATION_NODE("Invalid node for translation"),
+
+    /**
+     * Represents the missing parent node.
+     */
+    MISSING_PARENT_NODE("Missing parent node to get current node's java " +
+                                "information"),
+
+    /**
+     * Represents the invalid parent node.
+     */
+    INVALID_PARENT_NODE("Invalid parent node to get current node's java " +
+                                "information"),
+
+    /**
+     * Represents the invalid holder of leaf.
+     */
+    INVALID_LEAF_HOLDER("Invalid holder of leaf"),
+
+    /**
+     * Represents the invalid child node.
+     */
+    INVALID_CHILD_NODE("Invalid child of node "),
+
+    /**
+     * Represents the invalid leaf list without JAVA information.
+     */
+    INVALID_LEAF_LIST("Leaf-list does not have java information"),
+
+    /**
+     * Represents the invalid leaf without JAVA information.
+     */
+    INVALID_LEAF("Leaf does not have java information"),
+
+    /**
+     * Represents the invalid node without JAVA information.
+     */
+    INVALID_NODE("Missing java file information to get the package details " +
+                         "of attribute corresponding to child node"),
+
+    /**
+     * Represents that code generation failed for a node at exit.
+     */
+    FAIL_AT_EXIT("Failed to generate code for "),
+
+    /**
+     * Represents that code generation preparation failed for a node at entry.
+     */
+    FAIL_AT_ENTRY("Failed to prepare generate code entry for ");
+
+    // Prefix of an error type.
+    private final String prefix;
+
+    /**
+     * Creates translator error type.
+     *
+     * @param p prefix string
+     */
+    TranslatorErrorType(String p) {
+        prefix = p;
+    }
+
+    /**
+     * Returns prefix for a given enum type.
+     *
+     * @return prefix
+     */
+    public String prefix() {
+        return prefix;
+    }
+}
diff --git a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/utils/TranslatorUtils.java b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/utils/TranslatorUtils.java
new file mode 100644
index 0000000..fb5fd20
--- /dev/null
+++ b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/utils/TranslatorUtils.java
@@ -0,0 +1,146 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.translator.tojava.utils;
+
+import org.onosproject.yang.compiler.datamodel.LocationInfo;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangSchemaNode;
+import org.onosproject.yang.compiler.translator.tojava.JavaCodeGeneratorInfo;
+import org.onosproject.yang.compiler.translator.tojava.TempJavaBeanFragmentFiles;
+import org.onosproject.yang.compiler.translator.tojava.TempJavaCodeFragmentFilesContainer;
+import org.onosproject.yang.compiler.translator.tojava.TempJavaTypeFragmentFiles;
+
+import java.io.IOException;
+
+import static org.onosproject.yang.compiler.utils.UtilConstants.AT;
+import static org.onosproject.yang.compiler.utils.UtilConstants.IN;
+
+/**
+ * Represents common translator utilities.
+ */
+public final class TranslatorUtils {
+
+    // No instantiation
+    private TranslatorUtils() {
+    }
+
+    /**
+     * Returns translator error message string with location information for
+     * YANG schema node with localized message.
+     *
+     * @param errorType    type of translator error
+     * @param node         YANG schema node
+     * @param localizedMsg localized message
+     * @return translator error message
+     */
+    public static String getErrorMsg(TranslatorErrorType errorType,
+                                     YangSchemaNode node,
+                                     String localizedMsg) {
+        return getErrorMsg(errorType, node) + localizedMsg;
+    }
+
+    /**
+     * Returns translator error message string with location information for
+     * YANG schema node.
+     *
+     * @param errorType type of translator error
+     * @param node      YANG schema node
+     * @return translator error message
+     */
+    public static String getErrorMsg(TranslatorErrorType errorType,
+                                     YangSchemaNode node) {
+        return errorType.prefix() + IN + node.getName() + getLocationMsg(node);
+    }
+
+    /**
+     * Returns translator error message string with location information for
+     * JAVA code generator info.
+     *
+     * @param errorType type of translator error
+     * @param location  node with location info
+     * @return translator error message
+     */
+    public static String getErrorMsgForCodeGenerator(TranslatorErrorType errorType,
+                                                     LocationInfo location) {
+        return errorType.prefix() + getLocationMsg(location);
+    }
+
+    /**
+     * Returns location message string.
+     *
+     * @param location location info node
+     * @return location message string
+     */
+    private static String getLocationMsg(LocationInfo location) {
+        return AT + location.getLineNumber() + AT +
+                location.getCharPosition() + IN + location.getFileName();
+    }
+
+    /**
+     * Returns bean temp files for YANG node.
+     *
+     * @param curNode current YANG node
+     * @return bean files
+     */
+    public static TempJavaBeanFragmentFiles getBeanFiles(YangNode curNode) {
+        return ((TempJavaCodeFragmentFilesContainer) curNode)
+                .getTempJavaCodeFragmentFiles().getBeanTempFiles();
+    }
+
+    /**
+     * Returns bean temp files for JAVA code generator info.
+     *
+     * @param info JAVA code generator info
+     * @return bean files
+     */
+    public static TempJavaBeanFragmentFiles getBeanFiles(JavaCodeGeneratorInfo
+                                                                 info) {
+        return info.getTempJavaCodeFragmentFiles().getBeanTempFiles();
+    }
+
+    /**
+     * Returns type temp files for YANG node.
+     *
+     * @param curNode current YANG node
+     * @return type files
+     */
+    public static TempJavaTypeFragmentFiles getTypeFiles(YangNode curNode) {
+        return ((TempJavaCodeFragmentFilesContainer) curNode)
+                .getTempJavaCodeFragmentFiles().getTypeTempFiles();
+    }
+
+    /**
+     * Adds default constructor to a given YANG node.
+     *
+     * @param node     YANG node
+     * @param modifier modifier for constructor.
+     * @param toAppend string which need to be appended with the class name
+     * @return default constructor for class
+     * @throws IOException when fails to append to file
+     */
+    static String addDefaultConstructor(YangNode node, String modifier,
+                                        String toAppend)
+            throws IOException {
+        return ((TempJavaCodeFragmentFilesContainer) node)
+                .getTempJavaCodeFragmentFiles()
+                .addDefaultConstructor(modifier, toAppend);
+        /*
+         * TODO update addDefaultConstructor, it doesn't need YANG node as an
+         * input.
+         */
+    }
+}
diff --git a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/utils/ValidatorTypeForUnionTypes.java b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/utils/ValidatorTypeForUnionTypes.java
new file mode 100644
index 0000000..d3e068a
--- /dev/null
+++ b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/utils/ValidatorTypeForUnionTypes.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.translator.tojava.utils;
+
+/**
+ * Validator types for union when there is conflict between two types.
+ */
+public enum ValidatorTypeForUnionTypes {
+
+    /**
+     * When conflict is there for int32 and uInt16.
+     */
+    INT_TYPE_CONFLICT,
+
+    /**
+     * When conflict is there for int16 and uInt8.
+     */
+    SHORT_TYPE_CONFLICT,
+
+    /**
+     * When conflict is there for int64 and uInt32.
+     */
+    LONG_TYPE_CONFLICT
+}
diff --git a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/utils/package-info.java b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/utils/package-info.java
new file mode 100644
index 0000000..28d0329
--- /dev/null
+++ b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/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.
+ */
+
+/**
+ * Translator's utils for YANG plugin.
+ */
+package org.onosproject.yang.compiler.translator.tojava.utils;
diff --git a/compiler/base/translator/src/test/java/org/onosproject/yang/compiler/translator/tojava/javamodel/AttributesJavaDataTypeTest.java b/compiler/base/translator/src/test/java/org/onosproject/yang/compiler/translator/tojava/javamodel/AttributesJavaDataTypeTest.java
new file mode 100644
index 0000000..7ae5564
--- /dev/null
+++ b/compiler/base/translator/src/test/java/org/onosproject/yang/compiler/translator/tojava/javamodel/AttributesJavaDataTypeTest.java
@@ -0,0 +1,199 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.translator.tojava.javamodel;
+
+import org.junit.Test;
+import org.onosproject.yang.compiler.datamodel.YangDerivedInfo;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangType;
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes;
+import org.onosproject.yang.compiler.translator.tojava.JavaFileInfoTranslator;
+import org.onosproject.yang.compiler.utils.UtilConstants;
+import org.onosproject.yang.compiler.utils.io.YangToJavaNamingConflictUtil;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+
+import static org.hamcrest.core.Is.is;
+import static org.hamcrest.core.IsNot.not;
+import static org.junit.Assert.assertThat;
+import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes.BOOLEAN;
+import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes.DERIVED;
+import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes.INT32;
+import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes.STRING;
+import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes.UINT8;
+
+/**
+ * Unit test case for attribute java data type.
+ */
+public class AttributesJavaDataTypeTest {
+
+    private static final YangDataTypes TYPE1 = STRING;
+    private static final YangDataTypes TYPE2 = INT32;
+    private static final YangDataTypes TYPE3 = BOOLEAN;
+    private static final YangDataTypes TYPE4 = UINT8;
+    private static final YangDataTypes TYPE_DEF = DERIVED;
+    private static final String CLASS_INFO1 = "String";
+    private static final String CLASS_INFO2 = "int";
+    private static final String CLASS_INFO3 = "boolean";
+    private static final String CLASS_INFO4 = "short";
+    private static final String CLASS_INFO5 = "Integer";
+    private static final String TYPE_DEF_PKG = "target.test";
+    private static String test = "";
+    private static YangToJavaNamingConflictUtil pluginConfig = null;
+
+    /**
+     * Unit test for private constructor.
+     *
+     * @throws SecurityException         if any security violation is observed
+     * @throws NoSuchMethodException     if when the method is not found
+     * @throws IllegalArgumentException  if there is illegal argument found
+     * @throws InstantiationException    if instantiation is provoked for the private constructor
+     * @throws IllegalAccessException    if instance is provoked or a method is provoked
+     * @throws InvocationTargetException when an exception occurs by the method or constructor
+     */
+    @Test
+    public void callPrivateConstructors()
+            throws SecurityException, NoSuchMethodException, IllegalArgumentException,
+            InstantiationException, IllegalAccessException, InvocationTargetException {
+
+        Class<?>[] classesToConstruct = {AttributesJavaDataType.class};
+        for (Class<?> clazz : classesToConstruct) {
+            Constructor<?> constructor = clazz.getDeclaredConstructor();
+            constructor.setAccessible(true);
+            assertThat(null, not(constructor.newInstance()));
+        }
+    }
+
+    /**
+     * Unit test for java class info method test.
+     */
+    @Test
+    public void testgetJavaClassInfo() {
+        test = AttributesJavaDataType.getJavaImportClass(getStubYangType(TYPE1), false, pluginConfig);
+        assertThat(true, is(test.equals(CLASS_INFO1)));
+
+        test = AttributesJavaDataType.getJavaImportClass(getStubYangType(TYPE2), true, pluginConfig);
+        assertThat(true, is(test.equals(CLASS_INFO5)));
+
+        test = AttributesJavaDataType.getJavaImportClass(getStubYangType(TYPE3), false, pluginConfig);
+        assertThat(null, is(test));
+
+        test = AttributesJavaDataType.getJavaImportClass(getStubYangType(TYPE4), false, pluginConfig);
+        assertThat(null, is(test));
+    }
+
+    /**
+     * Unit test for java data type method.
+     */
+    @Test
+    public void testgetJavaDataType() {
+        test = AttributesJavaDataType.getJavaDataType(getStubYangType(TYPE1));
+        assertThat(true, is(test.equals(CLASS_INFO1)));
+
+        test = AttributesJavaDataType.getJavaDataType(getStubYangType(TYPE2));
+        assertThat(true, is(test.equals(CLASS_INFO2)));
+
+        test = AttributesJavaDataType.getJavaDataType(getStubYangType(TYPE3));
+        assertThat(true, is(test.equals(CLASS_INFO3)));
+
+        test = AttributesJavaDataType.getJavaDataType(getStubYangType(TYPE4));
+        assertThat(true, is(test.equals(CLASS_INFO4)));
+    }
+
+    /**
+     * Unit test for java package info method.
+     */
+    @Test
+    public void testgetJavaPkgInfo() {
+        test = AttributesJavaDataType.getJavaImportPackage(getStubYangType(TYPE1), false, pluginConfig);
+        assertThat(true, is(test.equals(UtilConstants.JAVA_LANG)));
+
+        test = AttributesJavaDataType.getJavaImportPackage(getStubYangType(TYPE2), true, pluginConfig);
+        assertThat(true, is(test.equals(UtilConstants.JAVA_LANG)));
+
+        test = AttributesJavaDataType.getJavaImportPackage(getStubYangType(TYPE3), false, pluginConfig);
+        assertThat(null, is(test));
+
+        test = AttributesJavaDataType.getJavaImportPackage(getStubYangType(TYPE4), false, pluginConfig);
+        assertThat(null, is(test));
+    }
+
+    /**
+     * Unit test case for typedef.
+     *
+     * @throws DataModelException when fails to do data model operations
+     */
+    @Test
+    public void testForTypeDef() throws DataModelException {
+        test = AttributesJavaDataType.getJavaImportPackage(getStubExtendedInfo(getStubYangType(TYPE_DEF)), false, pluginConfig);
+        assertThat(true, is(test.equals(TYPE_DEF_PKG)));
+    }
+
+    /**
+     * Returns stub YANG type for test.
+     *
+     * @param dataTypes YANG data types
+     * @return YANG type
+     */
+    private YangType<?> getStubYangType(YangDataTypes dataTypes) {
+        YangType<?> type = new YangType<>();
+        type.setDataType(dataTypes);
+        return type;
+    }
+
+    /**
+     * Returns YANG type with extended info.
+     *
+     * @param type YANG type
+     * @return YANG type with extended info
+     * @throws DataModelException when fails to do data model operations
+     */
+    @SuppressWarnings("unchecked")
+    private YangType<?> getStubExtendedInfo(YangType<?> type) throws DataModelException {
+        YangJavaTypeDefTranslator typedef = new YangJavaTypeDefTranslator();
+        getStubParent().addChild(typedef);
+        YangDerivedInfo<?> derInfo = new YangDerivedInfo<>();
+        derInfo.setReferredTypeDef(typedef);
+        ((YangType<YangDerivedInfo<?>>) type).setDataTypeExtendedInfo(derInfo);
+        return type;
+    }
+
+    /**
+     * Returns java file info.
+     *
+     * @return java file info
+     */
+    private JavaFileInfoTranslator addStubJavaFileInfo() {
+        JavaFileInfoTranslator fileInfo = new JavaFileInfoTranslator();
+        fileInfo.setJavaName("test");
+        fileInfo.setPackage("target");
+        return fileInfo;
+    }
+
+    /**
+     * Adds stub parent module for typedef.
+     *
+     * @return stub parent module
+     */
+    private YangNode getStubParent() {
+        YangJavaModuleTranslator parent = new YangJavaModuleTranslator();
+        parent.setJavaFileInfo(addStubJavaFileInfo());
+        return parent;
+    }
+}
diff --git a/compiler/base/translator/src/test/java/org/onosproject/yang/compiler/translator/tojava/utils/JavaCodeSnippetGenTest.java b/compiler/base/translator/src/test/java/org/onosproject/yang/compiler/translator/tojava/utils/JavaCodeSnippetGenTest.java
new file mode 100644
index 0000000..92c1177
--- /dev/null
+++ b/compiler/base/translator/src/test/java/org/onosproject/yang/compiler/translator/tojava/utils/JavaCodeSnippetGenTest.java
@@ -0,0 +1,104 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.translator.tojava.utils;
+
+import org.junit.Test;
+import org.onosproject.yang.compiler.translator.tojava.JavaQualifiedTypeInfoTranslator;
+import org.onosproject.yang.compiler.utils.UtilConstants;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.Is.is;
+import static org.hamcrest.core.IsNot.not;
+
+/**
+ * Unit test cases for java code snippet generator.
+ */
+public class JavaCodeSnippetGenTest {
+
+    private static final String PKG_INFO = "org.onosproject.unittest";
+    private static final String CLASS_INFO = "JavaCodeSnippetGenTest";
+    private static final String YANG_NAME = "Test";
+
+    /**
+     * Unit test for private constructor.
+     *
+     * @throws SecurityException         if any security violation is observed
+     * @throws NoSuchMethodException     if when the method is not found
+     * @throws IllegalArgumentException  if there is illegal argument found
+     * @throws InstantiationException    if instantiation is provoked for the private constructor
+     * @throws IllegalAccessException    if instance is provoked or a method is provoked
+     * @throws InvocationTargetException when an exception occurs by the method or constructor
+     */
+    @Test
+    public void callPrivateConstructors()
+            throws SecurityException, NoSuchMethodException, IllegalArgumentException,
+            InstantiationException, IllegalAccessException, InvocationTargetException {
+
+        Class<?>[] classesToConstruct = {JavaCodeSnippetGen.class};
+        for (Class<?> clazz : classesToConstruct) {
+            Constructor<?> constructor = clazz.getDeclaredConstructor();
+            constructor.setAccessible(true);
+            assertThat(null, not(constructor.newInstance()));
+        }
+    }
+
+    /**
+     * Unit test case for import text.
+     */
+    @Test
+    public void testForImportText() {
+        JavaQualifiedTypeInfoTranslator importInfo = new JavaQualifiedTypeInfoTranslator();
+        importInfo.setPkgInfo(PKG_INFO);
+        importInfo.setClassInfo(CLASS_INFO);
+
+        String imports = JavaCodeSnippetGen.getImportText(importInfo);
+
+        assertThat(true, is(imports.equals(UtilConstants.IMPORT + PKG_INFO + UtilConstants.PERIOD + CLASS_INFO + UtilConstants.SEMI_COLON + UtilConstants.NEW_LINE)));
+    }
+
+    /**
+     * Unit test case for java attribute info.
+     */
+    @Test
+    public void testForJavaAttributeInfo() {
+
+        String attributeWithoutTypePkg = JavaCodeSnippetGen.getJavaAttributeDefinition(null, UtilConstants.STRING_DATA_TYPE, YANG_NAME,
+                                                                                       false, UtilConstants.PRIVATE, null);
+        assertThat(true, is(attributeWithoutTypePkg.contains(
+                UtilConstants.PRIVATE + UtilConstants.SPACE + UtilConstants.STRING_DATA_TYPE + UtilConstants.SPACE + YANG_NAME + UtilConstants.SEMI_COLON + UtilConstants.NEW_LINE)));
+
+        String attributeWithTypePkg = JavaCodeSnippetGen.getJavaAttributeDefinition(UtilConstants.JAVA_LANG, UtilConstants.STRING_DATA_TYPE, YANG_NAME,
+                                                                                    false, UtilConstants.PRIVATE, null);
+        assertThat(true, is(attributeWithTypePkg.contains(UtilConstants.PRIVATE + UtilConstants.SPACE + UtilConstants.JAVA_LANG + UtilConstants.PERIOD
+                                                                  + UtilConstants.STRING_DATA_TYPE + UtilConstants.SPACE + YANG_NAME + UtilConstants.SEMI_COLON + UtilConstants.NEW_LINE)));
+
+        String attributeWithListPkg = JavaCodeSnippetGen.getJavaAttributeDefinition(UtilConstants.JAVA_LANG, UtilConstants.STRING_DATA_TYPE, YANG_NAME,
+                                                                                    true, UtilConstants.PRIVATE, null);
+        assertThat(true, is(attributeWithListPkg.contains(
+                UtilConstants.PRIVATE + UtilConstants.SPACE + UtilConstants.LIST + UtilConstants.DIAMOND_OPEN_BRACKET + UtilConstants.JAVA_LANG + UtilConstants.PERIOD + UtilConstants.STRING_DATA_TYPE
+                        + UtilConstants.DIAMOND_CLOSE_BRACKET + UtilConstants.SPACE + YANG_NAME)));
+
+        String attributeWithListWithoutPkg = JavaCodeSnippetGen.getJavaAttributeDefinition(null, UtilConstants.STRING_DATA_TYPE, YANG_NAME,
+                                                                                           true, UtilConstants.PRIVATE, null);
+        assertThat(true, is(attributeWithListWithoutPkg.contains(
+                UtilConstants.PRIVATE + UtilConstants.SPACE + UtilConstants.LIST + UtilConstants.DIAMOND_OPEN_BRACKET + UtilConstants.STRING_DATA_TYPE + UtilConstants.DIAMOND_CLOSE_BRACKET + UtilConstants.SPACE
+                        + YANG_NAME)));
+    }
+}
diff --git a/compiler/base/translator/src/test/java/org/onosproject/yang/compiler/translator/tojava/utils/JavaIdentifierSyntaxTest.java b/compiler/base/translator/src/test/java/org/onosproject/yang/compiler/translator/tojava/utils/JavaIdentifierSyntaxTest.java
new file mode 100644
index 0000000..d21cfba
--- /dev/null
+++ b/compiler/base/translator/src/test/java/org/onosproject/yang/compiler/translator/tojava/utils/JavaIdentifierSyntaxTest.java
@@ -0,0 +1,335 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.translator.tojava.utils;
+
+import org.hamcrest.core.Is;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.onosproject.yang.compiler.datamodel.YangRevision;
+import org.onosproject.yang.compiler.translator.exception.TranslatorException;
+import org.onosproject.yang.compiler.utils.UtilConstants;
+import org.onosproject.yang.compiler.utils.io.YangToJavaNamingConflictUtil;
+
+import java.io.File;
+import java.io.IOException;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import static org.apache.commons.io.FileUtils.deleteDirectory;
+import static org.hamcrest.core.Is.is;
+import static org.hamcrest.core.IsNot.not;
+import static org.junit.Assert.assertThat;
+import static org.onosproject.yang.compiler.translator.tojava.utils.JavaIdentifierSyntax.doesPackageExist;
+import static org.onosproject.yang.compiler.translator.tojava.utils.JavaIdentifierSyntax.getRootPackage;
+import static org.onosproject.yang.compiler.utils.io.impl.YangIoUtils.getCamelCase;
+import static org.onosproject.yang.compiler.utils.io.impl.YangIoUtils.getCapitalCase;
+import static org.onosproject.yang.compiler.utils.io.impl.YangIoUtils.getJavaPackageFromPackagePath;
+import static org.onosproject.yang.compiler.utils.io.impl.YangIoUtils.getPackageDirPathFromJavaJPackage;
+import static org.onosproject.yang.compiler.utils.io.impl.YangIoUtils.getSmallCase;
+
+/**
+ * Unit tests for java identifier syntax.
+ */
+public final class JavaIdentifierSyntaxTest {
+
+    private static final String PARENT_PACKAGE = "test5/test6/test7";
+    private static final String CHILD_PACKAGE = "test1:test2:test3";
+    private static final String DATE1 = "2000-1-5";
+    private static final String DATE2 = "1992-01-25";
+    private static final String PARENT_WITH_PERIOD = "test5.test6.test7";
+    private static final String CHILD_WITH_PERIOD = "test1.test2.test3";
+    private static final String DATE_WITH_REV1 = "rev20000105";
+    private static final String DATE_WITH_REV2 = "rev19920125";
+    private static final String VERSION_NUMBER = "v1";
+    private static final String VALID_PREFIX = "123add-prefix";
+    private static final String INVALID_PREFIX = "-*()&^&#$%";
+    private static final String INVALID_PREFIX1 = "abc~!@#$%^&*()_+}{:<>?`1234567890-=[]''|,./SS";
+    private static final String INVALID_NAME_SPACE_FOR_INVALID_PREFIX = "try:#test3:9case3";
+    private static final String INVALID_NAME_SPACE1 = "byte:#test2:9test3";
+    private static final String INVALID_NAME_SPACE2 = "const:#test2://9test3";
+    private static final String INVALID_NAME_SPACE3 = "CONST:TRY://9test3";
+    private static final String VALID_NAME_SPACE1 = "123addprefixbyte.test2.123addprefix9test3";
+    private static final String VALID_NAME_SPACE2 = "yangautoprefixconst.test2.yangautoprefix9test3";
+    private static final String VALID_NAME_SPACE3 = "abc1234567890ssconst.test2.abc1234567890ss9test3";
+    private static final String VALID_NAME_SPACE4 = "yangautoprefixconst.yangautoprefixtry.yangautoprefix9test3";
+    private static final String WITHOUT_CAMEL_CASE = "test-camel-case-identifier";
+    private static final String WITH_CAMEL_CASE = "testCamelCaseIdentifier";
+    private static final String WITHOUT_CAMEL_CASE1 = ".-_try-._-.123";
+    private static final String WITH_CAMEL_CASE1 = "try123";
+    private static final String WITHOUT_CAMEL_CASE2 = "_try";
+    private static final String WITH_CAMEL_CASE2 = "yangAutoPrefixTry";
+    private static final String WITHOUT_CAMEL_CASE3 = "-1-123g-123ga-a";
+    private static final String WITH_CAMEL_CASE3 = "yangAutoPrefix1123G123Gaa";
+    private static final String WITHOUT_CAMEL_CASE4 = "a-b-c-d-e-f-g-h";
+    private static final String WITH_CAMEL_CASE4 = "aBcDeFgh";
+    private static final String WITHOUT_CAMEL_CASE5 = "TestName";
+    private static final String WITH_CAMEL_CASE5 = "testName";
+    private static final String WITHOUT_CAMEL_CASE6 = "TEST-NAME";
+    private static final String WITH_CAMEL_CASE6 = "testName";
+    private static final String WITHOUT_CAMEL_CASE7 = "TESTNAME";
+    private static final String WITH_CAMEL_CASE7 = "testname";
+    private static final String WITHOUT_CAMEL_CASE8 = "TE-ST-NA-ME";
+    private static final String WITH_CAMEL_CASE8 = "teStNaMe";
+    private static final String WITHOUT_CAMEL_CASE9 = "TEST3NAME";
+    private static final String WITH_CAMEL_CASE9 = "test3Name";
+    private static final String WITHOUT_CAMEL_CASE10 = "TEST3";
+    private static final String WITH_CAMEL_CASE10 = "test3";
+    private static final String WITHOUT_CAMEL_CASE11 = "TEST3nAMe";
+    private static final String WITH_CAMEL_CASE11 = "test3Name";
+    private static final String WITHOUT_CAMEL_CASE12 = "TEST3name";
+    private static final String WITH_CAMEL_CASE12 = "test3Name";
+    private static final String WITHOUT_CAMEL_CASE13 = "t-RY";
+    private static final String WITH_CAMEL_CASE13 = "tRy";
+    private static final String WITHOUT_CAMEL_CASE14 = "TRY";
+    private static final String WITH_CAMEL_CASE14 = "yangAutoPrefixTry";
+    private static final String WITHOUT_CAPITAL = "test_this";
+    private static final String WITH_CAPITAL = "Test_this";
+    private static final String WITH_SMALL = "test_this";
+    private static final String WITH_CAMEL_CASE_WITH_PREFIX = "123addPrefixTry";
+    private static final String WITH_CAMEL_CASE_WITH_PREFIX1 = "abc1234567890Ss1123G123Gaa";
+    private static final String DATE_FORMAT = "yyyy-MM-dd";
+    private static final String BASE_DIR_PKG = "target.UnitTestCase.";
+    private static final String DIR_PATH = "exist1.exist2.exist3";
+    private static final String PKG_INFO = "package-info.java";
+    private static SimpleDateFormat simpleDateFormat = new SimpleDateFormat(DATE_FORMAT);
+    private static YangToJavaNamingConflictUtil conflictResolver = new YangToJavaNamingConflictUtil();
+    @Rule
+    public ExpectedException thrown = ExpectedException.none();
+
+    /**
+     * Unit test for private constructor.
+     *
+     * @throws SecurityException         if any security violation is observed.
+     * @throws NoSuchMethodException     if when the method is not found.
+     * @throws IllegalArgumentException  if there is illegal argument found.
+     * @throws InstantiationException    if instantiation is provoked for the
+     *                                   private constructor.
+     * @throws IllegalAccessException    if instance is provoked or a method is
+     *                                   provoked.
+     * @throws InvocationTargetException when an exception occurs by the method
+     *                                   or constructor.
+     */
+    @Test
+    public void callPrivateConstructors()
+            throws SecurityException, NoSuchMethodException, IllegalArgumentException,
+            InstantiationException, IllegalAccessException, InvocationTargetException {
+
+        Class<?>[] classesToConstruct = {JavaIdentifierSyntax.class};
+        for (Class<?> clazz : classesToConstruct) {
+            Constructor<?> constructor = clazz.getDeclaredConstructor();
+            constructor.setAccessible(true);
+            assertThat(null, not(constructor.newInstance()));
+        }
+    }
+
+    /**
+     * Unit test for root package generation with revision complexity.
+     */
+    @Test
+    public void getRootPackageTest()
+            throws ParseException {
+        conflictResolver.setPrefixForIdentifier(null);
+        String rootPackage = getRootPackage((byte) 1, CHILD_PACKAGE, getYangRevision(DATE1), conflictResolver);
+        assertThat(rootPackage.equals(UtilConstants.DEFAULT_BASE_PKG + UtilConstants.PERIOD + VERSION_NUMBER
+                                              + UtilConstants.PERIOD + CHILD_WITH_PERIOD + UtilConstants.PERIOD + DATE_WITH_REV1), is(true));
+    }
+
+    /**
+     * Unit test for root package generation with invalid prefix.
+     */
+    @Test
+    public void getRootPackageWithInvalidPrefix()
+            throws TranslatorException, ParseException {
+        thrown.expect(ArrayIndexOutOfBoundsException.class);
+        thrown.expectMessage("The given prefix in pom.xml is invalid.");
+        conflictResolver.setPrefixForIdentifier(INVALID_PREFIX);
+        String rootPackage1 = getRootPackage((byte) 1, INVALID_NAME_SPACE_FOR_INVALID_PREFIX, getYangRevision(DATE1),
+                                             conflictResolver);
+    }
+
+    /**
+     * Unit test for root package generation with special characters presence.
+     */
+    @Test
+    public void getRootPackageWithSpecialCharactersTest()
+            throws ParseException {
+        conflictResolver.setPrefixForIdentifier(VALID_PREFIX);
+        String rootPackage = getRootPackage((byte) 1, INVALID_NAME_SPACE1, getYangRevision(DATE1), conflictResolver);
+        assertThat(rootPackage.equals(UtilConstants.DEFAULT_BASE_PKG + UtilConstants.PERIOD + VERSION_NUMBER
+                                              + UtilConstants.PERIOD + VALID_NAME_SPACE1 + UtilConstants.PERIOD + DATE_WITH_REV1), is(true));
+        conflictResolver.setPrefixForIdentifier(null);
+        String rootPackage1 = getRootPackage((byte) 1, INVALID_NAME_SPACE2, getYangRevision(DATE1), conflictResolver);
+        assertThat(rootPackage1.equals(UtilConstants.DEFAULT_BASE_PKG + UtilConstants.PERIOD + VERSION_NUMBER
+                                               + UtilConstants.PERIOD + VALID_NAME_SPACE2 + UtilConstants.PERIOD + DATE_WITH_REV1), is(true));
+        String rootPackage2 = getRootPackage((byte) 1, INVALID_NAME_SPACE3, getYangRevision(DATE1), conflictResolver);
+        assertThat(rootPackage2.equals(UtilConstants.DEFAULT_BASE_PKG + UtilConstants.PERIOD + VERSION_NUMBER
+                                               + UtilConstants.PERIOD + VALID_NAME_SPACE4 + UtilConstants.PERIOD + DATE_WITH_REV1), is(true));
+        conflictResolver.setPrefixForIdentifier(INVALID_PREFIX1);
+        String rootPackage3 = getRootPackage((byte) 1, INVALID_NAME_SPACE2, getYangRevision(DATE1), conflictResolver);
+        assertThat(rootPackage3.equals(UtilConstants.DEFAULT_BASE_PKG + UtilConstants.PERIOD + VERSION_NUMBER
+                                               + UtilConstants.PERIOD + VALID_NAME_SPACE3 + UtilConstants.PERIOD + DATE_WITH_REV1), is(true));
+    }
+
+    /**
+     * Unit test for root package generation without complexity in revision.
+     */
+    @Test
+    public void getRootPackageWithRevTest()
+            throws ParseException {
+        Date date = simpleDateFormat.parse(DATE2);
+        String rootPkgWithRev = getRootPackage((byte) 1, CHILD_PACKAGE, getYangRevision(DATE2), null);
+        assertThat(rootPkgWithRev.equals(
+                UtilConstants.DEFAULT_BASE_PKG + UtilConstants.PERIOD + VERSION_NUMBER + UtilConstants.PERIOD + CHILD_WITH_PERIOD + UtilConstants.PERIOD + DATE_WITH_REV2),
+                   is(true));
+    }
+
+    /**
+     * Unit test for capitalizing the incoming string.
+     */
+    @Test
+    public void getCapitalCaseTest() {
+        String capitalCase = getCapitalCase(WITHOUT_CAPITAL);
+        assertThat(capitalCase.equals(WITH_CAPITAL), is(true));
+    }
+
+    /**
+     * Unit test for getting the camel case for the received string.
+     */
+    @Test
+    public void getCamelCaseTest() {
+        conflictResolver.setPrefixForIdentifier(null);
+        String camelCase = getCamelCase(WITHOUT_CAMEL_CASE, conflictResolver);
+        assertThat(camelCase.equals(WITH_CAMEL_CASE), is(true));
+        String camelCase1 = getCamelCase(WITHOUT_CAMEL_CASE1, conflictResolver);
+        assertThat(camelCase1.equals(WITH_CAMEL_CASE1), is(true));
+        String camelCase2 = getCamelCase(WITHOUT_CAMEL_CASE2, conflictResolver);
+        assertThat(camelCase2.equals(WITH_CAMEL_CASE2), is(true));
+        String camelCase3 = getCamelCase(WITHOUT_CAMEL_CASE3, conflictResolver);
+        assertThat(camelCase3.equals(WITH_CAMEL_CASE3), is(true));
+        String camelCase4 = getCamelCase(WITHOUT_CAMEL_CASE4, conflictResolver);
+        assertThat(camelCase4.equals(WITH_CAMEL_CASE4), is(true));
+        String camelCase5 = getCamelCase(WITHOUT_CAMEL_CASE5, conflictResolver);
+        assertThat(camelCase5.equals(WITH_CAMEL_CASE5), is(true));
+        String camelCase6 = getCamelCase(WITHOUT_CAMEL_CASE6, conflictResolver);
+        assertThat(camelCase6.equals(WITH_CAMEL_CASE6), is(true));
+        String camelCase7 = getCamelCase(WITHOUT_CAMEL_CASE7, conflictResolver);
+        assertThat(camelCase7.equals(WITH_CAMEL_CASE7), is(true));
+        String camelCase8 = getCamelCase(WITHOUT_CAMEL_CASE8, conflictResolver);
+        assertThat(camelCase8.equals(WITH_CAMEL_CASE8), is(true));
+        String camelCase9 = getCamelCase(WITHOUT_CAMEL_CASE9, conflictResolver);
+        assertThat(camelCase9.equals(WITH_CAMEL_CASE9), is(true));
+        String camelCase10 = getCamelCase(WITHOUT_CAMEL_CASE10, conflictResolver);
+        assertThat(camelCase10.equals(WITH_CAMEL_CASE10), is(true));
+        String camelCase11 = getCamelCase(WITHOUT_CAMEL_CASE11, conflictResolver);
+        assertThat(camelCase11.equals(WITH_CAMEL_CASE11), is(true));
+        String camelCase12 = getCamelCase(WITHOUT_CAMEL_CASE12, conflictResolver);
+        assertThat(camelCase12.equals(WITH_CAMEL_CASE12), is(true));
+        String camelCase13 = getCamelCase(WITHOUT_CAMEL_CASE13, conflictResolver);
+        assertThat(camelCase13.equals(WITH_CAMEL_CASE13), is(true));
+        String camelCase14 = getCamelCase(WITHOUT_CAMEL_CASE14, conflictResolver);
+        assertThat(camelCase14.equals(WITH_CAMEL_CASE14), is(true));
+    }
+
+    /**
+     * Unit test for getting the camel case along with the prefix provided.
+     */
+    @Test
+    public void getCamelCaseWithPrefixTest() {
+
+        conflictResolver.setPrefixForIdentifier(VALID_PREFIX);
+        String camelCase = getCamelCase(WITHOUT_CAMEL_CASE2, conflictResolver);
+        assertThat(camelCase.equals(WITH_CAMEL_CASE_WITH_PREFIX), is(true));
+        conflictResolver.setPrefixForIdentifier(INVALID_PREFIX1);
+        String camelCase2 = getCamelCase(WITHOUT_CAMEL_CASE3, conflictResolver);
+        assertThat(camelCase2.equals(WITH_CAMEL_CASE_WITH_PREFIX1), is(true));
+    }
+
+    /**
+     * Unit test for getting the camel case along with the invalid prefix provided.
+     */
+    @Test
+    public void getCamelCaseWithInvalidPrefixTest()
+            throws TranslatorException {
+
+        thrown.expect(ArrayIndexOutOfBoundsException.class);
+        thrown.expectMessage("The given prefix in pom.xml is invalid.");
+        conflictResolver.setPrefixForIdentifier(INVALID_PREFIX);
+        String camelCase = getCamelCase(WITHOUT_CAMEL_CASE3, conflictResolver);
+    }
+
+    /**
+     * Unit test for getting the camel case for the received string.
+     */
+    @Test
+    public void getSmallCaseTest() {
+        String smallCase = getSmallCase(WITHOUT_CAPITAL);
+        assertThat(smallCase.equals(WITH_SMALL), is(true));
+    }
+
+    /**
+     * Unit test for getting the camel case for the received string.
+     */
+    @Test
+    public void getPackageFromPathTest() {
+        String pkg = getJavaPackageFromPackagePath(PARENT_PACKAGE);
+        assertThat(pkg.equals(PARENT_WITH_PERIOD), is(true));
+    }
+
+    /**
+     * Unit test for getting the camel case for the received string.
+     */
+    @Test
+    public void getPathFromPackageTest() {
+        String path = getPackageDirPathFromJavaJPackage(PARENT_WITH_PERIOD);
+        assertThat(path.equals(PARENT_PACKAGE), is(true));
+    }
+
+
+    /**
+     * This test  case checks whether the package is existing.
+     *
+     * @throws IOException when failed to create a test file
+     */
+    @Test
+    public void packageExistTest()
+            throws IOException {
+
+        String strPath = BASE_DIR_PKG + DIR_PATH;
+        File createDir = new File(strPath.replace(UtilConstants.PERIOD, UtilConstants.SLASH));
+        createDir.mkdirs();
+        File createFile = new File(createDir + UtilConstants.SLASH + PKG_INFO);
+        createFile.createNewFile();
+        assertThat(true, Is.is(doesPackageExist(strPath)));
+        createDir.delete();
+        deleteDirectory(createDir);
+        deleteDirectory(new File(BASE_DIR_PKG.replace(UtilConstants.PERIOD, UtilConstants.SLASH)));
+    }
+
+    private YangRevision getYangRevision(String date) {
+        YangRevision revision = new YangRevision();
+        try {
+            revision.setRevDate(simpleDateFormat.parse(date));
+        } catch (ParseException e) {
+            e.printStackTrace();
+        }
+        return revision;
+    }
+}
diff --git a/compiler/base/translator/src/test/java/org/onosproject/yang/compiler/translator/tojava/utils/MethodsGeneratorTest.java b/compiler/base/translator/src/test/java/org/onosproject/yang/compiler/translator/tojava/utils/MethodsGeneratorTest.java
new file mode 100644
index 0000000..45fd00e
--- /dev/null
+++ b/compiler/base/translator/src/test/java/org/onosproject/yang/compiler/translator/tojava/utils/MethodsGeneratorTest.java
@@ -0,0 +1,326 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.translator.tojava.utils;
+
+import org.junit.Test;
+import org.onosproject.yang.compiler.datamodel.YangType;
+import org.onosproject.yang.compiler.translator.tojava.GeneratedJavaFileType;
+import org.onosproject.yang.compiler.translator.tojava.JavaAttributeInfo;
+import org.onosproject.yang.compiler.translator.tojava.JavaQualifiedTypeInfoTranslator;
+import org.onosproject.yang.compiler.utils.UtilConstants;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.hamcrest.core.Is.is;
+import static org.hamcrest.core.IsNot.not;
+import static org.junit.Assert.assertThat;
+import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes.STRING;
+
+/**
+ * Unit tests for generated methods from the file type.
+ */
+public final class MethodsGeneratorTest {
+
+    private static final String CLASS_NAME = "Testname";
+    private static final String ATTRIBUTE_NAME = "testname";
+    private static final String SET = "setValue.set(0);\n";
+    private static final String UNION = "    @Override\n" +
+            "    public String toString() {\n" +
+            "        if (setValue.get(0)) {\n" +
+            "            return string;\n" +
+            "        }\n" +
+            "        return null;\n" +
+            "    }";
+
+    /**
+     * Unit test for private constructor.
+     *
+     * @throws SecurityException         if any security violation is observed
+     * @throws NoSuchMethodException     if when the method is not found
+     * @throws IllegalArgumentException  if there is illegal argument found
+     * @throws InstantiationException    if instantiation is provoked for the private constructor
+     * @throws IllegalAccessException    if instance is provoked or a method is provoked
+     * @throws InvocationTargetException when an exception occurs by the method or constructor
+     */
+    @Test
+    public void callPrivateConstructors()
+            throws SecurityException, NoSuchMethodException, IllegalArgumentException,
+            InstantiationException, IllegalAccessException, InvocationTargetException {
+
+        Class<?>[] classesToConstruct = {MethodsGenerator.class};
+        for (Class<?> clazz : classesToConstruct) {
+            Constructor<?> constructor = clazz.getDeclaredConstructor();
+            constructor.setAccessible(true);
+            assertThat(null, not(constructor.newInstance()));
+        }
+    }
+
+    /**
+     * Unit test case for checking the parse builder and type constructor.
+     */
+    @Test
+    public void getTypeConstructorTest() {
+
+        JavaAttributeInfo testAttr = getTestAttribute();
+        String test = MethodsGenerator.getTypeConstructorStringAndJavaDoc(
+                testAttr, CLASS_NAME, GeneratedJavaFileType.GENERATE_TYPEDEF_CLASS, 0);
+        assertThat(true, is(test.contains(UtilConstants.PUBLIC + UtilConstants.SPACE + CLASS_NAME +
+                                                  UtilConstants.OPEN_PARENTHESIS)));
+    }
+
+    /**
+     * Unit test case for checking the parse builder and type constructor.
+     */
+    @Test
+    public void getTypeConstructorForUnionTest() {
+        JavaAttributeInfo testAttr = getTestAttribute();
+        String test = MethodsGenerator.getTypeConstructorStringAndJavaDoc(
+                testAttr, CLASS_NAME, GeneratedJavaFileType.GENERATE_UNION_CLASS, 0);
+        assertThat(true, is(test.contains(UtilConstants.PUBLIC + UtilConstants.SPACE + CLASS_NAME +
+                                                  UtilConstants.OPEN_PARENTHESIS)));
+        assertThat(true, is(test.contains(SET)));
+    }
+
+    /**
+     * Test for build method for class.
+     */
+    @Test
+    public void getBuildTest() {
+        String method = MethodsGenerator.getBuild(CLASS_NAME, false);
+        assertThat(true, is(method.equals(
+                UtilConstants.FOUR_SPACE_INDENTATION + UtilConstants.PUBLIC + UtilConstants.SPACE + CLASS_NAME + UtilConstants.SPACE +
+                        UtilConstants.BUILD + UtilConstants.OPEN_PARENTHESIS + UtilConstants.CLOSE_PARENTHESIS + UtilConstants.SPACE +
+                        UtilConstants.OPEN_CURLY_BRACKET + UtilConstants.NEW_LINE + UtilConstants.EIGHT_SPACE_INDENTATION +
+                        UtilConstants.RETURN + UtilConstants.SPACE + UtilConstants.NEW + UtilConstants.SPACE + UtilConstants.DEFAULT_CAPS + CLASS_NAME +
+                        UtilConstants.OPEN_PARENTHESIS + UtilConstants.THIS + UtilConstants.CLOSE_PARENTHESIS +
+                        UtilConstants.SEMI_COLON + UtilConstants.NEW_LINE + UtilConstants.FOUR_SPACE_INDENTATION +
+                        UtilConstants.CLOSE_CURLY_BRACKET + UtilConstants.NEW_LINE)));
+    }
+
+    /**
+     * Test for build method of interface.
+     */
+    @Test
+    public void getBuildForInterfaceTest() {
+        String method = MethodsGenerator.getBuildForInterface(CLASS_NAME);
+        assertThat(true, is(method.equals(
+                UtilConstants.FOUR_SPACE_INDENTATION + CLASS_NAME + UtilConstants.SPACE + UtilConstants.BUILD +
+                        UtilConstants.OPEN_PARENTHESIS + UtilConstants.CLOSE_PARENTHESIS + UtilConstants.SEMI_COLON +
+                        UtilConstants.NEW_LINE)));
+    }
+
+    /**
+     * Test for check not null method.
+     */
+    @Test
+    public void getCheckNotNullTest() {
+        String method = StringGenerator.getCheckNotNull(CLASS_NAME);
+        assertThat(true, is(method.equals(
+                UtilConstants.EIGHT_SPACE_INDENTATION + UtilConstants.CHECK_NOT_NULL_STRING +
+                        UtilConstants.OPEN_PARENTHESIS + CLASS_NAME + UtilConstants.COMMA + UtilConstants.SPACE +
+                        CLASS_NAME + UtilConstants.CLOSE_PARENTHESIS + UtilConstants.SEMI_COLON + UtilConstants.NEW_LINE)));
+    }
+
+    /**
+     * Test case for constructor.
+     */
+    @Test
+    public void getConstructorTest() {
+        JavaAttributeInfo testAttr = getTestAttribute();
+        String method = MethodsGenerator.getConstructor(testAttr, GeneratedJavaFileType.GENERATE_SERVICE_AND_MANAGER
+        );
+        assertThat(true, is(method.contains(
+                ATTRIBUTE_NAME + UtilConstants.SPACE + UtilConstants.EQUAL + UtilConstants.SPACE +
+                        UtilConstants.BUILDER_LOWER_CASE + UtilConstants.OBJECT + UtilConstants.PERIOD +
+                        UtilConstants.GET_METHOD_PREFIX + CLASS_NAME + UtilConstants.OPEN_PARENTHESIS +
+                        UtilConstants.CLOSE_PARENTHESIS + UtilConstants.SEMI_COLON)));
+    }
+
+    /**
+     * Test for constructor start method.
+     */
+    @Test
+    public void getConstructorStartTest() {
+        String method = MethodsGenerator.getConstructorStart(CLASS_NAME, false);
+        assertThat(true, is(method.contains(
+                UtilConstants.PROTECTED + UtilConstants.SPACE + UtilConstants.DEFAULT_CAPS + CLASS_NAME +
+                        UtilConstants.OPEN_PARENTHESIS + CLASS_NAME + UtilConstants.BUILDER + UtilConstants.SPACE +
+                        UtilConstants.BUILDER_LOWER_CASE + UtilConstants.OBJECT + UtilConstants.CLOSE_PARENTHESIS + UtilConstants.SPACE +
+                        UtilConstants.OPEN_CURLY_BRACKET)));
+    }
+
+    /**
+     * Test case for equals method.
+     */
+    @Test
+    public void getEqualsMethodTest() {
+        JavaAttributeInfo testAttr = getTestAttribute();
+        String method = MethodsGenerator.getEqualsMethod(testAttr);
+        assertThat(true, is(method.contains(
+                UtilConstants.SIXTEEN_SPACE_INDENTATION + UtilConstants.OBJECT_STRING + UtilConstants.SUFFIX_S +
+                        UtilConstants.PERIOD + UtilConstants.EQUALS_STRING + UtilConstants.OPEN_PARENTHESIS)));
+    }
+
+    /**
+     * Test for to string method.
+     */
+    @Test
+    public void getToStringMethodTest() {
+        JavaAttributeInfo testAttr = getTestAttribute();
+        String method = MethodsGenerator.getToStringMethod(testAttr);
+        assertThat(true, is(method.equals(
+                UtilConstants.TWELVE_SPACE_INDENTATION + UtilConstants.PERIOD + UtilConstants.ADD_STRING +
+                        UtilConstants.OPEN_PARENTHESIS + UtilConstants.QUOTES + testAttr.getAttributeName() +
+                        UtilConstants.QUOTES + UtilConstants.COMMA + UtilConstants.SPACE + testAttr.getAttributeName() +
+                        UtilConstants.CLOSE_PARENTHESIS)));
+    }
+
+    /**
+     * Test for to string method.
+     */
+    @Test
+    public void getToStringMethodForUnionTest() {
+        JavaAttributeInfo testAttr = getTestAttribute();
+        List<YangType<?>> types = new ArrayList<>();
+        types.add(testAttr.getAttributeType());
+        String method = MethodsGenerator.getUnionToStringMethod(types);
+        assertThat(true, is(method.contains(UNION)));
+    }
+
+    /**
+     * Test for getter method of class.
+     */
+    @Test
+    public void getGetterForClassTest() {
+        JavaAttributeInfo testAttr = getTestAttribute();
+        String method = MethodsGenerator.getGetterForClass(testAttr, GeneratedJavaFileType.GENERATE_SERVICE_AND_MANAGER);
+        assertThat(true, is(method.contains(UtilConstants.PUBLIC + UtilConstants.SPACE + UtilConstants.STRING_DATA_TYPE +
+                                                    UtilConstants.SPACE + UtilConstants.GET_METHOD_PREFIX)));
+    }
+
+    /**
+     * Test for getter of interface.
+     */
+    @Test
+    public void getGetterForInterfaceTest() {
+        String method = MethodsGenerator.getGetterForInterface(CLASS_NAME, UtilConstants.STRING_DATA_TYPE, false,
+                                                               GeneratedJavaFileType.GENERATE_SERVICE_AND_MANAGER, null);
+        assertThat(true, is(method.contains(UtilConstants.STRING_DATA_TYPE + UtilConstants.SPACE +
+                                                    UtilConstants.GET_METHOD_PREFIX)));
+    }
+
+    /**
+     * Test case for setter method of class.
+     */
+    @Test
+    public void getSetterForClassTest() {
+        JavaAttributeInfo testAttr = getTestAttribute();
+        String method = MethodsGenerator.getSetterForClass(testAttr, CLASS_NAME,
+                                                           GeneratedJavaFileType.GENERATE_SERVICE_AND_MANAGER);
+        assertThat(true, is(
+                method.contains(UtilConstants.PUBLIC + UtilConstants.SPACE + UtilConstants.VOID + UtilConstants.SPACE + UtilConstants.SET_METHOD_PREFIX +
+                                        CLASS_NAME + UtilConstants.OPEN_PARENTHESIS +
+                                        UtilConstants.STRING_DATA_TYPE + UtilConstants.SPACE +
+                                        ATTRIBUTE_NAME)));
+    }
+
+    /**
+     * Test for setter method of interface.
+     */
+    @Test
+    public void getSetterForInterfaceTest() {
+        String method = MethodsGenerator.getSetterForInterface(CLASS_NAME, UtilConstants.STRING_DATA_TYPE,
+                                                               CLASS_NAME, false,
+                                                               GeneratedJavaFileType.GENERATE_SERVICE_AND_MANAGER, null);
+        assertThat(true, is(method.contains(UtilConstants.VOID + UtilConstants.SPACE + UtilConstants.SET_METHOD_PREFIX +
+                                                    CLASS_NAME)));
+    }
+
+    /**
+     * Test case for of method.
+     */
+    @Test
+    public void getOfMethodTest() {
+        JavaAttributeInfo testAttr = getTestAttribute();
+        String method = MethodsGenerator.getOfMethodStringAndJavaDoc(testAttr, CLASS_NAME);
+        assertThat(true, is(method.contains(
+                UtilConstants.PUBLIC + UtilConstants.SPACE + UtilConstants.STATIC + UtilConstants.SPACE + CLASS_NAME + UtilConstants.SPACE + UtilConstants.OF +
+                        UtilConstants.OPEN_PARENTHESIS + UtilConstants.STRING_DATA_TYPE + UtilConstants.SPACE + UtilConstants.VALUE +
+                        UtilConstants.CLOSE_PARENTHESIS)));
+    }
+
+    /**
+     * Test case for setter in type def class.
+     */
+    @Test
+    public void getSetterForTypeDefClassTest() {
+        JavaAttributeInfo testAttr = getTestAttribute();
+        String method = MethodsGenerator.getSetterForTypeDefClass(testAttr);
+        assertThat(true, is(method.contains(UtilConstants.PUBLIC + UtilConstants.SPACE + UtilConstants.VOID + UtilConstants.SPACE +
+                                                    UtilConstants.SET_METHOD_PREFIX)));
+    }
+
+    /**
+     * Test case for over ride string.
+     */
+    @Test
+    public void getOverRideStringTest() {
+        String method = StringGenerator.getOverRideString();
+        assertThat(true, is(method.contains(UtilConstants.OVERRIDE)));
+    }
+
+    /**
+     * Returns java attribute.
+     *
+     * @return java attribute
+     */
+    private JavaAttributeInfo getTestAttribute() {
+        JavaAttributeInfo testAttr = new JavaAttributeInfo(
+                getTestYangType(), ATTRIBUTE_NAME, false, false);
+        testAttr.setAttributeName(ATTRIBUTE_NAME);
+        testAttr.setAttributeType(getTestYangType());
+        testAttr.setImportInfo(getTestJavaQualifiedTypeInfo());
+        return testAttr;
+    }
+
+    /**
+     * Returns java qualified info.
+     *
+     * @return java qualified info
+     */
+    private JavaQualifiedTypeInfoTranslator getTestJavaQualifiedTypeInfo() {
+        JavaQualifiedTypeInfoTranslator info = new JavaQualifiedTypeInfoTranslator();
+        info.setPkgInfo(UtilConstants.JAVA_LANG);
+        info.setClassInfo(UtilConstants.STRING_DATA_TYPE);
+        return info;
+    }
+
+    /**
+     * Returns stub YANG type.
+     *
+     * @return test YANG type
+     */
+    private YangType<?> getTestYangType() {
+        YangType<?> attrType = new YangType<>();
+        attrType.setDataTypeName(UtilConstants.STRING_DATA_TYPE);
+        attrType.setDataType(STRING);
+        return attrType;
+    }
+}
diff --git a/compiler/base/utils/pom.xml b/compiler/base/utils/pom.xml
new file mode 100644
index 0000000..7d67558
--- /dev/null
+++ b/compiler/base/utils/pom.xml
@@ -0,0 +1,59 @@
+<!--
+  ~ 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-yang-compiler-base</artifactId>
+        <version>1.12-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>onos-yang-compiler-utils</artifactId>
+    <packaging>jar</packaging>
+
+    <dependencies>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>4.8.2</version>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-jar-plugin</artifactId>
+                <version>3.0.2</version>
+                <configuration>
+                    <skipIfEmpty>true</skipIfEmpty>
+                </configuration>
+                <executions>
+                    <execution>
+                        <id>default</id>
+                        <goals>
+                            <goal>test-jar</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+</project>
diff --git a/compiler/base/utils/src/main/java/org/onosproject/yang/compiler/utils/UtilConstants.java b/compiler/base/utils/src/main/java/org/onosproject/yang/compiler/utils/UtilConstants.java
new file mode 100644
index 0000000..05073fc
--- /dev/null
+++ b/compiler/base/utils/src/main/java/org/onosproject/yang/compiler/utils/UtilConstants.java
@@ -0,0 +1,1941 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.utils;
+
+import java.io.File;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * Represents utilities constants which are used while generating java files.
+ */
+public final class UtilConstants {
+
+    /**
+     * JavaDocs for impl class.
+     */
+    public static final String IMPL_CLASS_JAVA_DOC =
+            " * Represents the implementation of ";
+
+    /**
+     * JavaDocs for builder class.
+     */
+    public static final String BUILDER_CLASS_JAVA_DOC =
+            " * Represents the builder implementation of ";
+
+    /**
+     * JavaDocs for interface class.
+     */
+    public static final String INTERFACE_JAVA_DOC =
+            " * Abstraction of an entity which represents the functionality " +
+                    "of ";
+
+    /**
+     * JavaDocs for event.
+     */
+    public static final String EVENT_JAVA_DOC =
+            " * Represents event implementation of ";
+
+    /**
+     * JavaDocs for op param class.
+     */
+    public static final String OP_PARAM_JAVA_DOC =
+            " * Represents operation parameter implementation of ";
+
+    /**
+     * JavaDocs for event listener.
+     */
+    public static final String EVENT_LISTENER_JAVA_DOC =
+            " * Abstraction for event listener of ";
+
+    /**
+     * JavaDocs for builder interface class.
+     */
+    public static final String BUILDER_INTERFACE_JAVA_DOC = " * Builder for ";
+
+    /**
+     * JavaDocs for enum class.
+     */
+    public static final String ENUM_CLASS_JAVADOC =
+            " * Represents ENUM data of ";
+
+    /**
+     * JavaDocs for enum attribute.
+     */
+    public static final String ENUM_ATTRIBUTE_JAVADOC = " * Represents ";
+
+    /**
+     * JavaDocs for package info class.
+     */
+    public static final String PACKAGE_INFO_JAVADOC =
+            " * Implementation of YANG node ";
+
+    /**
+     * JavaDocs for package info class.
+     */
+    public static final String PACKAGE_INFO_JAVADOC_OF_CHILD =
+            "'s children nodes";
+
+    /**
+     * JavaDocs's first line.
+     */
+    public static final String JAVA_DOC_FIRST_LINE = "/**\n";
+
+    /**
+     * JavaDocs's last line.
+     */
+    public static final String JAVA_DOC_END_LINE = " */\n";
+
+    /**
+     * JavaDocs's param annotation.
+     */
+    public static final String JAVA_DOC_PARAM = " * @param ";
+
+    /**
+     * JavaDocs's return annotation.
+     */
+    public static final String JAVA_DOC_RETURN = " * @return ";
+
+    /**
+     * JavaDocs's description for setter method.
+     */
+    public static final String JAVA_DOC_SETTERS =
+            " * Returns the builder object of ";
+
+    /**
+     * JavaDocs's description for add to list method.
+     */
+    public static final String JAVA_DOC_ADD_TO_LIST = " * Adds to the list of ";
+
+    /**
+     * JavaDocs's description for setter method.
+     */
+    public static final String JAVA_DOC_MANAGER_SETTERS =
+            " * Sets the value to attribute ";
+
+    /**
+     * JavaDocs's description for OF method.
+     */
+    public static final String JAVA_DOC_OF = " * Returns the object of ";
+
+    /**
+     * JavaDocs's description for typedef' setter method.
+     */
+    public static final String JAVA_DOC_SETTERS_COMMON =
+            " * Sets the value of ";
+
+    /**
+     * JavaDocs's description for getter method.
+     */
+    public static final String JAVA_DOC_GETTERS = " * Returns the attribute ";
+
+    /**
+     * JavaDocs's description for getter method.
+     */
+    public static final String JAVA_DOC_FOR_VALIDATOR =
+            " * Validates if value is in given range.";
+
+    /**
+     * JavaDocs's description for getter method.
+     */
+    public static final String JAVA_DOC_FOR_VALIDATOR_RETURN =
+            " true if value is in range";
+
+    /**
+     * JavaDocs's description for constructor.
+     */
+    public static final String JAVA_DOC_CONSTRUCTOR =
+            " * Creates an instance of ";
+
+    /**
+     * JavaDocs's description for build method.
+     */
+    public static final String JAVA_DOC_BUILD = " * Builds object of ";
+
+    /**
+     * JavaDocs's statement for builder object.
+     */
+    public static final String BUILDER_OBJECT = "builder object of ";
+
+    /**
+     * JavaDocs's statement for rpc method.
+     */
+    public static final String JAVA_DOC_RPC = " * Service interface of ";
+
+    /**
+     * JavaDocs's statement for rpc's input string.
+     */
+    public static final String RPC_INPUT_STRING = "input of service interface ";
+
+    /**
+     * JavaDocs's statement for rpc's output string.
+     */
+    public static final String RPC_OUTPUT_STRING =
+            "output of service interface ";
+
+    /**
+     * Static attribute for new line.
+     */
+    public static final String NEW_LINE = "\n";
+
+    /**
+     * Static attribute for default.
+     */
+    public static final String DEFAULT = "default";
+
+    /**
+     * Static attribute for default.
+     */
+    public static final String DEFAULT_CAPS = "Default";
+
+    /**
+     * Static attribute for java code generation for sbi.
+     */
+    public static final String SBI = "sbi";
+
+    /**
+     * Static attribute for multiple new line.
+     */
+    public static final String MULTIPLE_NEW_LINE = "\n\n";
+
+    /**
+     * Static attribute for empty line.
+     */
+    public static final String EMPTY_STRING = "";
+
+    /**
+     * Static attribute for new line with asterisk.
+     */
+    public static final String NEW_LINE_ASTERISK = " *\n";
+
+    /**
+     * Static attribute for period.
+     */
+    public static final String PERIOD = ".";
+
+    /**
+     * Static attribute for lib.
+     */
+    public static final String LIB = "lib__";
+
+    /**
+     * Static attribute for lib path.
+     */
+    public static final String LIB_PATH = "//lib:";
+
+    /**
+     * Static attribute for output.
+     */
+    public static final String OUT = "__output";
+
+    /**
+     * Static attribute for period.
+     */
+    public static final String ENTRY = "Entry";
+
+    /**
+     * Static attribute for period.
+     */
+    public static final String ENTRY_SET = "entrySet()";
+
+    /**
+     * Static attribute for compare to.
+     */
+    public static final String COMPARE_TO = "compareTo";
+
+    /**
+     * Static attribute for parse byte.
+     */
+    public static final String PARSE_BYTE = "parseByte";
+
+    /**
+     * Static attribute for parse boolean.
+     */
+    public static final String PARSE_BOOLEAN = "parseBoolean";
+
+    /**
+     * Static attribute for parse short.
+     */
+    public static final String PARSE_SHORT = "parseShort";
+
+    /**
+     * Static attribute for parse int.
+     */
+    public static final String PARSE_INT = "parseInt";
+
+    /**
+     * Static attribute for parse long.
+     */
+    public static final String PARSE_LONG = "parseLong";
+
+    /**
+     * Static attribute for base64.
+     */
+    public static final String BASE64 = "Base64";
+
+    /**
+     * Static attribute for getEncoder.
+     */
+    public static final String GET_ENCODER = "getEncoder";
+
+    /**
+     * Static attribute for encodeToString.
+     */
+    public static final String ENCODE_TO_STRING = "encodeToString";
+
+    /**
+     * Static attribute for getDecoder.
+     */
+    public static final String GET_DECODER = "getDecoder";
+
+    /**
+     * Static attribute for decode.
+     */
+    public static final String DECODE = "decode";
+
+    /**
+     * Static attribute for omit null value.
+     */
+    public static final String OMIT_NULL_VALUE_STRING = "omitNullValues()";
+
+    /**
+     * Static attribute for underscore.
+     */
+    public static final String UNDER_SCORE = "_";
+
+    /**
+     * Static attribute for semi-colan.
+     */
+    public static final String SEMI_COLON = ";";
+
+    /**
+     * Static attribute for hyphen.
+     */
+    public static final String HYPHEN = "-";
+
+    /**
+     * Static attribute for space.
+     */
+    public static final String SPACE = " ";
+    /**
+     * Static attribute for space.
+     */
+    public static final String TWO = "2";
+    /**
+     * Static attribute for space.
+     */
+    public static final String FLAG = "flag";
+    /**
+     * Static attribute for result.
+     */
+    public static final String RESULT = "result";
+
+    /**
+     * Static attribute for isSelectAllSchemaChild.
+     */
+    public static final String SELECT_ALL_CHILD = "isSelectAllSchemaChild";
+
+    /**
+     * Static attribute for schema name.
+     */
+    public static final String SCHEMA_NAME = "schemaName";
+
+    /**
+     * Static attribute for validateRange.
+     */
+    public static final String VALIDATE_RANGE = "validateRange";
+
+    /**
+     * Static attribute for minRange.
+     */
+    public static final String MIN_RANGE = "minRange";
+
+    /**
+     * Static attribute for maxRange.
+     */
+    public static final String MAX_RANGE = "maxRange";
+
+    /**
+     * Static attribute for minRange.
+     */
+    public static final String SHORT_MIN_RANGE_ATTR =
+            "static final int INT16_MIN_RANGE = -32768;\n";
+
+    /**
+     * Static attribute for minRange.
+     */
+    public static final String SHORT_MIN_RANGE = "INT16_MIN_RANGE";
+
+    /**
+     * Static attribute for minRange.
+     */
+    public static final String SHORT_MAX_RANGE = "INT16_MAX_RANGE";
+
+    /**
+     * Static attribute for maxRange.
+     */
+    public static final String SHORT_MAX_RANGE_ATTR =
+            "static final int INT16_MAX_RANGE = 32767;";
+
+
+    /**
+     * Static attribute for minRange.
+     */
+    public static final String UINT8_MIN_RANGE_ATTR =
+            "static final int UINT8_MIN_RANGE = 0;\n";
+
+    /**
+     * Static attribute for maxRange.
+     */
+    public static final String UINT8_MAX_RANGE_ATTR =
+            "static final int UINT8_MAX_RANGE = 32767;";
+
+
+    /**
+     * Static attribute for minRange.
+     */
+    public static final String UINT8_MIN_RANGE = "UINT8_MIN_RANGE";
+
+    /**
+     * Static attribute for maxRange.
+     */
+    public static final String UINT8_MAX_RANGE = "UINT8_MAX_RANGE";
+
+    /**
+     * Static attribute for minRange.
+     */
+    public static final String INT_MIN_RANGE_ATTR =
+            "static final int INT32_MIN_RANGE = -2147483648;\n";
+
+    /**
+     * Static attribute for minRange.
+     */
+    public static final String INT_MIN_RANGE = "INT32_MIN_RANGE";
+
+    /**
+     * Static attribute for minRange.
+     */
+    public static final String INT_MAX_RANGE = "INT32_MAX_RANGE";
+
+    /**
+     * Static attribute for maxRange.
+     */
+    public static final String INT_MAX_RANGE_ATTR =
+            "static final int INT32_MAX_RANGE = 2147483647;";
+
+
+    /**
+     * Static attribute for minRange.
+     */
+    public static final String UINT_MIN_RANGE_ATTR =
+            "static final int UINT16_MIN_RANGE = 0;\n";
+
+    /**
+     * Static attribute for maxRange.
+     */
+    public static final String UINT_MAX_RANGE_ATTR =
+            "static final int UINT16_MAX_RANGE = 2147483647;";
+
+
+    /**
+     * Static attribute for minRange.
+     */
+    public static final String UINT_MIN_RANGE = "UINT16_MIN_RANGE";
+
+    /**
+     * Static attribute for maxRange.
+     */
+    public static final String UINT_MAX_RANGE = "UINT16_MAX_RANGE";
+
+    /**
+     * Static attribute for minRange.
+     */
+    public static final String LONG_MIN_RANGE_ATTR =
+            "static final BigInteger INT64_MIN_RANGE =" +
+                    " new BigInteger(\"-9223372036854775808\");\n";
+
+    /**
+     * Static attribute for maxRange.
+     */
+    public static final String LONG_MAX_RANGE_ATTR =
+            "static final BigInteger INT64_MAX_RANGE =" +
+                    " new BigInteger(\"9223372036854775807\");";
+
+    /**
+     * Static attribute for minRange.
+     */
+    public static final String LONG_MIN_RANGE = "INT64_MIN_RANGE";
+
+    /**
+     * Static attribute for maxRange.
+     */
+    public static final String LONG_MAX_RANGE = "INT64_MAX_RANGE";
+
+    /**
+     * Static attribute for minRange.
+     */
+    public static final String ULONG_MIN_RANGE_ATTR =
+            "static final BigInteger UINT32_MIN_RANGE =" +
+                    " new BigInteger(\"0\");\n";
+
+    /**
+     * Static attribute for maxRange.
+     */
+    public static final String ULONG_MAX_RANGE_ATTR =
+            "static final BigInteger UINT32_MAX_RANGE =" +
+                    " new BigInteger(\"9223372036854775807\");";
+
+
+    /**
+     * Static attribute for minRange.
+     */
+    public static final String ULONG_MIN_RANGE = "UINT32_MIN_RANGE";
+
+    /**
+     * Static attribute for maxRange.
+     */
+    public static final String ULONG_MAX_RANGE = "UINT32_MAX_RANGE";
+
+    /**
+     * Static attribute for subject.
+     */
+    public static final String SUBJECT = "Subject";
+
+    /**
+     * Static attribute for ListenerService.
+     */
+    public static final String LISTENER_SERVICE = "ListenerService";
+
+    /**
+     * Static attribute for listener package.
+     */
+    public static final String ONOS_EVENT_PKG = "org.onosproject.event";
+
+    /**
+     * Static attribute for colon.
+     */
+    public static final String COLON = ":";
+
+    /**
+     * Static attribute for caret.
+     */
+    public static final String CARET = "^";
+
+    /**
+     * Static attribute for input string.
+     */
+    public static final String INPUT = "input";
+
+    /**
+     * Static attribute for output string.
+     */
+    public static final String OUTPUT = "output";
+
+    /**
+     * Static attribute for current string.
+     */
+    public static final String CURRENT = "current";
+
+    /**
+     * Static attribute for leafref string.
+     */
+    public static final String LEAFREF = "leafref";
+
+    /**
+     * Static attribute for output variable of rpc.
+     */
+    public static final String RPC_INPUT_VAR_NAME = "inputVar";
+
+    /**
+     * Static attribute for new line.
+     */
+    public static final String EQUAL = "=";
+
+    /**
+     * Static attribute for slash syntax.
+     */
+    public static final String SLASH = File.separator;
+
+    /**
+     * Static attribute for add syntax.
+     */
+    public static final String ADD = "+";
+
+    /**
+     * Static attribute for quotes.
+     */
+    public static final String QUOTES = "\"";
+
+    /**
+     * Static attribute for zero.
+     */
+    public static final String ZERO = "0";
+
+    /**
+     * Static attribute for ampersand.
+     */
+    public static final String AND = "&";
+
+    /**
+     * Static attribute for comma.
+     */
+    public static final String COMMA = ",";
+
+    /**
+     * Static attribute for class.
+     */
+    public static final String CLASS_STRING = "Class";
+
+    /**
+     * Static attribute for put.
+     */
+    public static final String PUT = "put";
+
+    /**
+     * Static attribute for get.
+     */
+    public static final String GET = "get";
+
+    /**
+     * Static attribute for slash character.
+     */
+    public static final char CHAR_OF_SLASH = '/';
+
+    /**
+     * Static attribute for open square bracket character.
+     */
+    public static final char CHAR_OF_OPEN_SQUARE_BRACKET = '[';
+
+    /**
+     * Static attribute for slash string.
+     */
+    public static final String SLASH_FOR_STRING = "/";
+
+    /**
+     * Static attribute for open square bracket.
+     */
+    public static final String OPEN_SQUARE_BRACKET = "[";
+
+    /**
+     * Static attribute for ancestor accessor.
+     */
+    public static final String ANCESTOR = "..";
+
+    /**
+     * Static attribute for ancestor accessor along with path.
+     */
+    public static final String SLASH_ANCESTOR = "../";
+
+    /**
+     * Static attribute for add syntax.
+     */
+    public static final String ADD_STRING = "add";
+
+    /**
+     * Static attribute for key syntax.
+     */
+    public static final String KEYS = "Keys";
+
+    /**
+     * Static attribute for key syntax.
+     */
+    public static final String GET_KEY = "getKey()";
+
+    /**
+     * Static attribute for key syntax.
+     */
+    public static final String GET_VALUE = "getValue()";
+
+    /**
+     * Static attribute for -1 to syntax.
+     */
+    public static final String NEG_ONE = "-1";
+
+    /**
+     * Static attribute for Comparable to syntax.
+     */
+    public static final String COMPARABLE = "Comparable";
+
+    /**
+     * Static attribute for string trim syntax.
+     */
+    public static final String TRIM_STRING = "trim";
+
+    /**
+     * Static attribute for string split syntax.
+     */
+    public static final String SPLIT_STRING = "split";
+
+    /**
+     * Static attribute for Pattern.
+     */
+    public static final String PATTERN = "Pattern";
+
+    /**
+     * Static attribute for Quote.
+     */
+    public static final String QUOTE_STRING = "quote";
+
+    /**
+     * Static attribute for from syntax.
+     */
+    public static final String FROM_STRING_METHOD_NAME = "fromString";
+
+    /**
+     * Static attribute for check not null syntax.
+     */
+    public static final String CHECK_NOT_NULL_STRING = "checkNotNull";
+
+    /**
+     * Static attribute for hash code syntax.
+     */
+    public static final String HASH_CODE_STRING = "hashCode";
+
+    /**
+     * Static attribute for equals syntax.
+     */
+    public static final String EQUALS_STRING = "equals";
+
+    /**
+     * Static attribute for object.
+     */
+    public static final String OBJECT_STRING = "Object";
+
+    /**
+     * Static attribute for instance of syntax.
+     */
+    public static final String INSTANCE_OF = " instanceof ";
+
+    /**
+     * Static attribute for value syntax.
+     */
+    public static final String VALUE = "value";
+
+    /**
+     * Static attribute for value syntax.
+     */
+    public static final String VALUE_CAPS = "Value";
+
+    /**
+     * Static attribute for suffix s.
+     */
+    public static final String SUFFIX_S = "s";
+
+    /**
+     * Static attribute for string builder var.
+     */
+    public static final String STRING_BUILDER_VAR = "sBuild";
+    /**
+     * Static attribute for string builder var.
+     */
+    public static final String APPEND = "append";
+
+    /**
+     * Static attribute for if.
+     */
+    public static final String IF = "if";
+
+    /**
+     * Static attribute for of.
+     */
+    public static final String OF = "of";
+    /**
+     * Static attribute for of.
+     */
+    public static final String OF_CAPS = "Of";
+
+    /**
+     * Static attribute for other.
+     */
+    public static final String OTHER = "other";
+
+    /**
+     * Static attribute for obj syntax.
+     */
+    public static final String OBJ = "obj";
+
+    /**
+     * Static attribute for hash syntax.
+     */
+    public static final String HASH = "hash";
+
+    /**
+     * Static attribute for to syntax.
+     */
+    public static final String TO = "to";
+
+    /**
+     * Static attribute for to syntax.
+     */
+    public static final String TO_CAPS = "To";
+
+    /**
+     * Static attribute for true syntax.
+     */
+    public static final String TRUE = "true";
+
+    /**
+     * Static attribute for false syntax.
+     */
+    public static final String FALSE = "false";
+
+    /**
+     * Static attribute for org.
+     */
+    public static final String ORG = "org";
+
+    /**
+     * Static attribute for temp.
+     */
+    public static final String TEMP = "Temp";
+
+    /**
+     * Static attribute for YANG file directory.
+     */
+    public static final String YANG_RESOURCES = "yang/resources";
+
+    /**
+     * Static attribute for diamond close bracket syntax.
+     */
+    public static final String DIAMOND_OPEN_BRACKET = "<";
+
+    /**
+     * Static attribute for diamond close bracket syntax.
+     */
+    public static final String DIAMOND_CLOSE_BRACKET = ">";
+
+    /**
+     * Static attribute for event type.
+     */
+    public static final String EVENT_TYPE = ".Type";
+
+    /**
+     * Static attribute for exception syntax.
+     */
+    public static final String EXCEPTION = "Exception";
+
+    /**
+     * Static attribute for exception variable syntax.
+     */
+    public static final String EXCEPTION_VAR = "e";
+
+    /**
+     * Static attribute for open parenthesis syntax.
+     */
+    public static final String OPEN_PARENTHESIS = "(";
+
+    /**
+     * Static attribute for switch syntax.
+     */
+    public static final String SWITCH = "switch";
+
+    /**
+     * Static attribute for case syntax.
+     */
+    public static final String CASE = "case";
+
+    /**
+     * Static attribute for temp val syntax.
+     */
+    public static final String TMP_VAL = "tmpVal";
+
+    /**
+     * Static attribute for close curly bracket syntax.
+     */
+    public static final String ELSE = " else ";
+
+    /**
+     * From string parameter name.
+     */
+    public static final String FROM_STRING_PARAM_NAME = "valInString";
+
+    /**
+     * Static attribute for close parenthesis syntax.
+     */
+    public static final String CLOSE_PARENTHESIS = ")";
+
+    /**
+     * Static attribute for empty parameter function call.
+     */
+    public static final String OPEN_CLOSE_BRACKET_STRING = "()";
+
+    /**
+     * Static attribute for empty parameter function call.
+     */
+    public static final String OPEN_CLOSE_DIAMOND_STRING = "<>";
+
+    /**
+     * Static attribute for open curly bracket syntax.
+     */
+    public static final String OPEN_CURLY_BRACKET = "{";
+
+    /**
+     * Static attribute for close curly bracket syntax.
+     */
+    public static final String CLOSE_CURLY_BRACKET = "}";
+
+    /**
+     * Static attribute for square brackets syntax.
+     */
+    public static final String SQUARE_BRACKETS = "[]";
+
+    /**
+     * Static attribute for getter method prefix.
+     */
+    public static final String GET_METHOD_PREFIX = "get";
+
+    /**
+     * Static attribute for setter method prefix.
+     */
+    public static final String SET_METHOD_PREFIX = "set";
+
+    /**
+     * Static attribute for op param.
+     */
+    public static final String OP_PARAM = "OpParam";
+
+
+    /**
+     * Static attribute for is filter content match method prefix.
+     */
+    public static final String PROCESS_SUBTREE_FILTERING =
+            "processSubtreeFiltering";
+
+    /**
+     * variable name of the subtree  filtering result builder.
+     */
+    public static final String SUBTREE_FILTERING_RESULT_BUILDER =
+            "subTreeFilteringResultBuilder";
+
+    /**
+     * variable name of the subtree  filtering result flag.
+     */
+    public static final String IS_ANY_SELECT_OR_CONTAINMENT_NODE_FLAG =
+            "isAnySelectOrContainmentNode";
+
+    /**
+     * variable name of the subtree  filtering to select all child.
+     */
+    public static final String IS_SELECT_ALL_SCHEMA_CHILD_FLAG =
+            "isSelectAllSchemaChild";
+
+    /**
+     * Static attribute for break prefix.
+     */
+    public static final String BREAK = "break";
+
+    /**
+     * Static attribute for isEmpty.
+     */
+    public static final String IS_EMPTY = "isEmpty()";
+    /**
+     * Static attribute for exception string in bits enum class.
+     */
+    public static final String EXCEPTION_STRING = "IllegalArgumentException" +
+            "(\"not a valid input element\");\n";
+
+    /**
+     * Static attribute for priority queue.
+     */
+    public static final String PRIORITY_QUEUE = "java.util.PriorityQueue<>()";
+
+    /**
+     * Static attribute for linked hash set.
+     */
+    public static final String LINKED_HASH_SET = "java.util.LinkedHashSet<>()";
+
+    /**
+     * Static attribute for priority queue.
+     */
+    public static final String LINKED_HASH_MAP = "java.util.LinkedHashMap<>()";
+
+    /**
+     * Static attribute for "throw new ".
+     */
+    public static final String THROW_NEW = "throw new ";
+
+    /**
+     * Static attribute for is isLeafValueSet method prefix.
+     */
+    public static final String VALUE_LEAF_SET = "isLeafValueSet";
+
+    /**
+     * Static attribute for is valueLeafFlags method prefix.
+     */
+    public static final String VALUE_LEAF = "valueLeafFlags";
+
+    /**
+     * Static attribute for is selectLeafFlags method prefix.
+     */
+    public static final String SELECT_LEAF = "selectLeafFlags";
+
+    /**
+     * Static attribute for is isSelectLeaf method prefix.
+     */
+    public static final String IS_SELECT_LEAF = "isSelectLeaf";
+
+    /**
+     * Static attribute for is selectLeaf method prefix.
+     */
+    public static final String SET_SELECT_LEAF = "selectLeaf";
+
+    /**
+     * Static attribute for is LeafIdentifier enum prefix.
+     */
+    public static final String LEAF_IDENTIFIER = "LeafIdentifier";
+    /**
+     * Static attribute for is leaf.
+     */
+    public static final String LEAF = "leaf";
+
+    /**
+     * Static attribute for four space indentation.
+     */
+    public static final String FOUR_SPACE_INDENTATION = "    ";
+
+    /**
+     * Static attribute for not syntax.
+     */
+    public static final String NOT = "!";
+
+    /**
+     * Static attribute for try syntax.
+     */
+    public static final String TRY = "try";
+
+    /**
+     * Static attribute for catch syntax.
+     */
+    public static final String CATCH = "catch";
+
+    /**
+     * Static attribute for eight space indentation.
+     */
+    public static final String EIGHT_SPACE_INDENTATION =
+            FOUR_SPACE_INDENTATION + FOUR_SPACE_INDENTATION;
+
+    /**
+     * Static attribute for twelve space indentation.
+     */
+    public static final String TWELVE_SPACE_INDENTATION =
+            EIGHT_SPACE_INDENTATION + FOUR_SPACE_INDENTATION;
+
+    /**
+     * Static attribute for sixteen space indentation.
+     */
+    public static final String SIXTEEN_SPACE_INDENTATION =
+            TWELVE_SPACE_INDENTATION + FOUR_SPACE_INDENTATION;
+
+    /**
+     * Static attribute for twenty space indentation.
+     */
+    public static final String TWENTY_SPACE_INDENTATION =
+            SIXTEEN_SPACE_INDENTATION + FOUR_SPACE_INDENTATION;
+
+    /**
+     * Static attribute for twenty four space indentation.
+     */
+    public static final String TWENTY_FOUR_SPACE_INDENTATION =
+            TWENTY_SPACE_INDENTATION + FOUR_SPACE_INDENTATION;
+
+    /**
+     * Static attribute for twenty eight space indentation.
+     */
+    public static final String TWENTY_EIGHT_SPACE_INDENTATION =
+            TWENTY_FOUR_SPACE_INDENTATION + FOUR_SPACE_INDENTATION;
+
+    /**
+     * Static attribute for thirty two space indentation.
+     */
+    public static final String THIRTY_TWO_SPACE_INDENTATION =
+            TWENTY_EIGHT_SPACE_INDENTATION + FOUR_SPACE_INDENTATION;
+
+    /**
+     * Static attribute for generated code path.
+     */
+    public static final String YANG_GEN_DIR = "src/main/java/";
+
+    /**
+     * Static attribute for base package.
+     */
+    public static final String DEFAULT_BASE_PKG = "org.onosproject.yang.gen";
+
+    /**
+     * Static attribute for YANG date prefix.
+     */
+    public static final String REVISION_PREFIX = "rev";
+
+    /**
+     * Static attribute for YANG automatic prefix for identifiers with keywords
+     * and beginning with digits.
+     */
+    public static final String YANG_AUTO_PREFIX = "yangAutoPrefix";
+
+    /**
+     * Static attribute for YANG version prefix.
+     */
+    public static final String VERSION_PREFIX = "v";
+
+    /**
+     * Static attribute for private modifier.
+     */
+    public static final String PRIVATE = "private";
+
+    /**
+     * Static attribute for public modifier.
+     */
+    public static final String PUBLIC = "public";
+
+    /**
+     * Static attribute for abstract modifier.
+     */
+    public static final String ABSTRACT = "abstract";
+
+    /**
+     * Static attribute for protected modifier.
+     */
+    public static final String PROTECTED = "protected";
+
+    /**
+     * Void java type.
+     */
+    public static final String VOID = "void";
+
+    /**
+     * String built in java type.
+     */
+    public static final String STRING_DATA_TYPE = "String";
+
+    /**
+     * String built in java type.
+     */
+    public static final String STRING_BUILDER = "StringBuilder";
+    /**
+     * Java.lang.* packages.
+     */
+    public static final String JAVA_LANG = "java.lang";
+
+    /**
+     * Java.math.* packages.
+     */
+    public static final String JAVA_MATH = "java.math";
+
+    /**
+     * Boolean built in java type.
+     */
+    public static final String BOOLEAN_DATA_TYPE = "boolean";
+
+    /**
+     * BigInteger built in java type.
+     */
+    public static final String BIG_INTEGER = "BigInteger";
+
+    /**
+     * BigDecimal built in java type.
+     */
+    public static final String BIG_DECIMAL = "BigDecimal";
+
+    /**
+     * BitSet built in java type.
+     */
+    public static final String BIT_SET = "BitSet";
+
+    /**
+     * Flag for subtree filtering in augment.
+     */
+    public static final String SUBTREE_FILTERED = "isSubTreeFiltered";
+
+    /**
+     * Augment map type.
+     */
+    public static final String AUGMENT_MAP_TYPE = "Map<Class<?>, Object>";
+
+    /**
+     * Byte java built in type.
+     */
+    public static final String BYTE = "byte";
+
+    /**
+     * Short java built in type.
+     */
+    public static final String SHORT = "short";
+
+    /**
+     * Int java built in type.
+     */
+    public static final String INT = "int";
+
+    /**
+     * Long java built in type.
+     */
+    public static final String LONG = "long";
+
+    /**
+     * Double java built in type.
+     */
+    public static final String DOUBLE = "double";
+
+    /**
+     * Boolean built in java wrapper type.
+     */
+    public static final String BOOLEAN_WRAPPER = "Boolean";
+
+    /**
+     * Byte java built in wrapper type.
+     */
+    public static final String BYTE_WRAPPER = "Byte";
+
+    /**
+     * Short java built in wrapper type.
+     */
+    public static final String SHORT_WRAPPER = "Short";
+
+    /**
+     * Integer java built in wrapper type.
+     */
+    public static final String INTEGER_WRAPPER = "Integer";
+
+    /**
+     * Long java built in wrapper type.
+     */
+    public static final String LONG_WRAPPER = "Long";
+
+    /**
+     * Static variable for question mark.
+     */
+    public static final String QUESTION_MARK = "?";
+
+    /**
+     * Static variable for forType string.
+     */
+    public static final String FOR_TYPE_STRING = " for type ";
+
+    /**
+     * List of keywords in java, this is used for checking if the input does not
+     * contain these keywords.
+     */
+    public static final List<String> JAVA_KEY_WORDS =
+            Arrays.asList("abstract", "assert", "boolean", "break", "byte",
+                          "case", "catch", "char", "class", "const", "continue",
+                          "default", "do", "double", "else", "extends", "false",
+                          "final", "finally", "float", "for", "goto", "if",
+                          "implements", "import", "instanceof", "enum", "int",
+                          "interface", "long", "native", "new", "null",
+                          "package", "private", "protected", "public", "return",
+                          "short", "static", "strictfp", "super", "switch",
+                          "synchronized", "this", "throw", "throws", "transient",
+                          "true", "try", "void", "volatile", "while", "list",
+                          "map", "arrayList", "hashMap", "linkedList", "notify",
+                          "notifyAll", "Method",
+                          "collections");
+
+    /**
+     * Static attribute for regex for all the special characters.
+     */
+    public static final String REGEX_WITH_ALL_SPECIAL_CHAR = "\\p{Punct}+";
+
+    /**
+     * Static attribute for regex for three special characters used in
+     * identifier.
+     */
+    public static final String REGEX_FOR_IDENTIFIER_SPECIAL_CHAR = "[. _ -]+";
+
+    /**
+     * Static attribute for regex for period.
+     */
+    public static final String REGEX_FOR_PERIOD = "[.]";
+
+    /**
+     * Static attribute for regex for underscore.
+     */
+    public static final String REGEX_FOR_UNDERSCORE = "[_]";
+
+    /**
+     * Static attribute for regex for hyphen.
+     */
+    public static final String REGEX_FOR_HYPHEN = "[-]";
+
+    /**
+     * Static attribute for regex for digits.
+     */
+    public static final String REGEX_FOR_FIRST_DIGIT = "\\d.*";
+
+    /**
+     * Static attribute for regex with digits.
+     */
+    public static final String REGEX_WITH_DIGITS = "(?=\\d+)";
+
+    /**
+     * Static attribute for regex for single letter.
+     */
+    public static final String REGEX_FOR_SINGLE_LETTER = "[a-zA-Z]";
+
+    /**
+     * Static attribute for regex for digits with single letter.
+     */
+    public static final String REGEX_FOR_DIGITS_WITH_SINGLE_LETTER =
+            "[0-9]+[a-zA-Z]";
+
+    /**
+     * Static attribute for regex with uppercase.
+     */
+    public static final String REGEX_WITH_UPPERCASE = "(?=\\p{Upper})";
+
+    /**
+     * Static attribute for regex for single capital case letter.
+     */
+    public static final String REGEX_WITH_SINGLE_CAPITAL_CASE = "[A-Z]";
+
+    /**
+     * Static attribute for regex for capital case letter with any number of
+     * digits and small case letters.
+     */
+    public static final String
+            REGEX_WITH_SINGLE_CAPITAL_CASE_AND_DIGITS_SMALL_CASES =
+            "[A-Z][0-9a-z]+";
+
+    /**
+     * Static attribute for regex for any string ending with service.
+     */
+    public static final String REGEX_FOR_ANY_STRING_ENDING_WITH_SERVICE =
+            ".+Service";
+
+    /**
+     * Static attribute for class syntax.
+     */
+    public static final String CLASS = "class";
+
+    /**
+     * Static attribute for builder syntax.
+     */
+    public static final String BUILDER = "Builder";
+
+    /**
+     * Static attribute for builder syntax.
+     */
+    public static final String BUILDER_LOWER_CASE = "builder";
+
+    /**
+     * Static attribute for service syntax.
+     */
+    public static final String SERVICE = "Service";
+
+    /**
+     * Static attribute for interface syntax.
+     */
+    public static final String INTERFACE = "interface";
+
+    /**
+     * Static attribute for enum syntax.
+     */
+    public static final String ENUM = "enum";
+
+    /**
+     * Static attribute for type syntax.
+     */
+    public static final String TYPE = "Type";
+
+    /**
+     * Static attribute for static syntax.
+     */
+    public static final String STATIC = "static";
+
+    /**
+     * Static attribute for final syntax.
+     */
+    public static final String FINAL = "final";
+
+    /**
+     * Static attribute for package syntax.
+     */
+    public static final String PACKAGE = "package";
+
+    /**
+     * Static attribute for import syntax.
+     */
+    public static final String IMPORT = "import ";
+
+    /**
+     * Static attribute for null syntax.
+     */
+    public static final String NULL = "null";
+
+    /**
+     * Static attribute for return syntax.
+     */
+    public static final String RETURN = "return";
+
+    /**
+     * Static attribute for java new syntax.
+     */
+    public static final String NEW = "new";
+
+    /**
+     * Static attribute for java new syntax.
+     */
+    public static final String TO_STRING_METHOD = "toString";
+
+    /**
+     * Static attribute for this syntax.
+     */
+    public static final String THIS = "this";
+
+    /**
+     * Static attribute for implements syntax.
+     */
+    public static final String IMPLEMENTS = "implements";
+
+    /**
+     * Static attribute for extends syntax.
+     */
+    public static final String EXTEND = "extends";
+
+    /**
+     * Static attribute for service interface suffix syntax.
+     */
+    public static final String SERVICE_METHOD_STRING = "Service";
+
+    /**
+     * For event file generation.
+     */
+    public static final String EVENT_STRING = "Event";
+
+    /**
+     * For event listener file generation.
+     */
+    public static final String EVENT_LISTENER_STRING = "EventListener";
+
+    /**
+     * For event subject file generation.
+     */
+    public static final String EVENT_SUBJECT_NAME_SUFFIX = "EventSubject";
+
+    /**
+     * Static attribute for build method syntax.
+     */
+    public static final String BUILD = "build";
+
+    /**
+     * Static attribute for build for filter in augment method syntax.
+     */
+    public static final String BUILD_FOR_FILTER = "buildForFilter";
+
+    /**
+     * Static attribute for object.
+     */
+    public static final String OBJECT = "Object";
+
+    /**
+     * Static attribute for app instance.
+     */
+    public static final String APP_INSTANCE = "appInstance";
+
+    /**
+     * Static attribute for instance.
+     */
+    public static final String INSTANCE = "instance";
+
+    /**
+     * Static attribute for override annotation.
+     */
+    public static final String OVERRIDE = "@Override";
+
+    /**
+     * Static attribute for collections.
+     */
+    public static final String COLLECTION_IMPORTS = "java.util";
+
+    /**
+     * Static attribute for reflect.
+     */
+    public static final String REFLECT_IMPORTS = "java.lang.reflect";
+
+    /**
+     * Static attribute for map.
+     */
+    public static final String MAP = "Map";
+
+    /**
+     * Static attribute for hash map.
+     */
+    public static final String HASH_MAP = "HashMap";
+
+
+    /**
+     * Static attribute for more object import package.
+     */
+    public static final String GOOGLE_MORE_OBJECT_IMPORT_PKG =
+            "com.google.common.base";
+
+    /**
+     * Static attribute for more object import class.
+     */
+    public static final String GOOGLE_MORE_OBJECT_IMPORT_CLASS =
+            "MoreObjects";
+
+    /**
+     * Static attribute for more object import class.
+     */
+    public static final String MORE_OBJ_ATTR =
+            "MoreObjects.ToStringHelper helper = ";
+
+    /**
+     * Static attribute for to string method.
+     */
+    public static final String GOOGLE_MORE_OBJECT_METHOD_STRING =
+            "MoreObjects.toStringHelper(getClass())";
+
+    /**
+     * Static attribute for to string method.
+     */
+    public static final String GOOGLE_MORE_OBJECT_METHOD_STATIC_STRING =
+            "MoreObjects.toStringHelper";
+
+    /**
+     * Static attribute for java utilities import package.
+     */
+    public static final String JAVA_UTIL_PKG = "java.util";
+
+    /**
+     * Static attribute for java utilities import package.
+     */
+    public static final String JAVA_UTIL_REGEX_PKG = "java.util.regex";
+
+    /**
+     * Static attribute for java utilities import package.
+     */
+    public static final String SET_VALUE_PARA = "setValue";
+
+    /**
+     * Static attribute for Method.
+     */
+    public static final String METHOD = "Method";
+
+    /**
+     * Static attribute for bitset.
+     */
+    public static final String BITSET = "BitSet";
+
+    /**
+     * Static attribute for java utilities objects import class.
+     */
+    public static final String JAVA_UTIL_OBJECTS_IMPORT_CLASS = "Objects";
+
+    /**
+     * Static attribute for AugmentedInfo class.
+     */
+    public static final String YANG_AUGMENTED_INFO = "YangAugmentedInfo";
+
+    /**
+     * Static attribute for AugmentedInfo class.
+     */
+    public static final String YANG_AUGMENTED_INFO_LOWER_CASE =
+            "yangAugmentedInfo";
+
+    /**
+     * Static attribute for AugmentedInfo class.
+     */
+    public static final String YANG_AUGMENTED_INFO_MAP =
+            "yangAugmentedInfoMap";
+
+    /**
+     * Static attribute for augmented.
+     */
+    public static final String AUGMENTED = "Augmented";
+
+    /**
+     * Static attribute for list.
+     */
+    public static final String LIST = "List";
+
+    /**
+     * Static attribute for queue.
+     */
+    public static final String QUEUE = "Queue";
+
+    /**
+     * Static attribute for set.
+     */
+    public static final String SET = "Set";
+
+    /**
+     * Comment to be added for auto generated impl methods.
+     */
+    public static final String YANG_UTILS_TODO =
+            "//TODO: YANG utils generated code";
+
+    /**
+     * Static attribute for AbstractEvent.
+     */
+    public static final String ABSTRACT_EVENT = "AbstractEvent";
+
+    /**
+     * Static attribute for EventListener.
+     */
+    public static final String EVENT_LISTENER = "EventListener";
+
+    /**
+     * Static attribute for or operator.
+     */
+    public static final String OR_OPERATION = "||";
+
+    /**
+     * Static attribute for or operator.
+     */
+    public static final String AND_OPERATION = "&&";
+
+    /**
+     * Static attribute for YANG file error.
+     */
+    public static final String YANG_FILE_ERROR = "YANG file error : ";
+
+    /**
+     * Static attribute for unsupported error information.
+     */
+    public static final String UNSUPPORTED_YANG_CONSTRUCT =
+            " is not supported.";
+
+    /**
+     * Static attribute for "is invalid" information.
+     */
+    public static final String IS_INVALID = " is invalid.";
+
+    /**
+     * Static attribute for data model tree error information.
+     */
+    public static final String INVALID_TREE = "Internal datamodel error: " +
+            "Datamodel tree is not correct";
+
+    /**
+     * Static attribute for currently unsupported error information.
+     */
+    public static final String CURRENTLY_UNSUPPORTED =
+            " is not supported in current version, please check wiki" +
+                    " for YANG utils road map.";
+
+    /**
+     * Static attribute for leaf ref target node error information.
+     */
+    public static final String LEAFREF_ERROR = "YANG file error: The target" +
+            " node, in the leafref path ";
+
+    /**
+     * Static attribute for leaf holder error information.
+     */
+    public static final String LEAF_HOLDER_ERROR = "Referred node should be of" +
+            " type leaves holder in ";
+
+    /**
+     * Static attribute for invalid resolve entity error information.
+     */
+    public static final String INVALID_RESOLVED_ENTITY = "Data Model " +
+            "Exception: Entity to resolved is other than type/uses";
+
+    /**
+     * Static attribute for invalid resolve entity error information.
+     */
+    public static final String INVALID_ENTITY = "Data Model Exception: Entity " +
+            "to resolved is other than identityref";
+
+    /**
+     * Static attribute for invalid state error information.
+     */
+    public static final String INVALID_LINKER_STATE = "Data Model Exception: " +
+            "Unsupported, linker state";
+
+    /**
+     * Static attribute for leaf ref resolve entity error information.
+     */
+    public static final String FAILED_TO_FIND_LEAD_INFO_HOLDER = "YANG file " +
+            "error: Unable to find base leaf/leaf-list for given leafref path ";
+
+    /**
+     * Static attribute for compiler annotation resolve entity error
+     * information.
+     */
+    public static final String FAILED_TO_FIND_ANNOTATION = "Failed to link " +
+            "compiler annotation ";
+
+    /**
+     * Static attribute for failed to link entity error information.
+     */
+    public static final String FAILED_TO_LINK = "Failed to link ";
+
+    /**
+     * Static attribute for un-resolve entity error information.
+     */
+    public static final String UNRESOLVABLE = "Data Model Exception: Entity " +
+            "to resolved is not Resolvable";
+
+    /**
+     * Static attribute for invalid resolve entity error information.
+     */
+    public static final String LINKER_ERROR = "Data Model Exception: Entity" +
+            " to resolved is other than type/uses/if-feature/leafref/base/identityref";
+
+    /**
+     * Static attribute for invalid resolve entity error information.
+     */
+    public static final String INVALID_TARGET = "Invalid target node type ";
+    /**
+     * Static attribute for typedef linker error information.
+     */
+    public static final String TYPEDEF_LINKER_ERROR =
+            "YANG file error: Unable to find base typedef for given type";
+
+    /**
+     * Static attribute for grouping linker error information.
+     */
+    public static final String GROUPING_LINKER_ERROR =
+            "YANG file error: Unable to find base grouping for given uses";
+
+    /**
+     * Static attribute for if-feature linker error information.
+     */
+    public static final String FEATURE_LINKER_ERROR =
+            "YANG file error: Unable to find feature for given if-feature";
+
+    /**
+     * Static attribute for leafref linker error information.
+     */
+    public static final String LEAFREF_LINKER_ERROR =
+            "YANG file error: Unable to find base leaf/leaf-list for given " +
+                    "leafref";
+
+    /**
+     * Static attribute for base linker error information.
+     */
+    public static final String BASE_LINKER_ERROR =
+            "YANG file error: Unable to find base identity for given base";
+
+    /**
+     * Static attribute for identityref linker error information.
+     */
+    public static final String IDENTITYREF_LINKER_ERROR =
+            "YANG file error: Unable to find base identity for given base";
+
+    /**
+     * Static attribute for jar.
+     */
+    public static final String JAR = "jar";
+
+    /**
+     * Static attribute for for.
+     */
+    public static final String FOR = "for";
+
+    /**
+     * Static attribute for InvocationTargetException.
+     */
+    public static final String INVOCATION_TARGET_EXCEPTION =
+            "InvocationTargetException";
+    /**
+     * Static attribute for arrayList.
+     */
+    public static final String ARRAY_LIST_INIT = "ArrayList<>()";
+
+    /**
+     * Static attribute for arrayList import.
+     */
+    public static final String ARRAY_LIST_IMPORT =
+            IMPORT + COLLECTION_IMPORTS + ".ArrayList;\n";
+
+    /**
+     * Static attribute for unused keyword.
+     */
+    public static final String UNUSED = "UNUSED";
+
+    /**
+     * Static attribute for 1 keyword.
+     */
+    public static final String ONE = "1";
+
+    /**
+     * Static attribute for YANG node operation type class.
+     */
+    public static final String OPERATION_TYPE_CLASS =
+            "OnosYangOpType";
+
+    /**
+     * Static attribute for YANG node operation type attribute.
+     */
+    public static final String OPERATION_TYPE_ATTRIBUTE =
+            "OpType";
+
+    /**
+     * Static attribute for input keyword to be suffixed with rpc name.
+     */
+    public static final String INPUT_KEYWORD = "_input";
+
+    /**
+     * Static attribute for output keyword to be suffixed with rpc name.
+     */
+    public static final String OUTPUT_KEYWORD = "_output";
+
+    /**
+     * Static attribute for event class.
+     */
+    public static final String EVENT_CLASS = "event class";
+
+    /**
+     * Static attribute for typedef class.
+     */
+    public static final String TYPEDEF_CLASS = "typedef class";
+
+    /**
+     * Static attribute for impl class.
+     */
+    public static final String IMPL_CLASS = "impl class";
+
+    /**
+     * Static attribute for union class.
+     */
+    public static final String UNION_CLASS = "union class";
+
+    /**
+     * Static attribute for enum class.
+     */
+    public static final String ENUM_CLASS = "enum class";
+
+    /**
+     * Static attribute for rpc class.
+     */
+    public static final String RPC_CLASS = "rpc class";
+
+    /**
+     * Static attribute for builder class.
+     */
+    public static final String BUILDER_CLASS = "builder class";
+
+    /**
+     * Static attribute for builder interface.
+     */
+    public static final String BUILDER_INTERFACE = "builder interface";
+
+    /**
+     * Static attribute for bits.
+     */
+    public static final String BITS = "bits";
+
+    /**
+     * Static attribute for YANG.
+     */
+    public static final String YANG = "yang";
+
+    /**
+     * Static attribute for error msg.
+     */
+    public static final String ERROR_MSG_FOR_GEN_CODE = "please check whether " +
+            "multiple yang" + " files has same module/submodule" +
+            " \"name\" and \"namespace\"" + "or You may have generated code of" +
+            " previous build present in your directory.";
+
+    /**
+     * Static attribute for error msg.
+     */
+    public static final String ERROR_MSG_JAVA_IDENTITY = "Expected java " +
+            "identity instance node ";
+
+    /**
+     * Static attribute for error msg.
+     */
+    public static final String ERROR_MSG_FOR_AUGMENT_LINKING = "Augment " +
+            "linking does not support linking when path contains " +
+            "notification/grouping for path: ";
+
+    /**
+     * Static attribute for error msg.
+     */
+    public static final String VERSION_ERROR = "Onos-yang-tools " +
+            "does not support maven version below \"3.3.9\" , your current " +
+            "version is ";
+
+    /**
+     * Static attribute for in.
+     */
+    public static final String IN = " in ";
+
+    /**
+     * Static attribute for at.
+     */
+    public static final String AT = " at ";
+
+    /**
+     * Static param for processChildNodesSubTreeFiltering.
+     */
+    public static final String PROCESS_CHILD_NODE_STF_PARAM =
+            "processChildNodesSubTreeFiltering";
+
+    /**
+     * Static param for processLeafListSubTreeFiltering.
+     */
+    public static final String PROCESS_LEAF_LIST_STF_PARAM =
+            "processLeafListSubTreeFiltering";
+    /**
+     * Static param for processLeafListSubTreeFiltering.
+     */
+    public static final String PROCESS_LEAF_STF_PARAM =
+            "processLeafSubtreeFiltering";
+    /**
+     * Static param for subTreeFilteringResultBuilder.
+     */
+    public static final String STF_BUILDER_PARAM =
+            "subTreeFilteringResultBuilder";
+
+    /**
+     * Static param for isAnySelectOrContainmentNode.
+     */
+    public static final String SELECT_OR_CONTAINMENT_NODE_PARAM =
+            "isAnySelectOrContainmentNode";
+    /**
+     * Static param for isSelectAllSchemaChild.
+     */
+    public static final String SELECT_ALL_CHILD_SCHEMA_PARAM =
+            "isSelectAllSchemaChild";
+
+    //File type extension for java classes.
+    public static final String JAVA_FILE_EXTENSION = ".java";
+
+    /**
+     * Static param for typedef.
+     */
+    public static final String HOLDER_TYPE_DEF = "typedef";
+
+    /**
+     * Static param for last.
+     */
+    public static final String LAST = "last";
+
+    // No instantiation.
+    private UtilConstants() {
+    }
+
+    /**
+     * Represents operation type.
+     */
+    public enum Operation {
+        /**
+         * Represents add operation.
+         */
+        ADD,
+
+        /**
+         * Represents remove operation.
+         */
+        REMOVE
+    }
+}
diff --git a/compiler/base/utils/src/main/java/org/onosproject/yang/compiler/utils/io/YangPluginConfig.java b/compiler/base/utils/src/main/java/org/onosproject/yang/compiler/utils/io/YangPluginConfig.java
new file mode 100644
index 0000000..eec9301
--- /dev/null
+++ b/compiler/base/utils/src/main/java/org/onosproject/yang/compiler/utils/io/YangPluginConfig.java
@@ -0,0 +1,154 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.utils.io;
+
+import org.onosproject.yang.compiler.utils.io.impl.YangFileScanner;
+
+import javax.tools.JavaCompiler;
+import javax.tools.StandardJavaFileManager;
+import javax.tools.ToolProvider;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * Representation of plugin configurations required for YANG utils.
+ */
+public final class YangPluginConfig {
+
+    /**
+     * Contains the code generation directory.
+     */
+    private String codeGenDir;
+
+    /**
+     * Contains information of naming conflicts that can be resolved.
+     */
+    private YangToJavaNamingConflictUtil conflictResolver;
+
+    /**
+     * Java code generation is for sbi.
+     */
+    private String codeGenerateForSbi;
+
+    /**
+     * Path to generate the resource files, which will be used by the  plugin
+     * to add it as part of the resource, implicitly by the path location, or
+     * some explicit way to add to bundle.
+     */
+    private String resourceGenDir;
+
+    /**
+     * Creates an object for YANG plugin config.
+     */
+    public YangPluginConfig() {
+    }
+
+    /**
+     * Returns the string for code generation.
+     *
+     * @return returns the string for code generation.
+     */
+    public String getCodeGenerateForSbi() {
+        return codeGenerateForSbi;
+    }
+
+    /**
+     * Sets the string sbi or nbi for code generation.
+     *
+     * @param codeGenerateForSbi generation is for sbi
+     */
+    public void setCodeGenerateForSbi(String codeGenerateForSbi) {
+        this.codeGenerateForSbi = codeGenerateForSbi;
+    }
+
+    /**
+     * Sets the path of the java code where it has to be generated.
+     *
+     * @param codeGenDir path of the directory
+     */
+    public void setCodeGenDir(String codeGenDir) {
+        this.codeGenDir = codeGenDir;
+    }
+
+    /**
+     * Returns the code generation directory path.
+     *
+     * @return code generation directory
+     */
+    public String getCodeGenDir() {
+        return codeGenDir;
+    }
+
+    /**
+     * Sets the object.
+     *
+     * @param conflictResolver object of the class
+     */
+    public void setConflictResolver(YangToJavaNamingConflictUtil conflictResolver) {
+        this.conflictResolver = conflictResolver;
+    }
+
+    /**
+     * Returns the object.
+     *
+     * @return object of the class
+     */
+    public YangToJavaNamingConflictUtil getConflictResolver() {
+        return conflictResolver;
+    }
+
+
+    public String resourceGenDir() {
+        return resourceGenDir;
+    }
+
+    public void resourceGenDir(String resourceGenDir) {
+        this.resourceGenDir = resourceGenDir;
+    }
+
+    /**
+     * TODO: delete me, it is not part of config, it needs to be updated for
+     * test scripts
+     * Compiles the generated code for unit tests.
+     *
+     * @param dir1 directory path
+     * @throws IOException when generated code has compilation errors.
+     */
+    @SuppressWarnings("unchecked")
+    public static void compileCode(String dir1) throws IOException {
+        String classpath = System.getProperty("java.class.path");
+        List<String> optionList = new ArrayList<>();
+        optionList.addAll(Arrays.asList("-classpath", classpath));
+
+        List<String> files = YangFileScanner.getJavaFiles(dir1);
+        JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
+        StandardJavaFileManager manager = compiler.getStandardFileManager(null, null, null);
+        Iterable fileObjects = manager.getJavaFileObjectsFromStrings(files);
+        JavaCompiler.CompilationTask task = compiler.getTask(null, null,
+                                                             null, optionList, null,
+                                                             fileObjects);
+
+        boolean failOnError = !task.call();
+        manager.close();
+        if (failOnError) {
+            throw new IOException("Yang Error : compilation errors in " +
+                                          "generated code.");
+        }
+    }
+}
diff --git a/compiler/base/utils/src/main/java/org/onosproject/yang/compiler/utils/io/YangToJavaNamingConflictUtil.java b/compiler/base/utils/src/main/java/org/onosproject/yang/compiler/utils/io/YangToJavaNamingConflictUtil.java
new file mode 100644
index 0000000..af966a1
--- /dev/null
+++ b/compiler/base/utils/src/main/java/org/onosproject/yang/compiler/utils/io/YangToJavaNamingConflictUtil.java
@@ -0,0 +1,121 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.utils.io;
+
+/**
+ * Representation of YANG to java naming conflict resolver util.
+ */
+public final class YangToJavaNamingConflictUtil {
+
+    /**
+     * Contains the replacement value for a period.
+     */
+    private String replacementForPeriodInIdentifier;
+
+    /**
+     * Contains the replacement value for an underscore.
+     */
+    private String replacementForUnderscoreInIdentifier;
+
+    /**
+     * Contains the replacement value for a hyphen.
+     */
+    private String replacementForHyphenInIdentifier;
+
+    /**
+     * Contains the prefix value for adding with the identifier.
+     */
+    private String prefixForIdentifier;
+
+    /**
+     * Creates an object for YANG to java naming conflict util.
+     */
+    public YangToJavaNamingConflictUtil() {
+    }
+
+    /**
+     * Sets the replacement value for a period.
+     *
+     * @param periodReplacement replacement value for period
+     */
+    public void setReplacementForPeriod(String periodReplacement) {
+        replacementForPeriodInIdentifier = periodReplacement;
+    }
+
+    /**
+     * Returns the replaced period value.
+     *
+     * @return replaced period
+     */
+    public String getReplacementForPeriod() {
+        return replacementForPeriodInIdentifier;
+    }
+
+    /**
+     * Sets the replacement value for a hyphen.
+     *
+     * @param hyphenReplacement replacement value for hyphen
+     */
+    public void setReplacementForHyphen(String hyphenReplacement) {
+        replacementForHyphenInIdentifier = hyphenReplacement;
+    }
+
+    /**
+     * Returns the replaced hyphen value.
+     *
+     * @return replaced hyphen
+     */
+    public String getReplacementForHyphen() {
+        return replacementForHyphenInIdentifier;
+    }
+
+    /**
+     * Sets the replacement value for an underscore.
+     *
+     * @param underscoreReplacement replacement value for underscore
+     */
+    public void setReplacementForUnderscore(String underscoreReplacement) {
+        replacementForUnderscoreInIdentifier = underscoreReplacement;
+    }
+
+    /**
+     * Returns the replaced underscore value.
+     *
+     * @return replaced underscore
+     */
+    public String getReplacementForUnderscore() {
+        return replacementForUnderscoreInIdentifier;
+    }
+
+    /**
+     * Sets the prefix value for adding with the identifier.
+     *
+     * @param prefix prefix for identifier
+     */
+    public void setPrefixForIdentifier(String prefix) {
+        prefixForIdentifier = prefix;
+    }
+
+    /**
+     * Returns the prefix for identifier.
+     *
+     * @return prefix for identifier
+     */
+    public String getPrefixForIdentifier() {
+        return prefixForIdentifier;
+    }
+}
diff --git a/compiler/base/utils/src/main/java/org/onosproject/yang/compiler/utils/io/impl/CopyrightHeader.java b/compiler/base/utils/src/main/java/org/onosproject/yang/compiler/utils/io/impl/CopyrightHeader.java
new file mode 100644
index 0000000..2ec2fd7
--- /dev/null
+++ b/compiler/base/utils/src/main/java/org/onosproject/yang/compiler/utils/io/impl/CopyrightHeader.java
@@ -0,0 +1,105 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.utils.io.impl;
+
+import org.onosproject.yang.compiler.utils.UtilConstants;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import static java.util.Calendar.YEAR;
+import static java.util.Calendar.getInstance;
+
+/**
+ * Represents the license header for the generated files.
+ */
+public final class CopyrightHeader {
+
+    private static final int EOF = -1;
+    private static final String COPYRIGHT_HEADER_FILE = "CopyrightHeader.txt";
+    private static final String COPYRIGHTS_FIRST_LINE = "/*\n * Copyright " + getInstance().get(YEAR)
+            + "-present Open Networking Laboratory\n";
+    private static final String TEMP_FILE = "temp.txt";
+
+    /**
+     * Creates an instance of copyright header.
+     */
+    private CopyrightHeader() {
+    }
+
+    /**
+     * parses Copyright to the temporary file.
+     *
+     * @return string of file.
+     * @throws IOException when fails to get the copyright header
+     */
+    public static String parseCopyrightHeader() throws IOException {
+
+        File temp = new File(TEMP_FILE);
+
+        try {
+            InputStream stream = CopyrightHeader.class.getClassLoader()
+                    .getResourceAsStream(COPYRIGHT_HEADER_FILE);
+            OutputStream out = new FileOutputStream(temp);
+
+            int index;
+            out.write(COPYRIGHTS_FIRST_LINE.getBytes());
+            while ((index = stream.read()) != EOF) {
+                out.write(index);
+            }
+            out.close();
+            stream.close();
+            return getStringFileContent(temp);
+        } catch (IOException e) {
+            throw new IOException("failed to parse the Copyright header");
+        } finally {
+            temp.delete();
+        }
+    }
+
+    /**
+     * Converts it to string.
+     *
+     * @param toAppend file to be converted.
+     * @return string of file.
+     * @throws IOException when fails to convert to string
+     */
+    private static String getStringFileContent(File toAppend) throws IOException {
+
+        FileReader fileReader = new FileReader(toAppend);
+        BufferedReader bufferReader = new BufferedReader(fileReader);
+        try {
+            StringBuilder stringBuilder = new StringBuilder();
+            String line = bufferReader.readLine();
+
+            while (line != null) {
+                stringBuilder.append(line);
+                stringBuilder.append(UtilConstants.NEW_LINE);
+                line = bufferReader.readLine();
+            }
+            return stringBuilder.toString();
+        } finally {
+            fileReader.close();
+            bufferReader.close();
+        }
+    }
+}
diff --git a/compiler/base/utils/src/main/java/org/onosproject/yang/compiler/utils/io/impl/FileSystemUtil.java b/compiler/base/utils/src/main/java/org/onosproject/yang/compiler/utils/io/impl/FileSystemUtil.java
new file mode 100644
index 0000000..e664728
--- /dev/null
+++ b/compiler/base/utils/src/main/java/org/onosproject/yang/compiler/utils/io/impl/FileSystemUtil.java
@@ -0,0 +1,171 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.utils.io.impl;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.onosproject.yang.compiler.utils.UtilConstants.EIGHT_SPACE_INDENTATION;
+import static org.onosproject.yang.compiler.utils.UtilConstants.EMPTY_STRING;
+import static org.onosproject.yang.compiler.utils.UtilConstants.FOUR_SPACE_INDENTATION;
+import static org.onosproject.yang.compiler.utils.UtilConstants.MULTIPLE_NEW_LINE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.NEW_LINE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.SPACE;
+
+/**
+ * Represents utility to handle file system operations.
+ */
+public final class FileSystemUtil {
+
+    /**
+     * Creates an instance of file system util.
+     */
+    private FileSystemUtil() {
+    }
+
+    /**
+     * Reads the contents from source file and append its contents to append file.
+     *
+     * @param toAppend destination file in which the contents of source file is appended
+     * @param srcFile  source file from which data is read and added to to append file
+     * @throws IOException any IO errors
+     */
+    public static void appendFileContents(File toAppend, File srcFile)
+            throws IOException {
+        updateFileHandle(srcFile, readAppendFile(toAppend.toString(),
+                                                 FOUR_SPACE_INDENTATION), false);
+    }
+
+    /**
+     * Reads file and convert it to string.
+     *
+     * @param toAppend file to be converted
+     * @param spaces   spaces to be appended
+     * @return string of file
+     * @throws IOException when fails to convert to string
+     */
+    public static String readAppendFile(String toAppend, String spaces)
+            throws IOException {
+
+        FileReader fileReader = new FileReader(toAppend);
+        BufferedReader bufferReader = new BufferedReader(fileReader);
+        try {
+            StringBuilder stringBuilder = new StringBuilder();
+            String line = bufferReader.readLine();
+
+            while (line != null) {
+                switch (line) {
+                    case SPACE:
+                    case EMPTY_STRING:
+                    case EIGHT_SPACE_INDENTATION:
+                    case MULTIPLE_NEW_LINE:
+                        stringBuilder.append(NEW_LINE);
+                        break;
+                    case FOUR_SPACE_INDENTATION:
+                        stringBuilder.append(EMPTY_STRING);
+                        break;
+                    default:
+                        String append = spaces + line;
+                        stringBuilder.append(append);
+                        stringBuilder.append(NEW_LINE);
+                        break;
+                }
+                line = bufferReader.readLine();
+            }
+            return stringBuilder.toString();
+        } finally {
+            fileReader.close();
+            bufferReader.close();
+        }
+    }
+
+    /**
+     * Updates the generated file handle.
+     *
+     * @param inputFile        input file
+     * @param contentTobeAdded content to be appended to the file
+     * @param isClose          when close of file is called.
+     * @throws IOException if the named file exists but is a directory rather than a regular file, does not exist but
+     *                     cannot be created, or cannot be opened for any other reason
+     */
+    public static void updateFileHandle(File inputFile, String contentTobeAdded,
+                                        boolean isClose)
+            throws IOException {
+
+        List<FileWriter> fileWriterStore = new ArrayList<>();
+
+        FileWriter fileWriter = new FileWriter(inputFile, true);
+        fileWriterStore.add(fileWriter);
+        PrintWriter outputPrintWriter = new PrintWriter(fileWriter, true);
+        if (!isClose) {
+            outputPrintWriter.write(contentTobeAdded);
+            outputPrintWriter.flush();
+            outputPrintWriter.close();
+        } else {
+            for (FileWriter curWriter : fileWriterStore) {
+                curWriter.flush();
+                curWriter.close();
+            }
+        }
+    }
+
+    /**
+     * Closes the file handle for temporary file.
+     *
+     * @param file        file to be closed
+     * @param toBeDeleted flag to indicate if file needs to be deleted
+     * @throws IOException when failed to close the file handle
+     */
+    public static void closeFile(File file, boolean toBeDeleted)
+            throws IOException {
+
+        if (file != null) {
+            updateFileHandle(file, null, true);
+            if (toBeDeleted) {
+                boolean deleted = file.delete();
+                if (!deleted) {
+                    throw new IOException("Failed to delete temporary file " + file.getName());
+                }
+            }
+        }
+    }
+
+    /**
+     * Closes the file handle for temporary file with file deletion.
+     *
+     * @param file file to be closed
+     * @throws IOException when failed to close the file handle
+     */
+    public static void closeFile(File file) throws IOException {
+
+        if (file != null) {
+            updateFileHandle(file, null, true);
+            boolean deleted = file.delete();
+            if (!deleted) {
+                throw new IOException("Failed to delete temporary file " +
+                                              file.getName());
+            }
+        }
+    }
+    // TODO follow coding guidelines in remaining of this file.
+}
diff --git a/compiler/base/utils/src/main/java/org/onosproject/yang/compiler/utils/io/impl/JavaDocGen.java b/compiler/base/utils/src/main/java/org/onosproject/yang/compiler/utils/io/impl/JavaDocGen.java
new file mode 100644
index 0000000..89ab368
--- /dev/null
+++ b/compiler/base/utils/src/main/java/org/onosproject/yang/compiler/utils/io/impl/JavaDocGen.java
@@ -0,0 +1,851 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.utils.io.impl;
+
+import org.onosproject.yang.compiler.utils.UtilConstants;
+
+import static org.onosproject.yang.compiler.utils.UtilConstants.*;
+import static org.onosproject.yang.compiler.utils.io.impl.YangIoUtils.*;
+
+/**
+ * Represents javadoc for the generated classes.
+ */
+public final class JavaDocGen {
+
+    /**
+     * Creates an instance of java doc gen.
+     */
+    private JavaDocGen() {
+    }
+
+    /**
+     * Returns java docs.
+     *
+     * @param type               java doc type
+     * @param name               name of the YangNode
+     * @param isList             is list attribute
+     * @param compilerAnnotation compiler annotations for user defined data type
+     * @return javaDocs.
+     */
+    public static String getJavaDoc(JavaDocType type, String name, boolean isList,
+                                    String compilerAnnotation) {
+
+        name = getSmallCase(name);
+        switch (type) {
+            case DEFAULT_CLASS: {
+                return generateForClass(name, isList);
+            }
+            case BUILDER_CLASS: {
+                return generateForBuilderClass(name);
+            }
+            case OPERATION_CLASS: {
+                return generateForOpParamClass(name);
+            }
+            case OPERATION_BUILDER_CLASS: {
+                return generateForOpParamClass(name);
+            }
+            case INTERFACE: {
+                return generateForInterface(name);
+            }
+            case BUILDER_INTERFACE: {
+                return generateForBuilderInterface(name);
+            }
+            case PACKAGE_INFO: {
+                return generateForPackage(name, isList);
+            }
+            case GETTER_METHOD: {
+                return generateForGetters(name, isList, compilerAnnotation);
+            }
+            case TYPE_DEF_SETTER_METHOD: {
+                return generateForTypeDefSetter(name);
+            }
+            case SETTER_METHOD: {
+                return generateForSetters(name, isList, compilerAnnotation);
+            }
+            case MANAGER_SETTER_METHOD: {
+                return generateForManagerSetters(name, isList, compilerAnnotation);
+            }
+            case OF_METHOD: {
+                return generateForOf(name);
+            }
+            case DEFAULT_CONSTRUCTOR: {
+                return generateForDefaultConstructors(name);
+            }
+            case BUILD_METHOD: {
+                return generateForBuild(name);
+            }
+            case TYPE_CONSTRUCTOR: {
+                return generateForTypeConstructor(name);
+            }
+            case FROM_METHOD: {
+                return generateForFromString(name);
+            }
+            case ENUM_CLASS: {
+                return generateForEnum(name);
+            }
+            case ENUM_ATTRIBUTE: {
+                return generateForEnumAttr(name);
+            }
+            case RPC_INTERFACE: {
+                return generateForRpcService(name);
+            }
+            case RPC_MANAGER: {
+                return generateForClass(name, false);
+            }
+            case EVENT: {
+                return generateForEvent(name);
+            }
+            case EVENT_LISTENER: {
+                return generateForEventListener(name);
+            }
+            case EVENT_SUBJECT_CLASS: {
+                return generateForClass(name, false);
+            }
+            case ADD_TO_LIST: {
+                return generateForAddToList(name, compilerAnnotation);
+            }
+            default: {
+                return generateForConstructors(name);
+            }
+        }
+    }
+
+    /**
+     * Generates javaDocs for enum's attributes.
+     *
+     * @param name attribute name
+     * @return javaDocs
+     */
+    private static String generateForEnumAttr(String name) {
+        return getJavaDocForClass(name, ENUM_ATTRIBUTE_JAVADOC,
+                                  FOUR_SPACE_INDENTATION);
+    }
+
+    /**
+     * Generates javaDocs for inner class enum's attributes.
+     *
+     * @param name attribute name
+     * @return javaDocs
+     */
+    public static String enumJavaDocForInnerClass(String name) {
+        return getJavaDocForClass(name, ENUM_ATTRIBUTE_JAVADOC,
+                                  EIGHT_SPACE_INDENTATION);
+    }
+
+    /**
+     * Generates javaDocs for rpc method.
+     *
+     * @param rpcName    name of the rpc
+     * @param inputName  name of input
+     * @param outputName name of output
+     * @return javaDocs of rpc method
+     */
+    public static String generateJavaDocForRpc(String rpcName, String inputName,
+                                               String outputName) {
+
+        String javadoc = getJavaDocStartLine(rpcName, JAVA_DOC_RPC) +
+                getJavaDocEmptyAsteriskLine();
+        if (!inputName.equals(EMPTY_STRING)) {
+            javadoc = javadoc + getInputString(inputName, rpcName);
+        }
+        if (!outputName.equals(VOID)) {
+            javadoc = javadoc + getOutputString(getSmallCase(outputName),
+                                                rpcName);
+        }
+        return javadoc + getJavaDocEndLine();
+    }
+
+    /**
+     * Returns output string of rpc.
+     *
+     * @param outputName name of output
+     * @param rpcName    name of rpc
+     * @return javaDocs for output string of rpc
+     */
+    private static String getOutputString(String outputName, String rpcName) {
+        return FOUR_SPACE_INDENTATION + JAVA_DOC_RETURN + outputName + SPACE +
+                RPC_OUTPUT_STRING + rpcName + NEW_LINE;
+    }
+
+    /**
+     * Returns input string of rpc.
+     *
+     * @param inputName name of input
+     * @param rpcName   name of rpc
+     * @return javaDocs for input string of rpc
+     */
+    private static String getInputString(String inputName, String rpcName) {
+        if (inputName.isEmpty()) {
+            return null;
+        } else {
+            return FOUR_SPACE_INDENTATION + JAVA_DOC_PARAM + inputName +
+                    SPACE + RPC_INPUT_STRING + rpcName + NEW_LINE;
+        }
+    }
+
+    /**
+     * Generates javaDoc for the interface.
+     *
+     * @param interfaceName interface name
+     * @return javaDocs
+     */
+    private static String generateForRpcService(String interfaceName) {
+        return getJavaDocForClass(interfaceName, INTERFACE_JAVA_DOC, EMPTY_STRING);
+    }
+
+    /**
+     * Generates javaDoc for the event.
+     *
+     * @param name event class name
+     * @return javaDocs
+     */
+    private static String generateForEvent(String name) {
+        return getJavaDocForClass(name, EVENT_JAVA_DOC, EMPTY_STRING);
+    }
+
+    /**
+     * Generates javaDoc for the event listener.
+     *
+     * @param name event class name
+     * @return javaDocs
+     */
+    private static String generateForEventListener(String name) {
+        return getJavaDocForClass(name, EVENT_LISTENER_JAVA_DOC, EMPTY_STRING);
+    }
+
+    /**
+     * Generates javaDocs for getter method.
+     *
+     * @param attribute          attribute
+     * @param isList             is list attribute
+     * @param compilerAnnotation compiler annotation
+     * @return javaDocs
+     */
+    private static String generateForGetters(String attribute, boolean isList,
+                                             String compilerAnnotation) {
+
+        String getter = getJavaDocStartLine(attribute, JAVA_DOC_GETTERS) +
+                getJavaDocEmptyAsteriskLine() +
+                FOUR_SPACE_INDENTATION + JAVA_DOC_RETURN + attribute + SPACE;
+
+        getter = getParamForAnnotation(getter, compilerAnnotation, isList) +
+                attribute + NEW_LINE + getJavaDocEndLine();
+        return getter;
+    }
+
+    /**
+     * Generates javaDocs for setter method.
+     *
+     * @param attribute          attribute
+     * @param isList             is list attribute
+     * @param compilerAnnotation compiler annotation
+     * @return javaDocs
+     */
+    private static String generateForSetters(String attribute, boolean isList,
+                                             String compilerAnnotation) {
+
+        String setter = getJavaDocStartLine(attribute, JAVA_DOC_SETTERS) +
+                getJavaDocEmptyAsteriskLine() +
+                FOUR_SPACE_INDENTATION + JAVA_DOC_PARAM + attribute + SPACE;
+        setter = getParamForAnnotation(setter, compilerAnnotation, isList) +
+                attribute + NEW_LINE + getJavaDocReturnLine(attribute)
+                + getJavaDocEndLine();
+        return setter;
+    }
+
+    /**
+     * Generates javaDocs for setter method.
+     *
+     * @param attribute          attribute
+     * @param isList             is list attribute
+     * @param compilerAnnotation compiler annotation
+     * @return javaDocs
+     */
+    private static String generateForManagerSetters(String attribute, boolean isList,
+                                                    String compilerAnnotation) {
+        String setter = getJavaDocStartLine(attribute, JAVA_DOC_MANAGER_SETTERS) +
+                getJavaDocEmptyAsteriskLine() +
+                FOUR_SPACE_INDENTATION + JAVA_DOC_PARAM + attribute + SPACE;
+        setter = getParamForAnnotation(setter, compilerAnnotation, isList) +
+                attribute + NEW_LINE + getJavaDocEndLine();
+        return setter;
+    }
+
+    private static String getParamForAnnotation(
+            String setter, String compilerAnnotation, boolean isList) {
+        String attributeParam;
+        if (compilerAnnotation != null) {
+            compilerAnnotation = compilerAnnotation.toLowerCase();
+            compilerAnnotation = getCapitalCase(compilerAnnotation);
+            switch (compilerAnnotation) {
+                case QUEUE: {
+                    attributeParam = QUEUE.toLowerCase() + SPACE + OF + SPACE;
+                    setter = setter + attributeParam;
+                    break;
+                }
+                case SET: {
+                    attributeParam = SET.toLowerCase() + SPACE + OF + SPACE;
+                    setter = setter + attributeParam;
+                    break;
+                }
+                case LIST: {
+                    attributeParam = LIST.toLowerCase() + SPACE + OF + SPACE;
+                    setter = setter + attributeParam;
+                    break;
+                }
+                case MAP:
+                    attributeParam = MAP.toLowerCase() + SPACE + OF + SPACE;
+                    setter = setter + attributeParam;
+                    break;
+                default: {
+
+                }
+            }
+        } else if (isList) {
+            attributeParam = LIST.toLowerCase() + SPACE + OF + SPACE;
+            setter = setter + attributeParam;
+        } else {
+            setter = setter + VALUE + SPACE + OF + SPACE;
+        }
+        return setter;
+    }
+
+    /**
+     * Generates javaDocs for of method.
+     *
+     * @param attribute attribute
+     * @return javaDocs
+     */
+    private static String generateForOf(String attribute) {
+        return getJavaDocStartLine(attribute, JAVA_DOC_OF) +
+                getJavaDocEmptyAsteriskLine() +
+                getJavaDocParamLine(attribute, VALUE) +
+                getJavaDocReturnLine(attribute) +
+                getJavaDocEndLine();
+    }
+
+    /**
+     * Generates javaDocs for from method.
+     *
+     * @param attribute attribute
+     * @return javaDocs
+     */
+    private static String generateForFromString(String attribute) {
+        return getJavaDocStartLine(attribute, JAVA_DOC_OF
+                + attribute + SPACE + FROM_STRING_METHOD_NAME + SPACE + INPUT +
+                SPACE + STRING_DATA_TYPE + SPACE) +
+                getJavaDocEmptyAsteriskLine() +
+                getJavaDocParamLine(INPUT + SPACE + STRING_DATA_TYPE,
+                                    FROM_STRING_PARAM_NAME) +
+                getJavaDocReturnLine(attribute) +
+                getJavaDocEndLine();
+    }
+
+    /**
+     * Generates javaDocs for typedef setter method.
+     *
+     * @param attribute attribute
+     * @return javaDocs
+     */
+    private static String generateForTypeDefSetter(String attribute) {
+        return getJavaDocStartLine(attribute, JAVA_DOC_SETTERS_COMMON) +
+                getJavaDocEmptyAsteriskLine() +
+                getJavaDocParamLine(attribute, VALUE) +
+                getJavaDocEndLine();
+    }
+
+    /**
+     * Generates javaDocs for the impl class.
+     *
+     * @param className         class name
+     * @param isForDefaultClass if javadoc is for default class
+     * @return javaDocs
+     */
+    private static String generateForClass(String className, boolean isForDefaultClass) {
+        return getJavaDocForDefaultClass(className, IMPL_CLASS_JAVA_DOC,
+                                         EMPTY_STRING, isForDefaultClass);
+    }
+
+    private static String addFlagJavaDoc() {
+        return " *\n" +
+                " * <p>\n" +
+                " * valueLeafFlags identify the leafs whose value are " +
+                "explicitly set\n" +
+                " * Applicable in protocol edit and query operation.\n" +
+                " * </p>\n" +
+                " *\n" +
+                " * <p>\n" +
+                " * selectLeafFlags identify the leafs to be selected, in" +
+                " a query operation.\n" +
+                " * </p>\n" +
+                " *\n" +
+                " * <p>\n" +
+                " * Operation type specify the node specific operation in" +
+                " protocols like NETCONF.\n" +
+                " * Applicable in protocol edit operation, not applicable" +
+                " in query operation.\n" +
+                " * </p>\n";
+    }
+
+    /**
+     * Generates javaDocs for enum.
+     *
+     * @param className enum class name
+     * @return javaDocs
+     */
+    private static String generateForEnum(String className) {
+        return getJavaDocForClass(className, ENUM_CLASS_JAVADOC, EMPTY_STRING);
+    }
+
+    /**
+     * Generates javaDocs for the builder class.
+     *
+     * @param className class name
+     * @return javaDocs
+     */
+    private static String generateForBuilderClass(String className) {
+        return getJavaDocForClass(className, BUILDER_CLASS_JAVA_DOC,
+                                  EMPTY_STRING);
+    }
+
+    /**
+     * Generates javaDocs for the op param class.
+     *
+     * @param className class name
+     * @return javaDocs
+     */
+    private static String generateForOpParamClass(String className) {
+        return getJavaDocForClass(className, OP_PARAM_JAVA_DOC,
+                                  EMPTY_STRING);
+    }
+
+    /**
+     * Generates javaDoc for the interface.
+     *
+     * @param interfaceName interface name
+     * @return javaDocs
+     */
+    private static String generateForInterface(String interfaceName) {
+        return getJavaDocForClass(interfaceName, INTERFACE_JAVA_DOC,
+                                  EMPTY_STRING);
+    }
+
+    /**
+     * Generates javaDoc for the builder interface.
+     *
+     * @param builderForName builder for name
+     * @return javaDocs
+     */
+    private static String generateForBuilderInterface(String builderForName) {
+        return getJavaDocForClass(builderForName, BUILDER_INTERFACE_JAVA_DOC,
+                                  EMPTY_STRING);
+    }
+
+    /**
+     * Generates javaDocs for package-info.
+     *
+     * @param packageName package name
+     * @param isChildNode is it child node
+     * @return javaDocs
+     */
+    private static String generateForPackage(String packageName, boolean isChildNode) {
+        if (isChildNode) {
+            return getJavaDocForClass(
+                    packageName + PACKAGE_INFO_JAVADOC_OF_CHILD,
+                    PACKAGE_INFO_JAVADOC, EMPTY_STRING);
+        }
+        return getJavaDocForClass(packageName, PACKAGE_INFO_JAVADOC, EMPTY_STRING);
+    }
+
+    /**
+     * Generates javaDocs for default constructor.
+     *
+     * @param className class name
+     * @return javaDocs
+     */
+    private static String generateForDefaultConstructors(String className) {
+        return getJavaDocStartLine(className, JAVA_DOC_CONSTRUCTOR) +
+                getJavaDocEndLine();
+    }
+
+    /**
+     * Generates javaDocs for constructor with parameters.
+     *
+     * @param className class name
+     * @return javaDocs
+     */
+    private static String generateForConstructors(String className) {
+        return getJavaDocStartLine(className, JAVA_DOC_CONSTRUCTOR) +
+                getJavaDocEmptyAsteriskLine() +
+                getJavaDocParamLine(BUILDER_OBJECT + className,
+                                    BUILDER_LOWER_CASE + OBJECT) +
+                getJavaDocEndLine();
+    }
+
+    /**
+     * Generates javaDocs for build.
+     *
+     * @param buildName builder name
+     * @return javaDocs
+     */
+    private static String generateForBuild(String buildName) {
+        return getJavaDocStartLine(buildName, JAVA_DOC_BUILD) +
+                getJavaDocEmptyAsteriskLine() +
+                getJavaDocReturnLine(buildName) +
+                getJavaDocEndLine();
+    }
+
+    /**
+     * Generates javaDocs for type constructor.
+     *
+     * @param attribute attribute string
+     * @return javaDocs for type constructor
+     */
+    private static String generateForTypeConstructor(String attribute) {
+        return getJavaDocStartLine(attribute,
+                                   JAVA_DOC_CONSTRUCTOR) +
+                getJavaDocEmptyAsteriskLine() +
+                getJavaDocParamLine(attribute, attribute) +
+                getJavaDocEndLine();
+    }
+
+    /**
+     * Generates javaDocs for add augmentation method.
+     *
+     * @param name builder class name
+     * @return javaDocs
+     */
+    public static String generateForAddAugmentation(String name) {
+        return getJavaDocStartLine(YANG_AUGMENTED_INFO_LOWER_CASE,
+                                   JAVA_DOC_SETTERS_COMMON) +
+                getJavaDocEmptyAsteriskLine() +
+                getJavaDocParamLine(YANG_AUGMENTED_INFO_LOWER_CASE, VALUE) +
+                getJavaDocParamLine(YANG_AUGMENTED_INFO_LOWER_CASE, CLASS +
+                        OBJECT_STRING) +
+                getJavaDocReturnLine(name) + getJavaDocEndLine();
+    }
+
+    /**
+     * Returns javadoc for get augmentation method.
+     *
+     * @return javadoc for get augmentation method
+     */
+    public static String generateForGetAugmentation() {
+        return NEW_LINE + getJavaDocStartLine(YANG_AUGMENTED_INFO_LOWER_CASE,
+                                              JAVA_DOC_GETTERS) +
+                getJavaDocEmptyAsteriskLine() +
+                getJavaDocParamLine(YANG_AUGMENTED_INFO_LOWER_CASE, CLASS +
+                        OBJECT_STRING) +
+                getJavaDocReturnLine(YANG_AUGMENTED_INFO) +
+                getJavaDocEndLine();
+    }
+
+    /**
+     * Returns javadoc for validator method.
+     *
+     * @return javadoc for validator method
+     */
+    public static String generateForValidatorMethod() {
+        return getJavaDocStartLine(VALIDATE_RANGE, JAVA_DOC_FOR_VALIDATOR) +
+                getJavaDocEmptyAsteriskLine() +
+                getJavaDocParamLine(MIN_RANGE, MIN_RANGE) +
+                getJavaDocParamLine(MAX_RANGE, MIN_RANGE) +
+                getJavaDocReturnLine(JAVA_DOC_FOR_VALIDATOR_RETURN) +
+                getJavaDocEndLine();
+    }
+
+    /**
+     * Generates javaDocs for type constructor.
+     *
+     * @param attribute attribute string
+     * @return javaDocs for type constructor
+     */
+    public static String generateForGetMethodWithAttribute(String attribute) {
+        attribute = getSmallCase(attribute);
+        return getJavaDocStartLine(attribute, JAVA_DOC_GETTERS) +
+                getJavaDocEmptyAsteriskLine() +
+                getJavaDocParamLine(attribute, attribute) +
+                getJavaDocReturnLine(attribute) +
+                getJavaDocEndLine();
+    }
+
+    /**
+     * Returns javaDocs for add to list method.
+     *
+     * @param attribute  attribute
+     * @param annotation compile annotation
+     * @return javaDocs
+     */
+    private static String generateForAddToList(String attribute, String annotation) {
+        StringBuilder javadoc = new StringBuilder();
+        javadoc.append(getJavaDocStartLine(attribute, JAVA_DOC_ADD_TO_LIST))
+                .append(getJavaDocEmptyAsteriskLine());
+        if (annotation != null) {
+            annotation = annotation.toLowerCase();
+            annotation = getCapitalCase(annotation);
+            switch (annotation) {
+                case MAP:
+                    javadoc.append(getJavaDocParamLine(
+                            attribute, attribute + KEYS)).append(getJavaDocParamLine(
+                            attribute, attribute + VALUE_CAPS));
+                    break;
+                default:
+                    javadoc.append(getJavaDocParamLine(
+                            attribute, ADD_STRING + TO_CAPS));
+                    break;
+            }
+        }
+        javadoc.append(getJavaDocParamLine(
+                attribute, ADD_STRING + TO_CAPS))
+                .append(getJavaDocReturnLine(BUILDER_OBJECT + attribute))
+                .append(getJavaDocEndLine());
+        return javadoc.toString();
+    }
+
+    /**
+     * Generates for builder method.
+     *
+     * @param attribute attribute
+     * @return javaDocs
+     */
+    public static String generateForBuilderMethod(String attribute) {
+        return getJavaDocStartLine(attribute + BUILDER, JAVA_DOC_GETTERS) +
+                getJavaDocEmptyAsteriskLine() +
+                getJavaDocReturnLine(attribute + BUILDER) +
+                getJavaDocEndLine();
+    }
+
+    /**
+     * Returns class javadoc.
+     *
+     * @param name   name of class
+     * @param type   type of javadoc
+     * @param indent indentation
+     * @return class javadoc
+     */
+    private static String getJavaDocForClass(String name, String type,
+                                             String indent) {
+        return NEW_LINE + indent + JAVA_DOC_FIRST_LINE + indent + type +
+                getSmallCase(name) + PERIOD + NEW_LINE + indent + JAVA_DOC_END_LINE;
+    }
+
+    /**
+     * Returns class javadoc.
+     *
+     * @param name              name of class
+     * @param type              type of javadoc
+     * @param indent            indentation
+     * @param isForDefaultClass if javadoc is generated for default class
+     * @return class javadoc
+     */
+    private static String getJavaDocForDefaultClass(String name, String type,
+                                                    String indent, boolean isForDefaultClass) {
+        String append = addFlagJavaDoc();
+        if (!isForDefaultClass) {
+            append = EMPTY_STRING;
+        }
+        return NEW_LINE + indent + JAVA_DOC_FIRST_LINE + indent + type +
+                getSmallCase(name) + PERIOD + NEW_LINE + indent + append +
+                JAVA_DOC_END_LINE;
+    }
+
+    /**
+     * Returns javadoc start line.
+     *
+     * @param name    name of attribute
+     * @param javaDoc type of javadoc
+     * @return javadoc start line
+     */
+    private static String getJavaDocStartLine(String name, String javaDoc) {
+        return FOUR_SPACE_INDENTATION + JAVA_DOC_FIRST_LINE +
+                FOUR_SPACE_INDENTATION + javaDoc + getSmallCase(name) +
+                PERIOD + NEW_LINE;
+    }
+
+    /**
+     * Returns asterisk line.
+     *
+     * @return asterisk line
+     */
+    private static String getJavaDocEmptyAsteriskLine() {
+        return FOUR_SPACE_INDENTATION + NEW_LINE_ASTERISK;
+    }
+
+    /**
+     * Returns javadoc param line.
+     *
+     * @param name name of attribute
+     * @return javadoc param line
+     */
+    private static String getJavaDocParamLine(String name, String paraName) {
+        return FOUR_SPACE_INDENTATION + JAVA_DOC_PARAM +
+                getSmallCase(paraName) + SPACE + VALUE + SPACE + OF + SPACE +
+                getSmallCase(name) + NEW_LINE;
+    }
+
+    /**
+     * Returns javadoc return line.
+     *
+     * @param name name of attribute
+     * @return javadoc return line
+     */
+    private static String getJavaDocReturnLine(String name) {
+        return FOUR_SPACE_INDENTATION + JAVA_DOC_RETURN + getSmallCase(name)
+                + NEW_LINE;
+    }
+
+    /**
+     * Returns javadoc end line.
+     *
+     * @return javadoc end line
+     */
+    private static String getJavaDocEndLine() {
+        return FOUR_SPACE_INDENTATION + JAVA_DOC_END_LINE;
+    }
+
+
+    /**
+     * JavaDocs types.
+     */
+    public enum JavaDocType {
+
+        /**
+         * For class.
+         */
+        DEFAULT_CLASS,
+
+        /**
+         * For builder class.
+         */
+        BUILDER_CLASS,
+
+        /**
+         * For interface.
+         */
+        INTERFACE,
+
+        /**
+         * For builder interface.
+         */
+        BUILDER_INTERFACE,
+
+        /**
+         * For package-info.
+         */
+        PACKAGE_INFO,
+
+        /**
+         * For getters.
+         */
+        GETTER_METHOD,
+
+        /**
+         * For rpc service.
+         */
+        RPC_INTERFACE,
+
+        /**
+         * For rpc manager.
+         */
+        RPC_MANAGER,
+
+        /**
+         * For event.
+         */
+        EVENT,
+
+        /**
+         * For event listener.
+         */
+        EVENT_LISTENER,
+
+        /**
+         * For setters.
+         */
+        SETTER_METHOD,
+
+        /**
+         * For type def's setters.
+         */
+        TYPE_DEF_SETTER_METHOD,
+
+        /**
+         * For of method.
+         */
+        OF_METHOD,
+
+        /**
+         * For default constructor.
+         */
+        DEFAULT_CONSTRUCTOR,
+
+        /**
+         * For constructor.
+         */
+        CONSTRUCTOR,
+
+        /**
+         * For from method.
+         */
+        FROM_METHOD,
+
+        /**
+         * For type constructor.
+         */
+        TYPE_CONSTRUCTOR,
+
+        /**
+         * For build.
+         */
+        BUILD_METHOD,
+
+        /**
+         * For enum.
+         */
+        ENUM_CLASS,
+
+        /**
+         * For enum's attributes.
+         */
+        ENUM_ATTRIBUTE,
+
+        /**
+         * For manager setters.
+         */
+        MANAGER_SETTER_METHOD,
+
+        /**
+         * For event subject.
+         */
+        EVENT_SUBJECT_CLASS,
+
+        /**
+         * For operation.
+         */
+        OPERATION_CLASS,
+
+        /**
+         * For operation builder.
+         */
+        OPERATION_BUILDER_CLASS,
+
+        /**
+         * For add to list.
+         */
+        ADD_TO_LIST,
+    }
+}
diff --git a/compiler/base/utils/src/main/java/org/onosproject/yang/compiler/utils/io/impl/YangFileScanner.java b/compiler/base/utils/src/main/java/org/onosproject/yang/compiler/utils/io/impl/YangFileScanner.java
new file mode 100644
index 0000000..0358e4f
--- /dev/null
+++ b/compiler/base/utils/src/main/java/org/onosproject/yang/compiler/utils/io/impl/YangFileScanner.java
@@ -0,0 +1,105 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.utils.io.impl;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Stack;
+
+/**
+ * Represents utility for searching the files in a directory.
+ */
+public final class YangFileScanner {
+
+    private static final String JAVA_FILE_EXTENSION = ".java";
+    private static final String YANG_FILE_EXTENSION = ".yang";
+
+    /**
+     * Creates an instance of YANG file scanner.
+     */
+    private YangFileScanner() {
+    }
+
+    /**
+     * Returns the list of java files.
+     *
+     * @param root specified directory
+     * @return list of java files
+     * @throws NullPointerException when no files are there.
+     * @throws IOException          when files get deleted while performing the
+     *                              operations
+     */
+    public static List<String> getJavaFiles(String root) throws IOException {
+        return getFiles(root, JAVA_FILE_EXTENSION);
+    }
+
+    /**
+     * Returns the list of YANG file.
+     *
+     * @param root specified directory
+     * @return list of YANG file information
+     * @throws NullPointerException when no files are there
+     * @throws IOException          when files get deleted while performing the
+     *                              operations
+     */
+    public static List<String> getYangFiles(String root) throws IOException {
+        return getFiles(root, YANG_FILE_EXTENSION);
+    }
+
+    /**
+     * Returns the list of required files.
+     *
+     * @param root      specified directory
+     * @param extension file extension
+     * @return list of required files
+     * @throws NullPointerException when no file is there
+     * @throws IOException          when files get deleted while performing the operations
+     */
+    private static List<String> getFiles(String root, String extension) throws IOException {
+
+        List<String> store = new LinkedList<>();
+        Stack<String> stack = new Stack<>();
+        stack.push(root);
+        File file;
+        File[] fileList;
+        try {
+            while (!stack.empty()) {
+                root = stack.pop();
+                file = new File(root);
+                fileList = file.listFiles();
+                if ((fileList == null) || (fileList.length == 0)) {
+                    continue;
+                }
+                for (File current : fileList) {
+                    if (current.isDirectory()) {
+                        stack.push(current.toString());
+                    } else {
+                        String yangFile = current.getCanonicalPath();
+                        if (yangFile.endsWith(extension)) {
+                            store.add(yangFile);
+                        }
+                    }
+                }
+            }
+            return store;
+        } catch (IOException e) {
+            throw new IOException("No File found of " + extension + " extension in " + root + " directory.");
+        }
+    }
+}
diff --git a/compiler/base/utils/src/main/java/org/onosproject/yang/compiler/utils/io/impl/YangIoUtils.java b/compiler/base/utils/src/main/java/org/onosproject/yang/compiler/utils/io/impl/YangIoUtils.java
new file mode 100644
index 0000000..f284c7d
--- /dev/null
+++ b/compiler/base/utils/src/main/java/org/onosproject/yang/compiler/utils/io/impl/YangIoUtils.java
@@ -0,0 +1,898 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.utils.io.impl;
+
+import org.apache.commons.io.FileUtils;
+import org.onosproject.yang.compiler.utils.io.YangToJavaNamingConflictUtil;
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Stack;
+import java.util.regex.Pattern;
+
+import static java.lang.Integer.parseInt;
+import static org.onosproject.yang.compiler.utils.UtilConstants.CLOSE_PARENTHESIS;
+import static org.onosproject.yang.compiler.utils.UtilConstants.COLON;
+import static org.onosproject.yang.compiler.utils.UtilConstants.EIGHT_SPACE_INDENTATION;
+import static org.onosproject.yang.compiler.utils.UtilConstants.EMPTY_STRING;
+import static org.onosproject.yang.compiler.utils.UtilConstants.HYPHEN;
+import static org.onosproject.yang.compiler.utils.UtilConstants.JAVA_KEY_WORDS;
+import static org.onosproject.yang.compiler.utils.UtilConstants.NEW_LINE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.ONE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.OPEN_CURLY_BRACKET;
+import static org.onosproject.yang.compiler.utils.UtilConstants.OPEN_PARENTHESIS;
+import static org.onosproject.yang.compiler.utils.UtilConstants.ORG;
+import static org.onosproject.yang.compiler.utils.UtilConstants.PACKAGE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.PERIOD;
+import static org.onosproject.yang.compiler.utils.UtilConstants.REGEX_FOR_DIGITS_WITH_SINGLE_LETTER;
+import static org.onosproject.yang.compiler.utils.UtilConstants.REGEX_FOR_FIRST_DIGIT;
+import static org.onosproject.yang.compiler.utils.UtilConstants.REGEX_FOR_HYPHEN;
+import static org.onosproject.yang.compiler.utils.UtilConstants.REGEX_FOR_IDENTIFIER_SPECIAL_CHAR;
+import static org.onosproject.yang.compiler.utils.UtilConstants.REGEX_FOR_PERIOD;
+import static org.onosproject.yang.compiler.utils.UtilConstants.REGEX_FOR_SINGLE_LETTER;
+import static org.onosproject.yang.compiler.utils.UtilConstants.REGEX_FOR_UNDERSCORE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.REGEX_WITH_ALL_SPECIAL_CHAR;
+import static org.onosproject.yang.compiler.utils.UtilConstants.REGEX_WITH_DIGITS;
+import static org.onosproject.yang.compiler.utils.UtilConstants.REGEX_WITH_SINGLE_CAPITAL_CASE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.REGEX_WITH_SINGLE_CAPITAL_CASE_AND_DIGITS_SMALL_CASES;
+import static org.onosproject.yang.compiler.utils.UtilConstants.REGEX_WITH_UPPERCASE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.SEMI_COLON;
+import static org.onosproject.yang.compiler.utils.UtilConstants.SLASH;
+import static org.onosproject.yang.compiler.utils.UtilConstants.SPACE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.TEMP;
+import static org.onosproject.yang.compiler.utils.UtilConstants.TWELVE_SPACE_INDENTATION;
+import static org.onosproject.yang.compiler.utils.UtilConstants.UNDER_SCORE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.UNUSED;
+import static org.onosproject.yang.compiler.utils.UtilConstants.YANG_AUTO_PREFIX;
+import static org.onosproject.yang.compiler.utils.io.impl.CopyrightHeader.parseCopyrightHeader;
+import static org.onosproject.yang.compiler.utils.io.impl.JavaDocGen.JavaDocType.PACKAGE_INFO;
+import static org.onosproject.yang.compiler.utils.io.impl.JavaDocGen.getJavaDoc;
+
+/**
+ * Represents common utility functionalities for code generation.
+ */
+public final class YangIoUtils {
+
+    private static final int LINE_SIZE = 118;
+    private static final int SUB_LINE_SIZE = 116;
+    private static final int SUB_SIZE = 60;
+
+    /**
+     * Creates an instance of YANG io utils.
+     */
+    private YangIoUtils() {
+    }
+
+    /**
+     * Creates the directory structure.
+     *
+     * @param path directory path
+     * @return directory structure
+     * @throws IOException when fails to do IO operations
+     */
+    public static File createDirectories(String path)
+            throws IOException {
+        File generatedDir = new File(path);
+        if (!generatedDir.exists()) {
+            boolean isGenerated = generatedDir.mkdirs();
+            if (!isGenerated) {
+                throw new IOException("failed to generated directory " + path);
+            }
+        }
+        return generatedDir;
+    }
+
+    /**
+     * Adds package info file for the created directory.
+     *
+     * @param path        directory path
+     * @param classInfo   class info for the package
+     * @param pack        package of the directory
+     * @param isChildNode is it a child node
+     * @throws IOException when fails to create package info file
+     */
+    public static void addPackageInfo(File path, String classInfo, String pack,
+                                      boolean isChildNode) throws IOException {
+
+        pack = parsePkg(pack);
+        try {
+
+            File packageInfo = new File(path + SLASH + "package-info.java");
+            if (!packageInfo.exists()) {
+                boolean isGenerated = packageInfo.createNewFile();
+                if (!isGenerated) {
+                    throw new IOException("failed to generated package-info " +
+                                                  path);
+                }
+            }
+            FileWriter fileWriter = new FileWriter(packageInfo);
+            BufferedWriter bufferedWriter = new BufferedWriter(fileWriter);
+
+            bufferedWriter.write(parseCopyrightHeader());
+            //TODO: get the compiler annotations and pass the info
+            bufferedWriter.write(getJavaDoc(PACKAGE_INFO, classInfo, isChildNode,
+                                            null));
+            String pkg = PACKAGE + SPACE + pack + SEMI_COLON;
+            if (pkg.length() >= LINE_SIZE) {
+                pkg = processModifications(pkg, LINE_SIZE);
+            }
+            bufferedWriter.write(pkg);
+            bufferedWriter.close();
+            fileWriter.close();
+        } catch (IOException e) {
+            throw new IOException("Exception occurred while creating package info" +
+                                          " file.");
+        }
+    }
+
+    /**
+     * Parses package and returns updated package.
+     *
+     * @param pack package needs to be updated
+     * @return updated package
+     */
+    public static String parsePkg(String pack) {
+
+        if (pack.contains(ORG)) {
+            String[] strArray = pack.split(ORG);
+            if (strArray.length >= 3) {
+                for (int i = 1; i < strArray.length; i++) {
+                    if (i == 1) {
+                        pack = ORG + strArray[1];
+                    } else {
+                        pack = pack + ORG + strArray[i];
+                    }
+                }
+            } else {
+                pack = ORG + strArray[1];
+            }
+        }
+
+        return pack;
+    }
+
+    /**
+     * Cleans the generated directory if already exist in source folder.
+     *
+     * @param dir generated directory in previous build
+     * @throws IOException when failed to delete directory
+     */
+    public static void deleteDirectory(String dir)
+            throws IOException {
+        File generatedDirectory = new File(dir);
+        if (generatedDirectory.exists()) {
+            try {
+                FileUtils.deleteDirectory(generatedDirectory);
+            } catch (IOException e) {
+                throw new IOException(
+                        "Failed to delete the generated files in " +
+                                generatedDirectory + " directory");
+            }
+        }
+    }
+
+    /**
+     * Searches and deletes generated temporary directories.
+     *
+     * @param root root directory
+     * @throws IOException when fails to do IO operations.
+     */
+    public static void searchAndDeleteTempDir(String root)
+            throws IOException {
+        List<File> store = new LinkedList<>();
+        Stack<String> stack = new Stack<>();
+        stack.push(root);
+
+        while (!stack.empty()) {
+            root = stack.pop();
+            File file = new File(root);
+            File[] fileList = file.listFiles();
+            if (fileList == null || fileList.length == 0) {
+                continue;
+            }
+            for (File current : fileList) {
+                if (current.isDirectory()) {
+                    stack.push(current.toString());
+                    if (current.getName().endsWith(HYPHEN + TEMP)) {
+                        store.add(current);
+                    }
+                }
+            }
+        }
+
+        for (File dir : store) {
+            FileUtils.deleteDirectory(dir);
+        }
+    }
+
+    /**
+     * Removes extra char from the string.
+     *
+     * @param valueString   string to be trimmed
+     * @param removalString extra chars
+     * @return new string
+     */
+    public static String trimAtLast(String valueString, String...
+            removalString) {
+        StringBuilder stringBuilder = new StringBuilder(valueString);
+        String midString;
+        int index;
+        for (String remove : removalString) {
+            midString = stringBuilder.toString();
+            index = midString.lastIndexOf(remove);
+            if (index != -1) {
+                stringBuilder.deleteCharAt(index);
+            }
+        }
+        return stringBuilder.toString();
+    }
+
+    /**
+     * Replaces the last occurrence of a string with a given string.
+     *
+     * @param valueString     string under operation
+     * @param removalString   string to be replaced
+     * @param replacingString string with which replacement is to be done
+     * @return new string
+     */
+    public static String replaceLast(String valueString, String removalString,
+                                     String replacingString) {
+        StringBuilder stringBuilder = new StringBuilder(valueString);
+        int index = valueString.lastIndexOf(removalString);
+        if (index != -1) {
+            stringBuilder.replace(index, index + 1, replacingString);
+        } else {
+            stringBuilder.append(NEW_LINE + EIGHT_SPACE_INDENTATION + UNUSED +
+                                         OPEN_PARENTHESIS + ONE +
+                                         CLOSE_PARENTHESIS + SEMI_COLON);
+        }
+        return stringBuilder.toString();
+
+        // TODO remove generation of ENUM if there is no leaf node.
+    }
+
+
+    /**
+     * Returns the directory path of the package in canonical form.
+     *
+     * @param baseCodeGenPath base path where the generated files needs to be
+     *                        put
+     * @param pathOfJavaPkg   java package of the file being generated
+     * @return absolute path of the package in canonical form
+     */
+    public static String getDirectory(String baseCodeGenPath, String pathOfJavaPkg) {
+
+        if (pathOfJavaPkg.charAt(pathOfJavaPkg.length() - 1) == File.separatorChar) {
+            pathOfJavaPkg = trimAtLast(pathOfJavaPkg, SLASH);
+        }
+        String[] strArray = pathOfJavaPkg.split(SLASH);
+        if (strArray[0].equals(EMPTY_STRING)) {
+            return pathOfJavaPkg;
+        } else {
+            return baseCodeGenPath + SLASH + pathOfJavaPkg;
+        }
+    }
+
+    /**
+     * Returns the absolute path of the package in canonical form.
+     *
+     * @param baseCodeGenPath base path where the generated files needs to be
+     *                        put
+     * @param pathOfJavaPkg   java package of the file being generated
+     * @return absolute path of the package in canonical form
+     */
+    public static String getAbsolutePackagePath(String baseCodeGenPath,
+                                                String pathOfJavaPkg) {
+        return baseCodeGenPath + pathOfJavaPkg;
+    }
+
+    /**
+     * Merges the temp java files to main java files.
+     *
+     * @param appendFile temp file
+     * @param srcFile    main file
+     * @throws IOException when fails to append contents
+     */
+    public static void mergeJavaFiles(File appendFile, File srcFile)
+            throws IOException {
+        try {
+            FileSystemUtil.appendFileContents(appendFile, srcFile);
+        } catch (IOException e) {
+            throw new IOException("Failed to merge " + appendFile + " in " +
+                                          srcFile);
+        }
+    }
+
+    /**
+     * Inserts data in the generated file.
+     *
+     * @param file file in which need to be inserted
+     * @param data data which need to be inserted
+     * @throws IOException when fails to insert into file
+     */
+    public static void insertDataIntoJavaFile(File file, String data)
+            throws IOException {
+        try {
+            FileSystemUtil.updateFileHandle(file, data, false);
+        } catch (IOException e) {
+            throw new IOException("Failed to insert in " + file + "file");
+        }
+    }
+
+    /**
+     * Validates a line size in given file whether it is having more then 120 characters.
+     * If yes it will update and give a new file.
+     *
+     * @param dataFile file in which need to verify all lines.
+     * @return updated file
+     * @throws IOException when fails to do IO operations.
+     */
+    public static File validateLineLength(File dataFile)
+            throws IOException {
+        FileReader fileReader = new FileReader(dataFile);
+        BufferedReader bufferReader = new BufferedReader(fileReader);
+        try {
+            StringBuilder stringBuilder = new StringBuilder();
+            String line = bufferReader.readLine();
+
+            while (line != null) {
+                if (line.length() >= LINE_SIZE) {
+                    line = processModifications(line, LINE_SIZE);
+                }
+                stringBuilder.append(line);
+                stringBuilder.append(NEW_LINE);
+                line = bufferReader.readLine();
+            }
+            FileWriter writer = new FileWriter(dataFile);
+            writer.write(stringBuilder.toString());
+            writer.close();
+            return dataFile;
+        } finally {
+            fileReader.close();
+            bufferReader.close();
+        }
+    }
+
+    /**
+     * Resolves validation of line length by modifying the string.
+     *
+     * @param line     current line string
+     * @param lineSize line size for change
+     * @return modified line string
+     */
+    private static String processModifications(String line, int lineSize) {
+        int period = getArrayLength(line, PERIOD);
+        int space = getArrayLength(line, SPACE);
+        if (period > space) {
+            return merge(getForPeriod(line), PERIOD, lineSize);
+        }
+        return merge(getForSpace(line), SPACE, lineSize);
+    }
+
+    /**
+     * Returns count of pattern in line.
+     *
+     * @param line    line string
+     * @param pattern pattern followed in line
+     * @return count of pattern in line
+     */
+    private static int getArrayLength(String line, String pattern) {
+        String[] array = line.split(Pattern.quote(pattern));
+        int len = array.length;
+        if (pattern.equals(SPACE)) {
+            for (String str : array) {
+                if (str.equals(EMPTY_STRING)) {
+                    len--;
+                }
+            }
+        }
+        return len - 1;
+    }
+
+    /**
+     * Returns array list of string in case of period.
+     *
+     * @param line line string
+     * @return array list of string in case of period
+     */
+    private static ArrayList<String> getForPeriod(String line) {
+        String[] array = line.split(Pattern.quote(PERIOD));
+        return getSplitArray(array, PERIOD);
+    }
+
+    /**
+     * Returns array list of string in case of space.
+     *
+     * @param line line string
+     * @return array list of string in case of space
+     */
+    private static ArrayList<String> getForSpace(String line) {
+        String[] array = line.split(SPACE);
+        return getSplitArray(array, SPACE);
+    }
+
+    /**
+     * Merges strings to form a new string.
+     *
+     * @param list     list of strings
+     * @param pattern  pattern
+     * @param lineSize line size
+     * @return merged string
+     */
+    private static String merge(ArrayList<String> list, String pattern, int lineSize) {
+        StringBuilder builder = new StringBuilder();
+        StringBuilder fine = new StringBuilder();
+        String append;
+        String pre;
+        String present = EMPTY_STRING;
+        //Add one blank string in list to handle border limit cases.
+        list.add(EMPTY_STRING);
+        Iterator<String> listIt = list.iterator();
+        ArrayList<String> arrayList = new ArrayList<>();
+        int length;
+        StringBuilder spaces = new StringBuilder();
+        while (listIt.hasNext()) {
+            pre = present;
+            present = listIt.next();
+            //check is present string is more than 80 char.
+            if (present.length() > SUB_SIZE) {
+                int period = getArrayLength(present, PERIOD);
+                int space = getArrayLength(present, SPACE);
+                if (period > space) {
+                    // in such case present string should be resolved.
+                    present = processModifications(present, SUB_SIZE);
+                    builder.append(present);
+                }
+            }
+            length = builder.length();
+            //If length of builder is less than the given length then append
+            // it to builder.
+            if (length <= lineSize) {
+                //fill the space builder to provide proper indentation.
+                if (present.equals(EMPTY_STRING)) {
+                    spaces.append(SPACE);
+                }
+                //append to builder
+                builder.append(present);
+                builder.append(pattern);
+                fine.append(pre);
+                //do not append pattern in case of empty strings.
+                if (!pre.equals(EMPTY_STRING)) {
+                    fine.append(pattern);
+                }
+            } else {
+                // now the length is more than given size so trim the pattern
+                // for the string and add it to list,
+                fine = getReplacedString(fine, pattern);
+                arrayList.add(fine.toString());
+                // clear all.
+                builder.delete(0, length);
+                fine.delete(0, fine.length());
+                // append indentation
+                if (pattern.contains(PERIOD)) {
+                    append = NEW_LINE + spaces +
+                            TWELVE_SPACE_INDENTATION +
+                            PERIOD;
+                } else {
+                    append = NEW_LINE + spaces + TWELVE_SPACE_INDENTATION;
+                }
+                // builder needs to move one step forward to fine builder so
+                // append present and pre strings to builder with pattern.
+                builder.append(append);
+                builder.append(pre);
+                builder.append(pattern);
+                builder.append(present);
+                builder.append(pattern);
+                fine.append(append);
+                fine.append(pre);
+                if (!pre.equals(EMPTY_STRING)) {
+                    fine.append(pattern);
+                }
+            }
+        }
+
+        builder = getReplacedString(builder, pattern);
+
+        //need to remove extra string added from the builder.
+        if (builder.toString().lastIndexOf(pattern) == builder.length() - 1) {
+            builder = getReplacedString(builder, pattern);
+        }
+        arrayList.add(builder.toString());
+        fine.delete(0, fine.length());
+        for (String str : arrayList) {
+            fine.append(str);
+        }
+        //No need to append extra spaces.
+        if (pattern.equals(PERIOD)) {
+            return fine.toString();
+        }
+        return spaces + fine.toString();
+    }
+
+    /**
+     * Trims extra pattern strings for builder string.
+     *
+     * @param builder builder
+     * @param pattern pattern
+     * @return modified string
+     */
+    private static StringBuilder getReplacedString(StringBuilder builder, String
+            pattern) {
+        String temp = builder.toString();
+        temp = trimAtLast(temp, pattern);
+        int length = builder.length();
+        builder.delete(0, length);
+        builder.append(temp);
+        return builder;
+    }
+
+    /**
+     * Creates array list to process line string modification.
+     *
+     * @param array   array of strings
+     * @param pattern pattern
+     * @return list to process line string modification
+     */
+    private static ArrayList<String> getSplitArray(String[] array, String pattern) {
+        ArrayList<String> newArray = new ArrayList<>();
+        int count = 0;
+        String temp;
+        for (String str : array) {
+            if (!str.contains(OPEN_CURLY_BRACKET)) {
+                if (str.length() >= SUB_LINE_SIZE) {
+                    count = getSplitString(str, newArray, count);
+                } else {
+                    newArray.add(str);
+                    count++;
+                }
+            } else {
+                if (newArray.isEmpty()) {
+                    newArray.add(str);
+                } else {
+                    temp = newArray.get(count - 1);
+                    newArray.remove(count - 1);
+                    newArray.add(count - 1, temp + pattern + str);
+                }
+            }
+        }
+
+        return newArray;
+    }
+
+    private static int getSplitString(String str,
+                                      ArrayList<String> newArray, int count) {
+        String[] array = str.split(SPACE);
+        for (String st : array) {
+            newArray.add(st + SPACE);
+            count++;
+        }
+        return count;
+    }
+
+    /**
+     * Returns the java Package from package path.
+     *
+     * @param packagePath package path
+     * @return java package
+     */
+    public static String getJavaPackageFromPackagePath(String packagePath) {
+        return packagePath.replace(SLASH, PERIOD);
+    }
+
+    /**
+     * Returns the directory path corresponding to java package.
+     *
+     * @param packagePath package path
+     * @return java package
+     */
+    public static String getPackageDirPathFromJavaJPackage(String packagePath) {
+        return packagePath.replace(PERIOD, SLASH);
+    }
+
+    /**
+     * Returns the YANG identifier name as java identifier with first letter
+     * in small.
+     *
+     * @param yangIdentifier identifier in YANG file.
+     * @return corresponding java identifier
+     */
+    public static String getSmallCase(String yangIdentifier) {
+        return yangIdentifier.substring(0, 1).toLowerCase() + yangIdentifier.substring(1);
+    }
+
+    /**
+     * Returns the YANG identifier name as java identifier with first letter
+     * in capital.
+     *
+     * @param yangIdentifier identifier in YANG file
+     * @return corresponding java identifier
+     */
+    public static String getCapitalCase(String yangIdentifier) {
+        yangIdentifier = yangIdentifier.substring(0, 1).toUpperCase() + yangIdentifier.substring(1);
+        return restrictConsecutiveCapitalCase(yangIdentifier);
+    }
+
+    /**
+     * Restricts consecutive capital cased string as a rule in camel case.
+     *
+     * @param consecCapitalCaseRemover which requires the restriction of consecutive capital case
+     * @return string without consecutive capital case
+     */
+    private static String restrictConsecutiveCapitalCase(String consecCapitalCaseRemover) {
+
+        for (int k = 0; k < consecCapitalCaseRemover.length(); k++) {
+            if (k + 1 < consecCapitalCaseRemover.length()) {
+                if (Character.isUpperCase(consecCapitalCaseRemover.charAt(k))) {
+                    if (Character.isUpperCase(consecCapitalCaseRemover.charAt(k + 1))) {
+                        consecCapitalCaseRemover = consecCapitalCaseRemover.substring(0, k + 1)
+                                + consecCapitalCaseRemover.substring(k + 1, k + 2).toLowerCase()
+                                + consecCapitalCaseRemover.substring(k + 2);
+                    }
+                }
+            }
+        }
+        return consecCapitalCaseRemover;
+    }
+
+    /**
+     * Adds prefix, if the string begins with digit or is a java key word.
+     *
+     * @param camelCasePrefix  string for adding prefix
+     * @param conflictResolver object of YANG to java naming conflict util
+     * @return prefixed camel case string
+     */
+    private static String addPrefix(String camelCasePrefix, YangToJavaNamingConflictUtil conflictResolver) {
+
+        String prefix = getPrefixForIdentifier(conflictResolver);
+        if (camelCasePrefix.matches(REGEX_FOR_FIRST_DIGIT)) {
+            camelCasePrefix = prefix + camelCasePrefix;
+        }
+        if (JAVA_KEY_WORDS.contains(camelCasePrefix)) {
+            camelCasePrefix = prefix + camelCasePrefix.substring(0, 1).toUpperCase()
+                    + camelCasePrefix.substring(1);
+        }
+        return camelCasePrefix;
+    }
+
+    /**
+     * Applies the rule that a string does not end with a capitalized letter and capitalizes
+     * the letter next to a number in an array.
+     *
+     * @param stringArray      containing strings for camel case separation
+     * @param conflictResolver object of YANG to java naming conflict util
+     * @return camel case rule checked string
+     */
+    private static String applyCamelCaseRule(String[] stringArray,
+                                             YangToJavaNamingConflictUtil conflictResolver) {
+
+        String ruleChecker = stringArray[0].toLowerCase();
+        int i;
+        if (ruleChecker.matches(REGEX_FOR_FIRST_DIGIT)) {
+            i = 0;
+            ruleChecker = EMPTY_STRING;
+        } else {
+            i = 1;
+        }
+        for (; i < stringArray.length; i++) {
+            if (i + 1 == stringArray.length) {
+                if (stringArray[i].matches(REGEX_FOR_SINGLE_LETTER)
+                        || stringArray[i].matches(REGEX_FOR_DIGITS_WITH_SINGLE_LETTER)) {
+                    ruleChecker = ruleChecker + stringArray[i].toLowerCase();
+                    break;
+                }
+            }
+            if (stringArray[i].matches(REGEX_FOR_FIRST_DIGIT)) {
+                for (int j = 0; j < stringArray[i].length(); j++) {
+                    char letterCheck = stringArray[i].charAt(j);
+                    if (Character.isLetter(letterCheck)) {
+                        stringArray[i] = stringArray[i].substring(0, j)
+                                + stringArray[i].substring(j, j + 1).toUpperCase() + stringArray[i].substring(j + 1);
+                        break;
+                    }
+                }
+                ruleChecker = ruleChecker + stringArray[i];
+            } else {
+                ruleChecker = ruleChecker + stringArray[i].substring(0, 1).toUpperCase() + stringArray[i].substring(1);
+            }
+        }
+        String ruleCheckerWithPrefix = addPrefix(ruleChecker, conflictResolver);
+        return restrictConsecutiveCapitalCase(ruleCheckerWithPrefix);
+    }
+
+    /**
+     * Resolves the conflict when input has upper case.
+     *
+     * @param stringArray      containing strings for upper case conflict resolver
+     * @param conflictResolver object of YANG to java naming conflict util
+     * @return camel cased string
+     */
+    private static String upperCaseConflictResolver(String[] stringArray,
+                                                    YangToJavaNamingConflictUtil conflictResolver) {
+
+        for (int l = 0; l < stringArray.length; l++) {
+            String[] upperCaseSplitArray = stringArray[l].split(REGEX_WITH_UPPERCASE);
+            for (int m = 0; m < upperCaseSplitArray.length; m++) {
+                if (upperCaseSplitArray[m].matches(REGEX_WITH_SINGLE_CAPITAL_CASE)) {
+                    int check = m;
+                    while (check + 1 < upperCaseSplitArray.length) {
+                        if (upperCaseSplitArray[check + 1].matches(REGEX_WITH_SINGLE_CAPITAL_CASE)) {
+                            upperCaseSplitArray[check + 1] = upperCaseSplitArray[check + 1].toLowerCase();
+                            check = check + 1;
+                        } else if (upperCaseSplitArray[check + 1]
+                                .matches(REGEX_WITH_SINGLE_CAPITAL_CASE_AND_DIGITS_SMALL_CASES)) {
+                            upperCaseSplitArray[check + 1] = upperCaseSplitArray[check + 1].toLowerCase();
+                            break;
+                        } else {
+                            break;
+                        }
+                    }
+                }
+            }
+            StringBuilder strBuilder = new StringBuilder();
+            for (String element : upperCaseSplitArray) {
+                strBuilder.append(element);
+            }
+            stringArray[l] = strBuilder.toString();
+        }
+        List<String> result = new ArrayList<>();
+        for (String element : stringArray) {
+            String[] capitalCaseSplitArray = element.split(REGEX_WITH_UPPERCASE);
+            for (String letter : capitalCaseSplitArray) {
+                String[] arrayForAddition = letter.split(REGEX_WITH_DIGITS);
+                List<String> list = Arrays.asList(arrayForAddition);
+                for (String str : list) {
+                    if (str != null && !str.isEmpty()) {
+                        result.add(str);
+                    }
+                }
+            }
+        }
+        stringArray = result.toArray(new String[result.size()]);
+        return applyCamelCaseRule(stringArray, conflictResolver);
+    }
+
+    /**
+     * Returns the YANG identifier name as java identifier.
+     *
+     * @param yangIdentifier   identifier in YANG file
+     * @param conflictResolver object of YANG to java naming conflict util
+     * @return corresponding java identifier
+     */
+    public static String getCamelCase(String yangIdentifier, YangToJavaNamingConflictUtil conflictResolver) {
+
+        if (conflictResolver != null) {
+            String replacementForHyphen = conflictResolver.getReplacementForHyphen();
+            String replacementForPeriod = conflictResolver.getReplacementForPeriod();
+            String replacementForUnderscore = conflictResolver.getReplacementForUnderscore();
+            if (replacementForPeriod != null) {
+                yangIdentifier = yangIdentifier.replaceAll(REGEX_FOR_PERIOD,
+                                                           PERIOD + replacementForPeriod.toLowerCase() + PERIOD);
+            }
+            if (replacementForUnderscore != null) {
+                yangIdentifier = yangIdentifier.replaceAll(REGEX_FOR_UNDERSCORE,
+                                                           UNDER_SCORE + replacementForUnderscore.toLowerCase() +
+                                                                   UNDER_SCORE);
+            }
+            if (replacementForHyphen != null) {
+                yangIdentifier = yangIdentifier.replaceAll(REGEX_FOR_HYPHEN,
+                                                           HYPHEN + replacementForHyphen.toLowerCase() + HYPHEN);
+            }
+        }
+        yangIdentifier = yangIdentifier.replaceAll(REGEX_FOR_IDENTIFIER_SPECIAL_CHAR, COLON);
+        String[] strArray = yangIdentifier.split(COLON);
+        if (strArray[0].isEmpty()) {
+            List<String> stringArrangement = new ArrayList<>();
+            stringArrangement.addAll(Arrays.asList(strArray).subList(1, strArray.length));
+            strArray = stringArrangement.toArray(new String[stringArrangement.size()]);
+        }
+        return upperCaseConflictResolver(strArray, conflictResolver);
+    }
+
+    /**
+     * Prefix for adding with identifier and namespace, when it is a java keyword or starting with digits.
+     *
+     * @param conflictResolver object of YANG to java naming conflict util
+     * @return prefix which needs to be added
+     */
+    public static String getPrefixForIdentifier(YangToJavaNamingConflictUtil conflictResolver) {
+
+        String prefixForIdentifier = null;
+        if (conflictResolver != null) {
+            prefixForIdentifier = conflictResolver.getPrefixForIdentifier();
+        }
+        if (prefixForIdentifier != null) {
+            prefixForIdentifier = prefixForIdentifier.replaceAll
+                    (REGEX_WITH_ALL_SPECIAL_CHAR, COLON);
+            String[] strArray = prefixForIdentifier.split(COLON);
+            try {
+                if (strArray[0].isEmpty()) {
+                    List<String> stringArrangement = new ArrayList<>();
+                    stringArrangement.addAll(Arrays.asList(strArray).subList(1, strArray.length));
+                    strArray = stringArrangement.toArray(new String[stringArrangement.size()]);
+                }
+                prefixForIdentifier = strArray[0];
+                for (int j = 1; j < strArray.length; j++) {
+                    prefixForIdentifier = prefixForIdentifier + strArray[j].substring(0, 1).toUpperCase() +
+                            strArray[j].substring(1);
+                }
+            } catch (ArrayIndexOutOfBoundsException outOfBoundsException) {
+                throw new ArrayIndexOutOfBoundsException("The given prefix in pom.xml is invalid.");
+            }
+        } else {
+            prefixForIdentifier = YANG_AUTO_PREFIX;
+        }
+        return prefixForIdentifier;
+    }
+
+    /**
+     * Removes empty directory.
+     *
+     * @param path path to be checked
+     */
+    public static void removeEmptyDirectory(String path) {
+        int index;
+        while (path != null && !path.isEmpty()) {
+            if (!removeDirectory(path)) {
+                break;
+            } else {
+                index = path.lastIndexOf(SLASH);
+                path = path.substring(0, index);
+            }
+        }
+    }
+
+    private static boolean removeDirectory(String path) {
+        File dir = new File(path);
+        boolean isDeleted = false;
+        if (dir.isDirectory()) {
+            File[] files = dir.listFiles();
+            if (files != null && files.length == 0) {
+                isDeleted = dir.delete();
+            } else if (files != null && files.length == 1) {
+                if ("package-info.java".equals(files[0].getName())
+                        || files[0].getName().endsWith("-temp")) {
+                    isDeleted = dir.delete();
+                }
+            }
+        }
+        return isDeleted;
+    }
+
+    /**
+     * Converts string to integer number for maven version.
+     *
+     * @param ver version
+     * @return int value of version
+     */
+    public static int getVersionValue(String ver) {
+        String[] array = ver.split(Pattern.quote(PERIOD));
+        StringBuilder builder = new StringBuilder();
+        for (String str : array) {
+            builder.append(str);
+        }
+        return parseInt(builder.toString());
+    }
+}
diff --git a/compiler/base/utils/src/main/java/org/onosproject/yang/compiler/utils/io/impl/package-info.java b/compiler/base/utils/src/main/java/org/onosproject/yang/compiler/utils/io/impl/package-info.java
new file mode 100644
index 0000000..8f7a46f
--- /dev/null
+++ b/compiler/base/utils/src/main/java/org/onosproject/yang/compiler/utils/io/impl/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.
+ */
+
+/**
+ * File system utilities implementation.
+ */
+package org.onosproject.yang.compiler.utils.io.impl;
diff --git a/compiler/base/utils/src/main/java/org/onosproject/yang/compiler/utils/io/package-info.java b/compiler/base/utils/src/main/java/org/onosproject/yang/compiler/utils/io/package-info.java
new file mode 100644
index 0000000..464214b
--- /dev/null
+++ b/compiler/base/utils/src/main/java/org/onosproject/yang/compiler/utils/io/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.
+ */
+
+/**
+ * File system utilities.
+ */
+package org.onosproject.yang.compiler.utils.io;
diff --git a/compiler/base/utils/src/main/java/org/onosproject/yang/compiler/utils/package-info.java b/compiler/base/utils/src/main/java/org/onosproject/yang/compiler/utils/package-info.java
new file mode 100644
index 0000000..ba648af
--- /dev/null
+++ b/compiler/base/utils/src/main/java/org/onosproject/yang/compiler/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 YANG maven plugin.
+ */
+package org.onosproject.yang.compiler.utils;
diff --git a/compiler/base/utils/src/main/resources/CopyrightHeader.txt b/compiler/base/utils/src/main/resources/CopyrightHeader.txt
new file mode 100644
index 0000000..2cbed45
--- /dev/null
+++ b/compiler/base/utils/src/main/resources/CopyrightHeader.txt
@@ -0,0 +1,14 @@
+ *
+ * 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.
+ */
+
diff --git a/compiler/base/utils/src/test/java/org/onosproject/yang/compiler/utils/UtilConstantsTest.java b/compiler/base/utils/src/test/java/org/onosproject/yang/compiler/utils/UtilConstantsTest.java
new file mode 100644
index 0000000..7e9c8ce
--- /dev/null
+++ b/compiler/base/utils/src/test/java/org/onosproject/yang/compiler/utils/UtilConstantsTest.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.utils;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.onosproject.yang.compiler.utils.UtilConstants;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+
+import static org.hamcrest.core.IsNot.not;
+import static org.junit.Assert.assertThat;
+
+/**
+ * Test case for testing the util constants.
+ */
+public final class UtilConstantsTest {
+
+    @Rule
+    public ExpectedException thrown = ExpectedException.none();
+
+    /**
+     * A private constructor is tested.
+     *
+     * @throws SecurityException if any security violation is observed
+     * @throws NoSuchMethodException if when the method is not found
+     * @throws IllegalArgumentException if there is illegal argument found
+     * @throws InstantiationException if instantiation is provoked for the private constructor
+     * @throws IllegalAccessException if instance is provoked or a method is provoked
+     * @throws InvocationTargetException when an exception occurs by the method or constructor
+     */
+    @Test
+    public void callPrivateConstructors() throws SecurityException, NoSuchMethodException, IllegalArgumentException,
+            InstantiationException, IllegalAccessException, InvocationTargetException {
+
+        Class<?>[] classesToConstruct = {UtilConstants.class };
+        for (Class<?> clazz : classesToConstruct) {
+            Constructor<?> constructor = clazz.getDeclaredConstructor();
+            constructor.setAccessible(true);
+            assertThat(null, not(constructor.newInstance()));
+        }
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/utils/src/test/java/org/onosproject/yang/compiler/utils/io/impl/CopyrightHeaderTest.java b/compiler/base/utils/src/test/java/org/onosproject/yang/compiler/utils/io/impl/CopyrightHeaderTest.java
new file mode 100644
index 0000000..e29240f
--- /dev/null
+++ b/compiler/base/utils/src/test/java/org/onosproject/yang/compiler/utils/io/impl/CopyrightHeaderTest.java
@@ -0,0 +1,103 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.utils.io.impl;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.onosproject.yang.compiler.utils.io.impl.CopyrightHeader;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.util.Calendar;
+
+import static org.apache.commons.io.FileUtils.contentEquals;
+import static org.hamcrest.core.Is.is;
+import static org.hamcrest.core.IsNot.not;
+import static org.junit.Assert.assertThat;
+
+public final class CopyrightHeaderTest {
+
+    private static final String COPYRIGHTS_FIRST_LINE = "/*\n * Copyright " + Calendar.getInstance().get(Calendar.YEAR)
+            + "-present Open Networking Laboratory\n";
+    @Rule
+    public ExpectedException thrown = ExpectedException.none();
+
+    /**
+     * Unit test for testing private constructor.
+     *
+     * @throws SecurityException if any security violation is observed
+     * @throws NoSuchMethodException if when the method is not found
+     * @throws IllegalArgumentException if there is illegal argument found
+     * @throws InstantiationException if instantiation is provoked for the private constructor
+     * @throws IllegalAccessException if instance is provoked or a method is provoked
+     * @throws InvocationTargetException when an exception occurs by the method or constructor
+     */
+    @Test
+    public void callPrivateConstructors() throws SecurityException, NoSuchMethodException, IllegalArgumentException,
+            InstantiationException, IllegalAccessException, InvocationTargetException {
+
+        Class<?>[] classesToConstruct = {CopyrightHeader.class };
+        for (Class<?> clazz : classesToConstruct) {
+            Constructor<?> constructor = clazz.getDeclaredConstructor();
+            constructor.setAccessible(true);
+            assertThat(null, not(constructor.newInstance()));
+        }
+    }
+
+    /**
+     * This test case checks the received copyright header contents.
+     *
+     * @throws IOException when fails to do IO operations
+     */
+    @Test
+    public void testGetCopyrightHeader() throws IOException {
+
+        String path = "src/test/resources/CopyrightHeader.txt";
+
+        File testRsc = new File(path);
+        FileInputStream in = new FileInputStream(testRsc);
+
+        File testFile = new File("target/TestHeader.txt");
+        FileOutputStream out = new FileOutputStream(testFile);
+
+        out.write(COPYRIGHTS_FIRST_LINE.getBytes());
+        int c = 0;
+        while ((c = in.read()) != -1) {
+            out.write(c);
+        }
+
+        String licenseHeader = CopyrightHeader.parseCopyrightHeader();
+        File test = new File("target/TestCopyrightHeader.txt");
+
+        FileWriter writer = new FileWriter(test);
+        writer.write(licenseHeader);
+        writer.close();
+        out.close();
+        out.flush();
+        in.close();
+
+        assertThat(true, is(contentEquals(test, testFile)));
+        test.delete();
+        testFile.delete();
+    }
+}
\ No newline at end of file
diff --git a/compiler/base/utils/src/test/java/org/onosproject/yang/compiler/utils/io/impl/FileSystemUtilTest.java b/compiler/base/utils/src/test/java/org/onosproject/yang/compiler/utils/io/impl/FileSystemUtilTest.java
new file mode 100644
index 0000000..f16ca88
--- /dev/null
+++ b/compiler/base/utils/src/test/java/org/onosproject/yang/compiler/utils/io/impl/FileSystemUtilTest.java
@@ -0,0 +1,89 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.utils.io.impl;
+
+import org.apache.commons.io.FileUtils;
+import org.junit.Test;
+import org.onosproject.yang.compiler.utils.UtilConstants;
+
+import java.io.File;
+import java.io.IOException;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+
+import static org.apache.commons.io.FileUtils.deleteDirectory;
+import static org.hamcrest.core.IsNot.not;
+import static org.junit.Assert.assertThat;
+
+/**
+ * Tests the file handle utilities.
+ */
+public final class FileSystemUtilTest {
+
+    private static final String BASE_PKG = "target/UnitTestCase";
+    private static final String TEST_DATA_1 = "This is to append a text to the file first1\n";
+    private static final String TEST_DATA_2 = "This is next second line\n";
+    private static final String TEST_DATA_3 = "This is next third line in the file";
+    private static final String TEST_FILE = "testFile";
+    private static final String SOURCE_TEST_FILE = "sourceTestFile";
+
+    /**
+     * A private constructor is tested.
+     *
+     * @throws SecurityException         if any security violation is observed
+     * @throws NoSuchMethodException     if when the method is not found
+     * @throws IllegalArgumentException  if there is illegal argument found
+     * @throws InstantiationException    if instantiation is provoked for the private constructor
+     * @throws IllegalAccessException    if instance is provoked or a method is provoked
+     * @throws InvocationTargetException when an exception occurs by the method or constructor
+     */
+    @Test
+    public void callPrivateConstructors()
+            throws SecurityException, NoSuchMethodException, IllegalArgumentException,
+            InstantiationException, IllegalAccessException, InvocationTargetException {
+
+        Class<?>[] classesToConstruct = {FileSystemUtil.class};
+        for (Class<?> clazz : classesToConstruct) {
+            Constructor<?> constructor = clazz.getDeclaredConstructor();
+            constructor.setAccessible(true);
+            assertThat(null, not(constructor.newInstance()));
+        }
+    }
+
+    /**
+     * This test case checks the contents to be written in the file.
+     *
+     * @throws IOException when fails to create a test file
+     */
+    @Test
+    public void updateFileHandleTest() throws IOException {
+
+        File dir = new File(BASE_PKG + UtilConstants.SLASH + TEST_FILE);
+        dir.mkdirs();
+        File createFile = new File(dir + TEST_FILE);
+        createFile.createNewFile();
+        File createSourceFile = new File(dir + SOURCE_TEST_FILE);
+        createSourceFile.createNewFile();
+        FileSystemUtil.updateFileHandle(createFile, TEST_DATA_1, false);
+        FileSystemUtil.updateFileHandle(createFile, TEST_DATA_2, false);
+        FileSystemUtil.updateFileHandle(createFile, TEST_DATA_3, false);
+        FileSystemUtil.appendFileContents(createFile, createSourceFile);
+        FileSystemUtil.updateFileHandle(createFile, null, true);
+        deleteDirectory(dir);
+        FileUtils.deleteDirectory(new File(BASE_PKG));
+    }
+}
diff --git a/compiler/base/utils/src/test/java/org/onosproject/yang/compiler/utils/io/impl/JavaDocGenTest.java b/compiler/base/utils/src/test/java/org/onosproject/yang/compiler/utils/io/impl/JavaDocGenTest.java
new file mode 100644
index 0000000..9da07d0
--- /dev/null
+++ b/compiler/base/utils/src/test/java/org/onosproject/yang/compiler/utils/io/impl/JavaDocGenTest.java
@@ -0,0 +1,210 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.utils.io.impl;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.onosproject.yang.compiler.utils.io.YangPluginConfig;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+
+import static org.hamcrest.core.Is.is;
+import static org.hamcrest.core.IsNot.not;
+import static org.junit.Assert.assertThat;
+import static org.onosproject.yang.compiler.utils.io.impl.JavaDocGen.JavaDocType.BUILDER_CLASS;
+import static org.onosproject.yang.compiler.utils.io.impl.JavaDocGen.JavaDocType.BUILDER_INTERFACE;
+import static org.onosproject.yang.compiler.utils.io.impl.JavaDocGen.JavaDocType.BUILD_METHOD;
+import static org.onosproject.yang.compiler.utils.io.impl.JavaDocGen.JavaDocType.CONSTRUCTOR;
+import static org.onosproject.yang.compiler.utils.io.impl.JavaDocGen.JavaDocType.DEFAULT_CLASS;
+import static org.onosproject.yang.compiler.utils.io.impl.JavaDocGen.JavaDocType.DEFAULT_CONSTRUCTOR;
+import static org.onosproject.yang.compiler.utils.io.impl.JavaDocGen.JavaDocType.GETTER_METHOD;
+import static org.onosproject.yang.compiler.utils.io.impl.JavaDocGen.JavaDocType.INTERFACE;
+import static org.onosproject.yang.compiler.utils.io.impl.JavaDocGen.JavaDocType.PACKAGE_INFO;
+import static org.onosproject.yang.compiler.utils.io.impl.JavaDocGen.JavaDocType.SETTER_METHOD;
+import static org.onosproject.yang.compiler.utils.io.impl.JavaDocGen.JavaDocType.TYPE_DEF_SETTER_METHOD;
+import static org.onosproject.yang.compiler.utils.io.impl.JavaDocGen.getJavaDoc;
+
+/**
+ * Tests the java doc that is generated.
+ */
+public final class JavaDocGenTest {
+
+    private static final String TEST_NAME = "testName";
+    private static final String END_STRING = " */\n";
+
+    @Rule
+    public ExpectedException thrown = ExpectedException.none();
+
+    /**
+     * This test case checks the content received for the builder class java doc.
+     */
+    @Test
+    public void builderClassGenerationTest() {
+        String builderClassJavaDoc = getJavaDoc(BUILDER_CLASS, TEST_NAME, false, null);
+        assertThat(true, is(builderClassJavaDoc.contains("Represents the builder implementation of")
+                                    && builderClassJavaDoc.contains(END_STRING)));
+    }
+
+    /**
+     * This test case checks the content received for the builder interface ge java doc.
+     */
+    @Test
+    public void builderInterfaceGenerationTest() {
+        String builderInterfaceJavaDoc = getJavaDoc(BUILDER_INTERFACE, TEST_NAME, false, null);
+        assertThat(true,
+                   is(builderInterfaceJavaDoc.contains("Builder for")
+                              && builderInterfaceJavaDoc.contains(END_STRING)));
+    }
+
+    /**
+     * This test case checks the content received for the build  java doc.
+     */
+    @Test
+    public void buildGenerationTest() {
+        String buildDoc = getJavaDoc(BUILD_METHOD, TEST_NAME, false, null);
+        assertThat(true, is(buildDoc.contains("Builds object of") && buildDoc.contains(END_STRING)));
+    }
+
+    /**
+     * A private constructor is tested.
+     *
+     * @throws SecurityException         if any security violation is observed
+     * @throws NoSuchMethodException     if when the method is not found
+     * @throws IllegalArgumentException  if there is illegal argument found
+     * @throws InstantiationException    if instantiation is provoked for the private constructor
+     * @throws IllegalAccessException    if instance is provoked or a method is provoked
+     * @throws InvocationTargetException when an exception occurs by the method or constructor
+     */
+    @Test
+    public void callPrivateConstructors()
+            throws SecurityException, NoSuchMethodException, IllegalArgumentException,
+            InstantiationException, IllegalAccessException, InvocationTargetException {
+
+        Class<?>[] classesToConstruct = {JavaDocGen.class};
+        for (Class<?> clazz : classesToConstruct) {
+            Constructor<?> constructor = clazz.getDeclaredConstructor();
+            constructor.setAccessible(true);
+            assertThat(null, not(constructor.newInstance()));
+        }
+    }
+
+    /**
+     * This test case checks the content received for the constructor java doc.
+     */
+    @Test
+    public void constructorGenerationTest() {
+        String constructorDoc = getJavaDoc(CONSTRUCTOR, TEST_NAME, false, null);
+        assertThat(true,
+                   is(constructorDoc.contains("Creates an instance of ")
+                              && constructorDoc.contains("builder object of")
+                              && constructorDoc.contains("@param") && constructorDoc.contains("*/\n")));
+    }
+
+    /**
+     * This test case checks the content received for the default constructor java doc.
+     */
+    @Test
+    public void defaultConstructorGenerationTest() {
+        String defaultConstructorDoc = getJavaDoc(DEFAULT_CONSTRUCTOR, TEST_NAME, false, null);
+        assertThat(true, is(defaultConstructorDoc.contains("Creates an instance of ")
+                                    && defaultConstructorDoc.contains(END_STRING)));
+    }
+
+    /**
+     * This test case checks the content received for the getter java doc.
+     */
+    @Test
+    public void getterGenerationTest() {
+        String getterJavaDoc = getJavaDoc(GETTER_METHOD, TEST_NAME, false, null);
+        assertThat(true,
+                   is(getterJavaDoc.contains("Returns the attribute") && getterJavaDoc.contains(END_STRING)));
+    }
+
+    /**
+     * This test case checks the content received for the impl class java doc.
+     */
+    @Test
+    public void implClassGenerationTest() {
+        String implClassJavaDoc = getJavaDoc(DEFAULT_CLASS, TEST_NAME, false, null);
+        assertThat(true,
+                   is(implClassJavaDoc.contains("Represents the implementation of")
+                              && implClassJavaDoc.contains(END_STRING)));
+    }
+
+    /**
+     * This test case checks the content received for the interface java doc.
+     */
+    @Test
+    public void interfaceGenerationTest() {
+        String interfaceJavaDoc = getJavaDoc(INTERFACE, TEST_NAME, false, null);
+        assertThat(true,
+                   is(interfaceJavaDoc.contains("Abstraction of an entity which represents the functionality of")
+                              && interfaceJavaDoc.contains(END_STRING)));
+    }
+
+    /**
+     * This test case checks the content received for the package info  java doc.
+     */
+    @Test
+    public void packageInfoGenerationTest() {
+        String packageInfo = getJavaDoc(PACKAGE_INFO, TEST_NAME, false, null);
+        assertThat(true,
+                   is(packageInfo.contains("Implementation of YANG node") && packageInfo.contains(END_STRING)));
+    }
+
+    /**
+     * This test case checks the content received for the package info  java doc.
+     */
+    @Test
+    public void packageInfoGenerationForChildNodeTest() {
+        String packageInfo = getJavaDoc(PACKAGE_INFO, TEST_NAME, true, null);
+        assertThat(true, is(packageInfo.contains("Implementation of YANG node testName's children nodes")
+                                    && packageInfo.contains(END_STRING)));
+    }
+
+    /**
+     * This test case checks the content received for the setter java doc.
+     */
+    @Test
+    public void setterGenerationTest() {
+        String setterJavaDoc = getJavaDoc(SETTER_METHOD, TEST_NAME, false, null);
+        assertThat(true,
+                   is(setterJavaDoc.contains("Returns the builder object of") && setterJavaDoc.contains(END_STRING)));
+    }
+
+    /**
+     * This test case checks the content received for the typedef setter java doc.
+     */
+    @Test
+    public void typeDefSetterGenerationTest() {
+        String typeDefSetter = getJavaDoc(TYPE_DEF_SETTER_METHOD, TEST_NAME, false, null);
+        assertThat(true, is(typeDefSetter.contains("Sets the value of") && typeDefSetter.contains(END_STRING)));
+    }
+
+    /**
+     * Returns stub pluginConfig.
+     *
+     * @return stub pluginConfig
+     */
+    private YangPluginConfig getStubPluginConfig() {
+        YangPluginConfig pluginConfig = new YangPluginConfig();
+        pluginConfig.setConflictResolver(null);
+        return pluginConfig;
+    }
+}
diff --git a/compiler/base/utils/src/test/java/org/onosproject/yang/compiler/utils/io/impl/YangFileScannerTest.java b/compiler/base/utils/src/test/java/org/onosproject/yang/compiler/utils/io/impl/YangFileScannerTest.java
new file mode 100644
index 0000000..7fa5d10
--- /dev/null
+++ b/compiler/base/utils/src/test/java/org/onosproject/yang/compiler/utils/io/impl/YangFileScannerTest.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.yang.compiler.utils.io.impl;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+
+import java.io.File;
+import java.io.IOException;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.util.LinkedList;
+import java.util.List;
+
+import static java.io.File.separator;
+import static org.apache.commons.io.FileUtils.deleteDirectory;
+import static org.hamcrest.core.Is.is;
+import static org.hamcrest.core.IsNot.not;
+import static org.junit.Assert.assertThat;
+import static org.onosproject.yang.compiler.utils.io.impl.YangFileScanner.getJavaFiles;
+import static org.onosproject.yang.compiler.utils.io.impl.YangFileScanner.getYangFiles;
+
+/**
+ * Test the file scanner service.
+ */
+public final class YangFileScannerTest {
+
+    @Rule
+    public ExpectedException thrown = ExpectedException.none();
+
+    String baseDir = "target/UnitTestCase";
+
+    /**
+     * A private constructor is tested.
+     *
+     * @throws SecurityException         if any security violation is observed
+     * @throws NoSuchMethodException     if when the method is not found
+     * @throws IllegalArgumentException  if there is illegal argument found
+     * @throws InstantiationException    if instantiation is provoked for the private constructor
+     * @throws IllegalAccessException    if instance is provoked or a method is provoked
+     * @throws InvocationTargetException when an exception occurs by the method or constructor
+     */
+    @Test
+    public void callPrivateConstructors() throws SecurityException, NoSuchMethodException, IllegalArgumentException,
+            InstantiationException, IllegalAccessException, InvocationTargetException {
+
+        Class<?>[] classesToConstruct = {YangFileScanner.class};
+        for (Class<?> clazz : classesToConstruct) {
+            Constructor<?> constructor = clazz.getDeclaredConstructor();
+            constructor.setAccessible(true);
+            assertThat(null, not(constructor.newInstance()));
+        }
+    }
+
+    /**
+     * This test case checks for a .java file inside the specified dir.
+     *
+     * @throws IOException when fails to do IO operations
+     */
+    @Test
+    public void checkJavaFileInsideDirTest() throws IOException {
+
+        String dir = baseDir + separator + "scanner2";
+        File path = createDirectory(dir);
+        createFile(path, "testScanner.java");
+        List<String> dirContents = getJavaFiles(path.toString());
+        List<String> expectedContents = new LinkedList<>();
+        expectedContents.add(path.getCanonicalPath() + separator + "testScanner.java");
+        assertThat(true, is(dirContents.equals(expectedContents)));
+        deleteDirectory(path);
+    }
+
+    /**
+     * Method used for creating multiple directories inside the target file.
+     *
+     * @param path where directories should be created
+     * @return the directory path that is created
+     */
+    private File createDirectory(String path) {
+
+        File myDir = new File(path);
+        myDir.mkdirs();
+        return myDir;
+    }
+
+    /**
+     * Method used for creating file inside the specified directory.
+     *
+     * @param myDir    the path where file has to be created inside
+     * @param fileName the name of the file to be created
+     */
+    private void createFile(File myDir, String fileName) throws IOException {
+
+        File file = null;
+        file = new File(myDir + separator + fileName);
+        file.createNewFile();
+    }
+
+    /**
+     * This testcase checks for a java file inside an empty directory.
+     *
+     * @throws IOException when fails to do IO operations
+     */
+    @Test
+    public void emptyDirJavaScannerTest() throws IOException {
+
+        String emptyDir = baseDir + separator + "scanner1";
+        File path = createDirectory(emptyDir);
+        List<String> emptyDirContents = getJavaFiles(path.toString());
+        List<String> expectedContents = new LinkedList<>();
+        assertThat(true, is(emptyDirContents.equals(expectedContents)));
+        deleteDirectory(path);
+    }
+
+    /**
+     * This testcase checks for a yang file inside an empty directory.
+     *
+     * @throws IOException when fails to do IO operations
+     */
+    @Test
+    public void emptyDirYangScannerTest() throws IOException {
+
+        String emptyYangDir = baseDir + separator + "scanner1";
+        File path = createDirectory(emptyYangDir);
+        List<String> emptyDirContents = getYangFiles(path.toString());
+        List<String> expectedContents = new LinkedList<>();
+        assertThat(true, is(emptyDirContents.equals(expectedContents)));
+        deleteDirectory(path);
+    }
+
+    /**
+     * This test case checks with the sub directories in the given path for java files.
+     *
+     * @throws IOException when fails to do IO operations
+     */
+    @Test
+    public void emptySubDirScannerTest() throws IOException {
+
+        String dir = baseDir + separator + "scanner3";
+        File path = createDirectory(dir);
+        String subDir = path.toString() + separator + "subDir1";
+        createDirectory(subDir);
+        createFile(path, "invalidFile.txt");
+        List<String> emptySubDirContents = getJavaFiles(path.toString());
+        List<String> expectedContents = new LinkedList<>();
+        assertThat(true, is(emptySubDirContents.equals(expectedContents)));
+        deleteDirectory(path);
+    }
+}
diff --git a/compiler/base/utils/src/test/java/org/onosproject/yang/compiler/utils/io/impl/YangIoUtilsTest.java b/compiler/base/utils/src/test/java/org/onosproject/yang/compiler/utils/io/impl/YangIoUtilsTest.java
new file mode 100644
index 0000000..cebd190
--- /dev/null
+++ b/compiler/base/utils/src/test/java/org/onosproject/yang/compiler/utils/io/impl/YangIoUtilsTest.java
@@ -0,0 +1,193 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.utils.io.impl;
+
+import org.apache.commons.io.FileUtils;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.onosproject.yang.compiler.utils.UtilConstants;
+
+import java.io.File;
+import java.io.IOException;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+
+import static org.hamcrest.core.Is.is;
+import static org.hamcrest.core.IsNot.not;
+import static org.junit.Assert.assertThat;
+
+/**
+ * Unit tests for YANG IO utils.
+ */
+public final class YangIoUtilsTest {
+
+    private static final String BASE_DIR = "target/UnitTestCase";
+    private static final String CREATE_PATH = BASE_DIR + File.separator + "dir1/dir2/dir3/dir4/";
+    private static final String CHECK_STRING = "one, two, three, four, five, six";
+    private static final String TRIM_STRING = "one, two, three, four, five, ";
+    private static final String CHECK1 = "check1";
+    private static final String PKG_INFO = "package-info.java";
+    private static final String PATH = "src/main/yangmodel/";
+    private static final String MSG = "Exception occurred while creating package info file.";
+
+    /**
+     * Expected exceptions.
+     */
+    @Rule
+    public ExpectedException thrown = ExpectedException.none();
+
+    /**
+     * This test case checks whether the package-info file is created.
+     *
+     * @throws IOException when fails to do IO operations for test case
+     */
+    @Test
+    public void addPackageInfoTest() throws IOException {
+
+        File dirPath = new File(CREATE_PATH);
+        dirPath.mkdirs();
+        YangIoUtils.addPackageInfo(dirPath, CHECK1, CREATE_PATH, false);
+        File filePath = new File(dirPath + File.separator + PKG_INFO);
+        assertThat(filePath.isFile(), is(true));
+        FileUtils.deleteDirectory(new File(BASE_DIR));
+    }
+
+    /**
+     * This test case checks with an additional info in the path.
+     *
+     * @throws IOException when fails to do IO operations for test case
+     */
+    @Test
+    public void addPackageInfoWithPathTest() throws IOException {
+
+        File dirPath = new File(CREATE_PATH);
+        dirPath.mkdirs();
+        YangIoUtils.addPackageInfo(dirPath, CHECK1, PATH + CREATE_PATH, false);
+        File filePath = new File(dirPath + File.separator + PKG_INFO);
+        assertThat(filePath.isFile(), is(true));
+        FileUtils.deleteDirectory(new File(BASE_DIR));
+    }
+
+    /**
+     * This test case checks with a child node.
+     *
+     * @throws IOException when fails to do IO operations for test case
+     */
+    @Test
+    public void addPackageInfoWithChildNode() throws IOException {
+
+        File dirPath = new File(CREATE_PATH);
+        dirPath.mkdirs();
+        YangIoUtils.addPackageInfo(dirPath, CHECK1, PATH + CREATE_PATH, true);
+        File filePath = new File(dirPath + File.separator + PKG_INFO);
+        assertThat(filePath.isFile(), is(true));
+        FileUtils.deleteDirectory(new File(BASE_DIR));
+    }
+
+    /**
+     * This test case checks whether the package-info file is created when invalid path is given.
+     *
+     * @throws IOException when fails to do IO operations for test case
+     */
+    @Test
+    public void addPackageInfoWithEmptyPathTest() throws IOException {
+
+        File dirPath = new File("invalid/check");
+        thrown.expect(IOException.class);
+        thrown.expectMessage(MSG);
+        YangIoUtils.addPackageInfo(dirPath, CHECK1, CREATE_PATH, false);
+        File filePath1 = new File(dirPath + File.separator + PKG_INFO);
+        assertThat(filePath1.isFile(), is(false));
+        FileUtils.deleteDirectory(dirPath);
+        FileUtils.deleteDirectory(new File(BASE_DIR));
+    }
+
+    /**
+     * A private constructor is tested.
+     *
+     * @throws SecurityException         if any security violation is observed
+     * @throws NoSuchMethodException     if when the method is not found
+     * @throws IllegalArgumentException  if there is illegal argument found
+     * @throws InstantiationException    if instantiation is provoked for the private constructor
+     * @throws IllegalAccessException    if instance is provoked or a method is provoked
+     * @throws InvocationTargetException when an exception occurs by the method or constructor
+     */
+    @Test
+    public void callPrivateConstructors()
+            throws SecurityException, NoSuchMethodException, IllegalArgumentException,
+            InstantiationException, IllegalAccessException, InvocationTargetException {
+
+        Class<?>[] classesToConstruct = {YangIoUtils.class};
+        for (Class<?> clazz : classesToConstruct) {
+            Constructor<?> constructor = clazz.getDeclaredConstructor();
+            constructor.setAccessible(true);
+            assertThat(null, not(constructor.newInstance()));
+        }
+    }
+
+    /**
+     * This test case checks if the directory is cleaned.
+     *
+     * @throws IOException when fails to do IO operations for test case
+     */
+    @Test
+    public void cleanGeneratedDirTest() throws IOException {
+
+        File baseDirPath = new File(BASE_DIR);
+        File createNewDir = new File(BASE_DIR + File.separator + UtilConstants.YANG_GEN_DIR);
+        createNewDir.mkdirs();
+        File createFile = new File(createNewDir + File.separator + "check1.java");
+        createFile.createNewFile();
+        YangIoUtils.deleteDirectory(baseDirPath.getAbsolutePath());
+        FileUtils.deleteDirectory(createNewDir);
+        FileUtils.deleteDirectory(baseDirPath);
+    }
+
+    /**
+     * This test case checks the cleaning method when an invalid path is provided.
+     *
+     * @throws IOException when fails to do IO operations for test case
+     */
+    @Test
+    public void cleanWithInvalidDirTest() throws IOException {
+
+        File baseDirPath = new File(BASE_DIR + "invalid");
+        YangIoUtils.deleteDirectory(baseDirPath.getAbsolutePath());
+    }
+
+    /**
+     * This test case tests whether the directories are getting created.
+     */
+    @Test
+    public void createDirectoryTest() throws IOException {
+
+        File dirPath = YangIoUtils.createDirectories(CREATE_PATH);
+        assertThat(dirPath.isDirectory(), is(true));
+        FileUtils.deleteDirectory(new File(BASE_DIR));
+    }
+
+    /**
+     * Unit test case for trim at last method.
+     */
+    @Test
+    public void testForTrimAtLast() {
+
+        String test = YangIoUtils.trimAtLast(CHECK_STRING, "six");
+        assertThat(test.contains(TRIM_STRING), is(true));
+    }
+}
diff --git a/compiler/base/utils/src/test/resources/CopyrightHeader.txt b/compiler/base/utils/src/test/resources/CopyrightHeader.txt
new file mode 100644
index 0000000..2cbed45
--- /dev/null
+++ b/compiler/base/utils/src/test/resources/CopyrightHeader.txt
@@ -0,0 +1,14 @@
+ *
+ * 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.
+ */
+
diff --git a/compiler/plugin/buck/pom.xml b/compiler/plugin/buck/pom.xml
new file mode 100644
index 0000000..958a92d
--- /dev/null
+++ b/compiler/plugin/buck/pom.xml
@@ -0,0 +1,68 @@
+<!--
+  ~ 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-yang-compiler-plugin</artifactId>
+        <version>1.12-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>onos-yang-compiler-buck-plugin</artifactId>
+    <packaging>jar</packaging>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.onosproject</groupId>
+            <artifactId>buck-api</artifactId>
+            <version>0.1-SNAPSHOT</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.onosproject</groupId>
+            <artifactId>onos-yang-compiler-tool</artifactId>
+            <version>1.12-SNAPSHOT</version>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-shade-plugin</artifactId>
+                <version>2.4.3</version>
+                <executions>
+                    <execution>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>shade</goal>
+                        </goals>
+                    </execution>
+                </executions>
+                <configuration>
+                    <artifactSet>
+                        <excludes>
+                            <exclude>com.google.guava:guava</exclude>
+                        </excludes>
+                    </artifactSet>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>
diff --git a/compiler/plugin/buck/src/main/java/org/onosproject/yang/compiler/plugin/buck/YangGenerator.java b/compiler/plugin/buck/src/main/java/org/onosproject/yang/compiler/plugin/buck/YangGenerator.java
new file mode 100644
index 0000000..ea69169
--- /dev/null
+++ b/compiler/plugin/buck/src/main/java/org/onosproject/yang/compiler/plugin/buck/YangGenerator.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.yang.compiler.plugin.buck;
+
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.utils.DataModelUtils;
+import org.onosproject.yang.compiler.utils.io.YangPluginConfig;
+import org.onosproject.yang.compiler.base.tool.CallablePlugin;
+import org.onosproject.yang.compiler.base.tool.YangToolManager;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import static java.util.stream.Collectors.toList;
+import static org.onosproject.yang.compiler.utils.UtilConstants.SLASH;
+import static org.onosproject.yang.compiler.utils.UtilConstants.YANG_RESOURCES;
+
+/**
+ * Generates Java sources from a Yang model.
+ */
+public class YangGenerator implements CallablePlugin {
+
+    private final List<File> models;
+    private final List<String> depJar;
+    private final String DEFAULT_JAR_RES_PATH = SLASH + YANG_RESOURCES + SLASH;
+    private String outputDirectory;
+
+    YangGenerator(List<File> models, String outputDirectory, List<String> depJar) {
+        this.models = models;
+        this.depJar = depJar;
+        this.outputDirectory = outputDirectory + SLASH;
+    }
+
+    public void execute() throws YangParsingException {
+        List<String> files = getListOfFile();
+        synchronized (files) {
+            try {
+                YangPluginConfig config = new YangPluginConfig();
+                config.setCodeGenDir(outputDirectory);
+                config.resourceGenDir(outputDirectory + DEFAULT_JAR_RES_PATH);
+                //for inter-jar linking.
+                List<YangNode> dependentSchema = new ArrayList<>();
+                for (String jar : depJar) {
+                    dependentSchema.addAll(DataModelUtils.parseJarFile(jar, outputDirectory));
+                }
+                //intra jar file linking.
+                YangToolManager manager = new YangToolManager();
+                manager.compileYangFiles(manager.createYangFileInfoSet(files),
+                                         dependentSchema, config, this);
+            } catch (Exception e) {
+                throw new YangParsingException(e);
+            }
+        }
+    }
+
+    private List<String> getListOfFile() {
+        List<String> files = new ArrayList<>();
+        if (models != null) {
+            synchronized (models) {
+                files.addAll(models.stream().map(File::toString)
+                                     .collect(toList()));
+            }
+        }
+        return files;
+    }
+
+    @Override
+    public void addGeneratedCodeToBundle() {
+        //TODO: add functionality.
+    }
+
+    @Override
+    public void addCompiledSchemaToBundle() throws IOException {
+        //TODO: add functionality.
+    }
+
+    @Override
+    public void addYangFilesToBundle() throws IOException {
+        //TODO: add functionality.
+    }
+}
diff --git a/compiler/plugin/buck/src/main/java/org/onosproject/yang/compiler/plugin/buck/YangLibrary.java b/compiler/plugin/buck/src/main/java/org/onosproject/yang/compiler/plugin/buck/YangLibrary.java
new file mode 100644
index 0000000..0eed357
--- /dev/null
+++ b/compiler/plugin/buck/src/main/java/org/onosproject/yang/compiler/plugin/buck/YangLibrary.java
@@ -0,0 +1,129 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.plugin.buck;
+
+import com.facebook.buck.jvm.java.JarDirectoryStep;
+import com.facebook.buck.model.BuildTargets;
+import com.facebook.buck.rules.AbstractBuildRule;
+import com.facebook.buck.rules.AddToRuleKey;
+import com.facebook.buck.rules.BuildContext;
+import com.facebook.buck.rules.BuildRuleParams;
+import com.facebook.buck.rules.BuildableContext;
+import com.facebook.buck.rules.SourcePath;
+import com.facebook.buck.rules.SourcePathResolver;
+import com.facebook.buck.step.Step;
+import com.facebook.buck.step.fs.MakeCleanDirectoryStep;
+import com.facebook.buck.step.fs.MkdirStep;
+import com.facebook.buck.step.fs.RmStep;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableSortedSet;
+
+import javax.annotation.Nullable;
+import java.io.File;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.List;
+import java.util.stream.Collectors;
+
+import static org.onosproject.yang.compiler.utils.UtilConstants.SLASH;
+import static org.onosproject.yang.compiler.utils.UtilConstants.YANG;
+
+/**
+ * Buck rule to define a library built form a Yang model.
+ */
+public class YangLibrary extends AbstractBuildRule {
+
+    @AddToRuleKey
+    private final ImmutableSortedSet<SourcePath> srcs;
+    private final BuildRuleParams params;
+
+    private final Path genSrcsDirectory;
+    private final Path outputDirectory;
+    private final Path output;
+
+    public YangLibrary(
+            BuildRuleParams params,
+            SourcePathResolver resolver,
+            ImmutableSortedSet<SourcePath> srcs) {
+        super(params, resolver);
+        this.srcs = srcs;
+        this.params = params;
+        genSrcsDirectory = BuildTargets.getGenPath(getProjectFilesystem(),
+                                                   params.getBuildTarget(),
+                                                   "%s__yang-gen");
+        outputDirectory = BuildTargets.getGenPath(getProjectFilesystem(),
+                                                  params.getBuildTarget(),
+                                                  "%s__yang-output");
+        output = Paths.get(String.format("%s/%s-sources.jar",
+                                         outputDirectory,
+                                         params.getBuildTarget().getShortNameAndFlavorPostfix()));
+    }
+
+    @Override
+    public ImmutableList<Step> getBuildSteps(BuildContext buildContext, BuildableContext buildableContext) {
+        ImmutableList.Builder<Step> steps = ImmutableList.builder();
+
+        // Delete the old output for this rule, if it exists.
+        steps.add(
+                new RmStep(
+                        getProjectFilesystem(),
+                        getPathToOutput(),
+                        /* shouldForceDeletion */ true,
+                        /* shouldRecurse */ true));
+
+        // Make sure that the directory to contain the output file exists. Rules get output to a
+        // directory named after the base path, so we don't want to nuke the entire directory.
+        steps.add(new MkdirStep(getProjectFilesystem(), outputDirectory));
+
+        steps.add(new MakeCleanDirectoryStep(getProjectFilesystem(), genSrcsDirectory));
+
+        List<Path> sourcePaths = srcs.stream()
+                .map(s -> getResolver().getRelativePath(s))
+                .collect(Collectors.toList());
+
+        steps.add(new YangStep(getProjectFilesystem(), sourcePaths, genSrcsDirectory,
+                               params.getDeps()));
+
+        steps.add(new JarDirectoryStep(
+                getProjectFilesystem(),
+                output,
+                ImmutableSortedSet.of(genSrcsDirectory),
+                null,
+                null));
+
+        return steps.build();
+    }
+
+    @Nullable
+    @Override
+    public Path getPathToOutput() {
+        return output;
+    }
+
+
+    /**
+     * Returns generated sources directory.
+     *
+     * @return generated sources directory
+     */
+    public Path getGenSrcsDirectory() {
+        File dir = new File(genSrcsDirectory.toString() + SLASH + YANG);
+        dir.mkdirs();
+        return genSrcsDirectory;
+    }
+
+}
diff --git a/compiler/plugin/buck/src/main/java/org/onosproject/yang/compiler/plugin/buck/YangLibraryDescription.java b/compiler/plugin/buck/src/main/java/org/onosproject/yang/compiler/plugin/buck/YangLibraryDescription.java
new file mode 100644
index 0000000..dc088dd
--- /dev/null
+++ b/compiler/plugin/buck/src/main/java/org/onosproject/yang/compiler/plugin/buck/YangLibraryDescription.java
@@ -0,0 +1,183 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.plugin.buck;
+
+import com.facebook.buck.cli.BuckConfig;
+import com.facebook.buck.jvm.java.CalculateAbi;
+import com.facebook.buck.jvm.java.DefaultJavaLibrary;
+import com.facebook.buck.jvm.java.JavaBuckConfig;
+import com.facebook.buck.jvm.java.JavaOptions;
+import com.facebook.buck.jvm.java.JavacOptions;
+import com.facebook.buck.jvm.java.JavacOptionsAmender;
+import com.facebook.buck.jvm.java.JavacOptionsFactory;
+import com.facebook.buck.jvm.java.JavacToJarStepFactory;
+import com.facebook.buck.jvm.java.JvmLibraryArg;
+import com.facebook.buck.model.BuildTarget;
+import com.facebook.buck.model.BuildTargets;
+import com.facebook.buck.model.Flavor;
+import com.facebook.buck.model.Flavored;
+import com.facebook.buck.model.ImmutableFlavor;
+import com.facebook.buck.model.UnflavoredBuildTarget;
+import com.facebook.buck.parser.NoSuchBuildTargetException;
+import com.facebook.buck.rules.BuildRule;
+import com.facebook.buck.rules.BuildRuleParams;
+import com.facebook.buck.rules.BuildRuleResolver;
+import com.facebook.buck.rules.BuildRuleType;
+import com.facebook.buck.rules.BuildTargetSourcePath;
+import com.facebook.buck.rules.Description;
+import com.facebook.buck.rules.PathSourcePath;
+import com.facebook.buck.rules.SourcePath;
+import com.facebook.buck.rules.SourcePathResolver;
+import com.facebook.buck.rules.SourcePaths;
+import com.facebook.buck.rules.TargetGraph;
+import com.google.common.base.Optional;
+import com.google.common.base.Suppliers;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.ImmutableSortedSet;
+import org.onosproject.yang.compiler.utils.UtilConstants;
+
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.regex.Pattern;
+import java.util.stream.Collectors;
+
+/**
+ * Description of a Buck Yang Library.
+ */
+public class YangLibraryDescription
+        implements Description<YangLibraryDescription.Arg>, Flavored {
+    public static final BuildRuleType TYPE = BuildRuleType.of("yang_library");
+    public static final Flavor SOURCES = ImmutableFlavor.of("srcs");
+
+    private final JavacOptions defaultJavacOptions;
+    private final JavaOptions defaultJavaOptions;
+
+    public YangLibraryDescription(BuckConfig config) {
+        JavaBuckConfig javaConfig = new JavaBuckConfig(config);
+        defaultJavacOptions = javaConfig.getDefaultJavacOptions();
+        defaultJavaOptions = javaConfig.getDefaultJavaOptions();
+    }
+
+    @Override
+    public BuildRuleType getBuildRuleType() {
+        return TYPE;
+    }
+
+    @Override
+    public Arg createUnpopulatedConstructorArg() {
+        return new Arg();
+    }
+
+    @Override
+    public <A extends Arg> BuildRule createBuildRule(TargetGraph targetGraph,
+                                                     BuildRuleParams params,
+                                                     BuildRuleResolver resolver,
+                                                     A args)
+            throws NoSuchBuildTargetException {
+
+        SourcePathResolver pathResolver = new SourcePathResolver(resolver);
+
+        UnflavoredBuildTarget unflavoredBuildTarget =
+                params.getBuildTarget().getUnflavoredBuildTarget();
+        BuildRuleParams yangParams = params.copyWithBuildTarget(
+                BuildTargets.createFlavoredBuildTarget(
+                        unflavoredBuildTarget, SOURCES));
+        BuildRule yangLib = resolver.addToIndex(new YangLibrary(yangParams, pathResolver, args.srcs));
+
+        if (params.getBuildTarget().getFlavors().contains(SOURCES)) {
+            return yangLib;
+        }
+
+        JavacOptions javacOptions = JavacOptionsFactory.create(
+                defaultJavacOptions,
+                params,
+                resolver,
+                pathResolver,
+                args
+        );
+
+
+        // Create to main compile rule.
+        BuildRuleParams javaParams = params.copyWithChanges(
+                params.getBuildTarget(),
+                Suppliers.ofInstance(
+                        ImmutableSortedSet.<BuildRule>naturalOrder()
+                                .add(yangLib)
+//                                .addAll(deps)
+                                //FIXME remove when we figure out compile time deps
+                                .addAll((args.deps.or(ImmutableSortedSet.<BuildTarget>of())).stream().map(resolver::getRule).collect(Collectors.toList()))
+//                                .addAll(BuildRules.getExportedRules(deps))
+                                .addAll(pathResolver.filterBuildRuleInputs(javacOptions.getInputs(pathResolver)))
+                                .build()),
+                Suppliers.ofInstance(ImmutableSortedSet.<BuildRule>of()));
+
+        BuildTarget abiJarTarget = params.getBuildTarget().withAppendedFlavors(CalculateAbi.FLAVOR);
+
+        //Add yang meta data resources to generated jar file resources.
+
+        Path rscRoot = ((YangLibrary) yangLib).getGenSrcsDirectory();
+        Path resPath = Paths.get(rscRoot + UtilConstants.SLASH + UtilConstants.YANG);
+
+        SourcePath path = new PathSourcePath(params.getProjectFilesystem(),
+                                             resPath);
+
+        DefaultJavaLibrary library =
+                resolver.addToIndex(
+                        new DefaultJavaLibrary(
+                                javaParams,
+                                pathResolver,
+                                ImmutableSet.of(SourcePaths.getToBuildTargetSourcePath().apply(yangLib)),
+                                /* resources */ImmutableSet.of(path),
+                                javacOptions.getGeneratedSourceFolderName(),
+                                /* proguardConfig */ Optional.<SourcePath>absent(),
+                                /* postprocessClassesCommands */ ImmutableList.<String>of(),
+                                /* exportedDeps */ ImmutableSortedSet.<BuildRule>of(),
+                                /* providedDeps */ ImmutableSortedSet.<BuildRule>of(),
+                                /* abiJar */ new BuildTargetSourcePath(abiJarTarget),
+                                javacOptions.trackClassUsage(),
+                                /* additionalClasspathEntries */ ImmutableSet.<Path>of(),
+                                new JavacToJarStepFactory(javacOptions, JavacOptionsAmender.IDENTITY),
+                                /* resourcesRoot */ Optional.<Path>of(rscRoot),
+                                /* manifestFile */ Optional.absent(),
+                                /* mavenCoords */ Optional.<String>absent(),
+                                /* tests */ ImmutableSortedSet.<BuildTarget>of(),
+                                /* classesToRemoveFromJar */ ImmutableSet.<Pattern>of()));
+
+        resolver.addToIndex(
+                CalculateAbi.of(
+                        abiJarTarget,
+                        pathResolver,
+                        params,
+                        new BuildTargetSourcePath(library.getBuildTarget())));
+
+        return library;
+    }
+
+    @Override
+    public boolean hasFlavors(ImmutableSet<Flavor> flavors) {
+        return flavors.isEmpty() || flavors.contains(SOURCES);
+    }
+
+    public static class Arg extends JvmLibraryArg {
+        public ImmutableSortedSet<SourcePath> srcs;
+        public Optional<ImmutableSortedSet<BuildTarget>> deps;
+
+        //TODO other params here
+    }
+
+}
diff --git a/compiler/plugin/buck/src/main/java/org/onosproject/yang/compiler/plugin/buck/YangParsingException.java b/compiler/plugin/buck/src/main/java/org/onosproject/yang/compiler/plugin/buck/YangParsingException.java
new file mode 100644
index 0000000..c4b9461
--- /dev/null
+++ b/compiler/plugin/buck/src/main/java/org/onosproject/yang/compiler/plugin/buck/YangParsingException.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.yang.compiler.plugin.buck;
+
+/**
+ * Used to signal a problem parsing a Yang model.
+ */
+public class YangParsingException extends Exception {
+
+    /**
+     * Creates a YangParsingException based on another exception.
+     * @param t exception from the parser
+     */
+    public YangParsingException (Throwable t) {
+        super(t);
+    }
+
+}
diff --git a/compiler/plugin/buck/src/main/java/org/onosproject/yang/compiler/plugin/buck/YangStep.java b/compiler/plugin/buck/src/main/java/org/onosproject/yang/compiler/plugin/buck/YangStep.java
new file mode 100644
index 0000000..076fd0a
--- /dev/null
+++ b/compiler/plugin/buck/src/main/java/org/onosproject/yang/compiler/plugin/buck/YangStep.java
@@ -0,0 +1,105 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.yang.compiler.plugin.buck;
+
+import com.facebook.buck.io.ProjectFilesystem;
+import com.facebook.buck.model.UnflavoredBuildTarget;
+import com.facebook.buck.rules.BuildRule;
+import com.facebook.buck.step.AbstractExecutionStep;
+import com.facebook.buck.step.ExecutionContext;
+import com.facebook.buck.step.StepExecutionResult;
+import com.google.common.collect.ImmutableSortedSet;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Path;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+
+import static org.onosproject.yang.compiler.utils.UtilConstants.JAR;
+import static org.onosproject.yang.compiler.utils.UtilConstants.LIB;
+import static org.onosproject.yang.compiler.utils.UtilConstants.LIB_PATH;
+import static org.onosproject.yang.compiler.utils.UtilConstants.OUT;
+import static org.onosproject.yang.compiler.utils.UtilConstants.PERIOD;
+import static org.onosproject.yang.compiler.utils.UtilConstants.SLASH;
+
+/**
+ * Buck build step to trigger Yang Java source file generation.
+ */
+public class YangStep extends AbstractExecutionStep {
+
+    private static final String DESCRIPTION = "yang-compile";
+    private final ImmutableSortedSet<BuildRule> deps;
+    private final ProjectFilesystem filesystem;
+    private final List<Path> srcs;
+    private final Path output;
+
+    YangStep(ProjectFilesystem filesystem,
+             List<Path> srcs,
+             Path genSourcesDirectory, ImmutableSortedSet<BuildRule> deps) {
+        super(DESCRIPTION);
+        this.filesystem = filesystem;
+        this.srcs = srcs;
+        this.deps = deps;
+        this.output = genSourcesDirectory;
+    }
+
+    @Override
+    public StepExecutionResult execute(ExecutionContext executionContext)
+            throws IOException, InterruptedException {
+
+        List<File> sourceFiles = srcs.stream().map(Path::toFile)
+                .collect(Collectors.toList());
+        try {
+            new YangGenerator(sourceFiles, output.toString(), getJarPaths())
+                    .execute();
+            return StepExecutionResult.SUCCESS;
+        } catch (YangParsingException e) {
+            executionContext.getConsole().printErrorText(e.getMessage());
+            return StepExecutionResult.ERROR;
+        }
+    }
+
+    private List<String> getJarPaths() {
+        StringBuilder builder;
+        List<String> depJarPaths = new ArrayList<>();
+        String[] array;
+        UnflavoredBuildTarget uBt;
+        if (deps != null) {
+            for (BuildRule rule : deps) {
+                if (!rule.getBuildTarget().getFullyQualifiedName()
+                        .contains(LIB_PATH)) {
+                    builder = new StringBuilder();
+                    //build absolute path for jar file
+                    builder.append(filesystem.getRootPath().toString()).append(SLASH)
+                            .append(filesystem.getBuckPaths().getGenDir())
+                            .append(SLASH);
+                    uBt = rule.getBuildTarget().getUnflavoredBuildTarget();
+                    array = uBt.getBaseName().split(SLASH);
+                    for (int i = 2; i < array.length; i++) {
+                        builder.append(array[i]).append(SLASH);
+                    }
+                    builder.append(LIB).append(uBt.getShortName())
+                            .append(OUT).append(SLASH)
+                            .append(uBt.getShortName()).append(PERIOD + JAR);
+                    depJarPaths.add(builder.toString());
+                }
+            }
+        }
+        return depJarPaths;
+    }
+}
diff --git a/compiler/plugin/maven/pom.xml b/compiler/plugin/maven/pom.xml
new file mode 100644
index 0000000..afc4947
--- /dev/null
+++ b/compiler/plugin/maven/pom.xml
@@ -0,0 +1,150 @@
+<!--
+  ~ 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-yang-compiler-plugin</artifactId>
+        <version>1.12-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>onos-yang-compiler-maven-plugin</artifactId>
+    <version>1.12-SNAPSHOT</version>
+    <packaging>maven-plugin</packaging>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.maven</groupId>
+            <artifactId>maven-core</artifactId>
+            <version>3.3.9</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.maven</groupId>
+            <artifactId>maven-plugin-api</artifactId>
+            <version>3.3.9</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.maven.plugin-tools</groupId>
+            <artifactId>maven-plugin-annotations</artifactId>
+            <version>3.4</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>maven-scr-plugin</artifactId>
+            <version>1.21.0</version>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.maven</groupId>
+            <artifactId>maven-artifact</artifactId>
+            <version>3.3.9</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.maven</groupId>
+            <artifactId>maven-project</artifactId>
+            <version>3.0-alpha-2</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.maven</groupId>
+            <artifactId>maven-model</artifactId>
+            <version>3.3.9</version>
+        </dependency>
+        <dependency>
+            <groupId>org.sonatype.plexus</groupId>
+            <artifactId>plexus-build-api</artifactId>
+            <version>0.0.7</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.codehaus.mojo</groupId>
+            <artifactId>build-helper-maven-plugin</artifactId>
+            <version>1.10</version>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+            <version>1.7.21</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>4.12</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.onosproject</groupId>
+            <artifactId>onos-yang-compiler-tool</artifactId>
+            <version>1.12-SNAPSHOT</version>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>build-helper-maven-plugin</artifactId>
+                <version>1.10</version>
+                <executions>
+                    <execution>
+                        <id>add-source</id>
+                        <phase>generate-sources</phase>
+                        <goals>
+                            <goal>add-source</goal>
+                        </goals>
+                        <configuration>
+                            <sources>
+                                <source>
+                                    target/generated-sources/org/onosproject/yangutils/parser/antlrgencode
+                                </source>
+                                <sourceDirectory>
+                                    target/generated-sources/org/onosproject/yangutils/parser/antlrgencode
+                                </sourceDirectory>
+                            </sources>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-plugin-plugin</artifactId>
+                <version>3.4</version>
+                <configuration>
+                    <skipErrorNoDescriptorsFound>true
+                    </skipErrorNoDescriptorsFound>
+                </configuration>
+                <executions>
+                    <execution>
+                        <phase>generate-sources</phase>
+                        <goals>
+                            <goal>descriptor</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <version>2.5.4</version>
+                <extensions>true</extensions>
+            </plugin>
+        </plugins>
+    </build>
+</project>
diff --git a/compiler/plugin/maven/src/main/java/org/onosproject/yang/compiler/plugin/maven/YangPluginUtils.java b/compiler/plugin/maven/src/main/java/org/onosproject/yang/compiler/plugin/maven/YangPluginUtils.java
new file mode 100644
index 0000000..c5f0e69
--- /dev/null
+++ b/compiler/plugin/maven/src/main/java/org/onosproject/yang/compiler/plugin/maven/YangPluginUtils.java
@@ -0,0 +1,208 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.plugin.maven;
+
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.model.Dependency;
+import org.apache.maven.model.Plugin;
+import org.apache.maven.model.Resource;
+import org.apache.maven.project.MavenProject;
+import org.onosproject.yang.compiler.base.tool.YangToolManager;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.utils.DataModelUtils;
+import org.onosproject.yang.compiler.utils.io.impl.YangIoUtils;
+import org.slf4j.Logger;
+import org.sonatype.plexus.build.incremental.BuildContext;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import static org.onosproject.yang.compiler.utils.UtilConstants.COLON;
+import static org.onosproject.yang.compiler.utils.UtilConstants.EMPTY_STRING;
+import static org.onosproject.yang.compiler.utils.UtilConstants.HYPHEN;
+import static org.onosproject.yang.compiler.utils.UtilConstants.JAR;
+import static org.onosproject.yang.compiler.utils.UtilConstants.PERIOD;
+import static org.onosproject.yang.compiler.utils.UtilConstants.SLASH;
+import static org.onosproject.yang.compiler.utils.UtilConstants.TEMP;
+import static org.slf4j.LoggerFactory.getLogger;
+
+/**
+ * Represents YANG plugin utilities.
+ */
+public final class YangPluginUtils {
+
+    private static final Logger log = getLogger(YangPluginUtils.class);
+
+    private static final String TEXT_FILE_EXTENSION = ".txt";
+    private static final String VERSION_META_DATA = "VersionMetaData";
+    private static final String PLUGIN_ARTIFACT = "onos-yang-maven-plugin";
+
+    private YangPluginUtils() {
+    }
+
+    /**
+     * Adds generated source directory to the compilation root.
+     *
+     * @param source  directory
+     * @param project current maven project
+     * @param context current build context
+     */
+    static void addToCompilationRoot(String source, MavenProject project, BuildContext context) {
+        project.addCompileSourceRoot(source);
+        context.refresh(project.getBasedir());
+        log.info("Source directory added to compilation root: " + source);
+    }
+
+    /**
+     * Copies YANG files to the current project's output directory.
+     *
+     * @param outputDir project's output directory
+     * @param project   maven project
+     * @throws IOException when fails to copy files to destination resource directory
+     */
+    static void copyYangFilesToTarget(String outputDir, MavenProject project)
+            throws IOException {
+
+        addToProjectResource(outputDir + SLASH + TEMP + SLASH, project);
+    }
+
+    /**
+     * Serializes data-model.
+     *
+     * @param directory base directory for serialized files
+     * @param project   maven project
+     * @param operation true if need to add to resource
+     * @throws IOException when fails to do IO operations
+     */
+    public static void serializeDataModel(String directory,
+                                          MavenProject project,
+                                          boolean operation)
+            throws IOException {
+
+        String serFileDirPath = directory + YangToolManager.DEFAULT_JAR_RES_PATH;
+        File dir = new File(serFileDirPath);
+        dir.mkdirs();
+
+        if (operation) {
+            addToProjectResource(directory + SLASH + TEMP + SLASH, project);
+        }
+
+        if (operation) {
+            addVersionMetaDataFile(project, serFileDirPath);
+        }
+    }
+
+    /**
+     * Adds version meta data files for YSR to know version of YANG tools.
+     *
+     * @param project maven project
+     * @param dir     directory
+     * @throws IOException when fails to do IO operations
+     */
+    private static void addVersionMetaDataFile(MavenProject project, String dir)
+            throws IOException {
+        List<Plugin> plugins = project.getBuildPlugins();
+        Iterator<Plugin> it = plugins.iterator();
+        Plugin plugin = it.next();
+        String data = EMPTY_STRING;
+        while (it.hasNext()) {
+            if (plugin.getArtifactId().equals(PLUGIN_ARTIFACT)) {
+                data = plugin.getGroupId() + COLON + plugin.getArtifactId()
+                        + COLON + plugin.getVersion();
+            }
+            plugin = it.next();
+        }
+        if (data.equals(EMPTY_STRING)) {
+            throw new IOException("Invalid artifact for " + PLUGIN_ARTIFACT);
+        }
+        String verFileName = dir + VERSION_META_DATA + TEXT_FILE_EXTENSION;
+        PrintWriter out = new PrintWriter(verFileName);
+        out.print(data);
+        out.close();
+    }
+
+    /**
+     * Returns list of jar path.
+     *
+     * @param project         maven project
+     * @param localRepository local repository
+     * @param remoteRepos     remote repository
+     * @return list of jar paths
+     */
+    private static List<String> resolveDependencyJarPath(MavenProject project, ArtifactRepository localRepository,
+                                                         List<ArtifactRepository> remoteRepos) {
+
+        StringBuilder path = new StringBuilder();
+        List<String> jarPaths = new ArrayList<>();
+        for (Object obj : project.getDependencies()) {
+
+            Dependency dependency = (Dependency) obj;
+            path.append(localRepository.getBasedir());
+            path.append(SLASH);
+            path.append(YangIoUtils.getPackageDirPathFromJavaJPackage(dependency.getGroupId()));
+            path.append(SLASH);
+            path.append(dependency.getArtifactId());
+            path.append(SLASH);
+            path.append(dependency.getVersion());
+            path.append(SLASH);
+            path.append(dependency.getArtifactId() + HYPHEN + dependency.getVersion() + PERIOD + JAR);
+            File jarFile = new File(path.toString());
+            if (jarFile.exists()) {
+                jarPaths.add(path.toString());
+            }
+            path.delete(0, path.length());
+        }
+
+        for (ArtifactRepository repo : remoteRepos) {
+            // TODO: add resolver for remote repo.
+        }
+        return jarPaths;
+    }
+
+    /**
+     * Resolves inter jar dependencies.
+     *
+     * @param project         current maven project
+     * @param localRepository local maven repository
+     * @param remoteRepos     list of remote repository
+     * @param directory       directory for serialized files
+     * @return list of resolved datamodel nodes
+     * @throws IOException when fails to do IO operations
+     */
+    static List<YangNode> resolveInterJarDependencies(MavenProject project, ArtifactRepository localRepository,
+                                                      List<ArtifactRepository> remoteRepos, String directory)
+            throws IOException {
+
+        List<String> dependenciesJarPaths = resolveDependencyJarPath(project, localRepository, remoteRepos);
+        List<YangNode> resolvedDataModelNodes = new ArrayList<>();
+        for (String dependency : dependenciesJarPaths) {
+            resolvedDataModelNodes.addAll(DataModelUtils.parseJarFile(dependency, directory));
+        }
+        return resolvedDataModelNodes;
+    }
+
+    /* Adds directory to resources of project */
+    private static void addToProjectResource(String dir, MavenProject project) {
+        Resource rsc = new Resource();
+        rsc.setDirectory(dir);
+        project.addResource(rsc);
+    }
+}
diff --git a/compiler/plugin/maven/src/main/java/org/onosproject/yang/compiler/plugin/maven/YangUtilManager.java b/compiler/plugin/maven/src/main/java/org/onosproject/yang/compiler/plugin/maven/YangUtilManager.java
new file mode 100644
index 0000000..a9d0ce0
--- /dev/null
+++ b/compiler/plugin/maven/src/main/java/org/onosproject/yang/compiler/plugin/maven/YangUtilManager.java
@@ -0,0 +1,430 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.plugin.maven;
+
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.plugins.annotations.Component;
+import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.maven.plugins.annotations.Parameter;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.rtinfo.RuntimeInformation;
+import org.onosproject.yang.compiler.parser.YangUtilsParser;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.YangUtilsParserManager;
+import org.onosproject.yang.compiler.base.tool.CallablePlugin;
+import org.onosproject.yang.compiler.base.tool.YangFileInfo;
+import org.onosproject.yang.compiler.base.tool.YangToolManager;
+import org.onosproject.yang.compiler.base.tool.exception.YangToolException;
+import org.onosproject.yang.compiler.datamodel.ResolvableType;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangReferenceResolver;
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.linker.YangLinker;
+import org.onosproject.yang.compiler.linker.exceptions.LinkerException;
+import org.onosproject.yang.compiler.linker.impl.YangLinkerManager;
+import org.onosproject.yang.compiler.translator.tojava.JavaCodeGeneratorUtil;
+import org.onosproject.yang.compiler.utils.io.YangPluginConfig;
+import org.onosproject.yang.compiler.utils.io.YangToJavaNamingConflictUtil;
+import org.sonatype.plexus.build.incremental.BuildContext;
+
+import java.io.IOException;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import static java.util.Collections.sort;
+import static org.apache.maven.plugins.annotations.LifecyclePhase.PROCESS_SOURCES;
+import static org.apache.maven.plugins.annotations.ResolutionScope.COMPILE;
+import static org.onosproject.yang.compiler.linker.impl.YangLinkerUtils.resolveGroupingInDefinationScope;
+import static org.onosproject.yang.compiler.plugin.maven.YangPluginUtils.addToCompilationRoot;
+import static org.onosproject.yang.compiler.plugin.maven.YangPluginUtils.copyYangFilesToTarget;
+import static org.onosproject.yang.compiler.plugin.maven.YangPluginUtils.resolveInterJarDependencies;
+import static org.onosproject.yang.compiler.plugin.maven.YangPluginUtils.serializeDataModel;
+import static org.onosproject.yang.compiler.utils.UtilConstants.DEFAULT_BASE_PKG;
+import static org.onosproject.yang.compiler.utils.UtilConstants.EMPTY_STRING;
+import static org.onosproject.yang.compiler.utils.UtilConstants.IN;
+import static org.onosproject.yang.compiler.utils.UtilConstants.NEW_LINE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.SLASH;
+import static org.onosproject.yang.compiler.utils.UtilConstants.TEMP;
+import static org.onosproject.yang.compiler.utils.UtilConstants.VERSION_ERROR;
+import static org.onosproject.yang.compiler.utils.UtilConstants.YANG_RESOURCES;
+import static org.onosproject.yang.compiler.utils.io.impl.YangFileScanner.getYangFiles;
+import static org.onosproject.yang.compiler.utils.io.impl.YangIoUtils.deleteDirectory;
+import static org.onosproject.yang.compiler.utils.io.impl.YangIoUtils.getDirectory;
+import static org.onosproject.yang.compiler.utils.io.impl.YangIoUtils.getPackageDirPathFromJavaJPackage;
+import static org.onosproject.yang.compiler.utils.io.impl.YangIoUtils.getVersionValue;
+
+/**
+ * Represents ONOS YANG utility maven plugin.
+ * Goal of plugin is yang2java.
+ * Execution phase is generate-sources.
+ * requiresDependencyResolution at compile time.
+ */
+@Mojo(name = "yang2java", defaultPhase = PROCESS_SOURCES,
+        requiresDependencyResolution = COMPILE)
+public class YangUtilManager extends AbstractMojo implements CallablePlugin {
+
+    private static final String DEFAULT_PKG =
+            getPackageDirPathFromJavaJPackage(DEFAULT_BASE_PKG);
+    private static final int SUPPORTED_VERSION = 339;
+    private final YangPluginConfig yangPlugin = new YangPluginConfig();
+    private final YangUtilsParser yangUtilsParser = new YangUtilsParserManager();
+    private final YangLinker yangLinker = new YangLinkerManager();
+    private final Set<YangNode> yangNodeSet = new HashSet<>();
+    private YangNode rootNode;
+    // YANG file information set.
+    private Set<YangFileInfo> yangFileInfoSet = new HashSet<>();
+    private YangFileInfo curYangFileInfo = new YangFileInfo();
+    /**
+     * Source directory for YANG files.
+     */
+    @Parameter(property = "yangFilesDir", defaultValue = "src/main/yang")
+    private String yangFilesDir;
+
+    /**
+     * Source directory for generated files.
+     */
+    @Parameter(property = "classFileDir", defaultValue = "target/generated-sources")
+    private String classFileDir;
+
+    /**
+     * Base directory for project.
+     */
+    @Parameter(property = "basedir", defaultValue = "${basedir}")
+    private String baseDir;
+
+    /**
+     * Output directory.
+     */
+    @Parameter(property = "project.build.outputDirectory", required = true,
+            defaultValue = "target/classes")
+    private String outputDirectory;
+
+    /**
+     * Current maven project.
+     */
+    @Parameter(property = "project", required = true, readonly = true,
+            defaultValue = "${project}")
+    private MavenProject project;
+
+    /**
+     * Replacement required for period special character in the identifier.
+     */
+    @Parameter(property = "replacementForPeriod")
+    private String replacementForPeriod;
+
+    /**
+     * Replacement required for underscore special character in the identifier.
+     */
+    @Parameter(property = "replacementForUnderscore")
+    private String replacementForUnderscore;
+
+    /**
+     * Replacement required for hyphen special character in the identifier.
+     */
+    @Parameter(property = "replacementForHyphen")
+    private String replacementForHyphen;
+
+    /**
+     * Prefix which is required for adding with the identifier.
+     */
+    @Parameter(property = "prefixForIdentifier")
+    private String prefixForIdentifier;
+
+    /**
+     * Build context.
+     */
+    @Component
+    private BuildContext context;
+
+    /**
+     * Local maven repository.
+     */
+    @Parameter(readonly = true, defaultValue = "${localRepository}")
+    private ArtifactRepository localRepository;
+
+    /**
+     * Remote maven repositories.
+     */
+    @Parameter(readonly = true, defaultValue = "${project.remoteArtifactRepositories}")
+    private List<ArtifactRepository> remoteRepository;
+
+    /**
+     * Code generation is for nbi or sbi.
+     */
+    @Parameter(property = "generateJavaFileForSbi", defaultValue = "nbi")
+    private String generateJavaFileForSbi;
+
+    /**
+     * The Runtime information for the current instance of Maven.
+     */
+    @Component
+    private RuntimeInformation runtime;
+
+    /**
+     * The name of the property in which to store the version of Maven.
+     */
+    @Parameter(defaultValue = "maven.version")
+    private String versionProperty;
+
+    private String outputDir;
+    private String codeGenDir;
+
+    @Override
+    public void execute()
+            throws MojoExecutionException, MojoFailureException {
+
+        try {
+            validateMavenVersion();
+            /*
+             * For deleting the generated code in previous build.
+             */
+            outputDir = getDirectory(baseDir, outputDirectory);
+            deleteDirectory(outputDir + SLASH + TEMP);
+            deleteDirectory(outputDir + SLASH + YANG_RESOURCES);
+            String searchDir = getDirectory(baseDir, yangFilesDir);
+            codeGenDir = getDirectory(baseDir, classFileDir) + SLASH;
+
+            // Creates conflict resolver and set values to it.
+            YangToJavaNamingConflictUtil conflictResolver = new YangToJavaNamingConflictUtil();
+            conflictResolver.setReplacementForPeriod(replacementForPeriod);
+            conflictResolver.setReplacementForHyphen(replacementForHyphen);
+            conflictResolver.setReplacementForUnderscore(replacementForUnderscore);
+            conflictResolver.setPrefixForIdentifier(prefixForIdentifier);
+            yangPlugin.setCodeGenDir(codeGenDir);
+            yangPlugin.setConflictResolver(conflictResolver);
+
+            yangPlugin.resourceGenDir(outputDir + YangToolManager.DEFAULT_JAR_RES_PATH);
+            yangPlugin.setCodeGenerateForSbi(generateJavaFileForSbi.toLowerCase());
+
+            /*
+             * Obtain the YANG files at a path mentioned in plugin and creates
+             * YANG file information set.
+             */
+
+            YangToolManager toolManager = new YangToolManager();
+
+            yangFileInfoSet = toolManager.createYangFileInfoSet(
+                    getYangFiles(searchDir));
+            List<YangNode> interJarResolvedNodes =
+                    resolveInterJarDependencies(project, localRepository,
+                                                remoteRepository, outputDir);
+            toolManager.compileYangFiles(yangFileInfoSet,
+                                         interJarResolvedNodes, yangPlugin,
+                                         this);
+        } catch (YangToolException e) {
+            String fileName = EMPTY_STRING;
+            if (e.getCurYangFile() != null) {
+                fileName = e.getCurYangFile().getYangFileName();
+            }
+            try {
+                deleteDirectory(codeGenDir + DEFAULT_PKG);
+            } catch (IOException ex) {
+                e.printStackTrace();
+                throw new MojoExecutionException(
+                        "Error handler failed to delete files for data model node.");
+            }
+            getLog().info(e.getCause());
+            throw new MojoExecutionException(
+                    "Exception occurred due to " + e.getLocalizedMessage() +
+                            IN + fileName + " YANG file.");
+        } catch (IOException e) {
+            throw new MojoExecutionException(
+                    "Failed to process files");
+        }
+    }
+
+    /**
+     * Validates current maven version of system.
+     *
+     * @throws MojoExecutionException when maven version is below 3.3.9
+     */
+    private void validateMavenVersion() throws MojoExecutionException {
+        String version = runtime.getMavenVersion();
+        if (getVersionValue(version) < SUPPORTED_VERSION) {
+            throw new MojoExecutionException(VERSION_ERROR + version);
+        }
+    }
+
+    /**
+     * Returns the YANG node set.
+     *
+     * @return YANG node set
+     */
+    public Set<YangNode> getYangNodeSet() {
+        return yangNodeSet;
+    }
+
+    /**
+     * TODO: Delete me and use the tool code for UT test cases
+     * Links all the provided with the YANG file info set.
+     *
+     * @throws MojoExecutionException a violation in mojo execution
+     */
+    public void resolveDependenciesUsingLinker()
+            throws MojoExecutionException {
+        createYangNodeSet();
+        try {
+            yangLinker.resolveDependencies(yangNodeSet);
+        } catch (LinkerException e) {
+            printLog(e.getFileName(), e.getLineNumber(), e.getCharPositionInLine(),
+                     e.getMessage(), e.getLocalizedMessage());
+            throw new MojoExecutionException(e.getMessage());
+        }
+    }
+
+    /**
+     * TODO: Delete me and use the tool code for UT test cases
+     * Creates YANG nodes set.
+     */
+    protected void createYangNodeSet() {
+        for (YangFileInfo yangFileInfo : yangFileInfoSet) {
+            yangNodeSet.add(yangFileInfo.getRootNode());
+        }
+    }
+
+    /**
+     * TODO: Delete me and use the tool code for UT test cases
+     * Parses all the provided YANG files and generates YANG data model tree.
+     *
+     * @throws IOException a violation in IO
+     */
+    public void parseYangFileInfoSet()
+            throws IOException {
+        for (YangFileInfo yangFileInfo : yangFileInfoSet) {
+            curYangFileInfo = yangFileInfo;
+            if (yangFileInfo.isForTranslator()) {
+                try {
+                    YangNode yangNode = yangUtilsParser.getDataModel(
+                            yangFileInfo.getYangFileName());
+                    yangFileInfo.setRootNode(yangNode);
+                    rootNode = yangNode;
+                    resolveGroupingInDefinationScope((YangReferenceResolver) yangNode);
+                    try {
+                        ((YangReferenceResolver) yangNode)
+                                .resolveSelfFileLinking(ResolvableType.YANG_DERIVED_DATA_TYPE);
+                        ((YangReferenceResolver) yangNode)
+                                .resolveSelfFileLinking(ResolvableType.YANG_IDENTITYREF);
+                    } catch (DataModelException e) {
+                        printLog(e.getFileName(), e.getLineNumber(), e
+                                .getCharPositionInLine(), e.getMessage(), e
+                                         .getLocalizedMessage());
+                    }
+                } catch (ParserException e) {
+                    printLog(e.getFileName(), e.getLineNumber(), e
+                            .getCharPositionInLine(), e.getMessage(), e
+                                     .getLocalizedMessage());
+                    throw e;
+                }
+            }
+        }
+    }
+
+    /**
+     * TODO: Delete me and use the tool code for UT test cases
+     * Translates to java code corresponding to the YANG schema.
+     *
+     * @param yangPlugin YANG plugin config
+     * @throws IOException when fails to generate java code file the current node
+     */
+    public void translateToJava(YangPluginConfig yangPlugin)
+            throws IOException {
+        List<YangNode> yangNodeSortedList = new LinkedList<>();
+        yangNodeSortedList.addAll(yangNodeSet);
+        sort(yangNodeSortedList);
+        for (YangNode node : yangNodeSortedList) {
+            if (node.isToTranslate()) {
+                JavaCodeGeneratorUtil.generateJavaCode(node, yangPlugin);
+            }
+        }
+    }
+
+    /**
+     * Creates a YANG file info set.
+     *
+     * @param yangFileList YANG files list
+     */
+    public void createYangFileInfoSet(List<String> yangFileList) {
+        for (String yangFile : yangFileList) {
+            YangFileInfo yangFileInfo = new YangFileInfo();
+            yangFileInfo.setYangFileName(yangFile);
+            yangFileInfoSet.add(yangFileInfo);
+        }
+    }
+
+    /**
+     * TODO: Delete me and use the tool code for UT test cases
+     * Returns the YANG file info set.
+     *
+     * @return the YANG file info set
+     */
+    public Set<YangFileInfo> getYangFileInfoSet() {
+        return yangFileInfoSet;
+    }
+
+    /**
+     * TODO: Delete me and use the tool code for UT test cases
+     * Sets the YANG file info set.
+     *
+     * @param yangFileInfoSet the YANG file info set
+     */
+    void setYangFileInfoSet(Set<YangFileInfo> yangFileInfoSet) {
+        this.yangFileInfoSet = yangFileInfoSet;
+    }
+
+    /**
+     * Adds log info for exception.
+     *
+     * @param fileName file name
+     * @param line     line number
+     * @param position character position
+     * @param msg      error message
+     * @param localMsg local message
+     */
+    private void printLog(String fileName, int line, int position, String
+            msg, String localMsg) {
+        String logInfo = "Error in file: " + fileName;
+        if (line != 0) {
+            logInfo = logInfo + " at line: " + line + " at position: "
+                    + position;
+        }
+        if (msg != null) {
+            logInfo = logInfo + NEW_LINE + localMsg;
+        }
+        getLog().info(logInfo);
+    }
+
+    @Override
+    public void addGeneratedCodeToBundle() {
+        addToCompilationRoot(codeGenDir, project, context);
+    }
+
+
+    @Override
+    public void addCompiledSchemaToBundle() throws IOException {
+        serializeDataModel(outputDir, project, true);
+    }
+
+    @Override
+    public void addYangFilesToBundle() throws IOException {
+        copyYangFilesToTarget(outputDir, project);
+    }
+}
diff --git a/compiler/plugin/maven/src/main/java/org/onosproject/yang/compiler/plugin/maven/package-info.java b/compiler/plugin/maven/src/main/java/org/onosproject/yang/compiler/plugin/maven/package-info.java
new file mode 100644
index 0000000..4b67022
--- /dev/null
+++ b/compiler/plugin/maven/src/main/java/org/onosproject/yang/compiler/plugin/maven/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.
+ */
+
+/**
+ * YANG utility maven plugin.
+ */
+package org.onosproject.yang.compiler.plugin.maven;
diff --git a/compiler/plugin/maven/src/main/resources/CopyrightHeader.txt b/compiler/plugin/maven/src/main/resources/CopyrightHeader.txt
new file mode 100644
index 0000000..2cbed45
--- /dev/null
+++ b/compiler/plugin/maven/src/main/resources/CopyrightHeader.txt
@@ -0,0 +1,14 @@
+ *
+ * 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.
+ */
+
diff --git a/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/AugmentTranslatorTest.java b/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/AugmentTranslatorTest.java
new file mode 100644
index 0000000..3d7a6e6
--- /dev/null
+++ b/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/AugmentTranslatorTest.java
@@ -0,0 +1,128 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.plugin.maven;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.junit.Test;
+import org.onosproject.yang.compiler.utils.io.YangPluginConfig;
+import org.onosproject.yang.compiler.utils.io.impl.YangFileScanner;
+import org.onosproject.yang.compiler.utils.io.impl.YangIoUtils;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+
+import java.io.File;
+import java.io.IOException;
+
+/**
+ * Unit test case for augment translator.
+ */
+public class AugmentTranslatorTest {
+
+    private final YangUtilManager utilManager = new YangUtilManager();
+    private static final String DIR = "target/augmentTranslator/";
+    private static final String COMP = System.getProperty("user.dir") + File
+            .separator + DIR;
+
+    /**
+     * Checks augment translation should not result in any exception.
+     *
+     * @throws MojoExecutionException
+     */
+    @Test
+    public void processAugmentTranslator() throws IOException, ParserException, MojoExecutionException {
+
+        YangIoUtils.deleteDirectory(DIR);
+        String searchDir = "src/test/resources/augmentTranslator";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+        utilManager.resolveDependenciesUsingLinker();
+
+        YangPluginConfig yangPluginConfig = new YangPluginConfig();
+        yangPluginConfig.setCodeGenDir(DIR);
+        utilManager.translateToJava(yangPluginConfig);
+        YangPluginConfig.compileCode(COMP);
+        YangIoUtils.deleteDirectory(DIR);
+    }
+
+    /**
+     * Checks augment translation should not result in any exception.
+     * compiler not added because it contains a notification which depends on
+     * onos api.
+     *
+     * @throws MojoExecutionException
+     */
+    @Test
+    public void processRpcAugmentIntraTranslator() throws IOException,
+            ParserException, MojoExecutionException {
+        YangIoUtils.deleteDirectory(DIR);
+        String searchDir = "src/test/resources/rpcAugment/intra";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+        utilManager.resolveDependenciesUsingLinker();
+
+        YangPluginConfig yangPluginConfig = new YangPluginConfig();
+        yangPluginConfig.setCodeGenDir(DIR);
+        utilManager.translateToJava(yangPluginConfig);
+        YangIoUtils.deleteDirectory(DIR);
+    }
+
+    /**
+     * Checks augment translation should not result in any exception.
+     *
+     * @throws MojoExecutionException
+     */
+    @Test
+    public void processRpcAugmentInterTranslator() throws IOException,
+            ParserException, MojoExecutionException {
+        YangIoUtils.deleteDirectory(DIR);
+        String searchDir = "src/test/resources/rpcAugment/inter";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+        utilManager.resolveDependenciesUsingLinker();
+
+        YangPluginConfig yangPluginConfig = new YangPluginConfig();
+        yangPluginConfig.setCodeGenDir(DIR);
+        utilManager.translateToJava(yangPluginConfig);
+        YangPluginConfig.compileCode(COMP);
+        YangIoUtils.deleteDirectory(DIR);
+    }
+
+    /**
+     * Checks augment translation should not result in any exception.
+     *
+     * @throws MojoExecutionException
+     */
+    @Test
+    public void processChoiceAugmentInterTranslator() throws IOException,
+            ParserException, MojoExecutionException {
+        YangIoUtils.deleteDirectory(DIR);
+        String searchDir = "src/test/resources/choiceAugment";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+        utilManager.resolveDependenciesUsingLinker();
+
+        YangPluginConfig yangPluginConfig = new YangPluginConfig();
+        yangPluginConfig.setCodeGenDir(DIR);
+        utilManager.translateToJava(yangPluginConfig);
+        YangPluginConfig.compileCode(COMP);
+        YangIoUtils.deleteDirectory(DIR);
+    }
+
+}
diff --git a/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/ChoiceCaseTranslatorTest.java b/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/ChoiceCaseTranslatorTest.java
new file mode 100644
index 0000000..395792a
--- /dev/null
+++ b/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/ChoiceCaseTranslatorTest.java
@@ -0,0 +1,83 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.plugin.maven;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.junit.Test;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.YangUtilsParserManager;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.utils.io.YangPluginConfig;
+import org.onosproject.yang.compiler.utils.io.impl.YangFileScanner;
+import org.onosproject.yang.compiler.utils.io.impl.YangIoUtils;
+
+import java.io.File;
+import java.io.IOException;
+
+import static org.onosproject.yang.compiler.translator.tojava.JavaCodeGeneratorUtil.generateJavaCode;
+
+/**
+ * Unit tests for choice-case translator.
+ */
+public final class ChoiceCaseTranslatorTest {
+    private static final String DIR = "target/ChoiceCaseTestGenFile/";
+    private static final String COMP = System.getProperty("user.dir") + File
+            .separator + DIR;
+    private final YangUtilManager utilManager = new YangUtilManager();
+    private final YangUtilsParserManager manager = new YangUtilsParserManager();
+
+    /**
+     * Checks choice-case translation should not result in any exception.
+     */
+    @Test
+    public void processChoiceCaseTranslator() throws IOException, ParserException {
+
+        String dir = "target/ChoiceCaseTestGenFile/";
+        YangIoUtils.deleteDirectory(dir);
+        YangNode node = manager.getDataModel("src/test/resources/ChoiceCaseTranslator.yang");
+
+        YangPluginConfig yangPluginConfig = new YangPluginConfig();
+        yangPluginConfig.setCodeGenDir(dir);
+
+        generateJavaCode(node, yangPluginConfig);
+        String dir1 = System.getProperty("user.dir") + File.separator + dir;
+        YangPluginConfig.compileCode(dir1);
+        YangIoUtils.deleteDirectory(dir);
+    }
+
+    /**
+     * Checks augment translation should not result in any exception.
+     *
+     * @throws MojoExecutionException
+     */
+    @Test
+    public void processChoiceAllTranslator() throws IOException,
+            ParserException, MojoExecutionException {
+        YangIoUtils.deleteDirectory(DIR);
+        String searchDir = "src/test/resources/choiceTranslator";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+        utilManager.resolveDependenciesUsingLinker();
+
+        YangPluginConfig yangPluginConfig = new YangPluginConfig();
+        yangPluginConfig.setCodeGenDir(DIR);
+        utilManager.translateToJava(yangPluginConfig);
+        YangPluginConfig.compileCode(COMP);
+        YangIoUtils.deleteDirectory(DIR);
+    }
+}
diff --git a/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/CompilerAnnotationTest.java b/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/CompilerAnnotationTest.java
new file mode 100644
index 0000000..d020cee
--- /dev/null
+++ b/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/CompilerAnnotationTest.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.onosproject.yang.compiler.plugin.maven;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.junit.Test;
+import org.onosproject.yang.compiler.utils.io.YangPluginConfig;
+import org.onosproject.yang.compiler.utils.io.impl.YangFileScanner;
+import org.onosproject.yang.compiler.utils.io.impl.YangIoUtils;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+
+import java.io.File;
+import java.io.IOException;
+
+/**
+ * Unit test case for compiler annotation.
+ */
+public class CompilerAnnotationTest {
+    private final YangUtilManager utilManager = new YangUtilManager();
+    private static final String DIR = "target/compiler/";
+    private static final String COMP = System.getProperty("user.dir") + File
+            .separator + DIR;
+
+
+    /**
+     * Checks compiler annotation translation should not result in any exception.
+     *
+     * @throws MojoExecutionException
+     */
+    @Test
+    public void processTranslator() throws IOException,
+            ParserException, MojoExecutionException {
+        YangIoUtils.deleteDirectory(DIR);
+        String searchDir = "src/test/resources/compilerAnnotation";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+        utilManager.resolveDependenciesUsingLinker();
+
+        YangPluginConfig yangPluginConfig = new YangPluginConfig();
+        yangPluginConfig.setCodeGenDir(DIR);
+        utilManager.translateToJava(yangPluginConfig);
+        YangPluginConfig.compileCode(COMP);
+        YangIoUtils.deleteDirectory(DIR);
+    }
+}
diff --git a/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/EnumTranslatorTest.java b/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/EnumTranslatorTest.java
new file mode 100644
index 0000000..6998d9b
--- /dev/null
+++ b/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/EnumTranslatorTest.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.plugin.maven;
+
+import org.junit.Test;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.YangUtilsParserManager;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.translator.tojava.JavaCodeGeneratorUtil;
+import org.onosproject.yang.compiler.utils.io.YangPluginConfig;
+import org.onosproject.yang.compiler.utils.io.impl.YangIoUtils;
+
+import java.io.File;
+import java.io.IOException;
+
+/**
+ * Unit test case for enum translator.
+ */
+public final class EnumTranslatorTest {
+
+    private final YangUtilsParserManager manager = new YangUtilsParserManager();
+
+    /**
+     * Checks enum translation should not result in any exception.
+     */
+    @Test
+    public void processEnumTranslator()
+            throws IOException, ParserException {
+        YangNode node = manager.getDataModel("src/test/resources/EnumTranslator.yang");
+
+        String dir = "target/enumTranslator/";
+        YangIoUtils.deleteDirectory(dir);
+        YangPluginConfig yangPluginConfig = new YangPluginConfig();
+        yangPluginConfig.setCodeGenDir(dir);
+
+        JavaCodeGeneratorUtil.generateJavaCode(node, yangPluginConfig);
+        String dir1 = System.getProperty("user.dir") + File.separator + dir;
+        YangPluginConfig.compileCode(dir1);
+        YangIoUtils.deleteDirectory(dir);
+    }
+    // TODO enhance the test cases, after having a framework of translator test.
+}
diff --git a/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/GroupingTranslatorTest.java b/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/GroupingTranslatorTest.java
new file mode 100644
index 0000000..d7e6580
--- /dev/null
+++ b/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/GroupingTranslatorTest.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.plugin.maven;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.junit.Test;
+import org.onosproject.yang.compiler.utils.io.YangPluginConfig;
+import org.onosproject.yang.compiler.utils.io.impl.YangFileScanner;
+import org.onosproject.yang.compiler.utils.io.impl.YangIoUtils;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+
+import java.io.File;
+import java.io.IOException;
+
+/**
+ * Unit test case for grouping translator.
+ */
+public class GroupingTranslatorTest {
+
+    private final YangUtilManager utilManager = new YangUtilManager();
+    private static final String DIR = "target/groupingTranslator/";
+    private static final String COMP = System.getProperty("user.dir") + File
+            .separator + DIR;
+
+    /**
+     * Checks grouping translation should not result in any exception.
+     *
+     * @throws MojoExecutionException
+     */
+    @Test
+    public void processTranslator() throws IOException, ParserException, MojoExecutionException {
+
+        YangIoUtils.deleteDirectory(DIR);
+        String searchDir = "src/test/resources/grouping";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+        utilManager.resolveDependenciesUsingLinker();
+
+        YangPluginConfig yangPluginConfig = new YangPluginConfig();
+        yangPluginConfig.setCodeGenDir(DIR);
+        utilManager.translateToJava(yangPluginConfig);
+        YangPluginConfig.compileCode(COMP);
+        YangIoUtils.deleteDirectory(DIR);
+    }
+
+}
diff --git a/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/IdentityTranslatorTest.java b/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/IdentityTranslatorTest.java
new file mode 100644
index 0000000..bb02522
--- /dev/null
+++ b/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/IdentityTranslatorTest.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.plugin.maven;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.junit.Test;
+import org.onosproject.yang.compiler.utils.io.YangPluginConfig;
+import org.onosproject.yang.compiler.utils.io.impl.YangFileScanner;
+import org.onosproject.yang.compiler.utils.io.impl.YangIoUtils;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+
+import java.io.File;
+import java.io.IOException;
+
+/**
+ * Translator test case for identity.
+ */
+public class IdentityTranslatorTest {
+
+    private final YangUtilManager utilManager = new YangUtilManager();
+    private static final String DIR = "target/identity/";
+    private static final String COMP = System.getProperty("user.dir") + File
+            .separator + DIR;
+
+    /**
+     * Checks translation should not result in any exception.
+     *
+     * @throws MojoExecutionException
+     */
+    @Test
+    public void processTranslator() throws IOException,
+            ParserException, MojoExecutionException {
+        YangIoUtils.deleteDirectory(DIR);
+        String searchDir = "src/test/resources/identityTranslator";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+        utilManager.resolveDependenciesUsingLinker();
+
+        YangPluginConfig yangPluginConfig = new YangPluginConfig();
+        yangPluginConfig.setCodeGenDir(DIR);
+        utilManager.translateToJava(yangPluginConfig);
+        YangPluginConfig.compileCode(COMP);
+        YangIoUtils.deleteDirectory(DIR);
+    }
+}
diff --git a/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/IncludeReferenceWithPrefix.java b/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/IncludeReferenceWithPrefix.java
new file mode 100644
index 0000000..fc35b92
--- /dev/null
+++ b/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/IncludeReferenceWithPrefix.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.plugin.maven;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.junit.Test;
+import org.onosproject.yang.compiler.utils.io.YangPluginConfig;
+import org.onosproject.yang.compiler.utils.io.impl.YangFileScanner;
+import org.onosproject.yang.compiler.utils.io.impl.YangIoUtils;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+
+import java.io.File;
+import java.io.IOException;
+
+/**
+ * Test cases for testing YANG schema node.
+ */
+public class IncludeReferenceWithPrefix {
+
+    private final YangUtilManager utilManager = new YangUtilManager();
+
+    /**
+     * Checks method to get schema node from map.
+     *
+     * @throws MojoExecutionException
+     */
+    @Test
+    public void processRefToIncludeWithPrefix() throws IOException, ParserException, MojoExecutionException {
+
+        String dir = "target/refincludecontentwithprefix/";
+        YangIoUtils.deleteDirectory(dir);
+        String searchDir = "src/test/resources/refincludecontentwithprefix";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+        utilManager.resolveDependenciesUsingLinker();
+        YangPluginConfig yangPluginConfig = new YangPluginConfig();
+        yangPluginConfig.setCodeGenDir(dir);
+        utilManager.translateToJava(yangPluginConfig);
+        String dir1 = System.getProperty("user.dir") + File.separator + dir;
+        YangPluginConfig.compileCode(dir1);
+        YangIoUtils.deleteDirectory(dir);
+    }
+}
diff --git a/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/InterFileIdentityLinkingTest.java b/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/InterFileIdentityLinkingTest.java
new file mode 100644
index 0000000..544047c
--- /dev/null
+++ b/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/InterFileIdentityLinkingTest.java
@@ -0,0 +1,684 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.yang.compiler.plugin.maven;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.onosproject.yang.compiler.datamodel.YangDerivedInfo;
+import org.onosproject.yang.compiler.datamodel.YangIdentity;
+import org.onosproject.yang.compiler.datamodel.YangIdentityRef;
+import org.onosproject.yang.compiler.datamodel.YangLeaf;
+import org.onosproject.yang.compiler.datamodel.YangLeafList;
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangType;
+import org.onosproject.yang.compiler.datamodel.YangTypeDef;
+import org.onosproject.yang.compiler.datamodel.utils.ResolvableStatus;
+import org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes;
+import org.onosproject.yang.compiler.linker.exceptions.LinkerException;
+import org.onosproject.yang.compiler.linker.impl.YangLinkerManager;
+import org.onosproject.yang.compiler.utils.io.YangPluginConfig;
+import org.onosproject.yang.compiler.utils.io.impl.YangFileScanner;
+import org.onosproject.yang.compiler.utils.io.impl.YangIoUtils;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ListIterator;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.Is.is;
+import static org.onosproject.yang.compiler.datamodel.YangNodeType.MODULE_NODE;
+import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes.IDENTITYREF;
+import static org.onosproject.yang.compiler.linker.impl.YangLinkerUtils.updateFilePriority;
+
+/**
+ * Test cases for testing inter file linking for identity.
+ */
+public class InterFileIdentityLinkingTest {
+
+    private final YangUtilManager utilManager = new YangUtilManager();
+    private final YangLinkerManager yangLinkerManager = new YangLinkerManager();
+
+    @Rule
+    public ExpectedException thrown = ExpectedException.none();
+
+    /**
+     * Checks inter file feature linking with imported file.
+     */
+    @Test
+    public void processIdentityInImportedFile()
+            throws IOException, ParserException, MojoExecutionException {
+
+        String searchDir = "src/test/resources/interfileidentityimport";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+
+        YangNode selfNode = null;
+        YangNode refNode1 = null;
+        YangNode refNode2 = null;
+
+        // Create YANG node set
+        yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+
+        // Add references to import list.
+        yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
+
+        updateFilePriority(utilManager.getYangNodeSet());
+
+        // Carry out inter-file linking.
+        yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
+
+        for (YangNode rootNode : utilManager.getYangNodeSet()) {
+            if (rootNode.getName().equals("IdentityIntraFile")) {
+                selfNode = rootNode;
+            } else if (rootNode.getName().equals("IdentityInModule")) {
+                refNode1 = rootNode;
+            } else {
+                refNode2 = rootNode;
+            }
+        }
+
+        // Check whether the data model tree returned is of type module.
+        assertThat(selfNode instanceof YangModule, is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(selfNode.getNodeType(), is(MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) selfNode;
+        assertThat(yangNode.getName(), is("IdentityIntraFile"));
+
+        YangIdentity yangIdentity = (YangIdentity) yangNode.getChild();
+        assertThat(yangIdentity.getName(), is("ipv4-address-family"));
+        assertThat(yangIdentity.getBaseNode().getBaseIdentifier().getName(), is("ref-address-family"));
+        assertThat(yangIdentity.getBaseNode().getReferredIdentity().getName(), is("ref-address-family"));
+        assertThat(yangIdentity.getBaseNode().getResolvableStatus(), is(ResolvableStatus.RESOLVED));
+
+        yangIdentity = (YangIdentity) yangNode.getChild().getNextSibling();
+        assertThat(yangIdentity.getName(), is("ipv6-address-family"));
+        assertThat(yangIdentity.getBaseNode().getBaseIdentifier().getName(), is("ref-address-family"));
+        assertThat(yangIdentity.getBaseNode().getReferredIdentity().getName(), is("ref-address-family"));
+        assertThat(yangIdentity.getBaseNode().getResolvableStatus(), is(ResolvableStatus.RESOLVED));
+
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("tunnel"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("identityref"));
+        assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.IDENTITYREF));
+        YangIdentityRef yangIdentityRef = (YangIdentityRef) leafInfo.getDataType().getDataTypeExtendedInfo();
+        assertThat(yangIdentityRef.getName(), is("ref-address-family"));
+        assertThat(yangIdentityRef.getBaseIdentity().getName(), is("ref-address-family"));
+        assertThat(yangIdentityRef.getReferredIdentity().getName(), is("ref-address-family"));
+        assertThat(yangIdentityRef.getResolvableStatus(), is(ResolvableStatus.RESOLVED));
+
+        ListIterator<YangLeafList> leafListIterator = yangNode.getListOfLeafList().listIterator();
+        YangLeafList leafListInfo = leafListIterator.next();
+
+        // Check whether the information in the leaf is correct.
+        assertThat(leafListInfo.getName(), is("network-ref"));
+        assertThat(leafListInfo.getDataType().getDataTypeName(), is("identityref"));
+        assertThat(leafListInfo.getDataType().getDataType(), is(YangDataTypes.IDENTITYREF));
+        yangIdentityRef = (YangIdentityRef) (leafListInfo.getDataType().getDataTypeExtendedInfo());
+        assertThat(yangIdentityRef.getBaseIdentity().getName(), is("ref-address-family"));
+        assertThat(yangIdentityRef.getReferredIdentity().getName(), is("ref-address-family"));
+        assertThat(yangIdentityRef.getResolvableStatus(), is(ResolvableStatus.RESOLVED));
+
+    }
+
+    @Test
+    public void processTranslator() throws IOException, ParserException, MojoExecutionException {
+
+        YangIoUtils.deleteDirectory("target/identityTranslator/");
+        String searchDir = "src/test/resources/interfileidentityimport";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+        utilManager.resolveDependenciesUsingLinker();
+
+        YangPluginConfig yangPluginConfig = new YangPluginConfig();
+        yangPluginConfig.setCodeGenDir("target/identityTranslator/");
+        utilManager.translateToJava(yangPluginConfig);
+        YangPluginConfig.compileCode(System.getProperty("user.dir") + File
+                .separator + "target/identityTranslator/");
+        YangIoUtils.deleteDirectory("target/identityTranslator/");
+    }
+
+    /**
+     * Checks inter file feature linking with included file.
+     */
+    @Test
+    public void processIdentityInIncludedFile()
+            throws IOException, ParserException, MojoExecutionException {
+
+        String searchDir = "src/test/resources/interfileidentityinlude";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+
+        YangNode selfNode = null;
+        YangNode refNode1 = null;
+        YangNode refNode2 = null;
+
+        // Create YANG node set
+        yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+
+        // Carry out linking of sub module with module.
+        yangLinkerManager.linkSubModulesToParentModule(utilManager.getYangNodeSet());
+
+        // Add references to import list.
+        yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
+
+        // Add references to include list.
+        yangLinkerManager.addRefToYangFilesIncludeList(utilManager.getYangNodeSet());
+
+        updateFilePriority(utilManager.getYangNodeSet());
+
+        // Carry out inter-file linking.
+        yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
+
+        for (YangNode rootNode : utilManager.getYangNodeSet()) {
+            if (rootNode.getName().equals("syslog3")) {
+                selfNode = rootNode;
+            } else if (rootNode.getName().equals("syslog4")) {
+                refNode1 = rootNode;
+            } else {
+                refNode2 = rootNode;
+            }
+        }
+
+        // Check whether the data model tree returned is of type module.
+        assertThat(selfNode instanceof YangModule, is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(selfNode.getNodeType(), is(MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) selfNode;
+        assertThat(yangNode.getName(), is("syslog3"));
+
+        YangIdentity yangIdentity = (YangIdentity) yangNode.getChild();
+        assertThat(yangIdentity.getName(), is("ipv4-address-family"));
+        assertThat(yangIdentity.getBaseNode().getBaseIdentifier().getName(), is("ref-address-family"));
+        assertThat(yangIdentity.getBaseNode().getReferredIdentity().getName(), is("ref-address-family"));
+        assertThat(yangIdentity.getBaseNode().getResolvableStatus(), is(ResolvableStatus.RESOLVED));
+
+        yangIdentity = (YangIdentity) yangNode.getChild().getNextSibling();
+        assertThat(yangIdentity.getName(), is("ipv6-address-family"));
+        assertThat(yangIdentity.getBaseNode().getBaseIdentifier().getName(), is("ref-address-family"));
+        assertThat(yangIdentity.getBaseNode().getReferredIdentity().getName(), is("ref-address-family"));
+        assertThat(yangIdentity.getBaseNode().getResolvableStatus(), is(ResolvableStatus.RESOLVED));
+
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("tunnel"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("identityref"));
+        assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.IDENTITYREF));
+        YangIdentityRef yangIdentityRef = (YangIdentityRef) leafInfo.getDataType().getDataTypeExtendedInfo();
+        assertThat(yangIdentityRef.getName(), is("ref-address-family"));
+        assertThat(yangIdentityRef.getBaseIdentity().getName(), is("ref-address-family"));
+        assertThat(yangIdentityRef.getReferredIdentity().getName(), is("ref-address-family"));
+        assertThat(yangIdentityRef.getResolvableStatus(), is(ResolvableStatus.RESOLVED));
+
+        ListIterator<YangLeafList> leafListIterator = yangNode.getListOfLeafList().listIterator();
+        YangLeafList leafListInfo = leafListIterator.next();
+
+        // Check whether the information in the leaf is correct.
+        assertThat(leafListInfo.getName(), is("network-ref"));
+        assertThat(leafListInfo.getDataType().getDataTypeName(), is("identityref"));
+        assertThat(leafListInfo.getDataType().getDataType(), is(YangDataTypes.IDENTITYREF));
+        yangIdentityRef = (YangIdentityRef) (leafListInfo.getDataType().getDataTypeExtendedInfo());
+        assertThat(yangIdentityRef.getBaseIdentity().getName(), is("ref-address-family"));
+        assertThat(yangIdentityRef.getReferredIdentity().getName(), is("ref-address-family"));
+        assertThat(yangIdentityRef.getResolvableStatus(), is(ResolvableStatus.RESOLVED));
+    }
+
+    /**
+     * Checks inter file feature linking with imported file with dependency.
+     */
+    @Test
+    public void processIdentityInImportedFileWithDependency()
+            throws IOException, ParserException, MojoExecutionException {
+
+        String searchDir = "src/test/resources/interfileidentityimportdependency";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+
+        YangNode selfNode = null;
+        YangNode refNode1 = null;
+        YangNode refNode2 = null;
+
+        // Create YANG node set
+        yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+
+        // Add references to import list.
+        yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
+
+        updateFilePriority(utilManager.getYangNodeSet());
+
+        // Carry out inter-file linking.
+        yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
+
+        for (YangNode rootNode : utilManager.getYangNodeSet()) {
+            if (rootNode.getName().equals("syslog1")) {
+                selfNode = rootNode;
+            } else if (rootNode.getName().equals("syslog2")) {
+                refNode1 = rootNode;
+            } else {
+                refNode2 = rootNode;
+            }
+        }
+
+        // Check whether the data model tree returned is of type module.
+        assertThat(selfNode instanceof YangModule, is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(selfNode.getNodeType(), is(MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) selfNode;
+        assertThat(yangNode.getName(), is("syslog1"));
+
+        YangIdentity yangIdentity = (YangIdentity) yangNode.getChild();
+        assertThat(yangIdentity.getName(), is("ipv4-address-family"));
+        assertThat(yangIdentity.getBaseNode().getBaseIdentifier().getName(), is("ref-address-family"));
+        assertThat(yangIdentity.getBaseNode().getReferredIdentity().getName(), is("ref-address-family"));
+        assertThat(yangIdentity.getBaseNode().getResolvableStatus(), is(ResolvableStatus.RESOLVED));
+
+        yangIdentity = (YangIdentity) yangNode.getChild().getNextSibling();
+        assertThat(yangIdentity.getName(), is("ipv6-address-family"));
+        assertThat(yangIdentity.getBaseNode().getBaseIdentifier().getName(), is("ref-address-family"));
+        assertThat(yangIdentity.getBaseNode().getReferredIdentity().getName(), is("ref-address-family"));
+        assertThat(yangIdentity.getBaseNode().getResolvableStatus(), is(ResolvableStatus.RESOLVED));
+
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("tunnel"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("identityref"));
+        assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.IDENTITYREF));
+        YangIdentityRef yangIdentityRef = (YangIdentityRef) leafInfo.getDataType().getDataTypeExtendedInfo();
+        assertThat(yangIdentityRef.getName(), is("ref-address-family"));
+        assertThat(yangIdentityRef.getBaseIdentity().getName(), is("ref-address-family"));
+        assertThat(yangIdentityRef.getReferredIdentity().getName(), is("ref-address-family"));
+        assertThat(yangIdentityRef.getResolvableStatus(), is(ResolvableStatus.RESOLVED));
+
+        ListIterator<YangLeafList> leafListIterator = yangNode.getListOfLeafList().listIterator();
+        YangLeafList leafListInfo = leafListIterator.next();
+
+        // Check whether the information in the leaf is correct.
+        assertThat(leafListInfo.getName(), is("network-ref"));
+        assertThat(leafListInfo.getDataType().getDataTypeName(), is("identityref"));
+        assertThat(leafListInfo.getDataType().getDataType(), is(YangDataTypes.IDENTITYREF));
+        yangIdentityRef = (YangIdentityRef) (leafListInfo.getDataType().getDataTypeExtendedInfo());
+        assertThat(yangIdentityRef.getBaseIdentity().getName(), is("ref-address-family"));
+        assertThat(yangIdentityRef.getReferredIdentity().getName(), is("ref-address-family"));
+        assertThat(yangIdentityRef.getResolvableStatus(), is(ResolvableStatus.RESOLVED));
+    }
+
+    /**
+     * Checks inter file feature linking with included file with dependency.
+     */
+    @Test
+    public void processIdentityInIncludedFileWithDependency()
+            throws IOException, ParserException, MojoExecutionException {
+
+        String searchDir = "src/test/resources/interfileidentityincludedependency";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+
+        YangNode selfNode = null;
+        YangNode refNode1 = null;
+        YangNode refNode2 = null;
+
+        // Create YANG node set
+        yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+
+        // Carry out linking of sub module with module.
+        yangLinkerManager.linkSubModulesToParentModule(utilManager.getYangNodeSet());
+
+        // Add references to include list.
+        yangLinkerManager.addRefToYangFilesIncludeList(utilManager.getYangNodeSet());
+
+        // Add references to import list.
+        yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
+
+        updateFilePriority(utilManager.getYangNodeSet());
+
+        // Carry out inter-file linking.
+        yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
+
+        for (YangNode rootNode : utilManager.getYangNodeSet()) {
+            if (rootNode.getName().equals("syslog1")) {
+                selfNode = rootNode;
+            } else if (rootNode.getName().equals("syslog2")) {
+                refNode1 = rootNode;
+            } else {
+                refNode2 = rootNode;
+            }
+        }
+
+        // Check whether the data model tree returned is of type module.
+        assertThat(selfNode instanceof YangModule, is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(selfNode.getNodeType(), is(MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) selfNode;
+        assertThat(yangNode.getName(), is("syslog1"));
+
+        YangIdentity yangIdentity = (YangIdentity) yangNode.getChild();
+        assertThat(yangIdentity.getName(), is("ipv4-address-family"));
+        assertThat(yangIdentity.getBaseNode().getBaseIdentifier().getName(), is("ref-address-family"));
+        assertThat(yangIdentity.getBaseNode().getReferredIdentity().getName(), is("ref-address-family"));
+        assertThat(yangIdentity.getBaseNode().getResolvableStatus(), is(ResolvableStatus.RESOLVED));
+
+        yangIdentity = (YangIdentity) yangNode.getChild().getNextSibling();
+        assertThat(yangIdentity.getName(), is("ipv6-address-family"));
+        assertThat(yangIdentity.getBaseNode().getBaseIdentifier().getName(), is("ref-address-family"));
+        assertThat(yangIdentity.getBaseNode().getReferredIdentity().getName(), is("ref-address-family"));
+        assertThat(yangIdentity.getBaseNode().getResolvableStatus(), is(ResolvableStatus.RESOLVED));
+
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("tunnel"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("identityref"));
+        assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.IDENTITYREF));
+        YangIdentityRef yangIdentityRef = (YangIdentityRef) leafInfo.getDataType().getDataTypeExtendedInfo();
+        assertThat(yangIdentityRef.getName(), is("ref-address-family"));
+        assertThat(yangIdentityRef.getBaseIdentity().getName(), is("ref-address-family"));
+        assertThat(yangIdentityRef.getReferredIdentity().getName(), is("ref-address-family"));
+        assertThat(yangIdentityRef.getResolvableStatus(), is(ResolvableStatus.RESOLVED));
+
+        ListIterator<YangLeafList> leafListIterator = yangNode.getListOfLeafList().listIterator();
+        YangLeafList leafListInfo = leafListIterator.next();
+
+        // Check whether the information in the leaf is correct.
+        assertThat(leafListInfo.getName(), is("network-ref"));
+        assertThat(leafListInfo.getDataType().getDataTypeName(), is("identityref"));
+        assertThat(leafListInfo.getDataType().getDataType(), is(YangDataTypes.IDENTITYREF));
+        yangIdentityRef = (YangIdentityRef) (leafListInfo.getDataType().getDataTypeExtendedInfo());
+        assertThat(yangIdentityRef.getBaseIdentity().getName(), is("ref-address-family"));
+        assertThat(yangIdentityRef.getReferredIdentity().getName(), is("ref-address-family"));
+        assertThat(yangIdentityRef.getResolvableStatus(), is(ResolvableStatus.RESOLVED));
+    }
+
+    /**
+     * Checks inter file feature linking with imported file with dependency
+     * feature undefined.
+     */
+    @Test
+    public void processIdentityInImportedFileWithDependencyUndefined()
+            throws IOException, LinkerException, MojoExecutionException {
+        thrown.expect(LinkerException.class);
+        thrown.expectMessage("YANG file error: Unable to find base identity for given base");
+
+        String searchDir = "src/test/resources/interfileidentityimportdependencyUndefined";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+
+        YangNode selfNode = null;
+        YangNode refNode1 = null;
+        YangNode refNode2 = null;
+
+        // Create YANG node set
+        yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+
+        // Add references to import list.
+        yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
+
+        updateFilePriority(utilManager.getYangNodeSet());
+
+        // Carry out inter-file linking.
+        yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
+    }
+
+    /**
+     * Checks inter file feature linking with included file with dependency
+     * feature undefined.
+     */
+    @Test
+    public void processIdentityInIncludedFileWithDependencyUndefined()
+            throws IOException, LinkerException, MojoExecutionException {
+        thrown.expect(LinkerException.class);
+        thrown.expectMessage("YANG file error: Unable to find base identity for given base");
+
+        String searchDir = "src/test/resources/interfileidentityincludedependencyUndefined";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+
+        // Create YANG node set
+        yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+
+        // Carry out linking of sub module with module.
+        yangLinkerManager.linkSubModulesToParentModule(utilManager.getYangNodeSet());
+
+        // Add references to import list.
+        yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
+
+        // Add references to include list.
+        yangLinkerManager.addRefToYangFilesIncludeList(utilManager.getYangNodeSet());
+
+        // Update the priority for all the files.
+        updateFilePriority(utilManager.getYangNodeSet());
+
+        // Carry out inter-file linking.
+        yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
+    }
+
+    /**
+     * Checks inter file feature linking with imported file.
+     */
+    @Test
+    public void processIdentityTypedefUnresolvedInImportedFile()
+            throws IOException, ParserException, MojoExecutionException {
+
+        String searchDir = "src/test/resources/interfileidentitytypedef";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+
+        YangNode selfNode = null;
+        YangNode refNode1 = null;
+        YangNode refNode2 = null;
+
+        // Create YANG node set
+        yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+
+        // Add references to import list.
+        yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
+
+        updateFilePriority(utilManager.getYangNodeSet());
+
+        // Carry out inter-file linking.
+        yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
+
+        for (YangNode rootNode : utilManager.getYangNodeSet()) {
+            if (rootNode.getName().equals("IdentityIntraFile")) {
+                selfNode = rootNode;
+            } else if (rootNode.getName().equals("IdentityInModule")) {
+                refNode1 = rootNode;
+            } else {
+                refNode2 = rootNode;
+            }
+        }
+        // Check whether the data model tree returned is of type module.
+        assertThat(selfNode instanceof YangModule, is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(selfNode.getNodeType(), is(MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) selfNode;
+        assertThat(yangNode.getName(), is("IdentityIntraFile"));
+
+        YangIdentity yangIdentity = (YangIdentity) yangNode.getChild();
+        assertThat(yangIdentity.getName(), is("ipv4-address-family"));
+        assertThat(yangIdentity.getBaseNode().getBaseIdentifier().getName(), is("ref-address-family"));
+        assertThat(yangIdentity.getBaseNode().getReferredIdentity().getName(), is("ref-address-family"));
+        assertThat(yangIdentity.getBaseNode().getResolvableStatus(), is(ResolvableStatus.RESOLVED));
+
+        yangIdentity = (YangIdentity) yangNode.getChild().getNextSibling();
+        assertThat(yangIdentity.getName(), is("ipv6-address-family"));
+        assertThat(yangIdentity.getBaseNode().getBaseIdentifier().getName(), is("ref-address-family"));
+        assertThat(yangIdentity.getBaseNode().getReferredIdentity().getName(), is("ref-address-family"));
+        assertThat(yangIdentity.getBaseNode().getResolvableStatus(), is(ResolvableStatus.RESOLVED));
+
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("tunnel"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("identityref"));
+        assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.IDENTITYREF));
+        YangIdentityRef yangIdentityRef = (YangIdentityRef) leafInfo.getDataType().getDataTypeExtendedInfo();
+        assertThat(yangIdentityRef.getName(), is("ref-address-family"));
+        assertThat(yangIdentityRef.getBaseIdentity().getName(), is("ref-address-family"));
+        assertThat(yangIdentityRef.getReferredIdentity().getName(), is("ref-address-family"));
+        assertThat(yangIdentityRef.getResolvableStatus(), is(ResolvableStatus.RESOLVED));
+
+        ListIterator<YangLeafList> leafListIterator = yangNode.getListOfLeafList().listIterator();
+        YangLeafList leafListInfo = leafListIterator.next();
+
+        // Check whether the information in the leaf is correct.
+        assertThat(leafListInfo.getName(), is("network-ref"));
+        assertThat(leafListInfo.getDataType().getDataTypeName(), is("identityref"));
+        assertThat(leafListInfo.getDataType().getDataType(), is(YangDataTypes.IDENTITYREF));
+        yangIdentityRef = (YangIdentityRef) (leafListInfo.getDataType().getDataTypeExtendedInfo());
+        // Check whether leafref type got resolved.
+        assertThat(yangIdentityRef.getResolvableStatus(), is(ResolvableStatus.RESOLVED));
+
+        YangTypeDef typedef = (YangTypeDef) yangNode.getChild().getNextSibling().getNextSibling();
+        assertThat(typedef.getName(), is("type15"));
+
+        YangType type = typedef.getTypeList().iterator().next();
+        assertThat(type.getDataType(), is(YangDataTypes.IDENTITYREF));
+        assertThat(type.getDataTypeName(), is("identityref"));
+
+        YangIdentityRef identityRef = (YangIdentityRef) type.getDataTypeExtendedInfo();
+        assertThat(identityRef.getName(), is("ref-address-family"));
+        assertThat(identityRef.getBaseIdentity().getName(), is("ref-address-family"));
+        assertThat(identityRef.getResolvableStatus(),
+                   is(ResolvableStatus.RESOLVED));
+    }
+
+    /**
+     * Checks inter file feature linking with imported file.
+     */
+    @Test
+    public void processIdentityTypedefInImportedFile()
+            throws IOException, ParserException, MojoExecutionException {
+
+        String searchDir = "src/test/resources/interfileidentitytypedef";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+
+        YangNode selfNode = null;
+        YangNode refNode1 = null;
+        YangNode refNode2 = null;
+
+        // Create YANG node set
+        yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+
+        // Add references to import list.
+        yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
+
+        updateFilePriority(utilManager.getYangNodeSet());
+
+        // Carry out inter-file linking.
+        yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
+
+        for (YangNode rootNode : utilManager.getYangNodeSet()) {
+            if (rootNode.getName().equals("IdentityTypedef")) {
+                selfNode = rootNode;
+            } else if (rootNode.getName().equals("IdentityInModule")) {
+                refNode1 = rootNode;
+            } else {
+                refNode2 = rootNode;
+            }
+        }
+
+        // Check whether the data model tree returned is of type module.
+        assertThat(selfNode instanceof YangModule, is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(selfNode.getNodeType(), is(MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) selfNode;
+        assertThat(yangNode.getName(), is("IdentityTypedef"));
+
+        YangIdentity yangIdentity = (YangIdentity) yangNode.getChild();
+        assertThat(yangIdentity.getName(), is("ipv4-address-family"));
+        assertThat(yangIdentity.getBaseNode().getBaseIdentifier().getName(), is("ref-address-family"));
+        assertThat(yangIdentity.getBaseNode().getReferredIdentity().getName(), is("ref-address-family"));
+        assertThat(yangIdentity.getBaseNode().getResolvableStatus(), is(ResolvableStatus.RESOLVED));
+
+        yangIdentity = (YangIdentity) yangNode.getChild().getNextSibling();
+        assertThat(yangIdentity.getName(), is("ipv6-address-family"));
+        assertThat(yangIdentity.getBaseNode().getBaseIdentifier().getName(), is("ref-address-family"));
+        assertThat(yangIdentity.getBaseNode().getReferredIdentity().getName(), is("ref-address-family"));
+        assertThat(yangIdentity.getBaseNode().getResolvableStatus(), is(ResolvableStatus.RESOLVED));
+
+        YangTypeDef typedef = (YangTypeDef) yangNode.getChild().getNextSibling().getNextSibling();
+        assertThat(typedef.getName(), is("type15"));
+
+        YangType type = typedef.getTypeList().iterator().next();
+        assertThat(type.getDataType(), is(YangDataTypes.IDENTITYREF));
+        assertThat(type.getDataTypeName(), is("identityref"));
+
+        YangIdentityRef identityRef = (YangIdentityRef) type.getDataTypeExtendedInfo();
+        assertThat(identityRef.getName(), is("ref-address-family"));
+        assertThat(identityRef.getBaseIdentity().getName(), is("ref-address-family"));
+
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("tunnel"));
+        YangDerivedInfo info = (YangDerivedInfo) leafInfo.getDataType()
+                .getDataTypeExtendedInfo();
+        assertThat(info.getEffectiveBuiltInType(), is(IDENTITYREF));
+        YangType type1 = info.getReferredTypeDef().getTypeList().get(0);
+        YangIdentityRef idRef1 =
+                (YangIdentityRef) type1.getDataTypeExtendedInfo();
+        assertThat(idRef1.getResolvableStatus(),
+                   is(ResolvableStatus.RESOLVED));
+
+        ListIterator<YangLeafList> itr =
+                yangNode.getListOfLeafList().listIterator();
+        YangLeafList leafListInfo = itr.next();
+
+        // Check whether the information in the leaf is correct.
+        assertThat(leafListInfo.getName(), is("network-ref"));
+        info = (YangDerivedInfo) leafListInfo.getDataType()
+                .getDataTypeExtendedInfo();
+        assertThat(info.getEffectiveBuiltInType(), is(IDENTITYREF));
+        type1 = info.getReferredTypeDef().getTypeList().get(0);
+        idRef1 = (YangIdentityRef) type1.getDataTypeExtendedInfo();
+        assertThat(idRef1.getResolvableStatus(), is(ResolvableStatus.RESOLVED));
+    }
+}
diff --git a/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/InterFileIfFeatureLinkingTest.java b/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/InterFileIfFeatureLinkingTest.java
new file mode 100644
index 0000000..afcee89
--- /dev/null
+++ b/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/InterFileIfFeatureLinkingTest.java
@@ -0,0 +1,469 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.plugin.maven;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.hamcrest.core.Is;
+import org.junit.Test;
+import org.onosproject.yang.compiler.datamodel.YangContainer;
+import org.onosproject.yang.compiler.datamodel.YangFeature;
+import org.onosproject.yang.compiler.datamodel.YangIfFeature;
+import org.onosproject.yang.compiler.datamodel.YangLeaf;
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.utils.ResolvableStatus;
+import org.onosproject.yang.compiler.linker.impl.YangLinkerManager;
+import org.onosproject.yang.compiler.linker.impl.YangLinkerUtils;
+import org.onosproject.yang.compiler.utils.io.impl.YangFileScanner;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.ListIterator;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.Is.is;
+import static org.onosproject.yang.compiler.datamodel.YangNodeType.MODULE_NODE;
+
+/**
+ * Test cases for testing inter file linking.
+ */
+public class InterFileIfFeatureLinkingTest {
+
+    private final YangUtilManager utilManager = new YangUtilManager();
+    private final YangLinkerManager yangLinkerManager = new YangLinkerManager();
+
+    /**
+     * Checks inter file feature linking with imported file.
+     */
+    @Test
+    public void processFeatureInImportedFile()
+            throws IOException, ParserException, MojoExecutionException {
+
+        String searchDir = "src/test/resources/interfilefeatureimport";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+
+        YangNode selfNode = null;
+        YangNode refNode1 = null;
+        YangNode refNode2 = null;
+
+        // Create YANG node set
+        yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+
+        // Add references to import list.
+        yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
+
+        YangLinkerUtils.updateFilePriority(utilManager.getYangNodeSet());
+
+        // Carry out inter-file linking.
+        yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
+
+        for (YangNode rootNode : utilManager.getYangNodeSet()) {
+            if (rootNode.getName().equals("syslog1")) {
+                selfNode = rootNode;
+            } else if (rootNode.getName().equals("syslog2")) {
+                refNode1 = rootNode;
+            } else {
+                refNode2 = rootNode;
+            }
+        }
+        // Check whether the data model tree returned is of type module.
+        assertThat(selfNode instanceof YangModule, is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(selfNode.getNodeType(), is(MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) selfNode;
+        assertThat(yangNode.getName(), is("syslog1"));
+
+        ListIterator<YangFeature> featureIterator = yangNode.getFeatureList().listIterator();
+        YangFeature feature = featureIterator.next();
+        assertThat(feature.getName(), is("frr-te"));
+
+        YangIfFeature ifFeature = feature.getIfFeatureList().iterator().next();
+        assertThat(ifFeature.getName().getName(), is("p2mp-te"));
+        assertThat(ifFeature.getName().getPrefix(), is("sys2"));
+        assertThat(ifFeature.getResolvableStatus(), Is.is(ResolvableStatus.RESOLVED));
+
+        YangContainer container = (YangContainer) selfNode.getChild();
+        assertThat(container.getName(), is("speed"));
+        YangLeaf leaf = container.getListOfLeaf().iterator().next();
+        assertThat(leaf.getName(), is("local-storage-limit"));
+
+        List<YangIfFeature> ifFeatureList = leaf.getIfFeatureList();
+        ifFeature = ifFeatureList.iterator().next();
+        assertThat(ifFeature.getName().getName(), is("frr-te"));
+        assertThat(ifFeature.getResolvableStatus(), Is.is(ResolvableStatus.RESOLVED));
+    }
+
+    /**
+     * Checks inter file feature linking with included file.
+     */
+    @Test
+    public void processFeatureInIncludedFile()
+            throws IOException, ParserException, MojoExecutionException {
+
+        String searchDir = "src/test/resources/interfilefeatureinclude";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+
+        YangNode selfNode = null;
+        YangNode refNode1 = null;
+        YangNode refNode2 = null;
+
+        // Create YANG node set
+        yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+
+        // Carry out linking of sub module with module.
+        yangLinkerManager.linkSubModulesToParentModule(utilManager.getYangNodeSet());
+
+        // Add references to import list.
+        yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
+
+        // Add references to include list.
+        yangLinkerManager.addRefToYangFilesIncludeList(utilManager.getYangNodeSet());
+
+        YangLinkerUtils.updateFilePriority(utilManager.getYangNodeSet());
+
+        // Carry out inter-file linking.
+        yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
+
+        for (YangNode rootNode : utilManager.getYangNodeSet()) {
+            if (rootNode.getName().equals("syslog3")) {
+                selfNode = rootNode;
+            } else if (rootNode.getName().equals("syslog4")) {
+                refNode1 = rootNode;
+            } else {
+                refNode2 = rootNode;
+            }
+        }
+
+        // Check whether the data model tree returned is of type module.
+        assertThat(selfNode instanceof YangModule, is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(selfNode.getNodeType(), is(MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) selfNode;
+        assertThat(yangNode.getName(), is("syslog3"));
+
+        ListIterator<YangFeature> featureIterator = yangNode.getFeatureList().listIterator();
+        YangFeature feature = featureIterator.next();
+        assertThat(feature.getName(), is("frr-te"));
+
+        YangIfFeature ifFeature = feature.getIfFeatureList().iterator().next();
+        assertThat(ifFeature.getName().getName(), is("p2mp-te"));
+        assertThat(ifFeature.getResolvableStatus(), Is.is(ResolvableStatus.RESOLVED));
+
+        YangContainer container = (YangContainer) selfNode.getChild();
+        assertThat(container.getName(), is("speed"));
+        YangLeaf leaf = container.getListOfLeaf().iterator().next();
+        assertThat(leaf.getName(), is("local-storage-limit"));
+
+        List<YangIfFeature> ifFeatureList = leaf.getIfFeatureList();
+        ifFeature = ifFeatureList.iterator().next();
+        assertThat(ifFeature.getName().getName(), is("frr-te"));
+        assertThat(ifFeature.getResolvableStatus(), Is.is(ResolvableStatus.RESOLVED));
+    }
+
+    /**
+     * Checks inter file feature linking with imported file with dependency.
+     */
+    @Test
+    public void processFeatureInImportedFileWithDependency()
+            throws IOException, ParserException, MojoExecutionException {
+
+        String searchDir = "src/test/resources/interfilefeatureimportdependency";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+
+        YangNode selfNode = null;
+        YangNode refNode1 = null;
+        YangNode refNode2 = null;
+
+        // Create YANG node set
+        yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+
+        // Add references to import list.
+        yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
+
+        // Update the priority for all the files.
+        YangLinkerUtils.updateFilePriority(utilManager.getYangNodeSet());
+
+        // Carry out inter-file linking.
+        yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
+
+        for (YangNode rootNode : utilManager.getYangNodeSet()) {
+            if (rootNode.getName().equals("syslog1")) {
+                selfNode = rootNode;
+            } else if (rootNode.getName().equals("syslog2")) {
+                refNode1 = rootNode;
+            } else {
+                refNode2 = rootNode;
+            }
+        }
+
+        // Check whether the data model tree returned is of type module.
+        assertThat(selfNode instanceof YangModule, is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(selfNode.getNodeType(), is(MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) selfNode;
+        assertThat(yangNode.getName(), is("syslog1"));
+
+        ListIterator<YangFeature> featureIterator = yangNode.getFeatureList().listIterator();
+        YangFeature feature = featureIterator.next();
+        assertThat(feature.getName(), is("frr-te"));
+
+        YangIfFeature ifFeature = feature.getIfFeatureList().iterator().next();
+        assertThat(ifFeature.getName().getName(), is("p2mp-te"));
+        assertThat(ifFeature.getName().getPrefix(), is("sys2"));
+        assertThat(ifFeature.getResolvableStatus(), Is.is(ResolvableStatus.RESOLVED));
+
+        YangContainer container = (YangContainer) selfNode.getChild();
+        assertThat(container.getName(), is("speed"));
+        YangLeaf leaf = container.getListOfLeaf().iterator().next();
+        assertThat(leaf.getName(), is("local-storage-limit"));
+
+        List<YangIfFeature> ifFeatureList = leaf.getIfFeatureList();
+        ifFeature = ifFeatureList.iterator().next();
+        assertThat(ifFeature.getName().getName(), is("frr-te"));
+        assertThat(ifFeature.getResolvableStatus(), Is.is(ResolvableStatus.RESOLVED));
+    }
+
+    /**
+     * Checks inter file feature linking with included file with dependency.
+     */
+    @Test
+    public void processFeatureInIncludedFileWithDependency()
+            throws IOException, ParserException, MojoExecutionException {
+
+        String searchDir = "src/test/resources/interfilefeatureincludedependency";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+
+        YangNode selfNode = null;
+        YangNode refNode1 = null;
+        YangNode refNode2 = null;
+
+        // Create YANG node set
+        yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+
+        // Carry out linking of sub module with module.
+        yangLinkerManager.linkSubModulesToParentModule(utilManager.getYangNodeSet());
+
+        // Add references to include list.
+        yangLinkerManager.addRefToYangFilesIncludeList(utilManager.getYangNodeSet());
+
+        // Add references to import list.
+        yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
+
+        YangLinkerUtils.updateFilePriority(utilManager.getYangNodeSet());
+
+        // Carry out inter-file linking.
+        yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
+
+        for (YangNode rootNode : utilManager.getYangNodeSet()) {
+            if (rootNode.getName().equals("syslog1")) {
+                selfNode = rootNode;
+            } else if (rootNode.getName().equals("syslog2")) {
+                refNode1 = rootNode;
+            } else {
+                refNode2 = rootNode;
+            }
+        }
+
+        // Check whether the data model tree returned is of type module.
+        assertThat(selfNode instanceof YangModule, is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(selfNode.getNodeType(), is(MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) selfNode;
+        assertThat(yangNode.getName(), is("syslog1"));
+
+        ListIterator<YangFeature> featureIterator = yangNode.getFeatureList().listIterator();
+        YangFeature feature = featureIterator.next();
+        assertThat(feature.getName(), is("frr-te"));
+
+        YangIfFeature ifFeature = feature.getIfFeatureList().iterator().next();
+        assertThat(ifFeature.getName().getName(), is("p2mp-te"));
+        assertThat(ifFeature.getResolvableStatus(), Is.is(ResolvableStatus.RESOLVED));
+
+        YangContainer container = (YangContainer) selfNode.getChild();
+        assertThat(container.getName(), is("speed"));
+        YangLeaf leaf = container.getListOfLeaf().iterator().next();
+        assertThat(leaf.getName(), is("local-storage-limit"));
+
+        List<YangIfFeature> ifFeatureList = leaf.getIfFeatureList();
+        ifFeature = ifFeatureList.iterator().next();
+        assertThat(ifFeature.getName().getName(), is("frr-te"));
+        assertThat(ifFeature.getResolvableStatus(), Is.is(ResolvableStatus.RESOLVED));
+    }
+
+    /**
+     * Checks inter file feature linking with imported file with dependency
+     * feature undefined.
+     */
+    @Test
+    public void processFeatureInImportedFileWithDependencyUndefined()
+            throws IOException, ParserException, MojoExecutionException {
+
+        String searchDir = "src/test/resources/interfilefeatureimportdependencyUndefined";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+
+        YangNode selfNode = null;
+        YangNode refNode1 = null;
+        YangNode refNode2 = null;
+
+        // Create YANG node set
+        yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+
+        // Add references to import list.
+        yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
+
+        YangLinkerUtils.updateFilePriority(utilManager.getYangNodeSet());
+
+        // Carry out inter-file linking.
+        yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
+
+        for (YangNode rootNode : utilManager.getYangNodeSet()) {
+            if (rootNode.getName().equals("syslog1")) {
+                selfNode = rootNode;
+            } else if (rootNode.getName().equals("syslog2")) {
+                refNode1 = rootNode;
+            } else {
+                refNode2 = rootNode;
+            }
+        }
+
+        // Check whether the data model tree returned is of type module.
+        assertThat(selfNode instanceof YangModule, is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(selfNode.getNodeType(), is(MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) selfNode;
+        assertThat(yangNode.getName(), is("syslog1"));
+
+        ListIterator<YangFeature> featureIterator = yangNode.getFeatureList().listIterator();
+        YangFeature feature = featureIterator.next();
+        assertThat(feature.getName(), is("frr-te"));
+
+        YangIfFeature ifFeature = feature.getIfFeatureList().iterator().next();
+        assertThat(ifFeature.getName().getName(), is("p2mp-te"));
+        assertThat(ifFeature.getName().getPrefix(), is("sys2"));
+        assertThat(ifFeature.getResolvableStatus(), Is.is(ResolvableStatus.INTRA_FILE_RESOLVED));
+
+        YangContainer container = (YangContainer) selfNode.getChild();
+        assertThat(container.getName(), is("speed"));
+        YangLeaf leaf = container.getListOfLeaf().iterator().next();
+        assertThat(leaf.getName(), is("local-storage-limit"));
+
+        List<YangIfFeature> ifFeatureList = leaf.getIfFeatureList();
+        ifFeature = ifFeatureList.iterator().next();
+        assertThat(ifFeature.getName().getName(), is("frr-te"));
+        assertThat(ifFeature.getResolvableStatus(), Is.is(ResolvableStatus.INTRA_FILE_RESOLVED));
+    }
+
+    /**
+     * Checks inter file feature linking with included file with dependency
+     * feature undefined.
+     */
+    @Test
+    public void processFeatureInIncludedFileWithDependencyUndefined()
+            throws IOException, ParserException, MojoExecutionException {
+
+        String searchDir = "src/test/resources/interfilefeatureincludedependencyUndefined";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+
+        YangNode selfNode = null;
+        YangNode refNode1 = null;
+        YangNode refNode2 = null;
+
+        // Create YANG node set
+        yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+
+        // Carry out linking of sub module with module.
+        yangLinkerManager.linkSubModulesToParentModule(utilManager.getYangNodeSet());
+
+        // Add references to import list.
+        yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
+
+        // Add references to include list.
+        yangLinkerManager.addRefToYangFilesIncludeList(utilManager.getYangNodeSet());
+
+        YangLinkerUtils.updateFilePriority(utilManager.getYangNodeSet());
+
+        // Carry out inter-file linking.
+        yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
+
+        for (YangNode rootNode : utilManager.getYangNodeSet()) {
+            if (rootNode.getName().equals("syslog1")) {
+                selfNode = rootNode;
+            } else if (rootNode.getName().equals("syslog2")) {
+                refNode1 = rootNode;
+            } else {
+                refNode2 = rootNode;
+            }
+        }
+
+        // Check whether the data model tree returned is of type module.
+        assertThat(selfNode instanceof YangModule, is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(selfNode.getNodeType(), is(MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) selfNode;
+        assertThat(yangNode.getName(), is("syslog1"));
+
+        ListIterator<YangFeature> featureIterator = yangNode.getFeatureList().listIterator();
+        YangFeature feature = featureIterator.next();
+        assertThat(feature.getName(), is("frr-te"));
+
+        YangIfFeature ifFeature = feature.getIfFeatureList().iterator().next();
+        assertThat(ifFeature.getName().getName(), is("p2mp-te"));
+        assertThat(ifFeature.getResolvableStatus(), Is.is(ResolvableStatus.INTRA_FILE_RESOLVED));
+
+        YangContainer container = (YangContainer) selfNode.getChild();
+        assertThat(container.getName(), is("speed"));
+        YangLeaf leaf = container.getListOfLeaf().iterator().next();
+        assertThat(leaf.getName(), is("local-storage-limit"));
+
+        List<YangIfFeature> ifFeatureList = leaf.getIfFeatureList();
+        ifFeature = ifFeatureList.iterator().next();
+        assertThat(ifFeature.getName().getName(), is("frr-te"));
+        assertThat(ifFeature.getResolvableStatus(), Is.is(ResolvableStatus.INTRA_FILE_RESOLVED));
+    }
+}
+
diff --git a/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/InterFileLeafrefLinkingTest.java b/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/InterFileLeafrefLinkingTest.java
new file mode 100644
index 0000000..ebda757
--- /dev/null
+++ b/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/InterFileLeafrefLinkingTest.java
@@ -0,0 +1,438 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.plugin.maven;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.hamcrest.core.Is;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.onosproject.yang.compiler.datamodel.YangContainer;
+import org.onosproject.yang.compiler.datamodel.YangLeaf;
+import org.onosproject.yang.compiler.datamodel.YangLeafList;
+import org.onosproject.yang.compiler.datamodel.YangLeafRef;
+import org.onosproject.yang.compiler.datamodel.YangList;
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangNodeType;
+import org.onosproject.yang.compiler.datamodel.utils.ResolvableStatus;
+import org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes;
+import org.onosproject.yang.compiler.linker.impl.YangLinkerManager;
+import org.onosproject.yang.compiler.utils.io.impl.YangFileScanner;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.ListIterator;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.Is.is;
+import static org.onosproject.yang.compiler.datamodel.YangNodeType.MODULE_NODE;
+import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes.LEAFREF;
+import static org.onosproject.yang.compiler.linker.impl.YangLinkerUtils.updateFilePriority;
+
+/**
+ * Test cases for testing leafref inter file linking.
+ */
+public class InterFileLeafrefLinkingTest {
+
+    @Rule
+    public ExpectedException thrown = ExpectedException.none();
+
+    private final YangUtilManager utilManager = new YangUtilManager();
+    private final YangLinkerManager yangLinkerManager = new YangLinkerManager();
+
+    /**
+     * Checks inter file leafref linking.
+     */
+    @Test
+    public void processInterFileLeafrefLinking()
+            throws IOException, ParserException, MojoExecutionException {
+
+        String searchDir = "src/test/resources/leafreflinker/interfile/interfileleafrefwithimport";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+        YangNode refNode = null;
+        YangNode selfNode = null;
+
+        // Create YANG node set
+        yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+
+        // Add references to import list.
+        yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
+
+        updateFilePriority(utilManager.getYangNodeSet());
+
+        // Carry out inter-file linking.
+        yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
+
+        Iterator<YangNode> yangNodeIterator = utilManager.getYangNodeSet().iterator();
+
+        YangNode rootNode = yangNodeIterator.next();
+
+        if (rootNode.getName().equals("module1")) {
+            selfNode = rootNode;
+            refNode = yangNodeIterator.next();
+        } else {
+            refNode = rootNode;
+            selfNode = yangNodeIterator.next();
+        }
+
+        // Check whether the data model tree returned is of type module.
+        assertThat(selfNode instanceof YangModule, is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(selfNode.getNodeType(), is(MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) selfNode;
+        assertThat(yangNode.getName(), is("module1"));
+
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("invalid-interval"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("leafref"));
+        assertThat(leafInfo.getDataType().getDataType(), is(LEAFREF));
+
+        // Check whether the data model tree returned is of type module.
+        assertThat(refNode instanceof YangModule, is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(refNode.getNodeType(), is(MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode1 = (YangModule) refNode;
+        assertThat(yangNode1.getName(), is("module2"));
+        YangLeaf leafInfo1 = yangNode1.getListOfLeaf().listIterator().next();
+
+        YangLeafRef leafref = (YangLeafRef) leafInfo.getDataType().getDataTypeExtendedInfo();
+
+        assertThat(leafref.getReferredLeafOrLeafList(), is(leafInfo1));
+        assertThat(leafref.getResolvableStatus(), Is.is(ResolvableStatus.RESOLVED));
+
+        assertThat(leafref.getEffectiveDataType().getDataType(),
+                is(YangDataTypes.STRING));
+    }
+
+    /**
+     * Checks inter file resolution when leafref from grouping refers to other file.
+     */
+    @Test
+    public void processInterFileLeafrefFromGroupingRefersToOtherFile()
+            throws IOException, ParserException {
+
+        String searchDir = "src/test/resources/leafreflinker/interfile/interfileleafreffromgroupingreferstootherfile";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+        YangNode selfNode = null;
+        YangNode refNode = null;
+
+        // Create YANG node set
+        yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+
+        // Add references to import list.
+        yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
+
+        updateFilePriority(utilManager.getYangNodeSet());
+
+        // Carry out inter-file linking.
+        yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
+
+        Iterator<YangNode> yangNodeIterator = utilManager.getYangNodeSet().iterator();
+
+        YangNode rootNode = yangNodeIterator.next();
+
+        if (rootNode.getName().equals("module1")) {
+            selfNode = rootNode;
+            refNode = yangNodeIterator.next();
+        } else {
+            refNode = rootNode;
+            selfNode = yangNodeIterator.next();
+        }
+
+        // Check whether the data model tree returned is of type module.
+        assertThat(selfNode instanceof YangModule, is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(selfNode.getNodeType(), is(MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) selfNode;
+        assertThat(yangNode.getName(), is("module1"));
+
+        YangList list = (YangList) yangNode.getChild().getChild();
+        ListIterator<YangLeaf> leafIterator = list.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("link-tp"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("leafref"));
+        assertThat(leafInfo.getDataType().getDataType(), is(LEAFREF));
+
+        YangLeafRef leafref = (YangLeafRef) leafInfo.getDataType().getDataTypeExtendedInfo();
+
+        YangLeaf leafInfo2 = (YangLeaf) leafref.getReferredLeafOrLeafList();
+        assertThat(leafref.getReferredLeafOrLeafList(), is(leafInfo2));
+        assertThat(leafref.getResolvableStatus(), Is.is(ResolvableStatus.RESOLVED));
+
+        assertThat(leafref.getEffectiveDataType().getDataType(),
+                is(YangDataTypes.STRING));
+    }
+
+    /**
+     * Checks inter file resolution when leafref from grouping with prefix is changed properly during cloning.
+     */
+    @Test
+    public void processInterFileLeafrefFromGroupingWithPrefixIsCloned()
+            throws IOException, ParserException {
+
+        String searchDir = "src/test/resources/leafreflinker/interfile/leafrefInGroupingWithPrefix";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+        YangNode selfNode = null;
+        YangNode refNode = null;
+
+        // Create YANG node set
+        yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+
+        // Add references to import list.
+        yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
+
+        updateFilePriority(utilManager.getYangNodeSet());
+
+        // Carry out inter-file linking.
+        yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
+
+        Iterator<YangNode> yangNodeIterator = utilManager.getYangNodeSet().iterator();
+
+        YangNode rootNode = yangNodeIterator.next();
+
+        if (rootNode.getName().equals("LeafrefInGroupingOfModule1")) {
+            selfNode = rootNode;
+            refNode = yangNodeIterator.next();
+        } else {
+            refNode = rootNode;
+            selfNode = yangNodeIterator.next();
+        }
+
+        // Check whether the data model tree returned is of type module.
+        assertThat(selfNode instanceof YangModule, is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(selfNode.getNodeType(), is(MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) selfNode;
+        assertThat(yangNode.getName(), is("LeafrefInGroupingOfModule1"));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode1 = (YangModule) refNode;
+        assertThat(yangNode1.getName(), is("GroupingCopiedInModule2"));
+
+        YangContainer yangContainer = (YangContainer) yangNode1.getChild();
+
+        ListIterator<YangLeaf> leafIterator = yangContainer.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("network-ref"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("leafref"));
+        assertThat(leafInfo.getDataType().getDataType(), is(LEAFREF));
+
+        YangLeafRef leafref = (YangLeafRef) leafInfo.getDataType().getDataTypeExtendedInfo();
+
+        YangLeaf leafInfo2 = (YangLeaf) leafref.getReferredLeafOrLeafList();
+        assertThat(leafref.getReferredLeafOrLeafList(), is(leafInfo2));
+        assertThat(leafref.getResolvableStatus(), Is.is(ResolvableStatus.RESOLVED));
+
+        assertThat(leafref.getEffectiveDataType().getDataType(),
+                is(YangDataTypes.STRING));
+    }
+
+    /**
+     * Checks inter file resolution when leafref from grouping with prefix is changed properly during cloning with
+     * multi reference.
+     */
+    @Test
+    public void processInterFileLeafrefFromGroupingWithPrefixIsClonedMultiReference()
+            throws IOException, ParserException {
+
+        String searchDir = "src/test/resources/leafreflinker/interfile/leafrefInGroupingWithPrefixAndManyReference";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+        YangNode selfNode = null;
+        YangNode refNode = null;
+
+        // Create YANG node set
+        yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+
+        // Add references to import list.
+        yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
+
+        updateFilePriority(utilManager.getYangNodeSet());
+
+        // Carry out inter-file linking.
+        yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
+
+        Iterator<YangNode> yangNodeIterator = utilManager.getYangNodeSet().iterator();
+
+        YangNode rootNode = yangNodeIterator.next();
+
+        if (rootNode.getName().equals("ietf-network")) {
+            selfNode = rootNode;
+            refNode = yangNodeIterator.next();
+        } else {
+            refNode = rootNode;
+            selfNode = yangNodeIterator.next();
+        }
+
+        // Check whether the data model tree returned is of type module.
+        assertThat(selfNode instanceof YangModule, is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(selfNode.getNodeType(), is(MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) selfNode;
+        assertThat(yangNode.getName(), is("ietf-network"));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode1 = (YangModule) refNode;
+        assertThat(yangNode1.getName(), is("ietf-te-topology"));
+
+        YangContainer yangContainer = (YangContainer) yangNode1.getChild().getNextSibling();
+        ListIterator<YangLeaf> leafIterator;
+        YangLeaf leafInfo;
+
+        leafIterator = yangContainer.getListOfLeaf().listIterator();
+        leafInfo = leafIterator.next();
+        leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("node-ref"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("leafref"));
+        assertThat(leafInfo.getDataType().getDataType(), is(LEAFREF));
+
+        YangLeafRef leafref = (YangLeafRef) leafInfo.getDataType().getDataTypeExtendedInfo();
+
+        YangLeaf leafInfo2 = (YangLeaf) leafref.getReferredLeafOrLeafList();
+        assertThat(leafref.getReferredLeafOrLeafList(), is(leafInfo2));
+        assertThat(leafref.getResolvableStatus(), Is.is(ResolvableStatus.RESOLVED));
+
+        assertThat(leafref.getEffectiveDataType().getDataType(),
+                is(YangDataTypes.DERIVED));
+
+        leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("network-ref"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("leafref"));
+        assertThat(leafInfo.getDataType().getDataType(), is(LEAFREF));
+
+        YangLeafRef leafref1 = (YangLeafRef) leafInfo.getDataType().getDataTypeExtendedInfo();
+
+        YangLeaf leafInfo4 = (YangLeaf) leafref1.getReferredLeafOrLeafList();
+        assertThat(leafref1.getReferredLeafOrLeafList(), is(leafInfo4));
+        assertThat(leafref1.getResolvableStatus(), Is.is(ResolvableStatus.RESOLVED));
+
+        assertThat(leafref1.getEffectiveDataType().getDataType(),
+                is(YangDataTypes.DERIVED));
+    }
+
+    /**
+     * Checks self resolution when leafref under typedef been referred multiple times.
+     */
+    @Test
+    public void processLeafrefWhenUsedMultipleTimes()
+            throws IOException, ParserException {
+        String searchDir = "src/test/resources/leafreflinker/interfile/typedefreferredmultipletimes";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+        YangNode selfNode = null;
+
+        // Create YANG node set
+        yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+
+        // Add references to import list.
+        yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
+
+        updateFilePriority(utilManager.getYangNodeSet());
+
+        // Carry out inter-file linking.
+        yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
+
+        Iterator<YangNode> yangNodeIterator = utilManager.getYangNodeSet().iterator();
+
+        YangNode rootNode = yangNodeIterator.next();
+
+        if (rootNode.getName().equals("ietf-interfaces")) {
+            selfNode = rootNode;
+        }
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((selfNode instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(selfNode.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) selfNode;
+        assertThat(yangNode.getName(), is("ietf-interfaces"));
+
+        YangContainer container = (YangContainer) yangNode.getChild().getNextSibling();
+
+        YangList list = (YangList) container.getChild();
+
+        ListIterator<YangLeafList> leafIterator;
+        YangLeafList leafInfo;
+
+        leafIterator = list.getListOfLeafList().listIterator();
+        leafInfo = leafIterator.next();
+
+        // Check whether the information in the leaf is correct.
+        assertThat(leafInfo.getName(), is("higher-layer-if"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("leafref"));
+        assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.LEAFREF));
+        YangLeafRef leafref = (YangLeafRef) (leafInfo.getDataType().getDataTypeExtendedInfo());
+
+        // Check whether leafref type got resolved.
+        assertThat(leafref.getResolvableStatus(),
+                is(ResolvableStatus.RESOLVED));
+
+        // Check the effective type for the leaf.
+        assertThat(leafref.getEffectiveDataType().getDataType(),
+                is(YangDataTypes.STRING));
+
+        leafInfo = leafIterator.next();
+
+        // Check whether the information in the leaf is correct.
+        assertThat(leafInfo.getName(), is("lower-layer-if"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("leafref"));
+        assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.LEAFREF));
+        YangLeafRef leafref1 = (YangLeafRef) (leafInfo.getDataType().getDataTypeExtendedInfo());
+
+        // Check whether leafref type got resolved.
+        assertThat(leafref1.getResolvableStatus(),
+                is(ResolvableStatus.RESOLVED));
+
+        // Check the effective type for the leaf.
+        assertThat(leafref1.getEffectiveDataType().getDataType(),
+                is(YangDataTypes.STRING));
+    }
+}
diff --git a/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/InterFileLinkingTest.java b/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/InterFileLinkingTest.java
new file mode 100644
index 0000000..ed431be
--- /dev/null
+++ b/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/InterFileLinkingTest.java
@@ -0,0 +1,935 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.plugin.maven;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.hamcrest.core.Is;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.onosproject.yang.compiler.datamodel.YangAugment;
+import org.onosproject.yang.compiler.datamodel.YangChoice;
+import org.onosproject.yang.compiler.datamodel.YangContainer;
+import org.onosproject.yang.compiler.datamodel.YangDerivedInfo;
+import org.onosproject.yang.compiler.datamodel.YangGrouping;
+import org.onosproject.yang.compiler.datamodel.YangLeaf;
+import org.onosproject.yang.compiler.datamodel.YangList;
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangNodeType;
+import org.onosproject.yang.compiler.datamodel.YangTypeDef;
+import org.onosproject.yang.compiler.datamodel.YangUses;
+import org.onosproject.yang.compiler.datamodel.utils.ResolvableStatus;
+import org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes;
+import org.onosproject.yang.compiler.linker.impl.YangLinkerManager;
+import org.onosproject.yang.compiler.linker.impl.YangLinkerUtils;
+import org.onosproject.yang.compiler.utils.io.YangPluginConfig;
+import org.onosproject.yang.compiler.utils.io.impl.YangFileScanner;
+import org.onosproject.yang.compiler.utils.io.impl.YangIoUtils;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.YangUtilsParserManager;
+
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.ListIterator;
+
+import static org.hamcrest.CoreMatchers.nullValue;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.Is.is;
+import static org.onosproject.yang.compiler.datamodel.YangNodeType.MODULE_NODE;
+import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes.DERIVED;
+import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes.STRING;
+
+/**
+ * Test cases for testing inter file linking.
+ */
+public class InterFileLinkingTest {
+
+    @Rule
+    public ExpectedException thrown = ExpectedException.none();
+
+    private final YangUtilsParserManager manager = new YangUtilsParserManager();
+    private final YangUtilManager utilManager = new YangUtilManager();
+    private final YangLinkerManager yangLinkerManager = new YangLinkerManager();
+
+    /**
+     * Checks inter file type linking.
+     */
+    @Test
+    public void processInterFileTypeLinking()
+            throws IOException, ParserException, MojoExecutionException {
+
+        String searchDir = "src/test/resources/interfiletype";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+
+        YangNode refNode = null;
+        YangNode selfNode = null;
+
+        // Create YANG node set
+        yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+
+        // Add references to import list.
+        yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
+
+        YangLinkerUtils.updateFilePriority(utilManager.getYangNodeSet());
+
+        // Carry out inter-file linking.
+        yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
+
+        Iterator<YangNode> yangNodeIterator = utilManager.getYangNodeSet().iterator();
+
+        YangNode rootNode = yangNodeIterator.next();
+
+        if (rootNode.getName().equals("module1")) {
+            selfNode = rootNode;
+            refNode = yangNodeIterator.next();
+        } else {
+            refNode = rootNode;
+            selfNode = yangNodeIterator.next();
+        }
+
+        // Check whether the data model tree returned is of type module.
+        assertThat(selfNode instanceof YangModule, is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(selfNode.getNodeType(), is(MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) selfNode;
+        assertThat(yangNode.getName(), is("module1"));
+
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("invalid-interval"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("hello"));
+        assertThat(leafInfo.getDataType().getDataType(), is(DERIVED));
+
+        assertThat(((YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo()).getReferredTypeDef(),
+                   Is.is((YangTypeDef) refNode.getChild()));
+
+        assertThat(leafInfo.getDataType().getResolvableStatus(), Is.is(ResolvableStatus.RESOLVED));
+
+        YangDerivedInfo<?> derivedInfo = (YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo();
+
+        // Check for the effective built-in type.
+        assertThat(derivedInfo.getEffectiveBuiltInType(), is(STRING));
+
+        // Check for the restriction.
+        assertThat(derivedInfo.getLengthRestrictionString(), is(nullValue()));
+        assertThat(derivedInfo.getRangeRestrictionString(), is(nullValue()));
+        assertThat(derivedInfo.getPatternRestriction(), is(nullValue()));
+        assertThat(derivedInfo.getResolvedExtendedInfo(), is(nullValue()));
+    }
+
+    /**
+     * Checks inter file uses linking.
+     */
+    @Test
+    public void processInterFileUsesLinking()
+            throws IOException, ParserException, MojoExecutionException {
+
+        String searchDir = "src/test/resources/interfileuses";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+
+        YangNode refNode = null;
+        YangNode selfNode = null;
+
+        // Create YANG node set
+        yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+
+        // Add references to import list.
+        yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
+
+        YangLinkerUtils.updateFilePriority(utilManager.getYangNodeSet());
+
+        // Carry out inter-file linking.
+        yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
+
+        Iterator<YangNode> yangNodeIterator = utilManager.getYangNodeSet().iterator();
+
+        YangNode rootNode = yangNodeIterator.next();
+
+        if (rootNode.getName().equals("module1")) {
+            selfNode = rootNode;
+            refNode = yangNodeIterator.next();
+        } else {
+            refNode = rootNode;
+            selfNode = yangNodeIterator.next();
+        }
+
+        // Check whether the data model tree returned is of type module.
+        assertThat(selfNode instanceof YangModule, is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(selfNode.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) selfNode;
+        assertThat(yangNode.getName(), is("module1"));
+
+        ListIterator<YangLeaf> leafIterator;
+        YangLeaf leafInfo;
+
+        // Check whether grouping is the sibling of module's child.
+        assertThat(refNode.getChild() instanceof YangGrouping, is(true));
+
+        YangGrouping grouping = (YangGrouping) refNode.getChild();
+        leafIterator = grouping.getListOfLeaf().listIterator();
+        leafInfo = leafIterator.next();
+
+        // Check whether the information in the leaf is correct under grouping.
+        assertThat(leafInfo.getName(), is("hello"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("string"));
+        assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.STRING));
+
+        // Check whether uses is module's child.
+        assertThat(yangNode.getChild() instanceof YangUses, is(true));
+        YangUses uses = (YangUses) yangNode.getChild();
+
+        // Check whether uses get resolved.
+        assertThat(uses.getResolvableStatus(),
+                   is(ResolvableStatus.RESOLVED));
+    }
+
+    /**
+     * Checks inter file type linking with include list.
+     */
+    @Test
+    public void processInterFileTypeLinkingWithIncludeList()
+            throws IOException, ParserException, MojoExecutionException {
+
+        String searchDir = "src/test/resources/interfiletypewithinclude";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+
+        YangNode refNode = null;
+        YangNode selfNode = null;
+
+        // Create YANG node set
+        yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+
+        // Carry out linking of sub module with module.
+        yangLinkerManager.linkSubModulesToParentModule(utilManager.getYangNodeSet());
+
+        // Add reference to include list.
+        yangLinkerManager.addRefToYangFilesIncludeList(utilManager.getYangNodeSet());
+
+        YangLinkerUtils.updateFilePriority(utilManager.getYangNodeSet());
+
+        // Carry out inter-file linking.
+        yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
+
+        Iterator<YangNode> yangNodeIterator = utilManager.getYangNodeSet().iterator();
+
+        YangNode rootNode = yangNodeIterator.next();
+
+        if (rootNode.getName().equals("module1")) {
+            selfNode = rootNode;
+            refNode = yangNodeIterator.next();
+        } else {
+            refNode = rootNode;
+            selfNode = yangNodeIterator.next();
+        }
+
+        // Check whether the data model tree returned is of type module.
+        assertThat(selfNode instanceof YangModule, is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(selfNode.getNodeType(), is(MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) selfNode;
+        assertThat(yangNode.getName(), is("module1"));
+
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("invalid-interval"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("hello"));
+        assertThat(leafInfo.getDataType().getDataType(), is(DERIVED));
+
+        assertThat(((YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo()).getReferredTypeDef(),
+                   is((YangTypeDef) refNode.getChild()));
+
+        assertThat(leafInfo.getDataType().getResolvableStatus(), Is.is(ResolvableStatus.RESOLVED));
+
+        YangDerivedInfo<?> derivedInfo = (YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo();
+
+        // Check for the effective built-in type.
+        assertThat(derivedInfo.getEffectiveBuiltInType(), is(STRING));
+
+        // Check for the restriction.
+        assertThat(derivedInfo.getLengthRestrictionString(), is(nullValue()));
+        assertThat(derivedInfo.getRangeRestrictionString(), is(nullValue()));
+        assertThat(derivedInfo.getPatternRestriction(), is(nullValue()));
+        assertThat(derivedInfo.getResolvedExtendedInfo(), is(nullValue()));
+    }
+
+    /**
+     * Checks inter file uses linking with include list.
+     */
+    @Test
+    public void processInterFileUsesLinkingWithInclude()
+            throws IOException, ParserException, MojoExecutionException {
+
+        String searchDir = "src/test/resources/interfileuseswithinclude";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+
+        YangNode refNode = null;
+        YangNode selfNode = null;
+
+        // Create YANG node set
+        yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+
+        // Carry out linking of sub module with module.
+        yangLinkerManager.linkSubModulesToParentModule(utilManager.getYangNodeSet());
+
+        // Add reference to include list.
+        yangLinkerManager.addRefToYangFilesIncludeList(utilManager.getYangNodeSet());
+
+        YangLinkerUtils.updateFilePriority(utilManager.getYangNodeSet());
+
+        // Carry out inter-file linking.
+        yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
+
+        Iterator<YangNode> yangNodeIterator = utilManager.getYangNodeSet().iterator();
+
+        YangNode rootNode = yangNodeIterator.next();
+
+        if (rootNode.getName().equals("module1")) {
+            selfNode = rootNode;
+            refNode = yangNodeIterator.next();
+        } else {
+            refNode = rootNode;
+            selfNode = yangNodeIterator.next();
+        }
+
+        // Check whether the data model tree returned is of type module.
+        assertThat(selfNode instanceof YangModule, is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(selfNode.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) selfNode;
+        assertThat(yangNode.getName(), is("module1"));
+
+        ListIterator<YangLeaf> leafIterator;
+        YangLeaf leafInfo;
+
+        // Check whether grouping is the sibling of module's child.
+        assertThat(refNode.getChild() instanceof YangGrouping, is(true));
+
+        YangGrouping grouping = (YangGrouping) refNode.getChild();
+        leafIterator = grouping.getListOfLeaf().listIterator();
+        leafInfo = leafIterator.next();
+
+        // Check whether the information in the leaf is correct under grouping.
+        assertThat(leafInfo.getName(), is("hello"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("string"));
+        assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.STRING));
+
+        // Check whether uses is module's child.
+        assertThat(yangNode.getChild() instanceof YangUses, is(true));
+        YangUses uses = (YangUses) yangNode.getChild();
+
+        // Check whether uses get resolved.
+        assertThat(uses.getResolvableStatus(),
+                   is(ResolvableStatus.RESOLVED));
+    }
+
+    /**
+     * Checks inter file type linking with revision.
+     */
+    @Test
+    public void processInterFileTypeLinkingWithRevision()
+            throws IOException, ParserException, MojoExecutionException {
+
+        String searchDir = "src/test/resources/interfiletypewithrevision";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+
+        YangNode refNode = null;
+        YangNode selfNode = null;
+
+        // Create YANG node set
+        yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+
+        // Add references to import list.
+        yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
+
+        YangLinkerUtils.updateFilePriority(utilManager.getYangNodeSet());
+
+        // Carry out inter-file linking.
+        yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
+
+        Iterator<YangNode> yangNodeIterator = utilManager.getYangNodeSet().iterator();
+
+        YangNode rootNode = yangNodeIterator.next();
+
+        if (rootNode.getName().equals("module1")) {
+            selfNode = rootNode;
+            refNode = yangNodeIterator.next();
+        } else {
+            refNode = rootNode;
+            selfNode = yangNodeIterator.next();
+        }
+
+        // Check whether the data model tree returned is of type module.
+        assertThat(selfNode instanceof YangModule, is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(selfNode.getNodeType(), is(MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) selfNode;
+        assertThat(yangNode.getName(), is("module1"));
+
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("invalid-interval"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("hello"));
+        assertThat(leafInfo.getDataType().getDataType(), is(DERIVED));
+
+        assertThat(((YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo()).getReferredTypeDef(),
+                   is((YangTypeDef) refNode.getChild()));
+
+        assertThat(leafInfo.getDataType().getResolvableStatus(), Is.is(ResolvableStatus.RESOLVED));
+
+        YangDerivedInfo<?> derivedInfo = (YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo();
+
+        // Check for the effective built-in type.
+        assertThat(derivedInfo.getEffectiveBuiltInType(), is(STRING));
+
+        // Check for the restriction.
+        assertThat(derivedInfo.getLengthRestrictionString(), is(nullValue()));
+        assertThat(derivedInfo.getRangeRestrictionString(), is(nullValue()));
+        assertThat(derivedInfo.getPatternRestriction(), is(nullValue()));
+        assertThat(derivedInfo.getResolvedExtendedInfo(), is(nullValue()));
+    }
+
+    /**
+     * Checks inter file type linking with revision in name.
+     */
+    @Test
+    public void processInterFileTypeLinkingWithRevisionInName()
+            throws IOException, ParserException, MojoExecutionException {
+
+        String searchDir = "src/test/resources/interfiletypewithrevisioninname";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+
+        YangNode refNode = null;
+        YangNode selfNode = null;
+
+        // Create YANG node set
+        yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+
+        // Add references to import list.
+        yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
+
+        YangLinkerUtils.updateFilePriority(utilManager.getYangNodeSet());
+
+        // Carry out inter-file linking.
+        yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
+
+        Iterator<YangNode> yangNodeIterator = utilManager.getYangNodeSet().iterator();
+
+        YangNode rootNode = yangNodeIterator.next();
+
+        if (rootNode.getName().equals("module1")) {
+            selfNode = rootNode;
+            refNode = yangNodeIterator.next();
+        } else {
+            refNode = rootNode;
+            selfNode = yangNodeIterator.next();
+        }
+
+        // Check whether the data model tree returned is of type module.
+        assertThat(selfNode instanceof YangModule, is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(selfNode.getNodeType(), is(MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) selfNode;
+        assertThat(yangNode.getName(), is("module1"));
+
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("invalid-interval"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("hello"));
+        assertThat(leafInfo.getDataType().getDataType(), is(DERIVED));
+
+        assertThat(((YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo()).getReferredTypeDef(),
+                   is((YangTypeDef) refNode.getChild()));
+
+        assertThat(leafInfo.getDataType().getResolvableStatus(), Is.is(ResolvableStatus.RESOLVED));
+
+        YangDerivedInfo<?> derivedInfo = (YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo();
+
+        // Check for the effective built-in type.
+        assertThat(derivedInfo.getEffectiveBuiltInType(), is(STRING));
+
+        // Check for the restriction.
+        assertThat(derivedInfo.getLengthRestrictionString(), is(nullValue()));
+        assertThat(derivedInfo.getRangeRestrictionString(), is(nullValue()));
+        assertThat(derivedInfo.getPatternRestriction(), is(nullValue()));
+        assertThat(derivedInfo.getResolvedExtendedInfo(), is(nullValue()));
+    }
+
+    /**
+     * Checks hierarchical inter file type linking.
+     */
+    @Test
+    public void processHierarchicalInterFileTypeLinking()
+            throws IOException, ParserException, MojoExecutionException {
+
+        String searchDir = "src/test/resources/hierarchicalinterfiletype";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+
+        YangNode refNode1 = null;
+        YangNode refNode2 = null;
+        YangNode selfNode = null;
+
+        // Create YANG node set
+        yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+
+        // Add references to import list.
+        yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
+
+        YangLinkerUtils.updateFilePriority(utilManager.getYangNodeSet());
+
+        // Carry out inter-file linking.
+        yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
+
+        for (YangNode rootNode : utilManager.getYangNodeSet()) {
+            if (rootNode.getName().equals("ietf-network-topology")) {
+                selfNode = rootNode;
+            } else if (rootNode.getName().equals("ietf-network")) {
+                refNode1 = rootNode;
+            } else {
+                refNode2 = rootNode;
+            }
+        }
+
+        // Check whether the data model tree returned is of type module.
+        assertThat(selfNode instanceof YangModule, is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(selfNode.getNodeType(), is(MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) selfNode;
+        assertThat(yangNode.getName(), is("ietf-network-topology"));
+
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("source-node"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("node-id"));
+        assertThat(leafInfo.getDataType().getDataType(), is(DERIVED));
+
+        assertThat(((YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo()).getReferredTypeDef(),
+                   is((YangTypeDef) refNode1.getChild()));
+
+        assertThat(leafInfo.getDataType().getResolvableStatus(), Is.is(ResolvableStatus.RESOLVED));
+
+        YangDerivedInfo<?> derivedInfo = (YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo();
+
+        // Check for the effective built-in type.
+        assertThat(derivedInfo.getEffectiveBuiltInType(), is(STRING));
+
+        // Check for the restriction.
+        assertThat(derivedInfo.getLengthRestrictionString(), is(nullValue()));
+        assertThat(derivedInfo.getRangeRestrictionString(), is(nullValue()));
+        assertThat(derivedInfo.getPatternRestriction(), is(nullValue()));
+        assertThat(derivedInfo.getResolvedExtendedInfo(), is(nullValue()));
+    }
+
+    /**
+     * Checks hierarchical intra with inter file type linking.
+     */
+    @Test
+    public void processHierarchicalIntraWithInterFileTypeLinking()
+            throws IOException, ParserException, MojoExecutionException {
+
+        String searchDir = "src/test/resources/hierarchicalintrawithinterfiletype";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+
+        YangNode refNode1 = null;
+        YangNode selfNode = null;
+
+        // Create YANG node set
+        yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+
+        // Add references to import list.
+        yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
+
+        YangLinkerUtils.updateFilePriority(utilManager.getYangNodeSet());
+
+        // Carry out inter-file linking.
+        yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
+
+        for (YangNode rootNode : utilManager.getYangNodeSet()) {
+            if (rootNode.getName().equals("ietf-network")) {
+                selfNode = rootNode;
+            } else if (rootNode.getName().equals("ietf-inet-types")) {
+                refNode1 = rootNode;
+            }
+        }
+
+        // Check whether the data model tree returned is of type module.
+        assertThat(selfNode instanceof YangModule, is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(selfNode.getNodeType(), is(MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) selfNode;
+        assertThat(yangNode.getName(), is("ietf-network"));
+
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("node-ref"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("node-id"));
+        assertThat(leafInfo.getDataType().getDataType(), is(DERIVED));
+
+        assertThat(((YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo()).getReferredTypeDef(),
+                   is((YangTypeDef) selfNode.getChild()));
+
+        assertThat(leafInfo.getDataType().getResolvableStatus(), Is.is(ResolvableStatus.RESOLVED));
+
+        YangDerivedInfo<?> derivedInfo = (YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo();
+
+        // Check for the effective built-in type.
+        assertThat(derivedInfo.getEffectiveBuiltInType(), is(STRING));
+
+        // Check for the restriction.
+        assertThat(derivedInfo.getLengthRestrictionString(), is(nullValue()));
+        assertThat(derivedInfo.getRangeRestrictionString(), is(nullValue()));
+        assertThat(derivedInfo.getPatternRestriction(), is(nullValue()));
+        assertThat(derivedInfo.getResolvedExtendedInfo(), is(nullValue()));
+    }
+
+    /**
+     * Checks hierarchical intra with inter file type linking.
+     */
+    @Test
+    public void interFileWithUsesReferringType()
+            throws IOException, ParserException, MojoExecutionException {
+
+        String searchDir = "src/test/resources/interfilewithusesreferringtype";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.resolveDependenciesUsingLinker();
+
+        YangPluginConfig yangPluginConfig = new YangPluginConfig();
+        yangPluginConfig.setCodeGenDir("target/interfilewithusesreferringtype/");
+
+        utilManager.translateToJava(yangPluginConfig);
+
+        YangIoUtils.deleteDirectory("target/interfilewithusesreferringtype/");
+
+    }
+
+    /**
+     * Checks hierarchical intra with inter file type linking.
+     */
+    @Test
+    public void file1UsesFile2TypeDefFile3Type()
+            throws IOException, ParserException, MojoExecutionException {
+
+        String searchDir = "src/test/resources/file1UsesFile2TypeDefFile3Type";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.resolveDependenciesUsingLinker();
+
+        YangPluginConfig yangPluginConfig = new YangPluginConfig();
+        yangPluginConfig.setCodeGenDir("target/file1UsesFile2TypeDefFile3Type/");
+
+        utilManager.translateToJava(yangPluginConfig);
+        String dir1 = System.getProperty("user.dir") + "/"
+                + "target/file1UsesFile2TypeDefFile3Type/";
+        YangPluginConfig.compileCode(dir1);
+        YangIoUtils.deleteDirectory("target/file1UsesFile2TypeDefFile3Type/");
+
+    }
+
+    /**
+     * Checks hierarchical intra with inter file type linking.
+     */
+    @Test
+    public void interFileIetf()
+            throws IOException, ParserException, MojoExecutionException {
+
+        YangIoUtils.deleteDirectory("target/interfileietf/");
+        String searchDir = "src/test/resources/interfileietf";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.resolveDependenciesUsingLinker();
+
+        YangPluginConfig yangPluginConfig = new YangPluginConfig();
+        yangPluginConfig.setCodeGenDir("target/interfileietf/");
+
+        utilManager.translateToJava(yangPluginConfig);
+
+        YangIoUtils.deleteDirectory("target/interfileietf/");
+
+    }
+
+    /**
+     * Checks hierarchical intra with inter file type linking.
+     */
+    @Test
+    public void usesInContainer()
+            throws IOException, ParserException, MojoExecutionException {
+
+        String searchDir = "src/test/resources/usesInContainer";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.resolveDependenciesUsingLinker();
+
+        YangPluginConfig yangPluginConfig = new YangPluginConfig();
+        yangPluginConfig.setCodeGenDir("target/usesInContainer/");
+
+        utilManager.translateToJava(yangPluginConfig);
+
+        YangIoUtils.deleteDirectory("target/usesInContainer/");
+
+    }
+
+    /**
+     * Checks hierarchical intra with inter file type linking.
+     */
+    @Test
+    public void groupingNodeSameAsModule()
+            throws IOException, ParserException, MojoExecutionException {
+
+        String searchDir = "src/test/resources/groupingNodeSameAsModule";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.resolveDependenciesUsingLinker();
+
+        YangPluginConfig yangPluginConfig = new YangPluginConfig();
+        yangPluginConfig.setCodeGenDir("target/groupingNodeSameAsModule/");
+
+        utilManager.translateToJava(yangPluginConfig);
+        String dir1 = System.getProperty("user.dir") + "/"
+                + "target/groupingNodeSameAsModule/";
+        YangPluginConfig.compileCode(dir1);
+        YangIoUtils.deleteDirectory("target/groupingNodeSameAsModule/");
+
+    }
+
+    /**
+     * Checks priority of the file.
+     */
+    @Test
+    public void interFilePriority()
+            throws IOException, ParserException, MojoExecutionException {
+
+        String searchDir = "src/test/resources/interfilepriority";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.resolveDependenciesUsingLinker();
+
+        YangNode selfNode = null;
+        YangNode refNode1 = null;
+        YangNode refNode2 = null;
+
+        for (YangNode rootNode : utilManager.getYangNodeSet()) {
+            if (rootNode.getName().equals("module1")) {
+                selfNode = rootNode;
+            } else if (rootNode.getName().equals("module2")) {
+                refNode1 = rootNode;
+            } else {
+                refNode2 = rootNode;
+            }
+        }
+
+        // Check whether the data model tree returned is of type module.
+        assertThat(selfNode instanceof YangModule, is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(selfNode.getNodeType(), is(MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) selfNode;
+        assertThat(yangNode.getName(), is("module1"));
+        assertThat(yangNode.getPriority(), is(2));
+
+        // Check whether the data model tree returned is of type module.
+        assertThat(refNode1 instanceof YangModule, is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(refNode1.getNodeType(), is(MODULE_NODE));
+
+        YangModule referredNode1 = (YangModule) refNode1;
+        assertThat(referredNode1.getName(), is("module2"));
+        assertThat(referredNode1.getPriority(), is(3));
+    }
+
+    /**
+     * Checks contents of uses are copied as child of grouping.
+     */
+    @Test
+    public void usesInsideChildOfGrouping()
+            throws IOException, ParserException, MojoExecutionException {
+
+        String searchDir = "src/test/resources/usesInsideChildOfGrouping";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.resolveDependenciesUsingLinker();
+
+        YangNode selfNode = null;
+        YangNode refNode1 = null;
+
+        for (YangNode rootNode : utilManager.getYangNodeSet()) {
+            if (rootNode.getName().equals("ietf-network")) {
+                selfNode = rootNode;
+            } else if (rootNode.getName().equals("ietf-te-topology")) {
+                refNode1 = rootNode;
+            }
+        }
+
+        // Check whether the data model tree returned is of type module.
+        assertThat(selfNode instanceof YangModule, is(true));
+        assertThat(selfNode.getNodeType(), is(MODULE_NODE));
+        YangModule yangNode = (YangModule) selfNode;
+        assertThat(yangNode.getName(), is("ietf-network"));
+
+        YangModule refNode = (YangModule) refNode1;
+        assertThat(refNode.getName(), is("ietf-te-topology"));
+
+        YangAugment augment = ((YangAugment) refNode.getChild().getNextSibling().
+                getNextSibling().getNextSibling().getNextSibling());
+        assertThat(augment.getName(), is("/nw:networks/nw:network/nw:node"));
+
+        YangUses uses = ((YangUses) augment.getChild());
+        YangContainer container = ((YangContainer) uses.getNextSibling());
+        assertThat(container.getName(), is("te"));
+
+        container = ((YangContainer) container.getChild());
+        assertThat(container.getName(), is("config"));
+
+        uses = ((YangUses) container.getChild().getNextSibling());
+        assertThat(uses.getName(), is("te-node-config-attributes"));
+
+        YangContainer container1 = ((YangContainer) uses.getNextSibling());
+        assertThat(container1.getName(), is("te-node-attributes"));
+
+        uses = ((YangUses) container1.getChild());
+        assertThat(uses.getName(), is("te-node-connectivity-matrix"));
+
+        YangList list = ((YangList) uses.getNextSibling());
+        assertThat(list.getName(), is("connectivity-matrix"));
+    }
+
+    /**
+     * Checks contents of uses are copied as child of grouping.
+     */
+    @Test
+    public void interFileUsesInsideChildOfGrouping()
+            throws IOException, ParserException, MojoExecutionException {
+
+        String searchDir = "src/test/resources/interFileUsesInsideChildOfGrouping";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.resolveDependenciesUsingLinker();
+
+        YangNode selfNode = null;
+        YangNode refNode1 = null;
+
+        for (YangNode rootNode : utilManager.getYangNodeSet()) {
+            if (rootNode.getName().equals("ietf-network")) {
+                selfNode = rootNode;
+            } else if (rootNode.getName().equals("ietf-te-topology")) {
+                refNode1 = rootNode;
+            }
+        }
+
+        // Check whether the data model tree returned is of type module.
+        assertThat(selfNode instanceof YangModule, is(true));
+        assertThat(selfNode.getNodeType(), is(MODULE_NODE));
+        YangModule yangNode = (YangModule) selfNode;
+        assertThat(yangNode.getName(), is("ietf-network"));
+
+        YangModule refNode = (YangModule) refNode1;
+        assertThat(refNode.getName(), is("ietf-te-topology"));
+
+        YangAugment augment = ((YangAugment) refNode.getChild().getNextSibling().
+                getNextSibling().getNextSibling().getNextSibling().getNextSibling());
+        assertThat(augment.getName(), is("/nw:networks/nw:network/nt:link"));
+
+        YangUses uses = ((YangUses) augment.getChild());
+        assertThat(uses.getResolvableStatus(), Is.is(ResolvableStatus.RESOLVED));
+        YangContainer container = ((YangContainer) uses.getNextSibling());
+        assertThat(container.getName(), is("te"));
+
+        container = ((YangContainer) container.getChild());
+        assertThat(container.getName(), is("config"));
+
+        uses = ((YangUses) container.getChild().getNextSibling());
+        assertThat(uses.getName(), is("te-link-config-attributes"));
+        assertThat(uses.getResolvableStatus(), Is.is(ResolvableStatus.RESOLVED));
+
+        YangContainer container1 = ((YangContainer) uses.getNextSibling());
+        assertThat(container1.getName(), is("te-link-attributes"));
+
+        container = ((YangContainer) container1.getChild());
+        assertThat(container.getName(), is("underlay"));
+
+        uses = ((YangUses) container.getChild());
+        assertThat(uses.getName(), is("te-link-underlay-attributes"));
+        assertThat(uses.getResolvableStatus(), Is.is(ResolvableStatus.RESOLVED));
+
+        container = ((YangContainer) uses.getNextSibling());
+        assertThat(container.getName(), is("underlay-primary-path"));
+
+        YangList yangList = ((YangList) container.getChild());
+        assertThat(yangList.getName(), is("path-element"));
+
+        uses = ((YangUses) yangList.getChild());
+        assertThat(uses.getName(), is("te-path-element"));
+        assertThat(uses.getResolvableStatus(), Is.is(ResolvableStatus.RESOLVED));
+
+        uses = ((YangUses) uses.getNextSibling());
+        assertThat(uses.getName(), is("explicit-route-subobject"));
+        assertThat(uses.getResolvableStatus(), Is.is(ResolvableStatus.RESOLVED));
+
+        YangChoice choice = ((YangChoice) uses.getNextSibling());
+        assertThat(choice.getName(), is("type"));
+    }
+}
diff --git a/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/InterJarLinkerTest.java b/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/InterJarLinkerTest.java
new file mode 100644
index 0000000..1ceefff
--- /dev/null
+++ b/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/InterJarLinkerTest.java
@@ -0,0 +1,363 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.plugin.maven;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.project.MavenProject;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.base.tool.YangFileInfo;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+import java.util.jar.JarEntry;
+import java.util.jar.JarOutputStream;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.Is.is;
+import static org.onosproject.yang.compiler.datamodel.utils.DataModelUtils.parseJarFile;
+import static org.onosproject.yang.compiler.utils.UtilConstants.SLASH;
+import static org.onosproject.yang.compiler.utils.UtilConstants.TEMP;
+import static org.onosproject.yang.compiler.utils.UtilConstants.YANG_RESOURCES;
+
+/**
+ * Unit test case for inter jar linker.
+ */
+public class InterJarLinkerTest {
+
+    private final YangUtilManager utilManager = new YangUtilManager();
+
+    private static final String TARGET = "target/interJarFileLinking/";
+    private static final String YANG_FILES_DIR = "src/test/resources/interJarFileLinking/yangFiles/";
+
+    private static final String FLOW_CLASSIFIER_FOLDER = "target/interJarFileLinking/org/onosproject"
+            + "/yang/gen/v1/sfc/flowclassifier/rev20160524";
+    private static final String PORT_PAIR_FOLDER = "target/interJarFileLinking/org/onosproject"
+            + "/yang/gen/v1/sfc/portpair/rev20160524";
+    private static final String FLOW_CLASSIFIER_MANAGER = FLOW_CLASSIFIER_FOLDER + SLASH + "FlowClassifierManager.java";
+
+    private MockJarFileProvider mockJarFileProvider = new MockJarFileProvider();
+
+    /**
+     * Unit test case for a single jar dependency.
+     *
+     * @throws IOException            when fails to do IO operations
+     * @throws MojoExecutionException when fails to do mojo operations
+     */
+//TODO: FIX the interJAR test case for using toolmanger instead of plugin mgr
+    //    @Test
+//    public void processSingleJarLinking()
+//            throws IOException, MojoExecutionException {
+//        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(YANG_FILES_DIR));
+//        Set<YangFileInfo> info = utilManager.getYangFileInfoSet();
+//        int size1 = info.size();
+//        utilManager.parseYangFileInfoSet();
+//
+//        mockJarFileProvider.provideTestJarFile(utilManager);
+//        utilManager.setYangFileInfoSet(removeFileInfoFromSet(info));
+//        utilManager.resolveDependenciesUsingLinker();
+//
+//        int size2 = info.size();
+//        assertThat(true, is(size1 != size2));
+//        assertThat(true, is(parseFileInfoSet(info.iterator())));
+//
+//        deleteDirectory(TARGET);
+//        mockJarFileProvider.deleteTestSerFile(YANG_FILES_DIR);
+//    }
+//
+//    /**
+//     * Unit test case for a multiple jar dependency.
+//     *
+//     * @throws IOException            when fails to do IO operations
+//     * @throws MojoExecutionException when fails to do mojo operations
+//     */
+//    @Test
+//    public void processMultipleJarLinking()
+//            throws IOException, MojoExecutionException {
+//        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(YANG_FILES_DIR));
+//
+//        Set<YangFileInfo> info = utilManager.getYangFileInfoSet();
+//        int size1 = info.size();
+//        utilManager.parseYangFileInfoSet();
+//
+//        mockJarFileProvider.provideTestJarFile(utilManager);
+//        utilManager.setYangFileInfoSet(removeFileInfoFromSet(info));
+//
+//        utilManager.resolveDependenciesUsingLinker();
+//        int size2 = info.size();
+//        assertThat(true, is(size1 != size2));
+//        assertThat(true, is(parseFileInfoSet(info.iterator())));
+//        assertThat(true, is(parseFileInfoSet(info.iterator())));
+//
+//        /*
+//         * grouping flow-classifier {
+//         *      container flow-classifier {
+//         *           leaf id {
+//         *                type flow-classifier-id;
+//         *           }
+//         *
+//         *           leaf tenant-id {
+//         *                type port-pair:tenant-id;
+//         *           }
+//         *           .
+//         *           .
+//         *           .
+//         *
+//         */
+//
+//        Iterator<YangFileInfo> yangFileInfoIterator = info.iterator();
+//
+//        YangFileInfo yangFileInfo = yangFileInfoIterator.next();
+//
+//        while (yangFileInfoIterator.hasNext()) {
+//            if (yangFileInfo.getRootNode().getName().equals("flow-classifier")) {
+//                break;
+//            }
+//            yangFileInfo = yangFileInfoIterator.next();
+//        }
+//
+//        YangNode node = yangFileInfo.getRootNode();
+//        node = node.getChild();
+//        while (node != null) {
+//            if (node instanceof YangGrouping) {
+//                break;
+//            }
+//            node = node.getNextSibling();
+//        }
+//
+//        node = node.getChild();
+//        ListIterator<YangLeaf> leafIterator = ((YangContainer) node).getListOfLeaf().listIterator();
+//        YangLeaf leafInfo = leafIterator.next();
+//
+//        assertThat(leafInfo.getName(), is("id"));
+//        assertThat(leafInfo.getDataType().getDataTypeName(), is("flow-classifier-id"));
+//        assertThat(leafInfo.getDataType().getDataType(), is(DERIVED));
+//
+//        leafInfo = leafIterator.next();
+//
+//        assertThat(leafInfo.getName(), is("tenant-id"));
+//        assertThat(leafInfo.getDataType().getDataType(), is(DERIVED));
+//
+//        assertThat(true, is(((YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo()).getReferredTypeDef()
+//                                    .getName().equals("tenant-id")));
+//
+//        assertThat(leafInfo.getDataType().getResolvableStatus(), is(RESOLVED));
+//
+//        YangDerivedInfo<?> derivedInfo = (YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo();
+//
+//        // Check for the effective built-in type.
+//        assertThat(derivedInfo.getEffectiveBuiltInType(), is(STRING));
+//
+//        YangPluginConfig yangPluginConfig = new YangPluginConfig();
+//        yangPluginConfig.setCodeGenDir(TARGET);
+//
+//        utilManager.translateToJava(yangPluginConfig);
+//        testIfFlowClassifierFilesExists();
+//        testIfPortPairFileDoesNotExist();
+//        deleteDirectory(TARGET);
+//        mockJarFileProvider.deleteTestSerFile(YANG_FILES_DIR);
+//    }
+
+    /**
+     * Test if flow classifier code is generated.
+     */
+    private void testIfFlowClassifierFilesExists() {
+        File folder = new File(System.getProperty("user.dir") + SLASH + FLOW_CLASSIFIER_FOLDER);
+        File file = new File(System.getProperty("user.dir") + SLASH + FLOW_CLASSIFIER_MANAGER);
+        assertThat(true, is(folder.exists()));
+        assertThat(false, is(file.exists()));
+    }
+
+    /**
+     * Tests if port pair code is not generated.
+     */
+    private void testIfPortPairFileDoesNotExist() {
+        File folder = new File(System.getProperty("user.dir") + SLASH + PORT_PAIR_FOLDER);
+        assertThat(false, is(folder.exists()));
+    }
+
+    /**
+     * Need to remove port-pair YANG file info from the set so , serialized file info can be
+     * tested.
+     *
+     * @param fileInfoSet YANG file info set
+     * @return updated file info set
+     */
+    private Set<YangFileInfo> removeFileInfoFromSet(Set<YangFileInfo> fileInfoSet) {
+        String portPairFile = System.getProperty("user.dir") + SLASH + YANG_FILES_DIR + "portpair.yang";
+        for (YangFileInfo fileInfo : fileInfoSet) {
+            if (fileInfo.getYangFileName().equals(portPairFile)) {
+                fileInfoSet.remove(fileInfo);
+                return fileInfoSet;
+            }
+        }
+        return fileInfoSet;
+    }
+
+    /**
+     * Parses file info list and returns true if file info list contains the serialized file info.
+     *
+     * @param yangFileInfoIterator file info list iterator
+     * @return true if present
+     */
+    private boolean parseFileInfoSet(Iterator<YangFileInfo> yangFileInfoIterator) {
+        YangFileInfo yangFileInfo = yangFileInfoIterator.next();
+        while (yangFileInfoIterator.hasNext()) {
+            if (yangFileInfo.getRootNode().getName().equals("port-pair")) {
+                return true;
+            } else if (yangFileInfo.getRootNode().getName().equals("flow-classifier")) {
+                return true;
+            }
+            yangFileInfo = yangFileInfoIterator.next();
+        }
+        return false;
+
+    }
+
+    /**
+     * Represents jar file provider for testing.
+     */
+    private static class MockJarFileProvider {
+
+        private static final String TARGET = "target/interJarFileLinking/";
+        private static final String TARGET_RESOURCE_PATH = SLASH + TEMP + SLASH + YANG_RESOURCES + SLASH;
+        private static final String JAR_FILE_NAME = "onlab-test-1.7.0-SNAPSHOT.jar";
+        private static final String SER_FILE_NAME = "portPair.ser";
+
+        /**
+         * Creates an instance of jar file provider.
+         */
+        MockJarFileProvider() {
+
+        }
+
+        /**
+         * Provides test jar files for linker.
+         *
+         * @throws IOException when fails to do IO operations
+         */
+        void provideTestJarFile(YangUtilManager utilManager) throws IOException {
+
+            Set<YangFileInfo> info = utilManager.getYangFileInfoSet();
+
+            Set<YangNode> compiledSchemas = new HashSet<>();
+            for (YangFileInfo fileInfo : info) {
+                compiledSchemas.add(fileInfo.getRootNode());
+            }
+
+            MavenProject project = new MavenProject();
+            YangPluginUtils.serializeDataModel(TARGET, project, false);
+            createTestJar();
+
+            for (String file : getListOfTestJar(TARGET)) {
+                addInterJarRootNodes(file, info);
+            }
+        }
+
+        /**
+         * Deletes serialized file.
+         */
+        void deleteTestSerFile(String yangFileDir) {
+            File ser = new File(System.getProperty("user.dir") + SLASH + yangFileDir +
+                                        SLASH + SER_FILE_NAME);
+            ser.delete();
+        }
+
+        /**
+         * Returns list of test jar files.
+         *
+         * @param searchDir search directory
+         * @return list of test jar files
+         */
+        private List<String> getListOfTestJar(String searchDir) {
+            List<String> jarFiles = new ArrayList<>();
+
+            File directory = new File(searchDir + "/");
+            File[] files = directory.listFiles();
+
+            for (File file : files) {
+                if (!file.isDirectory()) {
+                    jarFiles.add(file.toString());
+                }
+            }
+
+            return jarFiles;
+        }
+
+        /**
+         * Adds data model nodes of jar to file info set.
+         *
+         * @param jarFile jar file name
+         * @param info    file info
+         * @throws IOException when fails to do IO operations
+         */
+        private void addInterJarRootNodes(String jarFile, Set<YangFileInfo> info) throws IOException {
+            try {
+                List<YangNode> interJarResolvedNodes = parseJarFile(jarFile, TARGET);
+
+                for (YangNode node : interJarResolvedNodes) {
+                    YangFileInfo dependentFileInfo = new YangFileInfo();
+                    node.setToTranslate(false);
+                    dependentFileInfo.setRootNode(node);
+                    dependentFileInfo.setForTranslator(false);
+                    dependentFileInfo.setYangFileName(node.getName());
+                    info.add(dependentFileInfo);
+                }
+            } catch (IOException e) {
+                throw new IOException("failed to resolve in interjar scenario.");
+            }
+        }
+
+        /**
+         * Creates a temporary test jar files.
+         */
+        private void createTestJar() {
+
+            File file = new File(TARGET + TARGET_RESOURCE_PATH);
+            File[] files = file.listFiles();
+            String[] source = new String[files.length];
+
+            for (int i = 0; i < files.length; i++) {
+                source[i] = files[i].toString();
+            }
+            byte[] buf = new byte[1024];
+
+            try {
+                String target = TARGET + JAR_FILE_NAME;
+                JarOutputStream out = new JarOutputStream(new FileOutputStream(target));
+                for (String element : source) {
+                    FileInputStream in = new FileInputStream(element);
+                    out.putNextEntry(new JarEntry(element));
+                    int len;
+                    while ((len = in.read(buf)) > 0) {
+                        out.write(buf, 0, len);
+                    }
+                    out.closeEntry();
+                    in.close();
+                }
+                out.close();
+            } catch (IOException e) {
+            }
+        }
+    }
+}
diff --git a/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/IntraFileIfFeatureLinkingTest.java b/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/IntraFileIfFeatureLinkingTest.java
new file mode 100644
index 0000000..8adfa16
--- /dev/null
+++ b/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/IntraFileIfFeatureLinkingTest.java
@@ -0,0 +1,222 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.plugin.maven;
+
+import org.hamcrest.core.Is;
+import org.junit.Test;
+import org.onosproject.yang.compiler.datamodel.YangContainer;
+import org.onosproject.yang.compiler.datamodel.YangFeature;
+import org.onosproject.yang.compiler.datamodel.YangIfFeature;
+import org.onosproject.yang.compiler.datamodel.YangLeaf;
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangNodeType;
+import org.onosproject.yang.compiler.datamodel.YangSubModule;
+import org.onosproject.yang.compiler.datamodel.utils.ResolvableStatus;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.YangUtilsParserManager;
+
+import java.io.IOException;
+import java.util.List;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.Is.is;
+
+/**
+ * Test cases for testing if-feature intra file linking.
+ */
+public class IntraFileIfFeatureLinkingTest {
+
+    private final YangUtilsParserManager manager = new YangUtilsParserManager();
+
+    /**
+     * Checks self resolution when feature defined in same file.
+     */
+    @Test
+    public void processSelfFileLinkingWithFeature()
+            throws IOException, ParserException {
+
+        YangNode node = manager
+                .getDataModel("src/test/resources/SelfFileLinkingWithFeature.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("syslog"));
+
+        List<YangFeature> featureList = yangNode.getFeatureList();
+        YangFeature feature = featureList.iterator().next();
+        assertThat(feature.getName(), is("local-storage"));
+
+        YangContainer container = (YangContainer) yangNode.getChild();
+        assertThat(container.getName(), is("speed"));
+
+        List<YangLeaf> listOfLeaf = container.getListOfLeaf();
+        YangLeaf leaf = listOfLeaf.iterator().next();
+        assertThat(leaf.getName(), is("local-storage-limit"));
+
+        List<YangIfFeature> ifFeatureList = leaf.getIfFeatureList();
+        YangIfFeature ifFeature = ifFeatureList.iterator().next();
+        assertThat(ifFeature.getName().getName(), is("local-storage"));
+        assertThat(ifFeature.getResolvableStatus(), Is.is(ResolvableStatus.RESOLVED));
+    }
+
+    /**
+     * Checks self resolution when feature is undefined.
+     */
+    @Test
+    public void processSelfFileLinkingWithFeatureUndefined()
+            throws IOException, ParserException {
+
+        YangNode node = manager
+                .getDataModel("src/test/resources/SelfFileLinkingWithFeatureUndefined.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("syslog"));
+
+        YangContainer container = (YangContainer) yangNode.getChild();
+        assertThat(container.getName(), is("speed"));
+
+        List<YangLeaf> listOfLeaf = container.getListOfLeaf();
+        YangLeaf leaf = listOfLeaf.iterator().next();
+        assertThat(leaf.getName(), is("local-storage-limit"));
+
+        List<YangIfFeature> ifFeatureList = leaf.getIfFeatureList();
+        YangIfFeature ifFeature = ifFeatureList.iterator().next();
+        assertThat(ifFeature.getName().getName(), is("local-storage"));
+        assertThat(ifFeature.getResolvableStatus(), is(ResolvableStatus.INTRA_FILE_RESOLVED));
+    }
+
+    /**
+     * Checks self resolution of feature with multiple dependency.
+     */
+    @Test
+    public void processSelfFileLinkingWithMultipleDependency() throws IOException, ParserException {
+        YangNode node = manager
+                .getDataModel("src/test/resources/SelfFileLinkingWithMultipleDependency.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("syslog"));
+
+        List<YangFeature> featureList = yangNode.getFeatureList();
+        YangFeature feature = featureList.iterator().next();
+        assertThat(feature.getName(), is("p2mp-te"));
+
+        YangContainer container = (YangContainer) yangNode.getChild();
+        assertThat(container.getName(), is("speed"));
+
+        List<YangLeaf> listOfLeaf = container.getListOfLeaf();
+        YangLeaf leaf = listOfLeaf.iterator().next();
+        assertThat(leaf.getName(), is("local-storage-limit"));
+
+        List<YangIfFeature> ifFeatureList = leaf.getIfFeatureList();
+        YangIfFeature ifFeature = ifFeatureList.iterator().next();
+        assertThat(ifFeature.getName().getName(), is("frr-te"));
+        assertThat(ifFeature.getResolvableStatus(), is(ResolvableStatus.RESOLVED));
+    }
+
+    /**
+     * Checks self resolution of feature with multiple dependency undefined.
+     */
+    @Test
+    public void processSelfFileLinkingWithMultipleDependencyUnresolved() throws IOException, ParserException {
+        YangNode node = manager
+                .getDataModel("src/test/resources/SelfFileLinkingWithMultipleDependencyUnresolved.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("syslog"));
+
+        List<YangFeature> featureList = yangNode.getFeatureList();
+        YangFeature feature = featureList.iterator().next();
+        assertThat(feature.getName(), is("frr-te"));
+
+        YangContainer container = (YangContainer) yangNode.getChild();
+        assertThat(container.getName(), is("speed"));
+
+        List<YangLeaf> listOfLeaf = container.getListOfLeaf();
+        YangLeaf leaf = listOfLeaf.iterator().next();
+        assertThat(leaf.getName(), is("local-storage-limit"));
+
+        List<YangIfFeature> ifFeatureList = leaf.getIfFeatureList();
+        YangIfFeature ifFeature = ifFeatureList.iterator().next();
+        assertThat(ifFeature.getName().getName(), is("frr-te"));
+        assertThat(ifFeature.getResolvableStatus(), is(ResolvableStatus.INTRA_FILE_RESOLVED));
+    }
+
+    /**
+     * Checks self resolution when feature is defined in same file in submodule.
+     */
+    @Test
+    public void processSelfFileLinkingWithFeatureInSubModule()
+            throws IOException, ParserException {
+
+        YangNode node = manager
+                .getDataModel("src/test/resources/SelfFileLinkingWithFeatureInSubModule.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangSubModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.SUB_MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangSubModule yangNode = (YangSubModule) node;
+        assertThat(yangNode.getName(), is("syslog"));
+
+        List<YangFeature> featureList = yangNode.getFeatureList();
+        YangFeature feature = featureList.iterator().next();
+        assertThat(feature.getName(), is("local-storage"));
+
+        YangContainer container = (YangContainer) yangNode.getChild();
+        assertThat(container.getName(), is("speed"));
+
+        List<YangLeaf> listOfLeaf = container.getListOfLeaf();
+        YangLeaf leaf = listOfLeaf.iterator().next();
+        assertThat(leaf.getName(), is("local-storage-limit"));
+
+        List<YangIfFeature> ifFeatureList = leaf.getIfFeatureList();
+        YangIfFeature ifFeature = ifFeatureList.iterator().next();
+        assertThat(ifFeature.getName().getName(), is("local-storage"));
+        assertThat(ifFeature.getResolvableStatus(), is(ResolvableStatus.RESOLVED));
+    }
+}
diff --git a/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/IntraFileLeafrefLinkingTest.java b/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/IntraFileLeafrefLinkingTest.java
new file mode 100644
index 0000000..ce9f13d
--- /dev/null
+++ b/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/IntraFileLeafrefLinkingTest.java
@@ -0,0 +1,1987 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.plugin.maven;
+
+import org.hamcrest.core.Is;
+import org.junit.Ignore;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.onosproject.yang.compiler.datamodel.YangAtomicPath;
+import org.onosproject.yang.compiler.datamodel.YangAugment;
+import org.onosproject.yang.compiler.datamodel.YangContainer;
+import org.onosproject.yang.compiler.datamodel.YangFeature;
+import org.onosproject.yang.compiler.datamodel.YangIfFeature;
+import org.onosproject.yang.compiler.datamodel.YangInput;
+import org.onosproject.yang.compiler.datamodel.YangLeaf;
+import org.onosproject.yang.compiler.datamodel.YangLeafList;
+import org.onosproject.yang.compiler.datamodel.YangLeafRef;
+import org.onosproject.yang.compiler.datamodel.YangList;
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangNodeType;
+import org.onosproject.yang.compiler.datamodel.YangPathArgType;
+import org.onosproject.yang.compiler.datamodel.YangPathOperator;
+import org.onosproject.yang.compiler.datamodel.YangPathPredicate;
+import org.onosproject.yang.compiler.datamodel.YangRelativePath;
+import org.onosproject.yang.compiler.datamodel.utils.ResolvableStatus;
+import org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes;
+import org.onosproject.yang.compiler.linker.exceptions.LinkerException;
+import org.onosproject.yang.compiler.linker.impl.YangLinkerManager;
+import org.onosproject.yang.compiler.linker.impl.YangLinkerUtils;
+import org.onosproject.yang.compiler.utils.io.impl.YangFileScanner;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.YangUtilsParserManager;
+
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.Is.is;
+import static org.hamcrest.core.IsNull.nullValue;
+import static org.onosproject.yang.compiler.datamodel.YangNodeType.MODULE_NODE;
+import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes.LEAFREF;
+
+/**
+ * Test cases for testing leafref intra file linking.
+ */
+public class IntraFileLeafrefLinkingTest {
+
+    @Rule
+    public ExpectedException thrown = ExpectedException.none();
+
+    private final YangUtilManager utilManager = new YangUtilManager();
+    private final YangLinkerManager yangLinkerManager = new YangLinkerManager();
+    private final YangUtilsParserManager manager = new YangUtilsParserManager();
+
+    /**
+     * Checks self resolution when leafref under module refers to leaf in container.
+     */
+    @Test
+    public void processSelfResolutionWhenLeafrefReferToContainerLeaf()
+            throws IOException, ParserException {
+
+        String searchDir = "src/test/resources/leafreflinker/intrafile/simpleleafref";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+        YangNode selfNode = null;
+
+        // Create YANG node set
+        yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+
+        // Add references to import list.
+        yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
+
+        YangLinkerUtils.updateFilePriority(utilManager.getYangNodeSet());
+
+        // Carry out inter-file linking.
+        yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
+
+        Iterator<YangNode> yangNodeIterator = utilManager.getYangNodeSet().iterator();
+
+        YangNode rootNode = yangNodeIterator.next();
+
+        if (rootNode.getName().equals("SelfResolutionWhenLeafrefReferToContainerLeaf")) {
+            selfNode = rootNode;
+        }
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((selfNode instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(selfNode.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) selfNode;
+        assertThat(yangNode.getName(), is("SelfResolutionWhenLeafrefReferToContainerLeaf"));
+
+        ListIterator<YangLeaf> leafIterator;
+        YangLeaf leafInfo;
+
+        leafIterator = yangNode.getListOfLeaf().listIterator();
+        leafInfo = leafIterator.next();
+
+        // Check whether the information in the leaf is correct.
+        assertThat(leafInfo.getName(), is("network-ref"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("leafref"));
+        assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.LEAFREF));
+        YangLeafRef leafref = (YangLeafRef) (leafInfo.getDataType().getDataTypeExtendedInfo());
+
+        // Check whether leafref type got resolved.
+        assertThat(leafref.getResolvableStatus(),
+                   Is.is(ResolvableStatus.RESOLVED));
+
+        // Check the effective type for the leaf.
+        assertThat(leafref.getEffectiveDataType().getDataType(),
+                   is(YangDataTypes.UINT8));
+    }
+
+    /**
+     * Checks self resolution when leafref under module refers to leaf in input of rpc.
+     */
+    @Test
+    public void processSelfResolutionWhenLeafrefInModuleReferToLeafInInputOfRpc()
+            throws IOException, ParserException {
+
+        String searchDir = "src/test/resources/leafreflinker/intrafile/leafrefwithrpc";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+        YangNode selfNode = null;
+
+        // Create YANG node set
+        yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+
+        // Add references to import list.
+        yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
+
+        YangLinkerUtils.updateFilePriority(utilManager.getYangNodeSet());
+
+        // Carry out inter-file linking.
+        yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
+
+        Iterator<YangNode> yangNodeIterator = utilManager.getYangNodeSet().iterator();
+
+        YangNode rootNode = yangNodeIterator.next();
+
+        if (rootNode.getName().equals("SelfResolutionWhenLeafrefInModuleReferToLeafInInputOfRpc")) {
+            selfNode = rootNode;
+        }
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((selfNode instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(selfNode.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) selfNode;
+        assertThat(yangNode.getName(), is("SelfResolutionWhenLeafrefInModuleReferToLeafInInputOfRpc"));
+
+        ListIterator<YangLeaf> leafIterator;
+        YangLeaf leafInfo;
+
+        leafIterator = yangNode.getListOfLeaf().listIterator();
+        leafInfo = leafIterator.next();
+
+        // Check whether the information in the leaf is correct.
+        assertThat(leafInfo.getName(), is("network-ref"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("leafref"));
+        assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.LEAFREF));
+        YangLeafRef leafref = (YangLeafRef) (leafInfo.getDataType().getDataTypeExtendedInfo());
+
+        // Check whether leafref type got resolved.
+        assertThat(leafref.getResolvableStatus(),
+                   is(ResolvableStatus.RESOLVED));
+
+        // Check the effective type for the leaf.
+        assertThat(leafref.getEffectiveDataType().getDataType(),
+                   is(YangDataTypes.UINT8));
+    }
+
+    /**
+     * Checks self resolution when leafref under module refers to grouping rpc with input as name.
+     * Rpc has input child also. So here the node search must be done by taking input node.
+     * TODO: When path has RPC's input but grouping & typedef with the same name occurs.
+     */
+    @Ignore
+    public void processSelfResolutionWhenLeafrefInModuleReferToGroupingWithInputInRpc()
+            throws IOException, ParserException {
+
+        String searchDir = "src/test/resources/leafreflinker/intrafile/leafrefwithrpcandgrouping";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+        YangNode selfNode = null;
+
+        // Create YANG node set
+        yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+
+        // Add references to import list.
+        yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
+
+        YangLinkerUtils.updateFilePriority(utilManager.getYangNodeSet());
+
+        // Carry out inter-file linking.
+        yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
+
+        Iterator<YangNode> yangNodeIterator = utilManager.getYangNodeSet().iterator();
+
+        YangNode rootNode = yangNodeIterator.next();
+
+        if (rootNode.getName().equals("SelfResolutionWhenLeafrefInModuleReferToGroupingWithInputInRpc")) {
+            selfNode = rootNode;
+        }
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((selfNode instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(selfNode.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) selfNode;
+        assertThat(yangNode.getName(), is("SelfResolutionWhenLeafrefInModuleReferToGroupingWithInputInRpc"));
+
+        ListIterator<YangLeaf> leafIterator;
+        YangLeaf leafInfo;
+
+        leafIterator = yangNode.getListOfLeaf().listIterator();
+        leafInfo = leafIterator.next();
+
+        // Check whether the information in the leaf is correct.
+        assertThat(leafInfo.getName(), is("network-ref"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("leafref"));
+        assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.LEAFREF));
+        YangLeafRef leafref = (YangLeafRef) (leafInfo.getDataType().getDataTypeExtendedInfo());
+
+        // Check whether leafref type got resolved.
+        assertThat(leafref.getResolvableStatus(),
+                   is(ResolvableStatus.RESOLVED));
+
+        // Check the effective type for the leaf.
+        assertThat(leafref.getEffectiveDataType().getDataType(),
+                   is(YangDataTypes.UINT8));
+    }
+
+    /**
+     * Checks self resolution when leafref under module refers to grouping under module.
+     * Grouping/typedef cannot be referred.
+     */
+    @Test
+    public void processSelfResolutionWhenLeafrefInModuleReferToGrouping()
+            throws IOException, ParserException {
+/*
+        thrown.expect(LinkerException.class);
+        thrown.expectMessage(
+                "YANG file error: The target node, in the leafref path /networks/network-id, is invalid.");
+*/
+        String searchDir = "src/test/resources/leafreflinker/intrafile/invalidscenerioforgrouping";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+
+        // Create YANG node set
+        yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+
+        // Add references to import list.
+        yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
+
+        YangLinkerUtils.updateFilePriority(utilManager.getYangNodeSet());
+
+        // Carry out inter-file linking.
+        yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
+    }
+
+    /**
+     * Checks self resolution error scenerio where leafref is without path.
+     */
+    @Test
+    public void processSelfResolutionWhenLeafrefDoesntHavePath()
+            throws IOException, ParserException {
+
+        thrown.expect(ParserException.class);
+        thrown.expectMessage(
+                "YANG file error : a type leafref must have one path statement.");
+        YangNode node = manager
+                .getDataModel("src/test/resources/SelfResolutionWhenLeafrefDoesntHavePath.yang");
+    }
+
+    /**
+     * Checks self resolution when leafref under module refers to invalid node.
+     */
+    @Test
+    public void processSelfResolutionWhenLeafrefInModuleReferToInvalidNode()
+            throws IOException, ParserException {
+
+        thrown.expect(LinkerException.class);
+        thrown.expectMessage(
+                "YANG file error: Unable to find base leaf/leaf-list for given leafref path /define/network-id");
+        String searchDir = "src/test/resources/leafreflinker/intrafile/invalidsceneriowithinvalidnode";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+
+        // Create YANG node set
+        yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+
+        // Add references to import list.
+        yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
+
+        YangLinkerUtils.updateFilePriority(utilManager.getYangNodeSet());
+
+        // Carry out inter-file linking.
+        yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
+    }
+
+    /**
+     * Checks self resolution when leafref under module refers to invalid node.
+     * Inter file linking also has to be done to know the error message.
+     */
+    @Test
+    public void processSelfResolutionWhenLeafrefIsInDeepTreeAndLeafIsInModuleWithReferredTypeUnion()
+            throws IOException, ParserException {
+
+        String searchDir = "src/test/resources/leafreflinker/intrafile/leafreflinking";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+        YangNode selfNode = null;
+
+        // Create YANG node set
+        yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+
+        // Add references to import list.
+        yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
+
+        YangLinkerUtils.updateFilePriority(utilManager.getYangNodeSet());
+
+        // Carry out inter-file linking.
+        yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
+
+        Iterator<YangNode> yangNodeIterator = utilManager.getYangNodeSet().iterator();
+
+        YangNode rootNode = yangNodeIterator.next();
+
+        if (rootNode.getName().equals("Test")) {
+            selfNode = rootNode;
+        }
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((selfNode instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(selfNode.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) selfNode;
+        assertThat(yangNode.getName(), is("Test"));
+
+        YangContainer containerParent = (YangContainer) yangNode.getChild().getChild().getChild();
+        ListIterator<YangLeaf> leafIterator;
+        YangLeaf leafInfo;
+
+        leafIterator = containerParent.getListOfLeaf().listIterator();
+        leafInfo = leafIterator.next();
+
+        // Check whether the information in the leaf is correct.
+        assertThat(leafInfo.getName(), is("name"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("leafref"));
+        assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.LEAFREF));
+        YangLeafRef leafref = (YangLeafRef) (leafInfo.getDataType().getDataTypeExtendedInfo());
+
+        // Check whether leafref type got resolved.
+        assertThat(leafref.getResolvableStatus(),
+                   is(ResolvableStatus.RESOLVED));
+
+        // Check the effective type for the leaf.
+        assertThat(leafref.getEffectiveDataType().getDataType(),
+                   is(YangDataTypes.UNION));
+    }
+
+    /**
+     * Checks self resolution when leafref of leaf-list under module refers to leaf in container.
+     */
+    @Test
+    public void processSelfResolutionWhenLeafrefReferToContainerLeafList()
+            throws IOException, ParserException {
+
+        String searchDir = "src/test/resources/leafreflinker/intrafile/leafrefreferingtoleaflist";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+        YangNode selfNode = null;
+
+        // Create YANG node set
+        yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+
+        // Add references to import list.
+        yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
+
+        YangLinkerUtils.updateFilePriority(utilManager.getYangNodeSet());
+
+        // Carry out inter-file linking.
+        yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
+
+        Iterator<YangNode> yangNodeIterator = utilManager.getYangNodeSet().iterator();
+
+        YangNode rootNode = yangNodeIterator.next();
+
+        if (rootNode.getName().equals("ietf-network")) {
+            selfNode = rootNode;
+        }
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((selfNode instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(selfNode.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) selfNode;
+        assertThat(yangNode.getName(), is("ietf-network"));
+
+        ListIterator<YangLeafList> leafListIterator;
+        YangLeafList leafListInfo;
+
+        leafListIterator = yangNode.getListOfLeafList().listIterator();
+        leafListInfo = leafListIterator.next();
+
+        // Check whether the information in the leaf is correct.
+        assertThat(leafListInfo.getName(), is("network-ref"));
+        assertThat(leafListInfo.getDataType().getDataTypeName(), is("leafref"));
+        assertThat(leafListInfo.getDataType().getDataType(), is(YangDataTypes.LEAFREF));
+        YangLeafRef leafref = (YangLeafRef) (leafListInfo.getDataType().getDataTypeExtendedInfo());
+
+        // Check whether leafref type got resolved.
+        assertThat(leafref.getResolvableStatus(),
+                   is(ResolvableStatus.RESOLVED));
+
+        // Check the effective type for the leaf.
+        assertThat(leafref.getEffectiveDataType().getDataType(),
+                   is(YangDataTypes.UINT8));
+    }
+
+    /**
+     * Checks self resolution when leafref of leaf-list under module refers to leaf-list in input of rpc.
+     */
+    @Test
+    public void processSelfResolutionWhenLeafrefInModuleReferToLeafListInInputOfRpc()
+            throws IOException, ParserException {
+
+        String searchDir = "src/test/resources/leafreflinker/intrafile/leafreftoinputinrpc";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+        YangNode selfNode = null;
+
+        // Create YANG node set
+        yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+
+        // Add references to import list.
+        yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
+
+        YangLinkerUtils.updateFilePriority(utilManager.getYangNodeSet());
+
+        // Carry out inter-file linking.
+        yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
+
+        Iterator<YangNode> yangNodeIterator = utilManager.getYangNodeSet().iterator();
+
+        YangNode rootNode = yangNodeIterator.next();
+
+        if (rootNode.getName().equals("ietf-network")) {
+            selfNode = rootNode;
+        }
+
+        // Check whether the node type is set properly to module.
+        assertThat(selfNode.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) selfNode;
+        assertThat(yangNode.getName(), is("ietf-network"));
+
+        ListIterator<YangLeafList> leafListIterator;
+        YangLeafList leafListInfo;
+
+        leafListIterator = yangNode.getListOfLeafList().listIterator();
+        leafListInfo = leafListIterator.next();
+
+        // Check whether the information in the leaf is correct.
+        assertThat(leafListInfo.getName(), is("network-ref"));
+        assertThat(leafListInfo.getDataType().getDataTypeName(), is("leafref"));
+        assertThat(leafListInfo.getDataType().getDataType(), is(YangDataTypes.LEAFREF));
+        YangLeafRef leafref = (YangLeafRef) (leafListInfo.getDataType().getDataTypeExtendedInfo());
+
+        // Check whether leafref type got resolved.
+        assertThat(leafref.getResolvableStatus(),
+                   is(ResolvableStatus.RESOLVED));
+
+        // Check the effective type for the leaf.
+        assertThat(leafref.getEffectiveDataType().getDataType(),
+                   is(YangDataTypes.UINT8));
+    }
+
+    /**
+     * Checks self resolution when leafref of leaf-list under module refers to invalid node.
+     * Inter file linking also has to be done to know the error message.
+     */
+    @Test
+    public void processSelfResolutionWhenLeafrefIsInDeepTreeAndLeafListIsInModuleWithReferredTypeEnumeration()
+            throws IOException, ParserException {
+
+        String searchDir = "src/test/resources/leafreflinker/intrafile/leafrefwithrefleafderived";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+        YangNode selfNode = null;
+
+        // Create YANG node set
+        yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+
+        // Add references to import list.
+        yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
+
+        YangLinkerUtils.updateFilePriority(utilManager.getYangNodeSet());
+
+        // Carry out inter-file linking.
+        yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
+
+        Iterator<YangNode> yangNodeIterator = utilManager.getYangNodeSet().iterator();
+
+        YangNode rootNode = yangNodeIterator.next();
+
+        if (rootNode.getName().equals("Test")) {
+            selfNode = rootNode;
+        }
+
+        // Check whether the node type is set properly to module.
+        assertThat(selfNode.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) selfNode;
+
+        assertThat(yangNode.getName(), is("Test"));
+
+        YangContainer containerParent = (YangContainer) yangNode.getChild().getChild().getChild();
+        ListIterator<YangLeafList> leafListListIterator;
+        YangLeafList leafListInfo;
+
+        leafListListIterator = containerParent.getListOfLeafList().listIterator();
+        leafListInfo = leafListListIterator.next();
+
+        // Check whether the information in the leaf is correct.
+        assertThat(leafListInfo.getName(), is("name"));
+        assertThat(leafListInfo.getDataType().getDataTypeName(), is("leafref"));
+        assertThat(leafListInfo.getDataType().getDataType(), is(YangDataTypes.LEAFREF));
+        YangLeafRef leafref = (YangLeafRef) (leafListInfo.getDataType().getDataTypeExtendedInfo());
+
+        // Check whether leafref type got resolved.
+        assertThat(leafref.getResolvableStatus(),
+                   is(ResolvableStatus.RESOLVED));
+
+        // Check the effective type for the leaf.
+        assertThat(leafref.getEffectiveDataType().getDataType(),
+                   is(YangDataTypes.ENUMERATION));
+    }
+
+    /**
+     * Checks the error scenerio when the referred node is not a leaf or leaf-list.
+     */
+    @Test
+    public void processSelfResolutionWhenLeafrefDoesNotReferToLeafOrLeafList()
+            throws IOException, ParserException {
+
+        thrown.expect(LinkerException.class);
+        thrown.expectMessage(
+                "YANG file error: Unable to find base leaf/leaf-list for given leafref path /networks");
+        String searchDir = "src/test/resources/leafreflinker/intrafile/invalidsceneriowithnorefleaf";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+
+        // Create YANG node set
+        yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+
+        // Add references to import list.
+        yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
+
+        YangLinkerUtils.updateFilePriority(utilManager.getYangNodeSet());
+
+        // Carry out inter-file linking.
+        yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
+    }
+
+    /**
+     * Checks self resolution when leafref of leaf-list under module refers to leaf in container.
+     */
+    @Test
+    public void processSelfResolutionWhenLeafrefInTypedefReferToContainer()
+            throws IOException, ParserException {
+        String searchDir = "src/test/resources/leafreflinker/intrafile/leafrefintypedef";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+        YangNode selfNode = null;
+        // Create YANG node set
+        yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+
+        // Add references to import list.
+        yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
+
+        YangLinkerUtils.updateFilePriority(utilManager.getYangNodeSet());
+
+        // Carry out inter-file linking.
+        yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
+
+        Iterator<YangNode> yangNodeIterator = utilManager.getYangNodeSet().iterator();
+
+        YangNode rootNode = yangNodeIterator.next();
+
+        if (rootNode.getName().equals("ietf-network")) {
+            selfNode = rootNode;
+        }
+        // Check whether the data model tree returned is of type module.
+        assertThat((selfNode instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(selfNode.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) selfNode;
+        assertThat(yangNode.getName(), is("ietf-network"));
+
+        YangContainer yangContainer = (YangContainer) yangNode.getChild();
+        ListIterator<YangLeaf> leafIterator;
+        YangLeaf leafInfo;
+        leafIterator = yangContainer.getListOfLeaf().listIterator();
+        leafInfo = leafIterator.next();
+
+        // Check whether the information in the leaf is correct under grouping.
+        assertThat(leafInfo.getName(), is("network-id"));
+        assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.LEAFREF));
+
+        YangLeafRef leafref = (YangLeafRef) (leafInfo.getDataType().getDataTypeExtendedInfo());
+
+        // Check whether leafref type got resolved.
+        assertThat(leafref.getResolvableStatus(),
+                   is(ResolvableStatus.RESOLVED));
+
+        // Check the effective type for the leaf.
+        assertThat(leafref.getEffectiveDataType().getDataType(),
+                   is(YangDataTypes.UINT8));
+    }
+
+    /**
+     * Checks self resolution when leafref of leaf-list under module refers to leaf-list in input of rpc.
+     */
+    @Test
+    public void processSelfResolutionWhenLeafrefInTypedefModuleReferToLeafListInInputOfRpc()
+            throws IOException, ParserException {
+
+        String searchDir = "src/test/resources/leafreflinker/intrafile/leafreftorpcinputleaflist";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+        YangNode selfNode = null;
+        // Create YANG node set
+        yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+
+        // Add references to import list.
+        yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
+
+        YangLinkerUtils.updateFilePriority(utilManager.getYangNodeSet());
+
+        // Carry out inter-file linking.
+        yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
+
+        Iterator<YangNode> yangNodeIterator = utilManager.getYangNodeSet().iterator();
+
+        YangNode rootNode = yangNodeIterator.next();
+
+        if (rootNode.getName().equals("ietf-network")) {
+            selfNode = rootNode;
+        }
+        // Check whether the data model tree returned is of type module.
+        assertThat((selfNode instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(selfNode.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) selfNode;
+        assertThat(yangNode.getName(), is("ietf-network"));
+
+        YangInput yangInput = (YangInput) yangNode.getChild().getChild();
+
+        ListIterator<YangLeafList> leafListIterator;
+        YangLeafList yangLeafListInfo;
+        leafListIterator = yangInput.getListOfLeafList().listIterator();
+        yangLeafListInfo = leafListIterator.next();
+
+        // Check whether the information in the leaf is correct under grouping.
+        assertThat(yangLeafListInfo.getName(), is("network-id"));
+        assertThat(yangLeafListInfo.getDataType().getDataType(), is(YangDataTypes.LEAFREF));
+
+        YangLeafRef leafref = (YangLeafRef) (yangLeafListInfo.getDataType().getDataTypeExtendedInfo());
+
+        // Check whether leafref type got resolved.
+        assertThat(leafref.getResolvableStatus(),
+                   is(ResolvableStatus.RESOLVED));
+
+        // Check the effective type for the leaf.
+        assertThat(leafref.getEffectiveDataType().getDataType(),
+                   is(YangDataTypes.UINT8));
+    }
+
+    /**
+     * Checks self resolution when leafref of leaf-list under module refers to invalid node.
+     * Inter file linking also has to be done to know the error message.
+     */
+    @Test
+    public void processSelfResolutionWhenLeafrefInTypedefIsInDeepTreeAndLeafListIsInModuleWithReferredTypeEnumeration()
+            throws IOException, ParserException {
+
+        String searchDir = "src/test/resources/leafreflinker/intrafile/leafreftoleafrefwithtypedef";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+        YangNode selfNode = null;
+        // Create YANG node set
+        yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+
+        // Add references to import list.
+        yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
+
+        YangLinkerUtils.updateFilePriority(utilManager.getYangNodeSet());
+
+        // Carry out inter-file linking.
+        yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
+
+        Iterator<YangNode> yangNodeIterator = utilManager.getYangNodeSet().iterator();
+
+        YangNode rootNode = yangNodeIterator.next();
+
+        if (rootNode.getName().equals("Test")) {
+            selfNode = rootNode;
+        }
+        // Check whether the data model tree returned is of type module.
+        assertThat((selfNode instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(selfNode.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) selfNode;
+        assertThat(yangNode.getName(), is("Test"));
+
+        YangContainer yangContainer = (YangContainer) yangNode.getChild().getChild().getChild().getNextSibling();
+
+        ListIterator<YangLeaf> leafIterator;
+        YangLeaf yangLeafInfo;
+        leafIterator = yangContainer.getListOfLeaf().listIterator();
+        yangLeafInfo = leafIterator.next();
+
+        // Check whether the information in the leaf is correct under grouping.
+        assertThat(yangLeafInfo.getName(), is("interval"));
+        assertThat(yangLeafInfo.getDataType().getDataType(), is(YangDataTypes.LEAFREF));
+
+        YangLeafRef leafref = (YangLeafRef) (yangLeafInfo.getDataType().getDataTypeExtendedInfo());
+
+        // Check whether leafref type got resolved.
+        assertThat(leafref.getResolvableStatus(),
+                   is(ResolvableStatus.RESOLVED));
+
+        // Check the effective type for the leaf.
+        assertThat(leafref.getEffectiveDataType().getDataType(),
+                   is(YangDataTypes.ENUMERATION));
+    }
+
+    /**
+     * Checks self resolution when grouping and uses are siblings.
+     * Grouping followed by uses.
+     */
+    @Test
+    public void processSelfResolutionWhenLeafrefRefersAnotherLeafref()
+            throws IOException, ParserException {
+
+        String searchDir = "src/test/resources/leafreflinker/intrafile/leafreftoleafref";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+        YangNode selfNode = null;
+        // Create YANG node set
+        yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+
+        // Add references to import list.
+        yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
+
+        YangLinkerUtils.updateFilePriority(utilManager.getYangNodeSet());
+
+        // Carry out inter-file linking.
+        yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
+
+        Iterator<YangNode> yangNodeIterator = utilManager.getYangNodeSet().iterator();
+
+        YangNode rootNode = yangNodeIterator.next();
+
+        if (rootNode.getName().equals("ietf-network")) {
+            selfNode = rootNode;
+        }
+        // Check whether the data model tree returned is of type module.
+        assertThat((selfNode instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(selfNode.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) selfNode;
+        assertThat(yangNode.getName(), is("ietf-network"));
+
+        ListIterator<YangLeaf> leafIterator;
+        YangLeaf leafInfo;
+
+        //YangGrouping grouping = (YangGrouping) yangNode.getChild().getNextSibling();
+        leafIterator = yangNode.getListOfLeaf().listIterator();
+        leafInfo = leafIterator.next();
+
+        // Check whether the information in the leaf is correct under grouping.
+        assertThat(leafInfo.getName(), is("network-ref"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("leafref"));
+        assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.LEAFREF));
+        YangLeafRef leafref = (YangLeafRef) (leafInfo.getDataType().getDataTypeExtendedInfo());
+
+        assertThat(leafref.getResolvableStatus(),
+                   is(ResolvableStatus.RESOLVED));
+
+        assertThat(leafref.getEffectiveDataType().getDataType(),
+                   is(YangDataTypes.UINT8));
+    }
+
+    /**
+     * Checks self resolution when leafref refers to many other leafref.
+     */
+    @Test
+    public void processSelfResolutionWhenLeafrefReferToMultipleLeafref()
+            throws IOException, ParserException {
+
+        String searchDir = "src/test/resources/leafreflinker/intrafile/leafreftomultileafref";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+        YangNode selfNode = null;
+        // Create YANG node set
+        yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+
+        // Add references to import list.
+        yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
+
+        YangLinkerUtils.updateFilePriority(utilManager.getYangNodeSet());
+
+        // Carry out inter-file linking.
+        yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
+
+        Iterator<YangNode> yangNodeIterator = utilManager.getYangNodeSet().iterator();
+
+        YangNode rootNode = yangNodeIterator.next();
+
+        if (rootNode.getName().equals("Test")) {
+            selfNode = rootNode;
+        }
+        // Check whether the data model tree returned is of type module.
+        assertThat((selfNode instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(selfNode.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) selfNode;
+        assertThat(yangNode.getName(), is("Test"));
+
+        YangContainer containerInModule = (YangContainer) yangNode.getChild().getNextSibling();
+        YangContainer containerInList = (YangContainer) containerInModule.getChild().getChild();
+
+        ListIterator<YangLeaf> leafIterator;
+        YangLeaf leafInfo;
+
+        leafIterator = containerInList.getListOfLeaf().listIterator();
+        leafInfo = leafIterator.next();
+
+        // Check whether the information in the leaf is correct under grouping.
+        assertThat(leafInfo.getName(), is("remove"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("leafref"));
+        assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.LEAFREF));
+        YangLeafRef leafref = (YangLeafRef) (leafInfo.getDataType().getDataTypeExtendedInfo());
+
+        assertThat(leafref.getResolvableStatus(),
+                   is(ResolvableStatus.RESOLVED));
+
+        assertThat(leafref.getEffectiveDataType().getDataType(),
+                   is(YangDataTypes.ENUMERATION));
+    }
+
+    /**
+     * Checks self resolution when grouping and uses are siblings.
+     * Grouping followed by uses.
+     */
+    @Test
+    public void processSelfResolutionWhenLeafrefRefersAnotherDerivedType()
+            throws IOException, ParserException {
+
+        String searchDir = "src/test/resources/leafreflinker/intrafile/leafreftoderivedtype";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+        YangNode selfNode = null;
+        // Create YANG node set
+        yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+
+        // Add references to import list.
+        yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
+
+        YangLinkerUtils.updateFilePriority(utilManager.getYangNodeSet());
+
+        // Carry out inter-file linking.
+        yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
+
+        Iterator<YangNode> yangNodeIterator = utilManager.getYangNodeSet().iterator();
+
+        YangNode rootNode = yangNodeIterator.next();
+
+        if (rootNode.getName().equals("ietf-network")) {
+            selfNode = rootNode;
+        }
+        // Check whether the data model tree returned is of type module.
+        assertThat((selfNode instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(selfNode.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) selfNode;
+        assertThat(yangNode.getName(), is("ietf-network"));
+
+        ListIterator<YangLeaf> leafIterator;
+        YangLeaf leafInfo;
+
+        //YangGrouping grouping = (YangGrouping) yangNode.getChild().getNextSibling();
+        leafIterator = yangNode.getListOfLeaf().listIterator();
+        leafInfo = leafIterator.next();
+
+        // Check whether the information in the leaf is correct under grouping.
+        assertThat(leafInfo.getName(), is("network-ref"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("leafref"));
+        assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.LEAFREF));
+        YangLeafRef leafref = (YangLeafRef) (leafInfo.getDataType().getDataTypeExtendedInfo());
+
+        assertThat(leafref.getResolvableStatus(),
+                   is(ResolvableStatus.RESOLVED));
+
+        assertThat(leafref.getEffectiveDataType().getDataType(),
+                   is(YangDataTypes.DERIVED));
+    }
+
+    /**
+     * Checks self resolution when leafref refers to many other leafref.
+     */
+    @Test
+    public void processSelfResolutionWhenLeafrefReferToMultipleTypedef()
+            throws IOException, ParserException {
+
+        String searchDir = "src/test/resources/leafreflinker/intrafile/leafreftomultitypedef";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+        YangNode selfNode = null;
+        // Create YANG node set
+        yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+
+        // Add references to import list.
+        yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
+
+        YangLinkerUtils.updateFilePriority(utilManager.getYangNodeSet());
+
+        // Carry out inter-file linking.
+        yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
+
+        Iterator<YangNode> yangNodeIterator = utilManager.getYangNodeSet().iterator();
+
+        YangNode rootNode = yangNodeIterator.next();
+
+        if (rootNode.getName().equals("Test")) {
+            selfNode = rootNode;
+        }
+        // Check whether the data model tree returned is of type module.
+        assertThat((selfNode instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(selfNode.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) selfNode;
+        assertThat(yangNode.getName(), is("Test"));
+
+        YangContainer containerInModule = (YangContainer) yangNode.getChild().getNextSibling();
+        YangContainer containerInList = (YangContainer) containerInModule.getChild().getChild();
+
+        ListIterator<YangLeaf> leafIterator;
+        YangLeaf leafInfo;
+
+        leafIterator = containerInList.getListOfLeaf().listIterator();
+        leafInfo = leafIterator.next();
+
+        // Check whether the information in the leaf is correct under grouping.
+        assertThat(leafInfo.getName(), is("remove"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("leafref"));
+        assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.LEAFREF));
+        YangLeafRef leafref = (YangLeafRef) (leafInfo.getDataType().getDataTypeExtendedInfo());
+
+        assertThat(leafref.getResolvableStatus(),
+                   is(ResolvableStatus.RESOLVED));
+
+        assertThat(leafref.getEffectiveDataType().getDataType(),
+                   is(YangDataTypes.DERIVED));
+    }
+
+    /**
+     * Checks self resolution when leafref refers to many other leaf with derived type
+     * which in turn referring to another leaf.
+     */
+    @Test
+    public void processSelfResolutionWhenLeafrefReferToDerivedTypeReferringToLeafWithLeafref()
+            throws IOException, ParserException {
+
+        String searchDir = "src/test/resources/leafreflinker/intrafile/leafreftotypedefwithleafref";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+        YangNode selfNode = null;
+        // Create YANG node set
+        yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+
+        // Add references to import list.
+        yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
+
+        YangLinkerUtils.updateFilePriority(utilManager.getYangNodeSet());
+
+        // Carry out inter-file linking.
+        yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
+
+        Iterator<YangNode> yangNodeIterator = utilManager.getYangNodeSet().iterator();
+
+        YangNode rootNode = yangNodeIterator.next();
+
+        if (rootNode.getName().equals("Test")) {
+            selfNode = rootNode;
+        }
+        // Check whether the data model tree returned is of type module.
+        assertThat((selfNode instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(selfNode.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) selfNode;
+        assertThat(yangNode.getName(), is("Test"));
+
+        YangContainer containerInModule = (YangContainer) yangNode.getChild().getNextSibling();
+        YangContainer containerInList = (YangContainer) containerInModule.getChild().getChild();
+
+        ListIterator<YangLeaf> leafIterator;
+        YangLeaf leafInfo;
+
+        leafIterator = containerInList.getListOfLeaf().listIterator();
+        leafInfo = leafIterator.next();
+
+        // Check whether the information in the leaf is correct under grouping.
+        assertThat(leafInfo.getName(), is("remove"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("leafref"));
+        assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.LEAFREF));
+        YangLeafRef leafref = (YangLeafRef) leafInfo.getDataType().getDataTypeExtendedInfo();
+
+        assertThat(leafref.getResolvableStatus(),
+                   is(ResolvableStatus.RESOLVED));
+
+        assertThat(leafref.getEffectiveDataType().getDataType(),
+                   is(YangDataTypes.ENUMERATION));
+    }
+
+    /**
+     * Checks self resolution when leafref under module refers to leaf in container with relative path.
+     */
+    @Test
+    public void processSelfResolutionWhenLeafrefReferToContainerLeafRelPath()
+            throws IOException, ParserException {
+
+        String searchDir = "src/test/resources/leafreflinker/intrafile/relativepath/simpleleafref";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+        YangNode selfNode = null;
+        // Create YANG node set
+        yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+
+        // Add references to import list.
+        yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
+
+        YangLinkerUtils.updateFilePriority(utilManager.getYangNodeSet());
+
+        // Carry out inter-file linking.
+        yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
+
+        Iterator<YangNode> yangNodeIterator = utilManager.getYangNodeSet().iterator();
+
+        YangNode rootNode = yangNodeIterator.next();
+
+        if (rootNode.getName().equals("ietf-network")) {
+            selfNode = rootNode;
+        }
+        // Check whether the data model tree returned is of type module.
+        assertThat((selfNode instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(selfNode.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) selfNode;
+        assertThat(yangNode.getName(), is("ietf-network"));
+
+        ListIterator<YangLeaf> leafIterator;
+        YangLeaf leafInfo;
+
+        leafIterator = yangNode.getListOfLeaf().listIterator();
+        leafInfo = leafIterator.next();
+
+        // Check whether the information in the leaf is correct.
+        assertThat(leafInfo.getName(), is("network-ref"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("leafref"));
+        assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.LEAFREF));
+        YangLeafRef leafref = (YangLeafRef) (leafInfo.getDataType().getDataTypeExtendedInfo());
+
+        // Check whether leafref type got resolved.
+        assertThat(leafref.getResolvableStatus(),
+                   is(ResolvableStatus.RESOLVED));
+
+        // Check the effective type for the leaf.
+        assertThat(leafref.getEffectiveDataType().getDataType(),
+                   is(YangDataTypes.UINT8));
+    }
+
+    /**
+     * Checks self resolution when leafref under module refers to grouping rpc with input as name.
+     * Rpc has input child also. So here the node search must be done by taking input node using relative path.
+     */
+    @Ignore
+    public void processSelfResolutionWhenLeafrefInModuleReferToGroupingWithInputInRpcRelPath()
+            throws IOException, ParserException {
+
+        String searchDir = "src/test/resources/leafreflinker/intrafile/relativepath/leafreftoinputwithgroupinginrpc";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+        YangNode selfNode = null;
+        // Create YANG node set
+        yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+
+        // Add references to import list.
+        yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
+
+        YangLinkerUtils.updateFilePriority(utilManager.getYangNodeSet());
+
+        // Carry out inter-file linking.
+        yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
+
+        Iterator<YangNode> yangNodeIterator = utilManager.getYangNodeSet().iterator();
+
+        YangNode rootNode = yangNodeIterator.next();
+
+        if (rootNode.getName().equals("ietf-network")) {
+            selfNode = rootNode;
+        }
+        // Check whether the data model tree returned is of type module.
+        assertThat((selfNode instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(selfNode.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) selfNode;
+        assertThat(yangNode.getName(), is("ietf-network"));
+
+        ListIterator<YangLeaf> leafIterator;
+        YangLeaf leafInfo;
+
+        leafIterator = yangNode.getListOfLeaf().listIterator();
+        leafInfo = leafIterator.next();
+
+        // Check whether the information in the leaf is correct.
+        assertThat(leafInfo.getName(), is("network-ref"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("leafref"));
+        assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.LEAFREF));
+        YangLeafRef leafref = (YangLeafRef) (leafInfo.getDataType().getDataTypeExtendedInfo());
+
+        // Check whether leafref type got resolved.
+        assertThat(leafref.getResolvableStatus(),
+                   is(ResolvableStatus.RESOLVED));
+
+        // Check the effective type for the leaf.
+        assertThat(leafref.getEffectiveDataType().getDataType(),
+                   is(YangDataTypes.UINT8));
+    }
+
+    /**
+     * Checks self resolution when leafref under module refers to invalid root node with relative path.
+     */
+    @Test
+    public void processSelfResolutionWhenLeafrefInModuleReferToInvalidRootNodeRelPath()
+            throws IOException, ParserException {
+
+        thrown.expect(LinkerException.class);
+        thrown.expectMessage(
+                "YANG file error: The target node, in the leafref path ../../../define/network-id, is invalid.");
+        String searchDir = "src/test/resources/leafreflinker/intrafile/relativepath/invalidrelativeancestoraccess";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+
+        // Create YANG node set
+        yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+
+        // Add references to import list.
+        yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
+
+        YangLinkerUtils.updateFilePriority(utilManager.getYangNodeSet());
+
+        // Carry out inter-file linking.
+        yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
+    }
+
+    /**
+     * Checks self resolution when leafref under module refers to invalid node.
+     * Inter file linking also has to be done to know the error message with relative path.
+     */
+    @Test
+    public void processSelfResolutionWhenLeafrefInModuleReferToInvalidNodeRelPath()
+            throws IOException, ParserException {
+
+
+        thrown.expect(LinkerException.class);
+        thrown.expectMessage(
+                "YANG file error: Unable to find base leaf/leaf-list for given leafref path ../define/network-id");
+        String searchDir = "src/test/resources/leafreflinker/intrafile/relativepath/invalidnode";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+
+        // Create YANG node set
+        yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+
+        // Add references to import list.
+        yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
+
+        YangLinkerUtils.updateFilePriority(utilManager.getYangNodeSet());
+
+        //Carry out inter-file linking.
+        yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
+    }
+
+    /**
+     * Checks self resolution when leafref of leaf-list under module refers to leaf in container with relative path.
+     */
+    @Test
+    public void processSelfResolutionWhenLeafrefInTypedefReferToContainerRelPath()
+            throws IOException, ParserException {
+
+        String searchDir = "src/test/resources/leafreflinker/intrafile/relativepath/leafrefintypedef";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+        YangNode selfNode = null;
+        // Create YANG node set
+        yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+
+        // Add references to import list.
+        yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
+
+        YangLinkerUtils.updateFilePriority(utilManager.getYangNodeSet());
+
+        // Carry out inter-file linking.
+        yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
+
+        Iterator<YangNode> yangNodeIterator = utilManager.getYangNodeSet().iterator();
+
+        YangNode rootNode = yangNodeIterator.next();
+
+        if (rootNode.getName().equals("ietf-network")) {
+            selfNode = rootNode;
+        }
+        // Check whether the data model tree returned is of type module.
+        assertThat((selfNode instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(selfNode.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) selfNode;
+        assertThat(yangNode.getName(), is("ietf-network"));
+        ListIterator<YangLeaf> leafIterator;
+        YangLeaf leafInfo;
+        YangContainer yangContainer = (YangContainer) yangNode.getChild();
+        leafIterator = yangContainer.getListOfLeaf().listIterator();
+        leafInfo = leafIterator.next();
+
+        // Check whether the information in the leaf is correct under grouping.
+        assertThat(leafInfo.getName(), is("network-id"));
+        assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.LEAFREF));
+
+        YangLeafRef leafref = (YangLeafRef) (leafInfo.getDataType().getDataTypeExtendedInfo());
+
+        // Check whether leafref type got resolved.
+        assertThat(leafref.getResolvableStatus(),
+                   is(ResolvableStatus.RESOLVED));
+
+        // Check the effective type for the leaf.
+        assertThat(leafref.getEffectiveDataType().getDataType(),
+                   is(YangDataTypes.UINT8));
+    }
+
+    /**
+     * Checks self resolution when leafref refers to many other leafref with relative path.
+     */
+    @Test
+    public void processSelfResolutionWhenLeafrefReferToMultipleLeafrefRelPath()
+            throws IOException, ParserException {
+
+        String searchDir = "src/test/resources/leafreflinker/intrafile/relativepath/leafreftomultileafref";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+        YangNode selfNode = null;
+        // Create YANG node set
+        yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+
+        // Add references to import list.
+        yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
+
+        YangLinkerUtils.updateFilePriority(utilManager.getYangNodeSet());
+
+        // Carry out inter-file linking.
+        yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
+
+        Iterator<YangNode> yangNodeIterator = utilManager.getYangNodeSet().iterator();
+
+        YangNode rootNode = yangNodeIterator.next();
+
+        if (rootNode.getName().equals("Test")) {
+            selfNode = rootNode;
+        }
+        // Check whether the data model tree returned is of type module.
+        assertThat((selfNode instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(selfNode.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) selfNode;
+        assertThat(yangNode.getName(), is("Test"));
+
+        YangContainer containerInModule = (YangContainer) yangNode.getChild().getNextSibling();
+        YangContainer containerInList = (YangContainer) containerInModule.getChild().getChild();
+
+        ListIterator<YangLeaf> leafIterator;
+        YangLeaf leafInfo;
+
+        leafIterator = containerInList.getListOfLeaf().listIterator();
+        leafInfo = leafIterator.next();
+
+        // Check whether the information in the leaf is correct under grouping.
+        assertThat(leafInfo.getName(), is("remove"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("leafref"));
+        assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.LEAFREF));
+        YangLeafRef leafref = (YangLeafRef) (leafInfo.getDataType().getDataTypeExtendedInfo());
+
+        assertThat(leafref.getResolvableStatus(),
+                   is(ResolvableStatus.RESOLVED));
+
+        assertThat(leafref.getEffectiveDataType().getDataType(),
+                   is(YangDataTypes.ENUMERATION));
+    }
+
+    /**
+     * Checks self resolution when leafref refers to many other leaf with derived type
+     * which in turn referring to another leaf with relative type.
+     */
+    @Test
+    public void processSelfResolutionWhenLeafrefReferToDerivedTypeReferringToLeafWithLeafrefRelType()
+            throws IOException, ParserException {
+
+        String searchDir = "src/test/resources/leafreflinker/intrafile/relativepath/leafreftotypedef";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+        YangNode selfNode = null;
+        // Create YANG node set
+        yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+
+        // Add references to import list.
+        yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
+
+        YangLinkerUtils.updateFilePriority(utilManager.getYangNodeSet());
+
+        // Carry out inter-file linking.
+        yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
+
+        Iterator<YangNode> yangNodeIterator = utilManager.getYangNodeSet().iterator();
+
+        YangNode rootNode = yangNodeIterator.next();
+
+        if (rootNode.getName().equals("Test")) {
+            selfNode = rootNode;
+        }
+        // Check whether the data model tree returned is of type module.
+        assertThat((selfNode instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(selfNode.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) selfNode;
+        assertThat(yangNode.getName(), is("Test"));
+
+        YangContainer containerInModule = (YangContainer) yangNode.getChild().getNextSibling();
+        YangContainer containerInList = (YangContainer) containerInModule.getChild().getChild();
+
+        ListIterator<YangLeaf> leafIterator;
+        YangLeaf leafInfo;
+
+        leafIterator = containerInList.getListOfLeaf().listIterator();
+        leafInfo = leafIterator.next();
+
+        // Check whether the information in the leaf is correct under grouping.
+        assertThat(leafInfo.getName(), is("remove"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("leafref"));
+        assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.LEAFREF));
+        YangLeafRef leafref = (YangLeafRef) leafInfo.getDataType().getDataTypeExtendedInfo();
+
+        assertThat(leafref.getResolvableStatus(),
+                   is(ResolvableStatus.RESOLVED));
+
+        assertThat(leafref.getEffectiveDataType().getDataType(),
+                   is(YangDataTypes.ENUMERATION));
+    }
+
+    /**
+     * Checks the valid scenerios of path argument having proper setters.
+     */
+    @Test
+    public void processPathArgumentStatement()
+            throws IOException, ParserException {
+
+        String searchDir = "src/test/resources/leafreflinker/intrafile/relativepath/pathlistener";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+        YangNode selfNode = null;
+        // Create YANG node set
+        yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+
+        // Add references to import list.
+        yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
+
+        YangLinkerUtils.updateFilePriority(utilManager.getYangNodeSet());
+
+        // Carry out inter-file linking.
+        yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
+
+        Iterator<YangNode> yangNodeIterator = utilManager.getYangNodeSet().iterator();
+
+        YangNode rootNode = yangNodeIterator.next();
+
+        if (rootNode.getName().equals("PathListener")) {
+            selfNode = rootNode;
+        }
+        // Check whether the data model tree returned is of type module.
+        assertThat((selfNode instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(selfNode.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) selfNode;
+        assertThat(yangNode.getName(), is("PathListener"));
+        YangList listInModule = (YangList) yangNode.getChild();
+
+        YangContainer containerInModule = (YangContainer) yangNode.getChild().getNextSibling();
+        ListIterator<YangLeaf> leafIterator;
+        YangLeaf leafInfo;
+
+        YangLeaf leafNameInList = listInModule.getListOfLeaf().listIterator().next();
+
+        leafIterator = containerInModule.getListOfLeaf().listIterator();
+        leafInfo = leafIterator.next();
+
+        // Check whether the information in the leaf is correct under grouping.
+        assertThat(leafInfo.getName(), is("ifname"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("leafref"));
+        assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.LEAFREF));
+        YangLeafRef leafref = (YangLeafRef) leafInfo.getDataType().getDataTypeExtendedInfo();
+        assertThat(leafref.getPathType(), Is.is(YangPathArgType.ABSOLUTE_PATH));
+
+        YangRelativePath relativePathForName = leafref.getRelativePath();
+        assertThat(relativePathForName.getAncestorNodeCount(), is(2));
+        List<YangAtomicPath> absPathForName = relativePathForName.getAtomicPathList();
+        Iterator<YangAtomicPath> absPathIteratorForName = absPathForName.listIterator();
+        YangAtomicPath abspathForName = absPathIteratorForName.next();
+        assertThat(abspathForName.getNodeIdentifier().getName(), is("interface"));
+        assertThat(abspathForName.getNodeIdentifier().getPrefix(), is("test"));
+        YangAtomicPath abspath1 = absPathIteratorForName.next();
+        assertThat(abspath1.getNodeIdentifier().getName(), is("name"));
+        assertThat(abspath1.getNodeIdentifier().getPrefix(), is("test"));
+
+        YangLeaf leafInfo1 = leafIterator.next();
+        // Check whether the information in the leaf is correct under grouping.
+        assertThat(leafInfo1.getName(), is("status"));
+        assertThat(leafInfo1.getDataType().getDataTypeName(), is("leafref"));
+        assertThat(leafInfo1.getDataType().getDataType(), is(YangDataTypes.LEAFREF));
+
+        YangLeafRef leafref1 = (YangLeafRef) leafInfo1.getDataType().getDataTypeExtendedInfo();
+        assertThat(leafref1.getPathType(), is(YangPathArgType.ABSOLUTE_PATH));
+
+        List<YangAtomicPath> absolutePathList = leafref1.getAtomicPath();
+        Iterator<YangAtomicPath> absPathIterator = absolutePathList.listIterator();
+        YangAtomicPath abspath = absPathIterator.next();
+        assertThat(abspath.getNodeIdentifier().getName(), is("interface"));
+        assertThat(abspath.getNodeIdentifier().getPrefix(), is("test"));
+
+        List<YangPathPredicate> pathPredicateList = abspath.getPathPredicatesList();
+        Iterator<YangPathPredicate> pathPredicate = pathPredicateList.listIterator();
+        YangPathPredicate pathPredicate1 = pathPredicate.next();
+        assertThat(pathPredicate1.getNodeId().getName(), is("name"));
+        assertThat(pathPredicate1.getNodeId().getPrefix(), nullValue());
+        assertThat(pathPredicate1.getRelPath().getAncestorNodeCount(), is(1));
+        assertThat(pathPredicate1.getPathOp(), is(YangPathOperator.EQUALTO));
+        assertThat(pathPredicate1.getRelPath().getAtomicPathList().listIterator().next().getNodeIdentifier()
+                           .getName(), is("ifname"));
+        //TODO : Fill the path predicates
+//        assertThat(pathPredicate1.getLeftAxisNode(), is(leafNameInList));
+//        assertThat(pathPredicate1.getRightAxisNode(), is(leafInfo));
+    }
+
+    /**
+     * Checks inter file resolution when leafref refers to multiple leafrefs through many files.
+     */
+    @Test
+    public void processInterFileLeafrefRefersToMultipleLeafrefInMultipleFiles()
+            throws IOException, ParserException {
+
+        String searchDir = "src/test/resources/leafreflinker/interfile" +
+                "/interfileleafrefreferstomultipleleafrefinmultiplefiles";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+        YangNode refNode1 = null;
+        YangNode refNode2 = null;
+        YangNode selfNode = null;
+
+        // Create YANG node set
+        yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+
+        // Add references to import list.
+        yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
+
+        YangLinkerUtils.updateFilePriority(utilManager.getYangNodeSet());
+
+        // Carry out inter-file linking.
+        yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
+
+        for (YangNode rootNode : utilManager.getYangNodeSet()) {
+            if (rootNode.getName().equals("ietf-network-topology")) {
+                selfNode = rootNode;
+            } else if (rootNode.getName().equals("ietf-network")) {
+                refNode1 = rootNode;
+            } else {
+                refNode2 = rootNode;
+            }
+        }
+        // Check whether the data model tree returned is of type module.
+        assertThat(selfNode instanceof YangModule, is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(selfNode.getNodeType(), is(MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) selfNode;
+        assertThat(yangNode.getName(), is("ietf-network-topology"));
+
+        YangList list = (YangList) yangNode.getChild().getChild();
+        ListIterator<YangLeaf> leafIterator = list.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("link-tp"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("leafref"));
+        assertThat(leafInfo.getDataType().getDataType(), is(LEAFREF));
+
+        YangLeafRef leafref = (YangLeafRef) leafInfo.getDataType().getDataTypeExtendedInfo();
+
+        YangLeaf leafInfo2 = (YangLeaf) leafref.getReferredLeafOrLeafList();
+        assertThat(leafref.getReferredLeafOrLeafList(), is(leafInfo2));
+        assertThat(leafref.getResolvableStatus(), Is.is(ResolvableStatus.RESOLVED));
+
+        assertThat(leafref.getEffectiveDataType().getDataType(),
+                   is(YangDataTypes.STRING));
+    }
+
+
+    /**
+     * Checks addition of if-feature list to leafref.
+     */
+    @Test
+    public void processSelfFileLinkingWithFeatureReferredByLeafref()
+            throws IOException, ParserException {
+
+        String searchDir = "src/test/resources/leafreflinker/iffeatuinleafref/simpleleafrefwithiffeature";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+        YangNode selfNode = null;
+        // Create YANG node set
+        yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+
+        // Add references to import list.
+        yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
+
+        YangLinkerUtils.updateFilePriority(utilManager.getYangNodeSet());
+
+        // Carry out inter-file linking.
+        yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
+
+        Iterator<YangNode> yangNodeIterator = utilManager.getYangNodeSet().iterator();
+
+        YangNode rootNode = yangNodeIterator.next();
+
+        if (rootNode.getName().equals("syslog")) {
+            selfNode = rootNode;
+        }
+        // Check whether the data model tree returned is of type module.
+        assertThat((selfNode instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(selfNode.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) selfNode;
+        assertThat(yangNode.getName(), is("syslog"));
+
+        List<YangFeature> featureList = yangNode.getFeatureList();
+        YangFeature feature = featureList.iterator().next();
+        assertThat(feature.getName(), is("local-storage"));
+
+        YangContainer container = (YangContainer) yangNode.getChild();
+        assertThat(container.getName(), is("speed"));
+
+        List<YangLeaf> listOfLeaf = container.getListOfLeaf();
+        YangLeaf leaf = listOfLeaf.iterator().next();
+        assertThat(leaf.getName(), is("local-storage-limit"));
+
+        List<YangIfFeature> ifFeatureList = leaf.getIfFeatureList();
+        YangIfFeature ifFeature = ifFeatureList.iterator().next();
+        assertThat(ifFeature.getName().getName(), is("local-storage"));
+        assertThat(ifFeature.getResolvableStatus(), is(ResolvableStatus.RESOLVED));
+
+        ListIterator<YangLeaf> listOfLeafInModule = yangNode.getListOfLeaf().listIterator();
+        YangLeaf yangLeaf = listOfLeafInModule.next();
+        assertThat(yangLeaf.getName(), is("storage-value"));
+
+        YangLeafRef leafRef = (YangLeafRef) yangLeaf.getDataType().getDataTypeExtendedInfo();
+
+        assertThat(leafRef.getEffectiveDataType().getDataType(), is(YangDataTypes.UINT64));
+
+        List<YangIfFeature> ifFeatureListInLeafref = leafRef.getIfFeatureList();
+        YangIfFeature ifFeatureInLeafref = ifFeatureListInLeafref.iterator().next();
+        assertThat(ifFeatureInLeafref.getName().getName(), is("local-storage"));
+        assertThat(ifFeatureInLeafref.getResolvableStatus(), is(ResolvableStatus.RESOLVED));
+    }
+
+    /**
+     * Checks addition of if-feature list to leafref when referred leaf is again having leafref in it.
+     */
+    @Test
+    public void processSelfFileLinkingWithFeatureReferredByMultiLeafref()
+            throws IOException, ParserException {
+
+        String searchDir = "src/test/resources/leafreflinker/iffeatuinleafref/featurebymultileafref";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+        YangNode selfNode = null;
+        // Create YANG node set
+        yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+
+        // Add references to import list.
+        yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
+
+        YangLinkerUtils.updateFilePriority(utilManager.getYangNodeSet());
+
+        // Carry out inter-file linking.
+        yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
+
+        Iterator<YangNode> yangNodeIterator = utilManager.getYangNodeSet().iterator();
+
+        YangNode rootNode = yangNodeIterator.next();
+
+        if (rootNode.getName().equals("syslog")) {
+            selfNode = rootNode;
+        }
+        // Check whether the data model tree returned is of type module.
+        assertThat((selfNode instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(selfNode.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) selfNode;
+        assertThat(yangNode.getName(), is("syslog"));
+
+        List<YangFeature> featureList = yangNode.getFeatureList();
+        YangFeature feature = featureList.iterator().next();
+        assertThat(feature.getName(), is("local-storage"));
+
+        YangContainer container = (YangContainer) yangNode.getChild();
+        assertThat(container.getName(), is("speed"));
+
+        List<YangLeaf> listOfLeaf = container.getListOfLeaf();
+        YangLeaf leaf = listOfLeaf.iterator().next();
+        assertThat(leaf.getName(), is("local-storage-limit"));
+
+        List<YangIfFeature> ifFeatureList = leaf.getIfFeatureList();
+        YangIfFeature ifFeature = ifFeatureList.iterator().next();
+        assertThat(ifFeature.getName().getName(), is("local-storage"));
+        assertThat(ifFeature.getResolvableStatus(), is(ResolvableStatus.RESOLVED));
+
+        ListIterator<YangLeaf> listOfLeafInModule = yangNode.getListOfLeaf().listIterator();
+        YangLeaf yangLeaf = listOfLeafInModule.next();
+        assertThat(yangLeaf.getName(), is("storage-value"));
+
+        YangLeafRef leafRef = (YangLeafRef) yangLeaf.getDataType().getDataTypeExtendedInfo();
+
+        assertThat(leafRef.getEffectiveDataType().getDataType(), is(YangDataTypes.UINT64));
+
+        List<YangIfFeature> ifFeatureListInLeafref = leafRef.getIfFeatureList();
+        YangIfFeature ifFeatureInLeafref = ifFeatureListInLeafref.iterator().next();
+
+        assertThat(ifFeatureInLeafref.getName().getName(), is("main-storage"));
+        assertThat(ifFeatureInLeafref.getResolvableStatus(), is(ResolvableStatus.RESOLVED));
+
+        YangIfFeature ifFeatureInLeafref1 = ifFeatureListInLeafref.iterator().next();
+
+        assertThat(ifFeatureInLeafref1.getName().getName(), is("main-storage"));
+        assertThat(ifFeatureInLeafref1.getResolvableStatus(), is(ResolvableStatus.RESOLVED));
+    }
+
+    /**
+     * Checks self resolution when leafref in grouping is copied to augment.
+     */
+    @Test
+    public void processSelfResolutionWhenLeafrefInGroupingIsUnderAugment()
+            throws IOException, ParserException {
+
+        String searchDir = "src/test/resources/leafreflinker/intrafile/leafrefInAugment";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+        YangNode selfNode = null;
+
+        // Create YANG node set
+        yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+
+        // Add references to import list.
+        yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
+
+        YangLinkerUtils.updateFilePriority(utilManager.getYangNodeSet());
+
+        // Carry out inter-file linking.
+        yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
+
+        Iterator<YangNode> yangNodeIterator = utilManager.getYangNodeSet().iterator();
+
+        YangNode rootNode = yangNodeIterator.next();
+
+        if (rootNode.getName().equals("topology")) {
+            selfNode = rootNode;
+        }
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((selfNode instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(selfNode.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) selfNode;
+        assertThat(yangNode.getName(), is("topology"));
+
+        ListIterator<YangLeaf> leafIterator;
+        YangLeaf leafInfo;
+
+        YangAugment augment = (YangAugment) yangNode.getChild().getNextSibling();
+
+        YangList list = (YangList) augment.getChild().getChild().getChild().getChild().getChild();
+
+        leafIterator = list.getListOfLeaf().listIterator();
+        leafInfo = leafIterator.next();
+
+        // Check whether the information in the leaf is correct.
+        assertThat(leafInfo.getName(), is("src-tp-ref"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("leafref"));
+        assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.LEAFREF));
+        YangLeafRef leafref = (YangLeafRef) (leafInfo.getDataType().getDataTypeExtendedInfo());
+
+        // Check whether leafref type got resolved.
+        assertThat(leafref.getResolvableStatus(),
+                   is(ResolvableStatus.RESOLVED));
+
+        // Check the effective type for the leaf.
+        assertThat(leafref.getEffectiveDataType().getDataType(),
+                   is(YangDataTypes.UINT8));
+    }
+
+    /**
+     * Checks self resolution when leafref under grouping's uses.
+     */
+    @Test
+    public void processSelfResolutionWhenLeafrefUnderGroupingUses()
+            throws IOException, ParserException {
+
+        String searchDir = "src/test/resources/leafreflinker/intrafile/leafrefinusesundergrouping";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+        YangNode selfNode = null;
+        YangNode refNode = null;
+
+        // Create YANG node set
+        yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+
+        // Add references to import list.
+        yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
+
+        YangLinkerUtils.updateFilePriority(utilManager.getYangNodeSet());
+
+        // Carry out inter-file linking.
+        yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
+
+        Iterator<YangNode> yangNodeIterator = utilManager.getYangNodeSet().iterator();
+
+        YangNode rootNode = yangNodeIterator.next();
+
+        if (rootNode.getName().equals("ietf-network")) {
+            selfNode = rootNode;
+            refNode = yangNodeIterator.next();
+        } else {
+            refNode = rootNode;
+            selfNode = yangNodeIterator.next();
+        }
+
+        // Check whether the data model tree returned is of type module.
+        assertThat(selfNode instanceof YangModule, is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(selfNode.getNodeType(), is(MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) selfNode;
+        assertThat(yangNode.getName(), is("ietf-network"));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode1 = (YangModule) refNode;
+        assertThat(yangNode1.getName(), is("network"));
+
+        YangContainer yangContainer = (YangContainer) yangNode.getChild().getNextSibling().getNextSibling();
+        assertThat(yangContainer.getName(), is("fine"));
+
+        YangContainer yangContainer1 = (YangContainer) yangContainer.getChild().getNextSibling();
+        assertThat(yangContainer1.getName(), is("hi"));
+
+        ListIterator<YangLeaf> leafIterator;
+        YangLeaf leafInfo;
+
+        leafIterator = yangContainer1.getListOfLeaf().listIterator();
+        leafInfo = leafIterator.next();
+
+        // Check whether the information in the leaf is correct.
+        assertThat(leafInfo.getName(), is("network-id-ref"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("leafref"));
+        assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.LEAFREF));
+        YangLeafRef leafref = (YangLeafRef) (leafInfo.getDataType().getDataTypeExtendedInfo());
+
+        // Check whether leafref type got resolved.
+        assertThat(leafref.getResolvableStatus(),
+                   is(ResolvableStatus.RESOLVED));
+
+        // Check the effective type for the leaf.
+        assertThat(leafref.getEffectiveDataType().getDataType(),
+                   is(YangDataTypes.DERIVED));
+    }
+
+    /**
+     * Checks self resolution when leafref under typedef refers to the node where it is used.
+     */
+    @Test
+    public void processSelfResolutionWhenLeafrefInTypedefIsUsedInSameReferredNode()
+            throws IOException, ParserException {
+
+        String searchDir = "src/test/resources/leafreflinker/intrafile/leafrefintypedefwithsamereferpath";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+        YangNode selfNode = null;
+
+        // Create YANG node set
+        yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+
+        // Add references to import list.
+        yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
+
+        YangLinkerUtils.updateFilePriority(utilManager.getYangNodeSet());
+
+        // Carry out inter-file linking.
+        yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
+
+        Iterator<YangNode> yangNodeIterator = utilManager.getYangNodeSet().iterator();
+
+        YangNode rootNode = yangNodeIterator.next();
+
+        if (rootNode.getName().equals("typedef")) {
+            selfNode = rootNode;
+        }
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((selfNode instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(selfNode.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) selfNode;
+        assertThat(yangNode.getName(), is("typedef"));
+
+        ListIterator<YangLeaf> leafIterator;
+        YangLeaf leafInfo;
+
+        YangContainer yangContainer = (YangContainer) yangNode.getChild().getNextSibling();
+
+        leafIterator = yangContainer.getListOfLeaf().listIterator();
+        leafInfo = leafIterator.next();
+
+        // Check whether the information in the leaf is correct.
+        assertThat(leafInfo.getName(), is("reference"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("leafref"));
+        assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.LEAFREF));
+        YangLeafRef leafref = (YangLeafRef) (leafInfo.getDataType().getDataTypeExtendedInfo());
+
+        // Check whether leafref type got resolved.
+        assertThat(leafref.getResolvableStatus(),
+                   is(ResolvableStatus.RESOLVED));
+
+        // Check the effective type for the leaf.
+        assertThat(leafref.getEffectiveDataType().getDataType(),
+                   is(YangDataTypes.UINT8));
+    }
+}
diff --git a/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/IntraFileTypeLinkingTest.java b/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/IntraFileTypeLinkingTest.java
new file mode 100644
index 0000000..85129fa
--- /dev/null
+++ b/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/IntraFileTypeLinkingTest.java
@@ -0,0 +1,565 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.plugin.maven;
+
+import org.hamcrest.core.Is;
+import org.junit.Test;
+import org.onosproject.yang.compiler.datamodel.YangContainer;
+import org.onosproject.yang.compiler.datamodel.YangDerivedInfo;
+import org.onosproject.yang.compiler.datamodel.YangLeaf;
+import org.onosproject.yang.compiler.datamodel.YangList;
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangNodeType;
+import org.onosproject.yang.compiler.datamodel.YangTypeDef;
+import org.onosproject.yang.compiler.datamodel.utils.ResolvableStatus;
+import org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes;
+import org.onosproject.yang.compiler.linker.exceptions.LinkerException;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.YangUtilsParserManager;
+
+import java.io.IOException;
+import java.util.ListIterator;
+
+import static org.hamcrest.CoreMatchers.nullValue;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.Is.is;
+
+/**
+ * Test cases for testing "type" intra file linking.
+ */
+public class IntraFileTypeLinkingTest {
+
+    private final YangUtilsParserManager manager = new YangUtilsParserManager();
+
+    /**
+     * Checks self resolution when typedef and leaf using type are siblings.
+     */
+    @Test
+    public void processSelfResolutionWhenTypeAndTypedefAtRootLevel()
+            throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/SelfResolutionWhenTypeAndTypedefAtRootLevel.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat(node instanceof YangModule, is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), Is.is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("invalid-interval"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("hello"));
+        assertThat(leafInfo.getDataType().getDataType(), Is.is(YangDataTypes.DERIVED));
+
+        assertThat(((YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo()).getReferredTypeDef(),
+                   Is.is((YangTypeDef) node.getChild()));
+
+        assertThat(leafInfo.getDataType().getResolvableStatus(), Is.is(ResolvableStatus.RESOLVED));
+
+        YangDerivedInfo<?> derivedInfo = (YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo();
+
+        // Check for the effective built-in type.
+        assertThat(derivedInfo.getEffectiveBuiltInType(), Is.is(YangDataTypes.STRING));
+
+        // Check for the restriction.
+        assertThat(derivedInfo.getLengthRestrictionString(), is(nullValue()));
+        assertThat(derivedInfo.getRangeRestrictionString(), is(nullValue()));
+        assertThat(derivedInfo.getPatternRestriction(), is(nullValue()));
+        assertThat(derivedInfo.getResolvedExtendedInfo(), is(nullValue()));
+    }
+
+    /**
+     * Checks self resolution when typedef and leaf using type are at different
+     * level where typedef is at the root.
+     */
+    @Test
+    public void processSelfFileLinkingTypedefAtRootTypeTwoLevelInHierarchy()
+            throws IOException, ParserException {
+
+        YangNode node =
+                manager.getDataModel("src/test/resources/SelfFileLinkingTypedefAtRootTypeTwoLevelInHierarchy.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), Is.is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        YangContainer yangContainer = (YangContainer) node.getChild().getNextSibling();
+
+        YangList yangList = (YangList) yangContainer.getChild();
+
+        ListIterator<YangLeaf> leafIterator = yangList.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("invalid-interval"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("hello"));
+        assertThat(leafInfo.getDataType().getDataType(), Is.is(YangDataTypes.DERIVED));
+
+        assertThat(((YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo()).getReferredTypeDef(),
+                is((YangTypeDef) node.getChild()));
+
+        assertThat(leafInfo.getDataType().getResolvableStatus(), Is.is(ResolvableStatus.RESOLVED));
+
+        YangDerivedInfo<?> derivedInfo = (YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo();
+
+        // Check for the effective built-in type.
+        assertThat(derivedInfo.getEffectiveBuiltInType(), Is.is(YangDataTypes.STRING));
+
+        // Check for the restriction.
+        assertThat(derivedInfo.getLengthRestrictionString(), is(nullValue()));
+        assertThat(derivedInfo.getRangeRestrictionString(), is(nullValue()));
+        assertThat(derivedInfo.getPatternRestriction(), is(nullValue()));
+        assertThat(derivedInfo.getResolvedExtendedInfo(), is(nullValue()));
+    }
+
+    /**
+     * Checks self resolution when typedef and leaf using type are at different
+     * level where typedef is at the root and defined after parent holder
+     * of type.
+     */
+    @Test
+    public void processSelfFileLinkingTypedefAtRootIsAfterContainerHavingType()
+            throws IOException, ParserException {
+
+        YangNode node =
+                manager.getDataModel("src/test/resources/SelfFileLinkingTypedefAtRootIsAfterContainerHavingType.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), Is.is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        YangContainer yangContainer = (YangContainer) node.getChild();
+
+        YangList yangList = (YangList) yangContainer.getChild();
+
+        ListIterator<YangLeaf> leafIterator = yangList.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("invalid-interval"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("hello"));
+        assertThat(leafInfo.getDataType().getDataType(), Is.is(YangDataTypes.DERIVED));
+
+        assertThat(((YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo()).getReferredTypeDef(),
+                is((YangTypeDef) node.getChild().getNextSibling()));
+
+        assertThat(leafInfo.getDataType().getResolvableStatus(), Is.is(ResolvableStatus.RESOLVED));
+
+        YangDerivedInfo<?> derivedInfo = (YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo();
+
+        // Check for the effective built-in type.
+        assertThat(derivedInfo.getEffectiveBuiltInType(), Is.is(YangDataTypes.STRING));
+
+        // Check for the restriction.
+        assertThat(derivedInfo.getLengthRestrictionString(), is(nullValue()));
+        assertThat(derivedInfo.getRangeRestrictionString(), is(nullValue()));
+        assertThat(derivedInfo.getPatternRestriction(), is(nullValue()));
+        assertThat(derivedInfo.getResolvedExtendedInfo(), is(nullValue()));
+    }
+
+    /**
+     * Checks self resolution when typedef and leaf using type are at different
+     * level where typedef is at the level of root+1 and defined after parent
+     * holder of type.
+     */
+    @Test
+    public void processSelfFileLinkingTypedefAtMiddleLevelAfterParentHolder()
+            throws IOException, ParserException {
+
+        YangNode node =
+                manager.getDataModel("src/test/resources/SelfFileLinkingTypedefAtMiddleLevelAfterParentHolder.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), Is.is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        YangContainer yangContainer = (YangContainer) node.getChild();
+
+        YangList yangList = (YangList) yangContainer.getChild();
+
+        ListIterator<YangLeaf> leafIterator = yangList.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("invalid-interval"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("hello"));
+        assertThat(leafInfo.getDataType().getDataType(), Is.is(YangDataTypes.DERIVED));
+
+        assertThat(((YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo()).getReferredTypeDef(),
+                is((YangTypeDef) yangContainer.getChild().getNextSibling()));
+
+        assertThat(leafInfo.getDataType().getResolvableStatus(), Is.is(ResolvableStatus.RESOLVED));
+
+        YangDerivedInfo<?> derivedInfo = (YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo();
+
+        // Check for the effective built-in type.
+        assertThat(derivedInfo.getEffectiveBuiltInType(), Is.is(YangDataTypes.STRING));
+
+        // Check for the restriction.
+        assertThat(derivedInfo.getLengthRestrictionString(), is(nullValue()));
+        assertThat(derivedInfo.getRangeRestrictionString(), is(nullValue()));
+        assertThat(derivedInfo.getPatternRestriction(), is(nullValue()));
+        assertThat(derivedInfo.getResolvedExtendedInfo(), is(nullValue()));
+    }
+
+    /**
+     * Checks self resolution when typedef hierarchical references are present.
+     */
+    @Test
+    public void processSelfFileLinkingWithTypdefHierarchicalReference()
+            throws IOException, ParserException {
+
+        YangNode node =
+                manager.getDataModel("src/test/resources/SelfFileLinkingWithTypdefHierarchicalReference.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), Is.is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        YangContainer yangContainer = (YangContainer) node.getChild().getNextSibling();
+
+        YangList yangList = (YangList) yangContainer.getChild();
+
+        ListIterator<YangLeaf> leafIterator = yangList.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("invalid-interval"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("FirstClass"));
+        assertThat(leafInfo.getDataType().getDataType(), Is.is(YangDataTypes.DERIVED));
+
+        assertThat(((YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo()).getReferredTypeDef(),
+                is((YangTypeDef) yangList.getChild()));
+        assertThat(leafInfo.getDataType().getResolvableStatus(),
+                   Is.is(ResolvableStatus.RESOLVED));
+
+        YangTypeDef typeDef1 = (YangTypeDef) yangList.getChild();
+
+        assertThat(((YangDerivedInfo<?>) typeDef1.getTypeDefBaseType().getDataTypeExtendedInfo()).getReferredTypeDef(),
+                is((YangTypeDef) yangContainer.getChild().getNextSibling()));
+        assertThat(typeDef1.getTypeDefBaseType().getResolvableStatus(),
+                   Is.is(ResolvableStatus.RESOLVED));
+
+        YangTypeDef typeDef2 = (YangTypeDef) yangContainer.getChild().getNextSibling();
+
+        assertThat(((YangDerivedInfo<?>) typeDef2.getTypeDefBaseType().getDataTypeExtendedInfo()).getReferredTypeDef(),
+                is((YangTypeDef) node.getChild()));
+        assertThat(typeDef2.getTypeDefBaseType().getResolvableStatus(),
+                   Is.is(ResolvableStatus.RESOLVED));
+
+        YangDerivedInfo<?> derivedInfo = (YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo();
+
+        // Check for the effective built-in type.
+        assertThat(derivedInfo.getEffectiveBuiltInType(), Is.is(YangDataTypes.INT32));
+
+        // Check for the restriction.
+        assertThat(derivedInfo.getLengthRestrictionString(), is(nullValue()));
+        assertThat(derivedInfo.getRangeRestrictionString(), is(nullValue()));
+        assertThat(derivedInfo.getPatternRestriction(), is(nullValue()));
+        assertThat(derivedInfo.getResolvedExtendedInfo(), is(nullValue()));
+    }
+
+    /**
+     * Checks self resolution when typedef hierarchical references are present
+     * with last type is unresolved.
+     */
+    @Test
+    public void processSelfFileLinkingWithTypdefHierarchicalRefUnresolved()
+            throws IOException, ParserException {
+
+        YangNode node =
+                manager.getDataModel("src/test/resources/SelfFileLinkingWithTypdefHierarchicalRefUnresolved.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), Is.is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        YangContainer yangContainer = (YangContainer) node.getChild().getNextSibling();
+
+        YangList yangList = (YangList) yangContainer.getChild();
+
+        ListIterator<YangLeaf> leafIterator = yangList.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("invalid-interval"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("FirstClass"));
+        assertThat(leafInfo.getDataType().getDataType(), Is.is(YangDataTypes.DERIVED));
+
+        assertThat(((YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo()).getReferredTypeDef(),
+                is((YangTypeDef) yangList.getChild()));
+        assertThat(leafInfo.getDataType().getResolvableStatus(),
+                   Is.is(ResolvableStatus.INTRA_FILE_RESOLVED));
+
+        YangTypeDef typeDef1 = (YangTypeDef) yangList.getChild();
+
+        assertThat(((YangDerivedInfo<?>) typeDef1.getTypeDefBaseType().getDataTypeExtendedInfo()).getReferredTypeDef(),
+                is((YangTypeDef) yangContainer.getChild().getNextSibling()));
+        assertThat(typeDef1.getTypeDefBaseType().getResolvableStatus(),
+                   Is.is(ResolvableStatus.INTRA_FILE_RESOLVED));
+
+        YangTypeDef typeDef2 = (YangTypeDef) yangContainer.getChild().getNextSibling();
+
+        assertThat(((YangDerivedInfo<?>) typeDef2.getTypeDefBaseType().getDataTypeExtendedInfo()).getReferredTypeDef(),
+                is((YangTypeDef) node.getChild()));
+        assertThat(typeDef2.getTypeDefBaseType().getResolvableStatus(),
+                   Is.is(ResolvableStatus.INTRA_FILE_RESOLVED));
+
+        YangDerivedInfo<?> derivedInfo = (YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo();
+
+        // Check for the effective built-in type.
+        assertThat(derivedInfo.getEffectiveBuiltInType(), is(nullValue()));
+
+        // Check for the restriction.
+        assertThat(derivedInfo.getLengthRestrictionString(), is(nullValue()));
+        assertThat(derivedInfo.getRangeRestrictionString(), is(nullValue()));
+        assertThat(derivedInfo.getPatternRestriction(), is(nullValue()));
+        assertThat(derivedInfo.getResolvedExtendedInfo(), is(nullValue()));
+    }
+
+    /**
+     * Checks self resolution when type uses prefix of self module.
+     */
+    @Test
+    public void processSelfFileLinkingWithTypeWithSelfModulePrefix()
+            throws IOException, ParserException {
+
+        YangNode node =
+                manager.getDataModel("src/test/resources/SelfFileLinkingWithTypeWithSelfModulePrefix.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), Is.is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        YangContainer yangContainer = (YangContainer) node.getChild().getNextSibling();
+
+        YangList yangList = (YangList) yangContainer.getChild();
+
+        ListIterator<YangLeaf> leafIterator = yangList.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("invalid-interval"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("FirstClass"));
+        assertThat(leafInfo.getDataType().getDataType(), Is.is(YangDataTypes.DERIVED));
+
+        assertThat(((YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo()).getReferredTypeDef(),
+                is((YangTypeDef) yangList.getChild()));
+        assertThat(leafInfo.getDataType().getResolvableStatus(),
+                   Is.is(ResolvableStatus.RESOLVED));
+
+        YangTypeDef typeDef1 = (YangTypeDef) yangList.getChild();
+
+        assertThat(((YangDerivedInfo<?>) typeDef1.getTypeDefBaseType().getDataTypeExtendedInfo()).getReferredTypeDef(),
+                is((YangTypeDef) yangContainer.getChild().getNextSibling()));
+        assertThat(typeDef1.getTypeDefBaseType().getResolvableStatus(),
+                   Is.is(ResolvableStatus.RESOLVED));
+
+        YangTypeDef typeDef2 = (YangTypeDef) yangContainer.getChild().getNextSibling();
+
+        assertThat(((YangDerivedInfo<?>) typeDef2.getTypeDefBaseType().getDataTypeExtendedInfo()).getReferredTypeDef(),
+                is((YangTypeDef) node.getChild()));
+        assertThat(typeDef2.getTypeDefBaseType().getResolvableStatus(),
+                   Is.is(ResolvableStatus.RESOLVED));
+
+        YangDerivedInfo<?> derivedInfo = (YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo();
+
+        // Check for the effective built-in type.
+        assertThat(derivedInfo.getEffectiveBuiltInType(), Is.is(YangDataTypes.INT32));
+
+        // Check for the restriction.
+        assertThat(derivedInfo.getLengthRestrictionString(), is(nullValue()));
+        assertThat(derivedInfo.getRangeRestrictionString(), is(nullValue()));
+        assertThat(derivedInfo.getPatternRestriction(), is(nullValue()));
+        assertThat(derivedInfo.getResolvedExtendedInfo(), is(nullValue()));
+    }
+
+    /**
+     * Checks self resolution when some type uses prefix of self module
+     * some uses external prefix.
+     */
+    @Test
+    public void processSelfFileLinkingWithTypeWithSelfAndExternalPrefixMix()
+            throws IOException, ParserException {
+
+        YangNode node =
+                manager.getDataModel("src/test/resources/SelfFileLinkingWithTypeWithSelfAndExternalPrefixMix.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), Is.is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        YangContainer yangContainer = (YangContainer) node.getChild().getNextSibling();
+
+        YangList yangList = (YangList) yangContainer.getChild();
+
+        ListIterator<YangLeaf> leafIterator = yangList.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("invalid-interval"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("FirstClass"));
+        assertThat(leafInfo.getDataType().getDataType(), Is.is(YangDataTypes.DERIVED));
+
+        assertThat(((YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo()).getReferredTypeDef(),
+                is((YangTypeDef) yangList.getChild()));
+        assertThat(leafInfo.getDataType().getResolvableStatus(),
+                   Is.is(ResolvableStatus.INTRA_FILE_RESOLVED));
+
+        YangTypeDef typeDef1 = (YangTypeDef) yangList.getChild();
+
+        YangTypeDef typeDef2 = (YangTypeDef) yangContainer.getChild().getNextSibling();
+
+        assertThat(((YangDerivedInfo<?>) typeDef2.getTypeDefBaseType().getDataTypeExtendedInfo()).getReferredTypeDef(),
+                is((YangTypeDef) node.getChild()));
+        assertThat(typeDef2.getTypeDefBaseType().getResolvableStatus(),
+                   Is.is(ResolvableStatus.RESOLVED));
+
+        YangDerivedInfo<?> derivedInfo = (YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo();
+
+        // Check for the effective built-in type.
+        assertThat(derivedInfo.getEffectiveBuiltInType(), is(nullValue()));
+
+        // Check for the restriction.
+        assertThat(derivedInfo.getLengthRestrictionString(), is(nullValue()));
+        assertThat(derivedInfo.getRangeRestrictionString(), is(nullValue()));
+        assertThat(derivedInfo.getPatternRestriction(), is(nullValue()));
+        assertThat(derivedInfo.getResolvedExtendedInfo(), is(nullValue()));
+    }
+
+    /**
+     * Check self resolution when type referred typedef is not available in
+     * file, it should not result in exception.
+     */
+    @Test
+    public void processSelfResolutionWhenTypeReferredTypedefNotDefined()
+            throws IOException, LinkerException {
+
+        YangNode node =
+                manager.getDataModel("src/test/resources/SelfResolutionWhenTypeReferredTypedefNotDefined.yang");
+    }
+
+    /**
+     * Checks self resolution when typedef and leaf using type are at different
+     * level where typedef is is not an ancestor of type, it should not result
+     * in exception.
+     */
+    @Test
+    public void processSelfFileLinkingTypedefNotFound()
+            throws IOException, LinkerException {
+
+        YangNode node = manager.getDataModel("src/test/resources/SelfFileLinkingTypedefNotFound.yang");
+    }
+
+    /**
+     * Checks hierarchical self resolution with self resolution failure scenario.
+     * It should not result in exception.
+     */
+    @Test
+    public void processSelfFileLinkingWithHierarchicalTypeFailureScenario()
+            throws IOException, LinkerException {
+
+        YangNode node =
+                manager.getDataModel("src/test/resources/SelfFileLinkingWithHierarchicalTypeFailureScenario.yang");
+    }
+
+    /**
+     * Checks self resolution when typedef and leaf using type are siblings for binary type.
+     */
+    @Test
+    public void processSelfResolutionWhenTypeAndTypedefAtRootLevelForBinary()
+            throws IOException, ParserException {
+
+        YangNode node
+                = manager.getDataModel("src/test/resources/SelfResolutionWhenTypeAndTypedefAtRootLevelForBinary.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat(node instanceof YangModule, is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), Is.is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("ospf"));
+
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("typedef14"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("type14"));
+        assertThat(leafInfo.getDataType().getDataType(), Is.is(YangDataTypes.DERIVED));
+
+        assertThat(((YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo()).getReferredTypeDef(),
+                is((YangTypeDef) node.getChild()));
+
+        assertThat(leafInfo.getDataType().getResolvableStatus(), Is.is(ResolvableStatus.RESOLVED));
+
+        YangDerivedInfo<?> derivedInfo = (YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo();
+
+        // Check for the effective built-in type.
+        assertThat(derivedInfo.getEffectiveBuiltInType(), Is.is(YangDataTypes.BINARY));
+
+        // Check for the restriction.
+        assertThat(derivedInfo.getLengthRestrictionString(), is(nullValue()));
+        assertThat(derivedInfo.getRangeRestrictionString(), is(nullValue()));
+        assertThat(derivedInfo.getPatternRestriction(), is(nullValue()));
+        assertThat(derivedInfo.getResolvedExtendedInfo(), is(nullValue()));
+    }
+}
diff --git a/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/IntraFileUsesLinkingTest.java b/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/IntraFileUsesLinkingTest.java
new file mode 100644
index 0000000..f5dee73
--- /dev/null
+++ b/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/IntraFileUsesLinkingTest.java
@@ -0,0 +1,653 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.plugin.maven;
+
+import org.hamcrest.core.Is;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.onosproject.yang.compiler.datamodel.YangContainer;
+import org.onosproject.yang.compiler.datamodel.YangGrouping;
+import org.onosproject.yang.compiler.datamodel.YangInput;
+import org.onosproject.yang.compiler.datamodel.YangLeaf;
+import org.onosproject.yang.compiler.datamodel.YangList;
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangNodeType;
+import org.onosproject.yang.compiler.datamodel.YangTypeDef;
+import org.onosproject.yang.compiler.datamodel.YangUses;
+import org.onosproject.yang.compiler.datamodel.utils.ResolvableStatus;
+import org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes;
+import org.onosproject.yang.compiler.linker.exceptions.LinkerException;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.YangUtilsParserManager;
+
+import java.io.IOException;
+import java.util.ListIterator;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.Is.is;
+
+/**
+ * Test cases for testing uses intra file linking.
+ */
+public class IntraFileUsesLinkingTest {
+
+    @Rule
+    public ExpectedException thrown = ExpectedException.none();
+
+    private final YangUtilsParserManager manager = new YangUtilsParserManager();
+
+    /**
+     * Checks self resolution when grouping and uses are siblings.
+     * Grouping followed by uses.
+     */
+    @Test
+    public void processSelfResolutionWhenUsesAndGroupingAtRootLevel()
+            throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/SelfResolutionWhenUsesAndGroupingAtRootLevel.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        // Check whether the information in the leaf is correct under module.
+        assertThat(leafInfo.getName(), is("hello"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("string"));
+        assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.STRING));
+
+        // Check whether grouping is the sibling of module's child.
+        assertThat((yangNode.getChild().getNextSibling() instanceof YangGrouping), is(true));
+
+        YangGrouping grouping = (YangGrouping) yangNode.getChild().getNextSibling();
+        leafIterator = grouping.getListOfLeaf().listIterator();
+        leafInfo = leafIterator.next();
+
+        // Check whether the information in the leaf is correct under grouping.
+        assertThat(leafInfo.getName(), is("hello"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("string"));
+        assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.STRING));
+
+        // Check whether uses is module's child.
+        assertThat((yangNode.getChild() instanceof YangUses), is(true));
+        YangUses uses = (YangUses) yangNode.getChild();
+
+        // Check whether uses get resolved
+        assertThat(uses.getResolvableStatus(),
+                   Is.is(ResolvableStatus.RESOLVED));
+    }
+
+    /**
+     * Checks self resolution when grouping and uses are siblings.
+     * Grouping has a child node.
+     */
+    @Test
+    public void processSelfResolutionWhenUsesAndGroupingAtRootLevelGroupingWithChild()
+            throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel(
+                "src/test/resources/SelfResolutionWhenUsesAndGroupingAtRootLevelGroupingWithChild.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeaf> leafIterator;
+        YangLeaf leafInfo;
+
+        ListIterator<YangLeaf> leafIterator1 = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo1 = leafIterator1.next();
+
+        // Check whether the information in the leaf is correct under module.
+        assertThat(leafInfo1.getName(), is("treat"));
+        assertThat(leafInfo1.getDataType().getDataTypeName(), is("string"));
+        assertThat(leafInfo1.getDataType().getDataType(), is(YangDataTypes.STRING));
+
+        YangContainer container = (YangContainer) yangNode.getChild().getNextSibling().getNextSibling();
+
+        // Check whether the container name is set correctly which is under module.
+        assertThat(container.getName(), is("test"));
+
+        leafIterator = container.getListOfLeaf().listIterator();
+        leafInfo = leafIterator.next();
+
+        // Check whether the information in the leaf is correct under container which is under module.
+        assertThat(leafInfo.getName(), is("leaf2"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("string"));
+        assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.STRING));
+
+        // Check whether grouping is the sibling of module's child.
+        assertThat((yangNode.getChild().getNextSibling() instanceof YangGrouping), is(true));
+
+        YangGrouping grouping = (YangGrouping) yangNode.getChild().getNextSibling();
+        leafIterator = grouping.getListOfLeaf().listIterator();
+        leafInfo = leafIterator.next();
+
+        // Check whether the information in the leaf is correct under grouping.
+        assertThat(leafInfo.getName(), is("treat"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("string"));
+        assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.STRING));
+
+        // Check whether container is the child of grouping.
+        assertThat((grouping.getChild() instanceof YangContainer), is(true));
+        container = (YangContainer) grouping.getChild();
+
+        // Check whether the container name is set correctly which is under grouping.
+        assertThat(container.getName(), is("test"));
+
+        leafIterator = container.getListOfLeaf().listIterator();
+        leafInfo = leafIterator.next();
+
+        // Check whether the information in the leaf is correct under container which is under grouping.
+        assertThat(leafInfo.getName(), is("leaf2"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("string"));
+        assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.STRING));
+
+        // Check whether uses is module's child.
+        assertThat((yangNode.getChild() instanceof YangUses), is(true));
+        YangUses uses = (YangUses) yangNode.getChild();
+
+        // Check whether uses get resolved.
+        assertThat(uses.getResolvableStatus(),
+                   is(ResolvableStatus.RESOLVED));
+
+    }
+
+    /**
+     * Checks self resolution when grouping in rpc and uses in output of the same rpc.
+     * Uses is followed by grouping.
+     */
+    @Test
+    public void processSelfResolutionGroupingInRpcAndUsesInOutput()
+            throws IOException, ParserException {
+
+        YangNode node = manager
+                .getDataModel("src/test/resources/SelfResolutionGroupingInRpcAndUsesInOutput.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("rock"));
+
+        ListIterator<YangLeaf> leafIterator;
+        YangLeaf leafInfo;
+
+        // Check whether grouping is the child of rpc.
+        assertThat((yangNode.getChild().getChild() instanceof YangGrouping), is(true));
+        YangGrouping grouping = (YangGrouping) yangNode.getChild().getChild();
+
+        // Check whether the grouping name is set correctly.
+        assertThat(grouping.getName(), is("hello"));
+
+        // Check whether list is the child of grouping.
+        assertThat((grouping.getChild() instanceof YangList), is(true));
+        YangList yangListNode = (YangList) grouping.getChild();
+
+        // Check whether the list name is set correctly.
+        assertThat(yangListNode.getName(), is("valid"));
+
+        leafIterator = yangListNode.getListOfLeaf().listIterator();
+        leafInfo = leafIterator.next();
+
+        // Check whether the information in the leaf is correct under list which is under grouping.
+        assertThat(leafInfo.getName(), is("invalid-interval"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("uint16"));
+        assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.UINT16));
+        assertThat(leafInfo.getUnits(), is("\"seconds\""));
+        assertThat(leafInfo.getReference(), is("\"RFC 6020\""));
+
+        // Check whether uses is input's child.
+        assertThat((yangNode.getChild().getChild().getNextSibling().getChild() instanceof YangUses), is(true));
+        YangUses uses = (YangUses) yangNode.getChild().getChild().getNextSibling().getChild();
+
+        // Check whether uses get resolved.
+        assertThat(uses.getResolvableStatus(), is(ResolvableStatus.RESOLVED));
+
+        YangInput inputNode = ((YangInput) yangNode.getChild().getChild().getNextSibling());
+        assertThat((inputNode.getChild() instanceof YangUses), is(true));
+
+        YangList yangList = ((YangList) inputNode.getChild().getNextSibling());
+        assertThat(yangList.getName(), is("valid"));
+
+        leafIterator = yangList.getListOfLeaf().listIterator();
+        leafInfo = leafIterator.next();
+
+        // Check whether the information in the leaf is correct under list which is deep copied.
+        assertThat(leafInfo.getName(), is("invalid-interval"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("uint16"));
+        assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.UINT16));
+        assertThat(leafInfo.getUnits(), is("\"seconds\""));
+        assertThat(leafInfo.getReference(), is("\"RFC 6020\""));
+    }
+
+    /**
+     * Checks the failure scenario when uses is referring to its own grouping directly.
+     */
+    @Test
+    public void processSelfResolutionGroupingReferencingItselfFailureScenerio()
+            throws IOException {
+
+        thrown.expect(LinkerException.class);
+        thrown.expectMessage(
+                "YANG file error: Duplicate input identifier detected, same as leaf \"zip-code in 7 at 13 in " +
+                        "src/test/resources/SelfResolutionGroupingReferencingItselfFailureScenerio.yang\"");
+        YangNode node = manager
+                .getDataModel("src/test/resources/SelfResolutionGroupingReferencingItselfFailureScenerio.yang");
+
+    }
+
+    /**
+     * Checks the when multiple uses are present and are referred to the grouping at different levels.
+     */
+    @Test
+    public void processSelfResolutionGroupingWithMultipleUses()
+            throws IOException, ParserException {
+
+        YangNode node = manager
+                .getDataModel("src/test/resources/SelfResolutionGroupingWithMultipleUses.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeaf> leafIterator;
+        YangLeaf leafInfo;
+
+        // Check whether grouping is the child of container.
+        assertThat((yangNode.getChild().getChild() instanceof YangGrouping), is(true));
+        YangGrouping grouping = (YangGrouping) yangNode.getChild().getChild();
+
+        // Check whether the grouping name is set correctly.
+        assertThat(grouping.getName(), is("endpoint"));
+
+        // Check whether uses is endpoint-grouping's child.
+        assertThat((grouping.getChild() instanceof YangUses), is(true));
+        YangUses firstUses = (YangUses) grouping.getChild();
+
+        // Check whether uses get resolved.
+        assertThat(firstUses.getResolvableStatus(), is(ResolvableStatus.RESOLVED));
+
+        // Validate first uses child is cloned properly
+        assertThat((firstUses.getNextSibling().getNextSibling()
+                .getNextSibling().getNextSibling() instanceof YangList), is(true));
+        YangList firstUsesChild = ((YangList) firstUses.getNextSibling().getNextSibling().getNextSibling()
+                .getNextSibling());
+        assertThat(firstUsesChild.getName(), is("valid"));
+
+        leafIterator = firstUsesChild.getListOfLeaf().listIterator();
+        leafInfo = leafIterator.next();
+
+        // Check whether the information in the leaf is correct under list which has been deep copied from grouping.
+        assertThat(leafInfo.getName(), is("invalid-interval"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("uint16"));
+        assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.UINT16));
+        assertThat(leafInfo.getUnits(), is("\"seconds\""));
+        assertThat(leafInfo.getReference(), is("\"RFC 6020\""));
+
+        //validate uses second
+        assertThat((firstUses.getNextSibling() instanceof YangContainer), is(true));
+        YangContainer container = (YangContainer) firstUses.getNextSibling();
+        assertThat(container.getName(), is("design"));
+
+        assertThat((container.getChild() instanceof YangUses), is(true));
+        assertThat((container.getListOfLeaf().iterator().next().getName()), is("ink"));
+
+        //validate uses third
+        assertThat((container.getChild().getNextSibling() instanceof YangContainer), is(true));
+        YangContainer container2 = ((YangContainer) container.getChild().getNextSibling());
+        assertThat(container2.getName(), is("correct"));
+        assertThat((container2.getChild() instanceof YangUses), is(true));
+        assertThat((container2.getChild().getNextSibling() instanceof YangContainer), is(true));
+        YangContainer thirdUsesChild = ((YangContainer) container2.getChild().getNextSibling());
+        assertThat(thirdUsesChild.getListOfLeaf().iterator().next().getName(), is("zip-code"));
+
+        //validate fourth uses
+        assertThat((firstUses.getNextSibling().getNextSibling() instanceof YangUses), is(true));
+        YangUses fourthUses = ((YangUses) firstUses.getNextSibling().getNextSibling());
+        assertThat((fourthUses.getNextSibling().getNextSibling().getNextSibling() instanceof YangTypeDef),
+                   is(true));
+        assertThat(fourthUses.getNextSibling().getNextSibling().getNextSibling().getName(), is("my-type"));
+
+        //validate fifth uses
+        assertThat((firstUses.getNextSibling().getNextSibling().getNextSibling() instanceof YangUses),
+                   is(true));
+
+        //validate end point uses
+        assertThat(grouping.getNextSibling() instanceof YangUses, is(true));
+        assertThat(grouping.getNextSibling().getNextSibling().getNextSibling().getNextSibling()
+                           .getNextSibling().getNextSibling().getNextSibling().getNextSibling() instanceof YangContainer,
+                   is(true));
+        container = (YangContainer) grouping.getNextSibling().getNextSibling().getNextSibling().getNextSibling()
+                .getNextSibling().getNextSibling().getNextSibling().getNextSibling();
+        assertThat(container.getName(), is("design"));
+        container2 = (YangContainer) container.getChild().getNextSibling();
+        assertThat(container2.getName(), is("correct"));
+        assertThat(container2.getChild().getNextSibling().getName(), is("value"));
+    }
+
+    /**
+     * Checks the failure scenario when uses is present under the same node many times.
+     */
+    @Test
+    public void processSelfResolutionGroupingHavingSameUsesManyTimes()
+            throws IOException, ParserException {
+
+        thrown.expect(ParserException.class);
+        thrown.expectMessage(
+                "YANG File Error: Identifier collision detected in uses as " +
+                        "\"failure in 10 at 13 in src/test/resources/SelfResolutionGroupingHavingSameUsesManyTimes.yang");
+        YangNode node = manager
+                .getDataModel("src/test/resources/SelfResolutionGroupingHavingSameUsesManyTimes.yang");
+    }
+
+    /**
+     * Checks the rpc having both typedef and grouping.
+     * It also checks that the grouping under different nodes will not give any problem in resolving uses.
+     */
+    @Test
+    public void processSelfResolutionRpcWithOneTypedefAndTwoGroupingUnderDifferentNode()
+            throws IOException, ParserException {
+
+        YangNode node = manager
+                .getDataModel(
+                        "src/test/resources/SelfResolutionRpcWithOneTypedefAndTwoGroupingUnderDifferentNode.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("rock"));
+
+        ListIterator<YangLeaf> leafIterator;
+        YangLeaf leafInfo;
+
+        // Check whether grouping is the child of input.
+        assertThat((yangNode.getChild().getChild().getChild() instanceof YangGrouping), is(true));
+        YangGrouping groupingUnderInput = (YangGrouping) yangNode.getChild().getChild().getChild();
+
+        // Check whether the grouping name is set correctly.
+        assertThat(groupingUnderInput.getName(), is("creative"));
+
+        leafIterator = groupingUnderInput.getListOfLeaf().listIterator();
+        leafInfo = leafIterator.next();
+
+        // Check whether the information in the leaf is correct under grouping.
+        assertThat(leafInfo.getName(), is("carry"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("string"));
+        assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.STRING));
+
+        // Check whether grouping is the child of output.
+        assertThat((yangNode.getChild().getChild().getNextSibling().getChild() instanceof YangGrouping), is(true));
+        YangGrouping grouping = (YangGrouping) yangNode.getChild().getChild().getNextSibling().getChild();
+        assertThat(grouping.getName(), is("creative"));
+
+        // Check whether typedef is the sibling of grouping.
+        assertThat((grouping.getNextSibling() instanceof YangTypeDef), is(true));
+
+        YangTypeDef typedef = (YangTypeDef) grouping.getNextSibling();
+        assertThat(typedef.getName(), is("my-type"));
+
+        // Check whether uses is the sibling of typedef.
+        assertThat((typedef.getNextSibling() instanceof YangUses), is(true));
+
+        // Check whether uses get resolved.
+        YangUses uses = (YangUses) typedef.getNextSibling();
+        assertThat(uses.getName(), is("creative"));
+        assertThat(uses.getResolvableStatus(),
+                   is(ResolvableStatus.RESOLVED));
+    }
+
+    /**
+     * Checks the failure scenario when uses is cannot resolve its grouping.
+     * It shouldnt result in exception
+     */
+    @Test
+    public void processSelfResolutionNestedGroupingWithUnresolvedUses()
+            throws IOException, LinkerException {
+
+        YangNode node = manager
+                .getDataModel("src/test/resources/SelfResolutionNestedGroupingWithUnresolvedUses.yang");
+    }
+
+    /**
+     * Checks self resolution when typedef hierarchical references are present
+     * with last type is unresolved.
+     */
+    @Test
+    public void processSelfFileLinkingWithGroupingHierarchicalRefUnresolved()
+            throws IOException, ParserException {
+
+        YangNode node = manager
+                .getDataModel("src/test/resources/SelfFileLinkingWithGroupingHierarchicalRefUnresolved.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        // Check whether container is the sibling of grouping.
+        assertThat((yangNode.getChild().getNextSibling() instanceof YangContainer), is(true));
+        YangContainer containerWithUses = (YangContainer) yangNode.getChild().getNextSibling();
+        assertThat(containerWithUses.getName(), is("test"));
+
+        // Check whether uses is the child of container.
+        assertThat((containerWithUses.getChild() instanceof YangUses), is(true));
+        YangUses uses = (YangUses) containerWithUses.getChild();
+        assertThat(uses.getName(), is("create"));
+
+        // Check whether uses is getting resolved.
+        assertThat(uses.getResolvableStatus(),
+                   is(ResolvableStatus.INTRA_FILE_RESOLVED));
+
+        // Check whether grouping is the child of module.
+        assertThat((yangNode.getChild() instanceof YangGrouping), is(true));
+        YangGrouping groupingWithUses = (YangGrouping) yangNode.getChild();
+        assertThat(groupingWithUses.getName(), is("create"));
+
+        // Check whether uses with prefix from from other file, is the child of grouping.
+        assertThat((groupingWithUses.getChild() instanceof YangUses), is(true));
+        YangUses uses1 = (YangUses) groupingWithUses.getChild();
+        assertThat(uses1.getName(), is("valid"));
+
+        // Check whether this uses is getting intra-file-resolved.
+        assertThat(uses1.getResolvableStatus(),
+                   is(ResolvableStatus.INTRA_FILE_RESOLVED));
+    }
+
+    /**
+     * Checks self resolution when uses has prefix of self module.
+     */
+    @Test
+    public void processSelfFileLinkingWithGroupingWithSelfModulePrefix()
+            throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/SelfFileLinkingWithGroupingWithSelfModulePrefix.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        // Check whether container is the sibling of grouping.
+        YangContainer yangContainer = (YangContainer) node.getChild().getNextSibling();
+
+        // Check whether list is the child of container.
+        YangList yangList = (YangList) yangContainer.getChild();
+
+        // Check whether uses is the child of list.
+        assertThat((yangList.getChild() instanceof YangUses), is(true));
+        YangUses yangUses1 = (YangUses) yangList.getChild();
+        assertThat(yangUses1.getName(), is("FirstClass"));
+
+        // Check whether uses is getting resolved.
+        assertThat(yangUses1.getResolvableStatus(),
+                   is(ResolvableStatus.RESOLVED));
+
+        // Check whether grouping is the sibling of uses.
+        YangGrouping yangGrouping1 = (YangGrouping) yangUses1.getNextSibling();
+        assertThat(yangGrouping1.getName(), is("FirstClass"));
+
+        // Check whether uses is the child of grouping.
+        YangUses yangUses2 = (YangUses) yangGrouping1.getChild();
+        assertThat(yangUses2.getName(), is("PassingClass"));
+
+        // Check the uses gets resolved.
+        assertThat(yangUses2.getResolvableStatus(),
+                   is(ResolvableStatus.RESOLVED));
+
+        // Check whether grouping is the sibling of list.
+        YangGrouping yangGrouping2 = (YangGrouping) yangList.getNextSibling();
+        assertThat(yangGrouping2.getName(), is("PassingClass"));
+
+        // Check uses is the child of that grouping which has prefix of the same module.
+        YangUses yangUses3 = (YangUses) yangGrouping2.getChild();
+        assertThat(yangUses3.getName(), is("Percentage"));
+
+        // Check uses is getting resolved.
+        assertThat(yangUses3.getResolvableStatus(),
+                   is(ResolvableStatus.RESOLVED));
+
+        // Check grouping is the child of module.
+        YangGrouping yangGrouping3 = (YangGrouping) node.getChild();
+
+        ListIterator<YangLeaf> leafIterator;
+        YangLeaf leafInfo;
+        leafIterator = yangGrouping3.getListOfLeaf().listIterator();
+        leafInfo = leafIterator.next();
+
+        // Check whether the information in the leaf is correct under grouping.
+        assertThat(leafInfo.getName(), is("hello"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("string"));
+        assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.STRING));
+
+    }
+
+    /**
+     * Checks self resolution when some type uses prefix of self module
+     * some uses external prefix.
+     */
+    @Test
+    public void processSelfFileLinkingWithGroupingWithSelfAndExternalPrefixMix()
+            throws IOException, ParserException {
+
+        YangNode node = manager
+                .getDataModel("src/test/resources/SelfFileLinkingWithGroupingWithSelfAndExternalPrefixMix.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        // Check whether container is the sibling of grouping.
+        YangContainer yangContainer = (YangContainer) node.getChild().getNextSibling();
+
+        // Check whether list is the child of container.
+        YangList yangList = (YangList) yangContainer.getChild();
+
+        // Check whether uses is the child of list.
+        assertThat((yangList.getChild() instanceof YangUses), is(true));
+        YangUses yangUses1 = (YangUses) yangList.getChild();
+        assertThat(yangUses1.getName(), is("FirstClass"));
+
+        // Check whether uses is getting resolved.
+        assertThat(yangUses1.getResolvableStatus(),
+                   is(ResolvableStatus.INTRA_FILE_RESOLVED));
+
+        // Check whether grouping is the sibling of uses.
+        YangGrouping yangGrouping1 = (YangGrouping) yangUses1.getNextSibling();
+        assertThat(yangGrouping1.getName(), is("FirstClass"));
+
+        // Check whether uses is the child of grouping which has prefix from other module.
+        YangUses yangUses2 = (YangUses) yangGrouping1.getChild();
+        assertThat(yangUses2.getName(), is("PassingClass"));
+
+        // Check whether uses gets intra-file-resolved.
+        assertThat(yangUses2.getResolvableStatus(),
+                   is(ResolvableStatus.INTRA_FILE_RESOLVED));
+
+        // Check whether grouping is the sibling of list.
+        YangGrouping yangGrouping2 = (YangGrouping) yangList.getNextSibling();
+        assertThat(yangGrouping2.getName(), is("PassingClass"));
+
+        // Check uses is the child of that grouping which has prefix of the same module.
+        YangUses yangUses3 = (YangUses) yangGrouping2.getChild();
+        assertThat(yangUses3.getName(), is("Percentage"));
+
+        // Check uses is getting resolved.
+        assertThat(yangUses3.getResolvableStatus(),
+                   is(ResolvableStatus.RESOLVED));
+
+        // Check grouping is the child of module.
+        YangGrouping yangGrouping3 = (YangGrouping) node.getChild();
+        ListIterator<YangLeaf> leafIterator;
+        YangLeaf leafInfo;
+        leafIterator = yangGrouping3.getListOfLeaf().listIterator();
+        leafInfo = leafIterator.next();
+
+        // Check whether the information in the leaf is correct under grouping.
+        assertThat(leafInfo.getName(), is("hello"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("string"));
+        assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.STRING));
+    }
+
+}
diff --git a/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/NotificationTranslatorTest.java b/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/NotificationTranslatorTest.java
new file mode 100644
index 0000000..6043bee
--- /dev/null
+++ b/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/NotificationTranslatorTest.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.plugin.maven;
+
+import org.junit.Test;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.translator.tojava.JavaCodeGeneratorUtil;
+import org.onosproject.yang.compiler.utils.io.YangPluginConfig;
+import org.onosproject.yang.compiler.utils.io.impl.YangIoUtils;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.YangUtilsParserManager;
+
+import java.io.IOException;
+
+/**
+ * Unit tests for union translator.
+ */
+public final class NotificationTranslatorTest {
+
+    private final YangUtilsParserManager manager = new YangUtilsParserManager();
+    private final static String YANG = "src/test/resources/NotificationTest" +
+            ".yang";
+    private final static String DIR = "target/notificationTranslator/";
+
+    /**
+     * Checks union translation should not result in any exception.
+     */
+    @Test
+    public void processNotificationTranslator()
+            throws IOException, ParserException {
+        YangIoUtils.deleteDirectory(DIR);
+        YangNode node = manager.getDataModel(YANG);
+
+        YangPluginConfig yangPluginConfig = new YangPluginConfig();
+        yangPluginConfig.setCodeGenDir(DIR);
+
+        JavaCodeGeneratorUtil.generateJavaCode(node, yangPluginConfig);
+        YangIoUtils.deleteDirectory(DIR);
+    }
+
+    // TODO enhance the test cases, after having a framework of translator test.
+}
diff --git a/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/PathPredicateLinkingTest.java b/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/PathPredicateLinkingTest.java
new file mode 100644
index 0000000..5f6f15b
--- /dev/null
+++ b/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/PathPredicateLinkingTest.java
@@ -0,0 +1,360 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.plugin.maven;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.onosproject.yang.compiler.datamodel.YangAtomicPath;
+import org.onosproject.yang.compiler.datamodel.YangAugment;
+import org.onosproject.yang.compiler.datamodel.YangContainer;
+import org.onosproject.yang.compiler.datamodel.YangLeaf;
+import org.onosproject.yang.compiler.datamodel.YangLeafRef;
+import org.onosproject.yang.compiler.datamodel.YangList;
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangPathPredicate;
+import org.onosproject.yang.compiler.linker.exceptions.LinkerException;
+import org.onosproject.yang.compiler.linker.impl.YangLinkerManager;
+import org.onosproject.yang.compiler.linker.impl.YangLinkerUtils;
+import org.onosproject.yang.compiler.utils.io.impl.YangFileScanner;
+
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.ListIterator;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.Is.is;
+
+/**
+ * Test cases for path predicate linking in leaf-ref.
+ */
+public class PathPredicateLinkingTest {
+
+    private final YangUtilManager utilMgr = new YangUtilManager();
+    private final YangLinkerManager linkerMgr = new YangLinkerManager();
+
+    @Rule
+    public ExpectedException thrown = ExpectedException.none();
+
+    private ListIterator<YangLeaf> leafItr;
+    private YangLeaf ifName;
+    private YangLeaf address;
+    private YangLeaf name;
+    private Iterator<YangAtomicPath> pathItr;
+    private YangAtomicPath atomicPath;
+    private Iterator<YangPathPredicate> predicateItr;
+    private YangPathPredicate predicate;
+
+    /**
+     * Processes simple path predicate which gets linked within the same file
+     * using relative path.
+     *
+     * @throws IOException IO file error
+     */
+    @Test
+    public void processSimplePathPredicate() throws IOException {
+
+        String searchDir = "src/test/resources/pathpredicate/simple";
+        utilMgr.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilMgr.parseYangFileInfoSet();
+        utilMgr.createYangNodeSet();
+        YangNode selfNode;
+
+        linkerMgr.createYangNodeSet(utilMgr.getYangNodeSet());
+        linkerMgr.addRefToYangFilesImportList(utilMgr.getYangNodeSet());
+
+        YangLinkerUtils.updateFilePriority(utilMgr.getYangNodeSet());
+
+        linkerMgr.processInterFileLinking(utilMgr.getYangNodeSet());
+        Iterator<YangNode> nodeItr = utilMgr.getYangNodeSet().iterator();
+        selfNode = nodeItr.next();
+
+        // Gets the list node.
+        YangList yangList = (YangList) selfNode.getChild();
+        // Gets the container node.
+        YangContainer container = (YangContainer) yangList.getNextSibling();
+
+        ListIterator<YangLeaf> leafIterator;
+        YangLeaf ifName;
+        YangLeaf address;
+        YangLeaf name;
+        Iterator<YangAtomicPath> pathItr;
+        YangAtomicPath atomicPath;
+        Iterator<YangPathPredicate> predicateItr;
+        YangPathPredicate predicate;
+
+        leafIterator = container.getListOfLeaf().listIterator();
+        ifName = leafIterator.next();
+        address = leafIterator.next();
+
+        // Gets the address leaf's leaf-ref type.
+        YangLeafRef<?> leafRef2 = (YangLeafRef) address.getDataType()
+                .getDataTypeExtendedInfo();
+        pathItr = leafRef2.getAtomicPath().listIterator();
+        atomicPath = pathItr.next();
+
+        // Gets the path-predicate.
+        predicateItr = atomicPath.getPathPredicatesList().listIterator();
+        predicate = predicateItr.next();
+
+        // Gets the left and right axis node in path-predicate.
+        YangLeaf yangLeftLeaf = (YangLeaf) predicate.getLeftAxisNode();
+        YangLeaf yangRightLeaf = (YangLeaf) predicate.getRightAxisNode();
+
+        leafIterator = yangList.getListOfLeaf().listIterator();
+        name = leafIterator.next();
+
+        // Checks that right and left path-predicates are correct.
+        assertThat(yangLeftLeaf, is(name));
+        assertThat(yangRightLeaf, is(ifName));
+    }
+
+    /**
+     * Processes simple inter file path predicate which gets linked to another
+     * file using absolute path.
+     *
+     * @throws IOException IO file error
+     */
+    @Test
+    public void processSimpleInterFilePathPredicate() throws IOException {
+
+        String searchDir = "src/test/resources/pathpredicate/simpleinterfile";
+        utilMgr.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilMgr.parseYangFileInfoSet();
+        utilMgr.createYangNodeSet();
+        YangModule selfNode;
+
+        linkerMgr.createYangNodeSet(utilMgr.getYangNodeSet());
+        linkerMgr.addRefToYangFilesImportList(utilMgr.getYangNodeSet());
+
+        YangLinkerUtils.updateFilePriority(utilMgr.getYangNodeSet());
+
+        linkerMgr.processInterFileLinking(utilMgr.getYangNodeSet());
+        Iterator<YangNode> nodeItr = utilMgr.getYangNodeSet().iterator();
+
+        YangNode rootNode = nodeItr.next();
+        YangModule refNode;
+        if (rootNode.getName().equals("ietf-network")) {
+            selfNode = (YangModule) rootNode;
+            refNode = (YangModule) nodeItr.next();
+        } else {
+            refNode = (YangModule) rootNode;
+            selfNode = (YangModule) nodeItr.next();
+        }
+
+        // Gets the container node.
+        YangContainer container = (YangContainer) selfNode.getChild();
+        // Gets the list node.
+        YangList yangList = (YangList) refNode.getChild();
+
+        ListIterator<YangLeaf> leafItr;
+        YangLeaf ifName;
+        YangLeaf address;
+        YangLeaf name;
+        Iterator<YangAtomicPath> pathItr;
+        YangAtomicPath atomicPath;
+        Iterator<YangPathPredicate> predicateItr;
+        YangPathPredicate predicate;
+
+        leafItr = container.getListOfLeaf().listIterator();
+        ifName = leafItr.next();
+        address = leafItr.next();
+
+        // Gets the address leaf's leaf-ref type.
+        YangLeafRef<?> leafRef2 = (YangLeafRef) address.getDataType()
+                .getDataTypeExtendedInfo();
+        pathItr = leafRef2.getAtomicPath().listIterator();
+        atomicPath = pathItr.next();
+
+        // Gets the path-predicate.
+        predicateItr = atomicPath.getPathPredicatesList().listIterator();
+        predicate = predicateItr.next();
+
+        // Gets the left and right axis node in path-predicate.
+        YangLeaf yangLeftLeaf = (YangLeaf) predicate.getLeftAxisNode();
+        YangLeaf yangRightLeaf = (YangLeaf) predicate.getRightAxisNode();
+
+        leafItr = yangList.getListOfLeaf().listIterator();
+        name = leafItr.next();
+
+        // Checks that right and left path-predicates are correct.
+        assertThat(yangLeftLeaf, is(name));
+        assertThat(yangRightLeaf, is(ifName));
+    }
+
+    /**
+     * Processes inter file path predicate, where leaf-ref is present under
+     * YANG augment.
+     *
+     * @throws IOException IO file error
+     */
+    @Test
+    public void processInterFilePathPredicateFromAugment() throws IOException {
+
+        String searchDir = "src/test/resources/pathpredicate/interfileaugment";
+        utilMgr.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilMgr.parseYangFileInfoSet();
+        utilMgr.createYangNodeSet();
+        YangModule selfNode;
+
+        linkerMgr.createYangNodeSet(utilMgr.getYangNodeSet());
+        linkerMgr.addRefToYangFilesImportList(utilMgr.getYangNodeSet());
+
+        YangLinkerUtils.updateFilePriority(utilMgr.getYangNodeSet());
+
+        linkerMgr.processInterFileLinking(utilMgr.getYangNodeSet());
+        Iterator<YangNode> nodeItr = utilMgr.getYangNodeSet().iterator();
+
+        YangNode rootNode = nodeItr.next();
+        YangModule refNode;
+        if (rootNode.getName().equals("ietf-network")) {
+            selfNode = (YangModule) rootNode;
+            refNode = (YangModule) nodeItr.next();
+        } else {
+            refNode = (YangModule) rootNode;
+            selfNode = (YangModule) nodeItr.next();
+        }
+
+        // Gets the augment node.
+        YangList list = (YangList) selfNode.getChild().getChild();
+
+        // Gets the augment node.
+        YangAugment augment = (YangAugment) refNode.getChild();
+
+        ListIterator<YangLeaf> leafItr;
+        YangLeaf test;
+        YangLeaf networkId;
+        YangLeaf networkRef;
+        Iterator<YangAtomicPath> pathItr;
+        YangAtomicPath atomicPath;
+        Iterator<YangPathPredicate> predicateItr;
+        YangPathPredicate predicate;
+
+        leafItr = augment.getListOfLeaf().listIterator();
+        test = leafItr.next();
+
+        YangLeafRef<?> leafRef =
+                (YangLeafRef) test.getDataType().getDataTypeExtendedInfo();
+        pathItr = leafRef.getAtomicPath().listIterator();
+        pathItr.next();
+        atomicPath = pathItr.next();
+
+        // Gets the path-predicate.
+        predicateItr = atomicPath.getPathPredicatesList().listIterator();
+        predicate = predicateItr.next();
+
+        // Gets the left and right axis node in path-predicate.
+        YangLeaf yangLeftLeaf = (YangLeaf) predicate.getLeftAxisNode();
+        YangLeaf yangRightLeaf = (YangLeaf) predicate.getRightAxisNode();
+
+        leafItr = list.getListOfLeaf().listIterator();
+        networkId = leafItr.next();
+        YangContainer reference = (YangContainer) list.getChild();
+        leafItr = reference.getListOfLeaf().listIterator();
+        networkRef = leafItr.next();
+
+        // Checks that right and left path-predicates are correct.
+        assertThat(yangLeftLeaf, is(networkId));
+        assertThat(yangRightLeaf, is(networkRef));
+    }
+
+    /**
+     * Processes an invalid scenario where the target leaf/leaf-list in
+     * path-predicate is not found.
+     *
+     * @throws IOException IO file error
+     */
+    @Test
+    public void processInvalidPathLink() throws IOException {
+        thrown.expect(LinkerException.class);
+        thrown.expectMessage(
+                "YANG file error: There is no leaf/leaf-list in YANG node as " +
+                        "mentioned in the path predicate of the leafref path " +
+                        "../../interface[ifname = current()/../../ifname]" +
+                        "/address/ip");
+
+        String searchDir = "src/test/resources/pathpredicate/invalidlinking";
+        utilMgr.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilMgr.parseYangFileInfoSet();
+        utilMgr.createYangNodeSet();
+
+        linkerMgr.createYangNodeSet(utilMgr.getYangNodeSet());
+        linkerMgr.addRefToYangFilesImportList(utilMgr.getYangNodeSet());
+
+        YangLinkerUtils.updateFilePriority(utilMgr.getYangNodeSet());
+
+        linkerMgr.processInterFileLinking(utilMgr.getYangNodeSet());
+    }
+
+    /**
+     * Processes an invalid scenario where the right axis node doesn't come
+     * under YANG list node.
+     *
+     * @throws IOException IO file error
+     */
+    @Test
+    public void processInvalidPathLinkForList() throws IOException {
+        thrown.expect(LinkerException.class);
+        thrown.expectMessage(
+                "YANG file error: Path predicates are only applicable for " +
+                        "YANG list. The leafref path has path predicate for" +
+                        " non-list node in the path ../../default-address" +
+                        "[ifname = current()/../ifname]/ifname");
+
+        String searchDir = "src/test/resources/pathpredicate/invalidlinking2";
+        utilMgr.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilMgr.parseYangFileInfoSet();
+        utilMgr.createYangNodeSet();
+        YangNode selfNode;
+
+        linkerMgr.createYangNodeSet(utilMgr.getYangNodeSet());
+        linkerMgr.addRefToYangFilesImportList(utilMgr.getYangNodeSet());
+
+        YangLinkerUtils.updateFilePriority(utilMgr.getYangNodeSet());
+
+        linkerMgr.processInterFileLinking(utilMgr.getYangNodeSet());
+    }
+
+    /**
+     * Processes an invalid scenario where the node in path predicate is not
+     * present in the traversal.
+     *
+     * @throws IOException IO file error
+     */
+    @Test
+    public void processInvalidPathLinkForInvalidNode()
+            throws IOException {
+        thrown.expect(LinkerException.class);
+        thrown.expectMessage(
+                "YANG file error: The path predicate of the leafref has an " +
+                        "invalid path in ../../interface[name = current()/" +
+                        "../../address/ifname]/address/ip");
+
+        String searchDir = "src/test/resources/pathpredicate/invalidlinking3";
+        utilMgr.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilMgr.parseYangFileInfoSet();
+        utilMgr.createYangNodeSet();
+
+        linkerMgr.createYangNodeSet(utilMgr.getYangNodeSet());
+        linkerMgr.addRefToYangFilesImportList(utilMgr.getYangNodeSet());
+
+        YangLinkerUtils.updateFilePriority(utilMgr.getYangNodeSet());
+
+        linkerMgr.processInterFileLinking(utilMgr.getYangNodeSet());
+    }
+}
diff --git a/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/ProcessSubTreeCodeGenTest.java b/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/ProcessSubTreeCodeGenTest.java
new file mode 100644
index 0000000..fcc5545
--- /dev/null
+++ b/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/ProcessSubTreeCodeGenTest.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.plugin.maven;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.junit.Test;
+import org.onosproject.yang.compiler.utils.io.YangPluginConfig;
+import org.onosproject.yang.compiler.utils.io.impl.YangFileScanner;
+import org.onosproject.yang.compiler.utils.io.impl.YangIoUtils;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+
+import java.io.File;
+import java.io.IOException;
+
+/**
+ * Unit test case for process sub tree code generation test.
+ */
+public class ProcessSubTreeCodeGenTest {
+
+    private final YangUtilManager utilManager = new YangUtilManager();
+    private static final String DIR = "target/pstf/";
+    private static final String COMP = System.getProperty("user.dir") + File
+            .separator + DIR;
+
+    /**
+     * Checks pst translation should not result in any exception.
+     *
+     * @throws MojoExecutionException
+     */
+    @Test
+    public void processTranslator() throws IOException, ParserException, MojoExecutionException {
+
+        YangIoUtils.deleteDirectory(DIR);
+        String searchDir = "src/test/resources/pstcodegen";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+        utilManager.resolveDependenciesUsingLinker();
+
+        YangPluginConfig yangPluginConfig = new YangPluginConfig();
+        yangPluginConfig.setCodeGenDir(DIR);
+        utilManager.translateToJava(yangPluginConfig);
+        YangPluginConfig.compileCode(COMP);
+        YangIoUtils.deleteDirectory(DIR);
+    }
+
+}
diff --git a/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/RestrictionResolutionTest.java b/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/RestrictionResolutionTest.java
new file mode 100644
index 0000000..9908367
--- /dev/null
+++ b/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/RestrictionResolutionTest.java
@@ -0,0 +1,913 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.plugin.maven;
+
+import org.hamcrest.core.Is;
+import org.junit.Test;
+import org.onosproject.yang.compiler.datamodel.YangDerivedInfo;
+import org.onosproject.yang.compiler.datamodel.YangLeaf;
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangPatternRestriction;
+import org.onosproject.yang.compiler.datamodel.YangRangeInterval;
+import org.onosproject.yang.compiler.datamodel.YangRangeRestriction;
+import org.onosproject.yang.compiler.datamodel.YangStringRestriction;
+import org.onosproject.yang.compiler.datamodel.YangType;
+import org.onosproject.yang.compiler.datamodel.YangTypeDef;
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.datamodel.utils.ResolvableStatus;
+import org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes;
+import org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangInt16;
+import org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangInt32;
+import org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangUint64;
+import org.onosproject.yang.compiler.linker.exceptions.LinkerException;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.YangUtilsParserManager;
+
+import java.io.IOException;
+import java.math.BigInteger;
+import java.util.ListIterator;
+
+import static org.hamcrest.CoreMatchers.nullValue;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.Is.is;
+import static org.hamcrest.core.IsNull.notNullValue;
+import static org.onosproject.yang.compiler.datamodel.YangNodeType.MODULE_NODE;
+import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes.DERIVED;
+import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes.INT32;
+import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes.STRING;
+
+/**
+ * Test cases for testing restriction resolution.
+ */
+public final class RestrictionResolutionTest {
+
+    private final YangUtilsParserManager manager = new YangUtilsParserManager();
+
+    /**
+     * Checks length restriction in typedef.
+     */
+    @Test
+    public void processLengthRestrictionInTypedef()
+            throws IOException, ParserException, DataModelException {
+
+        YangNode node = manager.getDataModel("src/test/resources/LengthRestrictionInTypedef.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat(node instanceof YangModule, is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("invalid-interval"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("hello"));
+        assertThat(leafInfo.getDataType().getDataType(), is(DERIVED));
+
+        assertThat(((YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo()).getReferredTypeDef(),
+                   Is.is((YangTypeDef) node.getChild()));
+
+        assertThat(leafInfo.getDataType().getResolvableStatus(), Is.is(ResolvableStatus.RESOLVED));
+
+        YangDerivedInfo<?> derivedInfo = (YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo();
+
+        // Check for the effective built-in type.
+        assertThat(derivedInfo.getEffectiveBuiltInType(), is(STRING));
+
+        // Check for the restriction.
+        assertThat(derivedInfo.getLengthRestrictionString(), is(nullValue()));
+        assertThat(derivedInfo.getRangeRestrictionString(), is(nullValue()));
+        assertThat(derivedInfo.getPatternRestriction(), is(nullValue()));
+        assertThat(derivedInfo.getResolvedExtendedInfo(), is(notNullValue()));
+
+        // Check for the restriction value.
+        YangStringRestriction stringRestriction = (YangStringRestriction) derivedInfo.getResolvedExtendedInfo();
+        YangRangeRestriction lengthRestriction = stringRestriction.getLengthRestriction();
+
+        ListIterator<YangRangeInterval> lengthListIterator = lengthRestriction.getAscendingRangeIntervals()
+                .listIterator();
+
+        YangRangeInterval rangeInterval = lengthListIterator.next();
+
+        assertThat(((YangUint64) rangeInterval.getStartValue()).getValue(), is(BigInteger.valueOf(0)));
+        assertThat(((YangUint64) rangeInterval.getEndValue()).getValue(), is(BigInteger.valueOf(100)));
+    }
+
+    /**
+     * Checks length restriction in referred type.
+     */
+    @Test
+    public void processLengthRestrictionInRefType()
+            throws IOException, ParserException, DataModelException {
+
+        YangNode node = manager.getDataModel("src/test/resources/LengthRestrictionInRefType.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat(node instanceof YangModule, is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("invalid-interval"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("hello"));
+        assertThat(leafInfo.getDataType().getDataType(), is(DERIVED));
+
+        assertThat(((YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo()).getReferredTypeDef(),
+                is((YangTypeDef) node.getChild()));
+
+        assertThat(leafInfo.getDataType().getResolvableStatus(), Is.is(ResolvableStatus.RESOLVED));
+
+        YangDerivedInfo<?> derivedInfo = (YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo();
+
+        // Check for the effective built-in type.
+        assertThat(derivedInfo.getEffectiveBuiltInType(), is(STRING));
+
+        // Check for the restriction.
+        assertThat(derivedInfo.getLengthRestrictionString(), is(notNullValue()));
+        assertThat(derivedInfo.getRangeRestrictionString(), is(nullValue()));
+        assertThat(derivedInfo.getPatternRestriction(), is(nullValue()));
+        assertThat(derivedInfo.getResolvedExtendedInfo(), is(notNullValue()));
+
+        // Check for the restriction value.
+        YangStringRestriction stringRestriction = (YangStringRestriction) derivedInfo.getResolvedExtendedInfo();
+        YangRangeRestriction lengthRestriction = stringRestriction.getLengthRestriction();
+
+        ListIterator<YangRangeInterval> lengthListIterator = lengthRestriction.getAscendingRangeIntervals()
+                .listIterator();
+
+        YangRangeInterval rangeInterval = lengthListIterator.next();
+
+        assertThat(((YangUint64) rangeInterval.getStartValue()).getValue(), is(BigInteger.valueOf(0)));
+        assertThat(((YangUint64) rangeInterval.getEndValue()).getValue(), is(BigInteger.valueOf(100)));
+    }
+
+    /**
+     * Checks length restriction in typedef and in type with stricter value.
+     */
+    @Test
+    public void processLengthRestrictionInTypedefAndTypeValid()
+            throws IOException, ParserException, DataModelException {
+
+        YangNode node = manager.getDataModel("src/test/resources/LengthRestrictionInTypedefAndTypeValid.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat(node instanceof YangModule, is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("invalid-interval"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("hello"));
+        assertThat(leafInfo.getDataType().getDataType(), is(DERIVED));
+
+        assertThat(((YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo()).getReferredTypeDef(),
+                is((YangTypeDef) node.getChild()));
+
+        assertThat(leafInfo.getDataType().getResolvableStatus(), Is.is(ResolvableStatus.RESOLVED));
+
+        YangDerivedInfo<?> derivedInfo = (YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo();
+
+        // Check for the effective built-in type.
+        assertThat(derivedInfo.getEffectiveBuiltInType(), is(STRING));
+
+        // Check for the restriction.
+        assertThat(derivedInfo.getLengthRestrictionString(), is(notNullValue()));
+        assertThat(derivedInfo.getRangeRestrictionString(), is(nullValue()));
+        assertThat(derivedInfo.getPatternRestriction(), is(nullValue()));
+        assertThat(derivedInfo.getResolvedExtendedInfo(), is(notNullValue()));
+
+        // Check for the restriction value.
+        YangStringRestriction stringRestriction = (YangStringRestriction) derivedInfo.getResolvedExtendedInfo();
+        YangRangeRestriction lengthRestriction = stringRestriction.getLengthRestriction();
+
+        ListIterator<YangRangeInterval> lengthListIterator = lengthRestriction.getAscendingRangeIntervals()
+                .listIterator();
+
+        YangRangeInterval rangeInterval1 = lengthListIterator.next();
+
+        assertThat(((YangUint64) rangeInterval1.getStartValue()).getValue(), is(BigInteger.valueOf(0)));
+        assertThat(((YangUint64) rangeInterval1.getEndValue()).getValue(), is(BigInteger.valueOf(20)));
+
+        YangRangeInterval rangeInterval2 = lengthListIterator.next();
+
+        assertThat(((YangUint64) rangeInterval2.getStartValue()).getValue(), is(BigInteger.valueOf(201)));
+        assertThat(((YangUint64) rangeInterval2.getEndValue()).getValue(), is(BigInteger.valueOf(300)));
+    }
+
+    /**
+     * Checks length restriction in typedef and in type with not stricter value.
+     */
+    @Test(expected = LinkerException.class)
+    public void processLengthRestrictionInTypedefAndTypeInValid()
+            throws IOException, DataModelException {
+        YangNode node = manager.getDataModel("src/test/resources/LengthRestrictionInTypedefAndTypeInValid.yang");
+    }
+
+    /**
+     * Checks range restriction in typedef.
+     */
+    @Test
+    public void processRangeRestrictionInTypedef()
+            throws IOException, ParserException, DataModelException {
+
+        YangNode node = manager.getDataModel("src/test/resources/RangeRestrictionInTypedef.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat(node instanceof YangModule, is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("invalid-interval"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("hello"));
+        assertThat(leafInfo.getDataType().getDataType(), is(DERIVED));
+
+        assertThat(((YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo()).getReferredTypeDef(),
+                is((YangTypeDef) node.getChild()));
+
+        assertThat(leafInfo.getDataType().getResolvableStatus(), Is.is(ResolvableStatus.RESOLVED));
+
+        YangDerivedInfo<?> derivedInfo = (YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo();
+
+        // Check for the effective built-in type.
+        assertThat(derivedInfo.getEffectiveBuiltInType(), is(INT32));
+
+        // Check for the restriction.
+        assertThat(derivedInfo.getLengthRestrictionString(), is(nullValue()));
+        assertThat(derivedInfo.getRangeRestrictionString(), is(nullValue()));
+        assertThat(derivedInfo.getPatternRestriction(), is(nullValue()));
+        assertThat(derivedInfo.getResolvedExtendedInfo(), is(notNullValue()));
+
+        // Check for the restriction value.
+        YangRangeRestriction rangeRestriction = (YangRangeRestriction) derivedInfo.getResolvedExtendedInfo();
+
+        ListIterator<YangRangeInterval> rangeListIterator = rangeRestriction.getAscendingRangeIntervals()
+                .listIterator();
+
+        YangRangeInterval rangeInterval1 = rangeListIterator.next();
+
+        assertThat(((YangInt32) rangeInterval1.getStartValue()).getValue(), is(1));
+        assertThat(((YangInt32) rangeInterval1.getEndValue()).getValue(), is(4));
+
+        YangRangeInterval rangeInterval2 = rangeListIterator.next();
+
+        assertThat(((YangInt32) rangeInterval2.getStartValue()).getValue(), is(10));
+        assertThat(((YangInt32) rangeInterval2.getEndValue()).getValue(), is(20));
+    }
+
+    /**
+     * Checks range restriction in referred typedef.
+     */
+    @Test
+    public void processRangeRestrictionInRefTypedef()
+            throws IOException, ParserException, DataModelException {
+
+        YangNode node = manager.getDataModel("src/test/resources/RangeRestrictionInRefTypedef.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat(node instanceof YangModule, is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        // check top typedef
+        YangTypeDef topTypedef = (YangTypeDef) yangNode.getChild();
+        assertThat(topTypedef.getName(), is("Num3"));
+        YangType type = topTypedef.getTypeList().iterator().next();
+        assertThat(type.getDataType(), is(YangDataTypes.INT16));
+        assertThat(type.getDataTypeName(), is("int16"));
+
+        // Check for the restriction value.
+        YangRangeRestriction rangeRestriction = (YangRangeRestriction) type.getDataTypeExtendedInfo();
+        ListIterator<YangRangeInterval> rangeListIterator = rangeRestriction.getAscendingRangeIntervals()
+                .listIterator();
+        YangRangeInterval rangeInterval1 = rangeListIterator.next();
+        assertThat((int) ((YangInt16) rangeInterval1.getStartValue()).getValue(), is(-32000));
+        assertThat((int) ((YangInt16) rangeInterval1.getEndValue()).getValue(), is(4));
+
+        YangRangeInterval rangeInterval2 = rangeListIterator.next();
+        assertThat((int) ((YangInt16) rangeInterval2.getStartValue()).getValue(), is(32767));
+        assertThat((int) ((YangInt16) rangeInterval2.getEndValue()).getValue(), is(32767));
+
+        // check referred typedef
+        YangTypeDef refTypedef = (YangTypeDef) topTypedef.getNextSibling();
+        assertThat(refTypedef.getName(), is("Num6"));
+        YangType refType = refTypedef.getTypeList().iterator().next();
+        assertThat(refType.getDataType(), is(YangDataTypes.DERIVED));
+        assertThat(refType.getDataTypeName(), is("Num3"));
+        YangDerivedInfo<YangRangeRestriction> derivedInfo =
+                (YangDerivedInfo<YangRangeRestriction>) refType.getDataTypeExtendedInfo();
+
+        // Check for the restriction value.
+        rangeRestriction = (YangRangeRestriction) derivedInfo.getResolvedExtendedInfo();
+        rangeListIterator = rangeRestriction.getAscendingRangeIntervals().listIterator();
+        rangeInterval1 = rangeListIterator.next();
+        assertThat((int) ((YangInt16) rangeInterval1.getStartValue()).getValue(), is(-3));
+        assertThat((int) ((YangInt16) rangeInterval1.getEndValue()).getValue(), is(-3));
+
+        rangeInterval2 = rangeListIterator.next();
+        assertThat((int) ((YangInt16) rangeInterval2.getStartValue()).getValue(), is(-2));
+        assertThat((int) ((YangInt16) rangeInterval2.getEndValue()).getValue(), is(2));
+
+        YangRangeInterval rangeInterval3 = rangeListIterator.next();
+        assertThat((int) ((YangInt16) rangeInterval3.getStartValue()).getValue(), is(3));
+        assertThat((int) ((YangInt16) rangeInterval3.getEndValue()).getValue(), is(3));
+    }
+
+    /**
+     * Checks invalid range restriction in referred typedef.
+     */
+    @Test(expected = LinkerException.class)
+    public void processInvalidRangeRestrictionInRefTypedef()
+            throws IOException, ParserException, DataModelException {
+
+        manager.getDataModel("src/test/resources/RangeRestrictionInvalidInRefTypedef.yang");
+    }
+
+    /**
+     * Checks range restriction in referred type.
+     */
+    @Test
+    public void processRangeRestrictionInRefType()
+            throws IOException, ParserException, DataModelException {
+
+        YangNode node = manager.getDataModel("src/test/resources/RangeRestrictionInRefType.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat(node instanceof YangModule, is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("invalid-interval"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("hello"));
+        assertThat(leafInfo.getDataType().getDataType(), is(DERIVED));
+
+        assertThat(((YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo()).getReferredTypeDef(),
+                is((YangTypeDef) node.getChild()));
+
+        assertThat(leafInfo.getDataType().getResolvableStatus(), Is.is(ResolvableStatus.RESOLVED));
+
+        YangDerivedInfo<?> derivedInfo = (YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo();
+
+        // Check for the effective built-in type.
+        assertThat(derivedInfo.getEffectiveBuiltInType(), is(INT32));
+
+        // Check for the restriction.
+        assertThat(derivedInfo.getLengthRestrictionString(), is(nullValue()));
+        assertThat(derivedInfo.getRangeRestrictionString(), is(notNullValue()));
+        assertThat(derivedInfo.getPatternRestriction(), is(nullValue()));
+        assertThat(derivedInfo.getResolvedExtendedInfo(), is(notNullValue()));
+
+        // Check for the restriction value.
+        YangRangeRestriction rangeRestriction = (YangRangeRestriction) derivedInfo.getResolvedExtendedInfo();
+
+        ListIterator<YangRangeInterval> rangeListIterator = rangeRestriction.getAscendingRangeIntervals()
+                .listIterator();
+
+        YangRangeInterval rangeInterval1 = rangeListIterator.next();
+
+        assertThat(((YangInt32) rangeInterval1.getStartValue()).getValue(), is(1));
+        assertThat(((YangInt32) rangeInterval1.getEndValue()).getValue(), is(4));
+
+        YangRangeInterval rangeInterval2 = rangeListIterator.next();
+
+        assertThat(((YangInt32) rangeInterval2.getStartValue()).getValue(), is(10));
+        assertThat(((YangInt32) rangeInterval2.getEndValue()).getValue(), is(20));
+    }
+
+    /**
+     * Checks range restriction in typedef and stricter in referred type.
+     */
+    @Test
+    public void processRangeRestrictionInRefTypeAndTypedefValid()
+            throws IOException, ParserException, DataModelException {
+
+        YangNode node = manager.getDataModel("src/test/resources/RangeRestrictionInRefTypeAndTypedefValid.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat(node instanceof YangModule, is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("invalid-interval"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("hello"));
+        assertThat(leafInfo.getDataType().getDataType(), is(DERIVED));
+
+        assertThat(((YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo()).getReferredTypeDef(),
+                is((YangTypeDef) node.getChild()));
+
+        assertThat(leafInfo.getDataType().getResolvableStatus(), Is.is(ResolvableStatus.RESOLVED));
+
+        YangDerivedInfo<?> derivedInfo = (YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo();
+
+        // Check for the effective built-in type.
+        assertThat(derivedInfo.getEffectiveBuiltInType(), is(INT32));
+
+        // Check for the restriction.
+        assertThat(derivedInfo.getLengthRestrictionString(), is(nullValue()));
+        assertThat(derivedInfo.getRangeRestrictionString(), is(notNullValue()));
+        assertThat(derivedInfo.getPatternRestriction(), is(nullValue()));
+        assertThat(derivedInfo.getResolvedExtendedInfo(), is(notNullValue()));
+
+        // Check for the restriction value.
+        YangRangeRestriction rangeRestriction = (YangRangeRestriction) derivedInfo.getResolvedExtendedInfo();
+
+        ListIterator<YangRangeInterval> rangeListIterator = rangeRestriction.getAscendingRangeIntervals()
+                .listIterator();
+
+        YangRangeInterval rangeInterval1 = rangeListIterator.next();
+
+        assertThat(((YangInt32) rangeInterval1.getStartValue()).getValue(), is(1));
+        assertThat(((YangInt32) rangeInterval1.getEndValue()).getValue(), is(4));
+
+        YangRangeInterval rangeInterval2 = rangeListIterator.next();
+
+        assertThat(((YangInt32) rangeInterval2.getStartValue()).getValue(), is(10));
+        assertThat(((YangInt32) rangeInterval2.getEndValue()).getValue(), is(20));
+    }
+
+    /**
+     * Checks range restriction in typedef and not stricter in referred type.
+     */
+    @Test(expected = LinkerException.class)
+    public void processRangeRestrictionInRefTypeAndTypedefInValid()
+            throws IOException, ParserException, DataModelException {
+        YangNode node = manager.getDataModel("src/test/resources/RangeRestrictionInRefTypeAndTypedefInValid.yang");
+    }
+
+    /**
+     * Checks range restriction for string.
+     */
+    @Test(expected = ParserException.class)
+    public void processRangeRestrictionInString()
+            throws IOException, ParserException, DataModelException {
+        YangNode node = manager.getDataModel("src/test/resources/RangeRestrictionInString.yang");
+    }
+
+    /**
+     * Checks range restriction for string in referred type.
+     */
+    @Test(expected = LinkerException.class)
+    public void processRangeRestrictionInStringInRefType()
+            throws IOException, DataModelException {
+        YangNode node = manager.getDataModel("src/test/resources/RangeRestrictionInStringInRefType.yang");
+    }
+
+    /**
+     * Checks pattern restriction in typedef.
+     */
+    @Test
+    public void processPatternRestrictionInTypedef()
+            throws IOException, ParserException, DataModelException {
+
+        YangNode node = manager.getDataModel("src/test/resources/PatternRestrictionInTypedef.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat(node instanceof YangModule, is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("invalid-interval"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("hello"));
+        assertThat(leafInfo.getDataType().getDataType(), is(DERIVED));
+
+        assertThat(((YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo()).getReferredTypeDef(),
+                is((YangTypeDef) node.getChild()));
+
+        assertThat(leafInfo.getDataType().getResolvableStatus(), Is.is(ResolvableStatus.RESOLVED));
+
+        YangDerivedInfo<?> derivedInfo = (YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo();
+
+        // Check for the effective built-in type.
+        assertThat(derivedInfo.getEffectiveBuiltInType(), is(STRING));
+
+        // Check for the restriction.
+        assertThat(derivedInfo.getLengthRestrictionString(), is(nullValue()));
+        assertThat(derivedInfo.getRangeRestrictionString(), is(nullValue()));
+        assertThat(derivedInfo.getPatternRestriction(), is(nullValue()));
+        assertThat(derivedInfo.getResolvedExtendedInfo(), is(notNullValue()));
+
+        // Check for the restriction value.
+        YangStringRestriction stringRestriction = (YangStringRestriction) derivedInfo.getResolvedExtendedInfo();
+        YangPatternRestriction patternRestriction = stringRestriction.getPatternRestriction();
+
+        ListIterator<String> patternListIterator = patternRestriction.getPatternList().listIterator();
+        String pattern1 = patternListIterator.next();
+
+        assertThat(pattern1, is("[a-zA-Z]"));
+    }
+
+    /**
+     * Checks pattern restriction in referred type.
+     */
+    @Test
+    public void processPatternRestrictionInRefType()
+            throws IOException, ParserException, DataModelException {
+
+        YangNode node = manager.getDataModel("src/test/resources/PatternRestrictionInRefType.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat(node instanceof YangModule, is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("invalid-interval"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("hello"));
+        assertThat(leafInfo.getDataType().getDataType(), is(DERIVED));
+
+        assertThat(((YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo()).getReferredTypeDef(),
+                is((YangTypeDef) node.getChild()));
+
+        assertThat(leafInfo.getDataType().getResolvableStatus(), Is.is(ResolvableStatus.RESOLVED));
+
+        YangDerivedInfo<?> derivedInfo = (YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo();
+
+        // Check for the effective built-in type.
+        assertThat(derivedInfo.getEffectiveBuiltInType(), is(STRING));
+
+        // Check for the restriction.
+        assertThat(derivedInfo.getLengthRestrictionString(), is(nullValue()));
+        assertThat(derivedInfo.getRangeRestrictionString(), is(nullValue()));
+        assertThat(derivedInfo.getPatternRestriction(), is(notNullValue()));
+        assertThat(derivedInfo.getResolvedExtendedInfo(), is(notNullValue()));
+
+        // Check for the restriction value.
+        YangStringRestriction stringRestriction = (YangStringRestriction) derivedInfo.getResolvedExtendedInfo();
+        YangPatternRestriction patternRestriction = stringRestriction.getPatternRestriction();
+
+        ListIterator<String> patternListIterator = patternRestriction.getPatternList().listIterator();
+        String pattern1 = patternListIterator.next();
+
+        assertThat(pattern1, is("[a-zA-Z]"));
+    }
+
+    /**
+     * Checks pattern restriction in referred type and typedef.
+     */
+    @Test
+    public void processPatternRestrictionInRefTypeAndTypedef()
+            throws IOException, ParserException, DataModelException {
+
+        YangNode node = manager.getDataModel("src/test/resources/PatternRestrictionInRefTypeAndTypedef.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat(node instanceof YangModule, is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("invalid-interval"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("hello"));
+        assertThat(leafInfo.getDataType().getDataType(), is(DERIVED));
+
+        assertThat(((YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo()).getReferredTypeDef(),
+                is((YangTypeDef) node.getChild()));
+
+        assertThat(leafInfo.getDataType().getResolvableStatus(), Is.is(ResolvableStatus.RESOLVED));
+
+        YangDerivedInfo<?> derivedInfo = (YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo();
+
+        // Check for the effective built-in type.
+        assertThat(derivedInfo.getEffectiveBuiltInType(), is(STRING));
+
+        // Check for the restriction.
+        assertThat(derivedInfo.getLengthRestrictionString(), is(nullValue()));
+        assertThat(derivedInfo.getRangeRestrictionString(), is(nullValue()));
+        assertThat(derivedInfo.getPatternRestriction(), is(notNullValue()));
+        assertThat(derivedInfo.getResolvedExtendedInfo(), is(notNullValue()));
+
+        // Check for the restriction value.
+        YangStringRestriction stringRestriction = (YangStringRestriction) derivedInfo.getResolvedExtendedInfo();
+        YangPatternRestriction patternRestriction = stringRestriction.getPatternRestriction();
+
+        ListIterator<String> patternListIterator = patternRestriction.getPatternList().listIterator();
+        String pattern1 = patternListIterator.next();
+
+        assertThat(pattern1, is("[a-zA-Z]"));
+
+        String pattern2 = patternListIterator.next();
+
+        assertThat(pattern2, is("[0-9]"));
+    }
+
+    /**
+     * Checks multiple pattern restriction in referred type and typedef.
+     */
+    @Test
+    public void processMultiplePatternRestriction()
+            throws IOException, ParserException, DataModelException {
+
+        YangNode node = manager.getDataModel("src/test/resources/MultiplePatternRestrictionInRefTypeAndTypedef.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat(node instanceof YangModule, is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("invalid-interval"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("hello"));
+        assertThat(leafInfo.getDataType().getDataType(), is(DERIVED));
+
+        assertThat(((YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo()).getReferredTypeDef(),
+                is((YangTypeDef) node.getChild()));
+
+        assertThat(leafInfo.getDataType().getResolvableStatus(), Is.is(ResolvableStatus.RESOLVED));
+
+        YangDerivedInfo<?> derivedInfo = (YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo();
+
+        // Check for the effective built-in type.
+        assertThat(derivedInfo.getEffectiveBuiltInType(), is(STRING));
+
+        // Check for the restriction.
+        assertThat(derivedInfo.getLengthRestrictionString(), is(nullValue()));
+        assertThat(derivedInfo.getRangeRestrictionString(), is(nullValue()));
+        assertThat(derivedInfo.getPatternRestriction(), is(notNullValue()));
+        assertThat(derivedInfo.getResolvedExtendedInfo(), is(notNullValue()));
+
+        // Check for the restriction value.
+        YangStringRestriction stringRestriction = (YangStringRestriction) derivedInfo.getResolvedExtendedInfo();
+        YangPatternRestriction patternRestriction = stringRestriction.getPatternRestriction();
+
+        ListIterator<String> patternListIterator = patternRestriction.getPatternList().listIterator();
+        String pattern1 = patternListIterator.next();
+
+        assertThat(pattern1, is("[a-z]"));
+
+        String pattern2 = patternListIterator.next();
+
+        assertThat(pattern2, is("[A-Z]"));
+
+        String pattern3 = patternListIterator.next();
+
+        assertThat(pattern3, is("[0-9]"));
+
+        String pattern4 = patternListIterator.next();
+
+        assertThat(pattern4, is("[\\n]"));
+    }
+
+    /**
+     * Checks multiple pattern and length restriction in referred type and
+     * typedef.
+     */
+    @Test
+    public void processMultiplePatternAndLengthRestriction()
+            throws IOException, ParserException, DataModelException {
+
+        YangNode node = manager.getDataModel("src/test/resources/MultiplePatternAndLengthRestriction.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat(node instanceof YangModule, is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("invalid-interval"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("hello"));
+        assertThat(leafInfo.getDataType().getDataType(), is(DERIVED));
+
+        assertThat(((YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo()).getReferredTypeDef(),
+                is((YangTypeDef) node.getChild()));
+
+        assertThat(leafInfo.getDataType().getResolvableStatus(), Is.is(ResolvableStatus.RESOLVED));
+
+        YangDerivedInfo<?> derivedInfo = (YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo();
+
+        // Check for the effective built-in type.
+        assertThat(derivedInfo.getEffectiveBuiltInType(), is(STRING));
+
+        // Check for the restriction.
+        assertThat(derivedInfo.getLengthRestrictionString(), is(notNullValue()));
+        assertThat(derivedInfo.getRangeRestrictionString(), is(nullValue()));
+        assertThat(derivedInfo.getPatternRestriction(), is(notNullValue()));
+        assertThat(derivedInfo.getResolvedExtendedInfo(), is(notNullValue()));
+
+        // Check for the restriction value.
+        YangStringRestriction stringRestriction = (YangStringRestriction) derivedInfo.getResolvedExtendedInfo();
+
+        // Check for pattern restriction.
+        YangPatternRestriction patternRestriction = stringRestriction.getPatternRestriction();
+        ListIterator<String> patternListIterator = patternRestriction.getPatternList().listIterator();
+        String pattern1 = patternListIterator.next();
+
+        assertThat(pattern1, is("[a-z]"));
+
+        String pattern2 = patternListIterator.next();
+
+        assertThat(pattern2, is("[A-Z]"));
+
+        String pattern3 = patternListIterator.next();
+
+        assertThat(pattern3, is("[0-9]"));
+
+        String pattern4 = patternListIterator.next();
+
+        assertThat(pattern4, is("[\\n]"));
+
+        // Check for length restriction.
+        YangRangeRestriction lengthRestriction = stringRestriction.getLengthRestriction();
+        ListIterator<YangRangeInterval> lengthListIterator = lengthRestriction.getAscendingRangeIntervals()
+                .listIterator();
+
+        YangRangeInterval rangeInterval1 = lengthListIterator.next();
+
+        assertThat(((YangUint64) rangeInterval1.getStartValue()).getValue(), is(BigInteger.valueOf(0)));
+        assertThat(((YangUint64) rangeInterval1.getEndValue()).getValue(), is(BigInteger.valueOf(20)));
+
+        YangRangeInterval rangeInterval2 = lengthListIterator.next();
+
+        assertThat(((YangUint64) rangeInterval2.getStartValue()).getValue(), is(BigInteger.valueOf(201)));
+        assertThat(((YangUint64) rangeInterval2.getEndValue()).getValue(), is(BigInteger.valueOf(300)));
+    }
+
+    /**
+     * Checks multiple pattern and length restriction in referred type and
+     * typedef.
+     */
+    @Test
+    public void processMultiplePatternAndLengthRestrictionValid()
+            throws IOException, ParserException, DataModelException {
+
+        YangNode node = manager.getDataModel("src/test/resources/MultiplePatternAndLengthRestrictionValid.yang");
+
+        // Check whether the data model tree returned is of type module.
+        assertThat(node instanceof YangModule, is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(MODULE_NODE));
+
+        // Check whether the module name is set correctly.
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("Test"));
+
+        ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafIterator.next();
+
+        assertThat(leafInfo.getName(), is("invalid-interval"));
+        assertThat(leafInfo.getDataType().getDataTypeName(), is("hello"));
+        assertThat(leafInfo.getDataType().getDataType(), is(DERIVED));
+
+        assertThat(((YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo()).getReferredTypeDef(),
+                is((YangTypeDef) node.getChild()));
+
+        assertThat(leafInfo.getDataType().getResolvableStatus(), Is.is(ResolvableStatus.RESOLVED));
+
+        YangDerivedInfo<?> derivedInfo = (YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo();
+
+        // Check for the effective built-in type.
+        assertThat(derivedInfo.getEffectiveBuiltInType(), is(STRING));
+
+        // Check for the restriction.
+        assertThat(derivedInfo.getLengthRestrictionString(), is(notNullValue()));
+        assertThat(derivedInfo.getRangeRestrictionString(), is(nullValue()));
+        assertThat(derivedInfo.getPatternRestriction(), is(notNullValue()));
+        assertThat(derivedInfo.getResolvedExtendedInfo(), is(notNullValue()));
+
+        // Check for the restriction value.
+        YangStringRestriction stringRestriction = (YangStringRestriction) derivedInfo.getResolvedExtendedInfo();
+
+        // Check for pattern restriction.
+        YangPatternRestriction patternRestriction = stringRestriction.getPatternRestriction();
+        ListIterator<String> patternListIterator = patternRestriction.getPatternList().listIterator();
+        String pattern1 = patternListIterator.next();
+
+        assertThat(pattern1, is("[a-z]"));
+
+        String pattern2 = patternListIterator.next();
+
+        assertThat(pattern2, is("[A-Z]"));
+
+        String pattern3 = patternListIterator.next();
+
+        assertThat(pattern3, is("[0-9]"));
+
+        String pattern4 = patternListIterator.next();
+
+        assertThat(pattern4, is("[\\n]"));
+
+        // Check for length restriction.
+        YangRangeRestriction lengthRestriction = stringRestriction.getLengthRestriction();
+        ListIterator<YangRangeInterval> lengthListIterator = lengthRestriction.getAscendingRangeIntervals()
+                .listIterator();
+
+        YangRangeInterval rangeInterval1 = lengthListIterator.next();
+
+        assertThat(((YangUint64) rangeInterval1.getStartValue()).getValue(), is(BigInteger.valueOf(0)));
+        assertThat(((YangUint64) rangeInterval1.getEndValue()).getValue(), is(BigInteger.valueOf(20)));
+
+        YangRangeInterval rangeInterval2 = lengthListIterator.next();
+
+        assertThat(((YangUint64) rangeInterval2.getStartValue()).getValue(), is(BigInteger.valueOf(100)));
+        assertThat(((YangUint64) rangeInterval2.getEndValue()).getValue(),
+                is(new BigInteger("18446744073709551615")));
+    }
+
+    /**
+     * Checks multiple pattern and length restriction in referred type and
+     * typedef invalid scenario.
+     */
+    @Test(expected = LinkerException.class)
+    public void processMultiplePatternAndLengthRestrictionInValid()
+            throws IOException, DataModelException {
+        YangNode node = manager.getDataModel("src/test/resources/MultiplePatternAndLengthRestrictionInValid.yang");
+    }
+}
diff --git a/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/RootClassGeneratorTest.java b/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/RootClassGeneratorTest.java
new file mode 100644
index 0000000..2b01abe
--- /dev/null
+++ b/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/RootClassGeneratorTest.java
@@ -0,0 +1,117 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.plugin.maven;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.junit.Test;
+import org.onosproject.yang.compiler.utils.io.YangPluginConfig;
+import org.onosproject.yang.compiler.utils.io.impl.YangFileScanner;
+import org.onosproject.yang.compiler.utils.io.impl.YangIoUtils;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+
+import java.io.File;
+import java.io.IOException;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.Is.is;
+
+/**
+ * Unit test case for root node's code generation.
+ */
+public class RootClassGeneratorTest {
+
+    private final YangUtilManager utilManager = new YangUtilManager();
+
+    @Test
+    public void rootClassGenTest() throws IOException, ParserException, MojoExecutionException {
+        YangIoUtils.deleteDirectory("target/manager/");
+        String searchDir = "src/test/resources/manager/singleChild";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+        utilManager.resolveDependenciesUsingLinker();
+
+        YangPluginConfig yangPluginConfig = new YangPluginConfig();
+        yangPluginConfig.setCodeGenDir("target/manager/");
+        utilManager.translateToJava(yangPluginConfig);
+        String dir1 = System.getProperty("user.dir") + File.separator + "target/manager/";
+        YangPluginConfig.compileCode(dir1);
+        String path = System.getProperty("user.dir") + "/target/manager/" +
+                "org/onosproject/yang/gen/v1/single/test5/test/rev20160704" +
+                "/Test5.java";
+        assertThat(true, is((new File(path)).exists()));
+
+        path = System.getProperty("user.dir") + "/target/manager/" +
+                "org/onosproject/yang/gen/v1/single/test5/test/rev20160704" +
+                "/Test7.java";
+        assertThat(true, is((new File(path)).exists()));
+        YangIoUtils.deleteDirectory("target/manager/");
+    }
+
+    @Test
+    public void rootClassGenwithoutRevTest() throws IOException, ParserException, MojoExecutionException {
+        YangIoUtils.deleteDirectory("target/manager/");
+        String searchDir = "src/test/resources/manager/genwithoutrev";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+        utilManager.resolveDependenciesUsingLinker();
+
+        YangPluginConfig yangPluginConfig = new YangPluginConfig();
+        yangPluginConfig.setCodeGenDir("target/manager/");
+        utilManager.translateToJava(yangPluginConfig);
+        String dir1 = System.getProperty("user.dir") + File.separator + "target/manager/";
+        YangPluginConfig.compileCode(dir1);
+        String path = System.getProperty("user.dir") + "/target/manager/" +
+                "org/onosproject/yang/gen/v1/test5/test/Test5.java";
+
+        assertThat(true, is((new File(path)).exists()));
+        YangIoUtils.deleteDirectory("target/manager/");
+    }
+
+    @Test
+    public void rootClassMethodGenTest() throws IOException, ParserException, MojoExecutionException {
+        YangIoUtils.deleteDirectory("target/manager/");
+        String searchDir = "src/test/resources/manager/MultiChild";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+        utilManager.resolveDependenciesUsingLinker();
+
+        YangPluginConfig yangPluginConfig = new YangPluginConfig();
+        yangPluginConfig.setCodeGenDir("target/manager/");
+        utilManager.translateToJava(yangPluginConfig);
+        String dir1 = System.getProperty("user.dir") + File.separator + "target/manager/";
+        YangPluginConfig.compileCode(dir1);
+        String path = System.getProperty("user.dir") + "/target/manager/" +
+                "org/onosproject/yang/gen/v1/multi/test5/test/rev20160704" +
+                "/Test5.java";
+        assertThat(true, is((new File(path)).exists()));
+
+        path = System.getProperty("user.dir") + "/target/manager/" +
+                "org/onosproject/yang/gen/v1/multi/test5/test/rev20160704" +
+                "/Test7.java";
+        assertThat(true, is((new File(path)).exists()));
+
+        path = System.getProperty("user.dir") + "/target/manager/" +
+                "org/onosproject/yang/gen/v1/multi/test8/test/rev20160704" +
+                "/Test8.java";
+        assertThat(true, is((new File(path)).exists()));
+
+        YangIoUtils.deleteDirectory("target/manager/");
+    }
+}
diff --git a/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/RpcTranslatorTest.java b/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/RpcTranslatorTest.java
new file mode 100644
index 0000000..f4b35bb
--- /dev/null
+++ b/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/RpcTranslatorTest.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.plugin.maven;
+
+import org.junit.Test;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.translator.tojava.JavaCodeGeneratorUtil;
+import org.onosproject.yang.compiler.utils.io.YangPluginConfig;
+import org.onosproject.yang.compiler.utils.io.impl.YangIoUtils;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.YangUtilsParserManager;
+
+import java.io.File;
+import java.io.IOException;
+
+/**
+ * Unit tests for rpc translator.
+ */
+public final class RpcTranslatorTest {
+
+    private final YangUtilsParserManager manager = new YangUtilsParserManager();
+
+    /**
+     * Checks rpc translation should not result in any exception.
+     */
+    @Test
+    public void processRpcTranslator()
+            throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/RpcTranslator.yang");
+
+        String dir = "target/rpcTranslator/";
+        YangIoUtils.deleteDirectory(dir);
+        YangPluginConfig yangPluginConfig = new YangPluginConfig();
+        yangPluginConfig.setCodeGenDir(dir);
+
+        JavaCodeGeneratorUtil.generateJavaCode(node, yangPluginConfig);
+        String dir1 = System.getProperty("user.dir") + File.separator + dir;
+        YangPluginConfig.compileCode(dir1);
+        YangIoUtils.deleteDirectory(dir);
+    }
+    // TODO enhance the test cases, after having a framework of translator test.
+}
diff --git a/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/SchemaNodeTest.java b/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/SchemaNodeTest.java
new file mode 100644
index 0000000..3593398
--- /dev/null
+++ b/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/SchemaNodeTest.java
@@ -0,0 +1,218 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.plugin.maven;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.junit.Test;
+import org.onosproject.yang.compiler.datamodel.YangLeaf;
+import org.onosproject.yang.compiler.datamodel.YangLeavesHolder;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangSchemaNode;
+import org.onosproject.yang.compiler.datamodel.YangSchemaNodeContextInfo;
+import org.onosproject.yang.compiler.datamodel.YangSchemaNodeIdentifier;
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.utils.io.YangPluginConfig;
+import org.onosproject.yang.compiler.utils.io.impl.YangFileScanner;
+import org.onosproject.yang.compiler.utils.io.impl.YangIoUtils;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import static org.hamcrest.CoreMatchers.notNullValue;
+import static org.hamcrest.CoreMatchers.nullValue;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.Is.is;
+
+/**
+ * Test cases for testing YANG schema node.
+ */
+public class SchemaNodeTest {
+
+    private final YangUtilManager utilManager = new YangUtilManager();
+
+    /**
+     * Checks method to get schema node from map.
+     *
+     * @throws IOException            a violation in IO rule
+     * @throws ParserException        a violation in parser rule
+     * @throws MojoExecutionException a violation in mojo rule
+     * @throws DataModelException     a violation in data model rule
+     */
+    @Test
+    public void processSchemaNodeMap()
+            throws IOException, ParserException,
+            MojoExecutionException, DataModelException {
+
+        YangIoUtils.deleteDirectory("target/schemaMap/");
+        String searchDir = "src/test/resources/schemaMap";
+        utilManager
+                .createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+        utilManager.resolveDependenciesUsingLinker();
+        YangPluginConfig yangPluginConfig = new YangPluginConfig();
+        yangPluginConfig.setCodeGenDir("target/schemaMap/");
+        utilManager.translateToJava(yangPluginConfig);
+
+        Iterator<YangNode> yangNodeIterator =
+                utilManager.getYangNodeSet().iterator();
+        YangNode rootNode = yangNodeIterator.next();
+
+        // Validate the notification enum map
+        assertThat(rootNode.getChild().getNextSibling(),
+                   is(rootNode.getNotificationSchemaNode("TESTNOTIFICATION1")));
+
+        // Validate the notification enum map shouldn't have container
+        assertThat(rootNode.getNotificationSchemaNode("TESTCONTAINER"),
+                   is(nullValue()));
+
+        // Validation for RPC input/output node.
+        YangNode yangRpcNode = rootNode.getChild().getNextSibling()
+                .getNextSibling();
+        YangSchemaNodeIdentifier yangInputNode = new YangSchemaNodeIdentifier();
+        yangInputNode.setName("input");
+        yangInputNode.setNameSpace(yangRpcNode.getNameSpace());
+        assertThat(yangRpcNode.getChildSchema(yangInputNode).getSchemaNode(),
+                   is(yangRpcNode.getChild()));
+
+        YangSchemaNodeIdentifier yangOutputNode = new
+                YangSchemaNodeIdentifier();
+        yangOutputNode.setName("output");
+        yangOutputNode.setNameSpace(yangRpcNode.getNameSpace());
+        assertThat(yangRpcNode.getChildSchema(yangOutputNode).getSchemaNode(),
+                   is(yangRpcNode.getChild().getNextSibling()));
+
+        // Validate the input schema map
+        YangSchemaNode yangInput = yangRpcNode.getChild();
+        YangSchemaNodeIdentifier yangInputLeafNode = new
+                YangSchemaNodeIdentifier();
+        yangInputLeafNode.setName("image-name");
+        yangInputLeafNode.setNameSpace(yangRpcNode.getNameSpace());
+        assertThat(yangInput.getChildSchema(yangInputLeafNode),
+                   is(notNullValue()));
+
+        YangSchemaNode yangOutput = yangRpcNode.getChild().getNextSibling();
+        YangSchemaNodeIdentifier yangOutputLeafNode = new
+                YangSchemaNodeIdentifier();
+        yangOutputLeafNode.setName("image-name");
+        yangOutputLeafNode.setNameSpace(yangRpcNode.getNameSpace());
+        assertThat(yangOutput.getChildSchema(yangOutputLeafNode),
+                   is(notNullValue()));
+
+        // Validate schema node
+        assertThat(rootNode.getYsnContextInfoMap(), is(notNullValue()));
+        Map<YangSchemaNodeIdentifier, YangSchemaNodeContextInfo> schemaMap =
+                rootNode.getYsnContextInfoMap();
+        YangSchemaNodeIdentifier yangSchemaNodeIdentifier =
+                new YangSchemaNodeIdentifier();
+        yangSchemaNodeIdentifier.setName("testcontainer");
+        yangSchemaNodeIdentifier.setNameSpace(yangRpcNode.getNameSpace());
+        assertThat(schemaMap.get(yangSchemaNodeIdentifier), is(notNullValue()));
+        YangSchemaNodeContextInfo yangSchemaNodeContextInfo =
+                schemaMap.get(yangSchemaNodeIdentifier);
+        assertThat(yangSchemaNodeContextInfo.getSchemaNode(),
+                   is(rootNode.getChild()));
+
+        assertThat(rootNode.getChild().getYsnContextInfoMap(),
+                   is(notNullValue()));
+        Map<YangSchemaNodeIdentifier, YangSchemaNodeContextInfo> schemaMap2 =
+                rootNode.getChild()
+                        .getYsnContextInfoMap();
+        yangSchemaNodeIdentifier.setName("testleaf");
+        yangSchemaNodeIdentifier.setNameSpace(yangRpcNode.getNameSpace());
+        assertThat(schemaMap2.get(yangSchemaNodeIdentifier),
+                   is(notNullValue()));
+
+        yangSchemaNodeIdentifier.setName("pretzel");
+        yangSchemaNodeIdentifier.setNameSpace(yangRpcNode.getNameSpace());
+        assertThat(schemaMap2.get(yangSchemaNodeIdentifier),
+                   is(notNullValue()));
+
+        assertThat(rootNode.getChild().getChild().getYsnContextInfoMap(),
+                   is(notNullValue()));
+        Map<YangSchemaNodeIdentifier, YangSchemaNodeContextInfo> schemaMap3 =
+                rootNode.getChild().getChild()
+                        .getYsnContextInfoMap();
+        yangSchemaNodeIdentifier.setName("pretzel");
+        yangSchemaNodeIdentifier.setNameSpace(yangRpcNode.getNameSpace());
+        assertThat(schemaMap3.get(yangSchemaNodeIdentifier),
+                   is(notNullValue()));
+        YangSchemaNodeContextInfo yangSchemaNodeContextInfo3 =
+                schemaMap3.get(yangSchemaNodeIdentifier);
+
+        assertThat(rootNode.getChild().getChild().getChild()
+                           .getYsnContextInfoMap(),
+                   is(notNullValue()));
+        Map<YangSchemaNodeIdentifier, YangSchemaNodeContextInfo> schemaMap4 =
+                rootNode.getChild().getChild().getChild()
+                        .getYsnContextInfoMap();
+        yangSchemaNodeIdentifier.setName("pretzel");
+        yangSchemaNodeIdentifier.setNameSpace(yangRpcNode.getNameSpace());
+        assertThat(schemaMap4.get(yangSchemaNodeIdentifier),
+                   is(notNullValue()));
+
+        YangSchemaNodeContextInfo yangSchemaNodeContextInfo2 =
+                schemaMap4.get(yangSchemaNodeIdentifier);
+        List<YangLeaf> yangListOfLeaf = ((YangLeavesHolder) rootNode.getChild()
+                .getChild().getChild()).getListOfLeaf();
+        YangLeaf yangLeaf = yangListOfLeaf.get(0);
+        assertThat(yangSchemaNodeContextInfo2.getSchemaNode(), is(yangLeaf));
+
+        assertThat(yangSchemaNodeContextInfo3.getSchemaNode(), is(yangLeaf));
+        assertThat(yangSchemaNodeContextInfo3.getContextSwitchedNode(),
+                   is(rootNode.getChild().getChild().getChild()));
+
+        YangIoUtils.deleteDirectory("target/schemaMap/");
+    }
+
+    /**
+     * Checks that notification map shouldn't be present in other YANG node.
+     *
+     * @throws IOException            a violation in IO rule
+     * @throws ParserException        a violation in parser rule
+     * @throws MojoExecutionException a violation in mojo rule
+     * @throws DataModelException     a violation in data model rule
+     */
+    @Test(expected = DataModelException.class)
+    public void processNotificationEnumMapInvalidScenario()
+            throws IOException,
+            ParserException, MojoExecutionException,
+            DataModelException {
+
+        YangIoUtils.deleteDirectory("target/schemaMap/");
+        String searchDir = "src/test/resources/schemaMap";
+        utilManager
+                .createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+        utilManager.resolveDependenciesUsingLinker();
+        YangPluginConfig yangPluginConfig = new YangPluginConfig();
+        yangPluginConfig.setCodeGenDir("target/schemaMap/");
+        utilManager.translateToJava(yangPluginConfig);
+
+        Iterator<YangNode> yangNodeIterator =
+                utilManager.getYangNodeSet().iterator();
+        YangNode rootNode = yangNodeIterator.next();
+
+        YangIoUtils.deleteDirectory("target/schemaMap/");
+
+        rootNode.getChild().getNotificationSchemaNode("TESTNOTIFICATION1");
+    }
+}
diff --git a/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/TypeDefTranslatorTest.java b/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/TypeDefTranslatorTest.java
new file mode 100644
index 0000000..d45be4a
--- /dev/null
+++ b/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/TypeDefTranslatorTest.java
@@ -0,0 +1,108 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.plugin.maven;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.junit.Test;
+import org.onosproject.yang.compiler.utils.io.YangPluginConfig;
+import org.onosproject.yang.compiler.utils.io.impl.YangFileScanner;
+import org.onosproject.yang.compiler.utils.io.impl.YangIoUtils;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+
+import java.io.File;
+import java.io.IOException;
+
+/**
+ * Unit test case for typedef translator.
+ */
+public class TypeDefTranslatorTest {
+
+    private final YangUtilManager utilManager = new YangUtilManager();
+    private static final String DIR = "target/typedefTranslator/";
+    private static final String DIR1 = System.getProperty("user.dir") + File
+            .separator + DIR;
+
+    /**
+     * Checks typedef translation should not result in any exception.
+     *
+     * @throws MojoExecutionException
+     */
+    @Test
+    public void processTypeDefTranslator() throws IOException,
+            ParserException, MojoExecutionException {
+
+        YangIoUtils.deleteDirectory(DIR);
+        String searchDir = "src/test/resources/typedefTranslator/without";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+        utilManager.resolveDependenciesUsingLinker();
+
+        YangPluginConfig yangPluginConfig = new YangPluginConfig();
+        yangPluginConfig.setCodeGenDir(DIR);
+        utilManager.translateToJava(yangPluginConfig);
+        YangPluginConfig.compileCode(DIR1);
+        YangIoUtils.deleteDirectory(DIR);
+    }
+
+    /**
+     * Checks typedef translation should not result in any exception.
+     *
+     * @throws MojoExecutionException
+     */
+    @Test
+    public void processTypeDefWithRestrictionsTranslator() throws IOException,
+            ParserException, MojoExecutionException {
+
+        YangIoUtils.deleteDirectory(DIR);
+        String searchDir = "src/test/resources/typedefTranslator/with";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+        utilManager.resolveDependenciesUsingLinker();
+
+        YangPluginConfig yangPluginConfig = new YangPluginConfig();
+        yangPluginConfig.setCodeGenDir(DIR);
+        utilManager.translateToJava(yangPluginConfig);
+        YangPluginConfig.compileCode(DIR1);
+        YangIoUtils.deleteDirectory(DIR);
+
+    }
+
+    /**
+     * Checks typedef translation should not result in any exception.
+     *
+     * @throws MojoExecutionException
+     */
+    @Test
+    public void processTypeDefWithUnionAndBitsTranslator() throws IOException,
+            ParserException, MojoExecutionException {
+
+        YangIoUtils.deleteDirectory(DIR);
+        String searchDir = "src/test/resources/typedefTranslator/union";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+        utilManager.resolveDependenciesUsingLinker();
+
+        YangPluginConfig yangPluginConfig = new YangPluginConfig();
+        yangPluginConfig.setCodeGenDir(DIR);
+        utilManager.translateToJava(yangPluginConfig);
+        YangPluginConfig.compileCode(DIR1);
+        YangIoUtils.deleteDirectory(DIR);
+    }
+}
diff --git a/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/TypeLinkingAfterCloningTest.java b/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/TypeLinkingAfterCloningTest.java
new file mode 100644
index 0000000..88937ae
--- /dev/null
+++ b/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/TypeLinkingAfterCloningTest.java
@@ -0,0 +1,817 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.plugin.maven;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.onosproject.yang.compiler.datamodel.YangContainer;
+import org.onosproject.yang.compiler.datamodel.YangDerivedInfo;
+import org.onosproject.yang.compiler.datamodel.YangIdentityRef;
+import org.onosproject.yang.compiler.datamodel.YangLeaf;
+import org.onosproject.yang.compiler.datamodel.YangLeafList;
+import org.onosproject.yang.compiler.datamodel.YangLeafRef;
+import org.onosproject.yang.compiler.datamodel.YangList;
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangType;
+import org.onosproject.yang.compiler.datamodel.YangTypeDef;
+import org.onosproject.yang.compiler.datamodel.YangUnion;
+import org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes;
+import org.onosproject.yang.compiler.linker.impl.YangLinkerManager;
+import org.onosproject.yang.compiler.linker.impl.YangLinkerUtils;
+import org.onosproject.yang.compiler.utils.io.impl.YangFileScanner;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.ListIterator;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.Is.is;
+import static org.onosproject.yang.compiler.datamodel.YangNodeType.MODULE_NODE;
+import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes.DERIVED;
+import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes.IDENTITYREF;
+import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes.STRING;
+
+/**
+ * Test cases for type linking after cloning happens grouping.
+ */
+public class TypeLinkingAfterCloningTest {
+
+    private static final String MODULE = "module";
+    private static final String OPEN_ROAD = "org-open-road-m-device";
+    private static final String NODE_ID = "node-id";
+    private static final String LEAF = "leaf";
+    private static final String LEAF_LIST = "leaf-list";
+    private static final String NODE_REF = "node-ref";
+    private static final String FACILITY = "facility";
+    private static final String FACILITY_SYS_LOG = "syslog-facility";
+    private static final String USABILITY_SYS_LOG = "syslog-usability";
+    private static final String AVAILABILITY_SYS_LOG = "syslog-availability";
+    private static final String THIRD = "third";
+    private static final String SECOND = "second";
+    private static final String FIRST = "first";
+    private static final String TYPEDEF = "typedef";
+    private static final String CORRECT = "correct";
+    private static final String UNI = "with-uni";
+    private static final String UNION = "union";
+    private static final String BASE1 = "id2";
+    private static final String BASE2 = "id1";
+    private static final String DIR =
+            "src/test/resources/typelinkingaftercloning/";
+
+    private final YangUtilManager utilMgr = new YangUtilManager();
+    private final YangLinkerManager linkerMgr = new YangLinkerManager();
+
+    @Rule
+    public ExpectedException thrown = ExpectedException.none();
+
+    private ListIterator<YangLeaf> leafItr;
+    private YangLeaf leafInfo;
+    private ListIterator<YangLeafList> leafListItr;
+    private YangLeafList leafListInfo;
+    private YangIdentityRef idRef;
+    private YangUnion union;
+    private Iterator<YangType<?>> unionTypeItr;
+    private YangType type;
+    private YangDerivedInfo derInfo;
+    private YangType type2;
+    private YangType type3;
+    private YangType type1;
+    private YangDerivedInfo derInfo1;
+    private YangTypeDef typedef1;
+
+    /**
+     * Returns the error message as the node name incorrect, when assert fails.
+     *
+     * @param node     YANG node
+     * @param nodeName node name
+     * @return error message as the name is incorrect
+     */
+    private static String getInCrtName(String node, Object nodeName) {
+        return getCapitalCase(node) + "'s name " + nodeName + " is incorrect.";
+    }
+
+    /**
+     * Returns the capital cased first letter of the given string.
+     *
+     * @param name string to be capital cased
+     * @return capital cased string
+     */
+    private static String getCapitalCase(String name) {
+        return name.substring(0, 1).toUpperCase() + name.substring(1);
+    }
+
+    /**
+     * Returns the error message as the node type incorrect, when assert fails.
+     *
+     * @param node     YANG node
+     * @param nodeName node name
+     * @return error message as the type is incorrect
+     */
+    private static String getInCrtLeafType(String node, String nodeName) {
+        return "The " + node + " " + nodeName + " has incorrect data type.";
+    }
+
+    /**
+     * Returns the error message, stating the union and identity-ref level in
+     * the type, has not resolved to the referred identity.
+     *
+     * @param unionLvl union level in node
+     * @param idLvl    identity-ref level in node
+     * @param baseName referred base
+     * @param node     YANG node having type
+     * @param nodeName node name
+     * @return error message for incorrect identity-ref in union.
+     */
+    public static String getInCrtUnionWithIdRef(
+            String unionLvl, String idLvl, String baseName, String node,
+            String nodeName) {
+        return "The " + idLvl + " direct occurrence identity-ref in " +
+                unionLvl + " level union, of " + node + " " + nodeName +
+                " is not " + baseName;
+    }
+
+    /**
+     * Processes leaf-ref after its cloned to uses from grouping.
+     *
+     * @throws IOException if violates IO operation
+     */
+    @Test
+    public void processLeafRefAfterCloning() throws IOException {
+
+        utilMgr.createYangFileInfoSet(YangFileScanner.getYangFiles(DIR + "leafref/intrafile"));
+        utilMgr.parseYangFileInfoSet();
+        utilMgr.createYangNodeSet();
+        YangNode selfNode;
+
+        // Create YANG node set
+        linkerMgr.createYangNodeSet(utilMgr.getYangNodeSet());
+
+        // Add references to import list.
+        linkerMgr.addRefToYangFilesImportList(utilMgr.getYangNodeSet());
+
+        YangLinkerUtils.updateFilePriority(utilMgr.getYangNodeSet());
+
+        // Carry out inter-file linking.
+        linkerMgr.processInterFileLinking(utilMgr.getYangNodeSet());
+
+        Iterator<YangNode> nodeItr = utilMgr.getYangNodeSet().iterator();
+
+        selfNode = nodeItr.next();
+
+        // Checks whether the data model tree returned is of type module.
+        assertThat((selfNode instanceof YangModule), is(true));
+
+        // Checks whether the node type is set properly to module.
+        assertThat(selfNode.getNodeType(), is(MODULE_NODE));
+
+        assertThat(getInCrtName(MODULE, OPEN_ROAD), selfNode.getName(),
+                   is(OPEN_ROAD));
+
+        YangList list = (YangList) selfNode.getChild().getNextSibling()
+                .getNextSibling();
+
+        YangLeafRef leafRef;
+
+        leafItr = list.getListOfLeaf().listIterator();
+        leafInfo = leafItr.next();
+
+        // Checks whether the information in the leaf is correct under list.
+        assertThat(getInCrtName(LEAF, NODE_ID), leafInfo.getName(),
+                   is(NODE_ID));
+        leafRef = (YangLeafRef) leafInfo.getDataType()
+                .getDataTypeExtendedInfo();
+
+        // Checks the effective type for the leaf.
+        assertThat(getInCrtLeafType(LEAF, NODE_ID),
+                   leafRef.getEffectiveDataType().getDataType(), is(STRING));
+
+        leafListItr = list.getListOfLeafList().listIterator();
+        leafListInfo = leafListItr.next();
+
+        // Checks whether the information in the leaf-list is correct.
+        assertThat(getInCrtName(LEAF_LIST, NODE_REF), leafListInfo.getName(),
+                   is(NODE_REF));
+        leafRef = (YangLeafRef) leafListInfo.getDataType()
+                .getDataTypeExtendedInfo();
+
+        assertThat(getInCrtLeafType(LEAF_LIST, NODE_REF),
+                   leafRef.getEffectiveDataType().getDataType(), is(DERIVED));
+
+        // Checks whether the information under cloned container is correct.
+        YangContainer container = (YangContainer) list.getChild()
+                .getNextSibling();
+
+        leafItr = container.getListOfLeaf().listIterator();
+        leafInfo = leafItr.next();
+
+        // Checks whether the information in the leaf is correct under cont.
+        assertThat(getInCrtName(LEAF, NODE_ID), leafInfo.getName(),
+                   is(NODE_ID));
+        leafRef = (YangLeafRef) leafListInfo.getDataType()
+                .getDataTypeExtendedInfo();
+        assertThat(getInCrtLeafType(LEAF, NODE_ID),
+                   leafRef.getEffectiveDataType().getDataType(), is(DERIVED));
+
+        leafListItr = container.getListOfLeafList().listIterator();
+        leafListInfo = leafListItr.next();
+
+        // Checks whether the information in the leaf-list is correct.
+        assertThat(getInCrtName(LEAF_LIST, NODE_REF), leafListInfo.getName(),
+                   is(NODE_REF));
+        leafRef = (YangLeafRef) leafListInfo.getDataType()
+                .getDataTypeExtendedInfo();
+        assertThat(getInCrtLeafType(LEAF_LIST, NODE_REF),
+                   leafRef.getEffectiveDataType().getDataType(),
+                   is(STRING));
+    }
+
+    /**
+     * Processes invalid scenario where a leaf-ref is present in union.
+     *
+     * @throws IOException io error when finding file
+     */
+    @Test
+    public void processInvalidLeafRef() throws IOException {
+        thrown.expect(ParserException.class);
+        thrown.expectMessage("Union member type must not be one of the " +
+                                     "built-in types \"empty\" or " +
+                                     "\"leafref\"node-id_union");
+        utilMgr.createYangFileInfoSet(YangFileScanner.getYangFiles(DIR + "leafref/invalid"));
+        utilMgr.parseYangFileInfoSet();
+    }
+
+    /**
+     * Processes simple identity-ref after it gets cloned from grouping.
+     *
+     * @throws IOException if violates IO operation
+     */
+    @Test
+    public void processIdentityRefBeforeCloning() throws IOException {
+
+        utilMgr.createYangFileInfoSet(YangFileScanner.getYangFiles(DIR + "identityref"));
+        utilMgr.parseYangFileInfoSet();
+        utilMgr.createYangNodeSet();
+        YangNode selfNode;
+
+        // Create YANG node set
+        linkerMgr.createYangNodeSet(utilMgr.getYangNodeSet());
+
+        // Add references to import list.
+        linkerMgr.addRefToYangFilesImportList(utilMgr.getYangNodeSet());
+
+        YangLinkerUtils.updateFilePriority(utilMgr.getYangNodeSet());
+
+        // Carry out inter-file linking.
+        linkerMgr.processInterFileLinking(utilMgr.getYangNodeSet());
+
+        Iterator<YangNode> nodeItr = utilMgr.getYangNodeSet().iterator();
+
+        selfNode = nodeItr.next();
+
+        // Checks whether the data model tree returned is of type module.
+        assertThat((selfNode instanceof YangModule), is(true));
+
+        // Checks whether the node type is set properly to module.
+        assertThat(selfNode.getNodeType(), is(MODULE_NODE));
+
+        assertThat(getInCrtName(MODULE, OPEN_ROAD), selfNode.getName(),
+                   is(OPEN_ROAD));
+
+        YangList list = (YangList) selfNode.getChild().getNextSibling()
+                .getNextSibling().getNextSibling();
+
+        leafItr = list.getListOfLeaf().listIterator();
+        leafInfo = leafItr.next();
+
+        // Checks if the leaf has identity-ref in union.
+        assertThat(getInCrtName(LEAF, FACILITY), leafInfo.getName(),
+                   is(FACILITY));
+        union = (YangUnion) leafInfo.getDataType().getDataTypeExtendedInfo();
+        unionTypeItr = union.getTypeList().listIterator();
+        type = unionTypeItr.next();
+        idRef = (YangIdentityRef) type.getDataTypeExtendedInfo();
+
+        // Checks the effective type for the leaf.
+        assertThat(getInCrtLeafType(LEAF, FACILITY),
+                   idRef.getBaseIdentity().getName(),
+                   is(FACILITY_SYS_LOG));
+
+        leafInfo = leafItr.next();
+
+        // Checks whether the information in the leaf is correct under list.
+        assertThat(getInCrtName(LEAF, NODE_ID), leafInfo.getName(),
+                   is(NODE_ID));
+        idRef = (YangIdentityRef) leafInfo.getDataType()
+                .getDataTypeExtendedInfo();
+
+        // Checks the effective type for the leaf.
+        assertThat(getInCrtLeafType(LEAF, NODE_ID),
+                   idRef.getBaseIdentity().getName(),
+                   is(FACILITY_SYS_LOG));
+
+        leafListItr = list.getListOfLeafList().listIterator();
+        leafListInfo = leafListItr.next();
+
+        // Checks if the information in the leaf-list is correct under list.
+        assertThat(getInCrtName(LEAF_LIST, NODE_REF), leafListInfo.getName(),
+                   is(NODE_REF));
+
+        derInfo = (YangDerivedInfo) leafListInfo.getDataType()
+                .getDataTypeExtendedInfo();
+
+        type = derInfo.getReferredTypeDef().getTypeList().get(0);
+        idRef = (YangIdentityRef) type.getDataTypeExtendedInfo();
+
+        // Checks the effective type for the leaf-list.
+        assertThat(getInCrtLeafType(LEAF, NODE_REF),
+                   idRef.getBaseIdentity().getName(),
+                   is(FACILITY_SYS_LOG));
+
+        YangContainer container = (YangContainer) list.getChild()
+                .getNextSibling().getNextSibling();
+
+        leafListItr = container.getListOfLeafList().listIterator();
+        leafListInfo = leafListItr.next();
+
+        // Checks the leaf-list information is correct.
+        assertThat(getInCrtName(LEAF_LIST, FACILITY), leafListInfo.getName(),
+                   is(FACILITY));
+        union = (YangUnion) leafListInfo.getDataType()
+                .getDataTypeExtendedInfo();
+        unionTypeItr = union.getTypeList().listIterator();
+        type = unionTypeItr.next();
+        idRef = (YangIdentityRef) type.getDataTypeExtendedInfo();
+
+        // Checks the effective type for the leaf-list.
+        assertThat(getInCrtLeafType(LEAF_LIST, FACILITY),
+                   idRef.getBaseIdentity().getName(),
+                   is(FACILITY_SYS_LOG));
+
+        leafListInfo = leafListItr.next();
+
+        // Checks the leaf-list information is correct.
+        assertThat(getInCrtName(LEAF_LIST, NODE_REF), leafListInfo.getName(),
+                   is(NODE_REF));
+        idRef = (YangIdentityRef) leafListInfo.getDataType()
+                .getDataTypeExtendedInfo();
+
+        // Checks the effective type for the leaf.
+        assertThat(getInCrtLeafType(LEAF_LIST, NODE_REF),
+                   idRef.getBaseIdentity().getName(),
+                   is(FACILITY_SYS_LOG));
+
+        leafItr = container.getListOfLeaf().listIterator();
+        leafInfo = leafItr.next();
+
+        // Checks the leaf information is correct.
+        assertThat(getInCrtName(LEAF, NODE_ID), leafInfo.getName(),
+                   is(NODE_ID));
+        idRef = (YangIdentityRef) leafListInfo.getDataType()
+                .getDataTypeExtendedInfo();
+
+        assertThat(getInCrtLeafType(LEAF, NODE_ID),
+                   idRef.getBaseIdentity().getName(),
+                   is(FACILITY_SYS_LOG));
+
+    }
+
+    /**
+     * Processes union having different recursive level with identity-ref.
+     *
+     * @throws IOException if violates IO operation
+     */
+    @Test
+    public void processUnionAfterCloning() throws IOException {
+
+        utilMgr.createYangFileInfoSet(YangFileScanner.getYangFiles(DIR + "union"));
+        utilMgr.parseYangFileInfoSet();
+        utilMgr.createYangNodeSet();
+        YangNode selfNode;
+
+        // Create YANG node set
+        linkerMgr.createYangNodeSet(utilMgr.getYangNodeSet());
+
+        // Add references to import list.
+        linkerMgr.addRefToYangFilesImportList(utilMgr.getYangNodeSet());
+        YangLinkerUtils.updateFilePriority(utilMgr.getYangNodeSet());
+
+        // Carry out inter-file linking.
+        linkerMgr.processInterFileLinking(utilMgr.getYangNodeSet());
+        Iterator<YangNode> nodeItr = utilMgr.getYangNodeSet().iterator();
+        selfNode = nodeItr.next();
+
+        YangUnion union2;
+        YangUnion union3;
+        Iterator<YangType<?>> unionTypeItr2;
+        Iterator<YangType<?>> unionTypeItr3;
+        YangDerivedInfo derivedInfo;
+        YangTypeDef typeDef;
+        Iterator<YangType<?>> typeDefItr;
+
+        // Checks whether the data model tree returned is of type module.
+        assertThat((selfNode instanceof YangModule), is(true));
+
+        // Checks whether the node type is set properly to module.
+        assertThat(selfNode.getNodeType(), is(MODULE_NODE));
+
+        assertThat(getInCrtName(MODULE, OPEN_ROAD), selfNode.getName(),
+                   is(OPEN_ROAD));
+
+        YangList list = (YangList) selfNode.getChild().getNextSibling()
+                .getNextSibling().getNextSibling().getNextSibling()
+                .getNextSibling().getNextSibling();
+
+        Iterator<YangLeaf> leafItr = list.getListOfLeaf().listIterator();
+        YangLeaf leafInfo = leafItr.next();
+
+        // Checks if the leaf has identity-ref in union.
+        assertThat(getInCrtName(LEAF, FACILITY), leafInfo.getName(),
+                   is(FACILITY));
+
+        // Gets the first level union and the list of type in it.
+        union = (YangUnion) leafInfo.getDataType().getDataTypeExtendedInfo();
+        unionTypeItr = union.getTypeList().listIterator();
+        type = unionTypeItr.next();
+
+        // Gets the second level union and types in it.
+        union2 = (YangUnion) type.getDataTypeExtendedInfo();
+        unionTypeItr2 = union2.getTypeList().listIterator();
+        type2 = unionTypeItr2.next();
+
+        // Gets the third level union and types in it.
+        union3 = (YangUnion) type2.getDataTypeExtendedInfo();
+        unionTypeItr3 = union3.getTypeList().listIterator();
+        type3 = unionTypeItr3.next();
+
+        // Checks the first identity-ref in third level union.
+        idRef = (YangIdentityRef) type3.getDataTypeExtendedInfo();
+        assertThat(getInCrtUnionWithIdRef(
+                THIRD, FIRST, USABILITY_SYS_LOG, LEAF, FACILITY),
+                   idRef.getBaseIdentity().getName(),
+                   is(USABILITY_SYS_LOG));
+
+        // Checks the first identity-ref in second level union.
+        type2 = unionTypeItr2.next();
+        idRef = (YangIdentityRef) type2.getDataTypeExtendedInfo();
+        assertThat(getInCrtUnionWithIdRef(
+                SECOND, FIRST, FACILITY_SYS_LOG, LEAF, FACILITY),
+                   idRef.getBaseIdentity().getName(),
+                   is(FACILITY_SYS_LOG));
+
+        // Checks the first identity-ref in first level union.
+        type = unionTypeItr.next();
+        derInfo = (YangDerivedInfo) type.getDataTypeExtendedInfo();
+        type = derInfo.getReferredTypeDef().getTypeList().get(0);
+        idRef = (YangIdentityRef) type.getDataTypeExtendedInfo();
+        assertThat(getInCrtUnionWithIdRef(
+                FIRST, FIRST, AVAILABILITY_SYS_LOG, LEAF, FACILITY),
+                   idRef.getBaseIdentity().getName(),
+                   is(AVAILABILITY_SYS_LOG));
+
+        // Checks derived type in third level union.
+        type3 = unionTypeItr3.next();
+        derivedInfo = (YangDerivedInfo) type3.getDataTypeExtendedInfo();
+        typeDef = derivedInfo.getReferredTypeDef();
+        typeDefItr = typeDef.getTypeList().listIterator();
+        type = typeDefItr.next();
+
+        // Gets the first level union and the list of type in it.
+        union = (YangUnion) type.getDataTypeExtendedInfo();
+        unionTypeItr = union.getTypeList().listIterator();
+        type = unionTypeItr.next();
+
+        // Gets the first level union and the list of type in it.
+        union2 = (YangUnion) type.getDataTypeExtendedInfo();
+        unionTypeItr2 = union2.getTypeList().listIterator();
+        type2 = unionTypeItr2.next();
+
+        // Checks the first identity-ref in second level union.
+        idRef = (YangIdentityRef) type2.getDataTypeExtendedInfo();
+        assertThat(getInCrtUnionWithIdRef(
+                SECOND, FIRST, AVAILABILITY_SYS_LOG, TYPEDEF, CORRECT),
+                   idRef.getBaseIdentity().getName(),
+                   is(AVAILABILITY_SYS_LOG));
+
+        // Checks the second identity-ref in second level union.
+        type2 = unionTypeItr2.next();
+        derInfo = (YangDerivedInfo) type2.getDataTypeExtendedInfo();
+        type2 = derInfo.getReferredTypeDef().getTypeList().get(0);
+        idRef = (YangIdentityRef) type2.getDataTypeExtendedInfo();
+        assertThat(getInCrtUnionWithIdRef(
+                SECOND, SECOND, AVAILABILITY_SYS_LOG, TYPEDEF, CORRECT),
+                   idRef.getBaseIdentity().getName(),
+                   is(AVAILABILITY_SYS_LOG));
+
+        // Checks the first identity-ref in first level union.
+        type = unionTypeItr.next();
+        idRef = (YangIdentityRef) type.getDataTypeExtendedInfo();
+        assertThat(getInCrtUnionWithIdRef(
+                FIRST, FIRST, USABILITY_SYS_LOG, TYPEDEF, CORRECT),
+                   idRef.getBaseIdentity().getName(),
+                   is(USABILITY_SYS_LOG));
+
+        YangContainer container = (YangContainer) list.getChild()
+                .getNextSibling().getNextSibling();
+
+
+        Iterator<YangLeafList> leafListItr = container.getListOfLeafList()
+                .listIterator();
+        YangLeafList leafListInfo = leafListItr.next();
+
+        // Checks if the leaf-list has identity-ref in union.
+        assertThat(getInCrtName(LEAF_LIST, FACILITY), leafListInfo.getName(),
+                   is(FACILITY));
+
+        // Gets the first level union and the list of type in it.
+        union = (YangUnion) leafListInfo.getDataType()
+                .getDataTypeExtendedInfo();
+        unionTypeItr = union.getTypeList().listIterator();
+        type = unionTypeItr.next();
+
+        // Gets the second level union and types in it.
+        union2 = (YangUnion) type.getDataTypeExtendedInfo();
+        unionTypeItr2 = union2.getTypeList().listIterator();
+        type2 = unionTypeItr2.next();
+
+        // Gets the third level union and types in it.
+        union3 = (YangUnion) type2.getDataTypeExtendedInfo();
+        unionTypeItr3 = union3.getTypeList().listIterator();
+        type3 = unionTypeItr3.next();
+
+        // Checks the first identity-ref in third level union.
+        idRef = (YangIdentityRef) type3.getDataTypeExtendedInfo();
+        assertThat(getInCrtUnionWithIdRef(
+                THIRD, FIRST, USABILITY_SYS_LOG, LEAF_LIST, FACILITY),
+                   idRef.getBaseIdentity().getName(),
+                   is(USABILITY_SYS_LOG));
+
+        // Checks the first identity-ref in second level union.
+        type2 = unionTypeItr2.next();
+        idRef = (YangIdentityRef) type2.getDataTypeExtendedInfo();
+        assertThat(getInCrtUnionWithIdRef(
+                SECOND, FIRST, FACILITY_SYS_LOG, LEAF_LIST, FACILITY),
+                   idRef.getBaseIdentity().getName(),
+                   is(FACILITY_SYS_LOG));
+
+        // Checks the first identity-ref in first level union.
+        type = unionTypeItr.next();
+        derInfo = (YangDerivedInfo) type.getDataTypeExtendedInfo();
+        type = derInfo.getReferredTypeDef().getTypeList().get(0);
+        idRef = (YangIdentityRef) type.getDataTypeExtendedInfo();
+        assertThat(getInCrtUnionWithIdRef(
+                FIRST, FIRST, AVAILABILITY_SYS_LOG, LEAF_LIST, FACILITY),
+                   idRef.getBaseIdentity().getName(),
+                   is(AVAILABILITY_SYS_LOG));
+
+        // Checks derived type in third level union.
+        type3 = unionTypeItr3.next();
+        derivedInfo = (YangDerivedInfo) type3.getDataTypeExtendedInfo();
+        typeDef = derivedInfo.getReferredTypeDef();
+        typeDefItr = typeDef.getTypeList().listIterator();
+        type = typeDefItr.next();
+
+        // Gets the first level union and the list of type in it.
+        union = (YangUnion) type.getDataTypeExtendedInfo();
+        unionTypeItr = union.getTypeList().listIterator();
+        type = unionTypeItr.next();
+
+        // Gets the first level union and the list of type in it.
+        union2 = (YangUnion) type.getDataTypeExtendedInfo();
+        unionTypeItr2 = union2.getTypeList().listIterator();
+        type2 = unionTypeItr2.next();
+
+        // Checks the first identity-ref in second level union.
+        idRef = (YangIdentityRef) type2.getDataTypeExtendedInfo();
+        assertThat(getInCrtUnionWithIdRef(
+                SECOND, FIRST, AVAILABILITY_SYS_LOG, TYPEDEF, CORRECT),
+                   idRef.getBaseIdentity().getName(),
+                   is(AVAILABILITY_SYS_LOG));
+
+        // Checks the second identity-ref in second level union.
+        type2 = unionTypeItr2.next();
+        derInfo = (YangDerivedInfo) type2.getDataTypeExtendedInfo();
+        type2 = derInfo.getReferredTypeDef().getTypeList().get(0);
+        idRef = (YangIdentityRef) type2.getDataTypeExtendedInfo();
+        assertThat(getInCrtUnionWithIdRef(
+                SECOND, SECOND, AVAILABILITY_SYS_LOG, TYPEDEF, CORRECT),
+                   idRef.getBaseIdentity().getName(),
+                   is(AVAILABILITY_SYS_LOG));
+
+        // Checks the first identity-ref in first level union.
+        type = unionTypeItr.next();
+        idRef = (YangIdentityRef) type.getDataTypeExtendedInfo();
+        assertThat(getInCrtUnionWithIdRef(
+                FIRST, FIRST, USABILITY_SYS_LOG, TYPEDEF, CORRECT),
+                   idRef.getBaseIdentity().getName(),
+                   is(USABILITY_SYS_LOG));
+    }
+
+    /**
+     * Processes identity-ref when present under typedef, during intra and
+     * inter file linking.
+     *
+     * @throws IOException if violates IO operation
+     */
+    @Test
+    public void processIdentityRefWithTypeDef() throws IOException {
+
+        utilMgr.createYangFileInfoSet(YangFileScanner.getYangFiles(DIR + "idreftypedef"));
+        utilMgr.parseYangFileInfoSet();
+        utilMgr.createYangNodeSet();
+        YangNode selfNode;
+
+        // Create YANG node set
+        linkerMgr.createYangNodeSet(utilMgr.getYangNodeSet());
+
+        // Add references to import list.
+        linkerMgr.addRefToYangFilesImportList(utilMgr.getYangNodeSet());
+        YangLinkerUtils.updateFilePriority(utilMgr.getYangNodeSet());
+
+        // Carry out inter-file linking.
+        linkerMgr.processInterFileLinking(utilMgr.getYangNodeSet());
+        Iterator<YangNode> nodeItr = utilMgr.getYangNodeSet().iterator();
+        YangNode rootNode = nodeItr.next();
+
+        if (rootNode.getName().equals("IdRefInTypeDef1")) {
+            selfNode = rootNode;
+        } else {
+            selfNode = nodeItr.next();
+        }
+
+        YangDerivedInfo derInfo2;
+        YangTypeDef typedef2;
+        YangDerivedInfo derInfo3;
+        YangTypeDef typedef3;
+
+        YangModule module = (YangModule) selfNode;
+        leafItr = module.getListOfLeaf().listIterator();
+
+        // Gets the first leaf, which has three typedef with effective id-ref.
+        leafInfo = leafItr.next();
+        assertThat(getInCrtName(LEAF, LEAF), leafInfo.getName(), is(LEAF));
+        assertThat(getInCrtLeafType(LEAF, LEAF),
+                   leafInfo.getDataType().getDataType(), is(DERIVED));
+
+        // Traverses through the three typedef in it.
+        derInfo1 = (YangDerivedInfo) leafInfo.getDataType()
+                .getDataTypeExtendedInfo();
+        typedef1 = derInfo1.getReferredTypeDef();
+        type1 = typedef1.getTypeList().get(0);
+        derInfo2 = (YangDerivedInfo) type1.getDataTypeExtendedInfo();
+        typedef2 = derInfo2.getReferredTypeDef();
+        type2 = typedef2.getTypeList().get(0);
+        derInfo3 = (YangDerivedInfo) type2.getDataTypeExtendedInfo();
+        typedef3 = derInfo3.getReferredTypeDef();
+        type3 = typedef3.getTypeList().get(0);
+        idRef = (YangIdentityRef) type3.getDataTypeExtendedInfo();
+
+        assertThat(getInCrtLeafType(TYPEDEF, typedef1.getName()),
+                   derInfo1.getEffectiveBuiltInType(), is(IDENTITYREF));
+        assertThat(getInCrtLeafType(TYPEDEF, typedef3.getName()),
+                   idRef.getBaseIdentity().getName(), is(BASE1));
+
+        leafListItr = module.getListOfLeafList().listIterator();
+
+        // Gets the first leaf, which has two typedef with effective id-ref.
+        leafListInfo = leafListItr.next();
+        assertThat(getInCrtName(LEAF_LIST, LEAF_LIST), leafListInfo.getName(),
+                   is(LEAF_LIST));
+        assertThat(getInCrtLeafType(LEAF_LIST, LEAF_LIST),
+                   leafListInfo.getDataType().getDataType(), is(DERIVED));
+
+        // Traverses through the two typedef in it.
+        derInfo1 = (YangDerivedInfo) leafListInfo.getDataType()
+                .getDataTypeExtendedInfo();
+        typedef1 = derInfo1.getReferredTypeDef();
+        type1 = typedef1.getTypeList().get(0);
+        derInfo2 = (YangDerivedInfo) type1.getDataTypeExtendedInfo();
+        typedef2 = derInfo2.getReferredTypeDef();
+        type2 = typedef2.getTypeList().get(0);
+        idRef = (YangIdentityRef) type2.getDataTypeExtendedInfo();
+
+        assertThat(getInCrtLeafType(TYPEDEF, typedef1.getName()),
+                   derInfo1.getEffectiveBuiltInType(), is(IDENTITYREF));
+        assertThat(getInCrtLeafType(TYPEDEF, typedef3.getName()),
+                   idRef.getBaseIdentity().getName(), is(BASE1));
+
+        // Gets the leaf with union having typedef referred from other file.
+        leafInfo = leafItr.next();
+        assertThat(getInCrtName(LEAF, UNI), leafInfo.getName(), is(UNI));
+        assertThat(getInCrtLeafType(LEAF, UNI),
+                   leafInfo.getDataType().getDataType(),
+                   is(YangDataTypes.UNION));
+
+        union = (YangUnion) leafInfo.getDataType().getDataTypeExtendedInfo();
+        type1 = union.getTypeList().get(0);
+        idRef = (YangIdentityRef) type1.getDataTypeExtendedInfo();
+
+        assertThat(getInCrtLeafType(UNION, "first type"),
+                   idRef.getBaseIdentity().getName(), is(BASE1));
+
+        type1 = union.getTypeList().get(1);
+        derInfo1 = (YangDerivedInfo) type1.getDataTypeExtendedInfo();
+        typedef1 = derInfo1.getReferredTypeDef();
+        type2 = typedef1.getTypeList().get(0);
+        idRef = (YangIdentityRef) type2.getDataTypeExtendedInfo();
+        assertThat(getInCrtLeafType(UNION, "second type"),
+                   idRef.getBaseIdentity().getName(), is("id3"));
+    }
+
+    /**
+     * Processes identity-ref when present in grouping used by inter file uses.
+     *
+     * @throws IOException if violates IO operation
+     */
+    @Test
+    public void processIdentityRefInGrouping() throws IOException {
+
+        utilMgr.createYangFileInfoSet(YangFileScanner.getYangFiles(DIR + "idrefingrouping"));
+        utilMgr.parseYangFileInfoSet();
+        utilMgr.createYangNodeSet();
+        YangNode selfNode;
+
+        // Create YANG node set
+        linkerMgr.createYangNodeSet(utilMgr.getYangNodeSet());
+
+        // Add references to import list.
+        linkerMgr.addRefToYangFilesImportList(utilMgr.getYangNodeSet());
+        YangLinkerUtils.updateFilePriority(utilMgr.getYangNodeSet());
+
+        // Carry out inter-file linking.
+        linkerMgr.processInterFileLinking(utilMgr.getYangNodeSet());
+        Iterator<YangNode> nodeItr = utilMgr.getYangNodeSet().iterator();
+        YangNode rootNode = nodeItr.next();
+
+        if (rootNode.getName().equals("IdRefInGrouping2")) {
+            selfNode = rootNode;
+        } else {
+            selfNode = nodeItr.next();
+        }
+
+        YangModule module = (YangModule) selfNode;
+        YangContainer cont = (YangContainer) module.getChild();
+
+        leafItr = cont.getListOfLeaf().listIterator();
+
+        // Gets the first leaf, which has three typedef with effective id-ref.
+        leafInfo = leafItr.next();
+        assertThat(getInCrtName(LEAF, LEAF), leafInfo.getName(), is(LEAF));
+        assertThat(getInCrtLeafType(LEAF, LEAF),
+                   leafInfo.getDataType().getDataType(), is(IDENTITYREF));
+
+        idRef = (YangIdentityRef) leafInfo.getDataType()
+                .getDataTypeExtendedInfo();
+        assertThat(getInCrtLeafType(LEAF, LEAF),
+                   idRef.getBaseIdentity().getName(), is(BASE1));
+
+        leafListItr = cont.getListOfLeafList().listIterator();
+
+        // Gets the first leaf, which has two typedef with effective id-ref.
+        leafListInfo = leafListItr.next();
+        assertThat(getInCrtName(LEAF_LIST, LEAF_LIST), leafListInfo.getName(),
+                   is(LEAF_LIST));
+        assertThat(getInCrtLeafType(LEAF_LIST, LEAF_LIST),
+                   leafListInfo.getDataType().getDataType(), is(DERIVED));
+
+        // Traverses through the two typedef in it.
+        derInfo1 = (YangDerivedInfo) leafListInfo.getDataType()
+                .getDataTypeExtendedInfo();
+        typedef1 = derInfo1.getReferredTypeDef();
+        type1 = typedef1.getTypeList().get(0);
+        idRef = (YangIdentityRef) type1.getDataTypeExtendedInfo();
+
+        assertThat(getInCrtLeafType(TYPEDEF, typedef1.getName()),
+                   derInfo1.getEffectiveBuiltInType(), is(IDENTITYREF));
+        assertThat(getInCrtLeafType(TYPEDEF, typedef1.getName()),
+                   idRef.getBaseIdentity().getName(), is(BASE2));
+
+        YangContainer cont2 = (YangContainer) cont.getChild().getNextSibling();
+        leafItr = cont2.getListOfLeaf().listIterator();
+        leafInfo = leafItr.next();
+
+        assertThat(getInCrtName(LEAF, LEAF), leafInfo.getName(), is(LEAF));
+        assertThat(getInCrtLeafType(LEAF, LEAF),
+                   leafInfo.getDataType().getDataType(), is(IDENTITYREF));
+        idRef = (YangIdentityRef) leafInfo.getDataType()
+                .getDataTypeExtendedInfo();
+        assertThat(getInCrtLeafType(LEAF, LEAF),
+                   idRef.getBaseIdentity().getName(), is(BASE2));
+    }
+}
diff --git a/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/UnionTranslatorTest.java b/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/UnionTranslatorTest.java
new file mode 100644
index 0000000..cf4fb1f
--- /dev/null
+++ b/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/UnionTranslatorTest.java
@@ -0,0 +1,259 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.plugin.maven;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.junit.Test;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.translator.tojava.JavaCodeGeneratorUtil;
+import org.onosproject.yang.compiler.utils.io.YangPluginConfig;
+import org.onosproject.yang.compiler.utils.io.impl.YangFileScanner;
+import org.onosproject.yang.compiler.utils.io.impl.YangIoUtils;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.YangUtilsParserManager;
+
+import java.io.File;
+import java.io.IOException;
+
+/**
+ * Unit tests for union translator.
+ */
+public final class UnionTranslatorTest {
+
+    private final YangUtilsParserManager manager = new YangUtilsParserManager();
+    private static final String DIR = "target/unionTranslator/";
+    private static final String DIR1 = System.getProperty("user.dir") + File
+            .separator + DIR;
+
+    /**
+     * Checks union translation should not result in any exception.
+     */
+    @Test
+    public void processUnionTranslator()
+            throws IOException, ParserException {
+        YangIoUtils.deleteDirectory(DIR);
+        YangNode node = manager.getDataModel("src/test/resources/UnionTranslator.yang");
+
+        YangPluginConfig yangPluginConfig = new YangPluginConfig();
+        yangPluginConfig.setCodeGenDir(DIR);
+
+        JavaCodeGeneratorUtil.generateJavaCode(node, yangPluginConfig);
+        YangPluginConfig.compileCode(DIR1);
+        YangIoUtils.deleteDirectory(DIR);
+    }
+
+    /**
+     * Unit test case to test conflicting types.
+     *
+     * @throws IOException            when fails to do IO operations
+     * @throws MojoExecutionException when fails to do mojo operations
+     */
+    @Test
+    public void processUnionIntUintConflictingTypes() throws IOException, MojoExecutionException {
+        YangIoUtils.deleteDirectory(DIR);
+        String searchDir = "src/test/resources/unionTranslator/intuint";
+        YangUtilManager utilManager = new YangUtilManager();
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+        utilManager.resolveDependenciesUsingLinker();
+
+        YangPluginConfig yangPluginConfig = new YangPluginConfig();
+        yangPluginConfig.setCodeGenDir(DIR);
+
+        utilManager.translateToJava(yangPluginConfig);
+        YangPluginConfig.compileCode(DIR1);
+        YangIoUtils.deleteDirectory(DIR);
+    }
+
+    /**
+     * Unit test case to test conflicting types.
+     *
+     * @throws IOException            when fails to do IO operations
+     * @throws MojoExecutionException when fails to do mojo operations
+     */
+    @Test
+    public void processUnionUintIntConflictingTypes() throws IOException,
+            MojoExecutionException {
+        YangIoUtils.deleteDirectory(DIR);
+        String searchDir = "src/test/resources/unionTranslator/uintint";
+        YangUtilManager utilManager = new YangUtilManager();
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+        utilManager.resolveDependenciesUsingLinker();
+
+        YangPluginConfig yangPluginConfig = new YangPluginConfig();
+        yangPluginConfig.setCodeGenDir(DIR);
+
+        utilManager.translateToJava(yangPluginConfig);
+        YangPluginConfig.compileCode(DIR1);
+        YangIoUtils.deleteDirectory(DIR);
+    }
+
+    /**
+     * Unit test case to test conflicting types.
+     *
+     * @throws IOException            when fails to do IO operations
+     * @throws MojoExecutionException when fails to do mojo operations
+     */
+    @Test
+    public void processUnionLongUlongConflictingTypes() throws IOException,
+            MojoExecutionException {
+        YangIoUtils.deleteDirectory(DIR);
+        String searchDir = "src/test/resources/unionTranslator/longulong";
+        YangUtilManager utilManager = new YangUtilManager();
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+        utilManager.resolveDependenciesUsingLinker();
+
+        YangPluginConfig yangPluginConfig = new YangPluginConfig();
+        yangPluginConfig.setCodeGenDir(DIR);
+
+        utilManager.translateToJava(yangPluginConfig);
+        YangPluginConfig.compileCode(DIR1);
+        YangIoUtils.deleteDirectory(DIR);
+    }
+
+    /**
+     * Unit test case to test conflicting types.
+     *
+     * @throws IOException            when fails to do IO operations
+     * @throws MojoExecutionException when fails to do mojo operations
+     */
+    @Test
+    public void processUnionUlongLongConflictingTypes() throws IOException,
+            MojoExecutionException {
+        YangIoUtils.deleteDirectory(DIR);
+        String searchDir = "src/test/resources/unionTranslator/ulonglong";
+        YangUtilManager utilManager = new YangUtilManager();
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+        utilManager.resolveDependenciesUsingLinker();
+
+        YangPluginConfig yangPluginConfig = new YangPluginConfig();
+        yangPluginConfig.setCodeGenDir(DIR);
+
+        utilManager.translateToJava(yangPluginConfig);
+        YangPluginConfig.compileCode(DIR1);
+        YangIoUtils.deleteDirectory(DIR);
+    }
+
+    /**
+     * Unit test case to test conflicting types.
+     *
+     * @throws IOException            when fails to do IO operations
+     * @throws MojoExecutionException when fails to do mojo operations
+     */
+    @Test
+    public void processUnionIntUintUlongLongConflictingTypes() throws IOException,
+            MojoExecutionException {
+        YangIoUtils.deleteDirectory(DIR);
+        String searchDir = "src/test/resources/unionTranslator/intuintulonglong";
+        YangUtilManager utilManager = new YangUtilManager();
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+        utilManager.resolveDependenciesUsingLinker();
+
+        YangPluginConfig yangPluginConfig = new YangPluginConfig();
+        yangPluginConfig.setCodeGenDir(DIR);
+
+        utilManager.translateToJava(yangPluginConfig);
+        YangPluginConfig.compileCode(DIR1);
+        YangIoUtils.deleteDirectory(DIR);
+    }
+
+    /**
+     * Unit test case to test conflicting types.
+     *
+     * @throws IOException            when fails to do IO operations
+     * @throws MojoExecutionException when fails to do mojo operations
+     */
+    @Test
+    public void processUnionIntUintUlongLongStringConflictingTypes() throws IOException,
+            MojoExecutionException {
+        YangIoUtils.deleteDirectory(DIR);
+        String searchDir = "src/test/resources/unionTranslator/intuintulonglongstring";
+        YangUtilManager utilManager = new YangUtilManager();
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+        utilManager.resolveDependenciesUsingLinker();
+
+        YangPluginConfig yangPluginConfig = new YangPluginConfig();
+        yangPluginConfig.setCodeGenDir(DIR);
+
+        utilManager.translateToJava(yangPluginConfig);
+        YangPluginConfig.compileCode(DIR1);
+        YangIoUtils.deleteDirectory(DIR);
+    }
+
+    /**
+     * Unit test case to test conflicting types.
+     *
+     * @throws IOException            when fails to do IO operations
+     * @throws MojoExecutionException when fails to do mojo operations
+     */
+    @Test
+    public void processUnionIntUintStringConflictingTypes() throws IOException,
+            MojoExecutionException {
+        YangIoUtils.deleteDirectory(DIR);
+        String searchDir = "src/test/resources/unionTranslator/intuintstring";
+        YangUtilManager utilManager = new YangUtilManager();
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+        utilManager.resolveDependenciesUsingLinker();
+
+        YangPluginConfig yangPluginConfig = new YangPluginConfig();
+        yangPluginConfig.setCodeGenDir(DIR);
+
+        utilManager.translateToJava(yangPluginConfig);
+        YangPluginConfig.compileCode(DIR1);
+        YangIoUtils.deleteDirectory(DIR);
+    }
+
+    /**
+     * Unit test case to test Union with binary type.
+     *
+     * @throws IOException            when fails to do IO operations
+     * @throws MojoExecutionException when fails to do mojo operations
+     */
+    @Test
+    public void processUnionWithBinaryTypes() throws IOException,
+            MojoExecutionException {
+        YangIoUtils.deleteDirectory(DIR);
+        String searchDir = "src/test/resources/unionTranslator/unionwithbinary";
+        YangUtilManager utilManager = new YangUtilManager();
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+        utilManager.resolveDependenciesUsingLinker();
+
+        YangPluginConfig yangPluginConfig = new YangPluginConfig();
+        yangPluginConfig.setCodeGenDir(DIR);
+
+        utilManager.translateToJava(yangPluginConfig);
+        YangPluginConfig.compileCode(DIR1);
+        YangIoUtils.deleteDirectory(DIR);
+    }
+
+    // TODO enhance the test cases, after having a framework of translator test.
+}
diff --git a/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/YangJavaModelUtilsTest.java b/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/YangJavaModelUtilsTest.java
new file mode 100644
index 0000000..e1cad16
--- /dev/null
+++ b/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/YangJavaModelUtilsTest.java
@@ -0,0 +1,194 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.plugin.maven;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.hamcrest.core.Is;
+import org.junit.Test;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.translator.tojava.YangJavaModelUtils;
+import org.onosproject.yang.compiler.utils.io.impl.YangFileScanner;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+
+import java.io.IOException;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+
+/**
+ * Unit test case for java model utils.
+ */
+public class YangJavaModelUtilsTest {
+
+
+    private final YangUtilManager utilManager = new YangUtilManager();
+
+    @Test
+    public void isRootNodeContainsOnlyAugmentTest() throws IOException,
+            ParserException, MojoExecutionException {
+        String searchDir = "src/test/resources/rootNode/onlyaugment";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+        utilManager.resolveDependenciesUsingLinker();
+
+        for (YangNode node : utilManager.getYangNodeSet()) {
+            if (node.getName().equals("test5")) {
+                assertThat(false, Is.is(YangJavaModelUtils.isGetSetOfRootNodeRequired(node)));
+                assertThat(true, Is.is(YangJavaModelUtils.isRootNodesCodeGenRequired(node)));
+            }
+            if (node.getName().equals("test6")) {
+                assertThat(true, Is.is(YangJavaModelUtils.isGetSetOfRootNodeRequired(node)));
+                assertThat(true, Is.is(YangJavaModelUtils.isRootNodesCodeGenRequired(node)));
+            }
+        }
+    }
+
+    @Test
+    public void isRootNodeCodeGenRequiredOnlyLeafTest() throws IOException
+            , ParserException, MojoExecutionException {
+        String searchDir = "src/test/resources/rootNode/onlyleaf";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+        utilManager.resolveDependenciesUsingLinker();
+
+        for (YangNode node : utilManager.getYangNodeSet()) {
+            if (node.getName().equals("test5")) {
+                assertThat(true, Is.is(YangJavaModelUtils.isGetSetOfRootNodeRequired(node)));
+                assertThat(true, Is.is(YangJavaModelUtils.isRootNodesCodeGenRequired(node)));
+            }
+        }
+    }
+
+    @Test
+    public void isRootNodeCodeGenRequiredOnlyLeafListTest() throws IOException
+            , ParserException, MojoExecutionException {
+        String searchDir = "src/test/resources/rootNode/onlyleaflist";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+        utilManager.resolveDependenciesUsingLinker();
+
+        for (YangNode node : utilManager.getYangNodeSet()) {
+            if (node.getName().equals("test5")) {
+                assertThat(true, Is.is(YangJavaModelUtils.isGetSetOfRootNodeRequired(node)));
+                assertThat(true, Is.is(YangJavaModelUtils.isRootNodesCodeGenRequired(node)));
+            }
+        }
+    }
+
+    @Test
+    public void isRootNodeCodeGenRequiredOnlyGroupingTest() throws IOException
+            , ParserException, MojoExecutionException {
+        String searchDir = "src/test/resources/rootNode/onlygrouping";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+        utilManager.resolveDependenciesUsingLinker();
+
+        for (YangNode node : utilManager.getYangNodeSet()) {
+            if (node.getName().equals("test5")) {
+                assertThat(true, Is.is(YangJavaModelUtils.isGetSetOfRootNodeRequired(node)));
+                assertThat(false, Is.is(YangJavaModelUtils.isRootNodesCodeGenRequired(node)));
+            }
+            if (node.getName().equals("test6")) {
+                assertThat(true, Is.is(YangJavaModelUtils.isGetSetOfRootNodeRequired(node)));
+                assertThat(false, Is.is(YangJavaModelUtils.isRootNodesCodeGenRequired(node)));
+            }
+        }
+    }
+
+
+    @Test
+    public void isRootNodeCodeGenRequiredOnlyTypeDefTest() throws IOException
+            , ParserException, MojoExecutionException {
+        String searchDir = "src/test/resources/rootNode/onlytypdef";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+        utilManager.resolveDependenciesUsingLinker();
+
+        for (YangNode node : utilManager.getYangNodeSet()) {
+            if (node.getName().equals("test5")) {
+                assertThat(false, Is.is(YangJavaModelUtils.isGetSetOfRootNodeRequired(node)));
+                assertThat(false, Is.is(YangJavaModelUtils.isRootNodesCodeGenRequired(node)));
+            }
+            if (node.getName().equals("test6")) {
+                assertThat(true, Is.is(YangJavaModelUtils.isGetSetOfRootNodeRequired(node)));
+                assertThat(false, Is.is(YangJavaModelUtils.isRootNodesCodeGenRequired(node)));
+            }
+        }
+    }
+
+    @Test
+    public void isRootNodeCodeGenRequiredNoGenTest() throws IOException
+            , ParserException, MojoExecutionException {
+        String searchDir = "src/test/resources/rootNode/nogen";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+        utilManager.resolveDependenciesUsingLinker();
+
+        for (YangNode node : utilManager.getYangNodeSet()) {
+            if (node.getName().equals("test5")) {
+                assertThat(false, Is.is(YangJavaModelUtils.isGetSetOfRootNodeRequired(node)));
+                assertThat(false, Is.is(YangJavaModelUtils.isRootNodesCodeGenRequired(node)));
+            }
+        }
+
+    }
+
+    @Test
+    public void isRootNodeCodeGenRequiredMixedTest() throws IOException
+            , ParserException, MojoExecutionException {
+        String searchDir = "src/test/resources/rootNode/mixed";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+        utilManager.resolveDependenciesUsingLinker();
+
+        for (YangNode node : utilManager.getYangNodeSet()) {
+            if (node.getName().equals("test5")) {
+                assertThat(false, Is.is(YangJavaModelUtils.isGetSetOfRootNodeRequired(node)));
+                assertThat(true, Is.is(YangJavaModelUtils.isRootNodesCodeGenRequired(node)));
+            }
+            if (node.getName().equals("test6")) {
+                assertThat(true, Is.is(YangJavaModelUtils.isGetSetOfRootNodeRequired(node)));
+                assertThat(true, Is.is(YangJavaModelUtils.isRootNodesCodeGenRequired(node)));
+            }
+        }
+
+    }
+
+    @Test
+    public void isRootNodeCodeGenRequiredTypedefGroupingTest() throws IOException
+            , ParserException, MojoExecutionException {
+        String searchDir = "src/test/resources/rootNode/typedefgrouping";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+        utilManager.resolveDependenciesUsingLinker();
+
+        for (YangNode node : utilManager.getYangNodeSet()) {
+            if (node.getName().equals("test5")) {
+                assertThat(true, Is.is(YangJavaModelUtils.isGetSetOfRootNodeRequired(node)));
+                assertThat(false, Is.is(YangJavaModelUtils.isRootNodesCodeGenRequired(node)));
+            }
+        }
+
+    }
+}
diff --git a/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/YangPluginUtilsTest.java b/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/YangPluginUtilsTest.java
new file mode 100644
index 0000000..1759d48
--- /dev/null
+++ b/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/YangPluginUtilsTest.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.plugin.maven;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.maven.project.MavenProject;
+import org.junit.Test;
+import org.sonatype.plexus.build.incremental.BuildContext;
+import org.sonatype.plexus.build.incremental.DefaultBuildContext;
+
+import java.io.File;
+import java.io.IOException;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.Is.is;
+
+/**
+ * Unit test case for YANG plugin utils.
+ */
+public class YangPluginUtilsTest {
+
+    private static final String BASE_DIR = "target/UnitTestCase";
+
+    /**
+     * This test case checks whether the source is getting added.
+     */
+    @Test
+    public void testForAddSource() throws IOException {
+
+        MavenProject project = new MavenProject();
+        BuildContext context = new DefaultBuildContext();
+        String dir = BASE_DIR + File.separator + "yang";
+        String path = System.getProperty("user.dir") + File.separator + dir;
+        File sourceDir = new File(dir);
+        sourceDir.mkdirs();
+        YangPluginUtils.addToCompilationRoot(sourceDir.toString(), project, context);
+        assertThat(true, is(project.getCompileSourceRoots().contains(path)));
+        FileUtils.deleteDirectory(sourceDir);
+    }
+}
diff --git a/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/YangXpathLinkerTest.java b/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/YangXpathLinkerTest.java
new file mode 100644
index 0000000..28c3db8
--- /dev/null
+++ b/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/YangXpathLinkerTest.java
@@ -0,0 +1,761 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.plugin.maven;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.junit.Test;
+import org.onosproject.yang.compiler.datamodel.ResolvableType;
+import org.onosproject.yang.compiler.datamodel.YangAugment;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangReferenceResolver;
+import org.onosproject.yang.compiler.datamodel.YangResolutionInfo;
+import org.onosproject.yang.compiler.linker.impl.XpathLinkingTypes;
+import org.onosproject.yang.compiler.linker.impl.YangLinkerManager;
+import org.onosproject.yang.compiler.linker.impl.YangLinkerUtils;
+import org.onosproject.yang.compiler.linker.impl.YangXpathLinker;
+import org.onosproject.yang.compiler.utils.io.YangPluginConfig;
+import org.onosproject.yang.compiler.utils.io.impl.YangFileScanner;
+import org.onosproject.yang.compiler.utils.io.impl.YangIoUtils;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.List;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.Is.is;
+
+/**
+ * Unit test cases for x-path linker.
+ */
+public class YangXpathLinkerTest {
+
+    private static final String INTRA_FILE_PATH = "src/test/resources/xPathLinker/IntraFile/";
+    private static final String INTER_FILE_PATH = "src/test/resources/xPathLinker/InterFile/";
+    private static final String CASE_FILE_PATH = "src/test/resources/xPathLinker/Case/";
+    private YangUtilManager utilManager = new YangUtilManager();
+    private YangXpathLinker<?> linker = new YangXpathLinker();
+    private YangLinkerManager linkerManager = new YangLinkerManager();
+
+    /**
+     * Unit test case for intra file linking for single level container.
+     *
+     * @throws IOException            when fails to do IO operations
+     * @throws MojoExecutionException
+     */
+    @Test
+    public void processIntraFileLinkingSingleLevel() throws IOException, MojoExecutionException {
+
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(INTRA_FILE_PATH + "IntraSingle/"));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+        utilManager.resolveDependenciesUsingLinker();
+
+        YangNode targetNode = null;
+        String targetNodeName = null;
+
+        for (YangNode node : utilManager.getYangNodeSet()) {
+            YangReferenceResolver ref = (YangReferenceResolver) node;
+            List<YangResolutionInfo> infos = ref.getUnresolvedResolutionList(ResolvableType.YANG_AUGMENT);
+            YangResolutionInfo info = infos.get(0);
+
+            YangAugment augment = (YangAugment) info.getEntityToResolveInfo().getEntityToResolve();
+            targetNodeName = augment.getTargetNode().get(augment.getTargetNode().size() - 1).getNodeIdentifier()
+                    .getName();
+            targetNode = augment.getAugmentedNode();
+
+        }
+
+        assertThat(true, is(targetNode.getName().equals(targetNodeName)));
+    }
+
+    /**
+     * Unit test case for intra file linking for multiple level container.
+     *
+     * @throws IOException when fails to do IO operations
+     */
+    @Test
+    public void processIntraFileLinkingMultipleLevel() throws IOException {
+
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(INTRA_FILE_PATH + "IntraMulti/"));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+
+        YangNode targetNode = null;
+        String targetNodeName = null;
+
+        for (YangNode node : utilManager.getYangNodeSet()) {
+            List<YangAugment> augments = linker.getListOfYangAugment(node);
+
+            for (YangAugment augment : augments) {
+                targetNodeName = augment.getTargetNode().get(augment.getTargetNode().size() - 1).getNodeIdentifier()
+                        .getName();
+                targetNode = linker.processXpathLinking(augment.getTargetNode(), node, XpathLinkingTypes.AUGMENT_LINKING);
+            }
+        }
+
+        assertThat(true, is(targetNode.getName().equals(targetNodeName)));
+    }
+
+    /**
+     * Unit test case for intra file linking for single level augment.
+     *
+     * @throws IOException when fails to do IO operations
+     */
+    @Test
+    public void processIntraFileLinkingInAugmentSingleLevel() throws IOException {
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(INTRA_FILE_PATH + "IntraSingleAugment/"));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+
+        YangNode targetNode = null;
+        String targetNodeName = null;
+
+        for (YangNode node : utilManager.getYangNodeSet()) {
+            List<YangAugment> augments = linker.getListOfYangAugment(node);
+
+            for (YangAugment augment : augments) {
+                targetNodeName = augment.getTargetNode().get(augment.getTargetNode().size() - 1).getNodeIdentifier()
+                        .getName();
+                targetNode = linker.processXpathLinking(augment.getTargetNode(), node, XpathLinkingTypes.AUGMENT_LINKING);
+            }
+        }
+
+        assertThat(true, is(targetNode.getName().equals(targetNodeName)));
+    }
+
+    /**
+     * Unit test case for intra file linking for multiple level augment
+     * without prefix.
+     *
+     * @throws IOException if fails to do IO operations
+     */
+    @Test
+    public void processIntraFileMultiLevelWithoutPrefix() throws IOException {
+
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(
+                INTRA_FILE_PATH + "IntraMultiAugment/withoutprefix"));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+        linkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+        linkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
+        linkerManager.addRefToYangFilesIncludeList(utilManager.getYangNodeSet());
+        linkerManager.processInterFileLinking(utilManager.getYangNodeSet());
+
+        YangNode target = null;
+        String name = null;
+
+        for (YangNode node : utilManager.getYangNodeSet()) {
+            List<YangAugment> augments = linker.getListOfYangAugment(node);
+            for (YangAugment augment : augments) {
+                name = augment.getTargetNode()
+                        .get(augment.getTargetNode().size() - 1)
+                        .getNodeIdentifier().getName();
+                target = linker.processXpathLinking(augment.getTargetNode(),
+                                                    node, XpathLinkingTypes.AUGMENT_LINKING);
+            }
+        }
+        assertThat(true, is(target.getName().equals(name)));
+    }
+
+    /**
+     * Unit test case for intra file linking for multiple level augment with
+     * prefix.
+     *
+     * @throws IOException if fails to do IO operations
+     */
+    @Test
+    public void processIntraFileWithPrefix() throws IOException {
+
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(
+                INTRA_FILE_PATH + "IntraMultiAugment/withprefix"));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+        linkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+        linkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
+        linkerManager.addRefToYangFilesIncludeList(utilManager.getYangNodeSet());
+        linkerManager.processInterFileLinking(utilManager.getYangNodeSet());
+
+        YangNode target = null;
+        String name = null;
+
+        for (YangNode node : utilManager.getYangNodeSet()) {
+            List<YangAugment> augments = linker.getListOfYangAugment(node);
+            for (YangAugment augment : augments) {
+                name = augment.getTargetNode()
+                        .get(augment.getTargetNode().size() - 1)
+                        .getNodeIdentifier().getName();
+                target = linker.processXpathLinking(augment.getTargetNode(),
+                                                    node, XpathLinkingTypes.AUGMENT_LINKING);
+            }
+        }
+        assertThat(true, is(target.getName().equals(name)));
+
+    }
+
+    /**
+     * Unit test case for intra file linking for multiple level augment with
+     * partial prefix.
+     *
+     * @throws IOException if fails to do IO operations
+     */
+    @Test
+    public void processIntraFileWithPartialPrefix() throws IOException {
+
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(
+                INTRA_FILE_PATH + "IntraMultiAugment/withpartialprefix"));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+        linkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+        linkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
+        linkerManager.addRefToYangFilesIncludeList(utilManager.getYangNodeSet());
+        linkerManager.processInterFileLinking(utilManager.getYangNodeSet());
+
+        YangNode target = null;
+        String name = null;
+
+        for (YangNode node : utilManager.getYangNodeSet()) {
+            List<YangAugment> augments = linker.getListOfYangAugment(node);
+            for (YangAugment augment : augments) {
+                name = augment.getTargetNode()
+                        .get(augment.getTargetNode().size() - 1)
+                        .getNodeIdentifier().getName();
+                target = linker.processXpathLinking(augment.getTargetNode(),
+                                                    node, XpathLinkingTypes.AUGMENT_LINKING);
+            }
+        }
+        assertThat(true, is(target.getName().equals(name)));
+    }
+
+    /**
+     * Unit test case for intra file linking for multiple level submodule.
+     *
+     * @throws IOException when fails to do IO operations
+     */
+    @Test
+    public void processIntraFileLinkingInSubModuleSingleLevel() throws IOException {
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(INTRA_FILE_PATH + "IntraSingleSubModule/"));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+        linkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+        linkerManager.linkSubModulesToParentModule(utilManager.getYangNodeSet());
+        linkerManager.addRefToYangFilesIncludeList(utilManager.getYangNodeSet());
+
+        YangNode targetNode = null;
+        String targetNodeName = null;
+
+        for (YangNode node : utilManager.getYangNodeSet()) {
+            List<YangAugment> augments = linker.getListOfYangAugment(node);
+
+            for (YangAugment augment : augments) {
+                targetNodeName = augment.getTargetNode().get(augment.getTargetNode().size() - 1).getNodeIdentifier()
+                        .getName();
+                targetNode = linker.processXpathLinking(augment.getTargetNode(), node, XpathLinkingTypes.AUGMENT_LINKING);
+            }
+        }
+
+        assertThat(true, is(targetNode.getName().equals(targetNodeName)));
+    }
+
+    /**
+     * Unit test case for intra file linking for multiple level submodule.
+     *
+     * @throws IOException when fails to do IO operations
+     */
+    @Test
+    public void processIntraFileLinkingInSubModuleMultiLevel() throws IOException {
+
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(INTRA_FILE_PATH + "IntraMultiSubModule/"));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+        linkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+        linkerManager.linkSubModulesToParentModule(utilManager.getYangNodeSet());
+        linkerManager.addRefToYangFilesIncludeList(utilManager.getYangNodeSet());
+
+        YangNode targetNode = null;
+        String targetNodeName = null;
+
+        for (YangNode node : utilManager.getYangNodeSet()) {
+            List<YangAugment> augments = linker.getListOfYangAugment(node);
+
+            for (YangAugment augment : augments) {
+                targetNodeName = augment.getTargetNode().get(augment.getTargetNode().size() - 1).getNodeIdentifier()
+                        .getName();
+                targetNode = linker.processXpathLinking(augment.getTargetNode(), node, XpathLinkingTypes.AUGMENT_LINKING);
+            }
+        }
+
+        assertThat(true, is(targetNode.getName().equals(targetNodeName)));
+    }
+
+    /**
+     * Unit test case for intra file linking for single level uses.
+     *
+     * @throws IOException when fails to do IO operations
+     */
+    @Test
+    public void processIntraFileLinkingInUsesSingleLevel() throws IOException {
+
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(INTRA_FILE_PATH + "IntraSingleUses/"));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+        linkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+        YangLinkerUtils.updateFilePriority(utilManager.getYangNodeSet());
+        linkerManager.processInterFileLinking(utilManager.getYangNodeSet());
+
+        YangNode targetNode = null;
+        String targetNodeName = null;
+
+        for (YangNode node : utilManager.getYangNodeSet()) {
+            List<YangAugment> augments = linker.getListOfYangAugment(node);
+
+            for (YangAugment augment : augments) {
+                targetNodeName = augment.getTargetNode().get(augment.getTargetNode().size() - 1).getNodeIdentifier()
+                        .getName();
+                targetNode = linker.processXpathLinking(augment.getTargetNode(), node, XpathLinkingTypes.AUGMENT_LINKING);
+            }
+        }
+
+        assertThat(true, is(targetNode.getName().equals(targetNodeName)));
+    }
+
+    /**
+     * Unit test case for intra file linking for multi level uses.
+     *
+     * @throws IOException when fails to do IO operations
+     */
+    @Test
+    public void processIntraFileLinkingInUsesMultiLevel() throws IOException {
+
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(INTRA_FILE_PATH + "IntraMultiUses/"));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+        linkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+        YangLinkerUtils.updateFilePriority(utilManager.getYangNodeSet());
+        linkerManager.processInterFileLinking(utilManager.getYangNodeSet());
+
+        YangNode targetNode = null;
+        String targetNodeName = null;
+
+        for (YangNode node : utilManager.getYangNodeSet()) {
+            List<YangAugment> augments = linker.getListOfYangAugment(node);
+
+            for (YangAugment augment : augments) {
+                targetNodeName = augment.getTargetNode().get(augment.getTargetNode().size() - 1).getNodeIdentifier()
+                        .getName();
+                targetNode = linker.processXpathLinking(augment.getTargetNode(), node, XpathLinkingTypes.AUGMENT_LINKING);
+            }
+        }
+
+        assertThat(true, is(targetNode.getName().equals(targetNodeName)));
+    }
+
+    /**
+     * Unit test case for inter file linking for single level container.
+     *
+     * @throws IOException when fails to do IO operations
+     */
+    @Test
+    public void processInterFileLinkingSingleLevel() throws IOException {
+
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(INTER_FILE_PATH + "InterSingle/"));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+        linkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+        linkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
+
+        YangNode targetNode = null;
+        String targetNodeName = null;
+
+        for (YangNode node : utilManager.getYangNodeSet()) {
+            List<YangAugment> augments = linker.getListOfYangAugment(node);
+
+            for (YangAugment augment : augments) {
+                targetNodeName = augment.getTargetNode().get(augment.getTargetNode().size() - 1).getNodeIdentifier()
+                        .getName();
+                targetNode = linker.processXpathLinking(augment.getTargetNode(), node, XpathLinkingTypes.AUGMENT_LINKING);
+            }
+        }
+
+        assertThat(true, is(targetNode.getName().equals(targetNodeName)));
+    }
+
+    /**
+     * Unit test case for inter file linking for multi level container.
+     *
+     * @throws IOException when fails to do IO operations
+     */
+    @Test
+    public void processInterFileLinkingMultipleLevel() throws IOException {
+
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(INTER_FILE_PATH + "InterMulti/"));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+        linkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+        linkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
+
+        YangNode targetNode = null;
+        String targetNodeName = null;
+
+        for (YangNode node : utilManager.getYangNodeSet()) {
+            List<YangAugment> augments = linker.getListOfYangAugment(node);
+
+            for (YangAugment augment : augments) {
+                targetNodeName = augment.getTargetNode().get(augment.getTargetNode().size() - 1).getNodeIdentifier()
+                        .getName();
+                targetNode = linker.processXpathLinking(augment.getTargetNode(), node, XpathLinkingTypes.AUGMENT_LINKING);
+            }
+        }
+
+        assertThat(true, is(targetNode.getName().equals(targetNodeName)));
+    }
+
+    /**
+     * Unit test case for inter file linking for single level augment.
+     *
+     * @throws IOException when fails to do IO operations
+     */
+    @Test
+    public void processInterFileLinkingInAugmentSingleLevel() throws IOException {
+
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(INTER_FILE_PATH + "InterSingleAugment/"));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+        linkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+        linkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
+
+        YangNode targetNode = null;
+        String targetNodeName = null;
+
+        for (YangNode node : utilManager.getYangNodeSet()) {
+            List<YangAugment> augments = linker.getListOfYangAugment(node);
+
+            for (YangAugment augment : augments) {
+                targetNodeName = augment.getTargetNode().get(augment.getTargetNode().size() - 1).getNodeIdentifier()
+                        .getName();
+                targetNode = linker.processXpathLinking(augment.getTargetNode(), node, XpathLinkingTypes.AUGMENT_LINKING);
+            }
+        }
+
+        assertThat(true, is(targetNode.getName().equals(targetNodeName)));
+    }
+
+    /**
+     * Unit test case for inter file linking for multi level augment.
+     *
+     * @throws IOException when fails to do IO operations
+     */
+    @Test
+    public void processInterFileLinkingInAugmentMultiLevel() throws IOException {
+
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(INTER_FILE_PATH + "InterMultiAugment/"));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+        linkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+        linkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
+
+        YangNode targetNode = null;
+        String targetNodeName = null;
+
+        for (YangNode node : utilManager.getYangNodeSet()) {
+            List<YangAugment> augments = linker.getListOfYangAugment(node);
+
+            for (YangAugment augment : augments) {
+                targetNodeName = augment.getTargetNode().get(augment.getTargetNode().size() - 1).getNodeIdentifier()
+                        .getName();
+                targetNode = linker.processXpathLinking(augment.getTargetNode(), node, XpathLinkingTypes.AUGMENT_LINKING);
+            }
+        }
+
+        assertThat(true, is(targetNode.getName().equals(targetNodeName)));
+    }
+
+    /**
+     * Unit test case for multipler inter file linking for single level augment.
+     *
+     * @throws IOException when fails to do IO operations
+     */
+    @Test
+    public void processMultiInterFileLinkingInAugmentSingleLevel() throws IOException {
+
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(INTER_FILE_PATH + "InterMultiFileAugment/"));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+        linkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+        linkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
+
+        YangNode targetNode = null;
+        String targetNodeName = null;
+
+        for (YangNode node : utilManager.getYangNodeSet()) {
+            List<YangAugment> augments = linker.getListOfYangAugment(node);
+
+            for (YangAugment augment : augments) {
+                targetNodeName = augment.getTargetNode().get(augment.getTargetNode().size() - 1).getNodeIdentifier()
+                        .getName();
+                targetNode = linker.processXpathLinking(augment.getTargetNode(), node, XpathLinkingTypes.AUGMENT_LINKING);
+            }
+        }
+
+        assertThat(true, is(targetNode.getName().equals(targetNodeName)));
+    }
+
+    /**
+     * Unit test case for multiple inter file linking for multi level augment.
+     *
+     * @throws IOException when fails to do IO operations
+     */
+    @Test
+    public void processMultiInterFileLinkingInAugmentMultiLevel() throws IOException {
+
+        utilManager
+                .createYangFileInfoSet(YangFileScanner.getYangFiles(INTER_FILE_PATH + "InterMultiFileAugmentMulti/"));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+        linkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+        linkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
+        linkerManager.linkSubModulesToParentModule(utilManager.getYangNodeSet());
+        linkerManager.addRefToYangFilesIncludeList(utilManager.getYangNodeSet());
+        YangLinkerUtils.updateFilePriority(utilManager.getYangNodeSet());
+        linkerManager.processInterFileLinking(utilManager.getYangNodeSet());
+
+        YangNode targetNode = null;
+        String targetNodeName = null;
+
+        for (YangNode node : utilManager.getYangNodeSet()) {
+            List<YangAugment> augments = linker.getListOfYangAugment(node);
+
+            for (YangAugment augment : augments) {
+                targetNodeName = augment.getTargetNode().get(augment.getTargetNode().size() - 1).getNodeIdentifier()
+                        .getName();
+                targetNode = augment.getAugmentedNode();
+            }
+        }
+
+        assertThat(true, is(targetNode.getName().equals(targetNodeName)));
+    }
+
+    /**
+     * Unit test case for inter file linking for single level submodule.
+     *
+     * @throws IOException when fails to do IO operations
+     */
+    @Test
+    public void processInterFileLinkingInSubModuleSingleLevel() throws IOException {
+
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(INTER_FILE_PATH + "InterSingleSubModule/"));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+        linkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+        linkerManager.linkSubModulesToParentModule(utilManager.getYangNodeSet());
+        linkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
+        linkerManager.addRefToYangFilesIncludeList(utilManager.getYangNodeSet());
+        YangLinkerUtils.updateFilePriority(utilManager.getYangNodeSet());
+        linkerManager.processInterFileLinking(utilManager.getYangNodeSet());
+        YangNode targetNode = null;
+        String targetNodeName = null;
+
+        for (YangNode node : utilManager.getYangNodeSet()) {
+            List<YangAugment> augments = linker.getListOfYangAugment(node);
+
+            for (YangAugment augment : augments) {
+                targetNodeName = augment.getTargetNode().get(augment.getTargetNode().size() - 1).getNodeIdentifier()
+                        .getName();
+                targetNode = augment.getAugmentedNode();
+            }
+        }
+
+        assertThat(true, is(targetNode.getName().equals(targetNodeName)));
+    }
+
+    /**
+     * Unit test case for inter file linking for multi level submodule.
+     *
+     * @throws IOException when fails to do IO operations
+     */
+    @Test
+    public void processInterFileLinkingInSubModuleMultiLevel() throws IOException {
+
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(INTER_FILE_PATH + "InterMultiSubModule/"));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+        linkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+        linkerManager.linkSubModulesToParentModule(utilManager.getYangNodeSet());
+        linkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
+        linkerManager.addRefToYangFilesIncludeList(utilManager.getYangNodeSet());
+        YangLinkerUtils.updateFilePriority(utilManager.getYangNodeSet());
+        linkerManager.processInterFileLinking(utilManager.getYangNodeSet());
+        YangNode targetNode = null;
+        String targetNodeName = null;
+
+        for (YangNode node : utilManager.getYangNodeSet()) {
+            List<YangAugment> augments = linker.getListOfYangAugment(node);
+
+            for (YangAugment augment : augments) {
+                targetNodeName = augment.getTargetNode().get(augment.getTargetNode().size() - 1).getNodeIdentifier()
+                        .getName();
+                targetNode = augment.getAugmentedNode();
+            }
+        }
+
+        assertThat(true, is(targetNode.getName().equals(targetNodeName)));
+    }
+
+    /**
+     * Unit test case for inter file linking for multi level uses inside augment.
+     *
+     * @throws IOException when fails to do IO operations
+     */
+    @Test
+    public void processInterFileLinkingInUsesInAugment() throws IOException {
+
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(INTER_FILE_PATH + "InterSingleUses/"));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+        linkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+        linkerManager.linkSubModulesToParentModule(utilManager.getYangNodeSet());
+        linkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
+        linkerManager.addRefToYangFilesIncludeList(utilManager.getYangNodeSet());
+        YangLinkerUtils.updateFilePriority(utilManager.getYangNodeSet());
+        linkerManager.processInterFileLinking(utilManager.getYangNodeSet());
+
+        YangNode targetNode = null;
+        String targetNodeName = null;
+
+        for (YangNode node : utilManager.getYangNodeSet()) {
+            List<YangAugment> augments = linker.getListOfYangAugment(node);
+
+            for (YangAugment augment : augments) {
+                targetNodeName = augment.getTargetNode().get(augment.getTargetNode().size() - 1)
+                        .getNodeIdentifier().getName();
+                targetNode = augment.getAugmentedNode();
+            }
+        }
+
+        assertThat(true, is(targetNode.getName().equals(targetNodeName)));
+
+    }
+
+    /**
+     * Unit test case for inter file linking for multi level uses.
+     *
+     * @throws IOException when fails to do IO operations
+     */
+    @Test
+    public void processInterFileLinkingInUsesMultiLevel() throws IOException {
+
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(INTER_FILE_PATH + "InterMultiUses/"));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+        linkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+        linkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
+        linkerManager.addRefToYangFilesIncludeList(utilManager.getYangNodeSet());
+        YangLinkerUtils.updateFilePriority(utilManager.getYangNodeSet());
+        linkerManager.processInterFileLinking(utilManager.getYangNodeSet());
+
+        YangNode targetNode = null;
+        String targetNodeName = null;
+
+        for (YangNode node : utilManager.getYangNodeSet()) {
+            List<YangAugment> augments = linker.getListOfYangAugment(node);
+
+            for (YangAugment augment : augments) {
+                targetNodeName = augment.getTargetNode().get(augment.getTargetNode().size() - 1).getNodeIdentifier()
+                        .getName();
+                targetNode = linker.processXpathLinking(augment.getTargetNode(), node, XpathLinkingTypes.AUGMENT_LINKING);
+            }
+        }
+
+        assertThat(true, is(targetNode.getName().equals(targetNodeName)));
+    }
+
+    /**
+     * Unit test case for inter file linking for multi level uses inside augment.
+     *
+     * @throws IOException when fails to do IO operations
+     */
+    @Test
+    public void processInterFileLinkingInMultipleSubmodules() throws IOException {
+
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(CASE_FILE_PATH + "submodule/"));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+        linkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+        linkerManager.linkSubModulesToParentModule(utilManager.getYangNodeSet());
+        linkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
+        linkerManager.addRefToYangFilesIncludeList(utilManager.getYangNodeSet());
+        YangLinkerUtils.updateFilePriority(utilManager.getYangNodeSet());
+
+        linkerManager.processInterFileLinking(utilManager.getYangNodeSet());
+
+        YangNode targetNode = null;
+        String targetNodeName = null;
+
+        for (YangNode node : utilManager.getYangNodeSet()) {
+            List<YangAugment> augments = linker.getListOfYangAugment(node);
+
+            for (YangAugment augment : augments) {
+                targetNodeName = augment.getTargetNode().get(augment.getTargetNode().size() - 1)
+                        .getNodeIdentifier().getName();
+                targetNode = augment.getAugmentedNode();
+            }
+        }
+
+        assertThat(true, is(targetNode.getName().equals(targetNodeName)));
+
+    }
+
+    /**
+     * Unit test case for inter file linking for multi level uses inside augment.
+     *
+     * @throws IOException when fails to do IO operations
+     */
+    @Test
+    public void processInterFileLinkingInMultipleUses() throws IOException {
+
+        YangIoUtils.deleteDirectory("target/xpath/");
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(CASE_FILE_PATH + "uses/"));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+        linkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+        linkerManager.linkSubModulesToParentModule(utilManager.getYangNodeSet());
+        linkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
+        linkerManager.addRefToYangFilesIncludeList(utilManager.getYangNodeSet());
+        YangLinkerUtils.updateFilePriority(utilManager.getYangNodeSet());
+        linkerManager.processInterFileLinking(utilManager.getYangNodeSet());
+
+        YangNode targetNode = null;
+        String targetNodeName = null;
+
+        for (YangNode node : utilManager.getYangNodeSet()) {
+            List<YangAugment> augments = linker.getListOfYangAugment(node);
+
+            for (YangAugment augment : augments) {
+                targetNodeName = augment.getTargetNode().get(augment.getTargetNode().size() - 1)
+                        .getNodeIdentifier().getName();
+                targetNode = augment.getAugmentedNode();
+            }
+        }
+
+        YangPluginConfig yangPluginConfig = new YangPluginConfig();
+        yangPluginConfig.setCodeGenDir("target/xpath/");
+        utilManager.translateToJava(yangPluginConfig);
+        String dir = System.getProperty("user.dir") + File.separator + "target/xpath/";
+        YangPluginConfig.compileCode(dir);
+        YangIoUtils.deleteDirectory("target/xpath/");
+        assertThat(true, is(targetNode.getName().equals(targetNodeName)));
+    }
+}
diff --git a/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/ietfyang/IetfYangFileTest.java b/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/ietfyang/IetfYangFileTest.java
new file mode 100644
index 0000000..82de4c5
--- /dev/null
+++ b/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/ietfyang/IetfYangFileTest.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.plugin.maven.ietfyang;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.junit.Test;
+import org.onosproject.yang.compiler.utils.io.YangPluginConfig;
+import org.onosproject.yang.compiler.utils.io.impl.YangFileScanner;
+import org.onosproject.yang.compiler.utils.io.impl.YangIoUtils;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.plugin.maven.YangUtilManager;
+
+import java.io.File;
+import java.io.IOException;
+
+/**
+ * Test cases for testing IETF YANG files.
+ */
+public class IetfYangFileTest {
+
+    private final YangUtilManager utilManager = new YangUtilManager();
+
+    /**
+     * Checks hierarchical intra with inter file type linking.
+     * Reference: https://datatracker.ietf.org/doc/draft-zha-l3sm-l3vpn-onos-deployment
+     */
+    @Test
+    public void l3vpnserviceyang()
+            throws IOException, ParserException, MojoExecutionException {
+
+        String dir = "target/ietfyang/l3vpnservice/";
+        YangIoUtils.deleteDirectory(dir);
+        String searchDir = "src/test/resources/ietfyang/l3vpnservice";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.resolveDependenciesUsingLinker();
+
+        YangPluginConfig yangPluginConfig = new YangPluginConfig();
+        yangPluginConfig.setCodeGenDir(dir);
+
+        utilManager.translateToJava(yangPluginConfig);
+        String dir1 = System.getProperty("user.dir") + File.separator + dir;
+        YangPluginConfig.compileCode(dir1);
+        YangIoUtils.deleteDirectory("target/ietfyang/");
+    }
+
+}
diff --git a/compiler/plugin/maven/src/test/resources/ChoiceCaseTranslator.yang b/compiler/plugin/maven/src/test/resources/ChoiceCaseTranslator.yang
new file mode 100644
index 0000000..5834795
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/ChoiceCaseTranslator.yang
@@ -0,0 +1,42 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    container food {
+       choice snack {
+           case sports-arena {
+               leaf pretzel {
+                   type string;
+               }
+               leaf beer {
+                   type string;
+               }
+           }
+           case late-night {
+               leaf chocolate {
+                   type string;
+               }
+           }
+       }
+       container dinner {
+           leaf cheese {
+               type string;
+           }
+       }
+       choice snack2 {
+                  case sports-arena {
+                      leaf pretzel {
+                          type string;
+                      }
+                      leaf beer {
+                          type string;
+                      }
+                  }
+                  case late-night {
+                      leaf chocolate {
+                          type string;
+                      }
+                  }
+              }
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/EnumTranslator.yang b/compiler/plugin/maven/src/test/resources/EnumTranslator.yang
new file mode 100644
index 0000000..1957c1f
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/EnumTranslator.yang
@@ -0,0 +1,17 @@
+module Sfc {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf test{
+        type string;
+    }
+    leaf myenum {
+      type enumeration {
+         enum zero;
+         enum one;
+         enum seven {
+              value 7;
+             }
+         }
+     }
+}
diff --git a/compiler/plugin/maven/src/test/resources/LengthRestrictionInRefType.yang b/compiler/plugin/maven/src/test/resources/LengthRestrictionInRefType.yang
new file mode 100644
index 0000000..54684f4
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/LengthRestrictionInRefType.yang
@@ -0,0 +1,13 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf invalid-interval {
+        type hello {
+            length "0..100";
+        }
+    }
+    typedef hello {
+        type string;
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/LengthRestrictionInTypedef.yang b/compiler/plugin/maven/src/test/resources/LengthRestrictionInTypedef.yang
new file mode 100644
index 0000000..17baeec
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/LengthRestrictionInTypedef.yang
@@ -0,0 +1,13 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf invalid-interval {
+        type hello;
+    }
+    typedef hello {
+        type string {
+            length "0..100";
+        }
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/LengthRestrictionInTypedefAndTypeInValid.yang b/compiler/plugin/maven/src/test/resources/LengthRestrictionInTypedefAndTypeInValid.yang
new file mode 100644
index 0000000..65ed7de
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/LengthRestrictionInTypedefAndTypeInValid.yang
@@ -0,0 +1,15 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf invalid-interval {
+        type hello {
+            length "min..20 | 200..max";
+        }
+    }
+    typedef hello {
+        type string {
+            length "0..100 | 101..200 | 201..300";
+        }
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/LengthRestrictionInTypedefAndTypeValid.yang b/compiler/plugin/maven/src/test/resources/LengthRestrictionInTypedefAndTypeValid.yang
new file mode 100644
index 0000000..eca2691
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/LengthRestrictionInTypedefAndTypeValid.yang
@@ -0,0 +1,15 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf invalid-interval {
+        type hello {
+            length "min..20 | 201..max";
+        }
+    }
+    typedef hello {
+        type string {
+            length "0..100 | 101..200 | 201..300";
+        }
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/MultiplePatternAndLengthRestriction.yang b/compiler/plugin/maven/src/test/resources/MultiplePatternAndLengthRestriction.yang
new file mode 100644
index 0000000..d971643
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/MultiplePatternAndLengthRestriction.yang
@@ -0,0 +1,19 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf invalid-interval {
+        type hello {
+            pattern "[a-z]";
+            pattern "[A-Z]";
+            length "min..20 | 201..max";
+        }
+    }
+    typedef hello {
+        type string {
+            pattern "[0-9]";
+            pattern "[\n]";
+            length "0..100 | 101..200 | 201..300";
+        }
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/MultiplePatternAndLengthRestrictionInValid.yang b/compiler/plugin/maven/src/test/resources/MultiplePatternAndLengthRestrictionInValid.yang
new file mode 100644
index 0000000..7ba3ef9
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/MultiplePatternAndLengthRestrictionInValid.yang
@@ -0,0 +1,19 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf invalid-interval {
+        type hello {
+            pattern "[a-z]";
+            pattern "[A-Z]";
+            length "min..20 | 100..max";
+        }
+    }
+    typedef hello {
+        type string {
+            pattern "[0-9]";
+            pattern "[\n]";
+            length "0..100 | 101..200 | 201..300";
+        }
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/MultiplePatternAndLengthRestrictionValid.yang b/compiler/plugin/maven/src/test/resources/MultiplePatternAndLengthRestrictionValid.yang
new file mode 100644
index 0000000..161b558
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/MultiplePatternAndLengthRestrictionValid.yang
@@ -0,0 +1,18 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf invalid-interval {
+        type hello {
+            pattern "[a-z]";
+            pattern "[A-Z]";
+            length "min..20 | 100..max";
+        }
+    }
+    typedef hello {
+        type string {
+            pattern "[0-9]";
+            pattern "[\n]";
+        }
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/MultiplePatternRestrictionInRefTypeAndTypedef.yang b/compiler/plugin/maven/src/test/resources/MultiplePatternRestrictionInRefTypeAndTypedef.yang
new file mode 100644
index 0000000..eaa28c5
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/MultiplePatternRestrictionInRefTypeAndTypedef.yang
@@ -0,0 +1,17 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf invalid-interval {
+        type hello {
+            pattern "[a-z]";
+            pattern "[A-Z]";
+        }
+    }
+    typedef hello {
+        type string {
+            pattern "[0-9]";
+            pattern "[\n]";
+        }
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/NotificationTest.yang b/compiler/plugin/maven/src/test/resources/NotificationTest.yang
new file mode 100644
index 0000000..f199dbd
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/NotificationTest.yang
@@ -0,0 +1,13 @@
+module NotificationTest {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    notification test {
+        leaf type {
+            type string;
+        }
+        leaf severity {
+            type string;
+        }
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/PatternRestrictionInRefType.yang b/compiler/plugin/maven/src/test/resources/PatternRestrictionInRefType.yang
new file mode 100644
index 0000000..189177d
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/PatternRestrictionInRefType.yang
@@ -0,0 +1,13 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf invalid-interval {
+        type hello {
+            pattern "[a-zA-Z]";
+        }
+    }
+    typedef hello {
+        type string;
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/PatternRestrictionInRefTypeAndTypedef.yang b/compiler/plugin/maven/src/test/resources/PatternRestrictionInRefTypeAndTypedef.yang
new file mode 100644
index 0000000..e01b224
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/PatternRestrictionInRefTypeAndTypedef.yang
@@ -0,0 +1,15 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf invalid-interval {
+        type hello {
+            pattern "[a-zA-Z]";
+        }
+    }
+    typedef hello {
+        type string {
+            pattern "[0-9]";
+        }
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/PatternRestrictionInTypedef.yang b/compiler/plugin/maven/src/test/resources/PatternRestrictionInTypedef.yang
new file mode 100644
index 0000000..7875504
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/PatternRestrictionInTypedef.yang
@@ -0,0 +1,13 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf invalid-interval {
+        type hello;
+    }
+    typedef hello {
+        type string {
+            pattern "[a-zA-Z]";
+        }
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/RangeRestrictionInRefType.yang b/compiler/plugin/maven/src/test/resources/RangeRestrictionInRefType.yang
new file mode 100644
index 0000000..da396fa
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/RangeRestrictionInRefType.yang
@@ -0,0 +1,13 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf invalid-interval {
+        type hello {
+            range "1..4 | 10..20";
+        }
+    }
+    typedef hello {
+        type int32;
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/RangeRestrictionInRefTypeAndTypedefInValid.yang b/compiler/plugin/maven/src/test/resources/RangeRestrictionInRefTypeAndTypedefInValid.yang
new file mode 100644
index 0000000..f45f1ee
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/RangeRestrictionInRefTypeAndTypedefInValid.yang
@@ -0,0 +1,15 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf invalid-interval {
+        type hello {
+            range "min..4 | min..max";
+        }
+    }
+    typedef hello {
+        type int32 {
+            range "1..4 | 10..20";
+        }
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/RangeRestrictionInRefTypeAndTypedefValid.yang b/compiler/plugin/maven/src/test/resources/RangeRestrictionInRefTypeAndTypedefValid.yang
new file mode 100644
index 0000000..b0af767
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/RangeRestrictionInRefTypeAndTypedefValid.yang
@@ -0,0 +1,15 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf invalid-interval {
+        type hello {
+            range "min..4 | 10..max";
+        }
+    }
+    typedef hello {
+        type int32 {
+            range "1..4 | 10..20";
+        }
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/RangeRestrictionInRefTypedef.yang b/compiler/plugin/maven/src/test/resources/RangeRestrictionInRefTypedef.yang
new file mode 100644
index 0000000..14382b5
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/RangeRestrictionInRefTypedef.yang
@@ -0,0 +1,33 @@
+module Test {
+    namespace "urn:ietf:params:xml:ns:yang:yt3";
+    prefix "yt3";
+
+    organization
+        "YANG Language Design Team";
+
+    contact
+        "Andy Bierman";
+
+    description
+        "YANG test module 3.";
+
+    revision 2007-12-04 {
+        description "Initial revision.";
+    }
+
+    typedef Num3 {
+        units seconds;
+        type int16 {
+           range "-32000 .. 4 | max";
+        }
+        description "test 3";
+    }
+
+    typedef Num6 {
+        description "test 6";
+        type Num3 {
+           range "-3 | -2 .. +2 | 3";
+        }
+        default 0;
+    }
+}
\ No newline at end of file
diff --git a/compiler/plugin/maven/src/test/resources/RangeRestrictionInString.yang b/compiler/plugin/maven/src/test/resources/RangeRestrictionInString.yang
new file mode 100644
index 0000000..f167230
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/RangeRestrictionInString.yang
@@ -0,0 +1,13 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf invalid-interval {
+        type hello;
+    }
+    typedef hello {
+        type string {
+            range "1..4 | 10..20";
+        }
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/RangeRestrictionInStringInRefType.yang b/compiler/plugin/maven/src/test/resources/RangeRestrictionInStringInRefType.yang
new file mode 100644
index 0000000..c08635f
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/RangeRestrictionInStringInRefType.yang
@@ -0,0 +1,13 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf invalid-interval {
+        type hello {
+            range "1..4 | 10..20";
+        }
+    }
+    typedef hello {
+        type string;
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/RangeRestrictionInTypedef.yang b/compiler/plugin/maven/src/test/resources/RangeRestrictionInTypedef.yang
new file mode 100644
index 0000000..0f53d1f
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/RangeRestrictionInTypedef.yang
@@ -0,0 +1,13 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf invalid-interval {
+        type hello;
+    }
+    typedef hello {
+        type int32 {
+            range "1..4 | 10..20";
+        }
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/RangeRestrictionInvalidInRefTypedef.yang b/compiler/plugin/maven/src/test/resources/RangeRestrictionInvalidInRefTypedef.yang
new file mode 100644
index 0000000..9e93f1e
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/RangeRestrictionInvalidInRefTypedef.yang
@@ -0,0 +1,33 @@
+module Test {
+    namespace "urn:ietf:params:xml:ns:yang:yt3";
+    prefix "yt3";
+
+    organization
+        "YANG Language Design Team";
+
+    contact
+        "Andy Bierman";
+
+    description
+        "YANG test module 3.";
+
+    revision 2007-12-04 {
+        description "Initial revision.";
+    }
+
+    typedef Num3 {
+        units seconds;
+        type int16 {
+           range "-3 | -2 .. +2 | 3";
+        }
+        description "test 3";
+    }
+
+    typedef Num6 {
+        description "test 6";
+        type Num3 {
+           range "-32000 .. 4 | max" ;
+        }
+        default 0;
+    }
+}
\ No newline at end of file
diff --git a/compiler/plugin/maven/src/test/resources/RpcTranslator.yang b/compiler/plugin/maven/src/test/resources/RpcTranslator.yang
new file mode 100644
index 0000000..2f0616e
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/RpcTranslator.yang
@@ -0,0 +1,25 @@
+module Sfc {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf test{
+        type string;
+    }
+    container my-container{
+    leaf my-val{
+            type string;
+        }
+    }
+    rpc SFP {
+        input {
+            leaf port {
+                type string;
+            }
+        }
+        output {
+            leaf path {
+                type string;
+            }
+        }
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/SelfFileLinkingTypedefAtMiddleLevelAfterParentHolder.yang b/compiler/plugin/maven/src/test/resources/SelfFileLinkingTypedefAtMiddleLevelAfterParentHolder.yang
new file mode 100644
index 0000000..812a528
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/SelfFileLinkingTypedefAtMiddleLevelAfterParentHolder.yang
@@ -0,0 +1,16 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    container ospf {
+        list valid {
+            key "invalid-interval";
+            leaf invalid-interval {
+                type hello;
+            }
+        }
+        typedef hello {
+            type string;
+        }
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/SelfFileLinkingTypedefAtRootIsAfterContainerHavingType.yang b/compiler/plugin/maven/src/test/resources/SelfFileLinkingTypedefAtRootIsAfterContainerHavingType.yang
new file mode 100644
index 0000000..10ccab6
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/SelfFileLinkingTypedefAtRootIsAfterContainerHavingType.yang
@@ -0,0 +1,16 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    container ospf {
+        list valid {
+            key "invalid-interval";
+            leaf invalid-interval {
+                type hello;
+            }
+        }
+    }
+    typedef hello {
+        type string;
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/SelfFileLinkingTypedefAtRootTypeTwoLevelInHierarchy.yang b/compiler/plugin/maven/src/test/resources/SelfFileLinkingTypedefAtRootTypeTwoLevelInHierarchy.yang
new file mode 100644
index 0000000..eddb649
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/SelfFileLinkingTypedefAtRootTypeTwoLevelInHierarchy.yang
@@ -0,0 +1,16 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    typedef hello {
+        type string;
+    }
+    container ospf {
+        list valid {
+            key "invalid-interval";
+            leaf invalid-interval {
+                type hello;
+            }
+        }
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/SelfFileLinkingTypedefNotFound.yang b/compiler/plugin/maven/src/test/resources/SelfFileLinkingTypedefNotFound.yang
new file mode 100644
index 0000000..523f0b4
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/SelfFileLinkingTypedefNotFound.yang
@@ -0,0 +1,18 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    container ospf {
+        list valid {
+            key "invalid-interval";
+            leaf invalid-interval {
+                type Ant:hello;
+            }
+        }
+    }
+    container isis {
+        typedef hello {
+            type string;
+        }
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/SelfFileLinkingWithFeature.yang b/compiler/plugin/maven/src/test/resources/SelfFileLinkingWithFeature.yang
new file mode 100644
index 0000000..53de63a
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/SelfFileLinkingWithFeature.yang
@@ -0,0 +1,23 @@
+module syslog {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix "sys";
+    feature local-storage {
+        description
+            "This feature means the device supports local
+             storage (memory, flash or disk) that can be used to
+             store syslog messages.";
+    }
+
+    container speed {
+        leaf local-storage-limit {
+             if-feature local-storage;
+             type uint64;
+             units "kilobyte";
+             config false;
+             description
+                  "The amount of local storage that can be
+                   used to hold syslog messages.";
+         }
+     }
+}
diff --git a/compiler/plugin/maven/src/test/resources/SelfFileLinkingWithFeatureInSubModule.yang b/compiler/plugin/maven/src/test/resources/SelfFileLinkingWithFeatureInSubModule.yang
new file mode 100644
index 0000000..09b8b37
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/SelfFileLinkingWithFeatureInSubModule.yang
@@ -0,0 +1,24 @@
+submodule syslog {
+    yang-version 1;
+    belongs-to "syslog1" {
+        prefix "sys";
+    }
+    feature local-storage {
+        description
+            "This feature means the device supports local
+             storage (memory, flash or disk) that can be used to
+             store syslog messages.";
+    }
+
+    container speed {
+        leaf local-storage-limit {
+             if-feature local-storage;
+             type uint64;
+             units "kilobyte";
+             config false;
+             description
+                 "The amount of local storage that can be
+                  used to hold syslog messages.";
+         }
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/SelfFileLinkingWithFeatureUndefined.yang b/compiler/plugin/maven/src/test/resources/SelfFileLinkingWithFeatureUndefined.yang
new file mode 100644
index 0000000..f55c61a
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/SelfFileLinkingWithFeatureUndefined.yang
@@ -0,0 +1,17 @@
+module syslog {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix "sys";
+
+    container speed {
+        leaf local-storage-limit {
+            if-feature local-storage;
+            type uint64;
+            units "kilobyte";
+            config false;
+            description
+                 "The amount of local storage that can be
+                  used to hold syslog messages.";
+        }
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/SelfFileLinkingWithGroupingHierarchicalRefUnresolved.yang b/compiler/plugin/maven/src/test/resources/SelfFileLinkingWithGroupingHierarchicalRefUnresolved.yang
new file mode 100644
index 0000000..cd71621
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/SelfFileLinkingWithGroupingHierarchicalRefUnresolved.yang
@@ -0,0 +1,14 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    import ietf-yang-types {
+        prefix "P";
+    }
+    grouping create {
+        uses P:valid;
+    }
+    container test{
+        uses create;
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/SelfFileLinkingWithGroupingWithSelfAndExternalPrefixMix.yang b/compiler/plugin/maven/src/test/resources/SelfFileLinkingWithGroupingWithSelfAndExternalPrefixMix.yang
new file mode 100644
index 0000000..b6e3b45
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/SelfFileLinkingWithGroupingWithSelfAndExternalPrefixMix.yang
@@ -0,0 +1,28 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    import ietf-yang-types {
+        prefix "P";
+    }
+    grouping Percentage {
+        leaf hello{
+            type string;
+        }
+    }
+    container ospf {
+        list valid {
+            key "invalid";
+            leaf invalid{
+                type string;
+            }
+            uses Ant:FirstClass;
+            grouping FirstClass {
+                uses P:PassingClass;
+            }
+        }
+        grouping PassingClass {
+            uses Ant:Percentage;
+        }
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/SelfFileLinkingWithGroupingWithSelfModulePrefix.yang b/compiler/plugin/maven/src/test/resources/SelfFileLinkingWithGroupingWithSelfModulePrefix.yang
new file mode 100644
index 0000000..956ba50
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/SelfFileLinkingWithGroupingWithSelfModulePrefix.yang
@@ -0,0 +1,25 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    grouping Percentage {
+        leaf hello{
+            type string;
+        }
+    }
+    container ospf {
+        list valid {
+            key "invalid";
+            leaf invalid{
+                type string;
+            }
+            uses Ant:FirstClass;
+            grouping FirstClass {
+                uses PassingClass;
+            }
+        }
+        grouping PassingClass {
+            uses Ant:Percentage;
+        }
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/SelfFileLinkingWithHierarchicalTypeFailureScenario.yang b/compiler/plugin/maven/src/test/resources/SelfFileLinkingWithHierarchicalTypeFailureScenario.yang
new file mode 100644
index 0000000..d622196
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/SelfFileLinkingWithHierarchicalTypeFailureScenario.yang
@@ -0,0 +1,22 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    typedef Percentage {
+        type Ant:INT;
+    }
+    container ospf {
+        list valid {
+            key "invalid-interval";
+            leaf invalid-interval {
+                type Ant:FirstClass;
+            }
+            typedef FirstClass {
+                type Ant:PassingClass;
+            }
+        }
+        typedef PassingClass {
+            type Percentage;
+        }
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/SelfFileLinkingWithMultipleDependency.yang b/compiler/plugin/maven/src/test/resources/SelfFileLinkingWithMultipleDependency.yang
new file mode 100644
index 0000000..d230f99
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/SelfFileLinkingWithMultipleDependency.yang
@@ -0,0 +1,26 @@
+module syslog {
+     yang-version 1;
+     namespace http://huawei.com;
+     prefix "sys";
+
+     feature p2mp-te {
+       description "Indicates support for P2MP-TE";
+     }
+
+     feature frr-te {
+       description "Indicates support for TE FastReroute (FRR)";
+       if-feature p2mp-te;
+     }
+
+     container speed {
+         leaf local-storage-limit {
+             if-feature frr-te;
+             type uint64;
+             units "kilobyte";
+             config false;
+             description
+                     "The amount of local storage that can be
+                      used to hold syslog messages.";
+         }
+     }
+}
diff --git a/compiler/plugin/maven/src/test/resources/SelfFileLinkingWithMultipleDependencyUnresolved.yang b/compiler/plugin/maven/src/test/resources/SelfFileLinkingWithMultipleDependencyUnresolved.yang
new file mode 100644
index 0000000..02bca89
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/SelfFileLinkingWithMultipleDependencyUnresolved.yang
@@ -0,0 +1,22 @@
+module syslog {
+     yang-version 1;
+     namespace http://huawei.com;
+     prefix "sys";
+
+     feature frr-te {
+       description "Indicates support for TE FastReroute (FRR)";
+       if-feature p2mp-te;
+     }
+
+     container speed {
+         leaf local-storage-limit {
+             if-feature frr-te;
+             type uint64;
+             units "kilobyte";
+             config false;
+             description
+                     "The amount of local storage that can be
+                      used to hold syslog messages.";
+         }
+     }
+}
diff --git a/compiler/plugin/maven/src/test/resources/SelfFileLinkingWithMultipleFeature.yang b/compiler/plugin/maven/src/test/resources/SelfFileLinkingWithMultipleFeature.yang
new file mode 100644
index 0000000..407023c
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/SelfFileLinkingWithMultipleFeature.yang
@@ -0,0 +1,26 @@
+module syslog {
+     yang-version 1;
+     namespace http://huawei.com;
+     prefix "sys";
+
+     feature p2mp-te {
+       description "Indicates support for P2MP-TE";
+     }
+
+     feature frr-te {
+       description "Indicates support for TE FastReroute (FRR)";
+       if-feature p2mp-te;
+     }
+
+     container speed {
+         leaf local-storage-limit {
+             if-feature local-storage;
+             type uint64;
+             units "kilobyte";
+             config false;
+             description
+                     "The amount of local storage that can be
+                      used to hold syslog messages.";
+         }
+     }
+}
diff --git a/compiler/plugin/maven/src/test/resources/SelfFileLinkingWithTypdefHierarchicalRefUnresolved.yang b/compiler/plugin/maven/src/test/resources/SelfFileLinkingWithTypdefHierarchicalRefUnresolved.yang
new file mode 100644
index 0000000..a3e4379
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/SelfFileLinkingWithTypdefHierarchicalRefUnresolved.yang
@@ -0,0 +1,25 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    import ietf-yang-types {
+             prefix "P";
+         }
+    typedef Percentage {
+    type P:Per;
+    }
+    container ospf {
+        list valid {
+            key "invalid-interval";
+            leaf invalid-interval {
+                type FirstClass;
+            }
+            typedef FirstClass {
+                type PassingClass;
+            }
+        }
+        typedef PassingClass {
+            type Percentage;
+        }
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/SelfFileLinkingWithTypdefHierarchicalReference.yang b/compiler/plugin/maven/src/test/resources/SelfFileLinkingWithTypdefHierarchicalReference.yang
new file mode 100644
index 0000000..958dc23
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/SelfFileLinkingWithTypdefHierarchicalReference.yang
@@ -0,0 +1,22 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    typedef Percentage {
+    type int32;
+    }
+    container ospf {
+        list valid {
+            key "invalid-interval";
+            leaf invalid-interval {
+                type FirstClass;
+            }
+            typedef FirstClass {
+                type PassingClass;
+            }
+        }
+        typedef PassingClass {
+            type Percentage;
+        }
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/SelfFileLinkingWithTypeWithSelfAndExternalPrefixMix.yang b/compiler/plugin/maven/src/test/resources/SelfFileLinkingWithTypeWithSelfAndExternalPrefixMix.yang
new file mode 100644
index 0000000..d5f346e
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/SelfFileLinkingWithTypeWithSelfAndExternalPrefixMix.yang
@@ -0,0 +1,25 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    import ietf-yang-types {
+             prefix "P";
+         }
+    typedef Percentage {
+    type int32;
+    }
+    container ospf {
+        list valid {
+            key "invalid-interval";
+            leaf invalid-interval {
+                type Ant:FirstClass;
+            }
+            typedef FirstClass {
+                type P:PassingClass;
+            }
+        }
+        typedef PassingClass {
+            type Ant:Percentage;
+        }
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/SelfFileLinkingWithTypeWithSelfModulePrefix.yang b/compiler/plugin/maven/src/test/resources/SelfFileLinkingWithTypeWithSelfModulePrefix.yang
new file mode 100644
index 0000000..4f292b8
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/SelfFileLinkingWithTypeWithSelfModulePrefix.yang
@@ -0,0 +1,22 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    typedef Percentage {
+    type int32;
+    }
+    container ospf {
+        list valid {
+            key "invalid-interval";
+            leaf invalid-interval {
+                type Ant:FirstClass;
+            }
+            typedef FirstClass {
+                type PassingClass;
+            }
+        }
+        typedef PassingClass {
+            type Ant:Percentage;
+        }
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/SelfResolutionGroupingHavingSameUsesManyTimes.yang b/compiler/plugin/maven/src/test/resources/SelfResolutionGroupingHavingSameUsesManyTimes.yang
new file mode 100644
index 0000000..d449adf
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/SelfResolutionGroupingHavingSameUsesManyTimes.yang
@@ -0,0 +1,25 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    container valid {
+    	grouping endpoint {
+             leaf zip-code {
+                 type string;
+             }
+             uses failure;
+	     container hold {
+                 leaf newone {
+                     type string;
+                 }
+                 
+             }
+             uses failure;              
+    	}
+        grouping failure {
+            leaf test {
+                type string;
+            }
+        }
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/SelfResolutionGroupingInRpcAndUsesInOutput.yang b/compiler/plugin/maven/src/test/resources/SelfResolutionGroupingInRpcAndUsesInOutput.yang
new file mode 100644
index 0000000..3589a9f
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/SelfResolutionGroupingInRpcAndUsesInOutput.yang
@@ -0,0 +1,34 @@
+module rock {
+    namespace "http://example.net/rock";
+    prefix "rock";
+
+    rpc rock-the-house {
+        description "description";
+        status current;
+        reference "reference";
+	grouping hello {
+	    list valid {
+        	    key invalid-interval;
+    	            reference "RFC 6020";
+    		    leaf invalid-interval {
+        	    type "uint16";
+        	    units "seconds";
+        	    status current;
+        	    reference "RFC 6020";
+    		    }
+	     }
+         }
+        input {
+             leaf zip-code {
+                 type string;
+             }
+             uses hello;
+        }
+        output {
+             leaf status {
+                 type string;
+             }
+    	     uses hello;
+        }
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/SelfResolutionGroupingReferencingItselfFailureScenerio.yang b/compiler/plugin/maven/src/test/resources/SelfResolutionGroupingReferencingItselfFailureScenerio.yang
new file mode 100644
index 0000000..3e0ba3d
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/SelfResolutionGroupingReferencingItselfFailureScenerio.yang
@@ -0,0 +1,13 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    container valid {
+    	grouping endpoint {
+             leaf zip-code {
+                 type string;
+             }
+             uses endpoint;
+    	}
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/SelfResolutionGroupingWithMultipleUses.yang b/compiler/plugin/maven/src/test/resources/SelfResolutionGroupingWithMultipleUses.yang
new file mode 100644
index 0000000..906890f
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/SelfResolutionGroupingWithMultipleUses.yang
@@ -0,0 +1,63 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    container valid {
+    	grouping endpoint {
+             leaf zip-code {
+                 type string;
+             }
+             uses first;
+             container design {
+	         uses second;
+	         container correct {
+                     leaf newone {
+                         type string;
+                     }
+                     uses third;
+                 }
+	     }
+             uses fourth;
+             uses fifth;
+    	}
+        uses endpoint;
+        grouping first {
+	    list valid {
+        	    key invalid-interval;
+    	            reference "RFC 6020";
+    		    leaf invalid-interval {
+        	    type "uint16";
+        	    units "seconds";
+        	    status current;
+        	    reference "RFC 6020";
+    		    }
+	     }
+        }
+        grouping second {
+            leaf ink {
+                type int32;
+            }
+        }
+        grouping third {
+            container value {
+                leaf zip-code {
+                    type string;
+                }
+            }
+        }
+        grouping fourth {
+            typedef my-type {
+                status deprecated;
+                type int32;
+            }
+            leaf correct {
+                type my-type;
+            }
+        }
+        grouping fifth {
+            leaf abc {
+                type string;
+            }
+        }
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/SelfResolutionNestedGroupingWithUnresolvedUses.yang b/compiler/plugin/maven/src/test/resources/SelfResolutionNestedGroupingWithUnresolvedUses.yang
new file mode 100644
index 0000000..b2ab735
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/SelfResolutionNestedGroupingWithUnresolvedUses.yang
@@ -0,0 +1,17 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    container test {
+        leaf leaf2 {
+            type string;
+        }
+    	grouping treat {
+            grouping create {
+                grouping mass {
+                }
+            }
+        }
+    }
+    uses Ant:treat;
+}
diff --git a/compiler/plugin/maven/src/test/resources/SelfResolutionRpcWithOneTypedefAndTwoGroupingUnderDifferentNode.yang b/compiler/plugin/maven/src/test/resources/SelfResolutionRpcWithOneTypedefAndTwoGroupingUnderDifferentNode.yang
new file mode 100644
index 0000000..91dc763
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/SelfResolutionRpcWithOneTypedefAndTwoGroupingUnderDifferentNode.yang
@@ -0,0 +1,38 @@
+module rock {
+    namespace "http://example.net/rock";
+    prefix "rock";
+
+    rpc rock-the-house {
+        description "description";
+        status current;
+        reference "reference";
+        input {
+            leaf zip-code {
+                type string;
+            }
+             grouping creative {
+                leaf carry {
+                    type string;
+                }
+             }
+        }
+        output {
+             leaf status {
+                 type string;
+             }
+	     grouping creative {
+	        list valid {
+        	    key invalid-interval;
+    		    leaf invalid-interval {
+        	        type "uint16";
+    		    }
+	        }
+             }
+             typedef my-type {
+                 status deprecated;
+                 type int32;
+             }
+             uses creative;
+        }
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/SelfResolutionWhenLeafrefDoesntHavePath.yang b/compiler/plugin/maven/src/test/resources/SelfResolutionWhenLeafrefDoesntHavePath.yang
new file mode 100644
index 0000000..90b9efc
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/SelfResolutionWhenLeafrefDoesntHavePath.yang
@@ -0,0 +1,17 @@
+module ietf-network {
+    yang-version 1;
+    namespace "urn:ietf:params:xml:ns:yang:ietf-network";
+    prefix nd;
+    container networks {
+        description
+        "Serves as top-level container for a list of networks.";
+        leaf network-id {
+            type uint8;
+            description
+            "Identifies a network.";
+        }
+    }
+    leaf-list network-ref {
+        type leafref;
+    }
+}
\ No newline at end of file
diff --git a/compiler/plugin/maven/src/test/resources/SelfResolutionWhenTypeAndTypedefAtRootLevel.yang b/compiler/plugin/maven/src/test/resources/SelfResolutionWhenTypeAndTypedefAtRootLevel.yang
new file mode 100644
index 0000000..da6795b
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/SelfResolutionWhenTypeAndTypedefAtRootLevel.yang
@@ -0,0 +1,11 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf invalid-interval {
+        type hello;
+    }
+    typedef hello {
+        type string;
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/SelfResolutionWhenTypeAndTypedefAtRootLevelForBinary.yang b/compiler/plugin/maven/src/test/resources/SelfResolutionWhenTypeAndTypedefAtRootLevelForBinary.yang
new file mode 100644
index 0000000..d6ff30e
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/SelfResolutionWhenTypeAndTypedefAtRootLevelForBinary.yang
@@ -0,0 +1,17 @@
+module ospf {
+     namespace "urn:cisco:params:xml:ns:yang:ospf";
+     // replace with IANA namespace when assigned
+     prefix ospf;
+      revision 2020-10-20 {
+       description
+         "Initial revision.";
+     }
+
+    typedef type14 {
+        type binary;
+    }
+
+    leaf typedef14 {
+       type type14;
+     }
+}
diff --git a/compiler/plugin/maven/src/test/resources/SelfResolutionWhenTypeReferredTypedefNotDefined.yang b/compiler/plugin/maven/src/test/resources/SelfResolutionWhenTypeReferredTypedefNotDefined.yang
new file mode 100644
index 0000000..33f90c9
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/SelfResolutionWhenTypeReferredTypedefNotDefined.yang
@@ -0,0 +1,11 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf invalid-interval {
+        type Ant:hello;
+    }
+    typedef hi {
+        type string;
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/SelfResolutionWhenUsesAndGroupingAtRootLevel.yang b/compiler/plugin/maven/src/test/resources/SelfResolutionWhenUsesAndGroupingAtRootLevel.yang
new file mode 100644
index 0000000..f6e9197
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/SelfResolutionWhenUsesAndGroupingAtRootLevel.yang
@@ -0,0 +1,11 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    uses hello;
+    grouping hello {
+        leaf hello{
+            type string;
+        }
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/SelfResolutionWhenUsesAndGroupingAtRootLevelGroupingWithChild.yang b/compiler/plugin/maven/src/test/resources/SelfResolutionWhenUsesAndGroupingAtRootLevelGroupingWithChild.yang
new file mode 100644
index 0000000..13cc4a5
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/SelfResolutionWhenUsesAndGroupingAtRootLevelGroupingWithChild.yang
@@ -0,0 +1,16 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    uses treat;
+    grouping treat {
+        leaf treat{
+            type string;
+        }
+        container test{
+            leaf leaf2{
+                type string;
+            }
+        }
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/UnionTranslator.yang b/compiler/plugin/maven/src/test/resources/UnionTranslator.yang
new file mode 100644
index 0000000..f1de318
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/UnionTranslator.yang
@@ -0,0 +1,13 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    container valid {
+        leaf invalid-interval {
+            type union {
+                type int32;
+                type int8;
+            }
+        }
+    }
+}
\ No newline at end of file
diff --git a/compiler/plugin/maven/src/test/resources/augmentTranslator/test.yang b/compiler/plugin/maven/src/test/resources/augmentTranslator/test.yang
new file mode 100644
index 0000000..a5a0daf
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/augmentTranslator/test.yang
@@ -0,0 +1,167 @@
+module test {  
+    namespace "test:test";  
+    prefix test ;  
+       
+           
+    import test1{  
+       prefix test1;
+    }  
+
+    import test2{  
+       prefix test2;
+    } 
+
+    include acme-types;
+      
+    organization "";  
+    contact "";  
+       
+    description   
+       "Defines basic service types for L3VPN service.";  
+       
+    revision "2015-12-16" {  
+       reference "";  
+    }  
+
+    container cont1 {
+        container cont2 {
+           leaf leaf {
+              type int32;
+           }
+        }
+     }
+
+    choice choice1 {
+         case case1 {
+              leaf case-leaf {
+                  type int32;
+               }
+              container case-container3 {
+                 leaf leafs {
+                     type int64;
+                 }
+              }  
+         }
+     }
+
+     leaf leaf-a {
+       type int32;
+     }
+
+      leaf-list leaf-list-a {
+          type int32;
+      }
+
+      list list-a {
+         key "name";
+         leaf name {
+            type string;
+         }
+      }
+
+    augment /cont3 {
+        leaf leaf1 {
+           type int32;
+         }
+    }
+
+    augment /cont1/cont2 {
+        leaf-list leaf2 {
+           type int32;
+        }
+    }
+    augment /choice1 {
+        case case2 {
+            container con1 {
+                leaf in1 {
+                   type int32;
+                }
+            }
+        }
+        case case3 {
+            container con2 {
+                leaf in2 {
+                   type int32;
+                }
+            }
+        }
+        leaf-list leaf2 {
+           type int32;
+        }
+        leaf leaf1 {
+           type int32;
+         }
+         container case-container {
+            leaf leafs {
+                 type int64;
+             }
+         }  
+         container case-container2 {
+            leaf leafs {
+                 type int64;
+             }
+         }         
+    }
+
+    augment /test1:cont1/test1:cont2 {
+       leaf a {
+          type int32;
+        }
+     }
+
+     augment /test1:cont1/test1:cont2/test1:cont1s/test1:cont1s {
+         leaf a {
+            type int32;
+          }
+      }
+
+     augment /test1:cont1/test1:cont2/test1:cont1s/test1:cont1s/test2:aa {
+        leaf name {
+              type string;
+          }
+        leaf surname {
+              type string;
+          }
+        leaf-list aleaflist {
+           type int32;
+        }
+        container cont1 {
+        }
+        list alist {
+          key "name";
+          leaf name {
+              type string;
+          }
+          leaf-list surname {
+              type string;
+          }
+        }
+     }
+
+   augment /test1:rpc-input/test1:input {
+           leaf leaf2 {
+                type int32;
+            }
+   }
+
+   augment /test1:rpc-output/test1:output {
+           leaf leaf2 {
+                type int32;
+            }
+   }
+
+   augment /test1:rpc-input-output/test1:output {
+           leaf leaf2 {
+                type int32;
+            }
+   }
+
+   augment /test1:rpc-input-output/test1:input {
+           leaf leaf2 {
+                type int32;
+            }
+   }
+
+
+}
+    
diff --git a/compiler/plugin/maven/src/test/resources/augmentTranslator/test2.yang b/compiler/plugin/maven/src/test/resources/augmentTranslator/test2.yang
new file mode 100644
index 0000000..1eae21b
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/augmentTranslator/test2.yang
@@ -0,0 +1,60 @@
+module test1 {  
+    namespace "test1:test1";  
+    prefix test1 ;  
+                  
+    organization "";  
+    contact "";  
+       
+    description   
+       "Defines basic service types for L3VPN service.";  
+       
+    revision "2015-12-16" {  
+       reference "";  
+    }  
+
+    container cont1 {
+        container cont2 {
+        }
+     }
+
+    augment /cont1/cont2 {
+       leaf leaf4 {
+          type int32;
+        }
+        container cont1s {
+            container cont1s {
+            }
+        }
+    }
+
+    rpc rpc-input {
+       input {
+            leaf leaf1 {
+                 type int32;
+             }
+       }
+    }
+
+    rpc rpc-output {
+       output {
+            leaf leaf1 {
+                 type int32;
+             }
+       }
+    }
+
+    rpc rpc-input-output {
+       input {
+            leaf leaf1 {
+                 type int32;
+             }
+       }
+       output {
+            leaf leaf1 {
+                 type int32;
+             }
+       }
+    }
+
+}
+    
diff --git a/compiler/plugin/maven/src/test/resources/augmentTranslator/test3.yang b/compiler/plugin/maven/src/test/resources/augmentTranslator/test3.yang
new file mode 100644
index 0000000..dca558c
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/augmentTranslator/test3.yang
@@ -0,0 +1,26 @@
+module test2 {  
+    namespace "test2:test2";  
+    prefix test2 ;  
+                  
+    import test1{  
+       prefix test1;
+    }  
+    organization "";  
+    contact "";  
+       
+    description   
+       "Defines basic service types for L3VPN service.";  
+       
+    revision "2015-12-16" {  
+       reference "";  
+    }  
+
+
+    augment /test1:cont1/test1:cont2/test1:cont1s/test1:cont1s {
+        leaf leaf5 {
+          type int32;
+        }
+        container aa {
+        }
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/augmentTranslator/test4.yang b/compiler/plugin/maven/src/test/resources/augmentTranslator/test4.yang
new file mode 100644
index 0000000..bed22db
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/augmentTranslator/test4.yang
@@ -0,0 +1,18 @@
+submodule acme-types { 
+        
+    belongs-to "test" {
+         prefix "test";
+    }
+    organization "";  
+    contact "";  
+         
+    description   
+       "Defines basic service types for L3VPN service.";  
+       
+    revision "2015-12-16" {  
+       reference "";  
+    }  
+
+    container cont3 {
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/augmentTranslator/test5.yang b/compiler/plugin/maven/src/test/resources/augmentTranslator/test5.yang
new file mode 100644
index 0000000..b7cf234
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/augmentTranslator/test5.yang
@@ -0,0 +1,25 @@
+module test5 {  
+    namespace "test:test";  
+    prefix test5 ;  
+           
+    import test{  
+       prefix test;
+    }        
+    organization "";  
+    contact "";  
+       
+    description   
+       "Defines basic service types for L3VPN service.";  
+       
+    revision "2015-12-16" {  
+       reference "";  
+    }  
+                    
+    augment /test:cont1 {
+        leaf leaf1 {
+           type int32;
+         }
+    }
+
+}
+    
diff --git a/compiler/plugin/maven/src/test/resources/choiceAugment/test.yang b/compiler/plugin/maven/src/test/resources/choiceAugment/test.yang
new file mode 100644
index 0000000..ceee3d7
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/choiceAugment/test.yang
@@ -0,0 +1,78 @@
+module test {
+    namespace "test:test";
+        prefix test ;
+
+    import test1{
+       prefix test1;
+    }
+    organization "";
+    contact "";
+
+    description
+       "Defines basic service types for L3VPN service.";
+
+    revision "2015-12-16" {
+       reference "";
+    }
+
+    augment /test1:rpc-input-output/test1:output/ {
+        choice choice1 {
+            container case1 {
+                leaf int-leaf {
+                    type int32;
+                }
+            }
+        }
+    }
+
+    list node {
+        key "node-id";
+        leaf node-id{
+           type string;
+        }
+        leaf-list node-prop{
+           type string;
+        }
+        container termination-points{
+           leaf number-of-tp {
+               type int16;
+            }
+            list termination-point {
+                key "tp-id";
+                leaf tp-id {
+                    type string;
+                }
+            }
+        }
+        choice choice1{
+           case case1a{
+               leaf leaf1a1{
+                   type string;
+               }
+               leaf leaf1a2{
+                  type string;
+               }
+           }
+           case case1b{
+               choice choice1b{
+                    case case1bi{
+                         leaf leaf1bia{
+                              type string;
+                          }
+                          leaf leaf1bib{
+                              type string;
+                          }
+                     }
+                    case case1bii{
+                         leaf leaf1biia{
+                               type string;
+                         }
+                         leaf leaf1biib{
+                               type string;
+                          }
+                    }
+               }
+           }
+        }
+    }
+}
\ No newline at end of file
diff --git a/compiler/plugin/maven/src/test/resources/choiceAugment/test2.yang b/compiler/plugin/maven/src/test/resources/choiceAugment/test2.yang
new file mode 100644
index 0000000..4caa38b
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/choiceAugment/test2.yang
@@ -0,0 +1,26 @@
+module test1 {
+    namespace "test1:test1";
+    prefix test1 ;
+
+    organization "";
+    contact "";
+
+    description
+       "Defines basic service types for L3VPN service.";
+    revision "2015-12-16" {
+       reference "";
+    }
+
+    rpc rpc-input-output {
+       input {
+            leaf leaf1 {
+                 type int32;
+             }
+       }
+       output {
+            leaf leaf1 {
+                 type int32;
+             }
+       }
+    }
+}
\ No newline at end of file
diff --git a/compiler/plugin/maven/src/test/resources/choiceTranslator/all.yang b/compiler/plugin/maven/src/test/resources/choiceTranslator/all.yang
new file mode 100644
index 0000000..be2fd07
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/choiceTranslator/all.yang
@@ -0,0 +1,157 @@
+module all {
+
+  namespace "yang:all";
+  prefix "all";
+  yang-version 1;
+
+  choice name {
+             case a {
+                 leaf udp {
+                     type empty;
+                 }
+             }
+             case b {
+                 leaf tcp {
+                    type empty;
+           }
+       }
+   }
+
+
+   container c {
+       choice name {
+             case a {
+                 leaf udp {
+                     type empty;
+                 }
+             }
+             case b {
+                 leaf tcp {
+                    type empty;
+                 }
+             }
+         }
+   }
+
+   list l {
+   config false;
+choice name {
+             case a {
+                 leaf udp {
+                     type empty;
+                 }
+             }
+             case b {
+                 leaf tcp {
+                    type empty;
+                 }
+             }
+         }
+   }
+
+
+   grouping g {
+    choice name {
+             case a {
+                 leaf udp {
+                     type empty;
+                 }
+             }
+             case b {
+                 leaf tcp {
+                    type empty;
+                 }
+             }
+         }
+   }
+    rpc r {
+        input {
+           choice name {
+             case a {
+                 leaf udp {
+                     type empty;
+                 }
+             }
+             case b {
+                 leaf tcp {
+                    type empty;
+                 }
+             }
+         }
+       }
+      output {
+        choice name {
+             case a {
+                 leaf udp {
+                     type empty;
+                 }
+             }
+             case b {
+                 leaf tcp {
+                    type empty;
+                 }
+             }
+         }
+        }
+     }
+
+     augment /name {
+        choice name {
+             case a {
+                 leaf udp {
+                     type empty;
+                 }
+                 container cont1 {
+                     container cont2 {
+                     choice name {
+                                  case a {
+                                      leaf udp {
+                                          type empty;
+                                      }
+                                      container cont1 {
+                                          container cont2 {
+                                               leaf udp1 {
+                                                  type empty;
+                                                   }
+                                           }
+                                          leaf udp2 {
+                                              type empty;
+                                          }
+                                      }
+                                  }
+                                  case b {
+                                      leaf tcp3 {
+                                         type empty;
+                                      }
+                                  }
+                              }
+                          leaf udp4 {
+                             type empty;
+                              }
+                      }
+                     leaf udp5 {
+                         type empty;
+                     }
+                 }
+             }
+             case b {
+                 leaf tcp2 {
+                    type empty;
+                 }
+             }
+         }
+         choice name1 {
+                      case a {
+                          leaf udp {
+                              type empty;
+                          }
+                      }
+                      case b {
+                          leaf tcp {
+                             type empty;
+                          }
+                      }
+                  }
+     }
+
+}
\ No newline at end of file
diff --git a/compiler/plugin/maven/src/test/resources/compilerAnnotation/test.yang b/compiler/plugin/maven/src/test/resources/compilerAnnotation/test.yang
new file mode 100644
index 0000000..592e23f
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/compilerAnnotation/test.yang
@@ -0,0 +1,33 @@
+module test {  
+    namespace "test:test";  
+    prefix test;
+    typedef type1 {
+        type string;
+    }
+    list list1 {
+       key "name sur-name";
+       leaf name {
+          type string;
+       }
+       leaf sur-name {
+           type type1;
+       }
+       choice c1 {
+          case ca1 {
+             leaf a {
+                type int32;
+             }
+          }
+       }
+    }
+    list list2 {
+           key "name sur-name";
+           leaf name {
+              type string;
+           }
+           leaf sur-name {
+               type type1;
+           }
+        }
+}
+    
diff --git a/compiler/plugin/maven/src/test/resources/compilerAnnotation/test2.yang b/compiler/plugin/maven/src/test/resources/compilerAnnotation/test2.yang
new file mode 100644
index 0000000..704f724
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/compilerAnnotation/test2.yang
@@ -0,0 +1,21 @@
+module test1 {  
+    namespace "test1:test1";  
+    prefix test1 ;  
+
+    import test {
+       prefix test;
+    }
+    organization "";  
+    contact "";  
+
+    description   
+       "Defines basic service types for L3VPN service.";  
+
+    revision "2015-12-16" {  
+       reference "";  
+    }
+
+    ca:compiler-annotation /test:list1 {
+        ds:app-data-structure "Map";
+    }
+}
\ No newline at end of file
diff --git a/compiler/plugin/maven/src/test/resources/file1UsesFile2TypeDefFile3Type/ietf-inet-types.yang b/compiler/plugin/maven/src/test/resources/file1UsesFile2TypeDefFile3Type/ietf-inet-types.yang
new file mode 100644
index 0000000..db6df27
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/file1UsesFile2TypeDefFile3Type/ietf-inet-types.yang
@@ -0,0 +1,12 @@
+  module ietf-inet-types {
+
+    yang-version 1;
+
+    namespace
+      "urn:ietf:params:xml:ns:yang:ietf-inet-types";
+
+    prefix inet;
+    typedef uri {
+      type string;
+    }
+  }  
diff --git a/compiler/plugin/maven/src/test/resources/file1UsesFile2TypeDefFile3Type/ietf-network-topology.yang b/compiler/plugin/maven/src/test/resources/file1UsesFile2TypeDefFile3Type/ietf-network-topology.yang
new file mode 100644
index 0000000..4f426e4
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/file1UsesFile2TypeDefFile3Type/ietf-network-topology.yang
@@ -0,0 +1,34 @@
+ module ietf-network-topology {
+   yang-version 1;
+   namespace "urn:ietf:params:xml:ns:yang:ietf-network-topology";
+   prefix lnk;
+
+   import ietf-inet-types {
+     prefix inet;
+   }
+   
+   typedef tp-id {
+     type inet:uri;
+     description
+       "An identifier for termination points on a node.
+        The identifier SHOULD be chosen such that the same TP in a
+        real network topology will always be identified through the
+        same identifier, even if the model is instantiated in
+        separate datastores. An implementation MAY choose to capture
+        semantics in the identifier, for example to indicate the type
+        of TP and/or the type of node and topology that the TP is a
+        part of.";
+   }
+
+   grouping tp-ref {
+     description
+       "References a termination point in a specific node.";
+     leaf tp-ref {
+       type tp-id;
+       description
+         "A type for an absolute reference to a termination point.
+          (This type should not be used for relative references.
+          In such a case, a relative path should be used instead.)";
+     }
+   }
+ }
diff --git a/compiler/plugin/maven/src/test/resources/file1UsesFile2TypeDefFile3Type/ietf-te-topology.yang b/compiler/plugin/maven/src/test/resources/file1UsesFile2TypeDefFile3Type/ietf-te-topology.yang
new file mode 100644
index 0000000..c1d9324
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/file1UsesFile2TypeDefFile3Type/ietf-te-topology.yang
@@ -0,0 +1,17 @@
+   module ietf-te-topology {
+     yang-version 1;
+     namespace "urn:ietf:params:xml:ns:yang:ietf-te-topology";
+     // replace with IANA namespace when assigned
+
+     prefix "tet";
+
+     import ietf-network-topology {
+       prefix "nt";
+     }
+
+     container underlay-trail-src {
+         uses nt:tp-ref;
+         description
+           "Source TE link of the underlay trail.";
+       }
+   }
diff --git a/compiler/plugin/maven/src/test/resources/grouping/grouping.yang b/compiler/plugin/maven/src/test/resources/grouping/grouping.yang
new file mode 100644
index 0000000..518150f
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/grouping/grouping.yang
@@ -0,0 +1,58 @@
+module grouping {
+
+  namespace "yang:grouping";
+  prefix "grouping";
+  yang-version 1;
+  revision 2016-10-08;
+
+  grouping link-details {
+      leaf link-id {
+          type union {
+              type int32;
+              type uint16;
+              type enumeration {
+                   enum one;
+                   enum two;
+                   enum five {
+                      value 5;
+                   }
+                   enum six-square {
+                      value 36;
+                   }
+              }
+          }
+      }
+      typedef group {
+          type bits {
+              bit disable-nagle {
+                  position 0;
+                           }
+              bit auto-sense-speed {
+                  position 1;
+              }
+              bit Mb-only {
+                  position 2;
+              }
+          }
+      }
+      container link {
+          leaf port {
+            type int32;
+          }
+  
+          leaf-list port-id {
+              type string;
+          }
+          list areas {
+             key "name1";
+             leaf name1 {
+              type string;
+             }
+          }
+      }
+  }
+
+  container cont2 {
+       uses link-details;
+  }
+}
diff --git a/compiler/plugin/maven/src/test/resources/groupingNodeSameAsModule/portpair.yang b/compiler/plugin/maven/src/test/resources/groupingNodeSameAsModule/portpair.yang
new file mode 100644
index 0000000..3497f04
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/groupingNodeSameAsModule/portpair.yang
@@ -0,0 +1,29 @@
+module port-pair {
+
+    yang-version 1;
+
+    namespace "sfc.portpair";
+
+    prefix "port-pair";
+   
+     grouping port-pair {
+        container  port-pair {
+
+        	leaf name {
+           	    type string;
+        	}
+
+        	
+        	leaf description {
+            	    type string;
+        	}
+
+   	}
+    }
+   
+    rpc get-port-pair {
+      output {
+          uses port-pair;
+      }
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/hierarchicalinterfiletype/ietf-inet-types.yang b/compiler/plugin/maven/src/test/resources/hierarchicalinterfiletype/ietf-inet-types.yang
new file mode 100644
index 0000000..38f209f
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/hierarchicalinterfiletype/ietf-inet-types.yang
@@ -0,0 +1,15 @@
+  module ietf-inet-types {
+
+    yang-version 1;
+
+    namespace
+      "urn:ietf:params:xml:ns:yang:ietf-inet-types";
+
+    prefix inet;
+
+
+
+    typedef uri {
+      type string;
+    }
+  }
diff --git a/compiler/plugin/maven/src/test/resources/hierarchicalinterfiletype/ietf-network-topology.yang b/compiler/plugin/maven/src/test/resources/hierarchicalinterfiletype/ietf-network-topology.yang
new file mode 100644
index 0000000..6e9dfb7
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/hierarchicalinterfiletype/ietf-network-topology.yang
@@ -0,0 +1,17 @@
+ module ietf-network-topology {
+   yang-version 1;
+   namespace "urn:ietf:params:xml:ns:yang:ietf-network-topology";
+   prefix nt;
+
+   import ietf-inet-types {
+     prefix inet;
+   }
+   import ietf-network {
+     prefix nd;
+   }
+         leaf source-node {
+           type nd:node-id;
+           description
+             "Source node identifier, must be in same topology.";
+         }
+ }
diff --git a/compiler/plugin/maven/src/test/resources/hierarchicalinterfiletype/ietf-network.yang b/compiler/plugin/maven/src/test/resources/hierarchicalinterfiletype/ietf-network.yang
new file mode 100644
index 0000000..1f15b40
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/hierarchicalinterfiletype/ietf-network.yang
@@ -0,0 +1,16 @@
+   module ietf-network {
+     yang-version 1;
+     namespace "urn:ietf:params:xml:ns:yang:ietf-network";
+     prefix nd;
+
+     import ietf-inet-types {
+       prefix inet;
+     }
+
+    typedef node-id {
+       type inet:uri;
+       description
+         "Identifier for a node.";
+     }
+
+   }
diff --git a/compiler/plugin/maven/src/test/resources/hierarchicalintrawithinterfiletype/ietf-inet-types.yang b/compiler/plugin/maven/src/test/resources/hierarchicalintrawithinterfiletype/ietf-inet-types.yang
new file mode 100644
index 0000000..48d13c6
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/hierarchicalintrawithinterfiletype/ietf-inet-types.yang
@@ -0,0 +1,13 @@
+  module ietf-inet-types {
+
+    yang-version 1;
+
+    namespace
+      "urn:ietf:params:xml:ns:yang:ietf-inet-types";
+
+    prefix inet;
+
+    typedef uri {
+      type string;
+    }
+  }
diff --git a/compiler/plugin/maven/src/test/resources/hierarchicalintrawithinterfiletype/ietf-network.yang b/compiler/plugin/maven/src/test/resources/hierarchicalintrawithinterfiletype/ietf-network.yang
new file mode 100644
index 0000000..e35d0f5
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/hierarchicalintrawithinterfiletype/ietf-network.yang
@@ -0,0 +1,22 @@
+   module ietf-network {
+     yang-version 1;
+     namespace "urn:ietf:params:xml:ns:yang:ietf-network";
+     prefix nd;
+
+     import ietf-inet-types {
+       prefix inet;
+     }
+       leaf node-ref {
+         type node-id;
+         description
+           "Used to reference a node.
+            Nodes are identified relative to the network they are
+            contained in.";
+       }
+
+    typedef node-id {
+       type inet:uri;
+       description
+         "Identifier for a node.";
+     }
+   }
diff --git a/compiler/plugin/maven/src/test/resources/identityRef/identityRef.yang b/compiler/plugin/maven/src/test/resources/identityRef/identityRef.yang
new file mode 100644
index 0000000..a7389e7
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/identityRef/identityRef.yang
@@ -0,0 +1,19 @@
+module IdentityTest{
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix IdentityTest;
+
+    identity ref-address-family {
+        description "ref-address-family";
+    }
+
+    identity ipv4-address-family {
+        base ref-address-family;
+    }
+
+    leaf tunnel {
+        type identityref {
+            base ref-address-family;
+        }
+    }
+}
\ No newline at end of file
diff --git a/compiler/plugin/maven/src/test/resources/identityTranslator/test.yang b/compiler/plugin/maven/src/test/resources/identityTranslator/test.yang
new file mode 100644
index 0000000..f4f61bd
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/identityTranslator/test.yang
@@ -0,0 +1,81 @@
+module IdentityTest{
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix IdentityTest;
+
+    identity ref-address-family {
+        description "ref-address-family";
+    }
+
+    identity ipv4-address-family {
+        base ref-address-family;
+    }
+
+    identity ipv6-address-family {
+        base ipv4-address-family;
+    }
+
+    typedef tunnel-type {
+        type identityref {
+            base ref-address-family;
+        }
+    }
+    leaf tunnel1 {
+        type identityref {
+            base ipv4-address-family;
+        }
+    }
+
+    typedef type2 {
+       type identityref {
+            base ipv4-address-family;
+        }
+    }
+
+    container ip {
+    container ipv4-address-family {
+    leaf tunnel1 {
+            type identityref {
+                base ipv4-address-family;
+            }
+        }
+    }
+    }
+
+    typedef type3 {
+    type union {
+                type type2;
+                type identityref {
+                     base ipv4-address-family;
+                }
+            }
+    }
+    leaf tunnel {
+        type union {
+            type type2;
+            type identityref {
+                 base ipv6-address-family;
+            }
+        }
+    }
+ typedef ipv4-address {
+      type string {
+        pattern
+          '(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(%[\p{N}\p{L}]+)?';
+      }
+      description
+        "The ipv4-address type represents an IPv4 address in
+       dotted-quad notation.  The IPv4 address may include a zone
+       index, separated by a % sign.
+
+       The zone index is used to disambiguate identical address
+       values.  For link-local addresses, the zone index will
+       typically be the interface index number or the name of an
+       interface.  If the zone index is not present, the default
+       zone of the device will be used.
+
+       The canonical format for the zone index is the numerical
+       format";
+    }
+
+}
diff --git a/compiler/plugin/maven/src/test/resources/ietfyang/l3vpnservice/ietf-inet-types.yang b/compiler/plugin/maven/src/test/resources/ietfyang/l3vpnservice/ietf-inet-types.yang
new file mode 100644
index 0000000..851a4d7
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/ietfyang/l3vpnservice/ietf-inet-types.yang
@@ -0,0 +1,454 @@
+  module ietf-inet-types {
+
+    yang-version 1;
+
+    namespace
+      "urn:ietf:params:xml:ns:yang:ietf-inet-types";
+
+    prefix inet;
+
+    organization
+      "IETF NETMOD (NETCONF Data Modeling Language) Working Group";
+
+    contact
+      "WG Web:   <http://tools.ietf.org/wg/netmod/>
+    WG List:  <mailto:netmod@ietf.org>
+
+    WG Chair: David Kessens
+              <mailto:david.kessens@nsn.com>
+
+    WG Chair: Juergen Schoenwaelder
+              <mailto:j.schoenwaelder@jacobs-university.de>
+
+    Editor:   Juergen Schoenwaelder
+              <mailto:j.schoenwaelder@jacobs-university.de>";
+
+    description
+      "This module contains a collection of generally useful derived
+    YANG data types for Internet addresses and related things.
+
+    Copyright (c) 2013 IETF Trust and the persons identified as
+    authors of the code.  All rights reserved.
+
+    Redistribution and use in source and binary forms, with or
+    without modification, is permitted pursuant to, and subject
+    to the license terms contained in, the Simplified BSD License
+    set forth in Section 4.c of the IETF Trust's Legal Provisions
+    Relating to IETF Documents
+    (http://trustee.ietf.org/license-info).
+
+    This version of this YANG module is part of RFC 6991; see
+    the RFC itself for full legal notices.";
+
+    revision "2013-07-15" {
+      description
+        "This revision adds the following new data types:
+      - ip-address-no-zone
+      - ipv4-address-no-zone
+      - ipv6-address-no-zone";
+      reference
+        "RFC 6991: Common YANG Data Types";
+
+    }
+
+    revision "2010-09-24" {
+      description "Initial revision.";
+      reference
+        "RFC 6021: Common YANG Data Types";
+
+    }
+
+
+    typedef ip-version {
+      type enumeration {
+        enum "unknown" {
+          value 0;
+          description
+            "An unknown or unspecified version of the Internet
+          protocol.";
+        }
+        enum "ipv4" {
+          value 1;
+          description
+            "The IPv4 protocol as defined in RFC 791.";
+        }
+        enum "ipv6" {
+          value 2;
+          description
+            "The IPv6 protocol as defined in RFC 2460.";
+        }
+      }
+      description
+        "This value represents the version of the IP protocol.
+
+      In the value set and its semantics, this type is equivalent
+      to the InetVersion textual convention of the SMIv2.";
+      reference
+        "RFC  791: Internet Protocol
+         RFC 2460: Internet Protocol, Version 6 (IPv6) Specification
+         RFC 4001: Textual Conventions for Internet Network Addresses";
+
+    }
+
+    typedef dscp {
+      type uint8 {
+        range "0..63";
+      }
+      description
+        "The dscp type represents a Differentiated Services Code Point
+      that may be used for marking packets in a traffic stream.
+      In the value set and its semantics, this type is equivalent
+      to the Dscp textual convention of the SMIv2.";
+      reference
+        "RFC 3289: Management Information Base for the Differentiated
+              Services Architecture
+         RFC 2474: Definition of the Differentiated Services Field
+              (DS Field) in the IPv4 and IPv6 Headers
+         RFC 2780: IANA Allocation Guidelines For Values In
+              the Internet Protocol and Related Headers";
+
+    }
+
+    typedef ipv6-flow-label {
+      type uint32 {
+        range "0..1048575";
+      }
+      description
+        "The ipv6-flow-label type represents the flow identifier or Flow
+      Label in an IPv6 packet header that may be used to
+      discriminate traffic flows.
+
+      In the value set and its semantics, this type is equivalent
+      to the IPv6FlowLabel textual convention of the SMIv2.";
+      reference
+        "RFC 3595: Textual Conventions for IPv6 Flow Label
+         RFC 2460: Internet Protocol, Version 6 (IPv6) Specification";
+
+    }
+
+    typedef port-number {
+      type uint16 {
+        range "0..65535";
+      }
+      description
+        "The port-number type represents a 16-bit port number of an
+      Internet transport-layer protocol such as UDP, TCP, DCCP, or
+      SCTP.  Port numbers are assigned by IANA.  A current list of
+      all assignments is available from <http://www.iana.org/>.
+
+      Note that the port number value zero is reserved by IANA.  In
+      situations where the value zero does not make sense, it can
+      be excluded by subtyping the port-number type.
+      In the value set and its semantics, this type is equivalent
+      to the InetPortNumber textual convention of the SMIv2.";
+      reference
+        "RFC  768: User Datagram Protocol
+         RFC  793: Transmission Control Protocol
+         RFC 4960: Stream Control Transmission Protocol
+         RFC 4340: Datagram Congestion Control Protocol (DCCP)
+         RFC 4001: Textual Conventions for Internet Network Addresses";
+
+    }
+
+    typedef as-number {
+      type uint32;
+      description
+        "The as-number type represents autonomous system numbers
+      which identify an Autonomous System (AS).  An AS is a set
+      of routers under a single technical administration, using
+      an interior gateway protocol and common metrics to route
+      packets within the AS, and using an exterior gateway
+      protocol to route packets to other ASes.  IANA maintains
+      the AS number space and has delegated large parts to the
+      regional registries.
+
+      Autonomous system numbers were originally limited to 16
+      bits.  BGP extensions have enlarged the autonomous system
+      number space to 32 bits.  This type therefore uses an uint32
+      base type without a range restriction in order to support
+      a larger autonomous system number space.
+
+      In the value set and its semantics, this type is equivalent
+      to the InetAutonomousSystemNumber textual convention of
+      the SMIv2.";
+      reference
+        "RFC 1930: Guidelines for creation, selection, and registration
+              of an Autonomous System (AS)
+         RFC 4271: A Border Gateway Protocol 4 (BGP-4)
+         RFC 4001: Textual Conventions for Internet Network Addresses
+         RFC 6793: BGP Support for Four-Octet Autonomous System (AS)
+              Number Space";
+
+    }
+
+    typedef ip-address {
+      type union {
+        type ipv4-address;
+        type ipv6-address;
+      }
+      description
+        "The ip-address type represents an IP address and is IP
+      version neutral.  The format of the textual representation
+      implies the IP version.  This type supports scoped addresses
+      by allowing zone identifiers in the address format.";
+      reference
+        "RFC 4007: IPv6 Scoped Address Architecture";
+
+    }
+
+    typedef ipv4-address {
+      type string {
+        pattern
+          '(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(%[\p{N}\p{L}]+)?';
+      }
+      description
+        "The ipv4-address type represents an IPv4 address in
+       dotted-quad notation.  The IPv4 address may include a zone
+       index, separated by a % sign.
+
+       The zone index is used to disambiguate identical address
+       values.  For link-local addresses, the zone index will
+       typically be the interface index number or the name of an
+       interface.  If the zone index is not present, the default
+       zone of the device will be used.
+
+       The canonical format for the zone index is the numerical
+       format";
+    }
+
+    typedef ipv6-address {
+      type string {
+        pattern
+          '((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))(%[\p{N}\p{L}]+)?';
+        pattern
+          '(([^:]+:){6}(([^:]+:[^:]+)|(.*\..*)))|((([^:]+:)*[^:]+)?::(([^:]+:)*[^:]+)?)(%.+)?';
+      }
+      description
+        "The ipv6-address type represents an IPv6 address in full,
+      mixed, shortened, and shortened-mixed notation.  The IPv6
+      address may include a zone index, separated by a % sign.
+
+      The zone index is used to disambiguate identical address
+      values.  For link-local addresses, the zone index will
+      typically be the interface index number or the name of an
+      interface.  If the zone index is not present, the default
+      zone of the device will be used.
+
+
+
+      The canonical format of IPv6 addresses uses the textual
+      representation defined in Section 4 of RFC 5952.  The
+      canonical format for the zone index is the numerical
+      format as described in Section 11.2 of RFC 4007.";
+      reference
+        "RFC 4291: IP Version 6 Addressing Architecture
+         RFC 4007: IPv6 Scoped Address Architecture
+         RFC 5952: A Recommendation for IPv6 Address Text
+              Representation";
+
+    }
+
+    typedef ip-address-no-zone {
+      type union {
+        type ipv4-address-no-zone;
+        type ipv6-address-no-zone;
+      }
+      description
+        "The ip-address-no-zone type represents an IP address and is
+      IP version neutral.  The format of the textual representation
+      implies the IP version.  This type does not support scoped
+      addresses since it does not allow zone identifiers in the
+      address format.";
+      reference
+        "RFC 4007: IPv6 Scoped Address Architecture";
+
+    }
+
+    typedef ipv4-address-no-zone {
+      type ipv4-address {
+        pattern '[0-9\.]*';
+      }
+      description
+        "An IPv4 address without a zone index.  This type, derived from
+       ipv4-address, may be used in situations where the zone is
+       known from the context and hence no zone index is needed.";
+    }
+
+    typedef ipv6-address-no-zone {
+      type ipv6-address {
+        pattern '[0-9a-fA-F:\.]*';
+      }
+      description
+        "An IPv6 address without a zone index.  This type, derived from
+       ipv6-address, may be used in situations where the zone is
+       known from the context and hence no zone index is needed.";
+      reference
+        "RFC 4291: IP Version 6 Addressing Architecture
+         RFC 4007: IPv6 Scoped Address Architecture
+         RFC 5952: A Recommendation for IPv6 Address Text
+              Representation";
+
+    }
+
+    typedef ip-prefix {
+      type union {
+        type ipv4-prefix;
+        type ipv6-prefix;
+      }
+      description
+        "The ip-prefix type represents an IP prefix and is IP
+      version neutral.  The format of the textual representations
+      implies the IP version.";
+    }
+
+    typedef ipv4-prefix {
+      type string {
+        pattern
+          '(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])/(([0-9])|([1-2][0-9])|(3[0-2]))';
+      }
+      description
+        "The ipv4-prefix type represents an IPv4 address prefix.
+      The prefix length is given by the number following the
+      slash character and must be less than or equal to 32.
+
+      A prefix length value of n corresponds to an IP address
+      mask that has n contiguous 1-bits from the most
+      significant bit (MSB) and all other bits set to 0.
+
+      The canonical format of an IPv4 prefix has all bits of
+      the IPv4 address set to zero that are not part of the
+      IPv4 prefix.";
+    }
+
+    typedef ipv6-prefix {
+      type string {
+        pattern
+          '((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))(/(([0-9])|([0-9]{2})|(1[0-1][0-9])|(12[0-8])))';
+        pattern
+          '(([^:]+:){6}(([^:]+:[^:]+)|(.*\..*)))|((([^:]+:)*[^:]+)?::(([^:]+:)*[^:]+)?)(/.+)';
+      }
+      description
+        "The ipv6-prefix type represents an IPv6 address prefix.
+      The prefix length is given by the number following the
+      slash character and must be less than or equal to 128.
+
+      A prefix length value of n corresponds to an IP address
+      mask that has n contiguous 1-bits from the most
+      significant bit (MSB) and all other bits set to 0.
+
+      The IPv6 address should have all bits that do not belong
+      to the prefix set to zero.
+
+      The canonical format of an IPv6 prefix has all bits of
+      the IPv6 address set to zero that are not part of the
+      IPv6 prefix.  Furthermore, the IPv6 address is represented
+      as defined in Section 4 of RFC 5952.";
+      reference
+        "RFC 5952: A Recommendation for IPv6 Address Text
+              Representation";
+
+    }
+
+    typedef domain-name {
+      type string {
+        length "1..253";
+        pattern
+          '((([a-zA-Z0-9_]([a-zA-Z0-9\-_]){0,61})?[a-zA-Z0-9]\.)*([a-zA-Z0-9_]([a-zA-Z0-9\-_]){0,61})?[a-zA-Z0-9]\.?)|\.';
+      }
+      description
+        "The domain-name type represents a DNS domain name.  The
+      name SHOULD be fully qualified whenever possible.
+
+      Internet domain names are only loosely specified.  Section
+      3.5 of RFC 1034 recommends a syntax (modified in Section
+      2.1 of RFC 1123).  The pattern above is intended to allow
+      for current practice in domain name use, and some possible
+      future expansion.  It is designed to hold various types of
+      domain names, including names used for A or AAAA records
+      (host names) and other records, such as SRV records.  Note
+      that Internet host names have a stricter syntax (described
+      in RFC 952) than the DNS recommendations in RFCs 1034 and
+      1123, and that systems that want to store host names in
+      schema nodes using the domain-name type are recommended to
+      adhere to this stricter standard to ensure interoperability.
+
+      The encoding of DNS names in the DNS protocol is limited
+      to 255 characters.  Since the encoding consists of labels
+      prefixed by a length bytes and there is a trailing NULL
+      byte, only 253 characters can appear in the textual dotted
+      notation.
+
+      The description clause of schema nodes using the domain-name
+      type MUST describe when and how these names are resolved to
+      IP addresses.  Note that the resolution of a domain-name value
+      may require to query multiple DNS records (e.g., A for IPv4
+      and AAAA for IPv6).  The order of the resolution process and
+      which DNS record takes precedence can either be defined
+      explicitly or may depend on the configuration of the
+      resolver.
+
+      Domain-name values use the US-ASCII encoding.  Their canonical
+      format uses lowercase US-ASCII characters.  Internationalized
+      domain names MUST be A-labels as per RFC 5890.";
+      reference
+        "RFC  952: DoD Internet Host Table Specification
+         RFC 1034: Domain Names - Concepts and Facilities
+         RFC 1123: Requirements for Internet Hosts -- Application
+              and Support
+         RFC 2782: A DNS RR for specifying the location of services
+              (DNS SRV)
+         RFC 5890: Internationalized Domain Names in Applications
+              (IDNA): Definitions and Document Framework";
+
+    }
+
+    typedef host {
+      type union {
+        type ip-address;
+        type domain-name;
+      }
+      description
+        "The host type represents either an IP address or a DNS
+      domain name.";
+    }
+
+    typedef uri {
+      type string;
+      description
+        "The uri type represents a Uniform Resource Identifier
+      (URI) as defined by STD 66.
+
+      Objects using the uri type MUST be in US-ASCII encoding,
+      and MUST be normalized as described by RFC 3986 Sections
+      6.2.1, 6.2.2.1, and 6.2.2.2.  All unnecessary
+      percent-encoding is removed, and all case-insensitive
+      characters are set to lowercase except for hexadecimal
+      digits, which are normalized to uppercase as described in
+      Section 6.2.2.1.
+
+      The purpose of this normalization is to help provide
+      unique URIs.  Note that this normalization is not
+      sufficient to provide uniqueness.  Two URIs that are
+      textually distinct after this normalization may still be
+      equivalent.
+
+      Objects using the uri type may restrict the schemes that
+      they permit.  For example, 'data:' and 'urn:' schemes
+      might not be appropriate.
+
+      A zero-length URI is not a valid URI.  This can be used to
+      express 'URI absent' where required.
+
+      In the value set and its semantics, this type is equivalent
+      to the Uri SMIv2 textual convention defined in RFC 5017.";
+      reference
+        "RFC 3986: Uniform Resource Identifier (URI): Generic Syntax
+         RFC 3305: Report from the Joint W3C/IETF URI Planning Interest
+              Group: Uniform Resource Identifiers (URIs), URLs,
+              and Uniform Resource Names (URNs): Clarifications
+              and Recommendations
+         RFC 5017: MIB Textual Conventions for Uniform Resource
+              Identifiers (URIs)";
+
+    }
+  }  // module ietf-inet-types
diff --git a/compiler/plugin/maven/src/test/resources/ietfyang/l3vpnservice/ietf-sd-onos-common-types.yang b/compiler/plugin/maven/src/test/resources/ietfyang/l3vpnservice/ietf-sd-onos-common-types.yang
new file mode 100644
index 0000000..7cde2ec
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/ietfyang/l3vpnservice/ietf-sd-onos-common-types.yang
@@ -0,0 +1,141 @@
+   module ietf-sd-onos-common-types {
+     namespace "urn:ietf:params:xml:ns:yang:ietf-sd-onos-common-types";
+     prefix types ;
+     /*
+     import ietf-inet-types{
+        prefix inet;
+        }
+     import ietf-yang-types {
+       prefix yang-types;
+       }
+     */
+     organization "";
+     contact "";
+
+     description
+       "Defines common basic types of L3VPN.";
+
+     revision "2015-12-16" {
+       reference "";
+     }
+
+     typedef admin-status {
+       type enumeration {
+         enum admin-up {
+           value 0 ;
+           description "admin up, the operate-status is depend on the real
+   running status ." ;
+         }
+         enum admin-down {
+           value 1 ;
+           description "admin down,the operate-status is forced to down no
+   matter what the real status is" ;
+         }
+         enum config-up {
+           value 2 ;
+           description "the operate-status is forced to up no matter what
+   the real status is." ;
+         }
+       }
+       default admin-up;
+       description
+         "The administration status of the service.";
+     }
+
+     typedef notification-status {
+       type enumeration {
+         enum up {
+           value 0 ;
+           description "up." ;
+         }
+         enum down {
+           value 1 ;
+           description "down." ;
+         }
+       }
+       default up;
+       description
+         "The notification status of the service.";
+     }
+
+     typedef notification-type {
+       type enumeration {
+         enum ne{
+           value 0 ;
+           description "ncd change." ;
+         }
+         enum link{
+           value 1 ;
+           description "link change." ;
+         }
+         enum ltp{
+           value 2 ;
+           description "ltp change." ;
+         }
+       }
+       default ltp;
+       description
+         "The notification-type of the service.";
+     }
+
+     typedef operate-status {
+       type enumeration {
+         enum operate-up {
+           value 0 ;
+           description "operate up." ;
+         }
+         enum operate-down {
+           value 1 ;
+           description "operate down." ;
+         }
+       }
+       default operate-up;
+       description
+         "The operation status of the service.";
+     }
+
+      grouping command-result {
+         description
+           "Reusable container of the result of the command.";
+        container command-result {
+           description
+             "The result of the command.";
+          leaf result {
+             type int8;
+             description
+               "1 : success, 2 : failed, 3 : partly failed" ;
+         }
+         container success-resources {
+           description
+             "The resources those are available." ;
+           list success-resource-list {
+             description
+               "The resource list shows those are available." ;
+             leaf resource-id {
+               type string;
+               description
+                 "The available resource id." ;
+             }
+           }
+         }
+         container failed-resources {
+           description
+             "The resources those are failed." ;
+           list failed-resource-list {
+             description
+               "The resources list shows those are failed." ;
+             leaf resource-id {
+               type string;
+               description
+                 "The failed resources ids." ;
+             }
+             leaf error-code {
+               type string;
+               description
+                 "The error code." ;
+             }
+           }
+         }
+       }
+     }
+   }
diff --git a/compiler/plugin/maven/src/test/resources/ietfyang/l3vpnservice/ietf-sd-onos-service-l3vpn.yang b/compiler/plugin/maven/src/test/resources/ietfyang/l3vpnservice/ietf-sd-onos-service-l3vpn.yang
new file mode 100644
index 0000000..7b55f71
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/ietfyang/l3vpnservice/ietf-sd-onos-service-l3vpn.yang
@@ -0,0 +1,316 @@
+   module ietf-sd-onos-service-l3vpn {
+     namespace "urn:ietf:params:xml:ns:yang:ietf-sd-onos-service-l3vpn";
+     prefix l3vpn ;
+     /*
+     import ietf-inet-types{
+       prefix inet;
+     }
+     import ietf-yang-types {
+       prefix yang-types;
+     }
+     */
+     import ietf-sd-onos-service-types {
+       prefix service-types;
+     }
+     import ietf-sd-onos-common-types {
+       prefix types;
+     }
+     organization "";
+     contact "";
+
+     description
+       "L3vpn configuration model in ONOS.";
+
+     revision "2015-12-16" {
+       reference "";
+     }
+
+      grouping l3vpn {
+       description
+         "The configuration module of l3 vpn.";
+       leaf name {
+         type string ;
+         mandatory true;
+         description "name of snc eline." ;
+       }
+       leaf id {
+         type uint32 ;
+         mandatory true;
+         description "ID of snc eline." ;
+       }
+       leaf user-label {
+         type string ;
+         description "user label of snc eline." ;
+       }
+       leaf parent-ncd-id {
+         type string ;
+         description "parent ncd id." ;
+       }
+
+       leaf admin-status {
+         type types:admin-status;
+         description "administration status." ;
+       }
+       leaf operate-status {
+         type types:operate-status;
+         description "operation status." ;
+       }
+
+       uses service-type-grouping;
+       container acess-information {
+              description "access information of the l3 vpn." ;
+
+           uses service-types:l3-ac;        }
+
+       container protect-policy{
+         description "L3VPN Service protect policy." ;
+         uses service-types:protect-policy;
+       }
+       container tunnel-service {
+         description "tunnel service." ;
+         uses service-types:tunnel-service;
+       }
+
+     }
+
+     grouping service-type-grouping {
+       description "Basic service type" ;
+       leaf service-topology {
+         type enumeration {
+           enum full-mesh {
+             value 1 ;
+             description "full-mesh." ;
+           }
+           enum hub-spoke {
+             value 2 ;
+             description "hub-spoke." ;
+           }
+         }
+         default full-mesh;
+         description "service topology type." ;
+       }
+     }
+
+     container service {
+       description
+         "Root level of L3vpn service module.";
+       container l3vpn-cfg {
+         description
+           "L3vpn configuration model in ONOS.";
+         list vpn-cfg {
+           key name;
+           description
+             "vpn configuration parameter list.";
+           uses l3vpn;
+         }
+       }
+       container service-paths {
+         description
+           "The service path of the l3 vpn.";
+       }
+     }
+
+
+
+     rpc create-l3vpn-instance {
+       description "Create l3vpn instance." ;
+       input {
+         container l3vpn-instance {
+           description "Create l3vpn instance." ;
+           uses l3vpn;
+         }
+       }
+     }
+
+     rpc delete-l3vpn-instance {
+       description "Delete l3vpn instance." ;
+       input {
+         leaf l3vpn-id {
+           type string;
+           description "vpn id." ;
+         }
+       }
+     }
+
+     rpc close-l3vpn {
+     description "Close l3vpn." ;
+         input {
+             leaf l3vpn-id {
+                 type string;
+           description "vpn id." ;
+             }
+             container ac-status {
+           description "Access status of the vpn." ;
+                 list acs{
+                     key "id";
+             description "Access information." ;
+                     leaf id {
+                         type string;
+               description "Access id." ;
+                     }
+                     leaf admin-status {
+                         type types:admin-status;
+               description "Administration status." ;
+                     }
+                 }
+             }
+         }
+     }
+
+     rpc modify-l3vpn-instance-basic {
+       description "Modify l3vpn instance basic information." ;
+       input {
+         leaf l3vpn-id {
+           type string;
+           description "vpn id." ;
+         }
+         leaf user-label {
+           type string ;
+           description "user label." ;
+         }
+       }
+     }
+
+     rpc modify-l3vpn-instance-ac-qos {
+       description "Modify l3vpn instance ac qos information." ;
+       input {
+         leaf l3vpn-id {
+           type string;
+           description "L3vpn ID." ;
+         }
+         container ac-qos {
+           description "ac qos information." ;
+           list acs{
+           key "id";
+           description "acs list." ;
+                 leaf id {
+                   type string;
+                   description "acs ID." ;
+               }
+               container qos-policy {
+             description "qos policy." ;
+                   container qos-if-cars {
+               description "cars qos policy." ;
+                          uses service-types:qos-if-car;
+
+                   }
+               }
+           }
+         }
+       }
+     }
+     rpc modify-l3vpn-instance-connection {
+       description "Modify a l3vpn connection." ;
+       input {
+         leaf l3vpn-id {
+           type string;
+           description "L3vpn ID." ;
+         }
+         container ac-connection {
+           description "ac connection." ;
+           list acs{
+             key "id";
+             description "acs ID." ;
+             leaf id {
+               type string ;
+               description "acs ID." ;
+             }
+             container connection {
+               description "CE to PE  connection." ;
+               uses service-types:connection;
+             }
+           }
+         }
+       }
+     }
+     rpc inquire-l3vpn-instance-work-path {
+       description "Inquire a L3VPN instance work path." ;
+        input {
+              leaf service-id {
+                type string;
+             description "service ID." ;
+              }
+               leaf ingress-ne-id {
+                 type string ;
+              description "ingress network element ID." ;
+               }
+               leaf destination-ne-id {
+                 type string ;
+              description "destination network element ID." ;
+               }
+               leaf ingress-ac-id {
+                 type string ;
+              description "ingress ac ID." ;
+               }
+               leaf destination-ac-id {
+                 type string ;
+              description "destination ac ID." ;
+               }
+               leaf path-layer {
+                  type string ;
+               description "path layer." ;
+               }
+               leaf path-role {
+                  type string ;
+             description "path role." ;
+               }
+       }
+       output {
+           container service-path {
+            description "service path." ;
+              leaf service-id {
+                type string;
+             description "service ID." ;
+              }
+               leaf ingress-ne-id {
+                 type string ;
+              description "ingress network element ID." ;
+               }
+               leaf destination-ne-id {
+                 type string ;
+               description "destination network element ID." ;
+               }
+               leaf ingress-ac-id {
+                 type string ;
+              description "ingress access circuit ID." ;
+               }
+               leaf destination-ac-id {
+                 type string ;
+              description "destination access circuit ID." ;
+               }
+               leaf path-layer {
+                  type string ;
+               description "path layer." ;
+               }
+               leaf path-role {
+                  type string ;
+               description "path role." ;
+               }
+               list path-list {
+                   key "ne-id";
+             description "path list." ;
+                   leaf ne-id {
+                      type string;
+              description "network element ID." ;
+                   }
+                   leaf ingress-ltp-id {
+                      type string;
+              description "LTP ID." ;
+                   }
+                   leaf backward-peer-id {
+                      type string;
+              description "backward peer ID." ;
+                   }
+                   leaf egress-ltp-id {
+                      type string;
+              description "egress ltp ID." ;
+                   }
+                   leaf forward-peer-id {
+                      type string;
+              description "forward peer ID." ;
+                   }
+               }
+             }
+       }
+     }
+   }
diff --git a/compiler/plugin/maven/src/test/resources/ietfyang/l3vpnservice/ietf-sd-onos-service-types.yang b/compiler/plugin/maven/src/test/resources/ietfyang/l3vpnservice/ietf-sd-onos-service-types.yang
new file mode 100644
index 0000000..7fd7700
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/ietfyang/l3vpnservice/ietf-sd-onos-service-types.yang
@@ -0,0 +1,816 @@
+   module ietf-sd-onos-service-types {
+       namespace "urn:ietf:params:xml:ns:yang:ietf-sd-onos-service-types";
+       prefix service-types ;
+
+       import ietf-inet-types {prefix inet; }
+       import ietf-sd-onos-common-types {prefix  types;}
+
+     organization "";
+     contact "";
+
+     description
+       "Defines basic service types for L3VPN service.";
+
+     revision "2015-12-16" {
+       reference "";
+     }
+
+       typedef exp {
+           type enumeration {
+               enum BE {
+                   value 0 ;
+                   description "BE." ;
+               }
+               enum AF1 {
+                   value 1 ;
+                   description "AF1." ;
+               }
+               enum AF2 {
+                   value 2 ;
+                   description "AF2." ;
+               }
+               enum AF3 {
+                   value 3 ;
+                   description "AF3." ;
+               }
+               enum AF4 {
+                   value 4 ;
+                   description "AF4." ;
+               }
+               enum EF {
+                   value 5 ;
+                   description "EF." ;
+               }
+               enum CS6 {
+                   value 6 ;
+                   description "CS6." ;
+               }
+               enum CS7 {
+                   value 7 ;
+                   description "CS7." ;
+               }
+           }
+           default CS7;
+           description
+             "exp parameter.";
+       }
+
+       typedef pw-role{
+           type enumeration {
+               enum normal{
+                   value 0 ;
+                   description "normal." ;
+               }
+               enum master {
+                   value 1 ;
+                   description "master." ;
+               }
+               enum slave {
+                   value 2 ;
+                   description "slave." ;
+               }
+               enum DNI-PW {
+                   value 3 ;
+                   description "DNI PW." ;
+               }
+           }
+           default normal;
+           description
+             "The role of the PW.";
+       }
+
+       grouping qos-if-car {
+           description "qos parameter." ;
+         list qos-if-car {
+       key "direction";
+           description "cars qos policy." ;
+           leaf direction {
+               type enumeration {
+                   enum inbound{
+                       value 0 ;
+                       description "inbound." ;
+                   }
+                   enum outbound {
+                       value 1 ;
+                       description "outbound." ;
+                   }
+               }
+        description "qos for interface car" ;
+           }
+
+           leaf cir {
+               type int32;
+          description "forward CIR. unit:Kbps" ;
+           }
+           leaf pir {
+               type int32;
+          description "forward PIR. unit:Kbps" ;
+           }
+           leaf cbs {
+               type int32;
+          description "forward CBS. unit:Kbps" ;
+           }
+           leaf pbs {
+               type int32;
+          description "forward PBS. unit:Kbps" ;
+           }
+        }
+       }
+
+       grouping protect-policy {
+           description "The protect policy of the VPN" ;
+           leaf protect-type {
+               type enumeration {
+                   enum unprotected {
+                       value 0 ;
+                       description "unprotected." ;
+                   }
+                   enum protected {
+                       value 1 ;
+                       description "protection." ;
+                   }
+               }
+               default unprotected ;
+          description "protection type" ;
+           }
+
+           leaf revertive-type {
+               type enumeration {
+                   enum no-revertive {
+                       value 0 ;
+                       description "unprotected." ;
+                   }
+                   enum revertive {
+                       value 1 ;
+                       description "protection." ;
+                   }
+               }
+          description "revertive mode" ;
+           }
+           leaf wtr {
+               type uint32;
+               default 300;
+          description "WTR.unit:s" ;
+           }
+       }
+       grouping oam-policy {
+         description "The oam policy of the vpn service." ;
+           leaf detect-type {
+               type enumeration {
+                   enum undetect {
+                       value 0 ;
+                       description "unprotected." ;
+                   }
+                   enum APS {
+                       value 1 ;
+                       description "protection." ;
+                   }
+                   enum BFD {
+                       value 2 ;
+                       description "unprotected." ;
+                   }
+               }
+          description "detect type" ;
+           }
+           container bfd-detect-para {
+          description "bfd detect parameters." ;
+               leaf ingress-discriminator {
+                   type int32;
+            description "ingress-discriminator" ;
+               }
+               leaf egress-discriminator {
+                   type int32;
+            description "egress-discriminator" ;
+               }
+               leaf tx-interval {
+                   type int32;
+            description "tx-interval" ;
+               }
+               leaf rx-interval {
+                   type int32;
+            description "rx-interval" ;
+               }
+               leaf detect-interval {
+                   type int32;
+            description "detect-interval" ;
+              }
+           }
+       }
+       grouping ac {
+        description "Access information." ;
+           leaf id{
+               type string;
+          mandatory true;
+          description "ac id." ;
+           }
+           leaf name{
+               type string;
+          config false;
+          description "ac name." ;
+           }
+
+           leaf ne-id {
+               type string ;
+            mandatory true;
+            description "ne id." ;
+           }
+
+           leaf ltp-id {
+               type string ;
+               mandatory true;
+               description "ltp id." ;
+           }
+           leaf admin-status {
+                                     type types:admin-status;
+               description "Administration status." ;
+           }
+           leaf operate-status {
+              type types:operate-status;
+              description "Operation status." ;
+           }
+           container l2-access {
+               description "link layer access information of ac." ;
+               uses l2-access;
+           }
+
+           leaf role {
+               type enumeration {
+                   enum master {
+                       value 0 ;
+                       description "master." ;
+                   }
+                   enum slave {
+                       value 1 ;
+                       description "slave." ;
+                   }
+                   enum hub {
+                       value 2 ;
+                       description "slave." ;
+                   }
+                   enum spoke {
+                       value 3 ;
+                       description "slave." ;
+                   }
+               }
+               default master;
+          description "role of snc lsp." ;
+           }
+           container qos-policy {
+          description "The qos policy of the vpn service." ;
+               container qos-if-cars {
+             description "qos policy if car." ;
+                   list qos-if-car {
+                     //key "direction";
+                     uses qos-if-car;
+             description "List of qos parameters." ;
+                   }
+               }
+           }
+       }
+       grouping l3-ac {
+        description "Access information of l3vpn." ;
+       list access-circuit {
+           key "id";
+           description "list of access circuit." ;
+           uses ac;
+           container connection {
+               description "connection information of ac." ;
+               uses connection;
+           }
+        }
+       }
+       grouping l2-access {
+        description "Access information of l2vpn." ;
+           leaf access-type{
+               type enumeration {
+                   enum Port {
+                       value 0 ;
+                       description "master." ;
+                   }
+                   enum Dot1Q {
+                       value 1 ;
+                       description "slave." ;
+                   }
+                   enum QinQ {
+                       value 2 ;
+                       description "master." ;
+                   }
+               }
+        mandatory true;
+        description "The access type of the vpn service." ;
+           }
+           leaf dot1q-vlan-bitmap {
+               type string;
+          mandatory true;
+               description "Dot1Q Vlan Bitmap." ;
+           }
+
+           leaf qinq-svlan-bitmap {
+               type string;
+          mandatory true;
+               description "QinQ svlan Bitmap." ;
+           }
+
+           leaf qinq-cvlan-bitmap {
+               type string;
+          mandatory true;
+               description "QinQ cvlan Bitmap." ;
+           }
+           leaf access-action {
+               type enumeration {
+                   enum Keep {
+                       value 0 ;
+                       description "keep." ;
+                   }
+                   enum Push {
+                       value 1 ;
+                       description "push." ;
+                   }
+                   enum Pop {
+                       value 2 ;
+                       description "pop." ;
+                   }
+                   enum Swap {
+                       value 3 ;
+                       description "swap." ;
+                   }
+               }
+          mandatory true;
+               description "access type." ;
+           }
+
+           leaf action-vlan-id {
+               type int32 {
+                   range "1..4094";
+               }
+          description "action vlan id." ;
+           }
+       }
+       grouping connection {
+           description "Describe the connection of the vpn service." ;
+           leaf ip-address {
+               type inet:ip-address ;
+          description "ip address of access circuit's connection." ;
+           }
+           leaf mask-length {
+               type int32 {
+                   range "1..32";
+               }
+          description "mask length of ip address." ;
+           }
+           leaf protocols {
+               type enumeration {
+                   enum static {
+                       value 0 ;
+                       description "static." ;
+                   }
+                   enum ospf {
+                       value 1 ;
+                       description "ospf." ;
+                   }
+                   enum isis {
+                       value 2 ;
+                       description "bgp" ;
+                   }
+                   enum bgp {
+                       value 3 ;
+                       description "bgp" ;
+                   }
+               }
+        description "protocols between PE and CE." ;
+           }
+           container static-routes {
+          description "Defines the static routes." ;
+               list static-route {
+              key "ip-prefix mask-length";
+              description "List of static route." ;
+                   leaf ip-prefix {
+                       type inet:ipv4-address;
+               description "ip prefix" ;
+                   }
+                   leaf mask-length {
+                       type uint32 {
+                            range "1..32";
+                       }
+              description "mast length" ;
+                   }
+                   leaf next-hop {
+                       type inet:ipv4-address ;
+               description "next hop" ;
+                   }
+                   leaf preference {
+                       type uint32 {
+                           range "1..65535";
+                       }
+              description "preference of the route." ;
+                   }
+               }
+           }
+       }
+
+       grouping pw{
+           description "PW definition ";
+           leaf id {
+               type string ;
+          description "ID of pw." ;
+           }
+           uses encaplate-type-grouping;
+
+           leaf ingress-ne-id {
+               type string ;
+          description "ingress ne id." ;
+           }
+
+           leaf egress-ne-id {
+               type string ;
+          description "egress ne id." ;
+           }
+
+           leaf ctrl-word-support {
+               type enumeration {
+                   enum not-support {
+                       value 0 ;
+                       description "pw doesn't support control word" ;
+                   }
+                   enum support {
+                       value 1 ;
+                       description "pw supports control word" ;
+                   }
+               }
+               default support;
+          description "ctrl word support. 0 : not support, 1 : support" ;
+           }
+
+           leaf sn-support {
+               type enumeration {
+                   enum not-support {
+                       value 0 ;
+                       description "pw doesn't support control word" ;
+                   }
+                   enum support {
+                       value 1 ;
+                       description "pw supports control word" ;
+                   }
+               }
+               default not-support;
+          description "serial number support. 0 : not support, 1 : support" ;
+           }
+
+           leaf vccv-type {
+               type enumeration {
+                   enum not-support {
+                       value 0 ;
+                       description "pw doesn't support vccv" ;
+                   }
+                   enum CWD {
+                       value 1 ;
+                       description "pw supports vccv" ;
+                   }
+                   enum Label-alert {
+                       value 2 ;
+                       description "pw supports vccv" ;
+                   }
+                   enum TTL {
+                       value 3 ;
+                       description "pw supports vccv" ;
+                   }
+                   enum CWD&Label-alert {
+                       value 4 ;
+                       description "pw supports vccv" ;
+                   }
+                   enum CWD&TTL {
+                       value 5 ;
+                       description "pw supports vccv" ;
+                   }
+                   enum Label-alert&TTL {
+                       value 6 ;
+                       description "pw supports vccv" ;
+                   }
+                   enum CWD&Label-alert&TTL {
+                       value 7 ;
+                       description "pw supports vccv" ;
+                   }
+               }
+               default not-support;
+               description "vccv type" ;
+           }
+
+           leaf conn-ack-type {
+               type enumeration {
+                   enum not-support {
+                       value 0 ;
+                       description "pw doesn't support connection ack" ;
+                   }
+                   enum support {
+                       value 1 ;
+                       description "pw supports connection ack" ;
+                   }
+               }
+               default not-support;
+               description "Connectivity test type" ;
+           }
+           container tunnels {
+               description "Define tunnels." ;
+               list tunnel{
+                   key "tunnel-id";
+                   description "The list of tunnel id." ;
+                   uses tunnel;
+               }
+           }
+       }
+       grouping tunnel {
+           description "Reusable entity of tunnel." ;
+           leaf tunnel-id {
+               type string ;
+               description "ID of tunnel." ;
+           }
+       }
+       grouping encaplate-type-grouping {
+           description "encaplate type" ;
+           leaf encaplate-type {
+               type enumeration {
+                   enum NONE {
+                       value 0 ;
+                       description "none." ;
+                   }
+                   enum fr-dlci-martini {
+                       value 1 ;
+                       description "fr-dlci-martini." ;
+                   }
+                   enum atm-aal5-sdu {
+                       value 2 ;
+                       description "atm-aal5-sdu." ;
+                   }
+                   enum atm-transparent {
+                       value 3 ;
+                       description "atm-transparent." ;
+                   }
+                   enum ethernet-vlan {
+                       value 4 ;
+                       description "ethernet-vlan." ;
+                   }
+                   enum ethernet  {
+                       value 5 ;
+                       description "ethernet ." ;
+                   }
+                   enum  hdlc {
+                       value 6 ;
+                       description " hdlc." ;
+                   }
+                   enum ppp {
+                       value 7 ;
+                       description "ppp." ;
+                   }
+                   enum cep-mpls {
+                       value 8 ;
+                       description " cep-mpls." ;
+                   }
+                   enum atm-ntol {
+                       value 9 ;
+                       description "atm-ntol." ;
+                   }
+                   enum atm-nto1-vpc {
+                       value 10 ;
+                       description "atm-nto1-vpc." ;
+                   }
+                   enum ip-layer2 {
+                       value 11 ;
+                       description " ip-layer2." ;
+                   }
+                   enum atm-1to1-vcc {
+                       value 12 ;
+                       description "atm-1to1-vcc." ;
+                   }
+                   enum atm-1to1-vpc {
+                       value 13 ;
+                       description "atm-1to1-vpc." ;
+                   }
+                   enum atm-aal5-pdu {
+                       value 14 ;
+                       description "atm-aal5-pdu." ;
+                   }
+                   enum fr-port {
+                       value 15 ;
+                       description "fr-port." ;
+                   }
+                   enum cep-packet {
+                       value 16 ;
+                       description "cep-packet." ;
+                   }
+                   enum e1 {
+                       value 17 ;
+                       description "e1." ;
+                   }
+                    enum t1 {
+                       value 18 ;
+                       description "t1." ;
+                   }
+                   enum e3 {
+                       value 19 ;
+                       description "e3." ;
+                   }
+                   enum t3 {
+                       value 20 ;
+                       description " t3." ;
+                   }
+                   enum cesopsn-basic {
+                       value 21 ;
+                       description "cesopsn-basic." ;
+                   }
+                   enum tdmoip-aal1 {
+                       value 22 ;
+                       description "tdmoip-aal1." ;
+                   }
+                   enum cesopsn-tdm {
+                       value 23 ;
+                       description "cesopsn-tdm." ;
+                   }
+                   enum tdmoip-aal2 {
+                       value 24 ;
+                       description "tdmoip-aal2." ;
+                   }
+                   enum fr-dlci {
+                       value 25 ;
+                       description "fr-dlci." ;
+                   }
+               }
+          description "encaplate type." ;
+           }
+       }
+
+       grouping pw-trail{
+       description "pw trail information." ;
+           leaf id {
+               type string ;
+          description "ID of pw-trail." ;
+           }
+
+           leaf role {
+               type pw-role;
+          description "role of pw-trail." ;
+            }
+           container pw-lists {
+          description "List of pw information." ;
+               list pw-list {
+                    key id;
+             description "List of pw information." ;
+                    uses pw ;
+               }
+           }
+       }
+       grouping tunnel-service {
+           description "Reusable entity of tunnel service." ;
+           leaf signaling-type {
+               type enumeration {
+                   enum RSVP-TE {
+                       value 0 ;
+                       description "RSVP-TE" ;
+                   }
+                   enum LDP {
+                       value 1 ;
+                       description "LDP" ;
+                   }
+                   enum GRE {
+                       value 2 ;
+                       description "GRE" ;
+                   }
+                   enum SR-BE {
+                       value 3 ;
+                       description "SR-BE" ;
+                   }
+                   enum SR-TE {
+                       value 4 ;
+                       description "SR-TE" ;
+                   }
+               }
+               default RSVP-TE;
+          description "signaling type." ;
+           }
+           leaf tunnel-mode {
+               type enumeration {
+                   enum Nto1 {
+                       value 0 ;
+                       description "multi service one tunnel" ;
+                   }
+                   enum 1to1 {
+                       value 1 ;
+                       description "oner service one tunnel" ;
+                   }
+               }
+               default Nto1;
+          description "service to tunnel mode." ;
+           }
+           container protect-policy {
+          description "Protect policy." ;
+               uses protect-policy;
+           }
+           container oam-policy {
+          description "oam policy." ;
+               uses oam-policy;
+           }
+           leaf latency {
+               type int32;
+          description "tunnel latency requirement." ;
+           }
+       }
+       grouping service-path {
+           description "Service path of l3vpn." ;
+         list service-path{
+          key "service-id source-ne-id source-ac-id destination-ne-id destination-ac-id";
+        description
+         "The list of service path.";
+           leaf service-id {
+               type string ;
+          description "l2vpn or l3vpn service id." ;
+           }
+           leaf source-ne-id {
+               type string ;
+          description "source ne id." ;
+           }
+
+           leaf source-ac-id {
+               type string ;
+          description "source ltp id." ;
+           }
+           leaf destination-ne-id {
+               type string ;
+          description "destination ne id." ;
+           }
+
+           leaf destination-ac-id {
+               type string ;
+          description "destination ltp id." ;
+           }
+           container path-lists{
+          description "The path list of service path." ;
+               list path-list {
+                   key "path-layer path-role";
+               description "The path list of service path." ;
+                   leaf path-layer {
+                       type enumeration {
+                           enum PW {
+                               value 0 ;
+                               description "pw path." ;
+                           }
+                           enum BGP-LSP {
+                               value 1 ;
+                               description "BGP-LSP Path." ;
+                           }
+                           enum LSP {
+                               value 2 ;
+                               description "LSP Path." ;
+                           }
+                       }
+               description "path type. 0 : PW, 1 : BGP-LSP, 2 : PW" ;
+                   }
+                   leaf path-role {
+                       type enumeration {
+                           enum Primary {
+                               value 0 ;
+                               description "master path." ;
+                           }
+                           enum Backup {
+                               value 1 ;
+                               description "backup path." ;
+                           }
+                           enum Active {
+                               value 2 ;
+                               description "active path." ;
+                           }
+                       }
+                description "path role.. 0 : master, 1 : backup, 2 :
+   Bypass." ;
+                   }
+                   container paths {
+               description "path definition." ;
+                       list path {
+                           key "ne-id";
+                   description "Network element id list." ;
+                           leaf ne-id {
+                              type string;
+                   description "Network element id." ;
+                           }
+                           leaf ingress-ltp-id {
+                              type string;
+                   description "ingress ltd id." ;
+                           }
+                           leaf backward-peer-id {
+                              type string;
+                   description "backward peer id." ;
+                           }
+                           leaf egress-ltp-id {
+                              type string;
+                   description "egress ltd id." ;
+                           }
+                           leaf forward-peer-id {
+                              type string;
+                   description "forward peer id." ;
+                           }
+                       }
+                   }
+               }
+           }
+
+       }
+     }
+   }
diff --git a/compiler/plugin/maven/src/test/resources/interFileUsesInsideChildOfGrouping/ietf-network-topology.yang b/compiler/plugin/maven/src/test/resources/interFileUsesInsideChildOfGrouping/ietf-network-topology.yang
new file mode 100644
index 0000000..499c0f1
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/interFileUsesInsideChildOfGrouping/ietf-network-topology.yang
@@ -0,0 +1,37 @@
+module ietf-network-topology {
+    yang-version 1;
+    namespace "ietf-vidya-topology";
+    prefix lnk;
+
+    import ietf-network {
+        prefix nd;
+    }
+
+    revision 2015-12-08 {
+        description
+         "Initial revision.
+          NOTE TO RFC EDITOR: Please replace the following reference
+          to draft-ietf-i2rs-yang-network-topo-02 with
+          RFC number when published (i.e. RFC xxxx).";
+        reference
+          "draft-ietf-i2rs-yang-network-topo-02.";
+    }
+
+    augment "/nd:networks/nd:network" {
+        list link {
+            key "link-id";
+            container source {
+                leaf source-node {
+                    type string;
+                    mandatory true;
+                }
+                leaf source-tp {
+                    type string;
+                }
+            }
+            leaf link-id {
+                type string;
+            }
+        }
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/interFileUsesInsideChildOfGrouping/ietf-network.yang b/compiler/plugin/maven/src/test/resources/interFileUsesInsideChildOfGrouping/ietf-network.yang
new file mode 100644
index 0000000..a78b231
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/interFileUsesInsideChildOfGrouping/ietf-network.yang
@@ -0,0 +1,30 @@
+module ietf-network {
+    yang-version 1;
+    namespace "ietf-network";
+    prefix nd;
+
+    revision 2015-12-08 {
+        description
+         "Initial revision.
+          NOTE TO RFC EDITOR: Please replace the following reference
+          to draft-ietf-i2rs-yang-network-topo-02 with
+          RFC number when published (i.e. RFC xxxx).";
+         reference
+          "draft-ietf-i2rs-yang-network-topo-02";
+    }
+
+    container networks {
+        list network {
+            key "network-id";
+            leaf network-id {
+                type string;
+            }
+            list node {
+                key "node-id";
+                leaf node-id {
+                    type string;
+                }
+            }
+        }
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/interFileUsesInsideChildOfGrouping/ietf-te-topology.yang b/compiler/plugin/maven/src/test/resources/interFileUsesInsideChildOfGrouping/ietf-te-topology.yang
new file mode 100644
index 0000000..f92fccc
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/interFileUsesInsideChildOfGrouping/ietf-te-topology.yang
@@ -0,0 +1,65 @@
+module ietf-te-topology {
+    yang-version 1;
+    namespace "ietf-te-topology";
+    prefix "tet";
+
+    import ietf-te-types {
+        prefix "te-types";
+    }
+
+    import ietf-network {
+        prefix "nw";
+    }
+
+    import ietf-network-topology {
+        prefix "nt";
+    }
+
+    revision "2016-03-17" {
+        description "Initial revision";
+        reference "TBD";
+    }
+
+    grouping te-link-augment {
+        container te {
+            container config {
+                uses te-link-config;
+            } // config
+        } // te
+    } // te-link-augment
+
+    grouping te-link-config {
+        uses te-link-config-attributes;
+    } // te-link-config
+
+    grouping te-link-config-attributes {
+        container te-link-attributes {
+            container underlay {
+                uses te-link-underlay-attributes;
+            } // underlay
+        } // te-link-attributes
+    } // te-link-config-attributes
+
+    grouping te-link-underlay-attributes {
+        container underlay-primary-path {
+            list path-element {
+                key "path-element-id";
+                description
+                    "A list of path elements describing the service path.";
+                leaf path-element-id {
+                    type uint32;
+                    description "To identify the element in a path.";
+                }
+                uses te-path-element;
+            }
+        } // underlay-primary-path
+    } // te-link-underlay-attributes
+
+    grouping te-path-element {
+        uses te-types:explicit-route-subobject;
+    } // te-path-element
+
+    augment "/nw:networks/nw:network/nt:link" {
+        uses te-link-augment;
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/interFileUsesInsideChildOfGrouping/ietf-te-types.yang b/compiler/plugin/maven/src/test/resources/interFileUsesInsideChildOfGrouping/ietf-te-types.yang
new file mode 100644
index 0000000..96ce986
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/interFileUsesInsideChildOfGrouping/ietf-te-types.yang
@@ -0,0 +1,19 @@
+module ietf-te-types {
+
+    namespace "ietf-te-types";
+    prefix "te-types";
+
+    revision 2016-03-20 {
+        description "Latest revision of TE generic types";
+        reference "RFC3209";
+    }
+    grouping explicit-route-subobject {
+        choice type {
+            case ipv4-address {
+                leaf v4-address {
+                    type string;
+                }
+            }
+        }
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/interJarFileLinking/yangFiles/flowclassifier.yang b/compiler/plugin/maven/src/test/resources/interJarFileLinking/yangFiles/flowclassifier.yang
new file mode 100644
index 0000000..0fa3ba1
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/interJarFileLinking/yangFiles/flowclassifier.yang
@@ -0,0 +1,175 @@
+module flow-classifier {
+
+    yang-version 1;
+
+    namespace "sfc.flowclassifier";
+
+    prefix "flow-classifier";
+
+    import "port-pair" {
+        prefix "port-pair";
+    } 
+    
+    organization "ON-LAB";
+
+    description "This submodule defines for flow classifier.";
+
+    revision "2016-05-24" {
+        description "Initial revision.";
+    }
+
+    typedef flow-classifier-id {
+        type port-pair:uuid;
+    }
+
+    typedef IpPrefix {
+        type string;
+    }
+
+    typedef VirtualPortId {
+        type string;
+    }
+ 
+    grouping flow-classifier {
+        container flow-classifier {
+        	leaf id {
+                    type flow-classifier-id;
+        	}
+
+        	leaf tenant-id {
+        	    type port-pair:tenant-id;
+        	}
+
+        	leaf name {
+           	    type string;
+          	}
+ 
+        	leaf description {
+            	    type string;
+        	}
+    
+        	leaf etherType {
+            	    type string;
+        	}
+
+        	leaf protocol {
+            	    type string;
+        	}
+
+        	leaf priority {
+            	    type int32;
+        	}
+
+        	leaf minSrcPortRange {
+           	    type int32;
+        	}
+
+        	leaf maxSrcPortRange {
+            	    type int32;
+        	}
+
+       		leaf minDstPortRange {
+            	    type int32;
+        	}  
+
+        	leaf maxDstPortRange {
+            	    type int32;
+        	}
+
+        	leaf srcIpPrefix {
+            	    type IpPrefix;
+        	}
+
+        	leaf dstIpPrefix {
+            	    type IpPrefix;
+        	}
+
+        	leaf srcPort {
+	   	    type VirtualPortId;
+        	}
+
+        	leaf dstPort {
+	    	    type VirtualPortId;
+        	}
+    	}
+    }
+   rpc exists {
+      input {
+         leaf id {
+            type flow-classifier-id;
+          }
+      }
+      output {
+          leaf is-present {
+              type boolean;
+          }
+      }
+    }
+
+   rpc get-flow-classifier-count {
+      
+      output {
+          leaf count {
+              type int32;
+          }
+      }
+    }
+   
+   rpc get-flow-classifier {
+      input {
+         leaf id {
+            type flow-classifier-id;
+          }
+      }
+      output {
+          uses flow-classifier;
+      }
+    }
+
+   rpc create-flow-classifier {
+      input {
+          uses flow-classifier;
+      }
+      output {
+          leaf is-created {
+              type boolean;
+          }
+      }
+    }
+
+   rpc update-flow-classifier {
+      input {
+          uses flow-classifier;
+      }
+      output {
+          leaf is-updated {
+              type boolean;
+          }
+      }
+    }
+
+   rpc remove-flow-classifier {
+      input {
+         leaf id {
+            type flow-classifier-id;
+          }
+      }
+      output {
+          leaf is-removed {
+              type boolean;
+          }
+      }
+    }
+ 
+    notification Flow-Classifier-Put {
+       uses flow-classifier;
+    }
+    
+    notification Flow-Classifier-Delete {
+       uses flow-classifier;
+    }
+
+    notification Flow-Classifier-Update {
+        uses flow-classifier;
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/interJarFileLinking/yangFiles/portpair.yang b/compiler/plugin/maven/src/test/resources/interJarFileLinking/yangFiles/portpair.yang
new file mode 100644
index 0000000..ee67c62
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/interJarFileLinking/yangFiles/portpair.yang
@@ -0,0 +1,137 @@
+module port-pair {
+
+    yang-version 1;
+
+    namespace "sfc.portpair";
+
+    prefix "port-pair";
+   
+    organization "Huawei india pvt. ltd..";
+
+    description "This submodule defines for port pair.";
+
+    revision "2016-05-24" {
+        description "Initial revision.";
+    }
+
+    typedef uuid {
+    	type string;
+    }
+
+    typedef port-pair-id {
+        type uuid;
+    }
+
+    typedef tenant-id {
+        type uuid;
+    }
+    
+     grouping port-pair {
+        container  port-pair {
+
+        	leaf name {
+           	    type string;
+        	}
+
+        	leaf id {
+           	    type port-pair-id;
+        	}
+
+        	leaf tenantIdentifier {
+           	    type tenant-id;
+        	}
+
+        	leaf description {
+            	    type string;
+        	}
+
+        	leaf ingress {
+            	    type uuid;
+        	}
+
+        	leaf egress {
+           	    type uuid;
+        	}  
+   	}
+    }
+   rpc exists {
+      input {
+         leaf id {
+            type port-pair-id;
+          }
+      }
+      output {
+          leaf is-present {
+              type boolean;
+          }
+      }
+    }
+
+   rpc get-port-pair-count {
+      
+      output {
+          leaf count {
+              type int32;
+          }
+      }
+    }
+   
+   rpc get-port-pair {
+      input {
+         leaf id {
+            type port-pair-id;
+          }
+      }
+      output {
+          uses port-pair;
+      }
+    }
+
+   rpc create-port-pair {
+      input {
+          uses port-pair;
+      }
+      output {
+          leaf is-created {
+              type boolean;
+          }
+      }
+    }
+
+   rpc update-port-pair {
+      input {
+          uses port-pair;
+      }
+      output {
+          leaf is-updated {
+              type boolean;
+          }
+      }
+    }
+
+   rpc remove-port-pair {
+      input {
+         leaf id {
+            type port-pair-id;
+          }
+      }
+      output {
+          leaf is-removed {
+              type boolean;
+          }
+      }
+    }
+     
+ 
+    notification port-pair-put {
+        uses port-pair;
+    }
+    
+    notification port-pair-Delete {
+        uses port-pair;
+    }
+
+    notification port-pair-Update {
+        uses port-pair;
+    }   
+}
diff --git a/compiler/plugin/maven/src/test/resources/interJarFileLinking/yangFiles/test.yang b/compiler/plugin/maven/src/test/resources/interJarFileLinking/yangFiles/test.yang
new file mode 100644
index 0000000..4e7275c
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/interJarFileLinking/yangFiles/test.yang
@@ -0,0 +1,29 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    container valid {
+        leaf invalid-interval {
+            type "uint16";
+            units "seconds";
+            status current;
+            reference "RFC 6020";
+        }
+    }
+    container invalid {
+        leaf invalid-interval {
+            type "uint16";
+            units "seconds";
+            status current;
+            reference "RFC 6020";
+        }
+    }
+    container valid2 {
+        leaf invalid-interval {
+            type "uint16";
+            units "seconds";
+            status current;
+            reference "RFC 6020";
+        }
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/interfilefeatureimport/featureFile1.yang b/compiler/plugin/maven/src/test/resources/interfilefeatureimport/featureFile1.yang
new file mode 100644
index 0000000..e78e583
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/interfilefeatureimport/featureFile1.yang
@@ -0,0 +1,26 @@
+module syslog1 {
+     yang-version 1;
+     namespace "http://huawei1.com";
+     prefix "sys1";
+
+     import "syslog2" {
+        prefix "sys2";
+     }
+
+     feature frr-te {
+       description "Indicates support for TE FastReroute (FRR)";
+       if-feature "sys2:p2mp-te";
+     }
+
+     container speed {
+         leaf local-storage-limit {
+             if-feature frr-te;
+             type uint64;
+             units "kilobyte";
+             config false;
+             description
+                     "The amount of local storage that can be
+                      used to hold syslog messages.";
+         }
+     }
+}
diff --git a/compiler/plugin/maven/src/test/resources/interfilefeatureimport/featureFile2.yang b/compiler/plugin/maven/src/test/resources/interfilefeatureimport/featureFile2.yang
new file mode 100644
index 0000000..782571c
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/interfilefeatureimport/featureFile2.yang
@@ -0,0 +1,9 @@
+module syslog2 {
+     yang-version 1;
+     namespace "http://huawei2.com";
+     prefix "sys2";
+
+     feature p2mp-te {
+       description "Indicates support for P2MP-TE";
+     }
+}
diff --git a/compiler/plugin/maven/src/test/resources/interfilefeatureimportdependency/featurefile1.yang b/compiler/plugin/maven/src/test/resources/interfilefeatureimportdependency/featurefile1.yang
new file mode 100644
index 0000000..e78e583
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/interfilefeatureimportdependency/featurefile1.yang
@@ -0,0 +1,26 @@
+module syslog1 {
+     yang-version 1;
+     namespace "http://huawei1.com";
+     prefix "sys1";
+
+     import "syslog2" {
+        prefix "sys2";
+     }
+
+     feature frr-te {
+       description "Indicates support for TE FastReroute (FRR)";
+       if-feature "sys2:p2mp-te";
+     }
+
+     container speed {
+         leaf local-storage-limit {
+             if-feature frr-te;
+             type uint64;
+             units "kilobyte";
+             config false;
+             description
+                     "The amount of local storage that can be
+                      used to hold syslog messages.";
+         }
+     }
+}
diff --git a/compiler/plugin/maven/src/test/resources/interfilefeatureimportdependency/featurefile2.yang b/compiler/plugin/maven/src/test/resources/interfilefeatureimportdependency/featurefile2.yang
new file mode 100644
index 0000000..fcaf8e0
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/interfilefeatureimportdependency/featurefile2.yang
@@ -0,0 +1,14 @@
+module syslog2 {
+     yang-version 1;
+     namespace "http://huawei2.com";
+     prefix "sys2";
+
+     import "syslog3" {
+        prefix "sys3";
+     }
+
+     feature p2mp-te {
+       description "Indicates support for P2MP-TE";
+       if-feature "sys3:extended-admin-groups";
+     }
+}
diff --git a/compiler/plugin/maven/src/test/resources/interfilefeatureimportdependency/featurefile3.yang b/compiler/plugin/maven/src/test/resources/interfilefeatureimportdependency/featurefile3.yang
new file mode 100644
index 0000000..13d6787
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/interfilefeatureimportdependency/featurefile3.yang
@@ -0,0 +1,11 @@
+module syslog3 {
+     yang-version 1;
+     namespace "http://huawei3.com";
+     prefix "sys3";
+
+     feature extended-admin-groups {
+       description
+         "Indicates support for TE link extended admin
+         groups.";
+     }
+}
diff --git a/compiler/plugin/maven/src/test/resources/interfilefeatureimportdependencyUndefined/featurefile1.yang b/compiler/plugin/maven/src/test/resources/interfilefeatureimportdependencyUndefined/featurefile1.yang
new file mode 100644
index 0000000..e78e583
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/interfilefeatureimportdependencyUndefined/featurefile1.yang
@@ -0,0 +1,26 @@
+module syslog1 {
+     yang-version 1;
+     namespace "http://huawei1.com";
+     prefix "sys1";
+
+     import "syslog2" {
+        prefix "sys2";
+     }
+
+     feature frr-te {
+       description "Indicates support for TE FastReroute (FRR)";
+       if-feature "sys2:p2mp-te";
+     }
+
+     container speed {
+         leaf local-storage-limit {
+             if-feature frr-te;
+             type uint64;
+             units "kilobyte";
+             config false;
+             description
+                     "The amount of local storage that can be
+                      used to hold syslog messages.";
+         }
+     }
+}
diff --git a/compiler/plugin/maven/src/test/resources/interfilefeatureimportdependencyUndefined/featurefile2.yang b/compiler/plugin/maven/src/test/resources/interfilefeatureimportdependencyUndefined/featurefile2.yang
new file mode 100644
index 0000000..199a6a6
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/interfilefeatureimportdependencyUndefined/featurefile2.yang
@@ -0,0 +1,15 @@
+module syslog2 {
+     yang-version 1;
+     namespace "http://huawei2.com";
+     prefix "sys2";
+
+     import "syslog3" {
+        prefix "sys3";
+     }
+
+     feature p2mp-te {
+       description "Indicates support for P2MP-TE";
+       if-feature "sys3:extended-admin-groups";
+     }
+}
+
diff --git a/compiler/plugin/maven/src/test/resources/interfilefeatureimportdependencyUndefined/featurefile3.yang b/compiler/plugin/maven/src/test/resources/interfilefeatureimportdependencyUndefined/featurefile3.yang
new file mode 100644
index 0000000..f638139
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/interfilefeatureimportdependencyUndefined/featurefile3.yang
@@ -0,0 +1,5 @@
+module syslog3 {
+     yang-version 1;
+     namespace "http://huawei3.com";
+     prefix "sys3";
+}
diff --git a/compiler/plugin/maven/src/test/resources/interfilefeatureinclude/featureFile3.yang b/compiler/plugin/maven/src/test/resources/interfilefeatureinclude/featureFile3.yang
new file mode 100644
index 0000000..b387853
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/interfilefeatureinclude/featureFile3.yang
@@ -0,0 +1,24 @@
+module syslog3 {
+     yang-version 1;
+     namespace "http://huawei3.com";
+     prefix "sys3";
+
+     include "syslog4";
+
+     feature frr-te {
+       description "Indicates support for TE FastReroute (FRR)";
+       if-feature "p2mp-te";
+     }
+
+     container speed {
+         leaf local-storage-limit {
+             if-feature frr-te;
+             type uint64;
+             units "kilobyte";
+             config false;
+             description
+                     "The amount of local storage that can be
+                      used to hold syslog messages.";
+         }
+     }
+}
diff --git a/compiler/plugin/maven/src/test/resources/interfilefeatureinclude/featureFile4.yang b/compiler/plugin/maven/src/test/resources/interfilefeatureinclude/featureFile4.yang
new file mode 100644
index 0000000..30e1ce5
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/interfilefeatureinclude/featureFile4.yang
@@ -0,0 +1,10 @@
+submodule syslog4 {
+     yang-version 1;
+     belongs-to "syslog3" {
+         prefix "sys3";
+     }
+
+     feature p2mp-te {
+       description "Indicates support for P2MP-TE";
+     }
+}
diff --git a/compiler/plugin/maven/src/test/resources/interfilefeatureincludedependency/featurefile1.yang b/compiler/plugin/maven/src/test/resources/interfilefeatureincludedependency/featurefile1.yang
new file mode 100644
index 0000000..a30c85a
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/interfilefeatureincludedependency/featurefile1.yang
@@ -0,0 +1,24 @@
+module syslog1 {
+     yang-version 1;
+     namespace "http://huawei3.com";
+     prefix "sys1";
+
+     include "syslog2";
+
+     feature frr-te {
+       description "Indicates support for TE FastReroute (FRR)";
+       if-feature "p2mp-te";
+     }
+
+     container speed {
+         leaf local-storage-limit {
+             if-feature frr-te;
+             type uint64;
+             units "kilobyte";
+             config false;
+             description
+                     "The amount of local storage that can be
+                      used to hold syslog messages.";
+         }
+     }
+}
diff --git a/compiler/plugin/maven/src/test/resources/interfilefeatureincludedependency/featurefile2.yang b/compiler/plugin/maven/src/test/resources/interfilefeatureincludedependency/featurefile2.yang
new file mode 100644
index 0000000..370490a
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/interfilefeatureincludedependency/featurefile2.yang
@@ -0,0 +1,16 @@
+submodule syslog2 {
+     yang-version 1;
+     belongs-to "syslog1" {
+         prefix "sys1";
+     }
+     
+     import "syslog3" {
+        prefix "sys3";
+     }
+
+     feature p2mp-te {
+       description "Indicates support for P2MP-TE";
+       if-feature "sys3:extended-admin-groups";
+     }
+}
+
diff --git a/compiler/plugin/maven/src/test/resources/interfilefeatureincludedependency/featurefile3.yang b/compiler/plugin/maven/src/test/resources/interfilefeatureincludedependency/featurefile3.yang
new file mode 100644
index 0000000..13d6787
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/interfilefeatureincludedependency/featurefile3.yang
@@ -0,0 +1,11 @@
+module syslog3 {
+     yang-version 1;
+     namespace "http://huawei3.com";
+     prefix "sys3";
+
+     feature extended-admin-groups {
+       description
+         "Indicates support for TE link extended admin
+         groups.";
+     }
+}
diff --git a/compiler/plugin/maven/src/test/resources/interfilefeatureincludedependencyUndefined/featurefile1.yang b/compiler/plugin/maven/src/test/resources/interfilefeatureincludedependencyUndefined/featurefile1.yang
new file mode 100644
index 0000000..a30c85a
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/interfilefeatureincludedependencyUndefined/featurefile1.yang
@@ -0,0 +1,24 @@
+module syslog1 {
+     yang-version 1;
+     namespace "http://huawei3.com";
+     prefix "sys1";
+
+     include "syslog2";
+
+     feature frr-te {
+       description "Indicates support for TE FastReroute (FRR)";
+       if-feature "p2mp-te";
+     }
+
+     container speed {
+         leaf local-storage-limit {
+             if-feature frr-te;
+             type uint64;
+             units "kilobyte";
+             config false;
+             description
+                     "The amount of local storage that can be
+                      used to hold syslog messages.";
+         }
+     }
+}
diff --git a/compiler/plugin/maven/src/test/resources/interfilefeatureincludedependencyUndefined/featurefile2.yang b/compiler/plugin/maven/src/test/resources/interfilefeatureincludedependencyUndefined/featurefile2.yang
new file mode 100644
index 0000000..370490a
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/interfilefeatureincludedependencyUndefined/featurefile2.yang
@@ -0,0 +1,16 @@
+submodule syslog2 {
+     yang-version 1;
+     belongs-to "syslog1" {
+         prefix "sys1";
+     }
+     
+     import "syslog3" {
+        prefix "sys3";
+     }
+
+     feature p2mp-te {
+       description "Indicates support for P2MP-TE";
+       if-feature "sys3:extended-admin-groups";
+     }
+}
+
diff --git a/compiler/plugin/maven/src/test/resources/interfilefeatureincludedependencyUndefined/featurefile3.yang b/compiler/plugin/maven/src/test/resources/interfilefeatureincludedependencyUndefined/featurefile3.yang
new file mode 100644
index 0000000..f638139
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/interfilefeatureincludedependencyUndefined/featurefile3.yang
@@ -0,0 +1,5 @@
+module syslog3 {
+     yang-version 1;
+     namespace "http://huawei3.com";
+     prefix "sys3";
+}
diff --git a/compiler/plugin/maven/src/test/resources/interfileidentityimport/IdentityInModule.yang b/compiler/plugin/maven/src/test/resources/interfileidentityimport/IdentityInModule.yang
new file mode 100644
index 0000000..efaadd6
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/interfileidentityimport/IdentityInModule.yang
@@ -0,0 +1,15 @@
+
+module IdentityInModule{
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix IdentityInModule;
+
+    identity tunnel-type {
+        description
+           "Base identity from which specific tunnel types are derived.";
+    }
+
+    identity ref-address-family {
+        reference "http://www.iana.org/assignments/address-family-numbers/address-family-numbers.xhtml#address-family-numbers-2";
+    }
+}
\ No newline at end of file
diff --git a/compiler/plugin/maven/src/test/resources/interfileidentityimport/IdentityIntraFile.yang b/compiler/plugin/maven/src/test/resources/interfileidentityimport/IdentityIntraFile.yang
new file mode 100644
index 0000000..4036e97
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/interfileidentityimport/IdentityIntraFile.yang
@@ -0,0 +1,29 @@
+module IdentityIntraFile {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix IdentityIntraFile;
+
+    import "IdentityInModule" {
+        prefix "IdentityInModule";
+    }
+
+    identity ipv4-address-family {
+        base IdentityInModule:ref-address-family;
+    }
+
+    identity ipv6-address-family {
+        base IdentityInModule:ref-address-family;
+    }
+
+    leaf tunnel {
+        type identityref {
+            base IdentityInModule:ref-address-family;
+        }
+    }
+
+    leaf-list network-ref {
+        type identityref {
+            base IdentityInModule:ref-address-family;
+        }
+    }
+}
\ No newline at end of file
diff --git a/compiler/plugin/maven/src/test/resources/interfileidentityimportdependency/featurefile1.yang b/compiler/plugin/maven/src/test/resources/interfileidentityimportdependency/featurefile1.yang
new file mode 100644
index 0000000..b808b11
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/interfileidentityimportdependency/featurefile1.yang
@@ -0,0 +1,30 @@
+module syslog1 {
+    yang-version 1;
+    namespace "http://huawei1.com";
+    prefix "sys1";
+
+    import "syslog2" {
+       prefix "sys2";
+    }
+
+    identity ipv4-address-family {
+       base sys2:ref-address-family;
+    }
+
+    identity ipv6-address-family {
+       base sys2:ref-address-family;
+    }
+
+    leaf tunnel {
+        type identityref {
+            base sys2:ref-address-family;
+        }
+    }
+
+    leaf-list network-ref {
+        type identityref {
+            base sys2:ref-address-family;
+        }
+    }
+
+}
diff --git a/compiler/plugin/maven/src/test/resources/interfileidentityimportdependency/featurefile2.yang b/compiler/plugin/maven/src/test/resources/interfileidentityimportdependency/featurefile2.yang
new file mode 100644
index 0000000..2469e24
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/interfileidentityimportdependency/featurefile2.yang
@@ -0,0 +1,17 @@
+module syslog2 {
+     yang-version 1;
+     namespace "http://huawei2.com";
+     prefix "sys2";
+
+     import "syslog3" {
+        prefix "sys3";
+     }
+
+     identity tunnel-type {
+         base sys3:final-address-family;
+     }
+
+     identity ref-address-family {
+         base sys3:final-address-family;
+     }
+}
diff --git a/compiler/plugin/maven/src/test/resources/interfileidentityimportdependency/featurefile3.yang b/compiler/plugin/maven/src/test/resources/interfileidentityimportdependency/featurefile3.yang
new file mode 100644
index 0000000..f460bd1
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/interfileidentityimportdependency/featurefile3.yang
@@ -0,0 +1,10 @@
+module syslog3 {
+     yang-version 1;
+     namespace "http://huawei3.com";
+     prefix "sys3";
+
+    identity final-address-family {
+        description
+           "Base identity from which specific tunnel types are derived.";
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/interfileidentityimportdependencyUndefined/featurefile1.yang b/compiler/plugin/maven/src/test/resources/interfileidentityimportdependencyUndefined/featurefile1.yang
new file mode 100644
index 0000000..ec2e48c
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/interfileidentityimportdependencyUndefined/featurefile1.yang
@@ -0,0 +1,29 @@
+module syslog1 {
+     yang-version 1;
+     namespace "http://huawei1.com";
+     prefix "sys1";
+
+     import "syslog2" {
+        prefix "sys2";
+     }
+
+     identity ipv4-address-family {
+        base sys2:ref-address-family;
+     }
+
+     identity ipv6-address-family {
+        base sys2:ref-address-family;
+     }
+
+    leaf tunnel {
+        type identityref {
+            base sys2:ref-address-family;
+        }
+    }
+
+    leaf-list network-ref {
+        type identityref {
+            base sys2:ref-address-family;
+        }
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/interfileidentityimportdependencyUndefined/featurefile2.yang b/compiler/plugin/maven/src/test/resources/interfileidentityimportdependencyUndefined/featurefile2.yang
new file mode 100644
index 0000000..25e66af
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/interfileidentityimportdependencyUndefined/featurefile2.yang
@@ -0,0 +1,18 @@
+module syslog2 {
+     yang-version 1;
+     namespace "http://huawei2.com";
+     prefix "sys2";
+
+     import "syslog3" {
+        prefix "sys3";
+     }
+
+     identity tunnel-type {
+         base sys3:final-address-family;
+     }
+
+     identity ref-address-family {
+         base sys3:final-address-family;
+     }
+}
+
diff --git a/compiler/plugin/maven/src/test/resources/interfileidentityimportdependencyUndefined/featurefile3.yang b/compiler/plugin/maven/src/test/resources/interfileidentityimportdependencyUndefined/featurefile3.yang
new file mode 100644
index 0000000..f638139
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/interfileidentityimportdependencyUndefined/featurefile3.yang
@@ -0,0 +1,5 @@
+module syslog3 {
+     yang-version 1;
+     namespace "http://huawei3.com";
+     prefix "sys3";
+}
diff --git a/compiler/plugin/maven/src/test/resources/interfileidentityincludedependency/featurefile1.yang b/compiler/plugin/maven/src/test/resources/interfileidentityincludedependency/featurefile1.yang
new file mode 100644
index 0000000..fe987ea
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/interfileidentityincludedependency/featurefile1.yang
@@ -0,0 +1,27 @@
+module syslog1 {
+    yang-version 1;
+    namespace "http://huawei3.com";
+    prefix "sys1";
+
+    include "syslog2";
+
+    identity ipv4-address-family {
+       base ref-address-family;
+    }
+
+    identity ipv6-address-family {
+       base ref-address-family;
+    }
+
+    leaf tunnel {
+        type identityref {
+            base ref-address-family;
+        }
+    }
+
+    leaf-list network-ref {
+        type identityref {
+            base ref-address-family;
+        }
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/interfileidentityincludedependency/featurefile2.yang b/compiler/plugin/maven/src/test/resources/interfileidentityincludedependency/featurefile2.yang
new file mode 100644
index 0000000..14fd83c
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/interfileidentityincludedependency/featurefile2.yang
@@ -0,0 +1,19 @@
+submodule syslog2 {
+     yang-version 1;
+     belongs-to "syslog1" {
+         prefix "sys1";
+     }
+
+     import "syslog3" {
+        prefix "sys3";
+     }
+
+     identity tunnel-type {
+         base sys3:final-address-family;
+     }
+
+     identity ref-address-family {
+         base sys3:final-address-family;
+     }
+}
+
diff --git a/compiler/plugin/maven/src/test/resources/interfileidentityincludedependency/featurefile3.yang b/compiler/plugin/maven/src/test/resources/interfileidentityincludedependency/featurefile3.yang
new file mode 100644
index 0000000..aa056f0
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/interfileidentityincludedependency/featurefile3.yang
@@ -0,0 +1,10 @@
+module syslog3 {
+     yang-version 1;
+     namespace "http://huawei3.com";
+     prefix "sys3";
+
+     identity final-address-family {
+         description
+            "Base identity from which specific tunnel types are derived.";
+     }
+}
diff --git a/compiler/plugin/maven/src/test/resources/interfileidentityincludedependencyUndefined/featurefile1.yang b/compiler/plugin/maven/src/test/resources/interfileidentityincludedependencyUndefined/featurefile1.yang
new file mode 100644
index 0000000..bc4878f
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/interfileidentityincludedependencyUndefined/featurefile1.yang
@@ -0,0 +1,27 @@
+module syslog1 {
+    yang-version 1;
+    namespace "http://huawei3.com";
+    prefix "sys1";
+
+    include "syslog2";
+
+    identity ipv4-address-family {
+       base sys2:ref-address-family;
+    }
+
+    identity ipv6-address-family {
+       base sys2:ref-address-family;
+    }
+
+    leaf tunnel {
+        type identityref {
+            base sys2:ref-address-family;
+        }
+    }
+
+    leaf-list network-ref {
+        type identityref {
+            base sys2:ref-address-family;
+        }
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/interfileidentityincludedependencyUndefined/featurefile2.yang b/compiler/plugin/maven/src/test/resources/interfileidentityincludedependencyUndefined/featurefile2.yang
new file mode 100644
index 0000000..14fd83c
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/interfileidentityincludedependencyUndefined/featurefile2.yang
@@ -0,0 +1,19 @@
+submodule syslog2 {
+     yang-version 1;
+     belongs-to "syslog1" {
+         prefix "sys1";
+     }
+
+     import "syslog3" {
+        prefix "sys3";
+     }
+
+     identity tunnel-type {
+         base sys3:final-address-family;
+     }
+
+     identity ref-address-family {
+         base sys3:final-address-family;
+     }
+}
+
diff --git a/compiler/plugin/maven/src/test/resources/interfileidentityincludedependencyUndefined/featurefile3.yang b/compiler/plugin/maven/src/test/resources/interfileidentityincludedependencyUndefined/featurefile3.yang
new file mode 100644
index 0000000..f638139
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/interfileidentityincludedependencyUndefined/featurefile3.yang
@@ -0,0 +1,5 @@
+module syslog3 {
+     yang-version 1;
+     namespace "http://huawei3.com";
+     prefix "sys3";
+}
diff --git a/compiler/plugin/maven/src/test/resources/interfileidentityinlude/IdentityInModule.yang b/compiler/plugin/maven/src/test/resources/interfileidentityinlude/IdentityInModule.yang
new file mode 100644
index 0000000..e42ad86
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/interfileidentityinlude/IdentityInModule.yang
@@ -0,0 +1,27 @@
+module syslog3 {
+     yang-version 1;
+     namespace "http://huawei3.com";
+     prefix "sys3";
+
+     include "syslog4";
+
+     identity ipv4-address-family {
+         base ref-address-family;
+     }
+
+     identity ipv6-address-family {
+         base ref-address-family;
+     }
+
+    leaf tunnel {
+         type identityref {
+             base ref-address-family;
+         }
+    }
+
+    leaf-list network-ref {
+        type identityref {
+            base ref-address-family;
+        }
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/interfileidentityinlude/IdentityIntraFile.yang b/compiler/plugin/maven/src/test/resources/interfileidentityinlude/IdentityIntraFile.yang
new file mode 100644
index 0000000..ffa1a7d
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/interfileidentityinlude/IdentityIntraFile.yang
@@ -0,0 +1,15 @@
+submodule syslog4 {
+     yang-version 1;
+     belongs-to "syslog3" {
+         prefix "sys3";
+     }
+
+     identity tunnel-type {
+         description
+            "Base identity from which specific tunnel types are derived.";
+     }
+
+     identity ref-address-family {
+         reference "http://www.iana.org/assignments/address-family-numbers/address-family-numbers.xhtml#address-family-numbers-2";
+     }
+}
\ No newline at end of file
diff --git a/compiler/plugin/maven/src/test/resources/interfileidentitytypedef/IdentityInModule.yang b/compiler/plugin/maven/src/test/resources/interfileidentitytypedef/IdentityInModule.yang
new file mode 100644
index 0000000..5688615
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/interfileidentitytypedef/IdentityInModule.yang
@@ -0,0 +1,14 @@
+module IdentityInModule{
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix IdentityInModule;
+
+    identity tunnel-type {
+        description
+           "Base identity from which specific tunnel types are derived.";
+    }
+
+    identity ref-address-family {
+        reference "http://www.iana.org/assignments/address-family-numbers/address-family-numbers.xhtml#address-family-numbers-2";
+    }
+}
\ No newline at end of file
diff --git a/compiler/plugin/maven/src/test/resources/interfileidentitytypedef/IdentityIntraFile.yang b/compiler/plugin/maven/src/test/resources/interfileidentitytypedef/IdentityIntraFile.yang
new file mode 100644
index 0000000..fcb2984
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/interfileidentitytypedef/IdentityIntraFile.yang
@@ -0,0 +1,35 @@
+module IdentityIntraFile {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix IdentityIntraFile;
+
+    import "IdentityInModule" {
+        prefix "IdentityInModule";
+    }
+
+    identity ipv4-address-family {
+        base IdentityInModule:ref-address-family;
+    }
+
+    identity ipv6-address-family {
+        base IdentityInModule:ref-address-family;
+    }
+
+    leaf tunnel {
+        type identityref {
+            base IdentityInModule:ref-address-family;
+        }
+    }
+
+    leaf-list network-ref {
+        type identityref {
+            base IdentityInModule:ref-address-family;
+        }
+    }
+
+    typedef type15 {
+        type identityref {
+            base IdentityInModule:ref-address-family;
+        }
+    }
+}
\ No newline at end of file
diff --git a/compiler/plugin/maven/src/test/resources/interfileidentitytypedef/IdentityTypedef.yang b/compiler/plugin/maven/src/test/resources/interfileidentitytypedef/IdentityTypedef.yang
new file mode 100644
index 0000000..6a58976
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/interfileidentitytypedef/IdentityTypedef.yang
@@ -0,0 +1,31 @@
+module IdentityTypedef {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix IdentityTypedef;
+
+    import "IdentityInModule" {
+        prefix "IdentityInModule";
+    }
+
+    identity ipv4-address-family {
+        base IdentityInModule:ref-address-family;
+    }
+
+    identity ipv6-address-family {
+        base IdentityInModule:ref-address-family;
+    }
+
+    leaf tunnel {
+        type type15;
+    }
+
+    leaf-list network-ref {
+        type type15;
+    }
+
+    typedef type15 {
+        type identityref {
+            base IdentityInModule:ref-address-family;
+        }
+    }
+}
\ No newline at end of file
diff --git a/compiler/plugin/maven/src/test/resources/interfileietf/ietf-inet-types.yang b/compiler/plugin/maven/src/test/resources/interfileietf/ietf-inet-types.yang
new file mode 100644
index 0000000..2b7ed38
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/interfileietf/ietf-inet-types.yang
@@ -0,0 +1,454 @@
+  module ietf-inet-types {
+
+    yang-version 1;
+
+    namespace
+      "urn:ietf:params:xml:ns:yang:ietf-inet-types";
+
+    prefix inet;
+
+    organization
+      "IETF NETMOD (NETCONF Data Modeling Language) Working Group";
+
+    contact
+      "WG Web:   <http://tools.ietf.org/wg/netmod/>
+    WG List:  <mailto:netmod@ietf.org>
+
+    WG Chair: David Kessens
+              <mailto:david.kessens@nsn.com>
+
+    WG Chair: Juergen Schoenwaelder
+              <mailto:j.schoenwaelder@jacobs-university.de>
+
+    Editor:   Juergen Schoenwaelder
+              <mailto:j.schoenwaelder@jacobs-university.de>";
+
+    description
+      "This module contains a collection of generally useful derived
+    YANG data types for Internet addresses and related things.
+
+    Copyright (c) 2013 IETF Trust and the persons identified as
+    authors of the code.  All rights reserved.
+
+    Redistribution and use in source and binary forms, with or
+    without modification, is permitted pursuant to, and subject
+    to the license terms contained in, the Simplified BSD License
+    set forth in Section 4.c of the IETF Trust's Legal Provisions
+    Relating to IETF Documents
+    (http://trustee.ietf.org/license-info).
+
+    This version of this YANG module is part of RFC 6991; see
+    the RFC itself for full legal notices.";
+
+    revision "2013-07-15" {
+      description
+        "This revision adds the following new data types:
+      - ip-address-no-zone
+      - ipv4-address-no-zone
+      - ipv6-address-no-zone";
+      reference
+        "RFC 6991: Common YANG Data Types";
+
+    }
+
+    revision "2010-09-24" {
+      description "Initial revision.";
+      reference
+        "RFC 6021: Common YANG Data Types";
+
+    }
+
+
+    typedef ip-version {
+      type enumeration {
+        enum "unknown" {
+          value 0;
+          description
+            "An unknown or unspecified version of the Internet
+          protocol.";
+        }
+        enum "ipv4" {
+          value 1;
+          description
+            "The IPv4 protocol as defined in RFC 791.";
+        }
+        enum "ipv6" {
+          value 2;
+          description
+            "The IPv6 protocol as defined in RFC 2460.";
+        }
+      }
+      description
+        "This value represents the version of the IP protocol.
+
+      In the value set and its semantics, this type is equivalent
+      to the InetVersion textual convention of the SMIv2.";
+      reference
+        "RFC  791: Internet Protocol
+         RFC 2460: Internet Protocol, Version 6 (IPv6) Specification
+         RFC 4001: Textual Conventions for Internet Network Addresses";
+
+    }
+
+    typedef dscp {
+      type uint8 {
+        range "0..63";
+      }
+      description
+        "The dscp type represents a Differentiated Services Code Point
+      that may be used for marking packets in a traffic stream.
+      In the value set and its semantics, this type is equivalent
+      to the Dscp textual convention of the SMIv2.";
+      reference
+        "RFC 3289: Management Information Base for the Differentiated
+        	  Services Architecture
+         RFC 2474: Definition of the Differentiated Services Field
+        	  (DS Field) in the IPv4 and IPv6 Headers
+         RFC 2780: IANA Allocation Guidelines For Values In
+        	  the Internet Protocol and Related Headers";
+
+    }
+
+    typedef ipv6-flow-label {
+      type uint32 {
+        range "0..1048575";
+      }
+      description
+        "The ipv6-flow-label type represents the flow identifier or Flow
+      Label in an IPv6 packet header that may be used to
+      discriminate traffic flows.
+
+      In the value set and its semantics, this type is equivalent
+      to the IPv6FlowLabel textual convention of the SMIv2.";
+      reference
+        "RFC 3595: Textual Conventions for IPv6 Flow Label
+         RFC 2460: Internet Protocol, Version 6 (IPv6) Specification";
+
+    }
+
+    typedef port-number {
+      type uint16 {
+        range "0..65535";
+      }
+      description
+        "The port-number type represents a 16-bit port number of an
+      Internet transport-layer protocol such as UDP, TCP, DCCP, or
+      SCTP.  Port numbers are assigned by IANA.  A current list of
+      all assignments is available from <http://www.iana.org/>.
+
+      Note that the port number value zero is reserved by IANA.  In
+      situations where the value zero does not make sense, it can
+      be excluded by subtyping the port-number type.
+      In the value set and its semantics, this type is equivalent
+      to the InetPortNumber textual convention of the SMIv2.";
+      reference
+        "RFC  768: User Datagram Protocol
+         RFC  793: Transmission Control Protocol
+         RFC 4960: Stream Control Transmission Protocol
+         RFC 4340: Datagram Congestion Control Protocol (DCCP)
+         RFC 4001: Textual Conventions for Internet Network Addresses";
+
+    }
+
+    typedef as-number {
+      type uint32;
+      description
+        "The as-number type represents autonomous system numbers
+      which identify an Autonomous System (AS).  An AS is a set
+      of routers under a single technical administration, using
+      an interior gateway protocol and common metrics to route
+      packets within the AS, and using an exterior gateway
+      protocol to route packets to other ASes.  IANA maintains
+      the AS number space and has delegated large parts to the
+      regional registries.
+
+      Autonomous system numbers were originally limited to 16
+      bits.  BGP extensions have enlarged the autonomous system
+      number space to 32 bits.  This type therefore uses an uint32
+      base type without a range restriction in order to support
+      a larger autonomous system number space.
+
+      In the value set and its semantics, this type is equivalent
+      to the InetAutonomousSystemNumber textual convention of
+      the SMIv2.";
+      reference
+        "RFC 1930: Guidelines for creation, selection, and registration
+        	  of an Autonomous System (AS)
+         RFC 4271: A Border Gateway Protocol 4 (BGP-4)
+         RFC 4001: Textual Conventions for Internet Network Addresses
+         RFC 6793: BGP Support for Four-Octet Autonomous System (AS)
+        	  Number Space";
+
+    }
+
+    typedef ip-address {
+      type union {
+        type ipv4-address;
+        type ipv6-address;
+      }
+      description
+        "The ip-address type represents an IP address and is IP
+      version neutral.  The format of the textual representation
+      implies the IP version.  This type supports scoped addresses
+      by allowing zone identifiers in the address format.";
+      reference
+        "RFC 4007: IPv6 Scoped Address Architecture";
+
+    }
+
+    typedef ipv4-address {
+      type string {
+        pattern
+          '(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(%[\p{N}\p{L}]+)?';
+      }
+      description
+        "The ipv4-address type represents an IPv4 address in
+       dotted-quad notation.  The IPv4 address may include a zone
+       index, separated by a % sign.
+
+       The zone index is used to disambiguate identical address
+       values.  For link-local addresses, the zone index will
+       typically be the interface index number or the name of an
+       interface.  If the zone index is not present, the default
+       zone of the device will be used.
+
+       The canonical format for the zone index is the numerical
+       format";
+    }
+
+    typedef ipv6-address {
+      type string {
+        pattern
+          '((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))(%[\p{N}\p{L}]+)?';
+        pattern
+          '(([^:]+:){6}(([^:]+:[^:]+)|(.*\..*)))|((([^:]+:)*[^:]+)?::(([^:]+:)*[^:]+)?)(%.+)?';
+      }
+      description
+        "The ipv6-address type represents an IPv6 address in full,
+      mixed, shortened, and shortened-mixed notation.  The IPv6
+      address may include a zone index, separated by a % sign.
+
+      The zone index is used to disambiguate identical address
+      values.  For link-local addresses, the zone index will
+      typically be the interface index number or the name of an
+      interface.  If the zone index is not present, the default
+      zone of the device will be used.
+
+
+
+      The canonical format of IPv6 addresses uses the textual
+      representation defined in Section 4 of RFC 5952.  The
+      canonical format for the zone index is the numerical
+      format as described in Section 11.2 of RFC 4007.";
+      reference
+        "RFC 4291: IP Version 6 Addressing Architecture
+         RFC 4007: IPv6 Scoped Address Architecture
+         RFC 5952: A Recommendation for IPv6 Address Text
+        	  Representation";
+
+    }
+
+    typedef ip-address-no-zone {
+      type union {
+        type ipv4-address-no-zone;
+        type ipv6-address-no-zone;
+      }
+      description
+        "The ip-address-no-zone type represents an IP address and is
+      IP version neutral.  The format of the textual representation
+      implies the IP version.  This type does not support scoped
+      addresses since it does not allow zone identifiers in the
+      address format.";
+      reference
+        "RFC 4007: IPv6 Scoped Address Architecture";
+
+    }
+
+    typedef ipv4-address-no-zone {
+      type ipv4-address {
+        pattern '[0-9\.]*';
+      }
+      description
+        "An IPv4 address without a zone index.  This type, derived from
+       ipv4-address, may be used in situations where the zone is
+       known from the context and hence no zone index is needed.";
+    }
+
+    typedef ipv6-address-no-zone {
+      type ipv6-address {
+        pattern '[0-9a-fA-F:\.]*';
+      }
+      description
+        "An IPv6 address without a zone index.  This type, derived from
+       ipv6-address, may be used in situations where the zone is
+       known from the context and hence no zone index is needed.";
+      reference
+        "RFC 4291: IP Version 6 Addressing Architecture
+         RFC 4007: IPv6 Scoped Address Architecture
+         RFC 5952: A Recommendation for IPv6 Address Text
+        	  Representation";
+
+    }
+
+    typedef ip-prefix {
+      type union {
+        type ipv4-prefix;
+        type ipv6-prefix;
+      }
+      description
+        "The ip-prefix type represents an IP prefix and is IP
+      version neutral.  The format of the textual representations
+      implies the IP version.";
+    }
+
+    typedef ipv4-prefix {
+      type string {
+        pattern
+          '(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])/(([0-9])|([1-2][0-9])|(3[0-2]))';
+      }
+      description
+        "The ipv4-prefix type represents an IPv4 address prefix.
+      The prefix length is given by the number following the
+      slash character and must be less than or equal to 32.
+
+      A prefix length value of n corresponds to an IP address
+      mask that has n contiguous 1-bits from the most
+      significant bit (MSB) and all other bits set to 0.
+
+      The canonical format of an IPv4 prefix has all bits of
+      the IPv4 address set to zero that are not part of the
+      IPv4 prefix.";
+    }
+
+    typedef ipv6-prefix {
+      type string {
+        pattern
+          '((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))(/(([0-9])|([0-9]{2})|(1[0-1][0-9])|(12[0-8])))';
+        pattern
+          '(([^:]+:){6}(([^:]+:[^:]+)|(.*\..*)))|((([^:]+:)*[^:]+)?::(([^:]+:)*[^:]+)?)(/.+)';
+      }
+      description
+        "The ipv6-prefix type represents an IPv6 address prefix.
+      The prefix length is given by the number following the
+      slash character and must be less than or equal to 128.
+
+      A prefix length value of n corresponds to an IP address
+      mask that has n contiguous 1-bits from the most
+      significant bit (MSB) and all other bits set to 0.
+
+      The IPv6 address should have all bits that do not belong
+      to the prefix set to zero.
+
+      The canonical format of an IPv6 prefix has all bits of
+      the IPv6 address set to zero that are not part of the
+      IPv6 prefix.  Furthermore, the IPv6 address is represented
+      as defined in Section 4 of RFC 5952.";
+      reference
+        "RFC 5952: A Recommendation for IPv6 Address Text
+        	  Representation";
+
+    }
+
+    typedef domain-name {
+      type string {
+        length "1..253";
+        pattern
+          '((([a-zA-Z0-9_]([a-zA-Z0-9\-_]){0,61})?[a-zA-Z0-9]\.)*([a-zA-Z0-9_]([a-zA-Z0-9\-_]){0,61})?[a-zA-Z0-9]\.?)|\.';
+      }
+      description
+        "The domain-name type represents a DNS domain name.  The
+      name SHOULD be fully qualified whenever possible.
+
+      Internet domain names are only loosely specified.  Section
+      3.5 of RFC 1034 recommends a syntax (modified in Section
+      2.1 of RFC 1123).  The pattern above is intended to allow
+      for current practice in domain name use, and some possible
+      future expansion.  It is designed to hold various types of
+      domain names, including names used for A or AAAA records
+      (host names) and other records, such as SRV records.  Note
+      that Internet host names have a stricter syntax (described
+      in RFC 952) than the DNS recommendations in RFCs 1034 and
+      1123, and that systems that want to store host names in
+      schema nodes using the domain-name type are recommended to
+      adhere to this stricter standard to ensure interoperability.
+
+      The encoding of DNS names in the DNS protocol is limited
+      to 255 characters.  Since the encoding consists of labels
+      prefixed by a length bytes and there is a trailing NULL
+      byte, only 253 characters can appear in the textual dotted
+      notation.
+
+      The description clause of schema nodes using the domain-name
+      type MUST describe when and how these names are resolved to
+      IP addresses.  Note that the resolution of a domain-name value
+      may require to query multiple DNS records (e.g., A for IPv4
+      and AAAA for IPv6).  The order of the resolution process and
+      which DNS record takes precedence can either be defined
+      explicitly or may depend on the configuration of the
+      resolver.
+
+      Domain-name values use the US-ASCII encoding.  Their canonical
+      format uses lowercase US-ASCII characters.  Internationalized
+      domain names MUST be A-labels as per RFC 5890.";
+      reference
+        "RFC  952: DoD Internet Host Table Specification
+         RFC 1034: Domain Names - Concepts and Facilities
+         RFC 1123: Requirements for Internet Hosts -- Application
+        	  and Support
+         RFC 2782: A DNS RR for specifying the location of services
+        	  (DNS SRV)
+         RFC 5890: Internationalized Domain Names in Applications
+        	  (IDNA): Definitions and Document Framework";
+
+    }
+
+    typedef host {
+      type union {
+        type ip-address;
+        type domain-name;
+      }
+      description
+        "The host type represents either an IP address or a DNS
+      domain name.";
+    }
+
+    typedef uri {
+      type string;
+      description
+        "The uri type represents a Uniform Resource Identifier
+      (URI) as defined by STD 66.
+
+      Objects using the uri type MUST be in US-ASCII encoding,
+      and MUST be normalized as described by RFC 3986 Sections
+      6.2.1, 6.2.2.1, and 6.2.2.2.  All unnecessary
+      percent-encoding is removed, and all case-insensitive
+      characters are set to lowercase except for hexadecimal
+      digits, which are normalized to uppercase as described in
+      Section 6.2.2.1.
+
+      The purpose of this normalization is to help provide
+      unique URIs.  Note that this normalization is not
+      sufficient to provide uniqueness.  Two URIs that are
+      textually distinct after this normalization may still be
+      equivalent.
+
+      Objects using the uri type may restrict the schemes that
+      they permit.  For example, 'data:' and 'urn:' schemes
+      might not be appropriate.
+
+      A zero-length URI is not a valid URI.  This can be used to
+      express 'URI absent' where required.
+
+      In the value set and its semantics, this type is equivalent
+      to the Uri SMIv2 textual convention defined in RFC 5017.";
+      reference
+        "RFC 3986: Uniform Resource Identifier (URI): Generic Syntax
+         RFC 3305: Report from the Joint W3C/IETF URI Planning Interest
+        	  Group: Uniform Resource Identifiers (URIs), URLs,
+        	  and Uniform Resource Names (URNs): Clarifications
+        	  and Recommendations
+         RFC 5017: MIB Textual Conventions for Uniform Resource
+        	  Identifiers (URIs)";
+
+    }
+  }  // module ietf-inet-types
diff --git a/compiler/plugin/maven/src/test/resources/interfileietf/ietf-network-topology.yang b/compiler/plugin/maven/src/test/resources/interfileietf/ietf-network-topology.yang
new file mode 100644
index 0000000..4c57482
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/interfileietf/ietf-network-topology.yang
@@ -0,0 +1,297 @@
+ module ietf-network-topology {
+   yang-version 1;
+   namespace "urn:ietf:params:xml:ns:yang:ietf-network-topology";
+   prefix lnk;
+
+   import ietf-inet-types {
+     prefix inet;
+   }
+   import ietf-network {
+     prefix nd;
+   }
+
+   organization
+     "IETF I2RS (Interface to the Routing System) Working Group";
+
+   contact
+     "WG Web:    <http://tools.ietf.org/wg/i2rs/>
+      WG List:   <mailto:i2rs@ietf.org>
+
+      WG Chair:  Susan Hares
+                 <mailto:shares@ndzh.com>
+
+      WG Chair:  Jeffrey Haas
+                 <mailto:jhaas@pfrc.org>
+
+      Editor:    Alexander Clemm
+                 <mailto:alex@cisco.com>
+
+      Editor:    Jan Medved
+                 <mailto:jmedved@cisco.com>
+
+      Editor:    Robert Varga
+                 <mailto:rovarga@cisco.com>
+
+      Editor:    Tony Tkacik
+                 <mailto:ttkacik@cisco.com>
+
+      Editor:    Nitin Bahadur
+                 <mailto:nitin_bahadur@yahoo.com>
+
+      Editor:    Hariharan Ananthakrishnan
+                 <mailto:hari@packetdesign.com>";
+
+   description
+     "This module defines a common base model for network topology,
+      augmenting the base network model with links to connect nodes,
+      as well as termination points to terminate links on nodes.
+
+      Copyright (c) 2015 IETF Trust and the persons identified as
+      authors of the code.  All rights reserved.
+
+      Redistribution and use in source and binary forms, with or
+      without modification, is permitted pursuant to, and subject
+      to the license terms contained in, the Simplified BSD License
+      set forth in Section 4.c of the IETF Trust's Legal Provisions
+      Relating to IETF Documents
+      (http://trustee.ietf.org/license-info).
+
+      This version of this YANG module is part of
+      draft-ietf-i2rs-yang-network-topo-02;
+      see the RFC itself for full legal notices.
+
+      NOTE TO RFC EDITOR: Please replace above reference to
+      draft-ietf-i2rs-yang-network-topo-02 with RFC
+      number when published (i.e. RFC xxxx).";
+
+   revision 2015-12-08 {
+     description
+       "Initial revision.
+        NOTE TO RFC EDITOR: Please replace the following reference
+        to draft-ietf-i2rs-yang-network-topo-02 with
+        RFC number when published (i.e. RFC xxxx).";
+     reference
+       "draft-ietf-i2rs-yang-network-topo-02.";
+   }
+
+   typedef link-id {
+     type inet:uri;
+     description
+       "An identifier for a link in a topology.
+        The identifier SHOULD be chosen such that the same link in a
+        real network topology will always be identified through the
+        same identifier, even if the model is instantiated in
+            separate datastores. An implementation MAY choose to capture
+        semantics in the identifier, for example to indicate the type
+        of link and/or the type of topology that the link is a part
+        of.";
+   }
+
+   typedef tp-id {
+     type inet:uri;
+     description
+       "An identifier for termination points on a node.
+        The identifier SHOULD be chosen such that the same TP in a
+        real network topology will always be identified through the
+        same identifier, even if the model is instantiated in
+        separate datastores. An implementation MAY choose to capture
+        semantics in the identifier, for example to indicate the type
+        of TP and/or the type of node and topology that the TP is a
+        part of.";
+   }
+   grouping link-ref {
+     description
+       "References a link in a specific network.";
+     leaf link-ref {
+       type leafref {
+         path "/nd:networks/nd:network[nd:network-id=current()/../"+
+           "network-ref]/lnk:link/lnk:link-id";
+         require-instance false;
+       }
+       description
+         "A type for an absolute reference a link instance.
+          (This type should not be used for relative references.
+          In such a case, a relative path should be used instead.)";
+     }
+     uses nd:network-ref;
+   }
+
+   grouping tp-ref {
+     description
+       "References a termination point in a specific node.";
+     leaf tp-ref {
+       type leafref {
+         path "/nd:networks/nd:network[nd:network-id=current()/../"+
+           "network-ref]/nd:node[nd:node-id=current()/../"+
+           "node-ref]/lnk:termination-point/lnk:tp-id";
+         require-instance false;
+       }
+       description
+         "A type for an absolute reference to a termination point.
+          (This type should not be used for relative references.
+          In such a case, a relative path should be used instead.)";
+     }
+     uses nd:node-ref;
+   }
+
+   augment "/nd:networks/nd:network" {
+     description
+       "Add links to the network model.";
+     list link {
+       key "link-id";
+       description
+         "A Network Link connects a by Local (Source) node and
+          a Remote (Destination) Network Nodes via a set of the
+          nodes' termination points.
+          As it is possible to have several links between the same
+          source and destination nodes, and as a link could
+          potentially be re-homed between termination points, to
+          ensure that we would always know to distinguish between
+          links, every link is identified by a dedicated link
+          identifier.
+          Note that a link models a point-to-point link, not a
+          multipoint link.
+          Layering dependencies on links in underlay topologies are
+          not represented as the layering information of nodes and of
+          termination points is sufficient.";
+       container source {
+         description
+           "This container holds the logical source of a particular
+            link.";
+         leaf source-node {
+           type leafref {
+             path "../../../nd:node/nd:node-id";
+           }
+           mandatory true;
+           description
+             "Source node identifier, must be in same topology.";
+         }
+         leaf source-tp {
+           type leafref {
+             path "../../../nd:node[nd:node-id=current()/../"+
+               "source-node]/termination-point/tp-id";
+           }
+           description
+             "Termination point within source node that terminates
+              the link.";
+         }
+       }
+       container destination {
+         description
+           "This container holds the logical destination of a
+            particular link.";
+         leaf dest-node {
+           type leafref {
+             path "../../../nd:node/nd:node-id";
+           }
+           mandatory true;
+           description
+             "Destination node identifier, must be in the same
+              network.";
+         }
+         leaf dest-tp {
+           type leafref {
+             path "../../../nd:node[nd:node-id=current()/../"+
+               "dest-node]/termination-point/tp-id";
+           }
+           description
+             "Termination point within destination node that
+              terminates the link.";
+         }
+       }
+       leaf link-id {
+         type link-id;
+         description
+           "The identifier of a link in the topology.
+            A link is specific to a topology to which it belongs.";
+       }
+       list supporting-link {
+         key "network-ref link-ref";
+         description
+           "Identifies the link, or links, that this link
+            is dependent on.";
+         leaf network-ref {
+           type leafref {
+             path "../../../nd:supporting-network/nd:network-ref";
+           require-instance false;
+           }
+           description
+             "This leaf identifies in which underlay topology
+              supporting link is present.";
+         }
+         leaf link-ref {
+           type leafref {
+             path "/nd:networks/nd:network[nd:network-id=current()/"+
+               "../network-ref]/link/link-id";
+             require-instance false;
+           }
+           description
+             "This leaf identifies a link which is a part
+              of this link's underlay. Reference loops, in which
+              a link identifies itself as its underlay, either
+              directly or transitively, are not allowed.";
+         }
+       }
+     }
+   }
+   augment "/nd:networks/nd:network/nd:node" {
+     description
+       "Augment termination points which terminate links.
+        Termination points can ultimately be mapped to interfaces.";
+     list termination-point {
+       key "tp-id";
+       description
+         "A termination point can terminate a link.
+          Depending on the type of topology, a termination point
+          could, for example, refer to a port or an interface.";
+       leaf tp-id {
+         type tp-id;
+         description
+           "Termination point identifier.";
+       }
+       list supporting-termination-point {
+         key "network-ref node-ref tp-ref";
+         description
+           "The leaf list identifies any termination points that
+            the termination point is dependent on, or maps onto.
+            Those termination points will themselves be contained
+            in a supporting node.
+            This dependency information can be inferred from
+            the dependencies between links.  For this reason,
+            this item is not separately configurable.  Hence no
+            corresponding constraint needs to be articulated.
+            The corresponding information is simply provided by the
+            implementing system.";
+         leaf network-ref {
+           type leafref {
+             path "../../../nd:supporting-node/nd:network-ref";
+           require-instance false;
+           }
+           description
+             "This leaf identifies in which topology the
+              supporting termination point is present.";
+         }
+         leaf node-ref {
+           type leafref {
+             path "../../../nd:supporting-node/nd:node-ref";
+           require-instance false;
+           }
+           description
+             "This leaf identifies in which node the supporting
+              termination point is present.";
+         }
+         leaf tp-ref {
+           type leafref {
+             path "/nd:networks/nd:network[nd:network-id=current()/"+
+               "../network-ref]/nd:node[nd:node-id=current()/../"+
+               "node-ref]/termination-point/tp-id";
+             require-instance false;
+           }
+           description
+             "Reference to the underlay node, must be in a
+              different topology";
+         }
+       }
+     }
+   }
+ }
diff --git a/compiler/plugin/maven/src/test/resources/interfileietf/ietf-network.yang b/compiler/plugin/maven/src/test/resources/interfileietf/ietf-network.yang
new file mode 100644
index 0000000..60c47ce
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/interfileietf/ietf-network.yang
@@ -0,0 +1,216 @@
+   module ietf-network {
+     yang-version 1;
+     namespace "urn:ietf:params:xml:ns:yang:ietf-network";
+     prefix nd;
+
+     import ietf-inet-types {
+       prefix inet;
+     }
+
+     organization
+       "IETF I2RS (Interface to the Routing System) Working Group";
+
+     contact
+       "WG Web:    <http://tools.ietf.org/wg/i2rs/>
+        WG List:   <mailto:i2rs@ietf.org>
+
+        WG Chair:  Susan Hares
+                   <mailto:shares@ndzh.com>
+
+        WG Chair:  Jeffrey Haas
+                   <mailto:jhaas@pfrc.org>
+
+        Editor:    Alexander Clemm
+                   <mailto:alex@cisco.com>
+
+        Editor:    Jan Medved
+                   <mailto:jmedved@cisco.com>
+
+        Editor:    Robert Varga
+                   <mailto:rovarga@cisco.com>
+
+        Editor:    Tony Tkacik
+                   <mailto:ttkacik@cisco.com>
+
+        Editor:    Nitin Bahadur
+                   <mailto:nitin_bahadur@yahoo.com>
+
+        Editor:    Hariharan Ananthakrishnan
+                   <mailto:hari@packetdesign.com>";
+
+     description
+       "This module defines a common base model for a collection
+        of nodes in a network. Node definitions are further used
+        in network topologies and inventories.
+
+        Copyright (c) 2015 IETF Trust and the persons identified as
+        authors of the code.  All rights reserved.
+
+        Redistribution and use in source and binary forms, with or
+        without modification, is permitted pursuant to, and subject
+        to the license terms contained in, the Simplified BSD License
+        set forth in Section 4.c of the IETF Trust's Legal Provisions
+        Relating to IETF Documents
+        (http://trustee.ietf.org/license-info).
+
+        This version of this YANG module is part of
+        draft-ietf-i2rs-yang-network-topo-02;
+        see the RFC itself for full legal notices.
+
+        NOTE TO RFC EDITOR: Please replace above reference to
+        draft-ietf-i2rs-yang-network-topo-02 with RFC
+        number when published (i.e. RFC xxxx).";
+
+     revision 2015-12-08 {
+       description
+         "Initial revision.
+          NOTE TO RFC EDITOR: Please replace the following reference
+          to draft-ietf-i2rs-yang-network-topo-02 with
+          RFC number when published (i.e. RFC xxxx).";
+       reference
+         "draft-ietf-i2rs-yang-network-topo-02";
+     }
+
+     typedef node-id {
+       type inet:uri;
+       description
+         "Identifier for a node.";
+     }
+
+     typedef network-id {
+       type inet:uri;
+       description
+         "Identifier for a network.";
+     }
+     grouping network-ref {
+       description
+         "Contains the information necessary to reference a network,
+          for example an underlay network.";
+       leaf network-ref {
+         type leafref {
+           path "/nd:networks/nd:network/nd:network-id";
+         require-instance false;
+         }
+         description
+           "Used to reference a network, for example an underlay
+            network.";
+       }
+     }
+
+     grouping node-ref {
+       description
+         "Contains the information necessary to reference a node.";
+       leaf node-ref {
+         type leafref {
+           path "/nd:networks/nd:network[nd:network-id=current()/../"+
+             "network-ref]/nd:node/nd:node-id";
+           require-instance false;
+         }
+         description
+           "Used to reference a node.
+            Nodes are identified relative to the network they are
+            contained in.";
+       }
+       uses network-ref;
+     }
+
+     container networks {
+       description
+         "Serves as top-level container for a list of networks.";
+       list network {
+         key "network-id";
+         description
+           "Describes a network.
+            A network typically contains an inventory of nodes,
+            topological information (augmented through
+            network-topology model), as well as layering
+            information.";
+         container network-types {
+           description
+             "Serves as an augmentation target.
+              The network type is indicated through corresponding
+              presence containers augmented into this container.";
+         }
+         leaf network-id {
+           type network-id;
+           description
+             "Identifies a network.";
+         }
+         list supporting-network {
+           key "network-ref";
+           description
+             "An underlay network, used to represent layered network
+              topologies.";
+           leaf network-ref {
+             type leafref {
+               path "/networks/network/network-id";
+             require-instance false;
+             }
+             description
+               "References the underlay network.";
+           }
+         }
+         list node {
+           key "node-id";
+           description
+             "The inventory of nodes of this network.";
+           leaf node-id {
+             type node-id;
+             description
+               "Identifies a node uniquely within the containing
+                network.";
+           }
+           list supporting-node {
+             key "network-ref node-ref";
+             description
+               "Represents another node, in an underlay network, that
+                this node is supported by.  Used to represent layering
+                structure.";
+             leaf network-ref {
+               type leafref {
+                 path "../../../supporting-network/network-ref";
+               require-instance false;
+               }
+               description
+                 "References the underlay network that the
+                  underlay node is part of.";
+             }
+             leaf node-ref {
+               type leafref {
+                 path "/networks/network/node/node-id";
+               require-instance false;
+               }
+               description
+                 "References the underlay node itself.";
+             }
+           }
+         }
+       }
+     }
+     container networks-state {
+       config false;
+       description
+         "Serves as top-level container for a list of state information
+          for networks";
+       list network {
+         key "network-ref";
+         description
+           "Data nodes representing operational data and state of
+            networks.
+            An instance is automatically created for every network
+            in the corresponding list under the networks container.";
+         uses network-ref;
+         leaf server-provided {
+           type boolean;
+           description
+             "Indicates whether the information concerning this
+              particular network is populated by the server
+              (server-provided true, the general case for network
+              information discovered from the server),
+              or whether it is configured by a client
+              (server-provided true, possible e.g. for
+              service overlays managed through a controller).";
+         }
+       }
+     }
+   }
diff --git a/compiler/plugin/maven/src/test/resources/interfileietf/ietf-schedule.yang b/compiler/plugin/maven/src/test/resources/interfileietf/ietf-schedule.yang
new file mode 100644
index 0000000..b9f7297
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/interfileietf/ietf-schedule.yang
@@ -0,0 +1,64 @@
+   module ietf-schedule {
+     yang-version 1;
+     namespace "urn:ietf:params:xml:ns:yang:ietf-schedule";
+     // replace with IANA namespace when assigned
+
+     prefix "sch";
+
+     import ietf-yang-types {
+       prefix "yang";
+     }
+
+     organization "TBD";
+     contact "TBD";
+     description
+       "The model allows time scheduling parameters to be specified.";
+
+     revision "2016-03-01" {
+       description "Initial revision";
+       reference "TBD";
+     }
+
+     /*
+      * Groupings
+      */
+
+     grouping schedules {
+       description
+         "A list of schedules defining when a particular
+          configuration takes effect.";
+       container schedules {
+         description
+           "Container of a schedule list defining when a particular
+            configuration takes effect.";
+         list schedule {
+           key "schedule-id";
+           description "A list of schedule elements.";
+
+           leaf schedule-id {
+             type uint32;
+             description "Identifies the schedule element.";
+           }
+           leaf start {
+             type yang:date-and-time;
+             description "Start time.";
+           }
+           leaf schedule-duration {
+             type string {
+               pattern
+                 'P(\d+Y)?(\d+M)?(\d+W)?(\d+D)?T(\d+H)?(\d+M)?(\d+S)?';
+             }
+             description "Schedule duration in ISO 8601 format.";
+           }
+           leaf repeat-interval {
+             type string {
+               pattern
+                 'R\d*/P(\d+Y)?(\d+M)?(\d+W)?(\d+D)?T(\d+H)?(\d+M)?'
+                 + '(\d+S)?';
+             }
+             description "Repeat interval in ISO 8601 format.";
+           }
+         }
+       }
+     } // schedules
+   }
diff --git a/compiler/plugin/maven/src/test/resources/interfileietf/ietf-te-topology.yang b/compiler/plugin/maven/src/test/resources/interfileietf/ietf-te-topology.yang
new file mode 100644
index 0000000..582ba9e
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/interfileietf/ietf-te-topology.yang
@@ -0,0 +1,1779 @@
+   module ietf-te-topology {
+     yang-version 1;
+     namespace "urn:ietf:params:xml:ns:yang:ietf-te-topology";
+     // replace with IANA namespace when assigned
+
+     prefix "tet";
+
+     import ietf-inet-types {
+       prefix "inet";
+     }
+
+     import ietf-schedule {
+       prefix "sch";
+     }
+
+     import ietf-te-types {
+       prefix "te-types";
+     }
+
+     import ietf-network {
+       prefix "nw";
+     }
+
+     import ietf-network-topology {
+       prefix "nt";
+     }
+
+     organization
+       "Traffic Engineering Architecture and Signaling (TEAS)
+        Working Group";
+
+     contact
+       "WG Web:   <http://tools.ietf.org/wg/teas/>
+        WG List:  <mailto:teas@ietf.org>
+
+        WG Chair: Lou Berger
+                  <mailto:lberger@labn.net>
+
+        WG Chair: Vishnu Pavan Beeram
+                  <mailto:vbeeram@juniper.net>
+
+        Editor:   Xufeng Liu
+                  <mailto:xliu@kuatrotech.com>
+
+        Editor:   Igor Bryskin
+                  <mailto:Igor.Bryskin@huawei.com>
+
+        Editor:   Vishnu Pavan Beeram
+                  <mailto:vbeeram@juniper.net>
+
+        Editor:   Tarek Saad
+                  <mailto:tsaad@cisco.com>
+
+        Editor:   Himanshu Shah
+                  <mailto:hshah@ciena.com>
+
+        Editor:   Oscar Gonzalez De Dios
+                  <mailto:oscar.gonzalezdedios@telefonica.com>";
+
+     description "TE topology model";
+
+     revision "2016-03-17" {
+       description "Initial revision";
+       reference "TBD";
+     }
+
+     /*
+      * Features
+      */
+
+     feature configuration-schedule {
+       description
+         "This feature indicates that the system supports
+          configuration scheduling.";
+     }
+
+     feature te-topology-hierarchy {
+       description
+         "This feature indicates that the system allows underlay
+          and/or overlay TE topology hierarchy.";
+     }
+
+     feature te-performance-metric {
+       description
+         "This feature indicates that the system supports
+          TE performance metric defined in
+          RFC7471: OSPF Traffic Engineering (TE) Metric Extensions.";
+     }
+
+     feature template {
+       description
+         "This feature indicates that the system supports
+          template configuration.";
+     }
+
+     /*
+      * Typedefs
+      */
+     typedef performance-metric-normality {
+       type enumeration {
+         enum "unknown" {
+           value 0;
+           description
+             "Unknown.";
+         }
+         enum "normal" {
+           value 1;
+           description
+             "Normal.";
+         }
+         enum "abnormal" {
+           value 2;
+           description
+             "Abnormal. The anomalous bit is set.";
+         }
+       }
+       description
+         "Indicates whether a performance metric is normal, abnormal, or
+          unknown.";
+       reference
+         "RFC7471: OSPF Traffic Engineering (TE) Metric Extensions.";
+     }
+
+     typedef te-admin-status {
+       type enumeration {
+         enum up {
+           description
+             "Enabled.";
+         }
+         enum down {
+           description
+             "Disabled.";
+         }
+         enum testing {
+           description
+             "In some test mode.";
+         }
+         enum preparing-maintenance {
+           description
+             "Resource is disabled in the control plane to prepare for
+              graceful shutdown for maintenance purposes.";
+           reference
+             "RFC5817: Graceful Shutdown in MPLS and Generalized MPLS
+              Traffic Engineering Networks";
+         }
+         enum maintenance {
+           description
+             "Resource is disabled in the data plane for maintenance
+              purposes.";
+         }
+       }
+       description
+         "Defines a type representing the administrative status of
+          a TE resource.";
+     }
+     typedef te-global-id {
+       type uint32;
+       description
+         "An identifier to uniquely identify an operator, which can be
+          either a provider or a client.
+          The definition of this type is taken from RFC6370 and RFC5003.
+          This attribute type is used solely to provide a globally
+          unique context for TE topologies.";
+     }
+
+     typedef te-link-access-type {
+       type enumeration {
+         enum point-to-point {
+           description
+             "The link is point-to-point.";
+         }
+         enum multi-access {
+           description
+             "The link is multi-access, including broacast and NBMA.";
+         }
+       }
+       description
+         "Defines a type representing the access type of a TE link.";
+       reference
+         "RFC3630: Traffic Engineering (TE) Extensions to OSPF
+          Version 2.";
+     }
+
+     typedef te-node-id {
+       type inet:ip-address;
+       description
+         "An identifier for a node in a topology.
+          The identifier is represented as an IPv4 or IPv6 address.
+          This attribute is mapped to Router ID in
+          RFC3630, RFC5329, RFC5305, and RFC 6119.";
+     }
+
+     typedef te-oper-status {
+       type enumeration {
+         enum up {
+           description
+           "Operational up.";
+         }
+         enum down {
+           description
+           "Operational down.";
+         }
+         enum testing {
+           description
+           "In some test mode.";
+         }
+         enum unknown {
+           description
+           "Status cannot be determined for some reason.";
+         }
+         enum preparing-maintenance {
+           description
+             "Resource is disabled in the control plane to prepare for
+              graceful shutdown for maintenance purposes.";
+           reference
+             "RFC5817: Graceful Shutdown in MPLS and Generalized MPLS
+              Traffic Engineering Networks";
+         }
+         enum maintenance {
+           description
+             "Resource is disabled in the data plane for maintenance
+              purposes.";
+         }
+       }
+       description
+         "Defines a type representing the operational status of
+          a TE resource.";
+     }
+
+     typedef te-recovery-status {
+       type enumeration {
+         enum normal {
+           description
+             "Both the recovery and working spans are fully
+              allocated and active, data traffic is being
+              transported over (or selected from) the working
+              span, and no trigger events are reported.";
+         }
+         enum recovery-started {
+           description
+             "The recovery action has been started, but not completed.";
+         }
+         enum recovery-succeeded {
+           description
+             "The recovery action has succeeded. The working span has
+              reported a failure/degrade condition and the user traffic
+              is being transported (or selected) on the recovery span.";
+         }
+         enum recovery-failed {
+           description
+             "The recovery action has failed.";
+         }
+         enum reversion-started {
+           description
+             "The reversion has started.";
+         }
+         enum reversion-failed {
+           description
+             "The reversion has failed.";
+         }
+         enum recovery-unavailable {
+           description
+             "The recovery is unavailable -- either as a result of an
+              operator Lockout command or a failure condition detected
+              on the recovery span.";
+         }
+         enum recovery-admin {
+           description
+             "The operator has issued a command switching the user
+              traffic to the recovery span.";
+         }
+         enum wait-to-restore {
+           description
+             "The recovery domain is recovering from a failuer/degrade
+              condition on the working span that is being controlled by
+              the Wait-to-Restore (WTR) timer.";
+         }
+       }
+       description
+         "Defines the status of a recovery action.";
+       reference
+         "RFC4427: Recovery (Protection and Restoration) Terminology
+          for Generalized Multi-Protocol Label Switching (GMPLS).
+          RFC6378: MPLS Transport Profile (MPLS-TP) Linear Protection";
+     }
+
+     typedef te-template-name {
+       type string {
+         pattern '/?([a-zA-Z0-9\-_.]+)(/[a-zA-Z0-9\-_.]+)*';
+       }
+       description
+         "A type for the name of a TE node template or TE link
+          template.";
+     }
+
+     typedef te-topology-event-type {
+       type enumeration {
+         enum "add" {
+           value 0;
+           description
+             "A TE node or te-link has been added.";
+         }
+         enum "remove" {
+           value 1;
+           description
+             "A TE node or te-link has been removed.";
+         }
+         enum "update" {
+           value 2;
+           description
+             "A TE node or te-link has been updated.";
+         }
+       }
+       description "TE  Event type for notifications";
+     } // te-topology-event-type
+     typedef te-topology-id {
+       type string {
+         pattern '/?([a-zA-Z0-9\-_.]+)(/[a-zA-Z0-9\-_.]+)*';
+       }
+       description
+         "An identifier for a topology.";
+     }
+
+     typedef te-tp-id {
+       type union {
+         type uint32;          // Unnumbered
+         type inet:ip-address; // IPv4 or IPv6 address
+       }
+       description
+         "An identifier for a TE link endpoint on a node.
+          This attribute is mapped to local or remote link identifier in
+          RFC3630 and RFC5305.";
+     }
+
+     /*
+      * Identities
+      */
+
+     /*
+      * Groupings
+      */
+     grouping information-source-attributes {
+       description
+         "The attributes identifying source that has provided the
+          related information, and the source credibility.";
+       leaf information-source {
+         type enumeration {
+           enum "unknown" {
+             description "The source is unknown.";
+           }
+           enum "locally-configured" {
+             description "Configured entity.";
+           }
+           enum "ospfv2" {
+             description "OSPFv2.";
+           }
+           enum "ospfv3" {
+             description "OSPFv3.";
+           }
+           enum "isis" {
+             description "ISIS.";
+           }
+           enum "system-processed" {
+             description "System processed entity.";
+           }
+           enum "other" {
+             description "Other source.";
+           }
+         }
+         description
+           "Indicates the source of the information.";
+       }
+       container information-source-state {
+         description
+           "The container contains state attributes related to
+            the information source.";
+         leaf credibility-preference {
+           type uint16;
+           description
+             "The preference value to calculate the traffic
+              engineering database credibility value used for
+              tie-break selection between different
+              information-source values.
+              Higher value is more preferable.";
+         }
+         container topology {
+           description
+             "When the information is processed by the system,
+              the attributes in this container indicate which topology
+              is used to process to generate the result information.";
+           uses te-topology-ref;
+         } // topology
+         leaf routing-instance {
+           type string;
+           description
+             "When applicable, this is the name of a routing instance
+              from which the information is learned.";
+         } // routing-information
+       }
+     } // information-source-attributes
+
+     grouping performance-metric-attributes {
+       description
+         "Link performance information in real time.";
+       reference
+         "RFC7471: OSPF Traffic Engineering (TE) Metric Extensions.";
+       leaf unidirectional-delay {
+         type uint32 {
+           range 0..16777215;
+         }
+         description "Delay or latency in micro seconds.";
+       }
+       leaf unidirectional-min-delay {
+         type uint32 {
+           range 0..16777215;
+         }
+         description "Minimum delay or latency in micro seconds.";
+       }
+       leaf unidirectional-max-delay {
+         type uint32 {
+           range 0..16777215;
+         }
+         description "Maximum delay or latency in micro seconds.";
+       }
+       leaf unidirectional-delay-variation {
+         type uint32 {
+           range 0..16777215;
+         }
+         description "Delay variation in micro seconds.";
+       }
+       leaf unidirectional-packet-loss {
+         type decimal64 {
+           fraction-digits 6;
+           range "0 .. 50.331642";
+         }
+         description
+           "Packet loss as a percentage of the total traffic sent
+            over a configurable interval. The finest precision is
+            0.000003%.";
+       }
+       leaf unidirectional-residual-bandwidth {
+         type decimal64 {
+           fraction-digits 2;
+         }
+         description
+           "Residual bandwidth that subtracts tunnel
+            reservations from Maximum Bandwidth (or link capacity)
+            [RFC3630] and provides an aggregated remainder across QoS
+            classes.";
+       }
+       leaf unidirectional-available-bandwidth {
+         type decimal64 {
+           fraction-digits 2;
+         }
+         description
+           "Available bandwidth that is defined to be residual
+            bandwidth minus the measured bandwidth used for the
+            actual forwarding of non-RSVP-TE LSP packets.  For a
+            bundled link, available bandwidth is defined to be the
+            sum of the component link available bandwidths.";
+       }
+       leaf unidirectional-utilized-bandwidth {
+         type decimal64 {
+           fraction-digits 2;
+         }
+         description
+           "Bandwidth utilization that represents the actual
+            utilization of the link (i.e. as measured in the router).
+            For a bundled link, bandwidth utilization is defined to
+            be the sum of the component link bandwidth
+            utilizations.";
+       }
+     } // performance-metric-attributes
+     grouping performance-metric-normality-attributes {
+       description
+         "Link performance metric normality attributes.";
+       reference
+         "RFC7471: OSPF Traffic Engineering (TE) Metric Extensions.";
+       leaf unidirectional-delay {
+         type performance-metric-normality;
+         description "Delay normality.";
+       }
+       leaf unidirectional-min-delay {
+         type performance-metric-normality;
+         description "Minimum delay or latency normality.";
+       }
+       leaf unidirectional-max-delay {
+         type performance-metric-normality;
+         description "Maximum delay or latency normality.";
+       }
+       leaf unidirectional-delay-variation {
+         type performance-metric-normality;
+         description "Delay variation normality.";
+       }
+       leaf unidirectional-packet-loss {
+         type performance-metric-normality;
+         description "Packet loss normality.";
+       }
+       leaf unidirectional-residual-bandwidth {
+         type performance-metric-normality;
+         description "Residual bandwidth normality.";
+       }
+       leaf unidirectional-available-bandwidth {
+         type performance-metric-normality;
+         description "Available bandwidth normality.";
+       }
+       leaf unidirectional-utilized-bandwidth {
+         type performance-metric-normality;
+         description "Bandwidth utilization normality.";
+       }
+     } // performance-metric-normality-attributes
+
+     grouping performance-metric-throttle-container {
+       description
+         "A container controlling performance metric throttle.";
+       container performance-metric-throttle {
+         if-feature te-performance-metric;
+         must "suppression-interval >= measure-interval" {
+           error-message
+             "suppression-interval cannot be less then
+              measure-interval.";
+           description
+             "Constraint on suppression-interval and
+              measure-interval.";
+         }
+         description
+           "Link performance information in real time.";
+         reference
+           "RFC7471: OSPF Traffic Engineering (TE) Metric Extensions.";
+         leaf unidirectional-delay-offset {
+           type uint32 {
+             range 0..16777215;
+           }
+           description
+             "Offset value to be added to the measured delay value.";
+         }
+         leaf measure-interval {
+           type uint32;
+           default 30;
+           description
+             "Interval in seconds to measure the extended metric
+              values.";
+         }
+         leaf advertisement-interval {
+           type uint32;
+           description
+             "Interval in seconds to advertise the extended metric
+              values.";
+         }
+         leaf suppression-interval {
+           type uint32 {
+             range "1 .. max";
+           }
+           default 120;
+           description
+             "Interval in seconds to suppress advertising the extended
+              metric values.";
+         }
+         container threshold-out {
+           uses performance-metric-attributes;
+           description
+             "If the measured parameter falls outside an upper bound
+              for all but the min delay metric (or lower bound for
+              min-delay metric only) and the advertised value is not
+              already outside that bound, anomalous announcement will be
+              triggered.";
+         }
+         container threshold-in {
+           uses performance-metric-attributes;
+           description
+             "If the measured parameter falls inside an upper bound
+              for all but the min delay metric (or lower bound for
+              min-delay metric only) and the advertised value is not
+              already inside that bound, normal (anomalous-flag cleared)
+              announcement will be triggered.";
+         }
+         container threshold-accelerated-advertisement {
+           description
+             "When the difference between the last advertised value and
+              current measured value exceed this threshold, anomalous
+              announcement will be triggered.";
+           uses performance-metric-attributes;
+         }
+       }
+     } // performance-metric-throttle-container
+
+     grouping te-link-augment {
+       description
+         "Augmentation for TE link.";
+
+       container te {
+         presence "TE support.";
+         description
+           "Indicates TE support.";
+
+         container config {
+           description
+             "Configuration data.";
+           uses te-link-config;
+         } // config
+         container state {
+           config false;
+           description
+             "Operational state data.";
+           uses te-link-config;
+           uses te-link-state-derived;
+         } // state
+       } // te
+     } // te-link-augment
+
+     grouping te-link-config {
+       description
+         "TE link configuration grouping.";
+       choice bundle-stack-level {
+         description
+           "The TE link can be partitioned into bundled
+            links, or component links.";
+         case bundle {
+           container bundled-links {
+             description
+               "A set of bundled links.";
+             reference
+               "RFC4201: Link Bundling in MPLS Traffic Engineering
+               (TE).";
+             list bundled-link {
+               key "sequence";
+               description
+                 "Specify a bundled interface that is
+                  further partitioned.";
+               leaf sequence {
+                 type uint32;
+                 description
+                   "Identify the sequence in the bundle.";
+               }
+               leaf src-tp-ref {
+                 type leafref {
+                   path "../../../../../../nw:node[nw:node-id = "
+                     + "current()/../../../../../nt:source/"
+                     + "nt:source-node]/"
+                     + "nt:termination-point/nt:tp-id";
+                   require-instance true;
+                 }
+                 description
+                   "Reference to another TE termination point on the
+                    same souruce node.";
+               }
+               leaf des-tp-ref {
+                 type leafref {
+                   path "../../../../../../nw:node[nw:node-id = "
+                     + "current()/../../../../../nt:destination/"
+                     + "nt:dest-node]/"
+                     + "nt:termination-point/nt:tp-id";
+                   require-instance true;
+                 }
+                 description
+                   "Reference to another TE termination point on the
+                    same destination node.";
+               }
+             } // list bundled-link
+           }
+         }
+         case component {
+           container component-links {
+             description
+               "A set of component links";
+             list component-link {
+               key "sequence";
+               description
+                 "Specify a component interface that is
+                  sufficient to unambiguously identify the
+                  appropriate resources";
+
+               leaf sequence {
+                 type uint32;
+                 description
+                   "Identify the sequence in the bundle.";
+               }
+               leaf src-interface-ref {
+                 type string;
+                 description
+                   "Reference to component link interface on the
+                    source node.";
+               }
+               leaf des-interface-ref {
+                 type string;
+                 description
+                   "Reference to component link interface on the
+                    destinatioin node.";
+               }
+             }
+           }
+         }
+       } // bundle-stack-level
+
+       leaf-list te-link-template {
+         if-feature template;
+         type leafref {
+           path "../../../../../te/templates/link-template/name";
+         }
+         description
+           "The reference to a TE link template.";
+       }
+       uses te-link-config-attributes;
+     } // te-link-config
+
+     grouping te-link-config-attributes {
+       description
+         "Link configuration attributes in a TE topology.";
+       container te-link-attributes {
+         description "Link attributes in a TE topology.";
+         uses sch:schedules;
+         leaf access-type {
+           type te-link-access-type;
+           description
+             "Link access type, which can be point-to-point or
+              multi-access.";
+         }
+         leaf is-abstract {
+           type empty;
+           description "Present if the link is abstract.";
+         }
+         leaf name {
+           type string;
+           description "Link Name.";
+         }
+         container underlay {
+           if-feature te-topology-hierarchy;
+           presence
+             "Indicates the underlay exists for this link.";
+           description "Attributes of the te-link underlay.";
+           reference
+             "RFC4206: Label Switched Paths (LSP) Hierarchy with
+              Generalized Multi-Protocol Label Switching (GMPLS)
+              Traffic Engineering (TE)";
+
+           uses te-link-underlay-attributes;
+         } // underlay
+         leaf admin-status {
+           type te-admin-status;
+           description
+             "The administrative state of the link.";
+         }
+
+         uses performance-metric-throttle-container;
+         uses te-link-info-attributes;
+       } // te-link-attributes
+     } // te-link-config-attributes
+
+     grouping te-link-info-attributes {
+       description
+         "Advertised TE information attributes.";
+       leaf link-index {
+         type uint64;
+         description
+           "The link identifier.  If OSPF is used, this represents an
+            ospfLsdbID.  If IS-IS is used, this represents an isisLSPID.
+            If a locally configured link is used, this object represents
+            a unique value, which is locally defined in a router.";
+       }
+       leaf administrative-group {
+         type te-types:admin-groups;
+         description
+           "Administrative group or color of the link.
+            This attribute covers both administrative group (defined in
+            RFC3630, RFC5329, and RFC5305), and extended administrative
+            group (defined in RFC7308).";
+       }
+       leaf max-link-bandwidth {
+         type decimal64 {
+           fraction-digits 2;
+         }
+         description
+           "Maximum bandwidth that can be seen on this link in this
+            direction. Units in bytes per second.";
+         reference
+           "RFC3630: Traffic Engineering (TE) Extensions to OSPF
+            Version 2.
+            RFC5305: IS-IS Extensions for Traffic Engineering.";
+       }
+       leaf max-resv-link-bandwidth {
+         type decimal64 {
+           fraction-digits 2;
+         }
+         description
+           "Maximum amount of bandwidth that can be reserved in this
+            direction in this link. Units in bytes per second.";
+         reference
+           "RFC3630: Traffic Engineering (TE) Extensions to OSPF
+            Version 2.
+            RFC5305: IS-IS Extensions for Traffic Engineering.";
+       }
+       list unreserved-bandwidth {
+         key "priority";
+         max-elements "8";
+         description
+           "Unreserved bandwidth for 0-7 priority levels. Units in
+            bytes per second.";
+         reference
+           "RFC3630: Traffic Engineering (TE) Extensions to OSPF
+            Version 2.
+            RFC5305: IS-IS Extensions for Traffic Engineering.";
+         leaf priority {
+           type uint8 {
+             range "0..7";
+           }
+           description "Priority.";
+         }
+         leaf bandwidth {
+           type decimal64 {
+             fraction-digits 2;
+           }
+           description
+             "Unreserved bandwidth for this level.";
+         }
+       }
+       leaf te-default-metric {
+         type uint32;
+         description
+           "Traffic Engineering Metric.";
+       }
+       container performance-metric {
+         if-feature te-performance-metric;
+         description
+           "Link performance information in real time.";
+         reference
+           "RFC7471: OSPF Traffic Engineering (TE) Metric Extensions.";
+         container measurement {
+           description
+             "Measured performance metric values. Static configuration
+              and manual overrides of these measurements are also
+              allowed.";
+           uses performance-metric-attributes;
+         }
+         container normality
+         {
+           description
+             "Performance metric normality values.";
+           uses performance-metric-normality-attributes;
+         }
+       }
+       leaf link-protection-type {
+         type enumeration {
+           enum "unprotected" {
+             description "Unprotected.";
+           }
+           enum "extra-traffic" {
+             description "Extra traffic.";
+           }
+           enum "shared" {
+             description "Shared.";
+           }
+           enum "1-for-1" {
+             description "One for one protection.";
+           }
+           enum "1-plus-1" {
+             description "One plus one protection.";
+           }
+           enum "enhanced" {
+             description "Enhanced protection.";
+           }
+         }
+         description
+           "Link Protection Type desired for this link.";
+         reference
+           "RFC4202: Routing Extensions in Support of
+            Generalized Multi-Protocol Label Switching (GMPLS).";
+       }
+       list interface-switching-capability {
+         key "switching-capability";
+         description
+           "List of Interface Switching Capabilities Descriptors (ISCD)
+            for this link.";
+         reference
+           "RFC3471: Generalized Multi-Protocol Label Switching (GMPLS)
+            Signaling Functional Description.
+            RFC4203: OSPF Extensions in Support of Generalized
+            Multi-Protocol Label Switching (GMPLS).";
+         leaf switching-capability {
+           type identityref {
+             base te-types:switching-capabilities;
+           }
+           description
+             "Switching Capability for this interface.";
+         }
+         leaf encoding {
+           type identityref {
+             base te-types:lsp-encoding-types;
+           }
+           description
+             "Encoding supported by this interface.";
+         }
+         list max-lsp-bandwidth {
+           key "priority";
+           max-elements "8";
+           description
+             "Maximum LSP Bandwidth at priorities 0-7.";
+           leaf priority {
+             type uint8 {
+               range "0..7";
+             }
+             description "Priority.";
+           }
+           leaf bandwidth {
+             type decimal64 {
+               fraction-digits 2;
+             }
+             description
+               "Max LSP Bandwidth for this level";
+           }
+         }
+         container time-division-multiplex-capable {
+           when "../switching-capability = 'TDM'" {
+             description "Valid only for TDM";
+           }
+           description
+             "Interface has time-division multiplex capabilities.";
+
+           leaf minimum-lsp-bandwidth {
+             type decimal64 {
+               fraction-digits 2;
+             }
+             description
+               "Minimum LSP Bandwidth. Units in bytes per second.";
+           }
+           leaf indication {
+             type enumeration {
+               enum "standard" {
+                 description
+                   "Indicates support of standard SONET/SDH.";
+               }
+               enum "arbitrary" {
+                 description
+                   "Indicates support of arbitrary SONET/SDH.";
+               }
+             }
+             description
+               "Indication whether the interface supports Standard or
+                Arbitrary SONET/SDH";
+           }
+         }
+         list interface-adjustment-capability {
+           key "upper-sc";
+           description
+             "List of Interface Adjustment Capability Descriptors (IACD)
+              for this link.";
+           reference
+             "RFC6001: Generalized MPLS (GMPLS) Protocol Extensions
+              for Multi-Layer and Multi-Region Networks (MLN/MRN).";
+           leaf upper-sc {
+             type identityref {
+               base te-types:switching-capabilities;
+             }
+             description
+               "Switching Capability for this interface.";
+           }
+           leaf upper-encoding {
+             type identityref {
+               base te-types:lsp-encoding-types;
+             }
+             description
+               "Encoding supported by this interface.";
+           }
+           list max-lsp-bandwidth {
+             key "priority";
+             max-elements "8";
+             description
+               "Maximum LSP Bandwidth at priorities 0-7.";
+             leaf priority {
+               type uint8 {
+                 range "0..7";
+               }
+               description "Priority.";
+             }
+             leaf bandwidth {
+               type decimal64 {
+                 fraction-digits 2;
+               }
+               description
+                 "Max LSP Bandwidth for this level.";
+             }
+           }
+         } // interface-adjustment-capability
+       } // interface-switching-capability
+       container te-srlgs {
+         description
+           "A list of SLRGs.";
+         leaf-list values {
+           type te-types:srlg;
+           description "SRLG value.";
+           reference
+             "RFC4202: Routing Extensions in Support of
+              Generalized Multi-Protocol Label Switching (GMPLS).";
+         }
+       }
+     } // te-link-info-attributes
+
+     grouping te-link-state-derived {
+       description
+         "Link state attributes in a TE topology.";
+       leaf oper-status {
+         type te-oper-status;
+         description
+           "The current operational state of the link.";
+       }
+       uses information-source-attributes;
+       list alt-information-sources {
+         key "information-source";
+         description
+           "A list of information sources learned but not used.";
+         uses information-source-attributes;
+         uses te-link-info-attributes;
+       }
+       container recovery {
+         description
+           "Status of the recovery process.";
+         leaf restoration-status {
+           type te-recovery-status;
+           description
+             "Restoration status.";
+         }
+         leaf protection-status {
+           type te-recovery-status;
+           description
+             "Protection status.";
+         }
+       }
+       container underlay {
+         if-feature te-topology-hierarchy;
+         description "State attributes for te-link underlay.";
+         uses te-link-state-underlay-attributes;
+       }
+     } // te-link-state-derived
+     grouping te-link-state-underlay-attributes {
+       description "State attributes for te-link underlay.";
+       leaf dynamic {
+         type boolean;
+         description
+           "true if the underlay is dynamically created.";
+       }
+       leaf committed {
+         type boolean;
+         description
+           "true if the underlay is committed.";
+       }
+     } // te-link-state-underlay-attributes
+
+     grouping te-link-underlay-attributes {
+       description "Attributes for  te-link underlay.";
+       reference
+         "RFC4206: Label Switched Paths (LSP) Hierarchy with
+          Generalized Multi-Protocol Label Switching (GMPLS)
+          Traffic Engineering (TE)";
+       container underlay-primary-path {
+         description
+           "The service path on the underlay topology that
+            supports this link.";
+         uses te-topology-ref;
+         list path-element {
+           key "path-element-id";
+           description
+             "A list of path elements describing the service path.";
+           leaf path-element-id {
+             type uint32;
+             description "To identify the element in a path.";
+           }
+           uses te-path-element;
+         }
+       } // underlay-primary-path
+       list underlay-backup-path {
+         key "index";
+         description
+           "A list of backup service paths on the underlay topology that
+            protect the underlay primary path. If the primary path is
+            not protected, the list contains zero elements. If the
+            primary path is protected, the list contains one or more
+            elements.";
+         leaf index {
+           type uint32;
+           description
+             "A sequence number to identify a backup path.";
+         }
+         uses te-topology-ref;
+         list path-element {
+           key "path-element-id";
+           description
+             "A list of path elements describing the backup service
+              path";
+           leaf path-element-id {
+             type uint32;
+             description "To identify the element in a path.";
+           }
+           uses te-path-element;
+         }
+       } // underlay-backup-path
+       leaf underlay-protection-type {
+         type uint16;
+         description
+           "Underlay protection type desired for this link";
+       }
+       container underlay-trail-src {
+         uses nt:tp-ref;
+         description
+           "Source TE link of the underlay trail.";
+       }
+       container underlay-trail-des {
+         uses nt:tp-ref;
+         description
+           "Destination TE link of the underlay trail.";
+       }
+     } // te-link-underlay-attributes
+
+     grouping te-node-augment {
+       description
+         "Augmentation for TE node.";
+
+       container te {
+         presence "TE support.";
+         description
+           "Indicates TE support.";
+
+         leaf te-node-id {
+           type te-node-id;
+           mandatory true;
+           description
+             "The identifier of a node in the TE topology.
+              A node is specific to a topology to which it belongs.";
+         }
+
+         container config {
+           description
+             "Configuration data.";
+           uses te-node-config;
+         } // config
+         container state {
+           config false;
+           description
+             "Operational state data.";
+
+           uses te-node-config;
+           uses te-node-state-derived;
+         } // state
+
+         list tunnel-termination-point {
+           key "tunnel-tp-id";
+           description
+             "A termination point can terminate a tunnel.";
+           leaf tunnel-tp-id {
+             type binary;
+             description
+               "Tunnel termination point identifier.";
+           }
+           container config {
+             description
+               "Configuration data.";
+             uses te-node-tunnel-termination-capability;
+           }
+
+           container state {
+             config false;
+             description
+               "Operational state data.";
+
+             uses te-node-tunnel-termination-capability;
+             leaf switching-capability {
+               type identityref {
+                 base te-types:switching-capabilities;
+               }
+               mandatory true;
+               description
+                 "Switching Capability.";
+             }
+             leaf encoding {
+               type identityref {
+                 base te-types:lsp-encoding-types;
+               }
+               mandatory true;
+               description
+                 "Encoding type.";
+             }
+           } // state
+
+         } // tunnel-termination-point
+       } // te
+     } // te-node-augment
+
+     grouping te-node-config {
+       description "TE node configuration grouping.";
+
+       leaf-list te-node-template {
+         if-feature template;
+         type leafref {
+           path "../../../../../te/templates/node-template/name";
+         }
+         description
+           "The reference to a TE node template.";
+       }
+       uses te-node-config-attributes;
+     } // te-node-config
+
+     grouping te-node-config-attributes {
+       description "Configuration node attributes in a TE topology.";
+       container te-node-attributes {
+         description "Containing node attributes in a TE topology.";
+         uses sch:schedules;
+         leaf admin-status {
+           type te-admin-status;
+           description
+             "The administrative state of the link.";
+         }
+         uses te-node-connectivity-matrix;
+         uses te-node-info-attributes;
+       } // te-node-attributes
+     } // te-node-config-attributes
+
+     grouping te-node-config-attributes-notification {
+       description
+         "Configuration node attributes for template in a TE topology.";
+       container te-node-attributes {
+         description "Containing node attributes in a TE topology.";
+         uses sch:schedules;
+         leaf admin-status {
+           type te-admin-status;
+           description
+             "The administrative state of the link.";
+         }
+         uses te-node-connectivity-matrix-abs;
+         uses te-node-info-attributes;
+       } // te-node-attributes
+     } // te-node-config-attributes-notification
+
+     grouping te-node-config-attributes-template {
+       description
+         "Configuration node attributes for template in a TE topology.";
+       container te-node-attributes {
+         description "Containing node attributes in a TE topology.";
+         uses sch:schedules;
+         leaf admin-status {
+           type te-admin-status;
+           description
+             "The administrative state of the link.";
+         }
+         uses te-node-info-attributes;
+       } // te-node-attributes
+     } // te-node-config-attributes-template
+
+     grouping te-node-connectivity-matrix {
+       description "Connectivity matrix on a TE node.";
+       list connectivity-matrix {
+         key "id";
+         description
+           "Represents node's switching limitations, i.e. limitations
+            in interconnecting network TE links across the node.";
+         reference
+           "RFC7579: General Network Element Constraint Encoding
+            for GMPLS-Controlled Networks.";
+         leaf id {
+           type uint32;
+           description "Identifies the connectivity-matrix entry.";
+         }
+         container from {
+           leaf tp-ref {
+             type leafref {
+               path "../../../../../../nt:termination-point/nt:tp-id";
+             }
+             description
+               "Relative reference to source termination point.";
+           }
+           description
+             "Reference to source NTP.";
+         }
+         container to {
+           leaf tp-ref {
+             type leafref {
+               path "../../../../../../nt:termination-point/nt:tp-id";
+             }
+             description
+               "Relative reference to destination termination point.";
+           }
+           description
+             "Reference to destination NTP.";
+         }
+         leaf is-allowed {
+           type boolean;
+           description
+             "true  - switching is allowed,
+              false - switching is disallowed.";
+         }
+       }
+     } // te-node-connectivity-matrix
+
+     grouping te-node-connectivity-matrix-abs {
+       description
+         "Connectivity matrix on a TE node, using absolute
+          paths to reference termination points.";
+       list connectivity-matrix {
+         key "id";
+         description
+           "Represents node's switching limitations, i.e. limitations
+            in interconnecting network TE links across the node.";
+         reference
+           "RFC7579: General Network Element Constraint Encoding
+            for GMPLS-Controlled Networks.";
+         leaf id {
+           type uint32;
+           description "Identifies the connectivity-matrix entry.";
+         }
+         container from {
+           uses nt:tp-ref;
+           description
+             "Reference to source NTP.";
+         }
+         container to {
+           uses nt:tp-ref;
+           description
+             "Reference to destination NTP.";
+         }
+         leaf is-allowed {
+           type boolean;
+           description
+             "true  - switching is allowed,
+              false - switching is disallowed.";
+         }
+       }
+     } // te-node-connectivity-matrix-abs
+
+     grouping te-node-info-attributes {
+       description
+         "Advertised TE information attributes.";
+       leaf domain-id {
+         type uint32;
+         description
+           "Identifies the domain that this node belongs.
+            This attribute is used to support inter-domain links.";
+         reference
+           "RFC5152: A Per-Domain Path Computation Method for
+            Establishing Inter-Domain Traffic Engineering (TE)
+            Label Switched Paths (LSPs).
+            RFC5392: OSPF Extensions in Support of Inter-Autonomous
+            System (AS) MPLS and GMPLS Traffic Engineering.
+            RFC5316: ISIS Extensions in Support of Inter-Autonomous
+            System (AS) MPLS and GMPLS Traffic Engineering.";
+       }
+       leaf is-abstract {
+         type empty;
+         description
+           "Present if the node is abstract, not present if the node
+            is actual.";
+       }
+       leaf name {
+         type inet:domain-name;
+         description "Node name.";
+       }
+       leaf-list signaling-address {
+         type inet:ip-address;
+         description "Node signaling address.";
+       }
+       container underlay-topology {
+         if-feature te-topology-hierarchy;
+         description
+           "When an abstract node encapsulates a topology,
+            the attributes in this container point to said topology.";
+         uses te-topology-ref;
+       }
+     } // te-node-info-attributes
+
+     grouping te-node-state-derived {
+       description "Node state attributes in a TE topology.";
+       leaf oper-status {
+         type te-oper-status;
+         description
+           "The current operational state of the node.";
+       }
+       leaf is-multi-access-dr {
+         type empty;
+         description
+           "The presence of this attribute indicates that this TE node
+            is a pseudonode elected as a designated router.";
+         reference
+           "RFC3630: Traffic Engineering (TE) Extensions to OSPF
+            Version 2.
+            RFC1195: Use of OSI IS-IS for Routing in TCP/IP and Dual
+            Environments.";
+       }
+       uses information-source-attributes;
+       list alt-information-sources {
+         key "information-source";
+         description
+           "A list of information sources learned but not used.";
+         uses information-source-attributes;
+         uses te-node-connectivity-matrix;
+         uses te-node-info-attributes;
+       }
+     } // te-node-state-derived
+
+     grouping te-node-state-derived-notification {
+       description "Node state attributes in a TE topology.";
+       leaf oper-status {
+         type te-oper-status;
+         description
+           "The current operational state of the node.";
+       }
+       leaf is-multi-access-dr {
+         type empty;
+         description
+           "The presence of this attribute indicates that this TE node
+            is a pseudonode elected as a designated router.";
+         reference
+           "RFC3630: Traffic Engineering (TE) Extensions to OSPF
+            Version 2.
+            RFC1195: Use of OSI IS-IS for Routing in TCP/IP and Dual
+            Environments.";
+       }
+       uses information-source-attributes;
+       list alt-information-sources {
+         key "information-source";
+         description
+           "A list of information sources learned but not used.";
+         uses information-source-attributes;
+         uses te-node-connectivity-matrix-abs;
+         uses te-node-info-attributes;
+       }
+     } // te-node-state-derived-notification
+
+     grouping te-node-tunnel-termination-capability {
+       description
+         "Termination capability of a tunnel termination point on a
+          TE node.";
+
+       list termination-capability {
+         key "link-tp";
+         description
+           "The termination capabilities between
+            tunnel-termination-point and link termination-point.
+            The capability information can be used to compute
+            the tunnel path.";
+         leaf link-tp {
+           type leafref {
+             path "../../../../../nt:termination-point/nt:tp-id";
+           }
+           description
+             "Link termination point.";
+         }
+       } // termination-capability
+     } // te-node-tunnel-termination-capability
+
+     grouping te-path-element {
+       description
+         "A group of attributes defining an element in a TE path
+          such as TE node, TE link, TE atomic resource or label.";
+       uses te-types:explicit-route-subobject;
+     } // te-path-element
+
+     grouping te-termination-point-augment {
+       description
+         "Augmentation for TE termination point.";
+
+       container te {
+         presence "TE support.";
+         description
+           "Indicates TE support.";
+
+         leaf te-tp-id {
+           type te-tp-id;
+           mandatory true;
+           description
+             "An identifier to uniquely identify a TE termination
+              point.";
+         }
+
+         container config {
+           description
+             "Configuration data.";
+           uses te-termination-point-config;
+         } // config
+         container state {
+           config false;
+           description
+             "Operational state data.";
+           uses te-termination-point-config;
+         } // state
+       } // te
+     } // te-termination-point-augment
+
+     grouping te-termination-point-config {
+       description
+         "TE termination point configuration grouping.";
+       uses sch:schedules;
+     } // te-termination-point-config
+
+     grouping te-topologies-augment {
+       description
+         "Augmentation for TE topologies.";
+
+       container te {
+         presence "TE support.";
+         description
+           "Indicates TE support.";
+
+         container templates {
+           description
+             "Configuration parameters for templates used for TE
+              topology.";
+
+           list node-template {
+             if-feature template;
+             key "name";
+             leaf name {
+               type te-template-name;
+               description
+                 "The name to identify a TE node template.";
+             }
+             description
+               "The list of TE node templates used to define sharable
+                and reusable TE node attributes.";
+             uses template-attributes;
+             uses te-node-config-attributes-template;
+           } // node-template
+
+           list link-template {
+             if-feature template;
+             key "name";
+             leaf name {
+               type te-template-name;
+               description
+                 "The name to identify a TE link template.";
+             }
+             description
+               "The list of TE link templates used to define sharable
+                and reusable TE link attributes.";
+             uses template-attributes;
+             uses te-link-config-attributes;
+           } // link-template
+         } // templates
+       } // te
+     } // te-topologies-augment
+
+     grouping te-topology-augment {
+       description
+         "Augmentation for TE topology.";
+
+       container te {
+         presence "TE support.";
+         description
+           "Indicates TE support.";
+
+         leaf provider-id {
+           type te-global-id;
+           mandatory true;
+           description
+             "An identifier to uniquely identify a provider.";
+         }
+         leaf client-id {
+           type te-global-id;
+           mandatory true;
+           description
+             "An identifier to uniquely identify a client.";
+         }
+         leaf te-topology-id {
+           type te-topology-id;
+           mandatory true;
+           description
+             "It is presumed that a datastore will contain many
+              topologies. To distinguish between topologies it is
+              vital to have UNIQUE topology identifiers.";
+         }
+
+         container config {
+           description
+             "Configuration data.";
+           uses te-topology-config;
+         } // config
+         container state {
+           config false;
+           description
+             "Operational state data.";
+           uses te-topology-config;
+         } // state
+       } // te
+     } // te-topology-augment
+
+     grouping te-topology-config {
+       description
+         "TE topology configuration grouping.";
+       uses sch:schedules;
+       leaf preference {
+         type uint8 {
+           range "1..255";
+         }
+         description
+           "Specifies a preference for this topology. A lower number
+            indicates a higher preference.";
+       }
+     } // te-topology-config
+
+     grouping te-topology-ref {
+       description
+         "References a TE topology.";
+       leaf provider-id-ref {
+         type leafref {
+           path "/nw:networks/nw:network[nw:network-id = "
+             + "current()/../network-id-ref]/tet:te/tet:provider-id";
+           require-instance false;
+         }
+         description
+           "A reference to a provider-id.";
+       }
+       leaf client-id-ref {
+         type leafref {
+           path "/nw:networks/nw:network[nw:network-id = "
+             + "current()/../network-id-ref]/tet:te/tet:client-id";
+           require-instance false;
+         }
+         description
+           "A reference to a client-id.";
+       }
+       leaf te-topology-id-ref {
+         type leafref {
+           path "/nw:networks/nw:network[nw:network-id = "
+             + "current()/../network-id-ref]/tet:te/tet:te-topology-id";
+           require-instance false;
+         }
+         description
+           "A reference to a te-topology-id.";
+       }
+       leaf network-id-ref {
+         type leafref {
+           path "/nw:networks/nw:network/nw:network-id";
+           require-instance false;
+         }
+         description
+           "A reference to a network-id in base ietf-network module.";
+       }
+     } // te-topology-ref
+
+     grouping te-topology-type {
+       description
+         "Identifies the TE topology type.";
+       container te-topology {
+         presence "Indicates TE topology.";
+         description
+           "Its presence identifies the TE topology type.";
+       }
+     } // te-topology-type
+
+     grouping template-attributes {
+       description
+         "Common attributes for all templates.";
+
+       leaf priority {
+         type uint16;
+         description
+           "The preference value to resolve conflicts between different
+            templates. When two or more templates specify values for
+            one configuration attribute, the value from the template
+            with the highest priority is used.";
+       }
+       leaf reference-change-policy {
+         type enumeration {
+           enum no-action {
+             description
+               "When an attribute changes in this template, the
+                configuration node referring to this template does
+                not take any action.";
+           }
+           enum not-allowed {
+             description
+               "When any configuration object has a reference to this
+                template, changing this template is not allowed.";
+           }
+           enum cascade {
+             description
+               "When an attribute changes in this template, the
+                configuration object referring to this template applies
+                the new attribute value to the corresponding
+                configuration.";
+           }
+         }
+         description
+           "This attribute specifies the action taken to a configuration
+            node that has a reference to this template.";
+       }
+     } // template-attributes
+
+     /*
+      * Configuration data nodes
+      */
+     augment "/nw:networks/nw:network/nw:network-types" {
+       description
+         "Introduce new network type for TE topology.";
+       uses te-topology-type;
+     }
+
+     augment "/nw:networks" {
+       description
+         "Augmentation parameters for TE topologies.";
+       uses te-topologies-augment;
+     }
+
+     augment "/nw:networks/nw:network" {
+       when "nw:network-types/te-topology" {
+         description
+           "Augmentation parameters apply only for networks with
+            TE topology type.";
+       }
+       description
+         "Configuration parameters for TE topology.";
+       uses te-topology-augment;
+     }
+
+     augment "/nw:networks/nw:network/nw:node" {
+       when "../nw:network-types/te-topology" {
+         description
+           "Augmentation parameters apply only for networks with
+            TE topology type.";
+       }
+       description
+         "Configuration parameters for TE at node level.";
+       uses te-node-augment;
+     }
+
+     augment "/nw:networks/nw:network/nt:link" {
+       when "../nw:network-types/te-topology" {
+         description
+           "Augmentation parameters apply only for networks with
+            TE topology type.";
+       }
+       description
+         "Configuration parameters for TE at link level";
+       uses te-link-augment;
+     }
+
+     augment "/nw:networks/nw:network/nw:node/"
+           + "nt:termination-point" {
+       when "../../nw:network-types/te-topology" {
+         description
+           "Augmentation parameters apply only for networks with
+            TE topology type.";
+       }
+       description
+         "Configuration parameters for TE at termination point level";
+       uses te-termination-point-augment;
+     }
+
+     /*
+      * Operational state data nodes
+      */
+
+     /*
+      * Notifications
+      */
+     notification te-node-event {
+       description "Notification event for TE node.";
+       leaf event-type {
+         type te-topology-event-type;
+         description "Event type.";
+       }
+       uses nw:node-ref;
+       uses te-topology-type;
+       uses tet:te-node-config-attributes-notification;
+       uses tet:te-node-state-derived-notification;
+     }
+
+     notification te-link-event {
+       description "Notification event for TE link.";
+       leaf event-type {
+         type te-topology-event-type;
+         description "Event type";
+       }
+       uses nt:link-ref;
+       uses te-topology-type;
+       uses tet:te-link-config-attributes;
+       uses tet:te-link-state-derived;
+     }
+
+     augment "/te-link-event/te-link-attributes/underlay" {
+       description "Add state attributes to te-link underlay.";
+       uses te-link-state-underlay-attributes;
+     }
+   }
diff --git a/compiler/plugin/maven/src/test/resources/interfileietf/ietf-te-types.yang b/compiler/plugin/maven/src/test/resources/interfileietf/ietf-te-types.yang
new file mode 100644
index 0000000..9347f26
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/interfileietf/ietf-te-types.yang
@@ -0,0 +1,870 @@
+   module ietf-te-types {
+
+     namespace "urn:ietf:params:xml:ns:yang:ietf-te-types";
+
+     /* Replace with IANA when assigned */
+     prefix "te-types";
+
+     import ietf-inet-types {
+       prefix inet;
+     }
+
+     organization
+       "IETF Traffic Engineering Architecture and Signaling (TEAS)
+        Working Group";
+
+     contact
+       "WG Web:   <http://tools.ietf.org/wg/teas/>
+        WG List:  <mailto:teas@ietf.org>
+
+        WG Chair: Lou Berger
+                  <mailto:lberger@labn.net>
+
+        WG Chair: Vishnu Pavan Beeram
+                  <mailto:vbeeram@juniper.net>
+
+        Editor:   Tarek Saad
+                  <mailto:tsaad@cisco.com>
+
+        Editor:   Rakesh Gandhi
+                  <mailto:rgandhi@cisco.com>
+
+        Editor:   Vishnu Pavan Beeram
+                  <mailto:vbeeram@juniper.net>
+
+        Editor:   Himanshu Shah
+                  <mailto:hshah@ciena.com>
+
+        Editor:   Xufeng Liu
+                  <mailto:xufeng.liu@ericsson.com>
+
+        Editor:   Xia Chen
+                  <mailto:jescia.chenxia@huawei.com>
+
+        Editor:   Raqib Jones
+                  <mailto:raqib@Brocade.com>
+
+        Editor:   Bin Wen
+                  <mailto:Bin_Wen@cable.comcast.com>";
+
+     description
+       "This module contains a collection of generally
+       useful TE specific YANG data type defintions.";
+
+     revision 2016-03-20 {
+       description "Latest revision of TE generic types";
+       reference "RFC3209";
+     }
+
+     identity tunnel-type {
+       description
+         "Base identity from which specific tunnel types are
+         derived.";
+     }
+
+     identity tunnel-p2p {
+       base tunnel-type;
+       description
+         "TE point-to-point tunnel type.";
+     }
+
+     identity tunnel-p2mp {
+       base tunnel-type;
+       description
+         "TE point-to-multipoint tunnel type.";
+     }
+
+     identity state-type {
+       description
+         "Base identity for TE states";
+     }
+
+     identity state-up {
+       base state-type;
+       description
+         "State up";
+     }
+
+     identity state-down {
+       base state-type;
+       description
+         "State down";
+     }
+
+     identity lsp-prot-type {
+       description
+         "Base identity from which LSP protection types are
+         derived.";
+     }
+
+     identity lsp-prot-unprotected {
+       description
+         "LSP protection 'Unprotected'";
+       reference "RFC4872";
+     }
+
+     identity lsp-prot-reroute-extra {
+       description
+         "LSP protection '(Full) Rerouting'";
+       reference "RFC4872";
+     }
+
+     identity lsp-prot-reroute {
+       description
+         "LSP protection 'Rerouting without Extra-Traffic'";
+       reference "RFC4872";
+     }
+
+     identity lsp-prot-1-for-n {
+       description
+         "LSP protection '1:N Protection with Extra-Traffic'";
+       reference "RFC4872";
+     }
+
+     identity lsp-prot-unidir-1-to-1 {
+       description
+         "LSP protection '1+1 Unidirectional Protection'";
+       reference "RFC4872";
+     }
+
+     identity lsp-prot-bidir-1-to-1 {
+       description
+         "LSP protection '1+1 Bidirectional Protection'";
+       reference "RFC4872";
+     }
+
+     identity switching-capabilities {
+       description
+         "Base identity for interface switching capabilities";
+     }
+
+     identity switching-psc1 {
+       base switching-capabilities;
+       description
+         "Packet-Switch Capable-1 (PSC-1)";
+     }
+
+     identity switching-evpl {
+       base switching-capabilities;
+       description
+         "Ethernet Virtual Private Line (EVPL)";
+     }
+
+     identity switching-l2sc {
+       base switching-capabilities;
+       description
+         "Layer-2 Switch Capable (L2SC)";
+     }
+
+     identity switching-tdm {
+       base switching-capabilities;
+       description
+         "Time-Division-Multiplex Capable (TDM)";
+     }
+
+     identity switching-otn {
+       base switching-capabilities;
+       description
+         "OTN-TDM capable";
+     }
+
+     identity switching-dcsc {
+       base switching-capabilities;
+       description
+         "Data Channel Switching Capable (DCSC)";
+     }
+     identity switching-lsc {
+       base switching-capabilities;
+       description
+         "Lambda-Switch Capable (LSC)";
+     }
+
+     identity switching-fsc {
+       base switching-capabilities;
+       description
+         "Fiber-Switch Capable (FSC)";
+     }
+
+     identity lsp-encoding-types {
+       description
+         "Base identity for encoding types";
+     }
+
+     identity lsp-encoding-packet {
+       base lsp-encoding-types;
+       description
+         "Packet LSP encoding";
+     }
+
+     identity lsp-encoding-ethernet {
+       base lsp-encoding-types;
+       description
+         "Ethernet LSP encoding";
+     }
+
+     identity lsp-encoding-pdh {
+       base lsp-encoding-types;
+       description
+         "ANSI/ETSI LSP encoding";
+     }
+
+     identity lsp-encoding-sdh {
+       base lsp-encoding-types;
+       description
+         "SDH ITU-T G.707 / SONET ANSI T1.105 LSP encoding";
+     }
+
+     identity lsp-encoding-digital-wrapper {
+       base lsp-encoding-types;
+       description
+         "Digital Wrapper LSP encoding";
+     }
+
+     identity lsp-encoding-lambda {
+       base lsp-encoding-types;
+       description
+         "Lambda (photonic) LSP encoding";
+     }
+
+     identity lsp-encoding-fiber {
+       base lsp-encoding-types;
+       description
+         "Fiber LSP encoding";
+     }
+
+     identity lsp-encoding-fiber-channel {
+       base lsp-encoding-types;
+       description
+         "FiberChannel LSP encoding";
+     }
+
+     identity lsp-encoding-oduk {
+       base lsp-encoding-types;
+       description
+         "G.709 ODUk (Digital Path)LSP encoding";
+     }
+
+     identity lsp-encoding-optical-channel {
+       base lsp-encoding-types;
+       description
+         "Line (e.g., 8B/10B) LSP encoding";
+     }
+
+     identity lsp-encoding-line {
+       base lsp-encoding-types;
+       description
+         "Line (e.g., 8B/10B) LSP encoding";
+     }
+
+     /* TE basic features */
+     feature p2mp-te {
+       description
+         "Indicates support for P2MP-TE";
+     }
+
+     feature frr-te {
+       description
+         "Indicates support for TE FastReroute (FRR)";
+     }
+
+     feature extended-admin-groups {
+       description
+         "Indicates support for TE link extended admin
+         groups.";
+     }
+
+     feature named-path-affinities {
+       description
+         "Indicates support for named path affinities";
+     }
+
+     feature named-extended-admin-groups {
+       description
+         "Indicates support for named extended admin groups";
+     }
+
+     feature named-srlg-groups {
+       description
+         "Indicates support for named SRLG groups";
+     }
+
+     feature named-path-constraints {
+       description
+         "Indicates support for named path constraints";
+     }
+
+     grouping explicit-route-subobject {
+       description
+         "The explicit route subobject grouping";
+       choice type {
+         description
+           "The explicit route subobject type";
+         case ipv4-address {
+           description
+             "IPv4 address explicit route subobject";
+           leaf v4-address {
+             type inet:ipv4-address;
+             description
+               "An IPv4 address.  This address is
+               treated as a prefix based on the
+               prefix length value below. Bits beyond
+               the prefix are ignored on receipt and
+               SHOULD be set to zero on transmission.";
+           }
+           leaf v4-prefix-length {
+             type uint8;
+             description
+               "Length in bits of the IPv4 prefix";
+           }
+           leaf v4-loose {
+             type boolean;
+             description
+               "Describes whether the object is loose
+               if set, or otherwise strict";
+           }
+         }
+         case ipv6-address {
+           description
+             "IPv6 address Explicit Route Object";
+           leaf v6-address {
+             type inet:ipv6-address;
+             description
+               "An IPv6 address.  This address is
+               treated as a prefix based on the
+               prefix length value below.  Bits
+               beyond the prefix are ignored on
+               receipt and SHOULD be set to zero
+               on transmission.";
+           }
+           leaf v6-prefix-length {
+             type uint8;
+             description
+               "Length in bits of the IPv4 prefix";
+           }
+           leaf v6-loose {
+             type boolean;
+             description
+               "Describes whether the object is loose
+               if set, or otherwise strict";
+           }
+         }
+         case as-number {
+           leaf as-number {
+             type uint16;
+             description "AS number";
+           }
+           description
+             "Autonomous System explicit route subobject";
+         }
+         case unnumbered-link {
+           leaf router-id {
+             type inet:ip-address;
+             description
+               "A router-id address";
+           }
+           leaf interface-id {
+             type uint32;
+             description "The interface identifier";
+           }
+           description
+             "Unnumbered link explicit route subobject";
+           reference
+             "RFC3477: Signalling Unnumbered Links in
+             RSVP-TE";
+         }
+         case label {
+           leaf value {
+             type uint32;
+             description "the label value";
+           }
+           description
+             "The Label ERO subobject";
+         }
+         /* AS domain sequence..? */
+       }
+     }
+
+     grouping record-route-subobject {
+       description
+         "The record route subobject grouping";
+       choice type {
+         description
+           "The record route subobject type";
+         case ipv4-address {
+           leaf v4-address {
+             type inet:ipv4-address;
+             description
+               "An IPv4 address.  This address is
+               treated as a prefix based on the prefix
+               length value below. Bits beyond the
+               prefix are ignored on receipt and
+               SHOULD be set to zero on transmission.";
+           }
+           leaf v4-prefix-length {
+             type uint8;
+             description
+               "Length in bits of the IPv4 prefix";
+           }
+           leaf v4-flags {
+             type uint8;
+             description
+               "IPv4 address sub-object flags";
+             reference "RFC3209";
+           }
+         }
+         case ipv6-address {
+           leaf v6-address {
+             type inet:ipv6-address;
+             description
+               "An IPv6 address.  This address is
+               treated as a prefix based on the
+               prefix length value below. Bits
+               beyond the prefix are ignored on
+               receipt and SHOULD be set to zero
+               on transmission.";
+           }
+           leaf v6-prefix-length {
+             type uint8;
+             description
+               "Length in bits of the IPv4 prefix";
+           }
+           leaf v6-flags {
+             type uint8;
+             description
+               "IPv6 address sub-object flags";
+             reference "RFC3209";
+           }
+         }
+         case label {
+           leaf value {
+             type uint32;
+             description "the label value";
+           }
+           leaf flags {
+             type uint8;
+             description
+               "Label sub-object flags";
+             reference "RFC3209";
+           }
+           description
+             "The Label ERO subobject";
+         }
+       }
+     }
+
+     identity route-usage-type {
+       description
+         "Base identity for route usage";
+     }
+
+     identity route-include-ero {
+       base route-usage-type;
+       description
+         "Include ERO from route";
+     }
+
+     identity route-exclude-ero {
+       base route-usage-type;
+       description
+         "Exclude ERO from route";
+     }
+
+     identity route-exclude-srlg {
+       base route-usage-type;
+       description
+         "Exclude SRLG from route";
+     }
+
+     identity path-metric-type {
+       description
+         "Base identity for path metric type";
+     }
+
+     identity path-metric-te {
+       base path-metric-type;
+       description
+         "TE path metric";
+     }
+
+     identity path-metric-igp {
+       base path-metric-type;
+       description
+         "IGP path metric";
+     }
+
+     identity path-tiebreaker-type {
+       description
+         "Base identity for path tie-breaker type";
+     }
+
+     identity path-tiebreaker-minfill {
+       base path-tiebreaker-type;
+       description
+         "Min-Fill LSP path placement";
+     }
+
+     identity path-tiebreaker-maxfill {
+       base path-tiebreaker-type;
+       description
+         "Max-Fill LSP path placement";
+     }
+
+     identity path-tiebreaker-randoom {
+       base path-tiebreaker-type;
+       description
+         "Random LSP path placement";
+     }
+
+     identity bidir-provisioning-mode {
+       description
+         "Base identity for bidirectional provisioning
+         mode.";
+     }
+
+     identity bidir-provisioning-single-sided {
+       base bidir-provisioning-mode;
+       description
+         "Single-sided bidirectional provioning mode";
+     }
+
+     identity bidir-provisioning-double-sided {
+       base bidir-provisioning-mode;
+       description
+         "Double-sided bidirectional provioning mode";
+     }
+
+     identity bidir-association-type {
+       description
+         "Base identity for bidirectional association type";
+     }
+
+     identity bidir-assoc-corouted {
+       base bidir-association-type;
+       description
+         "Co-routed bidirectional association type";
+     }
+
+     identity bidir-assoc-non-corouted {
+       base bidir-association-type;
+       description
+         "Non co-routed bidirectional association type";
+     }
+
+     identity resource-affinities-type {
+       description
+         "Base identity for resource affinities";
+     }
+
+     identity resource-aff-include-all {
+       base resource-affinities-type;
+       description
+         "The set of attribute filters associated with a
+         tunnel all of which must be present for a link
+         to be acceptable";
+     }
+
+     identity resource-aff-include-any {
+       base resource-affinities-type;
+       description
+         "The set of attribute filters associated with a
+         tunnel any of which must be present for a link
+         to be acceptable";
+     }
+
+     identity resource-aff-exclude-any {
+       base resource-affinities-type;
+       description
+         "The set of attribute filters associated with a
+         tunnel any of which renders a link unacceptable";
+     }
+
+     typedef admin-group {
+       type binary {
+         length 32;
+       }
+       description
+         "Administrative group/Resource class/Color.";
+     }
+
+     typedef extended-admin-group {
+       type binary;
+       description
+         "Extended administrative group/Resource class/Color.";
+     }
+
+     typedef admin-groups {
+       type union {
+         type admin-group;
+         type extended-admin-group;
+       }
+       description "TE administrative group derived type";
+     }
+
+     typedef srlg {
+       type uint32;
+       description "SRLG type";
+     }
+
+     identity path-computation-srlg-type {
+       description
+         "Base identity for SRLG path computation";
+     }
+
+     identity srlg-ignore {
+       base path-computation-srlg-type;
+       description
+         "Ignores SRLGs in path computation";
+     }
+
+     identity srlg-strict {
+       base path-computation-srlg-type;
+       description
+         "Include strict SRLG check in path computation";
+     }
+
+     identity srlg-preferred {
+       base path-computation-srlg-type;
+       description
+         "Include preferred SRLG check in path computation";
+     }
+
+     identity srlg-weighted {
+       base path-computation-srlg-type;
+       description
+         "Include weighted SRLG check in path computation";
+     }
+
+     typedef te-metric {
+       type uint32;
+       description
+         "TE link metric";
+     }
+
+     typedef topology-id {
+       type string {
+         pattern '/?([a-zA-Z0-9\-_.]+)(/[a-zA-Z0-9\-_.]+)*';
+       }
+       description
+         "An identifier for a topology.";
+     }
+
+     /**
+      * TE tunnel generic groupings
+      **/
+
+     /* Tunnel path selection parameters */
+     grouping tunnel-path-selection {
+       description
+         "Tunnel path selection properties grouping";
+       container path-selection {
+         description
+           "Tunnel path selection properties container";
+         leaf topology {
+           type te-types:topology-id;
+           description
+             "The tunnel path is computed using the specific
+             topology identified by this identifier";
+         }
+         leaf cost-limit {
+           type uint32 {
+             range "1..4294967295";
+           }
+           description
+             "The tunnel path cost limit.";
+         }
+         leaf hop-limit {
+           type uint8 {
+             range "1..255";
+           }
+           description
+             "The tunnel path hop limit.";
+         }
+         leaf metric-type {
+           type identityref {
+             base path-metric-type;
+           }
+           default path-metric-te;
+           description
+             "The tunnel path metric type.";
+         }
+         leaf tiebreaker-type {
+           type identityref {
+             base path-tiebreaker-type;
+           }
+           default path-tiebreaker-maxfill;
+           description
+             "The tunnel path computation tie breakers.";
+         }
+         leaf ignore-overload {
+           type boolean;
+           description
+             "The tunnel path can traverse overloaded node.";
+         }
+         uses tunnel-path-affinities;
+         uses tunnel-path-srlgs;
+       }
+     }
+
+     grouping tunnel-path-affinities {
+       description
+         "Path affinities grouping";
+       container tunnel-path-affinities {
+         if-feature named-path-affinities;
+         description
+           "Path affinities container";
+         choice style {
+           description
+             "Path affinities representation style";
+           case values {
+             leaf value {
+               type uint32 {
+                 range "0..4294967295";
+               }
+               description
+                 "Affinity value";
+             }
+             leaf mask {
+               type uint32 {
+                 range "0..4294967295";
+               }
+               description
+                 "Affinity mask";
+             }
+           }
+           case named {
+             list constraints {
+               key "usage";
+               leaf usage {
+                 type identityref {
+                   base resource-affinities-type;
+                 }
+                 description "Affinities usage";
+               }
+               container constraint {
+                 description
+                   "Container for named affinities";
+                 list affinity-names {
+                   key "name";
+                   leaf name {
+                     type string;
+                     description
+                       "Affinity name";
+                   }
+                   description
+                     "List of named affinities";
+                 }
+               }
+               description
+                 "List of named affinity constraints";
+             }
+           }
+         }
+       }
+     }
+
+     grouping tunnel-path-srlgs {
+       description
+         "Path SRLG properties grouping";
+       container tunnel-path-srlgs {
+         description
+           "Path SRLG properties container";
+         choice style {
+           description
+             "Type of SRLG representation";
+           case values {
+             leaf usage {
+               type identityref {
+                 base route-exclude-srlg;
+               }
+               description "SRLG usage";
+             }
+             leaf-list values {
+               type te-types:srlg;
+               description "SRLG value";
+             }
+           }
+           case named {
+             list constraints {
+               key "usage";
+               leaf usage {
+                 type identityref {
+                   base route-exclude-srlg;
+                 }
+                 description "SRLG usage";
+               }
+               container constraint {
+                 description
+                   "Container for named SRLG list";
+                 list srlg-names {
+                   key "name";
+                   leaf name {
+                     type string;
+                     description
+                       "The SRLG name";
+                   }
+                   description
+                     "List named SRLGs";
+                 }
+               }
+               description
+                 "List of named SRLG constraints";
+             }
+           }
+         }
+       }
+     }
+
+     grouping tunnel-bidir-assoc-properties {
+       description
+         "TE tunnel associated bidirectional properties
+         grouping";
+       container bidirectional {
+         description
+           "TE tunnel associated bidirectional attributes.";
+         container association {
+           description
+             "Tunnel bidirectional association properties";
+           leaf id {
+             type uint16;
+             description
+               "The TE tunnel association identifier.";
+           }
+           leaf source {
+             type inet:ip-address;
+             description
+               "The TE tunnel association source.";
+           }
+           leaf global-source {
+             type inet:ip-address;
+             description
+               "The TE tunnel association global
+               source.";
+           }
+           leaf type {
+             type identityref {
+               base bidir-association-type;
+             }
+             default bidir-assoc-non-corouted;
+             description
+               "The TE tunnel association type.";
+           }
+           leaf provisioing {
+             type identityref {
+               base bidir-provisioning-mode;
+             }
+             description
+               "Describes the provisioning model of the
+               associated bidirectional LSP";
+             reference
+               "draft-ietf-teas-mpls-tp-rsvpte-ext-
+               associated-lsp, section-3.2";
+           }
+         }
+       }
+     }
+     /*** End of TE tunnel groupings ***/
+
+     /**
+      * TE interface generic groupings
+      **/
+   }
diff --git a/compiler/plugin/maven/src/test/resources/interfileietf/ietf-yang-types.yang b/compiler/plugin/maven/src/test/resources/interfileietf/ietf-yang-types.yang
new file mode 100644
index 0000000..9a543fa
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/interfileietf/ietf-yang-types.yang
@@ -0,0 +1,490 @@
+  module ietf-yang-types {
+
+    yang-version 1;
+
+    namespace
+      "urn:ietf:params:xml:ns:yang:ietf-yang-types";
+
+    prefix yang;
+
+    organization
+      "IETF NETMOD (NETCONF Data Modeling Language) Working Group";
+
+    contact
+      "WG Web:   <http://tools.ietf.org/wg/netmod/>
+    WG List:  <mailto:netmod@ietf.org>
+
+    WG Chair: David Kessens
+              <mailto:david.kessens@nsn.com>
+
+    WG Chair: Juergen Schoenwaelder
+              <mailto:j.schoenwaelder@jacobs-university.de>
+
+    Editor:   Juergen Schoenwaelder
+              <mailto:j.schoenwaelder@jacobs-university.de>";
+
+    description
+      "This module contains a collection of generally useful derived
+    YANG data types.
+
+    Copyright (c) 2013 IETF Trust and the persons identified as
+    authors of the code.  All rights reserved.
+
+    Redistribution and use in source and binary forms, with or
+    without modification, is permitted pursuant to, and subject
+    to the license terms contained in, the Simplified BSD License
+    set forth in Section 4.c of the IETF Trust's Legal Provisions
+    Relating to IETF Documents
+    (http://trustee.ietf.org/license-info).
+
+    This version of this YANG module is part of RFC 6991; see
+    the RFC itself for full legal notices.";
+
+    revision "2013-07-15" {
+      description
+        "This revision adds the following new data types:
+      - yang-identifier
+      - hex-string
+      - uuid
+      - dotted-quad";
+      reference
+        "RFC 6991: Common YANG Data Types";
+
+    }
+
+    revision "2010-09-24" {
+      description "Initial revision.";
+      reference
+        "RFC 6021: Common YANG Data Types";
+
+    }
+
+
+    typedef counter32 {
+      type uint32;
+      description
+        "The counter32 type represents a non-negative integer
+      that monotonically increases until it reaches a
+      maximum value of 2^32-1 (4294967295 decimal), when it
+      wraps around and starts increasing again from zero.
+
+      Counters have no defined 'initial' value, and thus, a
+      single value of a counter has (in general) no information
+      content.  Discontinuities in the monotonically increasing
+      value normally occur at re-initialization of the
+      management system, and at other times as specified in the
+      description of a schema node using this type.  If such
+      other times can occur, for example, the creation of
+      a schema node of type counter32 at times other than
+      re-initialization, then a corresponding schema node
+      should be defined, with an appropriate type, to indicate
+      the last discontinuity.
+
+      The counter32 type should not be used for configuration
+      schema nodes.  A default statement SHOULD NOT be used in
+      combination with the type counter32.
+
+      In the value set and its semantics, this type is equivalent
+      to the Counter32 type of the SMIv2.";
+      reference
+        "RFC 2578: Structure of Management Information Version 2
+        	  (SMIv2)";
+
+    }
+
+    typedef zero-based-counter32 {
+      type counter32;
+      default "0";
+      description
+        "The zero-based-counter32 type represents a counter32
+      that has the defined 'initial' value zero.
+
+      A schema node of this type will be set to zero (0) on creation
+      and will thereafter increase monotonically until it reaches
+      a maximum value of 2^32-1 (4294967295 decimal), when it
+      wraps around and starts increasing again from zero.
+
+      Provided that an application discovers a new schema node
+      of this type within the minimum time to wrap, it can use the
+      'initial' value as a delta.  It is important for a management
+      station to be aware of this minimum time and the actual time
+      between polls, and to discard data if the actual time is too
+      long or there is no defined minimum time.
+
+      In the value set and its semantics, this type is equivalent
+      to the ZeroBasedCounter32 textual convention of the SMIv2.";
+      reference
+        "RFC 4502: Remote Network Monitoring Management Information
+        	  Base Version 2";
+
+    }
+
+    typedef counter64 {
+      type uint64;
+      description
+        "The counter64 type represents a non-negative integer
+      that monotonically increases until it reaches a
+      maximum value of 2^64-1 (18446744073709551615 decimal),
+      when it wraps around and starts increasing again from zero.
+
+      Counters have no defined 'initial' value, and thus, a
+      single value of a counter has (in general) no information
+      content.  Discontinuities in the monotonically increasing
+      value normally occur at re-initialization of the
+      management system, and at other times as specified in the
+      description of a schema node using this type.  If such
+      other times can occur, for example, the creation of
+      a schema node of type counter64 at times other than
+      re-initialization, then a corresponding schema node
+      should be defined, with an appropriate type, to indicate
+      the last discontinuity.
+
+      The counter64 type should not be used for configuration
+      schema nodes.  A default statement SHOULD NOT be used in
+      combination with the type counter64.
+
+      In the value set and its semantics, this type is equivalent
+      to the Counter64 type of the SMIv2.";
+      reference
+        "RFC 2578: Structure of Management Information Version 2
+        	  (SMIv2)";
+
+    }
+
+    typedef zero-based-counter64 {
+      type counter64;
+      default "0";
+      description
+        "The zero-based-counter64 type represents a counter64 that
+      has the defined 'initial' value zero.
+
+
+
+
+      A schema node of this type will be set to zero (0) on creation
+      and will thereafter increase monotonically until it reaches
+      a maximum value of 2^64-1 (18446744073709551615 decimal),
+      when it wraps around and starts increasing again from zero.
+
+      Provided that an application discovers a new schema node
+      of this type within the minimum time to wrap, it can use the
+      'initial' value as a delta.  It is important for a management
+      station to be aware of this minimum time and the actual time
+      between polls, and to discard data if the actual time is too
+      long or there is no defined minimum time.
+
+      In the value set and its semantics, this type is equivalent
+      to the ZeroBasedCounter64 textual convention of the SMIv2.";
+      reference
+        "RFC 2856: Textual Conventions for Additional High Capacity
+        	  Data Types";
+
+    }
+
+    typedef gauge32 {
+      type uint32;
+      description
+        "The gauge32 type represents a non-negative integer, which
+      may increase or decrease, but shall never exceed a maximum
+      value, nor fall below a minimum value.  The maximum value
+      cannot be greater than 2^32-1 (4294967295 decimal), and
+      the minimum value cannot be smaller than 0.  The value of
+      a gauge32 has its maximum value whenever the information
+      being modeled is greater than or equal to its maximum
+      value, and has its minimum value whenever the information
+      being modeled is smaller than or equal to its minimum value.
+      If the information being modeled subsequently decreases
+      below (increases above) the maximum (minimum) value, the
+      gauge32 also decreases (increases).
+
+      In the value set and its semantics, this type is equivalent
+      to the Gauge32 type of the SMIv2.";
+      reference
+        "RFC 2578: Structure of Management Information Version 2
+        	  (SMIv2)";
+
+    }
+
+    typedef gauge64 {
+      type uint64;
+      description
+        "The gauge64 type represents a non-negative integer, which
+      may increase or decrease, but shall never exceed a maximum
+      value, nor fall below a minimum value.  The maximum value
+      cannot be greater than 2^64-1 (18446744073709551615), and
+      the minimum value cannot be smaller than 0.  The value of
+      a gauge64 has its maximum value whenever the information
+      being modeled is greater than or equal to its maximum
+      value, and has its minimum value whenever the information
+      being modeled is smaller than or equal to its minimum value.
+      If the information being modeled subsequently decreases
+      below (increases above) the maximum (minimum) value, the
+      gauge64 also decreases (increases).
+
+      In the value set and its semantics, this type is equivalent
+      to the CounterBasedGauge64 SMIv2 textual convention defined
+      in RFC 2856";
+      reference
+        "RFC 2856: Textual Conventions for Additional High Capacity
+        	  Data Types";
+
+    }
+
+    typedef object-identifier {
+      type string {
+        pattern
+          '(([0-1](\.[1-3]?[0-9]))|(2\.(0|([1-9]\d*))))(\.(0|([1-9]\d*)))*';
+      }
+      description
+        "The object-identifier type represents administratively
+      assigned names in a registration-hierarchical-name tree.
+
+      Values of this type are denoted as a sequence of numerical
+      non-negative sub-identifier values.  Each sub-identifier
+      value MUST NOT exceed 2^32-1 (4294967295).  Sub-identifiers
+      are separated by single dots and without any intermediate
+      whitespace.
+
+      The ASN.1 standard restricts the value space of the first
+      sub-identifier to 0, 1, or 2.  Furthermore, the value space
+      of the second sub-identifier is restricted to the range
+      0 to 39 if the first sub-identifier is 0 or 1.  Finally,
+      the ASN.1 standard requires that an object identifier
+      has always at least two sub-identifiers.  The pattern
+      captures these restrictions.
+
+      Although the number of sub-identifiers is not limited,
+      module designers should realize that there may be
+      implementations that stick with the SMIv2 limit of 128
+      sub-identifiers.
+
+      This type is a superset of the SMIv2 OBJECT IDENTIFIER type
+      since it is not restricted to 128 sub-identifiers.  Hence,
+      this type SHOULD NOT be used to represent the SMIv2 OBJECT
+      IDENTIFIER type; the object-identifier-128 type SHOULD be
+      used instead.";
+      reference
+        "ISO9834-1: Information technology -- Open Systems
+        Interconnection -- Procedures for the operation of OSI
+        Registration Authorities: General procedures and top
+        arcs of the ASN.1 Object Identifier tree";
+
+    }
+
+    typedef object-identifier-128 {
+      type object-identifier {
+        pattern '\d*(\.\d*){1,127}';
+      }
+      description
+        "This type represents object-identifiers restricted to 128
+      sub-identifiers.
+
+      In the value set and its semantics, this type is equivalent
+      to the OBJECT IDENTIFIER type of the SMIv2.";
+      reference
+        "RFC 2578: Structure of Management Information Version 2
+        	  (SMIv2)";
+
+    }
+
+    typedef yang-identifier {
+      type string {
+        length "1..max";
+        pattern '[a-zA-Z_][a-zA-Z0-9\-_.]*';
+        pattern
+          '.|..|[^xX].*|.[^mM].*|..[^lL].*';
+      }
+      description
+        "A YANG identifier string as defined by the 'identifier'
+       rule in Section 12 of RFC 6020.  An identifier must
+       start with an alphabetic character or an underscore
+       followed by an arbitrary sequence of alphabetic or
+       numeric characters, underscores, hyphens, or dots.
+
+       A YANG identifier MUST NOT start with any possible
+       combination of the lowercase or uppercase character
+       sequence 'xml'.";
+      reference
+        "RFC 6020: YANG - A Data Modeling Language for the Network
+        	  Configuration Protocol (NETCONF)";
+
+    }
+
+    typedef date-and-time {
+      type string {
+        pattern
+          '\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[\+\-]\d{2}:\d{2})';
+      }
+      description
+        "The date-and-time type is a profile of the ISO 8601
+      standard for representation of dates and times using the
+      Gregorian calendar.  The profile is defined by the
+      date-time production in Section 5.6 of RFC 3339.
+
+      The date-and-time type is compatible with the dateTime XML
+      schema type with the following notable exceptions:
+
+      (a) The date-and-time type does not allow negative years.
+
+      (b) The date-and-time time-offset -00:00 indicates an unknown
+          time zone (see RFC 3339) while -00:00 and +00:00 and Z
+          all represent the same time zone in dateTime.
+
+      (c) The canonical format (see below) of data-and-time values
+          differs from the canonical format used by the dateTime XML
+          schema type, which requires all times to be in UTC using
+          the time-offset 'Z'.
+
+      This type is not equivalent to the DateAndTime textual
+      convention of the SMIv2 since RFC 3339 uses a different
+      separator between full-date and full-time and provides
+      higher resolution of time-secfrac.
+
+      The canonical format for date-and-time values with a known time
+      zone uses a numeric time zone offset that is calculated using
+      the device's configured known offset to UTC time.  A change of
+      the device's offset to UTC time will cause date-and-time values
+      to change accordingly.  Such changes might happen periodically
+      in case a server follows automatically daylight saving time
+      (DST) time zone offset changes.  The canonical format for
+      date-and-time values with an unknown time zone (usually
+      referring to the notion of local time) uses the time-offset
+      -00:00.";
+      reference
+        "RFC 3339: Date and Time on the Internet: Timestamps
+         RFC 2579: Textual Conventions for SMIv2
+        XSD-TYPES: XML Schema Part 2: Datatypes Second Edition";
+
+    }
+
+    typedef timeticks {
+      type uint32;
+      description
+        "The timeticks type represents a non-negative integer that
+      represents the time, modulo 2^32 (4294967296 decimal), in
+      hundredths of a second between two epochs.  When a schema
+      node is defined that uses this type, the description of
+      the schema node identifies both of the reference epochs.
+
+      In the value set and its semantics, this type is equivalent
+      to the TimeTicks type of the SMIv2.";
+      reference
+        "RFC 2578: Structure of Management Information Version 2
+        	  (SMIv2)";
+
+    }
+
+    typedef timestamp {
+      type timeticks;
+      description
+        "The timestamp type represents the value of an associated
+      timeticks schema node at which a specific occurrence
+      happened.  The specific occurrence must be defined in the
+      description of any schema node defined using this type.  When
+      the specific occurrence occurred prior to the last time the
+      associated timeticks attribute was zero, then the timestamp
+      value is zero.  Note that this requires all timestamp values
+      to be reset to zero when the value of the associated timeticks
+      attribute reaches 497+ days and wraps around to zero.
+
+      The associated timeticks schema node must be specified
+      in the description of any schema node using this type.
+
+      In the value set and its semantics, this type is equivalent
+      to the TimeStamp textual convention of the SMIv2.";
+      reference
+        "RFC 2579: Textual Conventions for SMIv2";
+
+    }
+
+    typedef phys-address {
+      type string {
+        pattern
+          '([0-9a-fA-F]{2}(:[0-9a-fA-F]{2})*)?';
+      }
+      description
+        "Represents media- or physical-level addresses represented
+      as a sequence octets, each octet represented by two hexadecimal
+      numbers.  Octets are separated by colons.  The canonical
+      representation uses lowercase characters.
+
+      In the value set and its semantics, this type is equivalent
+      to the PhysAddress textual convention of the SMIv2.";
+      reference
+        "RFC 2579: Textual Conventions for SMIv2";
+
+    }
+
+    typedef mac-address {
+      type string {
+        pattern
+          '[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}';
+      }
+      description
+        "The mac-address type represents an IEEE 802 MAC address.
+      The canonical representation uses lowercase characters.
+
+      In the value set and its semantics, this type is equivalent
+      to the MacAddress textual convention of the SMIv2.";
+      reference
+        "IEEE 802: IEEE Standard for Local and Metropolitan Area
+        	  Networks: Overview and Architecture
+         RFC 2579: Textual Conventions for SMIv2";
+
+    }
+
+    typedef xpath1.0 {
+      type string;
+      description
+        "This type represents an XPATH 1.0 expression.
+
+      When a schema node is defined that uses this type, the
+      description of the schema node MUST specify the XPath
+      context in which the XPath expression is evaluated.";
+      reference
+        "XPATH: XML Path Language (XPath) Version 1.0";
+
+    }
+
+    typedef hex-string {
+      type string {
+        pattern
+          '([0-9a-fA-F]{2}(:[0-9a-fA-F]{2})*)?';
+      }
+      description
+        "A hexadecimal string with octets represented as hex digits
+      separated by colons.  The canonical representation uses
+      lowercase characters.";
+    }
+
+    typedef uuid {
+      type string {
+        pattern
+          '[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}';
+      }
+      description
+        "A Universally Unique IDentifier in the string representation
+      defined in RFC 4122.  The canonical representation uses
+      lowercase characters.
+
+      The following is an example of a UUID in string representation:
+      f81d4fae-7dec-11d0-a765-00a0c91e6bf6
+      ";
+      reference
+        "RFC 4122: A Universally Unique IDentifier (UUID) URN
+        	  Namespace";
+
+    }
+
+    typedef dotted-quad {
+      type string {
+        pattern
+          '(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])';
+      }
+      description
+        "An unsigned 32-bit number expressed in the dotted-quad
+       notation, i.e., four octets written as decimal numbers
+       and separated with the '.' (full stop) character.";
+    }
+  }  // module ietf-yang-types
+
diff --git a/compiler/plugin/maven/src/test/resources/interfilepriority/module1.yang b/compiler/plugin/maven/src/test/resources/interfilepriority/module1.yang
new file mode 100644
index 0000000..9a21b03
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/interfilepriority/module1.yang
@@ -0,0 +1,14 @@
+module module1 {
+    yang-version 1;
+    namespace "http://huawei.com";
+    prefix Ant;
+    import module2 {
+        prefix p;
+    }
+    leaf invalid-interval {
+        type p:hello;
+    }
+    typedef hello {
+        type string;
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/interfilepriority/module2.yang b/compiler/plugin/maven/src/test/resources/interfilepriority/module2.yang
new file mode 100644
index 0000000..0a3bdad
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/interfilepriority/module2.yang
@@ -0,0 +1,8 @@
+module module2 {
+    yang-version 1;
+    namespace "http://huawei.com";
+    prefix Ant2;
+    typedef hello {
+        type string;
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/interfilepriority/module3.yang b/compiler/plugin/maven/src/test/resources/interfilepriority/module3.yang
new file mode 100644
index 0000000..948c797
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/interfilepriority/module3.yang
@@ -0,0 +1,8 @@
+module module3 {
+    yang-version 1;
+    namespace "http://huawei.com";
+    prefix Ant;
+    import module1 {
+        prefix p;
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/interfilepriority/module4.yang b/compiler/plugin/maven/src/test/resources/interfilepriority/module4.yang
new file mode 100644
index 0000000..df6f8b2
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/interfilepriority/module4.yang
@@ -0,0 +1,8 @@
+module module4 {
+    yang-version 1;
+    namespace "http://huawei.com";
+    prefix Ant;
+    import module3 {
+        prefix p;
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/interfiletype/module1.yang b/compiler/plugin/maven/src/test/resources/interfiletype/module1.yang
new file mode 100644
index 0000000..3c60bd6
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/interfiletype/module1.yang
@@ -0,0 +1,14 @@
+module module1 {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    import module2 {
+        prefix p;
+    }
+    leaf invalid-interval {
+        type p:hello;
+    }
+    typedef hello {
+        type string;
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/interfiletype/module2.yang b/compiler/plugin/maven/src/test/resources/interfiletype/module2.yang
new file mode 100644
index 0000000..6784c45
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/interfiletype/module2.yang
@@ -0,0 +1,8 @@
+module module2 {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant2;
+    typedef hello {
+        type string;
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/interfiletypewithinclude/module1.yang b/compiler/plugin/maven/src/test/resources/interfiletypewithinclude/module1.yang
new file mode 100644
index 0000000..d1d4db3
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/interfiletypewithinclude/module1.yang
@@ -0,0 +1,9 @@
+module module1 {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    include module2;
+    leaf invalid-interval {
+        type hello;
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/interfiletypewithinclude/module2.yang b/compiler/plugin/maven/src/test/resources/interfiletypewithinclude/module2.yang
new file mode 100644
index 0000000..8e47100
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/interfiletypewithinclude/module2.yang
@@ -0,0 +1,9 @@
+submodule module2 {
+    yang-version 1;
+    belongs-to module1 {
+        prefix "module1";
+    }
+    typedef hello {
+        type string;
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/interfiletypewithrevision/module1.yang b/compiler/plugin/maven/src/test/resources/interfiletypewithrevision/module1.yang
new file mode 100644
index 0000000..180511d
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/interfiletypewithrevision/module1.yang
@@ -0,0 +1,15 @@
+module module1 {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    import module2 {
+        prefix p;
+        revision-date 2007-06-09;
+    }
+    leaf invalid-interval {
+        type p:hello;
+    }
+    typedef hello {
+        type string;
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/interfiletypewithrevision/module2.yang b/compiler/plugin/maven/src/test/resources/interfiletypewithrevision/module2.yang
new file mode 100644
index 0000000..fd99872
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/interfiletypewithrevision/module2.yang
@@ -0,0 +1,11 @@
+module module2 {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant2;
+    revision 2007-06-09 {
+        description "Initial revision.";
+    }
+    typedef hello {
+        type string;
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/interfiletypewithrevisioninname/module1.yang b/compiler/plugin/maven/src/test/resources/interfiletypewithrevisioninname/module1.yang
new file mode 100644
index 0000000..180511d
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/interfiletypewithrevisioninname/module1.yang
@@ -0,0 +1,15 @@
+module module1 {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    import module2 {
+        prefix p;
+        revision-date 2007-06-09;
+    }
+    leaf invalid-interval {
+        type p:hello;
+    }
+    typedef hello {
+        type string;
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/interfiletypewithrevisioninname/module2@2007-06-09.yang b/compiler/plugin/maven/src/test/resources/interfiletypewithrevisioninname/module2@2007-06-09.yang
new file mode 100644
index 0000000..fd99872
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/interfiletypewithrevisioninname/module2@2007-06-09.yang
@@ -0,0 +1,11 @@
+module module2 {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant2;
+    revision 2007-06-09 {
+        description "Initial revision.";
+    }
+    typedef hello {
+        type string;
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/interfileuses/module1.yang b/compiler/plugin/maven/src/test/resources/interfileuses/module1.yang
new file mode 100644
index 0000000..69df326
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/interfileuses/module1.yang
@@ -0,0 +1,9 @@
+module module1 {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    import module2 {
+        prefix p;
+    }
+    uses p:hello;
+}
diff --git a/compiler/plugin/maven/src/test/resources/interfileuses/module2.yang b/compiler/plugin/maven/src/test/resources/interfileuses/module2.yang
new file mode 100644
index 0000000..5bb3616
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/interfileuses/module2.yang
@@ -0,0 +1,10 @@
+module module2 {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    grouping hello {
+        leaf hello {
+            type string;
+        }
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/interfileuseswithinclude/module1.yang b/compiler/plugin/maven/src/test/resources/interfileuseswithinclude/module1.yang
new file mode 100644
index 0000000..41899d9
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/interfileuseswithinclude/module1.yang
@@ -0,0 +1,7 @@
+module module1 {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    include module2;
+    uses hello;
+}
diff --git a/compiler/plugin/maven/src/test/resources/interfileuseswithinclude/module2.yang b/compiler/plugin/maven/src/test/resources/interfileuseswithinclude/module2.yang
new file mode 100644
index 0000000..1b423d9
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/interfileuseswithinclude/module2.yang
@@ -0,0 +1,11 @@
+submodule module2 {
+    yang-version 1;
+    belongs-to module1 {
+        prefix "module1";
+    }
+    grouping hello {
+        leaf hello {
+            type string;
+        }
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/interfilewithusesreferringtype/ietf-network.yang b/compiler/plugin/maven/src/test/resources/interfilewithusesreferringtype/ietf-network.yang
new file mode 100644
index 0000000..3d96560
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/interfilewithusesreferringtype/ietf-network.yang
@@ -0,0 +1,14 @@
+   module ietf-network {
+     yang-version 1;
+     namespace "urn:ietf:params:xml:ns:yang:ietf-network";
+     prefix nd;
+
+     container networks {
+         container network-types {
+           description
+             "Serves as an augmentation target.
+              The network type is indicated through corresponding
+              presence containers augmented into this container.";
+         }
+     }
+}
diff --git a/compiler/plugin/maven/src/test/resources/interfilewithusesreferringtype/ietf-te-topology.yang b/compiler/plugin/maven/src/test/resources/interfilewithusesreferringtype/ietf-te-topology.yang
new file mode 100644
index 0000000..2434403
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/interfilewithusesreferringtype/ietf-te-topology.yang
@@ -0,0 +1,51 @@
+   module ietf-te-topology {
+     yang-version 1;
+     namespace "urn:ietf:params:xml:ns:yang:ietf-te-topology";
+     // replace with IANA namespace when assigned
+
+     prefix "tet";
+
+     import ietf-network {
+       prefix "nw";
+     }
+
+     grouping te-topologies-augment {
+       description
+         "Augmentation for TE topologies.";
+       leaf reference-change-policy {
+         type enumeration {
+           enum no-action {
+             description
+               "When an attribute changes in this template, the
+                configuration node referring to this template does
+                not take any action.";
+           }
+           enum not-allowed {
+             description
+               "When any configuration object has a reference to this
+                template, changing this template is not allowed.";
+           }
+           enum cascade {
+             description
+               "When an attribute changes in this template, the
+                configuration object referring to this template applies
+                the new attribute value to the corresponding
+                configuration.";
+           }
+         }
+         description
+           "This attribute specifies the action taken to a configuration
+            node that has a reference to this template.";
+       }
+     } // te-topologies-augment
+
+
+
+     augment "/nw:networks" {
+       description
+         "Augmentation parameters for TE topologies.";
+       uses te-topologies-augment;
+     }
+
+
+}
diff --git a/compiler/plugin/maven/src/test/resources/leafreflinker/iffeatuinleafref/featurebymultileafref/SelfFileLinkingWithFeatureReferredByMultiLeafref.yang b/compiler/plugin/maven/src/test/resources/leafreflinker/iffeatuinleafref/featurebymultileafref/SelfFileLinkingWithFeatureReferredByMultiLeafref.yang
new file mode 100644
index 0000000..f57fa6b
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/leafreflinker/iffeatuinleafref/featurebymultileafref/SelfFileLinkingWithFeatureReferredByMultiLeafref.yang
@@ -0,0 +1,40 @@
+module syslog {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix "sys";
+    feature local-storage {
+        description
+            "This feature means the device supports local
+             storage (memory, flash or disk) that can be used to
+             store syslog messages.";
+    }
+    feature main-storage {
+        description
+            "This feature means the device supports main
+             storage that can be used to
+             store syslog messages.";
+    }
+
+    container speed {
+        leaf local-storage-limit {
+             if-feature local-storage;
+             type leafref {
+                 path "/value";
+             }
+             units "kilobyte";
+             config false;
+             description
+                  "The amount of local storage that can be
+                   used to hold syslog messages.";
+        }
+    }
+    leaf storage-value {
+        type leafref {
+            path "/speed/local-storage-limit";
+        }
+    }
+    leaf value {
+        if-feature main-storage;
+        type uint64;
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/leafreflinker/iffeatuinleafref/simpleleafrefwithiffeature/SelfFileLinkingWithFeatureReferredByLeafref.yang b/compiler/plugin/maven/src/test/resources/leafreflinker/iffeatuinleafref/simpleleafrefwithiffeature/SelfFileLinkingWithFeatureReferredByLeafref.yang
new file mode 100644
index 0000000..941b56b
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/leafreflinker/iffeatuinleafref/simpleleafrefwithiffeature/SelfFileLinkingWithFeatureReferredByLeafref.yang
@@ -0,0 +1,28 @@
+module syslog {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix "sys";
+    feature local-storage {
+        description
+            "This feature means the device supports local
+             storage (memory, flash or disk) that can be used to
+             store syslog messages.";
+    }
+
+    container speed {
+        leaf local-storage-limit {
+             if-feature local-storage;
+             type uint64;
+             units "kilobyte";
+             config false;
+             description
+                  "The amount of local storage that can be
+                   used to hold syslog messages.";
+         }
+     }
+     leaf storage-value {
+         type leafref {
+             path "/speed/local-storage-limit";
+         }
+     }
+}
diff --git a/compiler/plugin/maven/src/test/resources/leafreflinker/interfile/interfileleafreffromgroupingreferstootherfile/module1.yang b/compiler/plugin/maven/src/test/resources/leafreflinker/interfile/interfileleafreffromgroupingreferstootherfile/module1.yang
new file mode 100644
index 0000000..b8a5d98
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/leafreflinker/interfile/interfileleafreffromgroupingreferstootherfile/module1.yang
@@ -0,0 +1,28 @@
+module module1 {
+    yang-version 1;
+    namespace "urn:ietf:params:xml:ns:yang:ietf-te-topology";
+    prefix "tet";
+    import module2 {
+        prefix "nt";
+    }
+    container te-node-tunnel-termination-capability {
+        description
+        "Termination capability of a tunnel termination point on a
+        TE node.";
+        list termination-capability {
+            key "link-tp";
+            description
+            "The termination capabilities between
+            tunnel-termination-point and link termination-point.
+            The capability information can be used to compute
+            the tunnel path.";
+            leaf link-tp {
+                type leafref {
+                    path "/nt:termination-point/nt:tp-id";
+                }
+                description
+                "Link termination point.";
+            }
+        } // termination-capability
+    } // te-node-tunnel-termination-capability
+}
diff --git a/compiler/plugin/maven/src/test/resources/leafreflinker/interfile/interfileleafreffromgroupingreferstootherfile/module2.yang b/compiler/plugin/maven/src/test/resources/leafreflinker/interfile/interfileleafreffromgroupingreferstootherfile/module2.yang
new file mode 100644
index 0000000..822d90b
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/leafreflinker/interfile/interfileleafreffromgroupingreferstootherfile/module2.yang
@@ -0,0 +1,11 @@
+module module2 {
+    yang-version 1;
+    namespace
+      "urn:ietf:params:xml:ns:yang:ietf-inet-types";
+    prefix inet;
+    container termination-point {
+        leaf tp-id {
+            type string;
+        }
+    }
+}
\ No newline at end of file
diff --git a/compiler/plugin/maven/src/test/resources/leafreflinker/interfile/interfileleafrefreferstomultipleleafrefinmultiplefiles/ieft-inet-types.yang b/compiler/plugin/maven/src/test/resources/leafreflinker/interfile/interfileleafrefreferstomultipleleafrefinmultiplefiles/ieft-inet-types.yang
new file mode 100644
index 0000000..c393dbf
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/leafreflinker/interfile/interfileleafrefreferstomultipleleafrefinmultiplefiles/ieft-inet-types.yang
@@ -0,0 +1,11 @@
+module ietf-inet-types {
+    yang-version 1;
+    namespace
+      "urn:ietf:params:xml:ns:yang:ietf-inet-types";
+    prefix inet;
+    typedef tp-ref {
+        type leafref {
+            path "/nwtp:value";
+        }
+    }
+}
\ No newline at end of file
diff --git a/compiler/plugin/maven/src/test/resources/leafreflinker/interfile/interfileleafrefreferstomultipleleafrefinmultiplefiles/ietf-network-topology.yang b/compiler/plugin/maven/src/test/resources/leafreflinker/interfile/interfileleafrefreferstomultipleleafrefinmultiplefiles/ietf-network-topology.yang
new file mode 100644
index 0000000..b488f46
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/leafreflinker/interfile/interfileleafrefreferstomultipleleafrefinmultiplefiles/ietf-network-topology.yang
@@ -0,0 +1,28 @@
+module ietf-network-topology {
+    yang-version 1;
+    namespace "urn:ietf:params:xml:ns:yang:ietf-te-topology";
+    prefix "tet";
+    import ietf-network {
+        prefix "nt";
+    }
+    container te-node-tunnel-termination-capability {
+        description
+        "Termination capability of a tunnel termination point on a
+        TE node.";
+        list termination-capability {
+            key "link-tp";
+            description
+            "The termination capabilities between
+            tunnel-termination-point and link termination-point.
+            The capability information can be used to compute
+            the tunnel path.";
+            leaf link-tp {
+                type leafref {
+                    path "/nt:termination-point/nt:tp-id";
+                }
+                description
+                "Link termination point.";
+            }
+        } // termination-capability
+    } // te-node-tunnel-termination-capability
+}
diff --git a/compiler/plugin/maven/src/test/resources/leafreflinker/interfile/interfileleafrefreferstomultipleleafrefinmultiplefiles/ietf-network.yang b/compiler/plugin/maven/src/test/resources/leafreflinker/interfile/interfileleafrefreferstomultipleleafrefinmultiplefiles/ietf-network.yang
new file mode 100644
index 0000000..49a6a04
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/leafreflinker/interfile/interfileleafrefreferstomultipleleafrefinmultiplefiles/ietf-network.yang
@@ -0,0 +1,14 @@
+module ietf-network {
+    yang-version 1;
+    namespace
+      "urn:ietf:params:xml:ns:yang:ietf-inet-types";
+    prefix nw;
+    import ietf-inet-types {
+       prefix inet;
+    }
+    container termination-point {
+        leaf tp-id {
+            type string;
+        }
+    }
+}
\ No newline at end of file
diff --git a/compiler/plugin/maven/src/test/resources/leafreflinker/interfile/interfileleafrefwithimport/module1.yang b/compiler/plugin/maven/src/test/resources/leafreflinker/interfile/interfileleafrefwithimport/module1.yang
new file mode 100644
index 0000000..d33cf1e
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/leafreflinker/interfile/interfileleafrefwithimport/module1.yang
@@ -0,0 +1,16 @@
+module module1 {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    import module2 {
+        prefix p;
+    }
+    leaf invalid-interval {
+        type leafref {
+            path "/p:hello";
+        }
+    }
+    leaf hello {
+        type string;
+    }
+}
\ No newline at end of file
diff --git a/compiler/plugin/maven/src/test/resources/leafreflinker/interfile/interfileleafrefwithimport/module2.yang b/compiler/plugin/maven/src/test/resources/leafreflinker/interfile/interfileleafrefwithimport/module2.yang
new file mode 100644
index 0000000..28a869b
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/leafreflinker/interfile/interfileleafrefwithimport/module2.yang
@@ -0,0 +1,8 @@
+module module2 {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant2;
+    leaf hello {
+        type string;
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/leafreflinker/interfile/leafrefInGroupingWithPrefix/GroupingCopiedInModule2.yang b/compiler/plugin/maven/src/test/resources/leafreflinker/interfile/leafrefInGroupingWithPrefix/GroupingCopiedInModule2.yang
new file mode 100644
index 0000000..dae2db2
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/leafreflinker/interfile/leafrefInGroupingWithPrefix/GroupingCopiedInModule2.yang
@@ -0,0 +1,12 @@
+module GroupingCopiedInModule2 {
+    yang-version 1;
+    namespace "onos-yang-19:level1:newlevel";
+    prefix test;
+    import LeafrefInGroupingOfModule1 {
+        prefix module1;
+    }
+    description "leaf scenario";
+    container value {
+        uses "module1:network-ref";
+    }
+}
\ No newline at end of file
diff --git a/compiler/plugin/maven/src/test/resources/leafreflinker/interfile/leafrefInGroupingWithPrefix/LeafrefInGroupingOfModule1.yang b/compiler/plugin/maven/src/test/resources/leafreflinker/interfile/leafrefInGroupingWithPrefix/LeafrefInGroupingOfModule1.yang
new file mode 100644
index 0000000..0753619
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/leafreflinker/interfile/leafrefInGroupingWithPrefix/LeafrefInGroupingOfModule1.yang
@@ -0,0 +1,40 @@
+module LeafrefInGroupingOfModule1 {
+    yang-version 1;
+    namespace "onos-yang-19:level1:newlevel";
+    prefix test2;
+    description "leaf scenario";
+    container networks {
+        list network {
+            key "network-id";
+            description
+                "Describes a network.
+                A network typically contains an inventory of nodes,
+                topological information (augmented through
+                network-topology model), as well as layering
+                information.";
+            container network-types {
+                description
+                    "Serves as an augmentation target.
+                    The network type is indicated through corresponding
+                    presence containers augmented into this container.";
+            }
+            leaf network-id {
+                type string;
+                description
+                "Identifies a network.";
+            }
+        }
+        leaf network-ip {
+            type uint8;
+            description
+            "Identifies a network.";
+        }
+    }
+    grouping network-ref {
+        leaf network-ref {
+            type leafref {
+                path "/test2:networks/test2:network/test2:network-id";
+            }
+        }
+    }
+}
\ No newline at end of file
diff --git a/compiler/plugin/maven/src/test/resources/leafreflinker/interfile/leafrefInGroupingWithPrefixAndManyReference/GroupingCopiedInModule2.yang b/compiler/plugin/maven/src/test/resources/leafreflinker/interfile/leafrefInGroupingWithPrefixAndManyReference/GroupingCopiedInModule2.yang
new file mode 100644
index 0000000..d988a3a
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/leafreflinker/interfile/leafrefInGroupingWithPrefixAndManyReference/GroupingCopiedInModule2.yang
@@ -0,0 +1,37 @@
+module ietf-te-topology {
+    yang-version 1;
+    namespace "onos-yang-19:level1:newlevel";
+    prefix test;
+     import ietf-network {
+       prefix "nw";
+     }
+    description "leaf scenario";
+         typedef te-topology-event-type {
+           type enumeration {
+             enum "add" {
+               value 0;
+               description
+                 "A TE node or te-link has been added.";
+             }
+             enum "remove" {
+               value 1;
+               description
+                 "A TE node or te-link has been removed.";
+             }
+             enum "update" {
+               value 2;
+               description
+                 "A TE node or te-link has been updated.";
+             }
+           }
+           description "TE  Event type for notifications";
+         } // te-topology-event-type
+     container te-node-event {
+       leaf event-type {
+         type te-topology-event-type;
+         description "Event type.";
+       }
+       description "Notification event for TE node.";
+       uses nw:node-ref;
+     }
+}
diff --git a/compiler/plugin/maven/src/test/resources/leafreflinker/interfile/leafrefInGroupingWithPrefixAndManyReference/LeafrefInGroupingOfModule1.yang b/compiler/plugin/maven/src/test/resources/leafreflinker/interfile/leafrefInGroupingWithPrefixAndManyReference/LeafrefInGroupingOfModule1.yang
new file mode 100644
index 0000000..f2b7591
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/leafreflinker/interfile/leafrefInGroupingWithPrefixAndManyReference/LeafrefInGroupingOfModule1.yang
@@ -0,0 +1,212 @@
+   module ietf-network {
+     yang-version 1;
+     namespace "urn:ietf:params:xml:ns:yang:ietf-network";
+     prefix nd;
+
+     organization
+       "IETF I2RS (Interface to the Routing System) Working Group";
+
+     contact
+       "WG Web:    <http://tools.ietf.org/wg/i2rs/>
+        WG List:   <mailto:i2rs@ietf.org>
+
+        WG Chair:  Susan Hares
+                   <mailto:shares@ndzh.com>
+
+        WG Chair:  Jeffrey Haas
+                   <mailto:jhaas@pfrc.org>
+
+        Editor:    Alexander Clemm
+                   <mailto:alex@cisco.com>
+
+        Editor:    Jan Medved
+                   <mailto:jmedved@cisco.com>
+
+        Editor:    Robert Varga
+                   <mailto:rovarga@cisco.com>
+
+        Editor:    Tony Tkacik
+                   <mailto:ttkacik@cisco.com>
+
+        Editor:    Nitin Bahadur
+                   <mailto:nitin_bahadur@yahoo.com>
+
+        Editor:    Hariharan Ananthakrishnan
+                   <mailto:hari@packetdesign.com>";
+
+     description
+       "This module defines a common base model for a collection
+        of nodes in a network. Node definitions are further used
+        in network topologies and inventories.
+
+        Copyright (c) 2015 IETF Trust and the persons identified as
+        authors of the code.  All rights reserved.
+
+        Redistribution and use in source and binary forms, with or
+        without modification, is permitted pursuant to, and subject
+        to the license terms contained in, the Simplified BSD License
+        set forth in Section 4.c of the IETF Trust's Legal Provisions
+        Relating to IETF Documents
+        (http://trustee.ietf.org/license-info).
+
+        This version of this YANG module is part of
+        draft-ietf-i2rs-yang-network-topo-02;
+        see the RFC itself for full legal notices.
+
+        NOTE TO RFC EDITOR: Please replace above reference to
+        draft-ietf-i2rs-yang-network-topo-02 with RFC
+        number when published (i.e. RFC xxxx).";
+
+     revision 2015-12-08 {
+       description
+         "Initial revision.
+          NOTE TO RFC EDITOR: Please replace the following reference
+          to draft-ietf-i2rs-yang-network-topo-02 with
+          RFC number when published (i.e. RFC xxxx).";
+       reference
+         "draft-ietf-i2rs-yang-network-topo-02";
+     }
+
+     typedef node-id {
+       type string;
+       description
+         "Identifier for a node.";
+     }
+
+     typedef network-id {
+       type string;
+       description
+         "Identifier for a network.";
+     }
+     grouping network-ref {
+       description
+         "Contains the information necessary to reference a network,
+          for example an underlay network.";
+       leaf network-ref {
+         type leafref {
+           path "/nd:networks/nd:network/nd:network-id";
+         require-instance false;
+         }
+         description
+           "Used to reference a network, for example an underlay
+            network.";
+       }
+     }
+
+     grouping node-ref {
+       description
+         "Contains the information necessary to reference a node.";
+       leaf node-ref {
+         type leafref {
+           path "/nd:networks/nd:network[nd:network-id=current()/../"+
+             "network-ref]/nd:node/nd:node-id";
+           require-instance false;
+         }
+         description
+           "Used to reference a node.
+            Nodes are identified relative to the network they are
+            contained in.";
+       }
+       uses network-ref;
+     }
+
+     container networks {
+       description
+         "Serves as top-level container for a list of networks.";
+       list network {
+         key "network-id";
+         description
+           "Describes a network.
+            A network typically contains an inventory of nodes,
+            topological information (augmented through
+            network-topology model), as well as layering
+            information.";
+         container network-types {
+           description
+             "Serves as an augmentation target.
+              The network type is indicated through corresponding
+              presence containers augmented into this container.";
+         }
+         leaf network-id {
+           type network-id;
+           description
+             "Identifies a network.";
+         }
+         list supporting-network {
+           key "network-ref";
+           description
+             "An underlay network, used to represent layered network
+              topologies.";
+           leaf network-ref {
+             type leafref {
+               path "/networks/network/network-id";
+             require-instance false;
+             }
+             description
+               "References the underlay network.";
+           }
+         }
+         list node {
+           key "node-id";
+           description
+             "The inventory of nodes of this network.";
+           leaf node-id {
+             type node-id;
+             description
+               "Identifies a node uniquely within the containing
+                network.";
+           }
+           list supporting-node {
+             key "network-ref node-ref";
+             description
+               "Represents another node, in an underlay network, that
+                this node is supported by.  Used to represent layering
+                structure.";
+             leaf network-ref {
+               type leafref {
+                 path "../../../supporting-network/network-ref";
+               require-instance false;
+               }
+               description
+                 "References the underlay network that the
+                  underlay node is part of.";
+             }
+             leaf node-ref {
+               type leafref {
+                 path "/networks/network/node/node-id";
+               require-instance false;
+               }
+               description
+                 "References the underlay node itself.";
+             }
+           }
+         }
+       }
+     }
+     container networks-state {
+       config false;
+       description
+         "Serves as top-level container for a list of state information
+          for networks";
+       list network {
+         key "network-ref";
+         description
+           "Data nodes representing operational data and state of
+            networks.
+            An instance is automatically created for every network
+            in the corresponding list under the networks container.";
+         uses network-ref;
+         leaf server-provided {
+           type boolean;
+           description
+             "Indicates whether the information concerning this
+              particular network is populated by the server
+              (server-provided true, the general case for network
+              information discovered from the server),
+              or whether it is configured by a client
+              (server-provided true, possible e.g. for
+              service overlays managed through a controller).";
+         }
+       }
+     }
+   }
diff --git a/compiler/plugin/maven/src/test/resources/leafreflinker/interfile/typedefreferredmultipletimes/ietf-interfaces.yang b/compiler/plugin/maven/src/test/resources/leafreflinker/interfile/typedefreferredmultipletimes/ietf-interfaces.yang
new file mode 100644
index 0000000..31bcb98
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/leafreflinker/interfile/typedefreferredmultipletimes/ietf-interfaces.yang
@@ -0,0 +1,55 @@
+module ietf-interfaces {
+    namespace "urn:ietf:params:xml:ns:yang:ietf-interfaces";
+    prefix if;
+    typedef interface-state-ref {
+        type leafref {
+            path "/if:interfaces-state/if:interface/if:name";
+        }
+        description
+            "This type is used by data models that need to reference
+            the operationally present interfaces";
+    }
+    /*
+     * Operational state data nodes
+     */
+    container interfaces-state {
+        config false;
+        description
+            "Data nodes for the operational state of interfaces.";
+        list interface {
+            key "name";
+            description
+                "The list of interfaces on the device.
+                System-controlled interfaces created by the system are
+                always present in this list, whether they are configured or
+                not.";
+            leaf name {
+                type string;
+                description
+                    "The name of the interface.
+                    A server implementation MAY map this leaf to the ifName
+                    MIB object.  Such an implementation needs to use some
+                    mechanism to handle the differences in size and characters
+                    allowed between this leaf and ifName.  The definition of
+                    such a mechanism is outside the scope of this document.";
+                    reference "RFC 2863: The Interfaces Group MIB - ifName";
+            }
+            leaf-list higher-layer-if {
+                type interface-state-ref;
+                description
+                    "A list of references to interfaces layered on top of this
+                    interface.";
+                reference
+                    "RFC 2863: The Interfaces Group MIB - ifStackTable";
+            }
+            leaf-list lower-layer-if {
+                type interface-state-ref;
+                description
+                    "A list of references to interfaces layered underneath this
+                    interface.";
+                reference
+                    "RFC 2863: The Interfaces Group MIB - ifStackTable";
+            }
+        }
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/invalidscenerioforgrouping/SelfResolutionWhenLeafrefInModuleReferToGroupingInModule.yang b/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/invalidscenerioforgrouping/SelfResolutionWhenLeafrefInModuleReferToGroupingInModule.yang
new file mode 100644
index 0000000..a0bd03b
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/invalidscenerioforgrouping/SelfResolutionWhenLeafrefInModuleReferToGroupingInModule.yang
@@ -0,0 +1,19 @@
+module SelfResolutionWhenLeafrefInModuleReferToGroupingInModule {
+    yang-version 1;
+    namespace "urn:ietf:params:xml:ns:yang:ietf-network";
+    prefix nd;
+    grouping networks {
+        leaf network-id {
+            type uint8;
+            description
+            "Identifies a network.";
+        }
+    }
+    container current {
+        leaf network-ref {
+            type leafref {
+            path "/networks/network-id";
+            }
+        }
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/invalidsceneriowithinvalidnode/SelfResolutionWhenLeafrefInModuleReferToInvalidNode.yang b/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/invalidsceneriowithinvalidnode/SelfResolutionWhenLeafrefInModuleReferToInvalidNode.yang
new file mode 100644
index 0000000..c10ba2b
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/invalidsceneriowithinvalidnode/SelfResolutionWhenLeafrefInModuleReferToInvalidNode.yang
@@ -0,0 +1,19 @@
+module SelfResolutionWhenLeafrefInModuleReferToInvalidNode {
+    yang-version 1;
+    namespace "urn:ietf:params:xml:ns:yang:ietf-network";
+    prefix nd;
+    container networks {
+        description
+        "Serves as top-level container for a list of networks.";
+        leaf network-id {
+            type uint8;
+            description
+            "Identifies a network.";
+        }
+    }
+    leaf network-ref {
+            type leafref {
+            path "/define/network-id";
+        }
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/invalidsceneriowithnorefleaf/SelfResolutionWhenLeafrefDoesNotReferToLeafOrLeafList.yang b/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/invalidsceneriowithnorefleaf/SelfResolutionWhenLeafrefDoesNotReferToLeafOrLeafList.yang
new file mode 100644
index 0000000..e5de10b
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/invalidsceneriowithnorefleaf/SelfResolutionWhenLeafrefDoesNotReferToLeafOrLeafList.yang
@@ -0,0 +1,22 @@
+module ietf-network {
+    yang-version 1;
+    namespace "urn:ietf:params:xml:ns:yang:ietf-network";
+    prefix nd;
+    container networks {
+        description
+        "Serves as top-level container for a list of networks.";
+        leaf network-id {
+            type status;
+            description
+            "Identifies a network.";
+        }
+    }
+    typedef status {
+        type uint8;
+    }
+    leaf network-ref {
+        type leafref {
+            path "/networks";
+        }
+    }
+}
\ No newline at end of file
diff --git a/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/leafrefInAugment/SelfResolutionIfLeafrefInGroupingIsCopiedToAugment.yang b/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/leafrefInAugment/SelfResolutionIfLeafrefInGroupingIsCopiedToAugment.yang
new file mode 100644
index 0000000..a208903
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/leafrefInAugment/SelfResolutionIfLeafrefInGroupingIsCopiedToAugment.yang
@@ -0,0 +1,64 @@
+module topology {
+    yang-version 1;
+    namespace "onos-yang-19:level1:newlevel";
+    prefix test;
+    organization "huawei";
+    contact "adarsh.m@huawei.com";
+    description "leaf scenario";
+    container networks {
+        list network {
+            key "network-id";
+            description
+                "Describes a network.
+                A network typically contains an inventory of nodes,
+                topological information (augmented through
+                network-topology model), as well as layering
+                information.";
+            container network-types {
+                description
+                    "Serves as an augmentation target.
+                    The network type is indicated through corresponding
+                    presence containers augmented into this container.";
+            }
+            leaf network-id {
+                type string;
+                description
+                "Identifies a network.";
+            }
+        }
+        leaf network-ip {
+            type uint8;
+            description
+            "Identifies a network.";
+        }
+    }
+    augment "/networks/network" {
+        container config {
+            description
+                "Configuration data.";
+            choice bundle-stack-level {
+                description
+                    "The TE link can be partitioned into bundled
+                    links, or component links.";
+                case bundle {
+                    container bundled-links {
+                        description
+                            "A set of bundled links.";
+                        reference
+                            "RFC4201: Link Bundling in MPLS Traffic Engineering
+                            (TE).";
+                        list bundled-link {
+                            key "src-tp-ref";
+                            leaf src-tp-ref {
+                                type leafref {
+                                    path "../../../../../network-ip";
+                                    require-instance true;
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        }
+    }
+}
\ No newline at end of file
diff --git a/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/leafrefingroupingonly/SelfResolutionWithLeafrefInGrouping.yang b/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/leafrefingroupingonly/SelfResolutionWithLeafrefInGrouping.yang
new file mode 100644
index 0000000..80b6ab0
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/leafrefingroupingonly/SelfResolutionWithLeafrefInGrouping.yang
@@ -0,0 +1,37 @@
+module ietf-network {
+     yang-version 1;
+     namespace "urn:ietf:params:xml:ns:yang:ietf-network";
+     prefix nd;
+
+     import ietf-inet-types {
+       prefix inet;
+     }
+     typedef node-id {
+       type inet:uri;
+       description
+         "Identifier for a node.";
+     }
+
+     leaf xyz {
+         type string;
+     }
+     typedef network-id {
+       type inet:uri;
+       description
+         "Identifier for a network.";
+     }
+     grouping network-ref {
+       description
+         "Contains the information necessary to reference a network,
+          for example an underlay network.";
+       leaf network-ref {
+         type leafref {
+           path "/nd:xyz";
+         require-instance false;
+         }
+         description
+           "Used to reference a network, for example an underlay
+            network.";
+       }
+     }
+   }
diff --git a/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/leafrefintypedef/SelfResolutionWhenLeafrefInTypedefReferToContainer.yang b/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/leafrefintypedef/SelfResolutionWhenLeafrefInTypedefReferToContainer.yang
new file mode 100644
index 0000000..ae42100
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/leafrefintypedef/SelfResolutionWhenLeafrefInTypedefReferToContainer.yang
@@ -0,0 +1,22 @@
+module ietf-network {
+    yang-version 1;
+    namespace "urn:ietf:params:xml:ns:yang:ietf-network";
+    prefix nd;
+    container networks {
+        description
+        "Serves as top-level container for a list of networks.";
+        leaf network-id {
+            type network-ref;
+            description
+            "Identifies a network.";
+        }
+        leaf id {
+            type uint8;
+        }
+    }
+    typedef network-ref {
+        type leafref {
+            path "/networks/id";
+        }
+    }
+}
\ No newline at end of file
diff --git a/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/leafrefintypedefwithsamereferpath/SelfResolutionWhenLeafrefInTypedefIsUsedInSameReferredNode.yang b/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/leafrefintypedefwithsamereferpath/SelfResolutionWhenLeafrefInTypedefIsUsedInSameReferredNode.yang
new file mode 100644
index 0000000..7506be9
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/leafrefintypedefwithsamereferpath/SelfResolutionWhenLeafrefInTypedefIsUsedInSameReferredNode.yang
@@ -0,0 +1,34 @@
+module typedef {
+    yang-version "1";
+    namespace "http://rob.sh/yang/test/list";
+    prefix "foo";
+    organization "BugReports Inc";
+    contact "Bug reporter";
+
+    description
+        "A test module";
+    revision 2014-01-01 {
+        description "april-fools";
+        reference "fooled-you";
+    }
+
+    typedef referenced-leaf {
+        type leafref {
+            path "/container/target";
+            require-instance false;
+        }
+    }
+
+    container container {
+        description
+            "A container";
+        leaf-list target {
+            type uint8;
+            description
+                "A target leaf for leafref checks";
+        }
+        leaf reference {
+            type referenced-leaf;
+        }
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/leafrefinusesundergrouping/ietf-network.yang b/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/leafrefinusesundergrouping/ietf-network.yang
new file mode 100644
index 0000000..4eaa2bf
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/leafrefinusesundergrouping/ietf-network.yang
@@ -0,0 +1,33 @@
+module ietf-network {
+    yang-version 1;
+    namespace "urn:ietf:params:xml:ns:yang:ietf-network";
+    prefix nd;
+    import network {
+       prefix "nw";
+    }
+    grouping xyz {
+        leaf network-id-ref {
+            type leafref {
+                path "/nw:networks/nw:network/nw:network-id";
+                require-instance false;
+            }
+            description
+                "A reference to a network-id in base ietf-network module.";
+        }
+    }
+    grouping yzx {
+        container hi {
+        uses xyz;
+        }
+    }
+    container fine {
+        uses yzx;
+    }
+    container networks {
+        leaf network {
+            type string;
+        }
+    }
+}
+
+
diff --git a/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/leafrefinusesundergrouping/network.yang b/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/leafrefinusesundergrouping/network.yang
new file mode 100644
index 0000000..30e8b80
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/leafrefinusesundergrouping/network.yang
@@ -0,0 +1,212 @@
+   module network {
+     yang-version 1;
+     namespace "urn:ietf:params:xml:ns:yang:ietf-network";
+     prefix nd;
+
+     organization
+       "IETF I2RS (Interface to the Routing System) Working Group";
+
+     contact
+       "WG Web:    <http://tools.ietf.org/wg/i2rs/>
+        WG List:   <mailto:i2rs@ietf.org>
+
+        WG Chair:  Susan Hares
+                   <mailto:shares@ndzh.com>
+
+        WG Chair:  Jeffrey Haas
+                   <mailto:jhaas@pfrc.org>
+
+        Editor:    Alexander Clemm
+                   <mailto:alex@cisco.com>
+
+        Editor:    Jan Medved
+                   <mailto:jmedved@cisco.com>
+
+        Editor:    Robert Varga
+                   <mailto:rovarga@cisco.com>
+
+        Editor:    Tony Tkacik
+                   <mailto:ttkacik@cisco.com>
+
+        Editor:    Nitin Bahadur
+                   <mailto:nitin_bahadur@yahoo.com>
+
+        Editor:    Hariharan Ananthakrishnan
+                   <mailto:hari@packetdesign.com>";
+
+     description
+       "This module defines a common base model for a collection
+        of nodes in a network. Node definitions are further used
+        in network topologies and inventories.
+
+        Copyright (c) 2015 IETF Trust and the persons identified as
+        authors of the code.  All rights reserved.
+
+        Redistribution and use in source and binary forms, with or
+        without modification, is permitted pursuant to, and subject
+        to the license terms contained in, the Simplified BSD License
+        set forth in Section 4.c of the IETF Trust's Legal Provisions
+        Relating to IETF Documents
+        (http://trustee.ietf.org/license-info).
+
+        This version of this YANG module is part of
+        draft-ietf-i2rs-yang-network-topo-02;
+        see the RFC itself for full legal notices.
+
+        NOTE TO RFC EDITOR: Please replace above reference to
+        draft-ietf-i2rs-yang-network-topo-02 with RFC
+        number when published (i.e. RFC xxxx).";
+
+     revision 2015-12-08 {
+       description
+         "Initial revision.
+          NOTE TO RFC EDITOR: Please replace the following reference
+          to draft-ietf-i2rs-yang-network-topo-02 with
+          RFC number when published (i.e. RFC xxxx).";
+       reference
+         "draft-ietf-i2rs-yang-network-topo-02";
+     }
+
+     typedef node-id {
+       type string;
+       description
+         "Identifier for a node.";
+     }
+
+     typedef network-id {
+       type string;
+       description
+         "Identifier for a network.";
+     }
+     grouping network-ref {
+       description
+         "Contains the information necessary to reference a network,
+          for example an underlay network.";
+       leaf network-ref {
+         type leafref {
+           path "/nd:networks/nd:network/nd:network-id";
+         require-instance false;
+         }
+         description
+           "Used to reference a network, for example an underlay
+            network.";
+       }
+     }
+
+     grouping node-ref {
+       description
+         "Contains the information necessary to reference a node.";
+       leaf node-ref {
+         type leafref {
+           path "/nd:networks/nd:network[nd:network-id=current()/../"+
+             "network-ref]/nd:node/nd:node-id";
+           require-instance false;
+         }
+         description
+           "Used to reference a node.
+            Nodes are identified relative to the network they are
+            contained in.";
+       }
+       uses network-ref;
+     }
+
+     container networks {
+       description
+         "Serves as top-level container for a list of networks.";
+       list network {
+         key "network-id";
+         description
+           "Describes a network.
+            A network typically contains an inventory of nodes,
+            topological information (augmented through
+            network-topology model), as well as layering
+            information.";
+         container network-types {
+           description
+             "Serves as an augmentation target.
+              The network type is indicated through corresponding
+              presence containers augmented into this container.";
+         }
+         leaf network-id {
+           type network-id;
+           description
+             "Identifies a network.";
+         }
+         list supporting-network {
+           key "network-ref";
+           description
+             "An underlay network, used to represent layered network
+              topologies.";
+           leaf network-ref {
+             type leafref {
+               path "/networks/network/network-id";
+             require-instance false;
+             }
+             description
+               "References the underlay network.";
+           }
+         }
+         list node {
+           key "node-id";
+           description
+             "The inventory of nodes of this network.";
+           leaf node-id {
+             type node-id;
+             description
+               "Identifies a node uniquely within the containing
+                network.";
+           }
+           list supporting-node {
+             key "network-ref node-ref";
+             description
+               "Represents another node, in an underlay network, that
+                this node is supported by.  Used to represent layering
+                structure.";
+             leaf network-ref {
+               type leafref {
+                 path "../../../supporting-network/network-ref";
+               require-instance false;
+               }
+               description
+                 "References the underlay network that the
+                  underlay node is part of.";
+             }
+             leaf node-ref {
+               type leafref {
+                 path "/networks/network/node/node-id";
+               require-instance false;
+               }
+               description
+                 "References the underlay node itself.";
+             }
+           }
+         }
+       }
+     }
+     container networks-state {
+       config false;
+       description
+         "Serves as top-level container for a list of state information
+          for networks";
+       list network {
+         key "network-ref";
+         description
+           "Data nodes representing operational data and state of
+            networks.
+            An instance is automatically created for every network
+            in the corresponding list under the networks container.";
+         uses network-ref;
+         leaf server-provided {
+           type boolean;
+           description
+             "Indicates whether the information concerning this
+              particular network is populated by the server
+              (server-provided true, the general case for network
+              information discovered from the server),
+              or whether it is configured by a client
+              (server-provided true, possible e.g. for
+              service overlays managed through a controller).";
+         }
+       }
+     }
+   }
\ No newline at end of file
diff --git a/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/leafreflinking/SelfResolutionWhenLeafrefIsInDeepTreeAndLeafIsInModuleWithReferredTypeUnion.yang b/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/leafreflinking/SelfResolutionWhenLeafrefIsInDeepTreeAndLeafIsInModuleWithReferredTypeUnion.yang
new file mode 100644
index 0000000..edf6bfa
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/leafreflinking/SelfResolutionWhenLeafrefIsInDeepTreeAndLeafIsInModuleWithReferredTypeUnion.yang
@@ -0,0 +1,28 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    list valid {
+        key "define";
+        leaf define {
+            type string;
+        }
+        container standard {
+            container present {
+                leaf name {
+                    type leafref {
+                        path "/invalid-interval";
+                    }
+                }
+            }
+        }
+    }
+    leaf invalid-interval {
+        type union {
+            type int32;
+            type enumeration {
+                enum "unbounded";
+            }
+        }
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/leafrefreferingtoleaflist/SelfResolutionWhenLeafrefReferToContainerLeafList.yang b/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/leafrefreferingtoleaflist/SelfResolutionWhenLeafrefReferToContainerLeafList.yang
new file mode 100644
index 0000000..ec9a6d3
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/leafrefreferingtoleaflist/SelfResolutionWhenLeafrefReferToContainerLeafList.yang
@@ -0,0 +1,19 @@
+module ietf-network {
+    yang-version 1;
+    namespace "urn:ietf:params:xml:ns:yang:ietf-network";
+    prefix nd;
+    container networks {
+        description
+        "Serves as top-level container for a list of networks.";
+        leaf network-id {
+            type uint8;
+            description
+            "Identifies a network.";
+        }
+    }
+    leaf-list network-ref {
+        type leafref {
+        path "/networks/network-id";
+        }
+    }
+}
\ No newline at end of file
diff --git a/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/leafreftoderivedtype/SelfResolutionWhenLeafrefReferToAnotherDerivedType.yang b/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/leafreftoderivedtype/SelfResolutionWhenLeafrefReferToAnotherDerivedType.yang
new file mode 100644
index 0000000..eb2668e
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/leafreftoderivedtype/SelfResolutionWhenLeafrefReferToAnotherDerivedType.yang
@@ -0,0 +1,22 @@
+module ietf-network {
+    yang-version 1;
+    namespace "urn:ietf:params:xml:ns:yang:ietf-network";
+    prefix nd;
+    container networks {
+        description
+        "Serves as top-level container for a list of networks.";
+        leaf network-id {
+            type status;
+            description
+            "Identifies a network.";
+        }
+    }
+    typedef status {
+        type uint8;
+    }
+    leaf network-ref {
+        type leafref {
+            path "/networks/network-id";
+        }
+    }
+}
\ No newline at end of file
diff --git a/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/leafreftoinputinrpc/SelfResolutionWhenLeafrefInModuleReferToLeafListInInputOfRpc.yang b/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/leafreftoinputinrpc/SelfResolutionWhenLeafrefInModuleReferToLeafListInInputOfRpc.yang
new file mode 100644
index 0000000..917c434
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/leafreftoinputinrpc/SelfResolutionWhenLeafrefInModuleReferToLeafListInInputOfRpc.yang
@@ -0,0 +1,23 @@
+module ietf-network {
+    yang-version 1;
+    namespace "urn:ietf:params:xml:ns:yang:ietf-network";
+    prefix nd;
+    rpc networks {
+        description
+        "Serves as top-level container for a list of networks.";
+        input {
+            leaf-list network-id {
+                type uint8;
+                description
+                "Identifies a network.";
+            }
+        }
+        output {
+        }
+    }
+    leaf-list network-ref {
+        type leafref {
+        path "/networks/input/network-id";
+        }
+    }
+}
\ No newline at end of file
diff --git a/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/leafreftoleafref/SelfResolutionWhenLeafrefReferToAnotherLeafref.yang b/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/leafreftoleafref/SelfResolutionWhenLeafrefReferToAnotherLeafref.yang
new file mode 100644
index 0000000..26ccd1f
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/leafreftoleafref/SelfResolutionWhenLeafrefReferToAnotherLeafref.yang
@@ -0,0 +1,26 @@
+module ietf-network {
+    yang-version 1;
+    namespace "urn:ietf:params:xml:ns:yang:ietf-network";
+    prefix nd;
+    container networks {
+        description
+        "Serves as top-level container for a list of networks.";
+        leaf network-id {
+            type leafref {
+                path "/status/current";
+            }
+            description
+            "Identifies a network.";
+        }
+    }
+    container status {
+        leaf current {
+            type uint8;
+        }
+    }
+    leaf network-ref {
+        type leafref {
+            path "/networks/network-id";
+        }
+    }
+}
\ No newline at end of file
diff --git a/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/leafreftoleafrefwithtypedef/SelfResolutionWhenLeafrefInTypedefIsInDeepTreeAndLeafListIsInModuleWithReferredTypeEnumeration.yang b/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/leafreftoleafrefwithtypedef/SelfResolutionWhenLeafrefInTypedefIsInDeepTreeAndLeafListIsInModuleWithReferredTypeEnumeration.yang
new file mode 100644
index 0000000..b61be6a
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/leafreftoleafrefwithtypedef/SelfResolutionWhenLeafrefInTypedefIsInDeepTreeAndLeafListIsInModuleWithReferredTypeEnumeration.yang
@@ -0,0 +1,33 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    list valid {
+        key "define";
+        leaf define {
+            type string;
+        }
+        container standard {
+            typedef node {
+                type leafref {
+                    path "/invalid-interval";
+                }
+            }
+            container present {
+                typedef name {
+                    type node;
+                }
+                leaf interval {
+                    type name;
+                }
+            }
+        }
+    }
+    leaf-list invalid-interval {
+        type enumeration {
+            enum 10m;
+            enum 100m;
+            enum auto;
+        }
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/leafreftomultileafref/SelfResolutionWhenLeafrefReferToMultipleLeafref.yang b/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/leafreftomultileafref/SelfResolutionWhenLeafrefReferToMultipleLeafref.yang
new file mode 100644
index 0000000..fd75d32
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/leafreftomultileafref/SelfResolutionWhenLeafrefReferToMultipleLeafref.yang
@@ -0,0 +1,50 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    list valid {
+        key "define";
+        leaf define {
+            type string;
+        }
+        container standard {
+            container present {
+                leaf-list name {
+                    type leafref {
+                        path "/transmitter/send";
+                    }
+                }
+            }
+        }
+    }
+    container reference {
+        list found {
+            key "define";
+            leaf define {
+                type string;
+            }
+            container reciever {
+                leaf remove {
+                    type leafref {
+                        path "/valid/standard/present/name";
+                    }
+                }
+            }
+        }
+    }
+    list transmitter {
+        key "send";
+        leaf send {
+            type leafref {
+                path "/invalid-interval";
+            }
+        }
+    }
+    leaf-list invalid-interval {
+        type enumeration {
+            enum 10m;
+            enum 100m;
+            enum auto;
+        }
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/leafreftomultitypedef/SelfResolutionWhenLeafrefReferToMultipleTypedef.yang b/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/leafreftomultitypedef/SelfResolutionWhenLeafrefReferToMultipleTypedef.yang
new file mode 100644
index 0000000..4b286d2
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/leafreftomultitypedef/SelfResolutionWhenLeafrefReferToMultipleTypedef.yang
@@ -0,0 +1,43 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    list valid {
+        key "define";
+        leaf define {
+            type string;
+        }
+        container standard {
+            container present {
+                leaf-list name {
+                    type transmitter;
+                }
+            }
+        }
+    }
+    container reference {
+        list found {
+            key "define";
+            leaf define {
+                type string;
+            }
+            container reciever {
+                leaf remove {
+                    type leafref {
+                        path "/valid/standard/present/name";
+                    }
+                }
+            }
+        }
+    }
+    typedef transmitter {
+        type invalid-interval;
+    }
+    typedef invalid-interval {
+        type enumeration {
+            enum 10m;
+            enum 100m;
+            enum auto;
+        }
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/leafreftorpcinputleaflist/SelfResolutionWhenLeafrefInTypedefModuleReferToLeafListInInputOfRpc.yang b/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/leafreftorpcinputleaflist/SelfResolutionWhenLeafrefInTypedefModuleReferToLeafListInInputOfRpc.yang
new file mode 100644
index 0000000..59e7a98
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/leafreftorpcinputleaflist/SelfResolutionWhenLeafrefInTypedefModuleReferToLeafListInInputOfRpc.yang
@@ -0,0 +1,26 @@
+module ietf-network {
+    yang-version 1;
+    namespace "urn:ietf:params:xml:ns:yang:ietf-network";
+    prefix nd;
+    rpc networks {
+        description
+        "Serves as top-level container for a list of networks.";
+        input {
+            leaf-list network-id {
+                type network-ref;
+                description
+                "Identifies a network.";
+            }
+            leaf id {
+                type uint8;
+            }
+        }
+        output {
+        }
+    }
+    typedef network-ref {
+        type leafref {
+            path "/networks/input/id";
+        }
+    }
+}
\ No newline at end of file
diff --git a/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/leafreftotypedefwithleafref/SelfResolutionWhenLeafrefReferToDerivedTypeReferringToLeafWithLeafref.yang b/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/leafreftotypedefwithleafref/SelfResolutionWhenLeafrefReferToDerivedTypeReferringToLeafWithLeafref.yang
new file mode 100644
index 0000000..1bf423d
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/leafreftotypedefwithleafref/SelfResolutionWhenLeafrefReferToDerivedTypeReferringToLeafWithLeafref.yang
@@ -0,0 +1,45 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    list valid {
+        key "define";
+        leaf define {
+            type string;
+        }
+        container standard {
+            container present {
+                leaf-list name {
+                    type transmitter;
+                }
+            }
+        }
+    }
+    container reference {
+        list found {
+            key "define";
+            leaf define {
+                type string;
+            }
+            container reciever {
+                leaf remove {
+                    type leafref {
+                        path "/valid/standard/present/name";
+                    }
+                }
+            }
+        }
+    }
+    typedef transmitter {
+        type leafref {
+            path "/invalid-interval";
+        }
+    }
+    leaf invalid-interval {
+        type enumeration {
+            enum 10m;
+            enum 100m;
+            enum auto;
+        }
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/leafrefundernodeingrouping/ietf-network.yang b/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/leafrefundernodeingrouping/ietf-network.yang
new file mode 100644
index 0000000..3db511e
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/leafrefundernodeingrouping/ietf-network.yang
@@ -0,0 +1,95 @@
+module ietf-network {
+     yang-version 1;
+     namespace "urn:ietf:params:xml:ns:yang:ietf-network";
+     prefix nd;
+
+     organization
+       "IETF I2RS (Interface to the Routing System) Working Group";     
+    grouping node-ref {
+       description
+         "Contains the information necessary to reference a node.";
+       container node-from-grouping {
+             leaf node-ref {
+                type leafref {
+                 path "/networks/network/node/node-id";
+                   require-instance false;
+                  }
+              }
+         }
+     }
+     container networks {
+       description
+         "Serves as top-level container for a list of networks.";
+       list network {
+         key "network-id";
+         description
+           "Describes a network.
+            A network typically contains an inventory of nodes,
+            topological information (augmented through
+            network-topology model), as well as layering
+            information.";
+         container network-types {
+           description
+             "Serves as an augmentation target.
+              The network type is indicated through corresponding
+              presence containers augmented into this container.";
+         }
+         leaf network-id {
+           type string;
+           description
+             "Identifies a network.";
+         }
+         list supporting-network {
+           key "network-ref";
+           description
+             "An underlay network, used to represent layered network
+              topologies.";
+           leaf network-ref {
+             type leafref {
+               path "/networks/network/network-id";
+             require-instance false;
+             }
+             description
+               "References the underlay network.";
+           }
+         }
+         list node {
+           key "node-id";
+           description
+             "The inventory of nodes of this network.";
+           leaf node-id {
+             type uint8;
+             description
+               "Identifies a node uniquely within the containing
+                network.";
+           }
+           list supporting-node {
+             key "network-ref node-ref";
+             description
+               "Represents another node, in an underlay network, that
+                this node is supported by.  Used to represent layering
+                structure.";
+             leaf network-ref {
+               type leafref {
+                 path "../../../supporting-network/network-ref";
+               require-instance false;
+               }
+               description
+                 "References the underlay network that the
+                  underlay node is part of.";
+             }
+             leaf node-ref {
+               type leafref {
+                 path "/networks/network/node/node-id";
+               require-instance false;
+               }
+               description
+                 "References the underlay node itself.";
+             }
+           }
+         }
+       }
+       uses node-ref;
+     }
+
+}
diff --git a/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/leafrefwithrefleafderived/SelfResolutionWhenLeafrefIsInDeepTreeAndLeafListIsInModuleWithReferredTypeEnumeration.yang b/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/leafrefwithrefleafderived/SelfResolutionWhenLeafrefIsInDeepTreeAndLeafListIsInModuleWithReferredTypeEnumeration.yang
new file mode 100644
index 0000000..a3e0f29
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/leafrefwithrefleafderived/SelfResolutionWhenLeafrefIsInDeepTreeAndLeafListIsInModuleWithReferredTypeEnumeration.yang
@@ -0,0 +1,27 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    list valid {
+        key "define";
+        leaf define {
+            type string;
+        }
+        container standard {
+            container present {
+                leaf-list name {
+                    type leafref {
+                        path "/invalid-interval";
+                    }
+                }
+            }
+        }
+    }
+    leaf-list invalid-interval {
+        type enumeration {
+            enum 10m;
+            enum 100m;
+            enum auto;
+        }
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/leafrefwithrpc/SelfResolutionWhenLeafrefInModuleReferToLeafInInputOfRpc.yang b/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/leafrefwithrpc/SelfResolutionWhenLeafrefInModuleReferToLeafInInputOfRpc.yang
new file mode 100644
index 0000000..3dce93e
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/leafrefwithrpc/SelfResolutionWhenLeafrefInModuleReferToLeafInInputOfRpc.yang
@@ -0,0 +1,23 @@
+module SelfResolutionWhenLeafrefInModuleReferToLeafInInputOfRpc {
+    yang-version 1;
+    namespace "urn:ietf:params:xml:ns:yang:ietf-network";
+    prefix nd;
+    rpc networks {
+        description
+        "Serves as top-level container for a list of networks.";
+        input {
+            leaf network-id {
+                type uint8;
+                description
+                "Identifies a network.";
+            }
+        }
+        output {
+        }
+    }
+    leaf network-ref {
+        type leafref {
+        path "/networks/input/network-id";
+        }
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/leafrefwithrpcandgrouping/SelfResolutionWhenLeafrefInModuleReferToGroupingWithInputInRpc.yang b/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/leafrefwithrpcandgrouping/SelfResolutionWhenLeafrefInModuleReferToGroupingWithInputInRpc.yang
new file mode 100644
index 0000000..e8debbd
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/leafrefwithrpcandgrouping/SelfResolutionWhenLeafrefInModuleReferToGroupingWithInputInRpc.yang
@@ -0,0 +1,28 @@
+module SelfResolutionWhenLeafrefInModuleReferToGroupingWithInputInRpc {
+    yang-version 1;
+    namespace "urn:ietf:params:xml:ns:yang:ietf-network";
+    prefix nd;
+    rpc networks {
+        description
+        "Serves as top-level container for a list of networks.";
+        grouping input {
+            leaf network-id {
+                type string;
+                description
+                "Identifies a network.";
+            }
+        }
+        input {
+            leaf network-id {
+                type uint8;
+                description
+                "Identifies a network.";
+            }
+        }
+    }
+    leaf network-ref {
+        type leafref {
+        path "/networks/input/network-id";
+        }
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/relativepath/invalidnode/SelfResolutionWhenLeafrefInModuleReferToInvalidNodeRelPath.yang b/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/relativepath/invalidnode/SelfResolutionWhenLeafrefInModuleReferToInvalidNodeRelPath.yang
new file mode 100644
index 0000000..9681d76
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/relativepath/invalidnode/SelfResolutionWhenLeafrefInModuleReferToInvalidNodeRelPath.yang
@@ -0,0 +1,19 @@
+module ietf-network {
+    yang-version 1;
+    namespace "urn:ietf:params:xml:ns:yang:ietf-network";
+    prefix nd;
+    container networks {
+        description
+        "Serves as top-level container for a list of networks.";
+        leaf network-id {
+            type uint8;
+            description
+            "Identifies a network.";
+        }
+    }
+    leaf network-ref {
+            type leafref {
+            path "../define/network-id";
+        }
+    }
+}
\ No newline at end of file
diff --git a/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/relativepath/invalidrelativeancestoraccess/SelfResolutionWhenLeafrefInModuleReferToInvalidRootNodeRelPath.yang b/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/relativepath/invalidrelativeancestoraccess/SelfResolutionWhenLeafrefInModuleReferToInvalidRootNodeRelPath.yang
new file mode 100644
index 0000000..7e3d216
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/relativepath/invalidrelativeancestoraccess/SelfResolutionWhenLeafrefInModuleReferToInvalidRootNodeRelPath.yang
@@ -0,0 +1,19 @@
+module ietf-network {
+    yang-version 1;
+    namespace "urn:ietf:params:xml:ns:yang:ietf-network";
+    prefix nd;
+    container networks {
+        description
+        "Serves as top-level container for a list of networks.";
+        leaf network-id {
+            type uint8;
+            description
+            "Identifies a network.";
+        }
+    }
+    leaf network-ref {
+            type leafref {
+            path "../../../define/network-id";
+        }
+    }
+}
\ No newline at end of file
diff --git a/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/relativepath/leafrefintypedef/SelfResolutionWhenLeafrefInTypedefReferToContainerRelPath.yang b/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/relativepath/leafrefintypedef/SelfResolutionWhenLeafrefInTypedefReferToContainerRelPath.yang
new file mode 100644
index 0000000..93d8e94
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/relativepath/leafrefintypedef/SelfResolutionWhenLeafrefInTypedefReferToContainerRelPath.yang
@@ -0,0 +1,22 @@
+module ietf-network {
+    yang-version 1;
+    namespace "urn:ietf:params:xml:ns:yang:ietf-network";
+    prefix nd;
+    container networks {
+        description
+        "Serves as top-level container for a list of networks.";
+        leaf network-id {
+            type network-ref;
+            description
+            "Identifies a network.";
+        }
+        leaf id {
+            type uint8;
+        }
+    }
+    typedef network-ref {
+        type leafref {
+            path "../id";
+        }
+    }
+}
\ No newline at end of file
diff --git a/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/relativepath/leafreftoinputwithgroupinginrpc/SelfResolutionWhenLeafrefInModuleReferToGroupingWithInputInRpcRelPath.yang b/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/relativepath/leafreftoinputwithgroupinginrpc/SelfResolutionWhenLeafrefInModuleReferToGroupingWithInputInRpcRelPath.yang
new file mode 100644
index 0000000..477832d
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/relativepath/leafreftoinputwithgroupinginrpc/SelfResolutionWhenLeafrefInModuleReferToGroupingWithInputInRpcRelPath.yang
@@ -0,0 +1,28 @@
+module ietf-network {
+    yang-version 1;
+    namespace "urn:ietf:params:xml:ns:yang:ietf-network";
+    prefix nd;
+    rpc networks {
+        description
+        "Serves as top-level container for a list of networks.";
+        grouping input {
+            leaf network-id {
+                type string;
+                description
+                "Identifies a network.";
+            }
+        }
+        input {
+            leaf network-id {
+                type uint8;
+                description
+                "Identifies a network.";
+            }
+        }
+    }
+    leaf network-ref {
+        type leafref {
+            path "../networks/input/network-id";
+        }
+    }
+}
\ No newline at end of file
diff --git a/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/relativepath/leafreftomultileafref/SelfResolutionWhenLeafrefReferToMultipleLeafrefRelPath.yang b/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/relativepath/leafreftomultileafref/SelfResolutionWhenLeafrefReferToMultipleLeafrefRelPath.yang
new file mode 100644
index 0000000..890bbaa
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/relativepath/leafreftomultileafref/SelfResolutionWhenLeafrefReferToMultipleLeafrefRelPath.yang
@@ -0,0 +1,50 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    list valid {
+        key "define";
+        leaf define {
+            type string;
+        }
+        container standard {
+            container present {
+                leaf-list name {
+                    type leafref {
+                        path "../../../../transmitter/send";
+                    }
+                }
+            }
+        }
+    }
+    container reference {
+        list found {
+            key "define";
+            leaf define {
+                type string;
+            }
+            container reciever {
+                leaf remove {
+                    type leafref {
+                        path "../../../../valid/standard/present/name";
+                    }
+                }
+            }
+        }
+    }
+    list transmitter {
+        key "send";
+        leaf send {
+            type leafref {
+                path "../../invalid-interval";
+            }
+        }
+    }
+    leaf-list invalid-interval {
+        type enumeration {
+            enum 10m;
+            enum 100m;
+            enum auto;
+        }
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/relativepath/leafreftotypedef/SelfResolutionWhenLeafrefReferToDerivedTypeReferringToLeafWithLeafrefRelType.yang b/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/relativepath/leafreftotypedef/SelfResolutionWhenLeafrefReferToDerivedTypeReferringToLeafWithLeafrefRelType.yang
new file mode 100644
index 0000000..5570f38
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/relativepath/leafreftotypedef/SelfResolutionWhenLeafrefReferToDerivedTypeReferringToLeafWithLeafrefRelType.yang
@@ -0,0 +1,45 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    list valid {
+        key "define";
+        leaf define {
+            type string;
+        }
+        container standard {
+            container present {
+                leaf-list name {
+                    type transmitter;
+                }
+            }
+        }
+    }
+    container reference {
+        list found {
+            key "define";
+            leaf define {
+                type string;
+            }
+            container reciever {
+                leaf remove {
+                    type leafref {
+                        path "../../../../valid/standard/present/name";
+                    }
+                }
+            }
+        }
+    }
+    typedef transmitter {
+        type leafref {
+            path "../../../../invalid-interval";
+        }
+    }
+    leaf invalid-interval {
+        type enumeration {
+            enum 10m;
+            enum 100m;
+            enum auto;
+        }
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/relativepath/pathlistener/PathListener.yang b/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/relativepath/pathlistener/PathListener.yang
new file mode 100644
index 0000000..c4dae28
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/relativepath/pathlistener/PathListener.yang
@@ -0,0 +1,31 @@
+module PathListener {
+    namespace "test";
+    prefix test;
+     list interface {
+         key "name";
+         leaf name {
+             type string;
+         }
+         leaf admin-status {
+             type string;
+         }
+         list address {
+             key "ip";
+             leaf ip {
+                 type string;
+             }
+         }
+     }
+     container default-address {
+         leaf ifname {
+             type leafref {
+                 path "../../test:interface/test:name";
+             }
+         }
+         leaf status {
+             type leafref {
+                 path "/test:interface[name = current()/../ifname]/test:admin-status";
+             }
+         }
+     }
+}
\ No newline at end of file
diff --git a/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/relativepath/simpleleafref/SelfResolutionWhenLeafrefReferToContainerLeafRelPath.yang b/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/relativepath/simpleleafref/SelfResolutionWhenLeafrefReferToContainerLeafRelPath.yang
new file mode 100644
index 0000000..05ef0d2
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/relativepath/simpleleafref/SelfResolutionWhenLeafrefReferToContainerLeafRelPath.yang
@@ -0,0 +1,19 @@
+module ietf-network {
+    yang-version 1;
+    namespace "urn:ietf:params:xml:ns:yang:ietf-network";
+    prefix nd;
+    container networks {
+        description
+        "Serves as top-level container for a list of networks.";
+        leaf network-id {
+            type uint8;
+            description
+            "Identifies a network.";
+        }
+    }
+    leaf network-ref {
+        type leafref {
+            path "../networks/network-id";
+        }
+    }
+}
\ No newline at end of file
diff --git a/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/simpleleafref/SelfResolutionWhenLeafrefReferToContainerLeaf.yang b/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/simpleleafref/SelfResolutionWhenLeafrefReferToContainerLeaf.yang
new file mode 100644
index 0000000..375cace
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/leafreflinker/intrafile/simpleleafref/SelfResolutionWhenLeafrefReferToContainerLeaf.yang
@@ -0,0 +1,19 @@
+module SelfResolutionWhenLeafrefReferToContainerLeaf {
+    yang-version 1;
+    namespace "urn:ietf:params:xml:ns:yang:ietf-network";
+    prefix nd;
+    container networks {
+        description
+        "Serves as top-level container for a list of networks.";
+        leaf network-id {
+            type uint8;
+            description
+            "Identifies a network.";
+        }
+    }
+    leaf network-ref {
+        type leafref {
+        path "/networks/network-id";
+        }
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/manager/MultiChild/module.yang b/compiler/plugin/maven/src/test/resources/manager/MultiChild/module.yang
new file mode 100644
index 0000000..845380b
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/manager/MultiChild/module.yang
@@ -0,0 +1,18 @@
+module test5 {
+    namespace "multi:test5:test";
+    prefix test ;
+
+    revision "2016-07-04" {
+             description "Initial revision.";
+    }
+    typedef typedef1 {
+       type int32;
+    }
+    typedef typedef2 {
+       type int32;
+    }
+    typedef typedef3 {
+       type int32;
+    }
+
+}
diff --git a/compiler/plugin/maven/src/test/resources/manager/MultiChild/submodule.yang b/compiler/plugin/maven/src/test/resources/manager/MultiChild/submodule.yang
new file mode 100644
index 0000000..92d7c21
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/manager/MultiChild/submodule.yang
@@ -0,0 +1,26 @@
+submodule test6 {
+      
+     belongs-to "test5" {
+         prefix "test";
+    }    
+
+    revision "2016-07-04" {
+             description "Initial revision.";
+    }
+    grouping grouping1 {
+        leaf leaf1 {
+           type int32;
+        }
+    }
+    grouping grouping2 {
+        leaf leaf1 {
+           type int32;
+        }
+    }
+
+   grouping grouping3 {
+        leaf leaf1 {
+           type int32;
+        }
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/manager/MultiChild/test.yang b/compiler/plugin/maven/src/test/resources/manager/MultiChild/test.yang
new file mode 100644
index 0000000..2665267
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/manager/MultiChild/test.yang
@@ -0,0 +1,19 @@
+module test7 {
+    namespace "multi:test5:test";
+    prefix test ;  
+
+    revision "2016-07-04" {
+             description "Initial revision.";
+    }
+
+    grouping grouping1 {
+        leaf leaf1 {
+           type int32;
+        }
+    }
+
+    typedef typedef3 {
+       type int32;
+    }
+
+}
diff --git a/compiler/plugin/maven/src/test/resources/manager/MultiChild/test2.yang b/compiler/plugin/maven/src/test/resources/manager/MultiChild/test2.yang
new file mode 100644
index 0000000..c87022d
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/manager/MultiChild/test2.yang
@@ -0,0 +1,22 @@
+module test8 {
+    namespace "multi:test8:test";
+    prefix test ;  
+
+    revision "2016-07-04" {
+             description "Initial revision.";
+    }
+
+    grouping grouping1 {
+        leaf leaf1 {
+           type int32;
+        }
+    }
+
+    typedef typedef3 {
+       type int32;
+    }
+
+    container container2 {
+    }
+
+}
diff --git a/compiler/plugin/maven/src/test/resources/manager/genwithoutrev/module.yang b/compiler/plugin/maven/src/test/resources/manager/genwithoutrev/module.yang
new file mode 100644
index 0000000..bcc1cc7
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/manager/genwithoutrev/module.yang
@@ -0,0 +1,9 @@
+module test5 {
+    namespace "test5:test";
+    prefix test ;
+
+    leaf a-leaf {
+       type int32;
+    }
+    
+}
diff --git a/compiler/plugin/maven/src/test/resources/manager/nogen/module.yang b/compiler/plugin/maven/src/test/resources/manager/nogen/module.yang
new file mode 100644
index 0000000..97d79b6
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/manager/nogen/module.yang
@@ -0,0 +1,9 @@
+module test5 {
+    namespace "test5:test";
+    prefix test ;
+
+    revision "2016-07-04" {
+             description "Initial revision.";
+    }
+    
+}
diff --git a/compiler/plugin/maven/src/test/resources/manager/singleChild/module.yang b/compiler/plugin/maven/src/test/resources/manager/singleChild/module.yang
new file mode 100644
index 0000000..67f4bc9
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/manager/singleChild/module.yang
@@ -0,0 +1,12 @@
+module test5 {
+    namespace "single:test5:test";
+    prefix test ;
+
+    revision "2016-07-04" {
+             description "Initial revision.";
+    }
+    typedef typedef1 {
+       type int32;
+    }
+
+}
diff --git a/compiler/plugin/maven/src/test/resources/manager/singleChild/submodule.yang b/compiler/plugin/maven/src/test/resources/manager/singleChild/submodule.yang
new file mode 100644
index 0000000..541b7dd
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/manager/singleChild/submodule.yang
@@ -0,0 +1,15 @@
+submodule test6 {
+      
+     belongs-to "test5" {
+         prefix "test";
+    }    
+
+    revision "2016-07-04" {
+             description "Initial revision.";
+    }
+    grouping grouping1 {
+        leaf leaf1 {
+           type int32;
+        }
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/manager/singleChild/test.yang b/compiler/plugin/maven/src/test/resources/manager/singleChild/test.yang
new file mode 100644
index 0000000..2d13b4c
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/manager/singleChild/test.yang
@@ -0,0 +1,12 @@
+module test7 {
+    namespace "single:test5:test";
+    prefix test ;  
+
+    revision "2016-07-04" {
+             description "Initial revision.";
+    }
+
+    container cont1 {
+    }
+
+}
diff --git a/compiler/plugin/maven/src/test/resources/org/onosproject/yang/compiler/parser/impl/decimal64/Decimal64MultiTypedefMultiInvalidRangeStatement.yang b/compiler/plugin/maven/src/test/resources/org/onosproject/yang/compiler/parser/impl/decimal64/Decimal64MultiTypedefMultiInvalidRangeStatement.yang
new file mode 100644
index 0000000..966b387
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/org/onosproject/yang/compiler/parser/impl/decimal64/Decimal64MultiTypedefMultiInvalidRangeStatement.yang
@@ -0,0 +1,22 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+
+    typedef topDecimal {
+         type decimal64 {
+            fraction-digits 4;
+            range 4..11;
+         }
+    }
+
+    typedef midDecimal {
+         type topDecimal;
+    }
+
+    leaf lowerDecimal {
+         type midDecimal {
+            range 1..12;
+         }
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/org/onosproject/yang/compiler/parser/impl/decimal64/Decimal64MultiTypedefMultiRangeStatement.yang b/compiler/plugin/maven/src/test/resources/org/onosproject/yang/compiler/parser/impl/decimal64/Decimal64MultiTypedefMultiRangeStatement.yang
new file mode 100644
index 0000000..76f215a
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/org/onosproject/yang/compiler/parser/impl/decimal64/Decimal64MultiTypedefMultiRangeStatement.yang
@@ -0,0 +1,22 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+
+    typedef topDecimal {
+         type decimal64 {
+            fraction-digits 4;
+            range 1..12;
+         }
+    }
+
+    typedef midDecimal {
+         type topDecimal;
+    }
+
+    leaf lowerDecimal {
+         type midDecimal {
+            range 4..11;
+         }
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/org/onosproject/yang/compiler/parser/impl/decimal64/Decimal64MultiTypedefRangeInLeafStatement.yang b/compiler/plugin/maven/src/test/resources/org/onosproject/yang/compiler/parser/impl/decimal64/Decimal64MultiTypedefRangeInLeafStatement.yang
new file mode 100644
index 0000000..eea48f4
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/org/onosproject/yang/compiler/parser/impl/decimal64/Decimal64MultiTypedefRangeInLeafStatement.yang
@@ -0,0 +1,21 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+
+    typedef topDecimal {
+         type decimal64 {
+            fraction-digits 4;
+         }
+    }
+
+    typedef midDecimal {
+         type topDecimal;
+    }
+
+    leaf lowerDecimal {
+         type midDecimal {
+            range 1..12;
+         }
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/org/onosproject/yang/compiler/parser/impl/decimal64/Decimal64MultiTypedefRangeStatement.yang b/compiler/plugin/maven/src/test/resources/org/onosproject/yang/compiler/parser/impl/decimal64/Decimal64MultiTypedefRangeStatement.yang
new file mode 100644
index 0000000..b4c0a36
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/org/onosproject/yang/compiler/parser/impl/decimal64/Decimal64MultiTypedefRangeStatement.yang
@@ -0,0 +1,20 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+
+    typedef topDecimal {
+         type decimal64 {
+            fraction-digits 4; 
+            range 1..12;
+         }
+    }
+
+    typedef midDecimal {
+         type topDecimal;
+    }
+
+    leaf lowerDecimal {
+         type midDecimal;
+    } 
+}
diff --git a/compiler/plugin/maven/src/test/resources/org/onosproject/yang/compiler/parser/impl/decimal64/Decimal64MultiTypedefStatement.yang b/compiler/plugin/maven/src/test/resources/org/onosproject/yang/compiler/parser/impl/decimal64/Decimal64MultiTypedefStatement.yang
new file mode 100644
index 0000000..8682aac
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/org/onosproject/yang/compiler/parser/impl/decimal64/Decimal64MultiTypedefStatement.yang
@@ -0,0 +1,19 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+
+    typedef topDecimal {
+         type decimal64 {
+            fraction-digits 4; 
+         }
+    }
+
+    typedef midDecimal {
+         type topDecimal;
+    }
+
+    leaf lowerDecimal {
+         type midDecimal;
+    } 
+}
diff --git a/compiler/plugin/maven/src/test/resources/org/onosproject/yang/compiler/parser/impl/decimal64/Decimal64MultiTypedefWithMaxRange.yang b/compiler/plugin/maven/src/test/resources/org/onosproject/yang/compiler/parser/impl/decimal64/Decimal64MultiTypedefWithMaxRange.yang
new file mode 100644
index 0000000..405d08c
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/org/onosproject/yang/compiler/parser/impl/decimal64/Decimal64MultiTypedefWithMaxRange.yang
@@ -0,0 +1,22 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+
+    typedef topDecimal {
+         type decimal64 {
+            fraction-digits 4;
+            range 1..12;
+         }
+    }
+
+    typedef midDecimal {
+         type topDecimal;
+    }
+
+    leaf lowerDecimal {
+         type midDecimal {
+            range 4..max;
+         }
+    } 
+}
diff --git a/compiler/plugin/maven/src/test/resources/org/onosproject/yang/compiler/parser/impl/decimal64/Decimal64TypeInvalidMaxValueFraction.yang b/compiler/plugin/maven/src/test/resources/org/onosproject/yang/compiler/parser/impl/decimal64/Decimal64TypeInvalidMaxValueFraction.yang
new file mode 100644
index 0000000..68bd8df
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/org/onosproject/yang/compiler/parser/impl/decimal64/Decimal64TypeInvalidMaxValueFraction.yang
@@ -0,0 +1,11 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+
+    leaf invalidDecimal1 {
+         type decimal64 {
+            fraction-digits 19; 
+         }
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/org/onosproject/yang/compiler/parser/impl/decimal64/Decimal64TypeInvalidMinValueFraction1.yang b/compiler/plugin/maven/src/test/resources/org/onosproject/yang/compiler/parser/impl/decimal64/Decimal64TypeInvalidMinValueFraction1.yang
new file mode 100644
index 0000000..3d7445a
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/org/onosproject/yang/compiler/parser/impl/decimal64/Decimal64TypeInvalidMinValueFraction1.yang
@@ -0,0 +1,11 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+
+    leaf invalidDecimal2 {
+         type decimal64 {
+            fraction-digits 0; 
+         }
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/org/onosproject/yang/compiler/parser/impl/decimal64/Decimal64TypeInvalidMinValueFraction2.yang b/compiler/plugin/maven/src/test/resources/org/onosproject/yang/compiler/parser/impl/decimal64/Decimal64TypeInvalidMinValueFraction2.yang
new file mode 100644
index 0000000..4e17bbe
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/org/onosproject/yang/compiler/parser/impl/decimal64/Decimal64TypeInvalidMinValueFraction2.yang
@@ -0,0 +1,11 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+
+    leaf invalidDecimal3 {
+         type decimal64 {
+            fraction-digits -1; 
+         }
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/org/onosproject/yang/compiler/parser/impl/decimal64/Decimal64TypeInvalidRangeStmnt.yang b/compiler/plugin/maven/src/test/resources/org/onosproject/yang/compiler/parser/impl/decimal64/Decimal64TypeInvalidRangeStmnt.yang
new file mode 100644
index 0000000..2ac3d94
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/org/onosproject/yang/compiler/parser/impl/decimal64/Decimal64TypeInvalidRangeStmnt.yang
@@ -0,0 +1,11 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf validDecimal {
+         type decimal64 {
+            fraction-digits 18; 
+            range "1 .. 20.14";
+         }
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/org/onosproject/yang/compiler/parser/impl/decimal64/Decimal64TypeStatement.yang b/compiler/plugin/maven/src/test/resources/org/onosproject/yang/compiler/parser/impl/decimal64/Decimal64TypeStatement.yang
new file mode 100644
index 0000000..9824c12
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/org/onosproject/yang/compiler/parser/impl/decimal64/Decimal64TypeStatement.yang
@@ -0,0 +1,10 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf validDecimal {
+         type decimal64 {
+            fraction-digits 2; 
+         }
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/org/onosproject/yang/compiler/parser/impl/decimal64/Decimal64TypeValidation.yang b/compiler/plugin/maven/src/test/resources/org/onosproject/yang/compiler/parser/impl/decimal64/Decimal64TypeValidation.yang
new file mode 100644
index 0000000..06bf5b7
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/org/onosproject/yang/compiler/parser/impl/decimal64/Decimal64TypeValidation.yang
@@ -0,0 +1,10 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf validDecimal {
+         type decimal64 {
+            fraction-digits 18; 
+         }
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/org/onosproject/yang/compiler/parser/impl/decimal64/Decimal64TypeWithMultiValueRangeStmnt.yang b/compiler/plugin/maven/src/test/resources/org/onosproject/yang/compiler/parser/impl/decimal64/Decimal64TypeWithMultiValueRangeStmnt.yang
new file mode 100644
index 0000000..f657134
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/org/onosproject/yang/compiler/parser/impl/decimal64/Decimal64TypeWithMultiValueRangeStmnt.yang
@@ -0,0 +1,11 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf validDecimal {
+         type decimal64 {
+            fraction-digits 18; 
+            range "-9.22..7.22 | 8 | 9..max";
+         }
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/org/onosproject/yang/compiler/parser/impl/decimal64/Decimal64TypeWithRangeStatement.yang b/compiler/plugin/maven/src/test/resources/org/onosproject/yang/compiler/parser/impl/decimal64/Decimal64TypeWithRangeStatement.yang
new file mode 100644
index 0000000..f184927
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/org/onosproject/yang/compiler/parser/impl/decimal64/Decimal64TypeWithRangeStatement.yang
@@ -0,0 +1,11 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf validDecimal {
+         type decimal64 {
+            fraction-digits 8; 
+            range "-92233720368.54775808 .. 92233720368.54775807";
+         }
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/org/onosproject/yang/compiler/parser/impl/decimal64/Decimal64TypeWithoutFraction.yang b/compiler/plugin/maven/src/test/resources/org/onosproject/yang/compiler/parser/impl/decimal64/Decimal64TypeWithoutFraction.yang
new file mode 100644
index 0000000..e7b8beb
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/org/onosproject/yang/compiler/parser/impl/decimal64/Decimal64TypeWithoutFraction.yang
@@ -0,0 +1,8 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    leaf validDecimal {
+         type decimal64;
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/org/onosproject/yang/compiler/parser/impl/decimal64/Decimal64TypedefStatement.yang b/compiler/plugin/maven/src/test/resources/org/onosproject/yang/compiler/parser/impl/decimal64/Decimal64TypedefStatement.yang
new file mode 100644
index 0000000..66addd2
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/org/onosproject/yang/compiler/parser/impl/decimal64/Decimal64TypedefStatement.yang
@@ -0,0 +1,15 @@
+module Test {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+
+    typedef validDecimal {
+         type decimal64 {
+            fraction-digits 4; 
+         }
+    }
+
+    leaf setFourDecimal {
+         type validDecimal;
+    } 
+}
diff --git a/compiler/plugin/maven/src/test/resources/pathpredicate/interfileaugment/ietf-network.yang b/compiler/plugin/maven/src/test/resources/pathpredicate/interfileaugment/ietf-network.yang
new file mode 100644
index 0000000..8e650da
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/pathpredicate/interfileaugment/ietf-network.yang
@@ -0,0 +1,21 @@
+module ietf-network {
+    yang-version 1;
+    namespace "urn:ietf:params:xml:ns:yang:ietf-network";
+    prefix nd;
+    container networks {
+        list network {
+            key "network-id";
+            leaf network-id {
+                type uint8;
+            }
+            container reference {
+                leaf network-ref {
+                    type string;
+                }
+            }
+            leaf node-id {
+                type int8;
+            }
+        }
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/pathpredicate/interfileaugment/ietf-topology.yang b/compiler/plugin/maven/src/test/resources/pathpredicate/interfileaugment/ietf-topology.yang
new file mode 100644
index 0000000..93bfa80
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/pathpredicate/interfileaugment/ietf-topology.yang
@@ -0,0 +1,18 @@
+module ietf-topology {
+    yang-version 1;
+    namespace "urn:ietf:params:xml:ns:yang:ietf-te-topology";
+    // replace with IANA namespace when assigned
+    prefix "tet";
+
+    import ietf-network {
+        prefix "nw";
+    }
+    augment "/nw:networks/nw:network" {
+        leaf test {
+            type leafref {
+                path "../../nw:network[nw:network-id = current()/../" +
+                "nw:reference/nw:network-ref]/nw:node-id";
+            }
+        }
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/pathpredicate/invalidlinking/ietf-network.yang b/compiler/plugin/maven/src/test/resources/pathpredicate/invalidlinking/ietf-network.yang
new file mode 100644
index 0000000..13bcb3e
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/pathpredicate/invalidlinking/ietf-network.yang
@@ -0,0 +1,33 @@
+module ietf-network {
+    yang-version 1;
+    namespace "urn:ietf:params:xml:ns:yang:ietf-network";
+    prefix nd;
+    list interface {
+        key "name";
+        leaf name {
+            type string;
+        }
+        leaf admin-status {
+            type uint8;
+        }
+        list address {
+            key "ip";
+            leaf ip {
+                type int8;
+            }
+        }
+    }
+    container default-address {
+        leaf ifname {
+            type leafref {
+                path "../../interface/name";
+            }
+        }
+        leaf address {
+            type leafref {
+                path "../../interface[ifname = current()/../../ifname]"
+                    + "/address/ip";
+            }
+        }
+    }
+}
\ No newline at end of file
diff --git a/compiler/plugin/maven/src/test/resources/pathpredicate/invalidlinking2/ietf-network.yang b/compiler/plugin/maven/src/test/resources/pathpredicate/invalidlinking2/ietf-network.yang
new file mode 100644
index 0000000..7c1881b
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/pathpredicate/invalidlinking2/ietf-network.yang
@@ -0,0 +1,33 @@
+module ietf-network {
+    yang-version 1;
+    namespace "urn:ietf:params:xml:ns:yang:ietf-network";
+    prefix nd;
+    list interface {
+        key "name";
+        leaf name {
+            type string;
+        }
+        leaf admin-status {
+            type uint8;
+        }
+        list address {
+            key "ip";
+            leaf ip {
+                type int8;
+            }
+        }
+    }
+    container default-address {
+        leaf ifname {
+            type leafref {
+                path "../../interface/name";
+            }
+        }
+        leaf address {
+            type leafref {
+                path "../../default-address[ifname = current()/../ifname]/" +
+                "ifname";
+            }
+        }
+    }
+}
\ No newline at end of file
diff --git a/compiler/plugin/maven/src/test/resources/pathpredicate/invalidlinking3/ietf-network.yang b/compiler/plugin/maven/src/test/resources/pathpredicate/invalidlinking3/ietf-network.yang
new file mode 100644
index 0000000..9ebb2ce
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/pathpredicate/invalidlinking3/ietf-network.yang
@@ -0,0 +1,33 @@
+module ietf-network {
+    yang-version 1;
+    namespace "urn:ietf:params:xml:ns:yang:ietf-network";
+    prefix nd;
+    list interface {
+        key "name";
+        leaf name {
+            type string;
+        }
+        leaf admin-status {
+            type uint8;
+        }
+        list address {
+            key "ip";
+            leaf ip {
+                type int8;
+            }
+        }
+    }
+    container default-address {
+        leaf ifname {
+            type leafref {
+                path "../../interface/name";
+            }
+        }
+        leaf address {
+            type leafref {
+                path "../../interface[name = current()/../../address/ifname]"
+                    + "/address/ip";
+            }
+        }
+    }
+}
\ No newline at end of file
diff --git a/compiler/plugin/maven/src/test/resources/pathpredicate/simple/ietf-network.yang b/compiler/plugin/maven/src/test/resources/pathpredicate/simple/ietf-network.yang
new file mode 100644
index 0000000..5c1ecdd
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/pathpredicate/simple/ietf-network.yang
@@ -0,0 +1,33 @@
+module ietf-network {
+    yang-version 1;
+    namespace "urn:ietf:params:xml:ns:yang:ietf-network";
+    prefix nd;
+    list interface {
+        key "name";
+        leaf name {
+            type string;
+        }
+        leaf admin-status {
+            type uint8;
+        }
+        list address {
+            key "ip";
+            leaf ip {
+                type int8;
+            }
+        }
+    }
+    container default-address {
+        leaf ifname {
+            type leafref {
+                path "../../interface/name";
+            }
+        }
+        leaf address {
+            type leafref {
+                path "../../interface[name = current()/../ifname]"
+                    + "/address/ip";
+            }
+        }
+    }
+}
\ No newline at end of file
diff --git a/compiler/plugin/maven/src/test/resources/pathpredicate/simpleinterfile/ietf-network.yang b/compiler/plugin/maven/src/test/resources/pathpredicate/simpleinterfile/ietf-network.yang
new file mode 100644
index 0000000..33d77dd
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/pathpredicate/simpleinterfile/ietf-network.yang
@@ -0,0 +1,22 @@
+module ietf-network {
+    yang-version 1;
+    namespace "urn:ietf:params:xml:ns:yang:ietf-network";
+    prefix nd;
+    import ietf-topology {
+        prefix tp;
+    }
+    container default-address {
+        leaf ifname {
+            type leafref {
+                path "/tp:interface/tp:name";
+            }
+        }
+        leaf address {
+            type leafref {
+                path "/tp:interface[tp:name = current()/../nd:ifname]"
+                + "/tp:address/ip";
+            }
+        }
+    }
+}
+
diff --git a/compiler/plugin/maven/src/test/resources/pathpredicate/simpleinterfile/ietf-topology.yang b/compiler/plugin/maven/src/test/resources/pathpredicate/simpleinterfile/ietf-topology.yang
new file mode 100644
index 0000000..63db761
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/pathpredicate/simpleinterfile/ietf-topology.yang
@@ -0,0 +1,21 @@
+   module ietf-topology {
+     yang-version 1;
+     namespace "urn:ietf:params:xml:ns:yang:ietf-topology";
+     prefix tp;
+     list interface {
+         key "name";
+         leaf name {
+             type string;
+         }
+         leaf admin-status {
+             type uint8;
+         }
+         list address {
+             key "ip";
+             leaf ip {
+                 type int8;
+             }
+         }
+     }
+   }
+
diff --git a/compiler/plugin/maven/src/test/resources/pstcodegen/test.yang b/compiler/plugin/maven/src/test/resources/pstcodegen/test.yang
new file mode 100644
index 0000000..93e1476
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/pstcodegen/test.yang
@@ -0,0 +1,83 @@
+module test {
+    namespace "test:test";
+    prefix test;
+
+    container cont1 {
+        leaf leaf1 {
+            type int32;
+        }
+        leaf-list leaf-list1 {
+            type int32;
+        }
+        list list1 {
+            key "name";
+            leaf name {
+                type string;
+            }
+        }
+        container cont2 {
+            leaf leaf2 {
+                type int32;
+            }
+        }
+    }
+    leaf leaf2 {
+        type int32;
+    }
+    leaf-list leaf-list2 {
+        type int32;
+    }
+    list list2 {
+        key "name";
+        leaf name {
+            type string;
+        }
+    }
+    choice choice1 {
+         case case1 {
+             leaf leaf3 {
+                 type int32;
+             }
+             leaf-list leaf-list3 {
+                 type int32;
+             }
+             list list3 {
+                 key "name";
+                 leaf name {
+                     type string;
+                 }
+             }
+         }
+    }
+    grouping group1 {
+        container cont1 {
+            leaf leaf1 {
+                type int32;
+            }
+            leaf-list leaf-list1 {
+                type int32;
+            }
+            list list1 {
+                key "name";
+                leaf name {
+                    type string;
+                }
+            }
+            container cont2 {
+                leaf leaf2 {
+                    type int32;
+                }
+            }
+        }
+    }
+    rpc rpc1 {
+        input {
+            uses group1;
+        }
+    }
+    augment /cont1/list1 {
+        leaf leaf2 {
+            type int64;
+        }
+    }
+}
\ No newline at end of file
diff --git a/compiler/plugin/maven/src/test/resources/refincludecontentwithprefix/ietf-snmp-common.yang b/compiler/plugin/maven/src/test/resources/refincludecontentwithprefix/ietf-snmp-common.yang
new file mode 100644
index 0000000..ed382c8
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/refincludecontentwithprefix/ietf-snmp-common.yang
@@ -0,0 +1,60 @@
+submodule ietf-snmp-common {
+  belongs-to ietf-snmp {
+    prefix snmp;
+  }
+  organization
+    "IETF NETMOD (NETCONF Data Modeling Language) Working Group";
+  contact
+    "WG Web:   <http://tools.ietf.org/wg/netmod/>
+     WG List:  <mailto:netmod@ietf.org>
+     WG Chair: Thomas Nadeau
+               <mailto:tnadeau@lucidvision.com>
+     WG Chair: Juergen Schoenwaelder
+               <mailto:j.schoenwaelder@jacobs-university.de>
+     Editor:   Martin Bjorklund
+               <mailto:mbj@tail-f.com>
+     Editor:   Juergen Schoenwaelder
+               <mailto:j.schoenwaelder@jacobs-university.de>";
+  description
+    "This submodule contains a collection of common YANG definitions
+     for configuring SNMP engines.
+     Copyright (c) 2014 IETF Trust and the persons identified as
+     authors of the code.  All rights reserved.
+     Redistribution and use in source and binary forms, with or
+     without modification, is permitted pursuant to, and subject
+     to the license terms contained in, the Simplified BSD License
+     set forth in Section 4.c of the IETF Trust's Legal Provisions
+     Relating to IETF Documents
+     (http://trustee.ietf.org/license-info).
+     This version of this YANG module is part of RFC 7407; see
+     the RFC itself for full legal notices.";
+  revision 2014-12-10 {
+    description
+      "Initial revision.";
+    reference
+      "RFC 7407: A YANG Data Model for SNMP Configuration";
+  }
+  /* Collection of SNMP-specific data types */
+  typedef admin-string {
+    type string {
+      length "0..255";
+    }
+    description
+      "Represents SnmpAdminString as defined in RFC 3411.
+      Note that the size of an SnmpAdminString is measured in
+      octets, not characters.";
+    reference
+      "RFC 3411: An Architecture for Describing Simple Network
+         Management Protocol (SNMP) Management Frameworks.
+         SNMP-FRAMEWORK-MIB.SnmpAdminString";
+  }
+  typedef identifier {
+    type admin-string {
+      length "1..32";
+    }
+    description
+      "Identifiers are used to name items in the SNMP configuration
+      datastore.";
+  }
+  feature testfeature;
+}
diff --git a/compiler/plugin/maven/src/test/resources/refincludecontentwithprefix/ietf-snmp-vacm.yang b/compiler/plugin/maven/src/test/resources/refincludecontentwithprefix/ietf-snmp-vacm.yang
new file mode 100644
index 0000000..5b6595d
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/refincludecontentwithprefix/ietf-snmp-vacm.yang
@@ -0,0 +1,51 @@
+submodule ietf-snmp-vacm {
+  belongs-to ietf-snmp {
+    prefix snmp;
+  }
+  include ietf-snmp-common;
+  organization
+    "IETF NETMOD (NETCONF Data Modeling Language) Working Group";
+  contact
+    "WG Web:   <http://tools.ietf.org/wg/netmod/>
+     WG List:  <mailto:netmod@ietf.org>
+     WG Chair: Thomas Nadeau
+               <mailto:tnadeau@lucidvision.com>
+     WG Chair: Juergen Schoenwaelder
+               <mailto:j.schoenwaelder@jacobs-university.de>
+     Editor:   Martin Bjorklund
+               <mailto:mbj@tail-f.com>
+     Editor:   Juergen Schoenwaelder
+               <mailto:j.schoenwaelder@jacobs-university.de>";
+  description
+    "This submodule contains a collection of YANG definitions
+     for configuring the View-based Access Control Model (VACM)
+     of SNMP.
+     Copyright (c) 2014 IETF Trust and the persons identified as
+     authors of the code.  All rights reserved.
+     Redistribution and use in source and binary forms, with or
+     without modification, is permitted pursuant to, and subject
+     to the license terms contained in, the Simplified BSD License
+     set forth in Section 4.c of the IETF Trust's Legal Provisions
+     Relating to IETF Documents
+     (http://trustee.ietf.org/license-info).
+     This version of this YANG module is part of RFC 7407; see
+     the RFC itself for full legal notices.";
+  reference
+    "RFC 3415: View-based Access Control Model (VACM) for the
+       Simple Network Management Protocol (SNMP)";
+  revision 2014-12-10 {
+    description
+      "Initial revision.";
+    reference
+      "RFC 7407: A YANG Data Model for SNMP Configuration";
+  }
+  typedef view-name {
+    type snmp:identifier;
+    description
+      "The view-name type represents an SNMP VACM view name.";
+  }
+  leaf testleaf {
+      if-feature snmp:testfeature;
+      type string;
+  }
+}
diff --git a/compiler/plugin/maven/src/test/resources/refincludecontentwithprefix/ietf-snmp.yang b/compiler/plugin/maven/src/test/resources/refincludecontentwithprefix/ietf-snmp.yang
new file mode 100644
index 0000000..224849c
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/refincludecontentwithprefix/ietf-snmp.yang
@@ -0,0 +1,42 @@
+module ietf-snmp {
+  namespace "urn:ietf:params:xml:ns:yang:ietf-snmp";
+  prefix snmp;
+  include ietf-snmp-common {
+    revision-date 2014-12-10;
+  }
+  include ietf-snmp-vacm {
+    revision-date 2014-12-10;
+  }
+  organization
+    "IETF NETMOD (NETCONF Data Modeling Language) Working Group";
+  contact
+    "WG Web:   <http://tools.ietf.org/wg/netmod/>
+     WG List:  <mailto:netmod@ietf.org>
+     WG Chair: Thomas Nadeau
+               <mailto:tnadeau@lucidvision.com>
+     WG Chair: Juergen Schoenwaelder
+               <mailto:j.schoenwaelder@jacobs-university.de>
+     Editor:   Martin Bjorklund
+               <mailto:mbj@tail-f.com>
+     Editor:   Juergen Schoenwaelder
+               <mailto:j.schoenwaelder@jacobs-university.de>";
+  description
+    "This module contains a collection of YANG definitions for
+     configuring SNMP engines.
+     Copyright (c) 2014 IETF Trust and the persons identified as
+     authors of the code.  All rights reserved.
+     Redistribution and use in source and binary forms, with or
+     without modification, is permitted pursuant to, and subject
+     to the license terms contained in, the Simplified BSD License
+     set forth in Section 4.c of the IETF Trust's Legal Provisions
+     Relating to IETF Documents
+     (http://trustee.ietf.org/license-info).
+     This version of this YANG module is part of RFC 7407; see
+     the RFC itself for full legal notices.";
+  revision 2014-12-10 {
+    description
+      "Initial revision.";
+    reference
+      "RFC 7407: A YANG Data Model for SNMP Configuration";
+  }
+}
diff --git a/compiler/plugin/maven/src/test/resources/rootNode/mixed/module.yang b/compiler/plugin/maven/src/test/resources/rootNode/mixed/module.yang
new file mode 100644
index 0000000..e3e5571
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/rootNode/mixed/module.yang
@@ -0,0 +1,21 @@
+module test5 {
+    namespace "test5:test";
+    prefix test ;
+
+    include test6;
+    revision "2016-07-04" {
+             description "Initial revision.";
+    }
+    
+    augment /cont1 {
+       leaf cont1 {
+          type string;
+        }
+    }
+    augment /cont2 {
+       leaf cont2 {
+          type string;
+        }
+    }	
+
+}
diff --git a/compiler/plugin/maven/src/test/resources/rootNode/mixed/submodule.yang b/compiler/plugin/maven/src/test/resources/rootNode/mixed/submodule.yang
new file mode 100644
index 0000000..e7c497e
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/rootNode/mixed/submodule.yang
@@ -0,0 +1,25 @@
+submodule test6 {
+      
+     belongs-to "test5" {
+         prefix "test";
+    }    
+
+    revision "2016-07-04" {
+             description "Initial revision.";
+    }
+
+    typedef typedef {
+        type int32;
+    }
+    container cont1 {
+        leaf leaf1 {
+           type int32;
+        }
+    }
+    container cont2 {
+        leaf leaf1 {
+           type int32;
+        }
+    }
+
+}
diff --git a/compiler/plugin/maven/src/test/resources/rootNode/nogen/module.yang b/compiler/plugin/maven/src/test/resources/rootNode/nogen/module.yang
new file mode 100644
index 0000000..97d79b6
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/rootNode/nogen/module.yang
@@ -0,0 +1,9 @@
+module test5 {
+    namespace "test5:test";
+    prefix test ;
+
+    revision "2016-07-04" {
+             description "Initial revision.";
+    }
+    
+}
diff --git a/compiler/plugin/maven/src/test/resources/rootNode/onlyaugment/module.yang b/compiler/plugin/maven/src/test/resources/rootNode/onlyaugment/module.yang
new file mode 100644
index 0000000..e3e5571
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/rootNode/onlyaugment/module.yang
@@ -0,0 +1,21 @@
+module test5 {
+    namespace "test5:test";
+    prefix test ;
+
+    include test6;
+    revision "2016-07-04" {
+             description "Initial revision.";
+    }
+    
+    augment /cont1 {
+       leaf cont1 {
+          type string;
+        }
+    }
+    augment /cont2 {
+       leaf cont2 {
+          type string;
+        }
+    }	
+
+}
diff --git a/compiler/plugin/maven/src/test/resources/rootNode/onlyaugment/submodule.yang b/compiler/plugin/maven/src/test/resources/rootNode/onlyaugment/submodule.yang
new file mode 100644
index 0000000..9acc939
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/rootNode/onlyaugment/submodule.yang
@@ -0,0 +1,21 @@
+submodule test6 {
+      
+     belongs-to "test5" {
+         prefix "test";
+    }    
+
+    revision "2016-07-04" {
+             description "Initial revision.";
+    }
+    container cont1 {
+        leaf leaf1 {
+           type int32;
+        }
+    }
+    container cont2 {
+        leaf leaf1 {
+           type int32;
+        }
+    }
+
+}
diff --git a/compiler/plugin/maven/src/test/resources/rootNode/onlygrouping/module.yang b/compiler/plugin/maven/src/test/resources/rootNode/onlygrouping/module.yang
new file mode 100644
index 0000000..1c4637c
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/rootNode/onlygrouping/module.yang
@@ -0,0 +1,18 @@
+module test5 {
+    namespace "test5:test";
+    prefix test ;
+
+    revision "2016-07-04" {
+             description "Initial revision.";
+    }
+    typedef typedef1 {
+       type int32;
+    }
+    typedef typedef2 {
+       type int32;
+    }
+    typedef typedef3 {
+       type int32;
+    }
+
+}
diff --git a/compiler/plugin/maven/src/test/resources/rootNode/onlygrouping/submodule.yang b/compiler/plugin/maven/src/test/resources/rootNode/onlygrouping/submodule.yang
new file mode 100644
index 0000000..92d7c21
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/rootNode/onlygrouping/submodule.yang
@@ -0,0 +1,26 @@
+submodule test6 {
+      
+     belongs-to "test5" {
+         prefix "test";
+    }    
+
+    revision "2016-07-04" {
+             description "Initial revision.";
+    }
+    grouping grouping1 {
+        leaf leaf1 {
+           type int32;
+        }
+    }
+    grouping grouping2 {
+        leaf leaf1 {
+           type int32;
+        }
+    }
+
+   grouping grouping3 {
+        leaf leaf1 {
+           type int32;
+        }
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/rootNode/onlyleaf/module.yang b/compiler/plugin/maven/src/test/resources/rootNode/onlyleaf/module.yang
new file mode 100644
index 0000000..61864ad
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/rootNode/onlyleaf/module.yang
@@ -0,0 +1,15 @@
+module test5 {
+    namespace "test5:test";
+    prefix test ;
+
+    revision "2016-07-04" {
+             description "Initial revision.";
+    }
+    leaf a-leaf {
+       type int32;
+     }
+    leaf b-leaf {
+       type int32;
+     }
+    
+}
diff --git a/compiler/plugin/maven/src/test/resources/rootNode/onlyleaflist/module.yang b/compiler/plugin/maven/src/test/resources/rootNode/onlyleaflist/module.yang
new file mode 100644
index 0000000..d8cf6b3
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/rootNode/onlyleaflist/module.yang
@@ -0,0 +1,15 @@
+module test5 {
+    namespace "test5:test";
+    prefix test ;
+
+    revision "2016-07-04" {
+             description "Initial revision.";
+    }
+    leaf-list a-leaf {
+       type int32;
+     }
+    leaf-list b-leaf {
+       type int32;
+     }
+    
+}
diff --git a/compiler/plugin/maven/src/test/resources/rootNode/onlytypedef/module.yang b/compiler/plugin/maven/src/test/resources/rootNode/onlytypedef/module.yang
new file mode 100644
index 0000000..1c4637c
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/rootNode/onlytypedef/module.yang
@@ -0,0 +1,18 @@
+module test5 {
+    namespace "test5:test";
+    prefix test ;
+
+    revision "2016-07-04" {
+             description "Initial revision.";
+    }
+    typedef typedef1 {
+       type int32;
+    }
+    typedef typedef2 {
+       type int32;
+    }
+    typedef typedef3 {
+       type int32;
+    }
+
+}
diff --git a/compiler/plugin/maven/src/test/resources/rootNode/typedefgrouping/module.yang b/compiler/plugin/maven/src/test/resources/rootNode/typedefgrouping/module.yang
new file mode 100644
index 0000000..b54ad47
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/rootNode/typedefgrouping/module.yang
@@ -0,0 +1,17 @@
+module test5 {
+    namespace "test5:test";
+    prefix test ;
+
+    revision "2016-07-04" {
+             description "Initial revision.";
+    }
+    typedef typedef1 {
+       type int32;
+    }
+    grouping group1 {
+      leaf typedef-leaf {
+          type typedef1;
+       }
+    }
+
+}
diff --git a/compiler/plugin/maven/src/test/resources/rpcAugment/inter/1.yang b/compiler/plugin/maven/src/test/resources/rpcAugment/inter/1.yang
new file mode 100644
index 0000000..dcfe919
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/rpcAugment/inter/1.yang
@@ -0,0 +1,17 @@
+module ietf-inet1 {
+
+  namespace "yang:all1";
+  prefix "inet1";
+  yang-version 1;
+
+  import ietf-inet2 {
+    prefix inet2;
+  }
+  
+    augment /inet2:get-port/inet2:input {
+       leaf port {
+           type int32;
+        }
+    }      
+   
+}
diff --git a/compiler/plugin/maven/src/test/resources/rpcAugment/inter/2.yang b/compiler/plugin/maven/src/test/resources/rpcAugment/inter/2.yang
new file mode 100644
index 0000000..7c6ccbf
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/rpcAugment/inter/2.yang
@@ -0,0 +1,33 @@
+module ietf-inet2 {
+
+  namespace "yang:all2";
+  prefix "inet2";
+  yang-version 1;
+
+  
+   rpc get-port {
+       input {
+           leaf port {
+              type int32;
+            }
+  
+           leaf-list port-id {
+              type string;
+           }
+       }
+       output {
+           container port {
+                leaf port-number {
+                   type enumeration {
+                       enum zero-0;
+                   }
+                 }
+                 leaf ip {
+                  type int32;
+                }
+           }
+       }
+    }           
+        
+   
+}
diff --git a/compiler/plugin/maven/src/test/resources/rpcAugment/intra/all.yang b/compiler/plugin/maven/src/test/resources/rpcAugment/intra/all.yang
new file mode 100644
index 0000000..6fc76ea
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/rpcAugment/intra/all.yang
@@ -0,0 +1,103 @@
+module ietf-inet {
+
+  namespace "yang:all";
+  prefix "inet";
+  yang-version 1;
+
+  typedef ip-address {
+     type int32;
+  }
+  
+  leaf-list id {
+    type string;
+  }
+
+  leaf mybits {
+           type bits {
+               bit disable-nagle {
+                   position 0;
+               }
+               bit auto-sense-speed {
+                   position 1;
+               }
+               bit Mb-only {
+                   position 2;
+               }
+           }
+       }
+
+  container network {
+      leaf network-ip {
+          type ip-address;
+      }
+  }
+
+  typedef leaf1 {
+     type leafref {
+         path "/network/network-ip";
+     }
+  }
+
+  grouping link-details {
+      leaf link-id {
+          type int32;
+      }
+      container link {
+          leaf port {
+            type int32;
+          }
+  
+          leaf-list port-id {
+              type string;
+          }
+          list areas {
+             key "name1";
+             leaf name1 {
+              type string;
+             }
+          }
+      }
+   }
+
+   notification link-up {
+        leaf link-id {
+          type int32;
+        }
+  
+        leaf-list link-name {
+           type string;
+        }
+   }
+
+   rpc get-port {
+       input {
+           leaf port {
+              type int32;
+            }
+  
+           leaf-list port-id {
+              type string;
+           }
+           uses link-details;
+       }
+       output {
+           container port {
+                leaf port-number {
+                   type enumeration {
+                       enum zero-0;
+                   }
+                 }
+                 leaf ip {
+                  type ip-address;
+                }
+           }
+       }
+    }           
+  
+    augment /get-port/input {
+       leaf port {
+           type int32;
+        }
+    }      
+   
+}
diff --git a/compiler/plugin/maven/src/test/resources/schemaMap/SchemaMap.yang b/compiler/plugin/maven/src/test/resources/schemaMap/SchemaMap.yang
new file mode 100644
index 0000000..d4c00c7
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/schemaMap/SchemaMap.yang
@@ -0,0 +1,57 @@
+module Testmodule {
+    yang-version 1;
+    namespace http://huawei.com;
+    prefix Ant;
+    container testcontainer {
+        leaf testleaf {
+            type "uint16";
+        }
+        choice snack {
+            case sports-arena {
+                leaf pretzel {
+                    type empty;
+                }
+             }
+        }
+    }
+    notification testnotification1 {
+        leaf type {
+            type string;
+        }
+        leaf severity {
+            type string;
+        }
+    }
+
+    rpc activate-software-image {
+        description "description";
+        input {
+            leaf image-name {
+                type string;
+            }
+            list ospf {
+                key "invalid-interval";
+                config true;
+                max-elements 10;
+                min-elements 3;
+                leaf invalid-interval {
+                    type uint16;
+                }
+            }
+            container isis {
+               config true;
+               leaf invalid-interval {
+                   type uint16;
+               }
+           }
+        }
+        output {
+            leaf image-name {
+                type string;
+            }
+            leaf image-value {
+                type string;
+            }
+        }
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/typedefTranslator/union/typedefs.yang b/compiler/plugin/maven/src/test/resources/typedefTranslator/union/typedefs.yang
new file mode 100644
index 0000000..276efa2
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/typedefTranslator/union/typedefs.yang
@@ -0,0 +1,51 @@
+module types {
+
+  namespace "yang:types";
+  prefix "types";
+  yang-version 1;
+
+  revision 2016-10-08;
+  typedef ip-address {
+     type union {
+         type ipv4-address;
+         type ipv6-address;
+     }
+  }
+
+  typedef ipv4-address {
+      type int32;
+  }
+
+  typedef ipv6-address {
+      type int32;
+  }
+
+  typedef port-number {
+                       type bits {
+                           bit disable-nagle {
+                               position 0;
+                           }
+                           bit auto-sense-speed {
+                               position 1;
+                           }
+                           bit Mb-only {
+                               position 2;
+                           }
+                       }
+
+}
+
+
+ container con1 {
+     leaf abc {
+         type int32;
+     }
+ }
+
+ typedef leaf {
+     type leafref {
+         path "/con1/abc";
+     }
+ }
+
+}
diff --git a/compiler/plugin/maven/src/test/resources/typedefTranslator/with/Onos_Yang_1.yang b/compiler/plugin/maven/src/test/resources/typedefTranslator/with/Onos_Yang_1.yang
new file mode 100644
index 0000000..c09e372
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/typedefTranslator/with/Onos_Yang_1.yang
@@ -0,0 +1,201 @@
+module typedef {
+
+    yang-version "1";
+    namespace "http://rob.sh/yang/test/list";
+    prefix "foo";
+
+    import remote { prefix defn; }
+
+    organization "BugReports Inc";
+    contact "A bug reporter";
+
+    description
+        "A test module";
+    revision 2014-01-01 {
+        description "april-fools";
+        reference "fooled-you";
+    }
+
+    typedef derived-string-type {
+        type string;
+    }
+
+    typedef restricted-integer-type {
+        type uint16 {
+            range 0..64;
+        }
+    }
+
+    typedef bgp-session-direction {
+        type enumeration {
+            enum INBOUND;
+            enum OUTBOUND;
+        }
+    }
+
+    typedef new-string-type {
+        type string;
+        default "defaultValue";
+    }
+
+    typedef restricted-inherit {
+        type string {
+            pattern "^a.*";
+        }
+    }
+
+    typedef restricted-int-inherit {
+        type int8 {
+            range 0..100;
+        }
+    }
+
+    typedef parent-union {
+        type union {
+            type string {
+                pattern "a.*";
+            }
+            type string {
+                pattern "b.*";
+            }
+        }
+    }
+
+    typedef child-union {
+        type union {
+            type parent-union;
+            type string {
+                pattern "z.*";
+            }
+        }
+    }
+
+    typedef union-included {
+        type union {
+            type string {
+                pattern "a.*";
+            }
+            type string {
+                pattern "b.*";
+            }
+        }
+    }
+
+    identity identity_base;
+    identity IDONE {
+        base "identity_base";
+    }
+
+    identity IDTWO {
+        base "identity_base";
+    }
+
+    typedef identity_one {
+        type identityref {
+            base identity_base;
+        }
+    }
+
+    typedef referenced-leaf {
+        type leafref {
+            path "/container/target";
+            require-instance false;
+        }
+    }
+
+    grouping scoped-typedef {
+        typedef scoped-type {
+            type string {
+                pattern "a.*";
+            }
+        }
+
+        leaf scoped-leaf {
+            type scoped-type;
+        }
+    }
+
+    container container {
+        description
+            "A container";
+
+        leaf-list target {
+            type string;
+            description
+                "A target leaf for leafref checks";
+        }
+
+        leaf string {
+            type derived-string-type;
+        }
+
+        leaf integer {
+            type restricted-integer-type;
+        }
+
+        leaf stringdefault {
+            type derived-string-type;
+            default "aDefaultValue";
+        }
+
+        leaf integerdefault {
+            type restricted-integer-type;
+            default 10;
+        }
+
+        leaf new-string {
+            type new-string-type;
+        }
+
+        leaf remote-new-type {
+            type defn:remote-definition;
+        }
+
+        leaf session-dir {
+            type bgp-session-direction;
+        }
+
+        leaf remote-local-type {
+            type defn:remote-local-definition;
+        }
+
+        leaf inheritance {
+            type restricted-inherit {
+                pattern ".*k";
+            }
+        }
+
+        leaf int-inheritance {
+            type restricted-int-inherit {
+                range 2..5;
+            }
+        }
+
+        leaf-list stacked-union {
+            type child-union;
+        }
+
+        leaf include-of-include-definition {
+            type defn:hybrid-definition;
+        }
+
+        leaf identity-one-typedef {
+            type identity_one;
+        }
+
+        leaf union-with-union {
+            type union {
+                type union-included;
+                type string {
+                    pattern "q.*";
+                }
+            }
+        }
+
+        leaf reference {
+            type referenced-leaf;
+        }
+
+        uses scoped-typedef;
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/typedefTranslator/with/remote.yang b/compiler/plugin/maven/src/test/resources/typedefTranslator/with/remote.yang
new file mode 100644
index 0000000..409f04f
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/typedefTranslator/with/remote.yang
@@ -0,0 +1,33 @@
+module remote {
+    yang-version "1";
+    namespace "http://rob.sh/yang/test/typedef/remote";
+    prefix "remote";
+
+    import second-remote { prefix sr; }
+
+    organization "BugReports Inc";
+    contact "A bug reporter";
+
+    description
+        "A test module";
+    revision 2014-01-01 {
+        description "april-fools";
+        reference "fooled-you";
+    }
+
+    typedef remote-definition {
+        type string;
+    }
+
+    typedef remote-local-definition {
+        type local-definition;
+    }
+
+    typedef local-definition {
+        type string;
+    }
+
+    typedef hybrid-definition {
+        type sr:second-remote-definition;
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/typedefTranslator/with/second-remote.yang b/compiler/plugin/maven/src/test/resources/typedefTranslator/with/second-remote.yang
new file mode 100644
index 0000000..c106d89
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/typedefTranslator/with/second-remote.yang
@@ -0,0 +1,21 @@
+module second-remote {
+    yang-version "1";
+    namespace "http://rob.sh/yang/test/typedef/second-remote";
+    prefix "second-remote";
+
+    organization "BugReports Inc";
+    contact "A bug reporter";
+
+    description
+        "A test module";
+    revision 2014-01-01 {
+        description "april-fools";
+        reference "fooled-you";
+    }
+
+    typedef second-remote-definition {
+        type string {
+            pattern "z.*";
+        }
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/typedefTranslator/without/Onos_Yang_1.yang b/compiler/plugin/maven/src/test/resources/typedefTranslator/without/Onos_Yang_1.yang
new file mode 100644
index 0000000..56fbacf
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/typedefTranslator/without/Onos_Yang_1.yang
@@ -0,0 +1,489 @@
+module ietf-yang-types {
+
+    yang-version 1;
+
+    namespace
+      "urn:ietf:params:xml:ns:yang:ietf-yang-types";
+
+    prefix yang;
+
+    organization
+      "IETF NETMOD (NETCONF Data Modeling Language) Working Group";
+
+    contact
+      "WG Web:   <http://tools.ietf.org/wg/netmod/>
+    WG List:  <mailto:netmod@ietf.org>
+
+    WG Chair: David Kessens
+              <mailto:david.kessens@nsn.com>
+
+    WG Chair: Juergen Schoenwaelder
+              <mailto:j.schoenwaelder@jacobs-university.de>
+
+    Editor:   Juergen Schoenwaelder
+              <mailto:j.schoenwaelder@jacobs-university.de>";
+
+    description
+      "This module contains a collection of generally useful derived
+    YANG data types.
+
+    Copyright (c) 2013 IETF Trust and the persons identified as
+    authors of the code.  All rights reserved.
+
+    Redistribution and use in source and binary forms, with or
+    without modification, is permitted pursuant to, and subject
+    to the license terms contained in, the Simplified BSD License
+    set forth in Section 4.c of the IETF Trust's Legal Provisions
+    Relating to IETF Documents
+    (http://trustee.ietf.org/license-info).
+
+    This version of this YANG module is part of RFC 6991; see
+    the RFC itself for full legal notices.";
+
+    revision "2013-07-15" {
+      description
+        "This revision adds the following new data types:
+      - yang-identifier
+      - hex-string
+      - uuid
+      - dotted-quad";
+      reference
+        "RFC 6991: Common YANG Data Types";
+
+    }
+
+    revision "2010-09-24" {
+      description "Initial revision.";
+      reference
+        "RFC 6021: Common YANG Data Types";
+
+    }
+
+
+    typedef counter32 {
+      type uint32;
+      description
+        "The counter32 type represents a non-negative integer
+      that monotonically increases until it reaches a
+      maximum value of 2^32-1 (4294967295 decimal), when it
+      wraps around and starts increasing again from zero.
+
+      Counters have no defined 'initial' value, and thus, a
+      single value of a counter has (in general) no information
+      content.  Discontinuities in the monotonically increasing
+      value normally occur at re-initialization of the
+      management system, and at other times as specified in the
+      description of a schema node using this type.  If such
+      other times can occur, for example, the creation of
+      a schema node of type counter32 at times other than
+      re-initialization, then a corresponding schema node
+      should be defined, with an appropriate type, to indicate
+      the last discontinuity.
+
+      The counter32 type should not be used for configuration
+      schema nodes.  A default statement SHOULD NOT be used in
+      combination with the type counter32.
+
+      In the value set and its semantics, this type is equivalent
+      to the Counter32 type of the SMIv2.";
+      reference
+        "RFC 2578: Structure of Management Information Version 2
+        	  (SMIv2)";
+
+    }
+
+    typedef zero-based-counter32 {
+      type counter32;
+      default "0";
+      description
+        "The zero-based-counter32 type represents a counter32
+      that has the defined 'initial' value zero.
+
+      A schema node of this type will be set to zero (0) on creation
+      and will thereafter increase monotonically until it reaches
+      a maximum value of 2^32-1 (4294967295 decimal), when it
+      wraps around and starts increasing again from zero.
+
+      Provided that an application discovers a new schema node
+      of this type within the minimum time to wrap, it can use the
+      'initial' value as a delta.  It is important for a management
+      station to be aware of this minimum time and the actual time
+      between polls, and to discard data if the actual time is too
+      long or there is no defined minimum time.
+
+      In the value set and its semantics, this type is equivalent
+      to the ZeroBasedCounter32 textual convention of the SMIv2.";
+      reference
+        "RFC 4502: Remote Network Monitoring Management Information
+        	  Base Version 2";
+
+    }
+
+    typedef counter64 {
+      type uint64;
+      description
+        "The counter64 type represents a non-negative integer
+      that monotonically increases until it reaches a
+      maximum value of 2^64-1 (18446744073709551615 decimal),
+      when it wraps around and starts increasing again from zero.
+
+      Counters have no defined 'initial' value, and thus, a
+      single value of a counter has (in general) no information
+      content.  Discontinuities in the monotonically increasing
+      value normally occur at re-initialization of the
+      management system, and at other times as specified in the
+      description of a schema node using this type.  If such
+      other times can occur, for example, the creation of
+      a schema node of type counter64 at times other than
+      re-initialization, then a corresponding schema node
+      should be defined, with an appropriate type, to indicate
+      the last discontinuity.
+
+      The counter64 type should not be used for configuration
+      schema nodes.  A default statement SHOULD NOT be used in
+      combination with the type counter64.
+
+      In the value set and its semantics, this type is equivalent
+      to the Counter64 type of the SMIv2.";
+      reference
+        "RFC 2578: Structure of Management Information Version 2
+        	  (SMIv2)";
+
+    }
+
+    typedef zero-based-counter64 {
+      type counter64;
+      default "0";
+      description
+        "The zero-based-counter64 type represents a counter64 that
+      has the defined 'initial' value zero.
+
+
+
+
+      A schema node of this type will be set to zero (0) on creation
+      and will thereafter increase monotonically until it reaches
+      a maximum value of 2^64-1 (18446744073709551615 decimal),
+      when it wraps around and starts increasing again from zero.
+
+      Provided that an application discovers a new schema node
+      of this type within the minimum time to wrap, it can use the
+      'initial' value as a delta.  It is important for a management
+      station to be aware of this minimum time and the actual time
+      between polls, and to discard data if the actual time is too
+      long or there is no defined minimum time.
+
+      In the value set and its semantics, this type is equivalent
+      to the ZeroBasedCounter64 textual convention of the SMIv2.";
+      reference
+        "RFC 2856: Textual Conventions for Additional High Capacity
+        	  Data Types";
+
+    }
+
+    typedef gauge32 {
+      type uint32;
+      description
+        "The gauge32 type represents a non-negative integer, which
+      may increase or decrease, but shall never exceed a maximum
+      value, nor fall below a minimum value.  The maximum value
+      cannot be greater than 2^32-1 (4294967295 decimal), and
+      the minimum value cannot be smaller than 0.  The value of
+      a gauge32 has its maximum value whenever the information
+      being modeled is greater than or equal to its maximum
+      value, and has its minimum value whenever the information
+      being modeled is smaller than or equal to its minimum value.
+      If the information being modeled subsequently decreases
+      below (increases above) the maximum (minimum) value, the
+      gauge32 also decreases (increases).
+
+      In the value set and its semantics, this type is equivalent
+      to the Gauge32 type of the SMIv2.";
+      reference
+        "RFC 2578: Structure of Management Information Version 2
+        	  (SMIv2)";
+
+    }
+
+    typedef gauge64 {
+      type uint64;
+      description
+        "The gauge64 type represents a non-negative integer, which
+      may increase or decrease, but shall never exceed a maximum
+      value, nor fall below a minimum value.  The maximum value
+      cannot be greater than 2^64-1 (18446744073709551615), and
+      the minimum value cannot be smaller than 0.  The value of
+      a gauge64 has its maximum value whenever the information
+      being modeled is greater than or equal to its maximum
+      value, and has its minimum value whenever the information
+      being modeled is smaller than or equal to its minimum value.
+      If the information being modeled subsequently decreases
+      below (increases above) the maximum (minimum) value, the
+      gauge64 also decreases (increases).
+
+      In the value set and its semantics, this type is equivalent
+      to the CounterBasedGauge64 SMIv2 textual convention defined
+      in RFC 2856";
+      reference
+        "RFC 2856: Textual Conventions for Additional High Capacity
+        	  Data Types";
+
+    }
+
+    typedef object-identifier {
+      type string {
+        pattern
+          '(([0-1](\.[1-3]?[0-9]))|(2\.(0|([1-9]\d*))))(\.(0|([1-9]\d*)))*';
+      }
+      description
+        "The object-identifier type represents administratively
+      assigned names in a registration-hierarchical-name tree.
+
+      Values of this type are denoted as a sequence of numerical
+      non-negative sub-identifier values.  Each sub-identifier
+      value MUST NOT exceed 2^32-1 (4294967295).  Sub-identifiers
+      are separated by single dots and without any intermediate
+      whitespace.
+
+      The ASN.1 standard restricts the value space of the first
+      sub-identifier to 0, 1, or 2.  Furthermore, the value space
+      of the second sub-identifier is restricted to the range
+      0 to 39 if the first sub-identifier is 0 or 1.  Finally,
+      the ASN.1 standard requires that an object identifier
+      has always at least two sub-identifiers.  The pattern
+      captures these restrictions.
+
+      Although the number of sub-identifiers is not limited,
+      module designers should realize that there may be
+      implementations that stick with the SMIv2 limit of 128
+      sub-identifiers.
+
+      This type is a superset of the SMIv2 OBJECT IDENTIFIER type
+      since it is not restricted to 128 sub-identifiers.  Hence,
+      this type SHOULD NOT be used to represent the SMIv2 OBJECT
+      IDENTIFIER type; the object-identifier-128 type SHOULD be
+      used instead.";
+      reference
+        "ISO9834-1: Information technology -- Open Systems
+        Interconnection -- Procedures for the operation of OSI
+        Registration Authorities: General procedures and top
+        arcs of the ASN.1 Object Identifier tree";
+
+    }
+
+    typedef object-identifier-128 {
+      type object-identifier {
+        pattern '\d*(\.\d*){1,127}';
+      }
+      description
+        "This type represents object-identifiers restricted to 128
+      sub-identifiers.
+
+      In the value set and its semantics, this type is equivalent
+      to the OBJECT IDENTIFIER type of the SMIv2.";
+      reference
+        "RFC 2578: Structure of Management Information Version 2
+        	  (SMIv2)";
+
+    }
+
+    typedef yang-identifier {
+      type string {
+        length "1..max";
+        pattern '[a-zA-Z_][a-zA-Z0-9\-_.]*';
+        pattern
+          '.|..|[^xX].*|.[^mM].*|..[^lL].*';
+      }
+      description
+        "A YANG identifier string as defined by the 'identifier'
+       rule in Section 12 of RFC 6020.  An identifier must
+       start with an alphabetic character or an underscore
+       followed by an arbitrary sequence of alphabetic or
+       numeric characters, underscores, hyphens, or dots.
+
+       A YANG identifier MUST NOT start with any possible
+       combination of the lowercase or uppercase character
+       sequence 'xml'.";
+      reference
+        "RFC 6020: YANG - A Data Modeling Language for the Network
+        	  Configuration Protocol (NETCONF)";
+
+    }
+
+    typedef date-and-time {
+      type string {
+        pattern
+          '\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[\+\-]\d{2}:\d{2})';
+      }
+      description
+        "The date-and-time type is a profile of the ISO 8601
+      standard for representation of dates and times using the
+      Gregorian calendar.  The profile is defined by the
+      date-time production in Section 5.6 of RFC 3339.
+
+      The date-and-time type is compatible with the dateTime XML
+      schema type with the following notable exceptions:
+
+      (a) The date-and-time type does not allow negative years.
+
+      (b) The date-and-time time-offset -00:00 indicates an unknown
+          time zone (see RFC 3339) while -00:00 and +00:00 and Z
+          all represent the same time zone in dateTime.
+
+      (c) The canonical format (see below) of data-and-time values
+          differs from the canonical format used by the dateTime XML
+          schema type, which requires all times to be in UTC using
+          the time-offset 'Z'.
+
+      This type is not equivalent to the DateAndTime textual
+      convention of the SMIv2 since RFC 3339 uses a different
+      separator between full-date and full-time and provides
+      higher resolution of time-secfrac.
+
+      The canonical format for date-and-time values with a known time
+      zone uses a numeric time zone offset that is calculated using
+      the device's configured known offset to UTC time.  A change of
+      the device's offset to UTC time will cause date-and-time values
+      to change accordingly.  Such changes might happen periodically
+      in case a server follows automatically daylight saving time
+      (DST) time zone offset changes.  The canonical format for
+      date-and-time values with an unknown time zone (usually
+      referring to the notion of local time) uses the time-offset
+      -00:00.";
+      reference
+        "RFC 3339: Date and Time on the Internet: Timestamps
+         RFC 2579: Textual Conventions for SMIv2
+        XSD-TYPES: XML Schema Part 2: Datatypes Second Edition";
+
+    }
+
+    typedef timeticks {
+      type uint32;
+      description
+        "The timeticks type represents a non-negative integer that
+      represents the time, modulo 2^32 (4294967296 decimal), in
+      hundredths of a second between two epochs.  When a schema
+      node is defined that uses this type, the description of
+      the schema node identifies both of the reference epochs.
+
+      In the value set and its semantics, this type is equivalent
+      to the TimeTicks type of the SMIv2.";
+      reference
+        "RFC 2578: Structure of Management Information Version 2
+        	  (SMIv2)";
+
+    }
+
+    typedef timestamp {
+      type timeticks;
+      description
+        "The timestamp type represents the value of an associated
+      timeticks schema node at which a specific occurrence
+      happened.  The specific occurrence must be defined in the
+      description of any schema node defined using this type.  When
+      the specific occurrence occurred prior to the last time the
+      associated timeticks attribute was zero, then the timestamp
+      value is zero.  Note that this requires all timestamp values
+      to be reset to zero when the value of the associated timeticks
+      attribute reaches 497+ days and wraps around to zero.
+
+      The associated timeticks schema node must be specified
+      in the description of any schema node using this type.
+
+      In the value set and its semantics, this type is equivalent
+      to the TimeStamp textual convention of the SMIv2.";
+      reference
+        "RFC 2579: Textual Conventions for SMIv2";
+
+    }
+
+    typedef phys-address {
+      type string {
+        pattern
+          '([0-9a-fA-F]{2}(:[0-9a-fA-F]{2})*)?';
+      }
+      description
+        "Represents media- or physical-level addresses represented
+      as a sequence octets, each octet represented by two hexadecimal
+      numbers.  Octets are separated by colons.  The canonical
+      representation uses lowercase characters.
+
+      In the value set and its semantics, this type is equivalent
+      to the PhysAddress textual convention of the SMIv2.";
+      reference
+        "RFC 2579: Textual Conventions for SMIv2";
+
+    }
+
+    typedef mac-address {
+      type string {
+        pattern
+          '[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}';
+      }
+      description
+        "The mac-address type represents an IEEE 802 MAC address.
+      The canonical representation uses lowercase characters.
+
+      In the value set and its semantics, this type is equivalent
+      to the MacAddress textual convention of the SMIv2.";
+      reference
+        "IEEE 802: IEEE Standard for Local and Metropolitan Area
+        	  Networks: Overview and Architecture
+         RFC 2579: Textual Conventions for SMIv2";
+
+    }
+
+    typedef xpath1.0 {
+      type string;
+      description
+        "This type represents an XPATH 1.0 expression.
+
+      When a schema node is defined that uses this type, the
+      description of the schema node MUST specify the XPath
+      context in which the XPath expression is evaluated.";
+      reference
+        "XPATH: XML Path Language (XPath) Version 1.0";
+
+    }
+
+    typedef hex-string {
+      type string {
+        pattern
+          '([0-9a-fA-F]{2}(:[0-9a-fA-F]{2})*)?';
+      }
+      description
+        "A hexadecimal string with octets represented as hex digits
+      separated by colons.  The canonical representation uses
+      lowercase characters.";
+    }
+
+    typedef uuid {
+      type string {
+        pattern
+          '[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}';
+      }
+      description
+        "A Universally Unique IDentifier in the string representation
+      defined in RFC 4122.  The canonical representation uses
+      lowercase characters.
+
+      The following is an example of a UUID in string representation:
+      f81d4fae-7dec-11d0-a765-00a0c91e6bf6
+      ";
+      reference
+        "RFC 4122: A Universally Unique IDentifier (UUID) URN
+        	  Namespace";
+
+    }
+
+    typedef dotted-quad {
+      type string {
+        pattern
+          '(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])';
+      }
+      description
+        "An unsigned 32-bit number expressed in the dotted-quad
+       notation, i.e., four octets written as decimal numbers
+       and separated with the '.' (full stop) character.";
+    }
+  }
diff --git a/compiler/plugin/maven/src/test/resources/typelinkingaftercloning/identityref/IntraFileIdentityRefAfterCloning.yang b/compiler/plugin/maven/src/test/resources/typelinkingaftercloning/identityref/IntraFileIdentityRefAfterCloning.yang
new file mode 100644
index 0000000..9fbc024
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/typelinkingaftercloning/identityref/IntraFileIdentityRefAfterCloning.yang
@@ -0,0 +1,74 @@
+module org-open-road-m-device {
+    namespace "http://org/openroadm/device";
+    prefix org-open-road-m-device;
+
+    identity syslog-facility {
+        description
+            "The base identity to represent syslog facilities";
+    }
+    typedef value {
+        type identityref {
+            base syslog-facility;
+        }
+    }
+
+    grouping device-common {
+        leaf facility {
+            type union {
+                type identityref {
+                    base syslog-facility;
+                }
+                type enumeration {
+                    enum "all" {
+                        description
+                            "This enum describes the case where all
+                            facilities are requested.";
+                    }
+                }
+            }
+        }
+        leaf node-id {
+            type identityref {
+                base syslog-facility;
+            }
+            description
+                "Globally unique identifier for a device.";
+            config true;
+        }
+        leaf-list node-ref {
+            type value;
+        }
+        container network-ref {
+            leaf-list facility {
+                type union {
+                    type identityref {
+                        base syslog-facility;
+                    }
+                    type enumeration {
+                        enum "all" {
+                            description
+                                "This enum describes the case where all
+                                facilities are requested.";
+                        }
+                    }
+                }
+            }
+            leaf-list node-ref {
+                type identityref {
+                    base syslog-facility;
+                }
+                description
+                    "Globally unique identifier for a device.";
+                config true;
+            }
+            leaf node-id {
+                type value;
+            }
+        }
+    }
+
+    list node {
+        config false;
+        uses device-common;
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/typelinkingaftercloning/idrefingrouping/idrefingrouping1.yang b/compiler/plugin/maven/src/test/resources/typelinkingaftercloning/idrefingrouping/idrefingrouping1.yang
new file mode 100644
index 0000000..8837d49
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/typelinkingaftercloning/idrefingrouping/idrefingrouping1.yang
@@ -0,0 +1,37 @@
+module IdRefInGrouping1 {
+    namespace "http://org/IdRefInGrouping1";
+    prefix id-ref-in-grouping-1;
+
+    identity id1 {
+        description "base identity";
+    }
+
+    identity id2 {
+        base id1;
+    }
+
+    typedef id {
+        type identityref {
+            base id1;
+        }
+    }
+
+    grouping value {
+        leaf leaf {
+            type identityref {
+                base id2;
+            }
+        }
+        leaf-list leaf-list {
+            type id;
+        }
+        container a {
+            leaf leaf {
+                type identityref {
+                    base id1;
+                }
+            }
+        }
+    }
+
+}
diff --git a/compiler/plugin/maven/src/test/resources/typelinkingaftercloning/idrefingrouping/idrefingrouping2.yang b/compiler/plugin/maven/src/test/resources/typelinkingaftercloning/idrefingrouping/idrefingrouping2.yang
new file mode 100644
index 0000000..2a347f1
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/typelinkingaftercloning/idrefingrouping/idrefingrouping2.yang
@@ -0,0 +1,12 @@
+module IdRefInGrouping2 {
+    namespace "http://org/IdRefInGrouping2";
+    prefix id-ref-in-grouping-2;
+
+    import IdRefInGrouping1 {
+        prefix idref1;
+    }
+
+    container content {
+        uses idref1:value;
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/typelinkingaftercloning/idreftypedef/IdRefInTypeDef1.yang b/compiler/plugin/maven/src/test/resources/typelinkingaftercloning/idreftypedef/IdRefInTypeDef1.yang
new file mode 100644
index 0000000..4d2642c
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/typelinkingaftercloning/idreftypedef/IdRefInTypeDef1.yang
@@ -0,0 +1,57 @@
+module IdRefInTypeDef1 {
+    namespace "http://org/IdRefInTypeDef1";
+    prefix id-ref-in-type-1;
+
+    import IdRefInTypeDef2 {
+        prefix id;
+    }
+
+    identity id1 {
+        description "base identity";
+    }
+
+    identity id2 {
+        base id1;
+    }
+
+    typedef forleaf3 {
+        type identityref {
+            base id2;
+        }
+    }
+
+    typedef forleaf2 {
+        type forleaf3;
+    }
+
+    typedef forleaf1 {
+        type forleaf2;
+    }
+
+    leaf leaf {
+        type forleaf1;
+    }
+
+    leaf-list leaf-list {
+        type forleaf2;
+    }
+
+    container cont {
+        leaf leaf {
+            type forleaf1;
+        }
+
+        leaf leaf-list {
+            type forleaf2;
+        }
+    }
+
+    leaf with-uni {
+        type union {
+            type identityref {
+                base id2;
+            }
+            type id:value;
+        }
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/typelinkingaftercloning/idreftypedef/IdRefInTypeDef2.yang b/compiler/plugin/maven/src/test/resources/typelinkingaftercloning/idreftypedef/IdRefInTypeDef2.yang
new file mode 100644
index 0000000..646a3f6
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/typelinkingaftercloning/idreftypedef/IdRefInTypeDef2.yang
@@ -0,0 +1,18 @@
+module IdRefInTypeDef2 {
+    namespace "http://org/IdRefInTypeDef2";
+    prefix id-ref-in-type-2;
+
+    identity id4 {
+        description "base identity";
+    }
+
+    identity id3 {
+        base id4;
+    }
+
+    typedef value {
+        type identityref {
+            base id3;
+        }
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/typelinkingaftercloning/leafref/intrafile/IntraFileLeafrefAfterCloning.yang b/compiler/plugin/maven/src/test/resources/typelinkingaftercloning/leafref/intrafile/IntraFileLeafrefAfterCloning.yang
new file mode 100644
index 0000000..a73280d
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/typelinkingaftercloning/leafref/intrafile/IntraFileLeafrefAfterCloning.yang
@@ -0,0 +1,52 @@
+module org-open-road-m-device {
+    namespace "http://org/openroadm/device";
+    prefix org-open-road-m-device;
+
+    leaf uri {
+        type string;
+    }
+    leaf-list id {
+        type value;
+    }
+    typedef value {
+        type uint8;
+    }
+
+    grouping device-common {
+        leaf node-id {
+            type leafref {
+                path "/uri";
+            }
+            description
+                "Globally unique identifier for a device.";
+            config true;
+            default "open-road-m";
+        }
+        leaf-list node-ref {
+            type leafref {
+                path "/id";
+            }
+        }
+        container network-ref {
+            leaf node-id {
+                type leafref {
+                    path "/id";
+                }
+                description
+                    "Globally unique identifier for a device.";
+                config true;
+                default "open-road-m";
+            }
+            leaf-list node-ref {
+                type leafref {
+                    path "/uri";
+                }
+            }
+        }
+    }
+
+    list node {
+        config false;
+        uses device-common;
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/typelinkingaftercloning/leafref/invalid/invalidleafref.yang b/compiler/plugin/maven/src/test/resources/typelinkingaftercloning/leafref/invalid/invalidleafref.yang
new file mode 100644
index 0000000..79491e1
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/typelinkingaftercloning/leafref/invalid/invalidleafref.yang
@@ -0,0 +1,28 @@
+module org-open-road-m-device {
+    namespace "http://org/openroadm/device";
+    prefix org-open-road-m-device;
+
+    leaf uri {
+        type string;
+    }
+
+    grouping device-common {
+        leaf node-id {
+            type union {
+                type leafref {
+                    path "/uri";
+                }
+                type string;
+            }
+            description
+                "Globally unique identifier for a device.";
+            config true;
+            default "open-road-m";
+        }
+    }
+
+    list node {
+        config false;
+        uses device-common;
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/typelinkingaftercloning/union/IntraFileUnionAfterCloning.yang b/compiler/plugin/maven/src/test/resources/typelinkingaftercloning/union/IntraFileUnionAfterCloning.yang
new file mode 100644
index 0000000..a69a5a1
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/typelinkingaftercloning/union/IntraFileUnionAfterCloning.yang
@@ -0,0 +1,81 @@
+module org-open-road-m-device {
+    namespace "http://org/openroadm/device";
+    prefix org-open-road-m-device;
+
+    identity syslog-facility {
+        description
+            "The base identity to represent syslog facilities";
+    }
+
+    identity syslog-usability {
+        description
+            "The base identity to represent syslog usabilities";
+    }
+
+    identity syslog-availability {
+        description
+            "The base identity to represent syslog availabilities";
+    }
+
+    typedef value {
+        type identityref {
+            base syslog-availability;
+        }
+    }
+
+    typedef correct {
+        type union {
+            type union {
+                type identityref {
+                    base syslog-availability;
+                }
+                type value;
+            }
+            type identityref {
+                base syslog-usability;
+            }
+        }
+    }
+
+    grouping device-common {
+        leaf facility {
+            type union {
+               type union {
+                   type union {
+                       type identityref {
+                           base syslog-usability;
+                       }
+                       type correct;
+                   }
+                   type identityref {
+                       base syslog-facility;
+                   }
+               }
+               type value;
+            }
+        }
+        container network-ref {
+            leaf-list facility {
+                type union {
+                   type union {
+                       type union {
+                           type identityref {
+                               base syslog-usability;
+                           }
+                           type correct;
+                       }
+                       type identityref {
+                           base syslog-facility;
+                       }
+                   }
+                   type value;
+                }
+            }
+        }
+    }
+
+    list node {
+        config false;
+        uses device-common;
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/unionTranslator/intuint/test.yang b/compiler/plugin/maven/src/test/resources/unionTranslator/intuint/test.yang
new file mode 100644
index 0000000..6cba197
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/unionTranslator/intuint/test.yang
@@ -0,0 +1,23 @@
+module test {  
+    namespace "test:test";  
+    prefix test ;  
+      
+    organization "";  
+    contact "";  
+       
+    description   
+       "Defines basic service types for L3VPN service.";  
+       
+    revision "2015-12-16" {  
+       reference "";  
+    }  
+
+    leaf leaf1 {
+       type union {
+          type int32;
+          type uint16;
+      }
+   }
+
+}
+    
diff --git a/compiler/plugin/maven/src/test/resources/unionTranslator/intuintstring/test.yang b/compiler/plugin/maven/src/test/resources/unionTranslator/intuintstring/test.yang
new file mode 100644
index 0000000..c806017
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/unionTranslator/intuintstring/test.yang
@@ -0,0 +1,24 @@
+module test {  
+    namespace "test:test";  
+    prefix test ;  
+      
+    organization "";  
+    contact "";  
+       
+    description   
+       "Defines basic service types for L3VPN service.";  
+       
+    revision "2015-12-16" {  
+       reference "";  
+    }  
+
+    leaf leaf1 {
+       type union {
+          type int32;
+	  type string;
+          type uint16;
+      }
+   }
+
+}
+    
diff --git a/compiler/plugin/maven/src/test/resources/unionTranslator/intuintstring/test2.yang b/compiler/plugin/maven/src/test/resources/unionTranslator/intuintstring/test2.yang
new file mode 100644
index 0000000..63b791c
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/unionTranslator/intuintstring/test2.yang
@@ -0,0 +1,24 @@
+module test2 {  
+    namespace "test:test";  
+    prefix test ;  
+      
+    organization "";  
+    contact "";  
+       
+    description   
+       "Defines basic service types for L3VPN service.";  
+       
+    revision "2015-12-16" {  
+       reference "";  
+    }  
+
+    leaf leaf1 {
+       type union {
+          type int64;
+	  type string;
+          type uint16;
+      }
+   }
+
+}
+    
diff --git a/compiler/plugin/maven/src/test/resources/unionTranslator/intuintulonglong/test.yang b/compiler/plugin/maven/src/test/resources/unionTranslator/intuintulonglong/test.yang
new file mode 100644
index 0000000..b4737e7
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/unionTranslator/intuintulonglong/test.yang
@@ -0,0 +1,25 @@
+module test {  
+    namespace "test:test";  
+    prefix test ;  
+      
+    organization "";  
+    contact "";  
+       
+    description   
+       "Defines basic service types for L3VPN service.";  
+       
+    revision "2015-12-16" {  
+       reference "";  
+    }  
+
+    leaf leaf1 {
+       type union {   
+          type int32;
+          type uint16;   
+          type uint32;
+          type int64;   
+      }
+   }
+
+}
+    
diff --git a/compiler/plugin/maven/src/test/resources/unionTranslator/intuintulonglongstring/test.yang b/compiler/plugin/maven/src/test/resources/unionTranslator/intuintulonglongstring/test.yang
new file mode 100644
index 0000000..a50b5ef
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/unionTranslator/intuintulonglongstring/test.yang
@@ -0,0 +1,26 @@
+module test {  
+    namespace "test:test";  
+    prefix test ;  
+      
+    organization "";  
+    contact "";  
+       
+    description   
+       "Defines basic service types for L3VPN service.";  
+       
+    revision "2015-12-16" {  
+       reference "";  
+    }  
+
+    leaf leaf1 {
+       type union {   
+          type string; 
+          type int32;
+          type uint16;  
+          type uint32;
+          type int64; 
+      }
+   }
+
+}
+    
diff --git a/compiler/plugin/maven/src/test/resources/unionTranslator/longulong/test.yang b/compiler/plugin/maven/src/test/resources/unionTranslator/longulong/test.yang
new file mode 100644
index 0000000..a555043
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/unionTranslator/longulong/test.yang
@@ -0,0 +1,23 @@
+module test {  
+    namespace "test:test";  
+    prefix test ;  
+      
+    organization "";  
+    contact "";  
+       
+    description   
+       "Defines basic service types for L3VPN service.";  
+       
+    revision "2015-12-16" {  
+       reference "";  
+    }  
+
+    leaf leaf1 {
+       type union { 
+          type int64;        
+          type uint32;
+      }
+   }
+
+}
+    
diff --git a/compiler/plugin/maven/src/test/resources/unionTranslator/uintint/test.yang b/compiler/plugin/maven/src/test/resources/unionTranslator/uintint/test.yang
new file mode 100644
index 0000000..d7a590a
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/unionTranslator/uintint/test.yang
@@ -0,0 +1,23 @@
+module test {  
+    namespace "test:test";  
+    prefix test ;  
+      
+    organization "";  
+    contact "";  
+       
+    description   
+       "Defines basic service types for L3VPN service.";  
+       
+    revision "2015-12-16" {  
+       reference "";  
+    }  
+
+    leaf leaf1 {
+       type union {         
+          type uint16;
+          type int32;
+      }
+   }
+
+}
+    
diff --git a/compiler/plugin/maven/src/test/resources/unionTranslator/ulonglong/test.yang b/compiler/plugin/maven/src/test/resources/unionTranslator/ulonglong/test.yang
new file mode 100644
index 0000000..22f6e97
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/unionTranslator/ulonglong/test.yang
@@ -0,0 +1,23 @@
+module test {  
+    namespace "test:test";  
+    prefix test ;  
+      
+    organization "";  
+    contact "";  
+       
+    description   
+       "Defines basic service types for L3VPN service.";  
+       
+    revision "2015-12-16" {  
+       reference "";  
+    }  
+
+    leaf leaf1 {
+       type union {      
+          type uint32;
+          type int64;   
+      }
+   }
+
+}
+    
diff --git a/compiler/plugin/maven/src/test/resources/unionTranslator/unionwithbinary/test.yang b/compiler/plugin/maven/src/test/resources/unionTranslator/unionwithbinary/test.yang
new file mode 100644
index 0000000..d2c9966
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/unionTranslator/unionwithbinary/test.yang
@@ -0,0 +1,15 @@
+module moduletest {
+  yang-version 1;
+  namespace "onos-yang-20:level1:newlevel";
+  prefix test;
+  organization "huawei";
+  contact "adarsh.m@huawei.com";
+  description "leaf scenario";
+  revision 2015-02-05;
+  leaf eleven {
+    type union { 
+      type binary;
+      type int8;
+    }
+  }
+}
diff --git a/compiler/plugin/maven/src/test/resources/usesInContainer/GroupingError.yang b/compiler/plugin/maven/src/test/resources/usesInContainer/GroupingError.yang
new file mode 100644
index 0000000..8c7c01d
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/usesInContainer/GroupingError.yang
@@ -0,0 +1,64 @@
+
+module ietf-sd-onos-service-types {
+
+       namespace "urn:ietf:params:xml:ns:yang:ietf-sd-onos-service-types";  
+       prefix service-types ; 
+
+	grouping qos-if-car {  
+           description "qos parameter." ;  
+         list qos-if-car {  
+       	key "direction";  
+           description "cars qos policy." ;   
+           leaf direction {  
+               type enumeration {  
+                   enum inbound{  
+                       value 0 ;  
+                       description "inbound." ;  
+                   }  
+                   enum outbound {  
+                       value 1 ;  
+                       description "outbound." ;  
+                   }  
+               }  
+        description "qos for interface car" ;  
+           }   
+}
+}
+
+	container qos-policy {  
+          description "The qos policy of the vpn service." ;  
+               container qos-if-cars {  
+             description "qos policy if car." ;  
+                   list qos-if-car {  
+                     key "direction";  
+                     uses qos-if-car;  
+             description "List of qos parameters." ;  
+                   }  
+               }  
+           }  
+
+     rpc close-l3vpn {  
+     description "Close l3vpn." ;  
+         input {  
+             leaf l3vpn-id {  
+                 type string;  
+           description "vpn id." ;  
+             }  
+             container ac-status {   
+           description "Access status of the vpn." ;  
+                 list acs{  
+                     key "id";  
+             description "Access information." ;  
+                     leaf id {  
+                         type string;  
+               description "Access id." ;  
+                     }  
+                     leaf admin-status {  
+                         type string;  
+               description "Administration status." ;  
+                     }                      
+                 }
+             }  
+         }  
+     }    
+}
diff --git a/compiler/plugin/maven/src/test/resources/usesInsideChildOfGrouping/ietf-network.yang b/compiler/plugin/maven/src/test/resources/usesInsideChildOfGrouping/ietf-network.yang
new file mode 100644
index 0000000..8fb2bc0
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/usesInsideChildOfGrouping/ietf-network.yang
@@ -0,0 +1,28 @@
+module ietf-network {
+    yang-version 1;
+    namespace "urn:ietf:params:xml:ns:yang:ietf-network";
+    prefix nd;
+
+    revision 2015-12-08 {
+       description
+         "Initial revision.
+          NOTE TO RFC EDITOR: Please replace the following reference
+          to draft-ietf-i2rs-yang-network-topo-02 with
+          RFC number when published (i.e. RFC xxxx).";
+    }
+
+    container networks {
+        list network {
+            key "network-id";
+            leaf network-id {
+                type string;
+            }
+            list node {
+                key "node-id";
+                leaf node-id {
+                    type string;
+                }
+            }
+        }
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/usesInsideChildOfGrouping/ietf-te-topology.yang b/compiler/plugin/maven/src/test/resources/usesInsideChildOfGrouping/ietf-te-topology.yang
new file mode 100644
index 0000000..f1776fb
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/usesInsideChildOfGrouping/ietf-te-topology.yang
@@ -0,0 +1,60 @@
+module ietf-te-topology {
+    yang-version 1;
+    namespace "urn:ietf:params:xml:ns:yang:ietf-te-topology";
+
+    prefix "tet";
+
+    import ietf-network {
+        prefix "nw";
+    }
+
+    revision "2016-03-17" {
+        description "Initial revision";
+    }
+
+    grouping te-node-augment {
+        container te {
+            presence "TE support.";
+
+            leaf te-node-id {
+                type string;
+                mandatory true;
+            }
+
+            container config {
+                uses te-node-config;
+            } // config
+        } // te
+    } // te-node-augment
+
+    grouping te-node-config {
+        leaf-list te-node-template {
+            if-feature template;
+            type string;
+        }
+        uses te-node-config-attributes;
+    } // te-node-config
+
+    grouping te-node-config-attributes {
+        container te-node-attributes {
+            leaf admin-status {
+               type string;
+            }
+            uses te-node-connectivity-matrix;
+        } // te-node-attributes
+    } // te-node-config-attributes
+
+    grouping te-node-connectivity-matrix {
+        list connectivity-matrix {
+            key "id";
+            leaf id {
+                type uint32;
+                description "Identifies the connectivity-matrix entry.";
+            }
+        }
+    } // te-node-connectivity-matrix
+
+    augment "/nw:networks/nw:network/nw:node" {
+        uses te-node-augment;
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/xPathLinker/Case/submodule/test.yang b/compiler/plugin/maven/src/test/resources/xPathLinker/Case/submodule/test.yang
new file mode 100644
index 0000000..dbff7e8
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/xPathLinker/Case/submodule/test.yang
@@ -0,0 +1,31 @@
+module test {  
+    namespace "xpath:intra:single";  
+    prefix test ;  
+   
+    include test1;
+    include test2;
+    include test4;
+
+    organization "";  
+    contact "";  
+       
+    description   
+        "Defines basic service types for L3VPN service.";  
+       
+    revision "2015-12-16" {  
+        reference "";  
+    }  
+
+    augment /cont5/cont6 {
+       leaf a {
+          type int32;
+       }
+    }
+
+   augment /cont3/cont4/cont8 {
+       leaf a {
+          type int32;
+       }
+    }
+}
+    
diff --git a/compiler/plugin/maven/src/test/resources/xPathLinker/Case/submodule/test1.yang b/compiler/plugin/maven/src/test/resources/xPathLinker/Case/submodule/test1.yang
new file mode 100644
index 0000000..23161d4
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/xPathLinker/Case/submodule/test1.yang
@@ -0,0 +1,47 @@
+submodule test1 {  
+
+    belongs-to test {
+         prefix test;
+    }           
+
+    include test4;
+
+    organization "";  
+    contact "";  
+       
+    description   
+        "Defines basic service types for L3VPN service.";  
+       
+    revision "2015-12-16" {  
+        reference "";  
+    }
+
+    container cont1 {
+          leaf leaf1 {
+             type int32;
+         }
+         container cont2 {
+            leaf leaf2 {
+               type int32;
+            }
+         }
+     }
+    
+    augment /cont1/cont2 {
+        container cont4 {
+          leaf leaf1 {
+             type int32;
+          }
+       }
+    }
+
+     augment /cont3/cont4 {
+        container cont8 {
+          leaf leaf8 {
+             type int32;
+          }
+       }
+    }
+
+}
+    
diff --git a/compiler/plugin/maven/src/test/resources/xPathLinker/Case/submodule/test2.yang b/compiler/plugin/maven/src/test/resources/xPathLinker/Case/submodule/test2.yang
new file mode 100644
index 0000000..26640ee
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/xPathLinker/Case/submodule/test2.yang
@@ -0,0 +1,36 @@
+submodule test2{
+    belongs-to test {
+         prefix test;
+    }
+
+    include test1;
+    organization "";  
+    contact "";  
+       
+    description   
+        "Defines basic service types for L3VPN service.";  
+       
+    revision "2015-12-16" {  
+        reference "";  
+    }  
+
+    container cont5 {
+       leaf leaf5 {
+          type int32;
+       }
+       container cont6 {
+          leaf leaf6 {
+             type int32;
+          }
+       }
+    }
+
+   augment /cont1/cont2/cont4 {
+        container cont10 {
+          leaf leaf10 {
+             type int32;
+          }
+       }
+    }
+}
+    
diff --git a/compiler/plugin/maven/src/test/resources/xPathLinker/Case/submodule/test4.yang b/compiler/plugin/maven/src/test/resources/xPathLinker/Case/submodule/test4.yang
new file mode 100644
index 0000000..fcbf522
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/xPathLinker/Case/submodule/test4.yang
@@ -0,0 +1,28 @@
+submodule test4 {  
+
+    belongs-to test {
+         prefix test;
+    } 
+      
+    organization "";  
+    contact "";  
+       
+    description   
+        "Defines basic service types for L3VPN service.";  
+       
+    revision "2015-12-16" {  
+        reference "";  
+    }  
+
+    container cont3 {
+       leaf leaf3 {
+          type int32;
+       }
+       container cont4 {
+          leaf leaf4 {
+             type int32;
+          }
+       }
+    }
+}
+    
diff --git a/compiler/plugin/maven/src/test/resources/xPathLinker/Case/uses/test.yang b/compiler/plugin/maven/src/test/resources/xPathLinker/Case/uses/test.yang
new file mode 100644
index 0000000..b326024
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/xPathLinker/Case/uses/test.yang
@@ -0,0 +1,23 @@
+module test {  
+    namespace "xpath:intra:single";  
+    prefix test ;  
+   
+    include test2;
+
+    organization "";  
+    contact "";  
+       
+    description   
+        "Defines basic service types for L3VPN service.";  
+       
+    revision "2015-12-16" {  
+        reference "";  
+    }  
+
+    augment /cont5/cont6/cont3/cont4 {
+       leaf a {
+          type int32;
+       }
+    }
+}
+    
diff --git a/compiler/plugin/maven/src/test/resources/xPathLinker/Case/uses/test1.yang b/compiler/plugin/maven/src/test/resources/xPathLinker/Case/uses/test1.yang
new file mode 100644
index 0000000..bd75dba
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/xPathLinker/Case/uses/test1.yang
@@ -0,0 +1,37 @@
+submodule test1 {  
+
+    belongs-to test {
+         prefix test;
+    }           
+
+    organization "";  
+    contact "";  
+       
+    description   
+        "Defines basic service types for L3VPN service.";  
+       
+    revision "2015-12-16" {  
+        reference "";  
+    }
+
+    container cont1 {
+          leaf leaf1 {
+             type int32;
+         }
+         container cont2 {
+            leaf leaf2 {
+               type int32;
+            }
+         }
+     }
+    
+    augment /cont1/cont2 {
+        container cont4 {
+          leaf leaf1 {
+             type int32;
+          }
+       }
+    }
+
+}
+    
diff --git a/compiler/plugin/maven/src/test/resources/xPathLinker/Case/uses/test2.yang b/compiler/plugin/maven/src/test/resources/xPathLinker/Case/uses/test2.yang
new file mode 100644
index 0000000..8e4dccf
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/xPathLinker/Case/uses/test2.yang
@@ -0,0 +1,64 @@
+submodule test2{
+    belongs-to test {
+         prefix test;
+    }
+
+    include test3;
+    include test1;
+
+    organization "";  
+    contact "";  
+       
+    description   
+        "Defines basic service types for L3VPN service.";  
+       
+    revision "2015-12-16" {  
+        reference "";  
+    }  
+
+    grouping group2 {
+        container cont11 {
+        }
+    }
+
+    container cont5 {
+       leaf leaf5 {
+          type int32;
+       }
+       container cont6 {
+          leaf leaf6 {
+             type int32;
+          }
+       uses group1;
+       }
+    }
+
+     container ethernet {
+           leaf leaf10 {
+                 type string;
+            }
+     }
+         
+
+   augment /ethernet {
+       uses group2;
+   }
+
+   augment /cont1/cont2/cont4 {
+        container cont10 {
+          leaf leaf10 {
+             type int32;
+          }
+          
+       }
+    }
+
+     augment /cont5/cont6/cont3/cont4 {
+        container cont8 {
+          leaf leaf8 {
+             type int32;
+          }
+       }
+    }
+}
+    
diff --git a/compiler/plugin/maven/src/test/resources/xPathLinker/Case/uses/test4.yang b/compiler/plugin/maven/src/test/resources/xPathLinker/Case/uses/test4.yang
new file mode 100644
index 0000000..b45bb7d
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/xPathLinker/Case/uses/test4.yang
@@ -0,0 +1,30 @@
+submodule test3 {  
+
+    belongs-to test {
+         prefix test;
+    } 
+    
+    organization "";  
+    contact "";  
+       
+    description   
+        "Defines basic service types for L3VPN service.";  
+       
+    revision "2015-12-16" {  
+        reference "";  
+    }  
+
+    grouping group1 {
+        container cont3 {
+           leaf leaf3 {
+              type int32;
+           }
+           container cont4 {
+                 leaf leaf4 {
+                    type int32;
+                 }
+            }
+        }
+    }
+    
+}
diff --git a/compiler/plugin/maven/src/test/resources/xPathLinker/InterFile/InterMulti/test.yang b/compiler/plugin/maven/src/test/resources/xPathLinker/InterFile/InterMulti/test.yang
new file mode 100644
index 0000000..772f792
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/xPathLinker/InterFile/InterMulti/test.yang
@@ -0,0 +1,25 @@
+module test {  
+    namespace "xpath:inter:single";  
+    prefix test ; 
+   
+    import test1{
+       prefix test1;
+    }
+ 
+    organization "";  
+    contact "";  
+       
+    description   
+        "Defines basic service types for L3VPN service.";  
+       
+    revision "2015-12-16" {  
+        reference "";  
+    }  
+
+    augment /test1:cont1/test1:cont2 {
+       leaf a {
+          type int32;
+       }
+    }
+}
+    
diff --git a/compiler/plugin/maven/src/test/resources/xPathLinker/InterFile/InterMulti/test1.yang b/compiler/plugin/maven/src/test/resources/xPathLinker/InterFile/InterMulti/test1.yang
new file mode 100644
index 0000000..9c1cdb0
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/xPathLinker/InterFile/InterMulti/test1.yang
@@ -0,0 +1,26 @@
+module test1 {  
+    namespace "xpath:inter:single";  
+    prefix test1 ;  
+      
+    organization "";  
+    contact "";  
+       
+    description   
+        "Defines basic service types for L3VPN service.";  
+       
+    revision "2015-12-16" {  
+        reference "";  
+    }  
+
+    container cont1 {
+       leaf leaf1 {
+          type int32;
+       }
+       container cont2 {
+           leaf leaf1 {
+             type int32;
+          }
+       }
+    }
+}
+    
diff --git a/compiler/plugin/maven/src/test/resources/xPathLinker/InterFile/InterMultiAugment/test.yang b/compiler/plugin/maven/src/test/resources/xPathLinker/InterFile/InterMultiAugment/test.yang
new file mode 100644
index 0000000..640a15a
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/xPathLinker/InterFile/InterMultiAugment/test.yang
@@ -0,0 +1,25 @@
+module test {  
+    namespace "xpath:inter:single";  
+    prefix test ; 
+   
+    import test1{
+       prefix test1;
+    }
+ 
+    organization "";  
+    contact "";  
+       
+    description   
+        "Defines basic service types for L3VPN service.";  
+       
+    revision "2015-12-16" {  
+        reference "";  
+    }  
+
+    augment /test1:cont1/test1:cont2/test1:cont2 {
+       leaf a {
+          type int32;
+       }
+    }
+}
+    
diff --git a/compiler/plugin/maven/src/test/resources/xPathLinker/InterFile/InterMultiAugment/test1.yang b/compiler/plugin/maven/src/test/resources/xPathLinker/InterFile/InterMultiAugment/test1.yang
new file mode 100644
index 0000000..c9fbeab
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/xPathLinker/InterFile/InterMultiAugment/test1.yang
@@ -0,0 +1,34 @@
+module test1 {  
+    namespace "xpath:inter:single";  
+    prefix test1 ;  
+      
+    organization "";  
+    contact "";  
+       
+    description   
+        "Defines basic service types for L3VPN service.";  
+       
+    revision "2015-12-16" {  
+        reference "";  
+    }  
+
+    container cont1 {
+       leaf leaf1 {
+          type int32;
+       }
+    }
+
+    augment /cont1 {
+       container cont2 {
+          leaf leaf1 {
+             type int32;
+          }
+          container cont2 {
+             leaf leaf1 {
+                type int32;
+             }
+          }
+       }
+    }
+}
+    
diff --git a/compiler/plugin/maven/src/test/resources/xPathLinker/InterFile/InterMultiFileAugment/test.yang b/compiler/plugin/maven/src/test/resources/xPathLinker/InterFile/InterMultiFileAugment/test.yang
new file mode 100644
index 0000000..53ed780
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/xPathLinker/InterFile/InterMultiFileAugment/test.yang
@@ -0,0 +1,29 @@
+module test {  
+    namespace "xpath:inter:single";  
+    prefix test ; 
+   
+    import test1{
+       prefix test1;
+    }
+
+    import test2{
+       prefix test2;
+    }
+ 
+    organization "";  
+    contact "";  
+       
+    description   
+        "Defines basic service types for L3VPN service.";  
+       
+    revision "2015-12-16" {  
+        reference "";  
+    }  
+
+     augment /test2:cont1/test2:cont2/test1:cont2 {
+       leaf a {
+          type int32;
+       }
+     }
+}
+    
diff --git a/compiler/plugin/maven/src/test/resources/xPathLinker/InterFile/InterMultiFileAugment/test1.yang b/compiler/plugin/maven/src/test/resources/xPathLinker/InterFile/InterMultiFileAugment/test1.yang
new file mode 100644
index 0000000..9ae5e24
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/xPathLinker/InterFile/InterMultiFileAugment/test1.yang
@@ -0,0 +1,51 @@
+module test1 {  
+    namespace "xpath:inter:single";  
+    prefix test1 ;  
+      
+    import test2{
+       prefix test2;
+    }
+
+    organization "";  
+    contact "";  
+       
+    description   
+        "Defines basic service types for L3VPN service.";  
+       
+    revision "2015-12-16" {  
+        reference "";  
+    }  
+
+
+    container cont1 {
+       leaf leaf1 {
+          type int32;
+       }
+    }
+
+    augment /cont1 {
+       container cont2 {
+          leaf leaf1 {
+             type int32;
+          }
+          container cont2 {
+             leaf leaf1 {
+                type int32;
+             }
+          }
+       }
+    }
+   
+    augment /test2:cont1/test2:cont2 {
+       leaf a {
+          type int32;
+       }
+
+       container cont2 {
+             leaf leaf1 {
+                type int32;
+             }
+        }
+    }
+}
+    
diff --git a/compiler/plugin/maven/src/test/resources/xPathLinker/InterFile/InterMultiFileAugment/test2.yang b/compiler/plugin/maven/src/test/resources/xPathLinker/InterFile/InterMultiFileAugment/test2.yang
new file mode 100644
index 0000000..f20ac7d
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/xPathLinker/InterFile/InterMultiFileAugment/test2.yang
@@ -0,0 +1,26 @@
+module test2 {  
+    namespace "xpath:inter:multi";  
+    prefix test2 ;  
+      
+    organization "";  
+    contact "";  
+       
+    description   
+        "Defines basic service types for L3VPN service.";  
+       
+    revision "2015-12-16" {  
+        reference "";  
+    }  
+
+    container cont1 {
+       leaf leaf1 {
+          type int32;
+       }
+       container cont2 {
+          leaf leaf1 {
+             type int32;
+          }
+       }
+    }
+}
+    
diff --git a/compiler/plugin/maven/src/test/resources/xPathLinker/InterFile/InterMultiFileAugmentMulti/test.yang b/compiler/plugin/maven/src/test/resources/xPathLinker/InterFile/InterMultiFileAugmentMulti/test.yang
new file mode 100644
index 0000000..adb4800
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/xPathLinker/InterFile/InterMultiFileAugmentMulti/test.yang
@@ -0,0 +1,29 @@
+module test {  
+    namespace "xpath:inter:single";  
+    prefix test ; 
+   
+    import test1{
+       prefix test1;
+    }
+
+    import test2{
+       prefix test2;
+    }
+ 
+    organization "";  
+    contact "";  
+       
+    description   
+        "Defines basic service types for L3VPN service.";  
+       
+    revision "2015-12-16" {  
+        reference "";  
+    }  
+
+     augment /test2:cont1/test2:cont2/test2:cont3/test1:cont2 {
+       leaf leaf8 {
+          type int32;
+       }
+     }
+}
+    
diff --git a/compiler/plugin/maven/src/test/resources/xPathLinker/InterFile/InterMultiFileAugmentMulti/test1.yang b/compiler/plugin/maven/src/test/resources/xPathLinker/InterFile/InterMultiFileAugmentMulti/test1.yang
new file mode 100644
index 0000000..0957e15
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/xPathLinker/InterFile/InterMultiFileAugmentMulti/test1.yang
@@ -0,0 +1,51 @@
+module test1 {  
+    namespace "xpath:inter:single";  
+    prefix test1 ;  
+      
+    import test2{
+       prefix test2;
+    }
+
+    organization "";  
+    contact "";  
+       
+    description   
+        "Defines basic service types for L3VPN service.";  
+       
+    revision "2015-12-16" {  
+        reference "";  
+    }  
+
+
+    container cont1 {
+       leaf leaf1 {
+          type int32;
+       }
+    }
+
+    augment /cont1 {
+       container cont2 {
+          leaf leaf1 {
+             type int32;
+          }
+          container cont2 {
+             leaf leaf3 {
+                type int32;
+             }
+          }
+       }
+    }
+   
+    augment /test2:cont1/test2:cont2/test2:cont3 {
+       leaf leaf2 {
+          type int32;
+       }
+
+       container cont2 {
+             leaf leaf4 {
+                type int32;
+             }
+        }
+    }
+}
+    
diff --git a/compiler/plugin/maven/src/test/resources/xPathLinker/InterFile/InterMultiFileAugmentMulti/test2.yang b/compiler/plugin/maven/src/test/resources/xPathLinker/InterFile/InterMultiFileAugmentMulti/test2.yang
new file mode 100644
index 0000000..0eeb46d
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/xPathLinker/InterFile/InterMultiFileAugmentMulti/test2.yang
@@ -0,0 +1,34 @@
+module test2 {  
+    namespace "xpath:inter:multi";  
+    prefix test2 ;  
+      
+    organization "";  
+    contact "";  
+       
+    description   
+        "Defines basic service types for L3VPN service.";  
+       
+    revision "2015-12-16" {  
+        reference "";  
+    }  
+
+    container cont1 {
+       leaf leaf5 {
+          type int32;
+       }
+       container cont2 {
+          leaf leaf6 {
+             type int32;
+          }
+       }
+    }
+
+    augment /cont1/cont2 {
+        container cont3 {
+            leaf leaf7 {
+              type string;
+            }
+        }
+    }
+}
+    
diff --git a/compiler/plugin/maven/src/test/resources/xPathLinker/InterFile/InterMultiSubModule/test.yang b/compiler/plugin/maven/src/test/resources/xPathLinker/InterFile/InterMultiSubModule/test.yang
new file mode 100644
index 0000000..40b2386
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/xPathLinker/InterFile/InterMultiSubModule/test.yang
@@ -0,0 +1,33 @@
+module test {  
+    namespace "xpath:intra:single";  
+    prefix test ;  
+    
+    import test2 {
+       prefix test2;
+    }
+   
+    include test1;
+
+    organization "";  
+    contact "";  
+       
+    description   
+        "Defines basic service types for L3VPN service.";  
+       
+    revision "2015-12-16" {  
+        reference "";  
+    }  
+
+    augment /test2:cont1/test2:cont2/cont2 {
+       leaf a {
+          type int32;
+       }
+    }
+
+    augment /cont2/cont3/cont4 {
+       leaf a {
+          type int32;
+       }
+    }
+}
+    
diff --git a/compiler/plugin/maven/src/test/resources/xPathLinker/InterFile/InterMultiSubModule/test1.yang b/compiler/plugin/maven/src/test/resources/xPathLinker/InterFile/InterMultiSubModule/test1.yang
new file mode 100644
index 0000000..a19ba35
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/xPathLinker/InterFile/InterMultiSubModule/test1.yang
@@ -0,0 +1,50 @@
+submodule test1 {  
+
+    belongs-to test {
+         prefix test;
+    }           
+    
+    import test2 {
+       prefix test2;
+    }
+    organization "";  
+    contact "";  
+       
+    description   
+        "Defines basic service types for L3VPN service.";  
+       
+    revision "2015-12-16" {  
+        reference "";  
+    }
+
+    container cont2 {
+          leaf leaf1 {
+             type int32;
+         }
+         container cont3 {
+            leaf leaf1 {
+               type int32;
+            }
+         }
+     }
+    
+    augment /cont2/cont3 {
+        container cont4 {
+          leaf leaf1 {
+             type int32;
+          }
+       }
+    }
+
+    augment /test2:cont1/test2:cont2 {
+       leaf a {
+          type int32;
+       }
+       container cont2 {
+          leaf leaf1 {
+             type int32;
+          }
+       }
+    }
+}
+    
diff --git a/compiler/plugin/maven/src/test/resources/xPathLinker/InterFile/InterMultiSubModule/test2.yang b/compiler/plugin/maven/src/test/resources/xPathLinker/InterFile/InterMultiSubModule/test2.yang
new file mode 100644
index 0000000..f20ac7d
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/xPathLinker/InterFile/InterMultiSubModule/test2.yang
@@ -0,0 +1,26 @@
+module test2 {  
+    namespace "xpath:inter:multi";  
+    prefix test2 ;  
+      
+    organization "";  
+    contact "";  
+       
+    description   
+        "Defines basic service types for L3VPN service.";  
+       
+    revision "2015-12-16" {  
+        reference "";  
+    }  
+
+    container cont1 {
+       leaf leaf1 {
+          type int32;
+       }
+       container cont2 {
+          leaf leaf1 {
+             type int32;
+          }
+       }
+    }
+}
+    
diff --git a/compiler/plugin/maven/src/test/resources/xPathLinker/InterFile/InterMultiUses/test.yang b/compiler/plugin/maven/src/test/resources/xPathLinker/InterFile/InterMultiUses/test.yang
new file mode 100644
index 0000000..01aa34e
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/xPathLinker/InterFile/InterMultiUses/test.yang
@@ -0,0 +1,32 @@
+module test {  
+    namespace "xpath:intra:single";  
+    prefix test ;  
+    
+    import test2 {
+       prefix test2;
+    }
+   
+    organization "";  
+    contact "";  
+       
+    description   
+        "Defines basic service types for L3VPN service.";  
+       
+    revision "2015-12-16" {  
+        reference "";  
+    }
+
+    container cont2 {
+       leaf a {
+          type int32;
+       }
+       uses test2:group1; 
+    }
+
+    augment /cont2/cont1/cont2 {
+          leaf a {
+          type int32;
+       }
+    } 
+}
+    
diff --git a/compiler/plugin/maven/src/test/resources/xPathLinker/InterFile/InterMultiUses/test2.yang b/compiler/plugin/maven/src/test/resources/xPathLinker/InterFile/InterMultiUses/test2.yang
new file mode 100644
index 0000000..298d443
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/xPathLinker/InterFile/InterMultiUses/test2.yang
@@ -0,0 +1,28 @@
+module test2 {  
+    namespace "xpath:inter:multi";  
+    prefix test2 ;  
+      
+    organization "";  
+    contact "";  
+       
+    description   
+        "Defines basic service types for L3VPN service.";  
+       
+    revision "2015-12-16" {  
+        reference "";  
+    }  
+
+   grouping group1 {
+    container cont1 {
+       leaf leaf1 {
+          type int32;
+       }
+       container cont2 {
+          leaf leaf1 {
+             type int32;
+          }
+       }
+    }
+  }
+}
+    
diff --git a/compiler/plugin/maven/src/test/resources/xPathLinker/InterFile/InterSingle/test.yang b/compiler/plugin/maven/src/test/resources/xPathLinker/InterFile/InterSingle/test.yang
new file mode 100644
index 0000000..102ec39
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/xPathLinker/InterFile/InterSingle/test.yang
@@ -0,0 +1,25 @@
+module test {  
+    namespace "xpath:inter:single";  
+    prefix test ; 
+   
+    import test1{
+       prefix test1;
+    }
+ 
+    organization "";  
+    contact "";  
+       
+    description   
+        "Defines basic service types for L3VPN service.";  
+       
+    revision "2015-12-16" {  
+        reference "";  
+    }  
+
+    augment /test1:cont1 {
+       leaf a {
+          type int32;
+       }
+    }
+}
+    
diff --git a/compiler/plugin/maven/src/test/resources/xPathLinker/InterFile/InterSingle/test1.yang b/compiler/plugin/maven/src/test/resources/xPathLinker/InterFile/InterSingle/test1.yang
new file mode 100644
index 0000000..243ddfe
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/xPathLinker/InterFile/InterSingle/test1.yang
@@ -0,0 +1,21 @@
+module test1 {  
+    namespace "xpath:inter:single";  
+    prefix test1 ;  
+      
+    organization "";  
+    contact "";  
+       
+    description   
+        "Defines basic service types for L3VPN service.";  
+       
+    revision "2015-12-16" {  
+        reference "";  
+    }  
+
+    container cont1 {
+       leaf leaf1 {
+          type int32;
+       }
+    }
+}
+    
diff --git a/compiler/plugin/maven/src/test/resources/xPathLinker/InterFile/InterSingleAugment/test.yang b/compiler/plugin/maven/src/test/resources/xPathLinker/InterFile/InterSingleAugment/test.yang
new file mode 100644
index 0000000..772f792
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/xPathLinker/InterFile/InterSingleAugment/test.yang
@@ -0,0 +1,25 @@
+module test {  
+    namespace "xpath:inter:single";  
+    prefix test ; 
+   
+    import test1{
+       prefix test1;
+    }
+ 
+    organization "";  
+    contact "";  
+       
+    description   
+        "Defines basic service types for L3VPN service.";  
+       
+    revision "2015-12-16" {  
+        reference "";  
+    }  
+
+    augment /test1:cont1/test1:cont2 {
+       leaf a {
+          type int32;
+       }
+    }
+}
+    
diff --git a/compiler/plugin/maven/src/test/resources/xPathLinker/InterFile/InterSingleAugment/test1.yang b/compiler/plugin/maven/src/test/resources/xPathLinker/InterFile/InterSingleAugment/test1.yang
new file mode 100644
index 0000000..b9c5e32
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/xPathLinker/InterFile/InterSingleAugment/test1.yang
@@ -0,0 +1,29 @@
+module test1 {  
+    namespace "xpath:inter:single";  
+    prefix test1 ;  
+      
+    organization "";  
+    contact "";  
+       
+    description   
+        "Defines basic service types for L3VPN service.";  
+       
+    revision "2015-12-16" {  
+        reference "";  
+    }  
+
+    container cont1 {
+       leaf leaf1 {
+          type int32;
+       }
+    }
+
+    augment /cont1 {
+       container cont2 {
+          leaf leaf1 {
+             type int32;
+          }
+       }
+    }
+}
+    
diff --git a/compiler/plugin/maven/src/test/resources/xPathLinker/InterFile/InterSingleSubModule/test.yang b/compiler/plugin/maven/src/test/resources/xPathLinker/InterFile/InterSingleSubModule/test.yang
new file mode 100644
index 0000000..a8340ab
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/xPathLinker/InterFile/InterSingleSubModule/test.yang
@@ -0,0 +1,27 @@
+module test {  
+    namespace "xpath:intra:single";  
+    prefix test ;  
+    
+    import test2 {
+       prefix test2;
+    }
+   
+    include test1;
+
+    organization "";  
+    contact "";  
+       
+    description   
+        "Defines basic service types for L3VPN service.";  
+       
+    revision "2015-12-16" {  
+        reference "";  
+    }  
+
+    augment /test2:cont1/test2:cont2/cont2 {
+       leaf a {
+          type int32;
+       }
+    }
+}
+    
diff --git a/compiler/plugin/maven/src/test/resources/xPathLinker/InterFile/InterSingleSubModule/test1.yang b/compiler/plugin/maven/src/test/resources/xPathLinker/InterFile/InterSingleSubModule/test1.yang
new file mode 100644
index 0000000..ebc8750
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/xPathLinker/InterFile/InterSingleSubModule/test1.yang
@@ -0,0 +1,31 @@
+submodule test1 {  
+
+    belongs-to test {
+         prefix test;
+    }           
+    
+    import test2 {
+       prefix test2;
+    }
+    organization "";  
+    contact "";  
+       
+    description   
+        "Defines basic service types for L3VPN service.";  
+       
+    revision "2015-12-16" {  
+        reference "";  
+    }  
+
+    augment /test2:cont1/test2:cont2 {
+       leaf a {
+          type int32;
+       }
+       container cont2 {
+          leaf leaf1 {
+             type int32;
+          }
+       }
+    }
+}
+    
diff --git a/compiler/plugin/maven/src/test/resources/xPathLinker/InterFile/InterSingleSubModule/test2.yang b/compiler/plugin/maven/src/test/resources/xPathLinker/InterFile/InterSingleSubModule/test2.yang
new file mode 100644
index 0000000..f20ac7d
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/xPathLinker/InterFile/InterSingleSubModule/test2.yang
@@ -0,0 +1,26 @@
+module test2 {  
+    namespace "xpath:inter:multi";  
+    prefix test2 ;  
+      
+    organization "";  
+    contact "";  
+       
+    description   
+        "Defines basic service types for L3VPN service.";  
+       
+    revision "2015-12-16" {  
+        reference "";  
+    }  
+
+    container cont1 {
+       leaf leaf1 {
+          type int32;
+       }
+       container cont2 {
+          leaf leaf1 {
+             type int32;
+          }
+       }
+    }
+}
+    
diff --git a/compiler/plugin/maven/src/test/resources/xPathLinker/InterFile/InterSingleUses/test.yang b/compiler/plugin/maven/src/test/resources/xPathLinker/InterFile/InterSingleUses/test.yang
new file mode 100644
index 0000000..15a6fab
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/xPathLinker/InterFile/InterSingleUses/test.yang
@@ -0,0 +1,34 @@
+module test {  
+    namespace "xpath:intra:single";  
+    prefix test ;  
+    
+    import test2 {
+       prefix test2;
+    }
+   
+    include test1;
+
+    organization "";  
+    contact "";  
+       
+    description   
+        "Defines basic service types for L3VPN service.";  
+       
+    revision "2015-12-16" {  
+        reference "";  
+    }
+
+    augment /test2:cont1/test2:cont2/cont2 {
+       leaf leaf {
+          type int32;
+       }
+       uses group1; 
+    }
+
+    augment /test2:cont1/test2:cont2/cont2/cont1/cont2 {
+          leaf leaf1 {
+          type int32;
+       }
+    } 
+}
+    
diff --git a/compiler/plugin/maven/src/test/resources/xPathLinker/InterFile/InterSingleUses/test1.yang b/compiler/plugin/maven/src/test/resources/xPathLinker/InterFile/InterSingleUses/test1.yang
new file mode 100644
index 0000000..e7fbc31
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/xPathLinker/InterFile/InterSingleUses/test1.yang
@@ -0,0 +1,42 @@
+submodule test1 {  
+
+    belongs-to test {
+         prefix test;
+    }           
+    
+    import test2 {
+       prefix test2;
+    }
+    organization "";  
+    contact "";  
+       
+    description   
+        "Defines basic service types for L3VPN service.";  
+       
+    revision "2015-12-16" {  
+        reference "";  
+    }  
+
+
+    grouping group1 {
+        container cont1 {
+           container cont2 {
+               leaf leaf2 {
+                  type string;
+               }
+           }
+        }
+    }
+
+    augment /test2:cont1/test2:cont2 {
+       leaf leaf3 {
+          type int32;
+       }
+       container cont2 {
+          leaf leaf1 {
+             type int32;
+          }
+       }
+    }
+}
+    
diff --git a/compiler/plugin/maven/src/test/resources/xPathLinker/InterFile/InterSingleUses/test2.yang b/compiler/plugin/maven/src/test/resources/xPathLinker/InterFile/InterSingleUses/test2.yang
new file mode 100644
index 0000000..2905f9a
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/xPathLinker/InterFile/InterSingleUses/test2.yang
@@ -0,0 +1,26 @@
+module test2 {  
+    namespace "xpath:inter:multi";  
+    prefix test2 ;  
+      
+    organization "";  
+    contact "";  
+       
+    description   
+        "Defines basic service types for L3VPN service.";  
+       
+    revision "2015-12-16" {  
+        reference "";  
+    }  
+
+    container cont1 {
+       leaf leaf4 {
+          type int32;
+       }
+       container cont2 {
+          leaf leaf5 {
+             type int32;
+          }
+       }
+    }
+}
+    
diff --git a/compiler/plugin/maven/src/test/resources/xPathLinker/IntraFile/IntraMulti/test.yang b/compiler/plugin/maven/src/test/resources/xPathLinker/IntraFile/IntraMulti/test.yang
new file mode 100644
index 0000000..77d61b9
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/xPathLinker/IntraFile/IntraMulti/test.yang
@@ -0,0 +1,37 @@
+module test {  
+    namespace "xpath:intra:multi";  
+    prefix test ;  
+      
+    organization "";  
+    contact "";  
+       
+    description   
+        "Defines basic service types for L3VPN service.";  
+       
+    revision "2015-12-16" {  
+        reference "";  
+    }  
+
+    container cont1 {
+       leaf leaf1 {
+          type int32;
+       }
+       container cont2 {
+          leaf leaf2 {
+             type int32;
+          }
+          container cont3 {
+              leaf leaf3 {
+                type int32;
+             }
+          }
+       }
+    }
+
+    augment /cont1/cont2/cont3 {
+       leaf a {
+          type int32;
+       }
+    }
+}
+    
diff --git a/compiler/plugin/maven/src/test/resources/xPathLinker/IntraFile/IntraMultiAugment/withoutprefix/test.yang b/compiler/plugin/maven/src/test/resources/xPathLinker/IntraFile/IntraMultiAugment/withoutprefix/test.yang
new file mode 100644
index 0000000..b634ab6
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/xPathLinker/IntraFile/IntraMultiAugment/withoutprefix/test.yang
@@ -0,0 +1,53 @@
+module test {
+    namespace "xpath:intra:multi";
+    prefix test ;
+
+    organization "";
+    contact "";
+
+    description
+        "Defines basic service types for L3VPN service.";
+
+    revision "2015-12-16" {
+        reference "";
+    }
+
+    container cont1 {
+       leaf leaf1 {
+          type int32;
+       }
+       container cont2 {
+          leaf leaf2 {
+             type int32;
+          }
+          container cont3 {
+              leaf leaf3 {
+                type int32;
+             }
+          }
+       }
+    }
+
+    augment /cont1/cont2/cont3 {
+       leaf a {
+          type int32;
+       }
+       container cont4 {
+          leaf leaf2 {
+             type int32;
+          }
+       }
+    }
+
+    augment /cont1/cont2/cont3/cont4 {
+       leaf a {
+          type int32;
+       }
+
+       container cont5 {
+           leaf leaf1 {
+             type int32;
+          }
+       }
+    }
+}
diff --git a/compiler/plugin/maven/src/test/resources/xPathLinker/IntraFile/IntraMultiAugment/withpartialprefix/augmentpartialprefix.yang b/compiler/plugin/maven/src/test/resources/xPathLinker/IntraFile/IntraMultiAugment/withpartialprefix/augmentpartialprefix.yang
new file mode 100644
index 0000000..7a84927
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/xPathLinker/IntraFile/IntraMultiAugment/withpartialprefix/augmentpartialprefix.yang
@@ -0,0 +1,44 @@
+module agumentpartial {
+    namespace "http://example.com/augment1";
+    prefix "au";
+    container interfaces {
+        list ifEntry {
+            key "ifIndex";
+            leaf ifIndex {
+                type uint32;
+            }
+            leaf ifDescr {
+                type string;
+            }
+            leaf ifType {
+                type int32;
+            }
+            leaf ifMtu {
+                type int32;
+            }
+        }
+    }
+    augment "/au:interfaces/au:ifEntry" {
+        when "au:ifType='ds0'";
+        leaf ifType1 {
+            type int8;
+        }
+        leaf uid {
+            type uint16;
+        }
+        container sub_interfaces {
+            list ifEntry1 {
+                key "ifIndex1";
+                leaf ifIndex1 {
+                    type uint32;
+                }
+            }
+        }
+    }
+
+    augment "/interfaces/au:ifEntry/au:sub_interfaces/ifEntry1" {
+        leaf ifType2{
+            type int8;
+        }
+    }
+}
\ No newline at end of file
diff --git a/compiler/plugin/maven/src/test/resources/xPathLinker/IntraFile/IntraMultiAugment/withprefix/augment.yang b/compiler/plugin/maven/src/test/resources/xPathLinker/IntraFile/IntraMultiAugment/withprefix/augment.yang
new file mode 100644
index 0000000..be666b3
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/xPathLinker/IntraFile/IntraMultiAugment/withprefix/augment.yang
@@ -0,0 +1,46 @@
+module agument {
+    namespace "http://example.com/augment1";
+    prefix "au";
+    container interfaces {
+        list ifEntry {
+            key "ifIndex";
+            leaf ifIndex {
+                type uint32;
+            }
+            leaf ifDescr {
+                type string;
+            }
+            leaf ifType {
+                type int32;
+            }
+            leaf ifMtu {
+                type int32;
+            }
+        }
+    }
+    augment "/au:interfaces/au:ifEntry" {
+        when "au:ifType='ds0'";
+        leaf ifType1 {
+            type int8;
+        }
+        leaf uid {
+            type uint16 {
+                range "1000 .. 30000";
+            }
+        }
+        container sub_interfaces {
+            list ifEntry1 {
+                key "ifIndex1";
+                leaf ifIndex1 {
+                    type uint32;
+                }
+            }
+        }
+    }
+
+    augment "/au:interfaces/au:ifEntry/au:sub_interfaces/au:ifEntry1" {
+        leaf ifType2{
+            type int8;
+        }
+    }
+}
\ No newline at end of file
diff --git a/compiler/plugin/maven/src/test/resources/xPathLinker/IntraFile/IntraMultiSubModule/test.yang b/compiler/plugin/maven/src/test/resources/xPathLinker/IntraFile/IntraMultiSubModule/test.yang
new file mode 100644
index 0000000..b5d1c8d
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/xPathLinker/IntraFile/IntraMultiSubModule/test.yang
@@ -0,0 +1,28 @@
+module test {  
+    namespace "xpath:intra:multi";  
+    prefix test ;  
+    
+    include test1;
+    organization "";  
+    contact "";  
+       
+    description   
+        "Defines basic service types for L3VPN service.";  
+       
+    revision "2015-12-16" {  
+        reference "";  
+    }  
+
+    container cont1 {
+       leaf leaf1 {
+          type int32;
+       }
+    }
+
+    augment /cont2/cont3 {
+       leaf a {
+          type int32;
+       }
+    }
+}
+    
diff --git a/compiler/plugin/maven/src/test/resources/xPathLinker/IntraFile/IntraMultiSubModule/test1.yang b/compiler/plugin/maven/src/test/resources/xPathLinker/IntraFile/IntraMultiSubModule/test1.yang
new file mode 100644
index 0000000..faf672e
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/xPathLinker/IntraFile/IntraMultiSubModule/test1.yang
@@ -0,0 +1,28 @@
+submodule test1 {  
+
+    belongs-to "test" {
+         prefix "test";
+    }           
+      
+    organization "";  
+    contact "";  
+       
+    description   
+        "Defines basic service types for L3VPN service.";  
+       
+    revision "2015-12-16" {  
+        reference "";  
+    }  
+
+    container cont2 {
+       leaf leaf1 {
+          type int32;
+       }
+       container cont3 {
+           leaf leaf3 {
+             type int32;
+          }
+       }
+    }
+}
+    
diff --git a/compiler/plugin/maven/src/test/resources/xPathLinker/IntraFile/IntraMultiUses/test.yang b/compiler/plugin/maven/src/test/resources/xPathLinker/IntraFile/IntraMultiUses/test.yang
new file mode 100644
index 0000000..6d7473d
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/xPathLinker/IntraFile/IntraMultiUses/test.yang
@@ -0,0 +1,38 @@
+module test {  
+    namespace "xpath:intra:single";  
+    prefix test ;  
+      
+    organization "";  
+    contact "";  
+       
+    description   
+        "Defines basic service types for L3VPN service.";  
+       
+    revision "2015-12-16" {  
+        reference "";  
+    }  
+
+    grouping group1 {
+        container cont1 {
+           leaf leaf1 {
+             type int32;
+           }
+           container cont3 {
+               leaf leaf1 {
+                 type int32;
+              }
+           }
+        }
+    }
+
+    container cont2 {
+         uses group1;
+    }
+
+    augment /cont2/cont1/cont3 {
+       leaf a {
+          type int32;
+       }
+    }
+}
+    
diff --git a/compiler/plugin/maven/src/test/resources/xPathLinker/IntraFile/IntraSingle/test.yang b/compiler/plugin/maven/src/test/resources/xPathLinker/IntraFile/IntraSingle/test.yang
new file mode 100644
index 0000000..95d9c2b
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/xPathLinker/IntraFile/IntraSingle/test.yang
@@ -0,0 +1,27 @@
+module test {  
+    namespace "xpath:intra:single";  
+    prefix test ;  
+      
+    organization "";  
+    contact "";  
+       
+    description   
+        "Defines basic service types for L3VPN service.";  
+       
+    revision "2015-12-16" {  
+        reference "";  
+    }  
+
+    container cont1 {
+       leaf leaf1 {
+          type int32;
+       }
+    }
+
+    augment /cont1 {
+       leaf a {
+          type int32;
+       }
+    }
+}
+    
diff --git a/compiler/plugin/maven/src/test/resources/xPathLinker/IntraFile/IntraSingleAugment/test.yang b/compiler/plugin/maven/src/test/resources/xPathLinker/IntraFile/IntraSingleAugment/test.yang
new file mode 100644
index 0000000..2925dcf
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/xPathLinker/IntraFile/IntraSingleAugment/test.yang
@@ -0,0 +1,39 @@
+module test {  
+    namespace "xpath:intra:single";  
+    prefix test ;  
+      
+    organization "";  
+    contact "";  
+       
+    description   
+        "Defines basic service types for L3VPN service.";  
+       
+    revision "2015-12-16" {  
+        reference "";  
+    }  
+
+    container cont1 {
+       leaf leaf1 {
+          type int32;
+       }
+    }
+
+    augment /cont1 {
+       leaf a {
+          type int32;
+       }
+
+       container cont2 {
+           leaf leaf1 {
+             type int32;
+          }
+       }
+    }
+
+    augment /cont1/cont2 {
+       leaf a {
+          type int32;
+       }
+    }
+}
+    
diff --git a/compiler/plugin/maven/src/test/resources/xPathLinker/IntraFile/IntraSingleSubModule/test.yang b/compiler/plugin/maven/src/test/resources/xPathLinker/IntraFile/IntraSingleSubModule/test.yang
new file mode 100644
index 0000000..77401da
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/xPathLinker/IntraFile/IntraSingleSubModule/test.yang
@@ -0,0 +1,28 @@
+module test {  
+    namespace "xpath:intra:single";  
+    prefix test ;  
+    
+    include test1;
+    organization "";  
+    contact "";  
+       
+    description   
+        "Defines basic service types for L3VPN service.";  
+       
+    revision "2015-12-16" {  
+        reference "";  
+    }  
+
+    container cont1 {
+       leaf leaf1 {
+          type int32;
+       }
+    }
+
+    augment /cont2 {
+       leaf a {
+          type int32;
+       }
+    }
+}
+    
diff --git a/compiler/plugin/maven/src/test/resources/xPathLinker/IntraFile/IntraSingleSubModule/test1.yang b/compiler/plugin/maven/src/test/resources/xPathLinker/IntraFile/IntraSingleSubModule/test1.yang
new file mode 100644
index 0000000..47d4c5c
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/xPathLinker/IntraFile/IntraSingleSubModule/test1.yang
@@ -0,0 +1,23 @@
+submodule test1 {  
+
+    belongs-to test {
+         prefix test;
+    }           
+      
+    organization "";  
+    contact "";  
+       
+    description   
+        "Defines basic service types for L3VPN service.";  
+       
+    revision "2015-12-16" {  
+        reference "";  
+    }  
+
+    container cont2 {
+       leaf leaf1 {
+          type int32;
+       }
+    }
+}
+    
diff --git a/compiler/plugin/maven/src/test/resources/xPathLinker/IntraFile/IntraSingleUses/test.yang b/compiler/plugin/maven/src/test/resources/xPathLinker/IntraFile/IntraSingleUses/test.yang
new file mode 100644
index 0000000..3074db7
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/xPathLinker/IntraFile/IntraSingleUses/test.yang
@@ -0,0 +1,33 @@
+module test {  
+    namespace "xpath:intra:single";  
+    prefix test ;  
+      
+    organization "";  
+    contact "";  
+       
+    description   
+        "Defines basic service types for L3VPN service.";  
+       
+    revision "2015-12-16" {  
+        reference "";  
+    }  
+
+    grouping group1 {
+        container cont1 {
+           leaf leaf1 {
+             type int32;
+           }
+        }
+    }
+
+    container cont2 {
+         uses group1;
+    }
+
+    augment /cont2/cont1 {
+       leaf a {
+          type int32;
+       }
+    }
+}
+    
diff --git a/compiler/plugin/pom.xml b/compiler/plugin/pom.xml
new file mode 100644
index 0000000..fd23dfc
--- /dev/null
+++ b/compiler/plugin/pom.xml
@@ -0,0 +1,73 @@
+<!--
+  ~ 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-yang-compiler</artifactId>
+        <version>1.12-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>onos-yang-compiler-plugin</artifactId>
+    <packaging>pom</packaging>
+
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    </properties>
+
+    <modules>
+        <module>maven</module>
+        <module>buck</module>
+    </modules>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.onosproject</groupId>
+            <artifactId>onos-yang-compiler-datamodel</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.onosproject</groupId>
+            <artifactId>onos-yang-compiler-parser</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.onosproject</groupId>
+            <artifactId>onos-yang-compiler-translator</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.onosproject</groupId>
+            <artifactId>onos-yang-compiler-utils</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.onosproject</groupId>
+            <artifactId>onos-yang-compiler-linker</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.onosproject</groupId>
+            <artifactId>onos-yang-compiler-datamodel</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+    </dependencies>
+</project>
+
+
diff --git a/compiler/pom.xml b/compiler/pom.xml
new file mode 100644
index 0000000..ce76fea
--- /dev/null
+++ b/compiler/pom.xml
@@ -0,0 +1,74 @@
+<!--
+  ~ 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-yang-tools</artifactId>
+        <version>1.12-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>onos-yang-compiler</artifactId>
+    <packaging>pom</packaging>
+
+    <modules>
+        <module>api</module>
+        <module>base</module>
+        <module>plugin</module>
+    </modules>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.onosproject</groupId>
+            <artifactId>onos-yang-model</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>commons-io</groupId>
+            <artifactId>commons-io</artifactId>
+            <version>2.4</version>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+            <version>1.7.21</version>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-jar-plugin</artifactId>
+                <version>3.0.2</version>
+                <configuration>
+                    <skipIfEmpty>true</skipIfEmpty>
+                </configuration>
+                <executions>
+                    <execution>
+                        <id>default</id>
+                        <goals>
+                            <goal>test-jar</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+</project>