OpenSDN source code
bgp_evpn.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014 Juniper Networks, Inc. All rights reserved.
3  */
4 
5 #ifndef SRC_BGP_BGP_EVPN_H_
6 #define SRC_BGP_BGP_EVPN_H_
7 
8 #include <boost/ptr_container/ptr_map.hpp>
9 #include <boost/scoped_ptr.hpp>
10 #include <tbb/spin_rw_mutex.h>
11 
12 #include <list>
13 #include <set>
14 #include <vector>
15 #include <atomic>
16 
17 #include "base/lifetime.h"
18 #include "base/task_trigger.h"
19 #include "base/address.h"
20 #include "bgp/bgp_attr.h"
21 #include "bgp/bgp_path.h"
22 #include "db/db_entry.h"
23 
24 class BgpPath;
25 class DBTablePartition;
26 class DBTablePartBase;
27 class EvpnRoute;
28 class ErmVpnRoute;
29 class EvpnState;
30 class EvpnTable;
31 class ErmVpnTable;
33 class EvpnManager;
34 class ShowEvpnTable;
35 struct UpdateInfo;
36 
37 typedef boost::intrusive_ptr<EvpnState> EvpnStatePtr;
38 
47 class EvpnMcastNode : public DBState {
48 public:
49  enum Type {
52  };
56  uint8_t type);
58  uint8_t type, EvpnStatePtr state);
60 
64 
70  virtual void TriggerUpdate() = 0;
71 
72  EvpnStatePtr state() { return state_; };
74  EvpnRoute *route() { return route_; }
75  uint8_t type() const { return type_; }
76  const BgpAttr *attr() const { return attr_.get(); }
77  uint32_t label() const { return label_; }
78  Ip4Address address() const { return address_; }
82  }
85  }
88  }
89 
90 protected:
94  uint8_t type_;
96  uint32_t label_;
102 
103 private:
105 };
106 
107 
126 public:
127 
138  virtual ~EvpnLocalMcastNode();
139 
145  virtual void TriggerUpdate();
146 
149 
150 private:
154 
157 
159 
161 };
162 
163 
172 public:
176  virtual ~EvpnRemoteMcastNode();
177 
179  virtual void TriggerUpdate();
180 
181 private:
183 };
184 
185 
203 class EvpnSegment : public DBState {
204 public:
205  EvpnSegment(EvpnManager *evpn_manager, const EthernetSegmentId &esi);
206  ~EvpnSegment();
207 
208  class RemotePe {
209  public:
210  RemotePe(const BgpPath *path);
211 
215  bool operator==(const RemotePe &rhs) const;
216 
217  bool esi_valid;
219  const IPeer *peer;
221  uint32_t flags;
223  };
224 
225  typedef std::list<RemotePe> RemotePeList;
226  typedef RemotePeList::const_iterator const_iterator;
227 
228  const_iterator begin() const { return pe_list_.begin(); }
229  const_iterator end() const { return pe_list_.end(); }
230 
232  void AddMacRoute(size_t part_id, EvpnRoute *route);
233 
237  void DeleteMacRoute(size_t part_id, EvpnRoute *route);
238 
242  void TriggerMacRouteUpdate();
243 
248  bool UpdatePeList();
249 
251  bool MayDelete() const;
252 
253  const EthernetSegmentId &esi() const { return esi_; }
257  }
259  bool single_active() const { return single_active_; }
260 
261 private:
262  typedef std::set<EvpnRoute *> RouteList;
263  typedef std::vector<RouteList> RouteListVector;
264 
271 
273 };
274 
275 
283 //
288 class EvpnMacState : public DBState {
289 public:
290  EvpnMacState(EvpnManager *evpn_manager, EvpnRoute *route);
291  ~EvpnMacState();
292 
297 
298  EvpnSegment *segment() { return segment_; }
299  const EvpnSegment *segment() const { return segment_; }
301  void clear_segment() { segment_ = NULL; }
302 
303 private:
304  typedef std::set<BgpPath *> AliasedPathList;
305 
308  void AddAliasedPath(AliasedPathList::const_iterator it);
309 
312  void DeleteAliasedPath(AliasedPathList::const_iterator it);
313 
316  uint32_t label);
317 
322 
324 };
325 
348 class EvpnState {
349 public:
350  typedef std::set<EvpnRoute *> RoutesSet;
351  typedef std::map<EvpnRoute *, BgpAttrPtr> RoutesMap;
352 
355  struct SG {
356  SG(const Ip4Address &source, const Ip4Address &group);
357  SG(const IpAddress &source, const IpAddress &group);
358  explicit SG(const ErmVpnRoute *route);
359  explicit SG(const EvpnRoute *route);
360  bool operator<(const SG &other) const;
361 
364  };
365 
366  typedef std::map<SG, EvpnState *> StatesMap;
367 
370 
371  virtual ~EvpnState();
372  const SG &sg() const;
374  const ErmVpnRoute *global_ermvpn_tree_rt() const;
377  const RoutesSet &smet_routes() const { return smet_routes_; }
378  const StatesMap *states() const { return states_; }
379  StatesMap *states() { return states_; }
380  EvpnManager *manager() { return manager_; }
381  const EvpnManager *manager() const { return manager_; }
382  int refcount() const { return refcount_; }
383 
384 private:
385  friend class EvpnMcastNode;
386  friend class EvpnManagerPartition;
387 
389  friend void intrusive_ptr_add_ref(EvpnState *evpn_state);
390 
395  friend void intrusive_ptr_release(EvpnState *evpn_state);
396 
397  const ErmVpnTable *table() const;
398 
404  std::atomic<int> refcount_;
405 
407 };
408 
409 
420 public:
421  typedef EvpnState::SG SG;
422  typedef std::map<SG, std::set<EvpnMcastNode *> > EvpnMcastNodeList;
423 
424  EvpnManagerPartition(EvpnManager *evpn_manager, size_t part_id);
426 
429 
431  void NotifyNodeRoute(EvpnMcastNode *node);
432 
436 
439  void NotifyIrClientNodeRoutes(bool exclude_edge_replication_supported);
440 
442  void AddMcastNode(EvpnMcastNode *node, EvpnRoute *route);
443 
445  void DeleteMcastNode(EvpnMcastNode *node, EvpnRoute *route);
446 
450  void UpdateMcastNode(EvpnMcastNode *node, EvpnRoute *route);
451 
454  EvpnMcastNodeList *list);
455 
459  void TriggerMacRouteUpdate(EvpnRoute *route);
460 
463  bool empty() const;
464 
467  }
469  return local_mcast_node_list_;
470  }
472  return leaf_node_list_;
473  }
475  return &remote_mcast_node_list_;
476  }
478  return &local_mcast_node_list_;
479  }
481  return &leaf_node_list_;
482  }
483 
485  BgpServer *server();
486 
488  const EvpnTable *table() const;
489 
490  size_t part_id() const { return part_id_; }
491 
492 private:
493  friend class EvpnManager;
494  friend class BgpEvpnManagerTest;
495 
496  typedef std::set<EvpnRoute *> EvpnRouteList;
497 
499  bool ProcessMacUpdateList();
500 
504 
508 
509  EvpnStatePtr GetState(const SG &sg);
510  EvpnStatePtr GetState(const SG &sg) const;
513  EvpnStatePtr LocateState(const SG &sg);
514  EvpnStatePtr CreateState(const SG &sg);
515  const EvpnState::StatesMap &states() const { return states_; }
517  bool GetForestNodeAddress(ErmVpnRoute *rt, Ip4Address *address) const;
519 
521  size_t part_id_;
531  boost::scoped_ptr<TaskTrigger> mac_update_trigger_;
532 
534 };
535 
536 
579 class EvpnManager {
580 public:
581  explicit EvpnManager(EvpnTable *table);
582  virtual ~EvpnManager();
583 
586  virtual void Initialize();
587 
590  virtual void Terminate();
591 
594  virtual UpdateInfo *GetUpdateInfo(EvpnRoute *route);
595 
597  EvpnManagerPartition *GetPartition(size_t part_id);
598 
600  DBTablePartition *GetTablePartition(size_t part_id);
601 
604  void FillShowInfo(ShowEvpnTable *sevt) const;
605 
606  BgpServer *server();
607  EvpnTable *table() { return table_; }
608  const EvpnTable *table() const { return table_; }
610  const ErmVpnTable *ermvpn_table() const { return ermvpn_table_; }
611  int listener_id() const { return listener_id_; }
612  int ermvpn_listener_id() const { return ermvpn_listener_id_; }
613 
616 
619 
628  void TriggerSegmentDelete(EvpnSegment *segment);
629 
638  void TriggerSegmentUpdate(EvpnSegment *segment);
639 
642  void ManagedDelete();
643 
645  void Shutdown();
646 
649  bool MayDelete() const;
650 
652  void RetryDelete();
653 
656 
657 private:
658  friend class BgpEvpnManagerTest;
659  friend class BgpEvpnAliasingTest;
660 
661  class DeleteActor;
662  typedef std::vector<EvpnManagerPartition *> PartitionList;
663  typedef boost::ptr_map<const EthernetSegmentId, EvpnSegment> SegmentMap;
664  typedef std::set<EvpnSegment *> SegmentSet;
665 
667  void AllocPartitions();
668 
670  void FreePartitions();
671 
674 
677  EvpnRoute *route);
678 
681  EvpnRoute *route);
682 
685  EvpnRoute *route);
686 
688  void RouteListener(DBTablePartBase *tpart, DBEntryBase *db_entry);
689 
693  void ErmVpnRouteListener(DBTablePartBase *tpart, DBEntryBase *db_entry);
694 
699 
705 
707  bool IsUsableGlobalTreeRootRoute(ErmVpnRoute *ermvpn_route) const;
708 
712 
716 
720 
724 
728 
732 
734  void SetDBState(EvpnRoute *route, EvpnMcastNode *dbstate);
735 
738  void ClearDBState(EvpnRoute *route);
739 
744  std::atomic<int> db_states_count_;
746  tbb::spin_rw_mutex segment_rw_mutex_;
750  boost::scoped_ptr<TaskTrigger> segment_delete_trigger_;
751  boost::scoped_ptr<TaskTrigger> segment_update_trigger_;
752 
753  boost::scoped_ptr<DeleteActor> deleter_;
755 
757 };
758 
760 inline void intrusive_ptr_add_ref(EvpnState *evpn_state) {
761  evpn_state->refcount_.fetch_add(1);
762 }
763 
768 inline void intrusive_ptr_release(EvpnState *evpn_state) {
769  int prev = evpn_state->refcount_.fetch_sub(1);
770  if (prev > 1)
771  return;
772  if (evpn_state->states()) {
773  EvpnState::StatesMap::iterator iter =
774  evpn_state->states()->find(evpn_state->sg());
775  if (iter != evpn_state->states()->end()) {
776  assert(iter->second == evpn_state);
777  evpn_state->states()->erase(iter);
778 
779  // Attempt project manager deletion as it could be held up due to
780  // this map being non-empty so far..
781  if (evpn_state->manager()->deleter()->IsDeleted())
782  evpn_state->manager()->deleter()->RetryDelete();
783  }
784  }
785  delete evpn_state;
786 }
787 
788 #define EVPN_RT_LOG(rt, ...) \
789  RTINSTANCE_LOG(EvpnRoute, this->table()->routing_instance(), \
790  SandeshLevel::UT_DEBUG, \
791  RTINSTANCE_LOG_FLAG_ALL, \
792  (rt)->GetPrefix().source().to_string(), \
793  (rt)->GetPrefix().group().to_string(), \
794  (rt)->ToString(), ##__VA_ARGS__)
795 
796 #define EVPN_ERMVPN_RT_LOG(rt, ...) \
797  RTINSTANCE_LOG(EvpnErmVpnRoute, this->table()->routing_instance(), \
798  SandeshLevel::UT_DEBUG, \
799  RTINSTANCE_LOG_FLAG_ALL, \
800  (rt)->GetPrefix().source().to_string(), \
801  (rt)->GetPrefix().group().to_string(), \
802  (rt)->ToString(), ##__VA_ARGS__)
803 
804 #define EVPN_TRACE(type, ...) \
805  RTINSTANCE_LOG(type, this->table()->routing_instance(), \
806  SandeshLevel::UT_DEBUG, RTINSTANCE_LOG_FLAG_ALL, ##__VA_ARGS__)
807 
808 #endif // SRC_BGP_BGP_EVPN_H_
boost::asio::ip::address IpAddress
Definition: address.h:13
boost::asio::ip::address_v4 Ip4Address
Definition: address.h:14
boost::intrusive_ptr< const BgpAttr > BgpAttrPtr
Definition: bgp_attr.h:997
void intrusive_ptr_release(EvpnState *evpn_state)
Decrement refcount of an evpn_state. If the refcount falls to 1, it implies that there is no more ref...
Definition: bgp_evpn.h:768
void intrusive_ptr_add_ref(EvpnState *evpn_state)
Increment refcont atomically.
Definition: bgp_evpn.h:760
boost::intrusive_ptr< EvpnState > EvpnStatePtr
Definition: bgp_evpn.h:35
PathSource
Definition: bgp_path.h:37
This class represents (in the context of an EVPN instance) a local vRouter that's connected to a cont...
Definition: bgp_evpn.h:125
virtual ~EvpnLocalMcastNode()
Definition: bgp_evpn.cc:206
EvpnRoute * inclusive_mcast_route_
Definition: bgp_evpn.h:158
EvpnLocalMcastNode(EvpnManagerPartition *partition, EvpnRoute *route)
Constructor for EvpnLocalMcastNode.
Definition: bgp_evpn.cc:183
UpdateInfo * GetUpdateInfo(EvpnRoute *route)
Definition: bgp_evpn.cc:302
virtual void TriggerUpdate()
Handle update of EvpnLocalMcastNode.
Definition: bgp_evpn.cc:288
void DeleteInclusiveMulticastRoute()
Delete Inclusive Multicast route for this EvpnLocalMcastNode.
Definition: bgp_evpn.cc:262
EvpnRoute * inclusive_mcast_route()
Definition: bgp_evpn.h:148
DISALLOW_COPY_AND_ASSIGN(EvpnLocalMcastNode)
void AddInclusiveMulticastRoute()
Add Inclusive Multicast route for this EvpnLocalMcastNode. The attributes are based on the Broadcast ...
Definition: bgp_evpn.cc:214
This class represents the EvpnManager state associated with a MAC route.
Definition: bgp_evpn.h:288
BgpPath * LocateAliasedPath(const EvpnSegment::RemotePe *remote_pe, uint32_t label)
Find or create the matching aliased BgpPath.
Definition: bgp_evpn.cc:637
EvpnRoute * route_
Definition: bgp_evpn.h:319
void clear_segment()
Definition: bgp_evpn.h:301
std::set< BgpPath * > AliasedPathList
Definition: bgp_evpn.h:304
void set_segment(EvpnSegment *segment)
Definition: bgp_evpn.h:300
void DeleteAliasedPath(AliasedPathList::const_iterator it)
Delete the BgpPath specified by the iterator from the aliased path list. Also deletes the BgpPath fro...
Definition: bgp_evpn.cc:621
bool ProcessMacRouteAliasing()
Update aliased BgpPaths for the EvpnRoute based on the remote PEs for the EvpnSegment....
Definition: bgp_evpn.cc:662
EvpnSegment * segment_
Definition: bgp_evpn.h:320
void AddAliasedPath(AliasedPathList::const_iterator it)
Add the BgpPath specified by the iterator to the aliased path list. Also inserts the BgpPath to the B...
Definition: bgp_evpn.cc:604
DISALLOW_COPY_AND_ASSIGN(EvpnMacState)
const EvpnSegment * segment() const
Definition: bgp_evpn.h:299
EvpnMacState(EvpnManager *evpn_manager, EvpnRoute *route)
Definition: bgp_evpn.cc:588
EvpnManager * evpn_manager_
Definition: bgp_evpn.h:318
AliasedPathList aliased_path_list_
Definition: bgp_evpn.h:321
EvpnSegment * segment()
Definition: bgp_evpn.h:298
This class represents a partition in the EvpnManager.
Definition: bgp_evpn.h:419
size_t part_id() const
Definition: bgp_evpn.h:490
void NotifyIrClientNodeRoutes(bool exclude_edge_replication_supported)
Go through all ingress replication client EvpnMcastNodes and notify the associated Broadcast MAC rout...
Definition: bgp_evpn.cc:762
EvpnState::StatesMap & states()
Definition: bgp_evpn.h:516
EvpnState::SG SG
Definition: bgp_evpn.h:421
const EvpnMcastNodeList & leaf_node_list() const
Definition: bgp_evpn.h:471
std::map< SG, std::set< EvpnMcastNode * > > EvpnMcastNodeList
Definition: bgp_evpn.h:422
void NotifyReplicatorNodeRoutes()
Go through all replicator EvpnMcastNodes and notify associated Broadcast MAC route.
Definition: bgp_evpn.cc:749
std::set< EvpnRoute * > EvpnRouteList
Definition: bgp_evpn.h:496
DISALLOW_COPY_AND_ASSIGN(EvpnManagerPartition)
void TriggerMacRouteUpdate(EvpnRoute *route)
Add the given MAC route to the update list. This method gets called either when the MAC route itself ...
Definition: bgp_evpn.cc:884
EvpnManagerPartition(EvpnManager *evpn_manager, size_t part_id)
Definition: bgp_evpn.cc:710
EvpnMcastNodeList leaf_node_list_
Definition: bgp_evpn.h:527
EvpnMcastNodeList local_mcast_node_list_
Definition: bgp_evpn.h:524
bool RemoveMcastNodeFromList(EvpnState::SG &sg, EvpnMcastNode *node, EvpnMcastNodeList *list)
Delete an EvpnMcastNode from the EvpnManagerPartition.
Definition: bgp_evpn.cc:807
bool ProcessMacUpdateList()
Process the MAC route update list for this EvpnManagerPartition.
Definition: bgp_evpn.cc:894
void UpdateMcastNode(EvpnMcastNode *node, EvpnRoute *route)
Update an EvpnMcastNode in the EvpnManagerPartition. Need to remove/add EvpnMcastNode from the replic...
Definition: bgp_evpn.cc:850
EvpnManager * evpn_manager_
Definition: bgp_evpn.h:520
EvpnState::StatesMap states_
Definition: bgp_evpn.h:522
void AddMcastNode(EvpnMcastNode *node, EvpnRoute *route)
Add an EvpnMcastNode to the EvpnManagerPartition.
Definition: bgp_evpn.cc:780
EvpnMcastNodeList * remote_mcast_node_list()
Definition: bgp_evpn.h:474
EvpnRouteList mac_update_list_
Definition: bgp_evpn.h:530
friend class BgpEvpnManagerTest
Definition: bgp_evpn.h:494
void NotifyNodeRoute(EvpnMcastNode *node)
Notify the Broadcast MAC route for the given EvpnMcastNode.
Definition: bgp_evpn.cc:740
EvpnMcastNodeList replicator_node_list_
Definition: bgp_evpn.h:526
void EnableMacUpdateProcessing()
Enable processing of the update list. For testing only.
Definition: bgp_evpn.cc:992
EvpnMcastNodeList regular_node_list_
Definition: bgp_evpn.h:528
boost::scoped_ptr< TaskTrigger > mac_update_trigger_
Definition: bgp_evpn.h:531
EvpnStatePtr GetState(const SG &sg)
Definition: bgp_evpn.cc:947
void DisableMacUpdateProcessing()
Disable processing of the update list. For testing only.
Definition: bgp_evpn.cc:984
void NotifyForestNode(EvpnRoute *route, ErmVpnTable *table)
Definition: bgp_evpn.cc:1484
EvpnMcastNodeList ir_client_node_list_
Definition: bgp_evpn.h:529
bool GetForestNodeAddress(ErmVpnRoute *rt, Ip4Address *address) const
Definition: bgp_evpn.cc:932
EvpnStatePtr CreateState(const SG &sg)
Definition: bgp_evpn.cc:958
DBTablePartition * GetTablePartition()
Get the DBTablePartition for the EvpnTable for our partition id.
Definition: bgp_evpn.cc:733
DBTablePartition * table_partition_
Definition: bgp_evpn.h:522
void DeleteMcastNode(EvpnMcastNode *node, EvpnRoute *route)
Delete an EvpnMcastNode from the EvpnManagerPartition.
Definition: bgp_evpn.cc:822
const EvpnState::StatesMap & states() const
Definition: bgp_evpn.h:515
const EvpnMcastNodeList & local_mcast_node_list() const
Definition: bgp_evpn.h:468
const EvpnMcastNodeList & remote_mcast_node_list() const
Definition: bgp_evpn.h:465
bool empty() const
Return true if the EvpnManagerPartition is empty i.e. it has no local or remote EvpnMcastNodes and no...
Definition: bgp_evpn.cc:1000
BgpServer * server()
Return the BgpServer for the EvpnManagerPartition.
Definition: bgp_evpn.cc:1017
EvpnMcastNodeList remote_mcast_node_list_
Definition: bgp_evpn.h:525
EvpnMcastNodeList * leaf_node_list()
Definition: bgp_evpn.h:480
EvpnStatePtr LocateState(EvpnRoute *route)
Definition: bgp_evpn.cc:974
const EvpnTable * table() const
Return the EvpnTable for the EvpnManagerPartition.
Definition: bgp_evpn.cc:1024
EvpnMcastNodeList * local_mcast_node_list()
Definition: bgp_evpn.h:477
This class represents the EVPN manager for an EvpnTable in a VRF.
Definition: bgp_evpn.h:579
void ErmVpnRouteListener(DBTablePartBase *tpart, DBEntryBase *db_entry)
ErmVpnTable route listener callback function.
Definition: bgp_evpn.cc:1530
void RouteListener(DBTablePartBase *tpart, DBEntryBase *db_entry)
DBListener callback handler for the EvpnTable.
Definition: bgp_evpn.cc:1596
bool ProcessSegmentUpdateSet()
Process the set of EvpnSegments that need to be updated.
Definition: bgp_evpn.cc:1259
LifetimeActor * deleter()
Return the LifetimeActor for the EvpnManager.
Definition: bgp_evpn.cc:1718
ErmVpnTable * ermvpn_table_
Definition: bgp_evpn.h:741
void Shutdown()
Initiate shutdown for the EvpnManager.
Definition: bgp_evpn.cc:1694
SegmentMap segment_map_
Definition: bgp_evpn.h:747
void DisableMacUpdateProcessing()
Disable processing of the update lists in all partitions. For testing only.
Definition: bgp_evpn.cc:1106
friend class BgpEvpnAliasingTest
Definition: bgp_evpn.h:659
SegmentSet segment_delete_set_
Definition: bgp_evpn.h:748
EvpnManager(EvpnTable *table)
Definition: bgp_evpn.cc:1031
void AllocPartitions()
Allocate the EvpnManagerPartitions.
Definition: bgp_evpn.cc:1089
std::set< EvpnSegment * > SegmentSet
Definition: bgp_evpn.h:664
virtual UpdateInfo * GetUpdateInfo(EvpnRoute *route)
Construct export state for the given EvpnRoute. Note that the route only needs to be exported to the ...
Definition: bgp_evpn.cc:1140
boost::ptr_map< const EthernetSegmentId, EvpnSegment > SegmentMap
Definition: bgp_evpn.h:663
int ermvpn_listener_id() const
Definition: bgp_evpn.h:612
int listener_id_
Definition: bgp_evpn.h:742
void RetryDelete()
Attempt to enqueue a delete for the EvpnManager.
Definition: bgp_evpn.cc:1709
boost::scoped_ptr< TaskTrigger > segment_delete_trigger_
Definition: bgp_evpn.h:750
EvpnTable * table_
Definition: bgp_evpn.h:740
EvpnSegment * FindSegment(const EthernetSegmentId &esi)
Find the EvpnSegment for the given EthernetSegmentId.
Definition: bgp_evpn.cc:1175
void DisableSegmentUpdateProcessing()
Disable processing of the update list. For testing only.
Definition: bgp_evpn.cc:1282
LifetimeRef< EvpnManager > table_delete_ref_
Definition: bgp_evpn.h:754
virtual void Initialize()
Initialize the EvpnManager. We allocate the EvpnManagerPartitions and register a DBListener for the E...
Definition: bgp_evpn.cc:1058
bool MayDelete() const
Trigger deletion of the EvpnManager and propagate the delete to any dependents.
Definition: bgp_evpn.cc:1664
void TriggerSegmentDelete(EvpnSegment *segment)
Trigger deletion of the given EvpnSegment. The EvpnSegment is added to a set of EvpnSegments that can...
Definition: bgp_evpn.cc:1192
EvpnManagerPartition * GetPartition(size_t part_id)
Get the EvpnManagerPartition for the given partition id.
Definition: bgp_evpn.cc:1125
ErmVpnTable * ermvpn_table()
Definition: bgp_evpn.h:609
const ErmVpnTable * ermvpn_table() const
Definition: bgp_evpn.h:610
void MacAdvertisementRouteListener(EvpnManagerPartition *partition, EvpnRoute *route)
DBListener callback handler for MacAdvertisement routes in the EvpnTable.
Definition: bgp_evpn.cc:1326
boost::scoped_ptr< DeleteActor > deleter_
Definition: bgp_evpn.h:753
SegmentSet segment_update_set_
Definition: bgp_evpn.h:749
EvpnSegment * LocateSegment(const EthernetSegmentId &esi)
Find or create the EvpnSegment for the given EthernetSegmentId.
Definition: bgp_evpn.cc:1160
PartitionList partitions_
Definition: bgp_evpn.h:745
void FillShowInfo(ShowEvpnTable *sevt) const
Fill information for introspect command. Note that all IM routes are always in partition 0.
Definition: bgp_evpn.cc:1629
friend class BgpEvpnManagerTest
Definition: bgp_evpn.h:658
void FreePartitions()
Free the EvpnManagerPartitions.
Definition: bgp_evpn.cc:1098
void InclusiveMulticastRouteListener(EvpnManagerPartition *partition, EvpnRoute *route)
DBListener callback handler for InclusiveMulticast routes in the EvpnTable.
Definition: bgp_evpn.cc:1384
bool ProcessSegmentDeleteSet()
Process the set of EvpnSegments that can potentially be deleted. Remove the EvpnSegment from the map ...
Definition: bgp_evpn.cc:1205
void AutoDiscoveryRouteListener(EvpnRoute *route)
DBListener callback handler for AutoDisocvery routes in the EvpnTable.
Definition: bgp_evpn.cc:1297
void EnableMacUpdateProcessing()
Enable processing of the update lists in all partitions. For testing only.
Definition: bgp_evpn.cc:1116
virtual void Terminate()
Terminate the EvpnManager. We free the EvpnManagerPartitions and unregister from the EvpnTable.
Definition: bgp_evpn.cc:1075
boost::scoped_ptr< TaskTrigger > segment_update_trigger_
Definition: bgp_evpn.h:751
void SelectiveMulticastRouteListener(EvpnManagerPartition *partition, EvpnRoute *route)
DBListener callback handler for SelectiveMulticast routes in the EvpnTable.
Definition: bgp_evpn.cc:1423
void SetDBState(EvpnRoute *route, EvpnMcastNode *dbstate)
Set DB State and update count.
Definition: bgp_evpn.cc:1493
void ClearDBState(EvpnRoute *route)
Create DB State and update count. If there is no DB State associated in the table,...
Definition: bgp_evpn.cc:1500
void TriggerSegmentUpdate(EvpnSegment *segment)
Trigger update of the given EvpnSegment. The EvpnSegment is added to a set of EvpnSegments for which ...
Definition: bgp_evpn.cc:1246
const EvpnTable * table() const
Definition: bgp_evpn.h:608
BgpServer * server()
Definition: bgp_evpn.cc:1153
void EnableSegmentUpdateProcessing()
Enable processing of the update list. For testing only.
Definition: bgp_evpn.cc:1290
DBTablePartition * GetTablePartition(size_t part_id)
Get the DBTablePartition for the EvpnTable for given partition id.
Definition: bgp_evpn.cc:1132
int listener_id() const
Definition: bgp_evpn.h:611
int ermvpn_listener_id_
Definition: bgp_evpn.h:743
void DisableSegmentDeleteProcessing()
Disable processing of the delete list. For testing only.
Definition: bgp_evpn.cc:1224
std::atomic< int > db_states_count_
Definition: bgp_evpn.h:744
bool IsUsableGlobalTreeRootRoute(ErmVpnRoute *ermvpn_route) const
Check whether an ErmVpnRoute is locally originated GlobalTreeRoute.
Definition: bgp_evpn.cc:1511
void ManagedDelete()
Trigger deletion of the EvpnManager and propagate the delete to any dependents.
Definition: bgp_evpn.cc:1702
tbb::spin_rw_mutex segment_rw_mutex_
Definition: bgp_evpn.h:746
DISALLOW_COPY_AND_ASSIGN(EvpnManager)
virtual ~EvpnManager()
Definition: bgp_evpn.cc:1048
std::vector< EvpnManagerPartition * > PartitionList
Definition: bgp_evpn.h:661
EvpnTable * table()
Definition: bgp_evpn.h:607
void EnableSegmentDeleteProcessing()
Enable processing of the delete list. For testing only.
Definition: bgp_evpn.cc:1232
This is the base class for a multicast node in an EVPN instance. The node could either represent a lo...
Definition: bgp_evpn.h:47
DISALLOW_COPY_AND_ASSIGN(EvpnMcastNode)
uint32_t label() const
Definition: bgp_evpn.h:77
bool edge_replication_not_supported_
Definition: bgp_evpn.h:99
EvpnStatePtr state()
Definition: bgp_evpn.h:72
uint8_t type() const
Definition: bgp_evpn.h:75
bool assisted_replication_leaf() const
Definition: bgp_evpn.h:86
bool assisted_replication_supported() const
Definition: bgp_evpn.h:83
Ip4Address replicator_address_
Definition: bgp_evpn.h:98
EvpnMcastNode(EvpnManagerPartition *partition, EvpnRoute *route, uint8_t type)
Constructor for EvpnMcastNode. The type indicates whether this is a local or remote EvpnMcastNode.
Definition: bgp_evpn.cc:79
bool assisted_replication_supported_
Definition: bgp_evpn.h:100
BgpAttrPtr attr_
Definition: bgp_evpn.h:95
EvpnStatePtr state_
Definition: bgp_evpn.h:92
uint32_t label_
Definition: bgp_evpn.h:96
EvpnManagerPartition * partition_
Definition: bgp_evpn.h:91
Ip4Address address_
Definition: bgp_evpn.h:97
void set_state(EvpnStatePtr state)
Definition: bgp_evpn.h:73
Ip4Address address() const
Definition: bgp_evpn.h:78
bool edge_replication_not_supported() const
Definition: bgp_evpn.h:80
bool assisted_replication_leaf_
Definition: bgp_evpn.h:101
virtual void TriggerUpdate()=0
Handle update of EvpnLocalMcastNode.
uint8_t type_
Definition: bgp_evpn.h:94
EvpnRoute * route_
Definition: bgp_evpn.h:93
EvpnRoute * route()
Definition: bgp_evpn.h:74
bool UpdateAttributes(EvpnRoute *route)
Update the label and attributes for a EvpnMcastNode. Return true if either of them changed.
Definition: bgp_evpn.cc:117
const BgpAttr * attr() const
Definition: bgp_evpn.h:76
Ip4Address replicator_address() const
Definition: bgp_evpn.h:79
This class represents (in the context of an EVPN instance) a remote vRouter or PE discovered via BGP....
Definition: bgp_evpn.h:171
EvpnRemoteMcastNode(EvpnManagerPartition *partition, EvpnRoute *route)
Definition: bgp_evpn.cc:375
DISALLOW_COPY_AND_ASSIGN(EvpnRemoteMcastNode)
virtual ~EvpnRemoteMcastNode()
Definition: bgp_evpn.cc:388
virtual void TriggerUpdate()
Handle update of EvpnRemoteMcastNode.
Definition: bgp_evpn.cc:394
bool operator==(const RemotePe &rhs) const
Equality operator for EvpnSegment::RemotePe. Do not compare esi_valid and single_active fields since ...
Definition: bgp_evpn.cc:573
const IPeer * peer
Definition: bgp_evpn.h:219
BgpPath::PathSource src
Definition: bgp_evpn.h:222
RemotePe(const BgpPath *path)
Definition: bgp_evpn.cc:559
This class represents a remote EVPN segment that has 2 or more PEs that are multi-homed to it....
Definition: bgp_evpn.h:203
EvpnRoute * esi_ad_route()
Definition: bgp_evpn.h:254
DISALLOW_COPY_AND_ASSIGN(EvpnSegment)
EvpnRoute * esi_ad_route_
Definition: bgp_evpn.h:267
void DeleteMacRoute(size_t part_id, EvpnRoute *route)
Delete the given MAC route as a dependent of this EvpnSegment. Trigger deletion of the EvpnSegment if...
Definition: bgp_evpn.cc:429
const_iterator begin() const
Definition: bgp_evpn.h:228
void AddMacRoute(size_t part_id, EvpnRoute *route)
Add the given MAC route as a dependent of this EvpnSegment.
Definition: bgp_evpn.cc:419
void set_esi_ad_route(EvpnRoute *esi_ad_route)
Definition: bgp_evpn.h:255
RouteListVector route_lists_
Definition: bgp_evpn.h:269
std::vector< RouteList > RouteListVector
Definition: bgp_evpn.h:263
EvpnManager * evpn_manager_
Definition: bgp_evpn.h:265
EvpnSegment(EvpnManager *evpn_manager, const EthernetSegmentId &esi)
Definition: bgp_evpn.cc:400
std::set< EvpnRoute * > RouteList
Definition: bgp_evpn.h:262
const EthernetSegmentId & esi() const
Definition: bgp_evpn.h:253
bool MayDelete() const
Return true if it's safe to delete this EvpnSegment.
Definition: bgp_evpn.cc:540
bool single_active() const
Definition: bgp_evpn.h:259
EthernetSegmentId esi_
Definition: bgp_evpn.h:266
std::list< RemotePe > RemotePeList
Definition: bgp_evpn.h:225
bool single_active_
Definition: bgp_evpn.h:268
bool UpdatePeList()
Update the PE list for this EvpnSegment. This should be called when the AutoDisocvery route is update...
Definition: bgp_evpn.cc:458
void TriggerMacRouteUpdate()
Trigger an update of all dependent MAC routes for this EvpnSegment. Note that the bgp::EvpnSegment ta...
Definition: bgp_evpn.cc:441
const_iterator end() const
Definition: bgp_evpn.h:229
RemotePeList::const_iterator const_iterator
Definition: bgp_evpn.h:226
void clear_esi_ad_route()
Definition: bgp_evpn.h:258
RemotePeList pe_list_
Definition: bgp_evpn.h:270
This class holds Evpn state for a particular <S,G> at any given time.
Definition: bgp_evpn.h:348
const SG & sg() const
Definition: bgp_evpn.cc:1751
friend void intrusive_ptr_release(EvpnState *evpn_state)
Decrement refcount of an evpn_state. If the refcount falls to 1, it implies that there is no more ref...
Definition: bgp_evpn.h:768
RoutesSet & smet_routes()
Definition: bgp_evpn.h:376
const ErmVpnTable * table() const
Definition: bgp_evpn.cc:45
void set_global_ermvpn_tree_rt(ErmVpnRoute *global_ermvpn_tree_rt)
Definition: bgp_evpn.cc:1755
RoutesSet smet_routes_
Definition: bgp_evpn.h:401
int refcount() const
Definition: bgp_evpn.h:382
const RoutesSet & smet_routes() const
Definition: bgp_evpn.h:377
friend void intrusive_ptr_add_ref(EvpnState *evpn_state)
Increment refcont atomically.
Definition: bgp_evpn.h:760
std::set< EvpnRoute * > RoutesSet
Definition: bgp_evpn.h:350
EvpnManager * manager()
Definition: bgp_evpn.h:380
EvpnState(const SG &sg, StatesMap *states, EvpnManager *manager)
A global MVPN state for a given <S.G> within a EvpnProjectManager.
Definition: bgp_evpn.cc:34
const StatesMap * states() const
Definition: bgp_evpn.h:378
ErmVpnRoute * global_ermvpn_tree_rt_
Definition: bgp_evpn.h:400
EvpnManager * manager_
Definition: bgp_evpn.h:403
const EvpnManager * manager() const
Definition: bgp_evpn.h:381
StatesMap * states()
Definition: bgp_evpn.h:379
ErmVpnRoute * global_ermvpn_tree_rt()
Definition: bgp_evpn.cc:1759
DISALLOW_COPY_AND_ASSIGN(EvpnState)
std::map< EvpnRoute *, BgpAttrPtr > RoutesMap
Definition: bgp_evpn.h:351
virtual ~EvpnState()
Definition: bgp_evpn.cc:40
StatesMap * states_
Definition: bgp_evpn.h:402
std::atomic< int > refcount_
Definition: bgp_evpn.h:404
std::map< SG, EvpnState * > StatesMap
Definition: bgp_evpn.h:366
Definition: ipeer.h:186
bool IsDeleted() const
Definition: lifetime.h:131
void RetryDelete()
Definition: lifetime.cc:73
Simple structure to hold <S,G>. Source as "0.0.0.0" can be used to encode <*,G> as well.
Definition: bgp_evpn.h:355
IpAddress group
Definition: bgp_evpn.h:363
bool operator<(const SG &other) const
Definition: bgp_evpn.cc:1739
IpAddress source
Definition: bgp_evpn.h:362
SG(const Ip4Address &source, const Ip4Address &group)
Definition: bgp_evpn.cc:1722