Skip to content

Commit

Permalink
Merge "Send IFMap parse error statistics in Vrouter UVE" into R3.0.2.x
Browse files Browse the repository at this point in the history
  • Loading branch information
Zuul authored and opencontrail-ci-admin committed Aug 24, 2016
2 parents f94ec17 + 10ec9a9 commit 09941ef
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/analytics/viz.sandesh
Original file line number Diff line number Diff line change
Expand Up @@ -2007,6 +2007,18 @@ const list<stat_table> _STAT_TABLES = [
{ 'name' : 'flow_rate.active_flows', 'datatype' : 'int', 'index' : false }
]
},
{
'display_name' : 'Vrouter IFMAP Parse Error Statistics',
'stat_type' : 'VrouterStatsAgent'
'stat_attr' : 'ifmap_stats',
'obj_table' : VROUTER_TABLE,
'attributes': [
{ 'name' : 'ifmap_stats.node_update_parse_errors', 'datatype' : 'int', 'index' : false },
{ 'name' : 'ifmap_stats.link_update_parse_errors', 'datatype' : 'int', 'index' : false },
{ 'name' : 'ifmap_stats.node_delete_parse_errors', 'datatype' : 'int', 'index' : false },
{ 'name' : 'ifmap_stats.link_delete_parse_errors', 'datatype' : 'int', 'index' : false }
]
},
{
'display_name' : 'Analytics API Statistics',
'stat_type' : 'AnalyticsApiStats',
Expand Down
11 changes: 11 additions & 0 deletions src/vnsw/agent/uve/vrouter.sandesh
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,16 @@ struct AgentIfBandwidth {
3: u64 out_bandwidth_usage;
}

/**
* Sandesh definition of Agent IFMap parse statistics
*/
struct AgentIFMapStats {
1: u64 node_update_parse_errors;
2: u64 link_update_parse_errors;
3: u64 node_delete_parse_errors;
4: u64 link_delete_parse_errors;
}

/**
* Sandesh definition for vrouter flow rate
*/
Expand Down Expand Up @@ -289,6 +299,7 @@ struct VrouterStatsAgent { // Agent stats
44: optional double total_out_bandwidth_utilization;
45: optional VrouterFlowRate flow_rate (tags="")
46: optional list<AgentIfBandwidth> phy_if_band (tags="name:.name")
50: optional AgentIFMapStats ifmap_stats (tags="")
}

/**
Expand Down
44 changes: 44 additions & 0 deletions src/vnsw/agent/uve/vrouter_uve_entry.cc
Original file line number Diff line number Diff line change
Expand Up @@ -271,13 +271,57 @@ bool VrouterUveEntry::SendVrouterMsg() {
prev_flow_setup_rate_export_time_ = cur_time;
}

AgentIFMapStats ifmap_stats;
if (BuildIFMapStats(ifmap_stats)) {
change = true;
stats.set_ifmap_stats(ifmap_stats);
}

if (change) {
DispatchVrouterStatsMsg(stats);
}
first = false;
return true;
}

bool VrouterUveEntry::BuildIFMapStats(AgentIFMapStats &s) {
uint64_t node_updates, link_updates, node_deletes, link_deletes;
IFMapAgentParser *parser = agent_->cfg()->cfg_parser();
if (parser) {
uint64_t total_node_updates = parser->node_update_parse_errors();
uint64_t total_link_updates = parser->link_update_parse_errors();
uint64_t total_node_deletes = parser->node_delete_parse_errors();
uint64_t total_link_deletes = parser->link_delete_parse_errors();

node_updates = total_node_updates -
prev_ifmap_stats_.node_update_parse_errors;

link_updates = total_link_updates -
prev_ifmap_stats_.link_update_parse_errors;

node_deletes = total_node_deletes -
prev_ifmap_stats_.node_delete_parse_errors;

link_deletes = total_link_deletes -
prev_ifmap_stats_.link_delete_parse_errors;

if (node_updates || link_updates || node_deletes || link_deletes) {
s.set_node_update_parse_errors(node_updates);
s.set_link_update_parse_errors(link_updates);
s.set_node_delete_parse_errors(node_deletes);
s.set_link_delete_parse_errors(link_deletes);
/* Update the prev stats */
prev_ifmap_stats_.set_node_update_parse_errors(total_node_updates);
prev_ifmap_stats_.set_link_update_parse_errors(total_link_updates);
prev_ifmap_stats_.set_node_delete_parse_errors(total_node_deletes);
prev_ifmap_stats_.set_link_delete_parse_errors(total_link_deletes);

return true;
}
}
return false;
}

uint64_t VrouterUveEntry::CalculateBandwitdh(uint64_t bytes, int speed_mbps,
int diff_seconds,
double *utilization_bps) const {
Expand Down
2 changes: 2 additions & 0 deletions src/vnsw/agent/uve/vrouter_uve_entry.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,10 @@ class VrouterUveEntry : public VrouterUveEntryBase {
bool BuildPhysicalInterfaceList(std::vector<AgentIfStats> &list) const;
std::string GetMacAddress(const MacAddress &mac) const;
void BuildXmppStatsList(std::vector<AgentXmppStats> &list) const;
bool BuildIFMapStats(AgentIFMapStats &s);

uint64_t start_time_;
AgentIFMapStats prev_ifmap_stats_;
DISALLOW_COPY_AND_ASSIGN(VrouterUveEntry);
};

Expand Down

0 comments on commit 09941ef

Please sign in to comment.