Skip to content

[Nexthop][fboss2-dev] Add fboss2-dev config arp CLI subcommands#1104

Open
benoit-nexthop wants to merge 1 commit intofacebook:mainfrom
nexthop-ai:arp-config
Open

[Nexthop][fboss2-dev] Add fboss2-dev config arp CLI subcommands#1104
benoit-nexthop wants to merge 1 commit intofacebook:mainfrom
nexthop-ai:arp-config

Conversation

@benoit-nexthop
Copy link
Copy Markdown
Contributor

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.

# 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.
```
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