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 CBF0445721; Fri, 2 Aug 2024 22:49:22 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A1C5540DD3; Fri, 2 Aug 2024 22:49:22 +0200 (CEST) Received: from mail-pj1-f46.google.com (mail-pj1-f46.google.com [209.85.216.46]) by mails.dpdk.org (Postfix) with ESMTP id 7504E40B90 for ; Fri, 2 Aug 2024 22:49:21 +0200 (CEST) Received: by mail-pj1-f46.google.com with SMTP id 98e67ed59e1d1-2cb5b783c15so6394284a91.2 for ; Fri, 02 Aug 2024 13:49:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; t=1722631760; x=1723236560; darn=dpdk.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=OKIi8D+eWdVqhQ4Li06j7UE8Q+qqe3A81KnO34TQMMw=; b=ZAcoIc9s+O5cjwNTRaGJc+AtzV4xwcc23qb1wma2y7vR5VB3Y18yThF4+GbKNHssME f8w1PweQBiXV4oRRWWv2LQEHSVPAzsv4mSBFw/r2POWYC/YwU1kHuz+7SwSayaqWXbNr uYYNTABulyjG5QWpyApMf+ovOjLPeoej+nqeg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722631760; x=1723236560; h=content-transfer-encoding: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=OKIi8D+eWdVqhQ4Li06j7UE8Q+qqe3A81KnO34TQMMw=; b=ugMPK0UNPvZOJ9pLBR/3x/6jSIc+HwBLNUE1yrjNp014Ty3cSL5KcnD6pvCvCpgoyz ExjjT3JlCDSysuAaal2Ye5OTy3uKlDgPkbQESjmTKJblexBAm5qhsX6AkMkCIT+gFPOZ vy0PBkW0SHJBlauVDKMWfm597u25GQipqDYUD170eHkFOjJ2y4JbXubV0SpQVlYjpDvv Ly54Ru+Ulfc1K+iy3EgjfoL8Z7kqRvW/ve+bHtow5tVRNk51JArxfuKPQc5YYjKKAwQh uieQC3boUJ0faZqb6l5wrevBgumnFUhpXy6J4UOgs7e4Ytkfvj5/mHeShYAfxvDgDGod QjYg== X-Forwarded-Encrypted: i=1; AJvYcCVg8K2filPUFDAdxKxCVrpPu5uH4mSvzNgHexq3RRx+9BewZcwLnYQm3opSoG5ZvWMzDEmCJSpOyjfD9CY= X-Gm-Message-State: AOJu0YwDNaYd0z2Ukzrv+zgzx1OThjLVSbYvkaXmSzSAppQC6L3YfRHa j2y3MX188a7Rj8WrO8FRULqaP7VPt8xuDwfzwB2qc35XZlCTxsPwY/HVyJRus2krllvTHKfZPYb O2d/I9vWTxCO/IEnL0UEd1DKL7SGDUFz2gPJj+g== X-Google-Smtp-Source: AGHT+IFarAs3ELy/2ixACLUfVipg6GiERXIqZvZXM9N6NRQDfcVGVoQd3LsXXPmUlwLnXuipXMnNM9RiTTBFfLjuLYk= X-Received: by 2002:a17:90a:ab0b:b0:2c9:964a:95cb with SMTP id 98e67ed59e1d1-2cff9552e7amr5052026a91.40.1722631760439; Fri, 02 Aug 2024 13:49:20 -0700 (PDT) MIME-Version: 1.0 References: <20240726142213.3109-1-dmarx@iol.unh.edu> In-Reply-To: <20240726142213.3109-1-dmarx@iol.unh.edu> From: Jeremy Spewock Date: Fri, 2 Aug 2024 16:49:09 -0400 Message-ID: Subject: Re: [PATCH v1] dts: add flow rule dataclass to testpmd shell To: Dean Marx 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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 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=E2=80=AFAM Dean Marx wrot= e: > + > class TestPmdShell(DPDKShell): > """Testpmd interactive shell. > > @@ -804,6 +841,25 @@ def show_port_stats(self, port_id: int) -> TestPmdPo= rtStats: > > return TestPmdPortStats.parse(output) > > + def flow_create(self, cmd: str, verify: bool =3D 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 scanne= d > + to ensure the flow rule was created successfully. > + > + Raises: > + InteractiveCommandExecutionError: If flow rule is invalid. > + """ > + flow_output =3D 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 >