]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd: Add Established and Dropped counts to JSON output of bgp summary 4920/head
authorDinesh G Dutt <5016467+ddutt@users.noreply.github.com>
Mon, 2 Sep 2019 19:37:37 +0000 (19:37 +0000)
committerDinesh G Dutt <5016467+ddutt@users.noreply.github.com>
Mon, 2 Sep 2019 19:37:37 +0000 (19:37 +0000)
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>
bgpd/bgp_vty.c

index 9b801b3c94bbddee74a6b4253fa1f3444bab61b2..7e7c0ea2d7eec50646b486e5973c67c7564e1295 100644 (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)