5 #ifndef vnsw_agent_flow_stats_collector_h
6 #define vnsw_agent_flow_stats_collector_h
8 #include <boost/static_assert.hpp>
15 #include <sandesh/common/flow_types.h>
21 class AgentUtXmlFlowThreshold;
22 class AgentUtXmlFlowThresholdValidate;
23 class FlowStatsRecordsReq;
24 class FetchFlowStatsRecord;
98 uint32_t flow_cache_timeout,
122 uint32_t
ProcessFlow(FlowExportInfoList::iterator &it,
126 const vr_flow_stats &k_stats,
const KFlowData &kinfo,
129 uint16_t k_flow_flags, uint32_t flow_handle, uint16_t gen_id,
142 uint32_t packets, uint32_t oflow_bytes,
151 static uint64_t
GetFlowStats(
const uint16_t &oflow_data,
const uint32_t &data);
179 uint32_t packets, uint32_t oflow_bytes,
184 uint16_t oflow_bytes,
191 uint16_t oflow_bytes,
198 uint32_t flow_handle, uint16_t gen_id);
202 uint64_t bytes, uint64_t pkts);
204 uint64_t bytes, uint64_t pkts);
206 const vr_flow_stats &k_stats, uint64_t curr_time);
208 uint64_t k_flow_pkts);
210 uint64_t k_flow_bytes);
221 FlowEntryTree::iterator &tree_it);
223 uint32_t packets, uint32_t oflow_bytes);
294 #endif //vnsw_agent_flow_stats_collector_h
static const int kMaxCollectors
uint64_t GetFlowAgeTime() const
VmInterfaceKey ReverseFlowFipVmi(const FlowExportInfo *info)
uint64_t ageing_task_starts_
static uint64_t GetFlowStats(const uint16_t &oflow_data, const uint32_t &data)
boost::shared_ptr< FlowStatsCollector > FlowStatsCollectorPtr
FlowStatsCollector * FlowToCollector(const FlowEntry *flow)
FlowStatsCollectorPtr collectors[kMaxCollectors]
DISALLOW_COPY_AND_ASSIGN(FlowStatsCollector)
void EvictedFlowStatsUpdate(const FlowEntryPtr &flow, uint32_t bytes, uint32_t packets, uint32_t oflow_bytes, const boost::uuids::uuid &u)
void UpdateStatsEvent(const FlowEntryPtr &flow, uint32_t bytes, uint32_t packets, uint32_t oflow_bytes, const boost::uuids::uuid &u)
void DeleteEvent(const FlowEntryPtr &flow, const RevFlowDepParams ¶ms)
void UpdateFlowStatsInternal(FlowExportInfo *info, uint32_t bytes, uint16_t oflow_bytes, uint32_t pkts, uint16_t oflow_pkts, uint64_t time, bool teardown_time)
AgeingTask * ageing_task_
uint32_t ProcessFlow(FlowExportInfoList::iterator &it, KSyncFlowMemory *ksync_obj, FlowExportInfo *info, uint64_t curr_time)
void AddEvent(const FlowEntryPtr &flow)
FlowAgingTableKey flow_aging_key_
boost::intrusive::list< FlowExportInfo > FlowExportInfoList
static const uint32_t kFlowsPerTask
bool AgeFlow(KSyncFlowMemory *ksync_obj, const vr_flow_entry *k_flow, const vr_flow_stats &k_stats, const KFlowData &kinfo, FlowExportInfo *info, uint64_t curr_time)
AgeingTask(FlowStatsCollector *fsc)
void set_flow_age_time_intvl(uint64_t interval)
const Queue * queue() const
void UpdateFlowStats(FlowExportInfo *info, uint64_t teardown_time)
uint32_t RunAgeing(uint32_t max_count)
boost::uuids::random_generator rand_gen_
uint64_t flow_age_time_intvl()
bool ShouldBeAged(FlowExportInfo *info, const vr_flow_entry *k_flow, const vr_flow_stats &k_stats, uint64_t curr_time)
bool RequestHandlerEntry()
std::map< const FlowEntry *, FlowExportInfo > FlowEntryTree
friend class FlowStatsRecordsReq
void UpdateFlowStatsInternalLocked(FlowExportInfo *info, uint32_t bytes, uint16_t oflow_bytes, uint32_t pkts, uint16_t oflow_pkts, uint64_t time, bool teardown_time)
void UpdateInterVnStats(FlowExportInfo *info, uint64_t bytes, uint64_t pkts)
const FlowEntry * flow_iteration_key_
FlowStatsCollector * GetCollector(uint8_t idx) const
FlowStatsCollectorObject(Agent *agent, FlowStatsCollectorReq *req, FlowStatsManager *mgr)
void UpdateFlowAgeTimeInSecs(uint32_t secs)
bool EvictFlow(KSyncFlowMemory *ksync_obj, const vr_flow_entry *k_flow, uint16_t k_flow_flags, uint32_t flow_handle, uint16_t gen_id, FlowExportInfo *info, uint64_t curr_time)
uint32_t instance_id() const
uint64_t GetUpdatedFlowBytes(const FlowExportInfo *stats, uint64_t k_flow_bytes)
void UpdateFloatingIpStats(const FlowExportInfo *flow, uint64_t bytes, uint64_t pkts)
void NewFlow(FlowEntry *flow)
FlowStatsCollector(boost::asio::io_context &io, int intvl, uint32_t flow_cache_timeout, AgentUveBase *uve, uint32_t instance_id, FlowAgingTableKey *key, FlowStatsManager *aging_module, FlowStatsCollectorObject *obj)
void UpdateThreshold(uint32_t new_value)
uint64_t flow_age_time_intvl_
void UpdateAgeTimeInSeconds(uint32_t age_time)
std::string Description() const
friend class FetchFlowStatsRecord
void HandleFlowStatsUpdate(const FlowKey &key, uint32_t bytes, uint32_t packets, uint32_t oflow_bytes)
void set_deleted(bool val)
virtual ~FlowStatsCollector()
static const uint64_t FlowTcpSynAgeTime
void set_flow_tcp_syn_age_time(uint64_t interval)
DISALLOW_COPY_AND_ASSIGN(FlowStatsCollectorObject)
int GetExpiryTime() const
void UpdateEntriesToVisit()
WorkQueue< boost::shared_ptr< FlowExportReq > > Queue
bool RequestHandler(boost::shared_ptr< FlowExportReq > req)
static const uint32_t kFlowStatsTimerInterval
size_t AgeTreeSize() const
void SetFlowAgeTime(uint64_t value)
static const uint32_t kDefaultFlowSamplingThreshold
boost::uuids::uuid rand_gen()
InterfaceUveTable::FloatingIp * ReverseFlowFipEntry(const FlowExportInfo *flow)
FlowExportInfoList flow_export_info_list_
void DeleteFlow(FlowEntryTree::iterator &it)
static const uint32_t kFlowScanTime
uint64_t flow_tcp_syn_age_time() const
FlowStatsCollectorObject * parent_
bool Run()
Code to execute. Returns true if task is completed. Return false to reschedule the task...
AgentUveBase * agent_uve_
uint32_t flow_age_time_intvl_in_secs() const
void UpdateVmiTagBasedStats(FlowExportInfo *info, uint64_t bytes, uint64_t pkts)
void AddFlow(FlowExportInfo info)
static const uint32_t kMinFlowsPerTimer
void UpdateFlowIterationKey(const FlowEntry *del_flow, FlowEntryTree::iterator &tree_it)
static const uint8_t kMaxFlowMsgsPerSend
void FlowDeleteEnqueue(FlowExportInfo *info, uint64_t t)
FlowStatsCollector * fsc_
static const uint64_t kFlowDeleteRetryTime
tbb::atomic< bool > deleted_
void RequestHandlerExit(bool done)
static const uint64_t FlowAgeTime
uint16_t underlay_src_port
void UpdateFlowAgeTime(uint64_t usecs)
uint32_t timers_per_scan_
friend class AgentUtXmlFlowThreshold
void SetExpiryTime(int time)
Task is a wrapper over tbb::task to support policies.
uint32_t ReverseFlowFip(const FlowExportInfo *info)
static uint64_t GetCurrentTime()
uint32_t entries_to_visit_
uint64_t GetUpdatedFlowPackets(const FlowExportInfo *stats, uint64_t k_flow_pkts)
const FlowAgingTableKey & flow_aging_key() const
friend class AgentUtXmlFlowThresholdValidate
bool FindFlowExportInfo(const FlowEntry *fe, FlowEntryTree::iterator &it)
FlowStatsManager * flow_stats_manager_
uint64_t flow_tcp_syn_age_time_
uint32_t GetAgeTimeInSeconds() const
boost::intrusive_ptr< FlowEntry > FlowEntryPtr
void FlowEvictEnqueue(FlowExportInfo *info, uint64_t t, uint32_t flow_handle, uint16_t gen_id)