15 template<
class RouteTable,
class RouteEntry>
24 const std::vector<IpAddress> nh_addresses(1, dip);
25 bool is_zero_mac = dmac.
IsZero();
44 const int prefix_len, uint32_t vxlan_id,
const std::string vrf_name,
46 const std::vector<std::string> &peer_sources) {
50 if (evpn_table == NULL) {
57 prefix_ip, prefix_len, vxlan_id, vrf_name, params, bgp_peer);
63 prefix_ip, prefix_len, vxlan_id, vrf_name, params, bgp_peer, peer_sources);
67 const int prefix_len,
const std::string vrf_name,
77 prefix_ip, prefix_len, vrf_name, path);
85 prefix_ip, prefix_len, vrf_name, path);
91 const int prefix_len, uint32_t vxlan_id,
const std::string vrf_name,
95 if (bgp_peer == NULL) {
110 tun_nh_key->rewrite_dmac(),
129 const int prefix_len, uint32_t vxlan_id,
const std::string vrf_name,
172 req.
data.reset(loc_rt_ptr);
179 const int prefix_len, uint32_t vxlan_id,
const std::string vrf_name,
183 const bool comp_nh_policy =
true;
186 comp_nh_policy, comp_nh_list, vrf_name);
188 nh_req.
key.reset(new_comp_nh_key);
190 const BgpPeer *bgp_peer_ecmp =
dynamic_cast<const BgpPeer*
>(bgp_peer);
191 std::stringstream prefix_str;
192 prefix_str << prefix_ip.to_string();
194 prefix_str << prefix_len;
226 const int prefix_len, uint32_t vxlan_id,
const std::string vrf_name,
228 const std::vector<std::string> &peer_sources
230 const NextHop *first_intf_nh =
nullptr;
234 for (
auto &nexthop_addr : peer_sources) {
236 boost::system::error_code ec;
239 nh_ip = Ip4Address::from_string(
ipv4_prefix(nexthop_addr), ec);
242 nh_ip = Ip6Address::from_string(
ipv6_prefix(nexthop_addr), ec);
245 LOG(ERROR,
"Error in VxlanRoutingManager::AddInterfaceComponentToList"
246 <<
", nexthop_addr = " << nexthop_addr
247 <<
" is not an IPv4 or IPv6 prefix");
254 nh_ip, nh_ip_len, 0);
257 if (loc_path ==
nullptr) {
260 if (loc_path->
nexthop() ==
nullptr) {
264 if (first_intf_nh == NULL) {
265 first_intf_nh = loc_path->
nexthop();
269 nh_key =
static_cast<NextHopKey *
>(key.release());
271 std::unique_ptr<const NextHopKey> nh_key_ptr(nh_key);
274 new_comp_nh_list.push_back(component_nh_key);
279 for (
auto &component : components) {
280 if (component.get() &&
283 if (first_intf_nh ==
nullptr) {
284 first_intf_nh = component->nh();
288 nh_key =
static_cast<NextHopKey *
>(key.release());
290 std::unique_ptr<const NextHopKey> nh_key_ptr(nh_key);
293 new_comp_nh_list.push_back(component_nh_key);
299 if (new_comp_nh_list.size() < 1) {
301 }
else if (new_comp_nh_list.size() == 1) {
303 vxlan_id, vrf_name, params, bgp_peer, first_intf_nh);
306 vxlan_id, vrf_name, params, bgp_peer, new_comp_nh_list);
313 const int prefix_len, uint32_t vxlan_id,
const std::string vrf_name,
315 const std::vector<std::string> &peer_sources ) {
317 prefix_ip, prefix_len, 0);
320 vrf_name, params, bgp_peer, peer_sources);
328 vrf_name, params, bgp_peer, peer_sources);
350 const int prefix_len,
const std::string vrf_name,
358 std::string origin_vn =
"";
360 nh_req.
key.reset(tun_nh_key);
380 const int prefix_len,
const std::string vrf_name,
399 template<
class RouteTable,
class RouteEntry>
402 if (table == NULL || agent == NULL || route == NULL) {
409 for (Route::PathList::const_iterator it =
410 route->GetPathList().begin();
411 it != route->GetPathList().end(); it++) {
413 static_cast<const AgentPath *
>(it.operator->());
414 if (tm_path == NULL || tm_path->
peer() == NULL) {
422 }
else if (tm_path->
nexthop() &&
boost::asio::ip::address IpAddress
boost::asio::ip::address_v4 Ip4Address
uint64_t peer_sequence_number() const
const VnListType & dest_vn_list() const
NextHop * nexthop() const
const EcmpLoadBalance & ecmp_load_balance() const
const PathPreference & path_preference() const
const SecurityGroupList & sg_list() const
uint32_t vxlan_id() const
const Peer * peer() const
const TagList & tag_list() const
const CommunityList & communities() const
const std::string & vrf_name() const
VrfEntry * vrf_entry() const
VrfTable * vrf_table() const
const Peer * local_vm_export_peer() const
const std::string & fabric_vrf_name() const
Ip4Address router_id() const
const ComponentNHList & component_nh_list() const
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
bool Enqueue(DBRequest *req)
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
void set_tunnel_bmap(TunnelType::TypeBmap bmap)
static const uint32_t kInvalidLabel
const Type GetType() const
const Ip4Address * GetDip() const
const MacAddress & rewrite_dmac() const
static TypeBmap VxlanType()
KeyPtr GetDBRequestKey() const
const string & GetName() const
InetUnicastAgentRouteTable * GetInetUnicastRouteTable(const IpAddress &addr) const
AgentRouteTable * GetEvpnRouteTable() const
VrfEntry * FindVrfFromName(const string &name)
static void CopyInterfacePathToEvpnTable(const AgentPath *path, const IpAddress &prefix_ip, const uint32_t plen, const Peer *peer, const RouteParameters ¶ms, 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 ¶ms, const Peer *bgp_peer, const NextHop *nh)
void XmppAdvertiseEvpnRoute(const IpAddress &prefix_ip, const int prefix_len, uint32_t vxlan_id, const std::string vrf_name, const RouteParameters ¶ms, 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 ¶ms, 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 ¶ms, 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 ¶ms, const Peer *bgp_peer, ComponentNHKeyList &comp_nh_list)
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 ¶ms, 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 ¶ms, 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 ¶ms, const Peer *bgp_peer, const std::vector< std::string > &peer_sources)
void XmppAdvertiseInetRoute(const IpAddress &prefix_ip, const int prefix_len, uint32_t vxlan_id, const std::string vrf_name, const RouteParameters ¶ms, 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)
std::vector< ComponentNHPtr > ComponentNHList
boost::shared_ptr< const ComponentNHKey > ComponentNHKeyPtr
std::vector< ComponentNHKeyPtr > ComponentNHKeyList
std::unique_ptr< DBRequestKey > key
std::unique_ptr< DBRequestData > data
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)