diff options
| author | Luca Vizzarro <[email protected]> | 2024-08-19 15:41:19 +0100 |
|---|---|---|
| committer | Luca Vizzarro <[email protected]> | 2024-11-11 14:43:21 +0100 |
| commit | b935bdc3da26ab86ec775dfad3aa63a1a61f5667 (patch) | |
| tree | de0b7269de9b7e5dbcb5bc8f828057e50932008c /dts/framework/testbed_model/node.py | |
| parent | c72ff85d259287c7ec9880b94891310050fe54e6 (diff) | |
dts: use Pydantic in the configuration
This change brings in pydantic in place of warlock. Pydantic offers
a built-in model validation system in the classes, which allows for
a more resilient and simpler code. As a consequence of this change:
- most validation is now built-in
- further validation is added to verify:
- cross referencing of node names and ports
- test suite and test cases names
- dictionaries representing the config schema are removed
- the config schema is no longer used and therefore dropped
- the TrafficGeneratorType enum has been changed from inheriting
StrEnum to the native str and Enum. This change was necessary to
enable the discriminator for object unions
- the structure of the classes has been slightly changed to perfectly
match the structure of the configuration files
- the test suite argument catches the ValidationError that
TestSuiteConfig can now raise
- the DPDK location has been wrapped under another configuration
mapping `dpdk_location`
- the DPDK locations are now structured and enforced by classes,
further simplifying the validation and handling thanks to
pattern matching
Bugzilla ID: 1508
Signed-off-by: Luca Vizzarro <[email protected]>
Reviewed-by: Paul Szczepanek <[email protected]>
Reviewed-by: Nicholas Pratte <[email protected]>
Reviewed-by: Patrick Robb <[email protected]>
Diffstat (limited to 'dts/framework/testbed_model/node.py')
| -rw-r--r-- | dts/framework/testbed_model/node.py | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/dts/framework/testbed_model/node.py b/dts/framework/testbed_model/node.py index 62867fd80c..6031eaf937 100644 --- a/dts/framework/testbed_model/node.py +++ b/dts/framework/testbed_model/node.py @@ -17,7 +17,12 @@ from abc import ABC from ipaddress import IPv4Interface, IPv6Interface from typing import Union -from framework.config import OS, DPDKLocation, NodeConfiguration, TestRunConfiguration +from framework.config import ( + OS, + DPDKBuildConfiguration, + NodeConfiguration, + TestRunConfiguration, +) from framework.exception import ConfigurationError from framework.logger import DTSLogger, get_dts_logger @@ -89,13 +94,15 @@ class Node(ABC): self._init_ports() def _init_ports(self) -> None: - self.ports = [Port(port_config) for port_config in self.config.ports] + self.ports = [Port(self.name, port_config) for port_config in self.config.ports] self.main_session.update_ports(self.ports) for port in self.ports: self.configure_port_state(port) def set_up_test_run( - self, test_run_config: TestRunConfiguration, dpdk_location: DPDKLocation + self, + test_run_config: TestRunConfiguration, + dpdk_build_config: DPDKBuildConfiguration, ) -> None: """Test run setup steps. @@ -105,7 +112,7 @@ class Node(ABC): Args: test_run_config: A test run configuration according to which the setup steps will be taken. - dpdk_location: The target source of the DPDK tree. + dpdk_build_config: The build configuration of DPDK. """ self._setup_hugepages() |
