Skip to content

[Nexthop][fboss2-dev] Harden fboss2 CLI integration tests #1368

Open
vybhav-nexthop wants to merge 2 commits into
facebook:mainfrom
nexthop-ai:fboss2-integration-test-robustness
Open

[Nexthop][fboss2-dev] Harden fboss2 CLI integration tests #1368
vybhav-nexthop wants to merge 2 commits into
facebook:mainfrom
nexthop-ai:fboss2-integration-test-robustness

Conversation

@vybhav-nexthop

@vybhav-nexthop vybhav-nexthop commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Pre-submission checklist

  • I've ran the linters locally and fixed lint errors related to the files I modified in this PR. You can install the linters by running pip install -r requirements-dev.txt && pre-commit install
  • pre-commit run

Summary

Harden the fboss2-dev CLI integration tests to pass across hardware variants, instead of assuming a fixed L2 VLAN (VLAN 2001) topology and an always-ready agent. On routed-mode devices and right after an agent warmboot the old tests crashed the agent or failed spuriously.

What

  • ConfigInterfaceMtuTest: wait for the agent after committing an MTU change; skip the kernel-MTU check on interfaces with no VLAN (routed-only) instead of asserting.
  • ConfigVlanCreateTest: discover an existing VLAN + port member dynamically instead of hard-coding VLAN 2001; skip on routed-mode DUTs with no such VLAN.
  • ConfigVlanDefaultTest: auto-create the target VLAN if absent. The dummy MAC used to trigger creation is deleted before commit; the VLAN scan is guarded for configs without a vlans section; restore uses config vlan default (not static-mac add, which would permanently attach a cfg::Interface to the default VLAN and break the suite's refusal test).
  • ConfigPfcTest: snapshot the running SwitchConfig in SetUp and restore it in TearDown via ConfigSession, replacing the per-field PFC disable (buffer-pool / priority-group / port-PFC objects have no delete CLI). Leftover PFC state made a later hitless apply crash the agent (EventBase re-entrancy on gracefulExit); the restore forces AGENT_WARMBOOT to avoid that path.

Known limitations

  • ConfigPfcTest::TearDown forces AGENT_WARMBOOT unconditionally, so every test in that fixture pays an agent restart even when nothing was mutated.

Test Plan

  • Passed the fboss2 CLI integration suite on Tomahawk4 and Tomahawk5 devices, including across agent warmboot and coldboot.

@vybhav-nexthop vybhav-nexthop requested a review from a team as a code owner July 8, 2026 09:11
@meta-cla meta-cla Bot added the CLA Signed label Jul 8, 2026
@vybhav-nexthop vybhav-nexthop changed the title [Nexthop][fboss2-dev] Harden fboss2 CLI integration tests for routed-mode DUTs and agent warmboot timing [Nexthop][fboss2-dev] Harden fboss2 CLI integration tests Jul 8, 2026
…rmboot timing

Make the fboss2-dev CLI integration tests robust across hardware variants
instead of assuming a fixed L2 VLAN topology and an always-ready agent:

- Fboss2IntegrationTest: findFirstEthInterfaceWithMtu() only returns
  interfaces that are UP, so tests don't pick an interface the agent is
  still bringing up.

- ConfigInterfaceMtuTest: wait for the agent to be ready after committing
  an MTU change; skip the kernel-MTU verification when the interface has
  no VLAN (routed-only platforms) instead of asserting.

- ConfigVlanCreateTest: discover an existing VLAN and port member
  dynamically in SetUpTestSuite (cached in static members) instead of
  hard-coding VLAN 2001; skip on pure routed-mode DUTs where no VLAN with
  a port member exists.

- ConfigVlanDefaultTest: auto-create the target VLAN if absent before the
  happy-path test so the test works on switches without a pre-provisioned
  VLAN.

- ConfigPfcTest: snapshot the full running config in SetUp and restore the
  entire SwitchConfig in TearDown via ConfigSession, instead of a
  per-field PFC disable. The buffer-pool / priority-group-policy /
  port-PFC objects have no `delete` CLI, so a per-field revert is
  impossible; leftover PFC state made a later test's hitless config apply
  crash the agent (EventBase re-entrancy on gracefulExit). The restore is
  committed with a forced AGENT_WARMBOOT rather than the default hitless
  apply, which is the crashing path.
The interface selector for the MTU test required intf.status == "up" in
addition to a configured MTU. This over-constrains selection: the MTU set
path operates on the L3 config (show interface reports MTU from
SwitchState, not the datapath), so an interface that is administratively
or link down but has a configured MTU is still fully testable.

Requiring UP could therefore skip the test entirely on a switch whose
configured L3 interfaces happen to have down ports, silently losing
coverage. Agent-readiness is already guaranteed by the waitForAgentReady()
call in SetUp() (the agent rejects show interface until fully configured),
so the UP check is not needed to avoid the warmboot-timing races it was
originally paired with.

Keep the mtu > 0 requirement (ensures a cfg::Interface exists to update)
and update the skip message accordingly.
@rabbit-nexthop rabbit-nexthop force-pushed the fboss2-integration-test-robustness branch from 5c0a25f to 44009db Compare July 9, 2026 08:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant