[ONOS-2159]Add to query devices by type api in DeviceService and
DeviceStore interfaces
Change-Id: Ifa7e94e08eb150fb4d71248a50a390832d1549df
diff --git a/core/api/src/main/java/org/onosproject/net/device/DeviceService.java b/core/api/src/main/java/org/onosproject/net/device/DeviceService.java
index 5ce4d16..ab6dba5 100644
--- a/core/api/src/main/java/org/onosproject/net/device/DeviceService.java
+++ b/core/api/src/main/java/org/onosproject/net/device/DeviceService.java
@@ -44,6 +44,15 @@
Iterable<Device> getDevices();
/**
+ * Returns a collection of the currently known infrastructure
+ * devices by device type.
+ *
+ * @param type device type
+ * @return collection of devices
+ */
+ Iterable<Device> getDevices(Device.Type type);
+
+ /**
* Returns an iterable collection of all devices
* currently available to the system.
*
@@ -52,6 +61,14 @@
Iterable<Device> getAvailableDevices();
/**
+ * Returns an iterable collection of all devices currently available to the system by device type.
+ *
+ * @param type device type
+ * @return device collection
+ */
+ Iterable<Device> getAvailableDevices(Device.Type type);
+
+ /**
* Returns the device with the specified identifier.
*
* @param deviceId device identifier
diff --git a/core/api/src/test/java/org/onosproject/net/device/DeviceServiceAdapter.java b/core/api/src/test/java/org/onosproject/net/device/DeviceServiceAdapter.java
index 88c2f94..539fd5f 100644
--- a/core/api/src/test/java/org/onosproject/net/device/DeviceServiceAdapter.java
+++ b/core/api/src/test/java/org/onosproject/net/device/DeviceServiceAdapter.java
@@ -19,6 +19,7 @@
import com.google.common.collect.FluentIterable;
import org.onosproject.net.Device;
+import org.onosproject.net.Device.Type;
import org.onosproject.net.DeviceId;
import org.onosproject.net.MastershipRole;
import org.onosproject.net.Port;
@@ -91,4 +92,14 @@
public void removeListener(DeviceListener listener) {
}
+ @Override
+ public Iterable<Device> getDevices(Type type) {
+ return Collections.emptyList();
+ }
+
+ @Override
+ public Iterable<Device> getAvailableDevices(Type type) {
+ return Collections.emptyList();
+ }
+
}