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 9EE7945B54; Wed, 16 Oct 2024 19:14:04 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2F9C840652; Wed, 16 Oct 2024 19:13:59 +0200 (CEST) Received: from mail-qv1-f49.google.com (mail-qv1-f49.google.com [209.85.219.49]) by mails.dpdk.org (Postfix) with ESMTP id A6B874060B for ; Wed, 16 Oct 2024 19:13:57 +0200 (CEST) Received: by mail-qv1-f49.google.com with SMTP id 6a1803df08f44-6cbf6809fb5so62066d6.3 for ; Wed, 16 Oct 2024 10:13:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; t=1729098837; x=1729703637; 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=CPYvRoU7nD/tLfFayCU4zIp2Mhr0K+4t8LfGNmmc3v4=; b=DjjCl+PxIkh8Hm7OENDPCROPfCmh+FnpghYJECNyJxp06Vg/TkLEWbaWaCnDaberUH 9dPQo+ZBQRQ+rqg0HPZVuWShW2VJBJmmCYFcWNVBE/kA7Z1IxVYXb+psPxsnN7jAUt2t cL38Iq5zX1f/DZ7r5iXWUsEhI1jXwGFCIh7KQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729098837; x=1729703637; 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=CPYvRoU7nD/tLfFayCU4zIp2Mhr0K+4t8LfGNmmc3v4=; b=ZmGyvaso2LjhLkhmK8UvubUs6Tt5Gvfv+tiHxDxM2YjMWyULP/9gR71fUbURHP0g08 GBfy3TVOb0d5F/qArNAfMZZM2bnyVmW5WmEjbUGlFnGx+9X0riPUw/P05h9QnxN6g0/n xxJGqKGUWQl48NnFE/3uJf+gylOzOyMMMHfMi+exkUvjnPQzroucTUYOZVqaK86ORFzc fB5fr1MexpHCavWPE/45LT+SMWyWgNlzZLjoGeiDF+WWMSt6tXEnccfyCSnVaX6t4oRU rGSbH4mnoVp2F/8f8VCRP1dIZOfeH7dGCOeFXg69mAG+Did7yg0ve/7I0TjXlVtxXgPA sjVw== X-Gm-Message-State: AOJu0YwvGSIKyoVvQ4IEsyOBGqkp+R6AKf40O3wfdZTrSGqPyf3LOx27 JXkqLHe3IAjyUtNjZZs5Uhdmirq4ZDOAncKwZB9pEXDXSgqvr31Ke/CKdVv7rTE= X-Google-Smtp-Source: AGHT+IHELvN2PsQPo6IOY8N6U2CuUZU/dkj/7KIQWl82e6DtoTd33+V2Soo20lUMwu42khivi3w23w== X-Received: by 2002:a05:6214:29ed:b0:6cb:f5d6:3f9d with SMTP id 6a1803df08f44-6cc2d90c03emr21632276d6.8.1729098836256; Wed, 16 Oct 2024 10:13:56 -0700 (PDT) Received: from localhost.unh.edu ([2606:4100:3880:1271:e2f8:4ec3:8bf3:864c]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6cc2291dbbbsm19738756d6.38.2024.10.16.10.13.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Oct 2024 10:13:55 -0700 (PDT) From: Nicholas Pratte To: dmarx@iol.unh.edu, probb@iol.unh.edu, luca.vizzarro@arm.com, Honnappa.Nagarahalli@arm.com, yoan.picchi@foss.arm.com, paul.szczepanek@arm.com Cc: dev@dpdk.org, Nicholas Pratte Subject: [PATCH v9 1/3] dts: add methods for setting mac and multicast addresses Date: Wed, 16 Oct 2024 13:13:05 -0400 Message-ID: <20241016171307.18635-2-npratte@iol.unh.edu> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20241016171307.18635-1-npratte@iol.unh.edu> References: <20240702192422.2480-2-npratte@iol.unh.edu> <20241016171307.18635-1-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 16b41a7814..6beec66e43 100644 --- a/dts/framework/remote_session/testpmd_shell.py +++ b/dts/framework/remote_session/testpmd_shell.py @@ -1663,6 +1663,65 @@ def _update_port(self, port: TestPmdPort) -> None: for existing_port in self._ports ] + 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 to or removed from 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 allow list. + + Args: + port_id: The port ID the multicast address is set on. + multi_addr: The multicast address to be added or removed from 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