From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by smtp.lore.kernel.org (Postfix) with ESMTP id CD07AE7717F for ; Thu, 12 Dec 2024 13:28:45 +0000 (UTC) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DF64240611; Thu, 12 Dec 2024 14:28:40 +0100 (CET) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mails.dpdk.org (Postfix) with ESMTP id C12FA402EE for ; Thu, 12 Dec 2024 14:28:38 +0100 (CET) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 5753B153B; Thu, 12 Dec 2024 05:29:06 -0800 (PST) Received: from e132991.cambridge.arm.com (unknown [10.1.195.55]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 8740B3F58B; Thu, 12 Dec 2024 05:28:37 -0800 (PST) From: Thomas Wilks To: dev@dpdk.org Cc: Patrick Robb , Thomas Wilks , Paul Szczepanek Subject: [PATCH v2 2/2] dts: add port restart configuration persistency test Date: Thu, 12 Dec 2024 13:28:07 +0000 Message-ID: <20241212132807.263829-3-thomas.wilks@arm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241212132807.263829-1-thomas.wilks@arm.com> References: <20241210141144.231010-1-thomas.wilks@arm.com> <20241212132807.263829-1-thomas.wilks@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Added test that sets various port settings and verifies that they persist after a port restart. Signed-off-by: Thomas Wilks Reviewed-by: Paul Szczepanek --- ...stSuite_port_restart_config_persistency.py | 101 ++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100644 dts/tests/TestSuite_port_restart_config_persistency.py diff --git a/dts/tests/TestSuite_port_restart_config_persistency.py b/dts/tests/TestSuite_port_restart_config_persistency.py new file mode 100644 index 0000000000..ad42c6c2e6 --- /dev/null +++ b/dts/tests/TestSuite_port_restart_config_persistency.py @@ -0,0 +1,101 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2024 Arm Limited + +"""Port config persistency test suite. + +Changes configuration of ports and verifies that the configuration persists after a +port is restarted. +""" + +from dataclasses import asdict + +from framework.remote_session.testpmd_shell import TestPmdPortFlowCtrl, TestPmdShell +from framework.test_suite import TestSuite, func_test +from framework.testbed_model.capability import NicCapability, requires + +ALTERNATIVE_MTU: int = 800 +STANDARD_MTU: int = 1500 +ALTERNATIVE_MAC_ADDRESS: str = "42:A6:B7:9E:B4:81" + + +class TestPortRestartConfigPersistency(TestSuite): + """Port config persistency test suite.""" + + def restart_port_and_verify(self, id, testpmd, changed_value) -> None: + """Fetch port config, restart and verify persistency.""" + testpmd.start_all_ports() + testpmd.wait_link_status_up(port_id=id, timeout=10) + + port_info_before = testpmd.show_port_info(id) + all_info_before = asdict(port_info_before) + + flow_info_before = testpmd.show_port_flow_info(id) + + if flow_info_before: + all_info_before.update(asdict(flow_info_before)) + + testpmd.stop_all_ports() + testpmd.start_all_ports() + testpmd.wait_link_status_up(port_id=id, timeout=10) + + port_info_after = testpmd.show_port_info(id) + all_info_after = asdict(port_info_after) + + flow_info_after = testpmd.show_port_flow_info(id) + if flow_info_after: + all_info_after.update(asdict(flow_info_after)) + + self.verify( + all_info_before == all_info_after, + f"Port configuration for {changed_value} was not retained through port restart.", + ) + testpmd.stop_all_ports() + + @func_test + def port_configuration_persistence(self) -> None: + """Port restart configuration persistency test. + + Steps: + For each port set the port MTU, VLAN filter, mac address, and promiscuous mode. + + Verify: + The configuration persists after the port is restarted. + """ + with TestPmdShell(self.sut_node, disable_device_start=True) as testpmd: + for port_id in range(len(self.sut_node.ports)): + testpmd.set_port_mtu(port_id=port_id, mtu=STANDARD_MTU, verify=True) + self.restart_port_and_verify(port_id, testpmd, "MTU") + + testpmd.set_port_mtu(port_id=port_id, mtu=ALTERNATIVE_MTU, verify=True) + self.restart_port_and_verify(port_id, testpmd, "MTU") + + testpmd.set_vlan_filter(port=port_id, enable=True, verify=True) + self.restart_port_and_verify(port_id, testpmd, "VLAN filter") + + testpmd.set_mac_address( + port=port_id, mac_address=ALTERNATIVE_MAC_ADDRESS, verify=True + ) + self.restart_port_and_verify(port_id, testpmd, "MAC address") + + testpmd.set_promisc(port=port_id, enable=True, verify=True) + self.restart_port_and_verify(port_id, testpmd, "promiscuous mode") + + @requires(NicCapability.FLOW_CTRL) + @func_test + def flow_ctrl_port_configuration_persistence(self) -> None: + """Flow control port configuration persistency test. + + Steps: + For each port enable flow control for RX and TX individually. + Verify: + The configuration persists after the port is restarted. + """ + with TestPmdShell(self.sut_node, disable_device_start=True) as testpmd: + for port_id in range(len(self.sut_node.ports)): + flow_ctrl = TestPmdPortFlowCtrl(rx=True) + testpmd.set_flow_control(port=port_id, flow_ctrl=flow_ctrl) + self.restart_port_and_verify(port_id, testpmd, "flow_ctrl") + + flow_ctrl = TestPmdPortFlowCtrl(tx=True) + testpmd.set_flow_control(port=port_id, flow_ctrl=flow_ctrl) + self.restart_port_and_verify(port_id, testpmd, "flow_ctrl") -- 2.43.0