9 #include "bgp/bgp_peer_internal_types.h"
26 bool summary,
bool match_peer, uint32_t page_limit, uint32_t iter_limit,
27 const string &start_rtarget_str,
const string &search_string,
28 vector<ShowRtGroupInfo> *srtg_list,
string *next_rtarget_str) {
32 if (!start_rtarget_str.empty()) {
39 if (match_peer && search_string.empty())
42 regex search_expr(search_string);
45 for (uint32_t iter_count = 0; it != rtgroup_mgr->
end();
47 const RtGroup *rtgroup = it->second;
60 srtg_list->push_back(srtg);
61 if (srtg_list->size() >= page_limit)
63 if (iter_count >= iter_limit)
68 if (it == rtgroup_mgr->
end() || ++it == rtgroup_mgr->
end())
73 bool done = srtg_list->size() >= page_limit;
74 *next_rtarget_str = it->second->ToString();
83 ShowRtGroupResp, ShowRtGroupInfo>::CallbackCommon(
87 string next_rtarget_str;
91 if (!next_rtarget_str.empty())
92 SaveContextToData(next_rtarget_str, done, data);
101 ShowRtGroupResp, ShowRtGroupInfo>::FillShowList(
102 ShowRtGroupResp *resp,
103 const vector<ShowRtGroupInfo> &show_list) {
104 resp->set_rtgroup_list(show_list);
111 bool BgpShowHandler<ShowRtGroupSummaryReq, ShowRtGroupSummaryReqIterate,
112 ShowRtGroupSummaryResp, ShowRtGroupInfo>::CallbackCommon(
116 string next_rtarget_str;
120 if (!next_rtarget_str.empty())
121 SaveContextToData(next_rtarget_str, done, data);
129 void BgpShowHandler<ShowRtGroupSummaryReq, ShowRtGroupSummaryReqIterate,
130 ShowRtGroupSummaryResp, ShowRtGroupInfo>::FillShowList(
131 ShowRtGroupSummaryResp *resp,
132 const vector<ShowRtGroupInfo> &show_list) {
133 resp->set_rtgroup_list(show_list);
140 bool BgpShowHandler<ShowRtGroupPeerReq, ShowRtGroupPeerReqIterate,
141 ShowRtGroupPeerResp, ShowRtGroupInfo>::CallbackCommon(
145 string next_rtarget_str;
149 if (!next_rtarget_str.empty())
150 SaveContextToData(next_rtarget_str, done, data);
158 void BgpShowHandler<ShowRtGroupPeerReq, ShowRtGroupPeerReqIterate,
159 ShowRtGroupPeerResp, ShowRtGroupInfo>::FillShowList(
160 ShowRtGroupPeerResp *resp,
161 const vector<ShowRtGroupInfo> &show_list) {
162 resp->set_rtgroup_list(show_list);
168 void ShowRtGroupReq::HandleRequest()
const {
176 ShowRtGroupReqIterate,
178 ShowRtGroupInfo>::Callback, _1, _2, _3, _4, _5);
181 ShowRtGroupReqIterate,
183 ShowRtGroupInfo>::CreateData;
185 ps.stages_.push_back(s1);
192 void ShowRtGroupReqIterate::HandleRequest()
const {
200 ShowRtGroupReqIterate,
202 ShowRtGroupInfo>::CallbackIterate, _1, _2, _3, _4, _5);
205 ShowRtGroupReqIterate,
207 ShowRtGroupInfo>::CreateData;
209 ps.stages_.push_back(s1);
216 void ShowRtGroupSummaryReq::HandleRequest()
const {
223 ShowRtGroupSummaryReq,
224 ShowRtGroupSummaryReqIterate,
225 ShowRtGroupSummaryResp,
226 ShowRtGroupInfo>::Callback, _1, _2, _3, _4, _5);
228 ShowRtGroupSummaryReq,
229 ShowRtGroupSummaryReqIterate,
230 ShowRtGroupSummaryResp,
231 ShowRtGroupInfo>::CreateData;
233 ps.stages_.push_back(s1);
240 void ShowRtGroupSummaryReqIterate::HandleRequest()
const {
247 ShowRtGroupSummaryReq,
248 ShowRtGroupSummaryReqIterate,
249 ShowRtGroupSummaryResp,
250 ShowRtGroupInfo>::CallbackIterate, _1, _2, _3, _4, _5);
252 ShowRtGroupSummaryReq,
253 ShowRtGroupSummaryReqIterate,
254 ShowRtGroupSummaryResp,
255 ShowRtGroupInfo>::CreateData;
257 ps.stages_.push_back(s1);
264 void ShowRtGroupPeerReq::HandleRequest()
const {
272 ShowRtGroupPeerReqIterate,
274 ShowRtGroupInfo>::Callback, _1, _2, _3, _4, _5);
277 ShowRtGroupPeerReqIterate,
279 ShowRtGroupInfo>::CreateData;
281 ps.stages_.push_back(s1);
288 void ShowRtGroupPeerReqIterate::HandleRequest()
const {
296 ShowRtGroupPeerReqIterate,
298 ShowRtGroupInfo>::CallbackIterate, _1, _2, _3, _4, _5);
301 ShowRtGroupPeerReqIterate,
303 ShowRtGroupInfo>::CreateData;
305 ps.stages_.push_back(s1);
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)
RTargetGroupMgr * rtarget_group_mgr()
const_iterator end() const
RtGroupMap::const_iterator const_iterator
const_iterator lower_bound(const RouteTarget &rt) const
static RouteTarget FromString(const std::string &str, boost::system::error_code *error=NULL)
void FillShowInfo(ShowRtGroupInfo *info) const
bool HasInterestedPeer(const std::string &name) const
void FillShowPeerInfo(ShowRtGroupInfo *info) const
std::string ToString() const
void FillShowSummaryInfo(ShowRtGroupInfo *info) const
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< int > instances_