OpenSDN source code
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
vn_uve_table_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_vn_uve_table_base_h
6 #define vnsw_agent_vn_uve_table_base_h
7 
8 #include <string>
9 #include <set>
10 #include <map>
11 #include <vector>
12 #include <virtual_network_types.h>
13 #include <oper/vn.h>
14 #include <uve/vn_uve_entry_base.h>
15 
16 //The container class for objects representing VirtualNetwork UVEs
17 //Defines routines for storing and managing (add, delete, change and send)
18 //VirtualNetwork UVEs
20 public:
21  struct VnUveInterfaceState :public DBState {
22  VnUveInterfaceState(const std::string &vm, const std::string &vn)
23  : vm_name_(vm), vn_name_(vn) {
24  }
25  std::string vm_name_;
26  std::string vn_name_;
27  };
28 
29  typedef boost::shared_ptr<VnUveEntryBase> VnUveEntryPtr;
30  typedef std::map<std::string, VnUveEntryPtr> UveVnMap;
31  typedef std::pair<std::string, VnUveEntryPtr> UveVnPair;
32  VnUveTableBase(Agent *agent, uint32_t default_intvl);
33  virtual ~VnUveTableBase();
34 
35  void RegisterDBClients();
36  void Shutdown(void);
37  void SendVnAclRuleCount();
38  bool TimerExpiry();
39 
40 protected:
41  void Delete(const std::string &name);
43  //The following API is made protected for UT.
44  virtual void DispatchVnMsg(const UveVirtualNetworkAgent &uve);
45  virtual void SendVnAceStats(VnUveEntryBase *entry, const VnEntry *vn) {
46  }
47 
50  /* For exclusion between kTaskFlowStatsCollector and kTaskDBExclude */
51  tbb::mutex uve_vn_map_mutex_;
52 private:
53  VnUveEntryBase* Add(const VnEntry *vn);
54  void Add(const std::string &vn);
55  virtual VnUveEntryPtr Allocate(const VnEntry *vn);
56  virtual VnUveEntryPtr Allocate();
57  void VnNotify(DBTablePartBase *partition, DBEntryBase *e);
58  void InterfaceNotify(DBTablePartBase *partition, DBEntryBase *e);
59  void SendDeleteVnMsg(const std::string &vn);
60  void MarkChanged(const VnEntry *vn);
61  void InterfaceDeleteHandler(const std::string &vm, const std::string &vn,
62  const Interface* intf);
63  void InterfaceAddHandler(const VnEntry* vn, const Interface* intf,
64  const std::string &vm_name,
65  VnUveInterfaceState *state);
66  void set_expiry_time(int time);
67  void SendVnMsg(VnUveEntryBase *entry, const VnEntry *vn);
68 
71 
72  // Last visited VmEntry by timer
73  std::string timer_last_visited_;
76 
78 };
79 
80 #endif // vnsw_agent_vn_uve_table_base_h
DBTableBase::ListenerId vn_listener_id_
void SendDeleteVnMsg(const std::string &vn)
std::string timer_last_visited_
int ListenerId
Definition: db_table.h:62
DBTableBase::ListenerId intf_listener_id_
virtual void SendVnAceStats(VnUveEntryBase *entry, const VnEntry *vn)
void MarkChanged(const VnEntry *vn)
void Delete(const std::string &name)
VnUveEntryBase * Add(const VnEntry *vn)
void InterfaceDeleteHandler(const std::string &vm, const std::string &vn, const Interface *intf)
Definition: agent.h:358
virtual VnUveEntryPtr Allocate()
DISALLOW_COPY_AND_ASSIGN(VnUveTableBase)
tbb::mutex uve_vn_map_mutex_
virtual ~VnUveTableBase()
Definition: vn.h:151
VnUveTableBase(Agent *agent, uint32_t default_intvl)
void VnNotify(DBTablePartBase *partition, DBEntryBase *e)
std::pair< std::string, VnUveEntryPtr > UveVnPair
void SendVnMsg(VnUveEntryBase *entry, const VnEntry *vn)
VnUveEntryBase * UveEntryFromVn(const VnEntry *vn)
boost::shared_ptr< VnUveEntryBase > VnUveEntryPtr
void set_expiry_time(int time)
Definition: timer.h:54
virtual void DispatchVnMsg(const UveVirtualNetworkAgent &uve)
VnUveInterfaceState(const std::string &vm, const std::string &vn)
void InterfaceAddHandler(const VnEntry *vn, const Interface *intf, const std::string &vm_name, VnUveInterfaceState *state)
std::map< std::string, VnUveEntryPtr > UveVnMap
void InterfaceNotify(DBTablePartBase *partition, DBEntryBase *e)