OpenSDN source code
ha_stale_l2_route.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015 Juniper Networks, Inc. All rights reserved.
3  * Copyright Contributors to the OpenSDN project
4  */
5 
6 #ifndef SRC_VNSW_AGENT_OVS_TOR_AGENT_OVSDB_CLIENT_HA_STALE_L2_ROUTE_H_
7 #define SRC_VNSW_AGENT_OVS_TOR_AGENT_OVSDB_CLIENT_HA_STALE_L2_ROUTE_H_
8 
9 #include <base/lifetime.h>
10 #include <ovsdb_entry.h>
11 #include <ovsdb_object.h>
12 #include <ovsdb_client_idl.h>
13 
14 class BridgeRouteEntry;
15 
16 namespace OVSDB {
17 class HaStaleDevVnEntry;
18 class HaStaleL2RouteEntry;
19 class ConnectionStateEntry;
20 
22 public:
24  AgentRouteTable *table);
25  virtual ~HaStaleL2RouteTable();
26 
27  KSyncEntry *Alloc(const KSyncEntry *key, uint32_t index);
29 
31  const OvsdbDBEntry *ovsdb_entry);
32 
33  Agent *agent() const;
34  void ManagedDelete();
35  virtual void EmptyTable();
36  Ip4Address dev_ip() const;
37  uint32_t vxlan_id() const;
38  const std::string &vn_name() const;
39  const std::string &vrf_name() const;
40 
41  void UpdateParams(HaStaleDevVnEntry *dev_vn);
42 
43 private:
44  friend class HaStaleL2RouteEntry;
45 
47  // DevVn entry will not be deleted till we del_ack for it
51  uint32_t vxlan_id_;
52  // take reference to the vrf while exporting route, to assure sanity
53  // of vrf pointer even if Add route request fails, due to any reason
55  std::string vn_name_;
57 };
58 
60 public:
62  const std::string &mac);
64 
65  bool Add();
66  bool Change();
67  bool Delete();
68 
69  bool Sync(DBEntry*);
70  bool IsLess(const KSyncEntry&) const;
71  std::string ToString() const {return "Ha Stale L2 Route Entry";}
73 
74  const std::string &mac() const;
75  uint32_t vxlan_id() const;
76  bool IsStale() const;
77 
78 private:
79  friend class HaStaleL2RouteTable;
80  friend class VrfRouteReflectorTable;
81 
82  void StaleClearCb();
83 
84  void StopStaleClearTimer();
85 
86  void AddEvent();
87  void ChangeEvent();
88  void DeleteEvent();
89 
90  std::string mac_;
91  uint32_t path_preference_;
92  uint32_t vxlan_id_;
93  uint64_t time_stamp_;
98 };
99 };
100 
101 #endif //SRC_VNSW_AGENT_OVS_TOR_AGENT_OVSDB_CLIENT_HA_STALE_L2_ROUTE_H_
102 
boost::asio::ip::address_v4 Ip4Address
Definition: address.h:15
Agent supports multiple route tables - Inet-unicast (IPv4/IPv6), Inet-multicast, bridge,...
Definition: agent_route.h:110
Definition: agent.h:361
const std::string & mac() const
std::string ToString() const
HaStaleL2RouteEntry(HaStaleL2RouteTable *table, const std::string &mac)
DISALLOW_COPY_AND_ASSIGN(HaStaleL2RouteEntry)
bool IsLess(const KSyncEntry &) const
DBFilterResp OvsdbDBEntryFilter(const DBEntry *entry, const OvsdbDBEntry *ovsdb_entry)
LifetimeRef< HaStaleL2RouteTable > table_delete_ref_
const std::string & vn_name() const
DISALLOW_COPY_AND_ASSIGN(HaStaleL2RouteTable)
KSyncEntry * Alloc(const KSyncEntry *key, uint32_t index)
ConnectionStateEntry * state_
HaStaleDevVnEntry * dev_vn_
KSyncEntry * DBToKSyncEntry(const DBEntry *)
const std::string & vrf_name() const
HaStaleL2RouteTable(HaStaleDevVnEntry *dev_vn, AgentRouteTable *table)
void UpdateParams(HaStaleDevVnEntry *dev_vn)
OvsdbDBObject * table()
Definition: ovsdb_entry.h:97
Definition: agent.h:44