From: Donatas Abraitis Date: Wed, 15 Jul 2020 14:52:12 +0000 (+0300) Subject: bgpd: Show the instance name when displaying statistics X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=b5bae2c827997107732a859883e84c93251552b7;p=matthieu%2Ffrr.git 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 --- diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 5f645fa871..6930ba3e71 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -11414,8 +11414,10 @@ static int bgp_table_stats(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)