[ONOS-2159]Add to query devices by type api in DeviceService and
DeviceStore interfaces Change-Id: Ifa7e94e08eb150fb4d71248a50a390832d1549df
Showing
3 changed files
with
28 additions
and
0 deletions
| ... | @@ -44,6 +44,15 @@ public interface DeviceService { | ... | @@ -44,6 +44,15 @@ public interface DeviceService { |
| 44 | Iterable<Device> getDevices(); | 44 | Iterable<Device> getDevices(); |
| 45 | 45 | ||
| 46 | /** | 46 | /** |
| 47 | + * Returns a collection of the currently known infrastructure | ||
| 48 | + * devices by device type. | ||
| 49 | + * | ||
| 50 | + * @param type device type | ||
| 51 | + * @return collection of devices | ||
| 52 | + */ | ||
| 53 | + Iterable<Device> getDevices(Device.Type type); | ||
| 54 | + | ||
| 55 | + /** | ||
| 47 | * Returns an iterable collection of all devices | 56 | * Returns an iterable collection of all devices |
| 48 | * currently available to the system. | 57 | * currently available to the system. |
| 49 | * | 58 | * |
| ... | @@ -52,6 +61,14 @@ public interface DeviceService { | ... | @@ -52,6 +61,14 @@ public interface DeviceService { |
| 52 | Iterable<Device> getAvailableDevices(); | 61 | Iterable<Device> getAvailableDevices(); |
| 53 | 62 | ||
| 54 | /** | 63 | /** |
| 64 | + * Returns an iterable collection of all devices currently available to the system by device type. | ||
| 65 | + * | ||
| 66 | + * @param type device type | ||
| 67 | + * @return device collection | ||
| 68 | + */ | ||
| 69 | + Iterable<Device> getAvailableDevices(Device.Type type); | ||
| 70 | + | ||
| 71 | + /** | ||
| 55 | * Returns the device with the specified identifier. | 72 | * Returns the device with the specified identifier. |
| 56 | * | 73 | * |
| 57 | * @param deviceId device identifier | 74 | * @param deviceId device identifier | ... | ... |
| ... | @@ -19,6 +19,7 @@ import com.google.common.base.Predicate; | ... | @@ -19,6 +19,7 @@ import com.google.common.base.Predicate; |
| 19 | import com.google.common.collect.FluentIterable; | 19 | import com.google.common.collect.FluentIterable; |
| 20 | 20 | ||
| 21 | import org.onosproject.net.Device; | 21 | import org.onosproject.net.Device; |
| 22 | +import org.onosproject.net.Device.Type; | ||
| 22 | import org.onosproject.net.DeviceId; | 23 | import org.onosproject.net.DeviceId; |
| 23 | import org.onosproject.net.MastershipRole; | 24 | import org.onosproject.net.MastershipRole; |
| 24 | import org.onosproject.net.Port; | 25 | import org.onosproject.net.Port; |
| ... | @@ -91,4 +92,14 @@ public class DeviceServiceAdapter implements DeviceService { | ... | @@ -91,4 +92,14 @@ public class DeviceServiceAdapter implements DeviceService { |
| 91 | public void removeListener(DeviceListener listener) { | 92 | public void removeListener(DeviceListener listener) { |
| 92 | } | 93 | } |
| 93 | 94 | ||
| 95 | + @Override | ||
| 96 | + public Iterable<Device> getDevices(Type type) { | ||
| 97 | + return Collections.emptyList(); | ||
| 98 | + } | ||
| 99 | + | ||
| 100 | + @Override | ||
| 101 | + public Iterable<Device> getAvailableDevices(Type type) { | ||
| 102 | + return Collections.emptyList(); | ||
| 103 | + } | ||
| 104 | + | ||
| 94 | } | 105 | } | ... | ... |
This diff is collapsed. Click to expand it.
-
Please register or login to post a comment