OpenSDN source code
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ovsdb_route_peer.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014 Juniper Networks, Inc. All rights reserved.
3  */
4 #ifndef SRC_VNSW_AGENT_OVS_TOR_AGENT_OVSDB_CLIENT_OVS_PEER_H_
5 #define SRC_VNSW_AGENT_OVS_TOR_AGENT_OVSDB_CLIENT_OVS_PEER_H_
6 
7 #include <cmn/agent_cmn.h>
8 #include <oper/peer.h>
9 
10 class OvsPeerManager;
11 
12 // Peer for routes added by OVS
13 class OvsPeer : public DynamicPeer {
14  public:
15  OvsPeer(const IpAddress &peer_ip, uint64_t gen_id, OvsPeerManager *manager);
16  virtual ~OvsPeer();
17 
18  bool Compare(const Peer *rhs) const;
19  const Ip4Address *NexthopIp(Agent *agent, const AgentPath *path) const;
20  bool AddOvsRoute(const VrfEntry *vrf, uint32_t vxlan_id,
21  const std::string &dest_vn, const MacAddress &mac,
22  Ip4Address &tor_ip);
23  void DeleteOvsRoute(VrfEntry *vrf, uint32_t vxlan, const MacAddress &mac);
24  void AddOvsPeerMulticastRoute(const VrfEntry *vrf,
25  uint32_t vxlan_id,
26  const std::string &vn_name_,
27  const Ip4Address &tsn_ip,
28  const Ip4Address &tor_ip);
29  void DeleteOvsPeerMulticastRoute(const VrfEntry *vrf,
30  uint32_t vxlan_id,
31  const Ip4Address &tor_ip);
32  const IpAddress &peer_ip() const {return peer_ip_;}
33 
36  }
37  bool ha_stale_export() const { return ha_stale_export_; }
38 
39  private:
41  uint64_t gen_id_;
45 };
46 
48  public:
49  struct cmp {
50  bool operator()(const OvsPeer *lhs, const OvsPeer *rhs) {
51  return lhs->Compare(rhs);
52  }
53  };
54  typedef std::set<OvsPeer *, cmp> OvsPeerTable;
55 
57  virtual ~OvsPeerManager();
58 
59  OvsPeer *Allocate(const IpAddress &peer_ip);
60  void Free(OvsPeer *peer);
61  uint32_t Size() const;
62  Agent *agent() const;
63 
64  private:
65  uint64_t gen_id_;
69 };
70 
71 #endif // SRC_VNSW_AGENT_OVS_TOR_AGENT_OVSDB_CLIENT_OVS_PEER_H_
Agent * agent() const
bool ha_stale_export_
Definition: vrf.h:86
bool Compare(const Peer *rhs) const
boost::asio::ip::address IpAddress
Definition: address.h:13
OvsPeer * Allocate(const IpAddress &peer_ip)
OvsPeer(const IpAddress &peer_ip, uint64_t gen_id, OvsPeerManager *manager)
uint64_t gen_id_
Definition: agent.h:358
IpAddress peer_ip_
bool operator()(const OvsPeer *lhs, const OvsPeer *rhs)
void Free(OvsPeer *peer)
OvsPeerTable table_
bool AddOvsRoute(const VrfEntry *vrf, uint32_t vxlan_id, const std::string &dest_vn, const MacAddress &mac, Ip4Address &tor_ip)
DISALLOW_COPY_AND_ASSIGN(OvsPeerManager)
Definition: peer.h:44
void set_ha_stale_export(bool ha_stale_export)
DISALLOW_COPY_AND_ASSIGN(OvsPeer)
boost::asio::ip::address_v4 Ip4Address
Definition: address.h:14
const IpAddress & peer_ip() const
OvsPeerManager(Agent *agent)
void AddOvsPeerMulticastRoute(const VrfEntry *vrf, uint32_t vxlan_id, const std::string &vn_name_, const Ip4Address &tsn_ip, const Ip4Address &tor_ip)
OvsPeerManager * peer_manager_
std::set< OvsPeer *, cmp > OvsPeerTable
uint32_t Size() const
void DeleteOvsRoute(VrfEntry *vrf, uint32_t vxlan, const MacAddress &mac)
virtual ~OvsPeer()
virtual ~OvsPeerManager()
bool ha_stale_export() const
const Ip4Address * NexthopIp(Agent *agent, const AgentPath *path) const
void DeleteOvsPeerMulticastRoute(const VrfEntry *vrf, uint32_t vxlan_id, const Ip4Address &tor_ip)