Skip to content

[Cisco]Fix programmed status for resolved named next-hop groups - #1431

Open
selekkala wants to merge 2 commits into
facebook:mainfrom
selekkala:fix/nhg-is-programmed
Open

[Cisco]Fix programmed status for resolved named next-hop groups#1431
selekkala wants to merge 2 commits into
facebook:mainfrom
selekkala:fix/nhg-is-programmed

Conversation

@selekkala

@selekkala selekkala commented Jul 28, 2026

Copy link
Copy Markdown

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

getNextHopGroups() and getNamedNextHopGroups() can report
isProgrammed=false for a named next-hop group that has been successfully
resolved and programmed.

The named-group lookup uses the original client NextHopSetID, while the FIB
forwarding entry contains the resolved and normalized IDs after recursive
resolution. As a result, the original ID is absent from the route reference
counts used to compute isProgrammed.

This change:

  • Collects original client next-hop set IDs only from resolved FIB routes that
    have a resolved next-hop set ID.
  • Includes those IDs when computing isProgrammed in both next-hop-group
    Thrift GET APIs.
  • Leaves the existing resolved/normalized route and MySID reference-count
    behavior unchanged.
  • Adds state and Thrift regression coverage for resolved, unresolved, used,
    and unused named next-hop groups.

Test Plan

Validated the fix with focused unit tests in Docker:

  • FibInfoTest.GetResolvedClientNextHopSetIdsFromRoutes
    • Creates resolved and unresolved FIB routes with different client and
      resolved next-hop set IDs.
    • Verifies that only a resolved route contributes its original client ID.
  • NamedNextHopGroupThriftTest.getNextHopGroupsNamedIsProgrammed
    • Adds referenced and unreferenced named next-hop groups.
    • Adds a resolvable route that references one named group.
    • Calls both getNextHopGroups() and getNamedNextHopGroups().
    • Verifies the referenced group returns isProgrammed=true, unreferenced
      groups return false, and both APIs return the same status.

Result: 2/2 tests passed. Formatting and whitespace checks also passed.

Unit-test log
[==========] Running 2 tests from 2 test suites.
[----------] 1 test from NhgIsProgrammedDockerTest
[ RUN      ] NhgIsProgrammedDockerTest.GetResolvedClientNextHopSetIdsFromRoutes
[       OK ] NhgIsProgrammedDockerTest.GetResolvedClientNextHopSetIdsFromRoutes (0 ms)

[----------] 1 test from NamedNextHopGroupDockerTest
[ RUN      ] NamedNextHopGroupDockerTest.GetNextHopGroupsNamedIsProgrammed
[       OK ] NamedNextHopGroupDockerTest.GetNextHopGroupsNamedIsProgrammed (165 ms)

[==========] 2 tests from 2 test suites ran. (166 ms total)
[  PASSED  ] 2 tests.

Track original client next-hop set IDs for resolved FIB routes when computing NHG programming status. Add state and Thrift regression coverage for resolved and unresolved groups.
@selekkala
selekkala requested a review from a team as a code owner July 28, 2026 22:35
@meta-cla meta-cla Bot added the CLA Signed label Jul 28, 2026
@selekkala selekkala changed the title Fix programmed status for resolved named next-hop groups [Cisco]Fix programmed status for resolved named next-hop groups Jul 28, 2026
@github-actions github-actions Bot added the cisco label Jul 28, 2026
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