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 F31E0456AC; Thu, 25 Jul 2024 18:24:03 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6AA8243304; Thu, 25 Jul 2024 18:23:59 +0200 (CEST) Received: from mail-qv1-f41.google.com (mail-qv1-f41.google.com [209.85.219.41]) by mails.dpdk.org (Postfix) with ESMTP id E5089427BA for ; Thu, 25 Jul 2024 18:23:34 +0200 (CEST) Received: by mail-qv1-f41.google.com with SMTP id 6a1803df08f44-6b7a3e468a9so8128756d6.1 for ; Thu, 25 Jul 2024 09:23:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; t=1721924614; x=1722529414; 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=2e0KOPU1BGAs66szevXsiZwNKyo57spTUZ2Ei2PVlsQ=; b=IIae8sOYfwOVdWHhK30t+HVKQ288VA/aBesxR8DEUectfYsnyRQn2oup2ezerOgBUM aLFuaqHHhc0xqdNyFX5eFdnRUA5gUJHz9SoNbeZidJEVLTq8yjg713IQBzxlYXr0ehzr lFSMyUY2++Mtyl09+fls4XsDCbnajKAvTvWqY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721924614; x=1722529414; 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=2e0KOPU1BGAs66szevXsiZwNKyo57spTUZ2Ei2PVlsQ=; b=ZYoD5nK4I++b4V/Iy5BW5kaZzBcbCkEsUNswBmxaV6E8rY3YmxPY3XbCNxK3pYcZ5r rgZ2QKjMCBqj7vCnMLmfau19IatZHJd4zLvMnIiiYLGubzDX8DPJuM+JpET6CehFGWRv T11oHhyB8cGCJF7Fsh7RSrcGVhax9we8e/d/p1Q+nU7knWzJOVgfQJ3P8+gt6UZIinoK g6Dg2Nrhuv4ZYaUMJm5t7HtBxdt7b4D486Vr6W+0janJiJCSyUSfEiGhCZJ5MQZZdF7b j2TfluuEaeKUlyPpFgon6fRarADbuAwWtNKHrhtA0lZI51Y5e3ElRga6En8AJqHMqbk1 wr+w== X-Gm-Message-State: AOJu0YxQcEJ7l/ImLcacZB9VPgkRagv8cQVjty3cLTwxujLFKIsxweGT OlpKAtY6OBiXNgkYj4o7U7i7jFKQf3gRa32oxT/XEZTOP8v5Vv9YX2DVDoH3WIA= X-Google-Smtp-Source: AGHT+IEz5/zvg+KXqA6J1n4rapczIZfu/ex7NLsUckhMwbprZaDoS0iwrTBllbOO90eRT7uhl3Tt8g== X-Received: by 2002:a05:6214:f04:b0:6b7:9dc9:af28 with SMTP id 6a1803df08f44-6bb3cb16fb7mr40173316d6.57.1721924614231; Thu, 25 Jul 2024 09:23:34 -0700 (PDT) Received: from dean-laptop.iol.unh.edu ([2606:4100:3880:1271:f9bd:24da:464d:6294]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6bb3f8d8269sm8683196d6.20.2024.07.25.09.23.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jul 2024 09:23:33 -0700 (PDT) From: Dean Marx To: probb@iol.unh.edu, npratte@iol.unh.edu, jspewock@iol.unh.edu, luca.vizzarro@arm.com, yoan.picchi@foss.arm.com, Honnappa.Nagarahalli@arm.com, paul.szczepanek@arm.com, juraj.linkes@pantheon.tech Cc: dev@dpdk.org, Dean Marx Subject: [RFC v1 1/3] dts: add UDP tunnel command to testpmd shell Date: Thu, 25 Jul 2024 12:23:23 -0400 Message-ID: <20240725162325.20933-2-dmarx@iol.unh.edu> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240725162325.20933-1-dmarx@iol.unh.edu> References: <20240725162325.20933-1-dmarx@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 add udp_tunnel_port command to testpmd shell class, also ports over set verbose method from vlan suite Signed-off-by: Dean Marx --- dts/framework/remote_session/testpmd_shell.py | 51 ++++++++++++++++++- 1 file changed, 50 insertions(+), 1 deletion(-) diff --git a/dts/framework/remote_session/testpmd_shell.py b/dts/framework/remote_session/testpmd_shell.py index eda6eb320f..26114091d6 100644 --- a/dts/framework/remote_session/testpmd_shell.py +++ b/dts/framework/remote_session/testpmd_shell.py @@ -804,7 +804,56 @@ def show_port_stats(self, port_id: int) -> TestPmdPortStats: return TestPmdPortStats.parse(output) - def _close(self) -> None: + def set_verbose(self, level: int, verify: bool = True): + """Set debug verbosity level. + + Args: + level: 0 - silent except for error + 1 - fully verbose except for Tx packets + 2 - fully verbose except for Rx packets + >2 - fully verbose + verify: If :data:`True` the command output will be scanned to verify that verbose level + is properly set. Defaults to :data:`True`. + + Raises: + InteractiveCommandExecutionError: If `verify` is :data:`True` and verbose level + is not correctly set. + """ + verbose_output = self.send_command(f"set verbose {level}") + if verify: + if "Change verbose level" not in verbose_output: + self._logger.debug(f"Failed to set verbose level to {level}: \n{verbose_output}") + raise InteractiveCommandExecutionError( + f"Testpmd failed to set verbose level to {level}." + ) + + def udp_tunnel_port( + self, port_id: int, add: bool, udp_port: int, protocol: str, verify: bool = True + ): + """Configures a UDP tunnel on the specified port, for the specified protocol. + + Args: + port_id: ID of the port to configure tunnel on. + add: If :data:`True`, adds tunnel, otherwise removes tunnel. + udp_port: ID of the UDP port to configure tunnel on. + protocol: Name of tunnelling protocol to use; options are vxlan, geneve, ecpri + verify: If :data:`True`, checks the output of the command to verify that + no errors were thrown. + + Raises: + InteractiveCommandExecutionError: If verify is :data:`True` and command + output shows an error. + """ + action = "add" if add else "rm" + cmd_output = self.send_command( + f"port config {port_id} udp_tunnel_port {action} {protocol} {udp_port}" + ) + if verify: + if "Operation not supported" in cmd_output or "Bad arguments" in cmd_output: + self._logger.debug(f"Failed to set UDP tunnel: \n{cmd_output}") + raise InteractiveCommandExecutionError(f"Failed to set UDP tunnel: \n{cmd_output}") + + def close(self) -> None: """Overrides :meth:`~.interactive_shell.close`.""" self.stop() self.send_command("quit", "Bye...") -- 2.44.0