7 #include <boost/bind.hpp>
11 #include "sandesh/sandesh_trace.h"
13 #include "bgp/bgp_peer_types.h"
29 const MacAddress &mac, uint32_t label, uint32_t l3_label,
35 origin_vn_index_(-1) {
57 for (
size_t idx = 0; idx < encap_.size(); ++idx) {
61 for (
size_t idx = 0; idx < tag_list_.size(); ++idx) {
101 uint32_t label, uint32_t l3_label,
bool is_xmpp)
106 vrf_originated_(false) {
107 if (attr && is_xmpp) {
115 const BgpAttr *attr, uint32_t label,
bool include_nh,
bool is_xmpp)
120 vrf_originated_(route->BestPath()->IsVrfOriginated()) {
121 if (attr && include_nh) {
135 label_(0), l3_label_(0), is_xmpp_(is_xmpp), vrf_originated_(false) {
154 for (Route::PathList::const_iterator it = route->
GetPathList().begin();
156 const BgpPath *path =
static_cast<const BgpPath *
>(it.operator->());
219 uint32_t label, uint32_t l3_label,
bool vrf_originated,
bool is_xmpp) {
224 NextHop nexthop(table, attrp->nexthop(), attrp->mac_address(),
239 assert(
attr_out_->nexthop() == attrp->nexthop());
260 for (AdvertiseSList::List::const_iterator iter =
advertised_->begin();
262 if (iter->roattr == roattr)
return iter.operator->();
285 for (UpdateInfoSList::List::const_iterator iter = uinfo_slist->begin();
286 iter != uinfo_slist->end(); ++iter) {
288 if (!ainfo || iter->target != ainfo->
bitset)
307 name_ +=
" Type: XMPP";
309 name_ +=
" Type: IBGP";
311 name_ +=
" Type: EBGP";
316 name_ +=
" ASOverride";
320 updates_.push_back(BgpStaticObjectFactory::Create<RibOutUpdates>(
this, idx));
443 if (dbstate == NULL) {
448 if (rstate != NULL) {
450 for (AdvertiseSList::List::const_iterator iter =
452 iter != rstate->
Advertised()->end(); ++iter) {
453 count += iter->bitset.count();
459 if (rt_update != NULL) {
461 for (AdvertiseSList::List::const_iterator iter =
463 iter != rt_update->
History()->end(); ++iter) {
464 count += iter->bitset.count();
470 if (uplist != NULL) {
472 for (AdvertiseSList::List::const_iterator iter =
474 iter != uplist->
History()->end(); ++iter) {
475 count += iter->bitset.count();
487 uint32_t queue_size = 0;
520 peerset->
reset(index);
539 return (ps ? ps->
index : -1);
549 memset(&stats, 0,
sizeof(stats));
550 size_t queue_size = 0;
551 size_t queue_marker_count = 0;
559 ShowRibOutStatistics sros;
566 sros.set_pending_updates(queue_size);
567 sros.set_markers(queue_marker_count);
577 sros_list->push_back(sros);
uint64_t peer_dequeue_count_
int GetPeerIndex(IPeerUpdate *peer) const
RibOutAttr & operator=(const RibOutAttr &rhs)
const IpAddress & nexthop() const
void STLDeleteValues(Container *container)
uint64_t marker_move_count_
const BgpPath * BestPath() const
std::vector< RibOutUpdates * > updates_
uint64_t tail_dequeue_count_
DBState * GetState(DBTableBase *tbl_base, ListenerId listener) const
bool test(size_t pos) const
bool operator!=(const NextHop &rhs) const
const RibPeerSet & PeerSet() const
int virtual_network_index() const
Ip4Address source_address_
static std::string BgpPeerTypeString(BgpPeerType peer_type)
DBTableBase * get_table() const
size_t queue_size(int queue_id) const
Ip4Address source_address_
const std::string & ToString() const
BitSet & reset(size_t pos)
void MoveHistory(RouteUpdate *rt_update)
RoutingInstance * routing_instance()
#define KEY_COMPARE(x, y)
boost::asio::ip::address IpAddress
uint64_t messages_built_count_
BgpGlobalSystemConfig * global_config()
BgpProto::BgpPeerType peer_type() const
void Unregister(IPeerUpdate *peer)
std::vector< int > tag_list_
void Register(IPeerUpdate *peer)
uint64_t messages_sent_count_
ValueType * At(int index) const
size_t queue_marker_count(int queue_id) const
void Unregister(ListenerId listener)
const Ip4Address & source_address() const
uint32_t GetQueueSize() const
MacAddress mac_address() const
int CompareTo(const NextHop &rhs) const
uint32_t GetL3Label() const
ListenerId Register(ChangeCallback callback, const std::string &name="unspecified")
AdvertiseSList & History()
boost::intrusive_ptr< const BgpAttr > BgpAttrPtr
bool vrf_originated() const
NextHopList nexthop_list_
uint64_t marker_merge_count_
static const std::string integerToString(const NumberType &num)
void Leave(RibOut *ribout, IPeerUpdate *peer)
void Remove(const KeyType &key, int index, bool clear_bit=true)
void GetSubsetPeerSet(RibPeerSet *peerset, const IPeerUpdate *cpeer) const
virtual bool send_ready() const
uint64_t marker_split_count_
BgpProto::BgpPeerType type
bool all_tags_are_global() const
void set_attr(const BgpTable *table, const BgpAttrPtr &attrp)
bool IsRegistered(IPeerUpdate *peer)
std::vector< std::string > encap_
AdvertiseSList advertised_
IPeerUpdate * GetPeer(int index) const
void Join(RibOut *ribout, IPeerUpdate *peer)
bool IsVrfOriginated() const
bool IsActive(IPeerUpdate *peer) const
bool operator==(const NextHop &rhs) const
const std::string & name() const
RibOut(BgpTable *table, BgpUpdateSender *sender, const RibExportPolicy &policy)
uint32_t l3_label() const
uint32_t GetLabel() const
int PathCompare(const BgpPath &rhs, bool allow_ecmp) const
void FillStatisticsInfo(std::vector< ShowRibOutStatistics > *sros_list) const
AdvertiseSList & History()
const AdvertiseSList & Advertised() const
void Export(DBTablePartBase *root, DBEntryBase *db_entry)
const ExtCommunity * ext_community() const
std::string EncodingString() const
void RibOutActive(int index, RibOut *ribout, int queue_id)
BgpUpdateSender * sender_
bool operator<(const NextHop &rhs) const
size_t find_first() const
void AddStatisticsInfo(int queue_id, Stats *stats) const
const BgpAttr * GetAttr() const
int RouteAdvertiseCount(const BgpRoute *rt) const
static const int kInvalidId
void Deactivate(IPeerUpdate *peer)
void SwapHistory(AdvertiseSList &history)
size_t find_next(size_t pos) const
void BuildSendReadyBitSet(const RibPeerSet &peerset, RibPeerSet *mready) const
RibOutUpdates * updates(int idx)
RibPeerSet active_peerset_
static int PartitionCount()
void RibOutDelete(const RibExportPolicy &policy)
bool CompareUpdateInfo(const UpdateInfoSList &uinfo_slist) const
const AdvertiseInfo * FindHistory(const RibOutAttr &roattr) const
boost::scoped_ptr< BgpExport > bgp_export_
void SwapHistory(AdvertiseSList &history)
NextHop(const BgpTable *table, IpAddress address, const MacAddress &mac, uint32_t label, uint32_t l3_label, const ExtCommunity *ext_community, bool vrf_originated)
as_t autonomous_system() const
ValueType * Find(const KeyType &key) const
ValueType * Locate(const KeyType &key)
const PathList & GetPathList() const
int CompareTo(const RibOutAttr &rhs) const