Moving LLDP provider configuration processing off the event thread.
Change-Id: Ief44d354081107c037870d9a7ede60e8a6447113
diff --git a/providers/lldp/src/main/java/org/onosproject/provider/lldp/impl/LldpLinkProvider.java b/providers/lldp/src/main/java/org/onosproject/provider/lldp/impl/LldpLinkProvider.java
index 2bdaeab..7f67d8f 100644
--- a/providers/lldp/src/main/java/org/onosproject/provider/lldp/impl/LldpLinkProvider.java
+++ b/providers/lldp/src/main/java/org/onosproject/provider/lldp/impl/LldpLinkProvider.java
@@ -784,44 +784,46 @@
@Override
public void event(NetworkConfigEvent event) {
- if (event.configClass() == LinkDiscoveryFromDevice.class &&
- CONFIG_CHANGED.contains(event.type())) {
+ executor.submit(() -> {
+ if (event.configClass() == LinkDiscoveryFromDevice.class &&
+ CONFIG_CHANGED.contains(event.type())) {
- if (event.subject() instanceof DeviceId) {
- final DeviceId did = (DeviceId) event.subject();
- Device device = deviceService.getDevice(did);
- updateDevice(device).ifPresent(ld -> updatePorts(ld, did));
- }
-
- } else if (event.configClass() == LinkDiscoveryFromPort.class &&
- CONFIG_CHANGED.contains(event.type())) {
-
- if (event.subject() instanceof ConnectPoint) {
- ConnectPoint cp = (ConnectPoint) event.subject();
- if (cp.elementId() instanceof DeviceId) {
- final DeviceId did = (DeviceId) cp.elementId();
+ if (event.subject() instanceof DeviceId) {
+ final DeviceId did = (DeviceId) event.subject();
Device device = deviceService.getDevice(did);
- Port port = deviceService.getPort(did, cp.port());
- updateDevice(device).ifPresent(ld -> updatePort(ld, port));
+ updateDevice(device).ifPresent(ld -> updatePorts(ld, did));
}
+
+ } else if (event.configClass() == LinkDiscoveryFromPort.class &&
+ CONFIG_CHANGED.contains(event.type())) {
+
+ if (event.subject() instanceof ConnectPoint) {
+ ConnectPoint cp = (ConnectPoint) event.subject();
+ if (cp.elementId() instanceof DeviceId) {
+ final DeviceId did = (DeviceId) cp.elementId();
+ Device device = deviceService.getDevice(did);
+ Port port = deviceService.getPort(did, cp.port());
+ updateDevice(device).ifPresent(ld -> updatePort(ld, port));
+ }
+ }
+
+ } else if (event.configClass() == FingerprintProbeFromDevice.class &&
+ CONFIG_CHANGED.contains(event.type())) {
+
+ if (event.subject() instanceof DeviceId) {
+ final DeviceId did = (DeviceId) event.subject();
+ Device device = deviceService.getDevice(did);
+ updateDevice(device);
+ }
+
+ } else if (event.configClass().equals(SuppressionConfig.class) &&
+ (event.type() == NetworkConfigEvent.Type.CONFIG_ADDED ||
+ event.type() == NetworkConfigEvent.Type.CONFIG_UPDATED)) {
+ SuppressionConfig cfg = cfgRegistry.getConfig(appId, SuppressionConfig.class);
+ reconfigureSuppressionRules(cfg);
+ log.trace("Network config reconfigured");
}
-
- } else if (event.configClass() == FingerprintProbeFromDevice.class &&
- CONFIG_CHANGED.contains(event.type())) {
-
- if (event.subject() instanceof DeviceId) {
- final DeviceId did = (DeviceId) event.subject();
- Device device = deviceService.getDevice(did);
- updateDevice(device);
- }
-
- } else if (event.configClass().equals(SuppressionConfig.class) &&
- (event.type() == NetworkConfigEvent.Type.CONFIG_ADDED ||
- event.type() == NetworkConfigEvent.Type.CONFIG_UPDATED)) {
- SuppressionConfig cfg = cfgRegistry.getConfig(appId, SuppressionConfig.class);
- reconfigureSuppressionRules(cfg);
- log.trace("Network config reconfigured");
- }
+ });
}
}
}