8 #include <boost/foreach.hpp>
12 #include "bgp/bgp_peer_types.h"
13 #include "bgp/bgp_peer_internal_types.h"
15 #include "schema/bgp_schema_types.h"
29 sbpc->set_name(peering->
name());
30 sbpc->set_neighbor_count(peering->
size());
32 vector<ShowBgpSessionConfig> sbsc_list;
33 for (vector<autogen::BgpSession>::const_iterator sit =
35 sit != peering->
bgp_peering()->data().end(); ++sit) {
36 ShowBgpSessionConfig sbsc;
37 sbsc.set_uuid(sit->uuid);
38 vector<ShowBgpSessionAttributesConfig> sbsac_list;
39 for (vector<autogen::BgpSessionAttributes>::const_iterator ait =
40 sit->attributes.begin(); ait != sit->attributes.end(); ++ait) {
41 ShowBgpSessionAttributesConfig sbsac;
42 sbsac.set_bgp_router(ait->bgp_router);
43 sbsac.set_address_families(ait->address_families.family);
44 sbsac_list.push_back(sbsac);
46 sbsc.set_attributes(sbsac_list);
47 sbsc_list.push_back(sbsc);
49 sbpc->set_sessions(sbsc_list);
57 bool BgpShowHandler<ShowBgpPeeringConfigReq, ShowBgpPeeringConfigReqIterate,
58 ShowBgpPeeringConfigResp, ShowBgpPeeringConfig>::CallbackCommon(
70 BgpConfigManager::InstanceMap::const_iterator it = range.first;
71 BgpConfigManager::InstanceMap::const_iterator it_end = range.second;
72 for (uint32_t iter_count = 0; it != it_end; ++it, ++iter_count) {
77 BOOST_FOREACH(BgpIfmapInstanceConfig::PeeringMap::value_type value,
82 ShowBgpPeeringConfig sbpc;
88 if (iter_count >= iter_limit)
93 if (it == it_end || ++it == it_end)
98 bool done = data->
show_list.size() >= page_limit;
99 SaveContextToData(it->second->name(), done, data);
107 void BgpShowHandler<ShowBgpPeeringConfigReq, ShowBgpPeeringConfigReqIterate,
108 ShowBgpPeeringConfigResp, ShowBgpPeeringConfig>::FillShowList(
109 ShowBgpPeeringConfigResp *resp,
110 const vector<ShowBgpPeeringConfig> &show_list) {
111 resp->set_peerings(show_list);
119 const ShowBgpPeeringConfigReq *req) {
126 ShowBgpPeeringConfigReq,
127 ShowBgpPeeringConfigReqIterate,
128 ShowBgpPeeringConfigResp,
129 ShowBgpPeeringConfig>::Callback, _1, _2, _3, _4, _5);
131 ShowBgpPeeringConfigReq,
132 ShowBgpPeeringConfigReqIterate,
133 ShowBgpPeeringConfigResp,
134 ShowBgpPeeringConfig>::CreateData;
145 const ShowBgpPeeringConfigReqIterate *req_iterate) {
152 ShowBgpPeeringConfigReq,
153 ShowBgpPeeringConfigReqIterate,
154 ShowBgpPeeringConfigResp,
155 ShowBgpPeeringConfig>::CallbackIterate, _1, _2, _3, _4, _5);
157 ShowBgpPeeringConfigReq,
158 ShowBgpPeeringConfigReqIterate,
159 ShowBgpPeeringConfigResp,
160 ShowBgpPeeringConfig>::CreateData;
void ShowBgpIfmapPeeringConfigReqHandler(const BgpSandeshContext *bsc, const ShowBgpPeeringConfigReq *req)
static void FillBgpPeeringConfigInfo(ShowBgpPeeringConfig *sbpc, const BgpSandeshContext *bsc, const BgpIfmapPeeringConfig *peering)
void ShowBgpIfmapPeeringConfigReqIterateHandler(const BgpSandeshContext *bsc, const ShowBgpPeeringConfigReqIterate *req_iterate)
std::pair< InstanceMap::const_iterator, InstanceMap::const_iterator > InstanceMapRange
BgpIfmapInstanceConfig * FindInstance(const std::string &name)
virtual InstanceMapRange InstanceMapItems(const std::string &start_name=std::string()) const
const BgpIfmapConfigData * config() const
const PeeringMap & peerings() const
const std::string & name() const
const autogen::BgpPeering * bgp_peering() const
BgpIfmapInstanceConfig * instance()
BgpConfigManager * config_manager()
The TaskScheduler keeps track of what tasks are currently schedulable. When a task is enqueued it is ...
int GetTaskId(const std::string &name)
static TaskScheduler * GetInstance()
static bool regex_search(const std::string &input, const regex ®ex)
static bool regex_match(const std::string &input, const regex ®ex)
uint32_t iter_limit() const
uint32_t page_limit() const
std::string search_string
std::vector< ShowT > show_list
std::vector< StageSpec > stages_
std::vector< int > instances_