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