test(flow): cover NetFlow v1/v7 and sFlow IPv6 parse paths#775
Conversation
Adds three minimal hand-rolled pcap fixtures (nf1.pcap, nf7.pcap, sflow_ipv6.pcap) and accompanying test cases that exercise dispatch arms in NetflowData.h (versions 1 and 7) and the IPv6 sampled-header path in SflowData.h. Existing flow tests only cover v5/v9/IPFIX and sFlow with IPv4 payloads. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
@codex review |
LCOV of commit
|
Adds sflow_keyed.pcap, a single sFlow v5 datagram with two flow_samples whose elements use tag=3 (SFLFLOW_IPV4) and tag=4 (SFLFLOW_IPV6) — the key-only sampled-flow formats that exercise readFlowSample_IPv4 and readFlowSample_IPv6 in SflowData.h. Previous sflow fixtures only carried SFLFLOW_HEADER (tag=1) elements, so those two decoders were uncovered. Asserts that the resulting per-interface metrics reflect both elements: one IPv4 TCP flow (1500 bytes) and one IPv6 UDP flow (1280 bytes). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
@codex review |
|
Codex Review: Didn't find any major issues. Keep them coming! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 853f87bee2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Codex pointed out that the IPv6 sflow test asserted only records_flows >= 1, which would pass even if decodeIPV6 regressed. Investigating uncovered a real bug in the original fixture: it set SFLHEADER_IPv6 to 11 (which is SFLHEADER_IPv4), so the parser took the IPv4 branch and decodeIPV6 never ran. Regenerates sflow_ipv6.pcap with header_protocol=12 and asserts the IPv6/UDP per-interface counters land in their IPv6 buckets. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
@codex review |
|
Codex Review: Didn't find any major issues. Another round soon, please! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Summary
nf1.pcap,nf7.pcap,sflow_ipv6.pcap— undersrc/tests/fixtures/.src/handlers/flow/test_flows.cppthat driveFlowInputStreamagainst each fixture.NetflowData.hversion-1 and version-7 dispatch (case 1/case 7 at lines 686-691), andSflowData.h'sdecodeIPV6()path forSFLADDRESSTYPE_IP_V6sampled headers.Test plan
unit-tests-handler-flow "Parse netflow v1 stream"passesunit-tests-handler-flow "Parse netflow v7 stream"passesunit-tests-handler-flow "Parse sflow IPv6 sample"passes