[v2,3/8] dts: refactor EalParams
Checks
Commit Message
Move EalParams to its own module to avoid circular dependencies.
Signed-off-by: Luca Vizzarro <luca.vizzarro@arm.com>
Reviewed-by: Paul Szczepanek <paul.szczepanek@arm.com>
---
dts/framework/params/eal.py | 50 +++++++++++++++++++
dts/framework/remote_session/testpmd_shell.py | 2 +-
dts/framework/testbed_model/sut_node.py | 42 +---------------
3 files changed, 53 insertions(+), 41 deletions(-)
create mode 100644 dts/framework/params/eal.py
new file mode 100644
@@ -0,0 +1,50 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2024 Arm Limited
+
+"""Module representing the DPDK EAL-related parameters."""
+
+from dataclasses import dataclass, field
+from typing import Literal
+
+from framework.params import Params, Switch
+from framework.testbed_model.cpu import LogicalCoreList
+from framework.testbed_model.port import Port
+from framework.testbed_model.virtual_device import VirtualDevice
+
+
+def _port_to_pci(port: Port) -> str:
+ return port.pci
+
+
+@dataclass(kw_only=True)
+class EalParams(Params):
+ """The environment abstraction layer parameters.
+
+ Attributes:
+ lcore_list: The list of logical cores to use.
+ memory_channels: The number of memory channels to use.
+ prefix: Set the file prefix string with which to start DPDK, e.g.: ``prefix="vf"``.
+ no_pci: Switch to disable PCI bus, e.g.: ``no_pci=True``.
+ vdevs: Virtual devices, e.g.::
+ vdevs=[
+ VirtualDevice('net_ring0'),
+ VirtualDevice('net_ring1')
+ ]
+ ports: The list of ports to allow.
+ other_eal_param: user defined DPDK EAL parameters, e.g.:
+ ``other_eal_param='--single-file-segments'``
+ """
+
+ lcore_list: LogicalCoreList = field(metadata=Params.short("l"))
+ memory_channels: int = field(metadata=Params.short("n"))
+ prefix: str = field(metadata=Params.long("file-prefix"))
+ no_pci: Switch = None
+ vdevs: list[VirtualDevice] | None = field(
+ default=None, metadata=Params.multiple() | Params.long("vdev")
+ )
+ ports: list[Port] | None = field(
+ default=None,
+ metadata=Params.convert_value(_port_to_pci) | Params.multiple() | Params.short("a"),
+ )
+ other_eal_param: Params | None = None
+ _separator: Literal[True] = field(default=True, init=False, metadata=Params.short("-"))
@@ -21,8 +21,8 @@
from typing import Callable, ClassVar
from framework.exception import InteractiveCommandExecutionError
+from framework.params.eal import EalParams
from framework.settings import SETTINGS
-from framework.testbed_model.sut_node import EalParams
from framework.utils import StrEnum
from .interactive_shell import InteractiveShell
@@ -15,9 +15,8 @@
import os
import tarfile
import time
-from dataclasses import dataclass, field
from pathlib import PurePath
-from typing import Literal, Type
+from typing import Type
from framework.config import (
BuildTargetConfiguration,
@@ -26,6 +25,7 @@
SutNodeConfiguration,
)
from framework.params import Params, Switch
+from framework.params.eal import EalParams
from framework.remote_session import CommandResult
from framework.settings import SETTINGS
from framework.utils import MesonArgs
@@ -37,44 +37,6 @@
from .virtual_device import VirtualDevice
-def _port_to_pci(port: Port) -> str:
- return port.pci
-
-
-@dataclass(kw_only=True)
-class EalParams(Params):
- """The environment abstraction layer parameters.
-
- Attributes:
- lcore_list: The list of logical cores to use.
- memory_channels: The number of memory channels to use.
- prefix: Set the file prefix string with which to start DPDK, e.g.: ``prefix="vf"``.
- no_pci: Switch to disable PCI bus, e.g.: ``no_pci=True``.
- vdevs: Virtual devices, e.g.::
- vdevs=[
- VirtualDevice('net_ring0'),
- VirtualDevice('net_ring1')
- ]
- ports: The list of ports to allow.
- other_eal_param: user defined DPDK EAL parameters, e.g.:
- ``other_eal_param='--single-file-segments'``
- """
-
- lcore_list: LogicalCoreList = field(metadata=Params.short("l"))
- memory_channels: int = field(metadata=Params.short("n"))
- prefix: str = field(metadata=Params.long("file-prefix"))
- no_pci: Switch
- vdevs: list[VirtualDevice] | None = field(
- default=None, metadata=Params.multiple() | Params.long("vdev")
- )
- ports: list[Port] | None = field(
- default=None,
- metadata=Params.convert_value(_port_to_pci) | Params.multiple() | Params.short("a"),
- )
- other_eal_param: Params | None = None
- _separator: Literal[True] = field(default=True, init=False, metadata=Params.short("-"))
-
-
class SutNode(Node):
"""The system under test node.