diff --git a/src/main/java/net/floodlightcontroller/devicemanager/internal/DeviceManagerImpl.java b/src/main/java/net/floodlightcontroller/devicemanager/internal/DeviceManagerImpl.java index a1ab0d05862634c9f86b4f628274c3de84698c63..884fe8392e5e3e4a8204a7fa2962e83028b5b9d9 100755 --- a/src/main/java/net/floodlightcontroller/devicemanager/internal/DeviceManagerImpl.java +++ b/src/main/java/net/floodlightcontroller/devicemanager/internal/DeviceManagerImpl.java @@ -643,6 +643,7 @@ public class DeviceManagerImpl implements IDeviceManagerService, IOFMessageListe protected static int DEVICE_NA_MAX_AGE = 60 * 60 * 2; protected static int DEVICE_AP_MAX_AGE = 60 * 60 * 2; protected static long BD_TO_NBD_TIMEDIFF_MS = 300000; // 5 minutes + protected static long BD_TO_BD_TIMEDIFF_MS = 5000; // 5 seconds // This the amount of time that we need for a device to move from // a non-broadcast domain port to a broadcast domain port. @@ -924,6 +925,25 @@ public class DeviceManagerImpl implements IDeviceManagerService, IOFMessageListe } return Command.STOP; } + } else if ( (topology.getSwitchClusterId(currSw) == topology.getSwitchClusterId(newSw)) && + (topology.isBroadcastDomainPort(currSw, currPort) == true) && + (topology.isBroadcastDomainPort(newSw, newPort) == true)) { + long dt = currentDate.getTime() - + oldDap.getLastSeen().getTime() ; + if (dt < BD_TO_BD_TIMEDIFF_MS) { + // if the packet was seen within the last 5 seconds, we should ignore. + // it should also ignore processing the packet. + if (log.isTraceEnabled()) { + log.trace("Surpressing too quick move of {} from one broadcast domain port {} {}" + + " to another broadcast domain port {} {}. Last seen on BD {} sec ago", + new Object[] { HexString.toHexString(match.getDataLayerSource()), + oldDap.getSwitchPort().getSw().getStringId(), currPort, + switchPort.getSw().getStringId(), newPort, + dt/1000 } + ); + } + return Command.STOP; + } } } diff --git a/src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManager.java b/src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManager.java index 51c638084b3abf0b9d77032b7ad72c50bf309b2c..abd8d91565b97053067c76e7410760e9424ba72f 100644 --- a/src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManager.java +++ b/src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManager.java @@ -156,7 +156,7 @@ public class LinkDiscoveryManager protected Map<LinkTuple, LinkInfo> links; protected int lldpFrequency = 15 * 1000; // sending frequency protected int lldpTimeout = 35 * 1000; // timeout - LLDPTLV controllerTLV; + protected LLDPTLV controllerTLV; protected ReentrantReadWriteLock lock; /** @@ -367,13 +367,17 @@ public class LinkDiscoveryManager e.printStackTrace(); } - Long result = System.nanoTime(); + long result = System.nanoTime(); if (localIPAddress != null) result = result * prime + IPv4.toIPv4Address(localIPAddress.getHostAddress()); if (localInterface != null) result = result * prime + localInterface.hashCode(); + // set the first 4 bits to 0. + result = result & (0x0fffffffffffffffL); + bb.putLong(result); + log.info("Controller TLV: {}", result); bb.rewind(); bb.get(controllerTLVValue, 0, 8);