Skip to content

[vpp] SAIVPP unit-test harness (docker-sai-test-vpp) + devdocs#1950

Open
nicholasching wants to merge 36 commits into
sonic-net:masterfrom
nicholasching:vpp_ut_harness
Open

[vpp] SAIVPP unit-test harness (docker-sai-test-vpp) + devdocs#1950
nicholasching wants to merge 36 commits into
sonic-net:masterfrom
nicholasching:vpp_ut_harness

Conversation

@nicholasching

Copy link
Copy Markdown

Description of PR

Summary:
Adds the self-contained Docker harness (docker-sai-test-vpp) that runs the upstream OCP sai_test PTF suite against the real VPP SAI backend (libsaivs) in one container — VPP + saiserver + PTF + veth/AF_PACKET topology — and produces a per-test compatibility matrix. This is test scaffolding only (everything under .azure-pipelines/docker-sai-test-vpp/); it does not touch any production/runtime code, so it cannot affect existing sonic-sairedis functionality. Reviewers can start at .azure-pipelines/docker-sai-test-vpp/README.md and run_test.sh.

Fixes # (N/A — no upstream issue)

Type of change

  • Bug fix
  • New feature
  • Refactor / cleanup
  • Documentation update
  • Test improvement

Approach

What is the motivation for this PR?

There was no in-tree way to run the OCP sai_test suite against the VPP SAI backend and track per-test coverage. This harness provides that, plus the development docs and compatibility matrices used to drive the backend fixes.

How did you do it?

Added under .azure-pipelines/docker-sai-test-vpp/:

  • Dockerfile and run_test.sh (orchestrates Redis → veth/PortChannel topology → VPP → saiserver → PTF), plus T0 config (sai.profile, lanemap.ini, port-map.ini, ptf-port-map.ini) and gen_compatibility_matrix.py.
  • Config-signature grouping: because the VPP SAI backend builds the switch once per saiserver process, run_test.sh groups tests by their setUp config signature and restarts the backend per group, so one container can run any mix of tests.
  • ISOLATE_EACH_TEST (default on): run each test in its own group with a fresh backend + own config to eliminate cross-test config-reuse contamination; set 0 for faster grouped runs.
  • L3-over-LAG forwarding (harness portion): run_test.sh assigns the DUT-side connected IPs to each LAG (be<N>) and SVI (bvi<vlan>) so routed-to-LAG/SVI traffic forwards in the standalone PTF environment (the backend portion is in the backend-fixes PR).
  • Debug hold to keep VPP/saiserver/veths alive after a --debug run for vppctl inspection.
  • devdocs/, demodocs/, and results/ compatibility matrices; .gitignore for generated artifacts.

How did you verify/test it?

Running the harness against sai_route_test/sai_rif_test/sai_neighbor_test/sai_ecmp_test produces a compatibility matrix (current state: 34 PASS, captured in devdocs//results/). The harness is self-contained and does not build or run any production code.

Any platform specific information?

VPP platform test infrastructure only; isolated under .azure-pipelines/docker-sai-test-vpp/. No impact on the sonic-sairedis build or runtime behavior.

Documentation

This PR adds the harness README.md plus rolling/dated progress notes and deep-dive debug logs under .azure-pipelines/docker-sai-test-vpp/devdocs/ and demo docs under demodocs/.

Signed-off-by: Nicholas Ching <nicholaslching@gmail.com>
…test

Signed-off-by: Nicholas Ching <nicholaslching@gmail.com>
…dog, --relax

Signed-off-by: Nicholas Ching <nicholaslching@gmail.com>
…ature and restarting backend per group

Signed-off-by: Nicholas Ching <nicholaslching@gmail.com>
Signed-off-by: Nicholas Ching <nicholaslching@gmail.com>
Signed-off-by: Nicholas Ching <nicholaslching@gmail.com>
Signed-off-by: Nicholas Ching <nicholaslching@gmail.com>
…ugging

Signed-off-by: Nicholas Ching <nicholaslching@gmail.com>
Signed-off-by: Nicholas Ching <nicholaslching@gmail.com>
Signed-off-by: Nicholas Ching <nicholaslching@gmail.com>
Signed-off-by: Nicholas Ching <nicholaslching@gmail.com>
UT-harness portion of the L3-over-LAG forwarding fix: run_test.sh assigns the
DUT-side connected IPs to each LAG (be<N>) and SVI (bvi<vlan>) so routed-to-LAG
/SVI traffic forwards in the standalone PTF environment. The backend portion
(SwitchVppFdb.cpp) is in the VPP SAI backend PR.

Signed-off-by: Nicholas Ching <nicholaslching@gmail.com>
Signed-off-by: Nicholas Ching <nicholaslching@gmail.com>
Signed-off-by: Nicholas Ching <nicholaslching@gmail.com>
Signed-off-by: Nicholas Ching <nicholaslching@gmail.com>
Signed-off-by: Nicholas Ching <nicholaslching@gmail.com>
Signed-off-by: Nicholas Ching <nicholaslching@gmail.com>
@linux-foundation-easycla

linux-foundation-easycla Bot commented Jun 23, 2026

Copy link
Copy Markdown

CLA Signed
The committers listed above are authorized under a signed CLA.

@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

…SER)

- gen_compatibility_matrix.py: prefer defusedxml for parsing PTF JUnit XML
  (XXE-hardened), with a stdlib fallback; input is our own local test output.
- Dockerfile: annotate the root entrypoint with a nosemgrep justification — the
  --privileged harness must run as root to start VPP/Redis/saiserver and manage
  veth/AF_PACKET; it is a disposable test container, never a deployed service.

Signed-off-by: Nicholas Ching <nicholaslching@gmail.com>
@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

Satisfy tests/checkwhitespace.sh (Azure Build amd64 gate).

Signed-off-by: Nicholas Ching <nicholaslching@gmail.com>
…f using SAI teardown

Signed-off-by: Nicholas Ching <nicholaslching@gmail.com>
…MULATE_SONIC

Signed-off-by: Nicholas Ching <nicholaslching@gmail.com>
@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@nicholasching

Copy link
Copy Markdown
Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

Signed-off-by: Nicholas Ching <nicholaslching@gmail.com>
@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

# further packets remain - which is impossible for a real flood that delivers
# a copy to every member port. --relax makes verify_no_other_packets() a
# no-op, which is the intended/standard mode for flooding tests.
PTF_ARGS+=(--relax)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

PTF_ARGS+=(--relax) is added unconditionally to all targets, not just the T0 cases mentioned above. Please scope --relax to only the flood test cases rather than the entire run.

@nicholasching nicholasching Jul 22, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Good catch, thank you @dypet. --relax disabled PTF's verify_no_other_packets() check, and applying it globally masked unexpected forwarding in non-flood tests. I changed the harness to add it only for an explicit allowlist of positive flood classes that use verify_each_packet_on_multiple_port_lists(). All other selectors now run with strict unexpected-packet verification. The change is in 67b5980b.

After more testing, we found this incorrect implementation to be hiding some background IPv6 lifecycle/control packets that strict PTF correctly treated as unexpected traffic, bringing down # of successful tests from 34 -> 19. The README.md at this PR stage has been updated to reflect that.

Upon implementing an opt-in, exact PTF filter for simulated-router Router Solicitation and MLDv2 startup frames, plus Linux IPv6 setup ordering that prevents DAD/router-discovery packets, the # of successful tests was restored 19 -> 30. These fixes involve both SAI and sonic-sairedis components. To prevent re-opening vpp_backend_fixes these fixes will be bundled with the others in the Phase 3 PRs. The associated SAI fix is here: opencomputeproject/SAI#2321

# Collect this invocation's JUnit XML into the shared results dir.
if [[ -n "$TEST_RESULTS_DIR" ]]; then
mkdir -p "$TEST_RESULTS_DIR"
cp -f "$xunit_dir"/*.xml "$TEST_RESULTS_DIR"/ 2>/dev/null || true

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

With ISOLATE_EACH_TEST=1 (default) or multi-group runs, two invocations that emit the same TEST-.xml filename will clobber each other, and gen_compatibility_matrix.py (which globs TEST-*.xml) would then undercount. Suggest namespacing the copied files per invocation (e.g. prefix with group/idx or test target) so no results are lost.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Thank you, I agree. I added deterministic invocation namespaces when collecting each report, for example TEST-group-3-test-8-sai_route_test.xml, while retaining the TEST- prefix expected by the matrix generator. The README also clears stale XML before a new run. This change is in 2ce71f7b. A collision test was performed, confirming both same-named source reports and testcase rows were retained.

Signed-off-by: Nicholas Ching <nicholaslching@gmail.com>
Signed-off-by: Nicholas Ching <nicholaslching@gmail.com>
Copilot AI review requested due to automatic review settings July 21, 2026 21:29

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

Signed-off-by: Nicholas Ching <nicholaslching@gmail.com>
Copilot AI review requested due to automatic review settings July 22, 2026 00:25

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

@nicholasching
nicholasching requested a review from dypet July 22, 2026 01:06
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.

5 participants