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 79FEA45971; Thu, 12 Sep 2024 21:00:23 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6780742DAC; Thu, 12 Sep 2024 21:00:23 +0200 (CEST) Received: from mail-qt1-f178.google.com (mail-qt1-f178.google.com [209.85.160.178]) by mails.dpdk.org (Postfix) with ESMTP id BF32B4028F for ; Thu, 12 Sep 2024 21:00:21 +0200 (CEST) Received: by mail-qt1-f178.google.com with SMTP id d75a77b69052e-45823ee8e62so939541cf.2 for ; Thu, 12 Sep 2024 12:00:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; t=1726167621; x=1726772421; 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=emBjYbUcdlS9Mu9ydMOMNUe/W8MHwWIVAywLSpblQJM=; b=YtYPpbDljyj0Z4pg6+MlsjUseDjE/Fp+qeFo0tXkl1olT/jRxJ0xFPP84h51J1rRqx tBbhx/rU55lQrYjUZFDXgzKJD7pKB7tCZsr3NMnvGHq/0d4jswt9ury/0v3V+sxFtiK4 kYFlC2XxzB+/AVkAZ+zyIHVk94lpPe9+FEwCs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726167621; x=1726772421; 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=emBjYbUcdlS9Mu9ydMOMNUe/W8MHwWIVAywLSpblQJM=; b=JlWDIFFyecrG/4XlB0NMay8OeIFxT3gqgsR9ionwGM0Vn7xcG/EsiXdWJ0beqfN7nZ u9wV2Je8f1DERNY3XE8rQDmuApxLODcCJAzVUQCEbIsQf+1wY8V4ysz6OLb50JouBx5D uBFlEIDjbH+kwE+VU3K81wDzlzdChEE4mVL4i3IPB4ssv0nm/Qa9jFrNCOPr943XXDo2 Hz/e5UHBXv+EAN6M2OQV7SQ02xku07rdbpwdfxe+tm8oWapdyb+rxrXA7afQlWWjNyBG RRY8UjnrZAYTg2aP6gUe+aWIVWkkUYVeKqjhjUPoMChmWwk3euWsj4mBapoeYgx7+ACw 7S9w== X-Gm-Message-State: AOJu0YxxBh33tD+LI8wcobhAH0OvCavMXCvyDhF2IhctPUVHAs1TIlBY vvFBGbZfK6Bmb2prX5RCZB8Cm0klIk0XZ6iod/NqP+OVhxbaC/wwAU1InNHkS0M= X-Google-Smtp-Source: AGHT+IF+J3arE3+LVtITar4S5Qfhv4vhhcDdtM5r7+pUZJdC5YXX/oAZDswImO3ylqkuyzACvn8X0w== X-Received: by 2002:a05:622a:11d2:b0:458:21b2:f9b9 with SMTP id d75a77b69052e-458604825e4mr23510471cf.15.1726167620818; Thu, 12 Sep 2024 12:00:20 -0700 (PDT) Received: from localhost.unh.edu ([2606:4100:3880:1271:e2f8:4ec3:8bf3:864c]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-4582b63fde9sm49119201cf.75.2024.09.12.12.00.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Sep 2024 12:00:20 -0700 (PDT) From: Nicholas Pratte To: jspewock@iol.unh.edu, probb@iol.unh.edu, paul.szczepanek@arm.com, luca.vizzarro@arm.com, juraj.linkes@pantheon.tech, dmarx@iol.unh.edu, yoan.picchi@foss.arm.com, Honnappa.Nagarahalli@arm.com Cc: dev@dpdk.org, Nicholas Pratte Subject: [PATCH v5 1/2] dts: add methods for setting mac and multicast addresses Date: Thu, 12 Sep 2024 15:00:04 -0400 Message-ID: <20240912190005.17932-2-npratte@iol.unh.edu> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240912190005.17932-1-npratte@iol.unh.edu> References: <20240702192422.2480-2-npratte@iol.unh.edu> <20240912190005.17932-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 d8b45133ad..9c57631702 100644 --- a/dts/framework/remote_session/testpmd_shell.py +++ b/dts/framework/remote_session/testpmd_shell.py @@ -767,6 +767,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 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