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