Skip to content
Snippets Groups Projects
Commit 28870d87 authored by Carl D. Roth's avatar Carl D. Roth
Browse files

Fix BVS interface deletion bug

- event processing in cleanupEntities was exiting prematurely, some device delete
  updates were not being processed
- updated unittest to verify device deletion
- See BSC-2454
parent a7697708
No related branches found
No related tags found
No related merge requests found
......@@ -1472,8 +1472,6 @@ IFlowReconcileListener, IInfoProvider, IHAListener {
d = deviceMap.get(d.getDeviceKey());
if (null != d)
continue;
else
break;
}
} else {
deviceUpdates.add(new DeviceUpdate(d, DELETE, null));
......@@ -1484,8 +1482,6 @@ IFlowReconcileListener, IInfoProvider, IHAListener {
d = deviceMap.get(d.getDeviceKey());
if (null != d)
continue;
else
break;
}
processUpdates(deviceUpdates);
break;
......
......@@ -869,6 +869,10 @@ public class DeviceManagerImplTest extends FloodlightTestCase {
}
public void doTestDeviceExpiration() throws Exception {
IDeviceListener mockListener =
createStrictMock(IDeviceListener.class);
mockListener.deviceRemoved(isA(IDevice.class));
Calendar c = Calendar.getInstance();
c.add(Calendar.MILLISECOND, -DeviceManagerImpl.ENTITY_TIMEOUT-1);
Entity entity1 = new Entity(1L, null, 1, 1L, 1, c.getTime());
......@@ -897,6 +901,8 @@ public class DeviceManagerImplTest extends FloodlightTestCase {
d = deviceManager.learnDeviceByEntity(entity1);
assertArrayEquals(new Integer[] { 1, 2 }, d.getIPv4Addresses());
deviceManager.addListener(mockListener);
replay(mockListener);
deviceManager.entityCleanupTask.reschedule(0, null);
IDevice r = deviceManager.getDevice(d.getDeviceKey());
......@@ -907,6 +913,8 @@ public class DeviceManagerImplTest extends FloodlightTestCase {
r = deviceManager.findDevice(1L, null, null, null, null);
assertNull(r);
verify(mockListener);
}
/*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment