From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 8A13046A68; Fri, 27 Jun 2025 06:34:54 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 79CE24060B; Fri, 27 Jun 2025 06:34:54 +0200 (CEST) Received: from mail-pj1-f54.google.com (mail-pj1-f54.google.com [209.85.216.54]) by mails.dpdk.org (Postfix) with ESMTP id 22575402DC for ; Fri, 27 Jun 2025 06:34:52 +0200 (CEST) Received: by mail-pj1-f54.google.com with SMTP id 98e67ed59e1d1-31393526d0dso1180884a91.0 for ; Thu, 26 Jun 2025 21:34:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; t=1750998891; x=1751603691; darn=dpdk.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=IHZjeuQNGWAvb7Q3mPuG7jiHPKguqibYN5ZhapnDLOc=; b=TzEl7GYWfn06ic7HSaafezVPB0eoXYWvRG903DyqQqVJ0+zgTEPN3hAJX/BnIxjxTM QfHtQWUBbBlRv9hmb1DC8hGU0DQwCytiJjXV9pKwRJYjyObxgFwhmnTjQihRLO1h6l+n hyALzeyTVe3FKTC/OR+LNoktEMIdXw5EMA2Is= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1750998891; x=1751603691; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=IHZjeuQNGWAvb7Q3mPuG7jiHPKguqibYN5ZhapnDLOc=; b=p31m5ye0Hl5Z8nUkdjBJQY5ov6EsigeWNwU5RlwM3D5I/Y7rVBkHRXvUM9KqT2GZMB 1fd/XsZx7A6bRaGguogsY1bC8zLtU5bxRCvwCcxwZzhs6Lq93P/2SRTCvf1FwqLsbg5j PVnS3n5fiz5Yn7oreEAFVjUWbwk7ySGOlzv3InF9VnjFM937pAa7TQneEnKCbSBzTMxD R2JbGI5flM/6kZX1EJBIt/qNxWR9FknrVxw9wWfp/VsIViTiw7+b7LTOD7GC2/0rvxnd xPtENvIB9EUbf4yGGKTgCZmFfvdWr5FtyxnEEGLhWTMNuZDAEzFU3ewuKKkPKmCHSBQe 2bZQ== X-Forwarded-Encrypted: i=1; AJvYcCXJKnghGRfysn3Q6HduDUXS22x66Bt0TFSWiomucjvB/stcwWNJM8Ou0nR3HaKyqZPcOso=@dpdk.org X-Gm-Message-State: AOJu0Yy0zh69LmWopQuQSE7g31ppHtMeB086oWfHmOettauYWvUdYlUA LCFVnhQEzVpznVAM6gKO3mug3PA3Gfu503O0ZD/bWCOM0mSZt+PwebYc01Nc5y7MPurdAlXurCQ 0zO7hLGI4/5XuO597rm+t6yjtx1CvjtVxrOnjVr2L1w== X-Gm-Gg: ASbGncv9UCGW6R93LJyBFtKI+LwbxNxhp8E5tD60RtGo5mueiXFKg/1wJ4AyIdW2Skh wV6yLCjYzj8lQ64/RPD+KBsmH4BjgrxtDLZf2h8GaFB4pwiGV3nfm/NmiyLbyNLAoxCERXg8zph yfnPvGgjzAfN44NHIFz35lniQgktS9yZcegkdYnn+z2d/i+zdwx++jihQ2owM= X-Google-Smtp-Source: AGHT+IH8H7qr+9J2LY2PLE6kND+BK6d0a3Bim2LAU8lRWjd4YoHbaWtZSmYFbvmXBUEr1Wit+4cNYHfoirrjkKM8kXs= X-Received: by 2002:a17:90b:2e52:b0:313:287e:f1e8 with SMTP id 98e67ed59e1d1-318c9218fb8mr2678087a91.8.1750998891231; Thu, 26 Jun 2025 21:34:51 -0700 (PDT) MIME-Version: 1.0 References: <20250521192629.294265-3-dmarx@iol.unh.edu> <20250626195617.219395-1-dmarx@iol.unh.edu> <20250626195617.219395-2-dmarx@iol.unh.edu> In-Reply-To: <20250626195617.219395-2-dmarx@iol.unh.edu> From: Patrick Robb Date: Fri, 27 Jun 2025 00:29:23 -0400 X-Gm-Features: Ac12FXxY6a6d55DR38eK-zTrBjh25c_g0COo0UsRuNrzCnWiq50YEZ1Y-KcL_p4 Message-ID: Subject: Re: [PATCH v3 2/2] dts: add flow validation To: Dean Marx Cc: luca.vizzarro@arm.com, yoan.picchi@foss.arm.com, Honnappa.Nagarahalli@arm.com, paul.szczepanek@arm.com, dev@dpdk.org Content-Type: multipart/alternative; boundary="000000000000ea123b06388632ec" 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 --000000000000ea123b06388632ec Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Applied to next-dts, thanks. On Thu, Jun 26, 2025 at 3:56=E2=80=AFPM Dean Marx 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 > Reviewed-by: Patrick Robb > --- > 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 =3D 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 =3D > 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) -> Non= e: > + """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 > > --000000000000ea123b06388632ec Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Applied to next-dts, thanks.

On Thu, = Jun 26, 2025 at 3:56=E2=80=AFPM Dean Marx <dmarx@iol.unh.edu> wrote:
Add a method for validating flow rules to the test= pmd 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>
---
=C2=A0dts/framework/remote_session/testpmd_shell.py | 15 +++++++++++++
=C2=A0dts/framework/test_run.py=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0|=C2=A0 3 +++
=C2=A0dts/framework/test_suite.py=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0| 21 ++++++++++++++++++-
=C2=A03 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:
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0self._logger.debug(f"F= ailed to create flow rule:\n{flow_output}")
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0raise InteractiveCommandExe= cutionError(f"Failed to create flow rule:\n{flow_output}")

+=C2=A0 =C2=A0 def flow_validate(self, flow_rule: FlowRule, port_id: int) -= > bool:
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 """Validates a flow rule in the= testpmd session.
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 Args:
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 flow_rule: :class:`FlowRule` obj= ect used for validating testpmd flow rule.
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 port_id: Integer representing th= e port to use.
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 Returns:
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Boolean representing whether rul= e is valid or not.
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 """
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 flow_output =3D self.send_command(f"flow = validate {port_id} {flow_rule}")
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 if "Flow rule validated" in flow_out= put:
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return True
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 return False
+
=C2=A0 =C2=A0 =C2=A0def flow_delete(self, flow_id: int, port_id: int, verif= y: bool =3D True) -> None:
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"""Deletes the specified f= low 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:
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return self
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0self.result.update(Result.F= AIL, e)
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 except SkippedTestException as e:
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 self.logger.info(f"{self.= description.capitalize()} SKIPPED: {e}")
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 self.result.update(Result.SKIP, = e)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0else:
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0self.result.update(Result.P= ASS)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0self.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 @@
=C2=A0 =C2=A0 =C2=A0PacketFilteringConfig,
=C2=A0)

-from .exception import ConfigurationError, InternalError, TestCaseVerifyEr= ror
+from .exception import ConfigurationError, InternalError, SkippedTestExcep= tion, TestCaseVerifyError
=C2=A0from .logger import DTSLogger, get_dts_logger
=C2=A0from .utils import get_packet_summaries, to_pascal_case

@@ -411,6 +411,25 @@ def _fail_test_case_verify(self, failure_description: = str) -> None:
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0self._logger.debug(command_= res.command)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0raise TestCaseVerifyError(failure_descrip= tion)

+=C2=A0 =C2=A0 def verify_else_skip(self, condition: bool, skip_reason: str= ) -> None:
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 """Verify `condition` and handl= e skips.
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 When `condition` is :data:`False`, raise a ski= p exception.
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 Args:
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 condition: The condition to chec= k.
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 skip_reason: Description of the = reason for skipping.
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 Raises:
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 SkippedTestException: `condition= ` is :data:`False`.
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 """
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 if not condition:
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 self._skip_test_case_verify(skip= _reason)
+
+=C2=A0 =C2=A0 def _skip_test_case_verify(self, skip_description: str) ->= ; None:
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 self._logger.debug(f"Test case skipped: {= skip_description}")
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 raise SkippedTestException(skip_description) +
=C2=A0 =C2=A0 =C2=A0def verify_packets(self, expected_packet: Packet, recei= ved_packets: list[Packet]) -> None:
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"""Verify that `expected_p= acket` has been received.

--
2.49.0

--000000000000ea123b06388632ec--