From: Thomas Wilks <thomas.wilks@arm.com>
To: dev@dpdk.org
Cc: Paul Szczepanek <paul.szczepanek@arm.com>,
Luca Vizzarro <luca.vizzarro@arm.com>,
Patrick Robb <probb@iol.unh.edu>,
Thomas Wilks <thomas.wilks@arm.com>
Subject: [PATCH v1 1/2] dts: add promiscuous mode verification test
Date: Thu, 16 Jan 2025 13:16:14 +0000 [thread overview]
Message-ID: <20250116131615.196053-2-thomas.wilks@arm.com> (raw)
In-Reply-To: <20250116131615.196053-1-thomas.wilks@arm.com>
Added verification that enables promiscuous mode,
sends a packet with a different destination mac address
and then disables promiscuous mode, sends the same packet
and checks if the packet was filtered out.
Signed-off-by: Thomas Wilks <thomas.wilks@arm.com>
---
Reviewed-by: Luca Vizzarro <luca.vizzarro@arm.com>
Reviewed-by: Paul Szczepanek <paul.szczepanek@arm.com>
---
dts/tests/TestSuite_promisc_support.py | 63 ++++++++++++++++++++++++++
1 file changed, 63 insertions(+)
create mode 100644 dts/tests/TestSuite_promisc_support.py
diff --git a/dts/tests/TestSuite_promisc_support.py b/dts/tests/TestSuite_promisc_support.py
new file mode 100644
index 0000000000..a3ea2461f0
--- /dev/null
+++ b/dts/tests/TestSuite_promisc_support.py
@@ -0,0 +1,63 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2025 Arm Limited
+
+"""Promiscuous mode support test suite.
+
+Test promiscuous support by sending a packet with a different destination
+mac address from the TG to the SUT.
+"""
+
+from scapy.layers.inet import IP
+from scapy.layers.l2 import Ether
+from scapy.packet import Raw
+
+from framework.remote_session.testpmd_shell import TestPmdShell
+from framework.test_suite import TestSuite, func_test
+
+
+class TestPromiscSupport(TestSuite):
+ """Promiscuous mode support test suite."""
+
+ #: Alternate MAC address.
+ ALTERNATIVE_MAC_ADDRESS: str = "02:00:00:00:00:00"
+
+ @func_test
+ def test_promisc_packets(self) -> None:
+ """Verify that promiscuous mode works.
+
+ Steps:
+ Create a packet with a different mac address to the destination.
+ Enable promiscuous mode.
+ Send and receive packet.
+ Disable promiscuous mode.
+ Send and receive packet.
+ Verify:
+ Packet sent with the wrong address is received in promiscuous mode and filtered out
+ otherwise.
+
+ """
+ packet = [Ether(dst=self.ALTERNATIVE_MAC_ADDRESS) / IP() / Raw(load=b"\x00" * 64)]
+
+ with TestPmdShell(
+ self.sut_node,
+ ) as testpmd:
+ for port_id in range(len(self.sut_node.ports)):
+ testpmd.set_promisc(port=port_id, enable=True, verify=True)
+ testpmd.start()
+
+ received_packets = self.send_packets_and_capture(packet)
+ expected_packets = self.get_expected_packets(packet, sent_from_tg=True)
+ self.match_all_packets(expected_packets, received_packets)
+
+ testpmd.stop()
+
+ for port_id in range(len(self.sut_node.ports)):
+ testpmd.set_promisc(port=port_id, enable=False, verify=True)
+ testpmd.start()
+
+ received_packets = self.send_packets_and_capture(packet)
+ expected_packets = self.get_expected_packets(packet, sent_from_tg=True)
+ self.verify(
+ not self.match_all_packets(expected_packets, received_packets, verify=False),
+ "Invalid packet wasn't filtered out.",
+ )
--
2.43.0
next prev parent reply other threads:[~2025-01-16 13:16 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-16 13:16 [PATCH v1 0/2] " Thomas Wilks
2025-01-16 13:16 ` Thomas Wilks [this message]
2025-01-16 13:16 ` [PATCH v1 2/2] dts: add verify to match all packets Thomas Wilks
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250116131615.196053-2-thomas.wilks@arm.com \
--to=thomas.wilks@arm.com \
--cc=dev@dpdk.org \
--cc=luca.vizzarro@arm.com \
--cc=paul.szczepanek@arm.com \
--cc=probb@iol.unh.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).