diff --git a/src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManager.java b/src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManager.java index 8c4fb69b3cf5024e5a4bcf92695b1149dae5a921..e8381d4b6204e9441ef4e42053123cf5bcb97fa4 100644 --- a/src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManager.java +++ b/src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManager.java @@ -965,13 +965,9 @@ public class LinkDiscoveryManager implements IOFMessageListener, linkDiscoveryAware }); } try { - // Send link discovery updates to listener only if the role - // is null or master. - if (role == null || role == Role.MASTER) { - for (ILinkDiscoveryListener lda : linkDiscoveryAware) { // order - // maintained - lda.linkDiscoveryUpdate(updateList); - } + for (ILinkDiscoveryListener lda : linkDiscoveryAware) { // order + // maintained + lda.linkDiscoveryUpdate(updateList); } } catch (Exception e) { log.error("Error in link discovery updates loop", e); diff --git a/src/main/java/net/floodlightcontroller/topology/TopologyManager.java b/src/main/java/net/floodlightcontroller/topology/TopologyManager.java index 9941e23c743592123ba9ea67c8ff93821f73df0a..b30dd410c342a1b3de1bbabfc6f0a700b109b0c8 100644 --- a/src/main/java/net/floodlightcontroller/topology/TopologyManager.java +++ b/src/main/java/net/floodlightcontroller/topology/TopologyManager.java @@ -1038,12 +1038,21 @@ public class TopologyManager implements addTunnelPort(update.getSrc(), update.getSrcPort()); } else if (update.getOperation() == UpdateOperation.TUNNEL_PORT_REMOVED) { removeTunnelPort(update.getSrc(), update.getSrcPort()); + } else if (update.getOperation() == UpdateOperation.SWITCH_UPDATED) { + addOrUpdateSwitch(update.getSrc()); + } else if (update.getOperation() == UpdateOperation.SWITCH_REMOVED) { + removeSwitch(update.getSrc()); } // Add to the list of applied updates. appliedUpdates.add(update); } } + protected void addOrUpdateSwitch(long sw) { + // nothing to do here for the time being. + return; + } + public void addTunnelPort(long sw, short port) { NodePortTuple npt = new NodePortTuple(sw, port); tunnelPorts.add(npt); @@ -1198,23 +1207,17 @@ public class TopologyManager implements switchPorts.get(s).add(p); } - public boolean removeSwitchPort(long sw, short port) { - - Set<Link> linksToRemove = new HashSet<Link>(); - NodePortTuple npt = new NodePortTuple(sw, port); - if (switchPortLinks.containsKey(npt) == false) return false; - - linksToRemove.addAll(switchPortLinks.get(npt)); - for(Link link: linksToRemove) { - removeLink(link); - } - return true; - } - - public boolean removeSwitch(long sid) { + public void removeSwitch(long sid) { // Delete all the links in the switch, switch and all // associated data should be deleted. - if (switchPorts.containsKey(sid) == false) return false; + if (switchPorts.containsKey(sid) == false) return; + + // Check if any tunnel ports need to be removed. + for(NodePortTuple npt: tunnelPorts) { + if (npt.getNodeId() == sid) { + removeTunnelPort(npt.getNodeId(), npt.getPortId()); + } + } Set<Link> linksToRemove = new HashSet<Link>(); for(Short p: switchPorts.get(sid)) { @@ -1222,12 +1225,11 @@ public class TopologyManager implements linksToRemove.addAll(switchPortLinks.get(n1)); } - if (linksToRemove.isEmpty()) return false; + if (linksToRemove.isEmpty()) return; for(Link link: linksToRemove) { removeLink(link); } - return true; } /**