Skip to content

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

Open
nicholasching wants to merge 33 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 33 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>
@azure-pipelines

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

@nicholasching

Copy link
Copy Markdown
Author

PortChannel netdev creation and LAG/SVI connected-IP assignment now run from
sai_test config helpers (vpp_ut_support.py) when each LAG or RIF is created,
instead of global run_test.sh startup/watchdog loops.

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

@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

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

COPY SAI/test/ptf /opt/ptf
COPY SAI/test/sai_test /sai_test
COPY .azure-pipelines/docker-sai-test-vpp/vpp_ut_support.py /sai_test/config/vpp_ut_support.py
COPY .azure-pipelines/docker-sai-test-vpp/harness_sai_test/overrides/lag_configer.py /sai_test/config/lag_configer.py

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.

This creates maintenance debt. If the one in sai_test is modified and creates a new dependency from certain test case, the "overrides" may become incompatible. One option is to modify sai_test lag_configer.py. It can be based on some env or config option like SIMULATE_SONIC. It is not necessary to be vpp specific.

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.

This reply consolidates this thread with #1950 (comment)

I agree, this creates two sources of truth. I've moved the PortChannel and LAG/SVI-IP setup out of the harness overrides and into sai_test, gated by a SIMULATE_SONIC option, disabled by default. As a result, the harness no longer needs to overlay sai_test, and run_test.sh just configures SIMULATE_SONIC=1 instead.

The sai_test change is a separate SAI PR (opencomputeproject/SAI#2316). The changes in SAI were made to be platform agnostic to respect the shared framework, therefore, VPP operations are passed in from the harness as a command template rather than hardcoding vppctl in sai_test.

I've re-validated the full integration of the changes made across (#1950, #1951, #1952, and the 4 SAI PRs) and verified there are no regressions against the 34-PASS baseline.

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

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

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.

3 participants