DPDK patches and discussions
 help / color / mirror / Atom feed
From: Jeremy Spewock <jspewock@iol.unh.edu>
To: Dean Marx <dmarx@iol.unh.edu>
Cc: probb@iol.unh.edu, npratte@iol.unh.edu, luca.vizzarro@arm.com,
	 yoan.picchi@foss.arm.com, Honnappa.Nagarahalli@arm.com,
	 paul.szczepanek@arm.com, juraj.linkes@pantheon.tech,
	dev@dpdk.org
Subject: Re: [PATCH v1] dts: add flow rule dataclass to testpmd shell
Date: Fri, 2 Aug 2024 16:49:09 -0400	[thread overview]
Message-ID: <CAAA20USnV76bb9LGhTMKByZK5-bE-8sCDTUVMVX2KRiZ1Gdw4Q@mail.gmail.com> (raw)
In-Reply-To: <20240726142213.3109-1-dmarx@iol.unh.edu>

I think Luca made some great points and I agree with what he said, I
just had one other though as well. Great work!

On Fri, Jul 26, 2024 at 10:22 AM Dean Marx <dmarx@iol.unh.edu> wrote:
<snip>
> +
>  class TestPmdShell(DPDKShell):
>      """Testpmd interactive shell.
>
> @@ -804,6 +841,25 @@ def show_port_stats(self, port_id: int) -> TestPmdPortStats:
>
>          return TestPmdPortStats.parse(output)
>
> +    def flow_create(self, cmd: str, verify: bool = True) -> None:

It might make more sense for this method to take in the actual
dataclass rather than a string, and then it can convert it to a string
when it sends the command. That way users don't have to make the class
and then always do str() on it before passing it into this method.
Additionally, it discourages people from just putting anything in the
command section and shows the expectation that you should be using the
dataclass to make the flow rules.

> +        """Creates a flow rule in the testpmd session.
> +
> +        Args:
> +            cmd: String from flow_func instance to send as a flow rule.
> +            verify: If :data:`True`, the output of the command is scanned
> +            to ensure the flow rule was created successfully.
> +
> +        Raises:
> +            InteractiveCommandExecutionError: If flow rule is invalid.
> +        """
> +        flow_output = self.send_command(cmd)
> +        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}"
> +                )
> +
>      def _close(self) -> None:
>          """Overrides :meth:`~.interactive_shell.close`."""
>          self.stop()
> --
> 2.44.0
>

  reply	other threads:[~2024-08-02 20:49 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-26 14:22 Dean Marx
2024-08-02 20:49 ` Jeremy Spewock [this message]
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
  -- strict thread matches above, loose matches on Subject: below --
2024-07-26 13:47 [PATCH v1] " Dean Marx

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=CAAA20USnV76bb9LGhTMKByZK5-bE-8sCDTUVMVX2KRiZ1Gdw4Q@mail.gmail.com \
    --to=jspewock@iol.unh.edu \
    --cc=Honnappa.Nagarahalli@arm.com \
    --cc=dev@dpdk.org \
    --cc=dmarx@iol.unh.edu \
    --cc=juraj.linkes@pantheon.tech \
    --cc=luca.vizzarro@arm.com \
    --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).