[v3,2/3] dts: allow to get multiple expected packets
Checks
Commit Message
At the moment there is only one facility that allows to prepare a packet
as it is expected to be received on the traffic generator end. Extend
this to allow to prepare multiple packets at the same time.
Signed-off-by: Luca Vizzarro <luca.vizzarro@arm.com>
Reviewed-by: Paul Szczepanek <paul.szczepanek@arm.com>
---
dts/framework/test_suite.py | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
Comments
Reviewed-by: Dean Marx <dmarx@iol.unh.edu>
Reviewed-by: Patrick Robb <probb@iol.unh.edu>
Tested-by: Patrick Robb <probb@iol.unh.edu>
@@ -310,16 +310,31 @@ def send_packets(
packets = self._adjust_addresses(packets)
self.tg_node.send_packets(packets, self._tg_port_egress)
+ def get_expected_packets(self, packets: list[Packet]) -> list[Packet]:
+ """Inject the proper L2/L3 addresses into `packets`.
+
+ Inject the L2/L3 addresses expected at the receiving end of the traffic generator.
+
+ Args:
+ packets: The packets to modify.
+
+ Returns:
+ `packets` with injected L2/L3 addresses.
+ """
+ return self._adjust_addresses(packets, expected=True)
+
def get_expected_packet(self, packet: Packet) -> Packet:
"""Inject the proper L2/L3 addresses into `packet`.
+ Inject the L2/L3 addresses expected at the receiving end of the traffic generator.
+
Args:
packet: The packet to modify.
Returns:
`packet` with injected L2/L3 addresses.
"""
- return self._adjust_addresses([packet], expected=True)[0]
+ return self.get_expected_packet([packet])[0]
def _adjust_addresses(self, packets: list[Packet], expected: bool = False) -> list[Packet]:
"""L2 and L3 address additions in both directions.