[Nexthop][fboss2-dev] Add fboss2-dev config arp CLI subcommands#1104
Open
benoit-nexthop wants to merge 1 commit intofacebook:mainfrom
Open
[Nexthop][fboss2-dev] Add fboss2-dev config arp CLI subcommands#1104benoit-nexthop wants to merge 1 commit intofacebook:mainfrom
benoit-nexthop wants to merge 1 commit intofacebook:mainfrom
Conversation
# Summary
Adds a new `fboss2-dev config arp <attr> <value>` command family for
tuning the FBOSS agent's ARP/NDP neighbor-table timers at runtime.
Four attributes are supported, all can be set in a hitless config
reload (no agent restart required):
- `timeout` -> SwitchConfig.arpTimeoutSeconds
- `age-interval` -> SwitchConfig.arpAgerInterval
- `max-probes` -> SwitchConfig.maxNeighborProbes
- `stale-interval` -> SwitchConfig.staleEntryInterval
Note: I was going to implement a `refresh` subcommand as well, to set
`arpRefreshSeconds`. That field is declared in `switch_config.thrift`
but is **not** read by `ApplyThriftConfig.cpp` and is absent from
`switch_state.thrift`, so setting it would be a no-op in the agent.
It is explicitly excluded from `kArpValidAttrs` and ignored for now.
# Test Plan
## Unit tests
```
$ ./fboss/oss/scripts/bazel.sh test \
//fboss/cli/fboss2/test/config:cmd_config_test \
--test_filter='CmdConfigArpTestFixture.*'
[==========] Running 10 tests from 1 test suite.
[ RUN ] CmdConfigArpTestFixture.argValidation_valid
[ OK ] CmdConfigArpTestFixture.argValidation_valid (84 ms)
[ RUN ] CmdConfigArpTestFixture.argValidation_badArity
[ OK ] CmdConfigArpTestFixture.argValidation_badArity (30 ms)
[ RUN ] CmdConfigArpTestFixture.argValidation_unknownAttr
[ OK ] CmdConfigArpTestFixture.argValidation_unknownAttr (34 ms)
[ RUN ] CmdConfigArpTestFixture.argValidation_nonInteger
[ OK ] CmdConfigArpTestFixture.argValidation_nonInteger (32 ms)
[ RUN ] CmdConfigArpTestFixture.argValidation_negative
[ OK ] CmdConfigArpTestFixture.argValidation_negative (31 ms)
[ RUN ] CmdConfigArpTestFixture.setTimeout
[ OK ] CmdConfigArpTestFixture.setTimeout (82 ms)
[ RUN ] CmdConfigArpTestFixture.setAgeInterval
[ OK ] CmdConfigArpTestFixture.setAgeInterval (103 ms)
[ RUN ] CmdConfigArpTestFixture.setMaxProbes
[ OK ] CmdConfigArpTestFixture.setMaxProbes (75 ms)
[ RUN ] CmdConfigArpTestFixture.setStaleInterval
[ OK ] CmdConfigArpTestFixture.setStaleInterval (76 ms)
[ RUN ] CmdConfigArpTestFixture.idempotentSameValue
[ OK ] CmdConfigArpTestFixture.idempotentSameValue (85 ms)
[----------] 10 tests from CmdConfigArpTestFixture (636 ms total)
[ PASSED ] 10 tests.
```
## Integration tests (on gold405 / NH-4010-F)
```
$ sudo /tmp/fboss2_integration_test --gtest_filter='ConfigArpTest.*'
[==========] Running 4 tests from 1 test suite.
[ RUN ] ConfigArpTest.SetTimeout
[ OK ] ConfigArpTest.SetTimeout (173 ms)
[ RUN ] ConfigArpTest.SetAgeInterval
[ OK ] ConfigArpTest.SetAgeInterval (108 ms)
[ RUN ] ConfigArpTest.SetMaxProbes
[ OK ] ConfigArpTest.SetMaxProbes (141 ms)
[ RUN ] ConfigArpTest.SetStaleInterval
[ OK ] ConfigArpTest.SetStaleInterval (108 ms)
[----------] 4 tests from ConfigArpTest (531 ms total)
[ PASSED ] 4 tests.
```
Each test reads the current value via the agent's thrift
`getRunningConfig()`, sets a new value via the CLI, commits the
session (HITLESS), verifies the running config reflects the change,
then restores the original value.
## Sample usage
```
$ fboss2-dev config arp timeout 90
Set arp timeout to 90
$ fboss2-dev config arp age-interval 7
Set arp age-interval to 7
$ fboss2-dev config arp max-probes 400
Set arp max-probes to 400
$ fboss2-dev config arp stale-interval 30
Set arp stale-interval to 30
$ fboss2-dev config session diff
--- current live config
+++ session config
@@ -29,9 +29,9 @@
"sw": {
"acls": [],
"aggregatePorts": [],
- "arpAgerInterval": 5,
+ "arpAgerInterval": 7,
"arpRefreshSeconds": 20,
- "arpTimeoutSeconds": 60,
+ "arpTimeoutSeconds": 90,
"clientIdToAdminDistance": {
...
- "maxNeighborProbes": 300,
+ "maxNeighborProbes": 400,
...
- "staleEntryInterval": 10,
+ "staleEntryInterval": 30,
...
$ fboss2-dev config session commit
Config session committed successfully as 280a583 and config reloaded for fboss_sw_agent.
```
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.
Summary
Adds a new
fboss2-dev config arp <attr> <value>command family for tuning the FBOSS agent's ARP/NDP neighbor-table timers at runtime. Four attributes are supported, all can be set in a hitless config reload (no agent restart required):timeout-> SwitchConfig.arpTimeoutSecondsage-interval-> SwitchConfig.arpAgerIntervalmax-probes-> SwitchConfig.maxNeighborProbesstale-interval-> SwitchConfig.staleEntryIntervalNote: I was going to implement a
refreshsubcommand as well, to setarpRefreshSeconds. That field is declared inswitch_config.thriftbut is not read byApplyThriftConfig.cppand is absent fromswitch_state.thrift, so setting it would be a no-op in the agent. It is explicitly excluded fromkArpValidAttrsand ignored for now.Test Plan
Unit tests
Integration tests (on gold405 / NH-4010-F)
Each test reads the current value via the agent's thrift
getRunningConfig(), sets a new value via the CLI, commits the session (HITLESS), verifies the running config reflects the change, then restores the original value.Sample usage