DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Wilks <thomas.wilks@arm.com>
To: dev@dpdk.org
Cc: Thomas Wilks <thomas.wilks@arm.com>,
	Paul Szczepanek <paul.szczepanek@arm.com>
Subject: [PATCH v1 2/2] dts: add port restart configuration persistency test
Date: Tue, 10 Dec 2024 14:11:43 +0000	[thread overview]
Message-ID: <20241210141144.231010-2-thomas.wilks@arm.com> (raw)
In-Reply-To: <20241210141144.231010-1-thomas.wilks@arm.com>

Added test that sets various port settings and verifies
that they persist after a port restart.

Signed-off-by: Thomas Wilks <thomas.wilks@arm.com>
Reviewed-by: Paul Szczepanek <paul.szczepanek@arm.com>
---
 ...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


  reply	other threads:[~2024-12-10 14:12 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-10 14:11 [PATCH v1 1/2] dts: add new testpmd shell functions Thomas Wilks
2024-12-10 14:11 ` Thomas Wilks [this message]
2024-12-12 13:28 ` [PATCH v2 0/2] dts: Add port restart configuration persistency testsuite Thomas Wilks
2024-12-12 13:28   ` [PATCH v2 1/2] dts: add new testpmd shell functions Thomas Wilks
2024-12-12 13:28   ` [PATCH v2 2/2] dts: add port restart configuration persistency test 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=20241210141144.231010-2-thomas.wilks@arm.com \
    --to=thomas.wilks@arm.com \
    --cc=dev@dpdk.org \
    --cc=paul.szczepanek@arm.com \
    /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