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