Change for device discovery on new-data model.
RcDevice is not implemented completely.
It is temporary implementation until all device archtecture is decicded.
Change-Id: Iea73bddbf859b869312d2590e0f31a18bd31aaf5
diff --git a/src/main/java/net/onrc/onos/ofcontroller/networkgraph/TopologyManager.java b/src/main/java/net/onrc/onos/ofcontroller/networkgraph/TopologyManager.java
index a323726..ccd3601 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/networkgraph/TopologyManager.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/networkgraph/TopologyManager.java
@@ -493,7 +493,7 @@
// Send out notification
TopologyEvent topologyEvent = new TopologyEvent(switchEvent);
eventChannel.addEntry(topologyEvent.getID(), topologyEvent);
-
+
// Send out notification for each port
for (PortEvent portEvent : portEvents) {
topologyEvent = new TopologyEvent(portEvent);
@@ -719,7 +719,8 @@
// Send out notification
TopologyEvent topologyEvent = new TopologyEvent(deviceEvent);
eventChannel.addEntry(topologyEvent.getID(), topologyEvent);
-
+ log.debug("Put the device info into the cache of the graph. mac {}", deviceEvent.getMac());
+
// Store the new Device Event in the local cache
// TODO: The implementation below is probably wrong
for (SwitchPort swp : deviceEvent.getAttachmentPoints()) {
@@ -746,6 +747,7 @@
if (datastore.removeDevice(deviceEvent)) {
// Send out notification
eventChannel.removeEntry(deviceEvent.getID());
+ log.debug("Remove the device info into the cache of the graph. mac {}", deviceEvent.getMac());
// Cleanup the Device Event from the local cache
// TODO: The implementation below is probably wrong
@@ -998,9 +1000,12 @@
*/
private void addDevice(DeviceEvent deviceEvent) {
Device device = networkGraph.getDeviceByMac(deviceEvent.getMac());
+
if (device == null) {
+ log.debug("Existing device was not found in networkGraph. New device. mac {}", deviceEvent.getMac());
device = new DeviceImpl(networkGraph, deviceEvent.getMac());
}
+
DeviceImpl deviceImpl = getDeviceImpl(device);
// Update the IP addresses
@@ -1036,6 +1041,7 @@
// Update the device in the Network Graph
if (attachmentFound) {
+ log.debug("Storing the info into networkGraph. mac {}", deviceEvent.getMac());
networkGraph.putDevice(device);
apiAddedDeviceEvents.add(deviceEvent);
}