Skip to content

[Nexthop][fboss2-dev] Add fboss2-dev config arp proactive subcommand#1297

Open
vybhav-nexthop wants to merge 1 commit into
facebook:mainfrom
nexthop-ai:nos-7168-config-cli
Open

[Nexthop][fboss2-dev] Add fboss2-dev config arp proactive subcommand#1297
vybhav-nexthop wants to merge 1 commit into
facebook:mainfrom
nexthop-ai:nos-7168-config-cli

Conversation

@vybhav-nexthop

@vybhav-nexthop vybhav-nexthop commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

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

  • Adds fboss2-dev config arp proactive [enabled|disabled] to the existing config arp command family
  • Mutates SwitchConfig.proactiveArp (declared in switch_config.thrift) and persists via HITLESS config save — no agent restart required
  • proactiveArp is not yet consumed by the agent (ApplyThriftConfig.cpp has no read, switch_state.thrift has no corresponding field); the CLI is wired ahead of agent support. A code comment flags this explicitly.

Changed files

File Change
CmdConfigArp.cpp Add proactive to valid attrs; parse enabled/disabled; dispatch to swConfig.proactiveArp()
CmdConfigArp.h Add getBoolValue() / boolValue_; update addCliArg() help text to mention proactive
test/config/CmdConfigArpTest.cpp Unit tests for arg validation + queryClient round-trip for proactive
test/integration_test/ConfigArpTest.cpp Integration test: set/commit/verify round-trip via running agent config
test/integration_test/Fboss2IntegrationTest.h Add two-arg getSwConfigField(field, default) overload + private getSwConfigFieldOpt<T> helper for optional/defaulted config fields

Fboss2IntegrationTest.h refactor

icmpV4UnavailableSrcAddress is optional in the agent config — devices that have never configured it have no entry in the JSON. The integration test needs to read the field with a fallback to the agent's implicit default (192.0.0.8) when absent.

To support this without duplicating the type-dispatch logic (bool/int/string/double), the existing getSwConfigField is refactored:

  • A private getSwConfigFieldOpt<T> helper does the actual field lookup and type conversion, returning std::optional<T>.
  • The original single-arg getSwConfigField delegates to it and throws when nullopt (required fields — existing callers unaffected).
  • A new two-arg overload delegates to it and returns the caller-supplied default when nullopt (optional fields).

Integration Test Results — NH-4010-F

Ran ConfigArpTest suite on DUT after latest changes:

[==========] Running 5 tests from 1 test suite.
[  PASSED  ] ConfigArpTest.SetTimeout (159 ms)
[  PASSED  ] ConfigArpTest.SetAgeInterval (117 ms)
[  PASSED  ] ConfigArpTest.SetMaxProbes (118 ms)
[  PASSED  ] ConfigArpTest.SetStaleInterval (119 ms)
[  PASSED  ] ConfigArpTest.SetProactive (118 ms)
[==========] 5 tests from 1 test suite ran. (633 ms total)
[  PASSED  ] 5 tests.

Test plan

  • Unit test: bazel test //fboss/cli/fboss2/test/config:CmdConfigArpTest
  • Integration test on DUT: fboss2-dev config arp proactive enabled → commit → verify proactiveArp: true in running config → restore

Notes

proactiveArp is not yet consumed by the agent; the integration test only
proves the value round-trips through the config (set → commit → read back),
not that proactive ARP behavior changes.

Review Findings

Pre-publication review (3 correctness angles × 7 candidates, 1-vote verify).
Issues found and fixed before push:

  • result.empty() fallback in queryClient replaced with explicit result assignment per branch (eliminates latent getValue() trap for future boolean attrs)
  • Fboss2IntegrationTest.h: single-arg getSwConfigField restored to inline form with distinct "missing 'sw' object" vs "missing field" error messages
  • Added EXPECT_THROW unit tests for getValue()/getBoolValue() cross-kind accessor guards

No issues above confidence threshold remain.

@vybhav-nexthop vybhav-nexthop requested a review from a team as a code owner June 15, 2026 13:23
@meta-cla meta-cla Bot added the CLA Signed label Jun 15, 2026
Comment thread fboss/cli/fboss2/commands/config/arp/CmdConfigArp.h
Wire `config arp proactive [enabled|disabled]` into the existing arp
config family, mutating SwitchConfig.proactiveArp.

proactiveArp is declared in switch_config.thrift but is not yet consumed
by the agent (no read in ApplyThriftConfig.cpp, no switch_state.thrift
field), so the write is a no-op at runtime today and is applied HITLESS.
The CLI is wired ahead of agent support; a code comment flags this.

## Changed files

| File | Change |
|------|--------|
| `CmdConfigArp.cpp` | Add `proactive` to valid attrs; parse `enabled`/`disabled`; dispatch to `swConfig.proactiveArp()` |
| `CmdConfigArp.h` | Add `getBoolValue()` / `boolValue_`; update `addCliArg()` help text to mention `proactive` |
| `test/config/CmdConfigArpTest.cpp` | Unit tests for arg validation + `queryClient` round-trip for `proactive` |
| `test/integration_test/ConfigArpTest.cpp` | Integration test: set/commit/verify round-trip via running agent config |
| `test/integration_test/Fboss2IntegrationTest.h` | Add two-arg `getSwConfigField(field, default)` overload + private `getSwConfigFieldOpt<T>` helper for optional/defaulted config fields |

## Integration Test Results — NH-4010-F

Ran `ConfigArpTest` suite on DUT after latest changes:

```
[==========] Running 5 tests from 1 test suite.
[  PASSED  ] ConfigArpTest.SetTimeout (159 ms)
[  PASSED  ] ConfigArpTest.SetAgeInterval (117 ms)
[  PASSED  ] ConfigArpTest.SetMaxProbes (118 ms)
[  PASSED  ] ConfigArpTest.SetStaleInterval (119 ms)
[  PASSED  ] ConfigArpTest.SetProactive (118 ms)
[==========] 5 tests from 1 test suite ran. (633 ms total)
[  PASSED  ] 5 tests.
```

## Test plan

- [x] Unit test: `bazel test //fboss/cli/fboss2/test/config:CmdConfigArpTest`
- [x] Integration test on DUT: `fboss2-dev config arp proactive enabled` → commit → verify `proactiveArp: true` in running config → restore

## Notes

proactiveArp is not yet consumed by the agent; the integration test only
proves the value round-trips through the config (set → commit → read back),
not that proactive ARP behavior changes.
@joseph5wu

Copy link
Copy Markdown
Contributor

@vybhav-nexthop Let's abandon this PR since this proactiveArp is never really used in agent. Your change here is basically no-op to the system and it could be confusing to exposing some cli which is not actually doing anything.

cc: @benoit-nexthop

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

2 participants