Skip to content

mgmtd/zebra: zebra: add per-source route-count support under /frr-zebra:lib/vrf#21280

Draft
ashred-lnx wants to merge 5 commits intoFRRouting:masterfrom
ashred-lnx:ashred/zebra-route-count-sampling-followup
Draft

mgmtd/zebra: zebra: add per-source route-count support under /frr-zebra:lib/vrf#21280
ashred-lnx wants to merge 5 commits intoFRRouting:masterfrom
ashred-lnx:ashred/zebra-route-count-sampling-followup

Conversation

@ashred-lnx
Copy link
Contributor

@ashred-lnx ashred-lnx commented Mar 21, 2026

  • Add zebra per-source route-count operational support under /frr-zebra:lib/vrf (IPv4/IPv6 + total).
  • Expose counts through YANG/NB callbacks backed by zebra RIB per-route-type counters.
  • Keep selector path as /frr-zebra:lib/vrf/... for client compatibility.
  • Add generic periodic FE sampling topotest coverage including the new zebra route-count selector.

Testing:

`sudo ./vtysh/vtysh -c 'show mgmt get-data /frr-zebra:lib/vrf/ipv4-route-count/total datastore operational json'
timeout 15s sudo python3 tests/topotests/lib/fe_client.py \
  --server /var/run/frr/mgmtd_fe.sock \
  --listen "/frr-zebra:lib/vrf/ipv4-route-count/total" \
  --notify-mode periodic \
  --notify-mode-data 1000 \
  --notify-count 5 \
  --datastore \
  -v
{"frr-zebra:lib":{"vrf":[{"id":"default","ipv4-route-count":{"total":3}}]}}
2026-03-20 21:59:24,822 DEBUG: Connecting to server on /var/run/frr/mgmtd_fe.sock
2026-03-20 21:59:24,822 INFO: Connected to server on /var/run/frr/mgmtd_fe.sock
2026-03-20 21:59:24,822 DEBUG: Sent native SESSION-REQ
2026-03-20 21:59:24,822 DEBUG: Recv native SESSION-REPLY Message: sess-id 1003: fixed: (1,): b''
2026-03-20 21:59:24,822 DEBUG: Sent NOTIFY_SELECT mode=1 mode_data=1000
2026-03-20 21:59:24,822 DEBUG: Waiting for Notify Message
2026-03-20 21:59:24,833 DEBUG: Received Notify Message: (2, 4): b'/frr-zebra:lib/vrf/ipv4-route-count/total\x00{"frr-zebra:lib":{"vrf":[{"id":"default","ipv4-route-count":{"total":3}}]}}\x00'
#OP=SYNC: /frr-zebra:lib/vrf/ipv4-route-count/total
{"frr-zebra:lib":{"vrf":[{"id":"default","ipv4-route-count":{"total":3}}]}}
2026-03-20 21:59:24,833 DEBUG: Waiting for Notify Message
2026-03-20 21:59:25,835 DEBUG: Received Notify Message: (2, 4): b'/frr-zebra:lib/vrf/ipv4-route-count/total\x00{"frr-zebra:lib":{"vrf":[{"id":"default","ipv4-route-count":{"total":3}}]}}\x00'
#OP=SYNC: /frr-zebra:lib/vrf/ipv4-route-count/total
{"frr-zebra:lib":{"vrf":[{"id":"default","ipv4-route-count":{"total":3}}]}}
2026-03-20 21:59:25,835 DEBUG: Waiting for Notify Message
2026-03-20 21:59:26,836 DEBUG: Received Notify Message: (2, 4): b'/frr-zebra:lib/vrf/ipv4-route-count/total\x00{"frr-zebra:lib":{"vrf":[{"id":"default","ipv4-route-count":{"total":3}}]}}\x00'
#OP=SYNC: /frr-zebra:lib/vrf/ipv4-route-count/total
{"frr-zebra:lib":{"vrf":[{"id":"default","ipv4-route-count":{"total":3}}]}}
2026-03-20 21:59:26,836 DEBUG: Waiting for Notify Message
^Z
`

Extend NOTIFY_SELECT to carry mode/mode_data, add FE client API support, and implement per-session periodic sampling timers in mgmtd while keeping backend notify-select operations on-change.

Signed-off-by: Ashwini Reddy <[email protected]>
Update tests/topotests/lib/fe_client.py to encode NOTIFY_SELECT mode/mode_data and add CLI flags for periodic sample testing, then remove the temporary standalone tools/mgmtd_notify_test_client.py helper.

Signed-off-by: Ashwini Reddy <[email protected]>
Clarify mode/mode_data behavior for native NOTIFY_SELECT in user docs and
add inline code-path comments around validation and periodic scheduling.

Signed-off-by: Ashwin Reddy <[email protected]>
@frrbot frrbot bot added mgmt FRR Management Infra tests Topotests, make check, etc labels Mar 21, 2026
@ashred-lnx ashred-lnx changed the title mgmtd/zebra: add periodic sampling support for /frr-zebra:lib/vrf route-count mgmtd/zebra: zebra: add per-source route-count support under /frr-zebra:lib/vrf Mar 21, 2026
Expose per-vrf zebra route-count operational nodes and callbacks, wire RIB per-route-type counters, advertise /frr-zebra:lib/vrf as a zebra oper prefix, allow sampled GET-DATA/periodic routing through both OPER and NOTIF backend maps, and update fe_client GET_DATA encoding to include datastore/default fields so query validation works with operational datastore.

Signed-off-by: Ashwini Reddy <[email protected]>
Add a generic mgmt notification topotest that validates periodic FE sampling for both a baseline interface selector and the zebra route-count selector, asserting sync notifications and JSON payload structure.

Signed-off-by: Ashwini Reddy <[email protected]>
@ashred-lnx ashred-lnx force-pushed the ashred/zebra-route-count-sampling-followup branch from 3f4b6d6 to 0dd9f78 Compare March 21, 2026 05:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

master mgmt FRR Management Infra rebase PR needs rebase size/XL tests Topotests, make check, etc

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant