Skip to content

[Nexthop][fboss2-dev] Add interface loopback-mode config command#1096

Open
hillol-nexthop wants to merge 5 commits intofacebook:mainfrom
nexthop-ai:interface-loopback-mode
Open

[Nexthop][fboss2-dev] Add interface loopback-mode config command#1096
hillol-nexthop wants to merge 5 commits intofacebook:mainfrom
nexthop-ai:interface-loopback-mode

Conversation

@hillol-nexthop
Copy link
Copy Markdown
Contributor

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

Based on #1095

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

1. New config interface attributes — gives operators direct CLI control over port properties previously only configurable by editing switch config JSON.

New config command syntax:

fboss2-dev config interface <port-list> loopback-mode [none|PHY|NIF|MAC]
fboss2-dev config interface <port-list> flow-control-rx [enable|disable]
fboss2-dev config interface <port-list> flow-control-tx [enable|disable]
fboss2-dev config interface <port-list> lldp-expected-value <string>
fboss2-dev config interface <port-list> lldp-expected-chassis <string>
fboss2-dev config interface <port-list> lldp-expected-ttl <string>
fboss2-dev config interface <port-list> lldp-expected-port-desc <string>
fboss2-dev config interface <port-list> lldp-expected-system-name <string>
fboss2-dev config interface <port-list> lldp-expected-system-desc <string>
fboss2-dev config interface <port-list> type routed-port
fboss2-dev config interface <port-list> shutdown
fboss2-dev config interface <port-list> no-shutdown

2. Consolidated delete interface commands — replaces separate per-attribute subcommand classes (CmdDeleteInterfaceLoopbackMode, CmdDeleteInterfaceLldpExpectedValue) with a single CmdDeleteInterface handler, mirroring the CmdConfigInterface pattern.

New delete command syntax:

fboss2-dev delete interface <port-list> loopback-mode
fboss2-dev delete interface <port-list> lldp-expected-value
fboss2-dev delete interface <port-list> lldp-expected-chassis
fboss2-dev delete interface <port-list> lldp-expected-ttl
fboss2-dev delete interface <port-list> lldp-expected-port-desc
fboss2-dev delete interface <port-list> lldp-expected-system-name
fboss2-dev delete interface <port-list> lldp-expected-system-desc
# Multiple attrs in one call:
fboss2-dev delete interface <port-list> loopback-mode lldp-expected-chassis

Implementation

All attributes map to existing fields on cfg::Port — no thrift schema changes.

| Attribute | Thrift field | Notes |
|--------|-----------|-------------|-------|
loopback-mode | cfg::Port.loopbackMode (field 17) | NONE/PHY/NIF/MAC, case-insensitive |
flow-control-rx | cfg::Port.pause.rx (field 13) | enable/disable |
flow-control-tx | cfg::Port.pause.tx (field 13) | enable/disable |
lldp-expected-* | cfg::Port.expectedLLDPValues (field 20) | 6 tag variants |
type routed-port | cfg::Port.portType (field 27) | also sets routable=true, clears ingressVlan |
shutdown / no-shutdown | cfg::Port.state (field 2) | valueless flags |

  • New InterfaceDeleteAttrs arg type parses <ports> <attr> [<attr>...] — same pattern as InterfacesConfig but all attributes are valueless (reset-to-default semantics)
  • operator const InterfaceList&() implicit conversion preserves the ipv6 nd subcommand chain
  • Adds delete support for all 6 lldp-expected-* tag variants (only lldp-expected-value was supported before)
  • Removes 4 files (2 old per-attribute classes + their headers), consolidates 4 test files into 2

Test plan

  • fboss2-dev config interface eth1/1/1 loopback-mode PHY — sets loopback mode
  • fboss2-dev delete interface eth1/1/1 loopback-mode — resets to NONE
  • fboss2-dev delete interface eth1/1/1 loopback-mode lldp-expected-chassis — resets both in one call
  • fboss2-dev config interface eth1/1/1 shutdown / no-shutdown — disables/enables port
  • fboss2-dev delete interface eth1/1/1 ipv6 nd ra-interval — ipv6 nd subcommand still works
  • Unit tests: CmdDeleteInterfaceTest (7 cases), CmdConfigInterfaceLoopbackModeTest, etc.

@meta-cla meta-cla Bot added the CLA Signed label Apr 17, 2026
@hillol-nexthop hillol-nexthop force-pushed the interface-loopback-mode branch 2 times, most recently from a5eec2c to 02393bc Compare April 20, 2026 17:20
@hillol-nexthop hillol-nexthop marked this pull request as ready for review April 20, 2026 17:24
@hillol-nexthop hillol-nexthop requested review from a team as code owners April 20, 2026 17:24
@hillol-nexthop hillol-nexthop force-pushed the interface-loopback-mode branch 4 times, most recently from d71b09c to 083c86f Compare April 21, 2026 09:35
@hillol-nexthop hillol-nexthop force-pushed the interface-loopback-mode branch from 083c86f to fad4539 Compare April 21, 2026 17:09
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