topology - Testbed Topology
Testbed topology representation.
A topology of a testbed captures what links are available between the testbed’s nodes. The link information then implies what type of topology is available.
- class TopologyType
Bases:
int
,Enum
Supported topology types.
- no_link = 0
A topology with no Traffic Generator.
- one_link = 1
A topology with one physical link between the SUT node and the TG node.
- two_links = 2
A topology with two physical links between the Sut node and the TG node.
- classmethod default() TopologyType
The default topology required by test cases if not specified otherwise.
- __new__(value)
- class PortLink
Bases:
NamedTuple
The physical, cabled connection between the ports.
- sut_port: Port
The port on the SUT node connected to tg_port.
- tg_port: Port
The port on the TG node connected to sut_port.
- static __new__(_cls, sut_port: Port, tg_port: Port)
Create new instance of PortLink(sut_port, tg_port)
- NodeIdentifier
The node identifier.
alias of
Literal
[‘sut’, ‘tg’]
- class Topology
Bases:
object
Testbed topology.
The topology contains ports processed into ingress and egress ports. If there are no ports on a node, accesses to
tg_port_egress
and alike will raise an exception. If there is only one link available, the ports of this link are stored as both ingress and egress ports.It’s up to
TestRun
to ensure no test case or suite requiring actual links is executed when the topology prohibits it and up to the developers to make sure that test cases not requiring any links don’t use any ports. Otherwise, the underlying methods using the ports will fail.- type
The type of the topology.
- sut_ports
The SUT ports.
- Type:
list[framework.testbed_model.port.Port]
- tg_ports
The TG ports.
- Type:
list[framework.testbed_model.port.Port]
- classmethod from_port_links(port_links: Iterator[PortLink]) typing_extensions.Self
Create the topology from port_links.
- Parameters:
port_links (Iterator[PortLink]) – The test run’s required port links.
- Raises:
ConfigurationError – If an unsupported link topology is supplied.
- node_and_ports_from_id(node_identifier: Literal['sut', 'tg']) tuple[framework.testbed_model.node.Node, list[framework.testbed_model.port.Port]]
Retrieve node and its ports for the current topology.
- Raises:
InternalError – If the given node_identifier is invalid.
- setup() None
Setup topology ports.
Binds all the ports to the right kernel driver to retrieve MAC addresses and logical names.
- teardown() None
Teardown topology ports.
Restores all the ports to their original drivers before the test run.
- instantiate_vf_ports() None
Create, setup, and add virtual functions to the list of ports on the SUT node.
- Raises:
InternalError – If virtual function creation fails.
- delete_vf_ports() None
Delete virtual functions from the SUT node during test run teardown.
- configure_ports(node_identifier: Literal['sut', 'tg'], drivers: Union[Literal['kernel', 'dpdk'], tuple[Literal['kernel', 'dpdk'], ...]]) None
Configure the ports for the requested node as specified in drivers.
Compares the current topology driver setup with the requested one and binds drivers only if needed. Moreover, it brings up the ports when using their kernel drivers.
- Parameters:
node_identifier (Literal['sut', 'tg']) – The identifier of the node to gather the ports from.
drivers (Union[Literal['kernel', 'dpdk'], tuple[typing.Literal['kernel', 'dpdk'], ...]]) – The driver kind(s) to bind. If a tuple is provided, each element corresponds to the driver for the respective port by index. Otherwise, if a driver kind is specified directly, this is applied to all the ports in the node.
- Raises:
InternalError – If the number of given driver kinds is greater than the number of available topology ports.
- property sut_dpdk_ports: list[framework.testbed_model.port.Port]
The DPDK ports for the SUT node.
- property tg_port_egress: Port
The egress port of the TG node.
- property sut_port_ingress: Port
The ingress port of the SUT node.
- property sut_port_egress: Port
The egress port of the SUT node.
- __init__(type: TopologyType, sut_ports: list[framework.testbed_model.port.Port], tg_ports: list[framework.testbed_model.port.Port], pf_ports: list[framework.testbed_model.port.Port], vf_ports: list[framework.testbed_model.port.Port]) None
- property tg_port_ingress: Port
The ingress port of the TG node.