OpenSDN source code
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
global_vrouter.cc
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
3  */
4 
5 // global_vrouter.cc - operational data for global vrouter configuration
6 #include <boost/foreach.hpp>
7 #include <base/util.h>
8 #include <cmn/agent_cmn.h>
9 #include <cfg/cfg_init.h>
10 #include <route/route.h>
11 
12 #include <vnc_cfg_types.h>
13 #include <agent_types.h>
14 #include <ifmap/ifmap_link.h>
15 #include <ifmap/ifmap_node.h>
16 
17 #include <oper/operdb_init.h>
18 #include <oper/peer.h>
19 #include <oper/vrf.h>
20 #include <oper/interface_common.h>
21 #include <oper/nexthop.h>
22 #include <oper/vn.h>
23 #include <oper/mirror_table.h>
24 #include <oper/vxlan.h>
25 #include <oper/mpls.h>
26 #include <oper/route_common.h>
27 #include <oper/ecmp_load_balance.h>
28 #include <oper/config_manager.h>
29 #include <oper/crypt_tunnel.h>
30 
33 #include <oper/global_vrouter.h>
35 
36 const std::string GlobalVrouter::kMetadataService = "metadata";
37 const std::string GlobalVrouter::kMetadataService6 = "metadata6";
39 
40 static int ProtocolToString(const std::string proto) {
41  if (proto == "TCP" || proto == "tcp") {
42  return IPPROTO_TCP;
43  }
44 
45  if (proto == "UDP" || proto == "udp") {
46  return IPPROTO_UDP;
47  }
48 
49  if (proto == "ICMP" || proto == "icmp") {
50  return IPPROTO_ICMP;
51  }
52 
53  if (proto == "SCTP" || proto == "sctp") {
54  return IPPROTO_SCTP;
55  }
56 
57  if (proto == "all") {
58  return 0;
59  }
60 
61  return atoi(proto.c_str());
62 }
63 
64 void GlobalVrouter::UpdateFlowAging(autogen::GlobalVrouterConfig *cfg) {
65  if (agent()->flow_stats_req_handler() == NULL) {
66  return;
67  }
68 
69  std::vector<autogen::FlowAgingTimeout>::const_iterator new_list_it =
70  cfg->flow_aging_timeout_list().begin();
71  FlowAgingTimeoutMap new_flow_aging_timeout_map;
72 
73  while (new_list_it != cfg->flow_aging_timeout_list().end()) {
74  int proto = ProtocolToString(new_list_it->protocol);
75  if (proto < 0 || proto > 0xFF) {
76  new_list_it++;
77  continue;
78  }
79  FlowAgingTimeoutKey key(proto, new_list_it->port);
80  agent()->flow_stats_req_handler()(agent(), proto, new_list_it->port,
81  new_list_it->timeout_in_seconds);
82 
83  flow_aging_timeout_map_.erase(key);
84  new_flow_aging_timeout_map.insert(
85  FlowAgingTimeoutPair(key, new_list_it->timeout_in_seconds));
86  new_list_it++;
87  }
88 
89  FlowAgingTimeoutMap::const_iterator old_list_it =
91  while (old_list_it != flow_aging_timeout_map_.end()) {
92  agent()->flow_stats_req_handler()(agent(), old_list_it->first.protocol,
93  old_list_it->first.port, 0);
94  old_list_it++;
95  }
96  flow_aging_timeout_map_ = new_flow_aging_timeout_map;
97 }
98 
100 
101  if (agent()->flow_stats_req_handler() == NULL) {
102  return;
103  }
104 
105  FlowAgingTimeoutMap::const_iterator old_list_it =
106  flow_aging_timeout_map_.begin();
107  while (old_list_it != flow_aging_timeout_map_.end()) {
108  agent()->flow_stats_req_handler()(agent(), old_list_it->first.protocol,
109  old_list_it->first.port, 0);
110  old_list_it++;
111  }
112  flow_aging_timeout_map_.clear();
113 }
114 
115 void GlobalVrouter::UpdatePortConfig(autogen::GlobalVrouterConfig *cfg) {
116  if (agent()->port_config_handler() == NULL) {
117  return;
118  }
119 
120  ProtocolPortSet new_protocol_port_set;
121  std::vector<autogen::PortTranslationPool>::const_iterator new_list_it =
122  cfg->port_translation_pools().begin();
123  for (;new_list_it != cfg->port_translation_pools().end(); new_list_it++) {
124  int proto = ProtocolToString(new_list_it->protocol);
125  if (proto < 0 || proto > 0xFF) {
126  new_list_it++;
127  continue;
128  }
129 
130  if (proto != IPPROTO_TCP && proto != IPPROTO_UDP) {
131  continue;
132  }
133 
134  uint16_t port_count = 0;
135  std::stringstream str(new_list_it->port_count);
136  str >> port_count;
137 
138  protocol_port_set_.erase(proto);
139  if (new_list_it->port_range.start_port != 0 &&
140  new_list_it->port_range.end_port != 0) {
141  PortConfig::PortRange range(new_list_it->port_range.start_port,
142  new_list_it->port_range.end_port);
143  new_protocol_port_set[proto].port_range.push_back(range);
144  } else if (port_count != 0) {
145  new_protocol_port_set[proto].port_count = port_count;
146  }
147  }
148 
149  struct rlimit rl;
150  int result = getrlimit(RLIMIT_NOFILE, &rl);
151  int avail_count = 0;
152  if (result == 0) {
153  avail_count = rl.rlim_max - Agent::kMaxOtherOpenFds;
154  if (avail_count < 0) {
155  avail_count = 0;
156  }
157  }
158 
159 
160  ProtocolPortSet::const_iterator old_list_it = protocol_port_set_.begin();
161  for (; old_list_it != protocol_port_set_.end(); old_list_it++) {
162  PortConfig pc;
163  agent()->port_config_handler()(agent(), old_list_it->first, &pc);
164  }
165 
166  int total_port_count = 0;
167  ProtocolPortSet::iterator pc_list_it = new_protocol_port_set.begin();
168  for (; pc_list_it != new_protocol_port_set.end(); pc_list_it++) {
169  pc_list_it->second.Trim();
170  total_port_count += pc_list_it->second.port_count;
171  }
172 
173  float avail_percent = 1;
174  if (total_port_count > avail_count) {
175  avail_percent = (float)avail_count / (float)total_port_count;
176  }
177 
178  pc_list_it = new_protocol_port_set.begin();
179  for (; pc_list_it != new_protocol_port_set.end(); pc_list_it++) {
180  pc_list_it->second.port_count *= avail_percent;
181  agent()->port_config_handler()(agent(), pc_list_it->first,
182  &(pc_list_it->second));
183  }
184 
185  protocol_port_set_ = new_protocol_port_set;
186 }
187 
189  ProtocolPortSet::const_iterator it = protocol_port_set_.begin();
190  for (; it != protocol_port_set_.end(); it++) {
191  PortConfig pc;
192  agent()->port_config_handler()(agent(), it->first, &pc);
193  }
194 
195  protocol_port_set_.clear();
196 }
197 
199 
200 // Link local service
202  const std::string &service_name,
203  const std::string &fabric_dns_name,
204  const std::vector<Ip4Address> &fabric_ip,
205  uint16_t fabric_port)
206  : linklocal_service_name(service_name),
207  ipfabric_dns_service_name(fabric_dns_name),
208  ipfabric_service_ip(fabric_ip),
209  ipfabric_service_port(fabric_port) {
210 }
211 
213  const LinkLocalService &rhs) const {
214  if (linklocal_service_name == rhs.linklocal_service_name &&
215  ipfabric_dns_service_name == rhs.ipfabric_dns_service_name &&
216  ipfabric_service_ip == rhs.ipfabric_service_ip &&
217  ipfabric_service_port == rhs.ipfabric_service_port)
218  return true;
219  return false;
220 }
221 
223  BOOST_FOREACH(Ip4Address ipfabric_addr, ipfabric_service_ip) {
224  if (ipfabric_addr == ip)
225  return true;
226  }
227  return false;
228 }
229 
231  const LinkLocalServiceKey &rhs) const {
232  if (linklocal_service_ip != rhs.linklocal_service_ip)
233  return linklocal_service_ip < rhs.linklocal_service_ip;
234  return linklocal_service_port < rhs.linklocal_service_port;
235 }
236 
238 
239 // Async resolve DNS names (used to resolve names given in linklocal config)
241 public:
242  typedef boost::asio::ip::udp boost_udp;
243  static const uint32_t kDnsTimeout = 15 * 60 * 1000; // fifteen minutes
244 
245  FabricDnsResolver(GlobalVrouter *vrouter, boost::asio::io_service &io)
246  : request_count_(0), response_count_(0), global_vrouter_(vrouter),
247  io_(io) {
248  // start timer to re-resolve the DNS names to IP addresses
249  timer_ = TimerManager::CreateTimer(io_, "DnsHandlerTimer");
250  timer_->Start(kDnsTimeout,
251  boost::bind(&GlobalVrouter::FabricDnsResolver::OnTimeout, this));
252  }
253  virtual ~FabricDnsResolver() {
254  timer_->Cancel();
256  }
257 
258  // Called in DB context, gives the list of names to be resolved
259  void ResolveList(const std::vector<std::string> &name_list) {
260  std::vector<Ip4Address> empty_addr_list;
261  ResolveMap new_addr_map;
262  tbb::mutex::scoped_lock lock(mutex_);
263  BOOST_FOREACH(std::string name, name_list) {
264  ResolveName(name);
265  ResolveMap::iterator it = address_map_.find(name);
266  if (it != address_map_.end()) {
267  new_addr_map.insert(ResolvePair(name, it->second));
268  address_map_.erase(it);
269  } else {
270  new_addr_map.insert(ResolvePair(name, empty_addr_list));
271  }
272  }
273  address_map_.swap(new_addr_map);
274  }
275 
276  // Called from client tasks to resolve name to address
277  bool Resolve(const std::string &name, Ip4Address *address) {
278  tbb::mutex::scoped_lock lock(mutex_);
279  ResolveMap::iterator it = address_map_.find(name);
280  if (it != address_map_.end() && it->second.size()) {
281  int index = rand() % it->second.size();
282  *address = it->second[index];
283  if (*address == kLoopBackIp) {
284  *address = global_vrouter_->agent()->router_id();
285  }
286  return true;
287  }
288  return false;
289  }
290 
291  // Timer handler; re-resolve all DNS names
292  bool OnTimeout() {
293  tbb::mutex::scoped_lock lock(mutex_);
294  for (ResolveMap::const_iterator it = address_map_.begin();
295  it != address_map_.end(); ++it) {
296  ResolveName(it->first);
297  }
298  return true;
299  }
300 
301  // Called in DB context
302  bool IsAddressInUse(const Ip4Address &ip) {
303  tbb::mutex::scoped_lock lock(mutex_);
304  for (ResolveMap::const_iterator it = address_map_.begin();
305  it != address_map_.end(); ++it) {
306  BOOST_FOREACH(Ip4Address address, it->second) {
307  if (address == ip)
308  return true;
309  }
310  }
311  return false;
312  }
313 
314  uint64_t PendingRequests() const {
315  return request_count_ - response_count_;
316  }
317 
318 private:
319  typedef std::map<std::string, std::vector<Ip4Address> > ResolveMap;
320  typedef std::pair<std::string, std::vector<Ip4Address> > ResolvePair;
321 
322  void ResolveName(const std::string &name) {
323  boost_udp::resolver *resolver = new boost_udp::resolver(io_);
324 
325  resolver->async_resolve(
326  boost_udp::resolver::query(boost_udp::v4(), name, "domain"),
328  _1, _2, name, resolver));
329  request_count_++;
330  }
331 
332  // called in asio context, handle resolve response
333  void ResolveHandler(const boost::system::error_code& error,
334  boost_udp::resolver::iterator resolve_it,
335  std::string &name, boost_udp::resolver *resolver) {
336  std::vector<Ip4Address> old_list;
337  ResolveMap::iterator addr_it;
338  tbb::mutex::scoped_lock lock(mutex_);
339  addr_it = address_map_.find(name);
340  if (addr_it != address_map_.end()) {
341  old_list.swap(addr_it->second);
342  if (!error) {
343  boost_udp::resolver::iterator end;
344  while (resolve_it != end) {
345  boost_udp::endpoint ep = *resolve_it;
346  addr_it->second.push_back(ep.address().to_v4());
347  resolve_it++;
348  }
349  }
350  global_vrouter_->LinkLocalRouteUpdate(addr_it->second);
351  }
352  response_count_++;
353  delete resolver;
354  }
355 
357  tbb::mutex mutex_;
359  uint64_t request_count_;
360  uint64_t response_count_;
362  boost::asio::io_service &io_;
363 };
364 
366 
367 // Add / delete routes to ip fabric servers used for link local services
368 // Also, add / delete receive routes for link local addresses in different VRFs
370 public:
372  : global_vrouter_(vrouter), vn_id_(DBTableBase::kInvalidId){
373  }
374 
376  DeleteDBClients();
377  ipfabric_address_list_.clear();
378  linklocal_address_list_.clear();
379  }
380 
381  void CreateDBClients();
382  void DeleteDBClients();
383  void AddArpRoute(const Ip4Address &srv);
384  void UpdateAllVns(const LinkLocalServiceKey &key, bool is_add);
385 
386 private:
387  bool VnUpdateWalk(DBEntryBase *entry, const LinkLocalServiceKey key,
388  bool is_add);
389  void VnWalkDone(DBTable::DBTableWalkRef ref);
390  bool VnNotify(DBTablePartBase *partition, DBEntryBase *entry);
391 
394  std::set<Ip4Address> ipfabric_address_list_;
395  std::set<IpAddress> linklocal_address_list_;
396 };
397 
399  vn_id_ = global_vrouter_->agent()->vn_table()->Register(
401  this, _1, _2));
402 }
403 
405  global_vrouter_->agent()->vn_table()->Unregister(vn_id_);
406 }
407 
409  std::set<Ip4Address>::iterator it;
410  std::pair<std::set<Ip4Address>::iterator, bool> ret;
411 
412  ret = ipfabric_address_list_.insert(srv);
413  if (ret.second == false) {
414  return;
415  }
416 
417  Agent *agent = global_vrouter_->agent();
418  VnListType vn_list;
419  vn_list.insert(agent->fabric_vn_name());
421  srv, agent->vhost_interface(),
422  vn_list, SecurityGroupList(),
423  TagList());
424 }
425 
426 // Walk thru all the VNs
428  const LinkLocalServiceKey &key, bool is_add) {
429  if (is_add) {
430  if (!linklocal_address_list_.insert(key.linklocal_service_ip).second)
431  return;
432  } else {
433  if (!linklocal_address_list_.erase(key.linklocal_service_ip))
434  return;
435  }
436  // This walker allocation has to be done everytime as function argument
437  // takes key and is_add which keeps varying. So boost bind needs to be
438  // redone.
439  // Also thats the reason why previous walk is also not stopped and it runs
440  // to completion.
441  // TODO: Evaluate if this can be optimized
442  DBTable::DBTableWalkRef walk_ref =
443  global_vrouter_->agent()->vn_table()->AllocWalker(
445  this, _2, key, is_add),
447  this, _1));
448  global_vrouter_->agent()->vn_table()->WalkAgain(walk_ref);
449 }
450 
451 // Vn Walk method
452 // For each Vn, add or delete receive route for the specified linklocal service
454  DBEntryBase *entry, const LinkLocalServiceKey key, bool is_add) {
455 
456  VnEntry *vn_entry = static_cast<VnEntry *>(entry);
457  if (vn_entry->IsDeleted()) {
458  return true;
459  }
460 
461  VrfEntry *vrf_entry = vn_entry->GetVrf();
462  if (!vrf_entry) {
463  return true;
464  }
465 
466  Agent *agent = global_vrouter_->agent();
467  // Do not create the routes for the default VRF
468  if (agent->fabric_vrf_name() == vrf_entry->GetName()) {
469  return true;
470  }
471 
472  InetUnicastAgentRouteTable *rt_table =
474 
475  LinkLocalDBState *state = static_cast<LinkLocalDBState *>
476  (vn_entry->GetState(vn_entry->get_table_partition()->parent(), vn_id_));
477  if (!state) {
478  return true;
479  }
480 
481  if (is_add) {
482  if (vn_entry->layer3_forwarding()) {
483  state->Add(key.linklocal_service_ip);
485  boost::uuids::nil_uuid(),
486  agent->vhost_interface_name());
487 
488  rt_table->AddVHostRecvRoute(agent->link_local_peer(),
489  vrf_entry->GetName(),
490  vmi_key,
492  key.linklocal_service_ip.is_v4() ? 32 : 128,
493  vn_entry->GetName(),
494  true, false, false);
495  }
496  } else {
497  state->Delete(key.linklocal_service_ip);
498  rt_table->DeleteReq(agent->link_local_peer(), vrf_entry->GetName(),
500  key.linklocal_service_ip.is_v4() ? 32 : 128, NULL);
501  }
502  return true;
503 }
504 
505 void
507  global_vrouter_->agent()->vn_table()->ReleaseWalker(ref);
508 }
509 
510 // VN notify handler
512  DBEntryBase *entry) {
513  VnEntry *vn_entry = static_cast<VnEntry *>(entry);
514  VrfEntry *vrf_entry = vn_entry->GetVrf();
515  Agent *agent = global_vrouter_->agent();
516  if (vn_entry->IsDeleted() || !vn_entry->layer3_forwarding() || !vrf_entry) {
517  LinkLocalDBState *state = static_cast<LinkLocalDBState *>
518  (vn_entry->GetState(partition->parent(), vn_id_));
519  if (!state)
520  return true;
521  for (std::set<IpAddress>::const_iterator it =
522  state->addresses_.begin(); it != state->addresses_.end(); ++it) {
523  InetUnicastAgentRouteTable *rt_table =
524  state->vrf_->GetInetUnicastRouteTable(*it);
525  rt_table->DeleteReq(agent->link_local_peer(),
526  state->vrf_->GetName(), *it, it->is_v4() ? 32 : 128, NULL);
527  }
528  vn_entry->ClearState(partition->parent(), vn_id_);
529  delete state;
530  return true;
531  }
532 
533  // Do not create the routes for the default VRF
534  if (agent->fabric_vrf_name() == vrf_entry->GetName()) {
535  return true;
536  }
537 
538  if (vn_entry->layer3_forwarding()) {
539  if (vn_entry->GetState(partition->parent(), vn_id_))
540  return true;
541  LinkLocalDBState *state = new LinkLocalDBState(vrf_entry);
542  vn_entry->SetState(partition->parent(), vn_id_, state);
543  InetUnicastAgentRouteTable *rt_table = NULL;
544  const GlobalVrouter::LinkLocalServicesMap &services =
545  global_vrouter_->linklocal_services_map();
546  for (GlobalVrouter::LinkLocalServicesMap::const_iterator it =
547  services.begin(); it != services.end(); ++it) {
549  boost::uuids::nil_uuid(),
550  agent->vhost_interface_name());
551  rt_table =
552  vrf_entry->GetInetUnicastRouteTable(it->first.linklocal_service_ip);
553  state->Add(it->first.linklocal_service_ip);
554  rt_table->AddVHostRecvRoute(agent->link_local_peer(),
555  vrf_entry->GetName(),
556  key,
557  it->first.linklocal_service_ip,
558  it->first.linklocal_service_ip.is_v4() ? 32 : 128,
559  vn_entry->GetName(),
560  true, false, false);
561  }
562  }
563  return true;
564 }
565 
567 
573  (this, *(agent->event_manager()->io_service()))),
576  slo_uuid_(boost::uuids::nil_uuid()) {
578  (new AgentRouteResync("GlobalVrouterRouteWalker", agent));
579  agent->oper_db()->agent_route_walk_manager()->
580  RegisterWalker(static_cast<AgentRouteWalker *>
582  }
583 
586  ReleaseWalker(agent_route_resync_walker_.get());
587 }
588 
589 
591  return fabric_dns_resolver_.get()->PendingRequests();
592 }
593 
595  linklocal_route_mgr_->CreateDBClients();
596 }
597 
599  GlobalVrouterConfig(node);
600  configured_ = false;
601  agent()->connection_state()->Update();
602  return;
603 }
604 
606  GlobalVrouterConfig(node);
607  configured_ = true;
608  agent()->connection_state()->Update();
609  return;
610 }
611 
614 }
615 
617  IFMapAgentTable *table = static_cast<IFMapAgentTable *>(node->table());
618  DBGraph *graph = table->GetGraph();
619  for (DBGraphVertex::adjacency_iterator iter = node->begin(graph);
620  iter != node->end(table->GetGraph()); ++iter) {
621 
622  IFMapNode *adj_node = static_cast<IFMapNode *>(iter.operator->());
623  if (agent()->config_manager()->SkipNode(adj_node)) {
624  continue;
625  }
626 
627  if (adj_node->table() == agent()->cfg()->cfg_slo_table()) {
628  autogen::SecurityLoggingObject *slo =
629  static_cast<autogen::SecurityLoggingObject *>(adj_node->
630  GetObject());
631  autogen::IdPermsType id_perms = slo->id_perms();
632  CfgUuidSet(id_perms.uuid.uuid_mslong, id_perms.uuid.uuid_lslong,
633  slo_uuid_);
634  }
635  }
636 }
637 
638 // Handle incoming global vrouter configuration
640  Agent::VxLanNetworkIdentifierMode cfg_vxlan_network_identifier_mode =
642  bool resync_vn = false; //resync_vn walks internally calls VMI walk.
643  bool resync_route = false;
644 
645  if (node->IsDeleted() == false) {
646  UpdateSLOConfig(node);
647 
648  autogen::GlobalVrouterConfig *cfg =
649  static_cast<autogen::GlobalVrouterConfig *>(node->GetObject());
650 
651  agent()->set_global_slo_status(cfg->enable_security_logging());
652 
653  resync_route =
654  TunnelType::EncapPrioritySync(cfg->encapsulation_priorities());
655  if (cfg->vxlan_network_identifier_mode() == "configured") {
656  cfg_vxlan_network_identifier_mode = Agent::CONFIGURED;
657  }
658  UpdateLinkLocalServiceConfig(cfg->linklocal_services());
659  UpdateCryptTunnelEndpointConfig(cfg->encryption_tunnel_endpoints(),
660  cfg->encryption_mode());
661 
662  //Take the forwarding mode if its set, else fallback to l2_l3.
663  Agent::ForwardingMode new_forwarding_mode =
664  agent()->TranslateForwardingMode(cfg->forwarding_mode());
665  if (new_forwarding_mode != forwarding_mode_) {
666  forwarding_mode_ = new_forwarding_mode;
667  resync_route = true;
668  resync_vn = true;
669  }
670  if (cfg->IsPropertySet
671  (autogen::GlobalVrouterConfig::FLOW_EXPORT_RATE)) {
672  flow_export_rate_ = cfg->flow_export_rate();
673  } else {
675  }
676  UpdateFlowAging(cfg);
677  UpdatePortConfig(cfg);
679  if (cfg->ecmp_hashing_include_fields().hashing_configured) {
680  ecmp_load_balance.UpdateFields(cfg->
681  ecmp_hashing_include_fields());
682  }
683  if (ecmp_load_balance_ != ecmp_load_balance) {
685  resync_vn = true;
686  }
687  } else {
690  resync_route = true;
692  DeleteFlowAging();
694  }
695 
696  if (cfg_vxlan_network_identifier_mode !=
697  agent()->vxlan_network_identifier_mode()) {
699  (cfg_vxlan_network_identifier_mode);
700  resync_vn = true;
701  }
702 
703  //Rebakes
704  if (resync_route) {
705  //Resync vm_interfaces to handle ethernet tag change if vxlan changed to
706  //mpls or vice versa.
707  //Update all routes irrespectively as this will handle change of
708  //priority between MPLS-UDP to MPLS-GRE and vice versa.
709  ResyncRoutes();
710  resync_vn = true;
711  }
712 
713  //Rebakes VN and then all interfaces.
714  if (resync_vn)
716 }
717 
718 // Get link local service configuration info, for a given service name
719 bool GlobalVrouter::FindLinkLocalService(const std::string &service_name,
720  IpAddress *service_ip,
721  uint16_t *service_port,
722  std::string *fabric_hostname,
723  Ip4Address *fabric_ip,
724  uint16_t *fabric_port) const {
725  std::string name = boost::to_lower_copy(service_name);
726 
727  for (GlobalVrouter::LinkLocalServicesMap::const_iterator it =
728  linklocal_services_map_.begin();
729  it != linklocal_services_map_.end(); ++it) {
730  if (it->second.linklocal_service_name == name) {
731  *service_ip = it->first.linklocal_service_ip;
732  *service_port = it->first.linklocal_service_port;
733  *fabric_port = it->second.ipfabric_service_port;
734  *fabric_hostname = it->second.ipfabric_dns_service_name;
735  if (it->second.ipfabric_service_ip.size()) {
736  // if there are multiple addresses, return one of them
737  int index = rand() % it->second.ipfabric_service_ip.size();
738  *fabric_ip = it->second.ipfabric_service_ip[index];
739  if (*fabric_ip == kLoopBackIp) {
740  *fabric_ip = agent()->router_id();
741  }
742  if (it->second.ipfabric_dns_service_name.empty())
743  *fabric_hostname = fabric_ip->to_string();
744  return true;
745  } else if (!it->second.ipfabric_dns_service_name.empty()) {
746  return fabric_dns_resolver_->Resolve(
747  it->second.ipfabric_dns_service_name, fabric_ip);
748  }
749  }
750  }
751  return false;
752 }
753 
754 // Get link local service info for a given linklocal service <ip, port>
756  uint16_t service_port,
757  std::string *service_name,
758  Ip4Address *fabric_ip,
759  uint16_t *fabric_port) const {
760  LinkLocalServicesMap::const_iterator it =
762  service_port));
763  if (it == linklocal_services_map_.end()) {
764 #if 0
765  if (!service_port) {
766  // to support ping to metadata address
767  IpAddress metadata_service_ip;
768  Ip4Address metadata_fabric_ip;
769  uint16_t metadata_service_port, metadata_fabric_port;
771  &metadata_service_ip,
772  &metadata_service_port,
773  &metadata_fabric_ip,
774  &metadata_fabric_port) &&
775  service_ip == metadata_service_ip) {
776  *fabric_port = agent()->metadata_server_port();
777  *fabric_ip = agent()->router_id();
778  return true;
779  }
780  }
781 #endif
782  return false;
783  }
784 
785  *service_name = it->second.linklocal_service_name;
786  if (service_name->find(GlobalVrouter::kMetadataService)
787  != std::string::npos) {
788  // for metadata, return vhost0 ip and HTTP proxy port
789  *fabric_port = agent()->metadata_server_port();
790  *fabric_ip = agent()->router_id();
791  return true;
792  }
793 
794  *fabric_port = it->second.ipfabric_service_port;
795  // if there are multiple addresses, return one of them
796  if (it->second.ipfabric_service_ip.size()) {
797  int index = rand() % it->second.ipfabric_service_ip.size();
798  *fabric_ip = it->second.ipfabric_service_ip[index];
799  if (*fabric_ip == kLoopBackIp) {
800  *fabric_ip = agent()->router_id();
801  }
802  return true;
803  } else if (!it->second.ipfabric_dns_service_name.empty()) {
804  return fabric_dns_resolver_->Resolve(
805  it->second.ipfabric_dns_service_name, fabric_ip);
806  }
807  return false;
808 }
809 
810 // Get link local services, for a given service name
811 bool GlobalVrouter::FindLinkLocalService(const std::string &service_name,
812  std::set<IpAddress> *service_ip
813  ) const {
814  if (service_name.empty())
815  return false;
816 
817  std::string name = boost::to_lower_copy(service_name);
818  for (GlobalVrouter::LinkLocalServicesMap::const_iterator it =
819  linklocal_services_map_.begin();
820  it != linklocal_services_map_.end(); ++it) {
821  if (it->second.linklocal_service_name == name) {
822  service_ip->insert(it->first.linklocal_service_ip);
823  }
824  }
825 
826  return (service_ip->size() > 0);
827 }
828 
829 // Get link local services info for a given linklocal service <ip>
831  std::set<std::string> *service_names
832  ) const {
833  LinkLocalServicesMap::const_iterator it =
834  linklocal_services_map_.lower_bound(LinkLocalServiceKey(service_ip, 0));
835 
836  while (it != linklocal_services_map_.end() &&
837  it->first.linklocal_service_ip == service_ip) {
838  service_names->insert(it->second.linklocal_service_name);
839  it++;
840  }
841 
842  return (service_names->size() > 0);
843 }
844 
845 // Handle changes to link local service configuration
847  const LinkLocalServiceList &linklocal_list) {
848 
849  std::vector<std::string> dns_name_list;
851  for (std::vector<autogen::LinklocalServiceEntryType>::const_iterator it =
852  linklocal_list.begin(); it != linklocal_list.end(); it++) {
853  boost::system::error_code ec;
854  IpAddress llip = IpAddress::from_string(it->linklocal_service_ip, ec);
855  std::vector<Ip4Address> fabric_ip;
856  BOOST_FOREACH(std::string ip_fabric_ip, it->ip_fabric_service_ip) {
857  Ip4Address ip = Ip4Address::from_string(ip_fabric_ip, ec);
858  if (ec) continue;
859  fabric_ip.push_back(ip);
860  }
861  std::string name = boost::to_lower_copy(it->linklocal_service_name);
862  linklocal_services_map.insert(LinkLocalServicesPair(
863  LinkLocalServiceKey(llip, it->linklocal_service_port),
864  LinkLocalService(name, it->ip_fabric_DNS_service_name,
865  fabric_ip, it->ip_fabric_service_port)));
866  if (!it->ip_fabric_DNS_service_name.empty())
867  dns_name_list.push_back(it->ip_fabric_DNS_service_name);
868  }
869 
870  linklocal_services_map_.swap(linklocal_services_map);
871  fabric_dns_resolver_->ResolveList(dns_name_list);
872  ChangeNotify(&linklocal_services_map, &linklocal_services_map_);
873 }
874 
876  std::vector<std::string> dns_name_list;
878 
879  linklocal_services_map_.swap(linklocal_services_map);
880  fabric_dns_resolver_->ResolveList(dns_name_list);
881  ChangeNotify(&linklocal_services_map, &linklocal_services_map_);
882 }
883 
884 // Identify linklocal service configuration changes from old to new
886  LinkLocalServicesMap *new_value) {
887  bool change = false;
888  LinkLocalServicesMap::iterator it_old = old_value->begin();
889  LinkLocalServicesMap::iterator it_new = new_value->begin();
890  while (it_old != old_value->end() && it_new != new_value->end()) {
891  if (it_old->first < it_new->first) {
892  // old entry is deleted
893  DeleteLinkLocalService(it_old);
894  change = true;
895  it_old++;
896  } else if (it_new->first < it_old->first) {
897  // new entry
898  AddLinkLocalService(it_new);
899  change = true;
900  it_new++;
901  } else if (it_new->second == it_old->second) {
902  // no change in entry
903  it_old++;
904  it_new++;
905  } else {
906  // change in entry
907  ChangeLinkLocalService(it_old, it_new);
908  change = true;
909  it_old++;
910  it_new++;
911  }
912  }
913 
914  // delete remaining old entries
915  for (; it_old != old_value->end(); ++it_old) {
916  DeleteLinkLocalService(it_old);
917  change = true;
918  }
919 
920  // add remaining new entries
921  for (; it_new != new_value->end(); ++it_new) {
922  AddLinkLocalService(it_new);
923  change = true;
924  }
925 
926  return change;
927 }
928 
929 // New link local service
931  const LinkLocalServicesMap::iterator &it) {
932  linklocal_route_mgr_->UpdateAllVns(it->first, true);
933  BOOST_FOREACH(Ip4Address ip, it->second.ipfabric_service_ip) {
934  linklocal_route_mgr_->AddArpRoute(ip);
935  }
936 }
937 
938 // Link local service deleted
940  const LinkLocalServicesMap::iterator &it) {
941  if (!IsLinkLocalAddressInUse(it->first.linklocal_service_ip))
942  linklocal_route_mgr_->UpdateAllVns(it->first, false);
943 }
944 
945 // Change in Link local service
947  const LinkLocalServicesMap::iterator &old_it,
948  const LinkLocalServicesMap::iterator &new_it) {
949  if (old_it->first.linklocal_service_ip !=
950  new_it->first.linklocal_service_ip) {
951  if (!IsLinkLocalAddressInUse(old_it->first.linklocal_service_ip))
952  linklocal_route_mgr_->UpdateAllVns(old_it->first, false);
953  linklocal_route_mgr_->UpdateAllVns(new_it->first, true);
954  }
955  LinkLocalRouteUpdate(new_it->second.ipfabric_service_ip);
956 }
957 
959  const std::vector<Ip4Address> &addr_list) {
960  BOOST_FOREACH(Ip4Address ip, addr_list) {
961  linklocal_route_mgr_->AddArpRoute(ip);
962  }
963 }
964 
966  for (LinkLocalServicesMap::const_iterator it =
968  ++it) {
969  if (it->second.IsAddressInUse(ip))
970  return true;
971  }
972  return fabric_dns_resolver_->IsAddressInUse(ip);
973 }
974 
976  for (LinkLocalServicesMap::const_iterator it =
978  ++it) {
979  if (it->first.linklocal_service_ip == ip)
980  return true;
981  }
982  return false;
983 }
984 
986  (static_cast<AgentRouteResync *>(agent_route_resync_walker_.get()))->
987  Update();
988 }
989 
991  return ecmp_load_balance_;
992 }
993 
995 
996 void LinkLocalServiceInfo::HandleRequest() const {
997  LinkLocalServiceResponse *resp = new LinkLocalServiceResponse();
998  std::vector<LinkLocalServiceData> linklocal_list;
999  const GlobalVrouter::LinkLocalServicesMap &services =
1001  global_vrouter()->linklocal_services_map();
1002 
1003  for (GlobalVrouter::LinkLocalServicesMap::const_iterator it =
1004  services.begin(); it != services.end(); ++it) {
1005  LinkLocalServiceData service;
1006  service.linklocal_service_name = it->second.linklocal_service_name;
1007  service.linklocal_service_ip =
1008  it->first.linklocal_service_ip.to_string();
1009  service.linklocal_service_port = it->first.linklocal_service_port;
1010  service.ipfabric_dns_name = it->second.ipfabric_dns_service_name;
1011  BOOST_FOREACH(Ip4Address ip, it->second.ipfabric_service_ip) {
1012  service.ipfabric_ip.push_back(ip.to_string());
1013  }
1014  service.ipfabric_port = it->second.ipfabric_service_port;
1015  linklocal_list.push_back(service);
1016  }
1017 
1018  resp->set_service_list(linklocal_list);
1019  resp->set_context(context());
1020  resp->Response();
1021 }
1022 
1024 
1026  const EncryptionTunnelEndpointList &endpoint_list) {
1027  bool vrouter_present = false;
1028  for (EncryptionTunnelEndpointList::const_iterator it = endpoint_list.begin();
1029  it != endpoint_list.end(); it++) {
1030  if (it->tunnel_remote_ip_address.compare(agent()->router_id().to_string()) == 0) {
1031  vrouter_present = true;
1032  break;
1033  }
1034  }
1035  return vrouter_present;
1036 }
1037 
1038 // Handle changes for cryptunnels
1040  const EncryptionTunnelEndpointList &endpoint_list, const std::string encrypt_mode_str) {
1042  CryptTunnelsMap crypt_tunnels_map;
1043  if (!agent()->crypt_interface())
1044  return;
1045  if (IsVrouterPresentCryptTunnelConfig(endpoint_list)) {
1046  if (boost::iequals(encrypt_mode_str, "all"))
1048  for (EncryptionTunnelEndpointList::const_iterator it = endpoint_list.begin();
1049  it != endpoint_list.end(); it++) {
1050  if (it->tunnel_remote_ip_address.compare(agent()->router_id().to_string()) == 0) {
1051  continue;
1052  }
1053  crypt_tunnels_map.insert(CryptTunnelsPair(CryptTunnelKey(it->tunnel_remote_ip_address),
1054  CryptTunnel(mode)));
1055  }
1056  }
1057  crypt_tunnels_map_.swap(crypt_tunnels_map);
1058  ChangeNotifyCryptTunnels(&crypt_tunnels_map, &crypt_tunnels_map_);
1059 }
1060 
1062 }
1063 
1065  CryptTunnelsMap *new_value) {
1066  bool change = false;
1067  CryptTunnelsMap::iterator it_old = old_value->begin();
1068  CryptTunnelsMap::iterator it_new = new_value->begin();
1069  while (it_old != old_value->end() && it_new != new_value->end()) {
1070  if (it_old->first < it_new->first) {
1071  // old entry is deleted
1072  DeleteCryptTunnelEndpoint(it_old);
1073  change = true;
1074  it_old++;
1075  } else if (it_new->first < it_old->first) {
1076  // new entry
1077  AddCryptTunnelEndpoint(it_new);
1078  change = true;
1079  it_new++;
1080  } else if (it_new->second == it_old->second) {
1081  // no change in entry
1082  it_old++;
1083  it_new++;
1084  } else {
1085  // change in entry
1086  ChangeCryptTunnelEndpoint(it_old, it_new);
1087  change = true;
1088  it_old++;
1089  it_new++;
1090  }
1091  }
1092 
1093  // delete remaining old entries
1094  for (; it_old != old_value->end(); ++it_old) {
1095  DeleteCryptTunnelEndpoint(it_old);
1096  change = true;
1097  }
1098 
1099  // add remaining new entries
1100  for (; it_new != new_value->end(); ++it_new) {
1101  AddCryptTunnelEndpoint(it_new);
1102  change = true;
1103  }
1104 
1105  return change;
1106 }
1107 
1108 void GlobalVrouter::AddCryptTunnelEndpoint(const CryptTunnelsMap::iterator &it) {
1109  bool crypt_traffic = false;
1110  if (it->second.mode == GlobalVrouter::CRYPT_ALL_TRAFFIC)
1111  crypt_traffic = true;
1112  agent()->crypt_tunnel_table()->Create(it->first, crypt_traffic);
1113 }
1114 
1115 void GlobalVrouter::DeleteCryptTunnelEndpoint(const CryptTunnelsMap::iterator &it) {
1116  agent()->crypt_tunnel_table()->Delete(it->first);
1117 }
1118 
1119 void GlobalVrouter::ChangeCryptTunnelEndpoint(const CryptTunnelsMap::iterator &old_it,
1120  const CryptTunnelsMap::iterator &new_it) {
1121  AddCryptTunnelEndpoint(new_it);
1122 }
1123 
1125  if (port_range.size() != 0) {
1126  port_count = 0;
1127  }
1128 
1129  //Only port range specified
1130  //nothing more to be done
1131  if (port_count != 0) {
1132  return;
1133  }
1134 
1135  for (uint16_t index = 0; index < port_range.size(); index++) {
1136  //Ignore invalid range
1137  if (port_range[index].port_start > port_range[index].port_end) {
1138  port_range[index].port_start = 0;
1139  port_range[index].port_end = 0;
1140  }
1141 
1142  if (port_range[index].port_start == 0 &&
1143  port_range[index].port_end == 0) {
1144  continue;
1145  }
1146 
1147  //Check if given range is a subset or intersecting with any other range
1148  for (uint16_t sub_index = 0; sub_index < port_range.size(); sub_index++) {
1149  if (index == sub_index) {
1150  continue;
1151  }
1152 
1153  //Two ranges are same
1154  if (port_range[index].port_start ==
1155  port_range[sub_index].port_start &&
1156  port_range[index].port_end == port_range[sub_index].port_end) {
1157  port_range[index].port_start = 0;
1158  port_range[index].port_end = 0;
1159  break;
1160  }
1161 
1162  //Range is a subset of other range
1163  if (port_range[index].port_start >=
1164  port_range[sub_index].port_start &&
1165  port_range[index].port_end <= port_range[sub_index].port_end) {
1166  port_range[index].port_start = 0;
1167  port_range[index].port_end = 0;
1168  break;
1169  }
1170 
1171  //Overlapping range with index range lesser than sub index range
1172  //Ex 10-15, 15-20
1173  if (port_range[index].port_start <=
1174  port_range[sub_index].port_start &&
1175  port_range[index].port_end >=
1176  port_range[sub_index].port_start &&
1177  port_range[index].port_end < port_range[sub_index].port_end) {
1178  port_range[index].port_end = port_range[sub_index].port_start;
1179  port_range[sub_index].port_start =
1180  port_range[sub_index].port_start + 1;
1181  }
1182  }
1183  }
1184 
1185  port_count = 0;
1186  //Update count
1187  std::vector<PortRange>::iterator it = port_range.begin();
1188  while (it != port_range.end()) {
1189  std::vector<PortRange>::iterator prev_it = it++;
1190  if (prev_it->port_end == 0 &&
1191  prev_it->port_start == 0) {
1192  continue;
1193  }
1194 
1195  port_count += (prev_it->port_end - prev_it->port_start) + 1;
1196  }
1197 }
std::pair< CryptTunnelKey, CryptTunnel > CryptTunnelsPair
void Delete(const std::string &remote_ip)
void LinkLocalRouteUpdate(const std::vector< Ip4Address > &addr_list)
const VrfEntry * vrf_
bool VnUpdateWalk(DBEntryBase *entry, const LinkLocalServiceKey key, bool is_add)
void GlobalVrouterConfig(IFMapNode *node)
void ResolveList(const std::vector< std::string > &name_list)
std::map< LinkLocalServiceKey, LinkLocalService > LinkLocalServicesMap
void ConfigManagerEnqueue(IFMapNode *node)
static Agent * GetInstance()
Definition: agent.h:436
LinkLocalService(const std::string &service_name, const std::string &fabric_dns_name, const std::vector< Ip4Address > &fabric_ip, uint16_t fabric_port)
ForwardingMode
Definition: agent.h:403
static void CfgUuidSet(uint64_t ms_long, uint64_t ls_long, boost::uuids::uuid &u)
Definition: agent_cmn.h:67
Definition: vrf.h:86
std::pair< std::string, std::vector< Ip4Address > > ResolvePair
DBState * GetState(DBTableBase *tbl_base, ListenerId listener) const
Definition: db_entry.cc:37
Agent * agent() const
Definition: oper_db.h:245
bool UpdateFields(const autogen::EcmpHashingIncludeFields &ecmp_hashing_fields)
void AddArpRoute(const Ip4Address &srv)
bool Resolve(const std::string &name, Ip4Address *address)
void ResolveName(const std::string &name)
boost::asio::io_service & io_
bool operator==(const LinkLocalService &rhs) const
const Interface * vhost_interface() const
Definition: agent.h:935
std::map< std::string, std::vector< Ip4Address > > ResolveMap
void DeleteFlowAging()
bool IsDeleted() const
Definition: db_entry.h:49
std::set< Ip4Address > ipfabric_address_list_
ConfigManager * config_manager() const
Definition: agent.cc:889
void SetState(DBTableBase *tbl_base, ListenerId listener, DBState *state)
Definition: db_entry.cc:22
void set_vxlan_network_identifier_mode(VxLanNetworkIdentifierMode mode)
Definition: agent.h:1151
boost::asio::ip::address IpAddress
Definition: address.h:13
std::vector< int > SecurityGroupList
Definition: agent.h:201
uint16_t port_count
void UpdateFlowAging(autogen::GlobalVrouterConfig *cfg)
void set_global_slo_status(bool flag)
Definition: agent.h:1357
int ListenerId
Definition: db_table.h:62
std::pair< FlowAgingTimeoutKey, uint32_t > FlowAgingTimeoutPair
DBTableBase * parent()
virtual ~GlobalVrouter()
const std::string & vhost_interface_name() const
Definition: agent.cc:104
VnTable * vn_table() const
Definition: agent.h:495
adjacency_iterator end(DBGraph *graph)
const string & GetName() const
Definition: vrf.h:100
int32_t flow_export_rate_
IFMapTable * table()
Definition: ifmap_node.h:29
CryptMode crypt_mode_
bool IsVrouterPresentCryptTunnelConfig(const EncryptionTunnelEndpointList &endpoint_list)
bool ChangeNotifyCryptTunnels(CryptTunnelsMap *old_value, CryptTunnelsMap *new_value)
void UpdateCryptTunnelEndpointConfig(const EncryptionTunnelEndpointList &endpoint_list, const std::string encrypt_mode_str)
void ChangeCryptTunnelEndpoint(const CryptTunnelsMap::iterator &old_it, const CryptTunnelsMap::iterator &new_it)
OperDB * oper_db() const
Definition: agent.cc:1013
const EcmpLoadBalance & ecmp_load_balance() const
bool FindLinkLocalService(const std::string &service_name, IpAddress *service_ip, uint16_t *service_port, std::string *fabric_hostname, Ip4Address *fabric_ip, uint16_t *fabric_port) const
Get link local service configuration info, for a given service name.
static bool EncapPrioritySync(const std::vector< std::string > &cfg_list)
Definition: nexthop.cc:58
void CreateDBClients()
static void AddVHostRecvRoute(const Peer *peer, const string &vrf, const InterfaceKey &interface, const IpAddress &addr, uint8_t plen, const string &vn_name, bool policy, bool native_encap, bool ipam_host_route=true)
void ResolveHandler(const boost::system::error_code &error, boost_udp::resolver::iterator resolve_it, std::string &name, boost_udp::resolver *resolver)
const DBGraph * GetGraph() const
void UpdatePortConfig(autogen::GlobalVrouterConfig *cfg)
const std::string & fabric_vrf_name() const
Definition: agent.h:903
void VnWalkDone(DBTable::DBTableWalkRef ref)
void AddGlobalVrouterNode(IFMapNode *node)
boost::scoped_ptr< FabricDnsResolver > fabric_dns_resolver_
const Peer * link_local_peer() const
Definition: agent.h:1024
std::set< IpAddress > linklocal_address_list_
LinkLocalServicesMap linklocal_services_map_
void DeleteCryptTunnelEndpointConfig()
CryptTunnelsMap crypt_tunnels_map_
boost::uuids::uuid slo_uuid_
static void DeletePriorityList()
Definition: nexthop.cc:77
bool IsAddressInUse(const Ip4Address &ip)
ProtocolPortSet protocol_port_set_
Definition: agent.h:358
AgentRouteWalkerManager * agent_route_walk_manager() const
Definition: operdb_init.h:91
bool ChangeNotify(LinkLocalServicesMap *old_value, LinkLocalServicesMap *new_value)
InetUnicastAgentRouteTable * GetInetUnicastRouteTable(const IpAddress &addr) const
Definition: vrf.cc:575
Ip4Address router_id() const
Definition: agent.h:666
uint64_t PendingFabricDnsRequests() const
std::map< uint8_t, PortConfig > ProtocolPortSet
void AddCryptTunnelEndpoint(const CryptTunnelsMap::iterator &it)
std::vector< Ip4Address > ipfabric_service_ip
const LinkLocalServicesMap & linklocal_services_map() const
static const std::string kMetadataService6
bool operator<(const LinkLocalServiceKey &rhs) const
std::vector< autogen::LinklocalServiceEntryType > LinkLocalServiceList
bool IsLinkLocalAddressInUse(const IpAddress &ip) const
LinkLocalRouteManager(GlobalVrouter *vrouter)
CryptTunnelTable * crypt_tunnel_table() const
Definition: agent.h:480
std::set< std::string > VnListType
Definition: agent.h:212
static void DeleteReq(const Peer *peer, const string &vrf_name, const IpAddress &addr, uint8_t plen, AgentRouteData *data)
static Timer * CreateTimer(boost::asio::io_context &service, const std::string &name, int task_id=Timer::GetTimerTaskId(), int task_instance=Timer::GetTimerInstanceId(), bool delete_on_completion=false)
Definition: timer.cc:201
void ClearState(DBTableBase *tbl_base, ListenerId listener)
Definition: db_entry.cc:73
void ConfigDelete(IFMapNode *node)
boost::asio::ip::address_v4 Ip4Address
Definition: address.h:14
Definition: vn.h:151
Agent::ForwardingMode forwarding_mode_
IFMapObject * GetObject()
Definition: ifmap_node.cc:63
FlowAgingTimeoutMap flow_aging_timeout_map_
static void CheckAndAddArpReq(const string &vrf_name, const Ip4Address &ip, const Interface *intf, const VnListType &vn_list, const SecurityGroupList &sg, const TagList &tag)
VrfEntry * GetVrf() const
Definition: vn.h:170
std::set< IpAddress > addresses_
static const std::string kMetadataService
void ChangeLinkLocalService(const LinkLocalServicesMap::iterator &old_it, const LinkLocalServicesMap::iterator &new_it)
std::map< CryptTunnelKey, CryptTunnel > CryptTunnelsMap
bool layer3_forwarding() const
Definition: vn.h:192
static int ProtocolToString(const std::string proto)
bool IsAddressInUse(const Ip4Address &ip) const
void DeleteLinkLocalService(const LinkLocalServicesMap::iterator &it)
boost::scoped_ptr< LinkLocalRouteManager > linklocal_route_mgr_
void AddLinkLocalService(const LinkLocalServicesMap::iterator &it)
void UpdateLinkLocalServiceConfig(const LinkLocalServiceList &linklocal_list)
GlobalVrouter(Agent *agent)
Agent::ForwardingMode TranslateForwardingMode(const std::string &mode) const
Definition: agent.cc:1095
std::map< FlowAgingTimeoutKey, uint32_t > FlowAgingTimeoutMap
VxLanNetworkIdentifierMode
Definition: agent.h:410
void Delete(const IpAddress &address)
std::vector< autogen::EncryptionTunnelEndpoint > EncryptionTunnelEndpointList
void Create(const std::string &remote_ip, bool crypt)
EcmpLoadBalance ecmp_load_balance_
void ConfigAddChange(IFMapNode *node)
const string & GetName() const
Definition: vn.h:162
void UpdateSLOConfig(IFMapNode *node)
DBTablePartBase * get_table_partition() const
Definition: db_entry.cc:115
PortConfigHandler & port_config_handler()
Definition: agent.h:1340
boost::intrusive_ptr< DBTableWalk > DBTableWalkRef
Definition: db_table.h:169
void GlobalVrouterConfigChanged()
Definition: vn.cc:838
AgentConfig * cfg() const
Definition: agent.cc:865
Definition: timer.h:54
uint16_t metadata_server_port() const
Definition: agent.h:959
const std::string & fabric_vn_name() const
Definition: agent.h:901
void DeleteLinkLocalServiceConfig()
IFMapAgentTable * cfg_slo_table() const
Definition: cfg_init.h:150
bool SkipNode(IFMapNode *node)
static const uint32_t kMaxOtherOpenFds
Definition: agent.h:362
void UpdateAllVns(const LinkLocalServiceKey &key, bool is_add)
adjacency_iterator begin(DBGraph *graph)
void Add(const IpAddress &address)
bool VnNotify(DBTablePartBase *partition, DBEntryBase *entry)
std::string CryptTunnelKey
void DeleteCryptTunnelEndpoint(const CryptTunnelsMap::iterator &it)
process::ConnectionState * connection_state() const
Definition: agent.h:953
bool IsAddressInUse(const Ip4Address &ip) const
std::vector< PortRange > port_range
std::pair< LinkLocalServiceKey, LinkLocalService > LinkLocalServicesPair
AgentRouteWalkerPtr agent_route_resync_walker_
FlowStatsReqHandler & flow_stats_req_handler()
Definition: agent.h:1332
void DeletePortConfig()
FabricDnsResolver(GlobalVrouter *vrouter, boost::asio::io_service &io)
static bool DeleteTimer(Timer *Timer)
Definition: timer.cc:222
static const Ip4Address kLoopBackIp
std::vector< int > TagList
Definition: agent.h:202
static const int32_t kDefaultFlowExportRate