OpenSDN source code
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ksync_sock_user.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
3  */
4 
5 #ifndef ctrlplane_ksync_sock_user_h
6 #define ctrlplane_ksync_sock_user_h
7 
8 #include <queue>
9 
10 #include <tbb/mutex.h>
11 #include <boost/asio.hpp>
12 #include <boost/asio/buffer.hpp>
13 
14 #include <boost/unordered_map.hpp>
15 #include "ksync_sock.h"
16 
17 #include "nl_util.h"
18 #include "vr_types.h"
19 #include "vr_flow.h"
20 #include "vr_bridge.h"
21 
22 using boost::asio::ip::udp;
23 
25 
26 class vrouter_ops_test : public vrouter_ops {
27 private:
28  virtual void Process(SandeshContext *context);
29 };
30 
32 public:
33  KSyncUserSockContext(uint32_t num) : seqno_(num) {}
34  virtual ~KSyncUserSockContext() {}
35  uint32_t GetSeqNum() { return seqno_; }
36  virtual void IfMsgHandler(vr_interface_req *req);
37  virtual void NHMsgHandler(vr_nexthop_req *req);
38  virtual void RouteMsgHandler(vr_route_req *req);
39  virtual void MplsMsgHandler(vr_mpls_req *req);
40  virtual void MirrorMsgHandler(vr_mirror_req *req);
41  virtual int VrResponseMsgHandler(vr_response *req) {return 0;};
42  virtual void FlowMsgHandler(vr_flow_req *req);
43  virtual void VrfAssignMsgHandler(vr_vrf_assign_req *req);
44  virtual void VrfMsgHandler(vr_vrf_req *req);
45  virtual void VrfStatsMsgHandler(vr_vrf_stats_req *req);
46  virtual void DropStatsMsgHandler(vr_drop_stats_req *req);
47  virtual void VxLanMsgHandler(vr_vxlan_req *req);
48  virtual void QosConfigMsgHandler(vr_qos_map_req *req);
49  virtual void ForwardingClassMsgHandler(vr_fc_map_req *req);
50  virtual void VrouterOpsMsgHandler(vrouter_ops *req);
51  virtual void Process() {}
52 private:
53  uint32_t seqno_;
54 };
55 
56 struct TestRouteCmp {
57  bool operator()(const vr_route_req &lhs, const vr_route_req &rhs) const {
58  if (lhs.get_rtr_family() != rhs.get_rtr_family()) {
59  return lhs.get_rtr_family() < rhs.get_rtr_family();
60  }
61  if (lhs.get_rtr_vrf_id() != rhs.get_rtr_vrf_id()) {
62  return lhs.get_rtr_vrf_id() < rhs.get_rtr_vrf_id();
63  }
64  if (lhs.get_rtr_family() == AF_BRIDGE) {
65  return lhs.get_rtr_mac() < rhs.get_rtr_mac();
66  }
67  if (lhs.get_rtr_prefix_len() != rhs.get_rtr_prefix_len()) {
68  return lhs.get_rtr_prefix_len() < rhs.get_rtr_prefix_len();
69  }
70  return lhs.get_rtr_prefix() < rhs.get_rtr_prefix();
71  }
72 };
73 
75  bool operator() (const vr_vrf_assign_req &lhs, const vr_vrf_assign_req &rhs) const {
76  if (lhs.get_var_vif_index() != rhs.get_var_vif_index()) {
77  return lhs.get_var_vif_index() < rhs.get_var_vif_index();
78  }
79 
80  return lhs.get_var_vlan_id() < rhs.get_var_vlan_id();
81  }
82 };
83 
84 //this class stores all netlink sandesh messages in a map
85 //used for unit testing or userspace datapath integration
86 class KSyncSockTypeMap : public KSyncSock {
87 public:
91  };
92 
93  KSyncSockTypeMap(boost::asio::io_context &ios) : KSyncSock(), sock_(ios), ksync_error_() {
94  block_msg_processing_ = false;
95  is_incremental_index_ = false;
96  }
98  assert(nh_map.size() == 0);
99  assert(flow_map.size() == 0);
100  assert(if_map.size() == 0);
101  assert(rt_tree.size() == 0);
102  assert(mpls_map.size() == 0);
103  assert(mirror_map.size() == 0);
104  assert(vrf_assign_tree.size() == 0);
105  assert(vxlan_map.size() == 0);
106  singleton_ = NULL;
107  }
108 
109  typedef std::map<int, vr_nexthop_req> ksync_map_nh;
111  typedef boost::unordered_map<int, vr_flow_req> ksync_map_flow;
113  typedef std::map<int, vr_interface_req> ksync_map_if;
115  typedef std::set<vr_route_req, TestRouteCmp> ksync_rt_tree;
117  typedef std::map<int, vr_mpls_req> ksync_map_mpls;
119  typedef std::map<int, vr_mirror_req> ksync_map_mirror;
121  typedef std::set<vr_vrf_assign_req, TestVrfAssignCmp> ksync_vrf_assign_tree;
123  typedef std::map<int, vr_vrf_stats_req> ksync_map_vrf_stats;
125  vr_drop_stats_req drop_stats;
126  vrouter_ops ksync_vrouter_ops;
127  typedef std::map<int, vr_vxlan_req> ksync_map_vxlan;
129  typedef std::map<int, vr_vrf_req> ksync_map_vrf;
131  typedef std::queue<KSyncUserSockContext *> ksync_map_ctx_queue;
133  tbb::mutex ctx_queue_lock_;
134 
135  virtual uint32_t GetSeqno(char *data);
136  virtual bool IsMoreData(char *data);
137  virtual bool BulkDecoder(char *data, KSyncBulkSandeshContext *ctxt);
138  virtual bool Decoder(char *data, AgentSandeshContext *ctxt);
139  virtual bool Validate(char *data);
140  virtual void AsyncReceive(boost::asio::mutable_buffers_1, HandlerCb);
141  virtual void AsyncSendTo(KSyncBufferList *iovec, uint32_t seq_no,
142  HandlerCb cb);
143  virtual std::size_t SendTo(KSyncBufferList *iovec, uint32_t seq_no);
144  virtual void Receive(boost::asio::mutable_buffers_1);
145 
146  void PurgeTxBuffer();
147  void ProcessSandesh(const uint8_t *, std::size_t, KSyncUserSockContext *);
148  static void set_error_code(int code) { error_code_ = code; }
149  static int error_code() { return error_code_; }
150  static void SimulateResponse(uint32_t, int, int);
151  static void SendNetlinkDoneMsg(uint32_t seq_num);
152  static void IfDumpResponse(uint32_t);
153  static void IfNetlinkMsgSend(uint32_t seq_num, ksync_map_if::const_iterator it);
154  static void IfStatsUpdate(int, int, int, int, int, int, int);
155  static void IfStatsSet(int, int, int, int, int, int, int);
156  static void InterfaceAdd(int id, int flags = 0, int mac_size = 6);
157  static void InterfaceDelete(int id);
158  static void NHAdd(int id, int flags = 0);
159  static void NHDelete(int id);
160  static void MplsAdd(int id);
161  static void MplsDelete(int id);
162  static void MirrorAdd(int id);
163  static void MirrorDelete(int id);
164  static void RouteAdd(vr_route_req &req);
165  static void RouteDelete(vr_route_req &req);
166  static void VrfAssignAdd(vr_vrf_assign_req &req);
167  static void VrfAssignDelete(vr_vrf_assign_req &req);
168  static void VrfAdd(vr_vrf_req &req);
169  static void VrfDelete(vr_vrf_req &req);
170  static void VrfStatsAdd(int vrf_id);
171  static void VrfStatsUpdate(int vrf_id, const vr_vrf_stats_req &req);
172  static void VrfStatsDelete(int vrf_id);
173  static void VxlanAdd(int id);
174  static void VxlanDelete(int id);
175 
176  static void SetDropStats(const vr_drop_stats_req &req);
177  static void SetVRouterOps(const vrouter_ops &req);
178  static int IfCount();
179  static int NHCount();
180  static int MplsCount();
181  static int RouteCount();
182  static int VxLanCount();
184  static void Init(boost::asio::io_context &ios);
185  static void Shutdown();
186  static vr_flow_entry *FlowMmapAlloc(int size);
187  static void FlowMmapFree();
188  static vr_flow_entry *GetFlowEntry(int idx);
189  static void SetFlowEntry(vr_flow_req *req, bool set);
190  static void IncrFlowStats(int idx, int pkts, int bytes);
191  static void SetTcpFlag(int idx, uint32_t flags);
192  static void SetOFlowStats(int idx, uint8_t pkts, uint16_t bytes);
193  static void SetFlowTcpFlags(int idx, uint16_t flags);
194  static void SetEvictedFlag(int idx);
195  static void ResetEvictedFlag(int idx);
196  static void FlowNatResponse(uint32_t seq_num, vr_flow_req *req, int code = 0);
197  static void SetUnderlaySourcePort(int idx, int port);
198  vr_bridge_entry* BridgeMmapAlloc(int size);
199  void BridgeMmapFree();
200  vr_bridge_entry* GetBridgeEntry(int idx);
201  void SetBridgeEntry(uint32_t idx, vr_route_req *req, bool set);
202  void UpdateBridgeEntryInactiveFlag(int idx, bool set);
203  friend class MockDumpHandlerBase;
204  friend class RouteDumpHandler;
205  friend class VrfAssignDumpHandler;
206  friend class VrfDumpHandler;
207  void SetBlockMsgProcessing(bool enable);
209  tbb::mutex::scoped_lock lock(ctx_queue_lock_);
210  return block_msg_processing_;
211  }
212 
213  void set_is_incremental_index(bool incremental) {
214  is_incremental_index_ = incremental;
215  }
216 
218 
219  void SetKSyncError(KSyncSockEntryType type, int ksync_error) {
220  ksync_error_[type] = ksync_error;
221  }
222 
224  return ksync_error_[type];
225  }
226 
227  // Add a response in nl_client into tx_buff_list_
228  void AddNetlinkTxBuff(struct nl_client *cl);
229  void InitNetlinkDoneMsg(struct nlmsghdr *nlh, uint32_t seq_num);
230  void DisableReceiveQueue(bool disable);
231 private:
232  void PurgeBlockedMsg();
233  udp::socket sock_;
234  udp::endpoint local_ep_;
239  static vr_flow_entry *flow_table_;
240  vr_bridge_entry *bridge_table_;
241  static int error_code_;
242  // List of nl_client messages to be sent. In case of bulk message, all
243  // responses are initially put into this list and finally NL_MULTI
244  // netlink messages are sent
245  std::vector<struct nl_client> tx_buff_list_;
247 };
248 
250 public:
252  virtual ~MockDumpHandlerBase() {}
253  void SendDumpResponse(uint32_t seq_num, Sandesh *);
254  void SendGetResponse(uint32_t seq_num, int idx);
255  virtual Sandesh* GetFirst(Sandesh *) = 0;
256  virtual Sandesh* GetNext(Sandesh *) = 0;
257  virtual Sandesh* Get(int idx) = 0;
258 };
259 
261 public:
263  virtual Sandesh* GetFirst(Sandesh *);
264  virtual Sandesh* GetNext(Sandesh *);
265  virtual Sandesh* Get(int idx);
266 private:
267  vr_drop_stats_req drop_stats_req;
268 };
269 
271 public:
273  virtual Sandesh* GetFirst(Sandesh *);
274  virtual Sandesh* GetNext(Sandesh *);
275  virtual Sandesh* Get(int idx);
276 };
277 
279 public:
281  virtual Sandesh* GetFirst(Sandesh *);
282  virtual Sandesh* GetNext(Sandesh *);
283  virtual Sandesh* Get(int idx);
284 };
285 
287 public:
289  virtual Sandesh* GetFirst(Sandesh *);
290  virtual Sandesh* GetNext(Sandesh *);
291  virtual Sandesh* Get(int idx);
292 };
293 
295 public:
297  virtual Sandesh* GetFirst(Sandesh *);
298  virtual Sandesh* GetNext(Sandesh *);
299  /* GET operation is not supported for vrf assign */
300  virtual Sandesh* Get(int idx) {
301  return NULL;
302  }
303 };
304 
306 public:
308  virtual Sandesh* GetFirst(Sandesh *);
309  virtual Sandesh* GetNext(Sandesh *);
310  /* GET operation is not supported for route */
311  virtual Sandesh* Get(int idx) {
312  return NULL;
313  }
314 };
315 
317 public:
319  virtual Sandesh* GetFirst(Sandesh *);
320  virtual Sandesh* GetNext(Sandesh *);
321  virtual Sandesh* Get(int idx);
322 };
323 
325 public:
327  virtual Sandesh* GetFirst(Sandesh *);
328  virtual Sandesh* GetNext(Sandesh *);
329  virtual Sandesh* Get(int idx);
330 };
331 
333 public:
335  virtual Sandesh* GetFirst(Sandesh *);
336  virtual Sandesh* GetNext(Sandesh *);
337  virtual Sandesh* Get(int idx);
338 };
339 
341 public:
343  virtual Sandesh* GetFirst(Sandesh *) { return NULL; }
344  virtual Sandesh* GetNext(Sandesh *) { return NULL; }
345  virtual Sandesh* Get(int idx) {
347  return &sock->drop_stats;
348  }
349 };
350 
352 public:
354  virtual Sandesh* GetFirst(Sandesh *) { return NULL;}
355  virtual Sandesh* GetNext(Sandesh *) { return NULL;}
356  virtual Sandesh* Get(int idx) {
358  return &sock->ksync_vrouter_ops;
359  }
360 };
361 
362 
364 public:
365  KSyncUserSockIfContext(uint32_t seq_num, vr_interface_req *req) : KSyncUserSockContext(seq_num) {
366  if (req) {
367  req_ = new vr_interface_req(*req);
368  } else {
369  req_ = NULL;
370  }
371  }
373  if (req_) {
374  delete req_;
375  req_ = NULL;
376  }
377  }
378 
379  virtual void Process();
380 private:
381  vr_interface_req *req_;
382 };
383 
385 public:
386  KSyncUserSockNHContext(uint32_t seq_num, vr_nexthop_req *req) : KSyncUserSockContext(seq_num) {
387  if (req) {
388  req_ = new vr_nexthop_req(*req);
389  } else {
390  req_ = NULL;
391  }
392  }
394  if (req_) {
395  delete req_;
396  req_ = NULL;
397  }
398  }
399 
400  virtual void Process();
401 private:
402  vr_nexthop_req *req_;
403 };
404 
406 public:
407  KSyncUserSockMplsContext(uint32_t seq_num, vr_mpls_req *req) : KSyncUserSockContext(seq_num) {
408  if (req) {
409  req_ = new vr_mpls_req(*req);
410  } else {
411  req_ = NULL;
412  }
413  }
415  if (req_) {
416  delete req_;
417  req_ = NULL;
418  }
419  }
420 
421  virtual void Process();
422 private:
423  vr_mpls_req *req_;
424 };
425 
427 public:
428  KSyncUserSockFlowContext(uint32_t seq_num, vr_flow_req *req) : KSyncUserSockContext(seq_num) {
429  if (req) {
430  req_ = new vr_flow_req(*req);
431  } else {
432  req_ = NULL;
433  }
434  }
436  if (req_) {
437  delete req_;
438  req_ = NULL;
439  }
440  }
441 
442  virtual void Process();
443 private:
444  vr_flow_req *req_;
445 };
446 
448 public:
449  KSyncUserSockRouteContext(uint32_t seq_num, vr_route_req *req) :
450  KSyncUserSockContext(seq_num) {
451  if (req) {
452  /* For delete of AF_BRIDGE entries, we need rtr_index of
453  * vr_route_req to find vr_bridge_entry and reset its flags. The
454  * rtr_index is configured while doing add of AF_BRIDGE entry. When
455  * delete of AF_BRIDGE arrives, we do lookup of vr_route_req from
456  * our tree to figure out the rtr_index */
457  if ((req->get_h_op() == sandesh_op::DEL) &&
458  (req->get_rtr_family() == AF_BRIDGE)) {
460  KSyncSockTypeMap::ksync_rt_tree::iterator it =
461  sock->rt_tree.find(*req);
462  assert (it != sock->rt_tree.end());
463  const vr_route_req &tmp_req = *it;
464  req_ = new vr_route_req(tmp_req);
465  /* Change the operation to DELETE after picking request from
466  * our tree */
467  req_->set_h_op(sandesh_op::DEL);
468  } else {
469  req_ = new vr_route_req(*req);
470  }
471  } else {
472  req_ = NULL;
473  }
474  }
476  if (req_) {
477  delete req_;
478  req_ = NULL;
479  }
480  }
481 
482  virtual void Process();
483 private:
484  vr_route_req *req_;
485 };
486 
488 public:
489  KSyncUserSockVrfAssignContext(uint32_t seq_num, vr_vrf_assign_req *req) :
490  KSyncUserSockContext(seq_num) {
491  if (req) {
492  req_ = new vr_vrf_assign_req(*req);
493  } else {
494  req_ = NULL;
495  }
496  }
498  if (req_) {
499  delete req_;
500  req_ = NULL;
501  }
502  }
503 
504  virtual void Process();
505 private:
506  vr_vrf_assign_req *req_;
507 };
508 
510 public:
511  KSyncUserSockVrfContext(uint32_t seq_num, vr_vrf_req *req) :
512  KSyncUserSockContext(seq_num) {
513  if (req) {
514  req_ = new vr_vrf_req(*req);
515  } else {
516  req_ = NULL;
517  }
518  }
520  if (req_) {
521  delete req_;
522  req_ = NULL;
523  }
524  }
525 
526  virtual void Process();
527 private:
528  vr_vrf_req *req_;
529 };
530 
532 public:
533  KSyncUserSockVrfStatsContext(uint32_t seq_num, vr_vrf_stats_req *req) : KSyncUserSockContext(seq_num) {
534  if (req) {
535  req_ = new vr_vrf_stats_req(*req);
536  } else {
537  req_ = NULL;
538  }
539  }
541  if (req_) {
542  delete req_;
543  req_ = NULL;
544  }
545  }
546 
547  virtual void Process();
548 private:
549  vr_vrf_stats_req *req_;
550 };
551 
553 public:
554  KSyncUserSockVxLanContext(uint32_t seq_num, vr_vxlan_req *req) : KSyncUserSockContext(seq_num) {
555  if (req) {
556  req_ = new vr_vxlan_req(*req);
557  } else {
558  req_ = NULL;
559  }
560  }
562  if (req_) {
563  delete req_;
564  req_ = NULL;
565  }
566  }
567 
568  virtual void Process();
569 private:
570  vr_vxlan_req *req_;
571 };
572 
574 public:
575  KSyncUserSockDropStatsContext(uint32_t seq_num, vr_drop_stats_req *req) : KSyncUserSockContext(seq_num) {
576  if (req) {
577  req_ = new vr_drop_stats_req(*req);
578  } else {
579  req_ = NULL;
580  }
581  }
583  if (req_) {
584  delete req_;
585  req_ = NULL;
586  }
587  }
588 
589  virtual void Process();
590 private:
591  vr_drop_stats_req *req_;
592 };
593 
595 public:
596  KSyncUserVrouterOpsContext(uint32_t seq_num, vrouter_ops *req) :
597  KSyncUserSockContext(seq_num) {
598  if (req) {
599  req_ = new vrouter_ops(*req);
600  } else {
601  req_ = NULL;
602  }
603  }
605  if (req_) {
606  delete req_;
607  req_ = NULL;
608  }
609  }
610 
611  virtual void Process();
612 private:
613  vrouter_ops *req_;
614 };
615 
616 
617 #endif // ctrlplane_ksync_sock_user_h
static int RouteCount()
void SetBlockMsgProcessing(bool enable)
ksync_rt_tree rt_tree
virtual uint32_t GetSeqno(char *data)
virtual Sandesh * GetFirst(Sandesh *)
udp::endpoint local_ep_
virtual Sandesh * Get(int idx)=0
KSyncUserSockFlowContext(uint32_t seq_num, vr_flow_req *req)
virtual ~KSyncUserSockContext()
static void VrfStatsDelete(int vrf_id)
static KSyncSockTypeMap * GetKSyncSockTypeMap()
static int IfCount()
std::vector< struct nl_client > tx_buff_list_
void ProcessSandesh(const uint8_t *, std::size_t, KSyncUserSockContext *)
virtual void RouteMsgHandler(vr_route_req *req)
std::map< int, vr_mirror_req > ksync_map_mirror
KSyncUserSockIfContext(uint32_t seq_num, vr_interface_req *req)
virtual Sandesh * GetFirst(Sandesh *)
std::set< vr_route_req, TestRouteCmp > ksync_rt_tree
static void SetUnderlaySourcePort(int idx, int port)
vr_drop_stats_req drop_stats
virtual Sandesh * GetNext(Sandesh *)
std::queue< KSyncUserSockContext * > ksync_map_ctx_queue
void SendGetResponse(uint32_t seq_num, int idx)
static vr_flow_entry * GetFlowEntry(int idx)
virtual std::size_t SendTo(KSyncBufferList *iovec, uint32_t seq_no)
ksync_map_mirror mirror_map
virtual void VrfMsgHandler(vr_vrf_req *req)
virtual bool BulkDecoder(char *data, KSyncBulkSandeshContext *ctxt)
ksync_map_nh nh_map
static void SetFlowTcpFlags(int idx, uint16_t flags)
static void IfStatsUpdate(int, int, int, int, int, int, int)
KSyncUserSockMplsContext(uint32_t seq_num, vr_mpls_req *req)
virtual Sandesh * Get(int idx)
virtual void Receive(boost::asio::mutable_buffers_1)
virtual Sandesh * GetNext(Sandesh *)
virtual Sandesh * Get(int idx)
KSyncUserSockVxLanContext(uint32_t seq_num, vr_vxlan_req *req)
std::map< int, vr_nexthop_req > ksync_map_nh
ksync_map_vrf_stats vrf_stats_map
virtual Sandesh * GetFirst(Sandesh *)
static void SetDropStats(const vr_drop_stats_req &req)
std::vector< boost::asio::mutable_buffers_1 > KSyncBufferList
Definition: ksync_sock.h:37
virtual Sandesh * GetFirst(Sandesh *)
virtual Sandesh * GetFirst(Sandesh *)
virtual Sandesh * Get(int idx)
virtual void DropStatsMsgHandler(vr_drop_stats_req *req)
static int NHCount()
void AddNetlinkTxBuff(struct nl_client *cl)
virtual Sandesh * GetNext(Sandesh *)
vr_bridge_entry * GetBridgeEntry(int idx)
static void SetVRouterOps(const vrouter_ops &req)
void SetKSyncError(KSyncSockEntryType type, int ksync_error)
KSyncUserVrouterOpsContext(uint32_t seq_num, vrouter_ops *req)
static void Shutdown()
static void FlowMmapFree()
static void VxlanAdd(int id)
virtual Sandesh * GetFirst(Sandesh *)
ksync_map_vrf vrf_map
DISALLOW_COPY_AND_ASSIGN(KSyncSockTypeMap)
tbb::mutex ctx_queue_lock_
virtual Sandesh * GetFirst(Sandesh *)
static void ResetEvictedFlag(int idx)
virtual Sandesh * Get(int idx)
virtual Sandesh * Get(int idx)
std::map< int, vr_mpls_req > ksync_map_mpls
ksync_map_if if_map
virtual Sandesh * GetFirst(Sandesh *)=0
static void MplsDelete(int id)
ksync_map_vxlan vxlan_map
void set_is_incremental_index(bool incremental)
virtual void IfMsgHandler(vr_interface_req *req)
int ksync_error_[KSYNC_MAX_ENTRY_TYPE]
ksync_vrf_assign_tree vrf_assign_tree
static void MirrorAdd(int id)
virtual void Process(SandeshContext *context)
static void IfDumpResponse(uint32_t)
virtual void VrfStatsMsgHandler(vr_vrf_stats_req *req)
uint8_t type
Definition: load_balance.h:109
static void IfNetlinkMsgSend(uint32_t seq_num, ksync_map_if::const_iterator it)
static int MplsCount()
static void InterfaceDelete(int id)
static void VrfStatsAdd(int vrf_id)
static void VrfAssignAdd(vr_vrf_assign_req &req)
static void MirrorDelete(int id)
virtual Sandesh * GetFirst(Sandesh *)
virtual Sandesh * GetNext(Sandesh *)
static void set_error_code(int code)
boost::function< void(const boost::system::error_code &, size_t)> HandlerCb
Definition: ksync_sock.h:328
virtual Sandesh * GetNext(Sandesh *)
int GetKSyncError(KSyncSockEntryType type)
static void SetTcpFlag(int idx, uint32_t flags)
virtual Sandesh * GetNext(Sandesh *)
KSyncUserSockVrfStatsContext(uint32_t seq_num, vr_vrf_stats_req *req)
void UpdateBridgeEntryInactiveFlag(int idx, bool set)
vr_bridge_entry * BridgeMmapAlloc(int size)
KSyncUserSockVrfContext(uint32_t seq_num, vr_vrf_req *req)
virtual void VxLanMsgHandler(vr_vxlan_req *req)
static void IfStatsSet(int, int, int, int, int, int, int)
virtual Sandesh * GetNext(Sandesh *)
virtual void Process()
static void FlowNatResponse(uint32_t seq_num, vr_flow_req *req, int code=0)
ksync_map_flow flow_map
ksync_map_mpls mpls_map
static void Init(boost::asio::io_context &ios)
static int VxLanCount()
bool operator()(const vr_route_req &lhs, const vr_route_req &rhs) const
virtual bool Validate(char *data)
static void RouteDelete(vr_route_req &req)
static void VrfAdd(vr_vrf_req &req)
virtual void FlowMsgHandler(vr_flow_req *req)
virtual void QosConfigMsgHandler(vr_qos_map_req *req)
virtual bool Decoder(char *data, AgentSandeshContext *ctxt)
virtual void VrfAssignMsgHandler(vr_vrf_assign_req *req)
virtual Sandesh * GetFirst(Sandesh *)
static int error_code()
KSyncUserSockNHContext(uint32_t seq_num, vr_nexthop_req *req)
virtual int VrResponseMsgHandler(vr_response *req)
virtual Sandesh * Get(int idx)
vr_nexthop_req * req_
std::set< vr_vrf_assign_req, TestVrfAssignCmp > ksync_vrf_assign_tree
virtual Sandesh * GetNext(Sandesh *)
static void InterfaceAdd(int id, int flags=0, int mac_size=6)
static void NHDelete(int id)
virtual Sandesh * GetNext(Sandesh *)=0
KSyncUserSockContext(uint32_t num)
static void NHAdd(int id, int flags=0)
void SendDumpResponse(uint32_t seq_num, Sandesh *)
KSyncSockTypeMap(boost::asio::io_context &ios)
static KSyncSockTypeMap * singleton_
static void MplsAdd(int id)
std::map< int, vr_vrf_req > ksync_map_vrf
static void SetFlowEntry(vr_flow_req *req, bool set)
virtual ~MockDumpHandlerBase()
static void VrfDelete(vr_vrf_req &req)
virtual Sandesh * GetFirst(Sandesh *)
virtual bool IsMoreData(char *data)
virtual Sandesh * GetNext(Sandesh *)
static void VrfAssignDelete(vr_vrf_assign_req &req)
std::map< int, vr_vxlan_req > ksync_map_vxlan
void InitNetlinkDoneMsg(struct nlmsghdr *nlh, uint32_t seq_num)
KSyncUserSockVrfAssignContext(uint32_t seq_num, vr_vrf_assign_req *req)
virtual void ForwardingClassMsgHandler(vr_fc_map_req *req)
virtual void NHMsgHandler(vr_nexthop_req *req)
KSyncUserSockRouteContext(uint32_t seq_num, vr_route_req *req)
static vr_flow_entry * FlowMmapAlloc(int size)
void SetBridgeEntry(uint32_t idx, vr_route_req *req, bool set)
static void VrfStatsUpdate(int vrf_id, const vr_vrf_stats_req &req)
virtual Sandesh * Get(int idx)
static void VxlanDelete(int id)
static int error_code_
virtual Sandesh * Get(int idx)
bool operator()(const vr_vrf_assign_req &lhs, const vr_vrf_assign_req &rhs) const
boost::unordered_map< int, vr_flow_req > ksync_map_flow
virtual void MirrorMsgHandler(vr_mirror_req *req)
virtual void MplsMsgHandler(vr_mpls_req *req)
vr_interface_req * req_
virtual Sandesh * GetNext(Sandesh *)
static void IncrFlowStats(int idx, int pkts, int bytes)
static vr_flow_entry * flow_table_
static void SendNetlinkDoneMsg(uint32_t seq_num)
vr_bridge_entry * bridge_table_
void DisableReceiveQueue(bool disable)
virtual Sandesh * GetFirst(Sandesh *)
vr_drop_stats_req drop_stats_req
virtual void AsyncReceive(boost::asio::mutable_buffers_1, HandlerCb)
static void RouteAdd(vr_route_req &req)
static void SetEvictedFlag(int idx)
KSyncUserSockDropStatsContext(uint32_t seq_num, vr_drop_stats_req *req)
vrouter_ops ksync_vrouter_ops
virtual void AsyncSendTo(KSyncBufferList *iovec, uint32_t seq_no, HandlerCb cb)
virtual Sandesh * Get(int idx)
static void SimulateResponse(uint32_t, int, int)
virtual Sandesh * Get(int idx)
std::map< int, vr_vrf_stats_req > ksync_map_vrf_stats
virtual void VrouterOpsMsgHandler(vrouter_ops *req)
virtual Sandesh * GetNext(Sandesh *)
std::map< int, vr_interface_req > ksync_map_if
virtual Sandesh * Get(int idx)
ksync_map_ctx_queue ctx_queue_
static void SetOFlowStats(int idx, uint8_t pkts, uint16_t bytes)