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 5ED084608B; Wed, 15 Jan 2025 15:19:39 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 37E00402E7; Wed, 15 Jan 2025 15:19:36 +0100 (CET) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mails.dpdk.org (Postfix) with ESMTP id B56584003C for ; Wed, 15 Jan 2025 15:19:33 +0100 (CET) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 5D35E12FC; Wed, 15 Jan 2025 06:20:01 -0800 (PST) Received: from localhost.localdomain (JR4XG4HTQC.cambridge.arm.com [10.1.39.16]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 3C7C63F63F; Wed, 15 Jan 2025 06:19:32 -0800 (PST) From: Luca Vizzarro To: dev@dpdk.org Cc: Nicholas Pratte , Luca Vizzarro , Paul Szczepanek , Patrick Robb Subject: [PATCH v3 1/7] dts: enable arch self-discovery Date: Wed, 15 Jan 2025 14:18:03 +0000 Message-ID: <20250115141809.3898708-2-luca.vizzarro@arm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250115141809.3898708-1-luca.vizzarro@arm.com> References: <20240705171341.23894-2-npratte@iol.unh.edu> <20250115141809.3898708-1-luca.vizzarro@arm.com> 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: Nicholas Pratte The 'arch' attribute in the conf.yaml is unnecessary, as this can be readily discovered directly from any given node. Bugzilla ID: 1360 Signed-off-by: Nicholas Pratte Signed-off-by: Luca Vizzarro Reviewed-by: Paul Szczepanek --- dts/conf.yaml | 2 -- dts/framework/config/__init__.py | 2 -- dts/framework/testbed_model/node.py | 3 +++ dts/framework/testbed_model/os_session.py | 8 ++++++++ dts/framework/testbed_model/posix_session.py | 4 ++++ 5 files changed, 15 insertions(+), 4 deletions(-) diff --git a/dts/conf.yaml b/dts/conf.yaml index f83dbb0e90..80aba0d63a 100644 --- a/dts/conf.yaml +++ b/dts/conf.yaml @@ -42,7 +42,6 @@ nodes: - name: "SUT 1" hostname: sut1.change.me.localhost user: dtsuser - arch: x86_64 os: linux lcores: "" # use all the available logical cores use_first_core: false # tells DPDK to use any physical core @@ -68,7 +67,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"@0000: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 6bf4885815..1127c6474a 100644 --- a/dts/framework/config/__init__.py +++ b/dts/framework/config/__init__.py @@ -191,8 +191,6 @@ class NodeConfiguration(FrozenModel): user: str #: The password of the user. The use of passwords is heavily discouraged, please use SSH keys. password: str | None = None - #: The architecture of the :class:`~framework.testbed_model.node.Node`. - arch: Architecture #: The operating system of the :class:`~framework.testbed_model.node.Node`. os: OS #: A comma delimited list of logical cores to use when running DPDK. diff --git a/dts/framework/testbed_model/node.py b/dts/framework/testbed_model/node.py index c6f12319ca..c56872aa99 100644 --- a/dts/framework/testbed_model/node.py +++ b/dts/framework/testbed_model/node.py @@ -17,6 +17,7 @@ from framework.config import ( OS, + Architecture, DPDKBuildConfiguration, NodeConfiguration, TestRunConfiguration, @@ -57,6 +58,7 @@ class Node(ABC): main_session: OSSession config: NodeConfiguration name: str + arch: Architecture lcores: list[LogicalCore] ports: list[Port] _logger: DTSLogger @@ -79,6 +81,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 28eccc05ed..30d781c355 100644 --- a/dts/framework/testbed_model/os_session.py +++ b/dts/framework/testbed_model/os_session.py @@ -507,6 +507,14 @@ def get_node_info(self) -> OSSessionInfo: 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 29e314db6e..220618cacc 100644 --- a/dts/framework/testbed_model/posix_session.py +++ b/dts/framework/testbed_model/posix_session.py @@ -404,3 +404,7 @@ def get_node_info(self) -> OSSessionInfo: ).stdout.split("\n") kernel_version = self.send_command("uname -r", SETTINGS.timeout).stdout return OSSessionInfo(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 self.send_command("uname -m").stdout.strip() -- 2.43.0