Line data Source code
1 : /* 2 : * Copyright (c) 2013 Juniper Networks, Inc. All rights reserved. 3 : * Copyright Contributors to the OpenSDN project 4 : */ 5 : 6 : #ifndef vnsw_agent_vrouter_uve_entry_h 7 : #define vnsw_agent_vrouter_uve_entry_h 8 : 9 : #include <uve/vrouter_uve_entry_base.h> 10 : #include <uve/agent_uve_stats.h> 11 : 12 : //The class that defines data-structures to store VRouter information 13 : //required for sending VRouter UVE. 14 : class VrouterUveEntry : public VrouterUveEntryBase { 15 : public: 16 : typedef std::map<std::string, RouteTableSize> RouteTableSizeMap; 17 : typedef std::pair<std::string, RouteTableSize> RouteTableSizePair; 18 : typedef boost::shared_ptr<RouteTableSizeMap> RouteTableSizeMapPtr; 19 : 20 : VrouterUveEntry(Agent *agent); 21 : virtual ~VrouterUveEntry(); 22 17 : L4PortBitmap port_bitmap() { return port_bitmap_; } 23 : 24 : virtual bool SendVrouterMsg(); 25 : void SendVrouterControlStats(); 26 : void UpdateBitmap(uint8_t proto, uint16_t sport, uint16_t dport); 27 : 28 : protected: 29 : uint8_t bandwidth_count_; 30 : L4PortBitmap port_bitmap_; 31 : FlowRateComputeInfo flow_info_; 32 : private: 33 : void DispatchVrouterControlStats(const VrouterControlStats &uve) const; 34 : void InitPrevStats() const; 35 : void FetchDropStats(AgentDropStats &ds) const; 36 : bool SetVrouterPortBitmap(VrouterStatsAgent &vr_stats); 37 : uint64_t CalculateBandwitdh(uint64_t bytes, int speed_mbps, 38 : int diff_seconds, double *utilization_bps) const; 39 : uint64_t GetBandwidthUsage(StatsManager::InterfaceStats *s, 40 : bool dir_in, int mins, double *util) const; 41 : bool BuildPhysicalInterfaceBandwidth(std::vector<AgentIfBandwidth> &list, 42 : uint8_t mins) const; 43 : bool BuildPhysicalInterfaceBandwidth(map<string,uint64_t> &imp, 44 : map<string,uint64_t> &omp, 45 : uint8_t mins, double &in_util, 46 : double &out_util) const; 47 : bool BuildPhysicalInterfaceList(std::map<std::string, PhyIfStats> &list, 48 : std::map<std::string, PhyIfInfo> &info, 49 : std::map<std::string, AgentDropStats> &dsmap) const; 50 : std::string GetMacAddress(const MacAddress &mac) const; 51 : void BuildXmppStatsList(std::map<std::string, AgentXmppStats> *stats) const; 52 : void FetchIFMapStats(AgentUve::DerivedStatsMap *ds) const; 53 : void VrfWalkDone(DBTableBase *base, RouteTableSizeMapPtr list); 54 : bool AppendVrf(DBTablePartBase *part, DBEntryBase *entry, 55 : RouteTableSizeMapPtr list); 56 : bool StartVrfWalk(); 57 : void BuildAndSendVrouterControlStats(RouteTableSizeMapPtr list); 58 : 59 : uint64_t start_time_; 60 : DBTableWalker::WalkId vrf_walk_id_; 61 : DISALLOW_COPY_AND_ASSIGN(VrouterUveEntry); 62 : }; 63 : 64 : #endif // vnsw_agent_vrouter_uve_entry_h