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 E72CE45AE8; Tue, 8 Oct 2024 22:45:39 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 516EA40A6D; Tue, 8 Oct 2024 22:45:39 +0200 (CEST) Received: from mail-qk1-f181.google.com (mail-qk1-f181.google.com [209.85.222.181]) by mails.dpdk.org (Postfix) with ESMTP id 06D7740A6C for ; Tue, 8 Oct 2024 22:45:38 +0200 (CEST) Received: by mail-qk1-f181.google.com with SMTP id af79cd13be357-7a9a62c6734so29665385a.3 for ; Tue, 08 Oct 2024 13:45:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; t=1728420337; x=1729025137; 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=3idQWAEkPwtuoh9Pa2KOMPmdpGKJxJCvg1C2519QagQ=; b=CJHPZsCrIng/jkTTozvyEdMq0D9MM+qlEDudPOSO7zAOpl5afqrOrB9+BhGCfa5Hjh Hz1FolZeBOvQeho+L/zn1vhTG0+WI7adxOFOdiQ34h/V4W8axFNa0/XHqTaKxTtJX1KA 8bue3HrHbhdA5AcCHc9XiFDJlM9JqfYj/i4IM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728420337; x=1729025137; 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=3idQWAEkPwtuoh9Pa2KOMPmdpGKJxJCvg1C2519QagQ=; b=A0/eijAdFkKNxdR6vStDdJ8nmXjYoTmxHHaDnjXEYRzrLC2SrKce9Z1NifaCTT6gZi 7JYytd+CYcXaluD5XG8ZKk6GYAx+oTIosRjLxEtKFqx0exJ+yDxvBQLXQbjo4GKjFcem tEpfLxEtwVNt2v8UsQs5nDLRnsnLDQacMf/+NDiJK+JGSoTBaKv2yNQQrxSxGo9XPJnH MU0t9VaZIn/MwgCNM1/gz6Eb7KPAD1PFytEQFwrU1aOrlYBjhblMXDJsgd/12L0NpHBn RWGJjrXjMv2myEM83nlRY7D56jYlDvzj7jix6nrzC1zyjkGyMinypbALpHSDewk4sEJe mFjw== X-Gm-Message-State: AOJu0YwLbsaOdlO90n6M6gHy2Fy9Ek24BuXzwBZ3cMb3j/MphD9rRknn SOAqdMj6+GwuPDQLbAMa6VAb7dXL4Ko0d1wt/11CDrsxSHUi+y0uoV2mToDHyt8= X-Google-Smtp-Source: AGHT+IEMhntFPRNT8oORBOfVd5POD4tkBdnR3uswTQoGOLnFyX0JfybBJonrfvyOHIQjoHIXNMqv1w== X-Received: by 2002:a05:620a:24cf:b0:7ae:5c84:6f92 with SMTP id af79cd13be357-7b079553eeamr5707585a.13.1728420337210; Tue, 08 Oct 2024 13:45:37 -0700 (PDT) Received: from localhost.unh.edu ([2606:4100:3880:1271:e2f8:4ec3:8bf3:864c]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7afceb513b4sm44816785a.19.2024.10.08.13.45.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Oct 2024 13:45:36 -0700 (PDT) From: Nicholas Pratte To: Honnappa.Nagarahalli@arm.com, luca.vizzarro@arm.com, yoan.picchi@foss.arm.com, jspewock@iol.unh.edu, probb@iol.unh.edu, juraj.linkes@pantheon.tech, paul.szczepanek@arm.com, dmarx@iol.unh.edu Cc: dev@dpdk.org, Nicholas Pratte Subject: [PATCH v6 1/2] dts: add methods for setting mac and multicast addresses Date: Tue, 8 Oct 2024 16:45:19 -0400 Message-ID: <20241008204520.17275-2-npratte@iol.unh.edu> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20241008204520.17275-1-npratte@iol.unh.edu> References: <20240702192422.2480-2-npratte@iol.unh.edu> <20241008204520.17275-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 a097626cb0..4c980faf41 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