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