OpenSDN source code
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
agent_sandesh.cc
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
3  */
4 
5 #include <cmn/agent_cmn.h>
6 
7 #include <vnc_cfg_types.h>
8 #include <agent_types.h>
9 
10 #include <oper/peer.h>
11 #include <oper/vrf.h>
12 #include <oper/interface_common.h>
13 #include <oper/health_check.h>
14 #include <oper/nexthop.h>
15 #include <oper/vn.h>
16 #include <oper/vm.h>
17 #include <oper/mirror_table.h>
18 #include <oper/vxlan.h>
19 #include <oper/service_instance.h>
20 #include <filter/acl.h>
21 #include <oper/mpls.h>
22 #include <oper/route_common.h>
23 #include <oper/sg.h>
24 #include <oper/agent_sandesh.h>
25 #include <oper/vrf_assign.h>
26 #include <oper/forwarding_class.h>
27 #include <oper/qos_config.h>
28 #include <oper/qos_queue.h>
29 #include <oper/bridge_domain.h>
30 #include <oper/tag.h>
32 #include <filter/acl.h>
33 #include <filter/policy_set.h>
34 #include <oper/crypt_tunnel.h>
35 #include <oper/multicast_policy.h>
36 
38 // Utility routines
40 static bool MatchSubString(const string &str, const string &sub_str) {
41  if (sub_str.empty())
42  return true;
43 
44  return (str.find(sub_str) != string::npos);
45 }
46 
47 AgentVnSandesh::AgentVnSandesh(const std::string &context,
48  const std::string &name,
49  const std::string &u,
50  const std::string &vxlan_id,
51  const std::string &ipam_name) :
52  AgentSandesh(context, ""), name_(name), uuid_str_(u),
53  vxlan_id_(vxlan_id), ipam_name_(ipam_name) {
54 
55  boost::system::error_code ec;
56  uuid_ = StringToUuid(u);
57 }
58 
59 static bool MatchUuid(const string &uuid_str, const boost::uuids::uuid &u,
60  const boost::uuids::uuid val) {
61  if (uuid_str.empty())
62  return true;
63  return u == val;
64 }
65 
67 // Sandesh routines per DBTable
70  return static_cast<DBTable *>(Agent::GetInstance()->vn_table());
71 }
72 
74  resp_ = new VnListResp();
75 }
76 
77 bool AgentVnSandesh::Filter(const DBEntryBase *entry) {
78  const VnEntry *vn = dynamic_cast<const VnEntry *>(entry);
79  assert(vn);
80 
81  if (MatchSubString(vn->GetName(), name_) == false)
82  return false;
83 
84  if (MatchUuid(uuid_str_ , uuid_, vn->GetUuid()) == false)
85  return false;
86 
87  if (vxlan_id_.empty() == false) {
88  if (((vn->GetVxLanId()) == boost::lexical_cast<int>(vxlan_id_)) == false) {
89  return false;
90  }
91  }
92 
93  const std::vector<VnIpam> VnIpams = vn->GetVnIpam();
94  std::vector<VnIpam>::const_iterator pos;
95  bool ipam_flag = true;
96  if (VnIpams.size() == 0) {
97  ipam_flag = false;
98  }
99  for(pos=VnIpams.begin();pos < VnIpams.end();pos++) {
100  if ((MatchSubString(pos->ipam_name , ipam_name_) == true)) {
101  ipam_flag = false;
102  }
103  }
104  if (ipam_flag == true) {
105  return false;
106  }
107 
108  return true;
109 }
110 
112  args->Add("name", name_);
113  args->Add("uuid", uuid_str_);
114  args->Add("vxlan_id", vxlan_id_);
115  args->Add("ipam_name", ipam_name_);
116 
117  return true;
118 }
119 
121  return static_cast<DBTable *>(Agent::GetInstance()->sg_table());
122 }
123 
125  resp_ = new SgListResp();
126 }
127 
129  return static_cast<DBTable *>(Agent::GetInstance()->vm_table());
130 }
131 
133  resp_ = new VmListResp();
134 }
135 
136 AgentIntfSandesh::AgentIntfSandesh(const std::string &context,
137  const std::string &type,
138  const std::string &name,
139  const std::string &u,
140  const std::string &vn,
141  const std::string &mac,
142  const std::string &v4,
143  const std::string &v6,
144  const std::string &parent,
145  const std::string &ip_active,
146  const std::string &ip6_active,
147  const std::string &l2_active) :
148  AgentSandesh(context, ""), type_(type), name_(name), uuid_str_(u),
149  vn_(vn), mac_str_(mac), v4_str_(v4), v6_str_(v6),
150  parent_uuid_str_(parent), ip_active_str_(ip_active),
151  ip6_active_str_(ip6_active), l2_active_str_(l2_active) {
152 
153  boost::system::error_code ec;
154  uuid_ = StringToUuid(u);
155  v4_ = Ip4Address::from_string(v4, ec);
156  v6_ = Ip6Address::from_string(v6, ec);
157  parent_uuid_ = StringToUuid(parent);
158 }
159 
161  return static_cast<DBTable *>(Agent::GetInstance()->interface_table());
162 }
163 
165  resp_ = new ItfResp();
166 }
167 
169  const Interface *intf = dynamic_cast<const Interface *>(entry);
170  assert(intf);
171 
172  if (MatchSubString(intf->name(), name_) == false)
173  return false;
174 
175  if (type_.empty() == false) {
176  if (type_ == "physical" &&
177  (intf->type() != Interface::PHYSICAL &&
178  intf->type() != Interface::REMOTE_PHYSICAL))
179  return false;
180  if (type_ == "logical" && intf->type() != Interface::LOGICAL)
181  return false;
182  if (type_ == "vmi" && intf->type() != Interface::VM_INTERFACE)
183  return false;
184  if (type_ == "inet" && intf->type() != Interface::INET)
185  return false;
186  if (type_ == "pkt" && intf->type() != Interface::PACKET)
187  return false;
188  }
189 
190  if (MatchUuid(uuid_str_, uuid_, intf->GetUuid()) == false)
191  return false;
192 
193  // vn_, mac_str_, v4_str_ or v6_str_ set means get VM-Interfaces only
194  if (vn_.empty() == false || mac_str_.empty() == false ||
195  v4_str_.empty() == false || v6_str_.empty() == false) {
196  if (intf->type() != Interface::VM_INTERFACE)
197  return false;
198  }
199 
200  if (ip_active_str_.empty() == false) {
201  if (ip_active_str_ == "no" || ip_active_str_ == "inactive") {
202  if (intf->ipv4_active())
203  return false;
204  }
205  }
206 
207  if (ip6_active_str_.empty() == false) {
208  if (ip6_active_str_ == "no" || ip6_active_str_ == "inactive") {
209  if (intf->ipv6_active())
210  return false;
211  }
212  }
213 
214  if (l2_active_str_.empty() == false) {
215  if (l2_active_str_ == "no" || l2_active_str_ == "inactive") {
216  if (intf->l2_active())
217  return false;
218  }
219  }
220 
221  const LogicalInterface *li = dynamic_cast<const LogicalInterface *>(entry);
222  if (li) {
223  if (parent_uuid_str_.empty() == false && parent_uuid_.is_nil() == false
224  && li->physical_interface()) {
225  if (li->physical_interface()->GetUuid() != parent_uuid_)
226  return false;
227  }
228 
229  return true;
230  }
231 
232  const VmInterface *vmi = dynamic_cast<const VmInterface *>(entry);
233  if (vmi == NULL)
234  return true;
235 
236  if (vn_.empty() == false && vmi->vn()) {
237  if (MatchSubString(vmi->vn()->GetName(), vn_) == false)
238  return false;
239  }
240 
241  if (MatchSubString(vmi->vm_mac().ToString(), mac_str_) == false)
242  return false;
243 
244  if (v4_str_.empty() == false) {
245  if (v4_ != vmi->primary_ip_addr()) {
246  return false;
247  }
248  }
249 
250  if (v6_str_.empty() == false) {
251  if (v6_ != vmi->primary_ip6_addr()) {
252  return false;
253  }
254  }
255 
256  return true;
257 }
258 
260  args->Add("type", type_);
261  args->Add("name", name_);
262  args->Add("uuid", uuid_str_);
263  args->Add("vn", vn_);
264  args->Add("mac", mac_str_);
265  args->Add("ipv4", v4_str_);
266  args->Add("ipv6", v6_str_);
267  args->Add("parent", parent_uuid_str_);
268  args->Add("ip-active", ip_active_str_);
269  args->Add("ip6-active", ip6_active_str_);
270  args->Add("l2-active", l2_active_str_);
271  return true;
272 }
273 
275  return static_cast<DBTable *>(Agent::GetInstance()->nexthop_table());
276 }
277 
279  resp_ = new NhListResp();
280 }
281 
282 AgentNhSandesh::AgentNhSandesh(const std::string &context,
283  const std::string &type,
284  const std::string &nh_index,
285  const std::string &policy_enabled) :
286  AgentSandesh(context, ""), type_(type), nh_index_(nh_index),
287  policy_enabled_(policy_enabled) {
288 
289 }
290 
292  const NextHop *nh = dynamic_cast<const NextHop *>(entry);
293  assert(nh);
294 
295  if (type_.empty() == false) {
296  NextHop::Type nh_type = nh->GetType();
297  if (type_ == "invalid" &&
298  (nh_type != NextHop::INVALID))
299  return false;
300  if (type_ == "discard" &&
301  (nh_type != NextHop::DISCARD))
302  return false;
303  if (type_ == "l2-receive" &&
304  (nh_type != NextHop::L2_RECEIVE))
305  return false;
306  if (type_ == "receive" &&
307  (nh_type != NextHop::RECEIVE))
308  return false;
309  if (type_ == "resolve" &&
310  (nh_type != NextHop::RESOLVE))
311  return false;
312  if (type_ == "arp" &&
313  (nh_type != NextHop::ARP))
314  return false;
315  if (type_ == "vrf" &&
316  (nh_type != NextHop::VRF))
317  return false;
318  if (type_ == "interface" &&
319  (nh_type != NextHop::INTERFACE))
320  return false;
321  if (type_ == "tunnel" &&
322  (nh_type != NextHop::TUNNEL))
323  return false;
324  if (type_ == "mirror" &&
325  (nh_type != NextHop::MIRROR))
326  return false;
327  if (type_ == "composite" &&
328  (nh_type != NextHop::COMPOSITE))
329  return false;
330  if (type_ == "vlan" &&
331  (nh_type != NextHop::VLAN))
332  return false;
333 
334  }
335 
336  if (policy_enabled_.empty() == false) {
337  bool policy_flag = true;
338  if (MatchSubString("enabled", policy_enabled_) == false) {
339  policy_flag = false;
340  }
341  if (policy_flag != nh->PolicyEnabled()) {
342  return false;
343  }
344  }
345  if (nh_index_.empty() == false) {
346  if (((nh->id()) == boost::lexical_cast<uint32_t>(nh_index_)) == false)
347  return false;
348  }
349  return true;
350 
351  }
352 
354  args->Add("type", type_);
355  args->Add("nh_index", nh_index_);
356  args->Add("policy_enabled", policy_enabled_);
357  return true;
358 }
359 
361  return static_cast<DBTable *>(Agent::GetInstance()->mpls_table());
362 }
363 
365  resp_ = new MplsResp();
366 }
367 
368 AgentMplsSandesh::AgentMplsSandesh(const std::string &context,
369  const std::string &type,
370  const std::string &label) :
371  AgentSandesh(context, ""), type_(type), label_(label) {
372 
373 }
374 
376  const MplsLabel *mplsl = dynamic_cast<const MplsLabel *>(entry);
377  assert(mplsl);
378 
379  if (label_.empty() == false) {
380  if (((mplsl->label()) == boost::lexical_cast<uint32_t>(label_)) == false)
381  return false;
382  NextHop::Type nh_type = mplsl->nexthop()->GetType();
383  if (type_ == "invalid" &&
384  (nh_type != NextHop::INVALID))
385  return false;
386  if (type_ == "interface" &&
387  (nh_type != NextHop::INTERFACE))
388  return false;
389  if (type_ == "vlan" &&
390  (nh_type != NextHop::VLAN))
391  return false;
392  if (type_ == "vrf" &&
393  (nh_type != NextHop::VRF))
394  return false;
395  if (type_ == "composite" &&
396  (nh_type != NextHop::COMPOSITE))
397  return false;
398  }
399  return true;
400 }
401 
403  args->Add("type", type_);
404  args->Add("label", label_);
405  return true;
406 }
407 
409  return static_cast<DBTable *>(Agent::GetInstance()->vrf_table());
410 }
411 
413  resp_ = new VrfListResp();
414 }
415 
417  return static_cast<DBTable *>(vrf_->GetInet4UnicastRouteTable());
418 }
419 
421  resp_ = new Inet4UcRouteResp();
422 }
423 
425  InetUnicastRouteEntry *rt = static_cast<InetUnicastRouteEntry *>(entry);
426  if (dump_table_) {
427  return rt->DBEntrySandesh(resp_, stale_);
428  }
429  return rt->DBEntrySandesh(resp_, addr_, plen_, stale_);
430 }
431 
433  return static_cast<DBTable *>(vrf_->GetInet4MplsUnicastRouteTable());
434 }
435 
437  resp_ = new Inet4MplsUcRouteResp();
438 }
439 
441  InetUnicastRouteEntry *rt = static_cast<InetUnicastRouteEntry *>(entry);
442  if (dump_table_) {
443  return rt->DBEntrySandesh(resp_, stale_);
444  }
445  return rt->DBEntrySandesh(resp_, addr_, plen_, stale_);
446 }
447 
449  return static_cast<DBTable *>(vrf_->GetInet6UnicastRouteTable());
450 }
451 
453  resp_ = new Inet6UcRouteResp();
454 }
455 
457  InetUnicastRouteEntry *rt = static_cast<InetUnicastRouteEntry *>(entry);
458  if (dump_table_) {
459  return rt->DBEntrySandesh(resp_, stale_);
460  }
461  return rt->DBEntrySandesh(resp_, addr_, plen_, stale_);
462 }
463 
465  return static_cast<DBTable *>(vrf_->GetInet4MulticastRouteTable());
466 }
467 
469  resp_ = new Inet4McRouteResp();
470 }
471 
473  Inet4MulticastRouteEntry *rt = static_cast<Inet4MulticastRouteEntry *>(entry);
474  if (dump_table_) {
475  return rt->DBEntrySandesh(resp_, stale_);
476  }
478 }
479 
481  return static_cast<DBTable *>(vrf_->GetEvpnRouteTable());
482 }
483 
485  resp_ = new EvpnRouteResp();
486 }
487 
489  AgentRoute *rt = static_cast<AgentRoute *>(entry);
490  return rt->DBEntrySandesh(resp_, stale_);
491 }
492 
494  return static_cast<DBTable *>(vrf_->GetBridgeRouteTable());
495 }
496 
498  resp_ = new Layer2RouteResp();
499 }
500 
502  AgentRoute *rt = static_cast<AgentRoute *>(entry);
503  return rt->DBEntrySandesh(resp_, stale_);
504 }
505 
507  return static_cast<DBTable *>(vrf_->GetBridgeRouteTable());
508 }
509 
511  resp_ = new BridgeRouteResp();
512 }
513 
515  BridgeRouteEntry *rt = static_cast<BridgeRouteEntry *>(entry);
516  assert(rt);
517  if (MatchSubString(rt->prefix_address().ToString(), mac_) == false)
518  return false;
519 
520  return rt->DBEntrySandesh(resp_, stale_);
521 }
522 
524  return static_cast<DBTable *>(Agent::GetInstance()->acl_table());
525 }
526 
528  resp_ = new AclResp();
529 }
530 
532  AclDBEntry *ent = static_cast<AclDBEntry *>(entry);
533  return ent->DBEntrySandesh(resp_, name_);
534 }
535 
537  return static_cast<DBTable *>(Agent::GetInstance()->mirror_table());
538 }
539 
541  resp_ = new MirrorEntryResp();
542 }
543 
544 AgentMirrorSandesh::AgentMirrorSandesh(const std::string &context,
545  const std::string &analyzer_name) :
546  AgentSandesh(context, ""), analyzer_name_(analyzer_name) {
547 
548 }
549 
551  const MirrorEntry *mrentry = dynamic_cast<const MirrorEntry *>(entry);
552  assert(mrentry);
553 
554  if (MatchSubString(mrentry->GetAnalyzerName(), analyzer_name_) == false) {
555  return false;
556  }
557 
558  return true;
559 }
560 
562  args->Add("analyzer_name", analyzer_name_);
563 
564  return true;
565 }
566 
568  return static_cast<DBTable *>(Agent::GetInstance()->vrf_assign_table());
569 }
570 
572  resp_ = new VrfAssignResp();
573 }
574 
576  return static_cast<DBTable *>(Agent::GetInstance()->vxlan_table());
577 }
578 
580  resp_ = new VxLanResp();
581 }
582 
583 AgentVxLanSandesh::AgentVxLanSandesh(const std::string &context,
584  const std::string &vxlan_id):
585  AgentSandesh(context, ""), vxlan_id_(vxlan_id) {
586 
587 }
588 
590  const VxLanId *identry = dynamic_cast<const VxLanId *>(entry);
591  assert(identry);
592 
593  if (vxlan_id_.empty() == false) {
594  if (((identry->vxlan_id()) == boost::lexical_cast<uint32_t>(vxlan_id_)) == false) {
595  return false;
596  }
597  }
598 
599  return true;
600 }
601 
603  args->Add("vxlan_id", vxlan_id_);
604 
605  return true;
606 }
607 
609  return static_cast<DBTable *>(Agent::GetInstance()->service_instance_table());
610 }
611 
613  resp_ = new ServiceInstanceResp();
614 }
615 
617 // Routines to manage arguments
619 bool AgentSandeshArguments::Add(const std::string &key, const std::string &val){
620  if (val.empty())
621  return true;
622  ArgumentMap::iterator it = arguments_.find(key);
623  if (it != arguments_.end()) {
624  it->second = val;
625  return false;
626  }
627 
628  arguments_.insert(make_pair(key, val));
629  return true;
630 }
631 
632 bool AgentSandeshArguments::Add(const std::string &key, int val) {
633  std::stringstream ss;
634  ss << val;
635  ArgumentMap::iterator it = arguments_.find(key);
636  if (it != arguments_.end()) {
637  it->second = ss.str();
638  return false;
639  }
640 
641  arguments_.insert(make_pair(key, ss.str()));
642  return true;
643 }
644 
645 bool AgentSandeshArguments::Del(const std::string &key) {
646  ArgumentMap::iterator it = arguments_.find(key);
647  if (it != arguments_.end()) {
648  arguments_.erase(it);
649  return true;
650  }
651 
652  return false;
653 }
654 
655 bool AgentSandeshArguments::Get(const std::string &key, std::string *val) const{
656  ArgumentMap::const_iterator it = arguments_.find(key);
657  if (it == arguments_.end()) {
658  *val = "INVALID";
659  return false;
660  }
661  *val = it->second;
662  return true;
663 }
664 
665 string AgentSandeshArguments::GetString(const std::string &key) const {
666  ArgumentMap::const_iterator it = arguments_.find(key);
667  if (it == arguments_.end()) {
668  return "";
669  }
670  return it->second;
671 }
672 
673 bool AgentSandeshArguments::Get(const std::string &key, int *val) const {
674  ArgumentMap::const_iterator it = arguments_.find(key);
675  if (it == arguments_.end()) {
676  *val = -1;
677  return false;
678  }
679  *val = strtoul(it->second.c_str(), NULL, 0);
680  return true;
681 }
682 
683 int AgentSandeshArguments::GetInt(const std::string &key) const {
684  ArgumentMap::const_iterator it = arguments_.find(key);
685  if (it == arguments_.end()) {
686  return -1;
687  }
688  return (strtoul(it->second.c_str(), NULL, 0));
689 }
690 
691 int AgentSandeshArguments::Encode(std::string *str) {
692  ArgumentMap::iterator it = arguments_.begin();
693  while (it != arguments_.end()) {
694  *str += it->first + ':' + it->second;
695  it++;
696  if (it != arguments_.end())
697  *str += ",";
698  }
699  return arguments_.size();
700 }
701 
702 static int Split(const string &s, char delim, vector<string> &tokens) {
703  std::stringstream ss(s);
704  string item;
705  int count = 0;
706  while(getline(ss, item, delim)) {
707  tokens.push_back(item);
708  count++;
709  }
710 
711  return count;
712 }
713 
714 int AgentSandeshArguments::Decode(const std::string &str) {
715  vector<string> token_list;
716  int count = Split(str, ',', token_list);
717 
718  for (vector<string>::iterator it = token_list.begin();
719  it != token_list.end(); ++it) {
720  vector<string> args;
721  if (Split((*it), ':', args) < 2) {
722  return 0;
723  }
724  string val = (*it).substr(args[0].length() + 1);
725  Add(args[0], val);
726  }
727 
728  return count;
729 }
730 
732 // AgentSandesh Utilities
734 static int ComputeFirst(int first, int len) {
735  if (first < 0 || first > len)
736  return 0;
737 
738  return first;
739 }
740 
741 static int ComputeLast(int first, int last, int len) {
742  if (last < 0)
743  return -1;
744 
745  if (last >= len)
746  return first + AgentSandesh::kEntriesPerPage - 1;
747 
748  if (last < first)
749  return first + AgentSandesh::kEntriesPerPage - 1;
750 
751  return last;
752 }
753 
754 static int ComputePageSize(int first, int last) {
755  if (first < 0 || last < 0)
757 
758  if (last <= first)
760  return (last - first + 1);
761 }
762 
763 void SandeshError(DBTable *table, const std::string &msg,
764  const std::string &context) {
765  ErrorResp *resp = new ErrorResp();
766 
767  if (table) {
768  std::stringstream s;
769  s << table->name() << ":" << msg;
770  resp->set_resp(s.str());
771  } else {
772  resp->set_resp(msg);
773  }
774  resp->set_context(context);
775  resp->Response();
776  return;
777 }
778 
779 static void EncodeOne(string *s, DBTable *table, int begin, int end,
780  AgentSandeshArguments *filter) {
781  *s = "";
783  args.Add("table", table->name());
784  args.Add("begin", begin);
785  args.Add("end", end);
786  args.Encode(s);
787 
788  if (filter) {
789  *s += ",";
790  filter->Del("table");
791  filter->Del("begin");
792  filter->Del("end");
793  filter->Encode(s);
794  }
795 }
796 
797 void PageReq::HandleRequest() const {
799  agent->oper_db()->agent_sandesh_manager()->AddPageRequest(key, context());
800  return;
801 }
802 
804 // AgentSandeshManager routines
807  agent_(agent),
808  page_request_queue_(TaskScheduler::GetInstance()->GetTaskId(AGENT_SANDESH_TASKNAME),
809  0, boost::bind(&AgentSandeshManager::Run, this, _1)) {
810  page_request_queue_.set_name("Introspect page request");
811 }
812 
814 }
815 
817 }
818 
820  page_request_queue_.Shutdown();
821 }
822 
823 void AgentSandeshManager::AddPageRequest(const string &key,
824  const string &context) {
825  page_request_queue_.Enqueue(PageRequest(key, context));
826 }
827 
830  args.Decode(req.key_);
831 
832  string table_name;
833  int first = 0;
834  int last = 0;
835  if (args.Get("table", &table_name) == false ||
836  args.Get("begin", &first) == false ||
837  args.Get("end", &last) == false) {
838  SandeshError(NULL, "Invalid request", req.context_);
839  return true;
840  }
841 
842  DBTable *table = static_cast<DBTable *>
843  (Agent::GetInstance()->db()->FindTable(table_name));
844  if (table == NULL) {
845  SandeshError(NULL, "Invalid DBTable", req.context_);
846  return true;
847  }
848 
849  AgentDBTable *agent_table = dynamic_cast<AgentDBTable *>(table);
850  if (agent_table) {
851  AgentSandeshPtr sandesh = agent_table->GetAgentSandesh(&args,
852  req.context_);
853  if (sandesh) {
854  sandesh->DoSandesh(sandesh, first, last);
855  } else {
856  SandeshError(table, "Pagination not supported", req.context_);
857  }
858  return true;
859  }
860 
861  AgentRouteTable *route_table = dynamic_cast<AgentRouteTable *>(table);
862  if (route_table) {
863  AgentSandeshPtr sandesh = route_table->GetAgentSandesh(&args,
864  req.context_);
865  if (sandesh) {
866  sandesh->DoSandesh(sandesh, first, last);
867  } else {
868  SandeshError(table, "Pagination not supported", req.context_);
869  }
870  return true;
871  }
872 
873  SandeshError(table, "Pagination not supported", req.context_);
874  return true;
875 }
876 
878 // AgentSandesh routines
880 void AgentSandesh::MakeSandeshPageReq(PageReqData *req, DBTable *table,
881  int first, int count, int match_count,
882  int table_size, int page_size) {
883  AgentSandeshArguments filter;
884 
885  FilterToArgs(&filter);
886 
887  // Set table-size
888  int len = table->Size();
889  req->set_table_size(len);
890 
891  // Set entries
892  int last = first + count - 1;
893  std::stringstream entries_ss;
894  if (match_count >= 0) {
895  if (count == 0) {
896  entries_ss << " 0 / " << match_count;
897  } else {
898  entries_ss << first << "-" << last << "/" << match_count;
899  }
900  } else {
901  entries_ss << first << "-" << last;
902  }
903  req->set_entries(entries_ss.str());
904 
905  // Next-Page link
906  int next_page_first = last + 1;
907  int next_page_last = next_page_first + page_size - 1;
908  if (match_count >= 0 && next_page_last > match_count) {
909  next_page_last = match_count - 1;
910  }
911 
912  if (next_page_last >= table_size) {
913  next_page_last = table_size - 1;
914  }
915 
916  if ((match_count >= 0 && next_page_first < match_count) ||
917  (match_count < 0 && next_page_first < table_size)) {
918  string s;
919  EncodeOne(&s, table, next_page_first, next_page_last, &filter);
920  req->set_next_page(s);
921  }
922 
923  // Prev-Page link
924  if (first > 0) {
925  int prev_page_first;
926  if (page_size < AgentSandesh::kEntriesPerPage) {
927  prev_page_first = first - AgentSandesh::kEntriesPerPage;
928  } else {
929  prev_page_first = first - page_size;
930  }
931 
932  if (prev_page_first < 0)
933  prev_page_first = 0;
934 
935  int prev_page_last;
936 
937  if (page_size < AgentSandesh::kEntriesPerPage) {
938  prev_page_last = prev_page_first + AgentSandesh::kEntriesPerPage;
939  } else {
940  prev_page_last = prev_page_first + page_size;
941  }
942 
943  if (prev_page_last >= first)
944  prev_page_last = first - 1;
945  string s;
946  EncodeOne(&s, table, prev_page_first, prev_page_last, &filter);
947  req->set_prev_page(s);
948  }
949 
950  // First-Page link
951  string s;
952  if ((len - AgentSandesh::kEntriesPerPage) >= 0) {
953  EncodeOne(&s, table, 0, (AgentSandesh::kEntriesPerPage - 1), &filter);
954  } else {
955  EncodeOne(&s, table, 0, (page_size - 1), &filter);
956  }
957 
958  req->set_first_page(s);
959 
960  // All-Page link
961  s = "";
962  EncodeOne(&s, table, -1, -1, &filter);
963  req->set_all(s);
964 }
965 
967  int last) {
968  DBTable *table = AgentGetTable();
969  DBTablePartition *part = static_cast<DBTablePartition *>
970  (table->GetTablePartition(0));
971 
972  if (table == NULL || part == NULL) {
973  SandeshError(table, "Invalid DBTable name", context_);
974  return;
975  }
976 
977  int len = (int)table->Size();
978  int page_size = ComputePageSize(first, last);
979  first = ComputeFirst(first, len);
980  last = ComputeLast(first, last, len);
981 
982  SetResp();
983  DBTable::DBTableWalkRef walk_ref = table->AllocWalker(
984  boost::bind(&AgentSandesh::EntrySandesh, this, _2, first, last),
985  boost::bind(&AgentSandesh::SandeshDone, this, sandesh, first,
986  page_size, _1, _2));
987  table->WalkAgain(walk_ref);
988 }
989 
990 void AgentSandesh::DoSandesh(AgentSandeshPtr sandesh, int first, int last) {
991  sandesh->DoSandeshInternal(sandesh, first, last);
992 }
993 
995  DoSandesh(sandesh, 0, (kEntriesPerPage - 1));
996 }
997 
999  Alloc();
1001 }
1002 
1004  AgentDBEntry *ent = static_cast<AgentDBEntry *>(entry);
1005  return ent->DBEntrySandesh(resp_, name_);
1006 }
1007 
1008 bool AgentSandesh::EntrySandesh(DBEntryBase *entry, int first, int last) {
1009  if (Filter(entry) == false)
1010  return true;
1011 
1012  if (total_entries_ >= first && ((last < 0) || (total_entries_ <= last))) {
1013  if (!UpdateResp(entry)) {
1014  return true;
1015  }
1016  count_++;
1017 
1018  if ((count_ % entries_per_sandesh) == 0) {
1019  // send partial sandesh
1020  resp_->set_more(true);
1021  resp_->Response();
1022  SetResp();
1023  }
1024  }
1025  total_entries_++;
1026 
1027  return true;
1028 }
1029 
1030 void AgentSandesh::SandeshDone(AgentSandeshPtr ptr, int first, int page_size,
1031  DBTable::DBTableWalkRef walk_ref,
1032  DBTableBase *partition) {
1033  (static_cast<DBTable *>(partition))->ReleaseWalker(walk_ref);
1034  resp_->set_more(true);
1035  resp_->Response();
1036 
1037  Pagination *page = new Pagination();
1038  resp_ = page;
1040 
1041  DBTable *table = AgentGetTable();
1042  PageReqData req;
1043  MakeSandeshPageReq(&req, table, first, count_, total_entries_,
1044  table->Size(), page_size);
1045  page->set_req(req);
1046  resp_->Response();
1047 }
1048 
1049 void AgentInitStateReq::HandleRequest() const {
1050  AgentInitState *resp = new AgentInitState();
1051  resp->set_context(context());
1052  Agent *agent = Agent::GetInstance();
1053  if (agent->init_done()) {
1054  resp->set_state("InitDone");
1055  } else {
1056  resp->set_state("InProgress");
1057  }
1058  resp->Response();
1059 }
1060 
1061 void VrouterObjectLimitsReq::HandleRequest() const {
1062  VrouterObjectLimitsResp *resp = new VrouterObjectLimitsResp();
1063  resp->set_context(context());
1064 
1065  Agent *agent = Agent::GetInstance();
1066 
1067  VrouterObjectLimits vr_limits = agent->GetVrouterObjectLimits();
1068  resp->set_vrouter_object_limit(vr_limits);
1069  resp->Response();
1070 }
1071 
1073  const std::string &u) :
1074  AgentSandesh(context, ""), uuid_str_(u) {
1075  boost::system::error_code ec;
1076  uuid_ = StringToUuid(u);
1077 }
1078 
1080  return static_cast<DBTable *>(Agent::GetInstance()->health_check_table());
1081 }
1082 
1084  resp_ = new HealthCheckSandeshResp();
1085 }
1086 
1088  const HealthCheckService *service =
1089  dynamic_cast<const HealthCheckService *>(entry);
1090  assert(service);
1091 
1092  if (MatchUuid(uuid_str_ , uuid_, service->uuid()) == false)
1093  return false;
1094 
1095  return true;
1096 }
1097 
1099  args->Add("uuid", uuid_str_);
1100  return true;
1101 }
1102 
1104  const std::string &u,
1105  const std::string &name,
1106  const std::string &id) :
1107  AgentSandesh(context, ""), uuid_(u), name_(name), id_(id) {
1108 }
1109 
1111  return static_cast<DBTable *>(Agent::GetInstance()->qos_config_table());
1112 }
1113 
1115  resp_ = new AgentQosConfigSandeshResp();
1116 }
1117 
1119  const AgentQosConfig *qos =
1120  dynamic_cast<const AgentQosConfig *>(entry);
1121  assert(qos);
1122 
1123  if (uuid_.empty() && name_.empty() && id_.empty()) {
1124  return true;
1125  }
1126 
1127  if (id_.empty() == false) {
1128  uint32_t id;
1129  stringToInteger(id_, id);
1130  if (qos->id() != id) {
1131  return false;
1132  }
1133  }
1134 
1135  if (name_.empty() == false &&
1136  qos->name() != name_) {
1137  return false;
1138  }
1139 
1140  if (uuid_.empty() == false && qos->uuid() != StringToUuid(uuid_)) {
1141  return false;
1142  }
1143 
1144  return true;
1145 }
1146 
1148  args->Add("uuid", uuid_);
1149  args->Add("id", id_);
1150  args->Add("name", name_);
1151  return true;
1152 }
1153 
1155  const std::string &u,
1156  const std::string &name,
1157  const std::string &id) :
1158  AgentSandesh(context, ""), uuid_(u), name_(name), id_(id) {
1159 }
1160 
1162  return static_cast<DBTable *>(Agent::GetInstance()->forwarding_class_table());
1163 }
1164 
1166  resp_ = new ForwardingClassSandeshResp();
1167 }
1168 
1170  const ForwardingClass *fc =
1171  dynamic_cast<const ForwardingClass *>(entry);
1172  assert(fc);
1173 
1174  if (uuid_.empty() && name_.empty() && id_.empty()) {
1175  return true;
1176  }
1177 
1178  if (id_.empty() == false) {
1179  uint32_t id;
1180  stringToInteger(id_, id);
1181  if (fc->id() != id) {
1182  return false;
1183  }
1184  }
1185 
1186  if (name_.empty() == false &&
1187  fc->name() != name_) {
1188  return false;
1189  }
1190 
1191  if (uuid_.empty() == false && fc->uuid() != StringToUuid(uuid_)) {
1192  return false;
1193  }
1194 
1195  return true;
1196 }
1197 
1199  args->Add("uuid", uuid_);
1200  args->Add("id", id_);
1201  args->Add("name", name_);
1202  return true;
1203 }
1204 
1205 QosQueueSandesh::QosQueueSandesh(const std::string &context,
1206  const std::string &u,
1207  const std::string &name,
1208  const std::string &id) :
1209  AgentSandesh(context, ""), uuid_(u), name_(name), id_(id) {
1210 }
1211 
1213  return static_cast<DBTable *>(Agent::GetInstance()->qos_queue_table());
1214 }
1215 
1217  resp_ = new QosQueueSandeshResp();
1218 }
1219 
1221  const QosQueue *qos_queue = dynamic_cast<const QosQueue *>(entry);
1222  assert(qos_queue);
1223 
1224  if (uuid_.empty() && name_.empty() && id_.empty()) {
1225  return true;
1226  }
1227 
1228  if (id_.empty() == false) {
1229  uint32_t id;
1230  stringToInteger(id_, id);
1231  if (qos_queue->id() != id) {
1232  return false;
1233  }
1234  }
1235 
1236  if (name_.empty() == false &&
1237  qos_queue->name() != name_) {
1238  return false;
1239  }
1240 
1241  if (uuid_.empty() == false && qos_queue->uuid() != StringToUuid(uuid_)) {
1242  return false;
1243  }
1244 
1245  return true;
1246 }
1247 
1249  args->Add("uuid", uuid_);
1250  args->Add("name", name_);
1251  args->Add("id", id_);
1252  return true;
1253 }
1254 
1255 BridgeDomainSandesh::BridgeDomainSandesh(const std::string &context,
1256  const std::string &u,
1257  const std::string &name) :
1258  AgentSandesh(context, ""), uuid_str_(u), name_(name) {
1259  boost::system::error_code ec;
1260  uuid_ = StringToUuid(u);
1261 }
1262 
1264  return static_cast<DBTable *>(Agent::GetInstance()->bridge_domain_table());
1265 }
1266 
1268  resp_ = new BridgeDomainSandeshResp();
1269 }
1270 
1272  const BridgeDomainEntry *bd =
1273  dynamic_cast<const BridgeDomainEntry *>(entry);
1274  assert(bd);
1275 
1276  if (MatchUuid(uuid_str_ , uuid_, bd->uuid()) == false)
1277  return false;
1278 
1279  if (name_.empty() == false &&
1280  bd->name() != name_) {
1281  return false;
1282  }
1283 
1284  return true;
1285 }
1286 
1288  args->Add("uuid", uuid_str_);
1289  args->Add("name", name_);
1290  return true;
1291 }
1292 
1294  return static_cast<DBTable *>(Agent::GetInstance()->policy_set_table());
1295 }
1296 
1298  const std::string &u,
1299  const std::string &name) :
1300  AgentSandesh(context, ""), uuid_str_(u), name_(name) {
1301  boost::system::error_code ec;
1302  uuid_ = StringToUuid(u);
1303 }
1304 
1306  resp_ = new ApplicationPolicySetResp();
1307 }
1308 
1310  PolicySet *ent = static_cast<PolicySet *>(entry);
1311  return ent->DBEntrySandesh(resp_, name_);
1312 }
1313 
1315  args->Add("uuid", uuid_str_);
1316  args->Add("name", name_);
1317  return true;
1318 }
1319 
1321  const PolicySet *ps =
1322  dynamic_cast<const PolicySet *>(entry);
1323  assert(ps);
1324 
1325  if (MatchUuid(uuid_str_ , uuid_, ps->uuid()) == false) {
1326  return false;
1327  }
1328 
1329  if (name_.empty() == false &&
1330  ps->name() != name_) {
1331  return false;
1332  }
1333 
1334  return true;
1335 }
1336 
1337 TagSandesh::TagSandesh(const std::string &context,
1338  const std::string &u,
1339  const std::string &name) :
1340  AgentSandesh(context, ""), uuid_str_(u), name_(name) {
1341  boost::system::error_code ec;
1342  uuid_ = StringToUuid(u);
1343 }
1344 
1346  return static_cast<DBTable *>(Agent::GetInstance()->tag_table());
1347 }
1348 
1350  resp_ = new TagSandeshResp();
1351 }
1352 
1353 bool TagSandesh::Filter(const DBEntryBase *entry) {
1354  const TagEntry *tag =
1355  dynamic_cast<const TagEntry *>(entry);
1356  assert(tag);
1357 
1358  if (MatchUuid(uuid_str_ , uuid_, tag->tag_uuid()) == false)
1359  return false;
1360 
1361  if (name_.empty() == false &&
1362  tag->name() != name_) {
1363  return false;
1364  }
1365 
1366  return true;
1367 }
1368 
1370  args->Add("uuid", uuid_str_);
1371  args->Add("name", name_);
1372  return true;
1373 }
1374 
1376  return static_cast<DBTable *>(Agent::GetInstance()->slo_table());
1377 }
1378 
1380  resp_ = new SLOListResp();
1381 }
1382 
1384  return static_cast<DBTable *>(Agent::GetInstance()->crypt_tunnel_table());
1385 }
1386 
1388  resp_ = new CryptTunnelResp();
1389 }
1390 
1392  const std::string &remote_ip) :
1393  AgentSandesh(context, ""), remote_ip_(remote_ip) {
1394 }
1395 
1397  CryptTunnelEntry *ent = static_cast<CryptTunnelEntry *>(entry);
1398  return ent->DBEntrySandesh(resp_, remote_ip_);
1399 }
1400 
1402  args->Add("remote", remote_ip_);
1403  return true;
1404 }
1405 
1407  const CryptTunnelEntry *crypt_tunnel_entry =
1408  dynamic_cast<const CryptTunnelEntry *>(entry);
1409  assert(crypt_tunnel_entry);
1410 
1411  if (MatchSubString(crypt_tunnel_entry->ToString(), remote_ip_) == false)
1412  return false;
1413  return true;
1414 }
1415 
1417  return static_cast<DBTable *>(Agent::GetInstance()->mp_table());
1418 }
1419 
1421  resp_ = new MulticastPolicyResp();
1422 }
1423 
1425  MulticastPolicyEntry *ent = static_cast<MulticastPolicyEntry *>(entry);
1426  return ent->DBEntrySandesh(resp_, name_);
1427 }
1428 
std::string vxlan_id_
int GetVxLanId() const
Definition: vn.cc:727
virtual bool Filter(const DBEntryBase *entry)
AgentMirrorSandesh(const std::string &context, const std::string &analyzer_name)
DBTable * AgentGetTable()
AgentVnSandesh(const std::string &context, const std::string &name, const std::string &u, const std::string &vxlan_id, const std::string &ipam_name)
boost::uuids::uuid uuid_
DBTable * AgentGetTable()
virtual bool FilterToArgs(AgentSandeshArguments *args)
static void DoSandesh(AgentSandeshPtr sandesh, int start, int count)
std::string type_
const MacAddress & vm_mac() const
Type type() const
Definition: interface.h:112
std::string ipam_name_
uint32_t label() const
Definition: mpls.h:79
bool EntrySandesh(DBEntryBase *entry, int first, int last)
Agent * agent() const
static Agent * GetInstance()
Definition: agent.h:436
static boost::uuids::uuid StringToUuid(const std::string &str)
Definition: string_util.h:145
BridgeDomainSandesh(const std::string &context, const std::string &u, const std::string &name)
bool Run(PageRequest req)
The TaskScheduler keeps track of what tasks are currently schedulable. When a task is enqueued it is ...
Definition: task.h:178
std::string uuid_str_
int Encode(std::string *str)
DBTable * AgentGetTable()
AgentRouteTable * GetInet4MulticastRouteTable() const
Definition: vrf.cc:326
virtual bool FilterToArgs(AgentSandeshArguments *args)
virtual bool Filter(const DBEntryBase *entry)
AgentRouteTable * GetEvpnRouteTable() const
Definition: vrf.cc:330
std::string parent_uuid_str_
const std::string & name() const
Definition: policy_set.h:80
virtual bool Filter(const DBEntryBase *entry)
bool UpdateResp(DBEntryBase *entry)
virtual bool FilterToArgs(AgentSandeshArguments *args)
std::string GetString(const std::string &key) const
const boost::uuids::uuid & GetUuid() const
Definition: interface.h:113
bool UpdateResp(DBEntryBase *entry)
NextHopTable * nexthop_table() const
Definition: agent.h:475
bool UpdateResp(DBEntryBase *entry)
std::string nh_index_
bool DBEntrySandesh(Sandesh *sresp, std::string &name) const
Agent supports multiple route tables - Inet-unicast (IPv4/IPv6), Inet-multicast, bridge, EVPN (Type2/Type5). This base class contains common code for all types of route tables.
Definition: agent_route.h:109
DB * db() const
Definition: agent.h:1118
std::string type_
bool DBEntrySandesh(Sandesh *resp, std::string &name) const
Definition: acl.cc:68
const NextHop * nexthop() const
Definition: mpls.h:80
DBTable * AgentGetTable()
bool stringToInteger(const std::string &str, NumberType &num)
Definition: string_util.h:71
bool l2_active() const
Definition: interface.h:122
std::string v6_str_
const std::string & name() const
static int ComputeLast(int first, int last, int len)
DBTableWalkRef AllocWalker(WalkFn walk_fn, WalkCompleteFn walk_complete)
Definition: db_table.cc:613
InetUnicastAgentRouteTable * GetInet4UnicastRouteTable() const
Definition: vrf.cc:319
bool UpdateResp(DBEntryBase *entry)
const std::string & name() const
Definition: bridge_domain.h:56
WorkQueue< PageRequest > page_request_queue_
Definition: agent_sandesh.h:75
InterfaceTable * interface_table() const
Definition: agent.h:465
virtual bool FilterToArgs(AgentSandeshArguments *args)
uint32_t id() const
Definition: qos_config.h:73
boost::uuids::uuid uuid
VnTable * vn_table() const
Definition: agent.h:495
InetUnicastAgentRouteTable * GetInet4MplsUnicastRouteTable() const
Definition: vrf.cc:323
virtual bool FilterToArgs(AgentSandeshArguments *args)
virtual bool FilterToArgs(AgentSandeshArguments *args)
Interface * physical_interface() const
std::string policy_enabled_
InetUnicastAgentRouteTable * GetInet6UnicastRouteTable() const
Definition: vrf.cc:338
std::string vn_
std::string context_
boost::uuids::uuid uuid_
static const uint16_t kEntriesPerPage
Definition: agent_sandesh.h:91
boost::uuids::uuid uuid_
ForwardingClassSandesh(const std::string &context, const std::string &u, const std::string &name, const std::string &idx)
DBTable * AgentGetTable()
virtual bool FilterToArgs(AgentSandeshArguments *args)
DBTable * AgentGetTable()
std::string uuid_str_
MplsTable * mpls_table() const
Definition: agent.h:510
Definition: vxlan.h:14
std::string mac_str_
Type GetType() const
Definition: nexthop.h:405
Base class for all Route entries in agent.
Definition: agent_route.h:224
DBTable * AgentGetTable()
bool UpdateResp(DBEntryBase *entry)
DBTable * AgentGetTable()
TagTable * tag_table() const
Definition: agent.h:505
QosQueueTable * qos_queue_table() const
Definition: agent.h:562
DBTable * AgentGetTable()
AgentHealthCheckSandesh(const std::string &context, const std::string &u)
DBTable * AgentGetTable()
MirrorTable * mirror_table() const
Definition: agent.h:525
OperDB * oper_db() const
Definition: agent.cc:1013
std::string uuid_
std::string ToString() const
Definition: mac_address.cc:53
std::string type_
bool Del(const std::string &key)
virtual bool DBEntrySandesh(Sandesh *sresp, bool stale) const =0
AgentPolicySetSandesh(const std::string &context, const std::string &uuid, const std::string &name)
boost::uuids::uuid uuid_
virtual bool Filter(const DBEntryBase *entry)
DBTable * AgentGetTable()
void WalkAgain(DBTableWalkRef walk)
Definition: db_table.cc:631
ServiceInstanceTable * service_instance_table() const
Definition: agent.h:817
virtual size_t Size() const
Definition: db_table.cc:507
static bool MatchUuid(const string &uuid_str, const boost::uuids::uuid &u, const boost::uuids::uuid val)
virtual void Response()
Definition: p/sandesh.h:502
void MakeSandeshPageReq(PageReqData *req, DBTable *table, int first, int last, int end, int count, int page_size)
virtual bool FilterToArgs(AgentSandeshArguments *args)
uint32_t id() const
virtual bool Filter(const DBEntryBase *entry)
PolicySetTable * policy_set_table() const
Definition: agent.h:520
uint8_t type
Definition: load_balance.h:109
bool Get(const std::string &key, std::string *val) const
std::string ip6_active_str_
static void EncodeOne(string *s, DBTable *table, int begin, int end, AgentSandeshArguments *filter)
bool UpdateResp(DBEntryBase *entry)
Definition: agent.h:358
QosQueueSandesh(const std::string &context, const std::string &u, const std::string &name, const std::string &id)
std::string uuid_str_
std::string name_
boost::uuids::uuid uuid_
virtual bool Filter(const DBEntryBase *entry)
bool ipv4_active() const
Definition: interface.h:116
BridgeDomainTable * bridge_domain_table() const
Definition: agent.cc:941
AgentVxLanSandesh(const std::string &context, const std::string &vxlan_id)
const std::string & name() const
Definition: qos_queue.h:70
virtual bool Filter(const DBEntryBase *entry)
std::string analyzer_name_
std::string name_
boost::uuids::uuid parent_uuid_
VrfAssignTable * vrf_assign_table() const
Definition: agent.h:530
virtual bool Filter(const DBEntryBase *entry)
AgentNhSandesh(const std::string &context, const std::string &type, const std::string &nh_index, const std::string &policy_enabled)
const boost::uuids::uuid & tag_uuid() const
AgentRouteTable * GetBridgeRouteTable() const
Definition: vrf.cc:334
virtual bool DBEntrySandesh(Sandesh *sresp, bool stale) const
bool DBEntrySandesh(Sandesh *resp, std::string &name) const
Definition: policy_set.cc:92
std::string v4_str_
const std::vector< VnIpam > & GetVnIpam() const
Definition: vn.h:171
class boost::shared_ptr< AgentSandesh > AgentSandeshPtr
Definition: agent_db.h:18
const VnEntry * vn() const
AgentCryptTunnelSandesh(const std::string &context, const std::string &name)
bool init_done() const
Definition: agent.h:1213
const std::string & name() const
Definition: db_table.h:110
CryptTunnelTable * crypt_tunnel_table() const
Definition: agent.h:480
AgentSandeshManager * agent_sandesh_manager()
Definition: operdb_init.h:73
std::string l2_active_str_
bool UpdateResp(DBEntryBase *entry)
bool Add(const std::string &key, const std::string &val)
std::string label_
const boost::uuids::uuid & uuid() const
Definition: policy_set.h:79
virtual bool Filter(const DBEntryBase *entry)
void AddPageRequest(const std::string &key, const std::string &context)
virtual void Alloc()=0
virtual bool FilterToArgs(AgentSandeshArguments *args)
virtual const PrefixType & prefix_address() const
Returns the value of a stored prefix address (IPv4, IPv6 or MAC address)
Definition: agent_route.h:389
Definition: vn.h:151
virtual bool UpdateResp(DBEntryBase *entry)
virtual bool Filter(const DBEntryBase *entry)
VrfTable * vrf_table() const
Definition: agent.h:485
std::string name_
const boost::uuids::uuid & uuid() const
Definition: bridge_domain.h:55
const Ip4Address & primary_ip_addr() const
virtual DBTablePartBase * GetTablePartition(const DBRequestKey *key)
Definition: db_table.cc:436
const boost::uuids::uuid & uuid() const
Definition: health_check.h:325
virtual bool FilterToArgs(AgentSandeshArguments *args)
void DoSandeshInternal(AgentSandeshPtr sandesh, int start, int count)
const boost::uuids::uuid & uuid() const
virtual bool FilterToArgs(AgentSandeshArguments *args)
virtual string ToString() const
Definition: crypt_tunnel.cc:38
int GetInt(const std::string &key) const
std::string name_
virtual DBTable * AgentGetTable()=0
uint32_t vxlan_id() const
Definition: vxlan.h:27
std::string name() const
Definition: qos_config.h:77
uint32_t id() const
Definition: nexthop.h:408
HealthCheckTable * health_check_table() const
Definition: agent.cc:933
AgentQosConfigTable * qos_config_table() const
Definition: agent.h:554
VxLanTable * vxlan_table() const
Definition: agent.h:535
static const uint8_t entries_per_sandesh
Definition: agent_sandesh.h:90
SecurityLoggingObjectTable * slo_table() const
Definition: agent.h:547
ArgumentMap arguments_
Definition: agent_sandesh.h:40
TagSandesh(const std::string &context, const std::string &u, const std::string &name)
std::string ip_active_str_
std::string name_
static int Split(const string &s, char delim, vector< string > &tokens)
DBTable * AgentGetTable()
const Ip6Address & primary_ip6_addr() const
void set_context(std::string context)
Definition: p/sandesh.h:310
Definition: mpls.h:52
virtual AgentSandeshPtr GetAgentSandesh(const AgentSandeshArguments *args, const std::string &context)
Definition: agent_db.h:186
boost::uuids::uuid uuid() const
Definition: qos_config.h:66
bool DBEntrySandesh(Sandesh *sresp, std::string &name) const
AgentIntfSandesh(const std::string &context, const std::string &type, const std::string &name, const std::string &u, const std::string &vn, const std::string &mac, const std::string &v4, const std::string &v6, const std::string &parent, const std::string &ip_active, const std::string &ip6_active, const std::string &l2_active)
virtual bool Filter(const DBEntryBase *entry)
virtual bool Filter(const DBEntryBase *entry)
std::string vxlan_id_
DBTable * AgentGetTable()
virtual bool DBEntrySandesh(Sandesh *resp, std::string &name) const =0
virtual bool FilterToArgs(AgentSandeshArguments *args)
static bool MatchSubString(const string &str, const string &sub_str)
bool UpdateResp(DBEntryBase *entry)
std::string id_
const std::string & name() const
static int ComputePageSize(int first, int last)
SgTable * sg_table() const
Definition: agent.h:500
uint32_t id() const
Definition: qos_queue.h:63
virtual bool DBEntrySandesh(Sandesh *sresp, bool stale) const
const std::string GetAnalyzerName() const
Definition: mirror_table.h:77
DBTable * AgentGetTable()
const std::string & name() const
Definition: interface.h:114
#define AGENT_SANDESH_TASKNAME
Definition: agent.h:301
AgentQosConfigSandesh(const std::string &context, const std::string &u, const std::string &name, const std::string &id)
bool PolicyEnabled() const
Definition: nexthop.h:407
const boost::uuids::uuid & GetUuid() const
Definition: vn.h:161
bool UpdateResp(DBEntryBase *entry)
const string & GetName() const
Definition: vn.h:162
DBTable * AgentGetTable()
AgentMplsSandesh(const std::string &context, const std::string &type, const std::string &label)
AgentSandeshManager(Agent *agent)
const boost::uuids::uuid & uuid() const
Definition: qos_queue.h:62
ForwardingClassTable * forwarding_class_table() const
Definition: agent.h:540
boost::intrusive_ptr< DBTableWalk > DBTableWalkRef
Definition: db_table.h:169
MulticastPolicyTable * mp_table() const
Definition: agent.h:642
boost::uuids::uuid uuid_
void SandeshError(const std::string &msg, const std::string &context)
Definition: dns_mgr.cc:781
bool UpdateResp(DBEntryBase *entry)
AclTable * acl_table() const
Definition: agent.h:515
virtual bool Filter(const DBEntryBase *entry)
static int ComputeFirst(int first, int len)
virtual bool FilterToArgs(AgentSandeshArguments *args)
SandeshResponse * resp_
virtual bool FilterToArgs(AgentSandeshArguments *args)
virtual void set_more(const bool val)=0
void SandeshDone(AgentSandeshPtr ptr, int first, int page_size, DBTable::DBTableWalkRef walk_ref, DBTableBase *partition)
bool ipv6_active() const
Definition: interface.h:117
bool UpdateResp(DBEntryBase *entry)
VmTable * vm_table() const
Definition: agent.h:490
Definition: acl.h:92
virtual bool FilterToArgs(AgentSandeshArguments *args)
DBTableBase * FindTable(const std::string &name)
Definition: db.cc:68
virtual bool DBEntrySandesh(Sandesh *sresp, bool stale) const
int Decode(const std::string &str)
DBTable * AgentGetTable()
VrouterObjectLimits GetVrouterObjectLimits()
Definition: agent.cc:1157
virtual bool Filter(const DBEntryBase *entry)
virtual AgentSandeshPtr GetAgentSandesh(const AgentSandeshArguments *args, const std::string &context)
Definition: agent_route.h:130
virtual bool Filter(const DBEntryBase *entry)
std::string uuid_str_