OpenSDN source code
vxlan_xmpp_routes.cc
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018 Juniper Networks, Inc. All rights reserved.
3  * Copyright (c) 2022 - 2026 Matvey Kraposhin.
4  * Copyright (c) 2024 - 2026 Elena Zizganova.
5  */
6 
7 #include <oper/operdb_init.h>
8 #include <oper/route_common.h>
9 #include <oper/vrf.h>
10 #include <oper/bridge_route.h>
12 #include <oper/evpn_route.h>
13 #include <oper/agent_route.h>
14 #include <oper/vn.h>
15 #include <oper/vrf.h>
18 #include <oper/tunnel_nh.h>
19 #include <oper/bgp_as_service.h>
20 
21 template<class RouteTable, class RouteEntry>
22 static const AgentPath *LocalVmExportInterface(Agent* agent,
23  RouteTable *table, RouteEntry *route);
24 
26  const IpAddress& dip, const MacAddress& dmac) const {
27 
28  const Ip4Address rtr_dip = dip.to_v4();
29 
30  const std::vector<IpAddress> nh_addresses(1, dip);
31  bool is_zero_mac = dmac.IsZero();
32 
33  MacAddress rtr_dmac;
34  if (!is_zero_mac) {
35  rtr_dmac = dmac;
36  } else {
37  rtr_dmac = NbComputeMac(rtr_dip, agent_);
38  }
39 
40  TunnelNHKey *tun_nh_key = new TunnelNHKey(agent_->fabric_vrf_name(),
41  agent_->router_id(),
42  rtr_dip,
43  false,
45  rtr_dmac);
46  return tun_nh_key;
47 }
48 
50 const int prefix_len, uint32_t vxlan_id, const std::string vrf_name,
51 const RouteParameters& params, const Peer *bgp_peer,
52 const std::vector<std::string> &peer_sources) {
53  VrfEntry* vrf = agent_->vrf_table()->FindVrfFromName(vrf_name);
54  EvpnAgentRouteTable *evpn_table =
55  dynamic_cast<EvpnAgentRouteTable*>(vrf->GetEvpnRouteTable());
56  if (evpn_table == NULL) {
57  return;
58  }
59 
60  // If route is a tunnel
61  if (agent_->router_id() != params.nh_addr_.to_v4()) {
62  XmppAdvertiseEvpnTunnel(evpn_table,
63  prefix_ip, prefix_len, vxlan_id, vrf_name, params, bgp_peer);
64  return;
65  }
66 
67  // Or this is an interface
68  XmppAdvertiseEvpnInterface(evpn_table,
69  prefix_ip, prefix_len, vxlan_id, vrf_name, params, bgp_peer, peer_sources);
70 }
71 
73  const int prefix_len, const std::string vrf_name,
74  const AgentPath* path) {
75 
76  VrfEntry* vrf = agent_->vrf_table()->FindVrfFromName(vrf_name);
77  InetUnicastAgentRouteTable *inet_table =
78  vrf->GetInetUnicastRouteTable(prefix_ip);
79 
80  if (path->nexthop() && path->nexthop()->GetType() ==
82  XmppAdvertiseInetTunnel(inet_table,
83  prefix_ip, prefix_len, vrf_name, path);
84  return;
85  }
86 
87  if (path->nexthop() &&
88  (path->nexthop()->GetType() == NextHop::INTERFACE ||
89  path->nexthop()->GetType() == NextHop::COMPOSITE)) {
91  prefix_ip, prefix_len, vrf_name, path);
92  }
93 }
94 
96  EvpnAgentRouteTable *evpn_table, const IpAddress& prefix_ip,
97  const int prefix_len, uint32_t vxlan_id, const std::string vrf_name,
98  const RouteParameters& params, const Peer *peer
99 ) {
100  const BgpPeer *bgp_peer = dynamic_cast<const BgpPeer*>(peer);
101  if (bgp_peer == NULL) {
102  return;
103  }
105  std::unique_ptr<TunnelNHKey> tun_nh_key (AllocateTunnelNextHopKey(
106  params.nh_addr_, params.nh_mac_));
107 
108  ControllerVmRoute *data =
109  ControllerVmRoute::MakeControllerVmRoute(dynamic_cast<const BgpPeer*>(bgp_peer),
111  agent_->router_id(),
112  vrf_name,
113  tun_nh_key->dip(),
115  vxlan_id,
116  tun_nh_key->rewrite_dmac(),
117  params.vn_list_,
118  params.sg_list_,
119  params.tag_list_,
120  params.path_preference_,
121  true,
122  EcmpLoadBalance(),
123  false);
124  evpn_table->AddRemoteVmRouteReq(bgp_peer,
125  vrf_name,
126  MacAddress(),
127  prefix_ip,
128  prefix_len,
129  0, // ethernet_tag is zero for Type5
130  data);
131 }
132 
134  EvpnAgentRouteTable *evpn_table, const IpAddress& prefix_ip,
135  const int prefix_len, uint32_t vxlan_id, const std::string vrf_name,
136  const RouteParameters& params, const Peer *bgp_peer, const NextHop *nh
137 ) {
138  const InterfaceNH *intf_nh = dynamic_cast<const InterfaceNH *>(nh);
139  const Interface *intf = intf_nh->GetInterface();
140  if (intf->type() != Interface::VM_INTERFACE) {
141  return;
142  }
143  const VmInterface *vm_intf = dynamic_cast<const VmInterface*>
144  (intf);
145  DBEntryBase::KeyPtr tintf_key_ptr = vm_intf->GetDBRequestKey();
146  const VmInterfaceKey* intf_key_ptr =
147  dynamic_cast<const VmInterfaceKey *>(tintf_key_ptr.get());
148 
149  LocalVmRoute *loc_rt_ptr = new LocalVmRoute(
150  *intf_key_ptr,
151  MplsTable::kInvalidLabel, // mpls_label
152  vxlan_id,
153  false,
154  params.vn_list_,
155  intf_nh->GetFlags(), // flags
156  params.sg_list_,
157  params.tag_list_,
158  params.communities_,
159  params.path_preference_,
160  Ip4Address(0),
161  params.ecmp_load_balance_,
162  false,
163  false,
164  params.sequence_number_,
165  false,
166  false); // native_encap
167  loc_rt_ptr->set_tunnel_bmap(TunnelType::VxlanType());
168 
169  {
171 
172  req.key.reset(new EvpnRouteKey(bgp_peer,
173  evpn_table->vrf_entry()->GetName(),
174  MacAddress(),
175  prefix_ip,
176  prefix_len,
177  0));
178  req.data.reset(loc_rt_ptr);
179  evpn_table->Enqueue(&req);
180  }
181 }
182 
184  EvpnAgentRouteTable *evpn_table, const IpAddress& prefix_ip,
185  const int prefix_len, uint32_t vxlan_id, const std::string vrf_name,
186  const RouteParameters& params, const Peer *bgp_peer,
187  ComponentNHKeyList &comp_nh_list ) {
189  const bool comp_nh_policy = true;
190  CompositeNHKey *new_comp_nh_key =
192  comp_nh_policy, comp_nh_list, vrf_name);
193 
194  nh_req.key.reset(new_comp_nh_key);
195  nh_req.data.reset(new CompositeNHData());
196  const BgpPeer *bgp_peer_ecmp = dynamic_cast<const BgpPeer*>(bgp_peer);
197  std::stringstream prefix_str;
198  prefix_str << prefix_ip.to_string();
199  prefix_str << "/";
200  prefix_str << prefix_len;
201 
203  bgp_peer_ecmp,
204  params.vn_list_,
205  params.ecmp_load_balance_,
206  params.tag_list_,
207  params.sg_list_,
208  params.path_preference_,
210  nh_req,
211  prefix_str.str(),
212  evpn_table->vrf_name());
213 
215  rt_data->cloned_local_path_list().begin();
216  while (iter != rt_data->cloned_local_path_list().end()) {
217  evpn_table->AddClonedLocalPathReq(bgp_peer_ecmp, vrf_name,
218  MacAddress(), prefix_ip, 0, (*iter));
219  iter++;
220  }
221 
222  evpn_table->AddRemoteVmRouteReq(bgp_peer_ecmp,
223  vrf_name, MacAddress(),
224  prefix_ip,
225  prefix_len,
226  0, // ethernet tag is 0 for VxLAN
227  rt_data);
228 }
229 
231  EvpnAgentRouteTable *evpn_table, const IpAddress& prefix_ip,
232  const int prefix_len, uint32_t vxlan_id, const std::string vrf_name,
233  const RouteParameters& params, const Peer *bgp_peer,
234  const std::vector<std::string> &peer_sources
235 ) {
236  const NextHop *first_intf_nh = nullptr;
237  NextHopKey *nh_key = nullptr;
238  // Create a new composite
239  ComponentNHKeyList new_comp_nh_list;
240  for (auto &nexthop_addr : peer_sources) {
241  IpAddress nh_ip;
242  boost::system::error_code ec;
243  int nh_ip_len;
244  if (is_ipv4_string(nexthop_addr)) {
245  nh_ip = Ip4Address::from_string(ipv4_prefix(nexthop_addr), ec);
246  nh_ip_len = ipv4_prefix_len(nexthop_addr);
247  } else if (is_ipv6_string(nexthop_addr)) {
248  nh_ip = Ip6Address::from_string(ipv6_prefix(nexthop_addr), ec);
249  nh_ip_len = ipv6_prefix_len(nexthop_addr);
250  } else {
251  LOG(ERROR, "Error in VxlanRoutingManager::AddInterfaceComponentToList"
252  << ", nexthop_addr = " << nexthop_addr
253  << " is not an IPv4 or IPv6 prefix");
254  return;
255  }
256  if (ec) {
257  continue;
258  }
259  EvpnRouteEntry *route =evpn_table->FindRoute(MacAddress(),
260  nh_ip, nh_ip_len, 0);
261  const AgentPath *loc_path =
262  LocalVmExportInterface(agent_, evpn_table, route);
263  if (loc_path == nullptr) {
264  continue;
265  }
266  if (loc_path->nexthop() == nullptr) {
267  continue;
268  }
269  if (IsBgpaasInterfaceNexthop(agent_, loc_path->nexthop())) {
270  if (first_intf_nh == NULL) {
271  first_intf_nh = loc_path->nexthop();
272  }
273  DBEntryBase::KeyPtr key = loc_path->nexthop()->
274  GetDBRequestKey();
275  nh_key = static_cast<NextHopKey *>(key.release());
276 
277  std::unique_ptr<const NextHopKey> nh_key_ptr(nh_key);
278  ComponentNHKeyPtr component_nh_key(new ComponentNHKey(
279  MplsTable::kInvalidLabel, std::move(nh_key_ptr)));
280  new_comp_nh_list.push_back(component_nh_key);
281  } else if (IsBgpaasCompositeNexthop(agent_, loc_path->nexthop())) {
282  const CompositeNH *composite_nh = dynamic_cast<const CompositeNH*>(
283  loc_path->nexthop());
284  const ComponentNHList &components = composite_nh->component_nh_list();
285  for (auto &component : components) {
286  if (component.get() &&
287  component->nh() &&
288  component->nh()->GetType() == NextHop::INTERFACE) {
289  if (first_intf_nh == nullptr) {
290  first_intf_nh = component->nh();
291  }
292  DBEntryBase::KeyPtr key = component->nh()->
293  GetDBRequestKey();
294  nh_key = static_cast<NextHopKey *>(key.release());
295 
296  std::unique_ptr<const NextHopKey> nh_key_ptr(nh_key);
297  ComponentNHKeyPtr component_nh_key(new ComponentNHKey(
298  MplsTable::kInvalidLabel, std::move(nh_key_ptr)));
299  new_comp_nh_list.push_back(component_nh_key);
300  }
301  }
302  }
303  }
304 
305  if (new_comp_nh_list.size() < 1) {
306  return;
307  } else if (new_comp_nh_list.size() == 1) {
308  XmppAdvertiseEvpnBgpaasInterface(evpn_table, prefix_ip, prefix_len,
309  vxlan_id, vrf_name, params, bgp_peer, first_intf_nh);
310  } else {
311  XmppAdvertiseEvpnBgpaasComposite(evpn_table, prefix_ip, prefix_len,
312  vxlan_id, vrf_name, params, bgp_peer, new_comp_nh_list);
313  }
314 
315 }
316 
318  EvpnAgentRouteTable *evpn_table, const IpAddress& prefix_ip,
319  const int prefix_len, uint32_t vxlan_id, const std::string vrf_name,
320  const RouteParameters& params, const Peer *bgp_peer,
321  const std::vector<std::string> &peer_sources ) {
322  EvpnRouteEntry *route = evpn_table->FindRoute(MacAddress(),
323  prefix_ip, prefix_len, 0);
324  if (RoutePrefixIsEqualTo(route, prefix_ip, prefix_len) == false) {
325  XmppAdvertiseEvpnBgpaas(evpn_table, prefix_ip, prefix_len, vxlan_id,
326  vrf_name, params, bgp_peer, peer_sources);
327  return;
328  }
329  const AgentPath * path =
330  LocalVmExportInterface(agent_, evpn_table, route);
331 
332  if (!path ) {
333  XmppAdvertiseEvpnBgpaas(evpn_table, prefix_ip, prefix_len, vxlan_id,
334  vrf_name, params, bgp_peer, peer_sources);
335  return;
336  }
337 
339  prefix_ip,
340  prefix_len,
341  bgp_peer,
342  RouteParameters(IpAddress(), // NH address, not needed here
343  MacAddress(),
344  params.vn_list_,
345  params.sg_list_,
346  params.communities_,
347  params.tag_list_,
348  params.path_preference_,
349  params.ecmp_load_balance_,
350  params.sequence_number_),
351  evpn_table);
352 }
353 
355  InetUnicastAgentRouteTable *inet_table, const IpAddress& prefix_ip,
356  const int prefix_len, const std::string vrf_name,
357  const AgentPath* path) {
358 
360  TunnelNH *tun_nh = dynamic_cast<TunnelNH*>(path->nexthop());
361 
362  TunnelNHKey *tun_nh_key = AllocateTunnelNextHopKey(*(tun_nh->GetDip()),
363  tun_nh->rewrite_dmac());
364  std::string origin_vn = "";
365 
366  nh_req.key.reset(tun_nh_key);
367  nh_req.data.reset(new TunnelNHData);
368 
369  inet_table->AddEvpnRoutingRoute(prefix_ip,
370  prefix_len,
371  inet_table->vrf_entry(),
373  path->sg_list(),
374  path->communities(),
375  path->path_preference(),
376  path->ecmp_load_balance(),
377  path->tag_list(),
378  nh_req,
379  path->vxlan_id(),
380  path->dest_vn_list(),
381  origin_vn);
382 }
383 
385  InetUnicastAgentRouteTable *inet_table, const IpAddress& prefix_ip,
386  const int prefix_len, const std::string vrf_name,
387  const AgentPath* path) {
388 
389  CopyPathToInetTable(path,
390  prefix_ip,
391  prefix_len,
394  MacAddress(),
395  path->dest_vn_list(),
396  path->sg_list(),
397  path->communities(),
398  path->tag_list(),
399  path->path_preference(),
400  path->ecmp_load_balance(),
401  path->peer_sequence_number()),
402  inet_table);
403 }
404 
405 template<class RouteTable, class RouteEntry>
407  RouteTable *table, RouteEntry *route) {
408  if (table == NULL || agent == NULL || route == NULL) {
409  return NULL;
410  }
411 
412  const AgentPath *tm_path = NULL;
413  const AgentPath *rt_path = NULL;
414 
415  for (Route::PathList::const_iterator it =
416  route->GetPathList().begin();
417  it != route->GetPathList().end(); it++) {
418  tm_path =
419  static_cast<const AgentPath *>(it.operator->());
420  if (tm_path == NULL || tm_path->peer() == NULL) {
421  continue;
422  }
423  if (tm_path->peer()->GetType() ==
424  agent->local_vm_export_peer()->GetType()) {
425  if (tm_path->nexthop() &&
426  tm_path->nexthop()->GetType() == NextHop::INTERFACE) {
427  rt_path = tm_path;
428  } else if (tm_path->nexthop() &&
429  tm_path->nexthop()->GetType() == NextHop::COMPOSITE) {
430  return tm_path;
431  }
432  }
433  }
434  return rt_path;
435 }
436 
437 //
438 //END-OF-FILE
439 //
440 
boost::asio::ip::address IpAddress
Definition: address.h:13
boost::asio::ip::address_v4 Ip4Address
Definition: address.h:14
uint64_t peer_sequence_number() const
Definition: agent_path.h:415
const VnListType & dest_vn_list() const
Definition: agent_path.h:258
NextHop * nexthop() const
Definition: agent_path.cc:87
const EcmpLoadBalance & ecmp_load_balance() const
Definition: agent_path.h:365
const PathPreference & path_preference() const
Definition: agent_path.h:329
const SecurityGroupList & sg_list() const
Definition: agent_path.h:248
uint32_t vxlan_id() const
Definition: agent_path.h:265
const Peer * peer() const
Definition: agent_path.h:263
const TagList & tag_list() const
Definition: agent_path.h:249
const CommunityList & communities() const
Definition: agent_path.h:250
const std::string & vrf_name() const
Definition: agent_route.cc:455
VrfEntry * vrf_entry() const
Definition: agent_route.cc:459
Definition: agent.h:360
VrfTable * vrf_table() const
Definition: agent.h:487
const Peer * local_vm_export_peer() const
Definition: agent.h:1042
const std::string & fabric_vrf_name() const
Definition: agent.h:905
Ip4Address router_id() const
Definition: agent.h:668
const ComponentNHList & component_nh_list() const
Definition: nexthop.h:1869
ClonedLocalPathList::iterator ClonedLocalPathListIter
ClonedLocalPathList & cloned_local_path_list()
static ControllerVmRoute * MakeControllerVmRoute(const BgpPeer *peer, const string &default_vrf, const Ip4Address &router_id, const string &vrf_name, const Ip4Address &tunnel_dest, TunnelType::TypeBmap bmap, uint32_t label, MacAddress rewrite_dmac, const VnListType &dest_vn_list, const SecurityGroupList &sg_list, const TagList &tag_list, const PathPreference &path_preference, bool ecmp_suppressed, const EcmpLoadBalance &ecmp_load_balance, bool etree_leaf)
std::unique_ptr< DBRequestKey > KeyPtr
Definition: db_entry.h:24
bool Enqueue(DBRequest *req)
Definition: db_table.cc:220
void AddClonedLocalPathReq(const Peer *peer, const string &vrf_name, const MacAddress &mac, const IpAddress &ip_addr, uint32_t ethernet_tag, ClonedLocalPath *data)
EvpnRouteEntry * FindRoute(const MacAddress &mac, const IpAddress &ip_addr, uint32_t plen, uint32_t ethernet_tag)
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)
void AddEvpnRoutingRoute(const IpAddress &ip_addr, uint8_t plen, const VrfEntry *vrf, const Peer *peer, const SecurityGroupList &sg_list, const CommunityList &communities, const PathPreference &path_preference, const EcmpLoadBalance &ecmp_load_balance, const TagList &tag_list, DBRequest &nh_req, uint32_t vxlan_id, const VnListType &vn_list, const std::string &origin_vn="")
const Interface * GetInterface() const
Definition: nexthop.h:1293
uint8_t GetFlags() const
Definition: nexthop.h:1300
@ VM_INTERFACE
Definition: interface.h:37
Type type() const
Definition: interface.h:114
void set_tunnel_bmap(TunnelType::TypeBmap bmap)
Definition: agent_path.h:679
bool IsZero() const
Definition: mac_address.cc:29
static const uint32_t kInvalidLabel
Definition: mpls.h:101
@ COMPOSITE
Definition: nexthop.h:354
@ INTERFACE
Definition: nexthop.h:351
@ TUNNEL
Definition: nexthop.h:352
Type GetType() const
Definition: nexthop.h:405
Definition: peer.h:44
const Type GetType() const
Definition: peer.h:87
const Ip4Address * GetDip() const
Definition: tunnel_nh.h:37
const MacAddress & rewrite_dmac() const
Definition: tunnel_nh.h:41
static TypeBmap VxlanType()
Definition: nexthop.h:311
KeyPtr GetDBRequestKey() const
Definition: vrf.h:89
const string & GetName() const
Definition: vrf.h:103
InetUnicastAgentRouteTable * GetInetUnicastRouteTable(const IpAddress &addr) const
Definition: vrf.cc:575
AgentRouteTable * GetEvpnRouteTable() const
Definition: vrf.cc:330
VrfEntry * FindVrfFromName(const string &name)
Definition: vrf.cc:873
static void CopyInterfacePathToEvpnTable(const AgentPath *path, const IpAddress &prefix_ip, const uint32_t plen, const Peer *peer, const RouteParameters &params, EvpnAgentRouteTable *evpn_table)
Copies the path to the prefix address into the EVPN table with the given Peer. The function is used d...
static bool RoutePrefixIsEqualTo(const EvpnRouteEntry *route, const IpAddress &prefix_ip, const uint32_t prefix_len)
Determines whether route prefix in the EVPN route is equal to the given pair of prefix IP address and...
void XmppAdvertiseInetInterfaceOrComposite(InetUnicastAgentRouteTable *inet_table, const IpAddress &prefix_ip, const int prefix_len, const std::string vrf_name, const AgentPath *path)
Advertises in the Inet table an interface route that arrived via XMPP channel. Must be called only fr...
friend class ControllerEcmpRoute
Allows ControllerEcmpRoute to use private members of this class.
static bool is_ipv4_string(const std::string &prefix_str)
Determines whether the address string contains an IPv4 address as substring or not.
static std::string ipv6_prefix(const std::string &prefix_str)
Extracts an IPv6 address string from the prefix string.
void XmppAdvertiseEvpnBgpaasInterface(EvpnAgentRouteTable *evpn_table, const IpAddress &prefix_ip, const int prefix_len, uint32_t vxlan_id, const std::string vrf_name, const RouteParameters &params, const Peer *bgp_peer, const NextHop *nh)
Advertises in an EVPN routing table a BGPaaS route with interface path that came from the controller ...
void XmppAdvertiseEvpnRoute(const IpAddress &prefix_ip, const int prefix_len, uint32_t vxlan_id, const std::string vrf_name, const RouteParameters &params, const Peer *bgp_peer, const std::vector< std::string > &peer_sources)
Advertises an EVPN route received using XMPP channel.
void XmppAdvertiseInetTunnel(InetUnicastAgentRouteTable *inet_table, const IpAddress &prefix_ip, const int prefix_len, uint32_t vxlan_id, const std::string vrf_name, const RouteParameters &params, const Peer *bgp_peer)
Advertises in the Inet table a tunnel route that arrived via XMPP channel. Must be called only from X...
void XmppAdvertiseEvpnTunnel(EvpnAgentRouteTable *inet_table, const IpAddress &prefix_ip, const int prefix_len, uint32_t vxlan_id, const std::string vrf_name, const RouteParameters &params, const Peer *bgp_peer)
Advertises in the EVPN table a tunnel route that arrived via XMPP channel. Must be called only from X...
static const Peer * routing_vrf_vxlan_bgp_peer_
A pointer to the Peer where all BGP routes are stored.
void XmppAdvertiseEvpnBgpaasComposite(EvpnAgentRouteTable *evpn_table, const IpAddress &prefix_ip, const int prefix_len, uint32_t vxlan_id, const std::string vrf_name, const RouteParameters &params, const Peer *bgp_peer, ComponentNHKeyList &comp_nh_list)
Advertises in an EVPN routing table a BGPaaS route with interface composite path that came from the c...
TunnelNHKey * AllocateTunnelNextHopKey(const IpAddress &dip, const MacAddress &dmac) const
XMPP Advertising functions.
static uint32_t ipv4_prefix_len(const std::string &prefix_str)
Extracts length of IPv4 subnet address from the prefix string.
static MacAddress NbComputeMac(const Ip4Address &compute_ip, const Agent *agent)
Returns the MAC address for the IP of a given neighbouring compute.
Agent * agent_
A pointer to the Agent instance.
void CopyPathToInetTable(const AgentPath *path, const IpAddress &prefix_ip, const uint32_t plen, const Peer *peer, const RouteParameters &params, InetUnicastAgentRouteTable *inet_table)
Copies the path to the prefix address into the EVPN table with the given Peer. The function is used d...
void XmppAdvertiseEvpnInterface(EvpnAgentRouteTable *inet_table, const IpAddress &prefix_ip, const int prefix_len, uint32_t vxlan_id, const std::string vrf_name, const RouteParameters &params, const Peer *bgp_peer, const std::vector< std::string > &peer_sources)
Advertises in the EVPN table an interface route that arrived via XMPP channel. Must be called only fr...
void XmppAdvertiseEvpnBgpaas(EvpnAgentRouteTable *evpn_table, const IpAddress &prefix_ip, const int prefix_len, uint32_t vxlan_id, const std::string vrf_name, const RouteParameters &params, const Peer *bgp_peer, const std::vector< std::string > &peer_sources)
Advertises in an EVPN routing table a BGPaaS route that came from the controller (this routes leaking...
void XmppAdvertiseInetRoute(const IpAddress &prefix_ip, const int prefix_len, uint32_t vxlan_id, const std::string vrf_name, const RouteParameters &params, const Peer *bgp_peer)
Advertises an Inet route received using XMPP channel.
static bool is_ipv6_string(const std::string &prefix_str)
Determines whether the address string contains an IPv6 address as substring or not.
static std::string ipv4_prefix(const std::string &prefix_str)
Extracts an IPv4 address string from the prefix string.
static uint32_t ipv6_prefix_len(const std::string &prefix_str)
Extracts length of IPv6 subnet address from the prefix string.
#define LOG(_Level, _Msg)
Definition: logging.h:34
std::vector< ComponentNHPtr > ComponentNHList
Definition: nexthop.h:1637
boost::shared_ptr< const ComponentNHKey > ComponentNHKeyPtr
Definition: nexthop.h:1639
std::vector< ComponentNHKeyPtr > ComponentNHKeyList
Definition: nexthop.h:1641
@ LOCAL_ECMP
Definition: nexthop.h:1593
@ DB_ENTRY_ADD_CHANGE
Definition: db_table.h:38
std::unique_ptr< DBRequestKey > key
Definition: db_table.h:48
std::unique_ptr< DBRequestData > data
Definition: db_table.h:49
A structure to hold path parameters during the transfer (routes leaking) of data between VRF instance...
const EcmpLoadBalance & ecmp_load_balance_
A reference to EcmpLoadBalance of the path.
const MacAddress & nh_mac_
A nexthop MAC address (usually it is a MAC of the router).
const IpAddress & nh_addr_
A nexthop IP address of the tunnel. Contains first IP address of nh_addresses_ in case of a composite...
const TagList & tag_list_
A list of tags.
const PathPreference & path_preference_
A reference to the PathPreference of the path.
uint64_t sequence_number_
An ID of sequence.
const CommunityList & communities_
A list of communities.
const SecurityGroupList & sg_list_
A list of security groups.
const VnListType & vn_list_
A list of path destination virtual networks used in policy lookups.
static bool IsBgpaasCompositeNexthop(const Agent *agent, const NextHop *nh)
static bool IsBgpaasInterfaceNexthop(const Agent *agent, const NextHop *nh)
static const AgentPath * LocalVmExportInterface(Agent *agent, RouteTable *table, RouteEntry *route)