Conversation
- TrexTestRun: optional pcap argument restricting TRex traffic to a single profile pcap (set_pcap on BaseTrexClientManager) - STF profile is rebuilt and re-uploaded when the pcap changes - add generated Bond PMD test pcaps (flow A, flows B/C/D) as LFS objects
TRex infrastructure for functional tests that need exact packet counts per replayed pcap: * TrexTestRun.execute(pcap=, single_pass=) - select the pcap and optionally disable the duration fallback per execution, so the traffic volume is bounded by the pcap content, not by time * set_props accepts duration=None -> STL single-pass: every pcap is transmitted exactly once instead of looping for a duration; ASTF and STF still require a duration (explicit guards) * _selectable_pcaps snapshot taken at the end of __init__ so that set_pcap can re-select any profile pcap later, not just the ones remaining after the previous narrowing-down
suricata_conf_file now falls back to a suricata.yaml placed next to the test file when no --suricata-cfg is given, letting a test pin capture-specific settings (e.g. DPDK queue/RSS config) without a dedicated command-line path.
Verify traffic delivery through a DPDK bond (logical interface combining multiple physical ports) in functional_tests/bond/. The test is parametrized by stage so each stage is a separate pytest node and runs in isolation: * stage 1: single flow A (1000 pkts) received intact through the bond (pkts + bytes asserted against the generated frame length) * stage 2: delivery continuity - Suricata keeps receiving without stall/crash (mid-burst member link-down requires TRex port control, documented as follow-up) * stage 3: LACP aggregate delivery of distinct flows B/C/D (6000 pkts; per-member distribution is not visible through the logical bond iface) Bond mode and membership are provisioned outside of this suite - see functionalTesting.md 'Bond PMD'. Uses a test-local suricata.yaml and the new BondProfile (STL, both pcaps at weight 1).
Recreates both bond test pcaps (flow A x 1000 packets; flows B/C/D x 2000 packets each, UDP with 1400B payload) from scapy - re-run when the test stages change.
There was a problem hiding this comment.
🟡 Changes recommended
The STL single-pass replay loop can exit after a TRexError without retrying, which can result in no traffic being sent.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR adds a new “bond” functional test (DPDK bond interface) and extends the TRex traffic-profile infrastructure to support selecting a specific PCAP and replaying STL traffic in a single-pass mode, while also improving Suricata config isolation by allowing per-test suricata.yaml overrides.
Changes:
- Add bond functional test (test code, Suricata test-local config, PCAP generator, TRex traffic profile, and LFS-tracked PCAP assets).
- Extend TRex client manager to support
set_pcap(...)selection andduration=Nonesingle-pass STL replay. - Update test runner and config plumbing to pass through PCAP selection and allow test-local Suricata configs.
File summaries
| File | Description |
|---|---|
util/test_runner.py |
Adds pcap/single_pass parameters to execution flow and wires PCAP selection into TRex setup. |
README.md |
Documents the new bond functional test and how to run stages. |
functional_tests/bond/test_settings.json |
Added/updated test settings placeholder (file is currently empty in this PR snapshot). |
functional_tests/bond/test_bond.py |
New staged pytest functional test that asserts Suricata decoder delivery through a bond. |
functional_tests/bond/suricata.yaml |
Test-local Suricata configuration tailored for the bond functional scenario. |
functional_tests/bond/generate_pcaps.py |
Script to generate the bond test PCAPs under assets/trex/traffic_profiles/pcaps/. |
conftest.py |
Allows using a test-local suricata.yaml when present next to a test. |
assets/trex/traffic_profiles/trex_client_manager.py |
Implements set_pcap(...) and STL single-pass replay via duration=None. |
assets/trex/traffic_profiles/pcaps/bond_flows_bcd_6000p.pcap |
Adds generated PCAP via Git LFS pointer. |
assets/trex/traffic_profiles/pcaps/bond_flow_a_1000p.pcap |
Adds generated PCAP via Git LFS pointer. |
assets/trex/traffic_profiles/functional_tests/bond_profile/profile.py |
New TRex profile listing bond test PCAPs. |
Review details
Suppressed comments (1)
util/test_runner.py:99
TrexTestRunoverrides still typedurationasint, butTestRun.execute(..., single_pass=True)can passNonethrough to both_before_trafficand_run_traffic. Update the override signatures toint | Noneto reflect the new single-pass STL behavior.
def _before_traffic(
self, multiplier: float, duration: int, pcap: str | None = None
):
if pcap is not None:
self.trex_client.set_pcap(pcap)
- Files reviewed: 10/11 changed files
- Comments generated: 4
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+395
to
+399
| entry = Path(pcap_entry) | ||
| req = Path(requested) | ||
| if entry.name == req.name: | ||
| return True | ||
| return entry.stem.startswith(f"{req.stem}.vlan") |
Comment on lines
602
to
+606
| if elapsed >= heatup and on_measurement_start is not None: | ||
| on_measurement_start() | ||
| on_measurement_start = None | ||
| if self.duration is None: | ||
| break # single pass done |
Comment on lines
+31
to
37
| def _before_traffic( | ||
| self, multiplier: float, duration: int, pcap: str | None = None | ||
| ): | ||
| """Prepare TRex before suricata starts (select pcap, reset, set_props).""" | ||
|
|
||
| def _run_traffic(self, multiplier: float, duration: int, run_info: RunInfo): | ||
| """Generate traffic. Suricata is already running.""" |
Comment on lines
+11
to
+14
| parametrized by stage so a single stage can be selected and run in | ||
| isolation via its node ID, e.g. | ||
| `functional_tests/bond/test_bond.py::test_bond[2]`: | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces a new functional test suite for verifying traffic delivery through a DPDK bond (logical interface) and adds supporting infrastructure to the codebase. The main changes include new test documentation, test assets (including generated PCAPs and a profile), enhancements to the traffic profile management code to support selective PCAP replay and single-pass STL traffic, and improved Suricata configuration handling for test-local configs.
Bond Functional Test Addition:
Documentation and Test Description
README.mdnow documents a new "bond" functional test, describing its stages, usage, and limitations.Test Asset Generation
functional_tests/bond/generate_pcaps.pyto generate specific PCAP files used by the bond test, and added the generated PCAPs (bond_flow_a_1000p.pcap,bond_flows_bcd_6000p.pcap) to the repository.assets/trex/traffic_profiles/functional_tests/bond_profile/profile.py.Enhancements to Traffic Profile Management:
Selective PCAP Replay and Single-Pass STL Support
BaseTrexClientManagerto allow selecting a specific PCAP for replay via a newset_pcapmethod, supporting both original and VLAN-tagged PCAPs.duration=Noneinset_propsand adjusting the traffic sending loop accordingly.Internal and API Improvements
multiplieranddurationin various modes.Test Infrastructure Improvements:
suricata.yaml) if present, improving test isolation and reproducibility.Other Minor Updates:
These changes collectively enable robust, parameterized functional testing of DPDK bond interfaces, with flexible traffic replay and improved test configuration management.