OpenSDN source code
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
bgp_ribout.cc
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
3  */
4 
5 #include "bgp/bgp_ribout.h"
6 
7 #include <boost/bind.hpp>
8 
9 #include <algorithm>
10 
11 #include "sandesh/sandesh_trace.h"
12 #include "base/string_util.h"
13 #include "bgp/bgp_peer_types.h"
14 #include "bgp/bgp_ribout_updates.h"
15 #include "bgp/bgp_export.h"
16 #include "bgp/bgp_factory.h"
17 #include "bgp/bgp_route.h"
18 #include "bgp/bgp_server.h"
19 #include "bgp/bgp_table.h"
20 #include "bgp/bgp_update.h"
21 #include "bgp/bgp_update_sender.h"
22 #include "bgp/ipeer.h"
24 #include "db/db.h"
25 
26 using std::find;
27 
29  const MacAddress &mac, uint32_t label, uint32_t l3_label,
30  const ExtCommunity *ext_community, bool vrf_originated)
31  : address_(address),
32  mac_(mac),
33  label_(label),
34  l3_label_(l3_label),
35  origin_vn_index_(-1) {
36  if (ext_community) {
37  as_t asn = table ? table->server()->autonomous_system() : 0;
38  encap_ = ext_community->GetTunnelEncap();
39  tag_list_ = ext_community->GetTag4List(asn);
40  origin_vn_index_ = ext_community->GetOriginVnIndex();
41  }
42  if (origin_vn_index_ < 0 && vrf_originated) {
44  table ? table->routing_instance()->virtual_network_index() : 0;
45  }
46 }
47 
48 int RibOutAttr::NextHop::CompareTo(const NextHop &rhs) const {
49  KEY_COMPARE(address_, rhs.address_);
50  KEY_COMPARE(mac_, rhs.mac_) ;
54  KEY_COMPARE(origin_vn_index_, rhs.origin_vn_index_);
55  KEY_COMPARE(encap_.size(), rhs.encap_.size());
56  for (size_t idx = 0; idx < encap_.size(); ++idx) {
57  KEY_COMPARE(encap_[idx], rhs.encap_[idx]);
58  }
59  KEY_COMPARE(tag_list_.size(), rhs.tag_list_.size());
60  for (size_t idx = 0; idx < tag_list_.size(); ++idx) {
61  KEY_COMPARE(tag_list_[idx], rhs.tag_list_[idx]);
62  }
63  return 0;
64 }
65 
66 bool RibOutAttr::NextHop::operator==(const NextHop &rhs) const {
67  return CompareTo(rhs) == 0;
68 }
69 
70 bool RibOutAttr::NextHop::operator!=(const NextHop &rhs) const {
71  return CompareTo(rhs) != 0;
72 }
73 
74 bool RibOutAttr::NextHop::operator<(const NextHop &rhs) const {
75  return CompareTo(rhs) < 0;
76 }
77 
79  : label_(0),
80  l3_label_(0),
81  is_xmpp_(false),
82  vrf_originated_(false) {
83 }
84 
85 //
86 // Copy constructor.
87 // Do not copy the string representation;
88 //
90  attr_out_ = rhs.attr_out_;
92  label_ = rhs.label_;
93  l3_label_ = rhs.l3_label_;
95  is_xmpp_ = rhs.is_xmpp_;
97 }
98 
99 RibOutAttr::RibOutAttr(const BgpTable *table, const BgpAttr *attr,
100  uint32_t label, uint32_t l3_label, bool is_xmpp)
101  : attr_out_(attr),
102  label_(label),
103  l3_label_(l3_label),
104  is_xmpp_(is_xmpp),
105  vrf_originated_(false) {
106  if (attr && is_xmpp) {
107  nexthop_list_.push_back(NextHop(table, attr->nexthop(),
108  attr->mac_address(), label, l3_label, attr->ext_community(),
109  false));
110  }
111 }
112 
113 RibOutAttr::RibOutAttr(const BgpTable *table, const BgpRoute *route,
114  const BgpAttr *attr, uint32_t label, bool include_nh, bool is_xmpp)
115  : attr_out_(attr),
116  label_(0),
117  l3_label_(0),
118  is_xmpp_(is_xmpp),
119  vrf_originated_(route->BestPath()->IsVrfOriginated()) {
120  if (attr && include_nh) {
121  if (is_xmpp) {
122  nexthop_list_.push_back(NextHop(table, attr->nexthop(),
123  attr->mac_address(), label, 0, attr->ext_community(),
124  vrf_originated_));
125  } else {
126  label_ = label;
127  l3_label_ = 0;
128  }
129  }
130 }
131 
132 RibOutAttr::RibOutAttr(const BgpRoute *route, const BgpAttr *attr,
133  bool is_xmpp) :
134  label_(0), l3_label_(0), is_xmpp_(is_xmpp), vrf_originated_(false) {
135  // Attribute should not be set already
136  assert(!attr_out_);
137 
138  const BgpTable *table = static_cast<const BgpTable *>(route->get_table());
139 
140  // Always encode best path's attributes (including it's nexthop) and label.
141  if (!is_xmpp) {
142  set_attr(table, attr, route->BestPath()->GetLabel(),
143  route->BestPath()->GetL3Label(), false, is_xmpp);
144  return;
145  }
146 
147  // Encode ECMP nexthops only for XMPP peers.
148  // Vrf Origination matters only for XMPP peers.
149  set_attr(table, attr, route->BestPath()->GetLabel(),
150  route->BestPath()->GetL3Label(), route->BestPath()->IsVrfOriginated(),
151  is_xmpp);
152 
153  for (Route::PathList::const_iterator it = route->GetPathList().begin();
154  it != route->GetPathList().end(); ++it) {
155  const BgpPath *path = static_cast<const BgpPath *>(it.operator->());
156 
157  // Skip the best path.
158  if (path == route->BestPath())
159  continue;
160 
161  // Check if the path is ECMP eligible. If not, bail out, as the paths
162  // are sorted in cost order anyways.
163  if (route->BestPath()->PathCompare(*path, true))
164  break;
165 
166  // We have an eligible ECMP path.
167  // Remember if the path was originated in the VRF. This is used to
168  // determine if VRF's VN name can be used as the origin VN for the
169  // nexthop.
170  NextHop nexthop(table, path->GetAttr()->nexthop(),
171  path->GetAttr()->mac_address(), path->GetLabel(),
172  path->GetL3Label(), path->GetAttr()->ext_community(),
173  path->IsVrfOriginated());
174 
175  // Skip if we have already encoded this next-hop
176  if (find(nexthop_list_.begin(), nexthop_list_.end(), nexthop) !=
177  nexthop_list_.end()) {
178  continue;
179  }
180  nexthop_list_.push_back(nexthop);
181  }
182 }
183 
184 //
185 // Assignment operator.
186 // Do not copy the string representation;
187 //
189  attr_out_ = rhs.attr_out_;
191  label_ = rhs.label_;
192  l3_label_ = rhs.l3_label_;
194  is_xmpp_ = rhs.is_xmpp_;
196  return *this;
197 }
198 
199 //
200 // Comparator for RibOutAttr.
201 // First compare the BgpAttr and then the nexthops.
202 //
203 int RibOutAttr::CompareTo(const RibOutAttr &rhs) const {
204  KEY_COMPARE(attr_out_.get(), rhs.attr_out_.get());
205  KEY_COMPARE(nexthop_list_.size(), rhs.nexthop_list_.size());
206  for (size_t idx = 0; idx < nexthop_list_.size(); ++idx) {
207  KEY_COMPARE(nexthop_list_[idx], rhs.nexthop_list_[idx]);
208  }
209  KEY_COMPARE(label_, rhs.label());
212  KEY_COMPARE(is_xmpp_, rhs.is_xmpp());
214  return 0;
215 }
216 
217 void RibOutAttr::set_attr(const BgpTable *table, const BgpAttrPtr &attrp,
218  uint32_t label, uint32_t l3_label, bool vrf_originated, bool is_xmpp) {
219  if (!attr_out_) {
220  attr_out_ = attrp;
221  assert(nexthop_list_.empty());
222  if (is_xmpp) {
223  NextHop nexthop(table, attrp->nexthop(), attrp->mac_address(),
224  label, l3_label, attrp->ext_community(), vrf_originated);
225  nexthop_list_.push_back(nexthop);
226  } else {
227  label_ = label;
229  }
230  return;
231  }
232 
233  if (!attrp) {
234  clear();
235  return;
236  }
237 
238  assert(attr_out_->nexthop() == attrp->nexthop());
239  attr_out_ = attrp;
240 }
241 
243 }
244 
245 //
246 // Move history from RouteState to RouteUpdate.
247 //
249  AdvertiseSList adv_slist;
250  SwapHistory(adv_slist);
251  rt_update->SwapHistory(adv_slist);
252 }
253 
254 //
255 // Find the AdvertiseInfo element with matching RibOutAttr.
256 //
258  const RibOutAttr &roattr) const {
259  for (AdvertiseSList::List::const_iterator iter = advertised_->begin();
260  iter != advertised_->end(); iter++) {
261  if (iter->roattr == roattr) return iter.operator->();
262  }
263  return NULL;
264 }
265 
266 //
267 // Compare AdevrtiseInfos in this RouteState with the UpdateInfo elements
268 // in the given list.
269 //
270 // Uses brute force since the UpdateInfo and AdvertiseInfo lists typically
271 // contain just a single element.
272 //
273 // Return true if the information in the RouteState is same as that in the
274 // UpdateInfoSList.
275 //
276 bool RouteState::CompareUpdateInfo(const UpdateInfoSList &uinfo_slist) const {
277  // Both lists must have the same number of elements.
278  if (uinfo_slist->size() != advertised_->size())
279  return false;
280 
281  // Compare the peerset for each UpdateInfo in the UpdateInfoSList to
282  // the peerset for the corresponding AdvertiseInfo in the advertised
283  // list.
284  for (UpdateInfoSList::List::const_iterator iter = uinfo_slist->begin();
285  iter != uinfo_slist->end(); ++iter) {
286  const AdvertiseInfo *ainfo = FindHistory(iter->roattr);
287  if (!ainfo || iter->target != ainfo->bitset)
288  return false;
289  }
290 
291  return true;
292 }
293 
294 //
295 // Create a new RibOut based on the BgpTable and RibExportPolicy.
296 //
298  const RibExportPolicy &policy)
299  : table_(table),
300  sender_(sender),
301  policy_(policy),
302  listener_id_(DBTableBase::kInvalidId),
303  bgp_export_(BgpStaticObjectFactory::Create<BgpExport>(this)) {
304  name_ = "RibOut";
305  if (policy_.type == BgpProto::XMPP) {
306  name_ += " Type: XMPP";
307  } else if (policy_.type == BgpProto::IBGP) {
308  name_ += " Type: IBGP";
309  } else {
310  name_ += " Type: EBGP";
311  name_ += " (AS " + integerToString(policy_.as_number);
312  if (!policy_.nexthop.is_unspecified())
313  name_ += " Nexthop " + policy_.nexthop.to_string();
314  if (policy_.as_override)
315  name_ += " ASOverride";
316  name_ += ")";
317  }
318  for (int idx = 0; idx < DB::PartitionCount(); ++idx) {
319  updates_.push_back(BgpStaticObjectFactory::Create<RibOutUpdates>(this, idx));
320  }
321 }
322 
323 //
324 // Destructor for RibOut. Takes care of unregistering the RibOut from
325 // the DBTableBase.
326 //
331  }
333 }
334 
335 //
336 // Register the RibOut as a listener with the underlying DBTableBase. This
337 // is separated out from the constructor to let the unit testing code work
338 // using the bare bones RibOut functionality.
339 //
340 // Note that the corresponding unregister from the DBTableBase will happen
341 // implicitly from the destructor.
342 //
345  return;
347  boost::bind(&BgpExport::Export, bgp_export_.get(), _1, _2),
348  ToString());
349 }
350 
351 //
352 // Register a new peer to the RibOut. If the peer is not present in the
353 // PeerStateMap, create a new PeerState and add it to the map.
354 // Join the IPeerUpdate to the UPDATE and BULK queues for all RibOutUpdates
355 // associated with the RibOut.
356 //
358  PeerState *ps = state_map_.Locate(peer);
359  assert(ps != NULL);
361  sender_->Join(this, peer);
362  for (int idx = 0; idx < DB::PartitionCount(); ++idx) {
363  if (updates_[idx]->QueueJoin(RibOutUpdates::QUPDATE, ps->index))
365  if (updates_[idx]->QueueJoin(RibOutUpdates::QBULK, ps->index))
367  }
368 }
369 
370 //
371 // Unregister a IPeerUpdate from the RibOut.
372 // Leave the IPeerUpdate from the UPDATE and BULK queues for all RibOutUpdates
373 // associated with the RibOut.
374 // Removes the IPeerUpdate from the PeerStateMap.
375 // If this was the last IPeerUpdate in the RibOut, remove the RibOut from the
376 // BgpTable. That will cause this RibOut itself to get destroyed.
377 //
379  PeerState *ps = state_map_.Find(peer);
380  assert(ps != NULL);
381  assert(!active_peerset_.test(ps->index));
382 
383  for (int idx = 0; idx < DB::PartitionCount(); ++idx) {
384  updates_[idx]->QueueLeave(RibOutUpdates::QUPDATE, ps->index);
385  updates_[idx]->QueueLeave(RibOutUpdates::QBULK, ps->index);
386  }
387  sender_->Leave(this, peer);
388  state_map_.Remove(peer, ps->index);
389 
390  if (state_map_.empty()) {
392  }
393 }
394 
395 //
396 // Return true if the IPeerUpdate is registered to this RibOut.
397 //
399  PeerState *ps = state_map_.Find(peer);
400  return (ps != NULL);
401 }
402 
403 //
404 // Deactivate a IPeerUpdate from the RibOut. Removes it from the RibPeerSet of
405 // active peers without removing it from the PeerStateMap.
406 //
407 // This must be called when the peer starts the process of leaving the RibOut
408 // in order to prevent any new or existing routes from getting exported while
409 // the route table walk for the leave processing is in progress.
410 //
412  PeerState *ps = state_map_.Find(peer);
413  assert(ps != NULL);
414  assert(active_peerset_.test(ps->index));
416 }
417 
418 bool RibOut::IsActive(IPeerUpdate *peer) const {
419  int index = GetPeerIndex(peer);
420  return (index < 0 ? false : active_peerset_.test(index));
421 }
422 
423 //
424 // Build the subset of given RibPeerSet in this RibOut that are send ready.
425 //
427  RibPeerSet *mready) const {
428  for (size_t bit = peerset.find_first(); bit != RibPeerSet::npos;
429  bit = peerset.find_next(bit)) {
430  IPeerUpdate *peer = GetPeer(bit);
431  if (peer->send_ready()) {
432  mready->set(bit);
433  }
434  }
435 }
436 
437 //
438 // Return the number of peers this route has been advertised to.
439 //
440 int RibOut::RouteAdvertiseCount(const BgpRoute *rt) const {
441  const DBState *dbstate = rt->GetState(table_, listener_id_);
442  if (dbstate == NULL) {
443  return 0;
444  }
445 
446  const RouteState *rstate = dynamic_cast<const RouteState *>(dbstate);
447  if (rstate != NULL) {
448  int count = 0;
449  for (AdvertiseSList::List::const_iterator iter =
450  rstate->Advertised()->begin();
451  iter != rstate->Advertised()->end(); ++iter) {
452  count += iter->bitset.count();
453  }
454  return count;
455  }
456 
457  const RouteUpdate *rt_update = dynamic_cast<const RouteUpdate *>(dbstate);
458  if (rt_update != NULL) {
459  int count = 0;
460  for (AdvertiseSList::List::const_iterator iter =
461  rt_update->History()->begin();
462  iter != rt_update->History()->end(); ++iter) {
463  count += iter->bitset.count();
464  }
465  return count;
466  }
467 
468  const UpdateList *uplist = dynamic_cast<const UpdateList *>(dbstate);
469  if (uplist != NULL) {
470  int count = 0;
471  for (AdvertiseSList::List::const_iterator iter =
472  uplist->History()->begin();
473  iter != uplist->History()->end(); ++iter) {
474  count += iter->bitset.count();
475  }
476  return count;
477  }
478 
479  return 0;
480 }
481 
482 //
483 // Return the total queue size across all RibOutUpdates and UpdateQueues.
484 //
485 uint32_t RibOut::GetQueueSize() const {
486  uint32_t queue_size = 0;
487  for (int idx = 0; idx < DB::PartitionCount(); ++idx) {
488  const RibOutUpdates *updates = updates_[idx];
489  for (int qid = RibOutUpdates::QFIRST; qid < RibOutUpdates::QCOUNT;
490  ++qid) {
491  queue_size += updates->queue_size(qid);
492  }
493  }
494  return queue_size;
495 }
496 
497 //
498 // Return the active RibPeerSet for this RibOut. We keep track of the active
499 // peers via the calls to Register and Deactivate.
500 //
501 // The active RibPeerSet is always a subset of the registered RibPeerSet that
502 // is in the PeerStateMap.
503 //
504 const RibPeerSet &RibOut::PeerSet() const {
505  return active_peerset_;
506 }
507 
508 //
509 // Clear the bit index corresponding to the specified peer.
510 // Used to implement split horizon within an EBGP Ribout.
511 //
513  const IPeerUpdate *cpeer) const {
514  assert(policy_.type == BgpProto::EBGP);
515  IPeerUpdate *peer = const_cast<IPeerUpdate *>(cpeer);
516  int index = GetPeerIndex(peer);
517  if (index < 0)
518  return;
519  peerset->reset(index);
520 }
521 
522 //
523 // Return the peer corresponding to the specified bit index.
524 //
525 IPeerUpdate *RibOut::GetPeer(int index) const {
526  PeerState *ps = state_map_.At(index);
527  if (ps != NULL) {
528  return ps->peer;
529  }
530  return NULL;
531 }
532 
533 //
534 // Return the bit index corresponding to the specified peer.
535 //
537  PeerState *ps = state_map_.Find(peer);
538  return (ps ? ps->index : -1);
539 }
540 
541 //
542 // Fill introspect information.
543 // Accumulate counters from all RibOutUpdates.
544 //
545 void RibOut::FillStatisticsInfo(vector<ShowRibOutStatistics> *sros_list) const {
546  for (int qid = RibOutUpdates::QFIRST; qid < RibOutUpdates::QCOUNT; ++qid) {
547  RibOutUpdates::Stats stats;
548  memset(&stats, 0, sizeof(stats));
549  size_t queue_size = 0;
550  size_t queue_marker_count = 0;
551  for (int idx = 0; idx < DB::PartitionCount(); ++idx) {
552  const RibOutUpdates *updates = updates_[idx];
553  updates->AddStatisticsInfo(qid, &stats);
554  queue_size += updates->queue_size(qid);
555  queue_marker_count += updates->queue_marker_count(qid);
556  }
557 
558  ShowRibOutStatistics sros;
559  sros.set_table(table_->name());
560  sros.set_encoding(EncodingString());
561  sros.set_peer_type(BgpProto::BgpPeerTypeString(peer_type()));
562  sros.set_peer_as(peer_as());
563  sros.set_peers(state_map_.size());
564  sros.set_queue(qid == RibOutUpdates::QBULK ? "BULK" : "UPDATE");
565  sros.set_pending_updates(queue_size);
566  sros.set_markers(queue_marker_count);
567  sros.set_messages_built(stats.messages_built_count_);
568  sros.set_messages_sent(stats.messages_sent_count_);
569  sros.set_reach(stats.reach_count_);
570  sros.set_unreach(stats.unreach_count_);
571  sros.set_tail_dequeues(stats.tail_dequeue_count_);
572  sros.set_peer_dequeues(stats.peer_dequeue_count_);
573  sros.set_marker_splits(stats.marker_split_count_);
574  sros.set_marker_merges(stats.marker_merge_count_);
575  sros.set_marker_moves(stats.marker_move_count_);
576  sros_list->push_back(sros);
577  }
578 }
int GetOriginVnIndex() const
Definition: community.cc:667
int GetPeerIndex(IPeerUpdate *peer) const
Definition: bgp_ribout.cc:536
RibOutAttr & operator=(const RibOutAttr &rhs)
Definition: bgp_ribout.cc:188
const IpAddress & nexthop() const
Definition: bgp_attr.h:886
void STLDeleteValues(Container *container)
Definition: util.h:101
int listener_id_
Definition: bgp_ribout.h:367
uint32_t label_
Definition: bgp_ribout.h:136
const BgpPath * BestPath() const
Definition: bgp_route.cc:46
std::vector< RibOutUpdates * > updates_
Definition: bgp_ribout.h:368
DBState * GetState(DBTableBase *tbl_base, ListenerId listener) const
Definition: db_entry.cc:37
bool test(size_t pos) const
Definition: bitset.cc:146
IpAddress nexthop
bool operator!=(const NextHop &rhs) const
Definition: bgp_ribout.cc:70
const RibPeerSet & PeerSet() const
Definition: bgp_ribout.cc:504
int virtual_network_index() const
Ip4Address source_address_
Definition: bgp_ribout.h:74
static std::string BgpPeerTypeString(BgpPeerType peer_type)
Definition: bgp_proto.h:34
bool is_xmpp_
Definition: bgp_ribout.h:139
DBTableBase * get_table() const
Definition: db_entry.cc:119
RibExportPolicy policy_
Definition: bgp_ribout.h:363
size_t queue_size(int queue_id) const
Ip4Address source_address_
Definition: bgp_ribout.h:138
const std::string & ToString() const
Definition: bgp_ribout.h:314
BitSet & reset(size_t pos)
Definition: bitset.cc:136
void MoveHistory(RouteUpdate *rt_update)
Definition: bgp_ribout.cc:248
RoutingInstance * routing_instance()
Definition: bgp_table.h:148
#define KEY_COMPARE(x, y)
Definition: util.h:70
boost::asio::ip::address IpAddress
Definition: address.h:13
BgpProto::BgpPeerType peer_type() const
Definition: bgp_ribout.h:320
void Unregister(IPeerUpdate *peer)
Definition: bgp_ribout.cc:378
BgpAttrPtr attr_out_
Definition: bgp_ribout.h:134
std::vector< int > GetTag4List(as_t asn=0) const
Definition: community.cc:632
IpAddress address_
Definition: bgp_ribout.h:70
std::vector< int > tag_list_
Definition: bgp_ribout.h:77
void Register(IPeerUpdate *peer)
Definition: bgp_ribout.cc:357
ValueType * At(int index) const
Definition: index_map.h:31
uint32_t as_t
Definition: bgp_common.h:21
size_t queue_marker_count(int queue_id) const
void Unregister(ListenerId listener)
Definition: db_table.cc:186
const Ip4Address & source_address() const
Definition: bgp_ribout.h:121
uint32_t GetQueueSize() const
Definition: bgp_ribout.cc:485
MacAddress mac_address() const
Definition: bgp_attr.cc:1196
int CompareTo(const NextHop &rhs) const
Definition: bgp_ribout.cc:48
uint32_t GetL3Label() const
Definition: bgp_path.h:90
ListenerId Register(ChangeCallback callback, const std::string &name="unspecified")
Definition: db_table.cc:181
uint32_t l3_label_
Definition: bgp_ribout.h:73
AdvertiseSList & History()
Definition: bgp_update.h:211
boost::intrusive_ptr< const BgpAttr > BgpAttrPtr
Definition: bgp_attr.h:991
bool vrf_originated() const
Definition: bgp_ribout.h:124
std::string name_
Definition: bgp_ribout.h:364
IPeerUpdate * peer
Definition: bgp_ribout.h:356
NextHopList nexthop_list_
Definition: bgp_ribout.h:135
static const std::string integerToString(const NumberType &num)
Definition: string_util.h:19
static const size_t npos
Definition: bitset.h:19
void Leave(RibOut *ribout, IPeerUpdate *peer)
void Remove(const KeyType &key, int index, bool clear_bit=true)
Definition: index_map.h:69
void GetSubsetPeerSet(RibPeerSet *peerset, const IPeerUpdate *cpeer) const
Definition: bgp_ribout.cc:512
virtual bool send_ready() const
Definition: ipeer.h:23
BgpProto::BgpPeerType type
RibPeerSet bitset
Definition: bgp_ribout.h:172
void set_attr(const BgpTable *table, const BgpAttrPtr &attrp)
Definition: bgp_ribout.h:98
bool IsRegistered(IPeerUpdate *peer)
Definition: bgp_ribout.cc:398
std::vector< std::string > encap_
Definition: bgp_ribout.h:76
AdvertiseSList advertised_
Definition: bgp_ribout.h:247
IPeerUpdate * GetPeer(int index) const
Definition: bgp_ribout.cc:525
void Join(RibOut *ribout, IPeerUpdate *peer)
bool IsVrfOriginated() const
Definition: bgp_path.h:68
bool IsActive(IPeerUpdate *peer) const
Definition: bgp_ribout.cc:418
bool operator==(const NextHop &rhs) const
Definition: bgp_ribout.cc:66
const std::string & name() const
Definition: db_table.h:110
RibOut(BgpTable *table, BgpUpdateSender *sender, const RibExportPolicy &policy)
Definition: bgp_ribout.cc:297
uint32_t l3_label() const
Definition: bgp_ribout.h:118
MacAddress mac_
Definition: bgp_ribout.h:71
as_t peer_as() const
Definition: bgp_ribout.h:321
uint32_t GetLabel() const
Definition: bgp_path.h:89
int PathCompare(const BgpPath &rhs, bool allow_ecmp) const
Definition: bgp_path.cc:58
void FillStatisticsInfo(std::vector< ShowRibOutStatistics > *sros_list) const
Definition: bgp_ribout.cc:545
AdvertiseSList & History()
Definition: bgp_update.h:274
const AdvertiseSList & Advertised() const
Definition: bgp_ribout.h:243
BgpServer * server()
Definition: bgp_table.cc:88
void Export(DBTablePartBase *root, DBEntryBase *db_entry)
Definition: bgp_export.cc:43
BitSet & set(size_t pos)
Definition: bitset.cc:125
const ExtCommunity * ext_community() const
Definition: bgp_attr.h:915
uint32_t label() const
Definition: bgp_ribout.h:115
uint32_t l3_label_
Definition: bgp_ribout.h:137
std::string EncodingString() const
Definition: bgp_ribout.h:334
BgpTable * table_
Definition: bgp_ribout.h:361
void RibOutActive(int index, RibOut *ribout, int queue_id)
BgpUpdateSender * sender_
Definition: bgp_ribout.h:362
bool operator<(const NextHop &rhs) const
Definition: bgp_ribout.cc:74
size_t find_first() const
Definition: bitset.cc:242
void AddStatisticsInfo(int queue_id, Stats *stats) const
const BgpAttr * GetAttr() const
Definition: bgp_path.h:87
int RouteAdvertiseCount(const BgpRoute *rt) const
Definition: bgp_ribout.cc:440
size_t size() const
Definition: index_map.h:100
void clear()
Definition: bgp_ribout.h:111
std::vector< std::string > GetTunnelEncap() const
Definition: community.cc:595
static const int kInvalidId
Definition: db_table.h:64
bool is_xmpp() const
Definition: bgp_ribout.h:123
bool empty() const
Definition: index_map.h:102
void Deactivate(IPeerUpdate *peer)
Definition: bgp_ribout.cc:411
void SwapHistory(AdvertiseSList &history)
Definition: bgp_update.h:205
size_t find_next(size_t pos) const
Definition: bitset.cc:255
void BuildSendReadyBitSet(const RibPeerSet &peerset, RibPeerSet *mready) const
Definition: bgp_ribout.cc:426
RibOutUpdates * updates(int idx)
Definition: bgp_ribout.h:316
RibPeerSet active_peerset_
Definition: bgp_ribout.h:366
static int PartitionCount()
Definition: db.cc:32
void RibOutDelete(const RibExportPolicy &policy)
Definition: bgp_table.cc:124
bool vrf_originated_
Definition: bgp_ribout.h:140
bool CompareUpdateInfo(const UpdateInfoSList &uinfo_slist) const
Definition: bgp_ribout.cc:276
const AdvertiseInfo * FindHistory(const RibOutAttr &roattr) const
Definition: bgp_ribout.cc:257
boost::scoped_ptr< BgpExport > bgp_export_
Definition: bgp_ribout.h:369
void RegisterListener()
Definition: bgp_ribout.cc:343
void SwapHistory(AdvertiseSList &history)
Definition: bgp_ribout.h:236
NextHop(const BgpTable *table, IpAddress address, const MacAddress &mac, uint32_t label, uint32_t l3_label, const ExtCommunity *ext_community, bool vrf_originated)
Definition: bgp_ribout.cc:28
as_t autonomous_system() const
Definition: bgp_server.h:205
ValueType * Find(const KeyType &key) const
Definition: index_map.h:34
ValueType * Locate(const KeyType &key)
Definition: index_map.h:91
PeerStateMap state_map_
Definition: bgp_ribout.h:365
const PathList & GetPathList() const
Definition: route.h:46
int CompareTo(const RibOutAttr &rhs) const
Definition: bgp_ribout.cc:203