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 D732545B09; Thu, 10 Oct 2024 21:21:38 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8058C40655; Thu, 10 Oct 2024 21:21:35 +0200 (CEST) Received: from mail-qv1-f45.google.com (mail-qv1-f45.google.com [209.85.219.45]) by mails.dpdk.org (Postfix) with ESMTP id 7384D40647 for ; Thu, 10 Oct 2024 21:21:34 +0200 (CEST) Received: by mail-qv1-f45.google.com with SMTP id 6a1803df08f44-6cb45ccf4c5so2132406d6.3 for ; Thu, 10 Oct 2024 12:21:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; t=1728588094; x=1729192894; 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=WEn+T0jzse4kmbhQ8KnwgHOn7t5tPLdVvmgfmTrJ3DbEQzgxxFWHncOP5joeQSv3gD TTiLfcT84D1kgx28b7OwfXR4i8CIkcII8qx8r7VP4rKRJ/P01j+uHeyo8xDOLNn/D+Jo 375NMwHUrwD26tPWT7ks48mt3h7tPdxTB9+ss= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728588094; x=1729192894; 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=EyISIzng+hfnKlArhz8cAhy/Y0pv7feTDUdK/zUyJl/n0xKGISipmvjJyBFmMnpGOL zt663PzBIVu9QOWMaaWKGrBHo2gck3BnNcuWbKTQCW+NGPelJTvRs8LsZRgoXJ9UvUp6 ALl3V7z1uxo8T8bX9Dqjn0Dzyis5SbKwXPvGHTD8Q6JA40jT34Vg1fnEYVROdc3VqA9z Uv0AbjMc1NFPTtbh6nz9rZyCsHGIQDO/SN0DIABJi3UFh3r0SWAHZH61QF72SrIsSOAp dMSUOFTBJ93f7mQkTM7Qj5ZUQ3zmvs7YhjyaDhtS0QkhcI7cpbSC+fGJuBUnIdRO18r8 XH2g== X-Gm-Message-State: AOJu0YzaO1MUMpXQUoW5ZpWs2eBS0DMEfkTcVYTgHXDeBp2xDLQX+CSC +S1JNmulbqFSdlSXJX/mahRtDLkCgu7iyDSiIgiuY4QdB6ThrB1gvbgQ4Agj8QQ= X-Google-Smtp-Source: AGHT+IElLSqLXtmHtgskqHvpZ/PP8Lq0oeqr3ihe3+BQ9/OG0DM4ePBGpOHsSavVW/GJDNqiRuQtTA== X-Received: by 2002:a05:620a:45a6:b0:7a9:a632:3fdf with SMTP id af79cd13be357-7b11a3a9cb3mr14951085a.13.1728588093654; Thu, 10 Oct 2024 12:21:33 -0700 (PDT) Received: from localhost.unh.edu ([2606:4100:3880:1271:e2f8:4ec3:8bf3:864c]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7b1148de0acsm70379785a.39.2024.10.10.12.21.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Oct 2024 12:21:33 -0700 (PDT) From: Nicholas Pratte To: yoan.picchi@foss.arm.com, probb@iol.unh.edu, paul.szczepanek@arm.com, dmarx@iol.unh.edu, Honnappa.Nagarahalli@arm.com, luca.vizzarro@arm.com Cc: dev@dpdk.org, Nicholas Pratte Subject: [PATCH v7 1/2] dts: add methods for setting mac and multicast addresses Date: Thu, 10 Oct 2024 15:21:25 -0400 Message-ID: <20241010192126.31062-2-npratte@iol.unh.edu> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20241010192126.31062-1-npratte@iol.unh.edu> References: <20240702192422.2480-2-npratte@iol.unh.edu> <20241010192126.31062-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