5 #ifndef vnsw_agent_route_hpp
6 #define vnsw_agent_route_hpp
9 #include <sys/socket.h>
10 #include <net/ethernet.h>
19 #include <agent_types.h>
26 #include <oper/agent_types.h>
28 #include <sandesh/sandesh_trace.h>
43 bool is_multicast)
const = 0;
131 const std::string &context) {
160 const std::string &
vrf_name()
const;
212 #define OPER_TRACE_ROUTE(obj, ...)\
214 Oper##obj::TraceMsg(GetOperDBTraceBuf(), __FILE__, __LINE__, __VA_ARGS__);\
217 #define OPER_TRACE_ROUTE_ENTRY(obj, table, ...)\
219 Oper##obj::TraceMsg(table->GetOperDBTraceBuf(),\
220 __FILE__, __LINE__, __VA_ARGS__);\
253 virtual std::string
ToString()
const = 0;
269 bool active_path_changed) {
283 for (
const auto &vn_nm : dest_vn_list) {
284 if (vn_nm ==
"unresolved") {
345 bool del, uint32_t *evpn_label);
376 template <
class PrefixType>
412 #define GETPEERNAME(peer) (peer)? peer->GetName() : ""
413 #define AGENT_ROUTE_LOG(table, msg, route, vrf, peer_info)\
415 AgentRouteLog::TraceMsg(table->GetOperDBTraceBuf(), __FILE__, __LINE__,\
416 msg, route, vrf, peer_info);\
std::set< std::string > VnListType
class boost::shared_ptr< AgentSandesh > AgentSandeshPtr
This class defines interfaces for manipulating the prefix of a route stored in an Agent VRF table.
AgentRoutePrefix()
Forbid default ctor.
virtual const PrefixType & prefix_address() const
Returns the value of a stored prefix address (IPv4, IPv6 or MAC address)
uint8_t prefix_length_
The prefix length.
PrefixType prefix_address_
The prefix address.
DISALLOW_COPY_AND_ASSIGN(AgentRoutePrefix)
~AgentRoutePrefix()
The destructor of a route prefix.
AgentRoutePrefix(const PrefixType &new_prefix, uint8_t new_plen)
Creates a new route prefix.
void set_prefix_length(uint8_t new_plen)
Sets the length of a stored prefix address.
Agent supports multiple route tables - Inet-unicast (IPv4/IPv6), Inet-multicast, bridge,...
int unresolved_route_size() const
void RemoveUnresolvedNH(const NextHop *)
UnresolvedNHTree::const_iterator unresolved_nh_end() const
virtual int PartitionCount() const
bool DelExplicitRouteWalkerCb(DBTablePartBase *part, DBEntryBase *entry)
UnresolvedRouteTree unresolved_rt_tree_
static bool PathSelection(const Path &path1, const Path &path2)
virtual void ProcessAdd(AgentRoute *rt)
const std::string & vrf_name() const
DISALLOW_COPY_AND_ASSIGN(AgentRouteTable)
void Process(DBRequest &req)
void SetVrf(VrfEntry *vrf)
static const int kPartitionCount
AgentRoute * LocateRoute(DBTablePartition *part, VrfEntry *vrf, AgentRoute *rt, AgentRouteKey *key, AgentRouteData *data, bool *notify)
virtual Agent::RouteTableType GetTableType() const =0
UnresolvedRouteTree::const_iterator unresolved_route_end() const
SandeshTraceBufferPtr OperDBTraceBuf
virtual void RetryDelete()
virtual void ProcessDelete(AgentRoute *rt)
LifetimeActor * deleter()
void DeleteRouteDone(DBTable::DBTableWalkRef walk_ref, DBTableBase *base, RouteTableWalkerState *state)
std::set< const NextHop *, NHComparator > UnresolvedNHTree
virtual SandeshTraceBufferPtr GetOperDBTraceBuf() const
virtual std::unique_ptr< DBEntry > AllocEntry(const DBRequestKey *k) const
void AddUnresolvedRoute(const AgentRoute *rt)
void EvaluateUnresolvedRoutes(void)
boost::scoped_ptr< DeleteActor > deleter_
LifetimeRef< AgentRouteTable > vrf_delete_ref_
virtual std::string GetTableName() const =0
VrfEntry * vrf_entry() const
AgentRoute * FindActiveEntryNoLock(const AgentRouteKey *key)
void Input(DBTablePartition *part, DBClient *client, DBRequest *req)
virtual size_t Hash(const DBEntry *entry) const
UnresolvedNHTree unresolved_nh_tree_
virtual void NotifyEntry(AgentRoute *entry)
AgentRouteTable(DB *db, const std::string &name)
void EvaluateUnresolvedNH(void)
virtual ~AgentRouteTable()
static const std::string & GetSuffix(Agent::RouteTableType type)
UnresolvedRouteTree::const_iterator unresolved_route_begin() const
UnresolvedNHTree::const_iterator unresolved_nh_begin() const
void RemoveUnresolvedRoute(const AgentRoute *rt)
virtual size_t Hash(const DBRequestKey *key) const
AgentRoute * FindActiveEntry(const AgentRouteKey *key)
virtual AgentSandeshPtr GetAgentSandesh(const AgentSandeshArguments *args, const std::string &context)
void AddChangeInput(DBTablePartition *part, VrfEntry *vrf, AgentRoute *rt, AgentRouteKey *key, AgentRouteData *data)
void AddUnresolvedNH(const NextHop *)
std::set< const AgentRoute *, RouteComparator > UnresolvedRouteTree
Base class for all Route entries in agent.
virtual int CompareTo(const Route &rhs) const =0
AgentPath * GetLocalVmPortPath() const
const std::string & origin_vn_name() const
virtual void DeleteDerivedRoutes(AgentRouteTable *table)
const AgentPath * FindIntfOrCompLocalVmPortPath() const
Finds path to an interface or a composite of interfaces and returns it. The priority is given to comp...
virtual const std::string GetSourceAddressString() const =0
virtual bool ReComputeMulticastPaths(AgentPath *path, bool del)
virtual AgentPath * FindPathUsingKeyData(const AgentRouteKey *key, const AgentRouteData *data) const
virtual void UpdateDerivedRoutes(AgentRouteTable *table, const AgentPath *path, bool active_path_changed)
bool IsRPFInvalid() const
bool ProcessPath(Agent *agent, DBTablePartition *part, AgentPath *path, AgentRouteData *data)
void AddUnresolvedRouteToTable(AgentRouteTable *table)
DEPENDENCY_LIST(NextHop, AgentRoute, tunnel_nh_list_)
std::string intf_route_type_
AgentPath * FindLocalPath() const
void FillTrace(RouteInfo &route, Trace event, const AgentPath *path) const
void ResyncTunnelNextHop()
bool IsTunnelNHListEmpty()
void SetVrf(VrfEntry *vrf)
virtual bool IsLess(const DBEntry &rhs) const
void InsertPath(const AgentPath *path)
const AgentPath * GetActivePath() const
bool IsDependantRouteEmpty()
virtual void HandleDeviceMastershipUpdate(AgentPath *path, bool del)
virtual void HandleMulticastLabel(const Agent *agent, AgentPath *path, const AgentPath *local_peer_path, const AgentPath *local_vm_peer_path, bool del, uint32_t *evpn_label)
DISALLOW_COPY_AND_ASSIGN(AgentRoute)
const NextHop * GetActiveNextHop() const
virtual const std::string GetAddressString() const =0
virtual uint32_t GetActiveLabel() const
bool WaitForTraffic() const
DependencyList< NextHop, AgentRoute > TunnelNhDependencyList
void DeleteInput(DBTablePartition *part, AgentRouteTable *table, AgentRouteKey *key, AgentRouteData *data)
bool DeleteAllBgpPath(DBTablePartBase *part, AgentRouteTable *table)
bool SubOpResyncInput(VrfEntry *vrf, AgentRouteTable *table, AgentPath **path_ptr, AgentRouteKey *key, AgentRouteData *data)
virtual bool DBEntrySandesh(Sandesh *sresp, bool stale) const =0
void UpdateDependantRoutes()
DependencyList< AgentRoute, AgentRoute > RouteDependencyList
const AgentRouteTable * GetDependentRouteTable(void) const
AgentRouteTable * dependent_route_table_
virtual void SetKey(const DBRequestKey *key)=0
virtual bool ReComputePathAdd(AgentPath *path)
virtual uint8_t prefix_length() const
Returns the length of a stored prefix address.
virtual std::string ToString() const =0
virtual KeyPtr GetDBRequestKey() const =0
void RemovePath(AgentPath *path)
void DeletePathFromPeer(DBTablePartBase *part, AgentRouteTable *table, AgentPath *path)
virtual Composite::Type GetMulticastCompType()
bool is_multicast() const
virtual AgentPath * FindPath(const Peer *peer) const
std::string origin_vn_name_
const std::string & intf_route_type() const
void set_intf_route_type(const std::string &intf_route_type)
void EnqueueRouteResync() const
AgentRoute(VrfEntry *vrf, bool is_multicast, const std::string &intf_route_type="interface")
void set_origin_vn_name(const VnListType &dest_vn_list)
virtual Agent::RouteTableType GetTableType() const =0
void RemoveUnresolvedRouteFromTable(AgentRouteTable *table)
bool SubOpAddChangeInput(VrfEntry *vrf, AgentRouteTable *table, AgentPath **path_ptr, AgentRouteKey *key, AgentRouteData *data, bool route_added)
virtual bool ValidateMcastSrc() const
virtual bool RecomputeRoutePath(Agent *agent, DBTablePartition *part, AgentPath *path, AgentRouteData *data)
DEPENDENCY_LIST(AgentRoute, AgentRoute, dependant_routes_)
AgentPath * FindLocalVmPortPath() const
virtual bool ReComputePathDeletion(AgentPath *path)
const std::string & dest_vn_name() const
static const std::string & NullString()
std::unique_ptr< DBRequestKey > KeyPtr
const std::string & name() const
boost::intrusive_ptr< DBTableWalk > DBTableWalkRef
void Reset(LifetimeActor *actor)
boost::intrusive_ptr< const Peer > PeerConstPtr
boost::shared_ptr< TraceBuffer< SandeshTrace > > SandeshTraceBufferPtr
virtual bool UpdateRoute(AgentRoute *rt)
uint64_t sequence_number() const
virtual bool AddChangePathExtended(Agent *agent, AgentPath *path, const AgentRoute *rt)=0
virtual bool CanDeletePath(Agent *agent, AgentPath *path, const AgentRoute *rt) const
virtual std::string ToString() const =0
virtual AgentPath * CreateAgentPath(const Peer *peer, AgentRoute *rt) const
uint64_t sequence_number_
@ ROUTE_PREFERENCE_CHANGE
bool AddChangePath(Agent *agent, AgentPath *path, const AgentRoute *rt)
DISALLOW_COPY_AND_ASSIGN(AgentRouteData)
AgentRouteData(Type type, bool is_multicast, uint64_t sequence_number)
virtual ~AgentRouteData()
bool is_multicast() const
const Peer * peer() const
void set_peer(const Peer *peer)
virtual Agent::RouteTableType GetRouteTableType()=0
virtual AgentRoute * AllocRouteEntry(VrfEntry *vrf, bool is_multicast) const =0
const std::string & vrf_name() const
virtual AgentRouteKey * Clone() const =0
virtual std::string ToString() const =0
DISALLOW_COPY_AND_ASSIGN(AgentRouteKey)
AgentRouteKey(const Peer *peer, const std::string &vrf_name)
bool operator()(const NextHop *nh1, const NextHop *nh2) const
bool operator()(const AgentRoute *rt1, const AgentRoute *rt2) const
LifetimeRef< RouteTableWalkerState > rt_delete_ref_
RouteTableWalkerState(LifetimeActor *actor)