[PATCH v1 2/3] dts: rework testbed_model Port objects to contain unique identifiers

Juraj Linkeš juraj.linkes at pantheon.tech
Tue Sep 10 12:17:27 CEST 2024



On 21. 8. 2024 20:43, Nicholas Pratte wrote:
> In order to leverage the usability of unique identifiers on ports, the
> testbed_model Port object needs some refactoring/trimming of obsolete or
> needless attributes.
> 
> Bugzilla ID: 1478
> 
> Signed-off-by: Nicholas Pratte <npratte at iol.unh.edu>
> ---
>   dts/framework/testbed_model/port.py | 45 +++++++----------------------
>   1 file changed, 10 insertions(+), 35 deletions(-)
> 
> diff --git a/dts/framework/testbed_model/port.py b/dts/framework/testbed_model/port.py
> index 817405bea4..75bc38f16e 100644
> --- a/dts/framework/testbed_model/port.py
> +++ b/dts/framework/testbed_model/port.py
> @@ -14,43 +14,30 @@
>   from framework.config import PortConfig
>   
>   
> - at dataclass(slots=True, frozen=True)
> -class PortIdentifier:
> -    """The port identifier.
> -
> -    Attributes:
> -        node: The node where the port resides.
> -        pci: The PCI address of the port on `node`.
> -    """
> -
> -    node: str
> -    pci: str
> -
> -
>   @dataclass(slots=True)
>   class Port:
>       """Physical port on a node.
>   
> -    The ports are identified by the node they're on and their PCI addresses. The port on the other
> -    side of the connection is also captured here.
> +    The ports are identified using a unique, user-defined name/identifier.
>       Each port is serviced by a driver, which may be different for the operating system (`os_driver`)
>       and for DPDK (`os_driver_for_dpdk`). For some devices, they are the same, e.g.: ``mlx5_core``.
>   
>       Attributes:
> -        identifier: The PCI address of the port on a node.
> +        node_name: Node the port exists on.

This would be more accurate as "The name of the node the port exists 
on.". It's not a big deal since the type is str, but being explicit is 
better.

> +        name: User-defined unique identifier of the port.
> +        pci: The pci address assigned to the port.
>           os_driver: The operating system driver name when the operating system controls the port,
>               e.g.: ``i40e``.
>           os_driver_for_dpdk: The operating system driver name for use with DPDK, e.g.: ``vfio-pci``.
> -        peer: The identifier of a port this port is connected with.
> -            The `peer` is on a different node.
>           mac_address: The MAC address of the port.
>           logical_name: The logical name of the port. Must be discovered.
>       """
>   
> -    identifier: PortIdentifier
> +    node: str

Let's rename this to node_name. This is only used in one place in the 
framework so it's not a big change and it better reflects what the 
variable stores.



More information about the dev mailing list