diff --git a/compiler/plugin/utils/src/main/java/org/onosproject/yang/compiler/plugin/utils/YangApacheUtils.java b/compiler/plugin/utils/src/main/java/org/onosproject/yang/compiler/plugin/utils/YangApacheUtils.java
index 1ce96b4..c457ec4 100644
--- a/compiler/plugin/utils/src/main/java/org/onosproject/yang/compiler/plugin/utils/YangApacheUtils.java
+++ b/compiler/plugin/utils/src/main/java/org/onosproject/yang/compiler/plugin/utils/YangApacheUtils.java
@@ -30,6 +30,7 @@
 import java.io.File;
 import java.io.IOException;
 import java.text.SimpleDateFormat;
+import java.util.Iterator;
 import java.util.List;
 import java.util.regex.Pattern;
 
@@ -104,7 +105,9 @@
                                              List<YangNode> curNodes) {
         DefaultYangModel model = new DefaultYangModel();
         YangModuleId id;
-        for (YangSchemaNode node : curNodes) {
+        Iterator<YangNode> it = curNodes.iterator();
+        while (it.hasNext()) {
+            YangSchemaNode node = it.next();
             id = processModuleId((YangNode) node);
             org.onosproject.yang.YangModule module =
                     new DefaultYangModule(id, get(node.getFileName()), get(path));
diff --git a/runtime/src/main/java/org/onosproject/yang/runtime/ymrimpl/DefaultYangModelRegistry.java b/runtime/src/main/java/org/onosproject/yang/runtime/ymrimpl/DefaultYangModelRegistry.java
index b064e9b..0f0d8a6 100644
--- a/runtime/src/main/java/org/onosproject/yang/runtime/ymrimpl/DefaultYangModelRegistry.java
+++ b/runtime/src/main/java/org/onosproject/yang/runtime/ymrimpl/DefaultYangModelRegistry.java
@@ -54,9 +54,10 @@
 /**
  * Represents YANG model registry implementation.
  */
-public class DefaultYangModelRegistry implements YangModelRegistry, SingleInstanceNodeContext {
+public class DefaultYangModelRegistry implements YangModelRegistry,
+        SingleInstanceNodeContext {
 
-    private static final Logger log = getLogger(DefaultYangModelRegistry.class);
+    private final Logger log = getLogger(getClass());
     private static final String AT = "@";
 
     /*
@@ -181,9 +182,9 @@
                                          "unregistered.", sClass
                                          .getSimpleName(), param);
                     } else {
-                        throw new RuntimeException(
-                                sClass.getSimpleName() +
-                                        " service was not registered.");
+                        log.error("Either {} service was not registered or " +
+                                          "already unregistered from model " +
+                                          "registry.", sClass.getSimpleName());
                     }
                 }
             } else {
@@ -277,12 +278,16 @@
      * @return registered class
      */
     public Class<?> getRegisteredClass(YangSchemaNode schemaNode) {
-        String interfaceName = getInterfaceClassName(schemaNode);
-        String serviceName = getServiceName(schemaNode);
-        Class<?> regClass = registerClassStore.get(serviceName);
-        if (regClass == null) {
-            regClass = registerClassStore.get(interfaceName);
+        Class<?> regClass = null;
+        if (schemaNode != null) {
+            String interfaceName = getInterfaceClassName(schemaNode);
+            String serviceName = getServiceName(schemaNode);
+            regClass = registerClassStore.get(serviceName);
+            if (regClass == null) {
+                regClass = registerClassStore.get(interfaceName);
+            }
         }
+        log.error("{} node should not be null.");
         return regClass;
     }
 
@@ -476,7 +481,7 @@
      *
      * @param nodes set of module/submodule nodes
      */
-    public void updateChildContext(Set<YangNode> nodes) {
+    private void updateChildContext(Set<YangNode> nodes) {
         // Preparing schema id for logical node with name "/"
         for (YangNode node : nodes) {
             node.setLeafRootContext(this);
@@ -513,7 +518,7 @@
      *
      * @param curNode choice node
      */
-    public void updateSchemaContextForChoiceChild(YangNode curNode) {
+    private void updateSchemaContextForChoiceChild(YangNode curNode) {
         YangNode child = curNode.getChild();
         // Setting the parent context for case
         while (child != null) {
@@ -527,7 +532,7 @@
      *
      * @param curNode case node
      */
-    public void updateSchemaContextForCaseChild(YangNode curNode) {
+    private void updateSchemaContextForCaseChild(YangNode curNode) {
         curNode.setLeafRootContext(this);
         YangNode child = curNode.getChild();
         updateContextForChoiceCase(child);
@@ -538,8 +543,7 @@
 
         checkNotNull(schemaId);
         if (schemaId.namespace() == null) {
-            log.error("node with {} namespace not found.",
-                      schemaId.namespace());
+            log.error("node with {} namespace not found.", schemaId.namespace());
         }
 
         String namespace = schemaId.namespace();
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 8d6caba..0e12c39 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
@@ -25,6 +25,8 @@
 import org.onosproject.yang.runtime.ymrimpl.DefaultYangModelRegistry;
 
 import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
 
 import static org.hamcrest.MatcherAssert.assertThat;
 import static org.hamcrest.core.Is.is;
@@ -101,10 +103,6 @@
             "org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf" +
                     ".network4.IetfNetwork4OpParam";
 
-    private static final String UN_REG_SCHEMA_NAME = "ietf-routing";
-    private static final String UN_REG_INTERFACE_NAME = "IetfRouting";
-    private static final String UN_REG_OP_PARAM_NAME = "IetfRoutingOpParam";
-    private static final String UN_REG_SERVICE_NAME = "IetfRoutingService";
     private static final String CHECK = "check";
     private static final String DATE_NAMESPACE = "2015-00-08";
     private static final String NAMESPACE =
@@ -126,39 +124,39 @@
 
         provider.processSchemaRegistry();
 
+        List<YangNode> nodes = new ArrayList<>();
         DefaultYangModelRegistry registry = provider.registry();
 
         YangSchemaNode yangNode = registry.getForSchemaName(SCHEMA_NAME_3);
         assertThat(true, is(SCHEMA_NAME_3.equals(yangNode.getName())));
 
-        yangNode =
-                registry.getForInterfaceFileName(
-                        INTERFACE_NAME_3);
+        yangNode = registry.getForInterfaceFileName(INTERFACE_NAME_3);
         assertThat(true, is(SCHEMA_NAME_3.equals(yangNode.getName())));
 
-        yangNode =
-                registry.getForOpPramFileName(
-                        OP_PARAM_NAME_3);
+        yangNode = registry.getForOpPramFileName(OP_PARAM_NAME_3);
         assertThat(true, is(SCHEMA_NAME_3.equals(yangNode.getName())));
 
-//        provider.unregisterService(SERVICE_NAME_3);
-        //TODO: fix unregister UT.
-//
-//        yangNode = registry.getForAppName(SERVICE_NAME_3);
-//        assertThat(true, is(yangNode == null));
-//
-//        yangNode = registry.getForSchemaName(SCHEMA_NAME_3);
-//        assertThat(true, is(yangNode == null));
-//
-//        yangNode =
-//                registry.getForInterfaceFileName(
-//                        INTERFACE_NAME_3);
-//        assertThat(true, is(yangNode == null));
-//
-//        yangNode =
-//                registry.getForOpPramFileName(
-//                        OP_PARAM_NAME_3);
-//        assertThat(true, is(yangNode == null));
+        Class<?> cls = registry.getRegisteredClass(yangNode);
+        assertThat(true, is(INTERFACE_NAME_3.equals(cls.getName())));
+
+        //Unregister service
+        nodes.add((YangNode) yangNode);
+        provider.unRegister(nodes);
+
+        yangNode = registry.getForAppName(SERVICE_NAME_3);
+        assertThat(true, is(yangNode == null));
+
+        yangNode = registry.getForSchemaName(SCHEMA_NAME_3);
+        assertThat(true, is(yangNode == null));
+
+        yangNode = registry.getForInterfaceFileName(INTERFACE_NAME_3);
+        assertThat(true, is(yangNode == null));
+
+        yangNode = registry.getForOpPramFileName(OP_PARAM_NAME_3);
+        assertThat(true, is(yangNode == null));
+
+        cls = registry.getRegisteredClass(yangNode);
+        assertThat(true, is(cls == null));
     }
 
     /**
@@ -172,179 +170,63 @@
             throws IOException {
 
         provider.processSchemaRegistry();
-        DefaultYangModelRegistry registry =
-                provider.registry();
+        DefaultYangModelRegistry registry = provider.registry();
 
+        List<YangNode> nodes = new ArrayList<>();
         //Service with rev.
         YangSchemaNode yangNode = registry.getForSchemaName(SCHEMA_NAME_4_15);
         assertThat(true, is(SCHEMA_NAME_4.equals(yangNode.getName())));
 
-        yangNode =
-                registry.getForInterfaceFileName(
-                        INTERFACE_NAME_REV_15);
+        yangNode = registry.getForInterfaceFileName(INTERFACE_NAME_REV_15);
         assertThat(true, is(SCHEMA_NAME_4.equals(yangNode.getName())));
 
-        yangNode =
-                registry.getForOpPramFileName(
-                        OP_PARAM_NAME_REV_15);
+        yangNode = registry.getForOpPramFileName(OP_PARAM_NAME_REV_15);
         assertThat(true, is(SCHEMA_NAME_4.equals(yangNode.getName())));
 
-        //       provider.unregisterService(SERVICE_NAME_REV_15);
+        Class<?> cls = registry.getRegisteredClass(yangNode);
+        assertThat(true, is(INTERFACE_NAME_REV_15.equals(cls.getName())));
+
+        //unregister SERVICE_NAME_REV_15.
+        nodes.add((YangNode) yangNode);
+        provider.unRegister(nodes);
 
         yangNode = registry.getForAppName(SERVICE_NAME_REV_15);
         assertThat(true, is(yangNode == null));
 
-        //Here the yangNode should be the node which does not have revision.
-        // asset should pass with false.
-        yangNode = registry.getForSchemaName(SCHEMA_NAME_4);
-        assertThat(true, is(((YangNode) yangNode).getRevision() == null));
-
-        yangNode = registry.getForSchemaName(SCHEMA_NAME_4);
-        assertThat(true, is(SCHEMA_NAME_4.equals(yangNode.getName())));
-
-        yangNode =
-                registry.getForInterfaceFileName(
-                        INTERFACE_NAME_NO_REV);
-        assertThat(true, is(SCHEMA_NAME_4.equals(yangNode.getName())));
-
-        yangNode =
-                registry.getForOpPramFileName(
-                        OP_PARAM_NAME_NO_REV);
-        assertThat(true, is(SCHEMA_NAME_4.equals(yangNode.getName())));
-
-        //provider.unregisterService(SERVICE_NAME_NO_REV);
-
-        yangNode = registry.getForAppName(SERVICE_NAME_NO_REV);
-        assertThat(true, is(yangNode == null));
-
-        //Here the yangNode should be the node which have different revision.
         yangNode = registry.getForSchemaName(SCHEMA_NAME_4);
         assertThat(true, is(yangNode != null));
-        //TODO: ureg.
-//        assertThat(true, is(((YangNode) yangNode).getRevision() != null));
-    }
 
-    /**
-     * Unit test case in which schema node should be present with multi
-     * revisions.
-     *
-     * @throws IOException when fails to do IO operation
-     */
-    //TODO: add unreg in UT
-    public void testForGetSchemaNodeWhenMultiRevision()
-            throws IOException {
-
-        provider.processSchemaRegistry();
-        DefaultYangModelRegistry registry =
-                provider.registry();
-
-        //Service with rev.
-        YangSchemaNode yangNode = registry.getForSchemaName(SCHEMA_NAME_4_15);
-        assertThat(true, is(SCHEMA_NAME_4.equals(yangNode.getName())));
-
-        yangNode =
-                registry.getForInterfaceFileName(
-                        INTERFACE_NAME_REV_15);
-        assertThat(true, is(SCHEMA_NAME_4.equals(yangNode.getName())));
-
-        yangNode =
-                registry.getForOpPramFileName(
-                        OP_PARAM_NAME_REV_15);
-        assertThat(true, is(SCHEMA_NAME_4.equals(yangNode.getName())));
-
-        //As we have not registered an  application this object should be null.
-        Object object = registry.getRegisteredClass(yangNode);
-        assertThat(true, is(object == null));
-//        provider.unregisterService(SERVICE_NAME_REV_15);
-
-        yangNode = registry.getForAppName(SERVICE_NAME_REV_15);
+        yangNode = registry.getForInterfaceFileName(INTERFACE_NAME_REV_15);
         assertThat(true, is(yangNode == null));
 
+        yangNode = registry.getForOpPramFileName(OP_PARAM_NAME_REV_15);
+        assertThat(true, is(yangNode == null));
+
+        cls = registry.getRegisteredClass(yangNode);
+        assertThat(true, is(cls == null));
+
         //Here the yangNode should be the node which does not have revision.
         // asset should pass with false.
         yangNode = registry.getForSchemaName(SCHEMA_NAME_4);
         assertThat(true, is(((YangNode) yangNode).getRevision() == null));
 
-        //Service with different revision.
-        yangNode = registry
-                .getForAppName(SERVICE_NAME_REV_16);
-        assertThat(true, is(SCHEMA_NAME_4.equals(yangNode.getName())));
-
-        yangNode = registry.getForSchemaName(SCHEMA_NAME_4_16);
-        assertThat(true, is(SCHEMA_NAME_4.equals(yangNode.getName())));
-
-        yangNode =
-                registry.getForInterfaceFileName(
-                        INTERFACE_NAME_REV_16);
-        assertThat(true, is(SCHEMA_NAME_4.equals(yangNode.getName())));
-
-        yangNode =
-                registry.getForOpPramFileName(
-                        OP_PARAM_NAME_REV_16);
-        assertThat(true, is(SCHEMA_NAME_4.equals(yangNode.getName())));
-
-        //As we have not registered an  application this object should be null.
-        object = registry.getRegisteredClass(yangNode);
-        assertThat(true, is(object == null));
-//        provider.unregisterService(SERVICE_NAME_REV_16);
-
-        yangNode = registry.getForAppName(SERVICE_NAME_REV_16);
-        assertThat(true, is(yangNode == null));
-
-        //Here the yangNode should be the node which have different revision.
-        yangNode = registry.getForSchemaName(SCHEMA_NAME_4);
-        assertThat(true, is(((YangNode) yangNode).getRevision() == null));
-
-        //Service with different revision.
-        yangNode = registry.getForAppName(SERVICE_NAME_REV_17);
-        assertThat(true, is(SCHEMA_NAME_4.equals(yangNode.getName())));
-
-        yangNode = registry.getForSchemaName(SCHEMA_NAME_4_17);
-        assertThat(true, is(SCHEMA_NAME_4.equals(yangNode.getName())));
-
-        yangNode =
-                registry.getForInterfaceFileName(
-                        INTERFACE_NAME_REV_17);
-        assertThat(true, is(SCHEMA_NAME_4.equals(yangNode.getName())));
-
-        yangNode =
-                registry.getForOpPramFileName(
-                        OP_PARAM_NAME_REV_17);
-        assertThat(true, is(SCHEMA_NAME_4.equals(yangNode.getName())));
-
-        //As we have not registered an  application this object should be null.
-        object = registry.getRegisteredClass(yangNode);
-        assertThat(true, is(object == null));
-//        provider.unregisterService(SERVICE_NAME_REV_17);
-
-        yangNode = registry.getForAppName(SERVICE_NAME_REV_17);
-        assertThat(true, is(yangNode == null));
-
-        //Here the yangNode should be the node which have different revision.
-        yangNode = registry.getForSchemaName(SCHEMA_NAME_4);
-        assertThat(true, is(((YangNode) yangNode).getRevision() == null));
-
-        //Service no revision.
-        yangNode = registry.getForAppName(SERVICE_NAME_NO_REV);
-        assertThat(true, is(SCHEMA_NAME_4.equals(yangNode.getName())));
+        //---------------------------------------------------------------//
 
         yangNode = registry.getForSchemaName(SCHEMA_NAME_4);
         assertThat(true, is(SCHEMA_NAME_4.equals(yangNode.getName())));
 
-        yangNode =
-                registry.getForInterfaceFileName(
-                        INTERFACE_NAME_NO_REV);
+        yangNode = registry.getForInterfaceFileName(INTERFACE_NAME_NO_REV);
         assertThat(true, is(SCHEMA_NAME_4.equals(yangNode.getName())));
 
-        yangNode =
-                registry.getForOpPramFileName(
-                        OP_PARAM_NAME_NO_REV);
+        yangNode = registry.getForOpPramFileName(OP_PARAM_NAME_NO_REV);
         assertThat(true, is(SCHEMA_NAME_4.equals(yangNode.getName())));
 
-        //As we have not registered an  application this object should be null.
-        object = registry.getRegisteredClass(yangNode);
-        assertThat(true, is(object == null));
-        //       provider.unregisterService(SERVICE_NAME_NO_REV);
+        cls = registry.getRegisteredClass(yangNode);
+        assertThat(true, is(INTERFACE_NAME_NO_REV.equals(cls.getName())));
+
+        //unregister SERVICE_NAME_NO_REV.
+        nodes.add((YangNode) yangNode);
+        provider.unRegister(nodes);
 
         yangNode = registry.getForAppName(SERVICE_NAME_NO_REV);
         assertThat(true, is(yangNode == null));
@@ -354,30 +236,223 @@
         assertThat(true, is(yangNode != null));
         assertThat(true, is(((YangNode) yangNode).getRevision() != null));
 
+        yangNode = registry.getForInterfaceFileName(INTERFACE_NAME_NO_REV);
+        assertThat(true, is(yangNode == null));
+
+        yangNode = registry.getForOpPramFileName(OP_PARAM_NAME_NO_REV);
+        assertThat(true, is(yangNode == null));
+
+        cls = registry.getRegisteredClass(yangNode);
+        assertThat(true, is(cls == null));
+    }
+
+    /**
+     * Unit test case in which schema node should be present with multi
+     * revisions.
+     *
+     * @throws IOException when fails to do IO operation
+     */
+    @Test
+    public void testForGetSchemaNodeWhenMultiRevision()
+            throws IOException {
+
+        provider.processSchemaRegistry();
+        DefaultYangModelRegistry registry = provider.registry();
+
+        List<YangNode> nodes = new ArrayList<>();
+        //Service with rev.
+        YangSchemaNode yangNode = registry.getForSchemaName(SCHEMA_NAME_4_15);
+        assertThat(true, is(SCHEMA_NAME_4.equals(yangNode.getName())));
+
+        yangNode = registry.getForInterfaceFileName(INTERFACE_NAME_REV_15);
+        assertThat(true, is(SCHEMA_NAME_4.equals(yangNode.getName())));
+
+        yangNode = registry.getForOpPramFileName(OP_PARAM_NAME_REV_15);
+        assertThat(true, is(SCHEMA_NAME_4.equals(yangNode.getName())));
+
+        Class<?> cls = registry.getRegisteredClass(yangNode);
+        assertThat(true, is(INTERFACE_NAME_REV_15.equals(cls.getName())));
+
+        //Unregister SERVICE_NAME_REV_15.
+        nodes.add((YangNode) yangNode);
+        provider.unRegister(nodes);
+
+        yangNode = registry.getForAppName(SERVICE_NAME_REV_15);
+        assertThat(true, is(yangNode == null));
+
+        yangNode = registry.getForSchemaName(SCHEMA_NAME_4);
+        assertThat(true, is(yangNode != null));
+
+        yangNode = registry.getForInterfaceFileName(INTERFACE_NAME_REV_15);
+        assertThat(true, is(yangNode == null));
+
+        yangNode = registry.getForOpPramFileName(OP_PARAM_NAME_REV_15);
+        assertThat(true, is(yangNode == null));
+
+        //Here the yangNode should be the node which does not have revision.
+        // asset should pass with false.
+        yangNode = registry.getForSchemaName(SCHEMA_NAME_4);
+        assertThat(true, is(((YangNode) yangNode).getRevision() == null));
+
+        cls = registry.getRegisteredClass(yangNode);
+        assertThat(true, is(cls != null));
+
+        //---------------------------------------------------------------//
+
+        //Here the yangNode should be the node which does not have revision.
+        // asset should pass with false.
+        yangNode = registry.getForSchemaName(SCHEMA_NAME_4);
+        assertThat(true, is(((YangNode) yangNode).getRevision() == null));
+
+        //Service with different revision.
+        yangNode = registry.getForAppName(SERVICE_NAME_REV_16);
+        assertThat(true, is(yangNode == null));
+
+        yangNode = registry.getForSchemaName(SCHEMA_NAME_4_16);
+        assertThat(true, is(SCHEMA_NAME_4.equals(yangNode.getName())));
+
+        yangNode = registry.getForInterfaceFileName(INTERFACE_NAME_REV_16);
+        assertThat(true, is(SCHEMA_NAME_4.equals(yangNode.getName())));
+
+        yangNode = registry.getForOpPramFileName(OP_PARAM_NAME_REV_16);
+        assertThat(true, is(SCHEMA_NAME_4.equals(yangNode.getName())));
+
+        cls = registry.getRegisteredClass(yangNode);
+        assertThat(true, is(INTERFACE_NAME_REV_16.equals(cls.getName())));
+
+        //Unregister SERVICE_NAME_REV_16.
+        nodes.add((YangNode) yangNode);
+        provider.unRegister(nodes);
+
+        yangNode = registry.getForAppName(SERVICE_NAME_REV_16);
+        assertThat(true, is(yangNode == null));
+
+        yangNode = registry.getForInterfaceFileName(INTERFACE_NAME_REV_16);
+        assertThat(true, is(yangNode == null));
+
+        yangNode = registry.getForOpPramFileName(OP_PARAM_NAME_REV_16);
+        assertThat(true, is(yangNode == null));
+
+        //Here the yangNode should be the node which have different revision.
+        yangNode = registry.getForSchemaName(SCHEMA_NAME_4);
+        assertThat(true, is(((YangNode) yangNode).getRevision() == null));
+
+        cls = registry.getRegisteredClass(yangNode);
+        assertThat(true, is(cls != null));
+
+        //---------------------------------------------------------------//
+
+        //Service with different revision.
+        yangNode = registry.getForAppName(SERVICE_NAME_REV_17);
+        assertThat(true, is(yangNode == null));
+
+        yangNode = registry.getForSchemaName(SCHEMA_NAME_4_17);
+        assertThat(true, is(SCHEMA_NAME_4.equals(yangNode.getName())));
+
+        yangNode = registry.getForInterfaceFileName(INTERFACE_NAME_REV_17);
+        assertThat(true, is(SCHEMA_NAME_4.equals(yangNode.getName())));
+
+        yangNode = registry.getForOpPramFileName(OP_PARAM_NAME_REV_17);
+        assertThat(true, is(SCHEMA_NAME_4.equals(yangNode.getName())));
+
+        cls = registry.getRegisteredClass(yangNode);
+        assertThat(true, is(INTERFACE_NAME_REV_17.equals(cls.getName())));
+
+        //Unregister SERVICE_NAME_REV_17.
+        nodes.add((YangNode) yangNode);
+        provider.unRegister(nodes);
+
+        yangNode = registry.getForAppName(SERVICE_NAME_REV_17);
+        assertThat(true, is(yangNode == null));
+
+        yangNode = registry.getForInterfaceFileName(INTERFACE_NAME_REV_17);
+        assertThat(true, is(yangNode == null));
+
+        yangNode = registry.getForOpPramFileName(OP_PARAM_NAME_REV_17);
+        assertThat(true, is(yangNode == null));
+
+        //Here the yangNode should be the node which have different revision.
+        yangNode = registry.getForSchemaName(SCHEMA_NAME_4);
+        assertThat(true, is(((YangNode) yangNode).getRevision() == null));
+
+        cls = registry.getRegisteredClass(yangNode);
+        assertThat(true, is(cls != null));
+
+        //---------------------------------------------------------------//
+
+        //Service no revision.
+        yangNode = registry.getForAppName(SERVICE_NAME_NO_REV);
+        assertThat(true, is(yangNode == null));
+
+        yangNode = registry.getForSchemaName(SCHEMA_NAME_4);
+        assertThat(true, is(SCHEMA_NAME_4.equals(yangNode.getName())));
+
+        yangNode = registry.getForInterfaceFileName(INTERFACE_NAME_NO_REV);
+        assertThat(true, is(SCHEMA_NAME_4.equals(yangNode.getName())));
+
+        yangNode = registry.getForOpPramFileName(OP_PARAM_NAME_NO_REV);
+        assertThat(true, is(SCHEMA_NAME_4.equals(yangNode.getName())));
+
+        cls = registry.getRegisteredClass(yangNode);
+        assertThat(true, is(INTERFACE_NAME_NO_REV.equals(cls.getName())));
+
+        //Unregister SERVICE_NAME_NO_REV.
+        nodes.add((YangNode) yangNode);
+        provider.unRegister(nodes);
+
+        yangNode = registry.getForAppName(SERVICE_NAME_NO_REV);
+        assertThat(true, is(yangNode == null));
+
+        yangNode = registry.getForInterfaceFileName(INTERFACE_NAME_NO_REV);
+        assertThat(true, is(yangNode == null));
+
+        yangNode = registry.getForOpPramFileName(OP_PARAM_NAME_NO_REV);
+        assertThat(true, is(yangNode == null));
+
+        //Here the yangNode should be the node which have different revision.
+        yangNode = registry.getForSchemaName(SCHEMA_NAME_4);
+        assertThat(true, is(yangNode != null));
+        assertThat(true, is(((YangNode) yangNode).getRevision() != null));
+
+        cls = registry.getRegisteredClass(yangNode);
+        assertThat(true, is(cls != null));
+
+        //---------------------------------------------------------------//
+
         //Service with different revision.
         yangNode = registry.getForAppName(SERVICE_NAME_REV_14);
-        assertThat(true, is(SCHEMA_NAME_4.equals(yangNode.getName())));
+        assertThat(true, is(yangNode == null));
 
         yangNode = registry.getForSchemaName(SCHEMA_NAME_4_14);
         assertThat(true, is(SCHEMA_NAME_4.equals(yangNode.getName())));
 
-        yangNode =
-                registry.getForInterfaceFileName(
-                        INTERFACE_NAME_REV_14);
+        yangNode = registry.getForInterfaceFileName(INTERFACE_NAME_REV_14);
         assertThat(true, is(SCHEMA_NAME_4.equals(yangNode.getName())));
 
-        yangNode =
-                registry.getForOpPramFileName(
-                        OP_PARAM_NAME_REV_14);
+        yangNode = registry.getForOpPramFileName(OP_PARAM_NAME_REV_14);
         assertThat(true, is(SCHEMA_NAME_4.equals(yangNode.getName())));
 
-        //As we have not registered an  application this object should be null.
-        object = registry.getRegisteredClass(yangNode);
-        assertThat(true, is(object == null));
-//        provider.unregisterService(SERVICE_NAME_REV_14);
+        cls = registry.getRegisteredClass(yangNode);
+        assertThat(true, is(INTERFACE_NAME_REV_14.equals(cls.getName())));
+
+        //Unregister SERVICE_NAME_REV_14.
+        nodes.add((YangNode) yangNode);
+        provider.unRegister(nodes);
 
         yangNode = registry.getForAppName(SERVICE_NAME_REV_14);
         assertThat(true, is(yangNode == null));
+
+        yangNode = registry.getForSchemaName(SCHEMA_NAME_4);
+        assertThat(true, is(yangNode == null));
+
+        yangNode = registry.getForInterfaceFileName(INTERFACE_NAME_REV_14);
+        assertThat(true, is(yangNode == null));
+
+        yangNode = registry.getForOpPramFileName(OP_PARAM_NAME_REV_14);
+        assertThat(true, is(yangNode == null));
+
+        cls = registry.getRegisteredClass(yangNode);
+        assertThat(true, is(cls == null));
     }
 
     /**
diff --git a/runtime/src/test/java/org/onosproject/yang/runtime/impl/TestYangSchemaNodeProvider.java b/runtime/src/test/java/org/onosproject/yang/runtime/impl/TestYangSchemaNodeProvider.java
index 59418e5..88f0a44 100644
--- a/runtime/src/test/java/org/onosproject/yang/runtime/impl/TestYangSchemaNodeProvider.java
+++ b/runtime/src/test/java/org/onosproject/yang/runtime/impl/TestYangSchemaNodeProvider.java
@@ -29,6 +29,7 @@
 import java.io.File;
 import java.io.IOException;
 import java.util.ArrayList;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Set;
 
@@ -42,7 +43,6 @@
 /**
  * Represents mock bundle context. provides bundle context for YSR to do unit
  * testing.
- * //TODO: add unreg ut.
  */
 public class TestYangSchemaNodeProvider {
 
@@ -70,41 +70,63 @@
             //Need to deserialize generated meta data file for unit tests.
             Set<YangNode> appNode = deSerializeDataModel(META_PATH);
             nodes.addAll(appNode);
-
-            //Process loading class file.
-            String appName;
-            ClassLoader classLoader = TestYangSchemaNodeProvider.class.getClassLoader();
-            for (YangSchemaNode node : nodes) {
-
-                //If service class is not generated then use
-                // interface file to load this class.
-                appName = getInterfaceClassName(node);
-                Class<?> cls;
-                try {
-                    cls = classLoader.loadClass(appName);
-                } catch (ClassNotFoundException e) {
-                    continue;
-                }
-
-                //Create model registration param.
-                ModelRegistrationParam.Builder b =
-                        DefaultModelRegistrationParam.builder();
-
-                //create a new YANG model
-                YangModel model = processYangModel(META_PATH, nodes);
-                //set YANG model
-                b.setYangModel(model);
-                //generate app info.
-                AppModuleInfo info = new DefaultAppModuleInfo(cls, null);
-                b.addAppModuleInfo(processModuleId((YangNode) node), info);
-                reg.registerModel(b.build());
-            }
+            reg.registerModel(prepareParam(nodes));
             deleteDirectory(TEMP_FOLDER_PATH);
         } catch (IOException e) {
         }
     }
 
     /**
+     * Unregister given nodes from runtime service.
+     *
+     * @param nodes list of nodes
+     */
+    public void unRegister(List<YangNode> nodes) {
+        reg.unregisterModel(prepareParam(nodes));
+    }
+
+    /**
+     * Prepares model registration parameter.
+     *
+     * @param nodes list of nodes
+     * @return model registration parameter
+     */
+    private ModelRegistrationParam prepareParam(List<YangNode> nodes) {
+        //Process loading class file.
+        String appName;
+        ClassLoader classLoader = getClass().getClassLoader();
+
+        //Create model registration param.
+        ModelRegistrationParam.Builder b =
+                DefaultModelRegistrationParam.builder();
+
+        //create a new YANG model
+        YangModel model = processYangModel(META_PATH, nodes);
+        //set YANG model
+        b.setYangModel(model);
+
+        Iterator<YangNode> it = nodes.iterator();
+        while (it.hasNext()) {
+            YangSchemaNode node = it.next();
+
+            //If service class is not generated then use
+            // interface file to load this class.
+            appName = getInterfaceClassName(node);
+            Class<?> cls;
+            try {
+                cls = classLoader.loadClass(appName);
+            } catch (ClassNotFoundException e) {
+                continue;
+            }
+
+            //generate app info.
+            AppModuleInfo info = new DefaultAppModuleInfo(cls, null);
+            b.addAppModuleInfo(processModuleId((YangNode) node), info);
+        }
+        return b.build();
+    }
+
+    /**
      * Returns schema registry.
      *
      * @return schema registry
