[PATCH v3 08/12] dts: add NIC capability support
Jeremy Spewock
jspewock at iol.unh.edu
Tue Aug 27 18:36:54 CEST 2024
On Wed, Aug 21, 2024 at 10:53 AM Juraj Linkeš
<juraj.linkes at pantheon.tech> wrote:
<snip>
> diff --git a/dts/framework/testbed_model/capability.py b/dts/framework/testbed_model/capability.py
> index 8899f07f76..9a79e6ebb3 100644
> --- a/dts/framework/testbed_model/capability.py
> +++ b/dts/framework/testbed_model/capability.py
> @@ -5,14 +5,40 @@
<snip>
> + @classmethod
> + def get_supported_capabilities(
> + cls, sut_node: SutNode, topology: "Topology"
> + ) -> set["DecoratedNicCapability"]:
> + """Overrides :meth:`~Capability.get_supported_capabilities`.
> +
> + The capabilities are first sorted by decorators, then reduced into a single function which
> + is then passed to the decorator. This way we only execute each decorator only once.
> + """
> + supported_conditional_capabilities: set["DecoratedNicCapability"] = set()
> + logger = get_dts_logger(f"{sut_node.name}.{cls.__name__}")
> + if topology.type is Topology.type.no_link:
As a follow-up, I didn't notice this during my initial review, but in
testing this line was throwing attribute errors for me due to Topology
not having an attribute named `type`. I think this was because of
`Topology.type.no_link` since this attribute isn't initialized on the
class itself. I fixed this by just replacing it with
`TopologyType.no_link` locally.
> + logger.debug(
> + "No links available in the current topology, not getting NIC capabilities."
> + )
> + return supported_conditional_capabilities
> + logger.debug(
> + f"Checking which NIC capabilities from {cls.capabilities_to_check} are supported."
> + )
> + if cls.capabilities_to_check:
> + capabilities_to_check_map = cls._get_decorated_capabilities_map()
> + with TestPmdShell(sut_node, privileged=True) as testpmd_shell:
> + for conditional_capability_fn, capabilities in capabilities_to_check_map.items():
> + supported_capabilities: set[NicCapability] = set()
<snip>
>
More information about the dev
mailing list