From 54baab9a856db6ddad183c115b0da238c31e7f37 Mon Sep 17 00:00:00 2001 From: ashoksingh Date: Wed, 13 May 2015 15:56:45 +0530 Subject: [PATCH] Disable flow and UVE stats from TSN Split the AgentUveBase and AgentUve into 3 classes AgentUveBase, AgentUve and AgentUveStats such that AgentUveBase is the base for both AgentUve and AgentUveStats. This split will help in disabling UVE stats from TSN. In TSN mode we create AgentUve object while in non-TSN mode we create AgentUveStats object. Change-Id: I81586951b73c1019b340eaaa63fb81495186a5f1 Closes-Bug: #1453783 --- .../agent/contrail/contrail_agent_init.cc | 15 +++-- .../agent/ovs_tor_agent/tor_agent_init.cc | 8 +-- src/vnsw/agent/pkt/pkt_sandesh_flow.cc | 6 +- src/vnsw/agent/test/test_util.cc | 11 ++-- src/vnsw/agent/uve/SConscript | 3 +- src/vnsw/agent/uve/agent_uve.cc | 38 ++---------- src/vnsw/agent/uve/agent_uve.h | 8 --- src/vnsw/agent/uve/agent_uve_base.cc | 8 +-- src/vnsw/agent/uve/agent_uve_base.h | 2 +- src/vnsw/agent/uve/agent_uve_stats.cc | 58 +++++++++++++++++++ src/vnsw/agent/uve/agent_uve_stats.h | 31 ++++++++++ .../agent/uve/interface_uve_stats_table.cc | 4 +- .../uve/test/agent_stats_collector_test.cc | 5 +- src/vnsw/agent/uve/test/agent_uve_test.cc | 2 +- src/vnsw/agent/uve/test/agent_uve_test.h | 4 +- src/vnsw/agent/uve/test/test_prouter_uve.cc | 34 +++++------ src/vnsw/agent/uve/test/test_uve.cc | 8 +-- src/vnsw/agent/uve/test/test_uve_util.h | 5 +- src/vnsw/agent/uve/test/test_vrouter_uve.cc | 14 ++--- src/vnsw/agent/uve/vn_uve_entry.cc | 4 +- src/vnsw/agent/uve/vn_uve_table.cc | 4 +- src/vnsw/agent/uve/vrouter_uve_entry.cc | 12 ++-- .../agent_stats_sandesh_context.cc | 4 +- .../linux/linux_vxlan_agent_init.cc | 8 +-- 24 files changed, 181 insertions(+), 115 deletions(-) create mode 100644 src/vnsw/agent/uve/agent_uve_stats.cc create mode 100644 src/vnsw/agent/uve/agent_uve_stats.h diff --git a/src/vnsw/agent/contrail/contrail_agent_init.cc b/src/vnsw/agent/contrail/contrail_agent_init.cc index 3c8fd154f35..85a5af5521c 100644 --- a/src/vnsw/agent/contrail/contrail_agent_init.cc +++ b/src/vnsw/agent/contrail/contrail_agent_init.cc @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -38,7 +39,13 @@ void ContrailAgentInit::ProcessOptions * Initialization routines ****************************************************************************/ void ContrailAgentInit::FactoryInit() { - AgentObjectFactory::Register(boost::factory()); + if (agent()->tsn_enabled() == false) { + AgentObjectFactory::Register + (boost::factory()); + } else { + AgentObjectFactory::Register + (boost::factory()); + } if (agent_param()->vrouter_on_nic_mode() || agent_param()->vrouter_on_host_dpdk()) { AgentObjectFactory::Register(boost::factory()); } else { @@ -73,14 +80,14 @@ void ContrailAgentInit::CreateModules() { *(agent()->event_manager()->io_service()), agent())); agent()->set_stats_collector(stats_collector_.get()); - } - flow_stats_collector_.reset(new FlowStatsCollector( + flow_stats_collector_.reset(new FlowStatsCollector( *(agent()->event_manager()->io_service()), agent()->params()->flow_stats_interval(), agent()->params()->flow_cache_timeout(), uve_.get())); - agent()->set_flow_stats_collector(flow_stats_collector_.get()); + agent()->set_flow_stats_collector(flow_stats_collector_.get()); + } ksync_.reset(AgentObjectFactory::Create(agent())); agent()->set_ksync(ksync_.get()); diff --git a/src/vnsw/agent/ovs_tor_agent/tor_agent_init.cc b/src/vnsw/agent/ovs_tor_agent/tor_agent_init.cc index 33a74f0ea03..404c578d2ce 100644 --- a/src/vnsw/agent/ovs_tor_agent/tor_agent_init.cc +++ b/src/vnsw/agent/ovs_tor_agent/tor_agent_init.cc @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include #include @@ -77,9 +77,9 @@ void TorAgentInit::CreateModules() { static_cast(agent_param()), ovs_peer_manager())); agent()->set_ovsdb_client(ovsdb_client_.get()); - uve_.reset(new AgentUveBase(agent(), AgentUveBase::kBandwidthInterval, true, - AgentUveBase::kDefaultInterval, - AgentUveBase::kIncrementalInterval)); + uve_.reset(new AgentUve(agent(), AgentUveBase::kBandwidthInterval, + AgentUveBase::kDefaultInterval, + AgentUveBase::kIncrementalInterval)); agent()->set_uve(uve_.get()); } diff --git a/src/vnsw/agent/pkt/pkt_sandesh_flow.cc b/src/vnsw/agent/pkt/pkt_sandesh_flow.cc index 9d8abe63759..6d0cde6cc34 100644 --- a/src/vnsw/agent/pkt/pkt_sandesh_flow.cc +++ b/src/vnsw/agent/pkt/pkt_sandesh_flow.cc @@ -396,19 +396,23 @@ void FetchFlowRecord::HandleRequest() const { // Intended for use in testing only void FlowAgeTimeReq::HandleRequest() const { Agent *agent = Agent::GetInstance(); + uint32_t age_time = get_new_age_time(); FlowStatsCollector *collector = agent->flow_stats_collector(); FlowAgeTimeResp *resp = new FlowAgeTimeResp(); + if (collector == NULL) { + goto done; + } resp->set_old_age_time(collector->flow_age_time_intvl_in_secs()); - uint32_t age_time = get_new_age_time(); if (age_time && age_time != resp->get_old_age_time()) { collector->UpdateFlowAgeTimeInSecs(age_time); resp->set_new_age_time(age_time); } else { resp->set_new_age_time(resp->get_old_age_time()); } +done: resp->set_context(context()); resp->set_more(false); resp->Response(); diff --git a/src/vnsw/agent/test/test_util.cc b/src/vnsw/agent/test/test_util.cc index 2bf3f9bdcf6..98bb7ca736c 100644 --- a/src/vnsw/agent/test/test_util.cc +++ b/src/vnsw/agent/test/test_util.cc @@ -7,6 +7,7 @@ #include "test/test_init.h" #include "oper/mirror_table.h" #include "uve/test/vn_uve_table_test.h" +#include "uve/agent_uve_stats.h" #define MAX_TESTNAME_LEN 80 @@ -696,7 +697,7 @@ bool VmPortGetStats(PortInfo *input, int id, uint32_t & bytes, uint32_t & pkts) if (intf == NULL) return false; - AgentUve *uve = static_cast(Agent::GetInstance()->uve()); + AgentUveStats *uve = static_cast(Agent::GetInstance()->uve()); StatsManager *sm = uve->stats_manager(); const StatsManager::InterfaceStats *st = sm->GetInterfaceStats(intf); if (st == NULL) @@ -714,7 +715,7 @@ bool VrfStatsMatch(int vrf_id, std::string vrf_name, bool stats_match, uint64_t fabric_composites, uint64_t l2_mcast_composites, uint64_t l3_mcast_composites, uint64_t multi_proto_composites, uint64_t encaps, uint64_t l2_encaps) { - AgentUve *uve = static_cast(Agent::GetInstance()->uve()); + AgentUveStats *uve = static_cast(Agent::GetInstance()->uve()); StatsManager *sm = uve->stats_manager(); const StatsManager::VrfStats *st = sm->GetVrfStats(vrf_id); if (st == NULL) { @@ -761,7 +762,7 @@ bool VrfStatsMatchPrev(int vrf_id, uint64_t discards, uint64_t resolves, uint64_t l2_mcast_composites, uint64_t l3_mcast_composites, uint64_t multi_proto_composites, uint64_t encaps, uint64_t l2_encaps) { - AgentUve *uve = static_cast(Agent::GetInstance()->uve()); + AgentUveStats *uve = static_cast(Agent::GetInstance()->uve()); StatsManager *sm = uve->stats_manager(); const StatsManager::VrfStats *st = sm->GetVrfStats(vrf_id); if (st == NULL) { @@ -801,7 +802,7 @@ bool VmPortStats(PortInfo *input, int id, uint32_t bytes, uint32_t pkts) { if (intf == NULL) return false; - AgentUve *uve = static_cast(Agent::GetInstance()->uve()); + AgentUveStats *uve = static_cast(Agent::GetInstance()->uve()); StatsManager *sm = uve->stats_manager(); const StatsManager::InterfaceStats *st = sm->GetInterfaceStats(intf); if (st == NULL) @@ -814,7 +815,7 @@ bool VmPortStats(PortInfo *input, int id, uint32_t bytes, uint32_t pkts) { bool VmPortStatsMatch(Interface *intf, uint32_t ibytes, uint32_t ipkts, uint32_t obytes, uint32_t opkts) { - AgentUve *uve = static_cast(Agent::GetInstance()->uve()); + AgentUveStats *uve = static_cast(Agent::GetInstance()->uve()); StatsManager *sm = uve->stats_manager(); const StatsManager::InterfaceStats *st = sm->GetInterfaceStats(intf); EXPECT_TRUE(st != NULL); diff --git a/src/vnsw/agent/uve/SConscript b/src/vnsw/agent/uve/SConscript index 2fed05ea420..c756794ac09 100644 --- a/src/vnsw/agent/uve/SConscript +++ b/src/vnsw/agent/uve/SConscript @@ -94,6 +94,7 @@ libuve = env.Library('uve', SandeshGenObjs + [ 'agent_uve_base.cc', + 'agent_uve.cc', 'interface_uve_table.cc', 'l4_port_bitmap.cc', 'prouter_uve_table.cc', @@ -108,7 +109,7 @@ libuve = env.Library('uve', libstatsuve = env.Library('statsuve', StatsSandeshGenObjs + [ - 'agent_uve.cc', + 'agent_uve_stats.cc', 'interface_uve_stats_table.cc', 'stats_manager.cc', 'vm_stat.cc', diff --git a/src/vnsw/agent/uve/agent_uve.cc b/src/vnsw/agent/uve/agent_uve.cc index a41cf7ab51d..d46a2b57cf4 100644 --- a/src/vnsw/agent/uve/agent_uve.cc +++ b/src/vnsw/agent/uve/agent_uve.cc @@ -21,39 +21,13 @@ AgentUve::AgentUve(Agent *agent, uint64_t intvl, uint32_t default_intvl, uint32_t incremental_intvl) - : AgentUveBase(agent, intvl, false, default_intvl, incremental_intvl), - stats_manager_(new StatsManager(agent)) { - //Override vm_uve_table_ to point to derived class object - vn_uve_table_.reset(new VnUveTable(agent, default_intvl)); - vm_uve_table_.reset(new VmUveTable(agent, default_intvl)); - vrouter_uve_entry_.reset(new VrouterUveEntry(agent)); - interface_uve_table_.reset(new InterfaceUveStatsTable(agent, - default_intvl)); -} + : AgentUveBase(agent, intvl, default_intvl, incremental_intvl) { -AgentUve::~AgentUve() { + vn_uve_table_.reset(new VnUveTableBase(agent, default_intvl)); + vm_uve_table_.reset(new VmUveTableBase(agent, default_intvl)); + vrouter_uve_entry_.reset(new VrouterUveEntryBase(agent)); + interface_uve_table_.reset(new InterfaceUveTable(agent, default_intvl)); } -StatsManager *AgentUve::stats_manager() const { - return stats_manager_.get(); -} - -void AgentUve::Shutdown() { - AgentUveBase::Shutdown(); - stats_manager_->Shutdown(); -} - -void AgentUve::RegisterDBClients() { - AgentUveBase::RegisterDBClients(); - stats_manager_->RegisterDBClients(); -} - -// The following is deprecated and is present only for backward compatibility -void GetStatsInterval::HandleRequest() const { - StatsIntervalResp_InSeconds *resp = new StatsIntervalResp_InSeconds(); - resp->set_agent_stats_interval(0); - resp->set_flow_stats_interval(0); - resp->set_context(context()); - resp->Response(); - return; +AgentUve::~AgentUve() { } diff --git a/src/vnsw/agent/uve/agent_uve.h b/src/vnsw/agent/uve/agent_uve.h index ea40c207ff4..e67d2f78668 100644 --- a/src/vnsw/agent/uve/agent_uve.h +++ b/src/vnsw/agent/uve/agent_uve.h @@ -6,7 +6,6 @@ #define vnsw_agent_uve_h #include -#include //The class to drive UVE module initialization for agent //Defines objects required for statistics collection from vrouter and @@ -17,13 +16,6 @@ class AgentUve : public AgentUveBase { uint32_t incremental_intvl); virtual ~AgentUve(); - virtual void Shutdown(); - virtual void RegisterDBClients(); - StatsManager *stats_manager() const; - -protected: - boost::scoped_ptr stats_manager_; - private: DISALLOW_COPY_AND_ASSIGN(AgentUve); }; diff --git a/src/vnsw/agent/uve/agent_uve_base.cc b/src/vnsw/agent/uve/agent_uve_base.cc index b57fc8c1a61..0129e53ba4e 100644 --- a/src/vnsw/agent/uve/agent_uve_base.cc +++ b/src/vnsw/agent/uve/agent_uve_base.cc @@ -28,7 +28,7 @@ using process::g_process_info_constants; AgentUveBase *AgentUveBase::singleton_; -AgentUveBase::AgentUveBase(Agent *agent, uint64_t intvl, bool create_objects, +AgentUveBase::AgentUveBase(Agent *agent, uint64_t intvl, uint32_t default_intvl, uint32_t incremental_intvl) : vn_uve_table_(NULL), vm_uve_table_(NULL), vrouter_uve_entry_(NULL), prouter_uve_table_(new ProuterUveTable(agent, default_intvl)), @@ -39,12 +39,6 @@ AgentUveBase::AgentUveBase(Agent *agent, uint64_t intvl, bool create_objects, vrouter_stats_collector_(new VrouterStatsCollector( *(agent->event_manager()->io_service()), this)) { - if (create_objects) { - vn_uve_table_.reset(new VnUveTableBase(agent, default_intvl)); - vm_uve_table_.reset(new VmUveTableBase(agent, default_intvl)); - vrouter_uve_entry_.reset(new VrouterUveEntryBase(agent)); - interface_uve_table_.reset(new InterfaceUveTable(agent, default_intvl)); - } singleton_ = this; } diff --git a/src/vnsw/agent/uve/agent_uve_base.h b/src/vnsw/agent/uve/agent_uve_base.h index 25dc0f6a0f6..1711765f9fa 100644 --- a/src/vnsw/agent/uve/agent_uve_base.h +++ b/src/vnsw/agent/uve/agent_uve_base.h @@ -30,7 +30,7 @@ class AgentUveBase { static const uint32_t kIncrementalInterval = (1000); // time in millisecs static const uint64_t kBandwidthInterval = (1000000); // time in microseconds - AgentUveBase(Agent *agent, uint64_t intvl, bool create_object, + AgentUveBase(Agent *agent, uint64_t intvl, uint32_t default_intvl, uint32_t incremental_intvl); virtual ~AgentUveBase(); diff --git a/src/vnsw/agent/uve/agent_uve_stats.cc b/src/vnsw/agent/uve/agent_uve_stats.cc new file mode 100644 index 00000000000..2ac6ddb3556 --- /dev/null +++ b/src/vnsw/agent/uve/agent_uve_stats.cc @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2013 Juniper Networks, Inc. All rights reserved. + */ + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +AgentUveStats::AgentUveStats(Agent *agent, uint64_t intvl, + uint32_t default_intvl, uint32_t incremental_intvl) + : AgentUveBase(agent, intvl, default_intvl, incremental_intvl), + stats_manager_(new StatsManager(agent)) { + vn_uve_table_.reset(new VnUveTable(agent, default_intvl)); + vm_uve_table_.reset(new VmUveTable(agent, default_intvl)); + vrouter_uve_entry_.reset(new VrouterUveEntry(agent)); + interface_uve_table_.reset(new InterfaceUveStatsTable(agent, + default_intvl)); +} + +AgentUveStats::~AgentUveStats() { +} + +StatsManager *AgentUveStats::stats_manager() const { + return stats_manager_.get(); +} + +void AgentUveStats::Shutdown() { + AgentUveBase::Shutdown(); + stats_manager_->Shutdown(); +} + +void AgentUveStats::RegisterDBClients() { + AgentUveBase::RegisterDBClients(); + stats_manager_->RegisterDBClients(); +} + +// The following is deprecated and is present only for backward compatibility +void GetStatsInterval::HandleRequest() const { + StatsIntervalResp_InSeconds *resp = new StatsIntervalResp_InSeconds(); + resp->set_agent_stats_interval(0); + resp->set_flow_stats_interval(0); + resp->set_context(context()); + resp->Response(); + return; +} diff --git a/src/vnsw/agent/uve/agent_uve_stats.h b/src/vnsw/agent/uve/agent_uve_stats.h new file mode 100644 index 00000000000..aabb092feec --- /dev/null +++ b/src/vnsw/agent/uve/agent_uve_stats.h @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2013 Juniper Networks, Inc. All rights reserved. + */ + +#ifndef vnsw_agent_uve_stats_h +#define vnsw_agent_uve_stats_h + +#include +#include + +//The class to drive UVE module initialization for agent +//Defines objects required for statistics collection from vrouter and +//objects required for sending UVE information to collector. +class AgentUveStats : public AgentUveBase { +public: + AgentUveStats(Agent *agent, uint64_t intvl, uint32_t default_intvl, + uint32_t incremental_intvl); + virtual ~AgentUveStats(); + + virtual void Shutdown(); + virtual void RegisterDBClients(); + StatsManager *stats_manager() const; + +protected: + boost::scoped_ptr stats_manager_; + +private: + DISALLOW_COPY_AND_ASSIGN(AgentUveStats); +}; + +#endif //vnsw_agent_uve_stats_h diff --git a/src/vnsw/agent/uve/interface_uve_stats_table.cc b/src/vnsw/agent/uve/interface_uve_stats_table.cc index 51959fe6214..fe5a42007c3 100644 --- a/src/vnsw/agent/uve/interface_uve_stats_table.cc +++ b/src/vnsw/agent/uve/interface_uve_stats_table.cc @@ -4,7 +4,7 @@ #include #include -#include +#include InterfaceUveStatsTable::InterfaceUveStatsTable(Agent *agent, uint32_t default_intvl) @@ -30,7 +30,7 @@ bool InterfaceUveStatsTable::FrameInterfaceStatsMsg(UveInterfaceEntry* entry, entry->SetVnVmInfo(uve); const Interface *intf = static_cast(vm_intf); - AgentUve *agent_uve = static_cast(agent_->uve()); + AgentUveStats *agent_uve = static_cast(agent_->uve()); StatsManager::InterfaceStats *s = agent_uve->stats_manager()->GetInterfaceStats(intf); if (s == NULL) { diff --git a/src/vnsw/agent/uve/test/agent_stats_collector_test.cc b/src/vnsw/agent/uve/test/agent_stats_collector_test.cc index 9a17cf5f3d9..65e6163b335 100644 --- a/src/vnsw/agent/uve/test/agent_stats_collector_test.cc +++ b/src/vnsw/agent/uve/test/agent_stats_collector_test.cc @@ -19,7 +19,7 @@ #include #include #include -#include +#include IoContext *AgentStatsCollectorTest::AllocateIoContext(char* buf, uint32_t buf_len, StatsType type, uint32_t seq) { @@ -99,7 +99,8 @@ void DropStatsIoContextTest::ErrorHandler(int err) { } void AgentStatsCollectorTest::Test_DeleteVrfStatsEntry(int vrf_id) { - AgentUve *uve = static_cast(Agent::GetInstance()->uve()); + AgentUveStats *uve = static_cast + (Agent::GetInstance()->uve()); StatsManager *sm = uve->stats_manager(); StatsManager::VrfIdToVrfStatsTree::iterator it; it = sm->vrf_stats_tree_.find(vrf_id); diff --git a/src/vnsw/agent/uve/test/agent_uve_test.cc b/src/vnsw/agent/uve/test/agent_uve_test.cc index 6c2f5da5886..9ee448d6001 100644 --- a/src/vnsw/agent/uve/test/agent_uve_test.cc +++ b/src/vnsw/agent/uve/test/agent_uve_test.cc @@ -17,7 +17,7 @@ AgentUveBaseTest::AgentUveBaseTest(Agent *agent, uint64_t intvl, uint32_t default_intvl, uint32_t incremental_intvl) - : AgentUve(agent, intvl, default_intvl, incremental_intvl) { + : AgentUveStats(agent, intvl, default_intvl, incremental_intvl) { if (vn_uve_table_) { vn_uve_table_->Shutdown(); } diff --git a/src/vnsw/agent/uve/test/agent_uve_test.h b/src/vnsw/agent/uve/test/agent_uve_test.h index 29051d495f2..f0c07e61231 100644 --- a/src/vnsw/agent/uve/test/agent_uve_test.h +++ b/src/vnsw/agent/uve/test/agent_uve_test.h @@ -5,9 +5,9 @@ #ifndef vnsw_agent_uve_test_h #define vnsw_agent_uve_test_h -#include +#include -class AgentUveBaseTest : public AgentUve { +class AgentUveBaseTest : public AgentUveStats { public: AgentUveBaseTest(Agent *agent, uint64_t intvl, uint32_t default_intvl, uint32_t incremental_intvl); diff --git a/src/vnsw/agent/uve/test/test_prouter_uve.cc b/src/vnsw/agent/uve/test/test_prouter_uve.cc index c806c164b23..11850f3d0ab 100644 --- a/src/vnsw/agent/uve/test/test_prouter_uve.cc +++ b/src/vnsw/agent/uve/test/test_prouter_uve.cc @@ -89,7 +89,7 @@ class UveProuterUveTest : public ::testing::Test { }; TEST_F(UveProuterUveTest, ProuterAddDel_1) { - AgentUve *u = static_cast(Agent::GetInstance()->uve()); + AgentUveStats *u = static_cast(Agent::GetInstance()->uve()); ProuterUveTableTest *pr = static_cast (u->prouter_uve_table()); pr->ClearCount(); @@ -125,7 +125,7 @@ TEST_F(UveProuterUveTest, ProuterAddDel_1) { //Verify that no Prouter UVEs are sent when physical interfaces added/removed. //(when physical interfaces are not associated with physical devices) TEST_F(UveProuterUveTest, PhysicalInterfaceAddDel_1) { - AgentUve *u = static_cast(Agent::GetInstance()->uve()); + AgentUveStats *u = static_cast(Agent::GetInstance()->uve()); ProuterUveTableTest *pr = static_cast (u->prouter_uve_table()); pr->ClearCount(); @@ -151,7 +151,7 @@ TEST_F(UveProuterUveTest, PhysicalInterfaceAddDel_1) { } TEST_F(UveProuterUveTest, PhysicalInterfaceAddDel_2) { - AgentUve *u = static_cast(Agent::GetInstance()->uve()); + AgentUveStats *u = static_cast(Agent::GetInstance()->uve()); ProuterUveTableTest *pr = static_cast (u->prouter_uve_table()); pr->ClearCount(); @@ -203,7 +203,7 @@ TEST_F(UveProuterUveTest, PhysicalInterfaceAddDel_2) { //Verify PhysicalInterface UVE is send on PhysicalInterface Add/del TEST_F(UveProuterUveTest, PhysicalInterfaceAddDel_3) { - AgentUve *u = static_cast(Agent::GetInstance()->uve()); + AgentUveStats *u = static_cast(Agent::GetInstance()->uve()); ProuterUveTableTest *pr = static_cast (u->prouter_uve_table()); pr->ClearCount(); @@ -232,7 +232,7 @@ TEST_F(UveProuterUveTest, PhysicalInterfaceAddDel_3) { //Verify that no UVEs are sent when logical interfaces added/removed. //(when logical interfaces are not associated with physical interfaces) TEST_F(UveProuterUveTest, LogicalInterfaceAddDel_1) { - AgentUve *u = static_cast(Agent::GetInstance()->uve()); + AgentUveStats *u = static_cast(Agent::GetInstance()->uve()); ProuterUveTableTest *pr = static_cast (u->prouter_uve_table()); pr->ClearCount(); @@ -263,7 +263,7 @@ TEST_F(UveProuterUveTest, LogicalInterfaceAddDel_1) { } TEST_F(UveProuterUveTest, LogicalInterfaceAddDel_2) { - AgentUve *u = static_cast(Agent::GetInstance()->uve()); + AgentUveStats *u = static_cast(Agent::GetInstance()->uve()); ProuterUveTableTest *pr = static_cast (u->prouter_uve_table()); pr->ClearCount(); @@ -327,7 +327,7 @@ TEST_F(UveProuterUveTest, LogicalInterfaceAddDel_2) { } TEST_F(UveProuterUveTest, LogicalInterfaceAddDel_3) { - AgentUve *u = static_cast(Agent::GetInstance()->uve()); + AgentUveStats *u = static_cast(Agent::GetInstance()->uve()); ProuterUveTableTest *pr = static_cast (u->prouter_uve_table()); pr->ClearCount(); @@ -398,7 +398,7 @@ TEST_F(UveProuterUveTest, LogicalInterfaceAddDel_3) { //Associate logical interface with prouter (instead of physical-interface) TEST_F(UveProuterUveTest, LogicalInterfaceAddDel_4) { - AgentUve *u = static_cast(Agent::GetInstance()->uve()); + AgentUveStats *u = static_cast(Agent::GetInstance()->uve()); ProuterUveTableTest *pr = static_cast (u->prouter_uve_table()); pr->ClearCount(); @@ -458,7 +458,7 @@ TEST_F(UveProuterUveTest, LogicalInterfaceAddDel_4) { //Associate logical interface with prouter. Verify change of prouter for a //logical-interface from one prouter to another. TEST_F(UveProuterUveTest, LogicalInterfaceAddDel_5) { - AgentUve *u = static_cast(Agent::GetInstance()->uve()); + AgentUveStats *u = static_cast(Agent::GetInstance()->uve()); ProuterUveTableTest *pr = static_cast (u->prouter_uve_table()); pr->ClearCount(); @@ -529,7 +529,7 @@ TEST_F(UveProuterUveTest, LogicalInterfaceAddDel_5) { } TEST_F(UveProuterUveTest, LogicalInterfaceAddDel_6) { - AgentUve *u = static_cast(Agent::GetInstance()->uve()); + AgentUveStats *u = static_cast(Agent::GetInstance()->uve()); ProuterUveTableTest *pr = static_cast (u->prouter_uve_table()); pr->ClearCount(); @@ -557,7 +557,7 @@ TEST_F(UveProuterUveTest, LogicalInterfaceAddDel_6) { //Delete PhysicalDevice before deleting logical interface TEST_F(UveProuterUveTest, PhysicalDeviceDel_1) { - AgentUve *u = static_cast(Agent::GetInstance()->uve()); + AgentUveStats *u = static_cast(Agent::GetInstance()->uve()); ProuterUveTableTest *pr = static_cast (u->prouter_uve_table()); pr->ClearCount(); @@ -623,7 +623,7 @@ TEST_F(UveProuterUveTest, PhysicalDeviceDel_1) { //Delete PhysicalDevice and associate Physical interface with different //PhysicalDevice TEST_F(UveProuterUveTest, PhysicalDeviceDel_2) { - AgentUve *u = static_cast(Agent::GetInstance()->uve()); + AgentUveStats *u = static_cast(Agent::GetInstance()->uve()); ProuterUveTableTest *pr = static_cast (u->prouter_uve_table()); pr->ClearCount(); @@ -702,7 +702,7 @@ TEST_F(UveProuterUveTest, PhysicalDeviceDel_2) { } TEST_F(UveProuterUveTest, VMI_Logical_Assoc_1) { - AgentUve *u = static_cast(Agent::GetInstance()->uve()); + AgentUveStats *u = static_cast(Agent::GetInstance()->uve()); ProuterUveTableTest *pr = static_cast (u->prouter_uve_table()); struct PortInfo input[] = { @@ -737,7 +737,7 @@ TEST_F(UveProuterUveTest, VMI_Logical_Assoc_1) { } TEST_F(UveProuterUveTest, VMIAddDel_1) { - AgentUve *u = static_cast(Agent::GetInstance()->uve()); + AgentUveStats *u = static_cast(Agent::GetInstance()->uve()); ProuterUveTableTest *pr = static_cast (u->prouter_uve_table()); pr->ClearCount(); @@ -799,7 +799,7 @@ TEST_F(UveProuterUveTest, VMIAddDel_1) { } TEST_F(UveProuterUveTest, VMIAddDel_2) { - AgentUve *u = static_cast(Agent::GetInstance()->uve()); + AgentUveStats *u = static_cast(Agent::GetInstance()->uve()); ProuterUveTableTest *pr = static_cast (u->prouter_uve_table()); pr->ClearCount(); @@ -874,7 +874,7 @@ TEST_F(UveProuterUveTest, VMIAddDel_2) { } TEST_F(UveProuterUveTest, VMIAddDel_3) { - AgentUve *u = static_cast(Agent::GetInstance()->uve()); + AgentUveStats *u = static_cast(Agent::GetInstance()->uve()); ProuterUveTableTest *pr = static_cast (u->prouter_uve_table()); pr->ClearCount(); @@ -956,7 +956,7 @@ TEST_F(UveProuterUveTest, VMIAddDel_3) { } TEST_F(UveProuterUveTest, VMIAddDel_4) { - AgentUve *u = static_cast(Agent::GetInstance()->uve()); + AgentUveStats *u = static_cast(Agent::GetInstance()->uve()); ProuterUveTableTest *pr = static_cast (u->prouter_uve_table()); pr->ClearCount(); diff --git a/src/vnsw/agent/uve/test/test_uve.cc b/src/vnsw/agent/uve/test/test_uve.cc index b8c52b1ed3a..d0eb4001834 100644 --- a/src/vnsw/agent/uve/test/test_uve.cc +++ b/src/vnsw/agent/uve/test/test_uve.cc @@ -544,7 +544,7 @@ TEST_F(UveTest, SandeshTest) { /* Discovery IP and service IPs are not configured */ TEST_F(UveTest, NodeStatus_ExpectedConnections_0) { Agent *agent = Agent::GetInstance(); - AgentUve *uve = static_cast(agent->uve()); + AgentUveStats *uve = static_cast(agent->uve()); uint8_t num_c_nodes, num_d_servers; int expected_conns = uve->ExpectedConnections(num_c_nodes, num_d_servers); @@ -555,7 +555,7 @@ TEST_F(UveTest, NodeStatus_ExpectedConnections_0) { TEST_F(UveTest, NodeStatus_ExpectedConnections_1) { Agent *agent = Agent::GetInstance(); AgentParamTest params(agent->params()); - AgentUve *uve = static_cast(agent->uve()); + AgentUveStats *uve = static_cast(agent->uve()); params.set_discovery_server("0.0.0.0"); params.set_xmpp_server_1("1.1.1.1"); params.set_xmpp_server_2("1.1.1.2"); @@ -573,7 +573,7 @@ TEST_F(UveTest, NodeStatus_ExpectedConnections_1) { TEST_F(UveTest, NodeStatus_ExpectedConnections_2) { Agent *agent = Agent::GetInstance(); AgentParamTest params(agent->params()); - AgentUve *uve = static_cast(agent->uve()); + AgentUveStats *uve = static_cast(agent->uve()); params.set_discovery_server("1.1.1.1"); params.set_xmpp_server_1("0.0.0.0"); params.set_xmpp_server_2("0.0.0.0"); @@ -591,7 +591,7 @@ TEST_F(UveTest, NodeStatus_ExpectedConnections_2) { TEST_F(UveTest, NodeStatus_ExpectedConnections_3) { Agent *agent = Agent::GetInstance(); AgentParamTest params(agent->params()); - AgentUve *uve = static_cast(agent->uve()); + AgentUveStats *uve = static_cast(agent->uve()); params.set_discovery_server("1.1.1.1"); params.set_xmpp_server_1("1.1.1.1"); params.set_xmpp_server_2("1.1.1.2"); diff --git a/src/vnsw/agent/uve/test/test_uve_util.h b/src/vnsw/agent/uve/test/test_uve_util.h index 1bee4f837a4..d135c4ef782 100644 --- a/src/vnsw/agent/uve/test/test_uve_util.h +++ b/src/vnsw/agent/uve/test/test_uve_util.h @@ -4,6 +4,8 @@ #ifndef __test_uve_util__ #define __test_uve_util__ +#include "uve/agent_uve_stats.h" + class AgentStatsCollectorTask : public Task { public: AgentStatsCollectorTask(int count) : @@ -39,7 +41,8 @@ class VRouterStatsCollectorTask : public Task { count_(count) { } virtual bool Run() { - AgentUve *uve = static_cast(Agent::GetInstance()->uve()); + AgentUveStats *uve = static_cast + (Agent::GetInstance()->uve()); for (int i = 0; i < count_; i++) uve->vrouter_stats_collector()->Run(); return true; diff --git a/src/vnsw/agent/uve/test/test_vrouter_uve.cc b/src/vnsw/agent/uve/test/test_vrouter_uve.cc index 1b772310a01..0bfeda034c9 100644 --- a/src/vnsw/agent/uve/test/test_vrouter_uve.cc +++ b/src/vnsw/agent/uve/test/test_vrouter_uve.cc @@ -390,7 +390,7 @@ TEST_F(UveVrouterUveTest, ComputeCpuState_1) { TEST_F(UveVrouterUveTest, DropStatsAddChange) { Agent *agent = Agent::GetInstance(); - AgentUve *u = static_cast(Agent::GetInstance()->uve()); + AgentUveStats *u = static_cast(Agent::GetInstance()->uve()); StatsManager *sm = u->stats_manager(); VrouterUveEntryTest *vr = static_cast (Agent::GetInstance()->uve()->vrouter_uve_entry()); @@ -464,7 +464,7 @@ TEST_F(UveVrouterUveTest, DropStatsAddChange) { TEST_F(UveVrouterUveTest, BandwidthTest_1) { Agent *agent = Agent::GetInstance(); - AgentUve *u = static_cast(Agent::GetInstance()->uve()); + AgentUveStats *u = static_cast(Agent::GetInstance()->uve()); StatsManager *sm = u->stats_manager(); VrouterUveEntryTest *vr = static_cast (Agent::GetInstance()->uve()->vrouter_uve_entry()); @@ -533,7 +533,7 @@ TEST_F(UveVrouterUveTest, BandwidthTest_1) { TEST_F(UveVrouterUveTest, BandwidthTest_2) { Agent *agent = Agent::GetInstance(); - AgentUve *u = static_cast(Agent::GetInstance()->uve()); + AgentUveStats *u = static_cast(Agent::GetInstance()->uve()); VrouterUveEntryTest *vr = static_cast (Agent::GetInstance()->uve()->vrouter_uve_entry()); vr->clear_count(); @@ -633,7 +633,7 @@ TEST_F(UveVrouterUveTest, BandwidthTest_2) { TEST_F(UveVrouterUveTest, BandwidthTest_3) { Agent *agent = Agent::GetInstance(); - AgentUve *u = static_cast(Agent::GetInstance()->uve()); + AgentUveStats *u = static_cast(Agent::GetInstance()->uve()); StatsManager *sm = u->stats_manager(); VrouterUveEntryTest *vr = static_cast (Agent::GetInstance()->uve()->vrouter_uve_entry()); @@ -732,7 +732,7 @@ TEST_F(UveVrouterUveTest, BandwidthTest_3) { } TEST_F(UveVrouterUveTest, ExceptionPktsChange) { - AgentUve *u = static_cast(Agent::GetInstance()->uve()); + AgentUveStats *u = static_cast(Agent::GetInstance()->uve()); VrouterUveEntryTest *vr = static_cast (Agent::GetInstance()->uve()->vrouter_uve_entry()); vr->clear_count(); @@ -772,7 +772,7 @@ TEST_F(UveVrouterUveTest, ExceptionPktsChange) { //Flow creation using IP and TCP packets TEST_F(UveVrouterUveTest, Bitmap_1) { - AgentUve *u = static_cast(Agent::GetInstance()->uve()); + AgentUveStats *u = static_cast(Agent::GetInstance()->uve()); VrouterUveEntryTest *vr = static_cast (Agent::GetInstance()->uve()->vrouter_uve_entry()); vr->clear_count(); @@ -860,7 +860,7 @@ TEST_F(UveVrouterUveTest, Bitmap_1) { /* Verifies agent configuration sent via vrouter UVE. */ TEST_F(UveVrouterUveTest, config_1) { - AgentUve *u = static_cast(Agent::GetInstance()->uve()); + AgentUveStats *u = static_cast(Agent::GetInstance()->uve()); VrouterUveEntryTest *vr = static_cast (Agent::GetInstance()->uve()->vrouter_uve_entry()); vr->clear_count(); diff --git a/src/vnsw/agent/uve/vn_uve_entry.cc b/src/vnsw/agent/uve/vn_uve_entry.cc index f8905430318..a19140aec19 100644 --- a/src/vnsw/agent/uve/vn_uve_entry.cc +++ b/src/vnsw/agent/uve/vn_uve_entry.cc @@ -3,7 +3,7 @@ */ #include -#include +#include VnUveEntry::VnUveEntry(Agent *agent, const VnEntry *vn) : VnUveEntryBase(agent, vn), port_bitmap_(), inter_vn_stats_(), mutex_(), @@ -264,7 +264,7 @@ bool VnUveEntry::FillVrfStats(int vrf_id, UveVirtualNetworkAgent &s_vn) { UveVrfStats vrf_stats; vector vlist; - AgentUve *uve = static_cast(agent_->uve()); + AgentUveStats *uve = static_cast(agent_->uve()); StatsManager::VrfStats *s = uve->stats_manager()->GetVrfStats(vrf_id); if (s != NULL) { vrf_stats.set_name(s->name); diff --git a/src/vnsw/agent/uve/vn_uve_table.cc b/src/vnsw/agent/uve/vn_uve_table.cc index 997353e07be..4ff86f67b75 100644 --- a/src/vnsw/agent/uve/vn_uve_table.cc +++ b/src/vnsw/agent/uve/vn_uve_table.cc @@ -2,7 +2,7 @@ * Copyright (c) 2013 Juniper Networks, Inc. All rights reserved. */ -#include +#include #include #include @@ -37,7 +37,7 @@ bool VnUveTable::SendUnresolvedVnMsg(const string &vn_name, changed = entry->PopulateInterVnStats(uve); - AgentUve *u = static_cast(agent_->uve()); + AgentUveStats *u = static_cast(agent_->uve()); StatsManager *stats = u->stats_manager(); /* Send Nameless VrfStats as part of Unknown VN */ if (vn_name.compare(FlowHandler::UnknownVn()) == 0) { diff --git a/src/vnsw/agent/uve/vrouter_uve_entry.cc b/src/vnsw/agent/uve/vrouter_uve_entry.cc index fad670f0ec2..550bb8e3023 100644 --- a/src/vnsw/agent/uve/vrouter_uve_entry.cc +++ b/src/vnsw/agent/uve/vrouter_uve_entry.cc @@ -13,7 +13,7 @@ #include #include #include -#include +#include #include #include #include @@ -182,7 +182,7 @@ bool VrouterUveEntry::SendVrouterMsg() { InetInterfaceKey key(agent_->vhost_interface_name()); const Interface *vhost = static_cast (agent_->interface_table()->FindActiveEntry(&key)); - AgentUve *uve = static_cast(agent_->uve()); + AgentUveStats *uve = static_cast(agent_->uve()); const StatsManager::InterfaceStats *s = uve->stats_manager()->GetInterfaceStats(vhost); if (s != NULL) { @@ -281,7 +281,7 @@ bool VrouterUveEntry::BuildPhysicalInterfaceList(vector &list) PhysicalInterfaceSet::const_iterator it = phy_intf_set_.begin(); while (it != phy_intf_set_.end()) { const Interface *intf = *it; - AgentUve *uve = static_cast(agent_->uve()); + AgentUveStats *uve = static_cast(agent_->uve()); StatsManager::InterfaceStats *s = uve->stats_manager()->GetInterfaceStats(intf); if (s == NULL) { @@ -310,7 +310,7 @@ bool VrouterUveEntry::BuildPhysicalInterfaceBandwidth PhysicalInterfaceSet::const_iterator it = phy_intf_set_.begin(); while (it != phy_intf_set_.end()) { const Interface *intf = *it; - AgentUve *uve = static_cast(agent_->uve()); + AgentUveStats *uve = static_cast(agent_->uve()); StatsManager::InterfaceStats *s = uve->stats_manager()->GetInterfaceStats(intf); if (s == NULL) { @@ -333,7 +333,7 @@ void VrouterUveEntry::InitPrevStats() const { PhysicalInterfaceSet::const_iterator it = phy_intf_set_.begin(); while (it != phy_intf_set_.end()) { const Interface *intf = *it; - AgentUve *uve = static_cast(agent_->uve()); + AgentUveStats *uve = static_cast(agent_->uve()); StatsManager::InterfaceStats *s = uve->stats_manager()->GetInterfaceStats(intf); if (s == NULL) { @@ -350,7 +350,7 @@ void VrouterUveEntry::InitPrevStats() const { } void VrouterUveEntry::FetchDropStats(AgentDropStats &ds) const { - AgentUve *uve = static_cast(agent_->uve()); + AgentUveStats *uve = static_cast(agent_->uve()); ds = uve->stats_manager()->drop_stats(); } diff --git a/src/vnsw/agent/vrouter/stats_collector/agent_stats_sandesh_context.cc b/src/vnsw/agent/vrouter/stats_collector/agent_stats_sandesh_context.cc index 89e9d6d53a4..b4486b4b751 100644 --- a/src/vnsw/agent/vrouter/stats_collector/agent_stats_sandesh_context.cc +++ b/src/vnsw/agent/vrouter/stats_collector/agent_stats_sandesh_context.cc @@ -4,7 +4,7 @@ #include -#include +#include #include #include #include @@ -13,7 +13,7 @@ AgentStatsSandeshContext::AgentStatsSandeshContext(Agent *agent) : agent_(agent), marker_id_(-1) { - AgentUve *uve = static_cast(agent_->uve()); + AgentUveStats *uve = static_cast(agent_->uve()); stats_ = uve->stats_manager(); } diff --git a/src/vnsw/agent/vxlan_agent/linux/linux_vxlan_agent_init.cc b/src/vnsw/agent/vxlan_agent/linux/linux_vxlan_agent_init.cc index 1aa086d4b7e..6b295953794 100644 --- a/src/vnsw/agent/vxlan_agent/linux/linux_vxlan_agent_init.cc +++ b/src/vnsw/agent/vxlan_agent/linux/linux_vxlan_agent_init.cc @@ -29,7 +29,7 @@ #include #include -#include +#include #include #include @@ -69,9 +69,9 @@ void LinuxVxlanAgentInit::FactoryInit() { void LinuxVxlanAgentInit::CreateModules() { ksync_vxlan_.reset(new KSyncLinuxVxlan(agent())); - uve_.reset(new AgentUveBase(agent(), AgentUveBase::kBandwidthInterval, true, - AgentUveBase::kDefaultInterval, - AgentUveBase::kIncrementalInterval)); + uve_.reset(new AgentUve(agent(), AgentUveBase::kBandwidthInterval, + AgentUveBase::kDefaultInterval, + AgentUveBase::kIncrementalInterval)); agent()->set_uve(uve_.get()); }