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