OpenSDN source code
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
vnsw/agent/oper/evpn_route.cc
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
3  */
4 
5 #include <boost/uuid/uuid_io.hpp>
6 
7 #include <cmn/agent_cmn.h>
8 #include <route/route.h>
9 
10 #include <oper/ecmp_load_balance.h>
11 #include <oper/route_common.h>
12 #include <oper/vrf.h>
13 #include <oper/tunnel_nh.h>
14 #include <oper/mpls.h>
15 #include <oper/mirror_table.h>
19 #include <oper/agent_sandesh.h>
20 #include <pkt/pkt_init.h>
21 #include <pkt/pkt_handler.h>
22 
23 using namespace std;
24 using namespace boost::asio;
25 
27 // Utility functions
29 static void EvpnTableEnqueue(Agent *agent, DBRequest *req) {
30  AgentRouteTable *table = agent->fabric_evpn_table();
31  if (table) {
32  table->Enqueue(req);
33  }
34 }
35 
36 static void EvpnTableProcess(Agent *agent, const string &vrf_name,
37  DBRequest &req) {
38  AgentRouteTable *table =
39  agent->vrf_table()->GetEvpnRouteTable(vrf_name);
40  if (table) {
41  table->Process(req);
42  }
43 }
44 
46 // EvpnRouteKey methods
48 string EvpnRouteKey::ToString() const {
49  std::stringstream str;
50  str << ethernet_tag_;
51  str << "-";
52  str << dmac_.ToString();
53  str << "-";
54  str << ip_addr_.to_string();
55  return str.str();
56 }
57 
59  return new EvpnRouteKey(peer(), vrf_name_, dmac_, ip_addr_,
60  plen_, ethernet_tag_);
61 }
62 
63 AgentRoute *
64 EvpnRouteKey::AllocRouteEntry(VrfEntry *vrf, bool is_multicast) const
65 {
66  EvpnRouteEntry *entry = new EvpnRouteEntry(vrf, dmac_, ip_addr_, plen_,
67  ethernet_tag_, is_multicast);
68  return static_cast<AgentRoute *>(entry);
69 }
70 
72 // EvpnAgentRouteTable methods
75  const std::string &name) {
76  AgentRouteTable *table = new EvpnAgentRouteTable(db, name);
77  table->Init();
78  return table;
79 }
80 
82  const IpAddress &ip_addr,
83  uint32_t plen,
84  uint32_t ethernet_tag) {
85  EvpnRouteKey key(NULL, vrf_name(), mac, ip_addr, plen, ethernet_tag);
86  EvpnRouteEntry *route =
87  static_cast<EvpnRouteEntry *>(FindActiveEntry(&key));
88  return route;
89 }
90 
92  const IpAddress &ip_addr,
93  uint32_t plen,
94  uint32_t ethernet_tag) {
95  EvpnRouteKey key(NULL, vrf_name(), mac, ip_addr, plen, ethernet_tag);
96  EvpnRouteEntry *route =
97  static_cast<EvpnRouteEntry *>(FindActiveEntryNoLock(&key));
98  return route;
99 }
100 
102  const string &vrf_name,
103  const MacAddress &mac,
104  const IpAddress &ip_addr,
105  uint32_t plen,
106  uint32_t ethernet_tag) {
107  VrfEntry *vrf = agent->vrf_table()->FindVrfFromName(vrf_name);
108  if (vrf == NULL)
109  return NULL;
110 
111  EvpnAgentRouteTable *table = static_cast<EvpnAgentRouteTable *>
112  (vrf->GetEvpnRouteTable());
113  return table->FindRoute(mac, ip_addr, plen, ethernet_tag);
114 }
115 
117 // EvpnAgentRouteTable utility methods to add/delete routes
120  uint32_t vxlan_id,
121  const std::string &vn_name,
122  Ip4Address tsn,
123  Ip4Address tor_ip,
124  bool enqueue,
125  bool ha_stale) {
126  const VrfEntry *vrf = vrf_entry();
128  nh_req.key.reset(new TunnelNHKey(vrf->GetName(), tsn, tor_ip,
129  false, TunnelType::VXLAN));
130  nh_req.data.reset(new TunnelNHData());
131 
133  req.key.reset(new EvpnRouteKey(peer,
134  vrf->GetName(),
136  tor_ip,
138  vxlan_id));
139  req.data.reset(new MulticastRoute(vn_name, 0, vxlan_id,
141  nh_req, Composite::L2COMP,
142  peer->sequence_number(),
143  ha_stale));
144  if (enqueue) {
145  EvpnTableEnqueue(agent(), &req);
146  } else {
147  EvpnTableProcess(agent(), vrf_name(), req);
148  }
149 }
150 
152  uint32_t vxlan_id,
153  const std::string &vn_name,
154  Ip4Address tsn,
155  Ip4Address tor_ip,
156  bool ha_stale) {
157  AddOvsPeerMulticastRouteInternal(peer, vxlan_id, vn_name, tsn, tor_ip,
158  false, ha_stale);
159 }
160 
162  uint32_t vxlan_id,
163  const std::string &vn_name,
164  Ip4Address tsn,
165  Ip4Address tor_ip) {
166  AddOvsPeerMulticastRouteInternal(peer, vxlan_id, vn_name, tsn, tor_ip, true,
167  false);
168 }
169 
171  const string &vrf_name,
172  uint32_t label,
173  const MacAddress &mac,
174  const IpAddress &ip_addr,
175  uint32_t ethernet_tag,
176  const string &vn_name,
177  const PathPreference &path_pref,
178  uint64_t sequence_number) {
179  const BgpPeer *bgp_peer = dynamic_cast<const BgpPeer *>(peer);
180  assert(bgp_peer != NULL);
181 
183  req.key.reset(new EvpnRouteKey(peer, vrf_name, mac, ip_addr,
185  ethernet_tag));
186  req.data.reset(new L2ReceiveRoute(vn_name, ethernet_tag,
187  label, path_pref,
188  sequence_number));
189  agent()->fabric_evpn_table()->Enqueue(&req);
190 }
191 
193  const string &vrf_name,
194  uint32_t label,
195  const MacAddress &mac,
196  const IpAddress &ip_addr,
197  uint32_t ethernet_tag,
198  const string &vn_name,
199  const PathPreference &pref) {
201  req.key.reset(new EvpnRouteKey(peer, vrf_name, mac, ip_addr,
203  ethernet_tag));
204  req.data.reset(new L2ReceiveRoute(vn_name, ethernet_tag, label, pref,
205  peer->sequence_number()));
206  agent()->fabric_evpn_table()->Enqueue(&req);
207 }
208 
210  const string &vrf_name,
211  uint32_t label,
212  const MacAddress &mac,
213  const IpAddress &ip_addr,
214  uint32_t ethernet_tag,
215  const string &vn_name,
216  const PathPreference &pref) {
218  req.key.reset(new EvpnRouteKey(peer, vrf_name, mac, ip_addr,
220  ethernet_tag));
221  req.data.reset(new L2ReceiveRoute(vn_name, ethernet_tag, label, pref,
222  peer->sequence_number()));
223  Process(req);
224 }
225 
227  const string &vrf_name,
228  const MacAddress &mac,
229  const IpAddress &ip_addr,
230  uint32_t ethernet_tag,
231  LocalVmRoute *data) {
232  assert(peer);
234 
235  req.key.reset(new EvpnRouteKey(peer, vrf_name, mac, ip_addr,
237  ethernet_tag));
239  req.data.reset(data);
241 }
242 
244  const string &vrf_name,
245  const MacAddress &mac,
246  const VmInterface *intf,
247  const IpAddress &ip,
248  uint32_t label,
249  const string &vn_name,
250  const SecurityGroupList &sg_id_list,
251  const TagList &tag_id_list,
252  const PathPreference &path_pref,
253  uint32_t ethernet_tag,
254  bool etree_leaf,
255  const std::string &name) {
256  assert(peer);
257 
258  Agent *agent = static_cast<AgentDBTable *>(intf->get_table())->agent();
259  VmInterfaceKey intf_key(AgentKey::ADD_DEL_CHANGE, intf->GetUuid(), name);
260  VnListType vn_list;
261  vn_list.insert(vn_name);
262  LocalVmRoute *data = new LocalVmRoute(intf_key, label,
263  intf->vxlan_id(), false,
264  vn_list,
266  sg_id_list, tag_id_list,
267  CommunityList(),
268  path_pref,
269  IpAddress(),
270  EcmpLoadBalance(), false, false,
271  peer->sequence_number(),
272  etree_leaf, false);
274 
276  req.key.reset(new EvpnRouteKey(peer, vrf_name, mac, ip,
278  ethernet_tag));
279  req.data.reset(data);
280  EvpnTableProcess(agent, vrf_name, req);
281 }
282 
284  const string &vrf_name,
285  const MacAddress &mac,
286  const VmInterface *intf,
287  const IpAddress &ip,
288  uint32_t label,
289  const string &vn_name,
290  const SecurityGroupList &sg_id_list,
291  const TagList &tag_id_list,
292  const PathPreference &path_pref,
293  uint32_t ethernet_tag,
294  bool etree_leaf) {
295  assert(peer);
296 
297  Agent *agent = static_cast<AgentDBTable *>(intf->get_table())->agent();
298  VmInterfaceKey intf_key(AgentKey::ADD_DEL_CHANGE, intf->GetUuid(), "");
299  VnListType vn_list;
300  vn_list.insert(vn_name);
301  LocalVmRoute *data = new LocalVmRoute(intf_key, label,
302  intf->vxlan_id(), false,
303  vn_list,
305  sg_id_list, tag_id_list,
306  CommunityList(),
307  path_pref,
308  IpAddress(),
309  EcmpLoadBalance(), false, false,
310  peer->sequence_number(),
311  etree_leaf, false);
313 
315  req.key.reset(new EvpnRouteKey(peer, vrf_name, mac, ip,
317  ethernet_tag));
318  req.data.reset(data);
319  EvpnTableEnqueue(agent, &req);
320 }
321 
323  uint32_t vxlan_id,
324  const Ip4Address &tor_ip,
325  bool enqueue) {
326  const VrfEntry *vrf = vrf_entry();
328  req.key.reset(new EvpnRouteKey(peer,
329  vrf->GetName(),
331  tor_ip,
333  vxlan_id));
334  req.data.reset(NULL);
335  if (enqueue) {
336  EvpnTableEnqueue(agent(), &req);
337  } else {
338  EvpnTableProcess(agent(), vrf->GetName(), req);
339  }
340 }
341 
343  uint32_t vxlan_id,
344  const Ip4Address &tor_ip) {
345  DeleteOvsPeerMulticastRouteInternal(peer, vxlan_id, tor_ip, true);
346 }
347 
349  uint32_t vxlan_id,
350  const Ip4Address &tor_ip) {
351  DeleteOvsPeerMulticastRouteInternal(peer, vxlan_id, tor_ip, false);
352 }
353 
355  const string &vrf_name,
356  const MacAddress &mac,
357  const VmInterface *intf,
358  const IpAddress &ip,
359  uint32_t ethernet_tag) {
360  assert(peer);
361  Agent *agent = static_cast<AgentDBTable *>(intf->get_table())->agent();
363  req.key.reset(new EvpnRouteKey(peer, vrf_name, mac, IpAddress(ip),
365  ethernet_tag));
366  req.data.reset(NULL);
367  EvpnTableProcess(agent, vrf_name, req);
368 }
369 
371  const string &vrf_name,
372  const MacAddress &mac,
373  const IpAddress &ip_addr,
374  uint32_t ethernet_tag,
375  AgentRouteData *data) {
377  EvpnRouteKey *key = new EvpnRouteKey(peer, vrf_name, mac, ip_addr,
379  ethernet_tag);
380  key->sub_op_ = AgentKey::RESYNC;
381  req.key.reset(key);
382  req.data.reset(data);
383 
384  EvpnTableProcess(Agent::GetInstance(), vrf_name, req);
385 }
386 
388  const string &vrf_name,
389  const MacAddress &mac,
390  const IpAddress &ip_addr,
391  uint32_t plen,
392  uint32_t ethernet_tag,
393  AgentRouteData *data) {
395  req.key.reset(new EvpnRouteKey(peer, vrf_name, mac, ip_addr,
396  plen, ethernet_tag));
397  req.data.reset(data);
398 
400 }
401 
403  const string &vrf_name,
404  const MacAddress &mac,
405  const IpAddress &ip_addr,
406  uint32_t plen,
407  uint32_t ethernet_tag,
408  AgentRouteData *data) {
410  req.key.reset(new EvpnRouteKey(peer, vrf_name, mac, ip_addr,
411  plen, ethernet_tag));
412  req.data.reset(data);
413 
414  EvpnTableProcess(Agent::GetInstance(), vrf_name, req);
415 }
416 
418  const string &vrf_name,
419  const IpAddress &ip_addr,
420  uint32_t ethernet_tag,
421  EvpnRoutingData *data, uint8_t plen) {
423  if ( !plen && !ip_addr.is_unspecified()) {
424  req.key.reset(new EvpnRouteKey(peer, vrf_name, MacAddress(), ip_addr,
426  ethernet_tag));
427  } else {
428  req.key.reset(new EvpnRouteKey(peer, vrf_name, MacAddress(), ip_addr,
429  plen,
430  ethernet_tag));
431  }
432  req.data.reset(data);
433 
434  EvpnTableEnqueue(agent(), &req);
435 }
436 
437 void EvpnAgentRouteTable::DeleteReq(const Peer *peer, const string &vrf_name,
438  const MacAddress &mac,
439  const IpAddress &ip_addr,
440  uint32_t plen,
441  uint32_t ethernet_tag,
442  AgentRouteData *data) {
444  req.key.reset(new EvpnRouteKey(peer, vrf_name, mac, ip_addr,
445  plen, ethernet_tag));
446  req.data.reset(data);
448 }
449 
450 void EvpnAgentRouteTable::Delete(const Peer *peer, const string &vrf_name,
451  const MacAddress &mac,
452  const IpAddress &ip_addr,
453  uint32_t ethernet_tag) {
455  req.key.reset(new EvpnRouteKey(peer, vrf_name, mac, ip_addr,
457  ethernet_tag));
458  req.data.reset(NULL);
459  EvpnTableProcess(Agent::GetInstance(), vrf_name, req);
460 }
461 
463  const string &vrf_name,
464  const MacAddress &mac,
465  const IpAddress &ip_addr,
466  uint32_t ethernet_tag,
467  ClonedLocalPath *data) {
469  req.key.reset(new EvpnRouteKey(peer, vrf_name, mac, ip_addr,
471  ethernet_tag));
472  req.data.reset(data);
474 }
475 
477  if (addr.is_v4())
478  return 32;
479  if (addr.is_v6())
480  return 128;
481 
482  assert(0);
483  return 0;
484 }
485 
487 // EvpnRouteEntry methods
490  const MacAddress &mac,
491  const IpAddress &ip_addr,
492  uint8_t plen,
493  uint32_t ethernet_tag,
494  bool is_multicast) :
495  AgentRoute(vrf, is_multicast), AgentRoutePrefix(ip_addr, plen),
496  mac_(mac),
497  ethernet_tag_(ethernet_tag),
498  publish_to_inet_route_table_(true),
499  publish_to_bridge_route_table_(true) {
500  if (IsType5()) {
503  }
504 }
505 
506 string EvpnRouteEntry::ToString() const {
507  std::stringstream str;
508  if (is_multicast()) {
509  str << mac_.ToString();
510  } else {
511  str << ethernet_tag_;
512  str << "-";
513  str << mac_.ToString();
514  str << "-";
515  str << prefix_address_.to_string();
516  str << "/";
517  str << int(prefix_length());
518  }
519  return str.str();
520 }
521 
522 int EvpnRouteEntry::CompareTo(const Route &rhs) const {
523  const EvpnRouteEntry &a = static_cast<const EvpnRouteEntry &>(rhs);
524 
526  return -1;
527 
529  return 1;
530 
531  int cmp = mac_.CompareTo(a.mac_);
532  if (cmp != 0)
533  return cmp;
534 
536  return -1;
537 
539  return 1;
540 
541  if (prefix_length() < a.prefix_length())
542  return -1;
543 
544  if (prefix_length() > a.prefix_length())
545  return 1;
546 
547  return 0;
548 }
549 
551  EvpnRouteKey *key =
552  new EvpnRouteKey(Agent::GetInstance()->local_vm_peer(),
553  vrf()->GetName(), mac_, prefix_address_,
555  return DBEntryBase::KeyPtr(key);
556 }
557 
559  const EvpnRouteKey *k = static_cast<const EvpnRouteKey *>(key);
560  SetVrf(Agent::GetInstance()->vrf_table()->FindVrfFromName(k->vrf_name()));
561  mac_ = k->GetMac();
562  prefix_address_ = k->ip_addr();
564 }
565 
567  return GetActivePath()->GetActiveLabel();
568 }
569 
571  for(Route::PathList::const_iterator it = GetPathList().begin();
572  it != GetPathList().end(); it++) {
573  const AgentPath *path = static_cast<const AgentPath *>(it.operator->());
574  if (path->peer()->GetType() == Peer::OVS_PEER) {
575  return const_cast<AgentPath *>(path);
576  }
577  }
578  return NULL;
579 }
580 
581 //Notify L2 route corresponding to MAC in evpn route.
582 //On addition of evpn routes, update bridge route using mac of evpn and inet
583 //route using ip of evpn.
584 //NH of bridge route is same as of EVPN as bridge rt is programmed in kernel.
585 //NH of Inet route will be of subnet route to which it belongs. This makes sure
586 //that n absence of any directly installed Inet route for this IP packets are
587 //forwarded as per the subnet route decision.
589  const AgentPath *path,
590  bool active_path_changed) {
591  //As active path is picked from route, any modification in non-active
592  //path need not rebake agent route.
593  //Path is NULL when resync is issued on route, hence no need to check flag
594  if ((path != NULL) && !active_path_changed)
595  return;
596 
597 
599  BridgeAgentRouteTable *bridge_table = NULL;
600  bridge_table = static_cast<BridgeAgentRouteTable *>
601  (table->vrf_entry()->GetBridgeRouteTable());
602  if (bridge_table)
603  bridge_table->AddBridgeRoute(this);
604  }
606  InetUnicastAgentRouteTable *inet_table =
608  if (inet_table)
609  inet_table->AddEvpnRoute(this);
610  }
611 }
612 
613 //Delete path from L2 route corresponding to MAC+IP in evpn route.
615  //Delete from bridge table
616  BridgeAgentRouteTable *bridge_table = static_cast<BridgeAgentRouteTable *>
617  (table->vrf_entry()->GetBridgeRouteTable());
618  if (bridge_table)
619  bridge_table->DeleteBridgeRoute(this);
620 
621  //Delete from Inet table
622  InetUnicastAgentRouteTable *inet_table =
624  if (inet_table)
625  inet_table->DeleteEvpnRoute(this);
626 }
627 
629 // Sandesh related methods
631 void EvpnRouteReq::HandleRequest() const {
632  VrfEntry *vrf =
633  Agent::GetInstance()->vrf_table()->FindVrfFromId(get_vrf_index());
634  if (!vrf) {
635  ErrorResp *resp = new ErrorResp();
636  resp->set_context(context());
637  resp->Response();
638  return;
639  }
640 
641  AgentSandeshPtr sand(new AgentEvpnRtSandesh(vrf, context(), "",
642  get_stale()));
643  sand->DoSandesh(sand);
644 }
645 
647 (const AgentSandeshArguments *args, const std::string &context) {
648  return AgentSandeshPtr(new AgentEvpnRtSandesh(vrf_entry(), context, "",
649  false));
650 }
651 
652 bool EvpnRouteEntry::DBEntrySandesh(Sandesh *sresp, bool stale) const {
653  EvpnRouteResp *resp = static_cast<EvpnRouteResp *>(sresp);
654  RouteEvpnSandeshData data;
655  data.set_mac(ToString());
656  data.set_ip_addr(prefix_address_.to_string());
657 
658  for (Route::PathList::const_iterator it = GetPathList().begin();
659  it != GetPathList().end(); it++) {
660  const AgentPath *path = static_cast<const AgentPath *>(it.operator->());
661  if (path) {
662  PathSandeshData pdata;
663  path->SetSandeshData(pdata);
664  data.path_list.push_back(pdata);
665  }
666  }
667  std::vector<RouteEvpnSandeshData> &list =
668  const_cast<std::vector<RouteEvpnSandeshData>&>(resp->get_route_list());
669  list.push_back(data);
670  return true;
671 }
672 
674  bool ret = false;
675  Agent *agent = static_cast<AgentRouteTable *>(get_table())->agent();
676  EvpnRoutingPath *evpn_path = dynamic_cast<EvpnRoutingPath *>(path);
677  if (evpn_path) {
678  evpn_path->DeleteEvpnType5Route(agent, this);
679  }
680  return ret;
681 }
void AddType5Route(const Peer *peer, const std::string &vrf_name, const IpAddress &ip_addr, uint32_t ethernet_tag, EvpnRoutingData *data, uint8_t plen=0)
int vxlan_id() const
EvpnRouteEntry * FindRoute(const MacAddress &mac, const IpAddress &ip_addr, uint32_t plen, uint32_t ethernet_tag)
void DeleteOvsPeerMulticastRoute(const Peer *peer, uint32_t vxlan_id, const Ip4Address &tor_ip)
static void EvpnTableProcess(Agent *agent, const string &vrf_name, DBRequest &req)
void AddReceiveRoute(const Peer *peer, const std::string &vrf_name, uint32_t label, const MacAddress &mac, const IpAddress &ip_addr, uint32_t ethernet_tag, const std::string &vn_name, const PathPreference &pref)
void DeleteOvsPeerMulticastRouteReq(const Peer *peer, uint32_t vxlan_id, const Ip4Address &tor_ip)
void DeleteOvsPeerMulticastRouteInternal(const Peer *peer, uint32_t vxlan_id, const Ip4Address &tor_ip, bool enqueue)
static Agent * GetInstance()
Definition: agent.h:436
void AddOvsPeerMulticastRoute(const Peer *peer, uint32_t vxlan_id, const std::string &vn_name, Ip4Address vtep, Ip4Address tor_ip, bool ha_stale)
static void Delete(const Peer *peer, const std::string &vrf_name, const MacAddress &mac, const IpAddress &ip_addr, uint32_t ethernet_tag)
Definition: vrf.h:86
void DeleteBridgeRoute(const AgentRoute *rt)
AgentRouteTable * GetEvpnRouteTable() const
Definition: vrf.cc:330
const boost::uuids::uuid & GetUuid() const
Definition: interface.h:113
VrfEntry * FindVrfFromName(const string &name)
Definition: vrf.cc:873
DBTableBase * get_table() const
Definition: db_entry.cc:119
virtual void DeleteDerivedRoutes(AgentRouteTable *table)
AgentRouteTable * GetEvpnRouteTable(const std::string &vrf_name)
Definition: vrf.cc:913
Agent supports multiple route tables - Inet-unicast (IPv4/IPv6), Inet-multicast, bridge, EVPN (Type2/Type5). This base class contains common code for all types of route tables.
Definition: agent_route.h:109
virtual void UpdateDerivedRoutes(AgentRouteTable *table, const AgentPath *path, bool active_path_changed)
void AddOvsPeerMulticastRouteReq(const Peer *peer, uint32_t vxlan_id, const std::string &vn_name, Ip4Address vtep, Ip4Address tor_ip)
void AddClonedLocalPathReq(const Peer *peer, const string &vrf_name, const MacAddress &mac, const IpAddress &ip_addr, uint32_t ethernet_tag, ClonedLocalPath *data)
void DelLocalVmRoute(const Peer *peer, const std::string &vrf_name, const MacAddress &mac, const VmInterface *intf, const IpAddress &ip, uint32_t ethernet_tag)
EvpnRouteEntry(VrfEntry *vrf, const MacAddress &mac, const IpAddress &ip_addr, uint8_t plen, uint32_t ethernet_tag, bool is_multicast)
boost::asio::ip::address IpAddress
Definition: address.h:13
uint8_t sub_op_
Definition: agent_db.h:106
static void DeleteReq(const Peer *peer, const std::string &vrf_name, const MacAddress &mac, const IpAddress &ip_addr, uint32_t plen, uint32_t ethernet_tag, AgentRouteData *data)
virtual void SetKey(const DBRequestKey *key)
std::vector< int > SecurityGroupList
Definition: agent.h:201
bool is_multicast() const
Definition: agent_route.h:274
Definition: route.h:14
std::unique_ptr< DBRequestData > data
Definition: db_table.h:49
uint32_t ethernet_tag() const
virtual uint32_t GetActiveLabel() const
bool Enqueue(DBRequest *req)
Definition: db_table.cc:194
virtual bool DBEntrySandesh(Sandesh *sresp, bool stale) const
const string & GetName() const
Definition: vrf.h:100
virtual std::string ToString() const
std::unique_ptr< DBRequestKey > KeyPtr
Definition: db_entry.h:25
Base class for all Route entries in agent.
Definition: agent_route.h:224
void DeleteEvpnRoute(const AgentRoute *rt)
std::string ToString() const
Definition: mac_address.cc:53
void AddEvpnRoute(const AgentRoute *evpn_entry)
void AddBridgeRoute(const AgentRoute *rt)
const AgentPath * FindOvsPath() const
Definition: db.h:24
const Type GetType() const
Definition: peer.h:87
const AgentPath * GetActivePath() const
Definition: agent_route.cc:876
bool publish_to_bridge_route_table() const
void Init()
Definition: db_table.cc:387
VrfEntry * vrf_entry() const
Definition: agent_route.cc:459
IpAddress prefix_address_
The prefix address.
Definition: agent_route.h:385
EvpnRouteEntry * FindRouteNoLock(const MacAddress &mac, const IpAddress &ip_addr, uint32_t plen, uint32_t ethernet_tag)
void SetVrf(VrfEntry *vrf)
Definition: agent_route.h:325
VrfEntry * FindVrfFromId(size_t index)
Definition: vrf.cc:884
void AddOvsPeerMulticastRouteInternal(const Peer *peer, uint32_t vxlan_id, const std::string &vn_name, Ip4Address vtep, Ip4Address tor_ip, bool enqueue, bool ha_stale)
Definition: agent.h:358
InetUnicastAgentRouteTable * GetInetUnicastRouteTable(const IpAddress &addr) const
Definition: vrf.cc:575
int CompareTo(const MacAddress &rhs, int len=0) const
Definition: mac_address.cc:87
virtual bool ReComputePathDeletion(AgentPath *path)
std::unique_ptr< DBRequestKey > key
Definition: db_table.h:48
void AddLocalVmRouteReq(const Peer *peer, const std::string &vrf_name, const MacAddress &mac, const IpAddress &ip_addr, uint32_t ethernet_tag, LocalVmRoute *data)
virtual AgentSandeshPtr GetAgentSandesh(const AgentSandeshArguments *args, const std::string &context)
static TypeBmap AllType()
Definition: nexthop.h:321
const Peer * peer() const
Definition: agent_path.h:263
virtual KeyPtr GetDBRequestKey() const
uint64_t sequence_number() const
Definition: peer.h:94
AgentRouteTable * GetBridgeRouteTable() const
Definition: vrf.cc:334
const MacAddress & GetMac() const
static const MacAddress & BroadcastMac()
Definition: mac_address.h:152
class boost::shared_ptr< AgentSandesh > AgentSandeshPtr
Definition: agent_db.h:18
void AddControllerReceiveRouteReq(const Peer *peer, const std::string &vrf_name, uint32_t label, const MacAddress &mac, const IpAddress &ip_addr, uint32_t ethernet_tag, const std::string &vn_name, const PathPreference &pref, uint64_t sequence_number)
std::vector< std::string > CommunityList
Definition: bgp_config.h:347
void SetSandeshData(PathSandeshData &data) const
Definition: agent_path.cc:1720
Definition: peer.h:44
std::set< std::string > VnListType
Definition: agent.h:212
virtual const IpAddress & prefix_address() const
Returns the value of a stored prefix address (IPv4, IPv6 or MAC address)
Definition: agent_route.h:375
boost::asio::ip::address_v4 Ip4Address
Definition: address.h:14
uint32_t GetActiveLabel() const
Definition: agent_path.cc:79
VrfTable * vrf_table() const
Definition: agent.h:485
static void ResyncVmRoute(const Peer *peer, const string &vrf_name, const MacAddress &mac, const IpAddress &ip_addr, uint32_t ethernet_tag, AgentRouteData *data)
void AddReceiveRouteReq(const Peer *peer, const std::string &vrf_name, uint32_t label, const MacAddress &mac, const IpAddress &ip_addr, uint32_t ethernet_tag, const std::string &vn_name, const PathPreference &pref)
static void AddRemoteVmRoute(const Peer *peer, const std::string &vrf_name, const MacAddress &mac, const IpAddress &ip_addr, uint32_t plen, uint32_t ethernet_tag, AgentRouteData *data)
uint8_t prefix_length() const
!
const IpAddress & ip_addr() const
virtual EvpnRouteKey * Clone() const
void DeleteEvpnType5Route(Agent *agent, const AgentRoute *rt) const
Definition: agent_path.cc:2066
static uint32_t ComputeHostIpPlen(const IpAddress &addr)
const std::string & vrf_name() const
Definition: agent_route.h:46
VrfEntry * vrf() const
Definition: agent_route.h:275
void Process(DBRequest &req)
Definition: agent_route.cc:186
static void EvpnTableEnqueue(Agent *agent, DBRequest *req)
static DBTableBase * CreateTable(DB *db, const std::string &name)
virtual std::string ToString() const
virtual AgentRoute * AllocRouteEntry(VrfEntry *vrf, bool is_multicast) const
EvpnAgentRouteTable * fabric_evpn_table() const
Definition: agent.h:611
void AddLocalVmRoute(const Peer *peer, const std::string &vrf_name, const MacAddress &mac, const VmInterface *intf, const IpAddress &ip, uint32_t label, const std::string &vn_name, const SecurityGroupList &sg_id_list, const TagList &tag_id_list, const PathPreference &path_pref, uint32_t ethernet_tag, bool etree_leaf, const std::string &interface_name)
virtual int CompareTo(const Route &rhs) const
static TypeBmap VxlanType()
Definition: nexthop.h:311
bool publish_to_inet_route_table() const
void set_tunnel_bmap(TunnelType::TypeBmap bmap)
Definition: agent_path.h:679
This class defines interfaces for manipulating the prefix of a route stored in an Agent VRF table...
Definition: agent_route.h:363
const PathList & GetPathList() const
Definition: route.h:46
std::vector< int > TagList
Definition: agent.h:202
static void AddRemoteVmRouteReq(const Peer *peer, const std::string &vrf_name, const MacAddress &mac, const IpAddress &ip_addr, uint32_t plen, uint32_t ethernet_tag, AgentRouteData *data)