1 #include <boost/uuid/uuid_io.hpp>
2 #include <boost/lexical_cast.hpp>
84 if (routing_vrf == NULL || routing_vrf == inet_rt->
vrf()) {
90 if (evpn_table == NULL) {
94 const AgentPath *local_vm_port_path = NULL;
97 if (local_vm_port_path == NULL) {
101 if (local_vm_port_path != NULL) {
103 local_vm_port_path, evpn_table);
110 if (local_vm_port_path == NULL) {
120 dest_vns.insert(routing_vrf->
vn()->
GetName());
151 if (evpn_rt->
IsType5() ==
false) {
167 if (local_vm_port_path) {
191 if (bgp_path == NULL) {
197 if (local_vm_port_path == NULL) {
218 if (inet_route == NULL) {
250 if (evpn_table == NULL) {
270 bool ok_to_delete = inet_rt->
IsDeleted() ||
293 if (routing_evpn_rt->
FindPath(agent_->evpn_routing_peer())) {
304 if (routing_inet_table == NULL) {
315 (routing_inet_table->
FindLPM(local_vm_route_key));
316 if (RoutePrefixIsEqualTo(inet_rt, routing_evpn_rt->
prefix_address(),
321 bool ok_to_delete = routing_evpn_rt->
IsDeleted() ||
322 inet_rt->FindPath(delete_from_peer);
365 const VnEntry *vn,
bool update) {
368 if (!evpn_rt || (evpn_rt->
vrf()->
vn() == NULL) || (!evpn_rt->
IsType5()))
370 if (uuid == boost::uuids::nil_uuid())
374 if (IsHostRouteFromLocalSubnet(evpn_rt)) {
379 vrf_mapper_.lr_vrf_info_map_[
uuid];
382 if (update && vn != NULL) {
383 update_bridge_vn_list.insert(vn);
384 it = update_bridge_vn_list.find(vn);
387 it = update_bridge_vn_list.begin();
389 while (it != update_bridge_vn_list.end()) {
390 VrfEntry *bridge_vrf = (*it)->GetVrf();
392 if (bridge_vrf == NULL) {
397 if (IsVrfLocalRoute(evpn_rt, bridge_vrf)) {
415 if (routing_vrf == NULL) {
425 agent_->evpn_routing_peer(),
uint8_t prefix_length() const
!
EvpnRouteEntry * FindRoute(const MacAddress &mac, const IpAddress &ip_addr, uint32_t plen, uint32_t ethernet_tag)
const VnListType & dest_vn_list() const
static bool IsHostRoute(const IpAddress &prefix_ip, uint32_t prefix_len)
Determines whether the prefix address and the prefix length point to a host route (/32 for IPv4...
const TagList & tag_list() const
const PathPreference & path_preference() const
InetUnicastRouteEntry * FindLPM(const IpAddress &ip)
AgentRouteTable * GetEvpnRouteTable() const
static bool IsBridgeVrf(const VrfEntry *vrf)
Determines whether the pointer to the VRF instance is of bridge type.
const AgentPath * FindBGPaaSPath(const InetUnicastRouteEntry *rt)
Finds in the given route the path that was announced using BGPaaS. It is expected that this path has ...
std::set< const VnEntry * > BridgeVnList
A typedef to store the list of bridge virtual networks connected to a LR.
void WhenBridgeInetIntfWasDeleted(const InetUnicastRouteEntry *inet_rt, const VrfEntry *routing_vrf)
Handles deletion of a route in the EVPN table of the routing VRF instance.
BridgeVnList bridge_vn_list_
The list of bridge virtual networks (VirtualNetwork) connected to a LR.
boost::asio::ip::address IpAddress
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)
std::unique_ptr< DBRequestData > data
bool WithdrawEvpnRouteFromRoutingVrf(const VrfEntry *routing_vrf, DBTablePartBase *partition, DBEntryBase *e)
Deletes a given EVPN route from EVPN table of the routing VRF instance.
void set_loc_sequence(uint32_t loc_sequence)
const VrfEntry * GetRoutingVrfUsingAgentRoute(const AgentRoute *rt)
Find the routing VRF instance using a given route (AgentRoute).
const string & GetName() const
A structure to hold path parameters during the transfer (routes leaking) of data between VRF instance...
const VrfEntry * routing_vrf_
A pointer to the routing VRF instance (L3 VRF) connected to a LR.
void AdvertiseBGPaaSRoute(const IpAddress &prefix_ip, uint32_t prefix_len, const AgentPath *path, EvpnAgentRouteTable *evpn_table)
Advertises BGPaaS interface path in the routing VRF instance by selecting corresponding path componen...
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 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...
const AgentPath * GetActivePath() const
NextHop * nexthop() const
VrfEntry * vrf_entry() const
static const AgentPath * FindPathWithGivenPeer(const AgentRoute *inet_rt, const Peer::Type peer_type)
Finds in the given route the path with a specified Peer type.
Agent * agent_
A pointer to the Agent instance.
void ClearRedundantVrfPath(DBEntryBase *e)
Removes redundant VrfNH path from a given route. These routes might arise with small chance in a brid...
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="")
static void Delete(const Peer *peer, const string &vrf_name, const IpAddress &addr, uint8_t plen)
static bool IsRoutingVrf(const VrfEntry *vrf)
Determines whether the pointer to the VRF instance is of routing type.
static uint32_t GetNewLocalSequence(const AgentPath *)
Auxilliary functions.
bool RouteNotify(DBTablePartBase *partition, DBEntryBase *e)
Handler for changes (new/update/delete) in a route (EVPN or Inet). Main entry point for routes leakin...
InetUnicastAgentRouteTable * GetInetUnicastRouteTable(const IpAddress &addr) const
std::unique_ptr< DBRequestKey > key
uint64_t sequence_number() const
static uint32_t loc_sequence_
An always increasing counter for new paths (used to signal controoler about new routes).
std::set< std::string > VnListType
bool EvpnRouteNotify(DBTablePartBase *partition, DBEntryBase *e)
Performs routes leaking between the EVPN table of the routing VRF instance and the Inet table of the ...
static void DeleteReq(const Peer *peer, const string &vrf_name, const IpAddress &addr, uint8_t plen, AgentRouteData *data)
virtual const PrefixType & prefix_address() const
Returns the value of a stored prefix address (IPv4, IPv6 or MAC address)
const AgentPath * FindIntfOrCompLocalVmPortPath() const
Finds path to an interface or a composite of interfaces and returns it. The priority is given to comp...
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...
const boost::uuids::uuid & logical_router_uuid() const
uint8_t prefix_length() const
!
uint32_t vxlan_id() const
VxlanRoutingVrfMapper vrf_mapper_
A map between LR uuids and associated bridge and routing VRF instances.
void WhenRoutingEvpnRouteWasDeleted(const EvpnRouteEntry *routing_evpn_rt, const Peer *delete_from_peer)
Handles deletion of a route in the Inet table of the routing VRF instance.
bool InetRouteNotify(DBTablePartBase *partition, DBEntryBase *e)
Routes leaking functions.
The structure holds information about virtual networks connected to a logical router (LR) ...
const string & GetName() const
BridgeVnList::iterator BridgeVnListIter
A type for iterator of the list of bridge virtual networks connected to a LR.
void DeleteIpamRoutes(const VnEntry *vn, const std::string &vrf_name, const IpAddress &ipam_prefix, const uint32_t plen)
Delete routes to IPAM, specified by IP prefix and prefix length.
static const Peer * routing_vrf_interface_peer_
Internal data of this class.
virtual AgentPath * FindPath(const Peer *peer) const
const CommunityList & communities() const
bool LeakRoutesIntoBridgeTables(DBTablePartBase *partition, DBEntryBase *e, const boost::uuids::uuid &uuid, const VnEntry *vn, bool update=false)
Performs advertisement and deletion of routing routes (with VrfNH) in bridge VRF instances. External tunnels and routes with a prefix that is not present in bridge VRF instance are selected for leaking.
static const Peer * routing_vrf_vxlan_bgp_peer_
A pointer to the Peer where all BGP routes are stored.
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.
const SecurityGroupList & sg_list() const
const EcmpLoadBalance & ecmp_load_balance() const
const Peer * evpn_routing_peer() const
const PathList & GetPathList() const