Skip to content

Commit

Permalink
Merge "Update RoutingInstance table stats key to virtual_network name"
Browse files Browse the repository at this point in the history
  • Loading branch information
Zuul authored and opencontrail-ci-admin committed Sep 26, 2016
2 parents 6c1732b + c0f32dc commit 4035b13
Show file tree
Hide file tree
Showing 34 changed files with 537 additions and 273 deletions.
5 changes: 0 additions & 5 deletions src/bgp/SConscript
Expand Up @@ -18,7 +18,6 @@ SandeshGenFiles += env.SandeshGenOnlyCpp('bgp_peer_internal.sandesh')
SandeshGenFiles += env.SandeshGenCpp('bgp_log.sandesh')
SandeshGenFiles += env.SandeshGenCpp('virtual_network.sandesh')
SandeshGenFiles += env.SandeshGenCpp('vrouter.sandesh')
SandeshGenFiles += env.SandeshGenCpp('bgp_table.sandesh')
SandeshGenSrcs = env.ExtractCpp(SandeshGenFiles)

env.Append(CPPPATH = env['TOP'])
Expand All @@ -33,10 +32,6 @@ SandeshPeerFiles = env.SandeshGenCpp('peer_info.sandesh')
SandeshPeerGenSrcs = env.ExtractCpp(SandeshPeerFiles)
libpeer_sandesh = env.Library('peer_sandesh', SandeshPeerGenSrcs);

SandeshTableFiles = env.SandeshGenCpp('table_info.sandesh')
SandeshTableGenSrcs = env.ExtractCpp(SandeshTableFiles)
libtable_sandesh = env.Library('table_sandesh', SandeshTableGenSrcs);

SandeshTableFiles = env.SandeshGenCpp('sandesh_info.sandesh')
SandeshTableGenSrcs = env.ExtractCpp(SandeshTableFiles)
libsandesh_sandesh = env.Library('sandesh_sandesh', SandeshTableGenSrcs);
Expand Down
68 changes: 2 additions & 66 deletions src/bgp/bgp_server.cc
Expand Up @@ -16,7 +16,6 @@
#include "bgp/bgp_peer.h"
#include "bgp/bgp_ribout_updates.h"
#include "bgp/bgp_session_manager.h"
#include "bgp/bgp_table_types.h"
#include "bgp/bgp_update_sender.h"
#include "bgp/peer_stats.h"
#include "bgp/routing-instance/iservice_chain_mgr.h"
Expand All @@ -35,6 +34,7 @@ using boost::tie;
using process::ConnectionState;
using std::boolalpha;
using std::make_pair;
using std::map;
using std::noboolalpha;
using std::string;

Expand Down Expand Up @@ -780,70 +780,6 @@ uint32_t BgpServer::GetDownStaticRouteCount() const {
return count;
}

uint32_t BgpServer::SendTableStatsUve(bool first) const {
uint32_t out_q_depth = 0;
for (RoutingInstanceMgr::RoutingInstanceIterator rit = inst_mgr_->begin();
rit != inst_mgr_->end(); ++rit) {
RoutingInstanceStatsData instance_info;
RoutingInstance::RouteTableList const rt_list = rit->GetTables();
std::map<string, BgpTableStats> tables_stats;

for (RoutingInstance::RouteTableList::const_iterator it =
rt_list.begin(); it != rt_list.end(); ++it) {
BgpTable *table = it->second;

size_t markers;
out_q_depth += table->GetPendingRiboutsCount(&markers);
string family = Address::FamilyToString(table->family());

bool changed = false;

if (first || table->stats()->get_prefixes() != table->Size()) {
changed = true;
table->stats()->set_prefixes(table->Size());
}

if (first || table->stats()->get_primary_paths() !=
table->GetPrimaryPathCount()) {
changed = true;
table->stats()->set_primary_paths(table->GetPrimaryPathCount());
}

if (first || table->stats()->get_secondary_paths() !=
table->GetSecondaryPathCount()) {
changed = true;
table->stats()->set_secondary_paths(
table->GetSecondaryPathCount());
}

uint64_t total_paths = table->stats()->get_primary_paths() +
table->stats()->get_secondary_paths() +
table->stats()->get_infeasible_paths();
if (first || table->stats()->get_total_paths() != total_paths) {
changed = true;
table->stats()->set_total_paths(total_paths);
}

if (changed) {
tables_stats.insert(make_pair(family, *table->stats()));

// Reset changed flags in the uve structure.
memset(&(table->stats()->__isset), 0,
sizeof(table->stats()->__isset));
}
}

// Set the key and send out the uve.
if (!tables_stats.empty()) {
instance_info.set_name(rit->name());
instance_info.set_table_stats(tables_stats);
RoutingInstanceStats::Send(instance_info);
}
}

return out_q_depth;
}

void BgpServer::FillPeerStats(const BgpPeer *peer) const {
PeerStatsInfo stats;
PeerStats::FillPeerDebugStats(peer->peer_stats(), &stats);
Expand Down Expand Up @@ -970,7 +906,7 @@ bool BgpServer::CollectStats(BgpRouterState *state, bool first) const {
change = true;
}

uint32_t out_load = SendTableStatsUve(first);
uint32_t out_load = inst_mgr_->SendTableStatsUve();
if (first || out_load != state->get_output_queue_depth()) {
state->set_output_queue_depth(out_load);
change = true;
Expand Down
1 change: 0 additions & 1 deletion src/bgp/bgp_server.h
Expand Up @@ -266,7 +266,6 @@ class BgpServer {
typedef std::map<TcpSession::Endpoint, BgpPeer *> EndpointToBgpPeerList;

void RoutingInstanceMgrDeletionComplete(RoutingInstanceMgr *mgr);
uint32_t SendTableStatsUve(bool first) const;
void FillPeerStats(const BgpPeer *peer) const;

// base config variables
Expand Down
2 changes: 1 addition & 1 deletion src/bgp/bgp_show_routing_instance.cc
Expand Up @@ -45,7 +45,7 @@ static void FillRoutingInstanceInfo(ShowRoutingInstance *sri,
const BgpSandeshContext *bsc, const RoutingInstance *rtinstance,
bool summary) {
sri->set_name(rtinstance->name());
sri->set_virtual_network(rtinstance->virtual_network());
sri->set_virtual_network(rtinstance->GetVirtualNetworkName());
sri->set_vn_index(rtinstance->virtual_network_index());
sri->set_vxlan_id(rtinstance->vxlan_id());
sri->set_deleted(rtinstance->deleted());
Expand Down
2 changes: 0 additions & 2 deletions src/bgp/bgp_table.cc
Expand Up @@ -17,7 +17,6 @@
#include "bgp/bgp_ribout_updates.h"
#include "bgp/bgp_route.h"
#include "bgp/bgp_server.h"
#include "bgp/bgp_table_types.h"
#include "bgp/bgp_update.h"
#include "bgp/routing-instance/iroute_aggregator.h"
#include "bgp/routing-instance/path_resolver.h"
Expand Down Expand Up @@ -61,7 +60,6 @@ BgpTable::BgpTable(DB *db, const string &name)
: RouteTable(db, name),
rtinstance_(NULL),
path_resolver_(NULL),
stats_(new BgpTableStats()),
instance_delete_ref_(this, NULL) {
primary_path_count_ = 0;
secondary_path_count_ = 0;
Expand Down
3 changes: 0 additions & 3 deletions src/bgp/bgp_table.h
Expand Up @@ -17,7 +17,6 @@
#include "route/table.h"

class BgpServer;
class BgpTableStats;
class BgpRoute;
class BgpPath;
class BgpUpdateSender;
Expand Down Expand Up @@ -145,7 +144,6 @@ class BgpTable : public RouteTable {

// Check whether the route is contributing route to aggregate route
bool IsContributingRoute(const BgpRoute *route) const;
BgpTableStats *stats() { return stats_.get(); }

bool DeletePath(DBTablePartBase *root, BgpRoute *rt, BgpPath *path);
virtual void Input(DBTablePartition *root, DBClient *client,
Expand Down Expand Up @@ -174,7 +172,6 @@ class BgpTable : public RouteTable {
RoutingInstance *rtinstance_;
PathResolver *path_resolver_;
RibOutMap ribout_map_;
boost::scoped_ptr<BgpTableStats> stats_;

boost::scoped_ptr<DeleteActor> deleter_;
LifetimeRef<BgpTable> instance_delete_ref_;
Expand Down
25 changes: 0 additions & 25 deletions src/bgp/bgp_table.sandesh

This file was deleted.

1 change: 0 additions & 1 deletion src/bgp/daemon/SConscript
Expand Up @@ -15,7 +15,6 @@ libs = [
'tunnel_encap',
'origin_vn',
'peer_sandesh',
'table_sandesh',
'route',
'net',
'db',
Expand Down
1 change: 0 additions & 1 deletion src/bgp/ermvpn/test/SConscript
Expand Up @@ -47,7 +47,6 @@ env.Prepend(LIBS = [
'bgp_ifmap_config',
'extended_community',
'peer_sandesh',
'table_sandesh',
'control_node',
'origin_vn',
'routing_instance',
Expand Down
1 change: 0 additions & 1 deletion src/bgp/evpn/test/SConscript
Expand Up @@ -49,7 +49,6 @@ env.Prepend(LIBS = [
'control_node',
'extended_community',
'peer_sandesh',
'table_sandesh',
'origin_vn',
'routing_instance',
'routing_policy',
Expand Down
1 change: 0 additions & 1 deletion src/bgp/inet/test/SConscript
Expand Up @@ -48,7 +48,6 @@ env.Prepend(LIBS = [
'bgp',
'bgp_ifmap_config',
'peer_sandesh',
'table_sandesh',
'control_node',
'origin_vn',
'routing_instance',
Expand Down
1 change: 0 additions & 1 deletion src/bgp/inet6/test/SConscript
Expand Up @@ -48,7 +48,6 @@ env.Prepend(LIBS = [
'bgp',
'bgp_ifmap_config',
'peer_sandesh',
'table_sandesh',
'control_node',
'origin_vn',
'routing_instance',
Expand Down
1 change: 0 additions & 1 deletion src/bgp/inet6vpn/test/SConscript
Expand Up @@ -47,7 +47,6 @@ env.Prepend(LIBS = [
'bgp',
'bgp_ifmap_config',
'peer_sandesh',
'table_sandesh',
'control_node',
'origin_vn',
'routing_instance',
Expand Down
1 change: 0 additions & 1 deletion src/bgp/l3vpn/test/SConscript
Expand Up @@ -50,7 +50,6 @@ env.Prepend(LIBS = [
'bgp_ifmap_config',
'extended_community',
'peer_sandesh',
'table_sandesh',
'control_node',
'origin_vn',
'routing_instance',
Expand Down
1 change: 1 addition & 0 deletions src/bgp/routing-instance/SConscript
Expand Up @@ -22,6 +22,7 @@ SandeshGenFiles += env.SandeshGenOnlyCpp('service_chaining_internal.sandesh')
SandeshGenFiles += env.SandeshGenCpp('static_route.sandesh')
SandeshGenFiles += env.SandeshGenOnlyCpp('static_route_internal.sandesh')
SandeshGenFiles += env.SandeshGenCpp('route_aggregate.sandesh')
SandeshGenFiles += env.SandeshGenCpp('routing_table.sandesh')
SandeshGenFiles += env.SandeshGenOnlyCpp('route_aggregate_internal.sandesh')
SandeshGenSrcs = env.ExtractCpp(SandeshGenFiles)

Expand Down
7 changes: 5 additions & 2 deletions src/bgp/routing-instance/route_aggregate.sandesh
Expand Up @@ -14,8 +14,11 @@ struct AggregateRouteInfo {
}

struct AggregateRouteEntriesInfo {
1: string name (link="ShowRouteAggregateReq");
2: list<AggregateRouteInfo> aggregate_route_list;
1: "VirtualNetwork";
2: string name (link="ShowRouteAggregateReq");
3: "Routing Instance";
4: string instance_name;
5: list<AggregateRouteInfo> aggregate_route_list;
}

response sandesh ShowRouteAggregateSummaryResp {
Expand Down
3 changes: 2 additions & 1 deletion src/bgp/routing-instance/route_aggregator.cc
Expand Up @@ -742,7 +742,8 @@ bool RouteAggregator<T>::FillAggregateRouteInfo(AggregateRouteEntriesInfo *info,
if (aggregate_route_map().empty())
return false;

info->set_name(rtinstance_->name());
info->set_name(rtinstance_->GetVirtualNetworkName());
info->set_instance_name(rtinstance_->name());
for (typename AggregateRouteMap::const_iterator it =
aggregate_route_map_.begin(); it != aggregate_route_map_.end(); it++) {
AggregateRouteT *aggregate =
Expand Down

0 comments on commit 4035b13

Please sign in to comment.