bgpd: Add route count from neighbours & established sessions to bgp summary
* bgp_vty.c: (bgp_show_summary) The sum of the routes received from
each neighbour can be interesting/useful. Add a line with this to
end of 'show ... bgp ... summary'. Also, add a count of the number of
established sessions.
Note, the route count is also available from 'show bgp <afi> <safi>
statistics', along with more.
diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c
index 8eeaff9..9f09016 100644
--- a/bgpd/bgp_vty.c
+++ b/bgpd/bgp_vty.c
@@ -7480,6 +7480,8 @@
struct peer *peer;
struct listnode *node, *nnode;
unsigned int count = 0;
+ unsigned int totrcount = 0;
+ unsigned int totecount = 0;
char timebuf[BGP_UPTIME_LEN];
int len;
@@ -7561,6 +7563,8 @@
if (peer->status == Established)
{
vty_out (vty, " %8ld", peer->pcount[afi][safi]);
+ totrcount += peer->pcount[afi][safi];
+ totecount++;
}
else
{
@@ -7577,8 +7581,14 @@
}
if (count)
- vty_out (vty, "%sTotal number of neighbors %d%s", VTY_NEWLINE,
- count, VTY_NEWLINE);
+ {
+ vty_out (vty, "%sTotal number of neighbors %d%s", VTY_NEWLINE,
+ count, VTY_NEWLINE);
+ vty_out (vty, "%sTotal num. Established sessions %d%s", VTY_NEWLINE,
+ totecount, VTY_NEWLINE);
+ vty_out (vty, "Total num. of routes received %d%s",
+ totrcount, VTY_NEWLINE);
+ }
else
vty_out (vty, "No %s neighbor is configured%s",
afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE);