automated: linux: add tcpreplay testing framework
This patch introduces an automated testing setup for tcpreplay-based traffic
replay and analysis. The system consists of:
1. `tcpreplay.py`: A test runner that:
- Creates and configures a TAP interface
- Replays PCAP files using `tcpreplay`
- Tracks results and produces a summary for each test
- Handles both expected and unexpected results (e.g., xfail -> pass)
2. `generate_pcap.py`: A Scapy-based script to:
- Generate a suite of PCAP files for functional and edge case testing
- Include both valid packets and malformed/false-positive scenarios
- Provide coverage for multiple protocols (TCP, UDP, ICMP, DNS, etc.)
- Simulate problematic flows like fragmented packets and invalid flags
Highlights:
- xfail support: tests expected to fail are counted as 'pass' if they do fail
- xpass detection: alerts if a known-broken test unexpectedly succeeds
- Easy extensibility for new PCAPs and expectations
Example test cases include:
- TCP lifecycle (`tcp_basic`, `tcp_full_cycle`)
- Bad flag scenarios (`bad_tcp_flags`)
- Noise/overlap (`false_positive_overlap`)
- Fragmentation and malformed headers
Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
3 files changed