summaryrefslogtreecommitdiffstats
path: root/bgpd/bgp_route.c
diff options
context:
space:
mode:
authorDonatas Abraitis <donatas.abraitis@gmail.com>2020-07-15 16:52:12 +0200
committerDonatas Abraitis <donatas.abraitis@gmail.com>2020-07-15 20:36:32 +0200
commit5290ceab0c86bbb18a07a7509187c5aee48df00c (patch)
tree298d083f142386aea2a84c25cb6b8cd7276e7a71 /bgpd/bgp_route.c
parentbgpd: Do not crash if bgp argument is NULL for bgp_table_stats() (diff)
downloadfrr-5290ceab0c86bbb18a07a7509187c5aee48df00c.tar.xz
frr-5290ceab0c86bbb18a07a7509187c5aee48df00c.zip
bgpd: Show the instance name when displaying statistics
``` exit1-debian-9# sh ip bgp vrf all statistics json { "ipv4Unicast":[ { "instance":"VRF default", "totalAdvertisements":2, "totalPrefixes":2, "averagePrefixLength":24, "unaggregateablePrefixes":2, "maximumAggregateablePrefixes":0, "bgpAggregateAdvertisements":0, "addressSpaceAdvertised":512, "%announced":1.1920928955078125e-05, "\/8equivalent":3.0517578125e-05, "\/24equivalent":2, "advertisementsWithPaths":2, "longestAsPath":0, "averageAsPathLengthHops":0, "largestAsPath":0, "averageAsPathSizeBytes":0, "highestPublicAsn":0 }, { "instance":"VRF testas", "totalAdvertisements":0, "totalPrefixes":0, "averagePrefixLength":0, "unaggregateablePrefixes":0, "maximumAggregateablePrefixes":0, "bgpAggregateAdvertisements":0, "addressSpaceAdvertised":0, "%announced":0, "\/8equivalent":0, "\/24equivalent":0, "advertisementsWithPaths":0, "longestAsPath":0, "averageAsPathLengthHops":0, "largestAsPath":0, "averageAsPathSizeBytes":0, "highestPublicAsn":0 } ] } ``` Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
Diffstat (limited to '')
-rw-r--r--bgpd/bgp_route.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index d2ae35339..7bc9550da 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -11437,8 +11437,10 @@ static int bgp_table_stats_single(struct vty *vty, struct bgp *bgp, afi_t afi,
}
if (!json)
- vty_out(vty, "BGP %s RIB statistics\n",
- get_afi_safi_str(afi, safi, false));
+ vty_out(vty, "BGP %s RIB statistics (%s)\n",
+ get_afi_safi_str(afi, safi, false), bgp->name_pretty);
+ else
+ json_object_string_add(json, "instance", bgp->name_pretty);
/* labeled-unicast routes live in the unicast table */
if (safi == SAFI_LABELED_UNICAST)