diff --git a/src/main/java/net/floodlightcontroller/topology/TopologyInstance.java b/src/main/java/net/floodlightcontroller/topology/TopologyInstance.java index ab2026c066e99e6a80b38f6a5d544bd1e9badd54..56748607a4dd4dd404022218e0a6c75b52d08206 100644 --- a/src/main/java/net/floodlightcontroller/topology/TopologyInstance.java +++ b/src/main/java/net/floodlightcontroller/topology/TopologyInstance.java @@ -156,6 +156,13 @@ public class TopologyInstance { // Remaining links are inter-cluster links addIntraClusterLinks(); + // Step 1.2 Compute the archipelagos (def: group of clusters). Each archipelago + // will have its own finiteBroadcastTree, which will be randomly chosen. This is + // because each achipelago is by definition isolated from all other archipelagos. + // The broadcast tree will not be set for each archipelago until after all paths + // have been computed. This is so we don't run dijkstras redundantly + calculateArchipelagos(); + // Step 2. Compute shortest path trees in each cluster for // unicast routing. The trees are rooted at the destination. // Cost for tunnel links and direct links are the same. @@ -171,12 +178,9 @@ public class TopologyInstance { // Step 4. Compute e2e shortest path trees on entire topology for unicast routing. // The trees are rooted at the destination. // Cost for tunnel links and direct links are the same. - // calculateAllShortestPaths(); + calculateAllShortestPaths(); - // Compute the archipelagos (def: group of clusters). Each archipelago will - // have its own finiteBroadcastTree, which will be randomly chosen. This is - // because each achipelago is by definition isolated from all other archipelagos. - calculateArchipelagos(); + selectBroadcastTreeForEachArchipelago(); // Step 5. Determine broadcast switch ports for each archipelago computeBcastNPTsFromArchipelagos(); @@ -637,7 +641,9 @@ public class TopologyInstance { dstArchipelago = null; } } - + } + + private void selectBroadcastTreeForEachArchipelago() { // Choose a broadcast tree for each archipelago for (Archipelago a : archipelagos) { for (DatapathId id : destinationRootedFullTrees.keySet()) { @@ -919,10 +925,6 @@ public class TopologyInstance { clusterBroadcastTrees.put(c.id, tree); } } - - private Set<NodePortTuple> getAllBroadcastNodePorts() { - return this.broadcastNodePorts; - } private void computeBcastNPTsFromArchipelagos() { if (this.destinationRootedFullTrees.size() > 0) { @@ -1032,16 +1034,6 @@ public class TopologyInstance { * Getter Functions */ - private int getCost(DatapathId srcId, DatapathId dstId) { - BroadcastTree bt = destinationRootedTrees.get(dstId); - if (bt == null) return -1; - return bt.getCost(srcId); - } - - private Set<Cluster> getClusters() { - return clusters; - } - protected boolean pathExists(DatapathId srcId, DatapathId dstId) { BroadcastTree bt = destinationRootedTrees.get(dstId); if (bt == null) return false; diff --git a/src/test/java/net/floodlightcontroller/devicemanager/internal/DeviceManagerImplTest.java b/src/test/java/net/floodlightcontroller/devicemanager/internal/DeviceManagerImplTest.java index 3c5d6fea36af340530b01260d1a0c1b2bcad66aa..fab12fe53e69da2e9f4506ade5095fd2bce061e7 100644 --- a/src/test/java/net/floodlightcontroller/devicemanager/internal/DeviceManagerImplTest.java +++ b/src/test/java/net/floodlightcontroller/devicemanager/internal/DeviceManagerImplTest.java @@ -156,7 +156,7 @@ public class DeviceManagerImplTest extends FloodlightTestCase { expectLastCall().andReturn(true).anyTimes(); mockTopology.getOpenflowDomainId(DatapathId.of(anyLong())); expectLastCall().andReturn(DatapathId.of(1L)).anyTimes(); - mockTopology.isBroadcastDomainPort(DatapathId.of(anyLong()), OFPort.of(anyShort())); + mockTopology.isBroadcastPort(DatapathId.of(anyLong()), OFPort.of(anyShort())); expectLastCall().andReturn(false).anyTimes(); mockTopology.isConsistent(DatapathId.of(anyLong()), OFPort.of(anyShort()), DatapathId.of(anyLong()), OFPort.of(anyShort())); expectLastCall().andReturn(false).anyTimes(); @@ -405,7 +405,7 @@ public class DeviceManagerImplTest extends FloodlightTestCase { ITopologyService mockTopology = createMock(ITopologyService.class); expect(mockTopology.getOpenflowDomainId(DatapathId.of(anyLong()))). andReturn(DatapathId.of(1L)).anyTimes(); - expect(mockTopology.isBroadcastDomainPort(DatapathId.of(anyLong()), OFPort.of(anyShort()))). + expect(mockTopology.isBroadcastPort(DatapathId.of(anyLong()), OFPort.of(anyShort()))). andReturn(false).anyTimes(); expect(mockTopology.isAttachmentPointPort(DatapathId.of(anyLong()), @@ -576,7 +576,7 @@ public class DeviceManagerImplTest extends FloodlightTestCase { ITopologyService mockTopology = createMock(ITopologyService.class); expect(mockTopology.getOpenflowDomainId(DatapathId.of(anyLong()))). andReturn(DatapathId.of(1L)).anyTimes(); - expect(mockTopology.isBroadcastDomainPort(DatapathId.of(anyLong()), OFPort.of(anyShort()))). + expect(mockTopology.isBroadcastPort(DatapathId.of(anyLong()), OFPort.of(anyShort()))). andReturn(false).anyTimes(); expect(mockTopology.isAttachmentPointPort(DatapathId.of(anyLong()), @@ -792,7 +792,7 @@ public class DeviceManagerImplTest extends FloodlightTestCase { andReturn(DatapathId.of(10L)).anyTimes(); expect(mockTopology.getOpenflowDomainId(DatapathId.of(50L))). andReturn(DatapathId.of(10L)).anyTimes(); - expect(mockTopology.isBroadcastDomainPort(DatapathId.of(anyLong()), OFPort.of(anyShort()))). + expect(mockTopology.isBroadcastPort(DatapathId.of(anyLong()), OFPort.of(anyShort()))). andReturn(false).anyTimes(); expect(mockTopology.isInSameBroadcastDomain(DatapathId.of(anyLong()), OFPort.of(anyShort()), DatapathId.of(anyLong()), OFPort.of(anyShort()))).andReturn(false).anyTimes(); @@ -909,7 +909,7 @@ public class DeviceManagerImplTest extends FloodlightTestCase { andReturn(DatapathId.of(1L)).anyTimes(); expect(mockTopology.getOpenflowDomainId(DatapathId.of(4L))). andReturn(DatapathId.of(1L)).anyTimes(); - expect(mockTopology.isBroadcastDomainPort(DatapathId.of(anyLong()), OFPort.of(anyShort()))) + expect(mockTopology.isBroadcastPort(DatapathId.of(anyLong()), OFPort.of(anyShort()))) .andReturn(false).anyTimes(); expect(mockTopology.isInSameBroadcastDomain(DatapathId.of(anyLong()), OFPort.of(anyShort()), DatapathId.of(anyLong()), OFPort.of(anyShort()))) @@ -1033,7 +1033,7 @@ public class DeviceManagerImplTest extends FloodlightTestCase { andReturn(DatapathId.of(10L)).anyTimes(); expect(mockTopology.getOpenflowDomainId(DatapathId.of(50L))). andReturn(DatapathId.of(10L)).anyTimes(); - expect(mockTopology.isBroadcastDomainPort(DatapathId.of(anyLong()), OFPort.of(anyShort()))) + expect(mockTopology.isBroadcastPort(DatapathId.of(anyLong()), OFPort.of(anyShort()))) .andReturn(false).anyTimes(); expect(mockTopology.isInSameBroadcastDomain(DatapathId.of(anyLong()), OFPort.of(anyShort()), DatapathId.of(anyLong()), OFPort.of(anyShort()))) @@ -1134,9 +1134,9 @@ public class DeviceManagerImplTest extends FloodlightTestCase { expect(mockTopology.getOpenflowDomainId(DatapathId.of(anyLong()))).andReturn(DatapathId.of(1L)).anyTimes(); expect(mockTopology.isAttachmentPointPort(DatapathId.of(anyLong()), OFPort.of(anyShort()))). andReturn(true).anyTimes(); - expect(mockTopology.isBroadcastDomainPort(DatapathId.of(1L), OFPort.of(1))). + expect(mockTopology.isBroadcastPort(DatapathId.of(1L), OFPort.of(1))). andReturn(false).anyTimes(); - expect(mockTopology.isBroadcastDomainPort(DatapathId.of(1L), OFPort.of(2))). + expect(mockTopology.isBroadcastPort(DatapathId.of(1L), OFPort.of(2))). andReturn(true).anyTimes(); expect(mockTopology.isInSameBroadcastDomain(DatapathId.of(1L), OFPort.of(1), DatapathId.of(1L), OFPort.of(2))).andReturn(true).anyTimes(); @@ -1196,11 +1196,11 @@ public class DeviceManagerImplTest extends FloodlightTestCase { andReturn(DatapathId.of(1L)).anyTimes(); expect(mockTopology.isAttachmentPointPort(DatapathId.of(anyLong()), OFPort.of(anyShort()))). andReturn(true).anyTimes(); - expect(mockTopology.isBroadcastDomainPort(DatapathId.of(1L), OFPort.of(1))). + expect(mockTopology.isBroadcastPort(DatapathId.of(1L), OFPort.of(1))). andReturn(false).anyTimes(); - expect(mockTopology.isBroadcastDomainPort(DatapathId.of(1L), OFPort.LOCAL)). + expect(mockTopology.isBroadcastPort(DatapathId.of(1L), OFPort.LOCAL)). andReturn(false).anyTimes(); - expect(mockTopology.isBroadcastDomainPort(DatapathId.of(1L), OFPort.of(2))). + expect(mockTopology.isBroadcastPort(DatapathId.of(1L), OFPort.of(2))). andReturn(true).anyTimes(); expect(mockTopology.isInSameBroadcastDomain(DatapathId.of(1L), OFPort.of(1), DatapathId.of(1L), OFPort.LOCAL)).andReturn(true).anyTimes(); @@ -1261,7 +1261,7 @@ public class DeviceManagerImplTest extends FloodlightTestCase { DatapathId.of(EasyMock.anyLong()), OFPort.of(EasyMock.anyShort()))).andReturn(false). anyTimes(); - expect(mockTopology.isBroadcastDomainPort(DatapathId.of(EasyMock.anyLong()), + expect(mockTopology.isBroadcastPort(DatapathId.of(EasyMock.anyLong()), OFPort.of(EasyMock.anyShort()))) .andReturn(false) .anyTimes(); @@ -1726,8 +1726,8 @@ public class DeviceManagerImplTest extends FloodlightTestCase { expect(mockTopology.isAttachmentPointPort(DatapathId.of(anyLong()), OFPort.of(anyShort()))).andReturn(true).anyTimes(); - expect(mockTopology.isBroadcastDomainPort(DatapathId.of(1L), OFPort.of(1))).andReturn(false).anyTimes(); - expect(mockTopology.isBroadcastDomainPort(DatapathId.of(5L), OFPort.of(1))).andReturn(false).anyTimes(); + expect(mockTopology.isBroadcastPort(DatapathId.of(1L), OFPort.of(1))).andReturn(false).anyTimes(); + expect(mockTopology.isBroadcastPort(DatapathId.of(5L), OFPort.of(1))).andReturn(false).anyTimes(); expect(mockTopology.getOpenflowDomainId(DatapathId.of(1L))).andReturn(DatapathId.of(1L)).anyTimes(); /* different islands */ expect(mockTopology.getOpenflowDomainId(DatapathId.of(5L))).andReturn(DatapathId.of(5L)).anyTimes(); expect(mockTopology.isConsistent(DatapathId.of(1L), OFPort.of(1), DatapathId.of(5L), OFPort.of(1))). @@ -1824,7 +1824,7 @@ public class DeviceManagerImplTest extends FloodlightTestCase { DatapathId.of(EasyMock.anyLong()), OFPort.of(EasyMock.anyShort()))).andReturn(false). anyTimes(); - expect(mockTopology.isBroadcastDomainPort(DatapathId.of(EasyMock.anyLong()), + expect(mockTopology.isBroadcastPort(DatapathId.of(EasyMock.anyLong()), OFPort.of(EasyMock.anyShort()))). andReturn(false).anyTimes(); replay(mockTopology); @@ -1959,7 +1959,7 @@ public class DeviceManagerImplTest extends FloodlightTestCase { ITopologyService mockTopology = createMock(ITopologyService.class); expect(mockTopology.isAttachmentPointPort(DatapathId.of(anyLong()), OFPort.of(anyShort()))).andReturn(true).anyTimes(); - expect(mockTopology.isBroadcastDomainPort(DatapathId.of(anyLong()), + expect(mockTopology.isBroadcastPort(DatapathId.of(anyLong()), OFPort.of(anyShort()))). andReturn(false).anyTimes(); expect(mockTopology.isInSameBroadcastDomain(DatapathId.of(anyLong()), OFPort.of(anyShort()), @@ -2049,7 +2049,7 @@ public class DeviceManagerImplTest extends FloodlightTestCase { ITopologyService mockTopology = createMock(ITopologyService.class); expect(mockTopology.isAttachmentPointPort(DatapathId.of(anyLong()), OFPort.of(anyShort()))).andReturn(true).anyTimes(); - expect(mockTopology.isBroadcastDomainPort(DatapathId.of(anyLong()), + expect(mockTopology.isBroadcastPort(DatapathId.of(anyLong()), OFPort.of(anyShort()))). andReturn(false).anyTimes(); expect(mockTopology.isInSameBroadcastDomain(DatapathId.of(anyLong()), OFPort.of(anyShort()), @@ -2500,7 +2500,7 @@ public class DeviceManagerImplTest extends FloodlightTestCase { OFPort.of(EasyMock.anyShort()))) .andReturn(false) .anyTimes(); - expect(mockTopology.isBroadcastDomainPort(DatapathId.of(EasyMock.anyLong()), + expect(mockTopology.isBroadcastPort(DatapathId.of(EasyMock.anyLong()), OFPort.of(EasyMock.anyShort()))) .andReturn(false) .anyTimes(); @@ -2611,7 +2611,7 @@ public class DeviceManagerImplTest extends FloodlightTestCase { OFPort.of(EasyMock.anyShort()))) .andReturn(false) .anyTimes(); - expect(mockTopology.isBroadcastDomainPort(DatapathId.of(EasyMock.anyLong()), + expect(mockTopology.isBroadcastPort(DatapathId.of(EasyMock.anyLong()), OFPort.of(EasyMock.anyShort()))) .andReturn(false) .anyTimes(); @@ -2749,7 +2749,7 @@ public class DeviceManagerImplTest extends FloodlightTestCase { OFPort.of(EasyMock.anyShort()))) .andReturn(false) .anyTimes(); - expect(mockTopology.isBroadcastDomainPort(DatapathId.of(EasyMock.anyLong()), + expect(mockTopology.isBroadcastPort(DatapathId.of(EasyMock.anyLong()), OFPort.of(EasyMock.anyShort()))) .andReturn(false) .anyTimes();