Changes in generated Code for keyClass, enum, list & ModelObjectId test

Change-Id: I74fe67e1c184ad38a606df3e449684507bb135b8
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/utils/DataModelUtils.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/utils/DataModelUtils.java
index ea23160..30122ec 100644
--- a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/utils/DataModelUtils.java
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/utils/DataModelUtils.java
@@ -1243,7 +1243,7 @@
     /**
      * Searches for input in given RPC node.
      *
-     * @param rpc yang node
+     * @param rpc YANG RPC node
      * @return input node
      */
     public static YangNode findRpcInput(YangNode rpc) {
@@ -1261,7 +1261,7 @@
     /**
      * Searches for output in given RPC node.
      *
-     * @param rpc yang node
+     * @param rpc YANG RPC node
      * @return output node
      */
     public static YangNode findRpcOutput(YangNode rpc) {
diff --git a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/TempJavaEventFragmentFiles.java b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/TempJavaEventFragmentFiles.java
index 25c6ca0..b4b404b 100644
--- a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/TempJavaEventFragmentFiles.java
+++ b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/TempJavaEventFragmentFiles.java
@@ -329,7 +329,7 @@
         addEventEnum(notificationName);
         addEventSubjectAttribute(javaAttributeInfo);
         addEventSubjectGetter(javaAttributeInfo);
-        addEventSubjectSetter(javaAttributeInfo, currentInfo);
+        addEventSubjectSetter(javaAttributeInfo);
     }
 
     /*Adds event to enum temp file.*/
@@ -370,8 +370,7 @@
     }
 
     /*Adds setter method for event in event subject class.*/
-    private void addEventSubjectSetter(JavaAttributeInfo attr,
-                                       String className)
+    private void addEventSubjectSetter(JavaAttributeInfo attr)
             throws IOException {
         String appDataStructure = null;
         if (attr.getCompilerAnnotation() != null) {
@@ -381,7 +380,7 @@
         appendToFile(getEventSubjectSetterTempFileHandle(), getJavaDoc(
                 MANAGER_SETTER_METHOD, attr.getAttributeName(),
                 false, appDataStructure) + getSetterForClass(
-                attr, className, GENERATE_EVENT_SUBJECT_CLASS) + NEW_LINE);
+                attr, GENERATE_EVENT_SUBJECT_CLASS) + NEW_LINE);
     }
 
     /**
diff --git a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/TempJavaFragmentFiles.java b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/TempJavaFragmentFiles.java
index f3a30b6..5cd5651 100644
--- a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/TempJavaFragmentFiles.java
+++ b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/TempJavaFragmentFiles.java
@@ -114,6 +114,8 @@
 import static org.onosproject.yang.compiler.utils.UtilConstants.MAP;
 import static org.onosproject.yang.compiler.utils.UtilConstants.MODEL_OBJECT;
 import static org.onosproject.yang.compiler.utils.UtilConstants.MODEL_OBJECT_PKG;
+import static org.onosproject.yang.compiler.utils.UtilConstants.MODEL_PKG;
+import static org.onosproject.yang.compiler.utils.UtilConstants.MULTI_INSTANCE_OBJECT;
 import static org.onosproject.yang.compiler.utils.UtilConstants.NEW_LINE;
 import static org.onosproject.yang.compiler.utils.UtilConstants.OP_PARAM;
 import static org.onosproject.yang.compiler.utils.UtilConstants.PERIOD;
@@ -649,10 +651,10 @@
         if (leafList) {
             tempFiles.getJavaImportData().setIfListImported(true);
             return getAttributeOfLeafInfoContainer(tempFiles, container, config,
-                                                   true);
+                                                   true, false);
         }
         return getAttributeOfLeafInfoContainer(tempFiles, container, config,
-                                               false);
+                                               false, false);
     }
 
     /**
@@ -662,6 +664,7 @@
      * @param container     JAVA leaf info container
      * @param config        plugin configurations
      * @param listAttribute flag indicating if list attribute
+     * @param keyLeaf       flag indicating key leaf
      * @return JAVA attribute information
      * @throws IOException when fails to do IO operations
      */
@@ -669,7 +672,8 @@
     getAttributeOfLeafInfoContainer(TempJavaFragmentFiles tempFiles,
                                     JavaLeafInfoContainer container,
                                     YangPluginConfig config,
-                                    boolean listAttribute) throws IOException {
+                                    boolean listAttribute, boolean keyLeaf)
+            throws IOException {
         container.setConflictResolveConfig(config.getConflictResolver());
         container.updateJavaQualifiedInfo();
         addImportForLeafInfo(tempFiles, container);
@@ -681,7 +685,8 @@
                         container.getJavaQualifiedInfo()), listAttribute);
         boolean condition =
                 ((YangSchemaNode) container).getReferredSchema() == null &&
-                        container.getDataType().getDataType() == BITS;
+                        container.getDataType().getDataType() == BITS &&
+                        !keyLeaf;
         if (condition) {
             addBitsHandler(attr, container.getDataType(), tempFiles);
         }
@@ -715,8 +720,8 @@
                 leaf = (YangJavaLeafTranslator) leafIt.next();
                 if (key.equals(leaf.getName())) {
                     attrs.add(getAttributeOfLeafInfoContainer(
-                            beanFile, leaf,
-                            fileInfo.getPluginConfig(), false));
+                            beanFile, leaf, fileInfo.getPluginConfig(),
+                            false, true));
                 }
             }
         }
@@ -998,8 +1003,7 @@
     private void addSetterImpl(JavaAttributeInfo attr)
             throws IOException {
         int generatedJavaFiles = getGeneratedJavaFiles();
-        String setter = getSetterForClass(attr, getGeneratedJavaClassName(),
-                                          generatedJavaFiles);
+        String setter = getSetterForClass(attr, generatedJavaFiles);
         YangDataStructure ds = getYangDataStructure(
                 attr.getCompilerAnnotation());
         String annotation = null;
@@ -1490,7 +1494,7 @@
         YangType attrType = newAttrInfo.getAttributeType();
 
         if (tempFlagSet(LEAF_IDENTIFIER_ENUM_ATTRIBUTES_MASK) &&
-                !listAttr && attrType != null) {
+                attrType != null) {
             leafCount++;
             addLeafIdAttributes(newAttrInfo, leafCount);
         }
@@ -1617,6 +1621,11 @@
             getBeanFiles(curNode).getJavaExtendsListHolder()
                     .addToExtendsList(typeInfo, curNode, getBeanFiles(curNode));
 
+            // add import for multi instance object
+            if (curNode instanceof YangList) {
+                imports.add(getImportString(MODEL_PKG, MULTI_INSTANCE_OBJECT));
+            }
+
             //Create impl class file.
             implClassJavaFileHandle =
                     getJavaFileHandle(getImplClassName(curNode));
@@ -1631,15 +1640,10 @@
 
         if (curNode instanceof YangList) {
             File keyClassJavaFileHandle;
-            YangList list = (YangList) curNode;
-            YangDataStructure data = getYangDataStructure(
-                    list.getCompilerAnnotation());
-            if (list.isConfig() && data == YangDataStructure.MAP) {
-                keyClassJavaFileHandle =
-                        getJavaFileHandle(getJavaClassName(
-                                KEY_CLASS_FILE_NAME_SUFFIX));
-                generateKeyClassFile(keyClassJavaFileHandle, curNode);
-            }
+            keyClassJavaFileHandle =
+                    getJavaFileHandle(getJavaClassName(
+                            KEY_CLASS_FILE_NAME_SUFFIX));
+            generateKeyClassFile(keyClassJavaFileHandle, curNode);
         }
         //Close all the file handles.
         freeTemporaryResources(false);
diff --git a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/TempJavaRpcCommandFragmentFiles.java b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/TempJavaRpcCommandFragmentFiles.java
index 0bd91fb..9c7f286 100644
--- a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/TempJavaRpcCommandFragmentFiles.java
+++ b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/TempJavaRpcCommandFragmentFiles.java
@@ -224,14 +224,14 @@
     /**
      * Returns RPC commands contents.
      *
-     * @param curNode YANG RPC node
+     * @param node YANG RPC node
      * @return RPC commands contents
      */
-    public static String getRpcCommandContents(YangNode curNode) {
-        String appService = curNode.getParent()
+    public static String getRpcCommandContents(YangNode node) {
+        String appService = node.getParent()
                 .getJavaClassNameOrBuiltInType() + SERVICE;
         String className = getCapitalCase(getCamelCase(
-                curNode.getJavaClassNameOrBuiltInType(), null)) + COMMAND;
+                node.getJavaClassNameOrBuiltInType(), null)) + COMMAND;
 
         // parameters for constructors
         Map<String, String> param = new LinkedHashMap<>();
@@ -251,7 +251,7 @@
 
                 // add constructor
                 .append(getJavaDocForRpcCommandConstructor(
-                        curNode.getJavaClassNameOrBuiltInType()))
+                        node.getJavaClassNameOrBuiltInType()))
                 .append(NEW_LINE)
                 .append(multiAttrMethodSignature(className, null, PUBLIC,
                                                  null, param, CLASS_TYPE,
@@ -272,10 +272,10 @@
                 .append(NEW_LINE)
 
                 //add execute method
-                .append(getRpcCommandExecuteMethod(appService, curNode))
+                .append(getRpcCommandExecuteMethod(appService, node))
 
                 //add get resource id method
-                .append(getResourceIdMethod(curNode));
+                .append(getResourceIdMethod(node));
 
         // add execute method with msgid
         return builder.toString();
diff --git a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/YangJavaModelUtils.java b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/YangJavaModelUtils.java
index a5d56a0..94304e1 100644
--- a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/YangJavaModelUtils.java
+++ b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/YangJavaModelUtils.java
@@ -259,9 +259,7 @@
             if (isLeafPresent || isLeafListPresent) {
                 bean.addCurNodeLeavesInfoToTempFiles((YangNode) info,
                                                      config);
-            }
-            //Add value leaf flag attribute to temp file.
-            if (isLeafPresent) {
+                //Add value leaf flag attribute to temp file.
                 bean.addValueLeafFlag(config, (YangNode) info);
             }
         } else if (info instanceof YangTypeHolder) {
diff --git a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/javamodel/YangJavaModuleTranslator.java b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/javamodel/YangJavaModuleTranslator.java
index a4a3057..f27a50b 100644
--- a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/javamodel/YangJavaModuleTranslator.java
+++ b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/javamodel/YangJavaModuleTranslator.java
@@ -181,6 +181,8 @@
                     if (isRpcNotificationPresent(this)) {
                         getTempJavaCodeFragmentFiles()
                                 .generateJavaFile(GENERATE_SERVICE_AND_MANAGER, this);
+                    }
+                    if (isRpcChildNodePresent(this)) {
                         getTempJavaCodeFragmentFiles()
                                 .generateJavaFile(GENERATE_ALL_RPC_CLASS_MASK, this);
                     }
diff --git a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/javamodel/YangJavaSubModuleTranslator.java b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/javamodel/YangJavaSubModuleTranslator.java
index 76e3ff7..b84a03e 100644
--- a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/javamodel/YangJavaSubModuleTranslator.java
+++ b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/javamodel/YangJavaSubModuleTranslator.java
@@ -32,6 +32,7 @@
 import static org.onosproject.yang.compiler.datamodel.utils.DataModelUtils.isRpcChildNodePresent;
 import static org.onosproject.yang.compiler.datamodel.utils.DataModelUtils.isRpcNotificationPresent;
 import static org.onosproject.yang.compiler.translator.tojava.GeneratedJavaFileType.GENERATE_ALL_EVENT_CLASS_MASK;
+import static org.onosproject.yang.compiler.translator.tojava.GeneratedJavaFileType.GENERATE_ALL_RPC_CLASS_MASK;
 import static org.onosproject.yang.compiler.translator.tojava.GeneratedJavaFileType.GENERATE_INTERFACE_WITH_BUILDER;
 import static org.onosproject.yang.compiler.translator.tojava.GeneratedJavaFileType.GENERATE_SERVICE_AND_MANAGER;
 import static org.onosproject.yang.compiler.translator.tojava.YangJavaModelUtils.generateCodeOfRootNode;
@@ -191,6 +192,10 @@
                         getTempJavaCodeFragmentFiles().generateJavaFile(
                                 GENERATE_SERVICE_AND_MANAGER, this);
                     }
+                    if (isRpcChildNodePresent(this)) {
+                        getTempJavaCodeFragmentFiles()
+                                .generateJavaFile(GENERATE_ALL_RPC_CLASS_MASK, this);
+                    }
                 }
             }
 
diff --git a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/utils/ClassDefinitionGenerator.java b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/utils/ClassDefinitionGenerator.java
index 1a82f0d..aa608b6 100644
--- a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/utils/ClassDefinitionGenerator.java
+++ b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/utils/ClassDefinitionGenerator.java
@@ -19,6 +19,7 @@
 import org.onosproject.yang.compiler.datamodel.RpcNotificationContainer;
 import org.onosproject.yang.compiler.datamodel.YangCase;
 import org.onosproject.yang.compiler.datamodel.YangIdentity;
+import org.onosproject.yang.compiler.datamodel.YangList;
 import org.onosproject.yang.compiler.datamodel.YangNode;
 import org.onosproject.yang.compiler.datamodel.YangNotification;
 import org.onosproject.yang.compiler.translator.exception.TranslatorException;
@@ -59,9 +60,9 @@
 import static org.onosproject.yang.compiler.utils.UtilConstants.CLASS;
 import static org.onosproject.yang.compiler.utils.UtilConstants.COMMA;
 import static org.onosproject.yang.compiler.utils.UtilConstants.COMMAND;
-import static org.onosproject.yang.compiler.utils.UtilConstants.COMPARABLE;
 import static org.onosproject.yang.compiler.utils.UtilConstants.DEFAULT_CAPS;
 import static org.onosproject.yang.compiler.utils.UtilConstants.DEFAULT_RPC_HANDLER;
+import static org.onosproject.yang.compiler.utils.UtilConstants.EIGHT_SPACE_INDENTATION;
 import static org.onosproject.yang.compiler.utils.UtilConstants.EMPTY_STRING;
 import static org.onosproject.yang.compiler.utils.UtilConstants.ENUM;
 import static org.onosproject.yang.compiler.utils.UtilConstants.ERROR_MSG_JAVA_IDENTITY;
@@ -72,8 +73,11 @@
 import static org.onosproject.yang.compiler.utils.UtilConstants.FINAL;
 import static org.onosproject.yang.compiler.utils.UtilConstants.IMPLEMENTS;
 import static org.onosproject.yang.compiler.utils.UtilConstants.INTERFACE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.KEYS;
+import static org.onosproject.yang.compiler.utils.UtilConstants.KEY_INFO;
 import static org.onosproject.yang.compiler.utils.UtilConstants.LISTENER_SERVICE;
 import static org.onosproject.yang.compiler.utils.UtilConstants.MODEL_OBJECT;
+import static org.onosproject.yang.compiler.utils.UtilConstants.MULTI_INSTANCE_OBJECT;
 import static org.onosproject.yang.compiler.utils.UtilConstants.NEW_LINE;
 import static org.onosproject.yang.compiler.utils.UtilConstants.OPEN_CURLY_BRACKET;
 import static org.onosproject.yang.compiler.utils.UtilConstants.OP_PARAM;
@@ -155,7 +159,7 @@
             case GENERATE_EVENT_LISTENER_INTERFACE:
                 return getEventListenerDefinition(yangName);
             case GENERATE_KEY_CLASS:
-                return getKeyClassDefinition(yangName);
+                return getKeyClassDefinition(yangName, curNode);
             case GENERATE_EVENT_SUBJECT_CLASS:
                 return getClassDefinition(yangName);
             case GENERATE_IDENTITY_CLASS:
@@ -231,12 +235,18 @@
      * Returns impl file class definition.
      *
      * @param yangName file name
+     * @param node     YANG list node
      * @return definition
      */
-    private static String getKeyClassDefinition(String yangName) {
-        String compareName = COMPARABLE + brackets(
-                OPEN_CLOSE_DIAMOND_WITH_VALUE, yangName, null);
-        return getDefinitionWithImplements(CLASS, yangName, PUBLIC, compareName);
+    private static String getKeyClassDefinition(String yangName,
+                                                YangNode node) {
+        String keyInfo = KEY_INFO +
+                brackets(OPEN_CLOSE_DIAMOND_WITH_VALUE,
+                         DEFAULT_CAPS + getCapitalCase(getCamelCase(
+                                 node.getJavaClassNameOrBuiltInType(), null)),
+                         null);
+        return getDefinitionWithImplements(CLASS, yangName, PUBLIC,
+                                           keyInfo);
     }
 
     /**
@@ -394,8 +404,21 @@
                     }
 
                     // append implements
-                    def.append(IMPLEMENTS).append(SPACE)
-                            .append(yangName);
+                    if (curNode instanceof YangList) {
+                        String multiInstanceObj = MULTI_INSTANCE_OBJECT +
+                                brackets(OPEN_CLOSE_DIAMOND_WITH_VALUE,
+                                         getCapitalCase(getCamelCase(yangName,
+                                                                     null)) +
+                                                 KEYS, null);
+                        def.append(NEW_LINE).append(EIGHT_SPACE_INDENTATION)
+                                .append(IMPLEMENTS).append(SPACE)
+                                .append(yangName).append(COMMA).append(SPACE)
+                                .append(multiInstanceObj);
+
+                    } else {
+                        def.append(IMPLEMENTS).append(SPACE)
+                                .append(yangName);
+                    }
                     break;
                 default:
                     return null;
diff --git a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/utils/JavaFileGenerator.java b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/utils/JavaFileGenerator.java
index 54d9894..b764ead 100644
--- a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/utils/JavaFileGenerator.java
+++ b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/utils/JavaFileGenerator.java
@@ -17,8 +17,10 @@
 package org.onosproject.yang.compiler.translator.tojava.utils;
 
 import org.onosproject.yang.compiler.datamodel.RpcNotificationContainer;
+import org.onosproject.yang.compiler.datamodel.YangDataStructure;
 import org.onosproject.yang.compiler.datamodel.YangEnumeration;
 import org.onosproject.yang.compiler.datamodel.YangLeavesHolder;
+import org.onosproject.yang.compiler.datamodel.YangList;
 import org.onosproject.yang.compiler.datamodel.YangNode;
 import org.onosproject.yang.compiler.datamodel.YangType;
 import org.onosproject.yang.compiler.datamodel.YangTypeDef;
@@ -42,6 +44,7 @@
 import java.util.List;
 
 import static java.util.Collections.sort;
+import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes.IDENTITYREF;
 import static org.onosproject.yang.compiler.translator.tojava.GeneratedJavaFileType.DEFAULT_CLASS_MASK;
 import static org.onosproject.yang.compiler.translator.tojava.GeneratedJavaFileType.GENERATE_ENUM_CLASS;
 import static org.onosproject.yang.compiler.translator.tojava.GeneratedJavaFileType.GENERATE_EVENT_CLASS;
@@ -97,7 +100,6 @@
 import static org.onosproject.yang.compiler.translator.tojava.utils.MethodsGenerator.getAugmentationsString;
 import static org.onosproject.yang.compiler.translator.tojava.utils.MethodsGenerator.getBitSetEnumClassFromString;
 import static org.onosproject.yang.compiler.translator.tojava.utils.MethodsGenerator.getBitSetEnumClassToString;
-import static org.onosproject.yang.compiler.translator.tojava.utils.MethodsGenerator.getCompareToForKeyClass;
 import static org.onosproject.yang.compiler.translator.tojava.utils.MethodsGenerator.getEnumsConstructor;
 import static org.onosproject.yang.compiler.translator.tojava.utils.MethodsGenerator.getEnumsOfValueMethod;
 import static org.onosproject.yang.compiler.translator.tojava.utils.MethodsGenerator.getEqualsMethod;
@@ -119,6 +121,7 @@
 import static org.onosproject.yang.compiler.translator.tojava.utils.MethodsGenerator.getToStringMethodClose;
 import static org.onosproject.yang.compiler.translator.tojava.utils.MethodsGenerator.getToStringMethodOpen;
 import static org.onosproject.yang.compiler.translator.tojava.utils.MethodsGenerator.getUnionToStringMethod;
+import static org.onosproject.yang.compiler.translator.tojava.utils.MethodsGenerator.getYangDataStructure;
 import static org.onosproject.yang.compiler.translator.tojava.utils.MethodsGenerator.isLeafValueSetInterface;
 import static org.onosproject.yang.compiler.translator.tojava.utils.StringGenerator.getImportString;
 import static org.onosproject.yang.compiler.translator.tojava.utils.StringGenerator.getInterfaceLeafIdEnumMethods;
@@ -129,34 +132,43 @@
 import static org.onosproject.yang.compiler.translator.tojava.utils.TranslatorUtils.getBeanFiles;
 import static org.onosproject.yang.compiler.translator.tojava.utils.TranslatorUtils.getTypeFiles;
 import static org.onosproject.yang.compiler.utils.UtilConstants.BIG_INTEGER;
+import static org.onosproject.yang.compiler.utils.UtilConstants.CLASS_STRING;
 import static org.onosproject.yang.compiler.utils.UtilConstants.CLOSE_CURLY_BRACKET;
 import static org.onosproject.yang.compiler.utils.UtilConstants.COMMA;
 import static org.onosproject.yang.compiler.utils.UtilConstants.COMMAND;
 import static org.onosproject.yang.compiler.utils.UtilConstants.DEFAULT;
 import static org.onosproject.yang.compiler.utils.UtilConstants.DEFAULT_CAPS;
 import static org.onosproject.yang.compiler.utils.UtilConstants.DEFAULT_RPC_HANDLER;
+import static org.onosproject.yang.compiler.utils.UtilConstants.DIAMOND_CLOSE_BRACKET;
+import static org.onosproject.yang.compiler.utils.UtilConstants.DIAMOND_OPEN_BRACKET;
 import static org.onosproject.yang.compiler.utils.UtilConstants.EMPTY_STRING;
 import static org.onosproject.yang.compiler.utils.UtilConstants.ENUM_CLASS;
 import static org.onosproject.yang.compiler.utils.UtilConstants.EVENT_CLASS;
 import static org.onosproject.yang.compiler.utils.UtilConstants.EVENT_LISTENER_STRING;
 import static org.onosproject.yang.compiler.utils.UtilConstants.EVENT_STRING;
 import static org.onosproject.yang.compiler.utils.UtilConstants.EVENT_SUBJECT_NAME_SUFFIX;
+import static org.onosproject.yang.compiler.utils.UtilConstants.EXTEND;
 import static org.onosproject.yang.compiler.utils.UtilConstants.IMPL_CLASS;
 import static org.onosproject.yang.compiler.utils.UtilConstants.INT;
 import static org.onosproject.yang.compiler.utils.UtilConstants.INTERFACE;
 import static org.onosproject.yang.compiler.utils.UtilConstants.JAVA_UTIL_OBJECTS_IMPORT_CLASS;
 import static org.onosproject.yang.compiler.utils.UtilConstants.JAVA_UTIL_PKG;
 import static org.onosproject.yang.compiler.utils.UtilConstants.KEYS;
+import static org.onosproject.yang.compiler.utils.UtilConstants.KEY_INFO;
+import static org.onosproject.yang.compiler.utils.UtilConstants.MODEL_PKG;
 import static org.onosproject.yang.compiler.utils.UtilConstants.NEW_LINE;
 import static org.onosproject.yang.compiler.utils.UtilConstants.OP_PARAM;
+import static org.onosproject.yang.compiler.utils.UtilConstants.PERIOD;
 import static org.onosproject.yang.compiler.utils.UtilConstants.PRIVATE;
 import static org.onosproject.yang.compiler.utils.UtilConstants.PROTECTED;
 import static org.onosproject.yang.compiler.utils.UtilConstants.PUBLIC;
+import static org.onosproject.yang.compiler.utils.UtilConstants.QUESTION_MARK;
 import static org.onosproject.yang.compiler.utils.UtilConstants.REGISTER_RPC;
 import static org.onosproject.yang.compiler.utils.UtilConstants.RPC_CLASS;
 import static org.onosproject.yang.compiler.utils.UtilConstants.RPC_EXTENDED_COMMAND;
 import static org.onosproject.yang.compiler.utils.UtilConstants.SEMI_COLON;
 import static org.onosproject.yang.compiler.utils.UtilConstants.SERVICE_METHOD_STRING;
+import static org.onosproject.yang.compiler.utils.UtilConstants.SPACE;
 import static org.onosproject.yang.compiler.utils.UtilConstants.TYPEDEF_CLASS;
 import static org.onosproject.yang.compiler.utils.UtilConstants.UNION_CLASS;
 import static org.onosproject.yang.compiler.utils.io.impl.JavaDocGen.JavaDocType.GETTER_METHOD;
@@ -273,16 +285,21 @@
         String className = getCapitalCase(fileInfo.getJavaName()) + KEYS;
         List<String> imports = new ArrayList<>();
 
-        YangNode parent = curNode.getParent();
-        JavaImportData importData = ((JavaCodeGeneratorInfo) parent)
-                .getTempJavaCodeFragmentFiles().getBeanTempFiles()
-                .getJavaImportData();
-        JavaQualifiedTypeInfoTranslator info =
-                new JavaQualifiedTypeInfoTranslator();
-        info.setClassInfo(className);
-        info.setPkgInfo(fileInfo.getPackage());
-        importData.addImportInfo(info, parent.getJavaClassNameOrBuiltInType(),
-                                 parent.getJavaPackage());
+        YangDataStructure data = getYangDataStructure(
+                ((YangList) curNode).getCompilerAnnotation());
+        if (((YangList) curNode).isConfig() &&
+                data == YangDataStructure.MAP) {
+            YangNode parent = curNode.getParent();
+            JavaImportData importData = ((JavaCodeGeneratorInfo) parent)
+                    .getTempJavaCodeFragmentFiles().getBeanTempFiles()
+                    .getJavaImportData();
+            JavaQualifiedTypeInfoTranslator info =
+                    new JavaQualifiedTypeInfoTranslator();
+            info.setClassInfo(className);
+            info.setPkgInfo(fileInfo.getPackage());
+            importData.addImportInfo(info, parent.getJavaClassNameOrBuiltInType(),
+                                     parent.getJavaPackage());
+        }
         List<JavaAttributeInfo> attrs = getListOfAttributesForKey(curNode);
 
         Iterator<JavaAttributeInfo> attrIt = attrs.iterator();
@@ -291,7 +308,8 @@
         while (attrIt.hasNext()) {
             attr = attrIt.next();
             typeInfo = attr.getImportInfo();
-            if (!typeInfo.getClassInfo().equals(className)) {
+            if (!typeInfo.getClassInfo().equals(className) &&
+                    attr.getImportInfo().getPkgInfo() != null) {
                 imports.add(getImportString(attr.getImportInfo().getPkgInfo(),
                                             attr.getImportInfo().getClassInfo()));
             } else {
@@ -299,8 +317,11 @@
             }
         }
 
-        imports.add(getImportString(JAVA_UTIL_PKG,
-                                    JAVA_UTIL_OBJECTS_IMPORT_CLASS));
+        imports.add(getImportString(MODEL_PKG, KEY_INFO));
+        if (!attrs.isEmpty()) {
+            imports.add(getImportString(JAVA_UTIL_PKG,
+                                        JAVA_UTIL_OBJECTS_IMPORT_CLASS));
+        }
 
         initiateJavaFileGeneration(file, GENERATE_KEY_CLASS, imports, curNode,
                                    className);
@@ -311,10 +332,26 @@
             if (attr.isQualifiedName()) {
                 pkg = attr.getImportInfo().getPkgInfo();
             }
-            insertDataIntoJavaFile(file, getJavaAttributeDefinition(
-                    pkg, attr.getImportInfo().getClassInfo(),
-                    attr.getAttributeName(), false, PROTECTED, null));
+            String attrType = attr.getImportInfo().getClassInfo();
+            if (attr.getAttributeType() != null &&
+                    attr.getAttributeType().getDataType() == IDENTITYREF) {
+                String type = attrType;
+                if (pkg != null) {
+                    type = pkg + PERIOD + attrType;
+                }
+                attrType = CLASS_STRING + DIAMOND_OPEN_BRACKET +
+                        QUESTION_MARK + SPACE + EXTEND + SPACE + type +
+                        DIAMOND_CLOSE_BRACKET;
+                insertDataIntoJavaFile(file, getJavaAttributeDefinition(
+                        null, attrType, attr.getAttributeName(),
+                        false, PROTECTED, null));
+            } else {
+                insertDataIntoJavaFile(file, getJavaAttributeDefinition(
+                        pkg, attr.getImportInfo().getClassInfo(),
+                        attr.getAttributeName(), false, PROTECTED, null));
+            }
         }
+
         attrIt = attrs.iterator();
         while (attrIt.hasNext()) {
             attr = attrIt.next();
@@ -328,26 +365,25 @@
             insertDataIntoJavaFile(file, getJavaDoc(MANAGER_SETTER_METHOD, attr
                     .getAttributeName(), false, null));
             insertDataIntoJavaFile(file, getSetterForClass(
-                    attr, className, GENERATE_EVENT_SUBJECT_CLASS));
+                    attr, GENERATE_EVENT_SUBJECT_CLASS));
             insertDataIntoJavaFile(file, NEW_LINE);
         }
-        //add hashcode and equals method.
-        insertDataIntoJavaFile(file, getHashCodeMethodOpen());
-        StringBuilder builder = new StringBuilder();
-        for (JavaAttributeInfo att : attrs) {
-            builder.append(getHashCodeMethod(att));
+        if (!attrs.isEmpty()) {
+            //add hashcode and equals method.
+            insertDataIntoJavaFile(file, getHashCodeMethodOpen());
+            StringBuilder builder = new StringBuilder();
+            for (JavaAttributeInfo att : attrs) {
+                builder.append(getHashCodeMethod(att));
+            }
+            insertDataIntoJavaFile(file, getHashCodeMethodClose(builder.toString()));
+
+            insertDataIntoJavaFile(file, getEqualsMethodOpen(className));
+            StringBuilder builder2 = new StringBuilder();
+            for (JavaAttributeInfo att : attrs) {
+                builder2.append(getEqualsMethod(att)).append(NEW_LINE);
+            }
+            insertDataIntoJavaFile(file, getEqualsMethodClose(builder2.toString()));
         }
-        insertDataIntoJavaFile(file, getHashCodeMethodClose(builder.toString()));
-
-        insertDataIntoJavaFile(file, getEqualsMethodOpen(className));
-        StringBuilder builder2 = new StringBuilder();
-        for (JavaAttributeInfo att : attrs) {
-            builder2.append(getEqualsMethod(att)).append(NEW_LINE);
-        }
-        insertDataIntoJavaFile(file, getEqualsMethodClose(builder2.toString()));
-
-        insertDataIntoJavaFile(file, getCompareToForKeyClass(attrs, className));
-
         insertDataIntoJavaFile(file, CLOSE_CURLY_BRACKET);
         return file;
     }
@@ -1046,8 +1082,10 @@
      * @return true if leaves are present, false otherwise
      */
     private static boolean leavesPresent(YangLeavesHolder holder) {
-        return holder.getListOfLeaf() != null &&
-                !holder.getListOfLeaf().isEmpty();
+        return (holder.getListOfLeaf() != null &&
+                !holder.getListOfLeaf().isEmpty()) ||
+                (holder.getListOfLeafList() != null &&
+                        !holder.getListOfLeafList().isEmpty());
     }
 
     /**
@@ -1078,7 +1116,7 @@
      * @param file    generated file
      * @param curNode current YANG node
      * @param imports imports for file
-     * @return generated file
+     * @return RPC extended command file
      * @throws IOException when fails to generate class file
      */
     public static File generateRpcExtendedCommand(File file, YangNode curNode,
@@ -1100,7 +1138,7 @@
      * @param file    generated file
      * @param curNode current YANG node
      * @param imports imports for file
-     * @return generated file
+     * @return RPC command file
      * @throws IOException when fails to generate class file
      */
     public static File generateRpcCommand(File file, YangNode curNode,
@@ -1124,7 +1162,7 @@
      * @param file    generated file
      * @param curNode current YANG node
      * @param imports imports for file
-     * @return generated file
+     * @return register RPC file
      * @throws IOException when fails to generate class file
      */
     public static File generateRegisterRpc(File file, YangNode curNode,
diff --git a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/utils/MethodsGenerator.java b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/utils/MethodsGenerator.java
index 4e78c71..3d88b35 100644
--- a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/utils/MethodsGenerator.java
+++ b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/utils/MethodsGenerator.java
@@ -143,6 +143,7 @@
 import static org.onosproject.yang.compiler.utils.UtilConstants.HASH;
 import static org.onosproject.yang.compiler.utils.UtilConstants.HASH_CODE_STRING;
 import static org.onosproject.yang.compiler.utils.UtilConstants.IF;
+import static org.onosproject.yang.compiler.utils.UtilConstants.IMPLEMENTS;
 import static org.onosproject.yang.compiler.utils.UtilConstants.INSTANCE_OF;
 import static org.onosproject.yang.compiler.utils.UtilConstants.INT;
 import static org.onosproject.yang.compiler.utils.UtilConstants.IS_EMPTY;
@@ -156,6 +157,7 @@
 import static org.onosproject.yang.compiler.utils.UtilConstants.MAP;
 import static org.onosproject.yang.compiler.utils.UtilConstants.MAX_RANGE;
 import static org.onosproject.yang.compiler.utils.UtilConstants.MIN_RANGE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.MODEL_LEAF_IDENTIFIER;
 import static org.onosproject.yang.compiler.utils.UtilConstants.MODEL_OBJECT;
 import static org.onosproject.yang.compiler.utils.UtilConstants.NEG_ONE;
 import static org.onosproject.yang.compiler.utils.UtilConstants.NEW;
@@ -441,12 +443,10 @@
      * Returns the setter method strings for class file.
      *
      * @param attr               attribute info
-     * @param className          name of the class
      * @param generatedJavaFiles generated java files
      * @return setter method for class
      */
     public static String getSetterForClass(JavaAttributeInfo attr,
-                                           String className,
                                            int generatedJavaFiles) {
         String attrQualifiedType = getReturnType(attr);
         String attributeName = attr.getAttributeName();
@@ -455,28 +455,26 @@
             isTypeNull = true;
         }
         if (!attr.isListAttr()) {
-            return getSetter(className, attributeName, attrQualifiedType,
-                             generatedJavaFiles, isTypeNull, false);
+            return getSetter(attributeName, attrQualifiedType,
+                             generatedJavaFiles, isTypeNull);
         }
         String attrParam = getListAttribute(attrQualifiedType,
                                             attr.getCompilerAnnotation());
-        return getSetter(className, attributeName, attrParam,
-                         generatedJavaFiles, isTypeNull, true);
+        return getSetter(attributeName, attrParam,
+                         generatedJavaFiles, isTypeNull);
     }
 
     /**
      * Returns setter for attribute.
      *
-     * @param className  class name
      * @param name       attribute name
      * @param type       return type
      * @param isTypeNull if attribute type is null
-     * @param isList     true if leaf-list
      * @return setter for attribute
      */
-    private static String getSetter(String className, String name, String type,
+    private static String getSetter(String name, String type,
                                     int genType,
-                                    boolean isTypeNull, boolean isList) {
+                                    boolean isTypeNull) {
         StringBuilder builder = new StringBuilder();
         if (genType == GENERATE_SERVICE_AND_MANAGER) {
             //Append method signature.
@@ -506,7 +504,7 @@
         builder.append(methodSignature(name, EMPTY_STRING, PUBLIC, name,
                                        VOID, type, CLASS_TYPE));
 
-        if (!isTypeNull && !isList &&
+        if (!isTypeNull &&
                 genType != GENERATE_TYPEDEF_CLASS && genType != GENERATE_UNION_CLASS) {
             builder.append(getLeafFlagSetString(name, VALUE_LEAF, EIGHT_SPACE_INDENTATION,
                                                 SET_METHOD_PREFIX)).append(signatureClose());
@@ -1542,6 +1540,7 @@
                 .append(signatureClose())
                 .append(methodClose(FOUR_SPACE));
         return builder.toString();
+
     }
 
     // Returns if condition for add to list method.
@@ -1610,7 +1609,8 @@
                 "     * Identify the leaf of " + name + PERIOD + NEW_LINE +
                 "     */\n";
         return start + FOUR_SPACE_INDENTATION + PUBLIC + SPACE + ENUM + SPACE +
-                LEAF_IDENTIFIER + SPACE + OPEN_CURLY_BRACKET + NEW_LINE;
+                LEAF_IDENTIFIER + SPACE + IMPLEMENTS + SPACE +
+                MODEL_LEAF_IDENTIFIER + OPEN_CURLY_BRACKET + NEW_LINE;
     }
 
     /**
@@ -1936,8 +1936,8 @@
      *
      * @param name         class name
      * @param modifierType modifier type
-     * @param params       parameters for constructor
-     * @param space        space
+     * @param params       parameters for constrcutor
+     * @param space        indentation for constructor
      * @return parameterisied constructor method string
      */
     public static String getParaMeterisiedConstructor(String name,
diff --git a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/utils/StringGenerator.java b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/utils/StringGenerator.java
index afe663e..39226e3 100644
--- a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/utils/StringGenerator.java
+++ b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/utils/StringGenerator.java
@@ -1025,6 +1025,40 @@
     }
 
     /**
+     * Returns class definition for implements.
+     *
+     * @param classType     class type
+     * @param name          name of class
+     * @param modifier      modifier
+     * @param implClassList list of class which should be implemented
+     * @return class definition
+     */
+    static String getDefinitionWithMultipleImplements(String classType,
+                                                      String name,
+                                                      String modifier,
+                                                      List<String>
+                                                              implClassList) {
+        String mod = EMPTY_STRING;
+        if (modifier != null) {
+            mod = modifier + SPACE;
+        }
+        String classDef = mod + classType + SPACE + name + SPACE
+                + IMPLEMENTS + SPACE;
+        if (implClassList != null && !implClassList.isEmpty()) {
+            Iterator<String> implIterator = implClassList.iterator();
+            while (implIterator.hasNext()) {
+                String implClass = implIterator.next();
+                classDef = classDef + implClass;
+                if (implIterator.hasNext()) {
+                    classDef = classDef + COMMA + SPACE;
+                }
+            }
+
+        }
+        return classDef + defCloseString();
+    }
+
+    /**
      * Returns string for service class.
      *
      * @param name1 name of even listener class
diff --git a/compiler/base/translator/src/test/java/org/onosproject/yang/compiler/translator/tojava/utils/MethodsGeneratorTest.java b/compiler/base/translator/src/test/java/org/onosproject/yang/compiler/translator/tojava/utils/MethodsGeneratorTest.java
index 3ac56d5..2a6b396 100644
--- a/compiler/base/translator/src/test/java/org/onosproject/yang/compiler/translator/tojava/utils/MethodsGeneratorTest.java
+++ b/compiler/base/translator/src/test/java/org/onosproject/yang/compiler/translator/tojava/utils/MethodsGeneratorTest.java
@@ -32,7 +32,10 @@
 import static org.hamcrest.core.IsNot.not;
 import static org.junit.Assert.assertThat;
 import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes.STRING;
-import static org.onosproject.yang.compiler.translator.tojava.utils.MethodsGenerator.*;
+import static org.onosproject.yang.compiler.translator.tojava.utils.MethodsGenerator.getGetterForClass;
+import static org.onosproject.yang.compiler.translator.tojava.utils.MethodsGenerator.getGetterForInterface;
+import static org.onosproject.yang.compiler.translator.tojava.utils.MethodsGenerator.getSetterForClass;
+import static org.onosproject.yang.compiler.translator.tojava.utils.MethodsGenerator.getSetterForInterface;
 
 /**
  * Unit tests for generated methods from the file type.
@@ -179,7 +182,8 @@
     @Test
     public void getSetterForClassTest() {
         JavaAttributeInfo testAttr = getTestAttribute();
-        String method = getSetterForClass(testAttr, CLASS_NAME, GeneratedJavaFileType.GENERATE_SERVICE_AND_MANAGER);
+        String method = getSetterForClass(
+                testAttr, GeneratedJavaFileType.GENERATE_SERVICE_AND_MANAGER);
         assertThat(true, is(
                 method.contains(UtilConstants.PUBLIC + UtilConstants.SPACE + UtilConstants.VOID +
                                         UtilConstants.SPACE + UtilConstants.SET_METHOD_PREFIX +
diff --git a/compiler/base/utils/src/main/java/org/onosproject/yang/compiler/utils/UtilConstants.java b/compiler/base/utils/src/main/java/org/onosproject/yang/compiler/utils/UtilConstants.java
index 5fd7a4d..dc36d1c 100644
--- a/compiler/base/utils/src/main/java/org/onosproject/yang/compiler/utils/UtilConstants.java
+++ b/compiler/base/utils/src/main/java/org/onosproject/yang/compiler/utils/UtilConstants.java
@@ -905,6 +905,9 @@
      * Static attribute for is LeafIdentifier enum prefix.
      */
     public static final String LEAF_IDENTIFIER = "LeafIdentifier";
+
+    public static final String MODEL_LEAF_IDENTIFIER = "org.onosproject.yang.model.LeafIdentifier";
+
     /**
      * Static attribute for is leaf.
      */
@@ -1063,16 +1066,6 @@
     public static final String BIT_SET = "BitSet";
 
     /**
-     * Flag for subtree filtering in augment.
-     */
-    public static final String SUBTREE_FILTERED = "isSubTreeFiltered";
-
-    /**
-     * Augment map type.
-     */
-    public static final String AUGMENT_MAP_TYPE = "Map<Class<?>, Object>";
-
-    /**
      * Byte java built in type.
      */
     public static final String BYTE = "byte";
@@ -1971,6 +1964,10 @@
 
     public static final String CREATE_DATA_NODE = "createDataNode";
 
+    public static final String MULTI_INSTANCE_OBJECT = "MultiInstanceObject";
+
+    public static final String KEY_INFO = "KeyInfo";
+
     // No instantiation.
     private UtilConstants() {
     }
diff --git a/compiler/base/utils/src/main/java/org/onosproject/yang/compiler/utils/io/impl/JavaDocGen.java b/compiler/base/utils/src/main/java/org/onosproject/yang/compiler/utils/io/impl/JavaDocGen.java
index 2c6824b..2b2c0ec 100644
--- a/compiler/base/utils/src/main/java/org/onosproject/yang/compiler/utils/io/impl/JavaDocGen.java
+++ b/compiler/base/utils/src/main/java/org/onosproject/yang/compiler/utils/io/impl/JavaDocGen.java
@@ -726,7 +726,7 @@
     /**
      * Returns javadoc for RPC command constructor.
      *
-     * @param rpcName rpc name
+     * @param rpcName name of RPC
      * @return javadoc for RPC command constructor
      */
     public static String getJavaDocForRpcCommandConstructor(String rpcName) {
diff --git a/model/src/main/java/org/onosproject/yang/model/AtomicPath.java b/model/src/main/java/org/onosproject/yang/model/AtomicPath.java
index 39a4122..fe53e22 100644
--- a/model/src/main/java/org/onosproject/yang/model/AtomicPath.java
+++ b/model/src/main/java/org/onosproject/yang/model/AtomicPath.java
@@ -1,9 +1,17 @@
 /*
- * Copyright (c) 2017. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
- * Morbi non lorem porttitor neque feugiat blandit. Ut vitae ipsum eget quam lacinia accumsan.
- * Etiam sed turpis ac ipsum condimentum fringilla. Maecenas magna.
- * Proin dapibus sapien vel ante. Aliquam erat volutpat. Pellentesque sagittis ligula eget metus.
- * Vestibulum commodo. Ut rhoncus gravida arcu.
+ * Copyright 2017-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 
 package org.onosproject.yang.model;
diff --git a/model/src/main/java/org/onosproject/yang/model/KeyInfo.java b/model/src/main/java/org/onosproject/yang/model/KeyInfo.java
index 2c35d45..86a0485 100644
--- a/model/src/main/java/org/onosproject/yang/model/KeyInfo.java
+++ b/model/src/main/java/org/onosproject/yang/model/KeyInfo.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2016-present Open Networking Laboratory
+ * Copyright 2017-present Open Networking Laboratory
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
diff --git a/model/src/main/java/org/onosproject/yang/model/LeafIdentifier.java b/model/src/main/java/org/onosproject/yang/model/LeafIdentifier.java
index a1a6f11..8eca49f 100644
--- a/model/src/main/java/org/onosproject/yang/model/LeafIdentifier.java
+++ b/model/src/main/java/org/onosproject/yang/model/LeafIdentifier.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2016-present Open Networking Laboratory
+ * Copyright 2017-present Open Networking Laboratory
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
diff --git a/model/src/main/java/org/onosproject/yang/model/MultiInstanceNode.java b/model/src/main/java/org/onosproject/yang/model/MultiInstanceNode.java
index 0042c8e..72182e5 100644
--- a/model/src/main/java/org/onosproject/yang/model/MultiInstanceNode.java
+++ b/model/src/main/java/org/onosproject/yang/model/MultiInstanceNode.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2016-present Open Networking Laboratory
+ * Copyright 2017-present Open Networking Laboratory
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
diff --git a/model/src/main/java/org/onosproject/yang/model/MultiInstanceObject.java b/model/src/main/java/org/onosproject/yang/model/MultiInstanceObject.java
index f32ea40..33f6435 100644
--- a/model/src/main/java/org/onosproject/yang/model/MultiInstanceObject.java
+++ b/model/src/main/java/org/onosproject/yang/model/MultiInstanceObject.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2016-present Open Networking Laboratory
+ * Copyright 2017-present Open Networking Laboratory
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
diff --git a/model/src/main/java/org/onosproject/yang/model/SingleInstanceLeaf.java b/model/src/main/java/org/onosproject/yang/model/SingleInstanceLeaf.java
index 34889c5..f5462b3 100644
--- a/model/src/main/java/org/onosproject/yang/model/SingleInstanceLeaf.java
+++ b/model/src/main/java/org/onosproject/yang/model/SingleInstanceLeaf.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2016-present Open Networking Laboratory
+ * Copyright 2017-present Open Networking Laboratory
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
diff --git a/model/src/main/java/org/onosproject/yang/model/SingleInstanceNode.java b/model/src/main/java/org/onosproject/yang/model/SingleInstanceNode.java
index 80fe27a..40c5076 100644
--- a/model/src/main/java/org/onosproject/yang/model/SingleInstanceNode.java
+++ b/model/src/main/java/org/onosproject/yang/model/SingleInstanceNode.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2016-present Open Networking Laboratory
+ * Copyright 2017-present Open Networking Laboratory
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
diff --git a/runtime/src/main/test/java/org/onosproject/yang/runtime/impl/ModelObjectIdTest.java b/runtime/src/main/test/java/org/onosproject/yang/runtime/impl/ModelObjectIdTest.java
new file mode 100644
index 0000000..ccadffe
--- /dev/null
+++ b/runtime/src/main/test/java/org/onosproject/yang/runtime/impl/ModelObjectIdTest.java
@@ -0,0 +1,102 @@
+/*
+ * Copyright 2017-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.runtime.app;
+
+import org.junit.Test;
+import org.onosproject.yang.gen.v1.modelobjecttest.check.Cont53;
+import org.onosproject.yang.gen.v1.modelobjecttest.check.DefaultCont50;
+import org.onosproject.yang.gen.v1.modelobjecttest.check.DefaultCont53;
+import org.onosproject.yang.gen.v1.modelobjecttest.check.DefaultList52;
+import org.onosproject.yang.gen.v1.modelobjecttest.check.DefaultList56;
+import org.onosproject.yang.gen.v1.modelobjecttest.check.List52Keys;
+import org.onosproject.yang.gen.v1.modelobjecttest.check.List56;
+import org.onosproject.yang.gen.v1.modelobjecttest.check.List56Keys;
+import org.onosproject.yang.model.ModelObjectId;
+
+import java.io.IOException;
+
+/**
+ * Unit test for model object id.
+ */
+public class ModelObjectIdTest {
+
+    /**
+     * Unit test case for creating model object id for container.
+     *
+     * @throws IOException when fails to do IO operation
+     */
+    @Test
+    public void testCreateContainerModelObjectId()
+            throws IOException {
+        ModelObjectId id = new ModelObjectId.Builder()
+                .addChild(DefaultCont50.class).build();
+    }
+
+    /**
+     * Unit test case for creating model object id for list.
+     *
+     * @throws IOException when fails to do IO operation
+     */
+    @Test
+    public void testCreateListModelObjectId()
+            throws IOException {
+        List52Keys key = new List52Keys();
+        key.leaf52(52);
+        ModelObjectId id = new ModelObjectId.Builder()
+                .addChild(DefaultList52.class, key).build();
+    }
+
+    /**
+     * Unit test case for creating model object id for leaf.
+     *
+     * @throws IOException when fails to do IO operation
+     */
+    @Test
+    public void testCreateleafModelObjectId()
+            throws IOException {
+        ModelObjectId id = new ModelObjectId.Builder()
+                .addChild(DefaultCont53.class)
+                .addChild(Cont53.LeafIdentifier.LEAF55).build();
+    }
+
+    /**
+     * Unit test case for creating model object id for leaf-list.
+     *
+     * @throws IOException when fails to do IO operation
+     */
+    @Test
+    public void testCreateleaflistModelObjectId()
+            throws IOException {
+        ModelObjectId id = new ModelObjectId.Builder()
+                .addChild(DefaultCont53.class)
+                .addChild(Cont53.LeafIdentifier.LEAF54, "hello").build();
+    }
+
+    /**
+     * Unit test case for creating model object id for leaf-list.
+     *
+     * @throws IOException when fails to do IO operation
+     */
+    @Test
+    public void testCreatelistWithoutKeyModelObjectId()
+            throws IOException {
+        List56Keys key = new List56Keys();
+        ModelObjectId id = new ModelObjectId.Builder()
+                .addChild(DefaultList56.class, key)
+                .addChild(List56.LeafIdentifier.LEAF57, "hello").build();
+    }
+}
diff --git a/runtime/src/main/test/resources/modelObjectId/modelObjectIdTest.yang b/runtime/src/main/test/resources/modelObjectId/modelObjectIdTest.yang
new file mode 100644
index 0000000..24ec4eb
--- /dev/null
+++ b/runtime/src/main/test/resources/modelObjectId/modelObjectIdTest.yang
@@ -0,0 +1,35 @@
+module check {
+   yang-version 1;
+   namespace "modelObjectTest";
+   prefix nd;
+   container cont50 {
+       leaf leaf51 {
+           type int32;
+       }
+   }
+   list list52 {
+       key leaf52;
+       leaf leaf52 {
+           type int32;
+       }
+   }
+
+   container cont53 {
+       leaf-list leaf54 {
+           type string;
+       }
+       leaf leaf55 {
+           type string;
+       }
+   }
+
+   list list56 {
+       config false;
+       leaf-list leaf57 {
+           type string;
+       }
+       leaf leaf58 {
+           type string;
+       }
+   }
+}
\ No newline at end of file