tests: fix wireguard test case failures
Type: test
There are random failures in the wireguard test cases that are not related to concurrency issues.
The root cause is a retry of the handshake initiation after (REKEY_TIMEOUT + JITTER) ms, where JITTER is a random value between 0 and 333 ms.
Solution: Add a filter parameter for the `send_and_expect` method of the vpptestcase.
This filter allows for excluding unexpected handshake initiation packets when the responder sends two packets (with `message_type = 1` and `message_type = 2`),while only a single packet (with `message_type = 2`) is expected.
Change-Id: I62816931fc1b85e2202f3d36eb6c2a23714644d5
Signed-off-by: Ivan Ivanets <iivanets@cisco.com>
diff --git a/test/framework.py b/test/framework.py
index fc22ad6..62fa1fe 100644
--- a/test/framework.py
+++ b/test/framework.py
@@ -26,7 +26,7 @@
import scapy.compat
from scapy.packet import Raw, Packet
-from vpp_pg_interface import VppPGInterface
+from vpp_pg_interface import VppPGInterface, is_ipv6_misc
from vpp_sub_interface import VppSubInterface
from vpp_lo_interface import VppLoInterface
from vpp_bvi_interface import VppBviInterface
@@ -547,6 +547,7 @@
trace=True,
msg=None,
stats_diff=None,
+ filter_out_fn=is_ipv6_misc,
):
if stats_diff:
stats_snapshot = self.snapshot_stats(stats_diff)
@@ -554,7 +555,7 @@
if not n_rx:
n_rx = 1 if isinstance(pkts, Packet) else len(pkts)
self.pg_send(intf, pkts, worker=worker, trace=trace)
- rx = output.get_capture(n_rx)
+ rx = output.get_capture(n_rx, filter_out_fn=filter_out_fn)
if trace:
if msg:
self.logger.debug(f"send_and_expect: {msg}")