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 E6EBCE7717F for ; Tue, 10 Dec 2024 14:12:03 +0000 (UTC) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3A7BD402E1; Tue, 10 Dec 2024 15:12:03 +0100 (CET) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mails.dpdk.org (Postfix) with ESMTP id 9C5C040261 for ; Tue, 10 Dec 2024 15:12:01 +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 22644106F; Tue, 10 Dec 2024 06:12:29 -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 5F15E3F58B; Tue, 10 Dec 2024 06:12:00 -0800 (PST) From: Thomas Wilks To: dev@dpdk.org Cc: Thomas Wilks , Paul Szczepanek Subject: [PATCH v1 2/2] dts: add port restart configuration persistency test Date: Tue, 10 Dec 2024 14:11:43 +0000 Message-ID: <20241210141144.231010-2-thomas.wilks@arm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241210141144.231010-1-thomas.wilks@arm.com> References: <20241210141144.231010-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 | 117 ++++++++++++++++++ 1 file changed, 117 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..969b96d422 --- /dev/null +++ b/dts/tests/TestSuite_port_restart_config_persistency.py @@ -0,0 +1,117 @@ +# 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 framework.remote_session.testpmd_shell import 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 +ALTERNATITVE_MAC_ADDRESS: str = "40:A6:B7:9E:B4:81" + + +class TestPortRestartConfigPersistency(TestSuite): + """Port config persistency Test suite.""" + + def restart_port_and_verify(self, id, testpmd, changed_value) -> None: + """Fetches all of the port configs, restarts all of the ports, fetches all the port + configs again and then compares the two the configs and varifies that they are the same. + """ + + 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 = port_info_before.__dict__ + try: + flow_info_before = testpmd.show_port_flow_info(id) + all_info_before.update(flow_info_before.__dict__) + except: + pass + + 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 = port_info_after.__dict__ + try: + flow_info_after = testpmd.show_port_flow_info(id) + all_info_after.update(flow_info_after.__dict__) + except: + pass + + 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, VF mode, and Promiscuous Mode. + + Verify: + Check that the configuration persists after the port is restarted. + """ + + with TestPmdShell(self.sut_node) as testpmd: + testpmd.stop_all_ports() + all_ports = [port.id for port in testpmd.show_port_info_all()] + for port_id in all_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=ALTERNATITVE_MAC_ADDRESS) + + self.restart_port_and_verify(port_id, testpmd, "mac_address") + + testpmd.set_port_VF_mode(port=port_id, vf_id=port_id, rxmode="AUPE", enable=True) + + self.restart_port_and_verify(port_id, testpmd, "VF_mode") + + testpmd.set_promisc(port=port_id, enable=True, verify=False) + + 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 restart configuration Persistency Test. + + Steps: + For each port enable flow control for RX and TX individualy. + Verify: + Check that the configuration persists after the port is restarted. + """ + + with TestPmdShell(self.sut_node) as testpmd: + testpmd.stop_all_ports() + all_ports = [port.id for port in testpmd.show_port_info_all()] + for port_id in all_ports: + + testpmd.set_flow_control(port=port_id, rx=True, tx=False) + + self.restart_port_and_verify(port_id, testpmd, "flow_ctrl") + + testpmd.set_flow_control(port=port_id, rx=False, tx=True) + + self.restart_port_and_verify(port_id, testpmd, "flow_ctrl") -- 2.43.0