5 #ifndef SRC_BGP_BGP_MVPN_H_
6 #define SRC_BGP_BGP_MVPN_H_
14 #include <shared_mutex>
15 #include <boost/scoped_ptr.hpp>
129 Ip4Address *address, std::vector<std::string> *encap)
const;
284 const SG &
sg()
const;
392 Ip4Address *address, std::vector<std::string> *encap)
const;
472 int prev = mvpn_state->
refcount_.fetch_sub(1);
475 if (mvpn_state->
states()) {
476 MvpnState::StatesMap::iterator iter =
477 mvpn_state->
states()->find(mvpn_state->
sg());
478 if (iter != mvpn_state->
states()->end()) {
479 assert(iter->second == mvpn_state);
480 mvpn_state->
states()->erase(iter);
491 #define MVPN_RT_LOG(rt, ...) \
492 RTINSTANCE_LOG(MvpnRoute, this->table()->routing_instance(), \
493 SandeshLevel::UT_DEBUG, \
494 RTINSTANCE_LOG_FLAG_ALL, \
495 (rt)->GetPrefix().source().to_string(), \
496 (rt)->GetPrefix().group().to_string(), \
497 (rt)->GetType(), (rt)->ToString(), ##__VA_ARGS__)
499 #define MVPN_ERMVPN_RT_LOG(rt, ...) \
500 RTINSTANCE_LOG(MvpnErmVpnRoute, this->table()->routing_instance(), \
501 SandeshLevel::UT_DEBUG, \
502 RTINSTANCE_LOG_FLAG_ALL, \
503 (rt)->GetPrefix().source().to_string(), \
504 (rt)->GetPrefix().group().to_string(), \
505 (rt)->GetType(), (rt)->ToString(), ##__VA_ARGS__)
507 #define MVPN_LOG(type, ...) \
508 RTINSTANCE_LOG(type, this->table()->routing_instance(), \
509 SandeshLevel::SYS_DEBUG, RTINSTANCE_LOG_FLAG_ALL, ##__VA_ARGS__)
511 #define MVPN_TRACE(type, ...) \
512 RTINSTANCE_LOG(type, this->table()->routing_instance(), \
513 SandeshLevel::UT_DEBUG, RTINSTANCE_LOG_FLAG_ALL, ##__VA_ARGS__)
boost::asio::ip::address IpAddress
boost::asio::ip::address_v4 Ip4Address
void intrusive_ptr_add_ref(MvpnState *mvpn_state)
void intrusive_ptr_release(MvpnState *mvpn_state)
boost::intrusive_ptr< MvpnState > MvpnStatePtr
std::set< BgpTable * > TableSet
bool GetForestNodePMSI(ErmVpnRoute *rt, uint32_t *label, Ip4Address *address, std::vector< std::string > *encap) const
void ProcessType7SourceTreeJoinRoute(MvpnRoute *join_rt)
void ProcessType4LeafADRoute(MvpnRoute *leaf_ad)
MvpnManagerPartition(MvpnManager *manager, int part_id)
MvpnStatePtr GetState(MvpnRoute *route)
void ProcessType3SPMSIRoute(MvpnRoute *spmsi_rt)
MvpnStatePtr LocateState(MvpnRoute *route)
virtual ~MvpnManagerPartition()
void NotifyForestNode(const Ip4Address &source, const Ip4Address &group)
void ProcessType5SourceActiveRoute(MvpnRoute *join_rt)
DISALLOW_COPY_AND_ASSIGN(MvpnManagerPartition)
MvpnProjectManagerPartition * GetProjectManagerPartition()
boost::scoped_ptr< DeleteActor > deleter_
LifetimeActor * deleter()
PartitionList::const_iterator const_iterator
void SetDBState(MvpnRoute *route, MvpnDBState *mvpn_dbstate)
virtual void Initialize()
void ResolvePath(RoutingInstance *rtinstance, BgpRoute *rt, BgpPath *path)
std::shared_mutex & neighbors_mutex()
DISALLOW_COPY_AND_ASSIGN(MvpnManager)
LifetimeRef< MvpnManager > ermvpn_table_delete_ref_
void RouteListener(DBTablePartBase *tpart, DBEntryBase *db_entry)
std::vector< MvpnManagerPartition * > PartitionList
MvpnProjectManager * GetProjectManager()
bool FindResolvedNeighbor(const BgpPath *path, MvpnNeighbor *neighbor) const
void ReOriginateType1Route(const Ip4Address &old_identifier)
void ProcessType1ADRoute(MvpnRoute *route)
MvpnManager(MvpnTable *table, ErmVpnTable *ermvpn_table)
PartitionList partitions_
std::map< RouteDistinguisher, MvpnNeighbor > NeighborMap
void ClearDBState(MvpnRoute *route)
std::atomic< int > db_states_count_
std::shared_mutex neighbors_mutex_
LifetimeRef< MvpnManager > table_delete_ref_
const NeighborMap & neighbors() const
BgpRoute * RouteReplicate(BgpServer *server, BgpTable *src_table, BgpRoute *source_rt, const BgpPath *src_path, ExtCommunityPtr comm)
void OriginateType1Route()
bool FindNeighbor(const RouteDistinguisher &rd, MvpnNeighbor *nbr) const
const LifetimeActor * deleter() const
ErmVpnTable * ermvpn_table_
int identifier_listener_id_
size_t neighbors_count() const
virtual void UpdateSecondaryTablesForReplication(MvpnRoute *rt, BgpTable::TableSet *secondary_tables) const
MvpnProjectManagerPartition(MvpnProjectManager *manager, int part_id)
DISALLOW_COPY_AND_ASSIGN(MvpnProjectManagerPartition)
void RouteListener(DBEntryBase *db_entry)
MvpnState::StatesMap states_
MvpnStatePtr GetState(const SG &sg)
bool GetForestNodePMSI(ErmVpnRoute *rt, uint32_t *label, Ip4Address *address, std::vector< std::string > *encap) const
ErmVpnRoute * GetGlobalTreeRootRoute(ErmVpnRoute *rt) const
const MvpnState::StatesMap & states() const
virtual ~MvpnProjectManagerPartition()
MvpnStatePtr CreateState(const SG &sg)
bool IsUsableGlobalTreeRootRoute(ErmVpnRoute *ermvpn_route) const
void NotifyForestNode(const Ip4Address &source, const Ip4Address &group)
MvpnState::StatesMap & states()
MvpnStatePtr LocateState(const SG &sg)
MvpnProjectManager * manager_
const LifetimeActor * deleter() const
MvpnProjectManagerPartition * GetPartition(int part_id)
boost::scoped_ptr< DeleteActor > deleter_
UpdateInfo * GetUpdateInfo(MvpnRoute *route)
MvpnStatePtr GetState(MvpnRoute *route) const
PartitionList partitions_
std::vector< MvpnProjectManagerPartition * > PartitionList
void GetMvpnSourceAddress(ErmVpnRoute *ermvpn_route, Ip4Address *address) const
PartitionList::const_iterator const_iterator
MvpnProjectManager(ErmVpnTable *table)
UpdateInfo * GetType7UpdateInfo(MvpnRoute *route)
LifetimeRef< MvpnProjectManager > table_delete_ref_
void RouteListener(DBTablePartBase *tpart, DBEntryBase *db_entry)
virtual void Initialize()
virtual ~MvpnProjectManager()
const PartitionList & partitions() const
DISALLOW_COPY_AND_ASSIGN(MvpnProjectManager)
RoutesSet spmsi_routes_received_
const StatesMap * states() const
friend void intrusive_ptr_add_ref(MvpnState *mvpn_state)
RoutesMap & leafad_routes_attr_received()
std::set< MvpnRoute * > RoutesSet
const MvpnProjectManager * project_manager() const
const ErmVpnTable * table() const
MvpnState(const SG &sg, StatesMap *states, MvpnProjectManager *pm)
ErmVpnRoute * global_ermvpn_tree_rt()
void set_source_active_rt(MvpnRoute *source_active_rt)
std::atomic< int > refcount_
DISALLOW_COPY_AND_ASSIGN(MvpnState)
std::map< MvpnRoute *, BgpAttrPtr > RoutesMap
ErmVpnRoute * global_ermvpn_tree_rt_
std::map< SG, MvpnState * > StatesMap
MvpnRoute * source_active_rt_
RoutesSet & spmsi_routes_received()
RoutesMap leafad_routes_attr_received_
MvpnRoute * source_active_rt()
void set_spmsi_rt(MvpnRoute *spmsi_rt)
MvpnProjectManager * project_manager_
friend void intrusive_ptr_release(MvpnState *mvpn_state)
void set_global_ermvpn_tree_rt(ErmVpnRoute *global_ermvpn_tree_rt)
MvpnProjectManager * project_manager()
MvpnDBState(MvpnStatePtr state)
DISALLOW_COPY_AND_ASSIGN(MvpnDBState)
void set_state(MvpnStatePtr state)
void set_route(MvpnRoute *route)
const IpAddress & originator() const
uint32_t source_as() const
bool operator==(const MvpnNeighbor &rhs) const
std::string ToString() const
const RouteDistinguisher & rd() const
bool operator<(const SG &other) const
SG(const Ip4Address &source, const Ip4Address &group)