OpenSDN source code
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
bgp_mvpn.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017 Juniper Networks, Inc. All rights reserved.
3  */
4 
5 #ifndef SRC_BGP_BGP_MVPN_H_
6 #define SRC_BGP_BGP_MVPN_H_
7 
8 #include <tbb/reader_writer_lock.h>
9 #include <map>
10 #include <set>
11 #include <sstream>
12 #include <string>
13 #include <vector>
14 #include <boost/scoped_ptr.hpp>
15 
16 #include "base/lifetime.h"
17 #include "base/address.h"
18 #include "bgp/bgp_attr.h"
19 #include "bgp/bgp_table.h"
20 #include "db/db_entry.h"
21 
22 class BgpPath;
23 class BgpRoute;
24 class BgpServer;
25 class BgpTable;
26 class ErmVpnRoute;
27 class ErmVpnTable;
28 struct MvpnDBState;
29 class MvpnManager;
31 class MvpnPrefix;
32 class MvpnProjectManager;
34 class MvpnRoute;
35 class MvpnState;
36 class MvpnTable;
37 class PathResolver;
38 class RoutingInstance;
39 class UpdateInfo;
40 
41 typedef boost::intrusive_ptr<MvpnState> MvpnStatePtr;
42 
43 // This struct represents a MVPN Neighbor discovered using BGP or using auto
44 // exported routes from one routing-instance into another.
45 //
46 // Each received Type1 Intra AS Auto-Discovery ad Type2 Inter AS Auto Discovery
47 // routes from MVPN BGP Peers is maintained as MVPN neighbors inside a map in
48 // each MvpnManager object. RouteDistinguisher is used as the key to this map.
49 //
50 // Typically neighbor information is used in mvpn when the Type I and Type II
51 // routes also carry PMSI tunnel information to send multicast traffic to all
52 // intended receivers. In Phase I, PMSI information is not sent encoded inside
53 // Type I/Type II AD routes. Also, in phase I, PMSI information if received in
54 // Type I/Type II routes from remote neighbors is not processed.
55 struct MvpnNeighbor {
56 public:
57  MvpnNeighbor();
59  std::string ToString() const;
60  const RouteDistinguisher &rd() const;
61  const IpAddress &originator() const;
62  uint32_t source_as() const;
63  bool operator==(const MvpnNeighbor &rhs) const;
64 
65 private:
66  friend class MvpnManagerPartition;
67 
70  uint32_t source_as_;
71 };
72 
73 // This class manages Mvpn routes with in a partition of an MvpnTable.
74 //
75 // It holds a back pointer to the parent MvpnManager class along with the
76 // partition id this object belongs to.
77 //
78 // Upon route change notification, based on the route-type for which a route
79 // notification has been received, different set of actions are undertaken in
80 // this class. This class only handles routes in which customer 'Group' info is
81 // encoded, such as Type3 S-PMSI routes.
82 //
83 // Notification for a Type7 SourceTreeJoinRoute route add/change/delete
84 // When this route is successfully imported into a vrf, new Type3 S-PMSI
85 // route is originated/updated into that vrf.mvpn.0 if there is at least
86 // one associated Join route from the agent with flags marked as "Sender"
87 // or "SenderAndReciver".
88 //
89 // Notification for a Type3 S-PMSI route add/change/delete
90 // When sender indicates that it has a sender for a particular <S,G> entry,
91 // (With Leaf-Information required in the PMSI tunnel attribute), then this
92 // class originates/updates a new Type4 LeafAD route into vrf.mvpn.0 table.
93 // LeafAD route however is originated only if a usuable GlobalErmVpnRoute
94 // is avaiable for stitching. On the other hand, if such a route was already
95 // originated before and now is no longer feasible, it is deleted instead.
96 //
97 // Notification for a Type4 Leaf AD route add/change/delete
98 // When leaf-ad routes are imported into a vrf and notified, the routes are
99 // stored inside a map using route as the key and best path attributes as
100 // values in the associated MvpnState. If the route is deleted, then it is
101 // deleted from the map as well. If a usable Type5 source active route is
102 // present in the vrf, then it is notified so that sender agent can be
103 // updated with the right set of path attributes (PMSI) in order to be able
104 // to replicate multicast traffic in the data plane.
106 public:
107  MvpnManagerPartition(MvpnManager *manager, int part_id);
108  virtual ~MvpnManagerPartition();
111 
112 private:
113  friend class MvpnManager;
114 
115  MvpnTable *table();
116  int listener_id() const;
117 
118  void ProcessType3SPMSIRoute(MvpnRoute *spmsi_rt);
119  void ProcessType4LeafADRoute(MvpnRoute *leaf_ad);
122 
124  MvpnStatePtr GetState(MvpnRoute *route) const;
126  void NotifyForestNode(const Ip4Address &source, const Ip4Address &group);
127  bool GetForestNodePMSI(ErmVpnRoute *rt, uint32_t *label,
128  Ip4Address *address, std::vector<std::string> *encap) const;
129 
131  int part_id_;
132 
134 };
135 
136 // This class manages MVPN routes for a given vrf.mvpn.0 table.
137 //
138 // In each *.mvpn.0 table, an instance of this class is created when ever the
139 // mvpn table itself is created (which happens when its parent routing-instance
140 // gets created.
141 //
142 // This class allocated one instance of MvpnManagerPartition for each DB
143 // partition. While all <S,G> specific operations are essentially manages inside
144 // MvpnManagerPartition object (in order to get necessary protection from
145 // concurrency across different db partitions), all other operations which are
146 // <S,G> agnostic are mainly handled in this class.
147 //
148 // Specifically, all MVPN BGP neighbors are maintained in std::map NeighborMap.
149 // Neighbors are created or updated when Type1/Type2 paths are received and are
150 // deleted when those routes are deleted. All access to this map is protected
151 // by a mutex because even though the map itself may be created, updated, or
152 // deleted always serially from with in the same db task, map will get accessed
153 // (read) concurrently from task running of different DB partitions.
154 //
155 // This class also provides DeleteActor and maintains a LifetimeRef to parent
156 // MvpnTable object in order to ensure orderly cleanup during table deletion.
157 class MvpnManager {
158 public:
159  typedef std::vector<MvpnManagerPartition *> PartitionList;
160  typedef PartitionList::const_iterator const_iterator;
161  typedef std::map<RouteDistinguisher, MvpnNeighbor> NeighborMap;
162 
163  MvpnManager(MvpnTable *table, ErmVpnTable *ermvpn_table);
164  virtual ~MvpnManager();
165  bool FindNeighbor(const RouteDistinguisher &rd, MvpnNeighbor *nbr) const;
167  void ManagedDelete();
168  BgpRoute *RouteReplicate(BgpServer *server, BgpTable *src_table,
169  BgpRoute *source_rt, const BgpPath *src_path, ExtCommunityPtr comm);
170  void ResolvePath(RoutingInstance *rtinstance, BgpRoute *rt, BgpPath *path);
171  MvpnTable *table();
172  const MvpnTable *table() const;
173  int listener_id() const;
174  virtual void Terminate();
175  virtual void Initialize();
176  size_t neighbors_count() const;
177  const NeighborMap &neighbors() const;
178  void ReOriginateType1Route(const Ip4Address &old_identifier);
179  void OriginateType1Route();
180  bool MayDelete() const;
181  const LifetimeActor *deleter() const;
182  bool deleted() const;
185  BgpTable::TableSet *secondary_tables) const;
186  tbb::reader_writer_lock &neighbors_mutex() { return neighbors_mutex_; }
187 
188 private:
189  friend class MvpnManagerPartition;
190  class DeleteActor;
191 
192  void AllocPartitions();
193  void FreePartitions();
194  void ProcessType1ADRoute(MvpnRoute *route);
195  void RouteListener(DBTablePartBase *tpart, DBEntryBase *db_entry);
196  bool FindResolvedNeighbor(const BgpPath *path,
197  MvpnNeighbor *neighbor) const;
198  void SetDBState(MvpnRoute *route, MvpnDBState *mvpn_dbstate);
199  void ClearDBState(MvpnRoute *route);
200 
205  tbb::atomic<int> db_states_count_;
207 
209  mutable tbb::reader_writer_lock neighbors_mutex_;
210 
211  boost::scoped_ptr<DeleteActor> deleter_;
214 
216 };
217 
218 // This class holds Mvpn state for a particular <S,G> at any given time.
219 //
220 // In MVPN state machinery, different types of routes are sent and received at
221 // different phases of processing. This class holds all relevant information
222 // associated with an <S,G>.
223 //
224 // This is a refcounted class which is referred by DB States of different
225 // routes. When the refcount reaches 0, (last referring db state is deleted),
226 // this object is deleted from the container map and then destroyed.
227 //
228 // global_ermvpn_tree_rt_
229 // This is a reference to GlobalErmVpnRoute associated with the ErmVpnTree
230 // used in the data plane for this <S,G>. This route is created/updated
231 // when ErmVpn notifies changes to ermvpn routes.
232 //
233 // spmsi_rt_
234 // This is the 'only' Type3 SPMSI sender route originated for this S,G.
235 // When an agent indicates that it has an active sender for a particular
236 // <S,G> via Join route, then this route is originated (if there is atleast
237 // one active receiver)
238 //
239 // spmsi_routes_received_
240 // This is a set of all Type3 spmsi routes received for this <S-G>. It is
241 // possible that when these routes are received, then there is no ermvpn
242 // tree route to use for forwarding in the data plane. In such a case, later
243 // when global_ermvpn_tree_rt_ does get updated, all leaf ad routes in this
244 // set are notified and re-evaluated.
245 //
246 // leafad_routes_attr_received_
247 // This is a map of all type 4 leaf ad routes originated (in response to
248 // received/imported type-3 spmsi routes. For each route, associated path
249 // attributes of the best path are stored as value inside the map. Whenever
250 // this map changes or when a new type-5 source active route is received,
251 // the correspnding sender agent is notified with the olist that contains
252 // the PMSI attributes as received in leafad routes path attributes.
253 //
254 // states_
255 // This is the parent map that holds 'this' MvpnState pointer as the value
256 // for the associated SG key. When the refcount reaches zero, it indicates
257 // that there is no reference to this state from of the DB States associated
258 // with any Mvpn route. Hence at that time, this state is removed this map
259 // states_ and destroyed. This map actually sits inside the associated
260 // MvpnProjectManagerParitition object.
261 class MvpnState {
262 public:
263  typedef std::set<MvpnRoute *> RoutesSet;
264  typedef std::map<MvpnRoute *, BgpAttrPtr> RoutesMap;
265 
266  // Simple structure to hold <S,G>. Source as "0.0.0.0" can be used to encode
267  // <*,G> as well.
268  struct SG {
269  SG(const Ip4Address &source, const Ip4Address &group);
270  SG(const IpAddress &source, const IpAddress &group);
271  explicit SG(const ErmVpnRoute *route);
272  explicit SG(const MvpnRoute *route);
273  bool operator<(const SG &other) const;
274 
277  };
278 
279  typedef std::map<SG, MvpnState *> StatesMap;
281 
282  virtual ~MvpnState();
283  const SG &sg() const;
285  const ErmVpnRoute *global_ermvpn_tree_rt() const;
286  MvpnRoute *spmsi_rt();
287  const MvpnRoute *spmsi_rt() const;
292  const RoutesSet &spmsi_routes_received() const;
293  const RoutesMap &leafad_routes_attr_received() const;
294  const StatesMap *states() const { return states_; }
295  StatesMap *states() { return states_; }
297  const MvpnRoute *source_active_rt() const;
301  return project_manager_;
302  }
303  int refcount() const { return refcount_; }
304 
305 private:
306  friend class MvpnDBState;
307  friend class MvpnManagerPartition;
309  friend void intrusive_ptr_add_ref(MvpnState *mvpn_state);
310  friend void intrusive_ptr_release(MvpnState *mvpn_state);
311 
312  const ErmVpnTable *table() const;
313 
322  tbb::atomic<int> refcount_;
323 
325 };
326 
327 // This class holds a reference to MvpnState along with associated route
328 // pointer. This is stored as DBState inside the table along with the
329 // associated route.
330 //
331 // Note: Routes are never deleted until the DB state is deleted. MvpnState which
332 // is refcounted is also deleted only when there is no MvpnDBState that refers
333 // to it.
334 struct MvpnDBState : public DBState {
335  explicit MvpnDBState(MvpnStatePtr state);
336  ~MvpnDBState();
338  MvpnRoute *route();
339  void set_state(MvpnStatePtr state);
340  void set_route(MvpnRoute *route);
341 
342 private:
345 
347 };
348 
349 // This class glues mvpn and ermvpn modules, inside a particular DB partition.
350 //
351 // Each MVPN is associated with a parent MvpnProjectManager virtual-network via
352 // configuration. This parent MvpnProjectManager's ermvpn tree is the one used
353 // for all multicast packets replication in the data plane for the given MVPN.
354 //
355 // Inside each RoutingInstance object, name of this parent manager virtual
356 // network is stored in mvpn_project_manager_network_ string. When ever this
357 // information is set/modified/cleared in the routing instance, all associated
358 // Type3 S-PMSI MPVN received routes should be notified for re-evaluation.
359 //
360 // MvpnState::StatesMap states_
361 // A Map of <<S,G>, MvpnState> is maintained to hold MvpnState for all
362 // <S,G>s that fall into a specific DB partition.
363 //
364 // This provides APIs to create/update/delete MvpnState as required. MvpnState
365 // is refcounted. When the refcount reaches 1, it is deleted from the StatesMap
366 // and destroyed.
368 public:
369  typedef MvpnState::SG SG;
370 
371  MvpnProjectManagerPartition(MvpnProjectManager*manager, int part_id);
373  MvpnStatePtr GetState(const SG &sg);
374  MvpnStatePtr GetState(const SG &sg) const;
375  MvpnStatePtr LocateState(const SG &sg);
376  MvpnStatePtr CreateState(const SG &sg);
377  const MvpnState::StatesMap &states() const { return states_; }
379 
380 private:
381  friend class MvpnProjectManager;
382  friend class MvpnManagerPartition;
383 
385  ErmVpnTable *table();
386  const ErmVpnTable *table() const;
387  void RouteListener(DBEntryBase *db_entry);
388  int listener_id() const;
389  void NotifyForestNode(const Ip4Address &source, const Ip4Address &group);
390  bool GetForestNodePMSI(ErmVpnRoute *rt, uint32_t *label,
391  Ip4Address *address, std::vector<std::string> *encap) const;
392  bool IsUsableGlobalTreeRootRoute(ErmVpnRoute *ermvpn_route) const;
393 
394  // Back pointer to the parent MvpnProjectManager
396 
397  // Partition id of the manged DB partition.
398  int part_id_;
400 
402 };
403 
404 // This class glues mvpn and ermvpn modules
405 //
406 // It maintains a list of MvpnProjectManagerPartition objects, one for each DB
407 // partition.
408 //
409 // It listens to changes to ErmVpn table and for any applicable change to
410 // GlobalErmVpnRoute, it notifies all applicable received SPMSI routes so that
411 // those routes can be replicated/deleted based on the current state of the
412 // GlobalErmVpnRoute associated with a given <S,G>.
413 //
414 // This class also provides DeleteActor and maintains a LifetimeRef to parent
415 // MvpnTable object in order to ensure orderly cleanup during table deletion.
417 public:
418  class DeleteActor;
419  typedef std::vector<MvpnProjectManagerPartition *> PartitionList;
420  typedef PartitionList::const_iterator const_iterator;
421 
423  virtual ~MvpnProjectManager();
425  const MvpnProjectManagerPartition *GetPartition(int part_id) const;
426  void ManagedDelete();
427  virtual void Terminate();
428  ErmVpnTable *table();
429  const ErmVpnTable *table() const;
430  int listener_id() const;
431  const LifetimeActor *deleter() const;
433  bool deleted() const;
434  virtual void Initialize();
435  MvpnStatePtr GetState(MvpnRoute *route) const;
437  MvpnStatePtr GetState(ErmVpnRoute *route) const;
439  const PartitionList &partitions() const { return partitions_; }
440  bool MayDelete() const;
441  void GetMvpnSourceAddress(ErmVpnRoute *ermvpn_route,
442  Ip4Address *address) const;
443 
444 private:
445  void AllocPartitions();
446  void FreePartitions();
447  void RouteListener(DBTablePartBase *tpart, DBEntryBase *db_entry);
449 
450  // Parent ErmVpn table.
454 
455  boost::scoped_ptr<DeleteActor> deleter_;
457 
459 };
460 
461 // Increment refcont atomically.
462 inline void intrusive_ptr_add_ref(MvpnState *mvpn_state) {
463  mvpn_state->refcount_.fetch_and_increment();
464 }
465 
466 // Decrement refcount of an mvpn_state. If the refcount falls to 1, it implies
467 // that there is no more reference to this particular state from any other data
468 // structure. Hence, it can be deleted from the container map and destroyed as
469 // well.
470 inline void intrusive_ptr_release(MvpnState *mvpn_state) {
471  int prev = mvpn_state->refcount_.fetch_and_decrement();
472  if (prev > 1)
473  return;
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);
480 
481  // Attempt project manager deletion as it could be held up due to
482  // this map being non-empty so far..
483  if (mvpn_state->project_manager()->deleter()->IsDeleted())
484  mvpn_state->project_manager()->deleter()->RetryDelete();
485  }
486  }
487  delete mvpn_state;
488 }
489 
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__)
497 
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__)
505 
506 #define MVPN_LOG(type, ...) \
507  RTINSTANCE_LOG(type, this->table()->routing_instance(), \
508  SandeshLevel::SYS_DEBUG, RTINSTANCE_LOG_FLAG_ALL, ##__VA_ARGS__)
509 
510 #define MVPN_TRACE(type, ...) \
511  RTINSTANCE_LOG(type, this->table()->routing_instance(), \
512  SandeshLevel::UT_DEBUG, RTINSTANCE_LOG_FLAG_ALL, ##__VA_ARGS__)
513 
514 #endif // SRC_BGP_BGP_MVPN_H_
ErmVpnRoute * global_ermvpn_tree_rt()
Definition: bgp_mvpn.cc:294
ErmVpnRoute * GetGlobalTreeRootRoute(ErmVpnRoute *rt) const
LifetimeRef< MvpnProjectManager > table_delete_ref_
Definition: bgp_mvpn.h:456
MvpnProjectManager(ErmVpnTable *table)
Definition: bgp_mvpn.cc:82
int intrusive_ptr_add_ref(const AsPath *cpath)
Definition: bgp_aspath.h:147
const NeighborMap & neighbors() const
Definition: bgp_mvpn.cc:250
MvpnStatePtr GetState(MvpnRoute *route) const
Definition: bgp_mvpn.cc:165
const MvpnState::StatesMap & states() const
Definition: bgp_mvpn.h:377
tbb::reader_writer_lock neighbors_mutex_
Definition: bgp_mvpn.h:209
const RouteDistinguisher & rd() const
Definition: bgp_mvpn.cc:222
MvpnTable * table_
Definition: bgp_mvpn.h:201
virtual void Initialize()
Definition: bgp_mvpn.cc:606
DISALLOW_COPY_AND_ASSIGN(MvpnManager)
MvpnProjectManagerPartition * GetProjectManagerPartition()
Definition: bgp_mvpn.cc:514
MvpnManager * manager_
Definition: bgp_mvpn.h:130
bool FindResolvedNeighbor(const BgpPath *path, MvpnNeighbor *neighbor) const
LifetimeRef< MvpnManager > ermvpn_table_delete_ref_
Definition: bgp_mvpn.h:213
void ManagedDelete()
Definition: bgp_mvpn.cc:157
void set_global_ermvpn_tree_rt(ErmVpnRoute *global_ermvpn_tree_rt)
Definition: bgp_mvpn.cc:326
MvpnManagerPartition(MvpnManager *manager, int part_id)
Definition: bgp_mvpn.cc:506
std::map< RouteDistinguisher, MvpnNeighbor > NeighborMap
Definition: bgp_mvpn.h:161
void ReOriginateType1Route(const Ip4Address &old_identifier)
Definition: bgp_mvpn.cc:625
int listener_id() const
Definition: bgp_mvpn.cc:502
void NotifyForestNode(const Ip4Address &source, const Ip4Address &group)
Definition: bgp_mvpn.cc:576
void SetDBState(MvpnRoute *route, MvpnDBState *mvpn_dbstate)
Definition: bgp_mvpn.cc:481
std::vector< MvpnProjectManagerPartition * > PartitionList
Definition: bgp_mvpn.h:418
const PartitionList & partitions() const
Definition: bgp_mvpn.h:439
MvpnProjectManager * project_manager_
Definition: bgp_mvpn.h:321
boost::scoped_ptr< DeleteActor > deleter_
Definition: bgp_mvpn.h:211
RoutesSet spmsi_routes_received_
Definition: bgp_mvpn.h:318
MvpnStatePtr LocateState(const SG &sg)
Definition: bgp_mvpn.cc:195
virtual ~MvpnProjectManagerPartition()
Definition: bgp_mvpn.cc:184
virtual void Terminate()
Definition: bgp_mvpn.cc:431
MvpnStatePtr state_
Definition: bgp_mvpn.h:343
boost::asio::ip::address IpAddress
Definition: address.h:13
MvpnRoute * source_active_rt()
Definition: bgp_mvpn.cc:334
MvpnRoute * spmsi_rt_
Definition: bgp_mvpn.h:316
RoutesSet & spmsi_routes_received()
Definition: bgp_mvpn.cc:310
ErmVpnTable * table()
Definition: bgp_mvpn.cc:560
void set_spmsi_rt(MvpnRoute *spmsi_rt)
Definition: bgp_mvpn.cc:330
DISALLOW_COPY_AND_ASSIGN(MvpnDBState)
LifetimeRef< MvpnManager > table_delete_ref_
Definition: bgp_mvpn.h:212
StatesMap * states_
Definition: bgp_mvpn.h:320
MvpnManager(MvpnTable *table, ErmVpnTable *ermvpn_table)
Definition: bgp_mvpn.cc:397
MvpnStatePtr state()
Definition: bgp_mvpn.cc:353
void ProcessType5SourceActiveRoute(MvpnRoute *join_rt)
Definition: bgp_mvpn.cc:822
DISALLOW_COPY_AND_ASSIGN(MvpnProjectManager)
DISALLOW_COPY_AND_ASSIGN(MvpnProjectManagerPartition)
MvpnRoute * route_
Definition: bgp_mvpn.h:344
ErmVpnRoute * global_ermvpn_tree_rt_
Definition: bgp_mvpn.h:315
MvpnState::StatesMap & states()
Definition: bgp_mvpn.h:378
tbb::atomic< int > db_states_count_
Definition: bgp_mvpn.h:205
std::string ToString() const
boost::scoped_ptr< DeleteActor > deleter_
Definition: bgp_mvpn.h:455
uint32_t source_as() const
Definition: bgp_mvpn.cc:226
MvpnProjectManager * GetProjectManager()
Definition: bgp_mvpn.cc:525
void ProcessType4LeafADRoute(MvpnRoute *leaf_ad)
Definition: bgp_mvpn.cc:962
virtual void UpdateSecondaryTablesForReplication(MvpnRoute *rt, BgpTable::TableSet *secondary_tables) const
Definition: bgp_mvpn.cc:1178
RouteDistinguisher rd_
Definition: bgp_mvpn.h:68
UpdateInfo * GetType7UpdateInfo(MvpnRoute *route)
Definition: bgp_mvpn.cc:1237
MvpnTable * table()
Definition: bgp_mvpn.cc:498
MvpnRoute * route()
Definition: bgp_mvpn.cc:357
virtual void Initialize()
Definition: bgp_mvpn.cc:116
void RetryDelete()
Definition: lifetime.cc:71
void GetMvpnSourceAddress(ErmVpnRoute *ermvpn_route, Ip4Address *address) const
Definition: bgp_mvpn.cc:1209
const MvpnProjectManager * project_manager() const
Definition: bgp_mvpn.h:300
bool FindNeighbor(const RouteDistinguisher &rd, MvpnNeighbor *nbr) const
Definition: bgp_mvpn.cc:239
tbb::reader_writer_lock & neighbors_mutex()
Definition: bgp_mvpn.h:186
void FreePartitions()
Definition: bgp_mvpn.cc:463
const LifetimeActor * deleter() const
Definition: bgp_mvpn.cc:427
boost::intrusive_ptr< MvpnState > MvpnStatePtr
Definition: bgp_mvpn.h:39
BgpRoute * RouteReplicate(BgpServer *server, BgpTable *src_table, BgpRoute *source_rt, const BgpPath *src_path, ExtCommunityPtr comm)
PartitionList partitions_
Definition: bgp_mvpn.h:453
virtual ~MvpnState()
Definition: bgp_mvpn.cc:40
bool operator<(const SG &other) const
Definition: bgp_mvpn.cc:278
bool IsDeleted() const
Definition: lifetime.h:131
void RouteListener(DBEntryBase *db_entry)
Definition: bgp_mvpn.cc:766
bool operator==(const MvpnNeighbor &rhs) const
Definition: bgp_mvpn.cc:234
MvpnProjectManagerPartition(MvpnProjectManager *manager, int part_id)
Definition: bgp_mvpn.cc:179
boost::intrusive_ptr< const ExtCommunity > ExtCommunityPtr
Definition: community.h:448
std::map< SG, MvpnState * > StatesMap
Definition: bgp_mvpn.h:279
virtual ~MvpnManager()
Definition: bgp_mvpn.cc:408
bool MayDelete() const
Definition: bgp_mvpn.cc:471
std::set< BgpTable * > TableSet
Definition: bgp_table.h:38
void RouteListener(DBTablePartBase *tpart, DBEntryBase *db_entry)
Definition: bgp_mvpn.cc:660
bool GetForestNodePMSI(ErmVpnRoute *rt, uint32_t *label, Ip4Address *address, std::vector< std::string > *encap) const
Definition: bgp_mvpn.cc:589
const LifetimeActor * deleter() const
Definition: bgp_mvpn.cc:110
MvpnTable * table()
Definition: bgp_mvpn.cc:411
IpAddress source
Definition: bgp_mvpn.h:275
MvpnStatePtr GetState(const SG &sg)
Definition: bgp_mvpn.cc:209
MvpnState::StatesMap states_
Definition: bgp_mvpn.h:399
bool MayDelete() const
Definition: bgp_mvpn.cc:94
std::vector< MvpnManagerPartition * > PartitionList
Definition: bgp_mvpn.h:159
MvpnProjectManagerPartition * GetPartition(int part_id)
Definition: bgp_mvpn.cc:148
bool GetForestNodePMSI(ErmVpnRoute *rt, uint32_t *label, Ip4Address *address, std::vector< std::string > *encap) const
Definition: bgp_mvpn.cc:596
RoutesMap & leafad_routes_attr_received()
Definition: bgp_mvpn.cc:318
int refcount() const
Definition: bgp_mvpn.h:303
uint32_t source_as_
Definition: bgp_mvpn.h:70
int listener_id() const
Definition: bgp_mvpn.cc:529
StatesMap * states()
Definition: bgp_mvpn.h:295
DISALLOW_COPY_AND_ASSIGN(MvpnManagerPartition)
void ProcessType3SPMSIRoute(MvpnRoute *spmsi_rt)
Definition: bgp_mvpn.cc:1024
boost::asio::ip::address_v4 Ip4Address
Definition: address.h:14
UpdateInfo * GetUpdateInfo(MvpnRoute *route)
Definition: bgp_mvpn.cc:1244
size_t neighbors_count() const
Definition: bgp_mvpn.cc:256
void FreePartitions()
Definition: bgp_mvpn.cc:141
std::set< MvpnRoute * > RoutesSet
Definition: bgp_mvpn.h:263
MvpnStatePtr CreateState(const SG &sg)
Definition: bgp_mvpn.cc:188
friend void intrusive_ptr_add_ref(MvpnState *mvpn_state)
Definition: bgp_mvpn.h:462
void set_source_active_rt(MvpnRoute *source_active_rt)
Definition: bgp_mvpn.cc:342
void AllocPartitions()
Definition: bgp_mvpn.cc:458
bool deleted() const
Definition: bgp_mvpn.cc:423
MvpnStatePtr GetState(MvpnRoute *route)
Definition: bgp_mvpn.cc:556
void AllocPartitions()
Definition: bgp_mvpn.cc:136
void ResolvePath(RoutingInstance *rtinstance, BgpRoute *rt, BgpPath *path)
DISALLOW_COPY_AND_ASSIGN(MvpnState)
void set_route(MvpnRoute *route)
Definition: bgp_mvpn.cc:361
PartitionList::const_iterator const_iterator
Definition: bgp_mvpn.h:420
void ProcessType1ADRoute(MvpnRoute *route)
Definition: bgp_mvpn.cc:705
virtual void Terminate()
Definition: bgp_mvpn.cc:128
ErmVpnTable * table()
Definition: bgp_mvpn.cc:568
void ProcessType7SourceTreeJoinRoute(MvpnRoute *join_rt)
Definition: bgp_mvpn.cc:920
bool deleted() const
Definition: bgp_mvpn.cc:161
friend void intrusive_ptr_release(MvpnState *mvpn_state)
Definition: bgp_mvpn.h:470
NeighborMap neighbors_
Definition: bgp_mvpn.h:208
bool IsUsableGlobalTreeRootRoute(ErmVpnRoute *ermvpn_route) const
Definition: bgp_mvpn.cc:743
MvpnStatePtr LocateState(MvpnRoute *route)
Definition: bgp_mvpn.cc:537
void ManagedDelete()
Definition: bgp_mvpn.cc:454
void OriginateType1Route()
Definition: bgp_mvpn.cc:638
virtual ~MvpnProjectManager()
Definition: bgp_mvpn.cc:89
RoutesMap leafad_routes_attr_received_
Definition: bgp_mvpn.h:319
const StatesMap * states() const
Definition: bgp_mvpn.h:294
MvpnRoute * spmsi_rt()
Definition: bgp_mvpn.cc:302
void intrusive_ptr_release(const AsPath *cpath)
Definition: bgp_aspath.h:155
tbb::atomic< int > refcount_
Definition: bgp_mvpn.h:322
MvpnDBState(MvpnStatePtr state)
Definition: bgp_mvpn.cc:346
int identifier_listener_id_
Definition: bgp_mvpn.h:204
IpAddress group
Definition: bgp_mvpn.h:276
const ErmVpnTable * table() const
Definition: bgp_mvpn.cc:49
const SG & sg() const
Definition: bgp_mvpn.cc:290
MvpnState(const SG &sg, StatesMap *states, MvpnProjectManager *pm)
Definition: bgp_mvpn.cc:34
void ClearDBState(MvpnRoute *route)
Definition: bgp_mvpn.cc:488
const IpAddress & originator() const
Definition: bgp_mvpn.cc:230
int listener_id_
Definition: bgp_mvpn.h:203
ErmVpnTable * table_
Definition: bgp_mvpn.h:451
void NotifyForestNode(const Ip4Address &source, const Ip4Address &group)
Definition: bgp_mvpn.cc:582
ErmVpnTable * ermvpn_table_
Definition: bgp_mvpn.h:202
MvpnRoute * source_active_rt_
Definition: bgp_mvpn.h:317
PartitionList::const_iterator const_iterator
Definition: bgp_mvpn.h:160
IpAddress originator_
Definition: bgp_mvpn.h:69
MvpnProjectManager * project_manager()
Definition: bgp_mvpn.h:299
PartitionList partitions_
Definition: bgp_mvpn.h:206
std::map< MvpnRoute *, BgpAttrPtr > RoutesMap
Definition: bgp_mvpn.h:264
virtual ~MvpnManagerPartition()
Definition: bgp_mvpn.cc:510
int listener_id() const
Definition: bgp_mvpn.cc:419
MvpnProjectManager * manager_
Definition: bgp_mvpn.h:395
void set_state(MvpnStatePtr state)
Definition: bgp_mvpn.cc:365
SG(const Ip4Address &source, const Ip4Address &group)
Definition: bgp_mvpn.cc:261
void RouteListener(DBTablePartBase *tpart, DBEntryBase *db_entry)
Definition: bgp_mvpn.cc:757