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;
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__)
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)
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)
LifetimeRef< MvpnManager > table_delete_ref_
tbb::reader_writer_lock & neighbors_mutex()
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
tbb::reader_writer_lock neighbors_mutex_
ErmVpnTable * ermvpn_table_
tbb::atomic< int > db_states_count_
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)
DISALLOW_COPY_AND_ASSIGN(MvpnState)
std::map< MvpnRoute *, BgpAttrPtr > RoutesMap
tbb::atomic< int > refcount_
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)