bgpd: Add Established and Dropped counts to JSON output of bgp summary

Based on a suggestion by Donald Sharp, this patch adds the counts of the
number of times a BGP peering session has transitioned from Estd->NotEstd
and from NotEstd->Estd to the JSON output only of the
"show [ip] bgp [vrf <vrf>] summary" command. The idea is that even if the
current session is well and up, but a sessions has trasnitionined in and
out of Estd state multiple times, its worth noting that. We cannot change
the non-JSON output as easily, and so this command only addresses the JSON
part for now. The fields added are the ones that were provided only as part
of the "show bgp neighbor" command.

Signed-off-by: Dinesh G Dutt <5016467+ddutt@users.noreply.github.com>
This commit is contained in:
Dinesh G Dutt 2019-09-02 19:37:37 +00:00
parent 3577f1c54f
commit 200116db4c

View File

@ -8392,6 +8392,10 @@ static int bgp_show_summary(struct vty *vty, struct bgp *bgp, int afi, int safi,
json_peer, "state",
lookup_msg(bgp_status_msg, peer->status,
NULL));
json_object_int_add(json_peer, "connectionsEstablished",
peer->established);
json_object_int_add(json_peer, "connectionsDropped",
peer->dropped);
}
/* Avoid creating empty peer dicts in JSON */
if (json_peer == NULL)