From 200116db4ca67896d438bc1ef82e6dc6584724dc Mon Sep 17 00:00:00 2001 From: Dinesh G Dutt <5016467+ddutt@users.noreply.github.com> Date: Mon, 2 Sep 2019 19:37:37 +0000 Subject: [PATCH] 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 ] 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> --- bgpd/bgp_vty.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 9b801b3c94..7e7c0ea2d7 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -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)