[Nexthop][fboss2-dev] Add interface loopback-mode config command#1096
Open
hillol-nexthop wants to merge 5 commits intofacebook:mainfrom
Open
[Nexthop][fboss2-dev] Add interface loopback-mode config command#1096hillol-nexthop wants to merge 5 commits intofacebook:mainfrom
hillol-nexthop wants to merge 5 commits intofacebook:mainfrom
Conversation
2 tasks
a5eec2c to
02393bc
Compare
d71b09c to
083c86f
Compare
…ete handler Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
083c86f to
fad4539
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.
Based on #1095
Pre-submission checklist
pip install -r requirements-dev.txt && pre-commit installpre-commit runSummary
1. New
config interfaceattributes — gives operators direct CLI control over port properties previously only configurable by editing switch config JSON.New config command syntax:
2. Consolidated
delete interfacecommands — replaces separate per-attribute subcommand classes (CmdDeleteInterfaceLoopbackMode,CmdDeleteInterfaceLldpExpectedValue) with a singleCmdDeleteInterfacehandler, mirroring theCmdConfigInterfacepattern.New delete command syntax:
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 |InterfaceDeleteAttrsarg type parses<ports> <attr> [<attr>...]— same pattern asInterfacesConfigbut all attributes are valueless (reset-to-default semantics)operator const InterfaceList&()implicit conversion preserves theipv6 ndsubcommand chainlldp-expected-*tag variants (onlylldp-expected-valuewas supported before)Test plan
fboss2-dev config interface eth1/1/1 loopback-mode PHY— sets loopback modefboss2-dev delete interface eth1/1/1 loopback-mode— resets to NONEfboss2-dev delete interface eth1/1/1 loopback-mode lldp-expected-chassis— resets both in one callfboss2-dev config interface eth1/1/1 shutdown/no-shutdown— disables/enables portfboss2-dev delete interface eth1/1/1 ipv6 nd ra-interval— ipv6 nd subcommand still worksCmdDeleteInterfaceTest(7 cases),CmdConfigInterfaceLoopbackModeTest, etc.