This commit ports the speed capabilities test suite from old DTS to next DTS.
Bugzilla ID: 1494 Signed-off-by: Andrew Bailey <[email protected]> --- .../tests.TestsSuite_speed_capabilities.rst | 8 +++ dts/configurations/tests_config.example.yaml | 4 ++ dts/tests/TestSuite_speed_capabilities.py | 54 +++++++++++++++++++ 3 files changed, 66 insertions(+) create mode 100644 doc/api/dts/tests.TestsSuite_speed_capabilities.rst create mode 100644 dts/tests/TestSuite_speed_capabilities.py diff --git a/doc/api/dts/tests.TestsSuite_speed_capabilities.rst b/doc/api/dts/tests.TestsSuite_speed_capabilities.rst new file mode 100644 index 0000000000..de6dc42757 --- /dev/null +++ b/doc/api/dts/tests.TestsSuite_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 64fa630aa0..bdc4c49a1c 100644 --- a/dts/configurations/tests_config.example.yaml +++ b/dts/configurations/tests_config.example.yaml @@ -15,3 +15,7 @@ hello_world: # num_descriptors: 1024 # expected_mpps: 1.0 # delta_tolerance: 0.05 +# port_speed_capabilities: +# test_parameters: +# 0 : 100 Gbps # set link speed according to your expected speed 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..9ab488ab1b --- /dev/null +++ b/dts/tests/TestSuite_speed_capabilities.py @@ -0,0 +1,54 @@ +# 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"]] = { + 0: "100 Gbps", + } + + +@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

