Add memberCount into peer-grp json AND GR fields in fields in show bgp vrfs json - #20578
Conversation
Greptile SummaryThis PR enhances JSON output observability for BGP by adding two sets of fields:
The implementation correctly extracts GR mode and configuration values from BGP structures, and both JSON and text output paths have been updated consistently. Tests validate the new fields match expected values. The GR fields are displayed outside the Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant VTY
participant bgp_vty.c
participant BGP
Note over User,BGP: Show BGP VRFs Command
User->>VTY: show bgp vrfs [name] json
VTY->>bgp_vty.c: show_bgp_vrfs_detail_common()
bgp_vty.c->>bgp_vty.c: print_bgp_vrfs()
bgp_vty.c->>BGP: bgp_global_gr_mode_get(bgp)
BGP-->>bgp_vty.c: gr_mode
bgp_vty.c->>BGP: read restart_time, stalepath_time, select_defer_time
bgp_vty.c->>BGP: CHECK_FLAG(BGP_FLAG_SUPPRESS_FIB_PENDING)
bgp_vty.c->>BGP: CHECK_FLAG(BGP_FLAG_GRACEFUL_SHUTDOWN)
bgp_vty.c->>VTY: JSON with as, GR fields, FIB/gShut flags
VTY-->>User: Complete VRF JSON output
Note over User,BGP: Show BGP Peer Group Command
User->>VTY: show bgp peer-group [name] json
VTY->>bgp_vty.c: bgp_show_one_peer_group()
loop For each peer in group
bgp_vty.c->>bgp_vty.c: member_count++
end
bgp_vty.c->>VTY: JSON with memberCount
VTY-->>User: Peer group JSON with member count
|
f886a35 to
4462719
Compare
| json_object_int_add(json, "grStalePathTime", bgp->stalepath_time); | ||
| json_object_int_add(json, "grSelectDeferTime", bgp->select_defer_time); | ||
| json_object_string_add(json, "grMode", bgp_global_gr_mode_str[gr_mode]); | ||
| json_object_boolean_add(json, "waitforFIBset", |
Member count is not part of current show bgp peer-group json output. Fix: memberCount attribute is added into bgp peer-grp json output. Signed-off-by: Sindhu Parvathi Gopinathan's <sgopinathan@nvidia.com>
Validate memberCount into peer-grp json output Signed-off-by: Rajasekar Raja <rajasekarr@nvidia.com>
426db9e to
0cc830f
Compare
| vty_out(vty, "Wait for FIB is set: %s\n", | ||
| CHECK_FLAG(bgp->flags, BGP_FLAG_SUPPRESS_FIB_PENDING) ? "YES" | ||
| : "NO"); | ||
| vty_out(vty, "BGP GSHUT is enabled: %s\n", |
There was a problem hiding this comment.
Can we not shorten words for non-JSON outputs? Any reason to write like this instead of "BGP graceful shutdown is enabled"? Because now it looks like a "draft output".
included vrf level bgp parameters - graceful restart timers, gshut,
suppress-fib-pending, AS number.
VTY output -
leaf11# show bgp vrfs default
BGP instance VRF default VRF id 0
Router Id 6.0.0.4
AS number 65011
Num Configured Peers 6, Established 6
Global graceful restart mode is Restarter
GR Restart Time Configured: 300s
GR Stale Path Time Configured: 900s
GR Select Defer Time Configured: 300s
Wait for FIB is set: YES
BGP GSHUT is enabled: NO
JSON output -
leaf11# show bgp vrfs default json
{
"default":{
"type":"DFLT",
"vrfId":0,
"routerId":"6.0.0.4",
"as":65011,
"numConfiguredPeers":6,
"numEstablishedPeers":6,
"l3vni":0,
"rmac":"00:00:00:00:00:00",
"interface":"unknown",
"grRestartTime":300,
"grStalePathTime":900,
"grSelectDeferTime":300,
"grMode":"Restarter",
"waitforFIBset":true,
"gShutEnabled":false
}
}
leaf11#
Signed-off-by: Aprathi K <aprathik@nvidia.com>
Signed-off-by: Rajasekar Raja <rajasekarr@nvidia.com>
Validate new GR fields in show bgp vrfs json Signed-off-by: Rajasekar Raja <rajasekarr@nvidia.com>
0cc830f to
77df87a
Compare
Add memberCount into peer-grp json AND GR fields in fields in show bgp vrfs json