[Emu] new ResourceService related bug fixes
- ResourceDeviceListener should also react to availability events.
- Should check if device supports the behavior before
retrieving Behaviour class
- ResourceManager should unregister when requested
- opticalUtils was specifying wrong driver name. Should've been "linc-oe"
Change-Id: I9364b6307cb537b04b57ac00f2451c13e3379471
diff --git a/core/net/src/main/java/org/onosproject/net/driver/impl/DriverManager.java b/core/net/src/main/java/org/onosproject/net/driver/impl/DriverManager.java
index 53bf30a..c793ca4 100644
--- a/core/net/src/main/java/org/onosproject/net/driver/impl/DriverManager.java
+++ b/core/net/src/main/java/org/onosproject/net/driver/impl/DriverManager.java
@@ -24,6 +24,7 @@
import org.apache.felix.scr.annotations.Reference;
import org.apache.felix.scr.annotations.ReferenceCardinality;
import org.apache.felix.scr.annotations.Service;
+import org.onlab.util.ItemNotFoundException;
import org.onosproject.net.Device;
import org.onosproject.net.DeviceId;
import org.onosproject.net.device.DeviceService;
@@ -166,8 +167,13 @@
Device device = nullIsNotFound(deviceService.getDevice(deviceId), NO_DEVICE);
String driverName = device.annotations().value(DRIVER);
if (driverName != null) {
- return getDriver(driverName);
+ try {
+ return getDriver(driverName);
+ } catch (ItemNotFoundException e) {
+ log.warn("Specified driver {} not found, falling back.", driverName);
+ }
}
+
return nullIsNotFound(getDriver(device.manufacturer(),
device.hwVersion(), device.swVersion()),
NO_DRIVER);