[ONOS-4583] Union defect fix.

Change-Id: Ic31866b9a1b7bd5d8209d5d22f4292ab9c79a118
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/linker/impl/YangXpathLinker.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/linker/impl/YangXpathLinker.java
index 3f4c7bf..25635e5 100644
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/linker/impl/YangXpathLinker.java
+++ b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/linker/impl/YangXpathLinker.java
@@ -75,7 +75,7 @@
      *
      * @return prefix resolver list
      */
-    public Map<YangAtomicPath, PrefixResolverType> getPrefixResolverTypes() {
+    private Map<YangAtomicPath, PrefixResolverType> getPrefixResolverTypes() {
         return prefixResolverTypes;
     }
 
@@ -84,7 +84,7 @@
      *
      * @param prefixResolverTypes prefix resolver list.
      */
-    public void setPrefixResolverTypes(Map<YangAtomicPath, PrefixResolverType> prefixResolverTypes) {
+    private void setPrefixResolverTypes(Map<YangAtomicPath, PrefixResolverType> prefixResolverTypes) {
         this.prefixResolverTypes = prefixResolverTypes;
     }
 
@@ -188,7 +188,7 @@
      * @param leafref  instance of YANG leafref
      * @return linked target node
      */
-    public T processLeafRefXpathLinking(List<YangAtomicPath> atomicPaths, YangNode root, YangLeafRef leafref) {
+    T processLeafRefXpathLinking(List<YangAtomicPath> atomicPaths, YangNode root, YangLeafRef leafref) {
 
         YangNode targetNode;
         setRootNode(root);
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/plugin/manager/YangUtilManager.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/plugin/manager/YangUtilManager.java
index 0b9c440..3e58009 100644
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/plugin/manager/YangUtilManager.java
+++ b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/plugin/manager/YangUtilManager.java
@@ -17,9 +17,12 @@
 package org.onosproject.yangutils.plugin.manager;
 
 import java.io.IOException;
+import java.util.Collections;
 import java.util.HashSet;
+import java.util.LinkedList;
 import java.util.List;
 import java.util.Set;
+
 import org.apache.maven.artifact.repository.ArtifactRepository;
 import org.apache.maven.plugin.AbstractMojo;
 import org.apache.maven.plugin.MojoExecutionException;
@@ -42,7 +45,6 @@
 
 import static org.apache.maven.plugins.annotations.LifecyclePhase.GENERATE_SOURCES;
 import static org.apache.maven.plugins.annotations.ResolutionScope.COMPILE;
-import static org.onosproject.yangutils.linker.impl.YangLinkerUtils.updateFilePriority;
 import static org.onosproject.yangutils.plugin.manager.YangPluginUtils.addToCompilationRoot;
 import static org.onosproject.yangutils.plugin.manager.YangPluginUtils.copyYangFilesToTarget;
 import static org.onosproject.yangutils.plugin.manager.YangPluginUtils.resolveInterJarDependencies;
@@ -68,6 +70,7 @@
         extends AbstractMojo {
 
     private static final String DEFAULT_PKG = SLASH + getPackageDirPathFromJavaJPackage(DEFAULT_BASE_PKG);
+    YangPluginConfig yangPlugin = new YangPluginConfig();
     private YangNode rootNode;
     // YANG file information set.
     private Set<YangFileInfo> yangFileInfoSet = new HashSet<>();
@@ -181,7 +184,6 @@
             conflictResolver.setReplacementForHyphen(replacementForHyphen);
             conflictResolver.setReplacementForUnderscore(replacementForUnderscore);
             conflictResolver.setPrefixForIdentifier(prefixForIdentifier);
-            YangPluginConfig yangPlugin = new YangPluginConfig();
             yangPlugin.setCodeGenDir(codeGenDir);
             yangPlugin.setManagerCodeGenDir(managerCodeGenDir);
             yangPlugin.setConflictResolver(conflictResolver);
@@ -223,7 +225,7 @@
                 fileName = getCurYangFileInfo().getYangFileName();
             }
             try {
-                translatorErrorHandler(getRootNode());
+                translatorErrorHandler(getRootNode(), yangPlugin);
                 deleteDirectory(getDirectory(baseDir, classFileDir) + DEFAULT_PKG);
             } catch (IOException ex) {
                 throw new MojoExecutionException(
@@ -348,8 +350,10 @@
      */
     public void translateToJava(YangPluginConfig yangPlugin)
             throws IOException {
-        updateFilePriority(getYangNodeSet());
-        for (YangNode node : getYangNodeSet()) {
+        List<YangNode> yangNodeSortedList = new LinkedList<>();
+        yangNodeSortedList.addAll(getYangNodeSet());
+        Collections.sort(yangNodeSortedList);
+        for (YangNode node : yangNodeSortedList) {
             if (node.isToTranslate()) {
                 generateJavaCode(node, yangPlugin);
             }
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/GeneratedTempFileType.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/GeneratedTempFileType.java
index 87e4679..2ffd282 100644
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/GeneratedTempFileType.java
+++ b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/GeneratedTempFileType.java
@@ -122,11 +122,6 @@
     public static final int EVENT_SUBJECT_SETTER_MASK = 524288;
 
     /**
-     * Event subject setter implementation of class.
-     */
-    public static final int AUGMENTE_CLASS_CONSTRUCTOR_MASK = 1048576;
-
-    /**
      * Creates an instance of generated temp file type.
      */
     private GeneratedTempFileType() {
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/JavaAttributeInfo.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/JavaAttributeInfo.java
index 485878b..c6b3bb7 100644
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/JavaAttributeInfo.java
+++ b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/JavaAttributeInfo.java
@@ -51,6 +51,16 @@
     private JavaQualifiedTypeInfo importInfo;
 
     /**
+     * If conflict occurs.
+     */
+    private boolean isIntConflict;
+
+    /**
+     * If conflict occurs.
+     */
+    private boolean isLongConflict;
+
+    /**
      * Creates a java attribute info object.
      */
     private JavaAttributeInfo() {
@@ -175,6 +185,42 @@
     }
 
     /**
+     * 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
+     */
+    public 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
+     */
+    public void setLongConflict(boolean longConflict) {
+        isLongConflict = longConflict;
+    }
+
+    /**
      * Returns java attribute info.
      *
      * @param importInfo java qualified type info
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/JavaCodeGeneratorUtil.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/JavaCodeGeneratorUtil.java
index 04bb2e2..79857eb 100644
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/JavaCodeGeneratorUtil.java
+++ b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/JavaCodeGeneratorUtil.java
@@ -17,6 +17,7 @@
 package org.onosproject.yangutils.translator.tojava;
 
 import java.io.IOException;
+
 import org.onosproject.yangutils.datamodel.TraversalType;
 import org.onosproject.yangutils.datamodel.YangNode;
 import org.onosproject.yangutils.translator.exception.InvalidNodeForTranslatorException;
@@ -27,6 +28,7 @@
 import static org.onosproject.yangutils.datamodel.TraversalType.PARENT;
 import static org.onosproject.yangutils.datamodel.TraversalType.ROOT;
 import static org.onosproject.yangutils.datamodel.TraversalType.SIBILING;
+import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.searchAndDeleteTempDir;
 
 /**
  * Representation of java code generator based on application schema.
@@ -39,6 +41,11 @@
     private static YangNode curNode;
 
     /**
+     * Root node.
+     */
+    private static YangNode rootNode;
+
+    /**
      * Creates a java code generator utility object.
      */
     private JavaCodeGeneratorUtil() {
@@ -67,13 +74,14 @@
      *
      * @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 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 {
+            throws TranslatorException, IOException {
 
         YangNode codeGenNode = rootNode;
+        setRootNode(rootNode);
         TraversalType curTraversal = ROOT;
 
         while (codeGenNode != null) {
@@ -94,6 +102,7 @@
                     }
                     continue;
                 } catch (Exception e) {
+                    close(codeGenNode, yangPlugin);
                     throw new TranslatorException(e.getMessage());
                 }
 
@@ -103,16 +112,18 @@
                 codeGenNode = codeGenNode.getChild();
             } else if (codeGenNode.getNextSibling() != null) {
                 try {
-                    generateCodeExit(codeGenNode);
+                    generateCodeExit(codeGenNode, yangPlugin);
                 } catch (Exception e) {
+                    close(codeGenNode, yangPlugin);
                     throw new TranslatorException(e.getMessage());
                 }
                 curTraversal = SIBILING;
                 codeGenNode = codeGenNode.getNextSibling();
             } else {
                 try {
-                    generateCodeExit(codeGenNode);
+                    generateCodeExit(codeGenNode, yangPlugin);
                 } catch (Exception e) {
+                    close(codeGenNode, yangPlugin);
                     throw new TranslatorException(e.getMessage());
                 }
                 curTraversal = PARENT;
@@ -124,18 +135,18 @@
     /**
      * Generates the current nodes code snippet.
      *
-     * @param codeGenNode current data model node for which the code needs to be
-     *                    generated
+     * @param codeGenNode current data model node for which the code needs to be generated
      * @param yangPlugin  YANG plugin config
-     * @throws TranslatorException when fails to generate java code file the current
-     *                             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)
-            throws TranslatorException {
+            throws TranslatorException, IOException {
 
         if (codeGenNode instanceof JavaCodeGenerator) {
             ((JavaCodeGenerator) codeGenNode).generateCodeEntry(yangPlugin);
         } else {
+            close(codeGenNode, yangPlugin);
             throw new TranslatorException(
                     "Generated data model node cannot be translated to target language code");
         }
@@ -144,25 +155,25 @@
     /**
      * Generates the current nodes code target code from the snippet.
      *
-     * @param codeGenNode current data model node for which the code needs to be
-     *                    generated
-     * @throws TranslatorException when fails to generate java code file the current
-     *                             node
+     * @param codeGenNode  current data model node for which the code needs to be generated
+     * @param pluginConfig plugin configurations
+     * @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)
-            throws TranslatorException {
+    private static void generateCodeExit(YangNode codeGenNode, YangPluginConfig pluginConfig)
+            throws TranslatorException, IOException {
 
         if (codeGenNode instanceof JavaCodeGenerator) {
             ((JavaCodeGenerator) codeGenNode).generateCodeExit();
         } else {
+            close(codeGenNode, pluginConfig);
             throw new TranslatorException(
                     "Generated data model node cannot be translated to target language code");
         }
     }
 
     /**
-     * Free other YANG nodes of data-model tree when error occurs while file
-     * generation of current node.
+     * Free other YANG nodes of data-model tree when error occurs while file generation of current node.
      */
     private static void freeRestResources() {
 
@@ -214,21 +225,18 @@
     /**
      * Delete Java code files corresponding to the YANG schema.
      *
-     * @param rootNode root node of data-model tree
+     * @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)
+    public static void translatorErrorHandler(YangNode rootNode, YangPluginConfig yangPluginConfig)
             throws IOException {
 
         if (rootNode != null) {
-            /**
-             * Free other resources where translator has failed.
-             */
+            //Free other resources where translator has failed.
             freeRestResources();
 
-            /**
-             * Start removing all open files.
-             */
+            // Start removing all open files.
             YangNode tempNode = rootNode;
             setCurNode(tempNode.getChild());
             TraversalType curTraversal = ROOT;
@@ -236,7 +244,7 @@
             while (tempNode != null) {
 
                 if (curTraversal != PARENT) {
-                    close(tempNode);
+                    close(tempNode, yangPluginConfig);
                 }
                 if (curTraversal != PARENT && tempNode.getChild() != null) {
                     curTraversal = CHILD;
@@ -255,17 +263,45 @@
     }
 
     /**
-     * Closes all the current open file handles of node and delete all generated
-     * files.
+     * Closes all the current open file handles of node and delete all generated files.
      *
-     * @param node current YANG node
+     * @param node       current YANG node
+     * @param yangPlugin plugin configurations
      * @throws IOException when fails to do IO operations
      */
-    private static void close(YangNode node)
+    private static void close(YangNode node, YangPluginConfig yangPlugin)
             throws IOException {
         if (node instanceof JavaCodeGenerator && ((TempJavaCodeFragmentFilesContainer) node)
                 .getTempJavaCodeFragmentFiles() != null) {
             ((TempJavaCodeFragmentFilesContainer) node).getTempJavaCodeFragmentFiles().freeTemporaryResources(true);
+        } else {
+
+            JavaFileInfo javaFileInfo = ((JavaFileInfoContainer) getRootNode()).getJavaFileInfo();
+            if (javaFileInfo != null) {
+                searchAndDeleteTempDir(javaFileInfo.getBaseCodeGenPath() +
+                        javaFileInfo.getPackageFilePath());
+            } else {
+                searchAndDeleteTempDir(yangPlugin.getManagerCodeGenDir());
+            }
+
         }
     }
+
+    /**
+     * Returns root node.
+     *
+     * @return root node
+     */
+    private static YangNode getRootNode() {
+        return rootNode;
+    }
+
+    /**
+     * Sets root node.
+     *
+     * @param rootNode root node
+     */
+    private static void setRootNode(YangNode rootNode) {
+        JavaCodeGeneratorUtil.rootNode = rootNode;
+    }
 }
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/JavaImportData.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/JavaImportData.java
index e55e7ad..abccc4c 100644
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/JavaImportData.java
+++ b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/JavaImportData.java
@@ -21,6 +21,7 @@
 import java.util.TreeSet;
 
 import static org.onosproject.yangutils.utils.UtilConstants.ABSTRACT_EVENT;
+import static org.onosproject.yangutils.utils.UtilConstants.BIG_INTEGER;
 import static org.onosproject.yangutils.utils.UtilConstants.YANG_AUGMENTED_INFO_CLASS_IMPORT_CLASS;
 import static org.onosproject.yangutils.utils.UtilConstants.YANG_AUGMENTED_INFO_CLASS_IMPORT_PKG;
 import static org.onosproject.yangutils.utils.UtilConstants.COLLECTION_IMPORTS;
@@ -31,6 +32,7 @@
 import static org.onosproject.yangutils.utils.UtilConstants.HASH_MAP;
 import static org.onosproject.yangutils.utils.UtilConstants.IMPORT;
 import static org.onosproject.yangutils.utils.UtilConstants.JAVA_LANG;
+import static org.onosproject.yangutils.utils.UtilConstants.JAVA_MATH;
 import static org.onosproject.yangutils.utils.UtilConstants.JAVA_UTIL_OBJECTS_IMPORT_CLASS;
 import static org.onosproject.yangutils.utils.UtilConstants.BITSET;
 import static org.onosproject.yangutils.utils.UtilConstants.JAVA_UTIL_OBJECTS_IMPORT_PKG;
@@ -300,4 +302,14 @@
         return IMPORT + YANG_AUGMENTED_INFO_CLASS_IMPORT_PKG + PERIOD +
                 YANG_AUGMENTED_OP_PARAM_INFO_CLASS;
     }
+
+    /**
+     * Returns import for big integer.
+     *
+     * @return import for big integer
+     */
+    public String getBigIntegerImport() {
+        return IMPORT + JAVA_MATH + PERIOD +
+                BIG_INTEGER + SEMI_COLAN + NEW_LINE;
+    }
 }
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaBeanFragmentFiles.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaBeanFragmentFiles.java
index 39ce34f..a70f579 100644
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaBeanFragmentFiles.java
+++ b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaBeanFragmentFiles.java
@@ -48,7 +48,7 @@
      * @param javaFileInfo generated java file info
      * @throws IOException when fails to create new file handle
      */
-    public TempJavaBeanFragmentFiles(JavaFileInfo javaFileInfo)
+    TempJavaBeanFragmentFiles(JavaFileInfo javaFileInfo)
             throws IOException {
 
         super(javaFileInfo);
@@ -109,9 +109,7 @@
     /**
      * Removes all temporary file handles.
      *
-     * @param isErrorOccurred when translator fails to generate java files we
-     * need to close all open file handles include temporary files
-     * and java files.
+     * @param isErrorOccurred flag to tell translator that error has occurred while code generation
      * @throws IOException when failed to delete the temporary files
      */
     @Override
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaCodeFragmentFiles.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaCodeFragmentFiles.java
index 48f8c07..90b2daf 100644
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaCodeFragmentFiles.java
+++ b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaCodeFragmentFiles.java
@@ -346,6 +346,10 @@
             getServiceTempFiles().freeTemporaryResources(isErrorOccurred);
         }
 
+        if (getEventFragmentFiles() != null) {
+            getEventFragmentFiles().freeTemporaryResources(isErrorOccurred);
+        }
+
     }
 
 }
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaEnumerationFragmentFiles.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaEnumerationFragmentFiles.java
index 09471cd..087788d 100644
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaEnumerationFragmentFiles.java
+++ b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaEnumerationFragmentFiles.java
@@ -43,8 +43,8 @@
 import static org.onosproject.yangutils.translator.tojava.utils.JavaIdentifierSyntax.createPackage;
 
 /**
- * Represents implementation of java code fragments temporary implementations.
- * Maintains the temp files required specific for enumeration java snippet generation.
+ * Represents implementation of java code fragments temporary implementations. Maintains the temp files required
+ * specific for enumeration java snippet generation.
  */
 public class TempJavaEnumerationFragmentFiles extends TempJavaFragmentFiles {
 
@@ -89,7 +89,7 @@
      * @param javaFileInfo generated java file info
      * @throws IOException when fails to create new file handle
      */
-    public TempJavaEnumerationFragmentFiles(JavaFileInfo javaFileInfo)
+    TempJavaEnumerationFragmentFiles(JavaFileInfo javaFileInfo)
             throws IOException {
 
         super(javaFileInfo);
@@ -107,7 +107,7 @@
      *
      * @return enum class java file handle
      */
-    public File getEnumClassJavaFileHandle() {
+    private File getEnumClassJavaFileHandle() {
         return enumClassJavaFileHandle;
     }
 
@@ -188,18 +188,18 @@
     /**
      * Adds enum attributes to temporary files.
      *
-     * @param curNode current YANG node
+     * @param curNode      current YANG node
      * @param pluginConfig plugin configurations
      * @throws IOException when fails to do IO operations
      */
-    public void addEnumAttributeToTempFiles(YangNode curNode, YangPluginConfig pluginConfig) throws IOException {
+    void addEnumAttributeToTempFiles(YangNode curNode, YangPluginConfig pluginConfig) throws IOException {
 
         super.addJavaSnippetInfoToApplicableTempFiles(getJavaAttributeForEnum(pluginConfig), pluginConfig);
         if (curNode instanceof YangEnumeration) {
             YangEnumeration enumeration = (YangEnumeration) curNode;
             for (YangEnum curEnum : enumeration.getEnumSet()) {
                 String enumName = curEnum.getNamedValue();
-                String prefixForIdentifier = null;
+                String prefixForIdentifier;
                 if (enumName.matches(REGEX_FOR_FIRST_DIGIT)) {
                     prefixForIdentifier = getPrefixForIdentifier(pluginConfig.getConflictResolver());
                     if (prefixForIdentifier != null) {
@@ -219,11 +219,11 @@
     }
 
     /**
-    * Returns java attribute for enum class.
-    *
-    * @param pluginConfig plugin configurations
-    * @return java attribute
-    */
+     * Returns java attribute for enum class.
+     *
+     * @param pluginConfig plugin configurations
+     * @return java attribute
+     */
     public JavaAttributeInfo getJavaAttributeForEnum(YangPluginConfig pluginConfig) {
         YangJavaType<?> javaType = new YangJavaType<>();
         javaType.setDataType(YangDataTypes.INT32);
@@ -248,11 +248,10 @@
     /**
      * Adds the new attribute info to the target generated temporary files.
      *
-     * @param curEnumName the attribute name that needs to be added to temporary
-     * files
+     * @param curEnumName the attribute name that needs to be added to temporary files
      * @throws IOException IO operation fail
      */
-    void addJavaSnippetInfoToApplicableTempFiles(String curEnumName, YangPluginConfig pluginConfig)
+    private void addJavaSnippetInfoToApplicableTempFiles(String curEnumName, YangPluginConfig pluginConfig)
             throws IOException {
         addAttributesForEnumClass(getEnumJavaAttribute(curEnumName), pluginConfig);
     }
@@ -261,7 +260,7 @@
      * Constructs java code exit.
      *
      * @param fileType generated file type
-     * @param curNode current YANG node
+     * @param curNode  current YANG node
      * @throws IOException when fails to generate java files
      */
     @Override
@@ -275,9 +274,7 @@
     /**
      * Removes all temporary file handles.
      *
-     * @param isErrorOccurred when translator fails to generate java files we
-     * need to close all open file handles include temporary files
-     * and java files.
+     * @param isErrorOccurred flag to tell translator that error has occurred while file generation
      * @throws IOException when failed to delete the temporary files
      */
     @Override
@@ -310,7 +307,7 @@
      *
      * @param enumStringList the enumStringList to set
      */
-    public void setEnumStringList(List<String> enumStringList) {
+    private void setEnumStringList(List<String> enumStringList) {
         this.enumStringList = enumStringList;
     }
 }
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaEventFragmentFiles.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaEventFragmentFiles.java
index 446bce1..f225f06 100644
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaEventFragmentFiles.java
+++ b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaEventFragmentFiles.java
@@ -46,6 +46,7 @@
 import static org.onosproject.yangutils.utils.UtilConstants.FOUR_SPACE_INDENTATION;
 import static org.onosproject.yangutils.utils.UtilConstants.NEW_LINE;
 import static org.onosproject.yangutils.utils.UtilConstants.SLASH;
+import static org.onosproject.yangutils.utils.io.impl.FileSystemUtil.closeFile;
 import static org.onosproject.yangutils.utils.io.impl.JavaDocGen.JavaDocType.ENUM_ATTRIBUTE;
 import static org.onosproject.yangutils.utils.io.impl.JavaDocGen.JavaDocType.GETTER_METHOD;
 import static org.onosproject.yangutils.utils.io.impl.JavaDocGen.JavaDocType.MANAGER_SETTER_METHOD;
@@ -63,12 +64,11 @@
     /**
      * File name for generated class file for special type like union, typedef suffix.
      */
-    public static final String EVENT_SUBJECT_NAME_SUFFIX = "EventSubject";
+    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";
 
     /**
@@ -149,7 +149,7 @@
      * @param javaFileInfo generated file information
      * @throws IOException when fails to create new file handle
      */
-    public TempJavaEventFragmentFiles(JavaFileInfo javaFileInfo)
+    TempJavaEventFragmentFiles(JavaFileInfo javaFileInfo)
             throws IOException {
         setJavaExtendsListHolder(new JavaExtendsListHolder());
         setJavaImportData(new JavaImportData());
@@ -255,6 +255,9 @@
         generateEventJavaFile(curNode);
         generateEventListenerJavaFile(curNode);
         generateEventSubjectJavaFile(curNode);
+
+        // Close all the file handles.
+        freeTemporaryResources(false);
     }
 
     /**
@@ -263,7 +266,7 @@
      * @param curNode current YANG node
      * @throws IOException when fails to generate java files
      */
-    public void generateEventJavaFile(YangNode curNode)
+    private void generateEventJavaFile(YangNode curNode)
             throws IOException {
 
         List<String> imports = new ArrayList<>();
@@ -274,43 +277,10 @@
 
         addEnumMethod(nodeName, curNodeInfo + EVENT_SUBJECT_NAME_SUFFIX);
 
-        /**
-         * Creates event interface file.
-         */
+        //Creates event interface file.
         setEventJavaFileHandle(getJavaFileHandle(curNode, curNodeInfo + EVENT_FILE_NAME_SUFFIX));
         generateEventFile(getEventJavaFileHandle(), curNode, imports);
 
-        /**
-         * Close all the file handles.
-         */
-        freeTemporaryResources(false);
-    }
-
-    /**
-     * Constructs java code exit.
-     *
-     * @param curNode  current YANG node
-     * @throws IOException when fails to generate java files
-     */
-    public 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.
-         */
-        setEventListenerJavaFileHandle(
-                getJavaFileHandle(curNode, curNodeInfo + EVENT_LISTENER_FILE_NAME_SUFFIX));
-        generateEventListenerFile(getEventListenerJavaFileHandle(), curNode, imports);
-
-        /**
-         * Close all the file handles.
-         */
-        freeTemporaryResources(false);
     }
 
     /**
@@ -319,22 +289,39 @@
      * @param curNode current YANG node
      * @throws IOException when fails to generate java files
      */
-    public void generateEventSubjectJavaFile(YangNode curNode)
+    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.
+        setEventListenerJavaFileHandle(
+                getJavaFileHandle(curNode, curNodeInfo + EVENT_LISTENER_FILE_NAME_SUFFIX));
+        generateEventListenerFile(getEventListenerJavaFileHandle(), 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.
-         */
+
+        //Creates event interface file.
         setEventSubjectJavaFileHandle(getJavaFileHandle(curNode, curNodeInfo +
                 TempJavaEventFragmentFiles.EVENT_SUBJECT_NAME_SUFFIX));
         generateEventSubjectFile(getEventSubjectJavaFileHandle(), curNode);
 
-        /**
-         * Close all the file handles.
-         */
-        freeTemporaryResources(false);
     }
 
     /**
@@ -351,7 +338,7 @@
      *
      * @param eventEnumTempFileHandle event enum temp file
      */
-    public void setEventEnumTempFileHandle(File eventEnumTempFileHandle) {
+    private void setEventEnumTempFileHandle(File eventEnumTempFileHandle) {
         this.eventEnumTempFileHandle = eventEnumTempFileHandle;
     }
 
@@ -369,7 +356,7 @@
      *
      * @param eventMethodTempFileHandle event method temp file
      */
-    public void setEventMethodTempFileHandle(File eventMethodTempFileHandle) {
+    private void setEventMethodTempFileHandle(File eventMethodTempFileHandle) {
         this.eventMethodTempFileHandle = eventMethodTempFileHandle;
     }
 
@@ -387,7 +374,7 @@
      *
      * @param eventSubjectAttributeTempFileHandle event subject attribute temp file
      */
-    public void setEventSubjectAttributeTempFileHandle(File eventSubjectAttributeTempFileHandle) {
+    private void setEventSubjectAttributeTempFileHandle(File eventSubjectAttributeTempFileHandle) {
         this.eventSubjectAttributeTempFileHandle = eventSubjectAttributeTempFileHandle;
     }
 
@@ -405,7 +392,7 @@
      *
      * @param eventSubjectGetterTempFileHandle event subject getter temp file
      */
-    public void setEventSubjectGetterTempFileHandle(File eventSubjectGetterTempFileHandle) {
+    private void setEventSubjectGetterTempFileHandle(File eventSubjectGetterTempFileHandle) {
         this.eventSubjectGetterTempFileHandle = eventSubjectGetterTempFileHandle;
     }
 
@@ -423,7 +410,7 @@
      *
      * @param eventSubjectSetterTempFileHandle event subject setter temp file
      */
-    public void setEventSubjectSetterTempFileHandle(File eventSubjectSetterTempFileHandle) {
+    private void setEventSubjectSetterTempFileHandle(File eventSubjectSetterTempFileHandle) {
         this.eventSubjectSetterTempFileHandle = eventSubjectSetterTempFileHandle;
     }
 
@@ -434,7 +421,7 @@
      * @param pluginConfig plugin configurations
      * @throws IOException when fails to do IO operations
      */
-    public void addJavaSnippetOfEvent(YangNode curNode, YangPluginConfig pluginConfig)
+    void addJavaSnippetOfEvent(YangNode curNode, YangPluginConfig pluginConfig)
             throws IOException {
 
         String currentInfo = getCapitalCase(getCamelCase(curNode.getName(),
@@ -521,4 +508,28 @@
     private String getDirPath(JavaFileInfo 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(getEventJavaFileHandle(), isErrorOccurred);
+        closeFile(getEventListenerJavaFileHandle(), isErrorOccurred);
+        closeFile(getEventSubjectJavaFileHandle(), isErrorOccurred);
+
+        closeFile(getEventEnumTempFileHandle(), true);
+        closeFile(getEventSubjectAttributeTempFileHandle(), true);
+        closeFile(getEventMethodTempFileHandle(), true);
+        closeFile(getEventSubjectGetterTempFileHandle(), true);
+        closeFile(getEventSubjectSetterTempFileHandle(), true);
+
+        super.freeTemporaryResources(isErrorOccurred);
+
+    }
 }
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaFragmentFiles.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaFragmentFiles.java
index 33ca972..19c2d54 100644
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaFragmentFiles.java
+++ b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaFragmentFiles.java
@@ -47,7 +47,6 @@
 import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.INTERFACE_MASK;
 import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.OPERATION_BUILDER_CLASS_MASK;
 import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.ATTRIBUTES_MASK;
-import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.AUGMENTE_CLASS_CONSTRUCTOR_MASK;
 import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.EQUALS_IMPL_MASK;
 import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.FROM_STRING_IMPL_MASK;
 import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.GETTER_FOR_CLASS_MASK;
@@ -72,7 +71,6 @@
 import static org.onosproject.yangutils.translator.tojava.utils.JavaFileGeneratorUtils.addResolvedAugmentedDataNodeImports;
 import static org.onosproject.yangutils.translator.tojava.utils.JavaFileGeneratorUtils.getFileObject;
 import static org.onosproject.yangutils.translator.tojava.utils.JavaIdentifierSyntax.createPackage;
-import static org.onosproject.yangutils.translator.tojava.utils.MethodsGenerator.getAugmentedConstructor;
 import static org.onosproject.yangutils.translator.tojava.utils.MethodsGenerator.getBuildString;
 import static org.onosproject.yangutils.translator.tojava.utils.MethodsGenerator.getDefaultConstructorString;
 import static org.onosproject.yangutils.translator.tojava.utils.MethodsGenerator.getEqualsMethod;
@@ -92,7 +90,6 @@
 import static org.onosproject.yangutils.utils.UtilConstants.DEFAULT;
 import static org.onosproject.yangutils.utils.UtilConstants.EMPTY_STRING;
 import static org.onosproject.yangutils.utils.UtilConstants.FOUR_SPACE_INDENTATION;
-import static org.onosproject.yangutils.utils.UtilConstants.IMPL;
 import static org.onosproject.yangutils.utils.UtilConstants.IMPORT;
 import static org.onosproject.yangutils.utils.UtilConstants.INTERFACE;
 import static org.onosproject.yangutils.utils.UtilConstants.MANAGER;
@@ -106,7 +103,6 @@
 import static org.onosproject.yangutils.utils.UtilConstants.SEMI_COLAN;
 import static org.onosproject.yangutils.utils.UtilConstants.SERVICE;
 import static org.onosproject.yangutils.utils.UtilConstants.SLASH;
-import static org.onosproject.yangutils.utils.UtilConstants.YANG_AUGMENTED_INFO;
 import static org.onosproject.yangutils.utils.io.impl.FileSystemUtil.closeFile;
 import static org.onosproject.yangutils.utils.io.impl.FileSystemUtil.readAppendFile;
 import static org.onosproject.yangutils.utils.io.impl.JavaDocGen.JavaDocType.GETTER_METHOD;
@@ -138,7 +134,7 @@
     /**
      * Folder suffix for temporary files folder.
      */
-    private static final String TEMP_FOLDER_NAME_SUFIX = "-Temp";
+    private static final String TEMP_FOLDER_NAME_SUFFIX = "-Temp";
 
     /**
      * File name for getter method.
@@ -201,16 +197,6 @@
     private static final String BUILDER_CLASS_FILE_NAME_SUFFIX = BUILDER;
 
     /**
-     * File name for impl class file name suffix.
-     */
-    private static final String IMPL_CLASS_FILE_NAME_SUFFIX = IMPL;
-
-    /**
-     * File name for augment copy constructor method.
-     */
-    private static final String AUGMENT_CONSTRUCTOR_FILE_NAME = "AugmentConstructor";
-
-    /**
      * Information about the java files being generated.
      */
     private JavaFileInfo javaFileInfo;
@@ -251,24 +237,6 @@
     private File builderClassJavaFileHandle;
 
     /**
-     * Retrieves the temporary file handle of op param builder class.
-     *
-     * @return op param builder temporary file handle
-     */
-    public File getBuilderOpParmClassJavaFileHandle() {
-        return builderOpParmClassJavaFileHandle;
-    }
-
-    /**
-     * Sets the java file handle for op param builder class.
-     *
-     * @param builderOpParmClassJavaFileHandle java file handle
-     */
-    public void setBuilderOpParmClassJavaFileHandle(File builderOpParmClassJavaFileHandle) {
-        this.builderOpParmClassJavaFileHandle = builderOpParmClassJavaFileHandle;
-    }
-
-    /**
      * Java file handle for builder op param class file.
      */
     private File builderOpParmClassJavaFileHandle;
@@ -343,11 +311,6 @@
      */
     private String baseCodePath;
 
-    /**
-     * Temporary file handle for augments copy constructor method of class.
-     */
-    private File augmentConstructorImplTempFileHandle;
-
     TempJavaFragmentFiles() {
     }
 
@@ -396,7 +359,6 @@
             addGeneratedTempFile(ATTRIBUTES_MASK);
             addGeneratedTempFile(GETTER_FOR_CLASS_MASK);
             addGeneratedTempFile(SETTER_FOR_CLASS_MASK);
-            addGeneratedTempFile(AUGMENTE_CLASS_CONSTRUCTOR_MASK);
         }
 
         /*
@@ -465,10 +427,6 @@
         if ((getGeneratedTempFiles() & FROM_STRING_IMPL_MASK) != 0) {
             setFromStringImplTempFileHandle(getTemporaryFileHandle(FROM_STRING_METHOD_FILE_NAME));
         }
-        if ((getGeneratedTempFiles() & AUGMENTE_CLASS_CONSTRUCTOR_MASK) != 0) {
-            setAugmentConstructorImplTempFileHandle(getTemporaryFileHandle(AUGMENT_CONSTRUCTOR_FILE_NAME));
-        }
-
     }
 
     /**
@@ -479,8 +437,8 @@
      * @param pluginConfig plugin configurations
      * @throws IOException IO operation exception
      */
-    public static void addCurNodeInfoInParentTempFile(YangNode curNode,
-                                                      boolean isList, YangPluginConfig pluginConfig)
+    static void addCurNodeInfoInParentTempFile(YangNode curNode,
+                                               boolean isList, YangPluginConfig pluginConfig)
             throws IOException {
         YangNode parent = getParentNodeInGenCode(curNode);
         if (!(parent instanceof JavaCodeGenerator)) {
@@ -499,9 +457,7 @@
 
         JavaAttributeInfo javaAttributeInfo = getCurNodeAsAttributeInTarget(curNode,
                 parent, isList, tempJavaBeanFragmentFiles);
-        if (!(parent instanceof TempJavaCodeFragmentFilesContainer)) {
-            throw new TranslatorException("missing parent temp file handle");
-        }
+
         getNodesInterfaceFragmentFiles(parent, javaAttributeInfo, pluginConfig);
     }
 
@@ -574,8 +530,8 @@
      * @param config plugin configurations
      * @throws IOException when fails to do IO operations
      */
-    public static void getNodesInterfaceFragmentFiles(YangNode node, JavaAttributeInfo attr,
-                                                      YangPluginConfig config) throws IOException {
+    private static void getNodesInterfaceFragmentFiles(YangNode node, JavaAttributeInfo attr,
+                                                       YangPluginConfig config) throws IOException {
         TempJavaFragmentFiles tempJavaFragmentFiles;
         JavaFileInfo javaFileInfo = ((JavaFileInfoContainer) node).getJavaFileInfo();
         if ((javaFileInfo.getGeneratedFileTypes() & GENERATE_SERVICE_AND_MANAGER) != 0) {
@@ -594,11 +550,73 @@
     }
 
     /**
+     * Returns java attribute for leaf.
+     *
+     * @param tempJavaFragmentFiles temporary generated file
+     * @param leaf                  YANG leaf
+     * @param yangPluginConfig      plugin configurations
+     * @return java attribute for leaf
+     */
+    public static JavaAttributeInfo getJavaAttributeOfLeaf(TempJavaFragmentFiles tempJavaFragmentFiles, YangLeaf leaf,
+                                                           YangPluginConfig yangPluginConfig) {
+        JavaLeafInfoContainer javaLeaf = (JavaLeafInfoContainer) leaf;
+        javaLeaf.setConflictResolveConfig(yangPluginConfig.getConflictResolver());
+        javaLeaf.updateJavaQualifiedInfo();
+        return getAttributeInfoForTheData(
+                javaLeaf.getJavaQualifiedInfo(),
+                javaLeaf.getJavaName(yangPluginConfig.getConflictResolver()),
+                javaLeaf.getDataType(),
+                tempJavaFragmentFiles.getIsQualifiedAccessOrAddToImportList(javaLeaf.getJavaQualifiedInfo()),
+                false);
+    }
+
+    /**
+     * Returns java attribute for leaf-list.
+     *
+     * @param tempJavaFragmentFiles temporary generated file
+     * @param leafList              YANG leaf-list
+     * @param yangPluginConfig      plugin configurations
+     * @return java attribute for leaf-list
+     */
+    public static JavaAttributeInfo getJavaAttributeOfLeafList(TempJavaFragmentFiles tempJavaFragmentFiles,
+                                                               YangLeafList leafList,
+                                                               YangPluginConfig yangPluginConfig) {
+        JavaLeafInfoContainer javaLeaf = (JavaLeafInfoContainer) leafList;
+        javaLeaf.setConflictResolveConfig(yangPluginConfig.getConflictResolver());
+        javaLeaf.updateJavaQualifiedInfo();
+        tempJavaFragmentFiles.getJavaImportData().setIfListImported(true);
+        return getAttributeInfoForTheData(
+                javaLeaf.getJavaQualifiedInfo(),
+                javaLeaf.getJavaName(yangPluginConfig.getConflictResolver()),
+                javaLeaf.getDataType(),
+                tempJavaFragmentFiles.getIsQualifiedAccessOrAddToImportList(javaLeaf.getJavaQualifiedInfo()),
+                true);
+    }
+
+    /**
+     * Retrieves the temporary file handle of op param builder class.
+     *
+     * @return op param builder temporary file handle
+     */
+    private File getBuilderOpParmClassJavaFileHandle() {
+        return builderOpParmClassJavaFileHandle;
+    }
+
+    /**
+     * Sets the java file handle for op param builder class.
+     *
+     * @param builderOpParmClassJavaFileHandle java file handle
+     */
+    private void setBuilderOpParmClassJavaFileHandle(File builderOpParmClassJavaFileHandle) {
+        this.builderOpParmClassJavaFileHandle = builderOpParmClassJavaFileHandle;
+    }
+
+    /**
      * Returns base code path.
      *
      * @return base code path
      */
-    public String getBaseCodePath() {
+    private String getBaseCodePath() {
         return baseCodePath;
     }
 
@@ -607,7 +625,7 @@
      *
      * @param baseCodePath base code path
      */
-    public void setBaseCodePath(String baseCodePath) {
+    void setBaseCodePath(String baseCodePath) {
         this.baseCodePath = baseCodePath;
     }
 
@@ -661,18 +679,11 @@
      *
      * @param fileType generated file type
      */
-    void setGeneratedTempFiles(int fileType) {
+    private void setGeneratedTempFiles(int fileType) {
         generatedTempFiles = fileType;
     }
 
     /**
-     * Clears the generated file mask.
-     */
-    void clearGeneratedTempFileMask() {
-        generatedTempFiles = 0;
-    }
-
-    /**
      * Adds to generated temporary files.
      *
      * @param generatedTempFile generated file
@@ -723,7 +734,7 @@
      *
      * @return status of any attributes added
      */
-    public boolean isAttributePresent() {
+    boolean isAttributePresent() {
         return isAttributePresent;
     }
 
@@ -732,7 +743,7 @@
      *
      * @param attributePresent status of any attributes added
      */
-    public void setAttributePresent(boolean attributePresent) {
+    private void setAttributePresent(boolean attributePresent) {
         isAttributePresent = attributePresent;
     }
 
@@ -894,7 +905,7 @@
      *
      * @param attributeForClass file handle for attribute
      */
-    void setAttributesTempFileHandle(File attributeForClass) {
+    private void setAttributesTempFileHandle(File attributeForClass) {
         attributesTempFileHandle = attributeForClass;
     }
 
@@ -912,7 +923,7 @@
      *
      * @param getterImpl file handle for to getter method's impl
      */
-    void setGetterImplTempFileHandle(File getterImpl) {
+    private void setGetterImplTempFileHandle(File getterImpl) {
         getterImplTempFileHandle = getterImpl;
     }
 
@@ -930,12 +941,12 @@
      *
      * @param hashCodeMethod file handle for hash code method
      */
-    void setHashCodeImplTempFileHandle(File hashCodeMethod) {
+    private void setHashCodeImplTempFileHandle(File hashCodeMethod) {
         hashCodeImplTempFileHandle = hashCodeMethod;
     }
 
     /**
-     * Returns equals mehtod's temporary file handle.
+     * Returns equals method's temporary file handle.
      *
      * @return temporary file handle
      */
@@ -948,7 +959,7 @@
      *
      * @param equalsMethod file handle for to equals method
      */
-    void setEqualsImplTempFileHandle(File equalsMethod) {
+    private void setEqualsImplTempFileHandle(File equalsMethod) {
         equalsImplTempFileHandle = equalsMethod;
     }
 
@@ -966,7 +977,7 @@
      *
      * @param toStringMethod file handle for to string method
      */
-    void setToStringImplTempFileHandle(File toStringMethod) {
+    private void setToStringImplTempFileHandle(File toStringMethod) {
         toStringImplTempFileHandle = toStringMethod;
     }
 
@@ -984,29 +995,11 @@
      *
      * @param javaExtendsListHolder java extends list holder
      */
-    public void setJavaExtendsListHolder(JavaExtendsListHolder javaExtendsListHolder) {
+    void setJavaExtendsListHolder(JavaExtendsListHolder javaExtendsListHolder) {
         this.javaExtendsListHolder = javaExtendsListHolder;
     }
 
     /**
-     * Returns augments copy constructor method impl class file.
-     *
-     * @return augments copy constructor method impl class file
-     */
-    public File getAugmentConstructorImplTempFileHandle() {
-        return augmentConstructorImplTempFileHandle;
-    }
-
-    /**
-     * Sets augments copy constructor method impl class.
-     *
-     * @param augmentConstructorImplTempFileHandle augments copy constructor method impl class file
-     */
-    public void setAugmentConstructorImplTempFileHandle(File augmentConstructorImplTempFileHandle) {
-        this.augmentConstructorImplTempFileHandle = augmentConstructorImplTempFileHandle;
-    }
-
-    /**
      * Adds attribute for class.
      *
      * @param attr             attribute info
@@ -1056,8 +1049,7 @@
             throws IOException {
         appendToFile(getSetterImplTempFileHandle(),
                 getOverRideString() + getSetterForClass(attr, getGeneratedJavaClassName(), getGeneratedJavaFiles())
-                        +
-                        NEW_LINE);
+                        + NEW_LINE);
     }
 
     /**
@@ -1067,7 +1059,7 @@
      * @param pluginConfig plugin configurations
      * @throws IOException when fails to append to temporary file
      */
-    private void addGetterImpl(JavaAttributeInfo attr, YangPluginConfig pluginConfig)
+    void addGetterImpl(JavaAttributeInfo attr, YangPluginConfig pluginConfig)
             throws IOException {
         if ((getGeneratedJavaFiles() & BUILDER_CLASS_MASK) != 0
                 || (getGeneratedJavaFiles() & GENERATE_SERVICE_AND_MANAGER) != 0) {
@@ -1158,25 +1150,14 @@
      * @param fromStringAttributeInfo from string attribute info
      * @throws IOException when fails to append to temporary file
      */
-    private void addFromStringMethod(JavaAttributeInfo javaAttributeInfo,
-                                     JavaAttributeInfo fromStringAttributeInfo)
+    void addFromStringMethod(JavaAttributeInfo javaAttributeInfo,
+                             JavaAttributeInfo fromStringAttributeInfo)
             throws IOException {
         appendToFile(getFromStringImplTempFileHandle(), getFromStringMethod(javaAttributeInfo,
                 fromStringAttributeInfo) + NEW_LINE);
     }
 
     /**
-     * Adds constructor for augment class.
-     *
-     * @param attr attribute info
-     * @throws IOException when fails to append to temporary file
-     */
-    private void addAugmentConstructor(JavaAttributeInfo attr, YangPluginConfig pluginConfig)
-            throws IOException {
-        appendToFile(getAugmentConstructorImplTempFileHandle(), getAugmentedConstructor(attr, pluginConfig));
-    }
-
-    /**
      * Returns a temporary file handle for the specific file type.
      *
      * @param fileName file name
@@ -1237,9 +1218,9 @@
      * @param absolutePath absolute path
      * @return directory path
      */
-    String getTempDirPath(String absolutePath) {
+    private String getTempDirPath(String absolutePath) {
         return getPackageDirPathFromJavaJPackage(absolutePath) + SLASH + getGeneratedJavaClassName()
-                + TEMP_FOLDER_NAME_SUFIX + SLASH;
+                + TEMP_FOLDER_NAME_SUFFIX + SLASH;
     }
 
     /**
@@ -1249,7 +1230,7 @@
      * @param pluginConfig plugin configurations
      * @return attribute string
      */
-    public String parseAttribute(JavaAttributeInfo attr, YangPluginConfig pluginConfig) {
+    String parseAttribute(JavaAttributeInfo attr, YangPluginConfig pluginConfig) {
         /*
          * TODO: check if this utility needs to be called or move to the caller
          */
@@ -1290,7 +1271,7 @@
      * @param curNode      current node for which import list needs to be updated
      * @param pluginConfig plugin configurations
      */
-    public void addParentInfoInCurNodeTempFile(YangNode curNode, YangPluginConfig pluginConfig) {
+    void addParentInfoInCurNodeTempFile(YangNode curNode, YangPluginConfig pluginConfig) {
         caseImportInfo = new JavaQualifiedTypeInfo();
         YangNode parent = getParentNodeInGenCode(curNode);
         if (!(parent instanceof JavaCodeGenerator)) {
@@ -1316,102 +1297,74 @@
      *
      * @param listOfLeaves     list of YANG leaf
      * @param yangPluginConfig plugin config
+     * @param curNode          current node
      * @throws IOException IO operation fail
      */
-    public void addLeavesInfoToTempFiles(List<YangLeaf> listOfLeaves,
-                                         YangPluginConfig yangPluginConfig)
+    private void addLeavesInfoToTempFiles(List<YangLeaf> listOfLeaves,
+                                          YangPluginConfig yangPluginConfig, YangNode curNode)
             throws IOException {
         if (listOfLeaves != null) {
             for (YangLeaf leaf : listOfLeaves) {
                 if (!(leaf instanceof JavaLeafInfoContainer)) {
                     throw new TranslatorException("Leaf does not have java information");
                 }
-                addJavaSnippetInfoToApplicableTempFiles(getJavaAttributeOfLeaf(this, leaf, yangPluginConfig),
-                        yangPluginConfig);
+                if (curNode instanceof YangModule || curNode instanceof YangSubModule) {
+                    TempJavaBeanFragmentFiles tempJavaBeanFragmentFiles = ((JavaCodeGeneratorInfo) curNode)
+                            .getTempJavaCodeFragmentFiles().getBeanTempFiles();
+                    addJavaSnippetInfoToApplicableTempFiles(getJavaAttributeOfLeaf(tempJavaBeanFragmentFiles, leaf,
+                            yangPluginConfig), yangPluginConfig);
+                } else {
+                    addJavaSnippetInfoToApplicableTempFiles(getJavaAttributeOfLeaf(this, leaf, yangPluginConfig),
+                            yangPluginConfig);
+                }
             }
         }
     }
 
     /**
-     * Returns java attribute for leaf.
-     *
-     * @param tempJavaFragmentFiles temporary generated file
-     * @param leaf             YANG leaf
-     * @param yangPluginConfig plugin configurations
-     * @return java attribute for leaf
-     */
-    public static JavaAttributeInfo getJavaAttributeOfLeaf(TempJavaFragmentFiles tempJavaFragmentFiles, YangLeaf leaf,
-                                                            YangPluginConfig yangPluginConfig) {
-        JavaLeafInfoContainer javaLeaf = (JavaLeafInfoContainer) leaf;
-        javaLeaf.setConflictResolveConfig(yangPluginConfig.getConflictResolver());
-        javaLeaf.updateJavaQualifiedInfo();
-        return getAttributeInfoForTheData(
-                javaLeaf.getJavaQualifiedInfo(),
-                javaLeaf.getJavaName(yangPluginConfig.getConflictResolver()),
-                javaLeaf.getDataType(),
-                tempJavaFragmentFiles.getIsQualifiedAccessOrAddToImportList(javaLeaf.getJavaQualifiedInfo()),
-                false);
-    }
-
-    /**
      * Adds leaf list's attributes in generated files.
      *
      * @param listOfLeafList   list of YANG leaves
      * @param yangPluginConfig plugin config
+     * @param curNode          current node
      * @throws IOException IO operation fail
      */
-    public void addLeafListInfoToTempFiles(List<YangLeafList> listOfLeafList, YangPluginConfig yangPluginConfig)
-            throws IOException {
+    private void addLeafListInfoToTempFiles(List<YangLeafList> listOfLeafList, YangPluginConfig yangPluginConfig,
+                                            YangNode curNode) throws IOException {
         if (listOfLeafList != null) {
             for (YangLeafList leafList : listOfLeafList) {
                 if (!(leafList instanceof JavaLeafInfoContainer)) {
                     throw new TranslatorException("Leaf-list does not have java information");
                 }
-                addJavaSnippetInfoToApplicableTempFiles(getJavaAttributeOfLeafList(this, leafList, yangPluginConfig),
-                        yangPluginConfig);
+                if (curNode instanceof YangModule || curNode instanceof YangSubModule) {
+                    TempJavaBeanFragmentFiles tempJavaBeanFragmentFiles = ((JavaCodeGeneratorInfo) curNode)
+                            .getTempJavaCodeFragmentFiles().getBeanTempFiles();
+                    addJavaSnippetInfoToApplicableTempFiles(getJavaAttributeOfLeafList(tempJavaBeanFragmentFiles,
+                            leafList, yangPluginConfig), yangPluginConfig);
+                } else {
+                    addJavaSnippetInfoToApplicableTempFiles(getJavaAttributeOfLeafList(this,
+                            leafList, yangPluginConfig), yangPluginConfig);
+                }
             }
         }
     }
 
     /**
-     * Returns java attribute for leaf-list.
+     * Adds all the leaves in the current data model node as part of the generated temporary file.
      *
-     * @param tempJavaFragmentFiles temporary generated file
-     * @param leafList         YANG leaf-list
-     * @param yangPluginConfig plugin configurations
-     * @return java attribute for leaf-list
-     */
-    public static JavaAttributeInfo getJavaAttributeOfLeafList(TempJavaFragmentFiles tempJavaFragmentFiles,
-                                                           YangLeafList leafList, YangPluginConfig yangPluginConfig) {
-        JavaLeafInfoContainer javaLeaf = (JavaLeafInfoContainer) leafList;
-        javaLeaf.setConflictResolveConfig(yangPluginConfig.getConflictResolver());
-        javaLeaf.updateJavaQualifiedInfo();
-        tempJavaFragmentFiles.getJavaImportData().setIfListImported(true);
-        return getAttributeInfoForTheData(
-                javaLeaf.getJavaQualifiedInfo(),
-                javaLeaf.getJavaName(yangPluginConfig.getConflictResolver()),
-                javaLeaf.getDataType(),
-                tempJavaFragmentFiles.getIsQualifiedAccessOrAddToImportList(javaLeaf.getJavaQualifiedInfo()),
-                true);
-    }
-
-    /**
-     * Adds all the leaves in the current data model node as part of the
-     * generated temporary file.
-     *
-     * @param curNode          java file info of the generated file
+     * @param curNode          current node
      * @param yangPluginConfig plugin config
      * @throws IOException IO operation fail
      */
-    public void addCurNodeLeavesInfoToTempFiles(YangNode curNode,
+    void addCurNodeLeavesInfoToTempFiles(YangNode curNode,
                                                 YangPluginConfig yangPluginConfig)
             throws IOException {
         if (!(curNode instanceof YangLeavesHolder)) {
             throw new TranslatorException("Data model node does not have any leaves");
         }
         YangLeavesHolder leavesHolder = (YangLeavesHolder) curNode;
-        addLeavesInfoToTempFiles(leavesHolder.getListOfLeaf(), yangPluginConfig);
-        addLeafListInfoToTempFiles(leavesHolder.getListOfLeafList(), yangPluginConfig);
+        addLeavesInfoToTempFiles(leavesHolder.getListOfLeaf(), yangPluginConfig, curNode);
+        addLeafListInfoToTempFiles(leavesHolder.getListOfLeafList(), yangPluginConfig, curNode);
     }
 
     /**
@@ -1440,9 +1393,6 @@
             addSetterImpl(newAttrInfo);
         }
 
-        if ((getGeneratedTempFiles() & GETTER_FOR_CLASS_MASK) != 0) {
-            addGetterImpl(newAttrInfo, pluginConfig);
-        }
         if ((getGeneratedTempFiles() & HASH_CODE_IMPL_MASK) != 0) {
             addHashCodeMethod(newAttrInfo);
         }
@@ -1453,19 +1403,26 @@
             addToStringMethod(newAttrInfo);
         }
 
-        if ((getGeneratedTempFiles() & FROM_STRING_IMPL_MASK) != 0) {
-            JavaQualifiedTypeInfo qualifiedInfoOfFromString = getQualifiedInfoOfFromString(newAttrInfo,
-                    pluginConfig.getConflictResolver());
+        if (!newAttrInfo.isIntConflict() &&
+                !newAttrInfo.isLongConflict()) {
+            if ((getGeneratedTempFiles() & GETTER_FOR_CLASS_MASK) != 0) {
+                addGetterImpl(newAttrInfo, pluginConfig);
+            }
+
+            if ((getGeneratedTempFiles() & FROM_STRING_IMPL_MASK) != 0) {
+                JavaQualifiedTypeInfo 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);
+                JavaAttributeInfo fromStringAttributeInfo = getAttributeInfoForTheData(qualifiedInfoOfFromString,
+                        newAttrInfo.getAttributeName(),
+                        newAttrInfo.getAttributeType(),
+                        getIsQualifiedAccessOrAddToImportList(qualifiedInfoOfFromString), false);
 
-            addFromStringMethod(newAttrInfo, fromStringAttributeInfo);
+                addFromStringMethod(newAttrInfo, fromStringAttributeInfo);
+            }
         }
     }
 
@@ -1484,7 +1441,7 @@
      *
      * @return java class name
      */
-    String getImplClassName() {
+    private String getImplClassName() {
         return getCapitalCase(DEFAULT) + getCapitalCase(getJavaFileInfo().getJavaName());
     }
 
@@ -1493,7 +1450,7 @@
      *
      * @return op param java class name
      */
-    String getOpParamImplClassName() {
+    private String getOpParamImplClassName() {
         return getCapitalCase(getJavaFileInfo().getJavaName()) + OPERATION;
     }
 
@@ -1502,7 +1459,7 @@
      *
      * @return op param builder java class name
      */
-    String getOpParamBuilderImplClassName() {
+    private String getOpParamBuilderImplClassName() {
         return getCapitalCase(getJavaFileInfo().getJavaName()) + OPERATION + BUILDER;
     }
 
@@ -1533,8 +1490,6 @@
         List<String> imports = ((JavaCodeGeneratorInfo) curNode).getTempJavaCodeFragmentFiles().getBeanTempFiles()
                 .getJavaImportData().getImports();
 
-        JavaFileInfo curInfo = ((JavaFileInfoContainer) curNode).getJavaFileInfo();
-
         createPackage(curNode);
 
         /*
@@ -1620,7 +1575,7 @@
                 qualifiedTypeInfo.setPkgInfo(getJavaFileInfo().getPackage());
                 getJavaExtendsListHolder().addToExtendsList(qualifiedTypeInfo, curNode,
                         tempJavaBeanFragmentFiles);
-                addBitsetImport(imports, true);
+                addBitSetImport(imports, true);
                 if (curNode instanceof YangAugment) {
                     addYangAugmentedOpParamInfoImport(imports);
                 }
@@ -1646,7 +1601,7 @@
                     mergeJavaFiles(getBuilderOpParmClassJavaFileHandle(), getOpParamClassJavaFileHandle());
                     validateLineLength(getOpParamClassJavaFileHandle());
 
-                    addBitsetImport(imports, false);
+                    addBitSetImport(imports, false);
                 }
                 insertDataIntoJavaFile(getOpParamClassJavaFileHandle(), getJavaClassDefClose());
 
@@ -1669,7 +1624,7 @@
      * @param imports   import list
      * @param operation add or remove
      */
-    public void addImportsToStringAndHasCodeMethods(List<String> imports, boolean operation) {
+    void addImportsToStringAndHasCodeMethods(List<String> imports, boolean operation) {
         if (operation) {
             imports.add(getJavaImportData().getImportForHashAndEquals());
             imports.add(getJavaImportData().getImportForToString());
@@ -1680,12 +1635,12 @@
     }
 
     /**
-     * Adds imports for bitset method.
+     * Adds imports for bitSet method.
      *
      * @param imports   import list
      * @param operation add or remove
      */
-    public void addBitsetImport(List<String> imports, boolean operation) {
+    private void addBitSetImport(List<String> imports, boolean operation) {
         if (operation) {
             imports.add(getJavaImportData().getImportForToBitSet());
         } else {
@@ -1700,7 +1655,7 @@
      * @param imports    import list
      * @param operations true for adding and false for deletion
      */
-    public void addImportsForAugmentableClass(List<String> imports, boolean operations) {
+    private void addImportsForAugmentableClass(List<String> imports, boolean operations) {
         if (operations) {
             imports.add(getJavaImportData().getHashMapImport());
             imports.add(getJavaImportData().getMapImport());
@@ -1730,34 +1685,24 @@
      * Removes case import info from import list.
      *
      * @param imports list of imports
-     * @return import for class
      */
     private void removeAugmentedInfoImport(List<String> imports) {
         imports.remove(getJavaImportData().getYangAugmentedInfoImport());
-
-        for (JavaQualifiedTypeInfo type : getJavaImportData().getImportSet()) {
-            if (type.getClassInfo().equals(YANG_AUGMENTED_INFO)) {
-                getJavaImportData().getImportSet().remove(type);
-                getJavaExtendsListHolder().getExtendsList().remove(type);
-            }
-        }
     }
 
     /**
      * Removes all temporary file handles.
      *
-     * @param isErrorOccurred when translator fails to generate java files we need to close all open file handles
-     *                        include temporary files and java files.
+     * @param isErrorOccurred flag to tell translator that error has occurred while file generation
      * @throws IOException when failed to delete the temporary files
      */
     public void freeTemporaryResources(boolean isErrorOccurred)
             throws IOException {
-        boolean isError = isErrorOccurred;
         /*
          * Close all java file handles and when error occurs delete the files.
          */
         if ((getGeneratedJavaFiles() & INTERFACE_MASK) != 0) {
-            closeFile(getInterfaceJavaFileHandle(), isError);
+            closeFile(getInterfaceJavaFileHandle(), isErrorOccurred);
         }
         if ((getGeneratedJavaFiles() & BUILDER_CLASS_MASK) != 0) {
             closeFile(getBuilderClassJavaFileHandle(), true);
@@ -1769,7 +1714,7 @@
             closeFile(getBuilderInterfaceJavaFileHandle(), true);
         }
         if ((getGeneratedJavaFiles() & IMPL_CLASS_MASK) != 0) {
-            closeFile(getImplClassJavaFileHandle(), isError);
+            closeFile(getImplClassJavaFileHandle(), isErrorOccurred);
         }
 
         /*
@@ -1793,9 +1738,6 @@
         if ((getGeneratedTempFiles() & FROM_STRING_IMPL_MASK) != 0) {
             closeFile(getFromStringImplTempFileHandle(), true);
         }
-        if ((getGeneratedTempFiles() & AUGMENTE_CLASS_CONSTRUCTOR_MASK) != 0) {
-            closeFile(getAugmentConstructorImplTempFileHandle(), true);
-        }
     }
 
     /**
@@ -1805,7 +1747,7 @@
      * @param importInfo import info for the current attribute being added
      * @return status of the qualified access to the attribute
      */
-    public boolean getIsQualifiedAccessOrAddToImportList(
+    boolean getIsQualifiedAccessOrAddToImportList(
             JavaQualifiedTypeInfo importInfo) {
 
         return getJavaImportData().addImportInfo(importInfo, getGeneratedJavaClassName(),
@@ -1817,7 +1759,7 @@
      *
      * @return java file handle for op param class file
      */
-    public File getOpParamClassJavaFileHandle() {
+    private File getOpParamClassJavaFileHandle() {
         return opParamClassJavaFileHandle;
     }
 
@@ -1826,7 +1768,7 @@
      *
      * @param opParamClassJavaFileHandle java file handle
      */
-    public void setOpParamClassJavaFileHandle(File opParamClassJavaFileHandle) {
+    private void setOpParamClassJavaFileHandle(File opParamClassJavaFileHandle) {
         this.opParamClassJavaFileHandle = opParamClassJavaFileHandle;
     }
 }
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaServiceFragmentFiles.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaServiceFragmentFiles.java
index 0a7971b..bae2df5 100644
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaServiceFragmentFiles.java
+++ b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaServiceFragmentFiles.java
@@ -78,7 +78,7 @@
     /**
      * Flag to set the manager files generation.
      */
-    boolean isManagerNeedToBeGenerated = false;
+    private boolean isManagerNeedToBeGenerated = false;
 
     /**
      * Temporary file handle for rpc interface.
@@ -96,7 +96,7 @@
     private File serviceInterfaceJavaFileHandle;
 
     /**
-     * Path for serive file to be generated.
+     * Path for service file to be generated.
      */
     private String serviceGenPath;
 
@@ -111,7 +111,7 @@
      * @param javaFileInfo generated file information
      * @throws IOException when fails to create new file handle
      */
-    public TempJavaServiceFragmentFiles(JavaFileInfo javaFileInfo)
+    TempJavaServiceFragmentFiles(JavaFileInfo javaFileInfo)
             throws IOException {
         setJavaExtendsListHolder(new JavaExtendsListHolder());
         setJavaImportData(new JavaImportData());
@@ -150,7 +150,7 @@
      *
      * @return java file handle
      */
-    public File getManagerJavaFileHandle() {
+    private File getManagerJavaFileHandle() {
         return managerJavaFileHandle;
     }
 
@@ -159,7 +159,7 @@
      *
      * @param managerJavaFileHandle file handle for to manager
      */
-    public void setManagerJavaFileHandle(File managerJavaFileHandle) {
+    private void setManagerJavaFileHandle(File managerJavaFileHandle) {
         this.managerJavaFileHandle = managerJavaFileHandle;
     }
 
@@ -195,7 +195,7 @@
      *
      * @param rpcImplTempFileHandle the manager impl temp file
      */
-    public void setRpcImplTempFileHandle(File rpcImplTempFileHandle) {
+    private void setRpcImplTempFileHandle(File rpcImplTempFileHandle) {
         this.rpcImplTempFileHandle = rpcImplTempFileHandle;
     }
 
@@ -226,9 +226,8 @@
         if (isNotification) {
             addListenersImport(curNode, imports, true, LISTENER_SERVICE);
         }
-        /**
-         * Creates rpc interface file.
-         */
+
+        // Creates rpc interface file.
         setBaseCodePath(getServiceGenPath());
         setServiceInterfaceJavaFileHandle(getJavaFileHandle(getJavaClassName(SERVICE_FILE_NAME_SUFFIX)));
         generateServiceInterfaceFile(getServiceInterfaceJavaFileHandle(), curNode, imports);
@@ -238,9 +237,8 @@
             addListenersImport(curNode, imports, true, LISTENER_REG);
         }
         addAnnotationsImports(imports, true);
-        /**
-         * Create builder class file.
-         */
+
+        // Create builder class file.
         if (isManagerNeedToBeGenerated()) {
             setManagerJavaFileHandle(getJavaFileHandle(getJavaClassName(MANAGER_FILE_NAME_SUFFIX)));
             generateManagerClassFile(getManagerJavaFileHandle(), imports, curNode);
@@ -251,17 +249,16 @@
         }
         addAnnotationsImports(imports, false);
 
-        /**
-         * Close all the file handles.
-         */
+
+        // Close all the file handles.
         freeTemporaryResources(false);
     }
 
     /**
      * Adds rpc string information to applicable temp file.
      *
-     * @param javaAttributeInfoOfInput  rpc's input node attribute info
-     * @param javaAttributeInfoOfOutput rpc's output node attribute info
+     * @param javaAttributeInfoOfInput  RPCs input node attribute info
+     * @param javaAttributeInfoOfOutput RPCs output node attribute info
      * @param rpcName                   name of the rpc function
      * @param pluginConfig              plugin configurations
      * @throws IOException IO operation fail
@@ -292,8 +289,8 @@
     /**
      * Adds the JAVA rpc snippet information.
      *
-     * @param javaAttributeInfoOfInput  rpc's input node attribute info
-     * @param javaAttributeInfoOfOutput rpc's output node attribute info
+     * @param javaAttributeInfoOfInput  RPCs input node attribute info
+     * @param javaAttributeInfoOfOutput RPCs output node attribute info
      * @param pluginConfig              plugin configurations
      * @param rpcName                   name of the rpc function
      * @throws IOException IO operation fail
@@ -308,17 +305,15 @@
     /**
      * Removes all temporary file handles.
      *
-     * @param isErrorOccurred when translator fails to generate java files we need to close all open file handles
-     *                        include temporary files and java files.
+     * @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 {
-        boolean isError = isErrorOccurred;
 
-        closeFile(getServiceInterfaceJavaFileHandle(), isError);
-        closeFile(getManagerJavaFileHandle(), isError);
+        closeFile(getServiceInterfaceJavaFileHandle(), isErrorOccurred);
+        closeFile(getManagerJavaFileHandle(), isErrorOccurred);
 
         closeFile(getRpcInterfaceTempFileHandle(), true);
         closeFile(getRpcImplTempFileHandle(), true);
@@ -335,7 +330,7 @@
      *
      * @return path where service file should be generated
      */
-    public String getServiceGenPath() {
+    private String getServiceGenPath() {
         return serviceGenPath;
     }
 
@@ -344,7 +339,7 @@
      *
      * @param serviceGenPath path where service file should be generated
      */
-    public void setServiceGenPath(String serviceGenPath) {
+    private void setServiceGenPath(String serviceGenPath) {
         this.serviceGenPath = serviceGenPath;
     }
 
@@ -353,7 +348,7 @@
      *
      * @return true if manager needs to be generated
      */
-    public boolean isManagerNeedToBeGenerated() {
+    private boolean isManagerNeedToBeGenerated() {
         return isManagerNeedToBeGenerated;
     }
 
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaTypeFragmentFiles.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaTypeFragmentFiles.java
index 1d31d20..8e05be5 100644
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaTypeFragmentFiles.java
+++ b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaTypeFragmentFiles.java
@@ -24,29 +24,37 @@
 import org.onosproject.yangutils.datamodel.YangNode;
 import org.onosproject.yangutils.datamodel.YangType;
 import org.onosproject.yangutils.datamodel.YangTypeHolder;
+import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes;
 import org.onosproject.yangutils.translator.exception.TranslatorException;
 import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaType;
 import org.onosproject.yangutils.utils.io.impl.YangPluginConfig;
 
+import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.INT32;
+import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.INT64;
+import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.UINT16;
+import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.UINT32;
 import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_TYPEDEF_CLASS;
 import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_UNION_CLASS;
 import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.CONSTRUCTOR_FOR_TYPE_MASK;
 import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.FROM_STRING_IMPL_MASK;
 import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.OF_STRING_IMPL_MASK;
 import static org.onosproject.yangutils.translator.tojava.JavaAttributeInfo.getAttributeInfoForTheData;
+import static org.onosproject.yangutils.translator.tojava.JavaQualifiedTypeInfo.getQualifiedInfoOfFromString;
 import static org.onosproject.yangutils.translator.tojava.utils.JavaFileGenerator.generateTypeDefClassFile;
 import static org.onosproject.yangutils.translator.tojava.utils.JavaFileGenerator.generateUnionClassFile;
-import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.getCamelCase;
+import static org.onosproject.yangutils.translator.tojava.utils.JavaIdentifierSyntax.createPackage;
 import static org.onosproject.yangutils.translator.tojava.utils.MethodsGenerator.getOfMethodStringAndJavaDoc;
 import static org.onosproject.yangutils.translator.tojava.utils.MethodsGenerator.getTypeConstructorStringAndJavaDoc;
-import static org.onosproject.yangutils.utils.io.impl.FileSystemUtil.closeFile;
+import static org.onosproject.yangutils.translator.tojava.utils.ValidatorTypeForUnionTypes.INT_TYPE_CONFLICT;
+import static org.onosproject.yangutils.translator.tojava.utils.ValidatorTypeForUnionTypes.LONG_TYPE_CONFLICT;
 import static org.onosproject.yangutils.utils.UtilConstants.EMPTY_STRING;
 import static org.onosproject.yangutils.utils.UtilConstants.NEW_LINE;
-import static org.onosproject.yangutils.translator.tojava.utils.JavaIdentifierSyntax.createPackage;
+import static org.onosproject.yangutils.utils.io.impl.FileSystemUtil.closeFile;
+import static org.onosproject.yangutils.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.
+ * Represents implementation of java data type code fragments temporary implementations. Maintains the temp files
+ * required specific for user defined data type java snippet generation.
  */
 public class TempJavaTypeFragmentFiles
         extends TempJavaFragmentFiles {
@@ -67,12 +75,31 @@
     private static final String TYPEDEF_CLASS_FILE_NAME_SUFFIX = EMPTY_STRING;
 
     /**
-     * File name for generated class file for special type like union, typedef
-     * suffix.
+     * File name for generated class file for special type like union, typedef suffix.
      */
     private static final String UNION_TYPE_CLASS_FILE_NAME_SUFFIX = EMPTY_STRING;
 
     /**
+     * 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;
+
+    /**
      * Temporary file handle for of string method of class.
      */
     private File ofStringImplTempFileHandle;
@@ -93,12 +120,32 @@
     private File typeClassJavaFileHandle;
 
     /**
+     * Java attribute for int.
+     */
+    private JavaAttributeInfo intAttribute;
+
+    /**
+     * Java attribute for long.
+     */
+    private JavaAttributeInfo longAttribute;
+
+    /**
+     * Java attribute for uInt.
+     */
+    private JavaAttributeInfo uIntAttribute;
+
+    /**
+     * Java attribute for uLong.
+     */
+    private JavaAttributeInfo uLongAttribute;
+
+    /**
      * Creates an instance of temporary java code fragment.
      *
      * @param javaFileInfo generated java file info
      * @throws IOException when fails to create new file handle
      */
-    public TempJavaTypeFragmentFiles(JavaFileInfo javaFileInfo)
+    TempJavaTypeFragmentFiles(JavaFileInfo javaFileInfo)
             throws IOException {
 
         super(javaFileInfo);
@@ -129,8 +176,7 @@
     /**
      * Sets type class constructor method's temporary file handle.
      *
-     * @param constructorForTypeTempFileHandle type class constructor method's
-     * temporary file handle
+     * @param constructorForTypeTempFileHandle type class constructor method's temporary file handle
      */
     private void setConstructorForTypeTempFileHandle(File constructorForTypeTempFileHandle) {
         this.constructorForTypeTempFileHandle = constructorForTypeTempFileHandle;
@@ -141,7 +187,7 @@
      *
      * @return java file handle for typedef class file
      */
-    File getTypedefClassJavaFileHandle() {
+    private File getTypedefClassJavaFileHandle() {
         return typedefClassJavaFileHandle;
     }
 
@@ -159,7 +205,7 @@
      *
      * @return java file handle for type class file
      */
-    File getTypeClassJavaFileHandle() {
+    private File getTypeClassJavaFileHandle() {
         return typeClassJavaFileHandle;
     }
 
@@ -185,23 +231,20 @@
     /**
      * Set of string method's temporary file handle.
      *
-     * @param ofStringImplTempFileHandle of string method's temporary file
-     * handle
+     * @param ofStringImplTempFileHandle of string method's temporary file handle
      */
     private void setOfStringImplTempFileHandle(File ofStringImplTempFileHandle) {
         this.ofStringImplTempFileHandle = ofStringImplTempFileHandle;
     }
 
     /**
-     * Adds all the type in the current data model node as part of the generated
-     * temporary file.
+     * 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 pluginConfig plugin configurations for naming conventions
+     * @param yangTypeHolder YANG java data model node which has type info, eg union / typedef
+     * @param pluginConfig   plugin configurations for naming conventions
      * @throws IOException IO operation fail
      */
-    public void addTypeInfoToTempFiles(YangTypeHolder yangTypeHolder, YangPluginConfig pluginConfig)
+    void addTypeInfoToTempFiles(YangTypeHolder yangTypeHolder, YangPluginConfig pluginConfig)
             throws IOException {
 
         List<YangType<?>> typeList = yangTypeHolder.getTypeList();
@@ -210,49 +253,165 @@
                 if (!(yangType instanceof YangJavaType)) {
                     throw new TranslatorException("Type does not have Java info");
                 }
-                YangJavaType<?> javaType = (YangJavaType<?>) yangType;
-                javaType.updateJavaQualifiedInfo(pluginConfig.getConflictResolver());
-                String typeName = javaType.getDataTypeName();
-                typeName = getCamelCase(typeName, pluginConfig.getConflictResolver());
-                JavaAttributeInfo javaAttributeInfo = getAttributeInfoForTheData(
-                        javaType.getJavaQualifiedInfo(),
-                        typeName, javaType,
-                        getIsQualifiedAccessOrAddToImportList(javaType.getJavaQualifiedInfo()),
-                        false);
-                addJavaSnippetInfoToApplicableTempFiles((YangNode) yangTypeHolder, javaAttributeInfo,
-                        pluginConfig);
+                JavaAttributeInfo javaAttributeInfo = getAttributeForType(yangType, pluginConfig);
+                addJavaSnippetInfoToApplicableTempFiles(javaAttributeInfo,
+                        pluginConfig, typeList);
             }
+            addTypeConstructor(pluginConfig);
+            addMethodsInConflictCase(pluginConfig);
         }
     }
 
     /**
-     * Adds the new attribute info to the target generated temporary files for
-     * union class.
+     * Returns java attribute.
      *
-     * @param hasType the node for which the type is being added as an attribute
-     * @param javaAttributeInfo the attribute info that needs to be added to
-     * temporary files
+     * @param yangType     YANG type
      * @param pluginConfig plugin configurations
+     * @return java attribute
+     */
+    private JavaAttributeInfo getAttributeForType(YangType yangType, YangPluginConfig pluginConfig) {
+        YangJavaType<?> javaType = (YangJavaType<?>) yangType;
+        javaType.updateJavaQualifiedInfo(pluginConfig.getConflictResolver());
+        String typeName = javaType.getDataTypeName();
+        typeName = getCamelCase(typeName, pluginConfig.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 javaAttributeInfo the attribute info that needs to be added to temporary files
+     * @param pluginConfig      plugin configurations
+     * @param typeList          type list
      * @throws IOException IO operation fail
      */
-    private void addJavaSnippetInfoToApplicableTempFiles(YangNode hasType, JavaAttributeInfo javaAttributeInfo,
-            YangPluginConfig pluginConfig)
+    private void addJavaSnippetInfoToApplicableTempFiles(JavaAttributeInfo javaAttributeInfo,
+                                                         YangPluginConfig pluginConfig, List<YangType<?>> typeList)
             throws IOException {
 
+        YangDataTypes attrType = javaAttributeInfo.getAttributeType().getDataType();
+
+        if (attrType == INT32 || attrType == UINT16) {
+            boolean isIntConflict = validateForConflictingIntTypes(typeList);
+            javaAttributeInfo.setIntConflict(isIntConflict);
+            updateAttributeCondition(javaAttributeInfo);
+            if (!isIntConflict) {
+                addMethodsWhenNoConflictingTypes(javaAttributeInfo, pluginConfig);
+            }
+        } else if (attrType == INT64 || attrType == UINT32) {
+            boolean isLongConflict = validateForConflictingLongTypes(typeList);
+            javaAttributeInfo.setLongConflict(isLongConflict);
+            updateAttributeCondition(javaAttributeInfo);
+            if (!isLongConflict) {
+                addMethodsWhenNoConflictingTypes(javaAttributeInfo, pluginConfig);
+            }
+        } else {
+            addMethodsWhenNoConflictingTypes(javaAttributeInfo, pluginConfig);
+        }
         super.addJavaSnippetInfoToApplicableTempFiles(javaAttributeInfo, pluginConfig);
 
+    }
+
+    /**
+     * Adds of method and constructor when there is no conflictiing types.
+     *
+     * @param javaAttributeInfo java attribute info
+     * @param pluginConfig      plugin configurations
+     * @throws IOException when fails to do IO opearions
+     */
+    private void addMethodsWhenNoConflictingTypes(JavaAttributeInfo javaAttributeInfo,
+                                                  YangPluginConfig pluginConfig) throws IOException {
         if ((getGeneratedTempFiles() & OF_STRING_IMPL_MASK) != 0) {
             addOfStringMethod(javaAttributeInfo, pluginConfig);
         }
+
         if ((getGeneratedTempFiles() & CONSTRUCTOR_FOR_TYPE_MASK) != 0) {
             addTypeConstructor(javaAttributeInfo, pluginConfig);
         }
     }
 
     /**
+     * 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()) {
+                    appendToFile(getOfStringImplTempFileHandle(), getOfMethodStringAndJavaDoc(getIntAttribute(),
+                            getGeneratedJavaClassName(), pluginConfig)
+                            + NEW_LINE);
+                    addGetterImpl(getIntAttribute(), pluginConfig);
+                    addFromStringMethod(getIntAttribute(), pluginConfig);
+                } else {
+                    appendToFile(getOfStringImplTempFileHandle(), getOfMethodStringAndJavaDoc(getUIntAttribute(),
+                            getGeneratedJavaClassName(), pluginConfig)
+                            + NEW_LINE);
+                    addGetterImpl(getUIntAttribute(), pluginConfig);
+                    addFromStringMethod(getUIntAttribute(), pluginConfig);
+                }
+            }
+        }
+        attr = getLongAttribute();
+        if (attr != null) {
+            attr = getULongAttribute();
+        }
+        if (attr != null) {
+            if (attr.isLongConflict()) {
+                if (getLongIndex() < getULongIndex()) {
+                    appendToFile(getOfStringImplTempFileHandle(), getOfMethodStringAndJavaDoc(getLongAttribute(),
+                            getGeneratedJavaClassName(), pluginConfig)
+                            + NEW_LINE);
+                    addGetterImpl(getLongAttribute(), pluginConfig);
+                    addFromStringMethod(getLongAttribute(), pluginConfig);
+                } else {
+                    appendToFile(getOfStringImplTempFileHandle(), getOfMethodStringAndJavaDoc(getULongAttribute(),
+                            getGeneratedJavaClassName(), pluginConfig)
+                            + NEW_LINE);
+                    addGetterImpl(getULongAttribute(), pluginConfig);
+                    addFromStringMethod(getULongAttribute(), 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 {
+
+        JavaQualifiedTypeInfo 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 attr         attribute info
      * @param pluginConfig plugin configurations
      * @throws IOException when fails to append to temporary file
      */
@@ -263,9 +422,45 @@
     }
 
     /**
+     * Adds type constructor.
+     *
+     * @param pluginConfig plugin configurations
+     * @throws IOException when fails to append to temporary file
+     */
+    private void addTypeConstructor(YangPluginConfig pluginConfig)
+            throws IOException {
+        JavaAttributeInfo attr = getIntAttribute();
+        if (attr != null) {
+            attr = getUIntAttribute();
+        }
+        if (attr != null) {
+            if (attr.isIntConflict()) {
+                appendToFile(getConstructorForTypeTempFileHandle(), getTypeConstructorStringAndJavaDoc(
+                        getIntAttribute(),
+                        getUIntAttribute(), getGeneratedJavaClassName(), pluginConfig, INT_TYPE_CONFLICT,
+                        getIntIndex()
+                                < getUIntIndex()) + NEW_LINE);
+            }
+        }
+        attr = getLongAttribute();
+        if (attr != null) {
+            attr = getULongAttribute();
+        }
+        if (attr != null) {
+            if (attr.isLongConflict()) {
+                appendToFile(getConstructorForTypeTempFileHandle(), getTypeConstructorStringAndJavaDoc(
+                        getLongAttribute(),
+                        getULongAttribute(), getGeneratedJavaClassName(), pluginConfig, LONG_TYPE_CONFLICT,
+                        getLongIndex()
+                                < getULongIndex()) + NEW_LINE);
+            }
+        }
+    }
+
+    /**
      * Adds of string for type.
      *
-     * @param attr attribute info
+     * @param attr         attribute info
      * @param pluginConfig plugin configurations
      * @throws IOException when fails to append to temporary file
      */
@@ -279,22 +474,19 @@
     /**
      * Removes all temporary file handles.
      *
-     * @param isErrorOccurred when translator fails to generate java files we
-     * need to close all open file handles include temporary files
-     * and java files.
+     * @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 {
-        boolean isError = isErrorOccurred;
 
         if ((getGeneratedJavaFiles() & GENERATE_TYPEDEF_CLASS) != 0) {
-            closeFile(getTypedefClassJavaFileHandle(), isError);
+            closeFile(getTypedefClassJavaFileHandle(), isErrorOccurred);
         }
 
         if ((getGeneratedJavaFiles() & GENERATE_UNION_CLASS) != 0) {
-            closeFile(getTypeClassJavaFileHandle(), isError);
+            closeFile(getTypeClassJavaFileHandle(), isErrorOccurred);
         }
 
         if ((getGeneratedTempFiles() & CONSTRUCTOR_FOR_TYPE_MASK) != 0) {
@@ -315,7 +507,7 @@
      * Constructs java code exit.
      *
      * @param fileType generated file type
-     * @param curNode current YANG node
+     * @param curNode  current YANG node
      * @throws IOException when fails to generate java files
      */
     @Override
@@ -350,4 +542,219 @@
          */
         freeTemporaryResources(false);
     }
+
+    /**
+     * 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 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);
+            }
+
+        }
+    }
+
+    /**
+     * 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;
+    }
 }
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/YangJavaModelUtils.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/YangJavaModelUtils.java
index ff28b66..3489eea 100644
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/YangJavaModelUtils.java
+++ b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/YangJavaModelUtils.java
@@ -147,7 +147,8 @@
                 }
             }
 
-        } else if (javaCodeGeneratorInfo instanceof YangLeavesHolder) {
+        }
+        if (javaCodeGeneratorInfo instanceof YangLeavesHolder) {
             /*
              * Container
              * Case
@@ -189,7 +190,7 @@
      * @throws IOException IO operations fails
      */
     private static void generateTempFiles(JavaCodeGeneratorInfo javaCodeGeneratorInfo,
-                                         YangPluginConfig yangPluginConfig)
+                                          YangPluginConfig yangPluginConfig)
             throws IOException {
         if (!(javaCodeGeneratorInfo instanceof YangNode)) {
             throw new TranslatorException("translation is not supported for the node");
@@ -456,7 +457,7 @@
     /**
      * Returns augment class name.
      *
-     * @param augment YANG augment
+     * @param augment          YANG augment
      * @param yangPluginConfig plugin configurations
      * @return augment class name
      */
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaModule.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaModule.java
index 5dae614..db5d060 100644
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaModule.java
+++ b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaModule.java
@@ -36,8 +36,8 @@
 import static org.onosproject.yangutils.translator.tojava.YangJavaModelUtils.isGenerationOfCodeReq;
 import static org.onosproject.yangutils.translator.tojava.YangJavaModelUtils.isManagerCodeGenRequired;
 import static org.onosproject.yangutils.translator.tojava.utils.JavaIdentifierSyntax.getRootPackage;
-import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.searchAndDeleteTempDir;
 import static org.onosproject.yangutils.utils.UtilConstants.SBI;
+import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.searchAndDeleteTempDir;
 
 /**
  * Represents module information extended to support java code generation.
@@ -212,7 +212,7 @@
      * @param rootNode root node of the data model
      * @return status of rpc's existence
      */
-    public boolean isNotificationChildNodePresent(YangNode rootNode) {
+    private boolean isNotificationChildNodePresent(YangNode rootNode) {
         YangNode childNode = rootNode.getChild();
 
         while (childNode != null) {
@@ -222,9 +222,6 @@
             childNode = childNode.getNextSibling();
         }
 
-        if (!getNotificationNodes().isEmpty()) {
-            return true;
-        }
-        return false;
+        return !getNotificationNodes().isEmpty();
     }
 }
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaSubModule.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaSubModule.java
index 4de196c..73d7583 100644
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaSubModule.java
+++ b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaSubModule.java
@@ -194,7 +194,6 @@
         }
     }
 
-
     /**
      * Returns notifications node list.
      *
@@ -219,7 +218,7 @@
      * @param rootNode root node of the data model
      * @return status of rpc's existence
      */
-    public boolean isNotificationChildNodePresent(YangNode rootNode) {
+    private boolean isNotificationChildNodePresent(YangNode rootNode) {
         YangNode childNode = rootNode.getChild();
 
         while (childNode != null) {
@@ -229,9 +228,6 @@
             childNode = childNode.getNextSibling();
         }
 
-        if (!getNotificationNodes().isEmpty()) {
-            return true;
-        }
-        return false;
+        return !getNotificationNodes().isEmpty();
     }
 }
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/utils/ClassDefinitionGenerator.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/utils/ClassDefinitionGenerator.java
index e778a84..7631bb6 100644
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/utils/ClassDefinitionGenerator.java
+++ b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/utils/ClassDefinitionGenerator.java
@@ -182,7 +182,7 @@
      * @return definition
      */
     private static String getBuilderInterfaceDefinition(String yangName, YangNode curNode) {
-        if (!(curNode instanceof YangCase)) {
+        if (!(curNode instanceof YangCase) && !(curNode instanceof YangAugment)) {
             String clsDef = getClassDefinitionForWhenExtended(curNode, yangName, BUILDER_INTERFACE_MASK);
             if (clsDef != null) {
                 return clsDef;
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/utils/JavaCodeSnippetGen.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/utils/JavaCodeSnippetGen.java
index cd361d0..1057bde 100644
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/utils/JavaCodeSnippetGen.java
+++ b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/utils/JavaCodeSnippetGen.java
@@ -42,10 +42,14 @@
 import static org.onosproject.yangutils.utils.UtilConstants.IMMEDIATE;
 import static org.onosproject.yangutils.utils.UtilConstants.IMPORT;
 import static org.onosproject.yangutils.utils.UtilConstants.INT;
+import static org.onosproject.yangutils.utils.UtilConstants.INT_MAX_RANGE_ATTR;
+import static org.onosproject.yangutils.utils.UtilConstants.INT_MIN_RANGE_ATTR;
 import static org.onosproject.yangutils.utils.UtilConstants.LIST;
 import static org.onosproject.yangutils.utils.UtilConstants.LISTENER_SERVICE;
 import static org.onosproject.yangutils.utils.UtilConstants.LOGGER_FACTORY_IMPORT;
 import static org.onosproject.yangutils.utils.UtilConstants.LOGGER_IMPORT;
+import static org.onosproject.yangutils.utils.UtilConstants.LONG_MAX_RANGE_ATTR;
+import static org.onosproject.yangutils.utils.UtilConstants.LONG_MIN_RANGE_ATTR;
 import static org.onosproject.yangutils.utils.UtilConstants.MAP;
 import static org.onosproject.yangutils.utils.UtilConstants.NEW;
 import static org.onosproject.yangutils.utils.UtilConstants.NEW_LINE;
@@ -61,6 +65,10 @@
 import static org.onosproject.yangutils.utils.UtilConstants.SPACE;
 import static org.onosproject.yangutils.utils.UtilConstants.TRUE;
 import static org.onosproject.yangutils.utils.UtilConstants.TYPE;
+import static org.onosproject.yangutils.utils.UtilConstants.UINT_MAX_RANGE_ATTR;
+import static org.onosproject.yangutils.utils.UtilConstants.UINT_MIN_RANGE_ATTR;
+import static org.onosproject.yangutils.utils.UtilConstants.ULONG_MAX_RANGE_ATTR;
+import static org.onosproject.yangutils.utils.UtilConstants.ULONG_MIN_RANGE_ATTR;
 import static org.onosproject.yangutils.utils.UtilConstants.YANG_AUGMENTED_INFO;
 import static org.onosproject.yangutils.utils.io.impl.JavaDocGen.JavaDocType.ENUM_ATTRIBUTE;
 import static org.onosproject.yangutils.utils.io.impl.JavaDocGen.getJavaDoc;
@@ -97,22 +105,23 @@
      * @param importInfo import info
      * @return the textual java code information corresponding to the import list
      */
-    public static String getImportText(JavaQualifiedTypeInfo importInfo) {
+    static String getImportText(JavaQualifiedTypeInfo importInfo) {
         return IMPORT + importInfo.getPkgInfo() + PERIOD + importInfo.getClassInfo() + SEMI_COLAN + NEW_LINE;
     }
 
     /**
      * Returns the textual java code for attribute definition in class.
      *
-     * @param javaAttributeTypePkg  Package of the attribute type
-     * @param javaAttributeType     java attribute type
-     * @param javaAttributeName     name of the attribute
-     * @param isList                is list attribute
-     * @param attributeAccessType   attribute access type
-     * @return  the textual java code for attribute definition in class
+     * @param javaAttributeTypePkg Package of the attribute type
+     * @param javaAttributeType    java attribute type
+     * @param javaAttributeName    name of the attribute
+     * @param isList               is list attribute
+     * @param attributeAccessType  attribute access type
+     * @return the textual java code for attribute definition in class
      */
     public static String getJavaAttributeDefination(String javaAttributeTypePkg, String javaAttributeType,
-            String javaAttributeName, boolean isList, String attributeAccessType) {
+                                                    String javaAttributeName, boolean isList,
+                                                    String attributeAccessType) {
 
         String attributeDefination = attributeAccessType + SPACE;
 
@@ -209,7 +218,7 @@
      *
      * @return event enum start
      */
-    public static String getEventEnumTypeStart() {
+    static String getEventEnumTypeStart() {
         return FOUR_SPACE_INDENTATION + PUBLIC + SPACE + ENUM + SPACE + TYPE + SPACE + OPEN_CURLY_BRACKET
                 + NEW_LINE;
     }
@@ -261,7 +270,7 @@
      * @param className enum's class name
      * @return enum's attribute
      */
-    public static String getEnumsValueAttribute(String className) {
+    static String getEnumsValueAttribute(String className) {
         return NEW_LINE + FOUR_SPACE_INDENTATION + PRIVATE + SPACE + INT + SPACE + getSmallCase(className)
                 + SEMI_COLAN + NEW_LINE;
     }
@@ -271,7 +280,7 @@
      *
      * @return component string
      */
-    public static String addComponentString() {
+    static String addComponentString() {
         return NEW_LINE + COMPONENT_ANNOTATION + OPEN_PARENTHESIS + IMMEDIATE + SPACE
                 + EQUAL + SPACE + TRUE + CLOSE_PARENTHESIS + NEW_LINE + SERVICE_ANNOTATION;
     }
@@ -281,11 +290,46 @@
      *
      * @return attribute for augmentation
      */
-    public static String addAugmentationAttribute() {
+    static String addAugmentationAttribute() {
         return NEW_LINE + FOUR_SPACE_INDENTATION + PRIVATE + SPACE + MAP + DIAMOND_OPEN_BRACKET + CLASS_STRING
                 + DIAMOND_OPEN_BRACKET + QUESTION_MARK + DIAMOND_CLOSE_BRACKET + COMMA + SPACE + YANG_AUGMENTED_INFO
                 + DIAMOND_CLOSE_BRACKET + SPACE + getSmallCase(YANG_AUGMENTED_INFO) + MAP + SPACE + EQUAL + SPACE +
                 NEW + SPACE + HASH_MAP + DIAMOND_OPEN_BRACKET + DIAMOND_CLOSE_BRACKET + OPEN_PARENTHESIS
                 + CLOSE_PARENTHESIS + SEMI_COLAN;
     }
+
+    /**
+     * 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 NEW_LINE + FOUR_SPACE_INDENTATION + modifier + SPACE + INT_MIN_RANGE_ATTR + FOUR_SPACE_INDENTATION +
+                    modifier +
+                    SPACE + INT_MAX_RANGE_ATTR;
+        } else {
+            return NEW_LINE + FOUR_SPACE_INDENTATION + modifier + SPACE + UINT_MIN_RANGE_ATTR + FOUR_SPACE_INDENTATION +
+                    modifier + SPACE + 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 NEW_LINE + FOUR_SPACE_INDENTATION + modifier + SPACE + LONG_MIN_RANGE_ATTR + FOUR_SPACE_INDENTATION +
+                    modifier + SPACE + LONG_MAX_RANGE_ATTR;
+        } else {
+            return NEW_LINE + FOUR_SPACE_INDENTATION + modifier + SPACE + ULONG_MIN_RANGE_ATTR +
+                    FOUR_SPACE_INDENTATION + modifier + SPACE + ULONG_MAX_RANGE_ATTR;
+        }
+    }
 }
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/utils/JavaFileGenerator.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/utils/JavaFileGenerator.java
index c8d55d7..fa0ef19 100644
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/utils/JavaFileGenerator.java
+++ b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/utils/JavaFileGenerator.java
@@ -28,6 +28,7 @@
 import org.onosproject.yangutils.datamodel.YangLeavesHolder;
 import org.onosproject.yangutils.datamodel.YangModule;
 import org.onosproject.yangutils.datamodel.YangNode;
+import org.onosproject.yangutils.datamodel.YangSubModule;
 import org.onosproject.yangutils.datamodel.YangType;
 import org.onosproject.yangutils.datamodel.YangTypeDef;
 import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes;
@@ -40,6 +41,7 @@
 import org.onosproject.yangutils.translator.tojava.TempJavaEnumerationFragmentFiles;
 import org.onosproject.yangutils.translator.tojava.TempJavaEventFragmentFiles;
 import org.onosproject.yangutils.translator.tojava.TempJavaServiceFragmentFiles;
+import org.onosproject.yangutils.translator.tojava.TempJavaTypeFragmentFiles;
 import org.onosproject.yangutils.translator.tojava.YangJavaModelUtils;
 import org.onosproject.yangutils.utils.io.impl.YangPluginConfig;
 
@@ -121,6 +123,7 @@
 import static org.onosproject.yangutils.translator.tojava.utils.MethodsGenerator.getToStringSelectLeafListgetter;
 import static org.onosproject.yangutils.translator.tojava.utils.MethodsGenerator.getToStringSelectLeafgetter;
 import static org.onosproject.yangutils.utils.UtilConstants.BASE64;
+import static org.onosproject.yangutils.utils.UtilConstants.BIG_INTEGER;
 import static org.onosproject.yangutils.utils.UtilConstants.BITSET;
 import static org.onosproject.yangutils.utils.UtilConstants.BUILDER;
 import static org.onosproject.yangutils.utils.UtilConstants.CLOSE_CURLY_BRACKET;
@@ -179,6 +182,7 @@
 import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.insertDataIntoJavaFile;
 import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.trimAtLast;
 import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.validateLineLength;
+import static java.util.Collections.sort;
 
 /**
  * Representation of java file generator.
@@ -205,7 +209,7 @@
         JavaFileInfo javaFileInfo = ((JavaFileInfoContainer) curNode).getJavaFileInfo();
 
         String path;
-        if (curNode instanceof YangModule) {
+        if (curNode instanceof YangModule || curNode instanceof YangSubModule) {
             path = javaFileInfo.getPluginConfig().getCodeGenDir() + javaFileInfo.getPackageFilePath();
         } else {
             path = javaFileInfo.getBaseCodeGenPath() + javaFileInfo.getPackageFilePath();
@@ -216,13 +220,9 @@
         initiateJavaFileGeneration(file, INTERFACE_MASK, imports, curNode, className);
 
         if (isAttrPresent) {
-            /**
-             * Add getter methods to interface file.
-             */
+            // Add getter methods to interface file.
             try {
-                /**
-                 * Getter methods.
-                 */
+                //Getter methods.
                 insertDataIntoJavaFile(file, getDataFromTempFileHandle(GETTER_FOR_INTERFACE_MASK,
                         ((TempJavaCodeFragmentFilesContainer) curNode).getTempJavaCodeFragmentFiles()
                                 .getBeanTempFiles(), path));
@@ -251,7 +251,7 @@
 
         String className = getCapitalCase(javaFileInfo.getJavaName());
         String path;
-        if (curNode instanceof YangModule) {
+        if (curNode instanceof YangModule || curNode instanceof YangSubModule) {
             path = javaFileInfo.getPluginConfig().getCodeGenDir() + javaFileInfo.getPackageFilePath();
         } else {
             path = javaFileInfo.getBaseCodeGenPath() + javaFileInfo.getPackageFilePath();
@@ -261,15 +261,13 @@
         List<String> methods = new ArrayList<>();
         if (isAttrPresent) {
             try {
-                /**
-                 * Getter methods.
-                 */
+
+                //Getter methods.
                 methods.add(FOUR_SPACE_INDENTATION + getDataFromTempFileHandle(GETTER_FOR_INTERFACE_MASK,
                         ((TempJavaCodeFragmentFilesContainer) curNode).getTempJavaCodeFragmentFiles()
                                 .getBeanTempFiles(), path));
-                /**
-                 * Setter methods.
-                 */
+
+                //Setter methods.
                 methods.add(NEW_LINE);
                 methods.add(FOUR_SPACE_INDENTATION + getDataFromTempFileHandle(SETTER_FOR_INTERFACE_MASK,
                         ((TempJavaCodeFragmentFilesContainer) curNode).getTempJavaCodeFragmentFiles()
@@ -279,16 +277,14 @@
                         + " while builder interface file generation");
             }
         }
-        /**
-         * Add build method to builder interface file.
-         */
+
+        //Add build method to builder interface file.
         methods.add(
                 ((TempJavaCodeFragmentFilesContainer) curNode).getTempJavaCodeFragmentFiles()
                         .addBuildMethodForInterface(pluginConfig));
 
-        /**
-         * Add getters and setters in builder interface.
-         */
+
+        //Add getters and setters in builder interface.
         for (String method : methods) {
             insertDataIntoJavaFile(file, method);
         }
@@ -315,7 +311,7 @@
         String className = getCapitalCase(javaFileInfo.getJavaName());
 
         String path;
-        if (curNode instanceof YangModule) {
+        if (curNode instanceof YangModule || curNode instanceof YangSubModule) {
             path = javaFileInfo.getPluginConfig().getCodeGenDir() + javaFileInfo.getPackageFilePath();
         } else {
             path = javaFileInfo.getBaseCodeGenPath() + javaFileInfo.getPackageFilePath();
@@ -325,9 +321,8 @@
         List<String> methods = new ArrayList<>();
 
         if (isAttrPresent) {
-            /**
-             * Add attribute strings.
-             */
+
+            //Add attribute strings.
             try {
                 insertDataIntoJavaFile(file,
                         NEW_LINE + FOUR_SPACE_INDENTATION + getDataFromTempFileHandle(ATTRIBUTES_MASK,
@@ -339,15 +334,11 @@
             }
 
             try {
-                /**
-                 * Getter methods.
-                 */
+                //Getter methods.
                 methods.add(getDataFromTempFileHandle(GETTER_FOR_CLASS_MASK,
                         ((TempJavaCodeFragmentFilesContainer) curNode).getTempJavaCodeFragmentFiles()
                                 .getBeanTempFiles(), path));
-                /**
-                 * Setter methods.
-                 */
+                // Setter methods.
                 methods.add(getDataFromTempFileHandle(SETTER_FOR_CLASS_MASK,
                         ((TempJavaCodeFragmentFilesContainer) curNode).getTempJavaCodeFragmentFiles()
                                 .getBeanTempFiles(), path));
@@ -360,17 +351,15 @@
         } else {
             insertDataIntoJavaFile(file, NEW_LINE);
         }
-        /**
-         * Add default constructor and build method impl.
-         */
+
+        // Add default constructor and build method impl.
         methods.add(((TempJavaCodeFragmentFilesContainer) curNode).getTempJavaCodeFragmentFiles()
                 .addBuildMethodImpl());
         methods.add(((TempJavaCodeFragmentFilesContainer) curNode).getTempJavaCodeFragmentFiles()
                 .addDefaultConstructor(PUBLIC, BUILDER, pluginConfig));
 
-        /**
-         * Add methods in builder class.
-         */
+
+        //Add methods in builder class.
         for (String method : methods) {
             insertDataIntoJavaFile(file, method);
         }
@@ -399,9 +388,7 @@
         List<String> methods = new ArrayList<>();
 
         if (isAttrPresent) {
-            /**
-             * Add attribute strings.
-             */
+            //Add attribute strings.
             try {
                 insertDataIntoJavaFile(file, FOUR_SPACE_INDENTATION + PRIVATE + SPACE +
                         OPERATION_ENUM + SPACE + OP_PARAM_TYPE + SEMI_COLAN + NEW_LINE);
@@ -448,9 +435,7 @@
             }
 
             try {
-                /**
-                 * Setter methods.
-                 */
+                // Setter methods.
                 methods.add(getSetterForLeaf(className, curNode, pluginConfig));
                 methods.add(getSetterForLeafList(className, curNode, pluginConfig));
 
@@ -481,9 +466,7 @@
             insertDataIntoJavaFile(file, NEW_LINE);
         }
 
-        /**
-         * Add methods in builder class.
-         */
+        // Add methods in builder class.
         for (String method : methods) {
             insertDataIntoJavaFile(file, method);
         }
@@ -523,14 +506,10 @@
         JavaAttributeInfo rootAttribute = getCurNodeAsAttributeInTarget(curNode, curNode, false,
                 tempJavaServiceFragmentFiles);
         try {
-            /**
-             * Getter methods.
-             */
+            //Getter methods.
             methods.add(getOverRideString() +
                     getGetterForClass(rootAttribute, GENERATE_SERVICE_AND_MANAGER) + NEW_LINE);
-            /**
-             * Setter methods.
-             */
+            // Setter methods.
             methods.add(getOverRideString() +
                     getSetterForClass(rootAttribute, className, GENERATE_SERVICE_AND_MANAGER)
                     + NEW_LINE);
@@ -538,12 +517,11 @@
             methods.add(getAugmentsDataMethodForManager(curNode) + NEW_LINE);
 
             if (((JavaCodeGeneratorInfo) curNode).getTempJavaCodeFragmentFiles().getServiceTempFiles() != null) {
-                JavaCodeGeneratorInfo javaGeninfo = (JavaCodeGeneratorInfo) curNode;
-                /**
-                 * Rpc methods
-                 */
+                JavaCodeGeneratorInfo javaGenInfo = (JavaCodeGeneratorInfo) curNode;
+
+                //Rpc methods
                 methods.add(getDataFromTempFileHandle(RPC_IMPL_MASK,
-                        javaGeninfo.getTempJavaCodeFragmentFiles().getServiceTempFiles(), path));
+                        javaGenInfo.getTempJavaCodeFragmentFiles().getServiceTempFiles(), path));
             }
             insertDataIntoJavaFile(file, NEW_LINE);
 
@@ -552,9 +530,7 @@
                     + " while manager class file generation");
         }
 
-        /**
-         * Add methods in builder class.
-         */
+        // Add methods in builder class.
         for (String method : methods) {
             insertDataIntoJavaFile(file, method);
         }
@@ -579,7 +555,7 @@
 
         String className = getCapitalCase(javaFileInfo.getJavaName());
         String path;
-        if (curNode instanceof YangModule) {
+        if (curNode instanceof YangModule || curNode instanceof YangSubModule) {
             path = javaFileInfo.getPluginConfig().getCodeGenDir() + javaFileInfo.getPackageFilePath();
         } else {
             path = javaFileInfo.getBaseCodeGenPath() + javaFileInfo.getPackageFilePath();
@@ -592,9 +568,8 @@
             insertDataIntoJavaFile(file, addAugmentationAttribute());
         }
         if (isAttrPresent) {
-            /**
-             * Add attribute strings.
-             */
+
+            //Add attribute strings.
             try {
                 insertDataIntoJavaFile(file,
                         NEW_LINE + FOUR_SPACE_INDENTATION + getDataFromTempFileHandle(ATTRIBUTES_MASK,
@@ -606,30 +581,25 @@
             }
 
             try {
-                /**
-                 * Getter methods.
-                 */
+                //Getter methods.
                 methods.add(getDataFromTempFileHandle(GETTER_FOR_CLASS_MASK,
                         ((TempJavaCodeFragmentFilesContainer) curNode).getTempJavaCodeFragmentFiles()
                                 .getBeanTempFiles(), path));
 
-                /**
-                 * Hash code method.
-                 */
+
+                // Hash code method.
                 methods.add(getHashCodeMethodClose(getHashCodeMethodOpen() +
                         getDataFromTempFileHandle(HASH_CODE_IMPL_MASK,
                                 ((TempJavaCodeFragmentFilesContainer) curNode).getTempJavaCodeFragmentFiles()
                                         .getBeanTempFiles(), path).replace(NEW_LINE, EMPTY_STRING)));
-                /**
-                 * Equals method.
-                 */
+
+                //Equals method.
                 methods.add(getEqualsMethodClose(getEqualsMethodOpen(getCapitalCase(DEFAULT) + className)
                         + getDataFromTempFileHandle(EQUALS_IMPL_MASK,
                         ((TempJavaCodeFragmentFilesContainer) curNode).getTempJavaCodeFragmentFiles()
                                 .getBeanTempFiles(), path)));
-                /**
-                 * To string method.
-                 */
+
+                // To string method.
                 methods.add(getToStringMethodOpen() + getDataFromTempFileHandle(TO_STRING_IMPL_MASK,
                         ((TempJavaCodeFragmentFilesContainer) curNode).getTempJavaCodeFragmentFiles()
                                 .getBeanTempFiles(), path)
@@ -644,9 +614,7 @@
         }
         try {
 
-            /**
-             * Constructor.
-             */
+            //Constructor.
             String constructor = getConstructorStart(className, pluginConfig);
             constructor = constructor + getDataFromTempFileHandle(CONSTRUCTOR_IMPL_MASK,
                     ((TempJavaCodeFragmentFilesContainer) curNode).getTempJavaCodeFragmentFiles()
@@ -664,9 +632,7 @@
             methods.add(getAugmentInfoMapImpl(javaFileInfo.getPluginConfig()));
         }
 
-        /**
-         * Add methods in impl class.
-         */
+        // Add methods in impl class.
         for (String method : methods) {
             insertDataIntoJavaFile(file, method);
         }
@@ -698,9 +664,8 @@
         List<String> methods = new ArrayList<>();
 
         if (isAttrPresent) {
-            /**
-             * Add attribute strings.
-             */
+
+            // Add attribute strings.
             try {
                 insertDataIntoJavaFile(file, FOUR_SPACE_INDENTATION + PUBLIC + SPACE + STATIC +
                         SPACE + ENUM + SPACE + OPERATION_ENUM + SPACE + OPEN_CURLY_BRACKET +
@@ -716,9 +681,8 @@
                         + " while impl class file generation");
             }
 
-            /**
-             * Add attribute strings.
-             */
+
+            // Add attribute strings.
             try {
                 insertDataIntoJavaFile(file, FOUR_SPACE_INDENTATION + PRIVATE + SPACE +
                         OPERATION_ENUM + SPACE + OP_PARAM_TYPE + SEMI_COLAN + NEW_LINE);
@@ -822,9 +786,7 @@
             methods.add(getBaseClassMethodImpl(clsName));
         }
 
-        /**
-         * Add methods in impl class.
-         */
+        // Add methods in impl class.
         for (String method : methods) {
             insertDataIntoJavaFile(file, method);
         }
@@ -862,9 +824,8 @@
 
         List<String> methods = new ArrayList<>();
 
-        /**
-         * Add attribute strings.
-         */
+
+        //Add attribute strings.
         try {
             insertDataIntoJavaFile(file,
                     NEW_LINE + FOUR_SPACE_INDENTATION + getDataFromTempFileHandle(ATTRIBUTES_MASK,
@@ -875,94 +836,85 @@
                     + " while type def class file generation");
         }
 
-        /**
-         * Default constructor.
-         */
+
+        //Default constructor.
         methods.add(((TempJavaCodeFragmentFilesContainer) curNode).getTempJavaCodeFragmentFiles()
                 .addDefaultConstructor(PRIVATE, EMPTY_STRING, pluginConfig));
 
         try {
 
-            /**
-             * Type constructor.
-             */
+
+            //Type constructor.
             methods.add(getDataFromTempFileHandle(CONSTRUCTOR_FOR_TYPE_MASK,
                     ((TempJavaCodeFragmentFilesContainer) curNode).getTempJavaCodeFragmentFiles().getTypeTempFiles(),
                     path));
 
-            /**
-             * Of method.
-             */
+
+            //Of method.
             methods.add(getDataFromTempFileHandle(OF_STRING_IMPL_MASK,
                     ((TempJavaCodeFragmentFilesContainer) curNode).getTempJavaCodeFragmentFiles().getTypeTempFiles(),
                     path));
 
-            /**
-             * Getter method.
-             */
+            //Getter methods.
             methods.add(getDataFromTempFileHandle(GETTER_FOR_CLASS_MASK,
                     ((TempJavaCodeFragmentFilesContainer) curNode).getTempJavaCodeFragmentFiles().getTypeTempFiles(),
                     path));
 
-            /**
-             * Hash code method.
-             */
+
+            // Hash code method.
             methods.add(getHashCodeMethodClose(getHashCodeMethodOpen() +
                     getDataFromTempFileHandle(HASH_CODE_IMPL_MASK,
                             ((TempJavaCodeFragmentFilesContainer) curNode).getTempJavaCodeFragmentFiles()
                                     .getTypeTempFiles(), path)
                             .replace(NEW_LINE, EMPTY_STRING)));
 
-            /**
-             * Equals method.
-             */
+
+            //Equals method.
             methods.add(getEqualsMethodClose(getEqualsMethodOpen(className + EMPTY_STRING)
                     + getDataFromTempFileHandle(EQUALS_IMPL_MASK,
                     ((TempJavaCodeFragmentFilesContainer) curNode).getTempJavaCodeFragmentFiles()
                             .getTypeTempFiles(), path)));
 
-            /**
-             * To string method.
-             */
-             if (type.getDataType().equals(YangDataTypes.BINARY)) {
-                    JavaQualifiedTypeInfo qualifiedTypeInfo = getQualifiedTypeInfoOfCurNode(curNode,
-                                                                                            getCapitalCase("binary"));
 
-                    JavaAttributeInfo attr =  getAttributeInfoForTheData(qualifiedTypeInfo, "binary", null, false,
-                                                                         false);
-                    String attributeName = attr.getAttributeName();
-                    String bitsToStringMethod = MethodsGenerator.getOverRideString() + FOUR_SPACE_INDENTATION + PUBLIC
-                            + SPACE + STRING_DATA_TYPE + SPACE + TO + STRING_DATA_TYPE + OPEN_PARENTHESIS
-                            + CLOSE_PARENTHESIS + SPACE + OPEN_CURLY_BRACKET + NEW_LINE + EIGHT_SPACE_INDENTATION
-                            + RETURN + SPACE + BASE64 + PERIOD + GET_ENCODER + OPEN_PARENTHESIS + CLOSE_PARENTHESIS
-                            + PERIOD + ENCODE_TO_STRING + OPEN_PARENTHESIS + attributeName + CLOSE_PARENTHESIS
-                            + SEMI_COLAN + NEW_LINE + FOUR_SPACE_INDENTATION + CLOSE_CURLY_BRACKET + NEW_LINE;
-                    methods.add(bitsToStringMethod);
-             } else if (type.getDataType().equals(YangDataTypes.BITS)) {
-                    JavaQualifiedTypeInfo qualifiedTypeInfo = getQualifiedTypeInfoOfCurNode(curNode,
-                                                                                            getCapitalCase("bits"));
+            //To string method.
+            if (type.getDataType().equals(YangDataTypes.BINARY)) {
+                JavaQualifiedTypeInfo qualifiedTypeInfo = getQualifiedTypeInfoOfCurNode(curNode,
+                        getCapitalCase("binary"));
 
-                    JavaAttributeInfo attr =  getAttributeInfoForTheData(qualifiedTypeInfo, "bits", null, false, false);
-                    String attributeName = attr.getAttributeName();
-                    String bitsToStringMethod = MethodsGenerator.getOverRideString() + FOUR_SPACE_INDENTATION + PUBLIC
-                            + SPACE + STRING_DATA_TYPE + SPACE + TO + STRING_DATA_TYPE + OPEN_PARENTHESIS
-                            + CLOSE_PARENTHESIS + SPACE + OPEN_CURLY_BRACKET + NEW_LINE + EIGHT_SPACE_INDENTATION
-                            + RETURN + SPACE + attributeName + PERIOD + TO + STRING_DATA_TYPE + OPEN_PARENTHESIS
-                            + CLOSE_PARENTHESIS + SEMI_COLAN + NEW_LINE + FOUR_SPACE_INDENTATION + CLOSE_CURLY_BRACKET
-                            + NEW_LINE;
-                    methods.add(bitsToStringMethod);
+                JavaAttributeInfo attr = getAttributeInfoForTheData(qualifiedTypeInfo, "binary", null, false,
+                        false);
+                String attributeName = attr.getAttributeName();
+                String bitsToStringMethod = MethodsGenerator.getOverRideString() + FOUR_SPACE_INDENTATION + PUBLIC
+                        + SPACE + STRING_DATA_TYPE + SPACE + TO + STRING_DATA_TYPE + OPEN_PARENTHESIS
+                        + CLOSE_PARENTHESIS + SPACE + OPEN_CURLY_BRACKET + NEW_LINE + EIGHT_SPACE_INDENTATION
+                        + RETURN + SPACE + BASE64 + PERIOD + GET_ENCODER + OPEN_PARENTHESIS + CLOSE_PARENTHESIS
+                        + PERIOD + ENCODE_TO_STRING + OPEN_PARENTHESIS + attributeName + CLOSE_PARENTHESIS
+                        + SEMI_COLAN + NEW_LINE + FOUR_SPACE_INDENTATION + CLOSE_CURLY_BRACKET + NEW_LINE;
+                methods.add(bitsToStringMethod);
+            } else if (type.getDataType().equals(YangDataTypes.BITS)) {
+                JavaQualifiedTypeInfo qualifiedTypeInfo = getQualifiedTypeInfoOfCurNode(curNode,
+                        getCapitalCase("bits"));
+
+                JavaAttributeInfo attr = getAttributeInfoForTheData(qualifiedTypeInfo, "bits", null, false, false);
+                String attributeName = attr.getAttributeName();
+                String bitsToStringMethod = MethodsGenerator.getOverRideString() + FOUR_SPACE_INDENTATION + PUBLIC
+                        + SPACE + STRING_DATA_TYPE + SPACE + TO + STRING_DATA_TYPE + OPEN_PARENTHESIS
+                        + CLOSE_PARENTHESIS + SPACE + OPEN_CURLY_BRACKET + NEW_LINE + EIGHT_SPACE_INDENTATION
+                        + RETURN + SPACE + attributeName + PERIOD + TO + STRING_DATA_TYPE + OPEN_PARENTHESIS
+                        + CLOSE_PARENTHESIS + SEMI_COLAN + NEW_LINE + FOUR_SPACE_INDENTATION + CLOSE_CURLY_BRACKET
+                        + NEW_LINE;
+                methods.add(bitsToStringMethod);
             } else {
                 methods.add(getToStringMethodOpen() + getDataFromTempFileHandle(TO_STRING_IMPL_MASK,
-                    ((TempJavaCodeFragmentFilesContainer) curNode).getTempJavaCodeFragmentFiles().getTypeTempFiles(),
-                    path) + getToStringMethodClose());
+                        ((TempJavaCodeFragmentFilesContainer) curNode).getTempJavaCodeFragmentFiles()
+                                .getTypeTempFiles(), path) + getToStringMethodClose());
             }
 
-            JavaCodeGeneratorInfo javaGeninfo = (JavaCodeGeneratorInfo) curNode;
-            /**
-             * From string method.
-             */
+            JavaCodeGeneratorInfo javaGenInfo = (JavaCodeGeneratorInfo) curNode;
+
+            //From string method.
             methods.add(getFromStringMethodSignature(className, pluginConfig)
-                    + getDataFromTempFileHandle(FROM_STRING_IMPL_MASK, javaGeninfo.getTempJavaCodeFragmentFiles()
+                    + getDataFromTempFileHandle(FROM_STRING_IMPL_MASK, javaGenInfo.getTempJavaCodeFragmentFiles()
                     .getTypeTempFiles(), path)
                     + getFromStringMethodClose());
 
@@ -997,14 +949,50 @@
         String className = getCapitalCase(javaFileInfo.getJavaName());
         String path = javaFileInfo.getBaseCodeGenPath() + javaFileInfo.getPackageFilePath();
 
+        TempJavaTypeFragmentFiles tempJavaTypeFragmentFiles = ((JavaCodeGeneratorInfo) curNode)
+                .getTempJavaCodeFragmentFiles().getTypeTempFiles();
+
+        boolean isIntConflict = false;
+        boolean isLongConflict = false;
+        JavaAttributeInfo intAttr = tempJavaTypeFragmentFiles.getIntAttribute();
+        if (intAttr == null) {
+            intAttr = tempJavaTypeFragmentFiles.getUIntAttribute();
+        }
+
+        JavaAttributeInfo longAttr = tempJavaTypeFragmentFiles.getLongAttribute();
+        if (longAttr == null) {
+            longAttr = tempJavaTypeFragmentFiles.getULongAttribute();
+        }
+
+        if (intAttr != null) {
+            isIntConflict = intAttr.isIntConflict();
+        }
+        if (longAttr != null) {
+            isLongConflict = longAttr.isLongConflict();
+        }
+
+        if (isLongConflict) {
+            imports.add(tempJavaTypeFragmentFiles.getJavaImportData().getBigIntegerImport());
+            sort(imports);
+        }
+
         initiateJavaFileGeneration(file, className, GENERATE_UNION_CLASS, imports, path, pluginConfig);
 
         List<String> methods = new ArrayList<>();
 
-        /**
-         * Add attribute strings.
-         */
+
+        // Add attribute strings.
         try {
+            if (isIntConflict) {
+                insertDataIntoJavaFile(file, JavaCodeSnippetGen.addStaticAttributeIntRange(PRIVATE,
+                        tempJavaTypeFragmentFiles.getIntIndex() < tempJavaTypeFragmentFiles.getUIntIndex()));
+            }
+
+            if (isLongConflict) {
+                insertDataIntoJavaFile(file, JavaCodeSnippetGen.addStaticAttributeLongRange(PRIVATE,
+                        tempJavaTypeFragmentFiles.getLongIndex() < tempJavaTypeFragmentFiles.getULongIndex()));
+            }
+
             insertDataIntoJavaFile(file,
                     NEW_LINE + FOUR_SPACE_INDENTATION + getDataFromTempFileHandle(ATTRIBUTES_MASK,
                             ((TempJavaCodeFragmentFilesContainer) curNode).getTempJavaCodeFragmentFiles()
@@ -1014,70 +1002,67 @@
                     + " while union class file generation");
         }
 
-        /**
-         * Default constructor.
-         */
+
+        //Default constructor.
         methods.add(((TempJavaCodeFragmentFilesContainer) curNode).getTempJavaCodeFragmentFiles()
                 .addDefaultConstructor(PRIVATE, EMPTY_STRING, pluginConfig));
 
         try {
 
-            /**
-             * Type constructor.
-             */
+
+            //Type constructor.
             methods.add(getDataFromTempFileHandle(CONSTRUCTOR_FOR_TYPE_MASK,
                     ((TempJavaCodeFragmentFilesContainer) curNode).getTempJavaCodeFragmentFiles().getTypeTempFiles(),
                     path));
 
-            /**
-             * Of string method.
-             */
+
+            // Of string method.
             methods.add(getDataFromTempFileHandle(OF_STRING_IMPL_MASK,
                     ((TempJavaCodeFragmentFilesContainer) curNode).getTempJavaCodeFragmentFiles().getTypeTempFiles(),
                     path));
 
-            /**
-             * Getter method.
-             */
+            //Getter methods.
             methods.add(getDataFromTempFileHandle(GETTER_FOR_CLASS_MASK,
                     ((TempJavaCodeFragmentFilesContainer) curNode).getTempJavaCodeFragmentFiles().getTypeTempFiles(),
                     path));
 
-            /**
-             * Hash code method.
-             */
+
+            //Hash code method.
             methods.add(getHashCodeMethodClose(getHashCodeMethodOpen() +
                     getDataFromTempFileHandle(HASH_CODE_IMPL_MASK,
                             ((TempJavaCodeFragmentFilesContainer) curNode).getTempJavaCodeFragmentFiles()
                                     .getTypeTempFiles(), path)
                             .replace(NEW_LINE, EMPTY_STRING)));
 
-            /**
-             * Equals method.
-             */
+            //Equals method.
             methods.add(getEqualsMethodClose(getEqualsMethodOpen(className + EMPTY_STRING)
                     + getDataFromTempFileHandle(EQUALS_IMPL_MASK,
                     ((TempJavaCodeFragmentFilesContainer) curNode).getTempJavaCodeFragmentFiles()
                             .getTypeTempFiles(), path)));
 
-            /**
-             * To string method.
-             */
+
+            //To string method.
             methods.add(getToStringMethodOpen() + getOmitNullValueString() +
                     getDataFromTempFileHandle(TO_STRING_IMPL_MASK,
                             ((TempJavaCodeFragmentFilesContainer) curNode).getTempJavaCodeFragmentFiles()
                                     .getTypeTempFiles(), path)
                     + getToStringMethodClose());
 
-            /**
-             * From string method.
-             */
+
+            //From string method.
             methods.add(getFromStringMethodSignature(className, pluginConfig)
                     + getDataFromTempFileHandle(FROM_STRING_IMPL_MASK,
                     ((TempJavaCodeFragmentFilesContainer) curNode).getTempJavaCodeFragmentFiles()
                             .getTypeTempFiles(), path)
                     + getFromStringMethodClose());
 
+            if (isIntConflict) {
+                methods.add(MethodsGenerator.getRangeValidatorMethodForUnion(INT));
+            }
+            if (isLongConflict) {
+                methods.add(MethodsGenerator.getRangeValidatorMethodForUnion(BIG_INTEGER));
+            }
+
         } catch (IOException e) {
             throw new IOException("No data found in temporary java code fragment files for " + className
                     + " while union class file generation");
@@ -1109,13 +1094,12 @@
         String path = javaFileInfo.getBaseCodeGenPath() + javaFileInfo.getPackageFilePath();
 
         initiateJavaFileGeneration(file, getCapitalCase(className), GENERATE_ENUM_CLASS, null, path, pluginConfig);
-        /**
-         * Add attribute strings.
-         */
+
+        //Add attribute strings.
         try {
-            JavaCodeGeneratorInfo javaGeninfo = (JavaCodeGeneratorInfo) curNode;
+            JavaCodeGeneratorInfo javaGenInfo = (JavaCodeGeneratorInfo) curNode;
             insertDataIntoJavaFile(file,
-                    trimAtLast(trimAtLast(getDataFromTempFileHandle(ENUM_IMPL_MASK, javaGeninfo
+                    trimAtLast(trimAtLast(getDataFromTempFileHandle(ENUM_IMPL_MASK, javaGenInfo
                             .getTempJavaCodeFragmentFiles().getEnumerationTempFiles(), path), COMMA), NEW_LINE)
                             + SEMI_COLAN + NEW_LINE);
         } catch (IOException e) {
@@ -1123,15 +1107,11 @@
                     + " while enum class file generation");
         }
 
-        /**
-         * Add an
-         * attribute to get the enum's values.
-         */
+
+        // Add an attribute to get the enum's values.
         insertDataIntoJavaFile(file, getEnumsValueAttribute(getCapitalCase(className)));
 
-        /**
-         * Add a constructor for enum.
-         */
+        // Add a constructor for enum.
         insertDataIntoJavaFile(file, getJavaDoc(TYPE_CONSTRUCTOR, className, false, pluginConfig)
                 + getEnumsConstructor(getCapitalCase(className)) + NEW_LINE);
 
@@ -1144,9 +1124,7 @@
                 enumFragFiles.getEnumStringList(), pluginConfig)
                 + NEW_LINE);
 
-        /**
-         * Add a getter method for enum.
-         */
+        // Add a getter method for enum.
         insertDataIntoJavaFile(file, getJavaDoc(GETTER_METHOD, className, false, pluginConfig)
                 + getGetter(INT, className, GENERATE_ENUM_CLASS) + NEW_LINE);
 
@@ -1169,9 +1147,9 @@
     /**
      * Generates interface file for rpc.
      *
-     * @param file               generated file
-     * @param curNode            current YANG node
-     * @param imports            imports for file
+     * @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
      */
@@ -1191,26 +1169,22 @@
                 tempJavaServiceFragmentFiles);
 
         try {
-            /**
-             * Getter methods.
-             */
+
+            //Getter methods.
             methods.add(getGetterString(rootAttribute, GENERATE_SERVICE_AND_MANAGER,
                     javaFileInfo.getPluginConfig()) + NEW_LINE);
-            /**
-             * Setter methods.
-             */
+            // Setter methods.
             methods.add(getSetterString(rootAttribute, className, GENERATE_SERVICE_AND_MANAGER,
                     javaFileInfo.getPluginConfig()) + NEW_LINE);
 
             methods.add(getAugmentsDataMethodForService(curNode) + NEW_LINE);
 
             if (((JavaCodeGeneratorInfo) curNode).getTempJavaCodeFragmentFiles().getServiceTempFiles() != null) {
-                JavaCodeGeneratorInfo javaGeninfo = (JavaCodeGeneratorInfo) curNode;
-                /**
-                 * Rpc methods
-                 */
+                JavaCodeGeneratorInfo javaGenInfo = (JavaCodeGeneratorInfo) curNode;
+
+                // Rpc methods
                 methods.add(getDataFromTempFileHandle(RPC_INTERFACE_MASK,
-                        javaGeninfo.getTempJavaCodeFragmentFiles().getServiceTempFiles(), path));
+                        javaGenInfo.getTempJavaCodeFragmentFiles().getServiceTempFiles(), path));
             }
         } catch (IOException e) {
             throw new IOException("No data found in temporary java code fragment files for " + className
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/utils/JavaFileGeneratorUtils.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/utils/JavaFileGeneratorUtils.java
index f76d9b2..c5558ff 100644
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/utils/JavaFileGeneratorUtils.java
+++ b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/utils/JavaFileGeneratorUtils.java
@@ -57,7 +57,6 @@
 import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.OPERATION_BUILDER_CLASS_MASK;
 import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.OPERATION_CLASS_MASK;
 import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.ATTRIBUTES_MASK;
-import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.AUGMENTE_CLASS_CONSTRUCTOR_MASK;
 import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.CONSTRUCTOR_FOR_TYPE_MASK;
 import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.CONSTRUCTOR_IMPL_MASK;
 import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.ENUM_IMPL_MASK;
@@ -120,10 +119,10 @@
     /**
      * Returns a file object for generated file.
      *
-     * @param filePath  file package path
-     * @param fileName  file name
-     * @param extension file extension
-     * @param baseCodePath    cached file handle
+     * @param filePath     file package path
+     * @param fileName     file name
+     * @param extension    file extension
+     * @param baseCodePath cached file handle
      * @return file object
      */
     public static File getFileObject(String filePath, String fileName, String extension, String baseCodePath) {
@@ -205,10 +204,6 @@
             return tempJavaFragmentFiles
                     .getTemporaryDataFromFileHandle(tempJavaFragmentFiles.getToStringImplTempFileHandle(),
                             absolutePath);
-        } else if ((generatedTempFiles & AUGMENTE_CLASS_CONSTRUCTOR_MASK) != 0) {
-            return tempJavaFragmentFiles
-                    .getTemporaryDataFromFileHandle(tempJavaFragmentFiles.getAugmentConstructorImplTempFileHandle(),
-                            absolutePath);
         } else if ((generatedTempFiles & OF_STRING_IMPL_MASK) != 0) {
             if (typeFragmentFiles == null) {
                 throw new TranslatorException("Required of string implementation info is missing.");
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/utils/MethodsGenerator.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/utils/MethodsGenerator.java
index a8159a6..95b8af2 100644
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/utils/MethodsGenerator.java
+++ b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/utils/MethodsGenerator.java
@@ -23,6 +23,7 @@
 import org.onosproject.yangutils.datamodel.YangAugmentableNode;
 import org.onosproject.yangutils.datamodel.YangLeaf;
 import org.onosproject.yangutils.datamodel.YangLeafList;
+import org.onosproject.yangutils.datamodel.YangLeafRef;
 import org.onosproject.yangutils.datamodel.YangLeavesHolder;
 import org.onosproject.yangutils.datamodel.YangNode;
 import org.onosproject.yangutils.datamodel.YangType;
@@ -44,6 +45,7 @@
 import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.INT32;
 import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.INT64;
 import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.INT8;
+import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.LEAFREF;
 import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.UINT16;
 import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.UINT32;
 import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.UINT64;
@@ -55,8 +57,10 @@
 import static org.onosproject.yangutils.translator.tojava.utils.JavaFileGeneratorUtils.getAugmentedClassNameForDataMethods;
 import static org.onosproject.yangutils.translator.tojava.utils.JavaFileGeneratorUtils.getParentNodeNameForDataMethods;
 import static org.onosproject.yangutils.translator.tojava.utils.JavaFileGeneratorUtils.getSetOfNodeIdentifiers;
+import static org.onosproject.yangutils.translator.tojava.utils.ValidatorTypeForUnionTypes.INT_TYPE_CONFLICT;
 import static org.onosproject.yangutils.utils.UtilConstants.ACTIVATE;
 import static org.onosproject.yangutils.utils.UtilConstants.ACTIVATE_ANNOTATION;
+import static org.onosproject.yangutils.utils.UtilConstants.ADD;
 import static org.onosproject.yangutils.utils.UtilConstants.ADD_STRING;
 import static org.onosproject.yangutils.utils.UtilConstants.AND;
 import static org.onosproject.yangutils.utils.UtilConstants.APP_INSTANCE;
@@ -91,6 +95,7 @@
 import static org.onosproject.yangutils.utils.UtilConstants.DIAMOND_OPEN_BRACKET;
 import static org.onosproject.yangutils.utils.UtilConstants.DOUBLE;
 import static org.onosproject.yangutils.utils.UtilConstants.EIGHT_SPACE_INDENTATION;
+import static org.onosproject.yangutils.utils.UtilConstants.ELSE;
 import static org.onosproject.yangutils.utils.UtilConstants.EMPTY_STRING;
 import static org.onosproject.yangutils.utils.UtilConstants.EQUAL;
 import static org.onosproject.yangutils.utils.UtilConstants.EQUALS_STRING;
@@ -121,10 +126,16 @@
 import static org.onosproject.yangutils.utils.UtilConstants.INSTANCE_OF;
 import static org.onosproject.yangutils.utils.UtilConstants.INT;
 import static org.onosproject.yangutils.utils.UtilConstants.INTEGER_WRAPPER;
+import static org.onosproject.yangutils.utils.UtilConstants.INT_MAX_RANGE;
+import static org.onosproject.yangutils.utils.UtilConstants.INT_MIN_RANGE;
 import static org.onosproject.yangutils.utils.UtilConstants.LIST;
 import static org.onosproject.yangutils.utils.UtilConstants.LONG;
+import static org.onosproject.yangutils.utils.UtilConstants.LONG_MAX_RANGE;
+import static org.onosproject.yangutils.utils.UtilConstants.LONG_MIN_RANGE;
 import static org.onosproject.yangutils.utils.UtilConstants.LONG_WRAPPER;
 import static org.onosproject.yangutils.utils.UtilConstants.MAP;
+import static org.onosproject.yangutils.utils.UtilConstants.MAX_RANGE;
+import static org.onosproject.yangutils.utils.UtilConstants.MIN_RANGE;
 import static org.onosproject.yangutils.utils.UtilConstants.NEW;
 import static org.onosproject.yangutils.utils.UtilConstants.NEW_LINE;
 import static org.onosproject.yangutils.utils.UtilConstants.NOT;
@@ -148,6 +159,7 @@
 import static org.onosproject.yangutils.utils.UtilConstants.PARSE_LONG;
 import static org.onosproject.yangutils.utils.UtilConstants.PARSE_SHORT;
 import static org.onosproject.yangutils.utils.UtilConstants.PERIOD;
+import static org.onosproject.yangutils.utils.UtilConstants.PRIVATE;
 import static org.onosproject.yangutils.utils.UtilConstants.PUBLIC;
 import static org.onosproject.yangutils.utils.UtilConstants.PUT;
 import static org.onosproject.yangutils.utils.UtilConstants.QUESTION_MARK;
@@ -182,6 +194,11 @@
 import static org.onosproject.yangutils.utils.UtilConstants.TRUE;
 import static org.onosproject.yangutils.utils.UtilConstants.TRY;
 import static org.onosproject.yangutils.utils.UtilConstants.TWELVE_SPACE_INDENTATION;
+import static org.onosproject.yangutils.utils.UtilConstants.UINT_MAX_RANGE;
+import static org.onosproject.yangutils.utils.UtilConstants.UINT_MIN_RANGE;
+import static org.onosproject.yangutils.utils.UtilConstants.ULONG_MAX_RANGE;
+import static org.onosproject.yangutils.utils.UtilConstants.ULONG_MIN_RANGE;
+import static org.onosproject.yangutils.utils.UtilConstants.VALIDATE_RANGE;
 import static org.onosproject.yangutils.utils.UtilConstants.VALUE;
 import static org.onosproject.yangutils.utils.UtilConstants.VOID;
 import static org.onosproject.yangutils.utils.UtilConstants.YANG_AUGMENTED_INFO;
@@ -199,6 +216,7 @@
 import static org.onosproject.yangutils.utils.io.impl.JavaDocGen.JavaDocType.TYPE_CONSTRUCTOR;
 import static org.onosproject.yangutils.utils.io.impl.JavaDocGen.generateForAddAugmentation;
 import static org.onosproject.yangutils.utils.io.impl.JavaDocGen.generateForGetAugmentation;
+import static org.onosproject.yangutils.utils.io.impl.JavaDocGen.generateForValidatorMethod;
 import static org.onosproject.yangutils.utils.io.impl.JavaDocGen.getJavaDoc;
 import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.getCamelCase;
 import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.getCapitalCase;
@@ -262,7 +280,7 @@
         String attrType = getReturnType(attr);
         String attributeName = attr.getAttributeName();
         JavaDocGen.JavaDocType type;
-        if ((generatedJavaFiles & GENERATE_SERVICE_AND_MANAGER) != 0) {
+        if (generatedJavaFiles == GENERATE_SERVICE_AND_MANAGER) {
             type = MANAGER_SETTER_METHOD;
         } else {
             type = SETTER_METHOD;
@@ -348,7 +366,7 @@
      */
     public static String getGetter(String type, String name, int generatedJavaFiles) {
         String ret = parseTypeForReturnValue(type);
-        if ((generatedJavaFiles & GENERATE_SERVICE_AND_MANAGER) != 0) {
+        if (generatedJavaFiles == GENERATE_SERVICE_AND_MANAGER) {
             return FOUR_SPACE_INDENTATION + PUBLIC + SPACE + type + SPACE + GET_METHOD_PREFIX + getCapitalCase(name)
                     + OPEN_PARENTHESIS + CLOSE_PARENTHESIS + SPACE + OPEN_CURLY_BRACKET + NEW_LINE +
                     EIGHT_SPACE_INDENTATION + YANG_UTILS_TODO + NEW_LINE + EIGHT_SPACE_INDENTATION +
@@ -406,7 +424,7 @@
      * @return setter for attribute
      */
     private static String getSetter(String className, String name, String type, int generatedJavaFiles) {
-        if ((generatedJavaFiles & GENERATE_SERVICE_AND_MANAGER) != 0) {
+        if (generatedJavaFiles == GENERATE_SERVICE_AND_MANAGER) {
             return FOUR_SPACE_INDENTATION + PUBLIC + SPACE + VOID + SPACE + SET_METHOD_PREFIX
                     + getCapitalCase(name) + OPEN_PARENTHESIS + type + SPACE + name + CLOSE_PARENTHESIS + SPACE +
                     OPEN_CURLY_BRACKET + NEW_LINE + EIGHT_SPACE_INDENTATION + YANG_UTILS_TODO +
@@ -489,7 +507,7 @@
      */
     private static String getGetterInterfaceString(String returnType, String yangName,
                                                    int generatedJavaFiles) {
-        if ((generatedJavaFiles & GENERATE_SERVICE_AND_MANAGER) != 0) {
+        if (generatedJavaFiles == GENERATE_SERVICE_AND_MANAGER) {
             return FOUR_SPACE_INDENTATION + returnType + SPACE + GET_METHOD_PREFIX + getCapitalCase(yangName)
                     + OPEN_PARENTHESIS + CLOSE_PARENTHESIS + SEMI_COLAN;
         } else {
@@ -528,7 +546,7 @@
      */
     private static String getSetterInterfaceString(String className, String attrName, String attrType,
                                                    int generatedJavaFiles) {
-        if ((generatedJavaFiles & GENERATE_SERVICE_AND_MANAGER) != 0) {
+        if (generatedJavaFiles == GENERATE_SERVICE_AND_MANAGER) {
 
             return FOUR_SPACE_INDENTATION + VOID + SPACE + SET_METHOD_PREFIX + getCapitalCase(attrName)
                     + OPEN_PARENTHESIS + attrType + SPACE + attrName + CLOSE_PARENTHESIS + SEMI_COLAN;
@@ -620,7 +638,7 @@
         String attributeName = attr.getAttributeName();
         String constructor;
 
-        if ((generatedJavaFiles & GENERATE_SERVICE_AND_MANAGER) != 0) {
+        if (generatedJavaFiles == GENERATE_SERVICE_AND_MANAGER) {
             constructor = EIGHT_SPACE_INDENTATION + THIS + PERIOD
                     + getCamelCase(attributeName, pluginConfig.getConflictResolver()) + SPACE + EQUAL
                     + SPACE + BUILDER.toLowerCase() + OBJECT + PERIOD + GET_METHOD_PREFIX
@@ -884,7 +902,7 @@
      * @param dataType data type to be checked
      * @return true, if data type can have primitive data type, false otherwise
      */
-    public static boolean isPrimitiveDataType(YangDataTypes dataType) {
+    private static boolean isPrimitiveDataType(YangDataTypes dataType) {
         return dataType == INT8
                 || dataType == INT16
                 || dataType == INT32
@@ -896,6 +914,42 @@
                 || dataType == DECIMAL64
                 || dataType == BOOLEAN
                 || dataType == EMPTY;
+
+    }
+
+    private static String getAttrTypeForFilterContentMatchWhenPrimitiveDataType(String attributeName) {
+        return APP_INSTANCE + PERIOD + attributeName + OPEN_PARENTHESIS + CLOSE_PARENTHESIS
+                + SPACE + NOT + EQUAL + SPACE + attributeName + OPEN_PARENTHESIS
+                + CLOSE_PARENTHESIS;
+    }
+
+    private static String getAttrTypeForFilterContentMatchWhenNonPremitiveDatatype(String attributeName) {
+        return APP_INSTANCE + PERIOD + attributeName + OPEN_PARENTHESIS + CLOSE_PARENTHESIS
+                + SPACE + EQUAL + EQUAL + SPACE + NULL + SPACE + OR_OPERATION + SPACE
+                + NOT + OPEN_PARENTHESIS + attributeName + OPEN_PARENTHESIS + CLOSE_PARENTHESIS
+                + PERIOD + EQUALS_STRING + OPEN_PARENTHESIS + APP_INSTANCE + PERIOD
+                + attributeName + OPEN_PARENTHESIS + CLOSE_PARENTHESIS
+                + CLOSE_PARENTHESIS + CLOSE_PARENTHESIS;
+    }
+
+    private static String getIfFilterContentMatchMethodImpl(String attributeName,
+                                                            String filterMethod, int numleaf, YangType dataType) {
+        String attrQualifiedType;
+
+        if (isPrimitiveDataType(dataType.getDataType())) {
+            attrQualifiedType = getAttrTypeForFilterContentMatchWhenPrimitiveDataType(attributeName);
+        } else if (dataType.getDataType() == LEAFREF) {
+            YangType type = ((YangLeafRef) dataType.getDataTypeExtendedInfo()).getEffectiveDataType();
+            if (isPrimitiveDataType(type.getDataType())) {
+                attrQualifiedType = getAttrTypeForFilterContentMatchWhenPrimitiveDataType(attributeName);
+            } else {
+                attrQualifiedType = getAttrTypeForFilterContentMatchWhenNonPremitiveDatatype(attributeName);
+            }
+        } else {
+            attrQualifiedType = getAttrTypeForFilterContentMatchWhenNonPremitiveDatatype(attributeName);
+        }
+
+        return attrQualifiedType;
     }
 
     /**
@@ -908,94 +962,71 @@
      */
     public static String getIsFilterContentMatch(String className, YangNode curNode, YangPluginConfig pluginConfig) {
 
-        int numleaf = 1;
-        String filterMethod = NEW_LINE + NEW_LINE + FOUR_SPACE_INDENTATION + PUBLIC + SPACE + BOOLEAN_DATA_TYPE
-                + SPACE + FILTER_CONTENT_MATCH + OPEN_PARENTHESIS + getCapitalCase(OBJECT)
-                + SPACE + OBJ +
-                CLOSE_PARENTHESIS + SPACE
-                + OPEN_CURLY_BRACKET + NEW_LINE;
+        int numLeaf = 1;
+        String filterMethod = "";
         TempJavaBeanFragmentFiles tempFragmentFiles = ((JavaCodeGeneratorInfo) curNode)
                 .getTempJavaCodeFragmentFiles().getBeanTempFiles();
-        filterMethod = filterMethod + EIGHT_SPACE_INDENTATION + getCapitalCase(DEFAULT)
-                + getCapitalCase(className) + SPACE + APP_INSTANCE + SPACE + EQUAL + SPACE + OPEN_PARENTHESIS +
-                getCapitalCase(DEFAULT) + getCapitalCase(className) + CLOSE_PARENTHESIS + OBJ +
-                SEMI_COLAN + NEW_LINE;
-        if (curNode instanceof YangAugmentableNode) {
-            filterMethod = filterMethod + getAugmentableOpParamSyntax();
-        }
-
         if (curNode instanceof YangLeavesHolder) {
+            filterMethod = NEW_LINE + NEW_LINE + FOUR_SPACE_INDENTATION + PUBLIC + SPACE + BOOLEAN_DATA_TYPE
+                    + SPACE + FILTER_CONTENT_MATCH + OPEN_PARENTHESIS + getCapitalCase(OBJECT)
+                    + SPACE + OBJ +
+                    CLOSE_PARENTHESIS + SPACE
+                    + OPEN_CURLY_BRACKET + NEW_LINE;
+            filterMethod = filterMethod + EIGHT_SPACE_INDENTATION + getCapitalCase(DEFAULT)
+                    + getCapitalCase(className) + SPACE + APP_INSTANCE + SPACE + EQUAL + SPACE + OPEN_PARENTHESIS +
+                    getCapitalCase(DEFAULT) + getCapitalCase(className) + CLOSE_PARENTHESIS + OBJ +
+                    SEMI_COLAN + NEW_LINE;
+            if (curNode instanceof YangAugmentableNode) {
+                filterMethod = filterMethod + getAugmentableOpParamSyntax();
+            }
+
             YangLeavesHolder leavesHolder = (YangLeavesHolder) curNode;
             List<YangLeaf> leaves = leavesHolder.getListOfLeaf();
             List<YangLeafList> listOfLeafList = leavesHolder.getListOfLeafList();
+            String attrQualifiedType;
             if (leaves != null) {
                 for (YangLeaf leaf : leaves) {
                     JavaAttributeInfo javaAttributeInfo = getJavaAttributeOfLeaf(tempFragmentFiles, leaf,
                             pluginConfig);
                     String attributeName = javaAttributeInfo.getAttributeName();
-
-                    String attrQuaifiedType = "";
-                    if (isPrimitiveDataType(leaf.getDataType().getDataType())) {
-                        attrQuaifiedType = APP_INSTANCE + PERIOD + attributeName + OPEN_PARENTHESIS + CLOSE_PARENTHESIS
-                                + SPACE + NOT + EQUAL + SPACE + attributeName + OPEN_PARENTHESIS
-                                + CLOSE_PARENTHESIS;
-                    } else {
-                        attrQuaifiedType = APP_INSTANCE + PERIOD + attributeName + OPEN_PARENTHESIS + CLOSE_PARENTHESIS
-                                + SPACE + EQUAL + EQUAL + SPACE + NULL + SPACE + OR_OPERATION + SPACE
-                                + NOT + OPEN_PARENTHESIS + attributeName + OPEN_PARENTHESIS + CLOSE_PARENTHESIS
-                                + PERIOD + EQUALS_STRING + OPEN_PARENTHESIS + APP_INSTANCE + PERIOD
-                                + attributeName + OPEN_PARENTHESIS + CLOSE_PARENTHESIS
-                                + CLOSE_PARENTHESIS + CLOSE_PARENTHESIS;
-                    }
-
+                    attrQualifiedType = getIfFilterContentMatchMethodImpl(attributeName,
+                            filterMethod, numLeaf, leaf.getDataType());
                     filterMethod = filterMethod + EIGHT_SPACE_INDENTATION + IF + SPACE + OPEN_PARENTHESIS
                             + GET_FILTER_LEAF + OPEN_PARENTHESIS + CLOSE_PARENTHESIS + PERIOD + GET_METHOD_PREFIX
-                            + OPEN_PARENTHESIS + String.valueOf(numleaf) + CLOSE_PARENTHESIS + CLOSE_PARENTHESIS
+                            + OPEN_PARENTHESIS + String.valueOf(numLeaf) + CLOSE_PARENTHESIS + CLOSE_PARENTHESIS
                             + SPACE + OPEN_CURLY_BRACKET + NEW_LINE + TWELVE_SPACE_INDENTATION + IF + SPACE
-                            + OPEN_PARENTHESIS + attrQuaifiedType + CLOSE_PARENTHESIS + SPACE
+                            + OPEN_PARENTHESIS + attrQualifiedType + CLOSE_PARENTHESIS + SPACE
                             + OPEN_CURLY_BRACKET + NEW_LINE + SIXTEEN_SPACE_INDENTATION + RETURN + SPACE + FALSE
                             + SEMI_COLAN + NEW_LINE + TWELVE_SPACE_INDENTATION + CLOSE_CURLY_BRACKET + NEW_LINE
                             + EIGHT_SPACE_INDENTATION + CLOSE_CURLY_BRACKET + NEW_LINE;
-                    numleaf++;
+
+                    numLeaf++;
                 }
             }
 
             if (listOfLeafList != null) {
-                numleaf = 1;
+                numLeaf = 1;
                 for (YangLeafList leafList : listOfLeafList) {
                     JavaAttributeInfo javaAttributeInfo = getJavaAttributeOfLeafList(tempFragmentFiles, leafList,
                             pluginConfig);
                     String attributeName = javaAttributeInfo.getAttributeName();
-                    String attrQuaifiedType = "";
-                    if (isPrimitiveDataType(leafList.getDataType().getDataType())) {
-                        attrQuaifiedType = APP_INSTANCE + PERIOD + attributeName + OPEN_PARENTHESIS + CLOSE_PARENTHESIS
-                                + SPACE + NOT + EQUAL + SPACE + attributeName + OPEN_PARENTHESIS
-                                + CLOSE_PARENTHESIS;
-                    } else {
-                        attrQuaifiedType = APP_INSTANCE + PERIOD + attributeName + OPEN_PARENTHESIS + CLOSE_PARENTHESIS
-                                + SPACE + EQUAL + EQUAL + SPACE + NULL + OR_OPERATION + OPEN_PARENTHESIS + NOT
-                                + OPEN_PARENTHESIS + attributeName + OPEN_PARENTHESIS + CLOSE_PARENTHESIS
-                                + PERIOD + EQUALS_STRING + OPEN_PARENTHESIS + APP_INSTANCE + PERIOD
-                                + attributeName + OPEN_PARENTHESIS + CLOSE_PARENTHESIS + CLOSE_PARENTHESIS
-                                + CLOSE_PARENTHESIS + CLOSE_PARENTHESIS;
-                    }
-
+                    attrQualifiedType = getIfFilterContentMatchMethodImpl(
+                            attributeName, filterMethod, numLeaf, leafList.getDataType());
                     filterMethod = filterMethod + EIGHT_SPACE_INDENTATION + IF + SPACE + OPEN_PARENTHESIS
                             + GET_FILTER_LEAF_LIST + OPEN_PARENTHESIS + CLOSE_PARENTHESIS + PERIOD + GET_METHOD_PREFIX
-                            + OPEN_PARENTHESIS + String.valueOf(numleaf) + CLOSE_PARENTHESIS + CLOSE_PARENTHESIS
+                            + OPEN_PARENTHESIS + String.valueOf(numLeaf) + CLOSE_PARENTHESIS + CLOSE_PARENTHESIS
                             + SPACE + OPEN_CURLY_BRACKET + NEW_LINE + TWELVE_SPACE_INDENTATION + IF + SPACE
-                            + OPEN_PARENTHESIS + attrQuaifiedType + CLOSE_PARENTHESIS + SPACE
+                            + OPEN_PARENTHESIS + attrQualifiedType + CLOSE_PARENTHESIS + SPACE
                             + OPEN_CURLY_BRACKET + NEW_LINE + SIXTEEN_SPACE_INDENTATION + RETURN + SPACE + FALSE
                             + SEMI_COLAN + NEW_LINE + TWELVE_SPACE_INDENTATION + CLOSE_CURLY_BRACKET + NEW_LINE
                             + EIGHT_SPACE_INDENTATION + CLOSE_CURLY_BRACKET + NEW_LINE;
-                    numleaf++;
+                    numLeaf++;
                 }
             }
 
-            if (leaves !=  null || listOfLeafList != null) {
-                filterMethod = filterMethod + EIGHT_SPACE_INDENTATION + RETURN + SPACE + TRUE + SEMI_COLAN +
-                        NEW_LINE + FOUR_SPACE_INDENTATION + CLOSE_CURLY_BRACKET + NEW_LINE;
-            }
+            filterMethod = filterMethod + EIGHT_SPACE_INDENTATION + RETURN + SPACE + TRUE + SEMI_COLAN +
+                    NEW_LINE + FOUR_SPACE_INDENTATION + CLOSE_CURLY_BRACKET + NEW_LINE;
+
         }
         return filterMethod;
     }
@@ -1003,7 +1034,7 @@
     /*Returns method string for op parms augmented syntax*/
     private static String getAugmentableOpParamSyntax() {
         return EIGHT_SPACE_INDENTATION + FOR + SPACE + OPEN_PARENTHESIS + YANG_AUGMENTED_INFO + SPACE +
-                getSmallCase(YANG_AUGMENTED_INFO) + SPACE + COLAN + SPACE + APP_INSTANCE +
+                getSmallCase(YANG_AUGMENTED_INFO) + SPACE + COLAN + SPACE + THIS +
                 PERIOD + GET_METHOD_PREFIX + YANG_AUGMENTED_INFO + MAP + OPEN_PARENTHESIS + CLOSE_PARENTHESIS + PERIOD
                 + VALUE + "s" + OPEN_PARENTHESIS + CLOSE_PARENTHESIS + CLOSE_PARENTHESIS + SPACE + OPEN_CURLY_BRACKET +
                 NEW_LINE + TWELVE_SPACE_INDENTATION + IF + SPACE + OPEN_PARENTHESIS + NOT + OPEN_PARENTHESIS +
@@ -1361,6 +1392,35 @@
     }
 
     /**
+     * Returns string and java doc for constructor of type class.
+     *
+     * @param attr1                  first attribute info
+     * @param attr2                  second attribute info
+     * @param generatedJavaClassName class name
+     * @param pluginConfig           plugin config
+     * @param type                   conflict validate type
+     * @param addFirst               whether int came first or uint came first
+     * @return string and java doc for constructor of type class
+     */
+    public static String getTypeConstructorStringAndJavaDoc(JavaAttributeInfo attr1, JavaAttributeInfo
+            attr2, String generatedJavaClassName, YangPluginConfig pluginConfig, ValidatorTypeForUnionTypes type,
+                                                            boolean addFirst) {
+
+        String attrType = getReturnType(attr1);
+        String attrName1 = "";
+        String attrName2 = "";
+        if (attr1 != null) {
+            attrName1 = attr1.getAttributeName();
+        }
+        if (attr2 != null) {
+            attrName2 = attr2.getAttributeName();
+        }
+
+        return getJavaDoc(TYPE_CONSTRUCTOR, generatedJavaClassName + " for type " + attrName1, false, pluginConfig)
+                + getTypeConstructorString(attrType, attrName1, attrName2, generatedJavaClassName, type, addFirst);
+    }
+
+    /**
      * Returns type constructor string.
      *
      * @param type      data type
@@ -1377,6 +1437,42 @@
     }
 
     /**
+     * Returns type constructor string.
+     *
+     * @param type      data type
+     * @param attr1     attribute attr1
+     * @param className class attr1
+     * @return type constructor string
+     */
+    private static String getTypeConstructorString(String type, String attr1, String attr2, String className,
+                                                   ValidatorTypeForUnionTypes validatorType, boolean addInt) {
+
+        String constructor;
+        constructor = FOUR_SPACE_INDENTATION + PUBLIC + SPACE + className + OPEN_PARENTHESIS + type + SPACE + VALUE
+                + CLOSE_PARENTHESIS + SPACE + OPEN_CURLY_BRACKET + NEW_LINE;
+
+        String name1;
+        String name2;
+        if (addInt) {
+            name1 = attr1;
+            name2 = attr2;
+        } else {
+            name1 = attr2;
+            name2 = attr1;
+        }
+        constructor = constructor + ifConditionForIntInTypeDefConstrcutor(validatorType, addInt) +
+                TWELVE_SPACE_INDENTATION + THIS + PERIOD
+                + name1 + SPACE + EQUAL + SPACE + VALUE + SEMI_COLAN + NEW_LINE + EIGHT_SPACE_INDENTATION
+                + CLOSE_CURLY_BRACKET + SPACE + ELSE + SPACE + OPEN_CURLY_BRACKET + NEW_LINE + TWELVE_SPACE_INDENTATION
+                + THIS + PERIOD
+                + name2 + SPACE + EQUAL + SPACE + VALUE + SEMI_COLAN + NEW_LINE + EIGHT_SPACE_INDENTATION
+                + CLOSE_CURLY_BRACKET + NEW_LINE + FOUR_SPACE_INDENTATION
+                + CLOSE_CURLY_BRACKET;
+
+        return constructor;
+    }
+
+    /**
      * Returns implementation of add augmentation.
      *
      * @return implementation of add augmentation
@@ -1469,7 +1565,7 @@
                 + RETURN + SPACE + NULL + SEMI_COLAN + NEW_LINE + EIGHT_SPACE_INDENTATION + CLOSE_CURLY_BRACKET
                 + NEW_LINE + FOUR_SPACE_INDENTATION + CLOSE_CURLY_BRACKET;
 
-        return getJavaDoc(OF_METHOD, getCapitalCase(className) + " for type" + attrName, false, pluginConfig)
+        return getJavaDoc(OF_METHOD, getCapitalCase(className) + " for type " + attrName, false, pluginConfig)
                 + method;
     }
 
@@ -1577,13 +1673,15 @@
         StringBuilder methods = new StringBuilder();
         String parentName;
         String returnType;
+        YangNode methodNode;
         YangPluginConfig pluginConfig = ((JavaFileInfoContainer) parent).getJavaFileInfo().getPluginConfig();
         for (YangAtomicPath nodeId : targets) {
             augmentedNode = nodeId.getResolvedNode().getParent();
-            if (((JavaFileInfoContainer) augmentedNode).getJavaFileInfo().getJavaName() != null) {
-                curNodeName = ((JavaFileInfoContainer) augmentedNode).getJavaFileInfo().getJavaName();
+            methodNode = nodeId.getResolvedNode();
+            if (((JavaFileInfoContainer) methodNode).getJavaFileInfo().getJavaName() != null) {
+                curNodeName = ((JavaFileInfoContainer) methodNode).getJavaFileInfo().getJavaName();
             } else {
-                curNodeName = getCapitalCase(getCamelCase(augmentedNode.getName(), pluginConfig
+                curNodeName = getCapitalCase(getCamelCase(methodNode.getName(), pluginConfig
                         .getConflictResolver()));
             }
             returnType = getAugmentedClassNameForDataMethods(augmentedNode, parent);
@@ -1596,7 +1694,7 @@
             methods.append(method);
 
             method = getJavaDoc(MANAGER_SETTER_METHOD, AUGMENTED +
-                    getCapitalCase(parentName) + curNodeName, false, pluginConfig) +
+                    getCapitalCase(parentName) + getCapitalCase(curNodeName), false, pluginConfig) +
                     getSetterForInterface(getSmallCase(AUGMENTED) + parentName +
                                     getCapitalCase(curNodeName), returnType, parentName,
                             false,
@@ -1620,13 +1718,15 @@
         String method;
         StringBuilder methods = new StringBuilder();
         String parentName;
+        YangNode methodNode;
         YangPluginConfig pluginConfig = ((JavaFileInfoContainer) parent).getJavaFileInfo().getPluginConfig();
         for (YangAtomicPath nodeId : targets) {
             augmentedNode = nodeId.getResolvedNode().getParent();
-            if (((JavaFileInfoContainer) augmentedNode).getJavaFileInfo().getJavaName() != null) {
-                curNodeName = ((JavaFileInfoContainer) augmentedNode).getJavaFileInfo().getJavaName();
+            methodNode = nodeId.getResolvedNode();
+            if (((JavaFileInfoContainer) methodNode).getJavaFileInfo().getJavaName() != null) {
+                curNodeName = ((JavaFileInfoContainer) methodNode).getJavaFileInfo().getJavaName();
             } else {
-                curNodeName = getCapitalCase(getCamelCase(augmentedNode.getName(), pluginConfig
+                curNodeName = getCapitalCase(getCamelCase(methodNode.getName(), pluginConfig
                         .getConflictResolver()));
             }
             returnType = getAugmentedClassNameForDataMethods(augmentedNode, parent);
@@ -1646,4 +1746,66 @@
         return methods.toString();
     }
 
+    /**
+     * Returns validator method for range in union class.
+     *
+     * @param type type
+     * @return validator method for range in union class
+     */
+    public static String getRangeValidatorMethodForUnion(String type) {
+        String newType;
+        if (type.contentEquals(BIG_INTEGER)) {
+            newType = LONG;
+        } else {
+            newType = INT;
+        }
+        String method = generateForValidatorMethod() + FOUR_SPACE_INDENTATION + PRIVATE + SPACE + BOOLEAN_DATA_TYPE +
+                SPACE +
+                VALIDATE_RANGE +
+                OPEN_PARENTHESIS
+                + type + SPACE + MIN_RANGE + COMMA + SPACE + type + SPACE + MAX_RANGE + COMMA + SPACE +
+                newType + SPACE + VALUE + CLOSE_PARENTHESIS + SPACE + OPEN_CURLY_BRACKET + NEW_LINE;
+        if (type.contentEquals(BIG_INTEGER)) {
+            method = method + EIGHT_SPACE_INDENTATION + BIG_INTEGER + SPACE + getSmallCase(BIG_INTEGER)
+                    + SPACE + EQUAL + SPACE + NEW + SPACE + BIG_INTEGER + OPEN_PARENTHESIS + QUOTES + SPACE +
+                    QUOTES + SPACE + ADD + SPACE + VALUE + CLOSE_PARENTHESIS + SEMI_COLAN + NEW_LINE +
+                    EIGHT_SPACE_INDENTATION + RETURN + SPACE + getSmallCase(BIG_INTEGER) + PERIOD + "compareTo"
+                    + OPEN_PARENTHESIS + MIN_RANGE + CLOSE_PARENTHESIS + SPACE + EQUAL + EQUAL + " 1" + SPACE + AND +
+                    AND + SPACE + getSmallCase(BIG_INTEGER) + PERIOD + "compareTo" + OPEN_PARENTHESIS + MAX_RANGE +
+                    CLOSE_PARENTHESIS + SPACE + EQUAL + EQUAL + " 1" + SEMI_COLAN + NEW_LINE;
+        } else {
+            method = method + EIGHT_SPACE_INDENTATION
+                    + RETURN + SPACE + VALUE + SPACE + DIAMOND_CLOSE_BRACKET + EQUAL + SPACE + MIN_RANGE + SPACE + AND +
+                    AND + SPACE + VALUE + DIAMOND_OPEN_BRACKET + EQUAL + SPACE + MAX_RANGE + SEMI_COLAN + NEW_LINE;
+        }
+        return method + FOUR_SPACE_INDENTATION + CLOSE_CURLY_BRACKET + NEW_LINE;
+    }
+
+    /**
+     * Returns if condition string for typedef constructor.
+     *
+     * @param type     type of conflict
+     * @param addFirst true int/long need to be added first
+     * @return if condition string for typedef constructor
+     */
+    private static String ifConditionForIntInTypeDefConstrcutor(ValidatorTypeForUnionTypes type, boolean addFirst) {
+        String condition = EIGHT_SPACE_INDENTATION + IF + SPACE + OPEN_PARENTHESIS + VALIDATE_RANGE + OPEN_PARENTHESIS;
+
+        if (type == INT_TYPE_CONFLICT) {
+            if (addFirst) {
+                condition = condition + INT_MIN_RANGE + COMMA + SPACE + INT_MAX_RANGE + COMMA + SPACE + VALUE;
+            } else {
+                condition = condition + UINT_MIN_RANGE + COMMA + SPACE + UINT_MAX_RANGE + COMMA + SPACE + VALUE;
+            }
+        } else {
+            if (addFirst) {
+                condition = condition + LONG_MIN_RANGE + COMMA + SPACE + LONG_MAX_RANGE + COMMA + SPACE + VALUE;
+            } else {
+                condition = condition + ULONG_MIN_RANGE + COMMA + SPACE + ULONG_MAX_RANGE + COMMA + SPACE + VALUE;
+            }
+        }
+        return condition + CLOSE_PARENTHESIS + CLOSE_PARENTHESIS + SPACE + OPEN_CURLY_BRACKET + NEW_LINE;
+    }
+
+
 }
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/utils/ValidatorTypeForUnionTypes.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/utils/ValidatorTypeForUnionTypes.java
new file mode 100644
index 0000000..1f5276b
--- /dev/null
+++ b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/utils/ValidatorTypeForUnionTypes.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yangutils.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 int64 and uint32.
+     */
+    LONG_TYPE_CONFLICT
+}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/utils/UtilConstants.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/utils/UtilConstants.java
index e83c075..d570fa7 100644
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/utils/UtilConstants.java
+++ b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/utils/UtilConstants.java
@@ -127,6 +127,16 @@
     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 = " * @return true if value is in range";
+
+    /**
      * JavaDocs's description for constructor.
      */
     public static final String JAVA_DOC_CONSTRUCTOR = " * Creates an instance of ";
@@ -292,6 +302,108 @@
     public static final String SPACE = " ";
 
     /**
+     * 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 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";
@@ -347,16 +459,6 @@
     public static final String IDENTITYREF = "identityref";
 
     /**
-     * Static attribute for binary string.
-     */
-    public static final String BINARY_STRING = "binary";
-
-    /**
-     * Static attribute for bits string.
-     */
-    public static final String BITS_STRING = "bits";
-
-    /**
      * Static attribute for output variable of rpc.
      */
     public static final String RPC_INPUT_VAR_NAME = "inputVar";
@@ -612,6 +714,11 @@
     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";
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/utils/io/impl/JavaDocGen.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/utils/io/impl/JavaDocGen.java
index 34e4983..af0b4e3 100644
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/utils/io/impl/JavaDocGen.java
+++ b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/utils/io/impl/JavaDocGen.java
@@ -17,6 +17,10 @@
 package org.onosproject.yangutils.utils.io.impl;
 
 import static org.onosproject.yangutils.utils.UtilConstants.AUGMENTED;
+import static org.onosproject.yangutils.utils.UtilConstants.JAVA_DOC_FOR_VALIDATOR;
+import static org.onosproject.yangutils.utils.UtilConstants.JAVA_DOC_FOR_VALIDATOR_RETURN;
+import static org.onosproject.yangutils.utils.UtilConstants.MAX_RANGE;
+import static org.onosproject.yangutils.utils.UtilConstants.MIN_RANGE;
 import static org.onosproject.yangutils.utils.UtilConstants.YANG_AUGMENTED_INFO;
 import static org.onosproject.yangutils.utils.UtilConstants.BUILDER;
 import static org.onosproject.yangutils.utils.UtilConstants.BUILDER_CLASS_JAVA_DOC;
@@ -519,6 +523,11 @@
                 VALUE + SPACE + OF + SPACE + AUGMENTED + CLASS + NEW_LINE + FOUR_SPACE_INDENTATION + JAVA_DOC_END_LINE;
     }
 
+    /**
+     * Returns javadoc for get augmentation method.
+     *
+     * @return javadoc for get augmentation method
+     */
     public static String generateForGetAugmentation() {
         return NEW_LINE + FOUR_SPACE_INDENTATION + JAVA_DOC_FIRST_LINE + FOUR_SPACE_INDENTATION
                 + JAVA_DOC_GETTERS + getSmallCase(YANG_AUGMENTED_INFO) + PERIOD + NEW_LINE +
@@ -529,6 +538,23 @@
     }
 
     /**
+     * Returns javadoc for validator method.
+     *
+     * @return javadoc for validator method
+     */
+    public static String generateForValidatorMethod() {
+        return NEW_LINE + FOUR_SPACE_INDENTATION + JAVA_DOC_FIRST_LINE + FOUR_SPACE_INDENTATION +
+                JAVA_DOC_FOR_VALIDATOR + NEW_LINE + FOUR_SPACE_INDENTATION + NEW_LINE_ASTERISK +
+                FOUR_SPACE_INDENTATION + JAVA_DOC_PARAM + MIN_RANGE + SPACE + MIN_RANGE + SPACE + OF + SPACE +
+                VALUE + NEW_LINE +
+                FOUR_SPACE_INDENTATION + JAVA_DOC_PARAM + MAX_RANGE + SPACE + MAX_RANGE + SPACE + OF + SPACE + VALUE +
+                NEW_LINE +
+                FOUR_SPACE_INDENTATION + JAVA_DOC_PARAM + VALUE + SPACE + VALUE + NEW_LINE +
+                FOUR_SPACE_INDENTATION + JAVA_DOC_FOR_VALIDATOR_RETURN + NEW_LINE + FOUR_SPACE_INDENTATION +
+                JAVA_DOC_END_LINE;
+    }
+
+    /**
      * JavaDocs types.
      */
     public enum JavaDocType {
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/ManagerCodeGeneratorTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/ManagerCodeGeneratorTest.java
index c3b2fe7..6bde56f 100644
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/ManagerCodeGeneratorTest.java
+++ b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/ManagerCodeGeneratorTest.java
@@ -39,7 +39,7 @@
     /**
      * Checks manager translation should not result in any exception.
      *
-     * @throws MojoExecutionException
+     * @throws MojoExecutionException when fails to do mojo operations
      */
     @Test
     public void processManagerTranslator() throws IOException, ParserException, MojoExecutionException {
@@ -73,7 +73,7 @@
     /**
      * Checks manager translation in different package should not result in any exception.
      *
-     * @throws MojoExecutionException
+     * @throws MojoExecutionException when fails to do mojo operations
      */
     @Test
     public void processManagerInDifferentPackageTranslator() throws IOException, ParserException,
@@ -102,7 +102,7 @@
     /**
      * Checks manager translation in different package should not result in any exception.
      *
-     * @throws MojoExecutionException
+     * @throws MojoExecutionException when fails to do mojo operations
      */
     @Test
     public void processManagerforMultiChildTranslator() throws IOException, ParserException,
@@ -140,6 +140,42 @@
         assertThat(true, is(manager4.exists()));
 
         deleteDirectory("target/manager/");
+        deleteDirectory("target/manager/");
+    }
+
+    /**
+     * Checks manager translation in different package should not result in any exception.
+     *
+     * @throws MojoExecutionException when fails to do mojo operations
+     */
+    @Test
+    public void processManagerforMultiChildWithDifferentPackageTranslator() throws IOException, ParserException,
+            MojoExecutionException {
+
+        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/");
+        yangPluginConfig.setManagerCodeGenDir("target/manager1/");
+
+        utilManager.translateToJava(yangPluginConfig);
+
+        String file1 = "target/manager1/org/onosproject/yang/gen/v1/test8/test/rev20160704/Test8Manager.java";
+
+        File manager1 = new File(file1);
+        assertThat(true, is(manager1.exists()));
+
+
+        String file2 = "target/manager/org/onosproject/yang/gen/v1/test8/test/rev20160704/Test8Service.java";
+
+        File service2 = new File(file2);
+        assertThat(true, is(service2.exists()));
+
+        deleteDirectory("target/manager/");
         deleteDirectory("target/manager1/");
     }
 }
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/TypeDefTranslatorTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/TypeDefTranslatorTest.java
new file mode 100644
index 0000000..d433d41
--- /dev/null
+++ b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/TypeDefTranslatorTest.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.yangutils.plugin.manager;
+
+import java.io.IOException;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.junit.Test;
+import org.onosproject.yangutils.parser.exceptions.ParserException;
+import org.onosproject.yangutils.utils.io.impl.YangFileScanner;
+import org.onosproject.yangutils.utils.io.impl.YangPluginConfig;
+
+import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.deleteDirectory;
+
+/**
+ * Unit test case for typedef translator.
+ */
+public class TypeDefTranslatorTest {
+
+    private final YangUtilManager utilManager = new YangUtilManager();
+
+    /**
+     * Checks typedef translation should not result in any exception.
+     *
+     * @throws MojoExecutionException
+     */
+    @Test
+    public void processTypeDefTranslator() throws IOException, ParserException, MojoExecutionException {
+
+        String searchDir = "src/test/resources/typedefTranslator";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+        utilManager.resolveDependenciesUsingLinker();
+
+        YangPluginConfig yangPluginConfig = new YangPluginConfig();
+        yangPluginConfig.setCodeGenDir("target/typedefTranslator/");
+        yangPluginConfig.setManagerCodeGenDir("target/typedefTranslator/");
+        utilManager.translateToJava(yangPluginConfig);
+
+        deleteDirectory("target/typedefTranslator/");
+    }
+
+}
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/UnionTranslatorTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/UnionTranslatorTest.java
index 46d4f67..b992d39 100644
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/UnionTranslatorTest.java
+++ b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/UnionTranslatorTest.java
@@ -18,10 +18,12 @@
 
 import java.io.IOException;
 
+import org.apache.maven.plugin.MojoExecutionException;
 import org.junit.Test;
 import org.onosproject.yangutils.datamodel.YangNode;
 import org.onosproject.yangutils.parser.exceptions.ParserException;
 import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
+import org.onosproject.yangutils.utils.io.impl.YangFileScanner;
 import org.onosproject.yangutils.utils.io.impl.YangPluginConfig;
 
 import static org.onosproject.yangutils.translator.tojava.JavaCodeGeneratorUtil.generateJavaCode;
@@ -52,5 +54,168 @@
         deleteDirectory("target/UnionTestGenFile/");
     }
 
+    /**
+     * 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 {
+        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("target/unionTranslator/");
+        yangPluginConfig.setManagerCodeGenDir("target/unionTranslator/");
+
+        utilManager.translateToJava(yangPluginConfig);
+        deleteDirectory("target/unionTranslator/");
+    }
+
+    /**
+     * 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 {
+        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("target/unionTranslator/");
+        yangPluginConfig.setManagerCodeGenDir("target/unionTranslator/");
+
+        utilManager.translateToJava(yangPluginConfig);
+        deleteDirectory("target/unionTranslator/");
+    }
+
+    /**
+     * 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 {
+        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("target/unionTranslator/");
+        yangPluginConfig.setManagerCodeGenDir("target/unionTranslator/");
+
+        utilManager.translateToJava(yangPluginConfig);
+        deleteDirectory("target/unionTranslator/");
+    }
+
+    /**
+     * 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 {
+        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("target/unionTranslator/");
+        yangPluginConfig.setManagerCodeGenDir("target/unionTranslator/");
+
+        utilManager.translateToJava(yangPluginConfig);
+        deleteDirectory("target/unionTranslator/");
+    }
+
+    /**
+     * 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 {
+        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("target/unionTranslator/");
+        yangPluginConfig.setManagerCodeGenDir("target/unionTranslator/");
+
+        utilManager.translateToJava(yangPluginConfig);
+        deleteDirectory("target/unionTranslator/");
+    }
+
+    /**
+     * 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 {
+        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("target/unionTranslator/");
+        yangPluginConfig.setManagerCodeGenDir("target/unionTranslator/");
+
+        utilManager.translateToJava(yangPluginConfig);
+        deleteDirectory("target/unionTranslator/");
+    }
+
+    /**
+     * 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 {
+        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("target/unionTranslator/");
+        yangPluginConfig.setManagerCodeGenDir("target/unionTranslator/");
+
+        utilManager.translateToJava(yangPluginConfig);
+        deleteDirectory("target/unionTranslator/");
+    }
+
     // TODO enhance the test cases, after having a framework of translator test.
 }
diff --git a/utils/yangutils/plugin/src/test/resources/typedefTranslator/Onos_Yang_1.yang b/utils/yangutils/plugin/src/test/resources/typedefTranslator/Onos_Yang_1.yang
new file mode 100644
index 0000000..56fbacf
--- /dev/null
+++ b/utils/yangutils/plugin/src/test/resources/typedefTranslator/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/utils/yangutils/plugin/src/test/resources/unionTranslator/intuint/test.yang b/utils/yangutils/plugin/src/test/resources/unionTranslator/intuint/test.yang
new file mode 100644
index 0000000..6cba197
--- /dev/null
+++ b/utils/yangutils/plugin/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/utils/yangutils/plugin/src/test/resources/unionTranslator/intuintstring/test.yang b/utils/yangutils/plugin/src/test/resources/unionTranslator/intuintstring/test.yang
new file mode 100644
index 0000000..c806017
--- /dev/null
+++ b/utils/yangutils/plugin/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/utils/yangutils/plugin/src/test/resources/unionTranslator/intuintstring/test2.yang b/utils/yangutils/plugin/src/test/resources/unionTranslator/intuintstring/test2.yang
new file mode 100644
index 0000000..63b791c
--- /dev/null
+++ b/utils/yangutils/plugin/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/utils/yangutils/plugin/src/test/resources/unionTranslator/intuintulonglong/test.yang b/utils/yangutils/plugin/src/test/resources/unionTranslator/intuintulonglong/test.yang
new file mode 100644
index 0000000..b4737e7
--- /dev/null
+++ b/utils/yangutils/plugin/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/utils/yangutils/plugin/src/test/resources/unionTranslator/intuintulonglongstring/test.yang b/utils/yangutils/plugin/src/test/resources/unionTranslator/intuintulonglongstring/test.yang
new file mode 100644
index 0000000..a50b5ef
--- /dev/null
+++ b/utils/yangutils/plugin/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/utils/yangutils/plugin/src/test/resources/unionTranslator/longulong/test.yang b/utils/yangutils/plugin/src/test/resources/unionTranslator/longulong/test.yang
new file mode 100644
index 0000000..a555043
--- /dev/null
+++ b/utils/yangutils/plugin/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/utils/yangutils/plugin/src/test/resources/unionTranslator/uintint/test.yang b/utils/yangutils/plugin/src/test/resources/unionTranslator/uintint/test.yang
new file mode 100644
index 0000000..d7a590a
--- /dev/null
+++ b/utils/yangutils/plugin/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/utils/yangutils/plugin/src/test/resources/unionTranslator/ulonglong/test.yang b/utils/yangutils/plugin/src/test/resources/unionTranslator/ulonglong/test.yang
new file mode 100644
index 0000000..22f6e97
--- /dev/null
+++ b/utils/yangutils/plugin/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;   
+      }
+   }
+
+}
+