Skip to content

Feat/12341 pmd implementation v1 - #61

Open
Davihan11 wants to merge 5 commits into
CESNET:mainfrom
Davihan11:feat/12341-pmd-implementation-v1
Open

Davihan11 wants to merge 5 commits into
CESNET:mainfrom
Davihan11:feat/12341-pmd-implementation-v1

Conversation

@Davihan11

Copy link
Copy Markdown
Collaborator

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

    • The README.md now documents a new "bond" functional test, describing its stages, usage, and limitations.
  • Test Asset Generation

    • Added functional_tests/bond/generate_pcaps.py to 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.
    • Introduced a new traffic profile for the bond test in assets/trex/traffic_profiles/functional_tests/bond_profile/profile.py.

Enhancements to Traffic Profile Management:

  • Selective PCAP Replay and Single-Pass STL Support

    • Extended BaseTrexClientManager to allow selecting a specific PCAP for replay via a new set_pcap method, supporting both original and VLAN-tagged PCAPs.
    • Modified STL mode to support single-pass traffic (replaying a PCAP exactly once) by allowing duration=None in set_props and adjusting the traffic sending loop accordingly.
  • Internal and API Improvements

    • Added tracking of selectable and selected PCAPs, and ensured proper handling of VLAN edits and PCAP uploads for different TRex modes.
    • Updated error handling and documentation for traffic profile methods to clarify requirements for multiplier and duration in various modes.

Test Infrastructure Improvements:

  • Suricata Configuration Handling
    • Enhanced the test infrastructure to automatically use a test-local Suricata configuration file (suricata.yaml) if present, improving test isolation and reproducibility.

Other Minor Updates:

  • Copyright
    • Updated author and copyright information in relevant files.

These changes collectively enable robust, parameterized functional testing of DPDK bond interfaces, with flexible traffic replay and improved test configuration management.

- 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.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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 and duration=None single-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

  • TrexTestRun overrides still type duration as int, but TestRun.execute(..., single_pass=True) can pass None through to both _before_traffic and _run_traffic. Update the override signatures to int | None to 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 thread util/test_runner.py
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]`:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants