Do GDP checkup for all devices in config and core
Tearing down connections for those devices removed from the config
Change-Id: I9a138054bfc61d55d470e7d89b50b42c07c4490b
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 f983ac6..a1d7fb8 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
@@ -17,6 +17,7 @@
package org.onosproject.provider.general.device.impl;
import com.google.common.collect.Maps;
+import com.google.common.collect.Sets;
import com.google.common.util.concurrent.Futures;
import org.onlab.packet.ChassisId;
import org.onlab.util.ItemNotFoundException;
@@ -80,6 +81,7 @@
import java.util.List;
import java.util.Map;
import java.util.Objects;
+import java.util.Set;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.ScheduledFuture;
@@ -519,9 +521,18 @@
private void submitCheckupTasksForAllDevices() {
// Async trigger a task for all devices in the cfg.
log.debug("Submitting checkup task for all devices...");
+ final Set<DeviceId> deviceToCheck = Sets.newHashSet();
+ // All devices in the core and in the config that we care about.
+ deviceService.getDevices().forEach(d -> {
+ if (myScheme(d.id())) {
+ deviceToCheck.add(d.id());
+ }
+ });
cfgService.getSubjects(DeviceId.class).stream()
.filter(GeneralDeviceProvider::myScheme)
- .forEach(d -> submitTask(d, TaskType.CHECKUP));
+ .filter(this::configIsPresent)
+ .forEach(deviceToCheck::add);
+ deviceToCheck.forEach(d -> submitTask(d, TaskType.CHECKUP));
}
/**