OpenSDN source code
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
vrouter_uve_entry_base.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
3  */
4 
5 #ifndef vnsw_agent_vrouter_uve_entry_base_h
6 #define vnsw_agent_vrouter_uve_entry_base_h
7 
8 #include <string>
9 #include <vector>
10 #include <set>
11 #include <sys/types.h>
12 #include <net/ethernet.h>
13 #include <vrouter_types.h>
14 #include <uve/l4_port_bitmap.h>
15 #include <pkt/flow_proto.h>
16 #include <cmn/agent_cmn.h>
17 #include <vgw/cfg_vgw.h>
18 
19 //The class that defines data-structures to store VRouter information
20 //required for sending VRouter UVE.
22 public:
24  VrouterUveInterfaceState(bool active) :
25  vmport_active_(active) {}
28  };
31  bool master_;
32  };
33 
34  // The below const values are dependent on value of
35  // VrouterStatsCollector::VrouterStatsInterval
36  static const uint8_t bandwidth_mod_1min = 2;
37  static const uint8_t bandwidth_mod_5min = 10;
38  typedef std::set<const Interface *> PhysicalInterfaceSet;
39  typedef boost::shared_ptr<std::vector<std::string> > StringVectorPtr;
40 
41  VrouterUveEntryBase(Agent *agent);
42  virtual ~VrouterUveEntryBase();
43 
44  void RegisterDBClients();
45  void Shutdown();
46 
48  void VmWalkDone(DBTableBase *base, StringVectorPtr list);
50  void VnWalkDone(DBTableBase *base, StringVectorPtr list);
51  bool AppendInterface(DBTablePartBase *part, DBEntryBase *entry,
52  StringVectorPtr intf_list, StringVectorPtr err_list,
53  StringVectorPtr nova_if_list,
54  StringVectorPtr unmanaged_list);
56  StringVectorPtr err_if_l,
57  StringVectorPtr nova_if_l,
58  StringVectorPtr unmanaged_list);
59  virtual bool SendVrouterMsg();
60  void SendVrouterProuterAssociation(const std::vector<std::string> &list);
61  bool TimerExpiry();
62 protected:
65  VrouterStatsAgent prev_stats_;
66  VrouterAgent prev_vrouter_;
74 
75  //The following Dispatch functions are not made const function because
76  //in derived class they need to be non-const
77  virtual void DispatchVrouterStatsMsg(const VrouterStatsAgent &uve);
78  virtual void DispatchComputeCpuStateMsg(const ComputeCpuState &ccs);
79 private:
80  //The following Dispatch functions are not made const function because
81  //in derived class they need to be non-const
82  virtual void DispatchVrouterMsg(const VrouterAgent &uve);
83  void BuildAndSendComputeCpuStateMsg(const CpuLoadInfo &info);
85  void InterfaceNotify(DBTablePartBase *partition, DBEntryBase *e);
86  void VmNotify(DBTablePartBase *partition, DBEntryBase *e);
87  void VnNotify(DBTablePartBase *partition, DBEntryBase *e);
88  bool StartVnWalk();
89  bool StartVmWalk();
90  bool StartInterfaceWalk();
91  void StartTimer();
92  bool Run();
93  std::string GetMacAddress(const MacAddress &mac) const;
95  std::vector<std::string> &l2);
96  void BuildAgentConfig(VrouterAgent &vrouter_agent);
97  void AppendInterfaceInternal(const VmInterface *port,
98  StringVectorPtr intf_list, StringVectorPtr err_if_list);
101 
108 };
109 
110 #endif // vnsw_agent_vrouter_uve_entry_base_h
std::string GetMacAddress(const MacAddress &mac) const
void InterfaceWalkDone(DBTableBase *base, StringVectorPtr if_l, StringVectorPtr err_if_l, StringVectorPtr nova_if_l, StringVectorPtr unmanaged_list)
static const uint8_t bandwidth_mod_1min
virtual void DispatchComputeCpuStateMsg(const ComputeCpuState &ccs)
DBTable::DBTableWalkRef vm_walk_ref_
VrouterStatsAgent prev_stats_
void PhysicalDeviceNotify(DBTablePartBase *partition, DBEntryBase *e)
int ListenerId
Definition: db_table.h:62
virtual void DispatchVrouterStatsMsg(const VrouterStatsAgent &uve)
boost::shared_ptr< std::vector< std::string > > StringVectorPtr
void AppendInterfaceInternal(const VmInterface *port, StringVectorPtr intf_list, StringVectorPtr err_if_list)
bool AppendInterface(DBTablePartBase *part, DBEntryBase *entry, StringVectorPtr intf_list, StringVectorPtr err_list, StringVectorPtr nova_if_list, StringVectorPtr unmanaged_list)
PhysicalDevice * VmiToPhysicalDevice(const VmInterface *port)
void VnNotify(DBTablePartBase *partition, DBEntryBase *e)
DISALLOW_COPY_AND_ASSIGN(VrouterUveEntryBase)
void BuildAndSendComputeCpuStateMsg(const CpuLoadInfo &info)
void InterfaceNotify(DBTablePartBase *partition, DBEntryBase *e)
void VnWalkDone(DBTableBase *base, StringVectorPtr list)
DBTableBase::ListenerId vn_listener_id_
Definition: agent.h:358
PhysicalDevice * InterfaceToPhysicalDevice(Interface *intf)
void SubnetToStringList(VirtualGatewayConfig::SubnetList &l1, std::vector< std::string > &l2)
static const uint8_t bandwidth_mod_5min
void VmWalkDone(DBTableBase *base, StringVectorPtr list)
DBTableBase::ListenerId physical_device_listener_id_
bool AppendVm(DBTablePartBase *part, DBEntryBase *e, StringVectorPtr l)
bool AppendVn(DBTablePartBase *part, DBEntryBase *e, StringVectorPtr l)
void SendVrouterProuterAssociation(const std::vector< std::string > &list)
DBTableBase::ListenerId vm_listener_id_
void VmNotify(DBTablePartBase *partition, DBEntryBase *e)
std::vector< Subnet > SubnetList
Definition: cfg_vgw.h:30
void BuildAgentConfig(VrouterAgent &vrouter_agent)
boost::intrusive_ptr< DBTableWalk > DBTableWalkRef
Definition: db_table.h:169
Definition: timer.h:54
DBTable::DBTableWalkRef interface_walk_ref_
std::set< const Interface * > PhysicalInterfaceSet
virtual void DispatchVrouterMsg(const VrouterAgent &uve)
PhysicalInterfaceSet phy_intf_set_
DBTableBase::ListenerId intf_listener_id_
DBTable::DBTableWalkRef vn_walk_ref_