diff --git a/src/main/java/net/floodlightcontroller/devicemanager/internal/DeviceManagerImpl.java b/src/main/java/net/floodlightcontroller/devicemanager/internal/DeviceManagerImpl.java index 5d7fde716eb9f4ed3695ff8c14a0a2c95e68fcf2..8f9281243b563713c2196dd80616e1019f96628b 100755 --- a/src/main/java/net/floodlightcontroller/devicemanager/internal/DeviceManagerImpl.java +++ b/src/main/java/net/floodlightcontroller/devicemanager/internal/DeviceManagerImpl.java @@ -277,7 +277,7 @@ IFlowReconcileListener, IInfoProvider, IHAListener { } else if (oldPort == OFPort.OFPP_LOCAL.getValue() && newPort != OFPort.OFPP_LOCAL.getValue()) { return 1; - } + } // We expect that the last seen of the new AP is higher than // old AP, if it is not, just reverse and send the negative diff --git a/src/main/java/net/floodlightcontroller/topology/ITopologyService.java b/src/main/java/net/floodlightcontroller/topology/ITopologyService.java index cc62e82ac86f78eb63c20da7b70833d5786248e7..6cfc679a80b2bfb8cfa66c34703c9c490cf9688a 100644 --- a/src/main/java/net/floodlightcontroller/topology/ITopologyService.java +++ b/src/main/java/net/floodlightcontroller/topology/ITopologyService.java @@ -41,6 +41,10 @@ public interface ITopologyService extends IFloodlightService { public boolean inSameOpenflowDomain(long switch1, long switch2, boolean tunnelEnabled); + public Set<Long> getSwitchesInOpenflowDomain(long switchDPID); + public Set<Long> getSwitchesInOpenflowDomain(long switchDPID, + boolean tunnelEnabled); + /** * Queries whether two switches are in the same island. * Currently, island and cluster are the same. In future, diff --git a/src/main/java/net/floodlightcontroller/topology/TopologyInstance.java b/src/main/java/net/floodlightcontroller/topology/TopologyInstance.java index 7fea75b348d6362c3968c71f78bb1ba0abd8d3c9..129f18bfb6ae6aadc3e5485f68beb5bb70928b4c 100644 --- a/src/main/java/net/floodlightcontroller/topology/TopologyInstance.java +++ b/src/main/java/net/floodlightcontroller/topology/TopologyInstance.java @@ -727,7 +727,13 @@ public class TopologyInstance { protected Set<Long> getSwitchesInOpenflowDomain(long switchId) { Cluster c = switchClusterMap.get(switchId); - if (c == null) return null; + if (c == null) { + // The switch is not known to topology as there + // are no links connected to it. + Set<Long> nodes = new HashSet<Long>(); + nodes.add(switchId); + return nodes; + } return (c.getNodes()); } diff --git a/src/main/java/net/floodlightcontroller/topology/TopologyManager.java b/src/main/java/net/floodlightcontroller/topology/TopologyManager.java index 0d2e974428b619c092fd6b81739dc827da0e6ae6..179db39b2518c4790fe883a390b71ccc5148784b 100644 --- a/src/main/java/net/floodlightcontroller/topology/TopologyManager.java +++ b/src/main/java/net/floodlightcontroller/topology/TopologyManager.java @@ -377,7 +377,8 @@ public class TopologyManager implements } - + //////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////// /** * Checks if the switchport is a broadcast domain port or not. */ @@ -393,7 +394,8 @@ public class TopologyManager implements return ti.isBroadcastDomainPort(new NodePortTuple(sw, port)); } - + //////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////// /** * Checks if the new attachment point port is consistent with the * old attachment point port. @@ -467,6 +469,22 @@ public class TopologyManager implements return ti.getAllowedIncomingBroadcastPort(src,srcPort); } + //////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////// + @Override + public Set<Long> getSwitchesInOpenflowDomain(long switchDPID) { + return getSwitchesInOpenflowDomain(switchDPID, true); + } + + @Override + public Set<Long> getSwitchesInOpenflowDomain(long switchDPID, + boolean tunnelEnabled) { + TopologyInstance ti = getCurrentInstance(tunnelEnabled); + return ti.getSwitchesInOpenflowDomain(switchDPID); + } + //////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////// + @Override public Set<NodePortTuple> getBroadcastDomainPorts() { return portBroadcastDomainLinks.keySet();