OpenSDN source code
|
#include <boost/intrusive_ptr.hpp>
#include <boost/array.hpp>
#include <cmn/agent_cmn.h>
#include <cmn/agent.h>
#include <sandesh/sandesh_trace.h>
Go to the source code of this file.
Classes | |
struct | RouteWalkerDBState |
class | AgentRouteWalker |
class | AgentRouteWalkerManager |
Macros | |
#define | AGENT_DBWALK_TRACE_BUF "AgentDBwalkTrace" |
#define | AGENT_DBWALK_TRACE(obj,...) |
Typedefs | |
typedef boost::intrusive_ptr < AgentRouteWalker > | AgentRouteWalkerPtr |
Functions | |
void | intrusive_ptr_add_ref (AgentRouteWalker *w) |
void | intrusive_ptr_release (AgentRouteWalker *w) |
Variables | |
SandeshTraceBufferPtr | AgentDBwalkTraceBuf |
#define AGENT_DBWALK_TRACE | ( | obj, | |
... | |||
) |
Definition at line 72 of file agent_route_walker.h.
#define AGENT_DBWALK_TRACE_BUF "AgentDBwalkTrace" |
The infrastructure is to support and manage VRF walks along with corresponding route walks. Following type of walks can be issued: 1) ALL VRF walk - Use API StartVrfWalk() 2) Specific VRF walk - Use StartRouteWalk(vrf_entry) API 3) Specialized walk - Issue StartVrfWalk() and override VrfWalkNotify() to select a set of VRF to walk on. By default VrfWalkNotify starts walks on all route table. RouteWalkNotify() - This should be overriden to listen and act on route entry notifications. By default it ignores the request. 4) Only VRF walk - Use API StartVRFWalk and override VrfWalkNotify() to not start route table walk. In this way only VRF entries can be traversed without route walks issued.
Multiple objects of this class can have separate parallel walks. There is no more walk cancellations to start a new walk. Same walk reference can be used to restart walks with different context. Each AgentRouteWalker instance will have its own walker reference on vrf table. Walk on this table will result in more walk references created for route tables. These references are stored in DB State keyed with Vrf walk reference.
How to use the walker?
Either walker can be derived or directly instantiated. Then the object needs to be registered with agent route walker manager. Once the scope of walker is over release of this walker should be done via agent routewalk manager.
Walk References in walker: Walker maintain two kind of references. First is the walk reference to walk VRF table. This is part of walker itself. Second is a set of references which is used to walk route tables. These references are stored in state created on each vrf entry. State is keyed with walker pointer and has an array of walk references. Route walk references are stored in state because for each vrf there can be different references and (vrf+walker) is the key to identify them.
Manager keeps a track of all walkers under a instrusive pointer list. It has also maintained a listener on agent's vrf table. There is a state maintained on each VRF which contains a map of walker to route table walker references. DB state is created by agent route walk manager and is unique for a vrf entry. Each instance of AgentRouteWalker will insert its vrf_walk_ref in this state and maintain route table references with walk tracker in same.
On receiving vrf delete manager can refer to state and invoke release of all walk references.
Definition at line 69 of file agent_route_walker.h.
typedef boost::intrusive_ptr<AgentRouteWalker> AgentRouteWalkerPtr |
Definition at line 80 of file agent_route_walker.h.
void intrusive_ptr_add_ref | ( | AgentRouteWalker * | w | ) |
Definition at line 463 of file agent_route_walker.cc.
void intrusive_ptr_release | ( | AgentRouteWalker * | w | ) |
Definition at line 467 of file agent_route_walker.cc.
SandeshTraceBufferPtr AgentDBwalkTraceBuf |