OpenSDN source code
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
mac_learning_db_client.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017 Juniper Networks, Inc. All rights reserved.
3  */
4 #ifndef SRC_VNSW_AGENT_MAC_LEARNING_MAC_LEARNING_DB_CLIENT_H_
5 #define SRC_VNSW_AGENT_MAC_LEARNING_MAC_LEARNING_DB_CLIENT_H_
6 #include "cmn/agent.h"
7 #include <oper/vn.h>
8 #include <oper/vm.h>
10 #include <oper/nexthop.h>
11 #include <oper/route_common.h>
12 #include <oper/sg.h>
13 #include <oper/vrf.h>
14 #include <filter/acl.h>
15 #include <oper/health_check.h>
16 
17 //Mac learning mgmt DB client module listens for all notification from
18 //DB table and triggers change on the dependent MAC entries.
19 //Add or Change of DB entry:
20 // Request to revaluate DB entries is enqueued to MAC mgmt module
21 // which in turn RESYNC's all the mac entries
22 //
23 //Delete of DB entry:
24 // Request to delete DB Entry gets queued to MAC mgmt table,
25 // which in turn deletes all the mac entries dependent on this
26 // DB entry.
27 //
28 //Free of DB State:
29 // DB state should be release till the depedent mac entries
30 // have been deleted. Hence once the mac entries are deleted
31 // request to free DB state gets enqued from mac mgmt module
32 // to learning module, so that it happens in exclusion to DB.
33 //
35 public:
36  struct MacLearningDBState : public DBState {
38  bool deleted_;
39  uint32_t gen_id_;
40  };
41 
43  uint32_t l2_label_;
47  bool l2_active_;
49  };
50 
53  void Register(MacLearningDBClient *client, VrfEntry *vrf);
54  void Unregister(VrfEntry *vrf);
55  bool deleted_;
57  uint32_t isid_;
60  };
63  hc_uuid_() {}
64  bool deleted_;
67  };
70  bool deleted_;
71  uint32_t delay_;
72  uint64_t delay_usecs_;
73  uint32_t timeout_;
74  uint64_t timeout_usecs_;
75  uint32_t max_retries_;
77  std::set<IpAddress> hc_target_ip_list_;
78  };
79 
81  };
82 
83  MacLearningDBClient(Agent *agent);
84  virtual ~MacLearningDBClient();
85  void Init();
86  void Shutdown();
87  void FreeDBState(const DBEntry *db_entry, uint32_t gen_id);
88 private:
89  void AddEvent(const DBEntry *entry, MacLearningDBState *state);
90  void DeleteEvent(const DBEntry *entry, MacLearningDBState *state);
91  void DeleteNoOpEvent(const DBEntry *entry, MacLearningDBState *state);
92  void ChangeEvent(const DBEntry *entry, MacLearningDBState *state);
93  void ReleaseToken(const DBEntry *entry);
94  void DeleteAllMac(const DBEntry *entry, MacLearningDBState *state);
96  void VrfNotify(DBTablePartBase *part, DBEntryBase *e);
97  void RouteNotify(MacLearningVrfState *state,
99  DBTablePartBase *partition,
100  DBEntryBase *e);
103  DBTablePartBase *partition,
104  DBEntryBase *e);
105  void VnNotify(DBTablePartBase *part, DBEntryBase *e);
107  void FreeRouteState(const DBEntry *e, uint32_t gen_id);
108  void EnqueueAgingTableDelete(const VrfEntry *vrf);
115 };
116 #endif
void RouteNotify(MacLearningVrfState *state, Agent::RouteTableType type, DBTablePartBase *partition, DBEntryBase *e)
void DeleteAllMac(const DBEntry *entry, MacLearningDBState *state)
Definition: vrf.h:86
DBTableBase::ListenerId interface_listener_id_
DBTableBase::ListenerId vrf_listener_id_
void VnNotify(DBTablePartBase *part, DBEntryBase *e)
VmInterface::SecurityGroupEntryList sg_l_
int ListenerId
Definition: db_table.h:62
void DeleteNoOpEvent(const DBEntry *entry, MacLearningDBState *state)
void EvpnRouteNotify(MacLearningVrfState *state, Agent::RouteTableType type, DBTablePartBase *partition, DBEntryBase *e)
boost::uuids::uuid uuid
uint8_t type
Definition: load_balance.h:109
DISALLOW_COPY_AND_ASSIGN(MacLearningDBClient)
void AddEvent(const DBEntry *entry, MacLearningDBState *state)
Definition: agent.h:358
void FreeDBState(const DBEntry *db_entry, uint32_t gen_id)
void InterfaceNotify(DBTablePartBase *part, DBEntryBase *e)
void DeleteEvent(const DBEntry *entry, MacLearningDBState *state)
void VrfNotify(DBTablePartBase *part, DBEntryBase *e)
void ReleaseToken(const DBEntry *entry)
void ChangeEvent(const DBEntry *entry, MacLearningDBState *state)
void EnqueueAgingTableDelete(const VrfEntry *vrf)
RouteTableType
Definition: agent.h:415
DBTableBase::ListenerId hc_listener_id_
void FreeRouteState(const DBEntry *e, uint32_t gen_id)
void HealthCheckNotify(DBTablePartBase *part, DBEntryBase *e)
void Register(MacLearningDBClient *client, VrfEntry *vrf)
DBTableBase::ListenerId vn_listener_id_