Skip to content
Snippets Groups Projects
Commit 2c5ad166 authored by Srinivasan Ramasubramanian's avatar Srinivasan Ramasubramanian
Browse files

Ignore entities whose last seen times are earlier than topology changed time.

parent 556f1624
No related branches found
No related tags found
No related merge requests found
......@@ -260,6 +260,8 @@ public class Device implements IDevice {
Integer port = cur.getSwitchPort();
if (dpid == null || port == null ||
!deviceManager.isValidAttachmentPoint(dpid, port) ||
cur.getLastSeenTimestamp().
before(topology.getLastUpdateTime()) ||
(prev != null &&
topology.isConsistent(prev.getSwitchDPID().longValue(),
prev.getSwitchPort().shortValue(),
......
package net.floodlightcontroller.topology;
import java.util.Date;
import java.util.Set;
import net.floodlightcontroller.core.module.IFloodlightService;
......@@ -9,6 +10,8 @@ public interface ITopologyService extends IFloodlightService {
public void addListener(ITopologyListener listener);
public Date getLastUpdateTime();
/**
* Query to determine if devices must be learned on a given switch port.
*/
......
......@@ -3,6 +3,7 @@ package net.floodlightcontroller.topology;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
......@@ -94,6 +95,8 @@ public class TopologyManager implements
protected TopologyInstance currentInstanceWithoutTunnels;
protected SingletonTask newInstanceTask;
private Date lastUpdateTime;
/**
* Thread for recomputing topology. The thread is always running,
* however the function applyUpdates() has a blocking call.
......@@ -104,6 +107,7 @@ public class TopologyManager implements
try {
applyUpdates();
createNewInstance();
lastUpdateTime = new Date();
informListeners();
}
catch (Exception e) {
......@@ -141,6 +145,10 @@ public class TopologyManager implements
//
// ITopologyService interface methods
//
@Override
public Date getLastUpdateTime() {
return lastUpdateTime;
}
@Override
public void addListener(ITopologyListener listener) {
......@@ -593,6 +601,8 @@ public class TopologyManager implements
topologyAware = new ArrayList<ITopologyListener>();
ldUpdates = new LinkedBlockingQueue<LDUpdate>();
appliedUpdates = new HashSet<LDUpdate>();
lastUpdateTime = new Date();
}
@Override
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment