From a5933f9f4bc6764857e882e775eebdb1a08cdd8d Mon Sep 17 00:00:00 2001 From: Ananth Suryanarayana Date: Mon, 1 Aug 2016 22:28:48 -0700 Subject: [PATCH] Send BGP Peer Flap stats periodically This is required in order to generate derived stats correctly Change-Id: I74fa4c6b6ed7b5ed456d91541bb7677d7f6e064e Partial-Bug: 1576437 --- src/bgp/bgp_peer.h | 1 + src/bgp/bgp_server.cc | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/src/bgp/bgp_peer.h b/src/bgp/bgp_peer.h index 7658ffce59b..1a8a2ecf118 100644 --- a/src/bgp/bgp_peer.h +++ b/src/bgp/bgp_peer.h @@ -223,6 +223,7 @@ class BgpPeer : public IPeer { void increment_flap_count(); void reset_flap_count(); uint64_t flap_count() const { return flap_count_; } + uint64_t last_flap() const { return last_flap_; } uint64_t total_flap_count() const { return total_flap_count_; } std::string last_flap_at() const; diff --git a/src/bgp/bgp_server.cc b/src/bgp/bgp_server.cc index c0c60eb8908..c5af87aa525 100644 --- a/src/bgp/bgp_server.cc +++ b/src/bgp/bgp_server.cc @@ -814,6 +814,15 @@ void BgpServer::FillPeerStats(const BgpPeer *peer) const { peer_stats_data.set_name(peer->ToUVEKey()); PeerStats::FillPeerUpdateStats(peer->peer_stats(), &peer_stats_data); PeerStatsUve::Send(peer_stats_data, "ObjectBgpPeer"); + + PeerFlapInfo flap_info; + flap_info.set_flap_count(peer->flap_count()); + flap_info.set_flap_time(peer->last_flap()); + + PeerFlapData peer_flap_data; + peer_flap_data.set_name(peer->ToUVEKey()); + peer_flap_data.set_flap_info(flap_info); + PeerFlap::Send(peer_flap_data, "ObjectBgpPeer"); } bool BgpServer::CollectStats(BgpRouterState *state, bool first) const {