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