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 
16 #include "base/lifetime.h"
17 #include "base/task_trigger.h"
18 #include "base/address.h"
19 #include "bgp/bgp_attr.h"
20 #include "bgp/bgp_path.h"
21 #include "db/db_entry.h"
22 
23 class BgpPath;
24 class DBTablePartition;
25 class DBTablePartBase;
26 class EvpnRoute;
27 class ErmVpnRoute;
28 class EvpnState;
29 class EvpnTable;
30 class ErmVpnTable;
32 class EvpnManager;
33 class ShowEvpnTable;
34 struct UpdateInfo;
35 
36 typedef boost::intrusive_ptr<EvpnState> EvpnStatePtr;
37 
46 class EvpnMcastNode : public DBState {
47 public:
48  enum Type {
51  };
55  uint8_t type);
57  uint8_t type, EvpnStatePtr state);
59 
63 
69  virtual void TriggerUpdate() = 0;
70 
71  EvpnStatePtr state() { return state_; };
73  EvpnRoute *route() { return route_; }
74  uint8_t type() const { return type_; }
75  const BgpAttr *attr() const { return attr_.get(); }
76  uint32_t label() const { return label_; }
77  Ip4Address address() const { return address_; }
81  }
84  }
87  }
88 
89 protected:
93  uint8_t type_;
95  uint32_t label_;
101 
102 private:
104 };
105 
106 
125 public:
126 
137  virtual ~EvpnLocalMcastNode();
138 
144  virtual void TriggerUpdate();
145 
148 
149 private:
153 
156 
158 
160 };
161 
162 
171 public:
175  virtual ~EvpnRemoteMcastNode();
176 
178  virtual void TriggerUpdate();
179 
180 private:
182 };
183 
184 
202 class EvpnSegment : public DBState {
203 public:
204  EvpnSegment(EvpnManager *evpn_manager, const EthernetSegmentId &esi);
205  ~EvpnSegment();
206 
207  class RemotePe {
208  public:
209  RemotePe(const BgpPath *path);
210 
214  bool operator==(const RemotePe &rhs) const;
215 
216  bool esi_valid;
218  const IPeer *peer;
220  uint32_t flags;
222  };
223 
224  typedef std::list<RemotePe> RemotePeList;
225  typedef RemotePeList::const_iterator const_iterator;
226 
227  const_iterator begin() const { return pe_list_.begin(); }
228  const_iterator end() const { return pe_list_.end(); }
229 
231  void AddMacRoute(size_t part_id, EvpnRoute *route);
232 
236  void DeleteMacRoute(size_t part_id, EvpnRoute *route);
237 
241  void TriggerMacRouteUpdate();
242 
247  bool UpdatePeList();
248 
250  bool MayDelete() const;
251 
252  const EthernetSegmentId &esi() const { return esi_; }
256  }
258  bool single_active() const { return single_active_; }
259 
260 private:
261  typedef std::set<EvpnRoute *> RouteList;
262  typedef std::vector<RouteList> RouteListVector;
263 
270 
272 };
273 
274 
282 //
287 class EvpnMacState : public DBState {
288 public:
289  EvpnMacState(EvpnManager *evpn_manager, EvpnRoute *route);
290  ~EvpnMacState();
291 
296 
297  EvpnSegment *segment() { return segment_; }
298  const EvpnSegment *segment() const { return segment_; }
300  void clear_segment() { segment_ = NULL; }
301 
302 private:
303  typedef std::set<BgpPath *> AliasedPathList;
304 
307  void AddAliasedPath(AliasedPathList::const_iterator it);
308 
311  void DeleteAliasedPath(AliasedPathList::const_iterator it);
312 
315  uint32_t label);
316 
321 
323 };
324 
347 class EvpnState {
348 public:
349  typedef std::set<EvpnRoute *> RoutesSet;
350  typedef std::map<EvpnRoute *, BgpAttrPtr> RoutesMap;
351 
354  struct SG {
355  SG(const Ip4Address &source, const Ip4Address &group);
356  SG(const IpAddress &source, const IpAddress &group);
357  explicit SG(const ErmVpnRoute *route);
358  explicit SG(const EvpnRoute *route);
359  bool operator<(const SG &other) const;
360 
363  };
364 
365  typedef std::map<SG, EvpnState *> StatesMap;
366 
369 
370  virtual ~EvpnState();
371  const SG &sg() const;
373  const ErmVpnRoute *global_ermvpn_tree_rt() const;
376  const RoutesSet &smet_routes() const { return smet_routes_; }
377  const StatesMap *states() const { return states_; }
378  StatesMap *states() { return states_; }
379  EvpnManager *manager() { return manager_; }
380  const EvpnManager *manager() const { return manager_; }
381  int refcount() const { return refcount_; }
382 
383 private:
384  friend class EvpnMcastNode;
385  friend class EvpnManagerPartition;
386 
388  friend void intrusive_ptr_add_ref(EvpnState *evpn_state);
389 
394  friend void intrusive_ptr_release(EvpnState *evpn_state);
395 
396  const ErmVpnTable *table() const;
397 
403  tbb::atomic<int> refcount_;
404 
406 };
407 
408 
419 public:
420  typedef EvpnState::SG SG;
421  typedef std::map<SG, std::set<EvpnMcastNode *> > EvpnMcastNodeList;
422 
423  EvpnManagerPartition(EvpnManager *evpn_manager, size_t part_id);
425 
428 
430  void NotifyNodeRoute(EvpnMcastNode *node);
431 
435 
438  void NotifyIrClientNodeRoutes(bool exclude_edge_replication_supported);
439 
441  void AddMcastNode(EvpnMcastNode *node, EvpnRoute *route);
442 
444  void DeleteMcastNode(EvpnMcastNode *node, EvpnRoute *route);
445 
449  void UpdateMcastNode(EvpnMcastNode *node, EvpnRoute *route);
450 
453  EvpnMcastNodeList *list);
454 
458  void TriggerMacRouteUpdate(EvpnRoute *route);
459 
462  bool empty() const;
463 
466  }
468  return local_mcast_node_list_;
469  }
471  return leaf_node_list_;
472  }
474  return &remote_mcast_node_list_;
475  }
477  return &local_mcast_node_list_;
478  }
480  return &leaf_node_list_;
481  }
482 
484  BgpServer *server();
485 
487  const EvpnTable *table() const;
488 
489  size_t part_id() const { return part_id_; }
490 
491 private:
492  friend class EvpnManager;
493  friend class BgpEvpnManagerTest;
494 
495  typedef std::set<EvpnRoute *> EvpnRouteList;
496 
498  bool ProcessMacUpdateList();
499 
503 
507 
508  EvpnStatePtr GetState(const SG &sg);
509  EvpnStatePtr GetState(const SG &sg) const;
512  EvpnStatePtr LocateState(const SG &sg);
513  EvpnStatePtr CreateState(const SG &sg);
514  const EvpnState::StatesMap &states() const { return states_; }
516  bool GetForestNodeAddress(ErmVpnRoute *rt, Ip4Address *address) const;
518 
520  size_t part_id_;
530  boost::scoped_ptr<TaskTrigger> mac_update_trigger_;
531 
533 };
534 
535 
578 class EvpnManager {
579 public:
580  explicit EvpnManager(EvpnTable *table);
581  virtual ~EvpnManager();
582 
585  virtual void Initialize();
586 
589  virtual void Terminate();
590 
593  virtual UpdateInfo *GetUpdateInfo(EvpnRoute *route);
594 
596  EvpnManagerPartition *GetPartition(size_t part_id);
597 
599  DBTablePartition *GetTablePartition(size_t part_id);
600 
603  void FillShowInfo(ShowEvpnTable *sevt) const;
604 
605  BgpServer *server();
606  EvpnTable *table() { return table_; }
607  const EvpnTable *table() const { return table_; }
609  const ErmVpnTable *ermvpn_table() const { return ermvpn_table_; }
610  int listener_id() const { return listener_id_; }
611  int ermvpn_listener_id() const { return ermvpn_listener_id_; }
612 
615 
618 
627  void TriggerSegmentDelete(EvpnSegment *segment);
628 
637  void TriggerSegmentUpdate(EvpnSegment *segment);
638 
641  void ManagedDelete();
642 
644  void Shutdown();
645 
648  bool MayDelete() const;
649 
651  void RetryDelete();
652 
655 
656 private:
657  friend class BgpEvpnManagerTest;
658  friend class BgpEvpnAliasingTest;
659 
660  class DeleteActor;
661  typedef std::vector<EvpnManagerPartition *> PartitionList;
662  typedef boost::ptr_map<const EthernetSegmentId, EvpnSegment> SegmentMap;
663  typedef std::set<EvpnSegment *> SegmentSet;
664 
666  void AllocPartitions();
667 
669  void FreePartitions();
670 
673 
676  EvpnRoute *route);
677 
680  EvpnRoute *route);
681 
684  EvpnRoute *route);
685 
687  void RouteListener(DBTablePartBase *tpart, DBEntryBase *db_entry);
688 
692  void ErmVpnRouteListener(DBTablePartBase *tpart, DBEntryBase *db_entry);
693 
698 
704 
706  bool IsUsableGlobalTreeRootRoute(ErmVpnRoute *ermvpn_route) const;
707 
711 
715 
719 
723 
727 
731 
733  void SetDBState(EvpnRoute *route, EvpnMcastNode *dbstate);
734 
737  void ClearDBState(EvpnRoute *route);
738 
743  tbb::atomic<int> db_states_count_;
745  tbb::spin_rw_mutex segment_rw_mutex_;
749  boost::scoped_ptr<TaskTrigger> segment_delete_trigger_;
750  boost::scoped_ptr<TaskTrigger> segment_update_trigger_;
751 
752  boost::scoped_ptr<DeleteActor> deleter_;
754 
756 };
757 
759 inline void intrusive_ptr_add_ref(EvpnState *evpn_state) {
760  evpn_state->refcount_.fetch_and_increment();
761 }
762 
767 inline void intrusive_ptr_release(EvpnState *evpn_state) {
768  int prev = evpn_state->refcount_.fetch_and_decrement();
769  if (prev > 1)
770  return;
771  if (evpn_state->states()) {
772  EvpnState::StatesMap::iterator iter =
773  evpn_state->states()->find(evpn_state->sg());
774  if (iter != evpn_state->states()->end()) {
775  assert(iter->second == evpn_state);
776  evpn_state->states()->erase(iter);
777 
778  // Attempt project manager deletion as it could be held up due to
779  // this map being non-empty so far..
780  if (evpn_state->manager()->deleter()->IsDeleted())
781  evpn_state->manager()->deleter()->RetryDelete();
782  }
783  }
784  delete evpn_state;
785 }
786 
787 #define EVPN_RT_LOG(rt, ...) \
788  RTINSTANCE_LOG(EvpnRoute, this->table()->routing_instance(), \
789  SandeshLevel::UT_DEBUG, \
790  RTINSTANCE_LOG_FLAG_ALL, \
791  (rt)->GetPrefix().source().to_string(), \
792  (rt)->GetPrefix().group().to_string(), \
793  (rt)->ToString(), ##__VA_ARGS__)
794 
795 #define EVPN_ERMVPN_RT_LOG(rt, ...) \
796  RTINSTANCE_LOG(EvpnErmVpnRoute, this->table()->routing_instance(), \
797  SandeshLevel::UT_DEBUG, \
798  RTINSTANCE_LOG_FLAG_ALL, \
799  (rt)->GetPrefix().source().to_string(), \
800  (rt)->GetPrefix().group().to_string(), \
801  (rt)->ToString(), ##__VA_ARGS__)
802 
803 #define EVPN_TRACE(type, ...) \
804  RTINSTANCE_LOG(type, this->table()->routing_instance(), \
805  SandeshLevel::UT_DEBUG, RTINSTANCE_LOG_FLAG_ALL, ##__VA_ARGS__)
806 
807 #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:991
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:767
void intrusive_ptr_add_ref(EvpnState *evpn_state)
Increment refcont atomically.
Definition: bgp_evpn.h:759
boost::intrusive_ptr< EvpnState > EvpnStatePtr
Definition: bgp_evpn.h:34
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:124
virtual ~EvpnLocalMcastNode()
Definition: bgp_evpn.cc:206
EvpnRoute * inclusive_mcast_route_
Definition: bgp_evpn.h:157
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:147
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:287
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:318
void clear_segment()
Definition: bgp_evpn.h:300
std::set< BgpPath * > AliasedPathList
Definition: bgp_evpn.h:303
void set_segment(EvpnSegment *segment)
Definition: bgp_evpn.h:299
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:319
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:298
EvpnMacState(EvpnManager *evpn_manager, EvpnRoute *route)
Definition: bgp_evpn.cc:588
EvpnManager * evpn_manager_
Definition: bgp_evpn.h:317
AliasedPathList aliased_path_list_
Definition: bgp_evpn.h:320
EvpnSegment * segment()
Definition: bgp_evpn.h:297
This class represents a partition in the EvpnManager.
Definition: bgp_evpn.h:418
size_t part_id() const
Definition: bgp_evpn.h:489
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:515
EvpnState::SG SG
Definition: bgp_evpn.h:420
const EvpnMcastNodeList & leaf_node_list() const
Definition: bgp_evpn.h:470
std::map< SG, std::set< EvpnMcastNode * > > EvpnMcastNodeList
Definition: bgp_evpn.h:421
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:495
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:526
EvpnMcastNodeList local_mcast_node_list_
Definition: bgp_evpn.h:523
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:519
EvpnState::StatesMap states_
Definition: bgp_evpn.h:521
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:473
EvpnRouteList mac_update_list_
Definition: bgp_evpn.h:529
friend class BgpEvpnManagerTest
Definition: bgp_evpn.h:493
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:525
void EnableMacUpdateProcessing()
Enable processing of the update list. For testing only.
Definition: bgp_evpn.cc:992
EvpnMcastNodeList regular_node_list_
Definition: bgp_evpn.h:527
boost::scoped_ptr< TaskTrigger > mac_update_trigger_
Definition: bgp_evpn.h:530
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:528
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:521
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:514
const EvpnMcastNodeList & local_mcast_node_list() const
Definition: bgp_evpn.h:467
const EvpnMcastNodeList & remote_mcast_node_list() const
Definition: bgp_evpn.h:464
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:524
EvpnMcastNodeList * leaf_node_list()
Definition: bgp_evpn.h:479
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:476
This class represents the EVPN manager for an EvpnTable in a VRF.
Definition: bgp_evpn.h:578
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:740
void Shutdown()
Initiate shutdown for the EvpnManager.
Definition: bgp_evpn.cc:1694
SegmentMap segment_map_
Definition: bgp_evpn.h:746
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:658
SegmentSet segment_delete_set_
Definition: bgp_evpn.h:747
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:663
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:662
int ermvpn_listener_id() const
Definition: bgp_evpn.h:611
int listener_id_
Definition: bgp_evpn.h:741
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:749
EvpnTable * table_
Definition: bgp_evpn.h:739
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:753
virtual void Initialize()
Initialize the EvpnManager. We allocate the EvpnManagerPartitions and register a DBListener for the E...
Definition: bgp_evpn.cc:1058
tbb::atomic< int > db_states_count_
Definition: bgp_evpn.h:743
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:608
const ErmVpnTable * ermvpn_table() const
Definition: bgp_evpn.h:609
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:752
SegmentSet segment_update_set_
Definition: bgp_evpn.h:748
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:744
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:657
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:750
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:607
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:610
int ermvpn_listener_id_
Definition: bgp_evpn.h:742
void DisableSegmentDeleteProcessing()
Disable processing of the delete list. For testing only.
Definition: bgp_evpn.cc:1224
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:745
DISALLOW_COPY_AND_ASSIGN(EvpnManager)
virtual ~EvpnManager()
Definition: bgp_evpn.cc:1048
std::vector< EvpnManagerPartition * > PartitionList
Definition: bgp_evpn.h:660
EvpnTable * table()
Definition: bgp_evpn.h:606
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:46
DISALLOW_COPY_AND_ASSIGN(EvpnMcastNode)
uint32_t label() const
Definition: bgp_evpn.h:76
bool edge_replication_not_supported_
Definition: bgp_evpn.h:98
EvpnStatePtr state()
Definition: bgp_evpn.h:71
uint8_t type() const
Definition: bgp_evpn.h:74
bool assisted_replication_leaf() const
Definition: bgp_evpn.h:85
bool assisted_replication_supported() const
Definition: bgp_evpn.h:82
Ip4Address replicator_address_
Definition: bgp_evpn.h:97
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:99
BgpAttrPtr attr_
Definition: bgp_evpn.h:94
EvpnStatePtr state_
Definition: bgp_evpn.h:91
uint32_t label_
Definition: bgp_evpn.h:95
EvpnManagerPartition * partition_
Definition: bgp_evpn.h:90
Ip4Address address_
Definition: bgp_evpn.h:96
void set_state(EvpnStatePtr state)
Definition: bgp_evpn.h:72
Ip4Address address() const
Definition: bgp_evpn.h:77
bool edge_replication_not_supported() const
Definition: bgp_evpn.h:79
bool assisted_replication_leaf_
Definition: bgp_evpn.h:100
virtual void TriggerUpdate()=0
Handle update of EvpnLocalMcastNode.
uint8_t type_
Definition: bgp_evpn.h:93
EvpnRoute * route_
Definition: bgp_evpn.h:92
EvpnRoute * route()
Definition: bgp_evpn.h:73
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:75
Ip4Address replicator_address() const
Definition: bgp_evpn.h:78
This class represents (in the context of an EVPN instance) a remote vRouter or PE discovered via BGP....
Definition: bgp_evpn.h:170
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:218
BgpPath::PathSource src
Definition: bgp_evpn.h:221
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:202
EvpnRoute * esi_ad_route()
Definition: bgp_evpn.h:253
DISALLOW_COPY_AND_ASSIGN(EvpnSegment)
EvpnRoute * esi_ad_route_
Definition: bgp_evpn.h:266
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:227
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:254
RouteListVector route_lists_
Definition: bgp_evpn.h:268
std::vector< RouteList > RouteListVector
Definition: bgp_evpn.h:262
EvpnManager * evpn_manager_
Definition: bgp_evpn.h:264
EvpnSegment(EvpnManager *evpn_manager, const EthernetSegmentId &esi)
Definition: bgp_evpn.cc:400
std::set< EvpnRoute * > RouteList
Definition: bgp_evpn.h:261
const EthernetSegmentId & esi() const
Definition: bgp_evpn.h:252
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:258
EthernetSegmentId esi_
Definition: bgp_evpn.h:265
std::list< RemotePe > RemotePeList
Definition: bgp_evpn.h:224
bool single_active_
Definition: bgp_evpn.h:267
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:228
RemotePeList::const_iterator const_iterator
Definition: bgp_evpn.h:225
void clear_esi_ad_route()
Definition: bgp_evpn.h:257
RemotePeList pe_list_
Definition: bgp_evpn.h:269
This class holds Evpn state for a particular <S,G> at any given time.
Definition: bgp_evpn.h:347
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:767
RoutesSet & smet_routes()
Definition: bgp_evpn.h:375
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:400
int refcount() const
Definition: bgp_evpn.h:381
const RoutesSet & smet_routes() const
Definition: bgp_evpn.h:376
friend void intrusive_ptr_add_ref(EvpnState *evpn_state)
Increment refcont atomically.
Definition: bgp_evpn.h:759
std::set< EvpnRoute * > RoutesSet
Definition: bgp_evpn.h:349
EvpnManager * manager()
Definition: bgp_evpn.h:379
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:377
ErmVpnRoute * global_ermvpn_tree_rt_
Definition: bgp_evpn.h:399
EvpnManager * manager_
Definition: bgp_evpn.h:402
const EvpnManager * manager() const
Definition: bgp_evpn.h:380
StatesMap * states()
Definition: bgp_evpn.h:378
ErmVpnRoute * global_ermvpn_tree_rt()
Definition: bgp_evpn.cc:1759
DISALLOW_COPY_AND_ASSIGN(EvpnState)
std::map< EvpnRoute *, BgpAttrPtr > RoutesMap
Definition: bgp_evpn.h:350
virtual ~EvpnState()
Definition: bgp_evpn.cc:40
StatesMap * states_
Definition: bgp_evpn.h:401
tbb::atomic< int > refcount_
Definition: bgp_evpn.h:403
std::map< SG, EvpnState * > StatesMap
Definition: bgp_evpn.h:365
Definition: ipeer.h:186
bool IsDeleted() const
Definition: lifetime.h:131
void RetryDelete()
Definition: lifetime.cc:71
Simple structure to hold <S,G>. Source as "0.0.0.0" can be used to encode <*,G> as well.
Definition: bgp_evpn.h:354
IpAddress group
Definition: bgp_evpn.h:362
bool operator<(const SG &other) const
Definition: bgp_evpn.cc:1739
IpAddress source
Definition: bgp_evpn.h:361
SG(const Ip4Address &source, const Ip4Address &group)
Definition: bgp_evpn.cc:1722