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 4BAE0456A3; Fri, 26 Jul 2024 18:45:20 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3C9E1410F6; Fri, 26 Jul 2024 18:45:20 +0200 (CEST) Received: from mail-oa1-f46.google.com (mail-oa1-f46.google.com [209.85.160.46]) by mails.dpdk.org (Postfix) with ESMTP id 983484064F for ; Fri, 26 Jul 2024 18:45:19 +0200 (CEST) Received: by mail-oa1-f46.google.com with SMTP id 586e51a60fabf-24c5ec50da1so306663fac.3 for ; Fri, 26 Jul 2024 09:45:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; t=1722012319; x=1722617119; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=V8w6/+ibXdH2s7BaShXRJMVSNI3EhOMoCEocLd6+Qfc=; b=cpqTKaFQkwOXmUz4bJRFiv1PevX8UXy3h+oKFWUAPsbIlQGL2OPuPOgeRP4OK1axKZ eA36FgQ8lXF6TG8piAOcbmUrO0IlPln6rkGsU1Rz0QLzQzF6bRyUDDnfx7DbPNjAaaeE e+HgUXUgCUkE94AombMVBfF/5MbH4OcunXBPg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722012319; x=1722617119; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=V8w6/+ibXdH2s7BaShXRJMVSNI3EhOMoCEocLd6+Qfc=; b=G+SfVHOI40XNXIV6+U/NL/PhECjRW5XAONPeJgmgeDebvdm7aaCw+neg4EAwNhj16F tpJQKdWlVhkQWdJnLxRkzhauLDv8dmYYB3GkXrBWsV9BmJE44GTbljkh8y/UCpoFyIUv d2fOJ16xXLemOrbQHPEKT4mH9w8Nf/4ea7HYmUiS6OhAc/cG8t0cxb+qSxy3gRyFxREZ hQuNg/mEHTg7fEEBQ85CjX2yN24mO02mkUbUA0GUsNVwubnxzqbn1do5pCnue06ERgUc 2NgcQRUuK47696G9Jw9dSMw8kwbOP3pinn+VuLnDysCdIiI5ju0dZ8lWwa4EpJ2gRVst rr/Q== X-Gm-Message-State: AOJu0Yx8IwQ1b1e+tYvTZxF49P2AIJDnafkUxswngV2me4RlE7KhunkW PbA1w5DYAXhkE1VFO3WIMYjvX5A0lYQR1y/DuT5QvTs9X7u2hGFWjN7LpmjVOK4= X-Google-Smtp-Source: AGHT+IHlMI6NN6hj6t1F+Yum6E9+NJrFZraDrApzl4DvTZex5FXiYAsR9V3aVQeQLaJ18P+2s03mqw== X-Received: by 2002:a05:6358:723:b0:1aa:ae3f:1e93 with SMTP id e5c5f4694b2df-1acfad256bemr447397855d.3.1722012318625; Fri, 26 Jul 2024 09:45:18 -0700 (PDT) Received: from localhost.unh.edu ([2606:4100:3880:1257::1003]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6bb3f8f63e7sm18301466d6.30.2024.07.26.09.45.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jul 2024 09:45:18 -0700 (PDT) From: Nicholas Pratte To: probb@iol.unh.edu, dmarx@iol.unh.edu, jspewock@iol.unh.edu, luca.vizzarro@arm.com, yoan.picchi@foss.arm.com, Honnappa.Nagarahalli@arm.com, paul.szczepanek@arm.com, juraj.linkes@pantheon.tech Cc: dev@dpdk.org, Nicholas Pratte Subject: [PATCH v4 1/2] dts: add methods for setting mac and multicast addresses Date: Fri, 26 Jul 2024 12:45:14 -0400 Message-ID: <20240726164514.24775-1-npratte@iol.unh.edu> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240726163915.19277-2-npratte@iol.unh.edu> References: <20240726163915.19277-2-npratte@iol.unh.edu> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 New methods have been added to TestPMDShell in order to produce the mac filter's individual test cases: - set_mac_addr - set_multicast_mac_addr set_mac_addr and set_multicast_addr were created for the mac filter test suite, enabling users to both add or remove mac and multicast addresses based on a boolean 'add or remove' parameter. The success or failure of each call can be verified if a user deems it necessary. Bugzilla ID: 1454 Signed-off-by: Nicholas Pratte --- dts/framework/remote_session/testpmd_shell.py | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/dts/framework/remote_session/testpmd_shell.py b/dts/framework/remote_session/testpmd_shell.py index 8e5a1c084a..64ffb23439 100644 --- a/dts/framework/remote_session/testpmd_shell.py +++ b/dts/framework/remote_session/testpmd_shell.py @@ -765,6 +765,65 @@ def show_port_info(self, port_id: int) -> TestPmdPort: return TestPmdPort.parse(output) + def set_mac_addr(self, port_id: int, mac_address: str, add: bool, verify: bool = True) -> None: + """Add or remove a mac address on a given port's Allowlist. + + Args: + port_id: The port ID the mac address is set on. + mac_address: The mac address to be added or removed to the specified port. + add: If :data:`True`, add the specified mac address. If :data:`False`, remove specified + mac address. + verify: If :data:'True', assert that the 'mac_addr' operation was successful. If + :data:'False', run the command and skip this assertion. + + Raises: + InteractiveCommandExecutionError: If the set mac address operation fails. + """ + mac_cmd = "add" if add else "remove" + output = self.send_command(f"mac_addr {mac_cmd} {port_id} {mac_address}") + if "Bad arguments" in output: + self._logger.debug("Invalid argument provided to mac_addr") + raise InteractiveCommandExecutionError("Invalid argument provided") + + if verify: + if "mac_addr_cmd error:" in output: + self._logger.debug(f"Failed to {mac_cmd} {mac_address} on port {port_id}") + raise InteractiveCommandExecutionError( + f"Failed to {mac_cmd} {mac_address} on port {port_id} \n{output}" + ) + + def set_multicast_mac_addr( + self, port_id: int, multi_addr: str, add: bool, verify: bool = True + ) -> None: + """Add or remove multicast mac address to a specified port's filter. + + Args: + port_id: The port ID the multicast address is set on. + multi_addr: The multicast address to be added to the filter. + add: If :data:'True', add the specified multicast address to the port filter. + If :data:'False', remove the specified multicast address from the port filter. + verify: If :data:'True', assert that the 'mcast_addr' operations was successful. + If :data:'False', execute the 'mcast_addr' operation and skip the assertion. + + Raises: + InteractiveCommandExecutionError: If either the 'add' or 'remove' operations fails. + """ + mcast_cmd = "add" if add else "remove" + output = self.send_command(f"mcast_addr {mcast_cmd} {port_id} {multi_addr}") + if "Bad arguments" in output: + self._logger.debug("Invalid arguments provided to mcast_addr") + raise InteractiveCommandExecutionError("Invalid argument provided") + + if verify: + if ( + "Invalid multicast_addr" in output + or f'multicast address {"already" if add else "not"} filtered by port' in output + ): + self._logger.debug(f"Failed to {mcast_cmd} {multi_addr} on port {port_id}") + raise InteractiveCommandExecutionError( + f"Failed to {mcast_cmd} {multi_addr} on port {port_id} \n{output}" + ) + def show_port_stats_all(self) -> list[TestPmdPortStats]: """Returns the statistics of all the ports. -- 2.44.0