diff options
| author | Luca Vizzarro <[email protected]> | 2024-11-13 16:31:27 +0000 |
|---|---|---|
| committer | Patrick Robb <[email protected]> | 2024-11-13 20:55:32 +0100 |
| commit | 8d46662d93e45ab301a5e4dbb1187d26760aed6a (patch) | |
| tree | 30ce44404b1d75bdde3124d4d7f6fafd5052d702 | |
| parent | a97f8cc4efef6dd88352c823d98f89a8a8183e58 (diff) | |
dts: allow to get multiple expected packets
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 <[email protected]>
Reviewed-by: Paul Szczepanek <[email protected]>
Reviewed-by: Dean Marx <[email protected]>
Reviewed-by: Patrick Robb <[email protected]>
Tested-by: Patrick Robb <[email protected]>
| -rw-r--r-- | dts/framework/test_suite.py | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/dts/framework/test_suite.py b/dts/framework/test_suite.py index 5b3e7c205e..7a75334cfa 100644 --- a/dts/framework/test_suite.py +++ b/dts/framework/test_suite.py @@ -310,16 +310,31 @@ class TestSuite(TestProtocol): 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_packets([packet])[0] def _adjust_addresses(self, packets: list[Packet], expected: bool = False) -> list[Packet]: """L2 and L3 address additions in both directions. |
