Modify existing test suites to use broadcast destination
MAC addresses when possible, rather than a default
MAC address assigned by DTS during execution.

VFs do not consistently receive and forward packets
unless the MAC address is broadcast or matches the
VF address, even with promiscuous mode enabled.

Signed-off-by: Dean Marx <dm...@iol.unh.edu>
---
 dts/tests/TestSuite_checksum_offload.py   | 69 ++++++++++++-----------
 dts/tests/TestSuite_dual_vlan.py          |  6 +-
 dts/tests/TestSuite_dynamic_queue_conf.py |  2 +-
 dts/tests/TestSuite_mtu.py                |  7 ++-
 dts/tests/TestSuite_packet_capture.py     | 23 ++++----
 dts/tests/TestSuite_queue_start_stop.py   |  2 +-
 dts/tests/TestSuite_vlan.py               |  4 +-
 7 files changed, 62 insertions(+), 51 deletions(-)

diff --git a/dts/tests/TestSuite_checksum_offload.py 
b/dts/tests/TestSuite_checksum_offload.py
index c9efdcaa1c..9d8d38b0f0 100644
--- a/dts/tests/TestSuite_checksum_offload.py
+++ b/dts/tests/TestSuite_checksum_offload.py
@@ -89,8 +89,13 @@ def send_packet_and_verify_checksum(
             if testpmd_packet.l4_dport == id:
                 is_IP = PacketOffloadFlag.RTE_MBUF_F_RX_IP_CKSUM_GOOD in 
testpmd_packet.ol_flags
                 is_L4 = PacketOffloadFlag.RTE_MBUF_F_RX_L4_CKSUM_GOOD in 
testpmd_packet.ol_flags
-        self.verify(is_L4 == good_L4, "Layer 4 checksum flag did not match 
expected checksum flag.")
-        self.verify(is_IP == good_IP, "IP checksum flag did not match expected 
checksum flag.")
+        try:
+            self.verify(
+                is_L4 == good_L4, "Layer 4 checksum flag did not match 
expected checksum flag."
+            )
+            self.verify(is_IP == good_IP, "IP checksum flag did not match 
expected checksum flag.")
+        except NameError:
+            self.verify(False, f"Test packet {packet} was not found in verbose 
output.")
 
     def setup_hw_offload(self, testpmd: TestPmdShell) -> None:
         """Sets IP, UDP, and TCP layers to hardware offload.
@@ -122,10 +127,10 @@ def test_insert_checksums(self) -> None:
         dport_id = 50000
         payload = b"xxxxx"
         packet_list = [
-            Ether() / IP() / UDP(dport=dport_id) / Raw(payload),
-            Ether() / IP() / TCP(dport=dport_id) / Raw(payload),
-            Ether() / IPv6(src="::1") / UDP(dport=dport_id) / Raw(payload),
-            Ether() / IPv6(src="::1") / TCP(dport=dport_id) / Raw(payload),
+            Ether(dst="FF:FF:FF:FF:FF:FF") / IP() / UDP(dport=dport_id) / 
Raw(payload),
+            Ether(dst="FF:FF:FF:FF:FF:FF") / IP() / TCP(dport=dport_id) / 
Raw(payload),
+            Ether(dst="FF:FF:FF:FF:FF:FF") / IPv6(src="::1") / 
UDP(dport=dport_id) / Raw(payload),
+            Ether(dst="FF:FF:FF:FF:FF:FF") / IPv6(src="::1") / 
TCP(dport=dport_id) / Raw(payload),
         ]
         with TestPmdShell(enable_rx_cksum=True) as testpmd:
             testpmd.set_forward_mode(SimpleForwardingModes.csum)
@@ -154,10 +159,10 @@ def test_no_insert_checksums(self) -> None:
         dport_id = 50000
         payload = b"xxxxx"
         packet_list = [
-            Ether() / IP() / UDP(dport=dport_id) / Raw(payload),
-            Ether() / IP() / TCP(dport=dport_id) / Raw(payload),
-            Ether() / IPv6(src="::1") / UDP(dport=dport_id) / Raw(payload),
-            Ether() / IPv6(src="::1") / TCP(dport=dport_id) / Raw(payload),
+            Ether(dst="FF:FF:FF:FF:FF:FF") / IP() / UDP(dport=dport_id) / 
Raw(payload),
+            Ether(dst="FF:FF:FF:FF:FF:FF") / IP() / TCP(dport=dport_id) / 
Raw(payload),
+            Ether(dst="FF:FF:FF:FF:FF:FF") / IPv6(src="::1") / 
UDP(dport=dport_id) / Raw(payload),
+            Ether(dst="FF:FF:FF:FF:FF:FF") / IPv6(src="::1") / 
TCP(dport=dport_id) / Raw(payload),
         ]
         with TestPmdShell(enable_rx_cksum=True) as testpmd:
             testpmd.set_forward_mode(SimpleForwardingModes.csum)
@@ -184,10 +189,10 @@ def test_l4_rx_checksum(self) -> None:
         """
         dport_id = 50000
         packet_list = [
-            Ether() / IP() / UDP(dport=dport_id),
-            Ether() / IP() / TCP(dport=dport_id),
-            Ether() / IP() / UDP(chksum=0xF, dport=dport_id),
-            Ether() / IP() / TCP(chksum=0xF, dport=dport_id),
+            Ether(dst="FF:FF:FF:FF:FF:FF") / IP() / UDP(dport=dport_id),
+            Ether(dst="FF:FF:FF:FF:FF:FF") / IP() / TCP(dport=dport_id),
+            Ether(dst="FF:FF:FF:FF:FF:FF") / IP() / UDP(chksum=0xF, 
dport=dport_id),
+            Ether(dst="FF:FF:FF:FF:FF:FF") / IP() / TCP(chksum=0xF, 
dport=dport_id),
         ]
         with TestPmdShell(enable_rx_cksum=True) as testpmd:
             testpmd.set_forward_mode(SimpleForwardingModes.csum)
@@ -217,10 +222,10 @@ def test_l3_rx_checksum(self) -> None:
         """
         dport_id = 50000
         packet_list = [
-            Ether() / IP() / UDP(dport=dport_id),
-            Ether() / IP() / TCP(dport=dport_id),
-            Ether() / IP(chksum=0xF) / UDP(dport=dport_id),
-            Ether() / IP(chksum=0xF) / TCP(dport=dport_id),
+            Ether(dst="FF:FF:FF:FF:FF:FF") / IP() / UDP(dport=dport_id),
+            Ether(dst="FF:FF:FF:FF:FF:FF") / IP() / TCP(dport=dport_id),
+            Ether(dst="FF:FF:FF:FF:FF:FF") / IP(chksum=0xF) / 
UDP(dport=dport_id),
+            Ether(dst="FF:FF:FF:FF:FF:FF") / IP(chksum=0xF) / 
TCP(dport=dport_id),
         ]
         with TestPmdShell(enable_rx_cksum=True) as testpmd:
             testpmd.set_forward_mode(SimpleForwardingModes.csum)
@@ -250,14 +255,14 @@ def test_validate_rx_checksum(self) -> None:
         """
         dport_id = 50000
         packet_list = [
-            Ether() / IP() / UDP(dport=dport_id),
-            Ether() / IP() / TCP(dport=dport_id),
-            Ether() / IPv6(src="::1") / UDP(dport=dport_id),
-            Ether() / IPv6(src="::1") / TCP(dport=dport_id),
-            Ether() / IP(chksum=0x0) / UDP(chksum=0xF, dport=dport_id),
-            Ether() / IP(chksum=0x0) / TCP(chksum=0xF, dport=dport_id),
-            Ether() / IPv6(src="::1") / UDP(chksum=0xF, dport=dport_id),
-            Ether() / IPv6(src="::1") / TCP(chksum=0xF, dport=dport_id),
+            Ether(dst="FF:FF:FF:FF:FF:FF") / IP() / UDP(dport=dport_id),
+            Ether(dst="FF:FF:FF:FF:FF:FF") / IP() / TCP(dport=dport_id),
+            Ether(dst="FF:FF:FF:FF:FF:FF") / IPv6(src="::1") / 
UDP(dport=dport_id),
+            Ether(dst="FF:FF:FF:FF:FF:FF") / IPv6(src="::1") / 
TCP(dport=dport_id),
+            Ether(dst="FF:FF:FF:FF:FF:FF") / IP(chksum=0x0) / UDP(chksum=0xF, 
dport=dport_id),
+            Ether(dst="FF:FF:FF:FF:FF:FF") / IP(chksum=0x0) / TCP(chksum=0xF, 
dport=dport_id),
+            Ether(dst="FF:FF:FF:FF:FF:FF") / IPv6(src="::1") / UDP(chksum=0xF, 
dport=dport_id),
+            Ether(dst="FF:FF:FF:FF:FF:FF") / IPv6(src="::1") / TCP(chksum=0xF, 
dport=dport_id),
         ]
         with TestPmdShell(enable_rx_cksum=True) as testpmd:
             testpmd.set_forward_mode(SimpleForwardingModes.csum)
@@ -297,22 +302,22 @@ def test_vlan_checksum(self) -> None:
         dport_id = 50000
         payload = b"xxxxx"
         packet_list = [
-            Ether()
+            Ether(dts="FF:FF:FF:FF:FF:FF")
             / Dot1Q(vlan=1)
             / IP(chksum=0x0)
             / UDP(chksum=0xF, dport=dport_id)
             / Raw(payload),
-            Ether()
+            Ether(dts="FF:FF:FF:FF:FF:FF")
             / Dot1Q(vlan=1)
             / IP(chksum=0x0)
             / TCP(chksum=0xF, dport=dport_id)
             / Raw(payload),
-            Ether()
+            Ether(dts="FF:FF:FF:FF:FF:FF")
             / Dot1Q(vlan=1)
             / IPv6(src="::1")
             / UDP(chksum=0xF, dport=dport_id)
             / Raw(payload),
-            Ether()
+            Ether(dts="FF:FF:FF:FF:FF:FF")
             / Dot1Q(vlan=1)
             / IPv6(src="::1")
             / TCP(chksum=0xF, dport=dport_id)
@@ -353,8 +358,8 @@ def test_validate_sctp_checksum(self) -> None:
         """
         dport_id = 50000
         packet_list = [
-            Ether() / IP() / UDP(dport=dport_id) / SCTP(),
-            Ether() / IP() / UDP(dport=dport_id) / SCTP(chksum=0xF),
+            Ether(dst="FF:FF:FF:FF:FF:FF") / IP() / UDP(dport=dport_id) / 
SCTP(),
+            Ether(dst="FF:FF:FF:FF:FF:FF") / IP() / UDP(dport=dport_id) / 
SCTP(chksum=0xF),
         ]
         with TestPmdShell(enable_rx_cksum=True) as testpmd:
             testpmd.set_forward_mode(SimpleForwardingModes.csum)
diff --git a/dts/tests/TestSuite_dual_vlan.py b/dts/tests/TestSuite_dual_vlan.py
index 6af503528d..de58af8c74 100644
--- a/dts/tests/TestSuite_dual_vlan.py
+++ b/dts/tests/TestSuite_dual_vlan.py
@@ -197,7 +197,7 @@ def insert_second_vlan(self) -> None:
             testpmd.tx_vlan_set(port=self.tx_port, enable=True, 
vlan=self.vlan_insert_tag)
             testpmd.start()
             recv = self.send_packet_and_capture(
-                Ether() / Dot1Q(vlan=self.outer_vlan_tag) / Raw(b"X" * 20)
+                Ether(dst="FF:FF:FF:FF:FF:FF") / 
Dot1Q(vlan=self.outer_vlan_tag) / Raw(b"X" * 20)
             )
             self.verify(len(recv) > 0, "Did not receive any packets when 
testing VLAN insertion.")
             self.verify(
@@ -224,7 +224,7 @@ def all_vlan_functions(self) -> None:
             VLAN functions work as expected.
         """
         send_pkt = (
-            Ether()
+            Ether(dst="FF:FF:FF:FF:FF:FF")
             / Dot1Q(vlan=self.outer_vlan_tag)
             / Dot1Q(vlan=self.inner_vlan_tag)
             / Raw(b"X" * 20)
@@ -264,7 +264,7 @@ def maintains_priority(self) -> None:
             Priorities are unchanged.
         """
         pkt = (
-            Ether()
+            Ether(dst="FF:FF:FF:FF:FF:FF")
             / Dot1Q(vlan=self.outer_vlan_tag, prio=1)
             / Dot1Q(vlan=self.inner_vlan_tag, prio=2)
             / Raw(b"X" * 20)
diff --git a/dts/tests/TestSuite_dynamic_queue_conf.py 
b/dts/tests/TestSuite_dynamic_queue_conf.py
index 344dd540eb..62da208c45 100644
--- a/dts/tests/TestSuite_dynamic_queue_conf.py
+++ b/dts/tests/TestSuite_dynamic_queue_conf.py
@@ -165,7 +165,7 @@ def send_packets_with_different_addresses(self, 
number_of_packets: int) -> None:
                 generator.
         """
         packets_to_send = [
-            Ether()
+            Ether(dst="FF:FF:FF:FF:FF:FF")
             / IP(src=self.src_addr, dst=f"{self.dst_address_subnet}.{(i % 254) 
+ 1}")
             / Raw()
             for i in range(number_of_packets)
diff --git a/dts/tests/TestSuite_mtu.py b/dts/tests/TestSuite_mtu.py
index af6ab88501..ee5242a9c1 100644
--- a/dts/tests/TestSuite_mtu.py
+++ b/dts/tests/TestSuite_mtu.py
@@ -68,7 +68,12 @@ def send_packet_and_verify(self, pkt_size: int, 
should_receive: bool) -> None:
         """
         padding = pkt_size - IP_HEADER_LEN
         # Insert '    ' as placeholder 'CRC' error correction.
-        packet = Ether() / Raw(load="    ") / IP(len=pkt_size) / Raw(load="X" 
* padding)
+        packet = (
+            Ether(dst="FF:FF:FF:FF:FF:FF")
+            / Raw(load="    ")
+            / IP(len=pkt_size)
+            / Raw(load="X" * padding)
+        )
         received_packets = self.send_packet_and_capture(packet)
         found = any(
             ("X" * padding) in str(packets.load)
diff --git a/dts/tests/TestSuite_packet_capture.py 
b/dts/tests/TestSuite_packet_capture.py
index e162bded87..4cefdc97d3 100644
--- a/dts/tests/TestSuite_packet_capture.py
+++ b/dts/tests/TestSuite_packet_capture.py
@@ -28,6 +28,7 @@
 
 from framework.context import get_ctx
 from framework.params import Params
+from framework.params.testpmd import SimpleForwardingModes
 from framework.remote_session.dpdk_shell import compute_eal_params
 from framework.remote_session.interactive_shell import InteractiveShell
 from framework.remote_session.testpmd_shell import TestPmdShell
@@ -118,16 +119,16 @@ def set_up_suite(self) -> None:
         Prepare the packets, file paths and queue range to be used in the test 
suite.
         """
         self.packets = [
-            Ether() / IP() / Raw(b"\0" * 60),
-            Ether() / IP() / TCP() / Raw(b"\0" * 60),
-            Ether() / IP() / UDP() / Raw(b"\0" * 60),
-            Ether() / IP() / SCTP() / Raw(b"\0" * 40),
-            Ether() / IPv6() / TCP() / Raw(b"\0" * 60),
-            Ether() / IPv6() / UDP() / Raw(b"\0" * 60),
-            Ether() / IP() / IPv6() / SCTP() / Raw(b"\0" * 40),
-            Ether() / Dot1Q() / IP() / UDP() / Raw(b"\0" * 40),
+            Ether(dst="FF:FF:FF:FF:FF:FF") / IP() / Raw(b"\0" * 60),
+            Ether(dst="FF:FF:FF:FF:FF:FF") / IP() / TCP() / Raw(b"\0" * 60),
+            Ether(dst="FF:FF:FF:FF:FF:FF") / IP() / UDP() / Raw(b"\0" * 60),
+            Ether(dst="FF:FF:FF:FF:FF:FF") / IP() / SCTP() / Raw(b"\0" * 40),
+            Ether(dst="FF:FF:FF:FF:FF:FF") / IPv6() / TCP() / Raw(b"\0" * 60),
+            Ether(dst="FF:FF:FF:FF:FF:FF") / IPv6() / UDP() / Raw(b"\0" * 60),
+            Ether(dst="FF:FF:FF:FF:FF:FF") / IP() / IPv6() / SCTP() / 
Raw(b"\0" * 40),
+            Ether(dst="FF:FF:FF:FF:FF:FF") / Dot1Q() / IP() / UDP() / 
Raw(b"\0" * 40),
             Ether(dst="FF:FF:FF:FF:FF:FF", type=0x88F7) / Raw(b"\0" * 60),
-            Ether(type=0x88CC)
+            Ether(dst="FF:FF:FF:FF:FF:FF", type=0x88CC)
             / LLDPDUChassisID(subtype=4, 
id=self.topology.tg_port_egress.mac_address)
             / LLDPDUPortID(subtype=5, id="Test Id")
             / LLDPDUTimeToLive(ttl=180)
@@ -192,7 +193,7 @@ def test_dumpcap(self) -> None:
             * The expected packets are the same as the Rx packets.
             * The Tx packets are the same as the packets received from Scapy.
         """
-        with TestPmdShell() as testpmd:
+        with TestPmdShell(forward_mode=SimpleForwardingModes.mac) as testpmd:
             testpmd.start()
             received_packets = self._send_and_dump()
 
@@ -221,7 +222,7 @@ def test_dumpcap_filter(self) -> None:
         Verify:
             * The dumped packets did not contain any of the packets meant for 
filtering.
         """
-        with TestPmdShell() as testpmd:
+        with TestPmdShell(forward_mode=SimpleForwardingModes.mac) as testpmd:
             testpmd.start()
             self._send_and_dump("tcp", rx_only=True)
             filtered_packets = [
diff --git a/dts/tests/TestSuite_queue_start_stop.py 
b/dts/tests/TestSuite_queue_start_stop.py
index d739ddedfe..3a5d4b6147 100644
--- a/dts/tests/TestSuite_queue_start_stop.py
+++ b/dts/tests/TestSuite_queue_start_stop.py
@@ -42,7 +42,7 @@ def send_packet_and_verify(self, should_receive: bool = True) 
-> None:
         Args:
             should_receive: Indicate whether the packet should be received.
         """
-        packet = Ether() / IP() / Raw(load="xxxxx")
+        packet = Ether(dst="FF:FF:FF:FF:FF:FF") / IP() / Raw(load="xxxxx")
         received = self.send_packet_and_capture(packet)
         contains_packet = any(
             packet.haslayer(Raw) and b"xxxxx" in packet.load for packet in 
received
diff --git a/dts/tests/TestSuite_vlan.py b/dts/tests/TestSuite_vlan.py
index d2a9e614d4..1cc5a200d4 100644
--- a/dts/tests/TestSuite_vlan.py
+++ b/dts/tests/TestSuite_vlan.py
@@ -48,7 +48,7 @@ def send_vlan_packet_and_verify(self, should_receive: bool, 
strip: bool, vlan_id
                 (as it has been stripped off.)
             vlan_id: Expected VLAN ID.
         """
-        packet = Ether() / Dot1Q(vlan=vlan_id) / Raw(load="xxxxx")
+        packet = Ether(dst="FF:FF:FF:FF:FF:FF") / Dot1Q(vlan=vlan_id) / 
Raw(load="xxxxx")
         received_packets = self.send_packet_and_capture(packet)
         test_packet = None
         for packet in received_packets:
@@ -83,7 +83,7 @@ def send_packet_and_verify_insertion(self, expected_id: int) 
-> None:
         Args:
             expected_id: The VLAN id that is being inserted through tx_offload 
configuration.
         """
-        packet = Ether() / Raw(load="xxxxx")
+        packet = Ether(dst="FF:FF:FF:FF:FF:FF") / Raw(load="xxxxx")
         received_packets = self.send_packet_and_capture(packet)
         test_packet = None
         for packet in received_packets:
-- 
2.49.0

Reply via email to