OpenSDN source code
mac_ip_learning.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2020 Juniper Networks, Inc. All rights reserved.
3  */
4 
5 #ifndef SRC_VNSW_AGENT_MAC_IP_LEARNING_MAC_LEARNING_H_
6 #define SRC_VNSW_AGENT_MAC_IP_LEARNING_MAC_LEARNING_H_
7 
8 #include <mutex>
9 
10 #include "cmn/agent.h"
11 #include "mac_ip_learning_key.h"
12 #include "mac_learning_base.h"
13 #include "mac_learning_event.h"
14 #include "pkt/flow_token.h"
15 #include "health_check.h"
16 
17 class MacIpLearningTable;
20 public:
21  MacIpLearningEntry(MacIpLearningTable *table, uint32_t vrf_id_,
22  const IpAddress &ip, const MacAddress &mac,
24  virtual ~MacIpLearningEntry() {}
25  bool Add();
26  void Delete();
27  void Resync();
28  uint32_t vrf_id() {
29  return key_.vrf_id_;
30  }
31  const Interface* intf() {
32  return intf_.get();
33  }
34  const VnEntry* Vn() {
35  return vn_.get();
36  }
38  return hc_service_;
39  }
41  return hc_instance_;
42  }
45  }
46  const MacIpLearningKey& key() const {
47  return key_;
48  }
50  return ip_;
51  }
53  return mac_;
54  }
59 
60 private:
70 };
71 
73 public:
74  typedef std::pair<MacIpLearningKey,
76  typedef std::map<MacIpLearningKey,
79 
81  virtual ~MacIpLearningTable() {}
82  void Add(MacLearningEntryPtr ptr);
83  void Resync(MacLearningEntryPtr ptr);
84  void Delete(MacLearningEntryPtr ptr);
87  void MacIpEntryUnreachable(uint32_t vrf_id, IpAddress &ip, MacAddress &mac);
88  void MacIpEntryHcNotify(const HealthCheckInstanceService *instance_service);
90  MacAddress GetPairedMacAddress(uint32_t vrf_id, const IpAddress &ip);
91  //To be used in test cases only
92  //MacLearningEntryPtr TestGet(const MacLearningKey &key);
94 
95  Agent* agent() {
96  return agent_;
97  }
98 
99  void SetQueueDisable(bool disable) {
100  work_queue_.SetQueueDisable(disable);
101  }
102 
104  void EnqueueMgmtReq(MacLearningEntryPtr ptr, bool add);
105 
106 private:
110  std::mutex macip_map_mutex_;
112 };
113 #endif
boost::asio::ip::address IpAddress
Definition: address.h:13
boost::intrusive_ptr< const Interface > InterfaceConstRef
Definition: agent.h:51
boost::intrusive_ptr< const VnEntry > VnEntryConstRef
Definition: agent.h:70
Definition: agent.h:360
IpAddress & IpAddr()
const Interface * intf()
MacIpLearningKey key_
InterfaceConstRef intf_
MacIpLearningEntry(MacIpLearningTable *table, uint32_t vrf_id_, const IpAddress &ip, const MacAddress &mac, InterfaceConstRef intf)
MacAddress & Mac()
void AddHealthCheckService(HealthCheckService *service)
DISALLOW_COPY_AND_ASSIGN(MacIpLearningEntry)
const HealthCheckInstanceBase * HcInstance()
const MacIpLearningKey & key() const
VnEntryConstRef vn_
HealthCheckService * hc_service_
virtual ~MacIpLearningEntry()
MacIpLearningTable * mac_ip_learning_table() const
void EnqueueToTable(MacLearningEntryRequestPtr req)
HealthCheckInstanceBase * hc_instance_
MacIpLearningTable * mac_ip_learning_table_
const HealthCheckService * HcService()
HealthCheckService * GetHealthCheckService(const VnEntry *vn)
const VnEntry * Vn()
void SetQueueDisable(bool disable)
MacAddress GetPairedMacAddress(uint32_t vrf_id, const IpAddress &ip)
void Add(MacLearningEntryPtr ptr)
virtual ~MacIpLearningTable()
void Enqueue(MacLearningEntryRequestPtr req)
void DetectIpMove(MacLearningEntryRequestPtr ptr)
bool RequestHandler(MacLearningEntryRequestPtr ptr)
void SetQueueDisable(bool disable)
void EnqueueMgmtReq(MacLearningEntryPtr ptr, bool add)
MacIpLearningEntryMap mac_ip_learning_entry_map_
MacIpLearningTable(Agent *agent, MacLearningProto *proto)
std::mutex macip_map_mutex_
std::map< MacIpLearningKey, MacLearningEntryPtr, MacIpLearningKeyCmp > MacIpLearningEntryMap
MacIpLearningRequestQueue work_queue_
void Delete(MacLearningEntryPtr ptr)
std::pair< MacIpLearningKey, MacLearningEntryPtr > MacIpLearningEntryPair
void MacIpEntryUnreachable(MacLearningEntryRequestPtr ptr)
void Resync(MacLearningEntryPtr ptr)
MacIpLearningEntry * Find(const MacIpLearningKey &key)
DISALLOW_COPY_AND_ASSIGN(MacIpLearningTable)
void MacIpEntryHcNotify(const HealthCheckInstanceService *instance_service)
Definition: vn.h:151
boost::shared_ptr< MacLearningEntry > MacLearningEntryPtr
boost::shared_ptr< MacLearningEntryRequest > MacLearningEntryRequestPtr
const uint32_t vrf_id_