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 #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 
198 void GlobalVrouter::ReadFlowsLimits(const autogen::GlobalVrouterConfig &cfg) {
199  uint32_t max_vm_flows_percent;
200  uint32_t global_max_vmi_flows;
201  if (cfg.IsPropertySet(autogen::GlobalVrouterConfig::MAX_VM_FLOWS_PERCENT)) {
202  max_vm_flows_percent = cfg.max_vm_flows_percent();
203  } else {
204  max_vm_flows_percent = FLOWS_LIMIT_UNLIMITED;
205  }
206  if (cfg.IsPropertySet(autogen::GlobalVrouterConfig::GLOBAL_MAX_VMI_FLOWS)) {
207  global_max_vmi_flows = cfg.global_max_vmi_flows();
208  } else {
209  global_max_vmi_flows = FLOWS_LIMIT_UNLIMITED;
210  }
211  Agent *agent = this->agent();
212  agent->set_max_vm_flows_perc(max_vm_flows_percent);
213  agent->set_global_max_vmi_flows(global_max_vmi_flows);
215 }
216 
218 
219 // Link local service
221  const std::string &service_name,
222  const std::string &fabric_dns_name,
223  const std::vector<Ip4Address> &fabric_ip,
224  uint16_t fabric_port)
225  : linklocal_service_name(service_name),
226  ipfabric_dns_service_name(fabric_dns_name),
227  ipfabric_service_ip(fabric_ip),
228  ipfabric_service_port(fabric_port) {
229 }
230 
232  const LinkLocalService &rhs) const {
233  if (linklocal_service_name == rhs.linklocal_service_name &&
234  ipfabric_dns_service_name == rhs.ipfabric_dns_service_name &&
235  ipfabric_service_ip == rhs.ipfabric_service_ip &&
236  ipfabric_service_port == rhs.ipfabric_service_port)
237  return true;
238  return false;
239 }
240 
242  BOOST_FOREACH(Ip4Address ipfabric_addr, ipfabric_service_ip) {
243  if (ipfabric_addr == ip)
244  return true;
245  }
246  return false;
247 }
248 
250  const LinkLocalServiceKey &rhs) const {
251  if (linklocal_service_ip != rhs.linklocal_service_ip)
252  return linklocal_service_ip < rhs.linklocal_service_ip;
253  return linklocal_service_port < rhs.linklocal_service_port;
254 }
255 
257 
258 // Async resolve DNS names (used to resolve names given in linklocal config)
260 public:
261  typedef boost::asio::ip::udp boost_udp;
262  static const uint32_t kDnsTimeout = 15 * 60 * 1000; // fifteen minutes
263 
264  FabricDnsResolver(GlobalVrouter *vrouter, boost::asio::io_service &io)
266  io_(io) {
267  // start timer to re-resolve the DNS names to IP addresses
268  timer_ = TimerManager::CreateTimer(io_, "DnsHandlerTimer");
270  boost::bind(&GlobalVrouter::FabricDnsResolver::OnTimeout, this));
271  }
272  virtual ~FabricDnsResolver() {
273  timer_->Cancel();
275  }
276 
277  // Called in DB context, gives the list of names to be resolved
278  void ResolveList(const std::vector<std::string> &name_list) {
279  std::vector<Ip4Address> empty_addr_list;
280  ResolveMap new_addr_map;
281  tbb::mutex::scoped_lock lock(mutex_);
282  BOOST_FOREACH(std::string name, name_list) {
283  ResolveName(name);
284  ResolveMap::iterator it = address_map_.find(name);
285  if (it != address_map_.end()) {
286  new_addr_map.insert(ResolvePair(name, it->second));
287  address_map_.erase(it);
288  } else {
289  new_addr_map.insert(ResolvePair(name, empty_addr_list));
290  }
291  }
292  address_map_.swap(new_addr_map);
293  }
294 
295  // Called from client tasks to resolve name to address
296  bool Resolve(const std::string &name, Ip4Address *address) {
297  tbb::mutex::scoped_lock lock(mutex_);
298  ResolveMap::iterator it = address_map_.find(name);
299  if (it != address_map_.end() && it->second.size()) {
300  int index = rand() % it->second.size();
301  *address = it->second[index];
302  if (*address == kLoopBackIp) {
303  *address = global_vrouter_->agent()->router_id();
304  }
305  return true;
306  }
307  return false;
308  }
309 
310  // Timer handler; re-resolve all DNS names
311  bool OnTimeout() {
312  tbb::mutex::scoped_lock lock(mutex_);
313  for (ResolveMap::const_iterator it = address_map_.begin();
314  it != address_map_.end(); ++it) {
315  ResolveName(it->first);
316  }
317  return true;
318  }
319 
320  // Called in DB context
321  bool IsAddressInUse(const Ip4Address &ip) {
322  tbb::mutex::scoped_lock lock(mutex_);
323  for (ResolveMap::const_iterator it = address_map_.begin();
324  it != address_map_.end(); ++it) {
325  BOOST_FOREACH(Ip4Address address, it->second) {
326  if (address == ip)
327  return true;
328  }
329  }
330  return false;
331  }
332 
333  uint64_t PendingRequests() const {
335  }
336 
337 private:
338  typedef std::map<std::string, std::vector<Ip4Address> > ResolveMap;
339  typedef std::pair<std::string, std::vector<Ip4Address> > ResolvePair;
340 
341  void ResolveName(const std::string &name) {
342  boost_udp::resolver *resolver = new boost_udp::resolver(io_);
343 
344  resolver->async_resolve(
345  boost_udp::resolver::query(boost_udp::v4(), name, "domain"),
347  _1, _2, name, resolver));
348  request_count_++;
349  }
350 
351  // called in asio context, handle resolve response
352  void ResolveHandler(const boost::system::error_code& error,
353  boost_udp::resolver::iterator resolve_it,
354  std::string &name, boost_udp::resolver *resolver) {
355  std::vector<Ip4Address> old_list;
356  ResolveMap::iterator addr_it;
357  tbb::mutex::scoped_lock lock(mutex_);
358  addr_it = address_map_.find(name);
359  if (addr_it != address_map_.end()) {
360  old_list.swap(addr_it->second);
361  if (!error) {
362  boost_udp::resolver::iterator end;
363  while (resolve_it != end) {
364  boost_udp::endpoint ep = *resolve_it;
365  addr_it->second.push_back(ep.address().to_v4());
366  resolve_it++;
367  }
368  }
369  global_vrouter_->LinkLocalRouteUpdate(addr_it->second);
370  }
371  response_count_++;
372  delete resolver;
373  }
374 
376  tbb::mutex mutex_;
378  uint64_t request_count_;
379  uint64_t response_count_;
381  boost::asio::io_service &io_;
382 };
383 
385 
386 // Add / delete routes to ip fabric servers used for link local services
387 // Also, add / delete receive routes for link local addresses in different VRFs
389 public:
391  : global_vrouter_(vrouter), vn_id_(DBTableBase::kInvalidId){
392  }
393 
395  DeleteDBClients();
396  ipfabric_address_list_.clear();
397  linklocal_address_list_.clear();
398  }
399 
400  void CreateDBClients();
401  void DeleteDBClients();
402  void AddArpRoute(const Ip4Address &srv);
403  void UpdateAllVns(const LinkLocalServiceKey &key, bool is_add);
404 
405 private:
406  bool VnUpdateWalk(DBEntryBase *entry, const LinkLocalServiceKey key,
407  bool is_add);
409  bool VnNotify(DBTablePartBase *partition, DBEntryBase *entry);
410 
413  std::set<Ip4Address> ipfabric_address_list_;
414  std::set<IpAddress> linklocal_address_list_;
415 };
416 
418  vn_id_ = global_vrouter_->agent()->vn_table()->Register(
420  this, _1, _2));
421 }
422 
424  global_vrouter_->agent()->vn_table()->Unregister(vn_id_);
425 }
426 
428  std::set<Ip4Address>::iterator it;
429  std::pair<std::set<Ip4Address>::iterator, bool> ret;
430 
431  ret = ipfabric_address_list_.insert(srv);
432  if (ret.second == false) {
433  return;
434  }
435 
436  Agent *agent = global_vrouter_->agent();
437  VnListType vn_list;
438  vn_list.insert(agent->fabric_vn_name());
440  srv, agent->vhost_interface(),
441  vn_list, SecurityGroupList(),
442  TagList());
443 }
444 
445 // Walk thru all the VNs
447  const LinkLocalServiceKey &key, bool is_add) {
448  if (is_add) {
449  if (!linklocal_address_list_.insert(key.linklocal_service_ip).second)
450  return;
451  } else {
452  if (!linklocal_address_list_.erase(key.linklocal_service_ip))
453  return;
454  }
455  // This walker allocation has to be done everytime as function argument
456  // takes key and is_add which keeps varying. So boost bind needs to be
457  // redone.
458  // Also thats the reason why previous walk is also not stopped and it runs
459  // to completion.
460  // TODO: Evaluate if this can be optimized
461  DBTable::DBTableWalkRef walk_ref =
462  global_vrouter_->agent()->vn_table()->AllocWalker(
464  this, _2, key, is_add),
466  this, _1));
467  global_vrouter_->agent()->vn_table()->WalkAgain(walk_ref);
468 }
469 
470 // Vn Walk method
471 // For each Vn, add or delete receive route for the specified linklocal service
473  DBEntryBase *entry, const LinkLocalServiceKey key, bool is_add) {
474 
475  VnEntry *vn_entry = static_cast<VnEntry *>(entry);
476  if (vn_entry->IsDeleted()) {
477  return true;
478  }
479 
480  VrfEntry *vrf_entry = vn_entry->GetVrf();
481  if (!vrf_entry) {
482  return true;
483  }
484 
485  Agent *agent = global_vrouter_->agent();
486  // Do not create the routes for the default VRF
487  if (agent->fabric_vrf_name() == vrf_entry->GetName()) {
488  return true;
489  }
490 
491  InetUnicastAgentRouteTable *rt_table =
493 
494  LinkLocalDBState *state = static_cast<LinkLocalDBState *>
495  (vn_entry->GetState(vn_entry->get_table_partition()->parent(), vn_id_));
496  if (!state) {
497  return true;
498  }
499 
500  if (is_add) {
501  if (vn_entry->layer3_forwarding()) {
502  state->Add(key.linklocal_service_ip);
504  boost::uuids::nil_uuid(),
506 
508  vrf_entry->GetName(),
509  vmi_key,
511  key.linklocal_service_ip.is_v4() ? 32 : 128,
512  vn_entry->GetName(),
513  true, false, false);
514  }
515  } else {
516  state->Delete(key.linklocal_service_ip);
517  rt_table->DeleteReq(agent->link_local_peer(), vrf_entry->GetName(),
519  key.linklocal_service_ip.is_v4() ? 32 : 128, NULL);
520  }
521  return true;
522 }
523 
524 void
526  global_vrouter_->agent()->vn_table()->ReleaseWalker(ref);
527 }
528 
529 // VN notify handler
531  DBEntryBase *entry) {
532  VnEntry *vn_entry = static_cast<VnEntry *>(entry);
533  VrfEntry *vrf_entry = vn_entry->GetVrf();
534  Agent *agent = global_vrouter_->agent();
535  if (vn_entry->IsDeleted() || !vn_entry->layer3_forwarding() || !vrf_entry) {
536  LinkLocalDBState *state = static_cast<LinkLocalDBState *>
537  (vn_entry->GetState(partition->parent(), vn_id_));
538  if (!state)
539  return true;
540  for (std::set<IpAddress>::const_iterator it =
541  state->addresses_.begin(); it != state->addresses_.end(); ++it) {
542  InetUnicastAgentRouteTable *rt_table =
543  state->vrf_->GetInetUnicastRouteTable(*it);
544  rt_table->DeleteReq(agent->link_local_peer(),
545  state->vrf_->GetName(), *it, it->is_v4() ? 32 : 128, NULL);
546  }
547  vn_entry->ClearState(partition->parent(), vn_id_);
548  delete state;
549  return true;
550  }
551 
552  // Do not create the routes for the default VRF
553  if (agent->fabric_vrf_name() == vrf_entry->GetName()) {
554  return true;
555  }
556 
557  if (vn_entry->layer3_forwarding()) {
558  if (vn_entry->GetState(partition->parent(), vn_id_))
559  return true;
560  LinkLocalDBState *state = new LinkLocalDBState(vrf_entry);
561  vn_entry->SetState(partition->parent(), vn_id_, state);
562  InetUnicastAgentRouteTable *rt_table = NULL;
563  const GlobalVrouter::LinkLocalServicesMap &services =
564  global_vrouter_->linklocal_services_map();
565  for (GlobalVrouter::LinkLocalServicesMap::const_iterator it =
566  services.begin(); it != services.end(); ++it) {
568  boost::uuids::nil_uuid(),
570  rt_table =
571  vrf_entry->GetInetUnicastRouteTable(it->first.linklocal_service_ip);
572  state->Add(it->first.linklocal_service_ip);
574  vrf_entry->GetName(),
575  key,
576  it->first.linklocal_service_ip,
577  it->first.linklocal_service_ip.is_v4() ? 32 : 128,
578  vn_entry->GetName(),
579  true, false, false);
580  }
581  }
582  return true;
583 }
584 
586 
592  (this, *(agent->event_manager()->io_service()))),
595  slo_uuid_(boost::uuids::nil_uuid()) {
597  (new AgentRouteResync("GlobalVrouterRouteWalker", agent));
599  RegisterWalker(static_cast<AgentRouteWalker *>
601  }
602 
605  ReleaseWalker(agent_route_resync_walker_.get());
606 }
607 
608 
610  return fabric_dns_resolver_.get()->PendingRequests();
611 }
612 
614  linklocal_route_mgr_->CreateDBClients();
615 }
616 
618  GlobalVrouterConfig(node);
619  configured_ = false;
620  agent()->connection_state()->Update();
621  return;
622 }
623 
625  GlobalVrouterConfig(node);
626  configured_ = true;
627  agent()->connection_state()->Update();
628  return;
629 }
630 
633 }
634 
636  IFMapAgentTable *table = static_cast<IFMapAgentTable *>(node->table());
637  DBGraph *graph = table->GetGraph();
638  for (DBGraphVertex::adjacency_iterator iter = node->begin(graph);
639  iter != node->end(table->GetGraph()); ++iter) {
640 
641  IFMapNode *adj_node = static_cast<IFMapNode *>(iter.operator->());
642  if (agent()->config_manager()->SkipNode(adj_node)) {
643  continue;
644  }
645 
646  if (adj_node->table() == agent()->cfg()->cfg_slo_table()) {
647  autogen::SecurityLoggingObject *slo =
648  static_cast<autogen::SecurityLoggingObject *>(adj_node->
649  GetObject());
650  autogen::IdPermsType id_perms = slo->id_perms();
651  CfgUuidSet(id_perms.uuid.uuid_mslong, id_perms.uuid.uuid_lslong,
652  slo_uuid_);
653  }
654  }
655 }
656 
657 // Handle incoming global vrouter configuration
659  Agent::VxLanNetworkIdentifierMode cfg_vxlan_network_identifier_mode =
661  bool resync_vn = false; //resync_vn walks internally calls VMI walk.
662  bool resync_route = false;
663 
664  if (node->IsDeleted() == false) {
665  UpdateSLOConfig(node);
666 
667  autogen::GlobalVrouterConfig *cfg =
668  static_cast<autogen::GlobalVrouterConfig *>(node->GetObject());
669 
670  agent()->set_global_slo_status(cfg->enable_security_logging());
671 
672  resync_route =
673  TunnelType::EncapPrioritySync(cfg->encapsulation_priorities());
674  if (cfg->vxlan_network_identifier_mode() == "configured") {
675  cfg_vxlan_network_identifier_mode = Agent::CONFIGURED;
676  }
677  UpdateLinkLocalServiceConfig(cfg->linklocal_services());
678  UpdateCryptTunnelEndpointConfig(cfg->encryption_tunnel_endpoints(),
679  cfg->encryption_mode());
680 
681  //Take the forwarding mode if its set, else fallback to l2_l3.
682  Agent::ForwardingMode new_forwarding_mode =
683  agent()->TranslateForwardingMode(cfg->forwarding_mode());
684  if (new_forwarding_mode != forwarding_mode_) {
685  forwarding_mode_ = new_forwarding_mode;
686  resync_route = true;
687  resync_vn = true;
688  }
689  if (cfg->IsPropertySet
690  (autogen::GlobalVrouterConfig::FLOW_EXPORT_RATE)) {
691  flow_export_rate_ = cfg->flow_export_rate();
692  } else {
694  }
695  UpdateFlowAging(cfg);
696  UpdatePortConfig(cfg);
698  if (cfg->ecmp_hashing_include_fields().hashing_configured) {
700  ecmp_hashing_include_fields());
701  }
704  resync_vn = true;
705  }
706  ReadFlowsLimits(*cfg);
707  } else {
710  resync_route = true;
712  DeleteFlowAging();
714  }
715 
716  if (cfg_vxlan_network_identifier_mode !=
717  agent()->vxlan_network_identifier_mode()) {
719  (cfg_vxlan_network_identifier_mode);
720  resync_vn = true;
721  }
722 
723  //Rebakes
724  if (resync_route) {
725  //Resync vm_interfaces to handle ethernet tag change if vxlan changed to
726  //mpls or vice versa.
727  //Update all routes irrespectively as this will handle change of
728  //priority between MPLS-UDP to MPLS-GRE and vice versa.
729  ResyncRoutes();
730  resync_vn = true;
731  }
732 
733  //Rebakes VN and then all interfaces.
734  if (resync_vn)
736 }
737 
738 // Get link local service configuration info, for a given service name
739 bool GlobalVrouter::FindLinkLocalService(const std::string &service_name,
740  IpAddress *service_ip,
741  uint16_t *service_port,
742  std::string *fabric_hostname,
743  Ip4Address *fabric_ip,
744  uint16_t *fabric_port) const {
745  std::string name = boost::to_lower_copy(service_name);
746 
747  for (GlobalVrouter::LinkLocalServicesMap::const_iterator it =
748  linklocal_services_map_.begin();
749  it != linklocal_services_map_.end(); ++it) {
750  if (it->second.linklocal_service_name == name) {
751  *service_ip = it->first.linklocal_service_ip;
752  *service_port = it->first.linklocal_service_port;
753  *fabric_port = it->second.ipfabric_service_port;
754  *fabric_hostname = it->second.ipfabric_dns_service_name;
755  if (it->second.ipfabric_service_ip.size()) {
756  // if there are multiple addresses, return one of them
757  int index = rand() % it->second.ipfabric_service_ip.size();
758  *fabric_ip = it->second.ipfabric_service_ip[index];
759  if (*fabric_ip == kLoopBackIp) {
760  *fabric_ip = agent()->router_id();
761  }
762  if (it->second.ipfabric_dns_service_name.empty())
763  *fabric_hostname = fabric_ip->to_string();
764  return true;
765  } else if (!it->second.ipfabric_dns_service_name.empty()) {
766  return fabric_dns_resolver_->Resolve(
767  it->second.ipfabric_dns_service_name, fabric_ip);
768  }
769  }
770  }
771  return false;
772 }
773 
774 // Get link local service info for a given linklocal service <ip, port>
776  uint16_t service_port,
777  std::string *service_name,
778  Ip4Address *fabric_ip,
779  uint16_t *fabric_port) const {
780  LinkLocalServicesMap::const_iterator it =
782  service_port));
783  if (it == linklocal_services_map_.end()) {
784 #if 0
785  if (!service_port) {
786  // to support ping to metadata address
787  IpAddress metadata_service_ip;
788  Ip4Address metadata_fabric_ip;
789  uint16_t metadata_service_port, metadata_fabric_port;
791  &metadata_service_ip,
792  &metadata_service_port,
793  &metadata_fabric_ip,
794  &metadata_fabric_port) &&
795  service_ip == metadata_service_ip) {
796  *fabric_port = agent()->metadata_server_port();
797  *fabric_ip = agent()->router_id();
798  return true;
799  }
800  }
801 #endif
802  return false;
803  }
804 
805  *service_name = it->second.linklocal_service_name;
806  if (service_name->find(GlobalVrouter::kMetadataService)
807  != std::string::npos) {
808  // for metadata, return vhost0 ip and HTTP proxy port
809  *fabric_port = agent()->metadata_server_port();
810  *fabric_ip = agent()->router_id();
811  return true;
812  }
813 
814  *fabric_port = it->second.ipfabric_service_port;
815  // if there are multiple addresses, return one of them
816  if (it->second.ipfabric_service_ip.size()) {
817  int index = rand() % it->second.ipfabric_service_ip.size();
818  *fabric_ip = it->second.ipfabric_service_ip[index];
819  if (*fabric_ip == kLoopBackIp) {
820  *fabric_ip = agent()->router_id();
821  }
822  return true;
823  } else if (!it->second.ipfabric_dns_service_name.empty()) {
824  return fabric_dns_resolver_->Resolve(
825  it->second.ipfabric_dns_service_name, fabric_ip);
826  }
827  return false;
828 }
829 
830 // Get link local services, for a given service name
831 bool GlobalVrouter::FindLinkLocalService(const std::string &service_name,
832  std::set<IpAddress> *service_ip
833  ) const {
834  if (service_name.empty())
835  return false;
836 
837  std::string name = boost::to_lower_copy(service_name);
838  for (GlobalVrouter::LinkLocalServicesMap::const_iterator it =
839  linklocal_services_map_.begin();
840  it != linklocal_services_map_.end(); ++it) {
841  if (it->second.linklocal_service_name == name) {
842  service_ip->insert(it->first.linklocal_service_ip);
843  }
844  }
845 
846  return (service_ip->size() > 0);
847 }
848 
849 // Get link local services info for a given linklocal service <ip>
851  std::set<std::string> *service_names
852  ) const {
853  LinkLocalServicesMap::const_iterator it =
854  linklocal_services_map_.lower_bound(LinkLocalServiceKey(service_ip, 0));
855 
856  while (it != linklocal_services_map_.end() &&
857  it->first.linklocal_service_ip == service_ip) {
858  service_names->insert(it->second.linklocal_service_name);
859  it++;
860  }
861 
862  return (service_names->size() > 0);
863 }
864 
865 // Handle changes to link local service configuration
867  const LinkLocalServiceList &linklocal_list) {
868 
869  std::vector<std::string> dns_name_list;
871  for (std::vector<autogen::LinklocalServiceEntryType>::const_iterator it =
872  linklocal_list.begin(); it != linklocal_list.end(); it++) {
873  boost::system::error_code ec;
874  IpAddress llip = IpAddress::from_string(it->linklocal_service_ip, ec);
875  std::vector<Ip4Address> fabric_ip;
876  BOOST_FOREACH(std::string ip_fabric_ip, it->ip_fabric_service_ip) {
877  Ip4Address ip = Ip4Address::from_string(ip_fabric_ip, ec);
878  if (ec) continue;
879  fabric_ip.push_back(ip);
880  }
881  std::string name = boost::to_lower_copy(it->linklocal_service_name);
883  LinkLocalServiceKey(llip, it->linklocal_service_port),
884  LinkLocalService(name, it->ip_fabric_DNS_service_name,
885  fabric_ip, it->ip_fabric_service_port)));
886  if (!it->ip_fabric_DNS_service_name.empty())
887  dns_name_list.push_back(it->ip_fabric_DNS_service_name);
888  }
889 
891  fabric_dns_resolver_->ResolveList(dns_name_list);
893 }
894 
896  std::vector<std::string> dns_name_list;
898 
900  fabric_dns_resolver_->ResolveList(dns_name_list);
902 }
903 
904 // Identify linklocal service configuration changes from old to new
906  LinkLocalServicesMap *new_value) {
907  bool change = false;
908  LinkLocalServicesMap::iterator it_old = old_value->begin();
909  LinkLocalServicesMap::iterator it_new = new_value->begin();
910  while (it_old != old_value->end() && it_new != new_value->end()) {
911  if (it_old->first < it_new->first) {
912  // old entry is deleted
913  DeleteLinkLocalService(it_old);
914  change = true;
915  it_old++;
916  } else if (it_new->first < it_old->first) {
917  // new entry
918  AddLinkLocalService(it_new);
919  change = true;
920  it_new++;
921  } else if (it_new->second == it_old->second) {
922  // no change in entry
923  it_old++;
924  it_new++;
925  } else {
926  // change in entry
927  ChangeLinkLocalService(it_old, it_new);
928  change = true;
929  it_old++;
930  it_new++;
931  }
932  }
933 
934  // delete remaining old entries
935  for (; it_old != old_value->end(); ++it_old) {
936  DeleteLinkLocalService(it_old);
937  change = true;
938  }
939 
940  // add remaining new entries
941  for (; it_new != new_value->end(); ++it_new) {
942  AddLinkLocalService(it_new);
943  change = true;
944  }
945 
946  return change;
947 }
948 
949 // New link local service
951  const LinkLocalServicesMap::iterator &it) {
952  linklocal_route_mgr_->UpdateAllVns(it->first, true);
953  BOOST_FOREACH(Ip4Address ip, it->second.ipfabric_service_ip) {
954  linklocal_route_mgr_->AddArpRoute(ip);
955  }
956 }
957 
958 // Link local service deleted
960  const LinkLocalServicesMap::iterator &it) {
961  if (!IsLinkLocalAddressInUse(it->first.linklocal_service_ip))
962  linklocal_route_mgr_->UpdateAllVns(it->first, false);
963 }
964 
965 // Change in Link local service
967  const LinkLocalServicesMap::iterator &old_it,
968  const LinkLocalServicesMap::iterator &new_it) {
969  if (old_it->first.linklocal_service_ip !=
970  new_it->first.linklocal_service_ip) {
971  if (!IsLinkLocalAddressInUse(old_it->first.linklocal_service_ip))
972  linklocal_route_mgr_->UpdateAllVns(old_it->first, false);
973  linklocal_route_mgr_->UpdateAllVns(new_it->first, true);
974  }
975  LinkLocalRouteUpdate(new_it->second.ipfabric_service_ip);
976 }
977 
979  const std::vector<Ip4Address> &addr_list) {
980  BOOST_FOREACH(Ip4Address ip, addr_list) {
981  linklocal_route_mgr_->AddArpRoute(ip);
982  }
983 }
984 
986  for (LinkLocalServicesMap::const_iterator it =
988  ++it) {
989  if (it->second.IsAddressInUse(ip))
990  return true;
991  }
992  return fabric_dns_resolver_->IsAddressInUse(ip);
993 }
994 
996  for (LinkLocalServicesMap::const_iterator it =
998  ++it) {
999  if (it->first.linklocal_service_ip == ip)
1000  return true;
1001  }
1002  return false;
1003 }
1004 
1006  (static_cast<AgentRouteResync *>(agent_route_resync_walker_.get()))->
1007  Update();
1008 }
1009 
1011  return ecmp_load_balance_;
1012 }
1013 
1015 
1016 void LinkLocalServiceInfo::HandleRequest() const {
1017  LinkLocalServiceResponse *resp = new LinkLocalServiceResponse();
1018  std::vector<LinkLocalServiceData> linklocal_list;
1019  const GlobalVrouter::LinkLocalServicesMap &services =
1021  global_vrouter()->linklocal_services_map();
1022 
1023  for (GlobalVrouter::LinkLocalServicesMap::const_iterator it =
1024  services.begin(); it != services.end(); ++it) {
1025  LinkLocalServiceData service;
1026  service.linklocal_service_name = it->second.linklocal_service_name;
1027  service.linklocal_service_ip =
1028  it->first.linklocal_service_ip.to_string();
1029  service.linklocal_service_port = it->first.linklocal_service_port;
1030  service.ipfabric_dns_name = it->second.ipfabric_dns_service_name;
1031  BOOST_FOREACH(Ip4Address ip, it->second.ipfabric_service_ip) {
1032  service.ipfabric_ip.push_back(ip.to_string());
1033  }
1034  service.ipfabric_port = it->second.ipfabric_service_port;
1035  linklocal_list.push_back(service);
1036  }
1037 
1038  resp->set_service_list(linklocal_list);
1039  resp->set_context(context());
1040  resp->Response();
1041 }
1042 
1044 
1046  const EncryptionTunnelEndpointList &endpoint_list) {
1047  bool vrouter_present = false;
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  vrouter_present = true;
1052  break;
1053  }
1054  }
1055  return vrouter_present;
1056 }
1057 
1058 // Handle changes for cryptunnels
1060  const EncryptionTunnelEndpointList &endpoint_list, const std::string encrypt_mode_str) {
1062  CryptTunnelsMap crypt_tunnels_map;
1063  if (!agent()->crypt_interface())
1064  return;
1065  if (IsVrouterPresentCryptTunnelConfig(endpoint_list)) {
1066  if (boost::iequals(encrypt_mode_str, "all"))
1068  for (EncryptionTunnelEndpointList::const_iterator it = endpoint_list.begin();
1069  it != endpoint_list.end(); it++) {
1070  if (it->tunnel_remote_ip_address.compare(agent()->router_id().to_string()) == 0) {
1071  continue;
1072  }
1073  crypt_tunnels_map.insert(CryptTunnelsPair(CryptTunnelKey(it->tunnel_remote_ip_address),
1074  CryptTunnel(mode)));
1075  }
1076  }
1077  crypt_tunnels_map_.swap(crypt_tunnels_map);
1078  ChangeNotifyCryptTunnels(&crypt_tunnels_map, &crypt_tunnels_map_);
1079 }
1080 
1082 }
1083 
1085  CryptTunnelsMap *new_value) {
1086  bool change = false;
1087  CryptTunnelsMap::iterator it_old = old_value->begin();
1088  CryptTunnelsMap::iterator it_new = new_value->begin();
1089  while (it_old != old_value->end() && it_new != new_value->end()) {
1090  if (it_old->first < it_new->first) {
1091  // old entry is deleted
1092  DeleteCryptTunnelEndpoint(it_old);
1093  change = true;
1094  it_old++;
1095  } else if (it_new->first < it_old->first) {
1096  // new entry
1097  AddCryptTunnelEndpoint(it_new);
1098  change = true;
1099  it_new++;
1100  } else if (it_new->second == it_old->second) {
1101  // no change in entry
1102  it_old++;
1103  it_new++;
1104  } else {
1105  // change in entry
1106  ChangeCryptTunnelEndpoint(it_old, it_new);
1107  change = true;
1108  it_old++;
1109  it_new++;
1110  }
1111  }
1112 
1113  // delete remaining old entries
1114  for (; it_old != old_value->end(); ++it_old) {
1115  DeleteCryptTunnelEndpoint(it_old);
1116  change = true;
1117  }
1118 
1119  // add remaining new entries
1120  for (; it_new != new_value->end(); ++it_new) {
1121  AddCryptTunnelEndpoint(it_new);
1122  change = true;
1123  }
1124 
1125  return change;
1126 }
1127 
1128 void GlobalVrouter::AddCryptTunnelEndpoint(const CryptTunnelsMap::iterator &it) {
1129  bool crypt_traffic = false;
1130  if (it->second.mode == GlobalVrouter::CRYPT_ALL_TRAFFIC)
1131  crypt_traffic = true;
1132  agent()->crypt_tunnel_table()->Create(it->first, crypt_traffic);
1133 }
1134 
1135 void GlobalVrouter::DeleteCryptTunnelEndpoint(const CryptTunnelsMap::iterator &it) {
1136  agent()->crypt_tunnel_table()->Delete(it->first);
1137 }
1138 
1139 void GlobalVrouter::ChangeCryptTunnelEndpoint(const CryptTunnelsMap::iterator &old_it,
1140  const CryptTunnelsMap::iterator &new_it) {
1141  AddCryptTunnelEndpoint(new_it);
1142 }
1143 
1145  if (port_range.size() != 0) {
1146  port_count = 0;
1147  }
1148 
1149  //Only port range specified
1150  //nothing more to be done
1151  if (port_count != 0) {
1152  return;
1153  }
1154 
1155  for (uint16_t index = 0; index < port_range.size(); index++) {
1156  //Ignore invalid range
1157  if (port_range[index].port_start > port_range[index].port_end) {
1158  port_range[index].port_start = 0;
1159  port_range[index].port_end = 0;
1160  }
1161 
1162  if (port_range[index].port_start == 0 &&
1163  port_range[index].port_end == 0) {
1164  continue;
1165  }
1166 
1167  //Check if given range is a subset or intersecting with any other range
1168  for (uint16_t sub_index = 0; sub_index < port_range.size(); sub_index++) {
1169  if (index == sub_index) {
1170  continue;
1171  }
1172 
1173  //Two ranges are same
1174  if (port_range[index].port_start ==
1175  port_range[sub_index].port_start &&
1176  port_range[index].port_end == port_range[sub_index].port_end) {
1177  port_range[index].port_start = 0;
1178  port_range[index].port_end = 0;
1179  break;
1180  }
1181 
1182  //Range is a subset of other range
1183  if (port_range[index].port_start >=
1184  port_range[sub_index].port_start &&
1185  port_range[index].port_end <= port_range[sub_index].port_end) {
1186  port_range[index].port_start = 0;
1187  port_range[index].port_end = 0;
1188  break;
1189  }
1190 
1191  //Overlapping range with index range lesser than sub index range
1192  //Ex 10-15, 15-20
1193  if (port_range[index].port_start <=
1194  port_range[sub_index].port_start &&
1195  port_range[index].port_end >=
1196  port_range[sub_index].port_start &&
1197  port_range[index].port_end < port_range[sub_index].port_end) {
1198  port_range[index].port_end = port_range[sub_index].port_start;
1199  port_range[sub_index].port_start =
1200  port_range[sub_index].port_start + 1;
1201  }
1202  }
1203  }
1204 
1205  port_count = 0;
1206  //Update count
1207  std::vector<PortRange>::iterator it = port_range.begin();
1208  while (it != port_range.end()) {
1209  std::vector<PortRange>::iterator prev_it = it++;
1210  if (prev_it->port_end == 0 &&
1211  prev_it->port_start == 0) {
1212  continue;
1213  }
1214 
1215  port_count += (prev_it->port_end - prev_it->port_start) + 1;
1216  }
1217 }
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:67
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:49
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:222
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
Definition: timer.h:54
bool Cancel()
Definition: timer.cc:150
bool Start(int time, Handler handler, ErrorHandler error_handler=NULL)
Definition: timer.cc:108
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:192
void GlobalVrouterConfigChanged()
Definition: vn.cc:838
Definition: vrf.h:86
const string & GetName() const
Definition: vrf.h:100
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:98
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