DPDK patches and discussions
 help / color / mirror / Atom feed
From: Luca Vizzarro <luca.vizzarro@arm.com>
To: dev@dpdk.org
Cc: Paul Szczepanek <paul.szczepanek@arm.com>,
	Patrick Robb <probb@iol.unh.edu>,
	Luca Vizzarro <luca.vizzarro@arm.com>
Subject: [PATCH v4 3/8] dts: refactor build and node info classes
Date: Mon, 28 Oct 2024 17:49:43 +0000	[thread overview]
Message-ID: <20241028174949.3283701-4-luca.vizzarro@arm.com> (raw)
In-Reply-To: <20241028174949.3283701-1-luca.vizzarro@arm.com>

The DPDKBuildInfo and NodeInfo classes, representing information
gathered in runtime, were erroneously placed in the configuration
package. This moves them in more appropriate modules.

NodeInfo, specifically, ia moved to os_session instead of node mostly
as a consequence of circular dependencies. And given os_session is the
top-most module to reference it, it appears to be the most suitable
place outside of node.

Signed-off-by: Luca Vizzarro <luca.vizzarro@arm.com>
Reviewed-by: Paul Szczepanek <paul.szczepanek@arm.com>
---
 dts/framework/config/__init__.py             | 31 --------------------
 dts/framework/test_result.py                 |  4 ++-
 dts/framework/testbed_model/os_session.py    | 21 ++++++++++++-
 dts/framework/testbed_model/posix_session.py |  4 +--
 dts/framework/testbed_model/sut_node.py      | 18 ++++++++++--
 5 files changed, 40 insertions(+), 38 deletions(-)

diff --git a/dts/framework/config/__init__.py b/dts/framework/config/__init__.py
index d0d95d00c7..7403ccbf14 100644
--- a/dts/framework/config/__init__.py
+++ b/dts/framework/config/__init__.py
@@ -318,24 +318,6 @@ class TGNodeConfiguration(NodeConfiguration):
     traffic_generator: TrafficGeneratorConfig
 
 
-@dataclass(slots=True, frozen=True)
-class NodeInfo:
-    """Supplemental node information.
-
-    Attributes:
-        os_name: The name of the running operating system of
-            the :class:`~framework.testbed_model.node.Node`.
-        os_version: The version of the running operating system of
-            the :class:`~framework.testbed_model.node.Node`.
-        kernel_version: The kernel version of the running operating system of
-            the :class:`~framework.testbed_model.node.Node`.
-    """
-
-    os_name: str
-    os_version: str
-    kernel_version: str
-
-
 @dataclass(slots=True, frozen=True)
 class DPDKBuildConfiguration:
     """DPDK build configuration.
@@ -493,19 +475,6 @@ def from_dict(cls, d: DPDKConfigurationDict) -> Self:
         )
 
 
-@dataclass(slots=True, frozen=True)
-class DPDKBuildInfo:
-    """Various versions and other information about a DPDK build.
-
-    Attributes:
-        dpdk_version: The DPDK version that was built.
-        compiler_version: The version of the compiler used to build DPDK.
-    """
-
-    dpdk_version: str | None
-    compiler_version: str | None
-
-
 @dataclass(slots=True, frozen=True)
 class TestSuiteConfig:
     """Test suite configuration.
diff --git a/dts/framework/test_result.py b/dts/framework/test_result.py
index 00263ad69e..d2f3a90eed 100644
--- a/dts/framework/test_result.py
+++ b/dts/framework/test_result.py
@@ -30,11 +30,13 @@
 
 from framework.testbed_model.capability import Capability
 
-from .config import DPDKBuildInfo, NodeInfo, TestRunConfiguration, TestSuiteConfig
+from .config import TestRunConfiguration, TestSuiteConfig
 from .exception import DTSError, ErrorSeverity
 from .logger import DTSLogger
 from .settings import SETTINGS
 from .test_suite import TestCase, TestSuite
+from .testbed_model.os_session import NodeInfo
+from .testbed_model.sut_node import DPDKBuildInfo
 
 
 @dataclass(slots=True, frozen=True)
diff --git a/dts/framework/testbed_model/os_session.py b/dts/framework/testbed_model/os_session.py
index 6194ddb989..5f087f40d6 100644
--- a/dts/framework/testbed_model/os_session.py
+++ b/dts/framework/testbed_model/os_session.py
@@ -24,11 +24,12 @@
 """
 from abc import ABC, abstractmethod
 from collections.abc import Iterable
+from dataclasses import dataclass
 from ipaddress import IPv4Interface, IPv6Interface
 from pathlib import Path, PurePath, PurePosixPath
 from typing import Union
 
-from framework.config import Architecture, NodeConfiguration, NodeInfo
+from framework.config import Architecture, NodeConfiguration
 from framework.logger import DTSLogger
 from framework.remote_session import (
     InteractiveRemoteSession,
@@ -44,6 +45,24 @@
 from .port import Port
 
 
+@dataclass(slots=True, frozen=True)
+class NodeInfo:
+    """Supplemental node information.
+
+    Attributes:
+        os_name: The name of the running operating system of
+            the :class:`~framework.testbed_model.node.Node`.
+        os_version: The version of the running operating system of
+            the :class:`~framework.testbed_model.node.Node`.
+        kernel_version: The kernel version of the running operating system of
+            the :class:`~framework.testbed_model.node.Node`.
+    """
+
+    os_name: str
+    os_version: str
+    kernel_version: str
+
+
 class OSSession(ABC):
     """OS-unaware to OS-aware translation API definition.
 
diff --git a/dts/framework/testbed_model/posix_session.py b/dts/framework/testbed_model/posix_session.py
index 5ab7c18fb7..0d3abbc519 100644
--- a/dts/framework/testbed_model/posix_session.py
+++ b/dts/framework/testbed_model/posix_session.py
@@ -15,7 +15,7 @@
 from collections.abc import Iterable
 from pathlib import Path, PurePath, PurePosixPath
 
-from framework.config import Architecture, NodeInfo
+from framework.config import Architecture
 from framework.exception import DPDKBuildError, RemoteCommandExecutionError
 from framework.settings import SETTINGS
 from framework.utils import (
@@ -26,7 +26,7 @@
     extract_tarball,
 )
 
-from .os_session import OSSession
+from .os_session import NodeInfo, OSSession
 
 
 class PosixSession(OSSession):
diff --git a/dts/framework/testbed_model/sut_node.py b/dts/framework/testbed_model/sut_node.py
index e160386324..a6c42b548c 100644
--- a/dts/framework/testbed_model/sut_node.py
+++ b/dts/framework/testbed_model/sut_node.py
@@ -14,13 +14,12 @@
 
 import os
 import time
+from dataclasses import dataclass
 from pathlib import PurePath
 
 from framework.config import (
     DPDKBuildConfiguration,
-    DPDKBuildInfo,
     DPDKLocation,
-    NodeInfo,
     SutNodeConfiguration,
     TestRunConfiguration,
 )
@@ -30,10 +29,23 @@
 from framework.utils import MesonArgs, TarCompressionFormat
 
 from .node import Node
-from .os_session import OSSession
+from .os_session import NodeInfo, OSSession
 from .virtual_device import VirtualDevice
 
 
+@dataclass(slots=True, frozen=True)
+class DPDKBuildInfo:
+    """Various versions and other information about a DPDK build.
+
+    Attributes:
+        dpdk_version: The DPDK version that was built.
+        compiler_version: The version of the compiler used to build DPDK.
+    """
+
+    dpdk_version: str | None
+    compiler_version: str | None
+
+
 class SutNode(Node):
     """The system under test node.
 
-- 
2.43.0


  parent reply	other threads:[~2024-10-28 17:51 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-22 16:39 [PATCH 0/5] dts: Pydantic configuration Luca Vizzarro
2024-08-22 16:39 ` [PATCH 1/5] dts: add TestSuiteSpec class and discovery Luca Vizzarro
2024-09-16 13:00   ` Juraj Linkeš
2024-09-19 20:01   ` Nicholas Pratte
2024-08-22 16:39 ` [PATCH 2/5] dts: add Pydantic and remove Warlock Luca Vizzarro
2024-09-16 13:17   ` Juraj Linkeš
2024-09-19 19:56   ` Nicholas Pratte
2024-09-30 20:41   ` Dean Marx
2024-08-22 16:39 ` [PATCH 3/5] dts: use Pydantic in the configuration Luca Vizzarro
2024-09-17 11:13   ` Juraj Linkeš
2024-09-30 17:56   ` Nicholas Pratte
2024-09-30 21:45   ` Dean Marx
2024-08-22 16:39 ` [PATCH 4/5] dts: use TestSuiteSpec class imports Luca Vizzarro
2024-09-17 11:39   ` Juraj Linkeš
2024-10-01 17:12   ` Dean Marx
2024-10-01 20:45   ` Nicholas Pratte
2024-08-22 16:39 ` [PATCH 5/5] dts: add JSON schema generation script Luca Vizzarro
2024-09-17 11:59   ` Juraj Linkeš
2024-10-01 20:48   ` Nicholas Pratte
2024-10-25 15:58 ` [PATCH v2 0/5] dts: Pydantic configuration Luca Vizzarro
2024-10-25 15:58   ` [PATCH v2 1/5] dts: add pydantic dependency Luca Vizzarro
2024-10-25 15:58   ` [PATCH v2 2/5] dts: add TestSuiteSpec class and discovery Luca Vizzarro
2024-10-25 15:58   ` [PATCH v2 3/5] dts: use pydantic in the configuration Luca Vizzarro
2024-10-25 15:58   ` [PATCH v2 4/5] dts: remove warlock dependency Luca Vizzarro
2024-10-25 15:58   ` [PATCH v2 5/5] dts: use TestSuiteSpec class imports Luca Vizzarro
2024-10-25 16:43 ` [PATCH v3 0/5] dts: Pydantic configuration Luca Vizzarro
2024-10-25 16:43   ` [PATCH v3 1/5] dts: add pydantic dependency Luca Vizzarro
2024-10-25 16:43   ` [PATCH v3 2/5] dts: add TestSuiteSpec class and discovery Luca Vizzarro
2024-10-25 16:43   ` [PATCH v3 3/5] dts: use pydantic in the configuration Luca Vizzarro
2024-10-25 16:43   ` [PATCH v3 4/5] dts: remove warlock dependency Luca Vizzarro
2024-10-25 16:43   ` [PATCH v3 5/5] dts: use TestSuiteSpec class imports Luca Vizzarro
2024-10-28 17:49 ` [PATCH v4 0/8] dts: Pydantic configuration Luca Vizzarro
2024-10-28 17:49   ` [PATCH v4 1/8] dts: add pydantic dependency Luca Vizzarro
2024-10-28 17:49   ` [PATCH v4 2/8] dts: add TestSuiteSpec class and discovery Luca Vizzarro
2024-10-28 17:49   ` Luca Vizzarro [this message]
2024-10-28 17:49   ` [PATCH v4 4/8] dts: use pydantic in the configuration Luca Vizzarro
2024-10-28 17:49   ` [PATCH v4 5/8] dts: remove warlock dependency Luca Vizzarro
2024-10-28 17:49   ` [PATCH v4 6/8] dts: add autodoc pydantic Luca Vizzarro
2024-10-28 17:49   ` [PATCH v4 7/8] dts: improve configuration API docs Luca Vizzarro
2024-10-28 17:49   ` [PATCH v4 8/8] dts: use TestSuiteSpec class imports Luca Vizzarro

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241028174949.3283701-4-luca.vizzarro@arm.com \
    --to=luca.vizzarro@arm.com \
    --cc=dev@dpdk.org \
    --cc=paul.szczepanek@arm.com \
    --cc=probb@iol.unh.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).