summaryrefslogtreecommitdiffstats
path: root/bgpd/bgp_evpn_vty.c
diff options
context:
space:
mode:
authorTrey Aspelund <taspelund@nvidia.com>2023-02-10 20:05:27 +0100
committerTrey Aspelund <taspelund@nvidia.com>2023-02-16 17:05:16 +0100
commitf9f2d188e3980d2338747739848001a432ad30b2 (patch)
treeac5e2ee9c082ae1dd5aa445c63d2eea51416dda9 /bgpd/bgp_evpn_vty.c
parentMerge pull request #12794 from anlancs/fix/doc-pid-path (diff)
downloadfrr-f9f2d188e3980d2338747739848001a432ad30b2.tar.xz
frr-f9f2d188e3980d2338747739848001a432ad30b2.zip
bgpd: fix 'json detail' output structure
"show bgp <afi> <safi> json detail" was incorrectly displaying header information from route_vty_out_detail_header() as an element of the "paths" array. This corrects the behavior for 'json detail' so that a route holds a dictionary with keys for "paths" and header info, which aligns with how we structure the output for a specific prefix, e.g. "show bgp <afi> <safi> <prefix> json". Before: ``` ub20# show ip bgp json detail { "vrfId": 0, "vrfName": "default", "tableVersion": 3, "routerId": "100.64.0.222", "defaultLocPrf": 100, "localAS": 1, "routes": { "2.2.2.2/32": [ { <<<<<<<<< should be outside the array "prefix":"2.2.2.2/32", "version":1, "advertisedTo":{ "192.168.122.12":{ "hostname":"ub20-2" } } }, { "aspath":{ "string":"Local", "segments":[ ], "length":0 }, <snip> ``` After: ``` ub20# show ip bgp json detail { "vrfId": 0, "vrfName": "default", "tableVersion": 3, "routerId": "100.64.0.222", "defaultLocPrf": 100, "localAS": 1, "routes": { "2.2.2.2/32": { "prefix": "2.2.2.2/32", "version": "1", "advertisedTo": { "192.168.122.12":{ "hostname":"ub20-2" } } ,"paths": [ { "aspath":{ "string":"Local", "segments":[ ], "length":0 }, ``` Signed-off-by: Trey Aspelund <taspelund@nvidia.com>
Diffstat (limited to 'bgpd/bgp_evpn_vty.c')
-rw-r--r--bgpd/bgp_evpn_vty.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/bgpd/bgp_evpn_vty.c b/bgpd/bgp_evpn_vty.c
index 6b63c6e3a..79d2bbbe3 100644
--- a/bgpd/bgp_evpn_vty.c
+++ b/bgpd/bgp_evpn_vty.c
@@ -2485,7 +2485,7 @@ static void evpn_show_route_vni_multicast(struct vty *vty, struct bgp *bgp,
/* Prefix and num paths displayed once per prefix. */
route_vty_out_detail_header(vty, bgp, dest, bgp_dest_get_prefix(dest),
- NULL, afi, safi, json);
+ NULL, afi, safi, json, false);
/* Display each path for this prefix. */
for (pi = bgp_dest_get_bgp_path_info(dest); pi; pi = pi->next) {
@@ -2587,7 +2587,7 @@ static void evpn_show_route_vni_macip(struct vty *vty, struct bgp *bgp,
/* Prefix and num paths displayed once per prefix. */
route_vty_out_detail_header(vty, bgp, dest, (struct prefix *)&p, NULL,
- afi, safi, json);
+ afi, safi, json, false);
evp = (const struct prefix_evpn *)bgp_dest_get_prefix(dest);
@@ -2722,7 +2722,7 @@ static void evpn_show_route_rd_macip(struct vty *vty, struct bgp *bgp,
/* Prefix and num paths displayed once per prefix. */
route_vty_out_detail_header(vty, bgp, dest, bgp_dest_get_prefix(dest),
- prd, afi, safi, json);
+ prd, afi, safi, json, false);
if (json)
json_paths = json_object_new_array();
@@ -2830,7 +2830,7 @@ static void evpn_show_route_rd(struct vty *vty, struct bgp *bgp,
/* Prefix and num paths displayed once per prefix. */
route_vty_out_detail_header(
vty, bgp, dest, bgp_dest_get_prefix(dest), prd,
- afi, safi, json_prefix);
+ afi, safi, json_prefix, false);
prefix_cnt++;
}
@@ -2965,7 +2965,7 @@ static void evpn_show_route_rd_all_macip(struct vty *vty, struct bgp *bgp,
/* Prefix and num paths displayed once per prefix. */
route_vty_out_detail_header(
vty, bgp, dest, p, (struct prefix_rd *)rd_destp,
- AFI_L2VPN, SAFI_EVPN, json_prefix);
+ AFI_L2VPN, SAFI_EVPN, json_prefix, false);
/* For EVPN, the prefix is displayed for each path (to
* fit in with code that already exists).
@@ -3119,7 +3119,7 @@ static void evpn_show_all_routes(struct vty *vty, struct bgp *bgp, int type,
vty, bgp, dest,
bgp_dest_get_prefix(dest),
(struct prefix_rd *)rd_destp, AFI_L2VPN,
- SAFI_EVPN, json_prefix);
+ SAFI_EVPN, json_prefix, false);
/* For EVPN, the prefix is displayed for each path (to
* fit in