OpenSDN source code
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
unicast_mac_remote_ovsdb.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014 Juniper Networks, Inc. All rights reserved.
3  */
4 
5 #ifndef SRC_VNSW_AGENT_OVS_TOR_AGENT_OVSDB_CLIENT_UNICAST_MAC_REMOTE_OVSDB_H_
6 #define SRC_VNSW_AGENT_OVS_TOR_AGENT_OVSDB_CLIENT_UNICAST_MAC_REMOTE_OVSDB_H_
7 
8 #include <base/lifetime.h>
9 #include <ovsdb_entry.h>
10 #include <ovsdb_object.h>
11 #include <ovsdb_client_idl.h>
12 
13 class BridgeRouteEntry;
14 
15 namespace OVSDB {
16 class VrfOvsdbObject;
17 class VrfOvsdbEntry;
18 
20 public:
22  const std::string &logical_switch_name,
23  VrfOvsdbEntry *vrf);
24  virtual ~UnicastMacRemoteTable();
25 
26  virtual void OvsdbRegisterDBTable(DBTable *tbl);
27 
28  KSyncEntry *Alloc(const KSyncEntry *key, uint32_t index);
30  OvsdbDBEntry *AllocOvsEntry(struct ovsdb_idl_row *row);
31 
33  const OvsdbDBEntry *ovsdb_entry);
34 
35  void ManagedDelete();
36  virtual void EmptyTable();
37 
38  const std::string &logical_switch_name() const;
39 
40 private:
41  std::string logical_switch_name_;
45 };
46 
48 public:
49  typedef std::set<struct ovsdb_idl_row *> OvsdbDupIdlList;
50  enum Trace {
55  };
58  const BridgeRouteEntry *entry);
60  const UnicastMacRemoteEntry *key);
62  struct ovsdb_idl_row *entry);
63  virtual ~UnicastMacRemoteEntry();
64 
65  // OVSDB schema does not consider a key for unicast mac remote entry
66  // so over-ride the default behaviour of NotifyAdd and NotifyDelete
67  // to handle multiple possible idl row associated with single unicast
68  // mac remote entry.
69  virtual void NotifyAdd(struct ovsdb_idl_row *);
70  virtual void NotifyDelete(struct ovsdb_idl_row *);
71 
72  void PreAddChange();
73  void PostDelete();
74  void AddMsg(struct ovsdb_idl_txn *);
75  void ChangeMsg(struct ovsdb_idl_txn *);
76  void DeleteMsg(struct ovsdb_idl_txn *);
77 
78  void OvsdbChange();
79 
80  bool Sync(DBEntry*);
81  bool IsLess(const KSyncEntry&) const;
82  std::string ToString() const {return "Unicast Mac Remote";}
84 
85  const std::string &mac() const;
86  const std::string &logical_switch_name() const;
87  const std::string &dest_ip() const;
88  bool self_exported_route() const;
89  uint32_t sequence() const;
90  uint32_t self_sequence() const;
91  bool ecmp_suppressed() const;
92 
93  // Override Ack api to get trigger on Ack
94  void Ack(bool success);
95 
96  // Override TxnDoneNoMessage to get triggers for no message
97  // transaction complete
98  void TxnDoneNoMessage();
99 
100  // use bulk txn
101  virtual bool UseBulkTxn() { return true; }
102 
103 private:
104  friend class UnicastMacRemoteTable;
105  friend class VrfOvsdbObject;
106  void SendTrace(Trace event) const;
107  void DeleteDupEntries(struct ovsdb_idl_txn *);
108 
110 
111  // physical_locator create ref
113 
114  std::string mac_;
115  std::string logical_switch_name_;
116  std::string dest_ip_;
119  uint32_t sequence_;
120  uint32_t self_sequence_;
124 };
125 };
126 
127 #endif //SRC_VNSW_AGENT_OVS_TOR_AGENT_OVSDB_CLIENT_UNICAST_MAC_REMOTE_OVSDB_H_
128 
DISALLOW_COPY_AND_ASSIGN(UnicastMacRemoteTable)
const std::string & logical_switch_name() const
OvsdbDBObject * table()
Definition: ovsdb_entry.h:96
UnicastMacRemoteEntry(UnicastMacRemoteTable *table, const std::string mac)
virtual void NotifyDelete(struct ovsdb_idl_row *)
void DeleteDupEntries(struct ovsdb_idl_txn *)
void AddMsg(struct ovsdb_idl_txn *)
DBFilterResp OvsdbDBEntryFilter(const DBEntry *entry, const OvsdbDBEntry *ovsdb_entry)
KSyncEntry * Alloc(const KSyncEntry *key, uint32_t index)
OvsdbDBEntry * AllocOvsEntry(struct ovsdb_idl_row *row)
DISALLOW_COPY_AND_ASSIGN(UnicastMacRemoteEntry)
void ChangeMsg(struct ovsdb_idl_txn *)
virtual void NotifyAdd(struct ovsdb_idl_row *)
UnicastMacRemoteTable(OvsdbClientIdl *idl, const std::string &logical_switch_name, VrfOvsdbEntry *vrf)
std::set< struct ovsdb_idl_row * > OvsdbDupIdlList
const std::string & logical_switch_name() const
boost::intrusive_ptr< KSyncEntry > KSyncEntryPtr
Definition: ksync_entry.h:68
Definition: trace.h:220
const std::string & mac() const
void DeleteMsg(struct ovsdb_idl_txn *)
LifetimeRef< UnicastMacRemoteTable > table_delete_ref_
bool IsLess(const KSyncEntry &) const
virtual void OvsdbRegisterDBTable(DBTable *tbl)
const std::string & dest_ip() const
KSyncEntry * DBToKSyncEntry(const DBEntry *)