mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-14 04:26:12 +00:00
bgpd: Add show bgp json detail
command
Print detailed version for JSON output when dumping ALL BGP table with `show bgp <afi> <safi> json detail`. This output should be at some sort of identical to show_ip_bgp_route_cmd. To avoid breaking backward-compatibility for `show bgp json`, adding 'detail' keyword for that. In long-term it's easier for operators to compare stuff just looking at global view instead of per-prefix for details. Before: ``` ],"192.168.100.1/32": [ { "valid":true, "bestpath":true, "selectionReason":"First path received", "pathFrom":"external", "prefix":"192.168.100.1", "prefixLen":32, "network":"192.168.100.1\/32", "metric":0, "weight":32768, "peerId":"(unspec)", "path":"", "origin":"incomplete", "nexthops":[ { "ip":"0.0.0.0", "hostname":"exit1-debian-9", "afi":"ipv4", "used":true } ] } ] } } ``` After: ``` ],"192.168.100.1/32": [ { "aspath":{ "string":"Local", "segments":[ ], "length":0 }, "origin":"incomplete", "metric":0, "weight":32768, "valid":true, "sourced":true, "bestpath":{ "overall":true, "selectionReason":"First path received" }, "lastUpdate":{ "epoch":1618040124, "string":"Sat Apr 10 07:35:24 2021\n" }, "nexthops":[ { "ip":"0.0.0.0", "hostname":"exit1-debian-9", "afi":"ipv4", "metric":0, "accessible":true, "used":true } ], "peer":{ "peerId":"0.0.0.0", "routerId":"192.168.100.1" } } ] } } ``` Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
This commit is contained in:
parent
d75213d260
commit
f280c93b11
@ -10830,9 +10830,17 @@ static int bgp_show_table(struct vty *vty, struct bgp *bgp, safi_t safi,
|
||||
flap_route_vty_out(vty, dest_p, pi, display,
|
||||
AFI_IP, safi, use_json,
|
||||
json_paths);
|
||||
else
|
||||
route_vty_out(vty, dest_p, pi, display, safi,
|
||||
json_paths, wide);
|
||||
else {
|
||||
if (CHECK_FLAG(show_flags, BGP_SHOW_OPT_DETAIL))
|
||||
route_vty_out_detail(
|
||||
vty, bgp, dest, pi,
|
||||
family2afi(dest_p->family),
|
||||
safi, RPKI_NOT_BEING_USED,
|
||||
json_paths);
|
||||
else
|
||||
route_vty_out(vty, dest_p, pi, display,
|
||||
safi, json_paths, wide);
|
||||
}
|
||||
display++;
|
||||
}
|
||||
|
||||
@ -11905,7 +11913,7 @@ DEFPY (show_ip_bgp_json,
|
||||
|route-filter-translated-v4] [exact-match]\
|
||||
|rpki <invalid|valid|notfound>\
|
||||
|version (1-4294967295)\
|
||||
] [json$uj | wide$wide]",
|
||||
] [json$uj [detail$detail] | wide$wide]",
|
||||
SHOW_STR
|
||||
IP_STR
|
||||
BGP_STR
|
||||
@ -11941,6 +11949,7 @@ DEFPY (show_ip_bgp_json,
|
||||
"Display prefixes with matching version numbers\n"
|
||||
"Version number and above\n"
|
||||
JSON_STR
|
||||
"Display detailed version of JSON output\n"
|
||||
"Increase table width for longer prefixes\n")
|
||||
{
|
||||
afi_t afi = AFI_IP6;
|
||||
@ -11960,6 +11969,9 @@ DEFPY (show_ip_bgp_json,
|
||||
SET_FLAG(show_flags, BGP_SHOW_OPT_JSON);
|
||||
}
|
||||
|
||||
if (detail)
|
||||
SET_FLAG(show_flags, BGP_SHOW_OPT_DETAIL);
|
||||
|
||||
/* [<ipv4|ipv6> [all]] */
|
||||
if (all) {
|
||||
SET_FLAG(show_flags, BGP_SHOW_OPT_AFI_ALL);
|
||||
|
@ -586,6 +586,7 @@ DECLARE_HOOK(bgp_process,
|
||||
#define BGP_SHOW_OPT_AFI_IP6 (1 << 4)
|
||||
#define BGP_SHOW_OPT_ESTABLISHED (1 << 5)
|
||||
#define BGP_SHOW_OPT_FAILED (1 << 6)
|
||||
#define BGP_SHOW_OPT_DETAIL (1 << 7)
|
||||
|
||||
/* Prototypes. */
|
||||
extern void bgp_rib_remove(struct bgp_dest *dest, struct bgp_path_info *pi,
|
||||
|
Loading…
Reference in New Issue
Block a user