Don't flood ARP packets out the port they came in on.
Also renamed ProxyArpService#known(Ip4Address) to
ProxyArpService#isKnown(Ip4Address)
Fixes ONOS-722.
Change-Id: I136c65e58693926e87b822cb0f4ec1c4ba0e3780
diff --git a/core/net/src/test/java/org/onosproject/net/proxyarp/impl/ProxyArpManagerTest.java b/core/net/src/test/java/org/onosproject/net/proxyarp/impl/ProxyArpManagerTest.java
index a80f0a1..a349738f 100644
--- a/core/net/src/test/java/org/onosproject/net/proxyarp/impl/ProxyArpManagerTest.java
+++ b/core/net/src/test/java/org/onosproject/net/proxyarp/impl/ProxyArpManagerTest.java
@@ -239,7 +239,7 @@
}
/**
- * Tests {@link ProxyArpManager#known(Ip4Address)} in the case where the
+ * Tests {@link ProxyArpManager#isKnown(Ip4Address)} in the case where the
* IP address is not known.
* Verifies the method returns false.
*/
@@ -248,11 +248,11 @@
expect(hostService.getHostsByIp(IP1)).andReturn(Collections.<Host>emptySet());
replay(hostService);
- assertFalse(proxyArp.known(IP1));
+ assertFalse(proxyArp.isKnown(IP1));
}
/**
- * Tests {@link ProxyArpManager#known(Ip4Address)} in the case where the
+ * Tests {@link ProxyArpManager#isKnown(Ip4Address)} in the case where the
* IP address is known.
* Verifies the method returns true.
*/
@@ -265,7 +265,7 @@
.andReturn(Sets.newHashSet(host1, host2));
replay(hostService);
- assertTrue(proxyArp.known(IP1));
+ assertTrue(proxyArp.isKnown(IP1));
}
/**
@@ -314,7 +314,7 @@
Ethernet arpRequest = buildArp(ARP.OP_REQUEST, MAC2, null, IP2, IP1);
- proxyArp.reply(arpRequest, getLocation(5));
+ proxyArp.reply(arpRequest, getLocation(6));
verifyFlood(arpRequest);
}
@@ -341,7 +341,7 @@
Ethernet arpRequest = buildArp(ARP.OP_REQUEST, MAC2, null, IP2, IP1);
- proxyArp.reply(arpRequest, getLocation(5));
+ proxyArp.reply(arpRequest, getLocation(6));
verifyFlood(arpRequest);
}
@@ -435,7 +435,7 @@
Ethernet arpRequest = buildArp(ARP.OP_REPLY, MAC2, MAC1, IP2, IP1);
- proxyArp.forward(arpRequest);
+ proxyArp.forward(arpRequest, LOC2);
assertEquals(1, packetService.packets.size());
OutboundPacket packet = packetService.packets.get(0);
@@ -455,18 +455,20 @@
Ethernet arpRequest = buildArp(ARP.OP_REPLY, MAC2, MAC1, IP2, IP1);
- proxyArp.forward(arpRequest);
+ proxyArp.forward(arpRequest, getLocation(6));
verifyFlood(arpRequest);
}
/**
- * Verifies that the given packet was flooded out all available edge ports.
+ * Verifies that the given packet was flooded out all available edge ports,
+ * except for the input port.
*
* @param packet the packet that was expected to be flooded
*/
private void verifyFlood(Ethernet packet) {
- assertEquals(NUM_FLOOD_PORTS, packetService.packets.size());
+ // There should be 1 less than NUM_FLOOD_PORTS; the inPort should be excluded.
+ assertEquals(NUM_FLOOD_PORTS - 1, packetService.packets.size());
Collections.sort(packetService.packets,
new Comparator<OutboundPacket>() {
@@ -476,7 +478,8 @@
}
});
- for (int i = 0; i < NUM_FLOOD_PORTS; i++) {
+
+ for (int i = 0; i < NUM_FLOOD_PORTS - 1; i++) {
ConnectPoint cp = new ConnectPoint(getDeviceId(NUM_ADDRESS_PORTS + i + 1),
PortNumber.portNumber(1));