5 #include <boost/uuid/uuid_io.hpp>
24 using namespace boost::asio;
49 std::stringstream str;
52 str << dmac_.ToString();
54 str << ip_addr_.to_string();
59 return new EvpnRouteKey(peer(), vrf_name_, dmac_, ip_addr_,
60 plen_, ethernet_tag_);
67 ethernet_tag_, is_multicast);
75 const std::string &name) {
84 uint32_t ethernet_tag) {
85 EvpnRouteKey key(NULL, vrf_name(), mac, ip_addr, plen, ethernet_tag);
94 uint32_t ethernet_tag) {
95 EvpnRouteKey key(NULL, vrf_name(), mac, ip_addr, plen, ethernet_tag);
102 const string &vrf_name,
106 uint32_t ethernet_tag) {
113 return table->
FindRoute(mac, ip_addr, plen, ethernet_tag);
121 const std::string &vn_name,
153 const std::string &vn_name,
157 AddOvsPeerMulticastRouteInternal(peer, vxlan_id, vn_name, tsn, tor_ip,
163 const std::string &vn_name,
166 AddOvsPeerMulticastRouteInternal(peer, vxlan_id, vn_name, tsn, tor_ip,
true,
171 const string &vrf_name,
175 uint32_t ethernet_tag,
176 const string &vn_name,
178 uint64_t sequence_number) {
180 assert(bgp_peer != NULL);
193 const string &vrf_name,
197 uint32_t ethernet_tag,
198 const string &vn_name,
210 const string &vrf_name,
214 uint32_t ethernet_tag,
215 const string &vn_name,
227 const string &vrf_name,
230 uint32_t ethernet_tag,
235 req.key.reset(
new EvpnRouteKey(peer, vrf_name, mac, ip_addr,
239 req.data.reset(data);
244 const string &vrf_name,
249 const string &vn_name,
253 uint32_t ethernet_tag,
255 const std::string &name) {
261 vn_list.insert(vn_name);
266 sg_id_list, tag_id_list,
279 req.
data.reset(data);
284 const string &vrf_name,
289 const string &vn_name,
293 uint32_t ethernet_tag,
300 vn_list.insert(vn_name);
305 sg_id_list, tag_id_list,
318 req.data.reset(data);
334 req.
data.reset(NULL);
345 DeleteOvsPeerMulticastRouteInternal(peer, vxlan_id, tor_ip,
true);
351 DeleteOvsPeerMulticastRouteInternal(peer, vxlan_id, tor_ip,
false);
355 const string &vrf_name,
359 uint32_t ethernet_tag) {
366 req.
data.reset(NULL);
371 const string &vrf_name,
374 uint32_t ethernet_tag,
382 req.
data.reset(data);
388 const string &vrf_name,
392 uint32_t ethernet_tag,
396 plen, ethernet_tag));
397 req.
data.reset(data);
403 const string &vrf_name,
407 uint32_t ethernet_tag,
411 plen, ethernet_tag));
412 req.
data.reset(data);
418 const string &vrf_name,
420 uint32_t ethernet_tag,
423 if ( !plen && !ip_addr.is_unspecified()) {
432 req.
data.reset(data);
441 uint32_t ethernet_tag,
445 plen, ethernet_tag));
446 req.
data.reset(data);
453 uint32_t ethernet_tag) {
458 req.
data.reset(NULL);
463 const string &vrf_name,
466 uint32_t ethernet_tag,
472 req.
data.reset(data);
493 uint32_t ethernet_tag,
497 ethernet_tag_(ethernet_tag),
498 publish_to_inet_route_table_(true),
499 publish_to_bridge_route_table_(true) {
507 std::stringstream str;
571 for(Route::PathList::const_iterator it =
GetPathList().begin();
590 bool active_path_changed) {
594 if ((path != NULL) && !active_path_changed)
631 void EvpnRouteReq::HandleRequest()
const {
635 ErrorResp *resp =
new ErrorResp();
636 resp->set_context(context());
643 sand->DoSandesh(sand);
653 EvpnRouteResp *resp =
static_cast<EvpnRouteResp *
>(sresp);
654 RouteEvpnSandeshData data;
658 for (Route::PathList::const_iterator it =
GetPathList().begin();
662 PathSandeshData pdata;
664 data.path_list.push_back(pdata);
667 std::vector<RouteEvpnSandeshData> &list =
668 const_cast<std::vector<RouteEvpnSandeshData>&
>(resp->get_route_list());
669 list.push_back(data);
void AddType5Route(const Peer *peer, const std::string &vrf_name, const IpAddress &ip_addr, uint32_t ethernet_tag, EvpnRoutingData *data, uint8_t plen=0)
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)
bool publish_to_bridge_route_table_
void DeleteOvsPeerMulticastRouteInternal(const Peer *peer, uint32_t vxlan_id, const Ip4Address &tor_ip, bool enqueue)
static Agent * GetInstance()
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)
void DeleteBridgeRoute(const AgentRoute *rt)
AgentRouteTable * GetEvpnRouteTable() const
const boost::uuids::uuid & GetUuid() const
VrfEntry * FindVrfFromName(const string &name)
bool publish_to_inet_route_table_
DBTableBase * get_table() const
virtual void DeleteDerivedRoutes(AgentRouteTable *table)
AgentRouteTable * GetEvpnRouteTable(const std::string &vrf_name)
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.
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
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
bool is_multicast() const
std::unique_ptr< DBRequestData > data
uint32_t ethernet_tag() const
virtual uint32_t GetActiveLabel() const
bool Enqueue(DBRequest *req)
virtual bool DBEntrySandesh(Sandesh *sresp, bool stale) const
const string & GetName() const
virtual std::string ToString() const
std::unique_ptr< DBRequestKey > KeyPtr
Base class for all Route entries in agent.
void DeleteEvpnRoute(const AgentRoute *rt)
std::string ToString() const
void AddEvpnRoute(const AgentRoute *evpn_entry)
void AddBridgeRoute(const AgentRoute *rt)
const AgentPath * FindOvsPath() const
const Type GetType() const
const AgentPath * GetActivePath() const
bool publish_to_bridge_route_table() const
VrfEntry * vrf_entry() const
IpAddress prefix_address_
The prefix address.
EvpnRouteEntry * FindRouteNoLock(const MacAddress &mac, const IpAddress &ip_addr, uint32_t plen, uint32_t ethernet_tag)
void SetVrf(VrfEntry *vrf)
VrfEntry * FindVrfFromId(size_t index)
void AddOvsPeerMulticastRouteInternal(const Peer *peer, uint32_t vxlan_id, const std::string &vn_name, Ip4Address vtep, Ip4Address tor_ip, bool enqueue, bool ha_stale)
InetUnicastAgentRouteTable * GetInetUnicastRouteTable(const IpAddress &addr) const
int CompareTo(const MacAddress &rhs, int len=0) const
virtual bool ReComputePathDeletion(AgentPath *path)
std::unique_ptr< DBRequestKey > key
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()
const Peer * peer() const
virtual KeyPtr GetDBRequestKey() const
uint64_t sequence_number() const
AgentRouteTable * GetBridgeRouteTable() const
const MacAddress & GetMac() const
static const MacAddress & BroadcastMac()
class boost::shared_ptr< AgentSandesh > AgentSandeshPtr
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
void SetSandeshData(PathSandeshData &data) const
std::set< std::string > VnListType
virtual const IpAddress & prefix_address() const
Returns the value of a stored prefix address (IPv4, IPv6 or MAC address)
boost::asio::ip::address_v4 Ip4Address
uint32_t GetActiveLabel() const
VrfTable * vrf_table() const
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
static uint32_t ComputeHostIpPlen(const IpAddress &addr)
const std::string & vrf_name() const
void Process(DBRequest &req)
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
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()
bool publish_to_inet_route_table() const
void set_tunnel_bmap(TunnelType::TypeBmap bmap)
This class defines interfaces for manipulating the prefix of a route stored in an Agent VRF table...
const PathList & GetPathList() const
std::vector< int > TagList
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)