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>
This commit is contained in:
Donatas Abraitis 2020-07-15 17:52:12 +03:00
parent 71f1613a3f
commit 5290ceab0c

View File

@ -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)