Added getDeviceCount and tests.
diff --git a/net/core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/SimpleDeviceStore.java b/net/core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/SimpleDeviceStore.java
index a49384b..dd63469 100644
--- a/net/core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/SimpleDeviceStore.java
+++ b/net/core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/SimpleDeviceStore.java
@@ -28,7 +28,8 @@
import static org.onlab.onos.net.device.DeviceEvent.Type.*;
/**
- * Manages inventory of infrastructure devices.
+ * Manages inventory of infrastructure devices using trivial in-memory
+ * implementation.
*/
class SimpleDeviceStore {
@@ -40,6 +41,15 @@
private final Map<DeviceId, Map<PortNumber, Port>> devicePorts = new HashMap<>();
/**
+ * Returns the number of devices known to the system.
+ *
+ * @return number of devices
+ */
+ public int getDeviceCount() {
+ return devices.size();
+ }
+
+ /**
* Returns an iterable collection of all devices known to the system.
*
* @return device collection
@@ -301,5 +311,4 @@
new DeviceEvent(DEVICE_REMOVED, device, null);
}
}
-
}