diff --git a/src/test/java/org/opencord/cordvtn/impl/CordVtnNodeManagerTest.java b/src/test/java/org/opencord/cordvtn/impl/CordVtnNodeManagerTest.java
index ab27957..a0eeb87 100644
--- a/src/test/java/org/opencord/cordvtn/impl/CordVtnNodeManagerTest.java
+++ b/src/test/java/org/opencord/cordvtn/impl/CordVtnNodeManagerTest.java
@@ -16,10 +16,10 @@
 package org.opencord.cordvtn.impl;
 
 import com.google.common.collect.Lists;
+import com.google.common.util.concurrent.MoreExecutors;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
-import org.onlab.junit.TestTools;
 import org.onlab.junit.TestUtils;
 import org.onosproject.cluster.ClusterServiceAdapter;
 import org.onosproject.cluster.LeadershipServiceAdapter;
@@ -76,6 +76,7 @@
         nodeStore = new DistributedCordVtnNodeStore();
         TestUtils.setField(nodeStore, "coreService", new TestCoreService());
         TestUtils.setField(nodeStore, "storageService", new TestStorageService());
+        TestUtils.setField(nodeStore, "eventExecutor", MoreExecutors.newDirectExecutorService());
         nodeStore.activate();
 
         nodeStore.createNode(NODE_2);
@@ -224,20 +225,17 @@
     }
 
     private void clearEvents() {
-        TestTools.delay(100);
         testListener.events.clear();
     }
 
     private void validateEvents(Enum... types) {
-        TestTools.assertAfter(100, () -> {
-            int i = 0;
-            assertEquals("Number of events did not match", types.length, testListener.events.size());
-            for (Event event : testListener.events) {
-                assertEquals("Incorrect event received", types[i], event.type());
-                i++;
-            }
-            testListener.events.clear();
-        });
+        int i = 0;
+        assertEquals("Number of events did not match", types.length, testListener.events.size());
+        for (Event event : testListener.events) {
+            assertEquals("Incorrect event received", types[i], event.type());
+            i++;
+        }
+        testListener.events.clear();
     }
 
     private static class TestCordVtnNodeListener implements CordVtnNodeListener {
diff --git a/src/test/java/org/opencord/cordvtn/impl/DefaultCordVtnNodeHandlerTest.java b/src/test/java/org/opencord/cordvtn/impl/DefaultCordVtnNodeHandlerTest.java
index 038d2da..21d7e9f 100644
--- a/src/test/java/org/opencord/cordvtn/impl/DefaultCordVtnNodeHandlerTest.java
+++ b/src/test/java/org/opencord/cordvtn/impl/DefaultCordVtnNodeHandlerTest.java
@@ -19,12 +19,13 @@
 import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
 import com.google.common.collect.Sets;
+import com.google.common.util.concurrent.MoreExecutors;
 import com.jcraft.jsch.Session;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
-import org.onlab.junit.TestTools;
+import org.onlab.junit.TestUtils;
 import org.onlab.packet.ChassisId;
 import org.onlab.packet.IpAddress;
 import org.onosproject.cluster.ClusterServiceAdapter;
@@ -85,7 +86,6 @@
 import static org.onosproject.net.NetTestTools.injectEventDispatcher;
 import static org.onosproject.net.device.DeviceEvent.Type.*;
 import static org.opencord.cordvtn.api.Constants.INTEGRATION_BRIDGE;
-import static org.opencord.cordvtn.api.node.CordVtnNodeEvent.Type.NODE_CREATED;
 import static org.opencord.cordvtn.api.node.CordVtnNodeEvent.Type.NODE_UPDATED;
 import static org.opencord.cordvtn.api.node.CordVtnNodeState.*;
 import static org.opencord.cordvtn.impl.RemoteIpCommandUtil.*;
@@ -152,8 +152,6 @@
         this.deviceService.devMap.put(OF_DEVICE_4.id(), OF_DEVICE_4);
 
         // add fake OF ports
-        this.deviceService.portList.add(OF_DEVICE_2_PORT_1);
-        this.deviceService.portList.add(OF_DEVICE_2_PORT_2);
         this.deviceService.portList.add(OF_DEVICE_3_PORT_1);
         this.deviceService.portList.add(OF_DEVICE_3_PORT_2);
         this.deviceService.portList.add(OF_DEVICE_4_PORT_1);
@@ -194,6 +192,7 @@
         target.nodeAdminService = this.nodeManager;
         target.instanceService = new TestInstanceService();
         target.pipelineService = new TestCordVtnPipeline();
+        TestUtils.setField(target, "eventExecutor", MoreExecutors.newDirectExecutorService());
         injectEventDispatcher(target, new TestEventDispatcher());
         target.activate();
     }
@@ -213,10 +212,8 @@
     @Test
     public void testProcessInitState() {
         deviceService.addDevice(OF_DEVICE_1);
-        TestTools.assertAfter(100, () -> {
-            CordVtnNode current = nodeManager.node(NODE_1.integrationBridgeId());
-            assertEquals(ERR_STATE, DEVICE_CREATED, current.state());
-        });
+        CordVtnNode current = nodeManager.node(NODE_1.integrationBridgeId());
+        assertEquals(ERR_STATE, DEVICE_CREATED, current.state());
     }
 
     /**
@@ -225,19 +222,18 @@
      */
     @Test
     public void testProcessDeviceCreatedState() {
-        // Add the data port and check if the state is still in DEVICE_CREAGED
+        CordVtnNode current = nodeManager.node(NODE_2.integrationBridgeId());
+        assertEquals(ERR_STATE, DEVICE_CREATED, current.state());
+
+        // Add the data port and check if the state is still in DEVICE_CREATED
         deviceService.addPort(OF_DEVICE_2, OF_DEVICE_2_PORT_1);
-        TestTools.assertAfter(100, () -> {
-            CordVtnNode current = nodeManager.node(NODE_2.integrationBridgeId());
-            assertEquals(ERR_STATE, DEVICE_CREATED, current.state());
-        });
+        current = nodeManager.node(NODE_2.integrationBridgeId());
+        assertEquals(ERR_STATE, DEVICE_CREATED, current.state());
 
         // Add the vxlan port and check if the state changes to PORT_CREATED
         deviceService.addPort(OF_DEVICE_2, OF_DEVICE_2_PORT_2);
-        TestTools.assertAfter(100, () -> {
-            CordVtnNode current = nodeManager.node(NODE_2.integrationBridgeId());
-            assertEquals(ERR_STATE, PORT_CREATED, current.state());
-        });
+        current = nodeManager.node(NODE_2.integrationBridgeId());
+        assertEquals(ERR_STATE, PORT_CREATED, current.state());
     }
 
     /**
@@ -258,11 +254,9 @@
 
         // There's no events for IP address changes on the interfaces, so just
         // Set node state updated to trigger node bootstrap
-        nodeManager.updateNode(NODE_3);
-        TestTools.assertAfter(100, () -> {
-            CordVtnNode current = nodeManager.node(NODE_3.integrationBridgeId());
-            assertEquals(ERR_STATE, COMPLETE, current.state());
-        });
+        nodeManager.updateNodeAndMakeEvent(NODE_3);
+        CordVtnNode current = nodeManager.node(NODE_3.integrationBridgeId());
+        assertEquals(ERR_STATE, COMPLETE, current.state());
     }
 
     /**
@@ -273,45 +267,35 @@
     public void testBackToInitStateWhenDeviceRemoved() {
         // Remove the device from DEVICE_CREATED state node
         deviceService.removeDevice(OF_DEVICE_2);
-        TestTools.assertAfter(100, () -> {
-            CordVtnNode current = nodeManager.node(NODE_2.integrationBridgeId());
-            assertEquals(ERR_STATE, INIT, current.state());
-        });
+        CordVtnNode current = nodeManager.node(NODE_2.integrationBridgeId());
+        assertEquals(ERR_STATE, INIT, current.state());
 
         // Remove the device from PORT_CREATED state node
         deviceService.removeDevice(OF_DEVICE_3);
-        TestTools.assertAfter(100, () -> {
-            CordVtnNode current = nodeManager.node(NODE_3.integrationBridgeId());
-            assertEquals(ERR_STATE, INIT, current.state());
-        });
+        current = nodeManager.node(NODE_3.integrationBridgeId());
+        assertEquals(ERR_STATE, INIT, current.state());
 
         // Remove the device from COMPLETE state node
         deviceService.removeDevice(OF_DEVICE_4);
-        TestTools.assertAfter(100, () -> {
-            CordVtnNode current = nodeManager.node(NODE_4.integrationBridgeId());
-            assertEquals(ERR_STATE, INIT, current.state());
-        });
+        current = nodeManager.node(NODE_4.integrationBridgeId());
+        assertEquals(ERR_STATE, INIT, current.state());
     }
 
     /**
-     * Checks if the node state falls back to DEVICE_CREATED when the ports
+     * Checks if the node state falls back to INIT state when the ports
      * are removed.
      */
     @Test
     public void testBackToDeviceCreatedStateWhenPortRemoved() {
         // Remove the device from PORT_CREATED state node
         deviceService.removePort(OF_DEVICE_3, OF_DEVICE_3_PORT_1);
-        TestTools.assertAfter(100, () -> {
-            CordVtnNode current = nodeManager.node(NODE_3.integrationBridgeId());
-            assertEquals(ERR_STATE, DEVICE_CREATED, current.state());
-        });
+        CordVtnNode current = nodeManager.node(NODE_3.integrationBridgeId());
+        assertEquals(ERR_STATE, INIT, current.state());
 
         // Remove the device from COMPLETE state node
         deviceService.removePort(OF_DEVICE_4, OF_DEVICE_4_PORT_1);
-        TestTools.assertAfter(100, () -> {
-            CordVtnNode current = nodeManager.node(NODE_4.integrationBridgeId());
-            assertEquals(ERR_STATE, DEVICE_CREATED, current.state());
-        });
+        current = nodeManager.node(NODE_4.integrationBridgeId());
+        assertEquals(ERR_STATE, INIT, current.state());
     }
 
     /**
@@ -330,10 +314,8 @@
         // Just triggers node update event for the PORT_CREATED node and
         // check if it stays in PORT_CREATED state
         nodeManager.updateNode(NODE_3);
-        TestTools.assertAfter(100, () -> {
-            CordVtnNode current = nodeManager.node(NODE_3.integrationBridgeId());
-            assertEquals(ERR_STATE, PORT_CREATED, current.state());
-        });
+        CordVtnNode current = nodeManager.node(NODE_3.integrationBridgeId());
+        assertEquals(ERR_STATE, PORT_CREATED, current.state());
     }
 
     private static final class TestDevice extends DefaultDevice {
@@ -453,13 +435,15 @@
         @Override
         public void createNode(CordVtnNode node) {
             nodeMap.put(node.integrationBridgeId(), node);
-            CordVtnNodeEvent event = new CordVtnNodeEvent(NODE_CREATED, node);
-            listeners.forEach(l -> l.event(event));
         }
 
         @Override
         public void updateNode(CordVtnNode node) {
             nodeMap.put(node.integrationBridgeId(), node);
+        }
+
+        public void updateNodeAndMakeEvent(CordVtnNode node) {
+            nodeMap.put(node.integrationBridgeId(), node);
             CordVtnNodeEvent event = new CordVtnNodeEvent(NODE_UPDATED, node);
             listeners.forEach(l -> l.event(event));
         }
