diff --git a/src/main/java/net/floodlightcontroller/devicemanager/internal/DeviceManagerImpl.java b/src/main/java/net/floodlightcontroller/devicemanager/internal/DeviceManagerImpl.java index ec1dd169a38b1fbb38dc72298a98b765c124c942..bb7ebd2b917860eeea78f652a500b54127deaead 100755 --- a/src/main/java/net/floodlightcontroller/devicemanager/internal/DeviceManagerImpl.java +++ b/src/main/java/net/floodlightcontroller/devicemanager/internal/DeviceManagerImpl.java @@ -790,7 +790,7 @@ IFlowReconcileListener, IInfoProvider, IHAListener { * @param switchPort the port * @return true if it's a valid attachment point */ - protected boolean isValidAttachmentPoint(long switchDPID, + public boolean isValidAttachmentPoint(long switchDPID, int switchPort) { if (topology.isAttachmentPointPort(switchDPID, (short)switchPort) == false) diff --git a/src/test/java/net/floodlightcontroller/devicemanager/test/MockDevice.java b/src/test/java/net/floodlightcontroller/devicemanager/test/MockDevice.java index 913a136e0fc0ce9238bf06f769500d7fc93e8898..32dba7b147e853057d120ba82acd2128fd6d8b09 100644 --- a/src/test/java/net/floodlightcontroller/devicemanager/test/MockDevice.java +++ b/src/test/java/net/floodlightcontroller/devicemanager/test/MockDevice.java @@ -70,7 +70,8 @@ public class MockDevice extends Device { new ArrayList<SwitchPort>(entities.length); for (Entity e : entities) { if (e.getSwitchDPID() != null && - e.getSwitchPort() != null) { + e.getSwitchPort() != null && + deviceManager.isValidAttachmentPoint(e.getSwitchDPID(), e.getSwitchPort())) { SwitchPort sp = new SwitchPort(e.getSwitchDPID(), e.getSwitchPort()); vals.add(sp); @@ -78,5 +79,4 @@ public class MockDevice extends Device { } return vals.toArray(new SwitchPort[vals.size()]); } - } diff --git a/src/test/java/net/floodlightcontroller/forwarding/ForwardingTest.java b/src/test/java/net/floodlightcontroller/forwarding/ForwardingTest.java index 65d8f607ba2edef6d267d53c4fe488e032454180..e2f1e7d31ac18e4fa397d67b6cd33c5340845730 100644 --- a/src/test/java/net/floodlightcontroller/forwarding/ForwardingTest.java +++ b/src/test/java/net/floodlightcontroller/forwarding/ForwardingTest.java @@ -330,6 +330,8 @@ public class ForwardingTest extends FloodlightTestCase { reset(topology); expect(topology.getL2DomainId(1L)).andReturn(1L).anyTimes(); expect(topology.getL2DomainId(2L)).andReturn(1L).anyTimes(); + expect(topology.isAttachmentPointPort(1L, (short)1)).andReturn(true).anyTimes(); + expect(topology.isAttachmentPointPort(2L, (short)3)).andReturn(true).anyTimes(); expect(topology.isIncomingBroadcastAllowed(anyLong(), anyShort())).andReturn(true).anyTimes(); // Reset mocks, trigger the packet in, and validate results @@ -418,6 +420,8 @@ public class ForwardingTest extends FloodlightTestCase { reset(topology); expect(topology.isIncomingBroadcastAllowed(anyLong(), anyShort())).andReturn(true).anyTimes(); expect(topology.getL2DomainId(1L)).andReturn(1L).anyTimes(); + expect(topology.isAttachmentPointPort(1L, (short)1)).andReturn(true).anyTimes(); + expect(topology.isAttachmentPointPort(1L, (short)3)).andReturn(true).anyTimes(); // Reset mocks, trigger the packet in, and validate results replay(sw1, sw2, routingEngine, topology);