Skip to content
Browse files

Merge into master from pull request #124:

Fix test issue related to duplicate devices (#124)
  • Loading branch information...
2 parents 52cba5d + 58ca335 commit 3604d8d4d3ee065d951ad0ffd97754ca549c392b @bsn-abat bsn-abat committed May 18, 2012
View
6 src/main/java/net/floodlightcontroller/devicemanager/internal/Device.java
@@ -275,7 +275,11 @@ public String getMACAddressString() {
if (prev != null &&
!(dpid.equals(prev.getSwitchDPID()) &&
- port.equals(prev.getSwitchPort()))) {
+ port.equals(prev.getSwitchPort())) &&
+ !topology.isInSameBroadcastDomain(dpid.longValue(),
+ port.shortValue(),
+ prev.getSwitchDPID().longValue(),
+ prev.getSwitchPort().shortValue())) {
long curActive =
deviceManager.apComparator.
getEffTS(cur, cur.getActiveSince());
View
10 src/test/java/net/floodlightcontroller/devicemanager/internal/DeviceManagerImplTest.java
@@ -415,6 +415,8 @@ public void testAttachmentPointLearning() throws Exception {
andReturn(10L).anyTimes();
expect(mockTopology.isBroadcastDomainPort(anyLong(), anyShort())).
andReturn(false).anyTimes();
+ expect(mockTopology.isInSameBroadcastDomain(anyLong(), anyShort(),
+ anyLong(), anyShort())).andReturn(false).anyTimes();
expect(mockTopology.isInternal(anyLong(),
anyShort())).andReturn(false).anyTimes();
@@ -499,6 +501,10 @@ public void testBDAttachmentPointLearning() throws Exception {
andReturn(false).anyTimes();
expect(mockTopology.isBroadcastDomainPort(1L, (short)2)).
andReturn(true).anyTimes();
+ expect(mockTopology.isInSameBroadcastDomain(1L, (short)1,
+ 1L, (short)2)).andReturn(true).anyTimes();
+ expect(mockTopology.isInSameBroadcastDomain(1L, (short)2,
+ 1L, (short)1)).andReturn(true).anyTimes();
replay(mockTopology);
@@ -717,6 +723,8 @@ public void testAttachmentPointFlapping() throws Exception {
expect(mockTopology.isBroadcastDomainPort(anyLong(),
anyShort())).
andReturn(false).anyTimes();
+ expect(mockTopology.isInSameBroadcastDomain(anyLong(), anyShort(),
+ anyLong(), anyShort())).andReturn(false).anyTimes();
expect(mockTopology.getSwitchClusterId(anyLong())).
andReturn(1L).anyTimes();
replay(mockTopology);
@@ -809,6 +817,8 @@ public void testAttachmentPointFlappingTwoCluster() throws Exception {
expect(mockTopology.isBroadcastDomainPort(anyLong(),
anyShort())).
andReturn(false).anyTimes();
+ expect(mockTopology.isInSameBroadcastDomain(anyLong(), anyShort(),
+ anyLong(), anyShort())).andReturn(false).anyTimes();
expect(mockTopology.getSwitchClusterId(1L)).
andReturn(1L).anyTimes();
expect(mockTopology.getSwitchClusterId(5L)).

0 comments on commit 3604d8d

Please sign in to comment.
Something went wrong with that request. Please try again.