6 #include <boost/foreach.hpp>
7 #include <boost/assign/list_of.hpp>
14 #include "bgp/routing-instance/route_aggregate_internal_types.h"
15 #include "bgp/routing-instance/route_aggregate_types.h"
17 using boost::assign::list_of;
25 bool summary, uint32_t page_limit, uint32_t iter_limit,
26 const string &start_instance,
const string &search_string,
27 vector<AggregateRouteEntriesInfo> *are_list,
string *next_instance) {
28 regex search_expr(search_string);
32 for (uint32_t iter_count = 0; it != rim->
name_cend(); ++it, ++iter_count) {
35 vector<Address::Family> families =
43 (search_string !=
"deleted" || !table->
IsDeleted())) {
49 if (!iroute_aggregator)
51 AggregateRouteEntriesInfo info;
54 are_list->push_back(info);
57 if (are_list->size() >= page_limit)
59 if (iter_count >= iter_limit)
69 bool done = are_list->size() >= page_limit;
70 *next_instance = it->second->name();
79 ShowRouteAggregateReqIterate, ShowRouteAggregateResp,
80 AggregateRouteEntriesInfo>::CallbackCommon(
88 if (!next_instance.empty())
89 SaveContextToData(next_instance, done, data);
98 ShowRouteAggregateReqIterate, ShowRouteAggregateResp,
99 AggregateRouteEntriesInfo>::FillShowList(
100 ShowRouteAggregateResp *resp,
101 const vector<AggregateRouteEntriesInfo> &show_list) {
102 resp->set_aggregate_route_entries(show_list);
110 ShowRouteAggregateSummaryReqIterate, ShowRouteAggregateSummaryResp,
111 AggregateRouteEntriesInfo>::CallbackCommon(
115 string next_instance;
119 if (!next_instance.empty())
120 SaveContextToData(next_instance, done, data);
129 ShowRouteAggregateSummaryReqIterate, ShowRouteAggregateSummaryResp,
130 AggregateRouteEntriesInfo>::FillShowList(
131 ShowRouteAggregateSummaryResp *resp,
132 const vector<AggregateRouteEntriesInfo> &show_list) {
133 resp->set_aggregate_route_entries(show_list);
139 void ShowRouteAggregateReq::HandleRequest()
const {
146 ShowRouteAggregateReq,
147 ShowRouteAggregateReqIterate,
148 ShowRouteAggregateResp,
149 AggregateRouteEntriesInfo>::Callback, _1, _2, _3, _4, _5);
151 ShowRouteAggregateReq,
152 ShowRouteAggregateReqIterate,
153 ShowRouteAggregateResp,
154 AggregateRouteEntriesInfo>::CreateData;
156 ps.stages_.push_back(s1);
163 void ShowRouteAggregateReqIterate::HandleRequest()
const {
170 ShowRouteAggregateReq,
171 ShowRouteAggregateReqIterate,
172 ShowRouteAggregateResp,
173 AggregateRouteEntriesInfo>::CallbackIterate, _1, _2, _3, _4, _5);
175 ShowRouteAggregateReq,
176 ShowRouteAggregateReqIterate,
177 ShowRouteAggregateResp,
178 AggregateRouteEntriesInfo>::CreateData;
180 ps.stages_.push_back(s1);
187 void ShowRouteAggregateSummaryReq::HandleRequest()
const {
194 ShowRouteAggregateSummaryReq,
195 ShowRouteAggregateSummaryReqIterate,
196 ShowRouteAggregateSummaryResp,
197 AggregateRouteEntriesInfo>::Callback, _1, _2, _3, _4, _5);
199 ShowRouteAggregateSummaryReq,
200 ShowRouteAggregateSummaryReqIterate,
201 ShowRouteAggregateSummaryResp,
202 AggregateRouteEntriesInfo>::CreateData;
204 ps.stages_.push_back(s1);
211 void ShowRouteAggregateSummaryReqIterate::HandleRequest()
const {
218 ShowRouteAggregateSummaryReq,
219 ShowRouteAggregateSummaryReqIterate,
220 ShowRouteAggregateSummaryResp,
221 AggregateRouteEntriesInfo>::CallbackIterate, _1, _2, _3, _4, _5);
223 ShowRouteAggregateSummaryReq,
224 ShowRouteAggregateSummaryReqIterate,
225 ShowRouteAggregateSummaryResp,
226 AggregateRouteEntriesInfo>::CreateData;
228 ps.stages_.push_back(s1);
RoutingInstanceMgr * routing_instance_mgr()
const std::string & name() const
virtual bool FillAggregateRouteInfo(AggregateRouteEntriesInfo *info, bool summary) const =0
const_name_iterator name_cend()
const_name_iterator name_clower_bound(const std::string &name)
RoutingInstanceList::const_iterator const_name_iterator
IRouteAggregator * route_aggregator(Address::Family family) const
BgpTable * GetTable(Address::Family fmly)
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)
static bool FillRouteAggregateInfoList(const BgpSandeshContext *bsc, bool summary, uint32_t page_limit, uint32_t iter_limit, const string &start_instance, const string &search_string, vector< AggregateRouteEntriesInfo > *are_list, string *next_instance)
uint32_t iter_limit() const
uint32_t page_limit() const
std::string search_string
std::vector< ShowT > show_list
std::vector< int > instances_