From: Patrick Robb <probb@iol.unh.edu>
To: Dean Marx <dmarx@iol.unh.edu>
Cc: luca.vizzarro@arm.com, yoan.picchi@foss.arm.com,
Honnappa.Nagarahalli@arm.com, paul.szczepanek@arm.com,
dev@dpdk.org
Subject: Re: [PATCH v3 2/2] dts: add flow validation
Date: Fri, 27 Jun 2025 00:29:23 -0400 [thread overview]
Message-ID: <CAJvnSUAph0-X2nnap6e-dyPVriuGgjSFNmgmoKSpuY9u-37Z0w@mail.gmail.com> (raw)
In-Reply-To: <20250626195617.219395-2-dmarx@iol.unh.edu>
[-- Attachment #1: Type: text/plain, Size: 4322 bytes --]
Applied to next-dts, thanks.
On Thu, Jun 26, 2025 at 3:56 PM Dean Marx <dmarx@iol.unh.edu> wrote:
> Add a method for validating flow rules to the testpmd shell class.
> Implement test case skipping for flow rules that do not pass
> validation.
>
> Signed-off-by: Dean Marx <dmarx@iol.unh.edu>
> Reviewed-by: Patrick Robb <probb@iol.unh.edu>
> ---
> dts/framework/remote_session/testpmd_shell.py | 15 +++++++++++++
> dts/framework/test_run.py | 3 +++
> dts/framework/test_suite.py | 21 ++++++++++++++++++-
> 3 files changed, 38 insertions(+), 1 deletion(-)
>
> diff --git a/dts/framework/remote_session/testpmd_shell.py
> b/dts/framework/remote_session/testpmd_shell.py
> index 0b9bb4070a..299887dd80 100644
> --- a/dts/framework/remote_session/testpmd_shell.py
> +++ b/dts/framework/remote_session/testpmd_shell.py
> @@ -1984,6 +1984,21 @@ def flow_create(self, flow_rule: FlowRule, port_id:
> int) -> int:
> self._logger.debug(f"Failed to create flow
> rule:\n{flow_output}")
> raise InteractiveCommandExecutionError(f"Failed to create
> flow rule:\n{flow_output}")
>
> + def flow_validate(self, flow_rule: FlowRule, port_id: int) -> bool:
> + """Validates a flow rule in the testpmd session.
> +
> + Args:
> + flow_rule: :class:`FlowRule` object used for validating
> testpmd flow rule.
> + port_id: Integer representing the port to use.
> +
> + Returns:
> + Boolean representing whether rule is valid or not.
> + """
> + flow_output = self.send_command(f"flow validate {port_id}
> {flow_rule}")
> + if "Flow rule validated" in flow_output:
> + return True
> + return False
> +
> def flow_delete(self, flow_id: int, port_id: int, verify: bool =
> True) -> None:
> """Deletes the specified flow rule from the testpmd session.
>
> diff --git a/dts/framework/test_run.py b/dts/framework/test_run.py
> index 10a5e1a6b8..fd49a7dc74 100644
> --- a/dts/framework/test_run.py
> +++ b/dts/framework/test_run.py
> @@ -655,6 +655,9 @@ def next(self) -> State | None:
> return self
>
> self.result.update(Result.FAIL, e)
> + except SkippedTestException as e:
> + self.logger.info(f"{self.description.capitalize()} SKIPPED:
> {e}")
> + self.result.update(Result.SKIP, e)
> else:
> self.result.update(Result.PASS)
> self.logger.info(f"{self.description.capitalize()} PASSED.")
> diff --git a/dts/framework/test_suite.py b/dts/framework/test_suite.py
> index e5fbadd1a1..145b79496f 100644
> --- a/dts/framework/test_suite.py
> +++ b/dts/framework/test_suite.py
> @@ -39,7 +39,7 @@
> PacketFilteringConfig,
> )
>
> -from .exception import ConfigurationError, InternalError,
> TestCaseVerifyError
> +from .exception import ConfigurationError, InternalError,
> SkippedTestException, TestCaseVerifyError
> from .logger import DTSLogger, get_dts_logger
> from .utils import get_packet_summaries, to_pascal_case
>
> @@ -411,6 +411,25 @@ def _fail_test_case_verify(self, failure_description:
> str) -> None:
> self._logger.debug(command_res.command)
> raise TestCaseVerifyError(failure_description)
>
> + def verify_else_skip(self, condition: bool, skip_reason: str) -> None:
> + """Verify `condition` and handle skips.
> +
> + When `condition` is :data:`False`, raise a skip exception.
> +
> + Args:
> + condition: The condition to check.
> + skip_reason: Description of the reason for skipping.
> +
> + Raises:
> + SkippedTestException: `condition` is :data:`False`.
> + """
> + if not condition:
> + self._skip_test_case_verify(skip_reason)
> +
> + def _skip_test_case_verify(self, skip_description: str) -> None:
> + self._logger.debug(f"Test case skipped: {skip_description}")
> + raise SkippedTestException(skip_description)
> +
> def verify_packets(self, expected_packet: Packet, received_packets:
> list[Packet]) -> None:
> """Verify that `expected_packet` has been received.
>
> --
> 2.49.0
>
>
[-- Attachment #2: Type: text/html, Size: 5464 bytes --]
next prev parent reply other threads:[~2025-06-27 4:34 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-15 16:38 [RFC PATCH 0/1] rte flow test suite Dean Marx
2025-05-15 16:38 ` [RFC PATCH] dts: add " Dean Marx
2025-05-19 18:19 ` [PATCH v1 1/2] " Dean Marx
2025-05-19 18:19 ` [PATCH v1 2/2] dts: add jump and priority tests to flow suite Dean Marx
2025-05-21 19:26 ` [PATCH v2 1/3] dts: add rte flow test suite Dean Marx
2025-05-21 19:26 ` [PATCH v2 2/3] dts: add jump and priority tests to flow suite Dean Marx
2025-06-25 17:25 ` Patrick Robb
2025-05-21 19:26 ` [PATCH v2 3/3] dts: add flow validation Dean Marx
2025-06-25 17:38 ` Patrick Robb
2025-06-26 19:56 ` [PATCH v3 1/2] dts: add rte flow test suite Dean Marx
2025-06-26 19:56 ` [PATCH v3 2/2] dts: add flow validation Dean Marx
2025-06-27 4:29 ` Patrick Robb [this message]
2025-06-27 4:29 ` [PATCH v3 1/2] dts: add rte flow test suite Patrick Robb
2025-06-25 17:15 ` [PATCH v2 1/3] " Patrick Robb
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=CAJvnSUAph0-X2nnap6e-dyPVriuGgjSFNmgmoKSpuY9u-37Z0w@mail.gmail.com \
--to=probb@iol.unh.edu \
--cc=Honnappa.Nagarahalli@arm.com \
--cc=dev@dpdk.org \
--cc=dmarx@iol.unh.edu \
--cc=luca.vizzarro@arm.com \
--cc=paul.szczepanek@arm.com \
--cc=yoan.picchi@foss.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;
as well as URLs for NNTP newsgroup(s).