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/datastore/topology/KVDevice.java b/src/main/java/net/onrc/onos/datastore/topology/KVDevice.java
index e076c14..805be62 100644
--- a/src/main/java/net/onrc/onos/datastore/topology/KVDevice.java
+++ b/src/main/java/net/onrc/onos/datastore/topology/KVDevice.java
@@ -55,6 +55,10 @@
private final byte[] mac;
private TreeSet<byte[]> portIds;
private transient boolean isPortIdsModified;
+
+ // Assume there is only one ip on a device now.
+ private int ip;
+ private long lastSeenTime;
// Assuming mac is unique cluster-wide
public static byte[] getDeviceID(final byte[] mac) {
@@ -199,4 +203,20 @@
return "[" + this.getClass().getSimpleName()
+ " " + ByteArrayUtil.toHexStringBuffer(mac, ":") + "]";
}
+
+ public int getIp() {
+ return ip;
+ }
+
+ public void setIp(int ip) {
+ this.ip = ip;
+ }
+
+ public long getLastSeenTime() {
+ return lastSeenTime;
+ }
+
+ public void setLastSeenTime(long lastSeenTime) {
+ this.lastSeenTime = lastSeenTime;
+ }
}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/devicemanager/IOnosDeviceListener.java b/src/main/java/net/onrc/onos/ofcontroller/devicemanager/IOnosDeviceListener.java
new file mode 100644
index 0000000..da50d83
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/devicemanager/IOnosDeviceListener.java
@@ -0,0 +1,7 @@
+package net.onrc.onos.ofcontroller.devicemanager;
+
+public interface IOnosDeviceListener {
+
+ public void onosDeviceAdded(OnosDevice device);
+ public void onosDeviceRemoved(OnosDevice device);
+}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/devicemanager/IOnosDeviceService.java b/src/main/java/net/onrc/onos/ofcontroller/devicemanager/IOnosDeviceService.java
index 9125985..e860de7 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/devicemanager/IOnosDeviceService.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/devicemanager/IOnosDeviceService.java
@@ -1,6 +1,7 @@
package net.onrc.onos.ofcontroller.devicemanager;
import net.floodlightcontroller.core.module.IFloodlightService;
+import net.floodlightcontroller.util.MACAddress;
/**
* {@link OnosDeviceManager} doesn't yet provide any API to fellow modules,
@@ -11,8 +12,13 @@
*/
public interface IOnosDeviceService extends IFloodlightService {
+ public void addOnosDeviceListener(IOnosDeviceListener listener);
+
+ public void deleteOnosDeviceListener(IOnosDeviceListener listener);
+
public void deleteOnosDevice(OnosDevice dev);
+ public void deleteOnosDeviceByMac(MACAddress mac);
+
public void addOnosDevice(Long mac, OnosDevice dev);
-
}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/devicemanager/OnosDeviceManager.java b/src/main/java/net/onrc/onos/ofcontroller/devicemanager/OnosDeviceManager.java
index bb2e387..d6dffac 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/devicemanager/OnosDeviceManager.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/devicemanager/OnosDeviceManager.java
@@ -9,6 +9,7 @@
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
@@ -29,6 +30,8 @@
import net.onrc.onos.packet.Ethernet;
import net.onrc.onos.packet.IPv4;
import net.onrc.onos.packet.UDP;
+import net.onrc.onos.ofcontroller.networkgraph.INetworkGraphService;
+import net.onrc.onos.ofcontroller.networkgraph.NetworkGraph;
import org.openflow.protocol.OFMessage;
import org.openflow.protocol.OFPacketIn;
@@ -42,11 +45,14 @@
private static final int CLEANUP_SECOND = 60*60;
private static final int AGEING_MILLSEC = 60*60*1000;
+ private CopyOnWriteArrayList<IOnosDeviceListener> deviceListeners;
private IFloodlightProviderService floodlightProvider;
private final static ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor();
private IDatagridService datagrid;
private Map<Long, OnosDevice> mapDevice = new ConcurrentHashMap<Long, OnosDevice>();
+ private INetworkGraphService networkGraphService;
+ private NetworkGraph networkGraph;
public enum OnosDeviceUpdateType {
ADD, DELETE, UPDATE;
@@ -63,14 +69,15 @@
@Override
public void dispatch() {
- // TODO: Fix the code below after deviceStorage was removed
- /*
if(type == OnosDeviceUpdateType.ADD) {
- deviceStorage.addOnosDevice(device);
+ for(IOnosDeviceListener listener: deviceListeners) {
+ listener.onosDeviceAdded(device);
+ }
} else if (type == OnosDeviceUpdateType.DELETE){
- deviceStorage.deleteOnosDevice(device);
+ for(IOnosDeviceListener listener: deviceListeners) {
+ listener.onosDeviceRemoved(device);
+ }
}
- */
}
}
@@ -132,37 +139,28 @@
return Command.CONTINUE;
} else if (srcDevice.getIpv4Address() == null &&
exDev.getSwitchDPID().equals(srcDevice.getSwitchDPID()) &&
- exDev.getSwitchPort() == srcDevice.getSwitchPort() &&
- exDev.getVlan().equals(srcDevice.getVlan())) {
- //Device attachment point and mac address are the same
- //but the packet does not have an ip address.
- exDev.setLastSeenTimestamp(new Date());
- if(log.isTraceEnabled()) {
- log.debug("In the datagrid, there is the same device with no ip."
- + "Keep ip and update last seen time. dpid {}, port {}, mac {}, ip {}, lastSeenTime {}",
- dpid, portId, srcDevice.getMacAddress(), srcDevice.getIpv4Address(), srcDevice.getLastSeenTimestamp().getTime());
- }
- return Command.CONTINUE;
+ exDev.getSwitchPort() == srcDevice.getSwitchPort()) {
+ //Vlan should be handled based on the Onos spec. Until then, don't handle it.
+ //Device attachment point and mac address are the same
+ //but the packet does not have an ip address.
+ exDev.setLastSeenTimestamp(new Date());
+ if(log.isTraceEnabled()) {
+ log.debug("In the datagrid, there is the same device with no ip."
+ + "Keep ip and update last seen time. dpid {}, port {}, mac {}, ip {} lastSeenTime {}",
+ dpid, portId, srcDevice.getMacAddress(), exDev.getIpv4Address(), srcDevice.getLastSeenTimestamp().getTime());
+ }
+ return Command.CONTINUE;
+ }
}
- }
//If the switch port we try to attach a new device already has a link, then stop adding device
- // TODO: Fix/update this after we refactor the Device Discovery mechanism
- /*
- Collection<TopologyElement> list = datagrid.getAllTopologyElements();
- for(TopologyElement elem: list) {
- if(elem.getType() == Type.ELEMENT_LINK) {
- if((elem.getFromPort() == portId && elem.getFromSwitch() == dpid) ||
- (elem.getToPort() == portId && elem.getToSwitch() == dpid)) {
- if(log.isTraceEnabled()) {
- log.debug("Stop adding OnosDevice {} due to there is a link to: dpid {} port {}",
- srcDevice.getMacAddress(), dpid, portId);
- }
- return Command.CONTINUE;
- }
- }
+ if(networkGraph.getLink(dpid, (long)portId) != null) {
+ if(log.isTraceEnabled()) {
+ log.debug("Stop adding OnosDevice {} due to there is a link to: dpid {} port {}",
+ srcDevice.getMacAddress(), dpid, portId);
+ }
+ return Command.CONTINUE;
}
- */
addOnosDevice(mac, srcDevice);
@@ -279,6 +277,8 @@
List<Class<? extends IFloodlightService>> dependencies =
new ArrayList<Class<? extends IFloodlightService>>();
dependencies.add(IFloodlightProviderService.class);
+ dependencies.add(INetworkGraphService.class);
+ dependencies.add(IDatagridService.class);
return dependencies;
}
@@ -288,7 +288,10 @@
floodlightProvider = context.getServiceImpl(IFloodlightProviderService.class);
executor.scheduleAtFixedRate(new CleanDevice(), 30 ,CLEANUP_SECOND, TimeUnit.SECONDS);
+ deviceListeners = new CopyOnWriteArrayList<IOnosDeviceListener>();
datagrid = context.getServiceImpl(IDatagridService.class);
+ networkGraphService = context.getServiceImpl(INetworkGraphService.class);
+ networkGraph = networkGraphService.getNetworkGraph();
}
@Override
@@ -297,12 +300,18 @@
datagrid.registerMapDeviceEventHandler(new MapDevListener());
}
- @Override
+ @Override
public void deleteOnosDevice(OnosDevice dev) {
datagrid.sendNotificationDeviceDeleted(dev);
floodlightProvider.publishUpdate(new OnosDeviceUpdate(dev, OnosDeviceUpdateType.DELETE));
}
-
+
+ @Override
+ public void deleteOnosDeviceByMac(MACAddress mac) {
+ OnosDevice deleteDevice = mapDevice.get(mac);
+ deleteOnosDevice(deleteDevice);
+ }
+
@Override
public void addOnosDevice(Long mac, OnosDevice dev) {
datagrid.sendNotificationDeviceAdded(mac, dev);
@@ -330,4 +339,14 @@
log.debug("updateDeviceMap: device mac {}", mac);
}
}
+
+ @Override
+ public void addOnosDeviceListener(IOnosDeviceListener listener) {
+ deviceListeners.add(listener);
+ }
+
+ @Override
+ public void deleteOnosDeviceListener(IOnosDeviceListener listener) {
+ deviceListeners.remove(listener);
+ }
}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/floodlightlistener/NetworkGraphPublisher.java b/src/main/java/net/onrc/onos/ofcontroller/floodlightlistener/NetworkGraphPublisher.java
index fba97f5..88d9475 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/floodlightlistener/NetworkGraphPublisher.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/floodlightlistener/NetworkGraphPublisher.java
@@ -1,5 +1,6 @@
package net.onrc.onos.ofcontroller.floodlightlistener;
+import java.net.InetAddress;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
@@ -16,8 +17,12 @@
import net.floodlightcontroller.threadpool.IThreadPoolService;
import net.onrc.onos.datagrid.IDatagridService;
import net.onrc.onos.ofcontroller.core.IOFSwitchPortListener;
+import net.onrc.onos.ofcontroller.devicemanager.IOnosDeviceListener;
+import net.onrc.onos.ofcontroller.devicemanager.IOnosDeviceService;
+import net.onrc.onos.ofcontroller.devicemanager.OnosDevice;
import net.onrc.onos.ofcontroller.linkdiscovery.ILinkDiscoveryListener;
import net.onrc.onos.ofcontroller.linkdiscovery.ILinkDiscoveryService;
+import net.onrc.onos.ofcontroller.networkgraph.DeviceEvent;
import net.onrc.onos.ofcontroller.networkgraph.INetworkGraphService;
import net.onrc.onos.ofcontroller.networkgraph.LinkEvent;
import net.onrc.onos.ofcontroller.networkgraph.NetworkGraph;
@@ -25,6 +30,7 @@
import net.onrc.onos.ofcontroller.networkgraph.PortEvent;
import net.onrc.onos.ofcontroller.networkgraph.Switch;
import net.onrc.onos.ofcontroller.networkgraph.SwitchEvent;
+import net.onrc.onos.ofcontroller.networkgraph.PortEvent.SwitchPort;
import net.onrc.onos.registry.controller.IControllerRegistryService;
import net.onrc.onos.registry.controller.IControllerRegistryService.ControlChangeCallback;
import net.onrc.onos.registry.controller.RegistryException;
@@ -34,6 +40,8 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import com.google.common.net.InetAddresses;
+
/*
* I've created a copy of the old NetworkGraphPublisher so I can integrate
* the new API with ONOS while still having the old NetworkGraphPublisher
@@ -47,7 +55,8 @@
public class NetworkGraphPublisher implements /*IOFSwitchListener,*/
IOFSwitchPortListener,
ILinkDiscoveryListener,
- IFloodlightModule {
+ IFloodlightModule,
+ IOnosDeviceListener {
private static final Logger log = LoggerFactory.getLogger(NetworkGraphPublisher.class);
private IFloodlightProviderService floodlightProvider;
@@ -56,6 +65,8 @@
private IDatagridService datagridService;
private INetworkGraphService networkGraphService;
+ private IOnosDeviceService onosDeviceService;
+
private NetworkGraph networkGraph;
private NetworkGraphDiscoveryInterface networkGraphDiscoveryInterface;
@@ -311,6 +322,7 @@
linkDiscovery = context.getServiceImpl(ILinkDiscoveryService.class);
registryService = context.getServiceImpl(IControllerRegistryService.class);
datagridService = context.getServiceImpl(IDatagridService.class);
+ onosDeviceService = context.getServiceImpl(IOnosDeviceService.class);
networkGraphService = context.getServiceImpl(INetworkGraphService.class);
}
@@ -320,6 +332,7 @@
// TODO enable cleanup thread
floodlightProvider.addOFSwitchListener(this);
linkDiscovery.addListener(this);
+ onosDeviceService.addOnosDeviceListener(this);
networkGraph = networkGraphService.getNetworkGraph();
networkGraphDiscoveryInterface =
@@ -343,4 +356,30 @@
cleanupTask.reschedule(0, TimeUnit.SECONDS);
}
}
+
+ @Override
+ public void onosDeviceAdded(OnosDevice device) {
+ log.debug("Called onosDeviceAdded mac {}", device.getMacAddress());
+
+ SwitchPort sp = new SwitchPort(device.getSwitchDPID(), (long)device.getSwitchPort());
+ List<SwitchPort> spLists = new ArrayList<SwitchPort>();
+ spLists.add(sp);
+ DeviceEvent event = new DeviceEvent(device.getMacAddress());
+ event.setAttachmentPoints(spLists);
+ event.setLastSeenTime(device.getLastSeenTimestamp().getTime());
+ if(device.getIpv4Address() != null) {
+ InetAddress ip = InetAddresses.fromInteger(device.getIpv4Address());
+ event.addIpAddress(ip);
+ }
+ //Does not use Vlan info now.
+
+ networkGraphDiscoveryInterface.putDeviceDiscoveryEvent(event);
+ }
+
+ @Override
+ public void onosDeviceRemoved(OnosDevice device) {
+ log.debug("Called onosDeviceRemoved");
+ DeviceEvent event = new DeviceEvent(device.getMacAddress());
+ networkGraphDiscoveryInterface.removeDeviceDiscoveryEvent(event);
+ }
}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/networkgraph/DeviceEvent.java b/src/main/java/net/onrc/onos/ofcontroller/networkgraph/DeviceEvent.java
index 8bea7f8..1846d8b 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/networkgraph/DeviceEvent.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/networkgraph/DeviceEvent.java
@@ -27,7 +27,7 @@
private final MACAddress mac;
protected List<SwitchPort> attachmentPoints;
protected Set<InetAddress> ipAddresses;
-
+ private long lastSeenTime;
/**
* Default constructor for Serializer to use.
@@ -68,11 +68,11 @@
}
- boolean addIpAddress(InetAddress addr) {
+ public boolean addIpAddress(InetAddress addr) {
return this.ipAddresses.add(addr);
}
- boolean removeIpAddress(InetAddress addr) {
+ public boolean removeIpAddress(InetAddress addr) {
return this.ipAddresses.remove(addr);
}
@@ -93,4 +93,12 @@
public ByteBuffer getIDasByteBuffer() {
return getDeviceID(mac.toBytes());
}
+
+ public long getLastSeenTime() {
+ return lastSeenTime;
+ }
+
+ public void setLastSeenTime(long lastSeenTime) {
+ this.lastSeenTime = lastSeenTime;
+ }
}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/networkgraph/DeviceImpl.java b/src/main/java/net/onrc/onos/ofcontroller/networkgraph/DeviceImpl.java
index 2b8930b..8f46f31 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/networkgraph/DeviceImpl.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/networkgraph/DeviceImpl.java
@@ -17,38 +17,42 @@
private final MACAddress macAddr;
protected LinkedList<Port> attachmentPoints;
protected Set<InetAddress> ipAddresses;
+ private long lastSeenTime;
public DeviceImpl(NetworkGraph graph, MACAddress mac) {
- super(graph);
- this.macAddr = mac;
- this.attachmentPoints = new LinkedList<>();
- this.ipAddresses = new HashSet<>();
+ super(graph);
+ this.macAddr = mac;
+ this.attachmentPoints = new LinkedList<>();
+ this.ipAddresses = new HashSet<>();
}
@Override
public MACAddress getMacAddress() {
- return this.macAddr;
+ return this.macAddr;
}
@Override
public Collection<InetAddress> getIpAddress() {
- return Collections.unmodifiableSet(ipAddresses);
+ return Collections.unmodifiableSet(ipAddresses);
}
@Override
public Iterable<Port> getAttachmentPoints() {
- return Collections.unmodifiableList(this.attachmentPoints);
+ return Collections.unmodifiableList(this.attachmentPoints);
}
@Override
public long getLastSeenTime() {
- // TODO Auto-generated method stub
- return 0;
+ return lastSeenTime;
}
@Override
public String toString() {
- return macAddr.toString();
+ return macAddr.toString();
+ }
+
+ void setLastSeenTime(long lastSeenTime) {
+ this.lastSeenTime = lastSeenTime;
}
/**
@@ -56,8 +60,8 @@
* @param p
*/
void addAttachmentPoint(Port p) {
- this.attachmentPoints.remove(p);
- this.attachmentPoints.addFirst(p);
+ this.attachmentPoints.remove(p);
+ this.attachmentPoints.addFirst(p);
}
/**
@@ -65,7 +69,7 @@
* @param p
*/
boolean removeAttachmentPoint(Port p) {
- return this.attachmentPoints.remove(p);
+ return this.attachmentPoints.remove(p);
}
/**
@@ -73,7 +77,7 @@
* @param p
*/
boolean addIpAddress(InetAddress addr) {
- return this.ipAddresses.add(addr);
+ return this.ipAddresses.add(addr);
}
/**
@@ -81,6 +85,6 @@
* @param p
*/
boolean removeIpAddress(InetAddress addr) {
- return this.ipAddresses.remove(addr);
+ return this.ipAddresses.remove(addr);
}
}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/networkgraph/NetworkGraphDatastore.java b/src/main/java/net/onrc/onos/ofcontroller/networkgraph/NetworkGraphDatastore.java
index 30b2f73..63f37d8 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/networkgraph/NetworkGraphDatastore.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/networkgraph/NetworkGraphDatastore.java
@@ -1,21 +1,27 @@
package net.onrc.onos.ofcontroller.networkgraph;
+import java.net.Inet4Address;
+import java.net.InetAddress;
import java.util.ArrayList;
import java.util.List;
import java.util.Collection;
import net.onrc.onos.datastore.DataStoreClient;
import net.onrc.onos.datastore.IKVClient;
+import net.onrc.onos.datastore.topology.KVDevice;
import net.onrc.onos.datastore.topology.KVLink;
import net.onrc.onos.datastore.topology.KVPort;
import net.onrc.onos.datastore.topology.KVPort.STATUS;
import net.onrc.onos.datastore.topology.KVSwitch;
import net.onrc.onos.datastore.utils.KVObject;
import net.onrc.onos.datastore.utils.KVObject.WriteOp;
+import net.onrc.onos.ofcontroller.networkgraph.PortEvent.SwitchPort;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import com.google.common.net.InetAddresses;
+
/**
* The southbound interface to the network graph which allows clients to
* mutate the graph. This class will maintain the invariants of the network
@@ -186,8 +192,24 @@
* @return true on success, otherwise false.
*/
public boolean addDevice(DeviceEvent device) {
- // TODO implement
- return false; // Failure: not implemented yet
+ log.debug("Adding device into DB. mac {}", device.getMac());
+
+ KVDevice rcDevice = new KVDevice(device.getMac().toBytes());
+ rcDevice.setLastSeenTime(device.getLastSeenTime());
+
+ for(SwitchPort sp : device.getAttachmentPoints()) {
+ byte[] portId = KVPort.getPortID(sp.getDpid(), sp.getNumber());
+ rcDevice.addPortId(portId);
+ }
+
+ for(InetAddress addr : device.getIpAddresses()) {
+ //It assume only one ip on a device now.
+ rcDevice.setIp(InetAddresses.coerceToInteger(addr));
+ }
+
+ rcDevice.forceCreate();
+
+ return true;
}
/**
@@ -197,7 +219,11 @@
* @return true on success, otherwise false.
*/
public boolean removeDevice(DeviceEvent device) {
- // TODO implement
- return false; // Failure: not implemented yet
+ log.debug("Removing device into DB. mac {}", device.getMac());
+
+ KVDevice rcDevice = new KVDevice(device.getMac().toBytes());
+ rcDevice.forceDelete();
+
+ return true;
}
}
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);
}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/util/serializers/KryoFactory.java b/src/main/java/net/onrc/onos/ofcontroller/util/serializers/KryoFactory.java
index 9eb4e10..42a3a4d 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/util/serializers/KryoFactory.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/util/serializers/KryoFactory.java
@@ -1,8 +1,9 @@
package net.onrc.onos.ofcontroller.util.serializers;
+import java.net.Inet4Address;
import java.net.InetAddress;
import java.util.ArrayList;
-
+import java.util.HashSet;
import net.floodlightcontroller.util.MACAddress;
import net.onrc.onos.intent.ConstrainedShortestPathIntent;
import net.onrc.onos.intent.ErrorIntent;
@@ -44,6 +45,8 @@
// import net.onrc.onos.ofcontroller.util.SwitchPort;
+
+
import com.esotericsoftware.kryo.Kryo;
/**
@@ -202,6 +205,10 @@
kryo.register(IntentOperationList.class);
kryo.register(IntentStateList.class);
+ // Device-related classes
+ kryo.register(HashSet.class);
+ kryo.register(Inet4Address.class);
+
return kryo;
}
}