Change NetworkGraph.getDeviceByMac() to return a single device object
Change-Id: I1bd34d2338cbd8adfdf737ff3de044d963dfaaec
diff --git a/src/main/java/net/onrc/onos/ofcontroller/networkgraph/AbstractNetworkGraph.java b/src/main/java/net/onrc/onos/ofcontroller/networkgraph/AbstractNetworkGraph.java
index 71ef16e..5c498b6 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/networkgraph/AbstractNetworkGraph.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/networkgraph/AbstractNetworkGraph.java
@@ -22,7 +22,7 @@
protected ConcurrentMap<Long, Switch> switches;
protected ConcurrentMap<InetAddress, Set<Device>> addr2Device;
- protected ConcurrentMap<MACAddress, Set<Device>> mac2Device;
+ protected ConcurrentMap<MACAddress, Device> mac2Device;
public AbstractNetworkGraph() {
// TODO: Does these object need to be stored in Concurrent Collection?
@@ -103,11 +103,7 @@
}
@Override
- public Iterable<Device> getDeviceByMac(MACAddress address) {
- Set<Device> devices = mac2Device.get(address);
- if (devices == null) {
- return Collections.emptyList();
- }
- return Collections.unmodifiableCollection(devices);
+ public Device getDeviceByMac(MACAddress address) {
+ return mac2Device.get(address);
}
}