Skip to content

[Nexthop][fboss2-dev] Add config and delete interface ipv6 nd CLI commands#1095

Open
hillol-nexthop wants to merge 1 commit into
facebook:mainfrom
nexthop-ai:ipv6-nd-commands
Open

[Nexthop][fboss2-dev] Add config and delete interface ipv6 nd CLI commands#1095
hillol-nexthop wants to merge 1 commit into
facebook:mainfrom
nexthop-ai:ipv6-nd-commands

Conversation

@hillol-nexthop
Copy link
Copy Markdown
Contributor

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

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

Based on #1072

Summary

Adds two new fboss2-dev CLI commands for configuring and deleting IPv6 Neighbor Discovery (NDP) settings on interfaces:

  • config interface <intf> ipv6 nd <attr> [<value>] ... — set NDP attributes
  • delete interface <intf> ipv6 nd <attr> ... — reset NDP attributes to defaults

Supported attributes: ra-interval, ra-lifetime, hop-limit, prefix-valid-lifetime, prefix-preferred-lifetime, managed-config-flag, other-config-flag, ra-address

Implementation

  • Added CmdConfigInterfaceIpv6 and CmdConfigInterfaceIpv6Nd under commands/config/interface/ipv6/ to handle NDP configuration via cfg::Interface::ndp().
  • Added CmdDeleteInterface, CmdDeleteInterfaceIpv6, and CmdDeleteInterfaceIpv6Nd under commands/delete/interface/ to reset NDP attributes to their defaults.
  • NdpConfigAttrs parses multi-attribute token lists; NdpDeleteAttrs validates a list of attribute names to reset.
  • Both commands use ConfigSession for config persistence. No Thrift RPCs are made — NDP is a pure config operation.
  • Registered both command trees in CmdListConfig.cpp and added OBJECT_ARG_TYPE_ID_NDP_CONFIG_ATTRS / OBJECT_ARG_TYPE_ID_NDP_DELETE_ATTRS to CmdUtilsCommon.h.
  • Updated both BUCK and cmake/CliFboss2.cmake build files.

Test Plan

Unit tests: test/config/CmdConfigInterfaceIpv6NdTest.cpp, test/config/CmdDeleteInterfaceIpv6NdTest.cpp

  • Valid attribute set/reset per attribute
  • Invalid value format → std::invalid_argument
  • Out-of-range hop-limit (0-255)
  • Multi-port update
  • Multiple attributes in one command
  • Idempotent delete (no NDP config on interface)
  • Case-insensitive attribute names

Integration tests: test/integration_test/ConfigInterfaceIpv6NdTest.cpp, test/integration_test/DeleteInterfaceIpv6NdTest.cpp

/tmp/fboss2_integration_test --gtest_filter=ConfigInterfaceIpv6Nd*:DeleteInterfaceIpv6Nd*

@meta-cla meta-cla Bot added the CLA Signed label Apr 17, 2026
@hillol-nexthop hillol-nexthop changed the title Ipv6 nd commands [Nexthop][fboss2-dev] Add IPv6 nd CLI commands in Apr 17, 2026
@hillol-nexthop hillol-nexthop force-pushed the ipv6-nd-commands branch 2 times, most recently from 2cd105f to c80fd28 Compare April 19, 2026 07:01
@hillol-nexthop hillol-nexthop changed the title [Nexthop][fboss2-dev] Add IPv6 nd CLI commands in [Nexthop][fboss2-dev] Add config and delete interface ipv6 nd CLI commands Apr 19, 2026
@hillol-nexthop hillol-nexthop marked this pull request as ready for review April 20, 2026 03:44
@hillol-nexthop hillol-nexthop requested review from a team as code owners April 20, 2026 03:44
@hillol-nexthop hillol-nexthop force-pushed the ipv6-nd-commands branch 4 times, most recently from 8411704 to 1363722 Compare April 21, 2026 17:02
hillol-nexthop added a commit to nexthop-ai/fboss that referenced this pull request May 13, 2026
Port upstream removal of fboss/cli/fboss2/test/integration_test/
ConfigSessionRestartTest.cpp and its references (cmake and BUCK file
lists) from facebook#1095.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@hillol-nexthop hillol-nexthop force-pushed the ipv6-nd-commands branch 4 times, most recently from 11d7368 to cc900f1 Compare May 15, 2026 05:47
Adds `fboss2-dev config interface <name> ipv6 nd <attr> [value]` and the
corresponding `delete` family for resetting attributes. Supported attrs:
ra-interval, ra-lifetime, hop-limit, managed-config-flag,
other-config-flag, ra-address.

Integration tests (fboss/cli/fboss2/test/integration_test/) verify each
attribute landed in the agent's running config via thrift
getRunningConfig(), polled with wait-retry semantics so they tolerate
the agent restart some config changes trigger on commit.

Base-class additions in Fboss2IntegrationTest:
  - waitForRunningConfig(predicate, timeout, interval): polls
    getRunningConfig(), swallowing thrift exceptions during the
    agent-restart window so verification resumes once the agent is back.
  - getInterfaceIdForPort(portName): resolves a port name to its L3
    interfaceId via getAllInterfaces() thrift. This is the right join
    key — show-interface's "vlan" field is portId on port-based
    platforms and does not match running-config vlanID/intfID directly.
  - commitConfig(): tolerates thrift disconnect on commit (EOF /
    Connection refused / Socket not open in stderr). Waits for the
    agent to come back and leaves outcome verification to the caller.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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