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