OpenSDN source code
|
This class represents the EVPN manager for an EvpnTable in a VRF. More...
#include <bgp_evpn.h>
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 UpdateInfo * | GetUpdateInfo (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... | |
EvpnManagerPartition * | GetPartition (size_t part_id) |
Get the EvpnManagerPartition for the given partition id. More... | |
DBTablePartition * | GetTablePartition (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... | |
BgpServer * | server () |
EvpnTable * | table () |
const EvpnTable * | table () const |
ErmVpnTable * | ermvpn_table () |
const ErmVpnTable * | ermvpn_table () const |
int | listener_id () const |
int | ermvpn_listener_id () const |
EvpnSegment * | LocateSegment (const EthernetSegmentId &esi) |
Find or create the EvpnSegment for the given EthernetSegmentId. More... | |
EvpnSegment * | FindSegment (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... | |
LifetimeActor * | deleter () |
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 | |
EvpnTable * | table_ |
ErmVpnTable * | ermvpn_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< TaskTrigger > | segment_delete_trigger_ |
boost::scoped_ptr< TaskTrigger > | segment_update_trigger_ |
boost::scoped_ptr< DeleteActor > | deleter_ |
LifetimeRef< EvpnManager > | table_delete_ref_ |
Friends | |
class | BgpEvpnManagerTest |
class | BgpEvpnAliasingTest |
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.
|
private |
Definition at line 660 of file bgp_evpn.h.
|
private |
Definition at line 662 of file bgp_evpn.h.
|
private |
Definition at line 663 of file bgp_evpn.h.
|
explicit |
Definition at line 1031 of file bgp_evpn.cc.
|
virtual |
Definition at line 1048 of file bgp_evpn.cc.
|
private |
Allocate the EvpnManagerPartitions.
Definition at line 1089 of file bgp_evpn.cc.
|
private |
DBListener callback handler for AutoDisocvery routes in the EvpnTable.
Definition at line 1297 of file bgp_evpn.cc.
|
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.
LifetimeActor * EvpnManager::deleter | ( | ) |
Return the LifetimeActor for the EvpnManager.
Definition at line 1718 of file bgp_evpn.cc.
|
private |
Disable processing of the update lists in all partitions. For testing only.
Definition at line 1106 of file bgp_evpn.cc.
|
private |
Disable processing of the delete list. For testing only.
Definition at line 1224 of file bgp_evpn.cc.
|
private |
Disable processing of the update list. For testing only.
Definition at line 1282 of file bgp_evpn.cc.
|
private |
|
private |
Enable processing of the update lists in all partitions. For testing only.
Definition at line 1116 of file bgp_evpn.cc.
|
private |
Enable processing of the delete list. For testing only.
Definition at line 1232 of file bgp_evpn.cc.
|
private |
Enable processing of the update list. For testing only.
Definition at line 1290 of file bgp_evpn.cc.
|
inline |
Definition at line 611 of file bgp_evpn.h.
|
inline |
Definition at line 608 of file bgp_evpn.h.
|
inline |
Definition at line 609 of file bgp_evpn.h.
|
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.
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.
EvpnSegment * EvpnManager::FindSegment | ( | const EthernetSegmentId & | esi | ) |
Find the EvpnSegment for the given EthernetSegmentId.
Definition at line 1175 of file bgp_evpn.cc.
|
private |
Free the EvpnManagerPartitions.
Definition at line 1098 of file bgp_evpn.cc.
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.
|
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.
|
private |
DBListener callback handler for InclusiveMulticast routes in the EvpnTable.
Definition at line 1384 of file bgp_evpn.cc.
|
virtual |
Initialize the EvpnManager. We allocate the EvpnManagerPartitions and register a DBListener for the EvpnTable.
Definition at line 1058 of file bgp_evpn.cc.
|
private |
Check whether an ErmVpnRoute is locally originated GlobalTreeRoute.
Definition at line 1511 of file bgp_evpn.cc.
|
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.
|
private |
DBListener callback handler for MacAdvertisement routes in the EvpnTable.
Definition at line 1326 of file bgp_evpn.cc.
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.
|
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.
|
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.
void EvpnManager::RetryDelete | ( | ) |
Attempt to enqueue a delete for the EvpnManager.
Definition at line 1709 of file bgp_evpn.cc.
|
private |
DBListener callback handler for the EvpnTable.
Definition at line 1596 of file bgp_evpn.cc.
|
private |
DBListener callback handler for SelectiveMulticast routes in the EvpnTable.
Definition at line 1423 of file bgp_evpn.cc.
BgpServer * EvpnManager::server | ( | ) |
|
private |
Set DB State and update count.
Definition at line 1493 of file bgp_evpn.cc.
void EvpnManager::Shutdown | ( | ) |
Initiate shutdown for the EvpnManager.
Definition at line 1694 of file bgp_evpn.cc.
|
inline |
Definition at line 606 of file bgp_evpn.h.
|
inline |
Definition at line 607 of file bgp_evpn.h.
|
virtual |
Terminate the EvpnManager. We free the EvpnManagerPartitions and unregister from the EvpnTable.
Definition at line 1075 of file bgp_evpn.cc.
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.
|
friend |
Definition at line 658 of file bgp_evpn.h.
|
friend |
Definition at line 657 of file bgp_evpn.h.
|
private |
Definition at line 743 of file bgp_evpn.h.
|
private |
Definition at line 752 of file bgp_evpn.h.
|
private |
Definition at line 742 of file bgp_evpn.h.
|
private |
Definition at line 740 of file bgp_evpn.h.
|
private |
Definition at line 741 of file bgp_evpn.h.
|
private |
Definition at line 744 of file bgp_evpn.h.
|
private |
Definition at line 747 of file bgp_evpn.h.
|
private |
Definition at line 749 of file bgp_evpn.h.
|
private |
Definition at line 746 of file bgp_evpn.h.
|
private |
Definition at line 745 of file bgp_evpn.h.
|
private |
Definition at line 748 of file bgp_evpn.h.
|
private |
Definition at line 750 of file bgp_evpn.h.
|
private |
Definition at line 739 of file bgp_evpn.h.
|
private |
Definition at line 753 of file bgp_evpn.h.