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) {
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);
boost::asio::ip::address IpAddress
boost::intrusive_ptr< const BgpAttr > BgpAttrPtr
MacAddress mac_address() const
const IpAddress & nexthop() const
const ExtCommunity * ext_community() const
void Export(DBTablePartBase *root, DBEntryBase *db_entry)
bool all_tags_are_global() const
bool IsVrfOriginated() const
uint32_t GetLabel() const
const BgpAttr * GetAttr() const
uint32_t GetL3Label() const
int PathCompare(const BgpPath &rhs, bool allow_ecmp) const
static std::string BgpPeerTypeString(BgpPeerType peer_type)
const BgpPath * BestPath() const
as_t autonomous_system() const
BgpGlobalSystemConfig * global_config()
RoutingInstance * routing_instance()
void RibOutDelete(const RibExportPolicy &policy)
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)
size_t find_first() const
size_t find_next(size_t pos) const
bool test(size_t pos) const
DBState * GetState(DBTableBase *tbl_base, ListenerId listener) const
DBTableBase * get_table() const
ListenerId Register(ChangeCallback callback, const std::string &name="unspecified")
static const int kInvalidId
void Unregister(ListenerId listener)
const std::string & name() const
static int PartitionCount()
virtual bool send_ready() const
ValueType * At(int index) const
ValueType * Locate(const KeyType &key)
void Remove(const KeyType &key, int index, bool clear_bit=true)
ValueType * Find(const KeyType &key) const
bool operator<(const NextHop &rhs) const
int CompareTo(const NextHop &rhs) const
bool operator==(const NextHop &rhs) const
std::vector< std::string > encap_
bool operator!=(const NextHop &rhs) const
NextHop(const BgpTable *table, IpAddress address, const MacAddress &mac, uint32_t label, uint32_t l3_label, const ExtCommunity *ext_community, bool vrf_originated)
Ip4Address source_address_
std::vector< int > tag_list_
int CompareTo(const RibOutAttr &rhs) const
const BgpAttr * attr() const
Ip4Address source_address_
const Ip4Address & source_address() const
bool vrf_originated() const
RibOutAttr & operator=(const RibOutAttr &rhs)
uint32_t l3_label() const
void set_attr(const BgpTable *table, const BgpAttrPtr &attrp)
NextHopList nexthop_list_
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
void Register(IPeerUpdate *peer)
RibOutUpdates * updates(int idx)
BgpProto::BgpPeerType peer_type() const
const RibPeerSet & PeerSet() const
int RouteAdvertiseCount(const BgpRoute *rt) const
void GetSubsetPeerSet(RibPeerSet *peerset, const IPeerUpdate *cpeer) const
void FillStatisticsInfo(std::vector< ShowRibOutStatistics > *sros_list) const
uint32_t GetQueueSize() const
IPeerUpdate * GetPeer(int index) const
int GetPeerIndex(IPeerUpdate *peer) const
bool IsActive(IPeerUpdate *peer) const
RibPeerSet active_peerset_
const std::string & ToString() const
void Unregister(IPeerUpdate *peer)
std::string EncodingString() const
bool IsRegistered(IPeerUpdate *peer)
boost::scoped_ptr< BgpExport > bgp_export_
std::vector< RibOutUpdates * > updates_
void BuildSendReadyBitSet(const RibPeerSet &peerset, RibPeerSet *mready) const
RibOut(BgpTable *table, BgpUpdateSender *sender, const RibExportPolicy &policy)
void Deactivate(IPeerUpdate *peer)
BgpUpdateSender * sender_
AdvertiseSList advertised_
void SwapHistory(AdvertiseSList &history)
bool CompareUpdateInfo(const UpdateInfoSList &uinfo_slist) const
const AdvertiseInfo * FindHistory(const RibOutAttr &roattr) const
const AdvertiseSList & Advertised() const
void MoveHistory(RouteUpdate *rt_update)
void SwapHistory(AdvertiseSList &history)
AdvertiseSList & History()
const PathList & GetPathList() const
int virtual_network_index() const
AdvertiseSList & History()
static const std::string integerToString(const NumberType &num)
BgpProto::BgpPeerType type
uint64_t marker_split_count_
uint64_t peer_dequeue_count_
uint64_t marker_move_count_
uint64_t messages_built_count_
uint64_t marker_merge_count_
uint64_t tail_dequeue_count_
uint64_t messages_sent_count_
#define KEY_COMPARE(x, y)
void STLDeleteValues(Container *container)