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>
41 virtual std::string
ToString()
const = 0;
43 bool is_multicast)
const = 0;
66 virtual std::string
ToString()
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) {
332 bool del, uint32_t *evpn_label);
362 template <
class PrefixType>
398 #define GETPEERNAME(peer) (peer)? peer->GetName() : ""
399 #define AGENT_ROUTE_LOG(table, msg, route, vrf, peer_info)\
401 AgentRouteLog::TraceMsg(table->GetOperDBTraceBuf(), __FILE__, __LINE__,\
402 msg, route, vrf, peer_info);\
uint64_t sequence_number() const
uint64_t sequence_number_
AgentPath * FindLocalVmPortPath() const
SandeshTraceBufferPtr OperDBTraceBuf
static const std::string & GetSuffix(Agent::RouteTableType type)
DISALLOW_COPY_AND_ASSIGN(AgentRoute)
void ResyncTunnelNextHop()
DISALLOW_COPY_AND_ASSIGN(AgentRoutePrefix)
virtual bool ReComputePathDeletion(AgentPath *path)
~AgentRoutePrefix()
The destructor of a route prefix.
void EnqueueRouteResync() const
bool is_multicast() const
AgentRouteTable * dependent_route_table_
virtual bool UpdateRoute(AgentRoute *rt)
virtual uint8_t prefix_length() const
Returns the length of a stored prefix address.
const std::string & vrf_name() const
bool IsTunnelNHListEmpty()
virtual bool CanDeletePath(Agent *agent, AgentPath *path, const AgentRoute *rt) const
void AddUnresolvedRouteToTable(AgentRouteTable *table)
std::set< const AgentRoute *, RouteComparator > UnresolvedRouteTree
virtual std::unique_ptr< DBEntry > AllocEntry(const DBRequestKey *k) const
virtual const std::string GetAddressString() const =0
std::set< const NextHop *, NHComparator > UnresolvedNHTree
void set_intf_route_type(const std::string &intf_route_type)
UnresolvedNHTree::const_iterator unresolved_nh_end() const
bool WaitForTraffic() const
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 int CompareTo(const Route &rhs) const =0
AgentRoute * LocateRoute(DBTablePartition *part, VrfEntry *vrf, AgentRoute *rt, AgentRouteKey *key, AgentRouteData *data, bool *notify)
virtual ~AgentRouteTable()
const std::string & intf_route_type() const
UnresolvedRouteTree::const_iterator unresolved_route_end() const
bool SubOpAddChangeInput(VrfEntry *vrf, AgentRouteTable *table, AgentPath **path_ptr, AgentRouteKey *key, AgentRouteData *data, bool route_added)
virtual void RetryDelete()
virtual std::string ToString() const =0
AgentRoute(VrfEntry *vrf, bool is_multicast, const std::string &intf_route_type="interface")
void EvaluateUnresolvedRoutes(void)
bool SubOpResyncInput(VrfEntry *vrf, AgentRouteTable *table, AgentPath **path_ptr, AgentRouteKey *key, AgentRouteData *data)
virtual bool AddChangePathExtended(Agent *agent, AgentPath *path, const AgentRoute *rt)=0
bool is_multicast() const
UnresolvedNHTree::const_iterator unresolved_nh_begin() const
AgentRoutePrefix(const PrefixType &new_prefix, uint8_t new_plen)
Creates a new route prefix.
void DeletePathFromPeer(DBTablePartBase *part, AgentRouteTable *table, AgentPath *path)
DISALLOW_COPY_AND_ASSIGN(AgentRouteTable)
virtual AgentPath * FindPathUsingKeyData(const AgentRouteKey *key, const AgentRouteData *data) const
DependencyList< AgentRoute, AgentRoute > RouteDependencyList
void set_prefix_length(uint8_t new_plen)
Sets the length of a stored prefix address.
virtual void SetKey(const DBRequestKey *key)=0
virtual uint32_t GetActiveLabel() const
virtual std::string GetTableName() const =0
uint8_t prefix_length_
The prefix length.
DependencyList< NextHop, AgentRoute > TunnelNhDependencyList
LifetimeActor * deleter()
const std::string & dest_vn_name() const
boost::shared_ptr< TraceBuffer< SandeshTrace > > SandeshTraceBufferPtr
std::unique_ptr< DBRequestKey > KeyPtr
Base class for all Route entries in agent.
virtual size_t Hash(const DBRequestKey *key) const
virtual KeyPtr GetDBRequestKey() const =0
virtual AgentRoute * AllocRouteEntry(VrfEntry *vrf, bool is_multicast) const =0
const AgentRouteTable * GetDependentRouteTable(void) const
virtual const std::string GetSourceAddressString() const =0
virtual bool DBEntrySandesh(Sandesh *sresp, bool stale) const =0
AgentRoute * FindActiveEntry(const AgentRouteKey *key)
LifetimeRef< AgentRouteTable > vrf_delete_ref_
const AgentPath * GetActivePath() const
virtual Agent::RouteTableType GetTableType() const =0
virtual int PartitionCount() const
VrfEntry * vrf_entry() const
PrefixType prefix_address_
The prefix address.
void FillTrace(RouteInfo &route, Trace event, const AgentPath *path) const
void SetVrf(VrfEntry *vrf)
virtual AgentPath * CreateAgentPath(const Peer *peer, AgentRoute *rt) const
AgentRouteData(Type type, bool is_multicast, uint64_t sequence_number)
boost::scoped_ptr< DeleteActor > deleter_
virtual void ProcessAdd(AgentRoute *rt)
AgentRoute * FindActiveEntryNoLock(const AgentRouteKey *key)
void Reset(LifetimeActor *actor)
AgentPath * FindLocalPath() const
const NextHop * GetActiveNextHop() const
std::string intf_route_type_
void Input(DBTablePartition *part, DBClient *client, DBRequest *req)
void RemovePath(AgentPath *path)
virtual Agent::RouteTableType GetRouteTableType()=0
virtual bool ReComputeMulticastPaths(AgentPath *path, bool del)
static bool PathSelection(const Path &path1, const Path &path2)
AgentRoutePrefix()
Forbid default ctor.
virtual void ProcessDelete(AgentRoute *rt)
void DeleteRouteDone(DBTable::DBTableWalkRef walk_ref, DBTableBase *base, RouteTableWalkerState *state)
bool AddChangePath(Agent *agent, AgentPath *path, const AgentRoute *rt)
class boost::shared_ptr< AgentSandesh > AgentSandeshPtr
void InsertPath(const AgentPath *path)
const std::string & name() const
static const int kPartitionCount
void RemoveUnresolvedRouteFromTable(AgentRouteTable *table)
virtual void DeleteDerivedRoutes(AgentRouteTable *table)
bool DelExplicitRouteWalkerCb(DBTablePartBase *part, DBEntryBase *entry)
virtual const PrefixType & prefix_address() const
Returns the value of a stored prefix address (IPv4, IPv6 or MAC address)
virtual std::string ToString() const =0
AgentRouteKey(const Peer *peer, const std::string &vrf_name)
const AgentPath * FindIntfOrCompLocalVmPortPath() const
Finds path to an interface or a composite of interfaces and returns it. The priority is given to comp...
DEPENDENCY_LIST(AgentRoute, AgentRoute, dependant_routes_)
AgentPath * GetLocalVmPortPath() const
virtual void NotifyEntry(AgentRoute *entry)
boost::intrusive_ptr< const Peer > PeerConstPtr
virtual AgentRouteKey * Clone() const =0
LifetimeRef< RouteTableWalkerState > rt_delete_ref_
virtual std::string ToString() const =0
virtual bool RecomputeRoutePath(Agent *agent, DBTablePartition *part, AgentPath *path, AgentRouteData *data)
UnresolvedRouteTree unresolved_rt_tree_
void RemoveUnresolvedRoute(const AgentRoute *rt)
void DeleteInput(DBTablePartition *part, AgentRouteTable *table, AgentRouteKey *key, AgentRouteData *data)
void RemoveUnresolvedNH(const NextHop *)
bool IsRPFInvalid() const
bool ProcessPath(Agent *agent, DBTablePartition *part, AgentPath *path, AgentRouteData *data)
virtual bool ReComputePathAdd(AgentPath *path)
void UpdateDependantRoutes()
int unresolved_route_size() const
const Peer * peer() const
virtual bool ValidateMcastSrc() const
virtual SandeshTraceBufferPtr GetOperDBTraceBuf() const
const std::string & vrf_name() const
RouteTableWalkerState(LifetimeActor *actor)
void Process(DBRequest &req)
DISALLOW_COPY_AND_ASSIGN(AgentRouteKey)
AgentRouteTable(DB *db, const std::string &name)
bool DeleteAllBgpPath(DBTablePartBase *part, AgentRouteTable *table)
void AddChangeInput(DBTablePartition *part, VrfEntry *vrf, AgentRoute *rt, AgentRouteKey *key, AgentRouteData *data)
UnresolvedRouteTree::const_iterator unresolved_route_begin() const
void EvaluateUnresolvedNH(void)
boost::intrusive_ptr< DBTableWalk > DBTableWalkRef
DISALLOW_COPY_AND_ASSIGN(AgentRouteData)
void AddUnresolvedNH(const NextHop *)
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)
virtual AgentPath * FindPath(const Peer *peer) const
bool IsDependantRouteEmpty()
void AddUnresolvedRoute(const AgentRoute *rt)
bool operator()(const NextHop *nh1, const NextHop *nh2) const
virtual Composite::Type GetMulticastCompType()
virtual void UpdateDerivedRoutes(AgentRouteTable *table, const AgentPath *path, bool active_path_changed)
bool operator()(const AgentRoute *rt1, const AgentRoute *rt2) const
virtual ~AgentRouteData()
UnresolvedNHTree unresolved_nh_tree_
virtual bool IsLess(const DBEntry &rhs) const
virtual size_t Hash(const DBEntry *entry) const
virtual Agent::RouteTableType GetTableType() const =0
void set_peer(const Peer *peer)
void SetVrf(VrfEntry *vrf)
This class defines interfaces for manipulating the prefix of a route stored in an Agent VRF table...
virtual AgentSandeshPtr GetAgentSandesh(const AgentSandeshArguments *args, const std::string &context)