Fixing discovery of initial description of REST device
Change-Id: If9dd180b6af22406e251660562fef7666bcb3ea2
diff --git a/providers/rest/device/src/main/java/org/onosproject/provider/rest/device/impl/RestDeviceProvider.java b/providers/rest/device/src/main/java/org/onosproject/provider/rest/device/impl/RestDeviceProvider.java
index f289dc9..ad5d228 100644
--- a/providers/rest/device/src/main/java/org/onosproject/provider/rest/device/impl/RestDeviceProvider.java
+++ b/providers/rest/device/src/main/java/org/onosproject/provider/rest/device/impl/RestDeviceProvider.java
@@ -268,11 +268,11 @@
private DeviceDescription getDesc(RestSBDevice restSBDev) {
DeviceId deviceId = restSBDev.deviceId();
- if (restSBDev.isProxy()) {
- Driver driver = driverService.getDriver(restSBDev.manufacturer().get(),
- restSBDev.hwVersion().get(),
- restSBDev.swVersion().get());
+ Driver driver = driverService.getDriver(restSBDev.manufacturer().get(),
+ restSBDev.hwVersion().get(),
+ restSBDev.swVersion().get());
+ if (restSBDev.isProxy()) {
if (driver != null && driver.hasBehaviour(DevicesDiscovery.class)) {
//Creates the driver to communicate with the server
@@ -283,6 +283,10 @@
log.warn("Driver not found for {}", restSBDev);
return null;
}
+ } else if (driver != null && driver.hasBehaviour(DeviceDescriptionDiscovery.class)) {
+ DriverHandler h = driverService.createHandler(deviceId);
+ DeviceDescriptionDiscovery deviceDiscovery = h.behaviour(DeviceDescriptionDiscovery.class);
+ return deviceDiscovery.discoverDeviceDetails();
}
ChassisId cid = new ChassisId();
String ipAddress = restSBDev.ip().toString();