[PATCH v4] dts: port speed capabilities test suite to next DTS
Andrew Bailey
abailey at iol.unh.edu
Mon Mar 9 18:57:18 CET 2026
This commit ports the speed capabilities test suite from old DTS to next
DTS.
Bugzilla ID: 1494
Signed-off-by: Andrew Bailey <abailey at iol.unh.edu>
---
.../tests.TestSuite_speed_capabilities.rst | 8 +++
dts/configurations/tests_config.example.yaml | 6 +-
dts/tests/TestSuite_speed_capabilities.py | 67 +++++++++++++++++++
3 files changed, 80 insertions(+), 1 deletion(-)
create mode 100644 doc/api/dts/tests.TestSuite_speed_capabilities.rst
create mode 100644 dts/tests/TestSuite_speed_capabilities.py
diff --git a/doc/api/dts/tests.TestSuite_speed_capabilities.rst b/doc/api/dts/tests.TestSuite_speed_capabilities.rst
new file mode 100644
index 0000000000..de6dc42757
--- /dev/null
+++ b/doc/api/dts/tests.TestSuite_speed_capabilities.rst
@@ -0,0 +1,8 @@
+.. SPDX-License-Identifier: BSD-3-Clause
+
+speed_capabilities Test Suite
+=============================
+
+.. automodule:: tests.TestSuite_speed_capabilities
+ :members:
+ :show-inheritance:
diff --git a/dts/configurations/tests_config.example.yaml b/dts/configurations/tests_config.example.yaml
index 209d7dd393..82f0c312c4 100644
--- a/dts/configurations/tests_config.example.yaml
+++ b/dts/configurations/tests_config.example.yaml
@@ -29,4 +29,8 @@ hello_world:
# - buff_size: 64
# Gbps: 2.0 # Set gigabits per second according to your devices throughput for this given buffer size
# - buff_size: 512
-# Gbps: 20.0
\ No newline at end of file
+# Gbps: 20.0
+# port_speed_capabilities:
+# test_parameters:
+# 0 : 100 Gbps # Assign an expected link speed to a port ID in Gbps
+# 1 : 100 Gbps
\ No newline at end of file
diff --git a/dts/tests/TestSuite_speed_capabilities.py b/dts/tests/TestSuite_speed_capabilities.py
new file mode 100644
index 0000000000..5eeb4095b7
--- /dev/null
+++ b/dts/tests/TestSuite_speed_capabilities.py
@@ -0,0 +1,67 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2026 University of New Hampshire
+
+"""Speed capability test suite.
+
+This test suite ensures that testpmd recognizes the expected speed from a link in Gbps.
+"""
+
+from typing import Literal
+
+from api.capabilities import (
+ LinkTopology,
+ requires_link_topology,
+)
+from api.test import verify
+from api.testpmd import TestPmd
+from framework.test_suite import BaseConfig, TestSuite, func_test
+
+
+class Config(BaseConfig):
+ """Performance test metrics."""
+
+ test_parameters: dict[
+ int,
+ Literal[
+ "1 Gbps",
+ "10 Gbps",
+ "25 Gbps",
+ "40 Gbps",
+ "100 Gbps",
+ "200 Gbps",
+ "400 Gbps",
+ "800 Gbps",
+ "1600 Gbps",
+ ],
+ ] = {
+ 0: "100 Gbps",
+ }
+
+
+ at requires_link_topology(LinkTopology.ONE_LINK)
+class TestSpeedCapabilities(TestSuite):
+ """Speed capabilities test suite."""
+
+ config: Config
+
+ def set_up_suite(self):
+ """Set up the test suite."""
+ self.test_parameters = self.config.test_parameters
+
+ @func_test
+ def validate_port_speed(self) -> None:
+ """Validate expected port speed is also the observed port speed.
+
+ Steps:
+ * Show port info for each available port
+
+ Verify:
+ * The resulting link speeds are equal to the configured link speeds
+ """
+ with TestPmd() as testpmd:
+ for i, param in enumerate(self.test_parameters.items()):
+ link_speed = testpmd.show_port_info(i).link_speed
+ verify(
+ link_speed == param[1],
+ f"port {i} speed {link_speed} does not match configured '{param[1]}'",
+ )
--
2.50.1
More information about the dev
mailing list