Skip to content

Commit

Permalink
Remove instance stats uve upon instance deletion
Browse files Browse the repository at this point in the history
Also send infeasible paths count as part of table stats uve

Change-Id: I8ef25b52ec643eb1f2111893846004c8047836f7
Partial-Bug: #1576437
  • Loading branch information
ananth-at-camphor-networks committed Sep 21, 2016
1 parent 3247128 commit f3132e1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/bgp/bgp_server.cc
Expand Up @@ -773,6 +773,13 @@ uint32_t BgpServer::SendTableStatsUve(bool first) const {
table->GetSecondaryPathCount());
}

if (first || table->stats()->get_infeasible_paths() !=
table->GetInfeasiblePathCount()) {
changed = true;
table->stats()->set_infeasible_paths(
table->GetSecondaryPathCount());
}

uint64_t total_paths = table->stats()->get_primary_paths() +
table->stats()->get_secondary_paths() +
table->stats()->get_infeasible_paths();
Expand Down
7 changes: 7 additions & 0 deletions src/bgp/routing-instance/routing_instance.cc
Expand Up @@ -13,6 +13,7 @@
#include "bgp/bgp_factory.h"
#include "bgp/bgp_log.h"
#include "bgp/bgp_server.h"
#include "bgp/bgp_table_types.h"
#include "bgp/routing-instance/iroute_aggregator.h"
#include "bgp/routing-instance/iservice_chain_mgr.h"
#include "bgp/routing-instance/istatic_route_mgr.h"
Expand Down Expand Up @@ -426,6 +427,12 @@ void RoutingInstanceMgr::DestroyRoutingInstance(RoutingInstance *rtinstance) {
RTINSTANCE_LOG(Destroy, rtinstance,
SandeshLevel::SYS_DEBUG, RTINSTANCE_LOG_FLAG_ALL);

// Delete instance stats uve.
RoutingInstanceStatsData instance_info;
instance_info.set_name(rtinstance->name());
instance_info.set_deleted(true);
RoutingInstanceStats::Send(instance_info);

// Remove call here also deletes the instance.
const string name = rtinstance->name();
instances_.Remove(rtinstance->name(), rtinstance->index());
Expand Down

0 comments on commit f3132e1

Please sign in to comment.