Provide a map between all devices and their driver names
- Introduce a new Java API in DriverService
- Implement a new CLI command device-drivers that dumps all devices and their driver names or a driver name of a device
- Include this CLI command as part of onos-diags
Change-Id: I978690e6af6c00dbfc09259b50449779b1167754
(cherry picked from commit dfaf4622e00256a8063ec4f12765381f7290a476)
diff --git a/core/api/src/main/java/org/onosproject/net/driver/DriverService.java b/core/api/src/main/java/org/onosproject/net/driver/DriverService.java
index e4432d1..2b7930b 100644
--- a/core/api/src/main/java/org/onosproject/net/driver/DriverService.java
+++ b/core/api/src/main/java/org/onosproject/net/driver/DriverService.java
@@ -17,6 +17,7 @@
import org.onosproject.net.DeviceId;
+import java.util.Map;
import java.util.Set;
/**
@@ -57,6 +58,13 @@
Driver getDriver(DeviceId deviceId);
/**
+ * Returns a map between all devices and their driver names.
+ *
+ * @return map of (device id, driver name)
+ */
+ Map<DeviceId, String> getDeviceDrivers();
+
+ /**
* Creates a new driver handler for interacting with the specified device.
* The driver is looked-up using the same semantics as
* {@link #getDriver(DeviceId)} method.
diff --git a/core/api/src/test/java/org/onosproject/net/driver/DriverServiceAdapter.java b/core/api/src/test/java/org/onosproject/net/driver/DriverServiceAdapter.java
index b2644db..776648d 100644
--- a/core/api/src/test/java/org/onosproject/net/driver/DriverServiceAdapter.java
+++ b/core/api/src/test/java/org/onosproject/net/driver/DriverServiceAdapter.java
@@ -15,6 +15,7 @@
*/
package org.onosproject.net.driver;
+import java.util.Map;
import java.util.Set;
import org.onosproject.net.DeviceId;
@@ -55,6 +56,11 @@
}
@Override
+ public Map<DeviceId, String> getDeviceDrivers() {
+ return null;
+ }
+
+ @Override
public void addListener(DriverListener listener) {
}