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