[Nexthop][fboss2-dev] fboss2-dev switchport access vlan: validate VLAN exists before commit#1179
Open
hillol-nexthop wants to merge 3 commits into
Open
Conversation
Signed-off-by: mabel-bot[bot] <266911995+mabel-bot[bot]@users.noreply.github.com>
joseph5wu
reviewed
May 12, 2026
Contributor
joseph5wu
left a comment
There was a problem hiding this comment.
The vlan existence check looks good to me but I'm not sure why do we need the vlan to have interfaces before you can set a port with an access vlan? Wouldn't this cli be used to assign the vlan to a port/interface?
Contributor
Author
Yes you are right. I have changed it. |
Port upstream removal of fboss/cli/fboss2/test/integration_test/ ConfigSessionRestartTest.cpp and its references (cmake and BUCK file lists) from facebook#1095. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
0473660 to
af1d442
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pre-submission checklist
pip install -r requirements-dev.txt && pre-commit installpre-commit runSummary
fboss2-dev config interface <name> switchport access vlan <id>blindly wroteingressVlanon the port and rewrote the matchingvlanPortsentry without checking that the target VLAN existed inconfig.sw()->vlans()or that it had a corresponding L3 interface inconfig.sw()->interfaces(). The CLI then printedConfig session committed successfullyand triggered a warmboot;fboss_sw_agentSIGABRTed during initialization with:Validate both conditions up front in
queryClient()and throwstd::invalid_argumentwith a descriptive message before touching the config or saving.CmdConfigInterfaceSwitchportAccessVlan.cpp: pre-flight check for VLAN existence + interface presence.CmdConfigInterfaceSwitchportAccessVlanTest.cpp: fixture now seedssw.vlans/sw.interfaces; added negative tests for both rejection paths and assert the running config is unchanged after the throw.Also removing RestartTest because this is redundant as feature specific tests like access vlan test would do the same thing.
Test plan
queryClientThrowsWhenVlanDoesNotExist,queryClientThrowsWhenVlanHasNoInterface, plus updated positive case still passes against the seeded VLAN.