[v3,2/3] dts: allow to get multiple expected packets

Message ID 20241108170138.203096-3-luca.vizzarro@arm.com (mailing list archive)
State Superseded, archived
Delegated to: Paul Szczepanek
Headers
Series dts: add l2fwd test suite |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Luca Vizzarro Nov. 8, 2024, 5:01 p.m. UTC
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

Dean Marx Nov. 12, 2024, 5:16 p.m. UTC | #1
Reviewed-by: Dean Marx <dmarx@iol.unh.edu>
  
Patrick Robb Nov. 13, 2024, 3:36 p.m. UTC | #2
Reviewed-by: Patrick Robb <probb@iol.unh.edu>
Tested-by: Patrick Robb <probb@iol.unh.edu>
  

Patch

diff --git a/dts/framework/test_suite.py b/dts/framework/test_suite.py
index 5b3e7c205e..23fe41a10e 100644
--- a/dts/framework/test_suite.py
+++ b/dts/framework/test_suite.py
@@ -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.