diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangUses.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangUses.java
index 798d45b..6263264 100644
--- a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangUses.java
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangUses.java
@@ -22,6 +22,7 @@
 
 import java.util.LinkedList;
 import java.util.List;
+import java.util.Set;
 
 import static java.util.Collections.unmodifiableList;
 import static org.onosproject.yang.compiler.datamodel.TraversalType.CHILD;
@@ -403,6 +404,12 @@
 
                 clonedLeaf.setContainedIn(usesParent);
                 usesParent.addLeaf(clonedLeaf);
+                if (usesParent instanceof YangList) {
+                    Set<String> keys = ((YangList) usesParent).getKeyLeaf();
+                    if (keys.contains(clonedLeaf.getName())) {
+                        clonedLeaf.setKeyLeaf(true);
+                    }
+                }
             }
         }
         if (referredGrouping.getListOfLeafList() != null) {
diff --git a/model/src/main/java/org/onosproject/yang/model/DataNode.java b/model/src/main/java/org/onosproject/yang/model/DataNode.java
index c76fa97..1833534 100644
--- a/model/src/main/java/org/onosproject/yang/model/DataNode.java
+++ b/model/src/main/java/org/onosproject/yang/model/DataNode.java
@@ -163,7 +163,7 @@
          * @param node parent node builder
          * @return builder object
          */
-        protected B parent(InnerNode.Builder node) {
+        public B parent(InnerNode.Builder node) {
             parent = node;
             return (B) this;
         }
diff --git a/runtime/src/main/java/org/onosproject/yang/runtime/helperutils/ExtResourceIdBldr.java b/runtime/src/main/java/org/onosproject/yang/runtime/helperutils/ExtResourceIdBldr.java
index 4d06677..e7cdfe2 100644
--- a/runtime/src/main/java/org/onosproject/yang/runtime/helperutils/ExtResourceIdBldr.java
+++ b/runtime/src/main/java/org/onosproject/yang/runtime/helperutils/ExtResourceIdBldr.java
@@ -88,12 +88,11 @@
      * builder.
      *
      * @param ridBldr extended resource id builder
-     * @param builder resource id builder
+     * @param id      resource id
      * @return updated extended resource id builder
      */
-    public ExtResourceIdBldr copyBuilder(ExtResourceIdBldr ridBldr, ResourceId
-            .Builder builder) {
-        ResourceId id = builder.build();
+    public ExtResourceIdBldr copyBuilder(ExtResourceIdBldr ridBldr,
+                                         ResourceId id) {
         SchemaId sId;
         // Preparing the extended resource id builder from resourceId.
         List<NodeKey> keys = id.nodeKeys();
diff --git a/runtime/src/main/java/org/onosproject/yang/runtime/helperutils/SerializerHelper.java b/runtime/src/main/java/org/onosproject/yang/runtime/helperutils/SerializerHelper.java
index 3bb668b..0902630 100644
--- a/runtime/src/main/java/org/onosproject/yang/runtime/helperutils/SerializerHelper.java
+++ b/runtime/src/main/java/org/onosproject/yang/runtime/helperutils/SerializerHelper.java
@@ -215,7 +215,7 @@
     public static Builder initializeDataNode(ResourceId.Builder builder) {
 
         ExtResourceIdBldr rIdBldr = new ExtResourceIdBldr();
-        rIdBldr = rIdBldr.copyBuilder(rIdBldr, builder);
+        rIdBldr = rIdBldr.copyBuilder(rIdBldr, builder.build());
         rIdBldr.appInfo(builder.appInfo());
         SchemaContext node = (SchemaContext) builder.appInfo();
         HelperContext info = new HelperContext();
diff --git a/runtime/src/main/java/org/onosproject/yang/runtime/impl/DefaultDataTreeBuilder.java b/runtime/src/main/java/org/onosproject/yang/runtime/impl/DefaultDataTreeBuilder.java
index 7be4b60..c78e54e 100644
--- a/runtime/src/main/java/org/onosproject/yang/runtime/impl/DefaultDataTreeBuilder.java
+++ b/runtime/src/main/java/org/onosproject/yang/runtime/impl/DefaultDataTreeBuilder.java
@@ -21,11 +21,14 @@
 import org.onosproject.yang.compiler.datamodel.YangAugmentableNode;
 import org.onosproject.yang.compiler.datamodel.YangCase;
 import org.onosproject.yang.compiler.datamodel.YangChoice;
+import org.onosproject.yang.compiler.datamodel.YangInput;
 import org.onosproject.yang.compiler.datamodel.YangLeaf;
 import org.onosproject.yang.compiler.datamodel.YangLeafList;
 import org.onosproject.yang.compiler.datamodel.YangLeavesHolder;
 import org.onosproject.yang.compiler.datamodel.YangList;
 import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangOutput;
+import org.onosproject.yang.compiler.datamodel.YangRpc;
 import org.onosproject.yang.compiler.datamodel.YangSchemaNode;
 import org.onosproject.yang.compiler.utils.io.YangPluginConfig;
 import org.onosproject.yang.model.DataNode;
@@ -36,6 +39,7 @@
 import org.onosproject.yang.model.ModelObjectData;
 import org.onosproject.yang.model.ModelObjectId;
 import org.onosproject.yang.model.ResourceData;
+import org.onosproject.yang.model.ResourceId;
 import org.onosproject.yang.runtime.DefaultResourceData;
 
 import java.util.Iterator;
@@ -129,20 +133,25 @@
         //Create data nodes.
         DataTreeBuilderHelper helper = new DataTreeBuilderHelper(reg);
         YangSchemaNode curNode;
-        for (Object modObj : modelObjects) {
+        for (ModelObject modObj : modelObjects) {
             //Do processing of data node conversion from model objects.
             if (modObj instanceof LeafModelObject) {
                 //Process leaf object.
                 processLeafObj(lastIndexNode, rscData, (LeafModelObject) modObj);
             } else {
-                curNode = fetchCurNode(modObj, (YangNode) lastIndexNode);
+                if (converter.isInputOrOutput()) {
+                    curNode = handleRpcChild(modObj, (YangNode)
+                            lastIndexNode, rscData);
+                } else {
+                    curNode = fetchCurNode(modObj, (YangNode) lastIndexNode);
+                }
                 if (curNode != null) {
                     processDataNodeConversion((YangNode) curNode, helper,
                                               rscData, modObj);
                 } else {
                     throw new ModelConvertorException(
                             "failed to convert model object in data node" +
-                                    modObj.toString());
+                                    modObj);
                 }
             }
         }
@@ -192,6 +201,44 @@
     }
 
     /**
+     * Returns input/output nodes.
+     *
+     * @param obj     model object for input/output nodes
+     * @param parent  module node
+     * @param rscData resource data builder
+     * @return input/output node
+     */
+    private YangSchemaNode handleRpcChild(
+            Object obj, YangNode parent, DefaultResourceData.Builder rscData) {
+        if (obj != null && parent != null) {
+            //process all the node which are in data model tree.
+            String name = obj.getClass().getName();
+            YangNode child = parent.getChild();
+            while (child != null && !(child instanceof YangRpc)) {
+                child = child.getNextSibling();
+            }
+            if (child != null) {
+                //Rpc should be part of resource identifier for input/output
+                // nodes.
+                ResourceId id = ResourceId.builder()
+                        .addBranchPointSchema("/", null)
+                        .addBranchPointSchema(child.getName(), child
+                                .getNameSpace().getModuleNamespace()).build();
+                rscData.resourceId(id);
+                child = child.getChild();
+                return getNode(child, name);
+            }
+        }
+        // this could also be possible that we have received this module node
+        // when model object is a node at third level of root node. for
+        // example if we have a model object id which is null and model
+        // object is an object of choice instance then this will be called
+        // because choice object will be instance of case class which is an
+        // third level node.
+        return fetchCurNode(obj, parent);
+    }
+
+    /**
      * In last index node we will be having parent node of the current object
      * so we need to get the current node and start processing it for
      * conversion.
@@ -323,6 +370,10 @@
                 javaName = child.getJavaPackage() + PERIOD + DEFAULT_CAPS +
                         getAugmentClassName((YangAugment) child,
                                             new YangPluginConfig());
+            } else if (child instanceof YangInput ||
+                    child instanceof YangOutput) {
+                javaName = child.getJavaPackage() + PERIOD + DEFAULT_CAPS +
+                        getCapitalCase(child.getJavaClassNameOrBuiltInType());
             } else {
                 javaName = child.getJavaPackage() + PERIOD + DEFAULT_CAPS +
                         getCapitalCase(getCamelCase(child.getName(), null));
diff --git a/runtime/src/main/java/org/onosproject/yang/runtime/impl/DefaultModelConverter.java b/runtime/src/main/java/org/onosproject/yang/runtime/impl/DefaultModelConverter.java
index 77d1b7f..aab6fd7 100644
--- a/runtime/src/main/java/org/onosproject/yang/runtime/impl/DefaultModelConverter.java
+++ b/runtime/src/main/java/org/onosproject/yang/runtime/impl/DefaultModelConverter.java
@@ -43,7 +43,7 @@
     }
 
     @Override
-    public synchronized ResourceData createDataNode(ModelObjectData modelData) {
+    public ResourceData createDataNode(ModelObjectData modelData) {
         DefaultDataTreeBuilder builder = new DefaultDataTreeBuilder(reg);
         return builder.getResourceData(modelData);
     }
diff --git a/runtime/src/main/java/org/onosproject/yang/runtime/impl/DefaultYangModelRegistry.java b/runtime/src/main/java/org/onosproject/yang/runtime/impl/DefaultYangModelRegistry.java
index e679d60..1ba79c6 100644
--- a/runtime/src/main/java/org/onosproject/yang/runtime/impl/DefaultYangModelRegistry.java
+++ b/runtime/src/main/java/org/onosproject/yang/runtime/impl/DefaultYangModelRegistry.java
@@ -286,13 +286,15 @@
      * Returns schema node for the given name. Name should be nodes namespace
      * defined in YANG file
      *
-     * @param nameSpace name space of YANG file
+     * @param nameSpace         name space of YANG file
+     * @param isForChildContext if the method call has arrived for child context
      * @return YANG schema node
      */
-    public YangSchemaNode getForNameSpace(String nameSpace) {
+    public YangSchemaNode getForNameSpace(String nameSpace,
+                                          boolean isForChildContext) {
 
         YangSchemaNode node = nameSpaceSchemaStore.get(nameSpace);
-        if (node == null) {
+        if (node == null && !isForChildContext) {
             log.error("node with {} namespace not found.", nameSpace);
         }
         return node;
@@ -314,7 +316,9 @@
                 regClass = registerClassStore.get(interfaceName);
             }
         }
-        log.error("{} node should not be null.");
+        if (regClass == null) {
+            log.error("{} node should not be null.");
+        }
         return regClass;
     }
 
@@ -575,7 +579,7 @@
         }
 
         String namespace = schemaId.namespace();
-        YangSchemaNode node = getForNameSpace(namespace);
+        YangSchemaNode node = getForNameSpace(namespace, true);
         if (node == null) {
             //If namespace if module name.
             node = getForSchemaName(schemaId.namespace());
@@ -585,6 +589,9 @@
         try {
             if (node != null) {
                 return node.getChildSchema(id).getSchemaNode();
+            } else {
+                log.error("node with {} namespace not found.", schemaId
+                        .namespace());
             }
         } catch (DataModelException e) {
             log.error("failed to get child schema", e);
diff --git a/runtime/src/main/java/org/onosproject/yang/runtime/impl/ModIdToRscIdConverter.java b/runtime/src/main/java/org/onosproject/yang/runtime/impl/ModIdToRscIdConverter.java
index 837795e..772e6a6 100644
--- a/runtime/src/main/java/org/onosproject/yang/runtime/impl/ModIdToRscIdConverter.java
+++ b/runtime/src/main/java/org/onosproject/yang/runtime/impl/ModIdToRscIdConverter.java
@@ -69,6 +69,11 @@
     private boolean isRpcAdded = true;
 
     /**
+     * Flag is true if we have found module node using input/output packages.
+     */
+    private boolean isInputOrOutput;
+
+    /**
      * Model registry.
      */
     private final DefaultYangModelRegistry reg;
@@ -159,6 +164,7 @@
         modPkg.deleteCharAt(modPkg.lastIndexOf(PERIOD));
         YangNode node = (YangNode) reg.getForInterfaceFilePkg(modPkg.toString());
         if (node != null) {
+            isInputOrOutput = true;
             modNode = node;
             //in this case we should update the lastIndexNode for object to
             // data fetchNode conversion. because we need to create the data fetchNode
@@ -166,7 +172,8 @@
             node = node.getChild();
             while (node != null) {
                 if (node.getJavaAttributeName().toLowerCase()
-                        .equals(strArray[i])) {
+                        .equals(strArray[i]) &&
+                        node.getYangSchemaNodeType() != YANG_NON_DATA_NODE) {
                     //last index fetchNode will be input fetchNode.
                     lastIndexNode = node.getChild();
                     break;
@@ -252,7 +259,20 @@
     private void handleLeafInRid(YangSchemaNode preNode, ModelObjectId id,
                                  ResourceId.Builder builder, AtomicPath path) {
         //check leaf nodes in previous nodes.
-        YangSchemaNode curNode = fetchLeaf(preNode, fetchPackage(path));
+        String pkg = fetchPackage(path);
+        YangSchemaNode curNode = fetchLeaf(preNode, pkg);
+        if (curNode == null) {
+            if (preNode instanceof YangAugmentableNode) {
+                List<YangAugment> augments = ((YangAugmentableNode) preNode)
+                        .getAugmentedInfoList();
+                for (YangAugment augment : augments) {
+                    curNode = fetchLeaf(augment, pkg);
+                    if (curNode != null) {
+                        break;
+                    }
+                }
+            }
+        }
         if (curNode == null) {
             throw new ModelConvertorException("invalid model object id." + id);
         }
@@ -334,13 +354,7 @@
         while (node != null) {
             //compare the java package with the package found in model object
             // identifier.
-            if (node.getYangSchemaNodeType() == YANG_NON_DATA_NODE) {
-                while (node != null &&
-                        node.getYangSchemaNodeType() == YANG_NON_DATA_NODE) {
-                    node = node.getNextSibling();
-                }
-            }
-            if (node != null) {
+            if (node.getYangSchemaNodeType() != YANG_NON_DATA_NODE) {
                 java = getJavaPkg(node);
                 if (java.equals(pkg)) {
                     return node;
@@ -358,6 +372,9 @@
                     // check in next sibling node
                     node = node.getNextSibling();
                 }
+            } else {
+                // check in next sibling node
+                node = node.getNextSibling();
             }
         }
         return null;
@@ -405,4 +422,13 @@
     boolean isMoIdWithLeaf() {
         return isMoIdWithLeaf;
     }
+
+    /**
+     * Returns true if module node is found using input/output packages.
+     *
+     * @return true if module node is found using input/output packages
+     */
+    boolean isInputOrOutput() {
+        return isInputOrOutput;
+    }
 }
diff --git a/runtime/src/test/java/org/onosproject/yang/runtime/impl/DefaultDataTreeBuilderTest.java b/runtime/src/test/java/org/onosproject/yang/runtime/impl/DefaultDataTreeBuilderTest.java
index 945af8d..9cb0419 100644
--- a/runtime/src/test/java/org/onosproject/yang/runtime/impl/DefaultDataTreeBuilderTest.java
+++ b/runtime/src/test/java/org/onosproject/yang/runtime/impl/DefaultDataTreeBuilderTest.java
@@ -48,6 +48,7 @@
 import org.onosproject.yang.runtime.mockclass.testmodule.DefaultTestNotification;
 import org.onosproject.yang.runtime.mockclass.testmodule.testnotification.DefaultTestContainer;
 import org.onosproject.yang.runtime.mockclass.testmodule.testrpc.DefaultTestInput;
+import org.onosproject.yang.runtime.mockclass.testmodule.testrpc.DefaultTestOutput;
 
 import java.math.BigDecimal;
 import java.util.ArrayList;
@@ -940,7 +941,7 @@
     @Test
     public void processRpcWithInput() {
         MoIdToRscIdTest ut = new MoIdToRscIdTest();
-        ut.addMockModWithInput();
+        ut.addMockModWithRpc();
 
         data = new DefaultModelObjectData.Builder();
         mid = ModelObjectId.builder()
@@ -975,13 +976,95 @@
     /**
      * Unit test for a module containing rpc. Model object contains input
      * class so resource identifier will start from "/" and will go till
+     * rpc node.as object is given for input node so data node will be having
+     * input node.
+     */
+    @Test
+    public void processRpcWithInputDataNode() {
+        MoIdToRscIdTest ut = new MoIdToRscIdTest();
+        ut.addMockModWithRpc();
+
+        DefaultTestInput input = new DefaultTestInput();
+        input.testContainer(new DefaultTestContainer());
+        data = new DefaultModelObjectData.Builder();
+        data.addModelObject(input);
+
+        registry = ut.reg;
+        DefaultDataTreeBuilder builder = new DefaultDataTreeBuilder(registry);
+        rscData = builder.getResourceData(data.build());
+
+        nameSpace = "testNamespace";
+        id = rscData.resourceId();
+        keys = id.nodeKeys();
+        assertThat(2, is(keys.size()));
+
+        sid = keys.get(0).schemaId();
+        assertThat("/", is(sid.name()));
+        assertThat(null, is(sid.namespace()));
+
+        sid = keys.get(1).schemaId();
+        assertThat("test-rpc", is(sid.name()));
+        assertThat(nameSpace, is(sid.namespace()));
+
+        dataNodes = rscData.dataNodes();
+        assertThat(1, is(dataNodes.size()));
+
+        node = dataNodes.get(0);
+        validateDataNode(node, "input", nameSpace,
+                         SINGLE_INSTANCE_NODE,
+                         true, null);
+    }
+
+    /**
+     * Unit test for a module containing rpc. Model object contains input
+     * class so resource identifier will start from "/" and will go till
+     * rpc node.as object is given for output node so data node will be having
+     * input node.
+     */
+    @Test
+    public void processRpcWithOutputDataNode() {
+        MoIdToRscIdTest ut = new MoIdToRscIdTest();
+        ut.addMockModWithRpc();
+
+        data = new DefaultModelObjectData.Builder();
+        data.addModelObject(new DefaultTestOutput());
+
+        registry = ut.reg;
+        DefaultDataTreeBuilder builder = new DefaultDataTreeBuilder(registry);
+        rscData = builder.getResourceData(data.build());
+
+        nameSpace = "testNamespace";
+        id = rscData.resourceId();
+        keys = id.nodeKeys();
+        assertThat(2, is(keys.size()));
+
+        sid = keys.get(0).schemaId();
+        assertThat("/", is(sid.name()));
+        assertThat(null, is(sid.namespace()));
+
+        sid = keys.get(1).schemaId();
+        assertThat("test-rpc", is(sid.name()));
+        assertThat(nameSpace, is(sid.namespace()));
+
+        dataNodes = rscData.dataNodes();
+        assertThat(1, is(dataNodes.size()));
+
+        node = dataNodes.get(0);
+        validateDataNode(node, "output", nameSpace,
+                         SINGLE_INSTANCE_NODE,
+                         true, null);
+    }
+
+    /**
+     * Unit test for a module containing rpc. Model object contains input
+     * class so resource identifier will start from "/" and will go till
      * input node. it will contains rpc node as well. as object is given for
      * input node so data node will be for container node.
      */
     @Test
     public void processRpcWithInputModId() {
         MoIdToRscIdTest ut = new MoIdToRscIdTest();
-        ut.addMockModWithInput();
+        ut.addMockModWithRpc();
 
         data = new DefaultModelObjectData.Builder();
         mid = ModelObjectId.builder()
diff --git a/runtime/src/test/java/org/onosproject/yang/runtime/impl/DefaultYangModelRegistryTest.java b/runtime/src/test/java/org/onosproject/yang/runtime/impl/DefaultYangModelRegistryTest.java
index da4a3cb..45419a1 100644
--- a/runtime/src/test/java/org/onosproject/yang/runtime/impl/DefaultYangModelRegistryTest.java
+++ b/runtime/src/test/java/org/onosproject/yang/runtime/impl/DefaultYangModelRegistryTest.java
@@ -462,7 +462,7 @@
         provider.processSchemaRegistry();
         DefaultYangModelRegistry registry = provider.registry();
 
-        YangSchemaNode yangNode = registry.getForNameSpace(NAMESPACE);
+        YangSchemaNode yangNode = registry.getForNameSpace(NAMESPACE, false);
         assertThat(true, is(CHECK.equals(yangNode.getName())));
 
         YangRevision rev = ((YangNode) yangNode).getRevision();
diff --git a/runtime/src/test/java/org/onosproject/yang/runtime/impl/MoIdToRscIdTest.java b/runtime/src/test/java/org/onosproject/yang/runtime/impl/MoIdToRscIdTest.java
index 0d65cdd..371ad88 100644
--- a/runtime/src/test/java/org/onosproject/yang/runtime/impl/MoIdToRscIdTest.java
+++ b/runtime/src/test/java/org/onosproject/yang/runtime/impl/MoIdToRscIdTest.java
@@ -45,6 +45,9 @@
 import org.onosproject.yang.gen.v1.yms.test.ytb.tree.builder.yangautoprefixfor.yangautoprefixlist.having.yangautoprefixlist.rev20160826.ytbtreebuilderforlisthavinglist.carrier.MultiplexesKeys;
 import org.onosproject.yang.gen.v1.yms.test.ytb.tree.builder.yangautoprefixfor.yangautoprefixlist.having.yangautoprefixlist.rev20160826.ytbtreebuilderforlisthavinglist.carrier.multiplexes.ApplicationAreasKeys;
 import org.onosproject.yang.gen.v1.yms.test.ytb.tree.builder.yangautoprefixfor.yangautoprefixlist.having.yangautoprefixlist.rev20160826.ytbtreebuilderforlisthavinglist.carrier.multiplexes.DefaultApplicationAreas;
+import org.onosproject.yang.gen.v1.yrt.model.converter.model.data.to.resource.data.rev20160826.modeldatatoresourcedata.DefaultFirstLevel;
+import org.onosproject.yang.gen.v1.yrt.model.converter.model.data.to.resource.data.rev20160826.modeldatatoresourcedata.firstlevel.DefaultContainerLeaf;
+import org.onosproject.yang.gen.v1.yrt.model.converter.model.data.to.resource.data.rev20160826.modeldatatoresourcedata.firstlevel.containerleaf.AugmentedContainerLeaf;
 import org.onosproject.yang.model.KeyLeaf;
 import org.onosproject.yang.model.LeafListKey;
 import org.onosproject.yang.model.ListKey;
@@ -55,6 +58,7 @@
 import org.onosproject.yang.runtime.mockclass.testmodule.DefaultTestNotification;
 import org.onosproject.yang.runtime.mockclass.testmodule.testnotification.DefaultTestContainer;
 import org.onosproject.yang.runtime.mockclass.testmodule.testrpc.DefaultTestInput;
+import org.onosproject.yang.runtime.mockclass.testmodule.testrpc.DefaultTestOutput;
 import org.slf4j.Logger;
 
 import java.util.List;
@@ -92,11 +96,11 @@
     /**
      * Adds mock node in registry.
      */
-    void addMockModWithInput() {
+    void addMockModWithRpc() {
         setUp();
         YangModule mod = null;
         try {
-            mod = (YangModule) getModuleWithInput();
+            mod = (YangModule) getModuleWithRpc();
         } catch (DataModelException e) {
             log.info("test error");
         }
@@ -239,6 +243,32 @@
     }
 
     /**
+     * Unit test with current node having augmented leaf as model object
+     * identifier.
+     */
+    @Test
+    public void modIdWithAugmentLeaf() {
+        setUp();
+        mid = ModelObjectId.builder()
+                .addChild(DefaultFirstLevel.class)
+                .addChild(DefaultContainerLeaf.class)
+                .addChild(AugmentedContainerLeaf.LeafIdentifier.LEAFAUG)
+                .build();
+        rscId = builder.fetchResourceId(mid);
+
+        nodeKeys = rscId.nodeKeys();
+        assertThat(4, is(nodeKeys.size()));
+
+        sid = nodeKeys.get(0).schemaId();
+        assertThat("/", is(sid.name()));
+        assertThat(null, is(sid.namespace()));
+
+        sid = nodeKeys.get(1).schemaId();
+        assertThat("first-level", is(sid.name()));
+        assertThat("yrt:model:converter:model:data:to:resource:data", is(sid.namespace()));
+    }
+
+    /**
      * Unit test case for model object identifier as list with leaf.
      */
     @Test
@@ -276,7 +306,7 @@
      */
     @Test
     public void moIdWithInput() {
-        addMockModWithInput();
+        addMockModWithRpc();
 
         mid = new ModelObjectId.Builder()
                 .addChild(DefaultTestInput.class).build();
@@ -299,11 +329,11 @@
     }
 
     /**
-     * Unit test case for model object identifier input with leaf.
+     * Unit test case for model object identifier input with container.
      */
     @Test
     public void moIdWithInputAndContainer() {
-        addMockModWithInput();
+        addMockModWithRpc();
 
         mid = new ModelObjectId.Builder()
                 .addChild(DefaultTestInput.class)
@@ -333,6 +363,34 @@
     }
 
     /**
+     * Unit test case for model object identifier output.
+     */
+    @Test
+    public void moIdWithOutput() {
+        addMockModWithRpc();
+
+        mid = new ModelObjectId.Builder()
+                .addChild(DefaultTestOutput.class)
+                .build();
+
+        rscId = builder.fetchResourceId(mid);
+        nodeKeys = rscId.nodeKeys();
+        assertThat(3, is(nodeKeys.size()));
+
+        sid = nodeKeys.get(0).schemaId();
+        assertThat("/", is(sid.name()));
+        assertThat(null, is(sid.namespace()));
+
+        sid = nodeKeys.get(1).schemaId();
+        assertThat("test-rpc", is(sid.name()));
+        assertThat("testNamespace", is(sid.namespace()));
+
+        sid = nodeKeys.get(2).schemaId();
+        assertThat("output", is(sid.name()));
+        assertThat("testNamespace", is(sid.namespace()));
+    }
+
+    /**
      * Unit test case for model object identifier as notification.
      */
     @Test
@@ -356,7 +414,8 @@
     }
 
     /**
-     * Unit test case for model object identifier as notification with leaf.
+     * Unit test case for model object identifier as notification with
+     * container.
      */
     @Test
     public void moIdWithNotificationAndContainer() {
@@ -643,7 +702,7 @@
      * @return mock node tree with module, rpc, input and output
      * @throws DataModelException when fails to do data model operations
      */
-    private YangNode getModuleWithInput() throws DataModelException {
+    private YangNode getModuleWithRpc() throws DataModelException {
         YangModule mod = getYangModule();
         YangRpc rpc = getRpcNode();
         mod.addChild(rpc);
@@ -794,7 +853,6 @@
             }
         };
         out.setName("output");
-        out.addLeaf(getLeafNode());
         out.setNameSpace(getMockNamespace());
         return out;
     }
diff --git a/serializers/xml/src/test/java/org/onosproject/yang/serializers/xml/XmlSerializerTest.java b/serializers/xml/src/test/java/org/onosproject/yang/serializers/xml/XmlSerializerTest.java
index 1f53ac5..678d88b 100644
--- a/serializers/xml/src/test/java/org/onosproject/yang/serializers/xml/XmlSerializerTest.java
+++ b/serializers/xml/src/test/java/org/onosproject/yang/serializers/xml/XmlSerializerTest.java
@@ -214,32 +214,6 @@
     }
 
     /**
-     * Validates data node in which XML element is child of YANG grouping.
-     */
-    @Test
-    public void testGroupingUsesDataNode() {
-        String path = "src/test/resources/testGroupingUses.xml";
-
-        String uri = "urn:ietf:params:xml:ns:yang:yrt-ietf-network:networks-state/network";
-        DefaultCompositeStream external =
-                new DefaultCompositeStream(uri, parseInput(path));
-        CompositeData compositeData = xmlSerializer.decode(external, context);
-        ResourceData resourceData = compositeData.resourceData();
-        List<DataNode> dataNodes = resourceData.dataNodes();
-        LeafNode dataNode = ((LeafNode) dataNodes.get(0));
-        SchemaId schemaId = dataNode.key().schemaId();
-        assertThat(schemaId.name(), is("network-ref"));
-        assertThat(schemaId.namespace(), is("urn:ietf:params:xml:ns:yang:yrt-ietf-network"));
-        assertThat(dataNode.value().toString(), is("abc"));
-
-        // encode test
-        CompositeStream compositeStream = xmlSerializer.encode(compositeData,
-                                                               context);
-        InputStream inputStream = compositeStream.resourceData();
-        assertThat(convertInputStreamToString(inputStream), is(parseXml(path)));
-    }
-
-    /**
      * Validates whether XML attributes is converted to annotations.
      */
     @Test
diff --git a/serializers/xml/src/test/resources/testGroupingUses.xml b/serializers/xml/src/test/resources/testGroupingUses.xml
deleted file mode 100644
index 45d3d05..0000000
--- a/serializers/xml/src/test/resources/testGroupingUses.xml
+++ /dev/null
@@ -1,2 +0,0 @@
-<network-ref xmlns="urn:ietf:params:xml:ns:yang:yrt-ietf-network">abc
-</network-ref>
\ No newline at end of file
