DPDK patches and discussions
 help / color / mirror / Atom feed
From: Luca Vizzarro <Luca.Vizzarro@arm.com>
To: Dean Marx <dmarx@iol.unh.edu>,
	probb@iol.unh.edu, npratte@iol.unh.edu, yoan.picchi@foss.arm.com,
	Honnappa.Nagarahalli@arm.com, paul.szczepanek@arm.com
Cc: dev@dpdk.org
Subject: Re: [PATCH v6 2/2] dts: add flow create/delete to testpmd shell
Date: Wed, 22 Jan 2025 15:11:50 +0000	[thread overview]
Message-ID: <f81a1eb2-1488-475f-988f-44ae342e6cd7@arm.com> (raw)
In-Reply-To: <20250121204135.28944-2-dmarx@iol.unh.edu>

Hi Dean, it looks mostly good, just some nits.

On 21/01/2025 20:41, Dean Marx wrote:
> +    def flow_create(self, flow_rule: FlowRule, port_id: int, verify: bool = True) -> int:
> +        """Creates a flow rule in the testpmd session.
> +
> +        Args:
> +            flow_rule: :class:`FlowRule` object used for creating testpmd flow rule.
> +            port_id: Integer representing the port to use.
> +            verify: If :data:`True`, the output of the command is scanned
> +            to ensure the flow rule was created successfully.

This line should be indented further.

> +
> +        Raises:
> +            InteractiveCommandExecutionError: If flow rule is invalid.
> +
> +        Returns:
> +            Id of created flow rule as an integer.
There is no reason to specify the type when it's already annotated as 
part of the function signature.
> +        """
> +        flow_output = self.send_command(f"flow create {port_id} {flow_rule}")
> +        if verify:
> +            if "created" not in flow_output:
> +                self._logger.debug(f"Failed to create flow rule:\n{flow_output}")
> +                raise InteractiveCommandExecutionError(
> +                    f"Failed to create flow rule:\n{flow_output}"
> +                )

With the check below here, we are already verifying the command 
execution... as you are effectively testing the same output. Therefore 
this verification above is redundant. I'd remove it, together with the 
verify argument. Finally, I'd specify in the description of the 
docstring that this function by returning the number of the created flow 
it's implicitly verifying its execution.

> +        match = re.search(r"#(\d+)", flow_output)
> +        if match is not None:
> +            match_str = match.group(1)
> +            flow_id = int(match_str)
> +            return flow_id
> +        else:
> +            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_delete(self, flow_id: int, port_id: int, verify: bool = True) -> None:
> +        """Deletes the specified flow rule from the testpmd session.
> +
> +        Args:
> +            flow_id: :class:`FlowRule` id used for deleting testpmd flow rule.

I guess it's not really a FlowRule id. Just Flow id. So:

   Id of the flow to remove.

> +            port_id: Integer representing the port to use.
> +            verify: If :data:`True`, the output of the command is scanned
> +            to ensure the flow rule was deleted successfully.
indent

  reply	other threads:[~2025-01-22 15:11 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-26 14:22 [PATCH v1] dts: add flow rule dataclass " Dean Marx
2024-08-02 20:49 ` Jeremy Spewock
2024-08-06 16:42 ` [PATCH v2] " Dean Marx
2024-08-13 14:39   ` [PATCH v3] " Dean Marx
2024-08-13 14:41   ` Dean Marx
2024-09-25  8:17     ` Juraj Linkeš
2024-10-10 21:06     ` [PATCH v4] " Dean Marx
2024-11-14 12:19       ` Luca Vizzarro
2024-12-04 23:22       ` [PATCH v5 1/2] " Dean Marx
2024-12-04 23:22         ` [PATCH v5 2/2] dts: add flow create/delete " Dean Marx
2025-01-21 20:41           ` [PATCH v6 1/2] dts: add flow rule dataclass " Dean Marx
2025-01-21 20:41             ` [PATCH v6 2/2] dts: add flow create/delete " Dean Marx
2025-01-22 15:11               ` Luca Vizzarro [this message]
2025-01-22 14:58             ` [PATCH v6 1/2] dts: add flow rule dataclass " Luca Vizzarro

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=f81a1eb2-1488-475f-988f-44ae342e6cd7@arm.com \
    --to=luca.vizzarro@arm.com \
    --cc=Honnappa.Nagarahalli@arm.com \
    --cc=dev@dpdk.org \
    --cc=dmarx@iol.unh.edu \
    --cc=npratte@iol.unh.edu \
    --cc=paul.szczepanek@arm.com \
    --cc=probb@iol.unh.edu \
    --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).