8 #include "bgp/bgp_peer_internal_types.h"
25 bool summary,
bool match_peer, uint32_t page_limit, uint32_t iter_limit,
26 const string &start_rtarget_str,
const string &search_string,
27 vector<ShowRtGroupInfo> *srtg_list,
string *next_rtarget_str) {
31 if (!start_rtarget_str.empty()) {
38 if (match_peer && search_string.empty())
41 regex search_expr(search_string);
44 for (uint32_t iter_count = 0; it != rtgroup_mgr->
end();
46 const RtGroup *rtgroup = it->second;
59 srtg_list->push_back(srtg);
60 if (srtg_list->size() >= page_limit)
62 if (iter_count >= iter_limit)
67 if (it == rtgroup_mgr->
end() || ++it == rtgroup_mgr->
end())
72 bool done = srtg_list->size() >= page_limit;
73 *next_rtarget_str = it->second->ToString();
82 ShowRtGroupResp, ShowRtGroupInfo>::CallbackCommon(
86 string next_rtarget_str;
90 if (!next_rtarget_str.empty())
91 SaveContextToData(next_rtarget_str, done, data);
100 ShowRtGroupResp, ShowRtGroupInfo>::FillShowList(
101 ShowRtGroupResp *resp,
102 const vector<ShowRtGroupInfo> &show_list) {
103 resp->set_rtgroup_list(show_list);
110 bool BgpShowHandler<ShowRtGroupSummaryReq, ShowRtGroupSummaryReqIterate,
111 ShowRtGroupSummaryResp, ShowRtGroupInfo>::CallbackCommon(
115 string next_rtarget_str;
119 if (!next_rtarget_str.empty())
120 SaveContextToData(next_rtarget_str, done, data);
128 void BgpShowHandler<ShowRtGroupSummaryReq, ShowRtGroupSummaryReqIterate,
129 ShowRtGroupSummaryResp, ShowRtGroupInfo>::FillShowList(
130 ShowRtGroupSummaryResp *resp,
131 const vector<ShowRtGroupInfo> &show_list) {
132 resp->set_rtgroup_list(show_list);
139 bool BgpShowHandler<ShowRtGroupPeerReq, ShowRtGroupPeerReqIterate,
140 ShowRtGroupPeerResp, ShowRtGroupInfo>::CallbackCommon(
144 string next_rtarget_str;
148 if (!next_rtarget_str.empty())
149 SaveContextToData(next_rtarget_str, done, data);
157 void BgpShowHandler<ShowRtGroupPeerReq, ShowRtGroupPeerReqIterate,
158 ShowRtGroupPeerResp, ShowRtGroupInfo>::FillShowList(
159 ShowRtGroupPeerResp *resp,
160 const vector<ShowRtGroupInfo> &show_list) {
161 resp->set_rtgroup_list(show_list);
167 void ShowRtGroupReq::HandleRequest()
const {
175 ShowRtGroupReqIterate,
177 ShowRtGroupInfo>::Callback, _1, _2, _3, _4, _5);
180 ShowRtGroupReqIterate,
182 ShowRtGroupInfo>::CreateData;
184 ps.stages_.push_back(s1);
191 void ShowRtGroupReqIterate::HandleRequest()
const {
199 ShowRtGroupReqIterate,
201 ShowRtGroupInfo>::CallbackIterate, _1, _2, _3, _4, _5);
204 ShowRtGroupReqIterate,
206 ShowRtGroupInfo>::CreateData;
208 ps.stages_.push_back(s1);
215 void ShowRtGroupSummaryReq::HandleRequest()
const {
222 ShowRtGroupSummaryReq,
223 ShowRtGroupSummaryReqIterate,
224 ShowRtGroupSummaryResp,
225 ShowRtGroupInfo>::Callback, _1, _2, _3, _4, _5);
227 ShowRtGroupSummaryReq,
228 ShowRtGroupSummaryReqIterate,
229 ShowRtGroupSummaryResp,
230 ShowRtGroupInfo>::CreateData;
232 ps.stages_.push_back(s1);
239 void ShowRtGroupSummaryReqIterate::HandleRequest()
const {
246 ShowRtGroupSummaryReq,
247 ShowRtGroupSummaryReqIterate,
248 ShowRtGroupSummaryResp,
249 ShowRtGroupInfo>::CallbackIterate, _1, _2, _3, _4, _5);
251 ShowRtGroupSummaryReq,
252 ShowRtGroupSummaryReqIterate,
253 ShowRtGroupSummaryResp,
254 ShowRtGroupInfo>::CreateData;
256 ps.stages_.push_back(s1);
263 void ShowRtGroupPeerReq::HandleRequest()
const {
271 ShowRtGroupPeerReqIterate,
273 ShowRtGroupInfo>::Callback, _1, _2, _3, _4, _5);
276 ShowRtGroupPeerReqIterate,
278 ShowRtGroupInfo>::CreateData;
280 ps.stages_.push_back(s1);
287 void ShowRtGroupPeerReqIterate::HandleRequest()
const {
295 ShowRtGroupPeerReqIterate,
297 ShowRtGroupInfo>::CallbackIterate, _1, _2, _3, _4, _5);
300 ShowRtGroupPeerReqIterate,
302 ShowRtGroupInfo>::CreateData;
304 ps.stages_.push_back(s1);
void FillShowPeerInfo(ShowRtGroupInfo *info) const
std::vector< int > instances_
The TaskScheduler keeps track of what tasks are currently schedulable. When a task is enqueued it is ...
RtGroupMap::const_iterator const_iterator
int GetTaskId(const std::string &name)
static bool regex_match(const std::string &input, const regex ®ex)
static TaskScheduler * GetInstance()
uint32_t iter_limit() const
void FillShowSummaryInfo(ShowRtGroupInfo *info) const
const_iterator lower_bound(const RouteTarget &rt) const
static bool FillRtGroupInfoList(const BgpSandeshContext *bsc, bool summary, bool match_peer, uint32_t page_limit, uint32_t iter_limit, const string &start_rtarget_str, const string &search_string, vector< ShowRtGroupInfo > *srtg_list, string *next_rtarget_str)
std::vector< ShowT > show_list
static RouteTarget FromString(const std::string &str, boost::system::error_code *error=NULL)
std::string search_string
static bool regex_search(const std::string &input, const regex ®ex)
bool HasInterestedPeer(const std::string &name) const
uint32_t page_limit() const
std::string ToString() const
const_iterator end() const
void FillShowInfo(ShowRtGroupInfo *info) const
RTargetGroupMgr * rtarget_group_mgr()