Skip to content

[Nexthop] [fboss2] Insert vlanPorts membership in switchport access vlan - #1451

Open
hillol-nexthop wants to merge 1 commit into
meta:mainfrom
nexthop-ai:insert-vlanports-membership-in
Open

hillol-nexthop wants to merge 1 commit into
meta:mainfrom
nexthop-ai:insert-vlanports-membership-in

Conversation

@hillol-nexthop

@hillol-nexthop hillol-nexthop commented Aug 3, 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

config interface <name> switchport access vlan <id> set sw.ports[].ingressVlan and retargeted existing sw.vlanPorts[] entries, but never inserted one when the port had no membership — leaving a config where the port is not a member of its ingress VLAN (rejected by the agent config validator). A port with multiple entries also got all of them retargeted, producing duplicate (vlan, port) pairs.

The command now leaves each port with exactly one untagged vlanPorts membership in the target VLAN:

  • stale untagged (access) memberships are removed,
  • an existing entry in the target VLAN is deduplicated,
  • the new untagged entry is inserted,
  • tagged (trunk) memberships in other VLANs are preserved.

Integration test redesign

ConfigVlanSwitchportAccessTest is redesigned as NewVlanAcrossPorts: attach a brand-new VLAN to one port (auto-create + insert path end to end), then the now-existing VLAN to a second port; after each warmboot commit verify ingressVlan and the untagged vlanPorts membership via the agent's running config.

Teardown

No manual unwind: the test harness's per-suite config containment (#1557) records the /etc/coop baseline before the suite starts and rolls the DUT back to it after the suite ends, so the device is left as found even when the test fails mid-way.

Port selection

NewVlanAcrossPorts needs two distinct ports; it calls the existing getRandomInterfacePortName() twice (retrying until the names differ) — no new fixture helper.

Test Plan

  • UT //fboss/cli/fboss2/test/config:cmd_config_test — 17/17 pass, including new UTs: insertion when membership missing, dedup of conflicting entries, idempotency, trunk-membership preservation, membership on VLAN auto-create.
  • On a freshly prepared lab device (NH-4010-F), ConfigVlanSwitchportAccessTest.NewVlanAcrossPorts — PASS (binary built from our internal tree carrying the identical test body). Both VLAN commits were recorded as AGENT_WARMBOOT in cli/cli_metadata.json, agents active after each commit, and the config was rolled back to the pre-suite baseline afterwards with no test residue in cli/agent.conf.

@hillol-nexthop
hillol-nexthop requested a review from a team as a code owner August 3, 2026 04:35
@meta-cla meta-cla Bot added the CLA Signed label Aug 3, 2026
@hillol-nexthop
hillol-nexthop marked this pull request as draft August 3, 2026 04:35
@hillol-nexthop hillol-nexthop changed the title Insert vlanPorts membership in switchport access vlan [Nexthop] [fboss2] Insert vlanPorts membership in switchport access vlan Aug 3, 2026
@meta-codesync

meta-codesync Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

This pull request has been imported. If you are a Meta employee, you can view this in D114555610. (Because this pull request was imported automatically, there will not be any future comments.)

@facebook-github-tools

Copy link
Copy Markdown

@hillol-nexthop has updated the pull request. You must reimport the pull request before landing.

1 similar comment
@facebook-github-tools

Copy link
Copy Markdown

@hillol-nexthop has updated the pull request. You must reimport the pull request before landing.

@hillol-nexthop
hillol-nexthop force-pushed the insert-vlanports-membership-in branch from 9f003e5 to b6fb1f3 Compare August 3, 2026 05:56
@facebook-github-tools

Copy link
Copy Markdown

@hillol-nexthop has updated the pull request. You must reimport the pull request before landing.

@hillol-nexthop
hillol-nexthop force-pushed the insert-vlanports-membership-in branch from b6fb1f3 to 4502877 Compare August 3, 2026 06:10
@facebook-github-tools

Copy link
Copy Markdown

@hillol-nexthop has updated the pull request. You must reimport the pull request before landing.

@hillol-nexthop
hillol-nexthop force-pushed the insert-vlanports-membership-in branch from 4502877 to e5d0ebd Compare August 3, 2026 06:57
@facebook-github-tools

Copy link
Copy Markdown

@hillol-nexthop has updated the pull request. You must reimport the pull request before landing.

@hillol-nexthop
hillol-nexthop marked this pull request as ready for review August 6, 2026 09:14
@hillol-nexthop
hillol-nexthop requested a review from a team as a code owner August 6, 2026 09:14
@hillol-nexthop
hillol-nexthop force-pushed the insert-vlanports-membership-in branch from e5d0ebd to cd2a473 Compare August 17, 2026 09:29
@facebook-github-tools

Copy link
Copy Markdown

@hillol-nexthop has updated the pull request. You must reimport the pull request before landing.

@hillol-nexthop

Copy link
Copy Markdown
Contributor Author

Note on ConfigCoppCpuTrafficPolicyTest.cpp: the file ships here (byte-identical to our internal tree) but is deliberately not added to the integration-test build targets — it drives config copp cpu-traffic-policy match ... action ..., which is pending in #1379. Registering it in cmake/CliFboss2TestIntegrationTest.cmake and fboss/cli/fboss2/test/integration_test/BUCK is a one-line follow-up once #1379 lands. Verified on a lab device: with the command absent the test fails at runtime (arg-parse error), and the other suites in this PR — ConfigVlanCreateTest (6/6, including the auto-create and switchport tests), ConfigVlanSwitchportAccessTest.NewVlanAcrossPorts, and ConfigPfcTest — all pass on this branch (8/8).

@facebook-github-tools

Copy link
Copy Markdown

@hillol-nexthop has updated the pull request. You must reimport the pull request before landing.

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

I strongly recommend to move the new snapshop test config for integration test out of this PR and have a new one to take care of it.
Besides, I don't think we should make Fboss2IntegrationTest to introduce the snapshop/restore config feature. Instead, we should consider to use ConfigSession::rollback(). I would also like to see whether rollback can take care of this case as expected(whether it needs coldboot or warmboot)

cc: @benoit-nexthop

Comment thread fboss/cli/fboss2/test/integration_test/Fboss2IntegrationTest.cpp Outdated
@hillol-nexthop
hillol-nexthop force-pushed the insert-vlanports-membership-in branch from fa60b9e to defc836 Compare August 27, 2026 06:26
@facebook-github-tools

Copy link
Copy Markdown

@hillol-nexthop has updated the pull request. You must reimport the pull request before landing.

@hillol-nexthop
hillol-nexthop force-pushed the insert-vlanports-membership-in branch from defc836 to 630367d Compare August 27, 2026 08:14
@facebook-github-tools

Copy link
Copy Markdown

@hillol-nexthop has updated the pull request. You must reimport the pull request before landing.

@hillol-nexthop
hillol-nexthop force-pushed the insert-vlanports-membership-in branch from 630367d to d6a1c02 Compare August 27, 2026 08:59
@facebook-github-tools

Copy link
Copy Markdown

@hillol-nexthop has updated the pull request. You must reimport the pull request before landing.

@hillol-nexthop
hillol-nexthop force-pushed the insert-vlanports-membership-in branch from d6a1c02 to bf02909 Compare August 27, 2026 09:05
@facebook-github-tools

Copy link
Copy Markdown

@hillol-nexthop has updated the pull request. You must reimport the pull request before landing.

@hillol-nexthop
hillol-nexthop force-pushed the insert-vlanports-membership-in branch from bf02909 to c3fc618 Compare August 31, 2026 04:45
@facebook-github-tools

Copy link
Copy Markdown

@hillol-nexthop has updated the pull request. You must reimport the pull request before landing.

@hillol-nexthop
hillol-nexthop force-pushed the insert-vlanports-membership-in branch from c3fc618 to 1f5f3c1 Compare September 1, 2026 09:51
@facebook-github-tools

Copy link
Copy Markdown

@hillol-nexthop has updated the pull request. You must reimport the pull request before landing.

`config interface <name> switchport access vlan <id>` set
sw.ports[].ingressVlan and retargeted existing sw.vlanPorts[] entries,
but never inserted one when the port had no membership, leaving a config
the agent validator rejects (port not a member of its ingress VLAN). A
port with several entries had all of them retargeted, producing
duplicate (vlan, port) pairs.

The command now leaves each port with exactly one untagged vlanPorts
membership in the target VLAN: stale untagged memberships are removed,
an existing entry in the target VLAN is deduplicated, the new untagged
entry is inserted, tagged (trunk) memberships elsewhere are preserved.

ConfigVlanSwitchportAccessTest becomes NewVlanAcrossPorts: attach a new
VLAN to one port (auto-create + insert), then the existing VLAN to a
second port, verifying ingressVlan and the untagged membership after each
commit. No manual unwind: the harness's per-suite config containment
(run_test.py suite hooks, meta#1557) rolls the DUT back to the pre-suite
baseline after the suite ends.

Signed-off-by: hillol-nexthop <hillol@nexthop.ai>

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@hillol-nexthop
hillol-nexthop force-pushed the insert-vlanports-membership-in branch from 1f5f3c1 to 88f30b7 Compare October 12, 2026 05:42
@facebook-github-tools

Copy link
Copy Markdown

@hillol-nexthop has updated the pull request. You must reimport the pull request before landing.

@github-actions github-actions Bot added the project:fboss2 FBOSS project: fboss2 label Oct 30, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants