Introduce allowlist for back to back duplicate events
If there are two duplicate back to back role requests
DeviceTaskExectur drops the duplicate response if they
are spaced by an interval < 1s. This patch introduces an
allowlist for event types that should not be dropped
by the back to back policy.
This patch fixes one scenario that led to SDFAB-1025
Change-Id: Ic62ba56228c9c0c2b368e8e68ff50d11e2dc4249
diff --git a/providers/general/device/src/main/java/org/onosproject/provider/general/device/impl/GeneralDeviceProvider.java b/providers/general/device/src/main/java/org/onosproject/provider/general/device/impl/GeneralDeviceProvider.java
index 78ab98a..f684d31 100644
--- a/providers/general/device/src/main/java/org/onosproject/provider/general/device/impl/GeneralDeviceProvider.java
+++ b/providers/general/device/src/main/java/org/onosproject/provider/general/device/impl/GeneralDeviceProvider.java
@@ -204,7 +204,7 @@
public void activate(ComponentContext context) {
mainExecutor = newFixedThreadPool(CORE_POOL_SIZE, groupedThreads(
"onos/gdp", "%d", log));
- taskExecutor = new DeviceTaskExecutor<>(mainExecutor);
+ taskExecutor = new DeviceTaskExecutor<>(mainExecutor, GDP_ALLOWLIST);
providerService = providerRegistry.register(this);
componentConfigService.registerProperties(getClass());
coreService.registerApplication(APP_NAME);
@@ -587,6 +587,9 @@
NOT_MASTER,
}
+ private static final Set<TaskType> GDP_ALLOWLIST = Sets.newHashSet(TaskType.ROLE_MASTER, TaskType.ROLE_NONE,
+ TaskType.ROLE_STANDBY, TaskType.NOT_MASTER);
+
private void submitTask(DeviceId deviceId, TaskType taskType) {
taskExecutor.submit(deviceId, taskType, taskRunnable(deviceId, taskType));
}