]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd: Show the instance name when displaying statistics 6745/head
authorDonatas Abraitis <donatas.abraitis@gmail.com>
Wed, 15 Jul 2020 14:52:12 +0000 (17:52 +0300)
committerDonatas Abraitis <donatas.abraitis@gmail.com>
Wed, 15 Jul 2020 18:36:32 +0000 (21:36 +0300)
```
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>
bgpd/bgp_route.c

index d2ae35339cd9ff961b72ed386fbce60f9753e149..7bc9550da9f46f95a2810a414bfb2df48e1a17da 100644 (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)