Fixing a potential start-up issue in PacketManager if device driver cannot be found.
Change-Id: Id76ed27b00c59d4d1d4afc13b999ec306c7056ce
diff --git a/core/net/src/main/java/org/onosproject/net/packet/impl/PacketManager.java b/core/net/src/main/java/org/onosproject/net/packet/impl/PacketManager.java
index ff63efe..98d1b41 100644
--- a/core/net/src/main/java/org/onosproject/net/packet/impl/PacketManager.java
+++ b/core/net/src/main/java/org/onosproject/net/packet/impl/PacketManager.java
@@ -17,6 +17,7 @@
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
+import org.onlab.util.ItemNotFoundException;
import org.onosproject.cluster.ClusterService;
import org.onosproject.cluster.NodeId;
import org.onosproject.core.ApplicationId;
@@ -135,7 +136,7 @@
if (device != null) {
pushRule(device, request);
} else {
- log.info("Device is not ready yet. Skip processing packet requests {}", request);
+ log.info("Device is not ready yet; not processing packet request {}", request);
}
} else {
pushToAllDevices(request);
@@ -279,10 +280,15 @@
private void pushToAllDevices(PacketRequest request) {
log.debug("Pushing packet request {} to all devices", request);
for (Device device : deviceService.getDevices()) {
- Driver driver = driverService.getDriver(device.id());
- if (driver != null &&
- Boolean.parseBoolean(driver.getProperty(SUPPORT_PACKET_REQUEST_PROPERTY))) {
- pushRule(device, request);
+ try {
+ Driver driver = driverService.getDriver(device.id());
+ if (driver != null &&
+ Boolean.parseBoolean(driver.getProperty(SUPPORT_PACKET_REQUEST_PROPERTY))) {
+ pushRule(device, request);
+ }
+ } catch (ItemNotFoundException e) {
+ log.warn("Device driver not found for {}; not processing packet request {}",
+ device.id(), request);
}
}
}