Hi Patrick, I am assuming the move of send_packets is because we can't send arbitrary packets with a perf generator. I believe this should be explained as it's not clear why the move and it feels counterintuitive at first.
On Wed, Oct 01, 2025 at 07:16:57PM +0000, Patrick Robb wrote: > diff --git > a/dts/framework/testbed_model/traffic_generator/performance_traffic_generator.py > > b/dts/framework/testbed_model/traffic_generator/performance_traffic_generator.py > new file mode 100644 > index 0000000000..6b23faa1a5 > --- /dev/null > +++ > b/dts/framework/testbed_model/traffic_generator/performance_traffic_generator.py > @@ -0,0 +1,63 @@ > +"""Traffic generators for performance tests which can generate a high number > of packets.""" > + > +from abc import abstractmethod > +from dataclasses import dataclass > + > +from scapy.packet import Packet > + > +from framework.testbed_model.topology import Topology > + > +from .traffic_generator import TrafficGenerator > + > + > +@dataclass(slots=True) > +class PerformanceTrafficStats: > + """Data structure to store performance statistics for a given test run. > + > + Attributes: > + tx_pps: Recorded tx packets per second > + tx_bps: Recorded tx bytes per second > + rx_pps: Recorded rx packets per second > + rx_bps: Recorded rx bytes per second > + frame_size: The total length of the frame nit: missing full stops at the end of each attribute. > + """ > + > + tx_pps: float > + tx_bps: float > + rx_pps: float > + rx_bps: float > + > + frame_size: int | None = None > + > + > +class PerformanceTrafficGenerator(TrafficGenerator): > + """An abstract base class for all performance-oriented traffic > generators. > + > + Provides an intermediary interface for performance-based traffic > generator. > + """ > + > + @abstractmethod > + def calculate_traffic_and_stats( > + self, > + packet: Packet, > + duration: float, > + send_mpps: int | None = None, > + ) -> PerformanceTrafficStats: > + """Send packet traffic and acquire associated statistics. > + > + If `send_mpps` is provided, attempt to transmit traffic at the > `send_mpps` rate. > + Otherwise, attempt to transmit at line rate. > + > + Args: > + packet: The packet to send. > + duration: Performance test duration (in seconds). > + send_mpps: The millions packets per second send rate. > + > + Returns: > + Performance statistics of the generated test. > + """ > + > + def setup(self, topology: Topology) -> None: > + """Overrides :meth:`.traffic_generator.TrafficGenerator.setup`.""" > + for port in self._tg_node.ports: > + self._tg_node.main_session.configure_port_mtu(2000, port) should do: port.configure_mtu(2000)

