21 template<
class RouteTable,
class RouteEntry>
30 const std::vector<IpAddress> nh_addresses(1, dip);
31 bool is_zero_mac = dmac.
IsZero();
50 const int prefix_len, uint32_t vxlan_id,
const std::string vrf_name,
52 const std::vector<std::string> &peer_sources) {
56 if (evpn_table == NULL) {
63 prefix_ip, prefix_len, vxlan_id, vrf_name, params, bgp_peer);
69 prefix_ip, prefix_len, vxlan_id, vrf_name, params, bgp_peer, peer_sources);
73 const int prefix_len,
const std::string vrf_name,
83 prefix_ip, prefix_len, vrf_name, path);
91 prefix_ip, prefix_len, vrf_name, path);
97 const int prefix_len, uint32_t vxlan_id,
const std::string vrf_name,
101 if (bgp_peer == NULL) {
116 tun_nh_key->rewrite_dmac(),
135 const int prefix_len, uint32_t vxlan_id,
const std::string vrf_name,
178 req.
data.reset(loc_rt_ptr);
185 const int prefix_len, uint32_t vxlan_id,
const std::string vrf_name,
189 const bool comp_nh_policy =
true;
192 comp_nh_policy, comp_nh_list, vrf_name);
194 nh_req.
key.reset(new_comp_nh_key);
196 const BgpPeer *bgp_peer_ecmp =
dynamic_cast<const BgpPeer*
>(bgp_peer);
197 std::stringstream prefix_str;
198 prefix_str << prefix_ip.to_string();
200 prefix_str << prefix_len;
232 const int prefix_len, uint32_t vxlan_id,
const std::string vrf_name,
234 const std::vector<std::string> &peer_sources
236 const NextHop *first_intf_nh =
nullptr;
240 for (
auto &nexthop_addr : peer_sources) {
242 boost::system::error_code ec;
245 nh_ip = Ip4Address::from_string(
ipv4_prefix(nexthop_addr), ec);
248 nh_ip = Ip6Address::from_string(
ipv6_prefix(nexthop_addr), ec);
251 LOG(ERROR,
"Error in VxlanRoutingManager::AddInterfaceComponentToList"
252 <<
", nexthop_addr = " << nexthop_addr
253 <<
" is not an IPv4 or IPv6 prefix");
260 nh_ip, nh_ip_len, 0);
263 if (loc_path ==
nullptr) {
266 if (loc_path->
nexthop() ==
nullptr) {
270 if (first_intf_nh == NULL) {
271 first_intf_nh = loc_path->
nexthop();
275 nh_key =
static_cast<NextHopKey *
>(key.release());
277 std::unique_ptr<const NextHopKey> nh_key_ptr(nh_key);
280 new_comp_nh_list.push_back(component_nh_key);
285 for (
auto &component : components) {
286 if (component.get() &&
289 if (first_intf_nh ==
nullptr) {
290 first_intf_nh = component->nh();
294 nh_key =
static_cast<NextHopKey *
>(key.release());
296 std::unique_ptr<const NextHopKey> nh_key_ptr(nh_key);
299 new_comp_nh_list.push_back(component_nh_key);
305 if (new_comp_nh_list.size() < 1) {
307 }
else if (new_comp_nh_list.size() == 1) {
309 vxlan_id, vrf_name, params, bgp_peer, first_intf_nh);
312 vxlan_id, vrf_name, params, bgp_peer, new_comp_nh_list);
319 const int prefix_len, uint32_t vxlan_id,
const std::string vrf_name,
321 const std::vector<std::string> &peer_sources ) {
323 prefix_ip, prefix_len, 0);
326 vrf_name, params, bgp_peer, peer_sources);
334 vrf_name, params, bgp_peer, peer_sources);
356 const int prefix_len,
const std::string vrf_name,
364 std::string origin_vn =
"";
366 nh_req.
key.reset(tun_nh_key);
386 const int prefix_len,
const std::string vrf_name,
405 template<
class RouteTable,
class RouteEntry>
408 if (table == NULL || agent == NULL || route == NULL) {
415 for (Route::PathList::const_iterator it =
416 route->GetPathList().begin();
417 it != route->GetPathList().end(); it++) {
419 static_cast<const AgentPath *
>(it.operator->());
420 if (tm_path == NULL || tm_path->
peer() == NULL) {
428 }
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)
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 ¶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)
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 ¶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)
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 ¶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)