OpenSDN source code
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
agent.cc
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
3  */
4 
5 #include <algorithm>
6 #include <fstream>
7 #include <iostream>
8 #include <string>
9 #include <vector>
10 
11 #include <base/logging.h>
12 #include <base/lifetime.h>
13 #include <base/misc_utils.h>
14 #include <io/event_manager.h>
15 #include <ifmap/ifmap_link.h>
16 #include <cmn/agent_cmn.h>
17 #include <vnc_cfg_types.h>
18 #include <agent_types.h>
19 
20 #include <base/sandesh/task_types.h>
21 
22 #include <init/agent_param.h>
23 #include <cmn/agent_signal.h>
24 #include <cfg/cfg_init.h>
25 #include <cfg/cfg_mirror.h>
26 #include <cmn/agent.h>
27 #include <cmn/event_notifier.h>
31 
32 #include <oper/operdb_init.h>
33 #include <oper/config_manager.h>
34 #include <oper/interface_common.h>
35 #include <oper/health_check.h>
36 #include <oper/metadata_ip.h>
37 #include <oper/multicast.h>
38 #include <oper/nexthop.h>
39 #include <oper/mirror_table.h>
40 #include <oper/mpls.h>
41 #include <oper/peer.h>
42 #include <xmpp/xmpp_client.h>
43 
44 #include <filter/acl.h>
45 
46 #include <cmn/agent_factory.h>
47 #include <net/if.h>
48 
49 const std::string Agent::null_string_ = "";
50 const std::set<std::string> Agent::null_string_list_;
51 const std::string Agent::fabric_vn_name_ =
52  "default-domain:default-project:ip-fabric";
53 std::string Agent::fabric_vrf_name_ =
54  "default-domain:default-project:ip-fabric:__default__";
56  "default-domain:default-project:ip-fabric:ip-fabric";
57 const std::string Agent::link_local_vn_name_ =
58  "default-domain:default-project:__link_local__";
59 const std::string Agent::link_local_vrf_name_ =
60  "default-domain:default-project:__link_local__:__link_local__";
61 const MacAddress Agent::vrrp_mac_(0x00, 0x00, 0x5E, 0x00, 0x01, 0x00);
62 // use the following MAC when sending data to left or right SI interfaces
63 const MacAddress Agent::left_si_mac_(0x02, 0x00, 0x00, 0x00, 0x00, 0x01);
64 const MacAddress Agent::right_si_mac_(0x02, 0x00, 0x00, 0x00, 0x00, 0x02);
65 const MacAddress Agent::pkt_interface_mac_(0x00, 0x00, 0x00, 0x00, 0x00, 0x01);
66 const std::string Agent::bcast_mac_ = "FF:FF:FF:FF:FF:FF";
67 const std::string Agent::xmpp_dns_server_connection_name_prefix_ = "dns-server:";
68 const std::string Agent::xmpp_control_node_connection_name_prefix_ = "control-node:";
69 const uint16_t Agent::kDefaultVmiVmVnUveInterval = 30; //in seconds
70 const std::string Agent::v4_link_local_subnet_ = "169.254.0.0";
71 const std::string Agent::v6_link_local_subnet_ = "FE80::";
72 
75 
77  IpAddress sip;
78  if (dest.is_v4()) {
79  if (router_id() == dest) {
80  // If source IP and dest IP are same,
81  // linux kernel will drop the packet.
82  // Hence we will use link local IP address as sip.
84  } else {
85  sip = router_id();
86  }
87  } else if (dest.is_v6()) {
88  sip = Ip6Address::v4_mapped(router_id());
89  }
90  return sip;
91 }
92 
93 const string &Agent::GetHostInterfaceName() const {
94  // There is single host interface. Its addressed by type and not name
95  return Agent::null_string_;
96 };
97 
98 std::string Agent::GetUuidStr(boost::uuids::uuid uuid_val) const {
99  std::ostringstream str;
100  str << uuid_val;
101  return str.str();
102 }
103 
104 const string &Agent::vhost_interface_name() const {
105  return vhost_interface_name_;
106 };
107 
109  if (tor_agent_enabled() || test_mode()|| isMockMode()) {
110  return true;
111  }
112 
113  static const int log_rate_limit = 15;
114  struct ifreq ifr;
115  static int err_count = 0;
116  int sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_IP);
117  memset(&ifr, 0, sizeof(ifr));
118  strcpy(ifr.ifr_name, vhost_interface_name().c_str());
119  int err = ioctl(sock, SIOCGIFFLAGS, &ifr);
120  if (err < 0 || !(ifr.ifr_flags & IFF_UP)) {
121  close(sock);
122  if ((err_count % log_rate_limit) == 0) {
123  LOG(DEBUG, "vhost is down");
124  }
125  err_count++;
126  return false;
127  }
128  err = ioctl(sock, SIOCGIFADDR, &ifr);
129  if (false == is_l3mh() && err < 0) {
130  close(sock);
131  if ((err_count % log_rate_limit) == 0) {
132  LOG(DEBUG, "vhost is up. but ip is not set");
133  }
134  err_count++;
135  return false;
136  }
137  close(sock);
138  return true;
139 }
140 
142  return params_->isXenMode();
143 }
144 
146  return params_->isKvmMode();
147 }
148 
150  return params_->isDockerMode();
151 }
152 
153 bool Agent::isMockMode() const {
154  return params_->cat_is_agent_mocked();
155 }
156 
157 std::string Agent::AgentGUID() const {
158  char *envval = NULL;
159  assert(params_);
160  return std::string(((envval = getenv("LOGNAME"))== NULL)? "" : envval)
161  + "_" + agent_name() + "_" + integerToString(getpid());
162 }
163 
164 static void SetTaskPolicyOne(const char *task, const char *exclude_list[],
165  int count) {
167  TaskPolicy policy;
168  for (int i = 0; i < count; ++i) {
169  int task_id = scheduler->GetTaskId(exclude_list[i]);
170  policy.push_back(TaskExclusion(task_id));
171  }
172  scheduler->SetPolicy(scheduler->GetTaskId(task), policy);
173 }
174 
176  /*
177  * TODO(roque): this method should not be called by the agent constructor.
178  */
179  static bool initialized = false;
180  if (initialized) {
181  return;
182  }
183  initialized = true;
184 
185  const char *db_exclude_list[] = {
192  "Agent::Services",
193  "Agent::StatsCollector",
197  "sandesh::RecvQueue",
198  "Agent::Uve",
199  "Agent::KSync",
200  "Agent::PktFlowResponder",
201  "Agent::Profile",
202  "Agent::PktHandler",
203  "Agent::Diag",
204  "http::RequestHandlerTask",
216  };
217  SetTaskPolicyOne("db::DBTable", db_exclude_list,
218  sizeof(db_exclude_list) / sizeof(char *));
219 
220  // ConfigManager task
221  const char *config_manager_exclude_list[] = {
224  };
225  SetTaskPolicyOne(kTaskConfigManager, config_manager_exclude_list,
226  sizeof(config_manager_exclude_list) / sizeof(char *));
227 
228  const char *flow_table_exclude_list[] = {
229  "Agent::PktFlowResponder",
232  };
233  SetTaskPolicyOne(kTaskFlowEvent, flow_table_exclude_list,
234  sizeof(flow_table_exclude_list) / sizeof(char *));
235 
236  SetTaskPolicyOne(kTaskFlowKSync, flow_table_exclude_list,
237  sizeof(flow_table_exclude_list) / sizeof(char *));
238 
239  SetTaskPolicyOne(kTaskFlowUpdate, flow_table_exclude_list,
240  sizeof(flow_table_exclude_list) / sizeof(char *));
241 
242  SetTaskPolicyOne(kTaskFlowDelete, flow_table_exclude_list,
243  sizeof(flow_table_exclude_list) / sizeof(char *));
244 
245  const char *sandesh_exclude_list[] = {
246  "db::DBTable",
247  "Agent::Services",
248  "Agent::StatsCollector",
249  "io::ReaderTask",
250  "Agent::PktFlowResponder",
251  "Agent::Profile",
252  "BFD",
256  };
257  SetTaskPolicyOne("sandesh::RecvQueue", sandesh_exclude_list,
258  sizeof(sandesh_exclude_list) / sizeof(char *));
259 
260  const char *xmpp_config_exclude_list[] = {
261  "Agent::Services",
262  "Agent::StatsCollector",
263  "sandesh::RecvQueue",
264  "io::ReaderTask",
265  "Agent::ControllerXmpp",
266  "db::Walker",
267  "db::DBTable",
268  "xmpp::StateMachine",
269  "bgp::ShowCommand",
272  };
273  SetTaskPolicyOne("bgp::Config", xmpp_config_exclude_list,
274  sizeof(xmpp_config_exclude_list) / sizeof(char *));
275 
276  const char *controller_xmpp_exclude_list[] = {
277  "Agent::Services",
278  "io::ReaderTask",
279  "db::DBTable",
282  };
283  SetTaskPolicyOne("Agent::ControllerXmpp", controller_xmpp_exclude_list,
284  sizeof(controller_xmpp_exclude_list) / sizeof(char *));
285 
286  const char *walker_exclude_list[] = {
287  "Agent::ControllerXmpp",
288  "db::DBTable",
289  // For ToR Agent Agent::KSync and db::Walker both task tries
290  // to modify route path list inline (out of DB table context) to
291  // manage route exports from dynamic peer before release the peer
292  // which is resulting in parallel access, for now we will avoid this
293  // race by adding task exclusion policy.
294  // TODO(prabhjot): need to remove this task exclusion one dynamic peer
295  // handling is done.
296  "Agent::KSync",
299  };
300  SetTaskPolicyOne("db::Walker", walker_exclude_list,
301  sizeof(walker_exclude_list) / sizeof(char *));
302 
303  const char *ksync_exclude_list[] = {
304  "db::DBTable",
307  };
308  SetTaskPolicyOne("Agent::KSync", ksync_exclude_list,
309  sizeof(ksync_exclude_list) / sizeof(char *));
310 
311  const char *stats_collector_exclude_list[] = {
312  "Agent::PktFlowResponder",
315  };
316  SetTaskPolicyOne("Agent::StatsCollector", stats_collector_exclude_list,
317  sizeof(stats_collector_exclude_list) / sizeof(char *));
318 
319  const char *flow_stats_exclude_list[] = {
322  };
323  SetTaskPolicyOne(kTaskFlowStatsCollector, flow_stats_exclude_list,
324  sizeof(flow_stats_exclude_list) / sizeof(char *));
325 
326  const char *session_stats_exclude_list[] = {
330  };
331  SetTaskPolicyOne(kTaskSessionStatsCollector, session_stats_exclude_list,
332  sizeof(session_stats_exclude_list) / sizeof(char *));
333 
334  const char *session_stats_event_exclude_list[] = {
337  };
338  SetTaskPolicyOne(kTaskSessionStatsCollectorEvent, session_stats_exclude_list,
339  sizeof(session_stats_event_exclude_list) / sizeof(char *));
340  const char *metadata_exclude_list[] = {
341  "xmpp::StateMachine",
342  "http::RequestHandlerTask"
343  };
344  SetTaskPolicyOne("http client", metadata_exclude_list,
345  sizeof(metadata_exclude_list) / sizeof(char *));
346 
347  const char *xmpp_state_machine_exclude_list[] = {
348  "io::ReaderTask"
349  };
350  SetTaskPolicyOne("xmpp::StateMachine", xmpp_state_machine_exclude_list,
351  sizeof(xmpp_state_machine_exclude_list) / sizeof(char *));
352 
353  const char *agent_init_exclude_list[] = {
354  "xmpp::StateMachine",
355  "http client",
356  "db::DBTable",
361  };
362  SetTaskPolicyOne(AGENT_INIT_TASKNAME, agent_init_exclude_list,
363  sizeof(agent_init_exclude_list) / sizeof(char *));
364 
365  const char *flow_stats_manager_exclude_list[] = {
366  "Agent::StatsCollector",
371  };
373  flow_stats_manager_exclude_list,
374  sizeof(flow_stats_manager_exclude_list) / sizeof(char *));
375 
377  scheduler->RegisterLog(boost::bind(&Agent::TaskTrace, this,
378  _1, _2, _3, _4, _5));
379 
380  const char *db_exclude_task_exclude_list[] = {
381  "Agent::Uve",
382  "sandesh::RecvQueue",
383  "Agent::ControllerXmpp",
384  "bgp::Config",
387  };
388  SetTaskPolicyOne(kTaskDBExclude, db_exclude_task_exclude_list,
389  sizeof(db_exclude_task_exclude_list) / sizeof(char *));
390 
391  const char *flow_stats_update_exclude_list[] = {
392  "Agent::Uve"
393  };
394  SetTaskPolicyOne(kTaskFlowStatsUpdate, flow_stats_update_exclude_list,
395  sizeof(flow_stats_update_exclude_list) / sizeof(char *));
396 
397  const char *profile_task_exclude_list[] = {
401  };
402  SetTaskPolicyOne("Agent::Profile", profile_task_exclude_list,
403  sizeof(profile_task_exclude_list) / sizeof(char *));
404 
405  //event notify exclude list
406  const char *event_notify_exclude_list[] = {
407  "Agent::ControllerXmpp",
408  "db::DBTable",
412  };
413  SetTaskPolicyOne(kEventNotifierTask, event_notify_exclude_list,
414  sizeof(event_notify_exclude_list) / sizeof(char *));
415 
416  // Health Check task
417  const char *health_check_exclude_list[] = {
419  };
420  SetTaskPolicyOne(kTaskHealthCheck, health_check_exclude_list,
421  sizeof(health_check_exclude_list) / sizeof(char *));
422 
423  const char *rest_api_exclude_list[] = {
424  "db::DBTable",
425  };
426  SetTaskPolicyOne("Agent::RestApi", rest_api_exclude_list,
427  sizeof(rest_api_exclude_list) / sizeof(char *));
428 
429 }
430 
433  TaskScheduler::GetInstance()->GetTaskId("db::DBTable"));
434 }
435 
437  delete lifetime_manager_;
438  lifetime_manager_ = NULL;
439 }
440 
441 uint32_t Agent::GenerateHash(std::vector<std::string> &list) {
442 
443  std::string concat_servers;
444  std::vector<std::string>::iterator iter;
445  for (iter = list.begin();
446  iter != list.end(); iter++) {
447  concat_servers += *iter;
448  }
449 
450  boost::hash<std::string> string_hash;
451  return(string_hash(concat_servers));
452 }
453 
457 }
458 
462 }
463 
466  InitDnsList();
467 }
468 
470 
471  // Controller
472  // 1. Save checksum of the Configured List
473  // 2. Randomize the Configured List
474  std::vector<string> list = params_->controller_server_list();
475  uint32_t new_chksum = GenerateHash(list);
476  if (new_chksum != controller_chksum_) {
477  controller_chksum_ = new_chksum;
479  std::random_shuffle(controller_list_.begin(), controller_list_.end());
480  }
481 
482  // Dns
483  // 1. Save checksum of the Configured List
484  // 2. Pick first two DNS Servers to connect
485  list.clear();
486  list = params_->dns_server_list();
487  new_chksum = GenerateHash(list);
488  if (new_chksum != dns_chksum_) {
489  dns_chksum_ = new_chksum;
491  }
492 
493  // Collector
494  // 1. Save checksum of the Configured List
495  // 2. Randomize the Configured List
496  list.clear();
497  list = params_->collector_server_list();
498  new_chksum = GenerateHash(list);
499  if (new_chksum != collector_chksum_) {
500  collector_chksum_ = new_chksum;
502  std::random_shuffle(collector_list_.begin(), collector_list_.end());
503  }
504 }
505 
506 // Get configuration from AgentParam into Agent
508  params_ = params;
509 
516 
519 
521 
522  // Don't fetch the VHOST conf for tor agent. For tor agent, vhost conf will
523  // not be populated into eth_port_list_ from conf file.
524  if (params_->eth_port_list().size() != 0) {
525  ip_fabric_intf_name_ = params_->eth_port_list()[0].c_str(); /* PKC: Using first element for now */
526  }
538  if (params_->loopback_ip() != Ip4Address(0)) {
540  is_l3mh_ = true;
541  }
542  if (router_id_.to_ulong()) {
543  router_id_configured_ = false;
544  }
545 
546  router_id6_ = Ip6Address::v4_mapped(router_id_);
548  if (params_->tunnel_type() == "MPLSoUDP")
550  else if (params_->tunnel_type() == "VXLAN")
552  else
554 
575  vr_limits_exceeded_map_.insert(VrLimitData("vr_nexthops", "Normal"));
576  vr_limits_exceeded_map_.insert(VrLimitData("vr_mpls_labels", "Normal"));
577 }
578 
580  cn_mcast_builder_ = peer;
581 }
582 
584  /* We need to do sandesh initialization here */
585 
586  /* If collector configuration is specified, use that for connection to
587  * collector. If not we still need to invoke InitGenerator to initialize
588  * introspect.
589  */
590  Module::type module = static_cast<Module::type>(module_type_);
591  NodeType::type node_type =
592  g_vns_constants.Module2NodeType.find(module)->second;
593  if (GetCollectorlist().size() != 0) {
595  host_name(),
596  g_vns_constants.NodeTypeNames.find(node_type)->second,
597  instance_id_,
598  event_manager(),
601  NULL, params_->derived_stats_map(),
603  } else {
605  host_name(),
606  g_vns_constants.NodeTypeNames.find(node_type)->second,
607  instance_id_,
608  event_manager(),
610  NULL, params_->derived_stats_map(),
612  }
613 
614  if (params_->cat_is_agent_mocked()) {
615  std::cout << "Agent Name: " << params_->agent_name()
616  << " Introspect Port: " << Sandesh::http_port() << std::endl;
617  std::string sub("{\"HTTPPort\":");
618  std::string pidstring = integerToString(getpid());
619 
620  pidstring += ".json";
621  sub += integerToString(Sandesh::http_port()) + "}";
622 
623  std::ofstream outfile(pidstring.c_str(), std::ofstream::out);
624  outfile << sub;
625  outfile.close();
626  }
627 }
628 
630  // ReConnect Collectors
633 }
634 
637  // Its observed that sometimes TBB scheduler misses spawn events
638  // and doesnt schedule a task till its triggered again. As a work around
639  // dummy timer is created at scheduler with default timeout of 1 sec
640  // that fires and awake TBB periodically. Modify the timeout if required.
643  }
644 
645  // Its observed that sometimes TBB stops scheduling tasks altogether.
646  // Initiate a monitor which asserts if no task is spawned for a given time.
650  }
651 }
652 
653 static bool interface_exist(string &name) {
654  struct if_nameindex *ifs = NULL;
655  struct if_nameindex *head = NULL;
656  bool ret = false;
657  string tname = "";
658 
659  ifs = if_nameindex();
660  if (ifs == NULL) {
661  LOG(INFO, "No interface exists!");
662  return ret;
663  }
664  head = ifs;
665  while (ifs->if_name && ifs->if_index) {
666  tname = ifs->if_name;
667  if (string::npos != tname.find(name)) {
668  ret = true;
669  name = tname;
670  break;
671  }
672  ifs++;
673  }
674  if_freenameindex(head);
675  return ret;
676 }
677 
679  if (!params_->isXenMode() || params_->xen_ll_name() == "")
680  return;
681 
682  string dev_name = params_->xen_ll_name();
683  if(!interface_exist(dev_name)) {
684  LOG(INFO, "Interface " << dev_name << " not found");
685  return;
686  }
687  params_->set_xen_ll_name(dev_name);
688 
689  //We create a kernel visible interface to support xapi
690  //Once we support dpdk on xen, we should change
691  //the transport type to KNI
697 }
698 
700  // Create peer entries
701  local_peer_.reset(new Peer(Peer::LOCAL_PEER, LOCAL_PEER_NAME, false));
703  false));
705  false));
706  ecmp_peer_.reset(new Peer(Peer::ECMP_PEER, ECMP_PEER_NAME, true));
707  vgw_peer_.reset(new Peer(Peer::VGW_PEER, VGW_PEER_NAME, true));
708  evpn_routing_peer_.reset(new EvpnRoutingPeer());
709  vxlan_bgp_peer_.reset(new VxlanBgpPeer());
710  evpn_peer_.reset(new EvpnPeer());
711  inet_evpn_peer_.reset(new InetEvpnPeer());
713  false));
715  MULTICAST_TOR_PEER_NAME, false));
719  false));
721  MAC_VM_BINDING_PEER_NAME, false));
724  false));
727  true));
730  true));
731 }
732 
733 void Agent::ReconfigSignalHandler(boost::system::error_code ec, int signum) {
734  LOG(DEBUG, "Received SIGHUP to apply updated configuration");
735  // Read the configuration
736  params_->ReInit();
737  // Generates checksum, randomizes and saves the list
739  // ReConnnect only ones whose checksums are different
740  controller()->ReConnect();
741  // ReConnect Collectors
743 }
744 
745 void Agent::DebugSignalHandler(boost::system::error_code ec, int signum) {
746  LOG(INFO, "Received SIGUSR1 to update debug configuration");
747  //Read the debug configuration
748  params_->DebugInit();
749 }
750 
752  params_(NULL), cfg_(NULL), stats_(NULL), ksync_(NULL), uve_(NULL),
753  stats_collector_(NULL), flow_stats_manager_(NULL), pkt_(NULL),
754  services_(NULL), vgw_(NULL), rest_server_(NULL), port_ipc_handler_(NULL),
755  oper_db_(NULL), diag_table_(NULL), controller_(NULL), resource_manager_(),
756  event_notifier_(), event_mgr_(NULL),
757  agent_xmpp_channel_(), ifmap_channel_(),
758  xmpp_client_(), xmpp_init_(), dns_xmpp_channel_(), dns_xmpp_client_(),
759  dns_xmpp_init_(), agent_stale_cleaner_(NULL), cn_mcast_builder_(NULL),
760  metadata_server_port_(0), host_name_(""), agent_name_(""),
761  prog_name_(""), introspect_port_(0),
762  instance_id_(g_vns_constants.INSTANCE_ID_DEFAULT),
763  module_type_(Module::VROUTER_AGENT), module_name_(),
764  db_(NULL), task_scheduler_(NULL), agent_init_(NULL), fabric_vrf_(NULL),
765  fabric_policy_vrf_(NULL),
766  intf_table_(NULL), health_check_table_(), metadata_ip_allocator_(),
767  metadata_ip6_allocator_(nullptr), nh_table_(NULL), uc_rt_table_(NULL), mc_rt_table_(NULL),
768  evpn_rt_table_(NULL), l2_rt_table_(NULL), vrf_table_(NULL),
769  vm_table_(NULL), vn_table_(NULL), sg_table_(NULL), mpls_table_(NULL),
770  acl_table_(NULL), mirror_table_(NULL), vrf_assign_table_(NULL),
771  vxlan_table_(NULL), service_instance_table_(NULL),
772  physical_device_table_(NULL), physical_device_vn_table_(NULL),
773  config_manager_(), mirror_cfg_table_(NULL),
774  intf_mirror_cfg_table_(NULL), router_id6_(Ip4Address(0)), router_id_(0), prefix_len_(0),
775  gateway_list_(0), compute_node_ip_(0), xs_cfg_addr_(""), xs_idx_(0),
776  xs_addr_(), xs_port_(),
777  xs_stime_(), xs_auth_enable_(false), xs_dns_idx_(0), dns_addr_(),
778  dns_port_(), dns_auth_enable_(false),
779  controller_chksum_(0), dns_chksum_(0), collector_chksum_(0),
780  ip_fabric_intf_name_(""), crypt_intf_name_(""),
781  vhost_interface_name_(""),
782  pkt_interface_name_("pkt0"), arp_proto_(NULL),
783  dhcp_proto_(NULL), dns_proto_(NULL), icmp_proto_(NULL),
784  dhcpv6_proto_(NULL), icmpv6_proto_(NULL), flow_proto_(NULL),
785  mac_learning_proto_(NULL), mac_learning_module_(NULL),
786  local_peer_(), local_vm_peer_(), linklocal_peer_(),
787  ecmp_peer_(), vgw_peer_(), evpn_routing_peer_(),
788  vxlan_bgp_peer_(), evpn_peer_(), multicast_peer_(),
789  multicast_tor_peer_(), multicast_tree_builder_peer_(),mac_vm_binding_peer_(),
790  inet_evpn_peer_(), mac_learning_peer_(), fabric_rt_export_peer_(),
791  local_vm_export_peer_(), agent_signal_(), ifmap_parser_(NULL),
792  router_id_configured_(false), mirror_src_udp_port_(0),
793  lifetime_manager_(NULL), ksync_sync_mode_(false), mgmt_ip_(""),
794  vxlan_network_identifier_mode_(AUTOMATIC), vhost_interface_(NULL),
795  crypt_interface_(NULL), connection_state_(NULL), test_mode_(false),
796  xmpp_dns_test_mode_(false),
797  init_done_(false), resource_manager_ready_(false),
798  simulate_evpn_tor_(false), tsn_no_forwarding_enabled_(false),
799  tsn_enabled_(false),
800  tor_agent_enabled_(false), forwarding_enabled_(true),
801  server_gateway_mode_(false), pbb_gateway_mode_(false),
802  inet_labeled_enabled_(false),
803  flow_table_size_(0), flow_thread_count_(0), flow_trace_enable_(true),
804  max_vm_flows_(0), ovsdb_client_(NULL), vrouter_server_ip_(0),
805  vrouter_server_port_(0), vrouter_max_labels_(0), vrouter_max_nexthops_(0),
806  vrouter_max_interfaces_(0), vrouter_max_vrfs_(0),
807  vrouter_max_mirror_entries_(0), vrouter_max_bridge_entries_(0),
808  vrouter_max_oflow_bridge_entries_(0), vrouter_priority_tagging_(true),
809  flow_stats_req_handler_(NULL),
810  tbb_keepawake_timeout_(kDefaultTbbKeepawakeTimeout),
811  task_monitor_timeout_msec_(kDefaultTaskMonitorTimeout),
812  vr_limit_high_watermark_(kDefaultHighWatermark),
813  vr_limit_low_watermark_(kDefaultLowWatermark),
814  loopback_ip_(), is_l3mh_(false), ip_fabric_intf_name_list_() {
815 
816  assert(singleton_ == NULL);
817  singleton_ = this;
818  db_ = new DB();
819  assert(db_);
820 
821  event_mgr_ = new EventManager();
822  assert(event_mgr_);
823 
826 
827  Module::type module = static_cast<Module::type>(module_type_);
828  module_name_ = g_vns_constants.ModuleNames.find(module)->second;
829 
830  agent_signal_.reset(
831  AgentStaticObjectFactory::Create<AgentSignal>(event_mgr_));
832  agent_signal_.get()->RegisterSigHupHandler(
833  boost::bind(&Agent::ReconfigSignalHandler, this, _1, _2));
834  agent_signal_.get()->RegisterDebugSigHandler(
835  boost::bind(&Agent::DebugSignalHandler, this, _1, _2));
836 
837  config_manager_.reset(new ConfigManager(this));
838  for (uint8_t count = 0; count < MAX_XMPP_SERVERS; count++) {
839  (agent_xmpp_channel_[count]).reset();
840  }
841 }
842 
844  uve_ = NULL;
845  flow_stats_manager_ = NULL;
846 
847  agent_signal_->Terminate();
848  agent_signal_.reset();
849 
851 
852  delete db_;
853  db_ = NULL;
854  singleton_ = NULL;
855 
856  if (task_scheduler_) {
858  task_scheduler_ = NULL;
859  }
860 
861  delete event_mgr_;
862  event_mgr_ = NULL;
863 }
864 
866  return cfg_;
867 }
868 
870  cfg_ = cfg;
871 }
872 
874  return diag_table_;
875 }
876 
878  diag_table_ = table;
879 }
880 
882  return stats_;
883 }
884 
886  stats_ = stats;
887 }
888 
890  return config_manager_.get();
891 }
892 
894  return event_notifier_;
895 }
896 
898  event_notifier_ = val;
899 }
900 
901 KSync *Agent::ksync() const {
902  return ksync_;
903 }
904 
905 void Agent::set_ksync(KSync *ksync) {
906  ksync_ = ksync;
907 }
908 
910  return uve_;
911 }
912 
914  uve_ = uve;
915 }
916 
918  return stats_collector_;
919 }
920 
922  stats_collector_ = asc;
923 }
924 
926  return flow_stats_manager_;
927 }
928 
930  flow_stats_manager_ = aging_module;
931 }
932 
934  return health_check_table_;
935 }
936 
938  health_check_table_ = table;
939 }
940 
942  return bridge_domain_table_;
943 }
944 
946  bridge_domain_table_ = table;
947 }
948 
950  return metadata_ip_allocator_.get();
951 }
952 
954  metadata_ip_allocator_.reset(allocator);
955 }
956 
958  return metadata_ip6_allocator_.get();
959 }
960 
962  metadata_ip6_allocator_.reset(allocator);
963 }
964 
966  return pkt_;
967 }
968 
970  pkt_ = pkt;
971 }
972 
974  return services_;
975 }
976 
979 }
980 
982  return controller_;
983 }
984 
986  controller_ = val;
987 }
988 
990  return vgw_;
991 }
992 
994  vgw_ = vgw;
995 }
996 
998  return rest_server_;
999 }
1000 
1002  rest_server_ = r;
1003 }
1004 
1006  return port_ipc_handler_;
1007 }
1008 
1010  port_ipc_handler_ = r;
1011 }
1012 
1014  return oper_db_;
1015 }
1016 
1017 void Agent::set_oper_db(OperDB *oper_db) {
1018  oper_db_ = oper_db;
1019 }
1020 
1022  return resource_manager_;
1023 }
1024 
1026  resource_manager_ = val;
1027 }
1028 
1030  return oper_db_->domain_config_table();
1031 }
1032 
1033 bool Agent::isVmwareMode() const {
1034  return params_->isVmwareMode();
1035 }
1036 
1038  if (isVmwareMode() == false)
1039  return false;
1040 
1041  return params_->isVmwareVcenterMode();
1042 }
1043 
1045  if (test_mode_) {
1046  CHECK_CONCURRENCY("db::DBTable", "Agent::KSync", AGENT_INIT_TASKNAME,
1050  }
1051 }
1052 
1054  return params_->vrouter_on_nic_mode();
1055 }
1056 
1058  return params_->vrouter_on_host_dpdk();
1059 }
1060 
1062  return params_->vrouter_on_host();
1063 }
1064 
1065 uint16_t
1066 Agent::ProtocolStringToInt(const std::string &proto_arg) {
1067  std::string proto = proto_arg;
1068 
1069  std::transform(proto.begin(), proto.end(), proto.begin(), ::tolower);
1070 
1071  if (proto == "tcp") {
1072  return IPPROTO_TCP;
1073  }
1074 
1075  if (proto == "udp") {
1076  return IPPROTO_UDP;
1077  }
1078 
1079  if (proto == "sctp") {
1080  return IPPROTO_SCTP;
1081  }
1082 
1083  if (proto =="icmp") {
1084  return IPPROTO_ICMP;
1085  }
1086 
1087  if (proto == "icmp6") {
1088  return IPPROTO_ICMPV6;
1089  }
1090 
1091  return atoi(proto.c_str());
1092 }
1093 
1095 (const std::string &mode) const {
1096  if (mode == "l2")
1097  return Agent::L2;
1098  else if (mode == "l3")
1099  return Agent::L3;
1100  else if (mode == "l2_l3")
1101  return Agent::L2_L3;
1102 
1103  return Agent::NONE;
1104 }
1105 
1106 void Agent::set_flow_table_size(uint32_t count) {
1107  flow_table_size_ = count;
1108  if (params_->max_vm_flows() >= 100) {
1109  max_vm_flows_ = 0;
1110  } else {
1111  max_vm_flows_ = (count * params_->max_vm_flows()) / 100;
1112  }
1113 }
1114 
1116  assert(channel != NULL);
1117  (agent_xmpp_channel_[idx]).reset(channel);
1118 }
1119 
1121  (agent_xmpp_channel_[idx]).reset();
1122 }
1123 
1124 boost::shared_ptr<AgentXmppChannel> Agent::controller_xmpp_channel_ref(uint8_t idx) {
1125  return agent_xmpp_channel_[idx];
1126 }
1127 
1128 void Agent::TaskTrace(const char *file_name, uint32_t line_no,
1129  const Task *task, const char *description,
1130  uint64_t delay) {
1131  TaskTrace::TraceMsg(TaskTraceBuf, file_name, line_no,
1132  task->GetTaskId(), task->GetTaskInstance(),
1133  description, delay, task->Description());
1134 }
1135 
1137  return params_->measure_queue_delay();
1138 }
1139 
1141  return params_->set_measure_queue_delay(val);
1142 }
1143 
1144 void Agent::SetXmppDscp(uint8_t val) {
1145  for (uint8_t count = 0; count < MAX_XMPP_SERVERS; count++) {
1146  XmppClient *client = xmpp_client_[count];
1147  if (client) {
1149  }
1150  client = dns_xmpp_client_[count];
1151  if (client) {
1152  client->SetDscpValue(val, XmppInit::kDnsNodeJID);
1153  }
1154  }
1155 }
1156 
1157 VrouterObjectLimits Agent::GetVrouterObjectLimits() {
1158  VrouterObjectLimits vr_limits;
1159  vr_limits.set_max_labels(vrouter_max_labels());
1160  vr_limits.set_max_nexthops(vrouter_max_nexthops());
1161  vr_limits.set_max_interfaces(vrouter_max_interfaces());
1162  vr_limits.set_max_vrfs(vrouter_max_vrfs());
1163  vr_limits.set_max_mirror_entries(vrouter_max_mirror_entries());
1164  vr_limits.set_vrouter_max_bridge_entries(vrouter_max_bridge_entries());
1165  vr_limits.set_vrouter_max_oflow_bridge_entries(
1167  vr_limits.set_vrouter_build_info(vrouter_build_info());
1168  vr_limits.set_vrouter_max_flow_entries(vrouter_max_flow_entries());
1169  vr_limits.set_vrouter_max_oflow_entries(vrouter_max_oflow_entries());
1170  vr_limits.set_vrouter_priority_tagging(vrouter_priority_tagging());
1171  return vr_limits;
1172 }
1173 
1175  resource_manager_ready_ = true;
1176  config_manager_->Start();
1177 }
1178 
1180  if (params()->vrouter_on_host_dpdk()) {
1181  return Interface::TRANSPORT_PMD;
1182  }
1184 }
1185 
1186 
1187 std::string AgentBackTrace(int skip = 1)
1188 {
1189  std::ostringstream sbuffer;
1190  void *callstack[128];
1191  char buffer[1024];
1192  const int nMaxFrames = sizeof(callstack) / sizeof(callstack[0]);
1193  int nFrames = backtrace(callstack, nMaxFrames);
1194 
1195  for (int i = skip; i < nFrames; i++) {
1196  Dl_info info;
1197  if (dladdr(callstack[i], &info)) {
1198  char *demangled = NULL;
1199  int status;
1200  demangled = abi::__cxa_demangle(info.dli_sname, NULL, 0, &status);
1201  snprintf(buffer, sizeof(buffer), "%-3d %p %s + %zd\n",
1202  i, callstack[i],
1203  status == 0 ? demangled : info.dli_sname,
1204  (char *)callstack[i] - (char *)info.dli_saddr);
1205  free(demangled);
1206  } else {
1207  snprintf(buffer, sizeof(buffer), "%-3d %p\n",
1208  i, callstack[i]);
1209  }
1210  sbuffer << buffer;
1211  }
1212  if (nFrames == nMaxFrames)
1213  sbuffer << " [truncated]\n";
1214 
1215  return sbuffer.str();
1216 }
bool MeasureQueueDelay()
Definition: agent.cc:1136
#define MAC_VM_BINDING_PEER_NAME
Definition: peer.h:28
bool router_id_configured_
Definition: agent.h:1563
#define LOCAL_VM_PEER_NAME
Definition: peer.h:17
IpAddress router_id6_
Definition: agent.h:1493
DiagTable * diag_table_
Definition: agent.h:1423
bool vcpe_gateway_mode_
Definition: agent.h:1585
int SetDscpValue(uint8_t value, const char *conn_id)
Definition: xmpp_client.cc:274
void set_services(ServicesModule *services)
Definition: agent.cc:977
uint32_t collector_chksum_
Definition: agent.h:1525
void InitPeers()
Definition: agent.cc:699
uint16_t flow_thread_count_
Definition: agent.h:1591
std::unique_ptr< Peer > vgw_peer_
Definition: agent.h:1547
void DebugInit()
void ConcurrencyCheck()
Definition: agent.cc:1044
std::unique_ptr< Peer > local_vm_export_peer_
Definition: agent.h:1558
bool isTorAgent() const
Definition: agent_param.h:385
static const MacAddress vrrp_mac_
Definition: agent.h:1655
void EnableMonitor(EventManager *evm, uint64_t tbb_keepawake_time_msec, uint64_t inactivity_time_msec, uint64_t poll_interval_msec)
Enable Task monitoring.
Definition: task.cc:511
ServicesModule * services() const
Definition: agent.cc:973
void set_controller_xmpp_channel(AgentXmppChannel *channel, uint8_t idx)
Definition: agent.cc:1115
std::string xmpp_server_cert() const
Definition: agent_param.h:268
std::vector< std::string > dns_list_
Definition: agent.h:1522
AgentConfig * cfg_
Definition: agent.h:1411
IpAddress GetMirrorSourceIp(const IpAddress &dest)
Definition: agent.cc:76
#define kEventNotifierTask
Definition: agent.h:356
bool isVmwareMode() const
Definition: agent.cc:1033
uint32_t tbb_keepawake_timeout() const
Definition: agent_param.h:456
static const std::string bcast_mac_
Definition: agent.h:1657
AgentStats * stats_
Definition: agent.h:1412
void InitDnsList()
Definition: agent.cc:459
static Agent * GetInstance()
Definition: agent.h:436
The TaskScheduler keeps track of what tasks are currently schedulable. When a task is enqueued it is ...
Definition: task.h:178
const std::string & vhost_name() const
Definition: agent_param.h:183
float vr_limit_high_watermark_
Definition: agent.h:1639
ForwardingMode
Definition: agent.h:403
std::vector< std::string > ip_fabric_intf_name_list_
Definition: agent.h:1644
#define kTaskDBExclude
Definition: agent.h:336
FlowStatsManager * flow_stats_manager() const
Definition: agent.cc:925
AgentUveBase * uve_
Definition: agent.h:1414
virtual ~Agent()
Definition: agent.cc:843
bool test_mode() const
Definition: agent.h:1191
bool server_gateway_mode_
Definition: agent.h:1584
#define kTaskFlowEvent
Definition: agent.h:321
void set_bridge_domain_table(BridgeDomainTable *table)
Definition: agent.cc:945
ServicesModule * services_
Definition: agent.h:1418
uint32_t task_monitor_timeout_msec() const
Definition: agent_param.h:457
bool tor_agent_enabled() const
Definition: agent.h:1164
DomainConfig * domain_config_table() const
Definition: agent.cc:1029
void CopyConfig(AgentParam *params)
Definition: agent.cc:507
void set_oper_db(OperDB *oper_db)
Definition: agent.cc:1017
RestServer * rest_server() const
Definition: agent.cc:997
void SetAgentTaskPolicy()
Definition: agent.cc:175
static const MacAddress left_si_mac_
Definition: agent.h:1658
#define kAgentResourceRestoreTask
Definition: agent.h:339
void SetPolicy(int task_id, TaskPolicy &policy)
Sets the task exclusion policy. Adds policy entries for the task Examples:
Definition: task.cc:610
static void ReConfigCollectors(const std::vector< std::string > &collector_list)
Definition: sandesh.cc:230
std::string host_name_
Definition: agent.h:1440
AgentUveBase * uve() const
Definition: agent.cc:909
uint16_t dns_port_[MAX_XMPP_SERVERS]
Definition: agent.h:1517
#define kTaskSessionStatsCollectorEvent
Definition: agent.h:330
#define kTaskFlowAudit
Definition: agent.h:326
static const MacAddress right_si_mac_
Definition: agent.h:1659
KSync * ksync_
Definition: agent.h:1413
bool vrouter_on_host_dpdk() const
Definition: agent.cc:1057
const std::vector< std::string > collector_server_list() const
Definition: agent_param.h:306
#define LINKLOCAL_PEER_NAME
Definition: peer.h:20
bool is_l3mh() const
Definition: agent.h:725
void reset_controller_xmpp_channel(uint8_t idx)
Definition: agent.cc:1120
ConfigManager * config_manager() const
Definition: agent.cc:889
const AddressList & gateway_list() const
Definition: agent_param.h:191
static AclTable * acl_table_
Definition: acl.cc:36
boost::asio::ip::address IpAddress
Definition: address.h:13
bool xmpp_auth_enabled() const
Definition: agent_param.h:267
AgentStatsCollector * stats_collector_
Definition: agent.h:1415
#define XMPP_DNS_SERVER_PORT
Definition: agent.h:293
const Ip4Address & loopback_ip() const
Definition: agent_param.h:577
PortIpcHandler * port_ipc_handler() const
Definition: agent.cc:1005
bool tsn_enabled_
Definition: agent.h:1581
AddressList ip_fabric_intf_addr_list_
Definition: agent.h:1498
const std::vector< std::string > controller_server_list() const
Definition: agent_param.h:217
AgentStats * stats() const
Definition: agent.cc:881
const std::string & crypt_port() const
Definition: agent_param.h:213
std::unique_ptr< Peer > fabric_rt_export_peer_
Definition: agent.h:1557
uint16_t flow_thread_count() const
Definition: agent_param.h:428
std::string prog_name_
Definition: agent.h:1444
std::unique_ptr< Peer > local_peer_
Definition: agent.h:1543
#define XMPP_SERVER_PORT
Definition: agent.h:292
std::string dns_addr_[MAX_XMPP_SERVERS]
Definition: agent.h:1516
const std::string & vhost_interface_name() const
Definition: agent.cc:104
bool flow_trace_enable_
Definition: agent.h:1592
bool resource_manager_ready_
Definition: agent.h:1578
void InitXenLinkLocalIntf()
Definition: agent.cc:678
float vr_object_high_watermark() const
Definition: agent_param.h:575
boost::uuids::uuid uuid
#define kTaskHealthCheck
Definition: agent.h:333
void InitCollector()
Definition: agent.cc:583
static const std::string xmpp_control_node_connection_name_prefix_
Definition: agent.h:1661
Definition: task_int.h:10
#define AGENT_FLOW_STATS_MANAGER_TASK
Definition: agent.h:300
#define METADATA_IP_ADDR
Definition: agent.h:294
void set_pkt(PktModule *pkt)
Definition: agent.cc:969
#define MULTICAST_PEER_NAME
Definition: peer.h:25
#define MAC_LEARNING_PEER_NAME
Definition: peer.h:29
void set_measure_queue_delay(bool val)
Definition: agent_param.h:509
boost::shared_ptr< AgentXmppChannel > controller_xmpp_channel_ref(uint8_t idx)
Definition: agent.cc:1124
#define kTaskFlowUpdate
Definition: agent.h:323
bool vrouter_on_host_dpdk() const
Definition: agent_param.h:347
std::string instance_id_
Definition: agent.h:1446
#define kTaskFlowMgmt
Definition: agent.h:325
void set_uve(AgentUveBase *uve)
Definition: agent.cc:913
uint32_t vrouter_max_vrfs() const
Definition: agent.h:1273
static Agent * singleton_
Definition: agent.h:1569
bool test_mode() const
Definition: agent_param.h:368
const Ip4Address & vhost_addr() const
Definition: agent_param.h:184
const int vhost_plen() const
Definition: agent_param.h:189
void CopyFilteredParams()
Definition: agent.cc:469
std::string xs_server_key_
Definition: agent.h:1512
boost::shared_ptr< TraceBuffer< SandeshTrace > > SandeshTraceBufferPtr
Definition: sandesh_trace.h:18
#define LOCAL_PEER_NAME
Definition: peer.h:16
DiagTable * diag_table() const
Definition: agent.cc:873
const std::string & xen_ll_name() const
Definition: agent_param.h:195
uint32_t flow_del_tokens_
Definition: agent.h:1596
std::unique_ptr< Peer > multicast_tor_peer_
Definition: agent.h:1552
std::string module_name_
Definition: agent.h:1448
#define FABRIC_RT_EXPORT
Definition: peer.h:30
bool vrouter_priority_tagging() const
Definition: agent.h:1327
#define ECMP_PEER_NAME
Definition: peer.h:21
bool vrouter_on_nic_mode() const
Definition: agent.cc:1053
void set_rest_server(RestServer *r)
Definition: agent.cc:1001
std::unique_ptr< Peer > vxlan_bgp_peer_
Definition: agent.h:1549
#define kTaskSessionStatsCollector
Definition: agent.h:329
TaskScheduler * task_scheduler_
Definition: agent.h:1451
uint32_t prefix_len_
Definition: agent.h:1496
std::unique_ptr< Peer > mac_learning_peer_
Definition: agent.h:1556
bool isPbbGatewayMode() const
Definition: agent_param.h:391
bool isXenMode() const
Definition: agent_param.h:337
void SetMeasureQueueDelay(bool val)
Definition: agent.cc:1140
std::unique_ptr< Peer > inet_evpn_peer_
Definition: agent.h:1555
uint32_t flow_table_size_
Definition: agent.h:1590
OperDB * oper_db() const
Definition: agent.cc:1013
int GetTaskId(const std::string &name)
Definition: task.cc:856
bool isDockerMode()
Definition: agent.cc:149
AgentParam * params_
Definition: agent.h:1410
#define VGW_PEER_NAME
Definition: peer.h:22
Ip4Address router_id_
Definition: agent.h:1494
void CreateLifetimeManager()
Definition: agent.cc:431
uint32_t vrouter_max_nexthops() const
Definition: agent.h:1259
bool simulate_evpn_tor() const
Definition: agent_param.h:272
Definition: db.h:24
bool pbb_gateway_mode_
Definition: agent.h:1586
#define AGENT_SHUTDOWN_TASKNAME
Definition: agent.h:299
EventNotifier * event_notifier() const
Definition: agent.cc:893
PktModule * pkt_
Definition: agent.h:1417
#define MULTICAST_TOR_PEER_NAME
Definition: peer.h:26
float vr_limit_low_watermark_
Definition: agent.h:1640
const std::string & tunnel_type() const
Definition: agent_param.h:240
MetaDataIpAllocator * metadata_ip_allocator() const
Definition: agent.cc:949
uint32_t max_vm_flows_
Definition: agent.h:1593
std::string xs_server_cert_
Definition: agent.h:1511
void InitializeFilteredParams()
Definition: agent.cc:464
bool dns_auth_enable_
Definition: agent.h:1518
bool isKvmMode() const
Definition: agent_param.h:338
const std::vector< std::string > dns_server_list() const
Definition: agent_param.h:221
SandeshTraceBufferPtr TaskTraceBuf(SandeshTraceBufferCreate("TaskTrace", 5000))
void RegisterLog(LogFn fn)
Definition: task.cc:531
static const std::string v4_link_local_subnet_
Definition: agent.h:1664
static std::string fabric_vrf_name_
Definition: agent.h:1650
uint8_t type
Definition: load_balance.h:109
DomainConfig * domain_config_table()
Definition: operdb_init.h:67
static const std::string integerToString(const NumberType &num)
Definition: string_util.h:19
std::vector< string > & GetCollectorlist()
Definition: agent.h:708
uint8_t GetInterfaceTransport() const
Definition: agent.cc:1179
PortIpcHandler * port_ipc_handler_
Definition: agent.h:1421
Definition: agent.h:358
static void Create(InterfaceTable *table, const std::string &ifname, SubType sub_type, const std::string &vrf_name, const Ip4Address &addr, int plen, const Ip4Address &gw, const std::string &xconnect, const std::string &vn_name, Interface::Transport transport)
Ip4Address loopback_ip_
Definition: agent.h:1642
static void SetTaskPolicyOne(const char *task, const char *exclude_list[], int count)
Definition: agent.cc:164
static TaskScheduler * GetInstance()
Definition: task.cc:547
bool flow_trace_enable() const
Definition: agent_param.h:431
std::unique_ptr< ConfigManager > config_manager_
Definition: agent.h:1485
void ShutdownLifetimeManager()
Definition: agent.cc:436
bool is_l3mh_
Definition: agent.h:1643
void ReInit()
BridgeDomainTable * bridge_domain_table() const
Definition: agent.cc:941
const AddressList & eth_port_addr_list() const
Definition: agent_param.h:208
VrLimitExceeded vr_limits_exceeded_map_
Definition: agent.h:1637
KSync * ksync() const
Definition: agent.cc:901
BridgeDomainTable * bridge_domain_table_
Definition: agent.h:1457
std::vector< std::string > collector_list_
Definition: agent.h:1524
Ip4Address router_id() const
Definition: agent.h:666
bool vrouter_on_host() const
Definition: agent_param.h:350
LifetimeManager * lifetime_manager_
Definition: agent.h:1566
#define kTaskFlowKSync
Definition: agent.h:322
VNController * controller() const
Definition: agent.cc:981
std::string xs_addr_[MAX_XMPP_SERVERS]
Definition: agent.h:1507
static const std::string null_string_
Definition: agent.h:1648
EventManager * event_manager() const
Definition: agent.h:1103
std::string xmpp_server_key() const
Definition: agent_param.h:269
uint16_t http_server_port() const
Definition: agent_param.h:312
std::string ip_fabric_intf_name_
Definition: agent.h:1526
#define MULTICAST_FABRIC_TREE_BUILDER_NAME
Definition: peer.h:27
void set_flow_table_size(uint32_t count)
Definition: agent.cc:1106
virtual std::string Description() const =0
#define CHECK_CONCURRENCY(...)
#define kTaskFlowDelete
Definition: agent.h:324
bool isVmwareMode() const
Definition: agent_param.h:340
void InitDone()
Definition: agent.cc:635
static const std::string & NullString()
Definition: agent.h:437
bool vrouter_on_nic_mode() const
Definition: agent_param.h:344
VNController * controller_
Definition: agent.h:1424
bool vrouter_on_host() const
Definition: agent.cc:1061
int introspect_port_
Definition: agent.h:1445
static const std::set< std::string > null_string_list_
Definition: agent.h:1649
static int http_port()
Definition: p/sandesh.h:297
uint32_t flow_ksync_tokens_
Definition: agent.h:1595
uint32_t flow_add_tokens() const
Definition: agent_param.h:259
bool IsForwardingEnabled() const
Definition: agent_param.h:386
bool xmpp_dns_auth_enabled() const
Definition: agent_param.h:271
uint32_t vrouter_max_labels() const
Definition: agent.h:1252
void set_vgw(VirtualGateway *vgw)
Definition: agent.cc:993
AgentStatsCollector * stats_collector() const
Definition: agent.cc:917
int GetTaskInstance() const
Definition: task.h:119
void ModifyTbbKeepAwakeTimeout(uint32_t timeout)
Definition: task.cc:505
bool forwarding_enabled_
Definition: agent.h:1583
AgentParam * params() const
Definition: agent.h:1218
#define kTaskCryptTunnel
Definition: agent.h:334
Definition: peer.h:44
#define kTaskFlowStatsUpdate
Definition: agent.h:331
AddressList gateway_list_
Definition: agent.h:1497
OperDB * oper_db_
Definition: agent.h:1422
#define kTaskConfigManager
Definition: agent.h:337
void set_flow_stats_manager(FlowStatsManager *fsc)
Definition: agent.cc:929
bool tor_agent_enabled_
Definition: agent.h:1582
const Ip4Address & xen_ll_addr() const
Definition: agent_param.h:199
const std::string & agent_name() const
Definition: agent.h:878
void set_cfg(AgentConfig *cfg)
Definition: agent.cc:869
void ParseAddresses(const std::vector< std::string > &addresses, std::string out_ips[], uint16_t out_ports[]) const
void SetXmppDscp(uint8_t val)
Definition: agent.cc:1144
RestServer * rest_server_
Definition: agent.h:1420
#define kAgentResourceBackUpTask
Definition: agent.h:340
std::unique_ptr< Peer > ecmp_peer_
Definition: agent.h:1546
XmppClient * xmpp_client_[MAX_XMPP_SERVERS]
Definition: agent.h:1431
std::vector< TaskExclusion > TaskPolicy
Definition: task.h:59
boost::asio::ip::address_v4 Ip4Address
Definition: address.h:14
uint32_t vrouter_max_mirror_entries() const
Definition: agent.h:1280
const std::string & host_name() const
Definition: agent_param.h:314
#define kTaskFlowStatsCollector
Definition: agent.h:328
std::string xmpp_ca_cert() const
Definition: agent_param.h:270
static const std::string link_local_vrf_name_
Definition: agent.h:1653
#define MAX_XMPP_SERVERS
Definition: agent.h:291
float max_vm_flows() const
Definition: agent_param.h:254
std::string AgentBackTrace(int skip=1)
Definition: agent.cc:1187
std::pair< std::string, std::string > VrLimitData
Definition: agent.h:215
FlowStatsManager * flow_stats_manager_
Definition: agent.h:1416
uint32_t flow_ksync_tokens() const
Definition: agent_param.h:260
bool isTsnAgent() const
Definition: agent_param.h:381
std::string AgentGUID() const
Definition: agent.cc:157
void set_port_ipc_handler(PortIpcHandler *r)
Definition: agent.cc:1009
std::string agent_name_
Definition: agent.h:1443
std::unique_ptr< Peer > evpn_peer_
Definition: agent.h:1550
const Ip4Address & xen_ll_gw() const
Definition: agent_param.h:202
uint32_t flow_del_tokens() const
Definition: agent_param.h:261
const std::string & module_name() const
Definition: agent.h:892
void set_stats(AgentStats *stats)
Definition: agent.cc:885
std::unique_ptr< MetaDataIpAllocator > metadata_ip6_allocator_
Definition: agent.h:1459
void DebugSignalHandler(boost::system::error_code, int)
Definition: agent.cc:745
void ReconfigSignalHandler(boost::system::error_code, int)
Definition: agent.cc:733
const int xen_ll_plen() const
Definition: agent_param.h:201
int module_type_
Definition: agent.h:1447
void set_event_notifier(EventNotifier *mgr)
Definition: agent.cc:897
HealthCheckTable * health_check_table() const
Definition: agent.cc:933
static bool InitGenerator(const std::string &module, const std::string &source, const std::string &node_type, const std::string &instance_id, EventManager *evm, unsigned short http_port, const std::vector< std::string > &collectors, SandeshContext *client_context=NULL, DerivedStats ds=DerivedStats(), const SandeshConfig &config=SandeshConfig())
Definition: sandesh.cc:271
bool is_vhost_interface_up() const
Definition: agent.cc:108
static const char * kDnsNodeJID
Definition: xmpp_init.h:19
uint32_t vrouter_max_interfaces() const
Definition: agent.h:1266
static const std::string xmpp_dns_server_connection_name_prefix_
Definition: agent.h:1660
int GetTaskId() const
Definition: task.h:118
void InitControllerList()
Definition: agent.cc:454
HealthCheckTable * health_check_table_
Definition: agent.h:1456
const void set_xen_ll_name(const std::string &name)
Definition: agent_param.h:196
boost::shared_ptr< AgentXmppChannel > agent_xmpp_channel_[MAX_XMPP_SERVERS]
Definition: agent.h:1429
uint32_t flow_add_tokens_
Definition: agent.h:1594
std::unique_ptr< AgentSignal > agent_signal_
Definition: agent.h:1560
static const uint16_t kDefaultVmiVmVnUveInterval
Definition: agent.h:382
uint32_t controller_chksum_
Definition: agent.h:1521
const std::string & GetHostInterfaceName() const
Definition: agent.cc:93
EventNotifier * event_notifier_
Definition: agent.h:1426
void set_cn_mcast_builder(AgentXmppChannel *peer)
Definition: agent.cc:579
bool isKvmMode()
Definition: agent.cc:145
const std::string & program_name() const
Definition: agent_param.h:289
uint32_t task_monitor_timeout_msec_
Definition: agent.h:1631
std::unique_ptr< Peer > multicast_tree_builder_peer_
Definition: agent.h:1553
uint32_t flow_update_tokens_
Definition: agent.h:1597
static const std::string link_local_vn_name_
Definition: agent.h:1654
void set_metadata_ip6_allocator(MetaDataIpAllocator *allocator)
Definition: agent.cc:961
const std::map< std::string, std::map< std::string, std::string > > derived_stats_map() const
Definition: agent_param.h:309
uint32_t vrouter_max_oflow_entries() const
Definition: agent.h:1310
void set_metadata_ip_allocator(MetaDataIpAllocator *allocator)
Definition: agent.cc:953
uint32_t tbb_keepawake_timeout_
Definition: agent.h:1629
bool isXenMode()
Definition: agent.cc:141
uint32_t vrouter_max_oflow_bridge_entries() const
Definition: agent.h:1295
static const std::string fabric_vn_name_
Definition: agent.h:1651
static const std::string v6_link_local_subnet_
Definition: agent.h:1665
uint32_t vrouter_max_flow_entries() const
Definition: agent.h:1303
std::string subcluster_name_
Definition: agent.h:1514
std::unique_ptr< Peer > evpn_routing_peer_
Definition: agent.h:1548
Agent()
Definition: agent.cc:751
VirtualGateway * vgw_
Definition: agent.h:1419
#define LOG(_Level, _Msg)
Definition: logging.h:33
bool isVcpeGatewayMode() const
Definition: agent_param.h:390
void set_health_check_table(HealthCheckTable *table)
Definition: agent.cc:937
std::vector< std::string > controller_list_
Definition: agent.h:1520
std::string crypt_intf_name_
Definition: agent.h:1527
XmppClient * dns_xmpp_client_[MAX_XMPP_SERVERS]
Definition: agent.h:1434
InterfaceTable * intf_table_
Definition: agent.h:1455
Agent::ForwardingMode TranslateForwardingMode(const std::string &mode) const
Definition: agent.cc:1095
std::unique_ptr< Peer > multicast_peer_
Definition: agent.h:1551
#define LOCAL_VM_EXPORT_PEER
Definition: peer.h:31
bool isDockerMode() const
Definition: agent_param.h:339
std::string xs_ca_cert_
Definition: agent.h:1513
#define AGENT_SANDESH_TASKNAME
Definition: agent.h:301
const SandeshConfig & sandesh_config() const
Definition: agent_param.h:426
bool xs_auth_enable_
Definition: agent.h:1510
static void SetDefaultType(Type type)
Definition: nexthop.h:306
VirtualGateway * vgw() const
Definition: agent.cc:989
void set_stats_collector(AgentStatsCollector *asc)
Definition: agent.cc:921
void set_diag_table(DiagTable *table)
Definition: agent.cc:877
Ip4Address compute_node_ip_
Definition: agent.h:1504
void ReConnectCollectors()
Definition: agent.cc:629
uint16_t xs_port_[MAX_XMPP_SERVERS]
Definition: agent.h:1508
static std::string fabric_policy_vrf_name_
Definition: agent.h:1652
EventManager * event_mgr_
Definition: agent.h:1428
void set_controller(VNController *val)
Definition: agent.cc:985
uint32_t dns_chksum_
Definition: agent.h:1523
std::string GetUuidStr(boost::uuids::uuid uuid_val) const
Definition: agent.cc:98
bool isVmwareVcenterMode() const
Definition: agent.cc:1037
void TaskTrace(const char *file_name, uint32_t line_no, const Task *task, const char *description, uint64_t delay)
Definition: agent.cc:1128
AgentConfig * cfg() const
Definition: agent.cc:865
AgentXmppChannel * cn_mcast_builder_
Definition: agent.h:1437
bool isServerGatewayMode() const
Definition: agent_param.h:389
std::string vhost_interface_name_
Definition: agent.h:1528
DB * db_
Definition: agent.h:1450
bool tsn_no_forwarding_enabled_
Definition: agent.h:1580
PktModule * pkt() const
Definition: agent.cc:965
bool simulate_evpn_tor_
Definition: agent.h:1579
uint32_t GenerateHash(std::vector< std::string > &)
Definition: agent.cc:441
static const MacAddress pkt_interface_mac_
Definition: agent.h:1656
void Terminate()
Definition: task.cc:978
bool isVmwareVcenterMode() const
Definition: agent_param.h:341
#define INSTANCE_MANAGER_TASK_NAME
Definition: agent.h:298
MetaDataIpAllocator * metadata_ip6_allocator() const
Definition: agent.cc:957
const std::string & agent_name() const
Definition: agent_param.h:204
void set_ksync(KSync *ksync)
Definition: agent.cc:905
const std::string & host_name() const
Definition: agent.h:875
void SetResourceManagerReady()
Definition: agent.cc:1174
#define AGENT_INIT_TASKNAME
Definition: agent.h:297
Definition: peer.h:257
Task is a wrapper over tbb::task to support policies.
Definition: task.h:86
std::unique_ptr< Peer > mac_vm_binding_peer_
Definition: agent.h:1554
const std::vector< std::string > & eth_port_list() const
Definition: agent_param.h:205
const std::string & subcluster_name() const
Definition: agent_param.h:220
bool measure_queue_delay() const
Definition: agent_param.h:508
uint32_t flow_update_tokens() const
Definition: agent_param.h:262
std::unique_ptr< Peer > linklocal_peer_
Definition: agent.h:1545
static uint16_t ProtocolStringToInt(const std::string &str)
Definition: agent.cc:1066
std::unique_ptr< Peer > local_vm_peer_
Definition: agent.h:1544
std::string vrouter_build_info() const
Definition: agent.h:1319
static bool interface_exist(string &name)
Definition: agent.cc:653
#define kTaskMacLearning
Definition: agent.h:341
bool cat_is_agent_mocked() const
Definition: agent_param.h:569
static const char * kControlNodeJID
Definition: xmpp_init.h:17
void set_resource_manager(ResourceManager *resource_manager)
Definition: agent.cc:1025
ResourceManager * resource_manager_
Definition: agent.h:1425
std::unique_ptr< MetaDataIpAllocator > metadata_ip_allocator_
Definition: agent.h:1458
ResourceManager * resource_manager() const
Definition: agent.cc:1021
SandeshTraceBufferPtr SandeshTraceBufferCreate(const std::string &buf_name, size_t buf_size, bool trace_enable=true)
Definition: sandesh_trace.h:46
int32_t skip(Protocol_ &prot, TType type)
Definition: TProtocol.h:187
bool isMockMode() const
Definition: agent.cc:153
uint32_t vrouter_max_bridge_entries() const
Definition: agent.h:1288
bool test_mode_
Definition: agent.h:1575
VrouterObjectLimits GetVrouterObjectLimits()
Definition: agent.cc:1157