5 #include <boost/foreach.hpp>
6 #include <boost/assign/list_of.hpp>
13 #include "bgp/routing-instance/route_aggregate_internal_types.h"
14 #include "bgp/routing-instance/route_aggregate_types.h"
16 using boost::assign::list_of;
24 bool summary, uint32_t page_limit, uint32_t iter_limit,
25 const string &start_instance,
const string &search_string,
26 vector<AggregateRouteEntriesInfo> *are_list,
string *next_instance) {
27 regex search_expr(search_string);
31 for (uint32_t iter_count = 0; it != rim->
name_cend(); ++it, ++iter_count) {
34 vector<Address::Family> families =
42 (search_string !=
"deleted" || !table->
IsDeleted())) {
48 if (!iroute_aggregator)
50 AggregateRouteEntriesInfo info;
53 are_list->push_back(info);
56 if (are_list->size() >= page_limit)
58 if (iter_count >= iter_limit)
68 bool done = are_list->size() >= page_limit;
69 *next_instance = it->second->name();
78 ShowRouteAggregateReqIterate, ShowRouteAggregateResp,
79 AggregateRouteEntriesInfo>::CallbackCommon(
87 if (!next_instance.empty())
88 SaveContextToData(next_instance, done, data);
97 ShowRouteAggregateReqIterate, ShowRouteAggregateResp,
98 AggregateRouteEntriesInfo>::FillShowList(
99 ShowRouteAggregateResp *resp,
100 const vector<AggregateRouteEntriesInfo> &show_list) {
101 resp->set_aggregate_route_entries(show_list);
109 ShowRouteAggregateSummaryReqIterate, ShowRouteAggregateSummaryResp,
110 AggregateRouteEntriesInfo>::CallbackCommon(
114 string next_instance;
118 if (!next_instance.empty())
119 SaveContextToData(next_instance, done, data);
128 ShowRouteAggregateSummaryReqIterate, ShowRouteAggregateSummaryResp,
129 AggregateRouteEntriesInfo>::FillShowList(
130 ShowRouteAggregateSummaryResp *resp,
131 const vector<AggregateRouteEntriesInfo> &show_list) {
132 resp->set_aggregate_route_entries(show_list);
138 void ShowRouteAggregateReq::HandleRequest()
const {
145 ShowRouteAggregateReq,
146 ShowRouteAggregateReqIterate,
147 ShowRouteAggregateResp,
148 AggregateRouteEntriesInfo>::Callback, _1, _2, _3, _4, _5);
150 ShowRouteAggregateReq,
151 ShowRouteAggregateReqIterate,
152 ShowRouteAggregateResp,
153 AggregateRouteEntriesInfo>::CreateData;
155 ps.stages_.push_back(s1);
162 void ShowRouteAggregateReqIterate::HandleRequest()
const {
169 ShowRouteAggregateReq,
170 ShowRouteAggregateReqIterate,
171 ShowRouteAggregateResp,
172 AggregateRouteEntriesInfo>::CallbackIterate, _1, _2, _3, _4, _5);
174 ShowRouteAggregateReq,
175 ShowRouteAggregateReqIterate,
176 ShowRouteAggregateResp,
177 AggregateRouteEntriesInfo>::CreateData;
179 ps.stages_.push_back(s1);
186 void ShowRouteAggregateSummaryReq::HandleRequest()
const {
193 ShowRouteAggregateSummaryReq,
194 ShowRouteAggregateSummaryReqIterate,
195 ShowRouteAggregateSummaryResp,
196 AggregateRouteEntriesInfo>::Callback, _1, _2, _3, _4, _5);
198 ShowRouteAggregateSummaryReq,
199 ShowRouteAggregateSummaryReqIterate,
200 ShowRouteAggregateSummaryResp,
201 AggregateRouteEntriesInfo>::CreateData;
203 ps.stages_.push_back(s1);
210 void ShowRouteAggregateSummaryReqIterate::HandleRequest()
const {
217 ShowRouteAggregateSummaryReq,
218 ShowRouteAggregateSummaryReqIterate,
219 ShowRouteAggregateSummaryResp,
220 AggregateRouteEntriesInfo>::CallbackIterate, _1, _2, _3, _4, _5);
222 ShowRouteAggregateSummaryReq,
223 ShowRouteAggregateSummaryReqIterate,
224 ShowRouteAggregateSummaryResp,
225 AggregateRouteEntriesInfo>::CreateData;
227 ps.stages_.push_back(s1);
std::vector< int > instances_
BgpTable * GetTable(Address::Family fmly)
The TaskScheduler keeps track of what tasks are currently schedulable. When a task is enqueued it is ...
const_name_iterator name_cend()
RoutingInstanceMgr * routing_instance_mgr()
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)
int GetTaskId(const std::string &name)
static bool regex_match(const std::string &input, const regex ®ex)
IRouteAggregator * route_aggregator(Address::Family family) const
static TaskScheduler * GetInstance()
uint32_t iter_limit() const
RoutingInstanceList::const_iterator const_name_iterator
const_name_iterator name_clower_bound(const std::string &name)
std::vector< ShowT > show_list
const std::string & name() const
std::string search_string
static bool regex_search(const std::string &input, const regex ®ex)
uint32_t page_limit() const
virtual bool FillAggregateRouteInfo(AggregateRouteEntriesInfo *info, bool summary) const =0