[v1,1/4] dts: add layer 4 port field to verbose parser

Message ID 20250306214747.579340-2-dmarx@iol.unh.edu (mailing list archive)
State Superseded
Delegated to: Paul Szczepanek
Headers
Series dts: change verbose packet verification to layer 4 ports |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Dean Marx March 6, 2025, 9:47 p.m. UTC
Add a field to the TestPmdVerbosePacket text parser
that stores destination port values for TCP/UDP packets.

Signed-off-by: Dean Marx <dmarx@iol.unh.edu>
---
 dts/framework/remote_session/testpmd_shell.py | 5 +++++
 1 file changed, 5 insertions(+)
  

Comments

Luca Vizzarro May 14, 2025, 3:37 p.m. UTC | #1
Hi Dean,

looks good to me. Just a minor optional nit.

Reviewed-by: Luca Vizzarro <luca.vizzarro@arm.com>

On 06/03/2025 22:47, Dean Marx wrote:
> +    #:
> +    l4_dport: int | None = field(
> +        default=None,
> +        metadata=TextParser.find_int(r"(?:Destination TCP port=|Destination UDP port=)(\d+)"),
> +    )

the regex can be simplified:

   r"Destination (?:TCP|UDP) port=(\d+)"
  
Nicholas Pratte May 14, 2025, 8:12 p.m. UTC | #2
Makes sense to me!

Reviewed-by: Nicholas Pratte <npratte@iol.unh.edu>

On Thu, Mar 6, 2025 at 4:47 PM Dean Marx <dmarx@iol.unh.edu> wrote:
>
> Add a field to the TestPmdVerbosePacket text parser
> that stores destination port values for TCP/UDP packets.
>
> Signed-off-by: Dean Marx <dmarx@iol.unh.edu>
> ---
>  dts/framework/remote_session/testpmd_shell.py | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/dts/framework/remote_session/testpmd_shell.py b/dts/framework/remote_session/testpmd_shell.py
> index 1f291fcb68..f99c24bb04 100644
> --- a/dts/framework/remote_session/testpmd_shell.py
> +++ b/dts/framework/remote_session/testpmd_shell.py
> @@ -1278,6 +1278,11 @@ class TestPmdVerbosePacket(TextParser):
>      l3_len: int | None = field(default=None, metadata=TextParser.find_int(r"l3_len=(\d+)"))
>      #:
>      l4_len: int | None = field(default=None, metadata=TextParser.find_int(r"l4_len=(\d+)"))
> +    #:
> +    l4_dport: int | None = field(
> +        default=None,
> +        metadata=TextParser.find_int(r"(?:Destination TCP port=|Destination UDP port=)(\d+)"),
> +    )
>
>
>  class RxOffloadCapability(Flag):
> --
> 2.48.1
>
  

Patch

diff --git a/dts/framework/remote_session/testpmd_shell.py b/dts/framework/remote_session/testpmd_shell.py
index 1f291fcb68..f99c24bb04 100644
--- a/dts/framework/remote_session/testpmd_shell.py
+++ b/dts/framework/remote_session/testpmd_shell.py
@@ -1278,6 +1278,11 @@  class TestPmdVerbosePacket(TextParser):
     l3_len: int | None = field(default=None, metadata=TextParser.find_int(r"l3_len=(\d+)"))
     #:
     l4_len: int | None = field(default=None, metadata=TextParser.find_int(r"l4_len=(\d+)"))
+    #:
+    l4_dport: int | None = field(
+        default=None,
+        metadata=TextParser.find_int(r"(?:Destination TCP port=|Destination UDP port=)(\d+)"),
+    )
 
 
 class RxOffloadCapability(Flag):