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);
boost::asio::ip::address IpAddress
boost::asio::ip::address_v4 Ip4Address
std::vector< int > TagList
std::vector< int > SecurityGroupList
std::set< std::string > VnListType
class boost::shared_ptr< AgentSandesh > AgentSandeshPtr
std::vector< std::string > CommunityList
uint32_t GetActiveLabel() const
void SetSandeshData(PathSandeshData &data) const
const Peer * peer() const
This class defines interfaces for manipulating the prefix of a route stored in an Agent VRF table.
virtual const IpAddress & prefix_address() const
Returns the value of a stored prefix address (IPv4, IPv6 or MAC address)
IpAddress prefix_address_
The prefix address.
Agent supports multiple route tables - Inet-unicast (IPv4/IPv6), Inet-multicast, bridge,...
void Process(DBRequest &req)
VrfEntry * vrf_entry() const
Base class for all Route entries in agent.
void SetVrf(VrfEntry *vrf)
const AgentPath * GetActivePath() const
bool is_multicast() const
VrfTable * vrf_table() const
EvpnAgentRouteTable * fabric_evpn_table() const
static Agent * GetInstance()
void DeleteBridgeRoute(const AgentRoute *rt)
void AddBridgeRoute(const AgentRoute *rt)
std::unique_ptr< DBRequestKey > KeyPtr
DBTableBase * get_table() const
bool Enqueue(DBRequest *req)
void AddLocalVmRouteReq(const Peer *peer, const std::string &vrf_name, const MacAddress &mac, const IpAddress &ip_addr, uint32_t ethernet_tag, LocalVmRoute *data)
void AddOvsPeerMulticastRoute(const Peer *peer, uint32_t vxlan_id, const std::string &vn_name, Ip4Address vtep, Ip4Address tor_ip, bool ha_stale)
virtual AgentSandeshPtr GetAgentSandesh(const AgentSandeshArguments *args, const std::string &context)
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)
static DBTableBase * CreateTable(DB *db, const std::string &name)
void DeleteOvsPeerMulticastRoute(const Peer *peer, uint32_t vxlan_id, const 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)
EvpnRouteEntry * FindRoute(const MacAddress &mac, const IpAddress &ip_addr, uint32_t plen, uint32_t ethernet_tag)
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)
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 DeleteOvsPeerMulticastRouteReq(const Peer *peer, uint32_t vxlan_id, const Ip4Address &tor_ip)
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)
void AddOvsPeerMulticastRouteInternal(const Peer *peer, uint32_t vxlan_id, const std::string &vn_name, Ip4Address vtep, Ip4Address tor_ip, bool enqueue, 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 AddType5Route(const Peer *peer, const std::string &vrf_name, const IpAddress &ip_addr, uint32_t ethernet_tag, EvpnRoutingData *data, uint8_t plen=0)
EvpnRouteEntry * FindRouteNoLock(const MacAddress &mac, const IpAddress &ip_addr, uint32_t plen, uint32_t ethernet_tag)
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)
void DelLocalVmRoute(const Peer *peer, const std::string &vrf_name, const MacAddress &mac, const VmInterface *intf, const IpAddress &ip, uint32_t ethernet_tag)
static uint32_t ComputeHostIpPlen(const IpAddress &addr)
void AddOvsPeerMulticastRouteReq(const Peer *peer, uint32_t vxlan_id, const std::string &vn_name, Ip4Address vtep, Ip4Address tor_ip)
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)
void DeleteOvsPeerMulticastRouteInternal(const Peer *peer, uint32_t vxlan_id, const Ip4Address &tor_ip, bool enqueue)
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)
static void ResyncVmRoute(const Peer *peer, const string &vrf_name, const MacAddress &mac, const IpAddress &ip_addr, uint32_t ethernet_tag, AgentRouteData *data)
bool publish_to_inet_route_table_
virtual void UpdateDerivedRoutes(AgentRouteTable *table, const AgentPath *path, bool active_path_changed)
uint8_t prefix_length() const
!
virtual int CompareTo(const Route &rhs) const
virtual void DeleteDerivedRoutes(AgentRouteTable *table)
bool publish_to_bridge_route_table_
EvpnRouteEntry(VrfEntry *vrf, const MacAddress &mac, const IpAddress &ip_addr, uint8_t plen, uint32_t ethernet_tag, bool is_multicast)
virtual KeyPtr GetDBRequestKey() const
virtual bool ReComputePathDeletion(AgentPath *path)
virtual void SetKey(const DBRequestKey *key)
bool publish_to_inet_route_table() const
const AgentPath * FindOvsPath() const
virtual std::string ToString() const
virtual bool DBEntrySandesh(Sandesh *sresp, bool stale) const
bool publish_to_bridge_route_table() const
virtual uint32_t GetActiveLabel() const
virtual AgentRoute * AllocRouteEntry(VrfEntry *vrf, bool is_multicast) const
const IpAddress & ip_addr() const
uint32_t ethernet_tag() const
const MacAddress & GetMac() const
virtual std::string ToString() const
virtual EvpnRouteKey * Clone() const
void DeleteEvpnType5Route(Agent *agent, const AgentRoute *rt) const
void DeleteEvpnRoute(const AgentRoute *rt)
void AddEvpnRoute(const AgentRoute *evpn_entry)
const boost::uuids::uuid & GetUuid() const
void set_tunnel_bmap(TunnelType::TypeBmap bmap)
std::string ToString() const
int CompareTo(const MacAddress &rhs, int len=0) const
static const MacAddress & BroadcastMac()
const Type GetType() const
uint64_t sequence_number() const
const PathList & GetPathList() const
static TypeBmap VxlanType()
static TypeBmap AllType()
const string & GetName() const
AgentRouteTable * GetBridgeRouteTable() const
InetUnicastAgentRouteTable * GetInetUnicastRouteTable(const IpAddress &addr) const
AgentRouteTable * GetEvpnRouteTable() const
VrfEntry * FindVrfFromName(const string &name)
AgentRouteTable * GetEvpnRouteTable(const std::string &vrf_name)
VrfEntry * FindVrfFromId(size_t index)
const std::string & vrf_name() const
std::unique_ptr< DBRequestKey > key
std::unique_ptr< DBRequestData > data
static void EvpnTableEnqueue(Agent *agent, DBRequest *req)
static void EvpnTableProcess(Agent *agent, const string &vrf_name, DBRequest &req)