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