Skip to content

sai_test: add opt-in SIMULATE_SONIC to emulate SONiC teamd/IntfMgr netdevs for standalone benches#2316

Open
nicholasching wants to merge 1 commit into
opencomputeproject:masterfrom
nicholasching:simulate_sonic
Open

sai_test: add opt-in SIMULATE_SONIC to emulate SONiC teamd/IntfMgr netdevs for standalone benches#2316
nicholasching wants to merge 1 commit into
opencomputeproject:masterfrom
nicholasching:simulate_sonic

Conversation

@nicholasching

Copy link
Copy Markdown

Context / motivation
Part of the SAIVPP unit-test framework (see the sonic-sairedis docker-sai-test-vpp harness). When the OCP sai_test T0 suite runs against a SAI backend on a standalone bench with no SONiC control plane, there is no teamd to create PortChannel netdevs and no IntfMgr to assign LAG/SVI interface IPs — which some backends (e.g. the VPP virtual switch) rely on for LAG bring-up and routed-to-LAG/SVI forwarding. This adds an opt-in way for the test setup to emulate that.

What this change does

  • test/sai_test/config/simulate_sonic.py (new). Opt-in helper, active only when SIMULATE_SONIC=1; every entry point is a no-op otherwise.
  • test/sai_test/config/lag_configer.pycreate_lag(). When enabled, create the PortChannel<N> netdev teamd would provide, before the SAI LAG create.
  • test/sai_test/config/route_configer.pycreate_router_interface(). When enabled, assign the connected IPs IntfMgr would set on a LAG or VLAN(SVI) router interface.
  • Vendor-neutral by construction. PortChannel netdevs use generic Linux ip … type bond; LAG RIF IPs use ip addr add. A VLAN SVI has no host-interface netdev to mirror from, so its address is programmed via command templates supplied by the caller (SVI_RIF_SET_IP_CMD / SVI_RIF_PROBE_CMD, with {ifname}/{addr} placeholders) — no backend-specific tooling is hardcoded in sai_test. All interface-name prefixes and address patterns are env-overridable.

Scope / risk

  • 3 files (one new module + two setUp-path hooks) — test-config helpers only; no change to SAI/backend code or packet semantics.
  • Fully opt-in with default-off: with SIMULATE_SONIC unset, all entry points no-op, so real-HW and other OCP consumers are unchanged unless they opt in.

Dependencies
None. Independent of #2299 / #2300 / #2301 (edits different functions); targets master.

…s in sai_test

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

Copy link
Copy Markdown
Author

@kcudnik, could you please invoke azure pipelines to run checks, please. I do not have the permissions to do so.

@kcudnik

kcudnik commented Jul 7, 2026

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.

2 participants