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 A8EF14559C; Fri, 5 Jul 2024 20:32:29 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 91ECE43254; Fri, 5 Jul 2024 20:32:29 +0200 (CEST) Received: from mail-oa1-f41.google.com (mail-oa1-f41.google.com [209.85.160.41]) by mails.dpdk.org (Postfix) with ESMTP id 181AD410F2 for ; Fri, 5 Jul 2024 20:32:28 +0200 (CEST) Received: by mail-oa1-f41.google.com with SMTP id 586e51a60fabf-25e3d71030cso201891fac.1 for ; Fri, 05 Jul 2024 11:32:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; t=1720204347; x=1720809147; 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=DsoaH7kG4dE/zBk0Lsap5nVty7tsDzNN9sha5Uw4Ckw=; b=WsrX2zaH82hUaeltHbF1ZLp3e2UjKQ0c7qyX78R8yODIqRaycDW2En7Wy15YoFYcl6 Sr+tsVM7zCwD3Do2OHPfl6vLIFBJ/HeGJu3yb5Z58qWChHP2db+677nHiL7U7aXujfMn S9akyuiOVrMXrsPd19ogjxTL4XTeG6AOtvD5Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720204347; x=1720809147; 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=DsoaH7kG4dE/zBk0Lsap5nVty7tsDzNN9sha5Uw4Ckw=; b=YIh8QnNyYKjCU/K6ltStzb8rb2j9dh0TZcmXkLzM6F1R8eG0IXD3GnSW3x8ZjZBf9d BBO9vH/cO+nnfQO7CPLfxM6j0fyD870qn0VH82uRRD40jyxf4pdwJirMBJUvFVCsqnYq uvt2MiOt97YQo3K7B3NpO10SoxfnP6Ub5x9JaRm0tZTlHakfmJvO4qNvmWmcivFo9TNP qHbrcN7mmtaFxy+lnD2jSoBXT2ZoMJLfKHwcY8kkU0p2CUo4KruLAhBOQ6zXtuufbQsM Xt9ckRYv1kkZnQmpxSqB8VjKLmGY4GGw0vjaithYhjVogN9KyXBhciJCi3WsvNou5n6+ dDSw== X-Gm-Message-State: AOJu0Yzvdd1sptro4aedfDS2WDdMK+4nPdVmMY14rzzbuNI9eNXZnu2q TQWZwhvGFD61rHRZHAgnvVuJ1otdL8czFpDJPqB3lksSwUZURRdkW9xVWtjUjao= X-Google-Smtp-Source: AGHT+IE3iJufihhwyqOfpMLGETqIVriMtmiB7cBzi5RSoFFJNUdaGh3N3G+LiYs/boXkLSY7URzkTA== X-Received: by 2002:a05:6871:24d9:b0:254:affe:5a08 with SMTP id 586e51a60fabf-25e2ba1b287mr5502028fac.2.1720204347222; Fri, 05 Jul 2024 11:32:27 -0700 (PDT) Received: from localhost.unh.edu ([2606:4100:3880:1257::1003]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6b5fe762c09sm2649476d6.97.2024.07.05.11.32.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jul 2024 11:32:26 -0700 (PDT) From: Nicholas Pratte To: dmarx@iol.unh.edu, paul.szczepanek@arm.com, juraj.linkes@pantheon.tech, yoan.picchi@foss.arm.com, jspewock@iol.unh.edu, luca.vizzarro@arm.com, probb@iol.unh.edu, Honnappa.Nagarahalli@arm.com Cc: dev@dpdk.org, Nicholas Pratte Subject: [PATCH v2 3/6] dts: Self-Discovering Architecture Change Date: Fri, 5 Jul 2024 14:32:15 -0400 Message-ID: <20240705183215.30998-1-npratte@iol.unh.edu> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240705171341.23894-2-npratte@iol.unh.edu> References: <20240705171341.23894-2-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 The 'arch' attribute in the conf.yaml is unnecessary, as this can be readily discovered within the constructor of any given node. Since OS is determined within user configuration, finding system arch can be done both reliably and easily within the framework. For Linux/Posix systems, the 'uname' command is used to determine system architecture. I believe that this is posix-standard and utilizes a standardized output. Bugzilla ID: 1360 Signed-off-by: Nicholas Pratte --- dts/conf.yaml | 2 -- dts/framework/config/__init__.py | 4 ---- dts/framework/config/conf_yaml_schema.json | 12 ------------ dts/framework/config/types.py | 2 -- dts/framework/testbed_model/node.py | 4 +++- dts/framework/testbed_model/os_session.py | 8 ++++++++ dts/framework/testbed_model/posix_session.py | 6 ++++++ 7 files changed, 17 insertions(+), 21 deletions(-) diff --git a/dts/conf.yaml b/dts/conf.yaml index 53192e0761..7ca4c05b55 100644 --- a/dts/conf.yaml +++ b/dts/conf.yaml @@ -27,7 +27,6 @@ nodes: - name: "SUT 1" hostname: sut1.change.me.localhost user: dtsuser - arch: x86_64 os: linux lcores: "" # use all available logical cores (Skips first core) memory_channels: 4 # tells DPDK to use 4 memory channels @@ -52,7 +51,6 @@ nodes: - name: "TG 1" hostname: tg1.change.me.localhost user: dtsuser - arch: x86_64 os: linux ports: # sets up the physical link between "TG 1"@000:00:08.0 and "SUT 1"@0000:00:08.0 diff --git a/dts/framework/config/__init__.py b/dts/framework/config/__init__.py index 4c05373ef3..662b3070a1 100644 --- a/dts/framework/config/__init__.py +++ b/dts/framework/config/__init__.py @@ -208,7 +208,6 @@ class NodeConfiguration: the :class:`~framework.testbed_model.node.Node`. password: The password of the user. The use of passwords is heavily discouraged. Please use keys instead. - arch: The architecture of the :class:`~framework.testbed_model.node.Node`. os: The operating system of the :class:`~framework.testbed_model.node.Node`. lcores: A comma delimited list of logical cores to use when running DPDK. use_first_core: If :data:`True`, the first logical core won't be used. @@ -220,7 +219,6 @@ class NodeConfiguration: hostname: str user: str password: str | None - arch: Architecture os: OS lcores: str use_first_core: bool @@ -257,7 +255,6 @@ def from_dict( hostname=d["hostname"], user=d["user"], password=d.get("password"), - arch=Architecture(d["arch"]), os=OS(d["os"]), lcores=lcores, use_first_core=use_first_core, @@ -271,7 +268,6 @@ def from_dict( hostname=d["hostname"], user=d["user"], password=d.get("password"), - arch=Architecture(d["arch"]), os=OS(d["os"]), lcores=lcores, use_first_core=use_first_core, diff --git a/dts/framework/config/conf_yaml_schema.json b/dts/framework/config/conf_yaml_schema.json index 01a6afdc72..e65ea45058 100644 --- a/dts/framework/config/conf_yaml_schema.json +++ b/dts/framework/config/conf_yaml_schema.json @@ -6,14 +6,6 @@ "type": "string", "description": "A unique identifier for a node" }, - "ARCH": { - "type": "string", - "enum": [ - "x86_64", - "arm64", - "ppc64le" - ] - }, "OS": { "type": "string", "enum": [ @@ -155,9 +147,6 @@ "type": "string", "description": "The password to use on this node. Use only as a last resort. SSH keys are STRONGLY preferred." }, - "arch": { - "$ref": "#/definitions/ARCH" - }, "os": { "$ref": "#/definitions/OS" }, @@ -233,7 +222,6 @@ "name", "hostname", "user", - "arch", "os" ] }, diff --git a/dts/framework/config/types.py b/dts/framework/config/types.py index 2f75724c5e..9934fef503 100644 --- a/dts/framework/config/types.py +++ b/dts/framework/config/types.py @@ -56,8 +56,6 @@ class NodeConfigDict(TypedDict): #: password: str #: - arch: str - #: os: str #: lcores: str diff --git a/dts/framework/testbed_model/node.py b/dts/framework/testbed_model/node.py index 9b3f01f1e9..09399f4823 100644 --- a/dts/framework/testbed_model/node.py +++ b/dts/framework/testbed_model/node.py @@ -17,7 +17,7 @@ from ipaddress import IPv4Interface, IPv6Interface from typing import Any, Callable, Union -from framework.config import OS, NodeConfiguration, TestRunConfiguration +from framework.config import OS, Architecture, NodeConfiguration, TestRunConfiguration from framework.exception import ConfigurationError from framework.logger import DTSLogger, get_dts_logger from framework.settings import SETTINGS @@ -55,6 +55,7 @@ class Node(ABC): main_session: OSSession config: NodeConfiguration name: str + arch: Architecture lcores: list[LogicalCore] ports: list[Port] _logger: DTSLogger @@ -77,6 +78,7 @@ def __init__(self, node_config: NodeConfiguration): self.name = node_config.name self._logger = get_dts_logger(self.name) self.main_session = create_session(self.config, self.name, self._logger) + self.arch = Architecture(self.main_session.get_arch_info()) self._logger.info(f"Connected to node: {self.name}") diff --git a/dts/framework/testbed_model/os_session.py b/dts/framework/testbed_model/os_session.py index 79f56b289b..02277eee1f 100644 --- a/dts/framework/testbed_model/os_session.py +++ b/dts/framework/testbed_model/os_session.py @@ -342,6 +342,14 @@ def get_node_info(self) -> NodeInfo: Node information. """ + @abstractmethod + def get_arch_info(self) -> str: + """Discover CPU architecture of the remote host. + + Returns: + Remote host CPU architecture. + """ + @abstractmethod def update_ports(self, ports: list[Port]) -> None: """Get additional information about ports from the operating system and update them. diff --git a/dts/framework/testbed_model/posix_session.py b/dts/framework/testbed_model/posix_session.py index d279bb8b53..91afca61ea 100644 --- a/dts/framework/testbed_model/posix_session.py +++ b/dts/framework/testbed_model/posix_session.py @@ -295,3 +295,9 @@ def get_node_info(self) -> NodeInfo: ).stdout.split("\n") kernel_version = self.send_command("uname -r", SETTINGS.timeout).stdout return NodeInfo(os_release_info[0].strip(), os_release_info[1].strip(), kernel_version) + + def get_arch_info(self) -> str: + """Overrides :meth'~.os_session.OSSession.get_arch_info'.""" + # return str(self.send_command('arch')).stdout + + return str(self.send_command("uname -m").stdout.removesuffix("\n")) -- 2.44.0