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 CA73D45B09; Thu, 10 Oct 2024 22:12:09 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4C2EE4064F; Thu, 10 Oct 2024 22:12:08 +0200 (CEST) Received: from mail-qt1-f180.google.com (mail-qt1-f180.google.com [209.85.160.180]) by mails.dpdk.org (Postfix) with ESMTP id B5CDC4065D for ; Thu, 10 Oct 2024 22:12:06 +0200 (CEST) Received: by mail-qt1-f180.google.com with SMTP id d75a77b69052e-460445c48baso1348211cf.2 for ; Thu, 10 Oct 2024 13:12:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; t=1728591126; x=1729195926; 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=PNgIxZU7rpGQuY/UbqqYmc3VEny6MrOoZGK4X3sAEGOakYaKtEqCq9KN4JO7jrwRLV 0VstkNtbyst0nA675xATLw1HiUM6CNj00I+qBvxLG29dWx0YfqH+Okex9ZBO/vDmAUU5 I+E/ctFJo2TArTIf19nxxbK8jIi0fjZU6Kqhs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728591126; x=1729195926; 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=vT9qjVnesHi/3nfCzM+aHSO1lsS2DjGyQSkt72BSSpYqsIARFeRFRjlm7jt4Va2d42 fJlf0/J22kIuVL34ovsIPo57GdtmDTTr3zcjor1OC8LMAH6QBbBlVArNM29eUL55ruQy eYmiJfS/adsx+9YX+MtJtWBlhmvYAvFVfJYTPqSx/GHVaDq//Yj0fvFZS4mbkxWMiSWM dJhm9kQaF/puFU2Rez54sVF0cWhfH3QDKCRPX5KToQKqsKkJny2zDIk1VavUPOM4gBOW uAky67oHl4/Sf8THAd1A0GunlQDSUiSTaZ5MT7RsJrRl+2Vo6KSoMQGv9VzwDeqdytZP NmTA== X-Gm-Message-State: AOJu0Yx6vqZksJ7LayKL2Ugp1UMjEWjAb2zfUMQ6Rey0GPZg3uee+QfR yNGxuTgdLamn296PTlwqAxb2ADaKDBhQfSoM7+350cjit9PPsQt+On9kBUrRkUw= X-Google-Smtp-Source: AGHT+IEtyWEDfc4bMa18IjWJUFy0GXpEtVgYY/R6F7n/qOazsLFib5ZkSt/LzU/Yf2cAkTGyE04VSw== X-Received: by 2002:a05:620a:2685:b0:7ac:bb36:599a with SMTP id af79cd13be357-7b11a3aca4emr24002585a.13.1728591125901; Thu, 10 Oct 2024 13:12:05 -0700 (PDT) Received: from localhost.unh.edu ([2606:4100:3880:1271:e2f8:4ec3:8bf3:864c]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7b11498a1bdsm73048885a.127.2024.10.10.13.12.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Oct 2024 13:12:04 -0700 (PDT) From: Nicholas Pratte To: dmarx@iol.unh.edu, luca.vizzarro@arm.com, probb@iol.unh.edu, yoan.picchi@foss.arm.com, Honnappa.Nagarahalli@arm.com, paul.szczepanek@arm.com Cc: dev@dpdk.org, Nicholas Pratte Subject: [PATCH v8 1/2] dts: add methods for setting mac and multicast addresses Date: Thu, 10 Oct 2024 16:11:58 -0400 Message-ID: <20241010201159.2568-2-npratte@iol.unh.edu> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20241010201159.2568-1-npratte@iol.unh.edu> References: <20240702192422.2480-2-npratte@iol.unh.edu> <20241010201159.2568-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