Skip to content

[Nexthop][fboss2-dev] Add CLI command for configuring trunk VLAN#1097

Open
hillol-nexthop wants to merge 6 commits intofacebook:mainfrom
nexthop-ai:trunk-vlan
Open

[Nexthop][fboss2-dev] Add CLI command for configuring trunk VLAN#1097
hillol-nexthop wants to merge 6 commits intofacebook:mainfrom
nexthop-ai:trunk-vlan

Conversation

@hillol-nexthop
Copy link
Copy Markdown
Contributor

@hillol-nexthop hillol-nexthop commented Apr 17, 2026

Based on #1096

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

This PR implements trunk VLAN management functionality for the FBOSS CLI, allowing users to add and remove VLANs from trunk ports.

config interface <port-list> switchport trunk allowed vlan add <vlan-id-list>
config interface <port-list> switchport trunk allowed vlan remove <vlan-id-list>

Examples:

# Add VLANs 100, 200, 300 to trunk port eth1/1/1
fboss2-dev config interface eth1/1/1 switchport trunk allowed vlan add 100,200,300

# Add VLAN 100 to multiple ports
fboss2-dev config interface eth1/1/1-eth1/1/4 switchport trunk allowed vlan add 100

# Remove VLAN 200 from trunk port
fboss2-dev config interface eth1/1/1 switchport trunk allowed vlan remove 200

Implementation Details
Adding VLANs: Creates VlanPort entries with emitTags=true (tagged traffic) for each port-VLAN combination
Removing VLANs: Removes the corresponding VlanPort entries from the configuration
Validation:
VLANs must exist in the configuration with an associated interface (SVI)
Ports must exist in the hardware platform mapping
VLAN IDs must be in the valid range (1-4094)
Idempotency: Adding an existing VLAN or removing a non-existent VLAN reports "No changes made" without error

Files Changed
fboss/cli/fboss2/commands/config/interface/switchport/trunk/ - New command hierarchy
fboss/cli/fboss2/utils/CmdUtils.h/cpp - Added TrunkVlanAction argument type
fboss/cli/fboss2/CmdList.cpp - Registered new commands
fboss/cli/fboss2/CmdArgsLists.h - Added argument type mapping

Test Plan

AddAndRemoveTrunkVlan
AddMultipleVlans
AddExistingVlan
RemoveVlansOneByOne
RemoveNonExistingVlan
AddVlanToMultiplePorts
RemoveVlanFromMultiplePorts
AddMultipleVlansToMultiplePorts

@meta-cla meta-cla Bot added the CLA Signed label Apr 17, 2026
@hillol-nexthop hillol-nexthop force-pushed the trunk-vlan branch 2 times, most recently from dccc722 to c7d63e3 Compare April 20, 2026 17:24
@hillol-nexthop hillol-nexthop marked this pull request as ready for review April 20, 2026 17:32
@hillol-nexthop hillol-nexthop requested review from a team as code owners April 20, 2026 17:32
@hillol-nexthop hillol-nexthop force-pushed the trunk-vlan branch 4 times, most recently from b6082aa to 3e8b12c Compare April 21, 2026 09:39
@hillol-nexthop hillol-nexthop force-pushed the trunk-vlan branch 2 times, most recently from 047074e to c19188c Compare April 22, 2026 04:42
@hillol-nexthop hillol-nexthop requested review from a team as code owners April 22, 2026 04:42
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