OpenSDN source code
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ovsdb_sandesh.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015 Juniper Networks, Inc. All rights reserved.
3  */
4 
5 #ifndef SRC_VNSW_AGENT_OVS_TOR_AGENT_OVSDB_CLIENT_OVSDB_SANDESH_H_
6 #define SRC_VNSW_AGENT_OVS_TOR_AGENT_OVSDB_CLIENT_OVSDB_SANDESH_H_
7 
8 #include <oper/agent_sandesh.h>
9 
11 namespace OVSDB {
12 class OvsdbSandeshTask : public Task {
13 public:
14  enum TableType {
26  };
27 
28  enum FilterResp {
31  };
32 
33  static const uint8_t kEntriesPerSandesh = 100;
34  static const uint8_t kEntriesPerPage = 100;
35  OvsdbSandeshTask(std::string resp_ctx, AgentSandeshArguments &args);
36  OvsdbSandeshTask(std::string resp_ctx, const std::string &ip,
37  uint32_t port);
38 
39  virtual ~OvsdbSandeshTask();
40 
41  bool Run();
42  std::string Description() const { return "OvsdbSandeshTask"; }
43 
44  std::string EncodeFirstPage();
45 
46 protected:
47  std::string ip_;
48  uint32_t port_;
49 
50 private:
51  virtual void EncodeArgs(AgentSandeshArguments &args) {}
52  virtual FilterResp Filter(KSyncEntry *entry) { return FilterAllow; }
53  virtual void UpdateResp(KSyncEntry *entry, SandeshResponse *resp) = 0;
54  virtual SandeshResponse *Alloc() = 0;
55  virtual KSyncObject *GetObject(OvsdbClientSession *session) = 0;
56  virtual TableType GetTableType() = 0;
57 
58  virtual bool NoSessionObject() { return false; }
59 
60  void EncodeSendPageReq(uint32_t display_count, uint32_t table_size);
61 
62  void SendResponse(bool more);
63 
65  std::string resp_data_;
66  uint32_t first_;
67  uint32_t last_;
68  uint32_t total_count_;
70  bool error_;
71  std::string error_msg_;
73 };
74 
76 public:
77  PhysicalPortSandeshTask(std::string resp_ctx, AgentSandeshArguments &args);
78  PhysicalPortSandeshTask(std::string resp_ctx, const std::string &ip,
79  uint32_t port, const std::string &name);
80 
81  virtual ~PhysicalPortSandeshTask();
82 
83 private:
86  void UpdateResp(KSyncEntry *kentry, SandeshResponse *resp);
90 
91  std::string name_;
93 };
94 
96 public:
97  LogicalSwitchSandeshTask(std::string resp_ctx, AgentSandeshArguments &args);
98  LogicalSwitchSandeshTask(std::string resp_ctx, const std::string &ip,
99  uint32_t port, const std::string &name,
100  uint32_t vxlan_id);
101 
102  virtual ~LogicalSwitchSandeshTask();
103 
104 private:
105  void EncodeArgs(AgentSandeshArguments &args);
106  FilterResp Filter(KSyncEntry *entry);
107  void UpdateResp(KSyncEntry *kentry, SandeshResponse *resp);
111 
112  std::string name_;
113  uint32_t vxlan_id_;
115 };
116 
118 public:
119  VlanPortBindingSandeshTask(std::string resp_ctx,
120  AgentSandeshArguments &args);
121  VlanPortBindingSandeshTask(std::string resp_ctx, const std::string &ip,
122  uint32_t port, const std::string &physical_port);
123 
124  virtual ~VlanPortBindingSandeshTask();
125 
126 private:
127  void EncodeArgs(AgentSandeshArguments &args);
128  FilterResp Filter(KSyncEntry *entry);
129  void UpdateResp(KSyncEntry *kentry, SandeshResponse *resp);
133 
134  std::string physical_port_;
136 };
137 
139 public:
140  OvsdbVrfSandeshTask(std::string resp_ctx, AgentSandeshArguments &args);
141  OvsdbVrfSandeshTask(std::string resp_ctx, const std::string &ip,
142  uint32_t port, const std::string &logical_switch,
143  const std::string &mac);
144 
145  virtual ~OvsdbVrfSandeshTask();
146 
147 private:
148  void EncodeArgs(AgentSandeshArguments &args);
149  FilterResp Filter(KSyncEntry *entry);
150  void UpdateResp(KSyncEntry *kentry, SandeshResponse *resp);
154 
155  std::string logical_switch_;
156  std::string mac_;
158 };
159 
161 public:
162  UnicastMacRemoteSandeshTask(std::string resp_ctx,
163  AgentSandeshArguments &args);
164  UnicastMacRemoteSandeshTask(std::string resp_ctx, const std::string &ip,
165  uint32_t port, const std::string &ls,
166  const std::string &mac);
167 
169 
170 private:
171  void EncodeArgs(AgentSandeshArguments &args);
172  FilterResp Filter(KSyncEntry *entry);
173  void UpdateResp(KSyncEntry *kentry, SandeshResponse *resp);
177 
178  std::string ls_name_;
179  std::string mac_;
181 };
182 
184 public:
185  UnicastMacLocalSandeshTask(std::string resp_ctx,
186  AgentSandeshArguments &args);
187  UnicastMacLocalSandeshTask(std::string resp_ctx, const std::string &ip,
188  uint32_t port, const std::string &ls,
189  const std::string &mac);
190 
191  virtual ~UnicastMacLocalSandeshTask();
192 
193 private:
194  void EncodeArgs(AgentSandeshArguments &args);
195  FilterResp Filter(KSyncEntry *entry);
196  void UpdateResp(KSyncEntry *kentry, SandeshResponse *resp);
200 
201  std::string ls_name_;
202  std::string mac_;
204 };
205 
207 public:
208  MulticastMacLocalSandeshTask(std::string resp_ctx,
209  AgentSandeshArguments &args);
210  MulticastMacLocalSandeshTask(std::string resp_ctx, const std::string &ip,
211  uint32_t port, const std::string &ls);
212 
214 
215 private:
216  void EncodeArgs(AgentSandeshArguments &args);
217  FilterResp Filter(KSyncEntry *entry);
218  void UpdateResp(KSyncEntry *kentry, SandeshResponse *resp);
222 
223  std::string ls_name_;
225 };
226 
228 public:
229  HaStaleDevVnSandeshTask(std::string resp_ctx,
230  AgentSandeshArguments &args);
231  HaStaleDevVnSandeshTask(std::string resp_ctx, const std::string &dev_name,
232  const std::string &vn_uuid);
233 
234  virtual ~HaStaleDevVnSandeshTask();
235 
236  virtual bool NoSessionObject() { return true; }
237 
238 private:
239  void EncodeArgs(AgentSandeshArguments &args);
240  FilterResp Filter(KSyncEntry *entry);
241  void UpdateResp(KSyncEntry *kentry, SandeshResponse *resp);
245 
246  std::string dev_name_;
247  std::string vn_uuid_;
249 };
250 
252 public:
253  HaStaleL2RouteSandeshTask(std::string resp_ctx,
254  AgentSandeshArguments &args);
255  HaStaleL2RouteSandeshTask(std::string resp_ctx, const std::string &dev_name,
256  const std::string &vn_uuid,
257  const std::string &mac);
258 
259  virtual ~HaStaleL2RouteSandeshTask();
260 
261  virtual bool NoSessionObject() { return true; }
262 
263 private:
264  void EncodeArgs(AgentSandeshArguments &args);
265  FilterResp Filter(KSyncEntry *entry);
266  void UpdateResp(KSyncEntry *kentry, SandeshResponse *resp);
270 
271  std::string dev_name_;
272  std::string vn_uuid_;
273  std::string mac_;
275 };
276 
277 };
278 
279 #endif // SRC_VNSW_AGENT_OVS_TOR_AGENT_OVSDB_CLIENT_OVSDB_SANDESH_H_
280 
HaStaleL2RouteSandeshTask(std::string resp_ctx, AgentSandeshArguments &args)
void UpdateResp(KSyncEntry *kentry, SandeshResponse *resp)
KSyncObject * GetObject(OvsdbClientSession *session)
void UpdateResp(KSyncEntry *kentry, SandeshResponse *resp)
FilterResp Filter(KSyncEntry *entry)
UnicastMacLocalSandeshTask(std::string resp_ctx, AgentSandeshArguments &args)
DISALLOW_COPY_AND_ASSIGN(VlanPortBindingSandeshTask)
MulticastMacLocalSandeshTask(std::string resp_ctx, AgentSandeshArguments &args)
DISALLOW_COPY_AND_ASSIGN(HaStaleDevVnSandeshTask)
void EncodeArgs(AgentSandeshArguments &args)
OvsdbSandeshTask(std::string resp_ctx, AgentSandeshArguments &args)
void UpdateResp(KSyncEntry *kentry, SandeshResponse *resp)
SandeshResponse * resp_
Definition: ovsdb_sandesh.h:64
void EncodeArgs(AgentSandeshArguments &args)
Definition: vrf_ovsdb.cc:213
DISALLOW_COPY_AND_ASSIGN(MulticastMacLocalSandeshTask)
void UpdateResp(KSyncEntry *kentry, SandeshResponse *resp)
DISALLOW_COPY_AND_ASSIGN(UnicastMacRemoteSandeshTask)
void EncodeArgs(AgentSandeshArguments &args)
FilterResp Filter(KSyncEntry *entry)
Definition: vrf_ovsdb.cc:222
void EncodeSendPageReq(uint32_t display_count, uint32_t table_size)
std::string EncodeFirstPage()
DISALLOW_COPY_AND_ASSIGN(LogicalSwitchSandeshTask)
void EncodeArgs(AgentSandeshArguments &args)
void EncodeArgs(AgentSandeshArguments &args)
DISALLOW_COPY_AND_ASSIGN(HaStaleL2RouteSandeshTask)
FilterResp Filter(KSyncEntry *entry)
VlanPortBindingSandeshTask(std::string resp_ctx, AgentSandeshArguments &args)
DISALLOW_COPY_AND_ASSIGN(OvsdbVrfSandeshTask)
KSyncObject * GetObject(OvsdbClientSession *session)
KSyncObject * GetObject(OvsdbClientSession *session)
FilterResp Filter(KSyncEntry *entry)
void UpdateResp(KSyncEntry *kentry, SandeshResponse *resp)
DISALLOW_COPY_AND_ASSIGN(OvsdbSandeshTask)
bool Run()
Code to execute. Returns true if task is completed. Return false to reschedule the task...
UnicastMacRemoteSandeshTask(std::string resp_ctx, AgentSandeshArguments &args)
virtual TableType GetTableType()=0
FilterResp Filter(KSyncEntry *entry)
void SendResponse(bool more)
PhysicalPortSandeshTask(std::string resp_ctx, AgentSandeshArguments &args)
KSyncObject * GetObject(OvsdbClientSession *session)
void UpdateResp(KSyncEntry *kentry, SandeshResponse *resp)
virtual bool NoSessionObject()
Definition: ovsdb_sandesh.h:58
OvsdbVrfSandeshTask(std::string resp_ctx, AgentSandeshArguments &args)
Definition: vrf_ovsdb.cc:192
DISALLOW_COPY_AND_ASSIGN(PhysicalPortSandeshTask)
virtual SandeshResponse * Alloc()=0
LogicalSwitchSandeshTask(std::string resp_ctx, AgentSandeshArguments &args)
KSyncObject * GetObject(OvsdbClientSession *session)
KSyncObject * GetObject(OvsdbClientSession *session)
void EncodeArgs(AgentSandeshArguments &args)
HaStaleDevVnSandeshTask(std::string resp_ctx, AgentSandeshArguments &args)
void EncodeArgs(AgentSandeshArguments &args)
KSyncObject * GetObject(OvsdbClientSession *session)
Definition: vrf_ovsdb.cc:254
void EncodeArgs(AgentSandeshArguments &args)
KSyncObject * GetObject(OvsdbClientSession *session)
FilterResp Filter(KSyncEntry *entry)
KSyncObject * GetObject(OvsdbClientSession *session)
FilterResp Filter(KSyncEntry *entry)
DISALLOW_COPY_AND_ASSIGN(UnicastMacLocalSandeshTask)
virtual KSyncObject * GetObject(OvsdbClientSession *session)=0
void UpdateResp(KSyncEntry *kentry, SandeshResponse *resp)
void EncodeArgs(AgentSandeshArguments &args)
virtual void EncodeArgs(AgentSandeshArguments &args)
Definition: ovsdb_sandesh.h:51
static const uint8_t kEntriesPerSandesh
Definition: ovsdb_sandesh.h:33
virtual FilterResp Filter(KSyncEntry *entry)
Definition: ovsdb_sandesh.h:52
void UpdateResp(KSyncEntry *kentry, SandeshResponse *resp)
Definition: vrf_ovsdb.cc:234
Task is a wrapper over tbb::task to support policies.
Definition: task.h:86
SandeshResponse * Alloc()
Definition: vrf_ovsdb.cc:250
std::string Description() const
Definition: ovsdb_sandesh.h:42
void UpdateResp(KSyncEntry *kentry, SandeshResponse *resp)
virtual void UpdateResp(KSyncEntry *entry, SandeshResponse *resp)=0
static const uint8_t kEntriesPerPage
Definition: ovsdb_sandesh.h:34