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 E370D459FE; Mon, 23 Sep 2024 18:45:10 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1372F402E2; Mon, 23 Sep 2024 18:45:08 +0200 (CEST) Received: from mail-pl1-f228.google.com (mail-pl1-f228.google.com [209.85.214.228]) by mails.dpdk.org (Postfix) with ESMTP id CA5F0402E2 for ; Mon, 23 Sep 2024 18:45:06 +0200 (CEST) Received: by mail-pl1-f228.google.com with SMTP id d9443c01a7336-206b9455460so34678015ad.0 for ; Mon, 23 Sep 2024 09:45:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; t=1727109906; x=1727714706; 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=+gwr9RSeBY6Pawq6F1U/ax5E/LYR1A/cwk3313ajYyc=; b=OBKo9T51V9YdxC8ES64E/df5ZVJONbX8/ZcIkGUqbaP3FKx1hs3L1Fc1MFlNM+6cIN eOeDWAlK1Abnnll3g0yfCWgyY5mgGbVWFVNDrv+DBheFVtS4GS1+4oFJKkOs5NZPTdeg SHJ4qJ4gXEZ2v0F5IsLEneLQnWhJgw+KJy7cY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727109906; x=1727714706; 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=+gwr9RSeBY6Pawq6F1U/ax5E/LYR1A/cwk3313ajYyc=; b=YxGoggnm8f9wrKhz8GIKoocNwirutYpIG4gst5Yla5/jAOhXauYKFrdMxh8fsk+cai s/NmvqndOLjAq+NPpV5Pgy/Z0YKvsrShooZ8Z7+chLh7hDaS29S6pv02PdI58uHxM2+r nxuCncn7RZEi2yiSFEpJnXQIfKUBc7WiY7ohND1AE159IApt2HEi9SnoDcM1iJ6Z/8fd 70q5nh1pVIPyJ7mUfmTseo02aCA6foLqNmFDZyJHy2kslCWTZRY0VUBMNezHqZ4I/oYc AexOBDGqF183h5GPPDmuvNvYSLc3TgoyRomdCvOUViPvy2L6zUCNjAcieI94mrJC+EEC S5+w== X-Gm-Message-State: AOJu0Yx2BX5rzaN+NcAVc3RqzuzW5SK4nX6FYa0innSZOKBkXRtTB/c0 zp7BjqDU9oJlbUGTsTb7nkrYVEESWNH5ji9pA8b2MBLZft+CZtlvw/TJGmuaXq1tKQ+oIUf+NWZ TOInXXu2NFSotVk+RqGeQIsfuCbzUVpqr X-Google-Smtp-Source: AGHT+IEUvinRmQ2ZjaSl9TOJr29eOZN87ox1vaig/LtPZSt2cOtzCuDS3RIw5z79qnZrGYRTyNKRZFZ2afTm X-Received: by 2002:a17:902:d4cd:b0:206:a027:8acd with SMTP id d9443c01a7336-20aed07b90dmr4162505ad.2.1727109905907; Mon, 23 Sep 2024 09:45:05 -0700 (PDT) Received: from postal.iol.unh.edu (postal.iol.unh.edu. [132.177.123.84]) by smtp-relay.gmail.com with ESMTPS id d9443c01a7336-207946f7ac3sm4717045ad.130.2024.09.23.09.45.05 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 Sep 2024 09:45:05 -0700 (PDT) X-Relaying-Domain: iol.unh.edu Received: from iol.unh.edu (unknown [IPv6:2606:4100:3880:1257::1083]) by postal.iol.unh.edu (Postfix) with ESMTP id 3CE99605C351; Mon, 23 Sep 2024 12:45:04 -0400 (EDT) From: jspewock@iol.unh.edu To: wathsala.vithanage@arm.com, paul.szczepanek@arm.com, juraj.linkes@pantheon.tech, thomas@monjalon.net, Luca.Vizzarro@arm.com, alex.chapman@arm.com, probb@iol.unh.edu, yoan.picchi@foss.arm.com, Honnappa.Nagarahalli@arm.com, npratte@iol.unh.edu Cc: dev@dpdk.org, Jeremy Spewock Subject: [PATCH v2 1/2] dts: add method for closing ports to testpmd Date: Mon, 23 Sep 2024 12:44:52 -0400 Message-ID: <20240923164453.17904-2-jspewock@iol.unh.edu> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240923164453.17904-1-jspewock@iol.unh.edu> References: <20240814182005.12251-1-jspewock@iol.unh.edu> <20240923164453.17904-1-jspewock@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 From: Jeremy Spewock Closing ports is a standard configuration feature that is available in testpmd but the framework lacks the ability to access this command through the Testpmd API. This patch adds a method that performs this action and verifies the results of sending the command to allow developers to have more control over the state of the ports that testpmd is aware of. Signed-off-by: Jeremy Spewock --- dts/framework/remote_session/testpmd_shell.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/dts/framework/remote_session/testpmd_shell.py b/dts/framework/remote_session/testpmd_shell.py index 77902a468d..c7161df374 100644 --- a/dts/framework/remote_session/testpmd_shell.py +++ b/dts/framework/remote_session/testpmd_shell.py @@ -844,6 +844,24 @@ def set_ports_queues(self, number_of: int) -> None: self.send_command(f"port config all rxq {number_of}") self.send_command(f"port config all txq {number_of}") + @requires_stopped_ports + def close_all_ports(self, verify: bool = True) -> None: + """Close all ports. + + Args: + verify: If :data:`True` the output of the close command will be scanned in an attempt + to verify that all ports were stopped successfully. Defaults to :data:`True`. + + Raises: + InteractiveCommandExecutionError: If `verify` is :data:`True` and at lease one port + failed to close. + """ + port_close_output = self.send_command("port close all") + if verify: + num_ports = len(self.ports) + if not all(f"Port {p_id} is closed" in port_close_output for p_id in range(num_ports)): + raise InteractiveCommandExecutionError("Ports were not closed successfully.") + def show_port_info_all(self) -> list[TestPmdPort]: """Returns the information of all the ports. -- 2.46.0