diff --git a/src/main/java/net/floodlightcontroller/core/IOFSwitch.java b/src/main/java/net/floodlightcontroller/core/IOFSwitch.java index b6188dcd63131bbeb44de0a3d452a83e41bdb27b..67345322dfeb7f1e4d3707cb007562ea4d36a47c 100644 --- a/src/main/java/net/floodlightcontroller/core/IOFSwitch.java +++ b/src/main/java/net/floodlightcontroller/core/IOFSwitch.java @@ -47,6 +47,7 @@ public interface IOFSwitch { public static final String PROP_REQUIRES_L3_MATCH = "requiresL3Match"; public static final String PROP_SUPPORTS_OFPP_TABLE = "supportsOfppTable"; public static final String PROP_SUPPORTS_OFPP_FLOOD = "supportsOfppFlood"; + public static final String PROP_SUPPORTS_NETMASK_TBL = "supportsNetmaskTbl"; /** * Writes to the OFMessage to the output stream. diff --git a/src/main/java/net/floodlightcontroller/devicemanager/internal/DeviceIndex.java b/src/main/java/net/floodlightcontroller/devicemanager/internal/DeviceIndex.java index f7831662d4e61442e82582818762547239b52551..0d8ea75dd42466600e9abf24637903750479985c 100644 --- a/src/main/java/net/floodlightcontroller/devicemanager/internal/DeviceIndex.java +++ b/src/main/java/net/floodlightcontroller/devicemanager/internal/DeviceIndex.java @@ -102,6 +102,15 @@ public abstract class DeviceIndex { IndexedEntity oio = new IndexedEntity(keyFields, o); if (oio.equals(ie)) return; } - removeEntity(entity, deviceKey); + + Iterator<Long> keyiter = this.queryByEntity(entity); + while (keyiter.hasNext()) { + Long key = keyiter.next(); + if (key.equals(deviceKey)) { + removeEntity(entity, deviceKey); + break; + } + } } -} \ No newline at end of file + +} diff --git a/src/main/java/net/floodlightcontroller/devicemanager/internal/DeviceManagerImpl.java b/src/main/java/net/floodlightcontroller/devicemanager/internal/DeviceManagerImpl.java index 32d2ebc8ad73f148ae2c8f755cd07060de7cba3f..d02742dc987b8ea3e3d633e064748a53645e19a3 100755 --- a/src/main/java/net/floodlightcontroller/devicemanager/internal/DeviceManagerImpl.java +++ b/src/main/java/net/floodlightcontroller/devicemanager/internal/DeviceManagerImpl.java @@ -1162,7 +1162,14 @@ IFlowReconcileListener, IInfoProvider, IHAListener { if (deleteQueue != null) { for (Long l : deleteQueue) { + Device dev = deviceMap.get(l); + this.deleteDevice(dev); deviceMap.remove(l); + + // generate new device update + deviceUpdates = + updateUpdates(deviceUpdates, + new DeviceUpdate(dev, DELETE, null)); } } diff --git a/src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManager.java b/src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManager.java index b818e8f7b848be108218c92c1b007bbc68e8ed16..f3bb22a2882e9612937040dd16a839ab5719f84c 100644 --- a/src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManager.java +++ b/src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManager.java @@ -308,6 +308,7 @@ IFloodlightModule, IInfoProvider, IHAListener { lldpClock = (lldpClock + 1)% LLDP_TO_ALL_INTERVAL; if (lldpClock == 0) { + log.debug("Sending LLDP out on all ports."); discoverOnAllPorts(); } } @@ -355,7 +356,7 @@ IFloodlightModule, IInfoProvider, IHAListener { IOFSwitch iofSwitch = floodlightProvider.getSwitches().get(sw); if (iofSwitch == null) { - return; + return; } OFPhysicalPort ofpPort = iofSwitch.getPort(port); @@ -366,6 +367,8 @@ IFloodlightModule, IInfoProvider, IHAListener { return; } + log.info("Sending LLDPs"); + if (log.isTraceEnabled()) { log.trace("Sending LLDP packet out of swich: {}, port: {}", sw, port); @@ -475,6 +478,7 @@ IFloodlightModule, IInfoProvider, IHAListener { // Send standard LLDPs for (long sw: switches) { IOFSwitch iofSwitch = floodlightProvider.getSwitches().get(sw); + if (iofSwitch == null) continue; if (iofSwitch.getEnabledPorts() != null) { for (OFPhysicalPort p : iofSwitch.getEnabledPorts()) { // sends only forward LLDPs and BDDPs @@ -485,6 +489,7 @@ IFloodlightModule, IInfoProvider, IHAListener { for (long sw: switches) { IOFSwitch iofSwitch = floodlightProvider.getSwitches().get(sw); + if (iofSwitch == null) continue; if (iofSwitch.getEnabledPorts() != null) { for (OFPhysicalPort p : iofSwitch.getEnabledPorts()) { // sends only forward LLDPs and BDDPs @@ -544,7 +549,7 @@ IFloodlightModule, IInfoProvider, IHAListener { case PORT_STATUS: return this.handlePortStatus(sw.getId(), (OFPortStatus) msg); default: - break; + break; } log.error("Received an unexpected message {} from switch {}", msg, sw); @@ -1578,8 +1583,11 @@ IFloodlightModule, IInfoProvider, IHAListener { // null role implies HA mode is not enabled. Role role = floodlightProvider.getRole(); if (role == null || role == Role.MASTER) { + log.debug("Rescheduling discovery task as role = {}", role); discoveryTask.reschedule(DISCOVERY_TASK_INTERVAL, TimeUnit.SECONDS); + } else { + log.debug("Stopped LLDP rescheduling due to role = {}.", role); } } } @@ -1601,8 +1609,12 @@ IFloodlightModule, IInfoProvider, IHAListener { // null role implies HA mode is not enabled. Role role = floodlightProvider.getRole(); - if (role == null || role == Role.MASTER) + if (role == null || role == Role.MASTER) { + log.debug("Setup: Rescheduling discovery task. role = {}", role); discoveryTask.reschedule(DISCOVERY_TASK_INTERVAL, TimeUnit.SECONDS); + } else { + log.debug("Setup: Not scheduling LLDP as role = {}.", role); + } // Register for the OpenFlow messages we want to receive floodlightProvider.addOFMessageListener(OFType.PACKET_IN, this); floodlightProvider.addOFMessageListener(OFType.PORT_STATUS, this); @@ -1718,6 +1730,7 @@ IFloodlightModule, IInfoProvider, IHAListener { "to HA change from SLAVE->MASTER"); } clearAllLinks(); + log.debug("Role Change to Master: Rescheduling discovery task."); discoveryTask.reschedule(1, TimeUnit.MICROSECONDS); } break; @@ -1732,8 +1745,8 @@ IFloodlightModule, IInfoProvider, IHAListener { portBroadcastDomainLinks.clear(); discoverOnAllPorts(); break; - default: - break; + default: + break; } }