OpenSDN source code
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
EvpnManager Class Reference

This class represents the EVPN manager for an EvpnTable in a VRF. More...

#include <bgp_evpn.h>

Collaboration diagram for EvpnManager:

Classes

class  DeleteActor
 

Public Member Functions

 EvpnManager (EvpnTable *table)
 
virtual ~EvpnManager ()
 
virtual void Initialize ()
 Initialize the EvpnManager. We allocate the EvpnManagerPartitions and register a DBListener for the EvpnTable. More...
 
virtual void Terminate ()
 Terminate the EvpnManager. We free the EvpnManagerPartitions and unregister from the EvpnTable. More...
 
virtual UpdateInfoGetUpdateInfo (EvpnRoute *route)
 Construct export state for the given EvpnRoute. Note that the route only needs to be exported to the IPeer from which it was learnt. More...
 
EvpnManagerPartitionGetPartition (size_t part_id)
 Get the EvpnManagerPartition for the given partition id. More...
 
DBTablePartitionGetTablePartition (size_t part_id)
 Get the DBTablePartition for the EvpnTable for given partition id. More...
 
void FillShowInfo (ShowEvpnTable *sevt) const
 Fill information for introspect command. Note that all IM routes are always in partition 0. More...
 
BgpServerserver ()
 
EvpnTabletable ()
 
const EvpnTabletable () const
 
ErmVpnTableermvpn_table ()
 
const ErmVpnTableermvpn_table () const
 
int listener_id () const
 
int ermvpn_listener_id () const
 
EvpnSegmentLocateSegment (const EthernetSegmentId &esi)
 Find or create the EvpnSegment for the given EthernetSegmentId. More...
 
EvpnSegmentFindSegment (const EthernetSegmentId &esi)
 Find the EvpnSegment for the given EthernetSegmentId. More...
 
void TriggerSegmentDelete (EvpnSegment *segment)
 Trigger deletion of the given EvpnSegment. The EvpnSegment is added to a set of EvpnSegments that can potentially be deleted. This method can be invoked from multiple db::DBTable tasks in parallel when a MAC routes are removed from the dependency list in an EvpnSegment. Hence we ensure exclusive access using a write lock. More...
 
void TriggerSegmentUpdate (EvpnSegment *segment)
 Trigger update of the given EvpnSegment. The EvpnSegment is added to a set of EvpnSegments for which updates need triggered. This method is called in the context of db::DBTable task and a task instance of 0 since all AutoDisocvery routes always get sharded to partition 0. More...
 
void ManagedDelete ()
 Trigger deletion of the EvpnManager and propagate the delete to any dependents. More...
 
void Shutdown ()
 Initiate shutdown for the EvpnManager. More...
 
bool MayDelete () const
 Trigger deletion of the EvpnManager and propagate the delete to any dependents. More...
 
void RetryDelete ()
 Attempt to enqueue a delete for the EvpnManager. More...
 
LifetimeActordeleter ()
 Return the LifetimeActor for the EvpnManager. More...
 

Private Types

typedef std::vector
< EvpnManagerPartition * > 
PartitionList
 
typedef boost::ptr_map< const
EthernetSegmentId, EvpnSegment
SegmentMap
 
typedef std::set< EvpnSegment * > SegmentSet
 

Private Member Functions

void AllocPartitions ()
 Allocate the EvpnManagerPartitions. More...
 
void FreePartitions ()
 Free the EvpnManagerPartitions. More...
 
void AutoDiscoveryRouteListener (EvpnRoute *route)
 DBListener callback handler for AutoDisocvery routes in the EvpnTable. More...
 
void MacAdvertisementRouteListener (EvpnManagerPartition *partition, EvpnRoute *route)
 DBListener callback handler for MacAdvertisement routes in the EvpnTable. More...
 
void InclusiveMulticastRouteListener (EvpnManagerPartition *partition, EvpnRoute *route)
 DBListener callback handler for InclusiveMulticast routes in the EvpnTable. More...
 
void SelectiveMulticastRouteListener (EvpnManagerPartition *partition, EvpnRoute *route)
 DBListener callback handler for SelectiveMulticast routes in the EvpnTable. More...
 
void RouteListener (DBTablePartBase *tpart, DBEntryBase *db_entry)
 DBListener callback handler for the EvpnTable. More...
 
void ErmVpnRouteListener (DBTablePartBase *tpart, DBEntryBase *db_entry)
 ErmVpnTable route listener callback function. More...
 
bool ProcessSegmentDeleteSet ()
 Process the set of EvpnSegments that can potentially be deleted. Remove the EvpnSegment from the map and destroy if it's fine to to delete the EvpnSegment. More...
 
bool ProcessSegmentUpdateSet ()
 Process the set of EvpnSegments that need to be updated. More...
 
bool IsUsableGlobalTreeRootRoute (ErmVpnRoute *ermvpn_route) const
 Check whether an ErmVpnRoute is locally originated GlobalTreeRoute. More...
 
void DisableSegmentUpdateProcessing ()
 Disable processing of the update list. For testing only. More...
 
void EnableSegmentUpdateProcessing ()
 Enable processing of the update list. For testing only. More...
 
void DisableSegmentDeleteProcessing ()
 Disable processing of the delete list. For testing only. More...
 
void EnableSegmentDeleteProcessing ()
 Enable processing of the delete list. For testing only. More...
 
void DisableMacUpdateProcessing ()
 Disable processing of the update lists in all partitions. For testing only. More...
 
void EnableMacUpdateProcessing ()
 Enable processing of the update lists in all partitions. For testing only. More...
 
void SetDBState (EvpnRoute *route, EvpnMcastNode *dbstate)
 Set DB State and update count. More...
 
void ClearDBState (EvpnRoute *route)
 Create DB State and update count. If there is no DB State associated in the table, resume table deletion if the deletion was pending. More...
 
 DISALLOW_COPY_AND_ASSIGN (EvpnManager)
 

Private Attributes

EvpnTabletable_
 
ErmVpnTableermvpn_table_
 
int listener_id_
 
int ermvpn_listener_id_
 
tbb::atomic< int > db_states_count_
 
PartitionList partitions_
 
tbb::spin_rw_mutex segment_rw_mutex_
 
SegmentMap segment_map_
 
SegmentSet segment_delete_set_
 
SegmentSet segment_update_set_
 
boost::scoped_ptr< TaskTriggersegment_delete_trigger_
 
boost::scoped_ptr< TaskTriggersegment_update_trigger_
 
boost::scoped_ptr< DeleteActordeleter_
 
LifetimeRef< EvpnManagertable_delete_ref_
 

Friends

class BgpEvpnManagerTest
 
class BgpEvpnAliasingTest
 

Detailed Description

This class represents the EVPN manager for an EvpnTable in a VRF.

It is responsible for listening to route notifications on the associated EvpnTable and implementing glue logic to massage routes so that vRouters can communicate properly with EVPN PEs.

It currently implements glue logic for multicast connectivity between the vRouters and EVPN PEs. This is achieved by keeping track of local/remote EvpnMcastNodes and constructing ingress replication OList for any given EvpnLocalMcastNode when requested.

It also provides the EvpnTable class with an API to get the UpdateInfo for a route in EvpnTable. This is used by the table's Export method to build the RibOutAttr for the broadcast MAC routes. This is how we send ingress replication OList information for an EVPN instance to the XMPP peers.

An EvpnManager keeps a vector of pointers to EvpnManagerPartitions. The number of partitions is the same as the DB partition count. A partition contains a subset of EvpnMcastNodes that are created based on EvpnRoutes in the EvpnTable.

The concurrency model is that each EvpnManagerPartition can be updated and can build the ingress replication OLists independently of other partitions.

The EvpnManager is also used to implement glue logic for EVPN aliasing when remote PEs have multi-homed segments.

An EvpnManager maintains a map of EvpnSegments keyed by EthernetSegmentId. It also keeps sets of EvpnSegments that need to be updated or evaluated for deletion.

An EvpnSegment gets added to the segment update list in the EvpnManager when there's a change in the AD route for the EvpnSegment. The update list gets processed in the context of the bgp::EvpnSegment task.

An EvpnSegment gets added to the segment delete list in the EvpnManager when the PE list becomes empty (bgp::EvpnSegment task) or when the MAC route list for a given partition becomes empty (db::DBTable task). The actual call to MayDelete and subsequent destroy, if appropriate, happens in in the context of bgp::EvpnSegment task.

The bgp::EvpnSegment task is mutually exclusive with the db::DBTable task.

Definition at line 578 of file bgp_evpn.h.

Member Typedef Documentation

typedef std::vector<EvpnManagerPartition *> EvpnManager::PartitionList
private

Definition at line 660 of file bgp_evpn.h.

typedef boost::ptr_map<const EthernetSegmentId, EvpnSegment> EvpnManager::SegmentMap
private

Definition at line 662 of file bgp_evpn.h.

typedef std::set<EvpnSegment *> EvpnManager::SegmentSet
private

Definition at line 663 of file bgp_evpn.h.

Constructor & Destructor Documentation

EvpnManager::EvpnManager ( EvpnTable table)
explicit

Definition at line 1031 of file bgp_evpn.cc.

EvpnManager::~EvpnManager ( )
virtual

Definition at line 1048 of file bgp_evpn.cc.

Member Function Documentation

void EvpnManager::AllocPartitions ( )
private

Allocate the EvpnManagerPartitions.

Definition at line 1089 of file bgp_evpn.cc.

Here is the call graph for this function:

void EvpnManager::AutoDiscoveryRouteListener ( EvpnRoute route)
private

DBListener callback handler for AutoDisocvery routes in the EvpnTable.

Definition at line 1297 of file bgp_evpn.cc.

Here is the call graph for this function:

void EvpnManager::ClearDBState ( EvpnRoute route)
private

Create DB State and update count. If there is no DB State associated in the table, resume table deletion if the deletion was pending.

Definition at line 1500 of file bgp_evpn.cc.

Here is the call graph for this function:

LifetimeActor * EvpnManager::deleter ( )

Return the LifetimeActor for the EvpnManager.

Definition at line 1718 of file bgp_evpn.cc.

void EvpnManager::DisableMacUpdateProcessing ( )
private

Disable processing of the update lists in all partitions. For testing only.

Definition at line 1106 of file bgp_evpn.cc.

Here is the call graph for this function:

void EvpnManager::DisableSegmentDeleteProcessing ( )
private

Disable processing of the delete list. For testing only.

Definition at line 1224 of file bgp_evpn.cc.

void EvpnManager::DisableSegmentUpdateProcessing ( )
private

Disable processing of the update list. For testing only.

Definition at line 1282 of file bgp_evpn.cc.

EvpnManager::DISALLOW_COPY_AND_ASSIGN ( EvpnManager  )
private
void EvpnManager::EnableMacUpdateProcessing ( )
private

Enable processing of the update lists in all partitions. For testing only.

Definition at line 1116 of file bgp_evpn.cc.

Here is the call graph for this function:

void EvpnManager::EnableSegmentDeleteProcessing ( )
private

Enable processing of the delete list. For testing only.

Definition at line 1232 of file bgp_evpn.cc.

void EvpnManager::EnableSegmentUpdateProcessing ( )
private

Enable processing of the update list. For testing only.

Definition at line 1290 of file bgp_evpn.cc.

int EvpnManager::ermvpn_listener_id ( ) const
inline

Definition at line 611 of file bgp_evpn.h.

ErmVpnTable* EvpnManager::ermvpn_table ( )
inline

Definition at line 608 of file bgp_evpn.h.

const ErmVpnTable* EvpnManager::ermvpn_table ( ) const
inline

Definition at line 609 of file bgp_evpn.h.

void EvpnManager::ErmVpnRouteListener ( DBTablePartBase tpart,
DBEntryBase db_entry 
)
private

ErmVpnTable route listener callback function.

Process changes (create/update/delete) to GlobalErmVpnRoute in vrf.ermvpn.0

Definition at line 1530 of file bgp_evpn.cc.

Here is the call graph for this function:

void EvpnManager::FillShowInfo ( ShowEvpnTable *  sevt) const

Fill information for introspect command. Note that all IM routes are always in partition 0.

Definition at line 1629 of file bgp_evpn.cc.

Here is the call graph for this function:

EvpnSegment * EvpnManager::FindSegment ( const EthernetSegmentId esi)

Find the EvpnSegment for the given EthernetSegmentId.

Definition at line 1175 of file bgp_evpn.cc.

Here is the call graph for this function:

void EvpnManager::FreePartitions ( )
private

Free the EvpnManagerPartitions.

Definition at line 1098 of file bgp_evpn.cc.

Here is the call graph for this function:

EvpnManagerPartition * EvpnManager::GetPartition ( size_t  part_id)

Get the EvpnManagerPartition for the given partition id.

Definition at line 1125 of file bgp_evpn.cc.

DBTablePartition * EvpnManager::GetTablePartition ( size_t  part_id)

Get the DBTablePartition for the EvpnTable for given partition id.

Definition at line 1132 of file bgp_evpn.cc.

Here is the call graph for this function:

UpdateInfo * EvpnManager::GetUpdateInfo ( EvpnRoute route)
virtual

Construct export state for the given EvpnRoute. Note that the route only needs to be exported to the IPeer from which it was learnt.

Definition at line 1140 of file bgp_evpn.cc.

Here is the call graph for this function:

void EvpnManager::InclusiveMulticastRouteListener ( EvpnManagerPartition partition,
EvpnRoute route 
)
private

DBListener callback handler for InclusiveMulticast routes in the EvpnTable.

Definition at line 1384 of file bgp_evpn.cc.

Here is the call graph for this function:

void EvpnManager::Initialize ( )
virtual

Initialize the EvpnManager. We allocate the EvpnManagerPartitions and register a DBListener for the EvpnTable.

Definition at line 1058 of file bgp_evpn.cc.

Here is the call graph for this function:

bool EvpnManager::IsUsableGlobalTreeRootRoute ( ErmVpnRoute ermvpn_route) const
private

Check whether an ErmVpnRoute is locally originated GlobalTreeRoute.

Definition at line 1511 of file bgp_evpn.cc.

Here is the call graph for this function:

int EvpnManager::listener_id ( ) const
inline

Definition at line 610 of file bgp_evpn.h.

EvpnSegment * EvpnManager::LocateSegment ( const EthernetSegmentId esi)

Find or create the EvpnSegment for the given EthernetSegmentId.

Definition at line 1160 of file bgp_evpn.cc.

Here is the call graph for this function:

void EvpnManager::MacAdvertisementRouteListener ( EvpnManagerPartition partition,
EvpnRoute route 
)
private

DBListener callback handler for MacAdvertisement routes in the EvpnTable.

Definition at line 1326 of file bgp_evpn.cc.

Here is the call graph for this function:

void EvpnManager::ManagedDelete ( )

Trigger deletion of the EvpnManager and propagate the delete to any dependents.

Definition at line 1702 of file bgp_evpn.cc.

bool EvpnManager::MayDelete ( ) const

Trigger deletion of the EvpnManager and propagate the delete to any dependents.

Definition at line 1664 of file bgp_evpn.cc.

Here is the call graph for this function:

bool EvpnManager::ProcessSegmentDeleteSet ( )
private

Process the set of EvpnSegments that can potentially be deleted. Remove the EvpnSegment from the map and destroy if it's fine to to delete the EvpnSegment.

Definition at line 1205 of file bgp_evpn.cc.

Here is the call graph for this function:

bool EvpnManager::ProcessSegmentUpdateSet ( )
private

Process the set of EvpnSegments that need to be updated.

Go through each EvpnSegment and update it's PE list. Trigger updates of all it's dependent MAC routes if there's a change in the PE list.

Definition at line 1259 of file bgp_evpn.cc.

Here is the call graph for this function:

void EvpnManager::RetryDelete ( )

Attempt to enqueue a delete for the EvpnManager.

Definition at line 1709 of file bgp_evpn.cc.

Here is the call graph for this function:

void EvpnManager::RouteListener ( DBTablePartBase tpart,
DBEntryBase db_entry 
)
private

DBListener callback handler for the EvpnTable.

Definition at line 1596 of file bgp_evpn.cc.

Here is the call graph for this function:

void EvpnManager::SelectiveMulticastRouteListener ( EvpnManagerPartition partition,
EvpnRoute route 
)
private

DBListener callback handler for SelectiveMulticast routes in the EvpnTable.

Definition at line 1423 of file bgp_evpn.cc.

Here is the call graph for this function:

BgpServer * EvpnManager::server ( )

Definition at line 1153 of file bgp_evpn.cc.

Here is the call graph for this function:

void EvpnManager::SetDBState ( EvpnRoute route,
EvpnMcastNode dbstate 
)
private

Set DB State and update count.

Definition at line 1493 of file bgp_evpn.cc.

Here is the call graph for this function:

void EvpnManager::Shutdown ( )

Initiate shutdown for the EvpnManager.

Definition at line 1694 of file bgp_evpn.cc.

EvpnTable* EvpnManager::table ( )
inline

Definition at line 606 of file bgp_evpn.h.

const EvpnTable* EvpnManager::table ( ) const
inline

Definition at line 607 of file bgp_evpn.h.

void EvpnManager::Terminate ( )
virtual

Terminate the EvpnManager. We free the EvpnManagerPartitions and unregister from the EvpnTable.

Definition at line 1075 of file bgp_evpn.cc.

Here is the call graph for this function:

void EvpnManager::TriggerSegmentDelete ( EvpnSegment segment)

Trigger deletion of the given EvpnSegment. The EvpnSegment is added to a set of EvpnSegments that can potentially be deleted. This method can be invoked from multiple db::DBTable tasks in parallel when a MAC routes are removed from the dependency list in an EvpnSegment. Hence we ensure exclusive access using a write lock.

The list is processed from the context of bgp::EvpnSegment task which is mutually exclusive with db::DBTable task.

Definition at line 1192 of file bgp_evpn.cc.

void EvpnManager::TriggerSegmentUpdate ( EvpnSegment segment)

Trigger update of the given EvpnSegment. The EvpnSegment is added to a set of EvpnSegments for which updates need triggered. This method is called in the context of db::DBTable task and a task instance of 0 since all AutoDisocvery routes always get sharded to partition 0.

The set is processed in the context of bgp::EvpnSegment task, which is mutually exclusive with db::DBTable task.

Definition at line 1246 of file bgp_evpn.cc.

Friends And Related Function Documentation

friend class BgpEvpnAliasingTest
friend

Definition at line 658 of file bgp_evpn.h.

friend class BgpEvpnManagerTest
friend

Definition at line 657 of file bgp_evpn.h.

Member Data Documentation

tbb::atomic<int> EvpnManager::db_states_count_
private

Definition at line 743 of file bgp_evpn.h.

boost::scoped_ptr<DeleteActor> EvpnManager::deleter_
private

Definition at line 752 of file bgp_evpn.h.

int EvpnManager::ermvpn_listener_id_
private

Definition at line 742 of file bgp_evpn.h.

ErmVpnTable* EvpnManager::ermvpn_table_
private

Definition at line 740 of file bgp_evpn.h.

int EvpnManager::listener_id_
private

Definition at line 741 of file bgp_evpn.h.

PartitionList EvpnManager::partitions_
private

Definition at line 744 of file bgp_evpn.h.

SegmentSet EvpnManager::segment_delete_set_
private

Definition at line 747 of file bgp_evpn.h.

boost::scoped_ptr<TaskTrigger> EvpnManager::segment_delete_trigger_
private

Definition at line 749 of file bgp_evpn.h.

SegmentMap EvpnManager::segment_map_
private

Definition at line 746 of file bgp_evpn.h.

tbb::spin_rw_mutex EvpnManager::segment_rw_mutex_
private

Definition at line 745 of file bgp_evpn.h.

SegmentSet EvpnManager::segment_update_set_
private

Definition at line 748 of file bgp_evpn.h.

boost::scoped_ptr<TaskTrigger> EvpnManager::segment_update_trigger_
private

Definition at line 750 of file bgp_evpn.h.

EvpnTable* EvpnManager::table_
private

Definition at line 739 of file bgp_evpn.h.

LifetimeRef<EvpnManager> EvpnManager::table_delete_ref_
private

Definition at line 753 of file bgp_evpn.h.


The documentation for this class was generated from the following files: