OpenSDN source code
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
bgp_show_config.cc
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
3  */
4 
5 #include "bgp/bgp_show_handler.h"
6 
7 #include <boost/assign/list_of.hpp>
8 #include <boost/foreach.hpp>
9 
10 #include "base/regex.h"
11 #include "bgp/bgp_config.h"
12 #include "bgp/bgp_config_ifmap.h"
13 #include "bgp/bgp_peer_internal_types.h"
14 #include "bgp/bgp_server.h"
15 
16 using boost::assign::list_of;
17 using contrail::regex;
20 using std::string;
21 using std::vector;
22 
23 //
24 // Fill in information for an instance.
25 //
26 static void FillBgpInstanceConfigInfo(ShowBgpInstanceConfig *sbic,
27  const BgpSandeshContext *bsc, const BgpInstanceConfig *instance) {
28  sbic->set_name(instance->name());
29  sbic->set_virtual_network(instance->virtual_network());
30  sbic->set_virtual_network_index(instance->virtual_network_index());
31  sbic->set_vxlan_id(instance->vxlan_id());
32 
33  vector<string> import_list;
34  for (auto rt : instance->import_list()) {
35  import_list.push_back(rt);
36  }
37  sbic->set_import_target(import_list);
38  vector<string> export_list;
39  for (auto rt : instance->export_list()) {
40  export_list.push_back(rt);
41  }
42  sbic->set_export_target(export_list);
43  sbic->set_has_pnf(instance->has_pnf());
44  sbic->set_allow_transit(instance->virtual_network_allow_transit());
45  sbic->set_pbb_evpn_enable(instance->virtual_network_pbb_evpn_enable());
46  sbic->set_last_change_at(UTCUsecToString(instance->last_change_at()));
47 
48  vector<string> neighbors(
49  instance->neighbor_list().begin(), instance->neighbor_list().end());
50  sbic->set_neighbors(neighbors);
51 
52  vector<ShowBgpServiceChainConfig> sbscc_list;
53  for (const auto &sc_config :
54  instance->service_chain_list()) {
55  ShowBgpServiceChainConfig sbscc;
56  Address::Family family =
57  SCAddress::SCFamilyToAddressFamily(sc_config.family);
58  sbscc.set_family(Address::FamilyToString(family));
59  sbscc.set_routing_instance(sc_config.routing_instance);
60  sbscc.set_service_instance(sc_config.service_instance);
61  sbscc.set_chain_address(sc_config.service_chain_address);
62  sbscc.set_prefixes(sc_config.prefix);
63  sbscc_list.push_back(sbscc);
64  }
65  sbic->set_service_chain_infos(sbscc_list);
66 
67  vector<ShowBgpStaticRouteConfig> static_route_list;
68  vector<Address::Family> families = list_of(Address::INET)(Address::INET6);
69  for (auto family : families) {
70  for (const auto &static_rt_config :
71  instance->static_routes(family)) {
72  ShowBgpStaticRouteConfig sbsrc;
73  string prefix = static_rt_config.address.to_string() + "/";
74  prefix += integerToString(static_rt_config.prefix_length);
75  sbsrc.set_prefix(prefix);
76  sbsrc.set_nexthop(static_rt_config.nexthop.to_string());
77  sbsrc.set_targets(static_rt_config.communities);
78  sbsrc.set_targets(static_rt_config.route_targets);
79  static_route_list.push_back(sbsrc);
80  }
81  }
82  if (!static_route_list.empty())
83  sbic->set_static_routes(static_route_list);
84 
85  vector<ShowBgpRouteAggregateConfig> aggregate_route_list;
86  for (auto family : families) {
87  for (const auto &aggregate_rt_config :
88  instance->aggregate_routes(family)) {
89  ShowBgpRouteAggregateConfig sbarc;
90  string prefix = aggregate_rt_config.aggregate.to_string() + "/";
91  prefix += integerToString(aggregate_rt_config.prefix_length);
92  sbarc.set_prefix(prefix);
93  sbarc.set_nexthop(aggregate_rt_config.nexthop.to_string());
94  aggregate_route_list.push_back(sbarc);
95  }
96  }
97  if (!aggregate_route_list.empty())
98  sbic->set_aggregate_routes(aggregate_route_list);
99 
100  vector<ShowBgpInstanceRoutingPolicyConfig> routing_policy_list;
101  for (const auto &policy_config :
102  instance->routing_policy_list()) {
103  ShowBgpInstanceRoutingPolicyConfig sbirpc;
104  sbirpc.set_policy_name(policy_config.routing_policy_);
105  sbirpc.set_sequence(policy_config.sequence_);
106  routing_policy_list.push_back(sbirpc);
107  }
108  if (!routing_policy_list.empty())
109  sbic->set_routing_policies(routing_policy_list);
110 }
111 
112 //
113 // Specialization of BgpShowHandler<>::CallbackCommon.
114 //
115 template <>
116 bool BgpShowHandler<ShowBgpInstanceConfigReq, ShowBgpInstanceConfigReqIterate,
117  ShowBgpInstanceConfigResp, ShowBgpInstanceConfig>::CallbackCommon(
118  const BgpSandeshContext *bsc, Data *data) {
119  uint32_t page_limit = bsc->page_limit() ? bsc->page_limit() : kPageLimit;
120  uint32_t iter_limit = bsc->iter_limit() ? bsc->iter_limit() : kIterLimit;
121  const BgpConfigManager *bcm = bsc->bgp_server->config_manager();
122 
123  regex search_expr(data->search_string);
125  bcm->InstanceMapItems(data->next_entry);
126  BgpConfigManager::InstanceMap::const_iterator it = range.first;
127  BgpConfigManager::InstanceMap::const_iterator it_end = range.second;
128  for (uint32_t iter_count = 0; it != it_end; ++it, ++iter_count) {
129  const BgpInstanceConfig *instance = it->second;
130  if (!regex_search(instance->name(), search_expr))
131  continue;
132  ShowBgpInstanceConfig sbic;
133  FillBgpInstanceConfigInfo(&sbic, bsc, instance);
134  data->show_list.push_back(sbic);
135  if (data->show_list.size() >= page_limit)
136  break;
137  if (iter_count >= iter_limit)
138  break;
139  }
140 
141  // All done if we've looked at all instances.
142  if (it == it_end || ++it == it_end)
143  return true;
144 
145  // Return true if we've reached the page limit, false if we've reached the
146  // iteration limit.
147  bool done = data->show_list.size() >= page_limit;
148  SaveContextToData(it->second->name(), done, data);
149  return done;
150 }
151 
152 //
153 // Specialization of BgpShowHandler<>::FillShowList.
154 //
155 template <>
156 void BgpShowHandler<ShowBgpInstanceConfigReq, ShowBgpInstanceConfigReqIterate,
157  ShowBgpInstanceConfigResp, ShowBgpInstanceConfig>::FillShowList(
158  ShowBgpInstanceConfigResp *resp,
159  const vector<ShowBgpInstanceConfig> &show_list) {
160  resp->set_instances(show_list);
161 }
162 
163 //
164 // Handler for ShowBgpInstanceConfigReq.
165 //
166 void ShowBgpInstanceConfigReq::HandleRequest() const {
167  RequestPipeline::PipeSpec ps(this);
170 
171  s1.taskId_ = scheduler->GetTaskId("bgp::ShowCommand");
172  s1.cbFn_ = boost::bind(&BgpShowHandler<
173  ShowBgpInstanceConfigReq,
174  ShowBgpInstanceConfigReqIterate,
175  ShowBgpInstanceConfigResp,
176  ShowBgpInstanceConfig>::Callback, _1, _2, _3, _4, _5);
178  ShowBgpInstanceConfigReq,
179  ShowBgpInstanceConfigReqIterate,
180  ShowBgpInstanceConfigResp,
181  ShowBgpInstanceConfig>::CreateData;
182  s1.instances_.push_back(0);
183  ps.stages_.push_back(s1);
184  RequestPipeline rp(ps);
185 }
186 
187 //
188 // Handler for ShowBgpInstanceConfigReqIterate.
189 //
190 void ShowBgpInstanceConfigReqIterate::HandleRequest() const {
191  RequestPipeline::PipeSpec ps(this);
194 
195  s1.taskId_ = scheduler->GetTaskId("bgp::ShowCommand");
196  s1.cbFn_ = boost::bind(&BgpShowHandler<
197  ShowBgpInstanceConfigReq,
198  ShowBgpInstanceConfigReqIterate,
199  ShowBgpInstanceConfigResp,
200  ShowBgpInstanceConfig>::CallbackIterate, _1, _2, _3, _4, _5);
202  ShowBgpInstanceConfigReq,
203  ShowBgpInstanceConfigReqIterate,
204  ShowBgpInstanceConfigResp,
205  ShowBgpInstanceConfig>::CreateData;
206  s1.instances_.push_back(0);
207  ps.stages_.push_back(s1);
208  RequestPipeline rp(ps);
209 }
210 
211 //
212 // Fill in information for an routing policy.
213 //
214 static void FillBgpRoutingPolicyInfo(ShowBgpRoutingPolicyConfig *sbrpc,
215  const BgpSandeshContext *bsc, const BgpRoutingPolicyConfig *policy) {
216  sbrpc->set_name(policy->name());
217  std::vector<ShowBgpRoutingPolicyTermConfig> terms_list;
218  for (const auto &term : policy->terms()) {
219  ShowBgpRoutingPolicyTermConfig sbrptc;
220  sbrptc.set_match(term.match.ToString());
221  sbrptc.set_action(term.action.ToString());
222  terms_list.push_back(sbrptc);
223  }
224  sbrpc->set_terms(terms_list);
225 }
226 
227 //
228 // Specialization of BgpShowHandler<>::CallbackCommon.
229 //
230 template <>
231 bool BgpShowHandler<ShowBgpRoutingPolicyConfigReq,
232  ShowBgpRoutingPolicyConfigReqIterate, ShowBgpRoutingPolicyConfigResp,
233  ShowBgpRoutingPolicyConfig>::CallbackCommon(
234  const BgpSandeshContext *bsc, Data *data) {
235  uint32_t page_limit = bsc->page_limit() ? bsc->page_limit() : kPageLimit;
236  uint32_t iter_limit = bsc->iter_limit() ? bsc->iter_limit() : kIterLimit;
237  const BgpConfigManager *bcm = bsc->bgp_server->config_manager();
238 
239  regex search_expr(data->search_string);
241  bcm->RoutingPolicyMapItems(data->next_entry);
242  BgpConfigManager::RoutingPolicyMap::const_iterator it = range.first;
243  BgpConfigManager::RoutingPolicyMap::const_iterator it_end = range.second;
244  for (uint32_t iter_count = 0; it != it_end; ++it, ++iter_count) {
245  const BgpRoutingPolicyConfig *policy = it->second;
246  if (!regex_search(policy->name(), search_expr))
247  continue;
248  ShowBgpRoutingPolicyConfig sbrpc;
249  FillBgpRoutingPolicyInfo(&sbrpc, bsc, policy);
250  data->show_list.push_back(sbrpc);
251  if (data->show_list.size() >= page_limit)
252  break;
253  if (iter_count >= iter_limit)
254  break;
255  }
256 
257  // All done if we've looked at all policies.
258  if (it == it_end || ++it == it_end)
259  return true;
260 
261  // Return true if we've reached the page limit, false if we've reached the
262  // iteration limit.
263  bool done = data->show_list.size() >= page_limit;
264  SaveContextToData(it->second->name(), done, data);
265  return done;
266 }
267 
268 //
269 // Specialization of BgpShowHandler<>::FillShowList.
270 //
271 template <>
272 void BgpShowHandler<ShowBgpRoutingPolicyConfigReq,
273  ShowBgpRoutingPolicyConfigReqIterate, ShowBgpRoutingPolicyConfigResp,
274  ShowBgpRoutingPolicyConfig>::FillShowList(
275  ShowBgpRoutingPolicyConfigResp *resp,
276  const vector<ShowBgpRoutingPolicyConfig> &show_list) {
277  resp->set_routing_policies(show_list);
278 }
279 
280 
281 //
282 // Handler for ShowBgpRoutingPolicyConfigReq.
283 //
284 void ShowBgpRoutingPolicyConfigReq::HandleRequest() const {
285  RequestPipeline::PipeSpec ps(this);
288 
289  s1.taskId_ = scheduler->GetTaskId("bgp::ShowCommand");
290  s1.cbFn_ = boost::bind(&BgpShowHandler<
291  ShowBgpRoutingPolicyConfigReq,
292  ShowBgpRoutingPolicyConfigReqIterate,
293  ShowBgpRoutingPolicyConfigResp,
294  ShowBgpRoutingPolicyConfig>::Callback, _1, _2, _3, _4, _5);
296  ShowBgpRoutingPolicyConfigReq,
297  ShowBgpRoutingPolicyConfigReqIterate,
298  ShowBgpRoutingPolicyConfigResp,
299  ShowBgpRoutingPolicyConfig>::CreateData;
300  s1.instances_.push_back(0);
301  ps.stages_.push_back(s1);
302  RequestPipeline rp(ps);
303 }
304 
305 //
306 // Handler for ShowBgpRoutingPolicyConfigReqIterate.
307 //
308 void ShowBgpRoutingPolicyConfigReqIterate::HandleRequest() const {
309  RequestPipeline::PipeSpec ps(this);
312 
313  s1.taskId_ = scheduler->GetTaskId("bgp::ShowCommand");
314  s1.cbFn_ = boost::bind(&BgpShowHandler<
315  ShowBgpRoutingPolicyConfigReq,
316  ShowBgpRoutingPolicyConfigReqIterate,
317  ShowBgpRoutingPolicyConfigResp,
318  ShowBgpRoutingPolicyConfig>::CallbackIterate, _1, _2, _3, _4, _5);
320  ShowBgpRoutingPolicyConfigReq,
321  ShowBgpRoutingPolicyConfigReqIterate,
322  ShowBgpRoutingPolicyConfigResp,
323  ShowBgpRoutingPolicyConfig>::CreateData;
324  s1.instances_.push_back(0);
325  ps.stages_.push_back(s1);
326  RequestPipeline rp(ps);
327 }
328 
329 //
330 // Fill in information for a neighbor.
331 //
332 static void FillBgpNeighborConfigInfo(ShowBgpNeighborConfig *sbnc,
333  const BgpSandeshContext *bsc, const BgpNeighborConfig *neighbor) {
334  sbnc->set_instance_name(neighbor->instance_name());
335  sbnc->set_name(neighbor->name());
336  sbnc->set_admin_down(neighbor->admin_down());
337  sbnc->set_passive(neighbor->passive());
338  sbnc->set_as_override(neighbor->as_override());
339  const BgpNeighborConfig::OriginOverrideConfig &route_origin =
340  neighbor->origin_override();
341  sbnc->set_origin_override(route_origin.origin_override);
342  if (route_origin.origin_override) {
343  sbnc->set_route_origin(route_origin.origin);
344  } else {
345  sbnc->set_route_origin("-");
346  }
347  sbnc->set_private_as_action(neighbor->private_as_action());
348  sbnc->set_router_type(neighbor->router_type());
349  sbnc->set_local_identifier(neighbor->local_identifier_string());
350  sbnc->set_local_as(neighbor->local_as());
351  sbnc->set_autonomous_system(neighbor->peer_as());
352  sbnc->set_identifier(neighbor->peer_identifier_string());
353  sbnc->set_address(neighbor->peer_address().to_string());
354  sbnc->set_cluster_id(Ip4Address(neighbor->cluster_id()).to_string());
355  sbnc->set_source_port(neighbor->source_port());
356  sbnc->set_address_families(neighbor->GetAddressFamilies());
357  sbnc->set_hold_time(neighbor->hold_time());
358  sbnc->set_loop_count(neighbor->loop_count());
359  sbnc->set_last_change_at(UTCUsecToString(neighbor->last_change_at()));
360  sbnc->set_auth_type(neighbor->auth_data().KeyTypeToString());
361  if (bsc->test_mode()) {
362  sbnc->set_auth_keys(neighbor->auth_data().KeysToStringDetail());
363  }
364 
365  vector<ShowBgpNeighborFamilyConfig> sbnfc_list;
366  for (const auto& family_config :
367  neighbor->family_attributes_list()) {
368  ShowBgpNeighborFamilyConfig sbnfc;
369  sbnfc.set_family(family_config.family);
370  sbnfc.set_loop_count(family_config.loop_count);
371  sbnfc.set_prefix_limit(family_config.prefix_limit);
372  sbnfc.set_idle_timeout(family_config.idle_timeout);
373  sbnfc.set_default_tunnel_encap_list(
374  family_config.default_tunnel_encap_list);
375  if (family_config.family == "inet") {
376  IpAddress address = neighbor->gateway_address(Address::INET);
377  if (!address.is_unspecified())
378  sbnfc.set_gateway_address(address.to_string());
379  } else if (family_config.family == "inet6") {
380  IpAddress address = neighbor->gateway_address(Address::INET6);
381  if (!address.is_unspecified())
382  sbnfc.set_gateway_address(address.to_string());
383  }
384  sbnfc_list.push_back(sbnfc);
385  }
386  sbnc->set_family_attributes_list(sbnfc_list);
387 }
388 
389 //
390 // Specialization of BgpShowHandler<>::CallbackCommon.
391 //
392 template <>
393 bool BgpShowHandler<ShowBgpNeighborConfigReq, ShowBgpNeighborConfigReqIterate,
394  ShowBgpNeighborConfigResp, ShowBgpNeighborConfig>::CallbackCommon(
395  const BgpSandeshContext *bsc, Data *data) {
396  uint32_t page_limit = bsc->page_limit() ? bsc->page_limit() : kPageLimit;
397  uint32_t iter_limit = bsc->iter_limit() ? bsc->iter_limit() : kIterLimit;
398  const BgpConfigManager *bcm = bsc->bgp_server->config_manager();
399 
400  regex search_expr(data->search_string);
402  bcm->InstanceMapItems(data->next_entry);
403  BgpConfigManager::InstanceMap::const_iterator it = range.first;
404  BgpConfigManager::InstanceMap::const_iterator it_end = range.second;
405  for (uint32_t iter_count = 0; it != it_end; ++it, ++iter_count) {
406  const BgpInstanceConfig *instance = it->second;
407  BOOST_FOREACH(BgpConfigManager::NeighborMap::value_type value,
408  bcm->NeighborMapItems(instance->name())) {
409  const BgpNeighborConfig *neighbor = value.second;
410  if (!regex_search(neighbor->name(), search_expr))
411  continue;
412  ShowBgpNeighborConfig sbnc;
413  FillBgpNeighborConfigInfo(&sbnc, bsc, neighbor);
414  data->show_list.push_back(sbnc);
415  }
416  if (data->show_list.size() >= page_limit)
417  break;
418  if (iter_count >= iter_limit)
419  break;
420  }
421 
422  // All done if we've looked at all instances.
423  if (it == it_end || ++it == it_end)
424  return true;
425 
426  // Return true if we've reached the page limit, false if we've reached the
427  // iteration limit.
428  bool done = data->show_list.size() >= page_limit;
429  SaveContextToData(it->second->name(), done, data);
430  return done;
431 }
432 
433 //
434 // Specialization of BgpShowHandler<>::FillShowList.
435 //
436 template <>
437 void BgpShowHandler<ShowBgpNeighborConfigReq, ShowBgpNeighborConfigReqIterate,
438  ShowBgpNeighborConfigResp, ShowBgpNeighborConfig>::FillShowList(
439  ShowBgpNeighborConfigResp *resp,
440  const vector<ShowBgpNeighborConfig> &show_list) {
441  resp->set_neighbors(show_list);
442 }
443 
444 //
445 // Handler for ShowBgpNeighborConfigReq.
446 //
447 void ShowBgpNeighborConfigReq::HandleRequest() const {
448  RequestPipeline::PipeSpec ps(this);
451 
452  s1.taskId_ = scheduler->GetTaskId("bgp::ShowCommand");
453  s1.cbFn_ = boost::bind(&BgpShowHandler<
454  ShowBgpNeighborConfigReq,
455  ShowBgpNeighborConfigReqIterate,
456  ShowBgpNeighborConfigResp,
457  ShowBgpNeighborConfig>::Callback, _1, _2, _3, _4, _5);
459  ShowBgpNeighborConfigReq,
460  ShowBgpNeighborConfigReqIterate,
461  ShowBgpNeighborConfigResp,
462  ShowBgpNeighborConfig>::CreateData;
463  s1.instances_.push_back(0);
464  ps.stages_.push_back(s1);
465  RequestPipeline rp(ps);
466 }
467 
468 //
469 // Handler for ShowBgpNeighborConfigReqIterate.
470 //
471 void ShowBgpNeighborConfigReqIterate::HandleRequest() const {
472  RequestPipeline::PipeSpec ps(this);
475 
476  s1.taskId_ = scheduler->GetTaskId("bgp::ShowCommand");
477  s1.cbFn_ = boost::bind(&BgpShowHandler<
478  ShowBgpNeighborConfigReq,
479  ShowBgpNeighborConfigReqIterate,
480  ShowBgpNeighborConfigResp,
481  ShowBgpNeighborConfig>::CallbackIterate, _1, _2, _3, _4, _5);
483  ShowBgpNeighborConfigReq,
484  ShowBgpNeighborConfigReqIterate,
485  ShowBgpNeighborConfigResp,
486  ShowBgpNeighborConfig>::CreateData;
487  s1.instances_.push_back(0);
488  ps.stages_.push_back(s1);
489  RequestPipeline rp(ps);
490 }
491 
492 //
493 // Handler for ShowBgpPeeringConfigReq.
494 //
495 void ShowBgpPeeringConfigReq::HandleRequest() const {
496  BgpSandeshContext *bsc = static_cast<BgpSandeshContext *>(client_context());
497  bsc->PeeringShowReqHandler(this);
498 }
499 
500 //
501 // Handler for ShowBgpPeeringConfigReqIterate.
502 //
503 void ShowBgpPeeringConfigReqIterate::HandleRequest() const {
504  BgpSandeshContext *bsc = static_cast<BgpSandeshContext *>(client_context());
505  bsc->PeeringShowReqIterateHandler(this);
506 }
507 
508 //
509 // Fill in information for an instance.
510 //
511 static void FillBgpGlobalSystemConfigInfo(ShowBgpGlobalSystemConfig *sbgc,
512  const BgpSandeshContext *bsc, const BgpGlobalSystemConfig *bgsc) {
513 
514  sbgc->set_gr_time(bgsc->gr_time());
515  sbgc->set_llgr_time(bgsc->llgr_time());
516  sbgc->set_last_change_at(bgsc->last_change_at());
517  sbgc->set_end_of_rib_timeout(bgsc->end_of_rib_timeout());
518  sbgc->set_gr_bgp_helper(bgsc->gr_bgp_helper());
519  sbgc->set_gr_xmpp_helper(bgsc->gr_xmpp_helper());
520  sbgc->set_gr_enable(bgsc->gr_enable());
521  sbgc->set_always_compare_med(bgsc->always_compare_med());
522  sbgc->set_rd_cluster_seed(bgsc->rd_cluster_seed());
523  sbgc->set_bgpaas_port_start(bgsc->bgpaas_port_start());
524  sbgc->set_bgpaas_port_end(bgsc->bgpaas_port_end());
525 }
526 
527 //
528 //Specialization of BgpShowHandler<>::ConvertReqToData
529 //
530 template <>
531 void BgpShowHandler<ShowBgpGlobalSystemConfigReq,
532  ShowBgpGlobalSystemConfigReqIterate,
533  ShowBgpGlobalSystemConfigResp,
534  ShowBgpGlobalSystemConfig>::ConvertReqToData(
535  const ShowBgpGlobalSystemConfigReq *req, Data *data) {
536 
537  data->initialized = true;
538 }
539 
540 //
541 // Specialization of BgpShowHandler<>::CallbackCommon.
542 //
543 template <>
544 bool BgpShowHandler<ShowBgpGlobalSystemConfigReq,
545  ShowBgpGlobalSystemConfigReqIterate,
546  ShowBgpGlobalSystemConfigResp,
547  ShowBgpGlobalSystemConfig>::CallbackCommon(
548  const BgpSandeshContext *bsc, Data *data) {
549 
550  const BgpGlobalSystemConfig *bgsc = bsc->bgp_server->global_config();
551 
552  ShowBgpGlobalSystemConfig sbgc;
553  FillBgpGlobalSystemConfigInfo(&sbgc, bsc, bgsc);
554  data->show_list.push_back(sbgc);
555 
556  return true;
557 }
558 
559 //
560 // Specialization of BgpShowHandler<>::FillShowList.
561 //
562 template <>
563 void BgpShowHandler<ShowBgpGlobalSystemConfigReq,
564  ShowBgpGlobalSystemConfigReqIterate,
565  ShowBgpGlobalSystemConfigResp,
566  ShowBgpGlobalSystemConfig>::FillShowList(
567  ShowBgpGlobalSystemConfigResp *resp,
568  const vector<ShowBgpGlobalSystemConfig> &show_list) {
569  resp->set_global_instances(show_list);
570 }
571 
572 //
573 // Handler for ShowBgpGlobalSystemConfigReq.
574 //
575 void ShowBgpGlobalSystemConfigReq::HandleRequest() const {
576  RequestPipeline::PipeSpec ps(this);
579 
580  s1.taskId_ = scheduler->GetTaskId("bgp::ShowCommand");
581  s1.cbFn_ = boost::bind(&BgpShowHandler<
582  ShowBgpGlobalSystemConfigReq,
583  ShowBgpGlobalSystemConfigReqIterate,
584  ShowBgpGlobalSystemConfigResp,
585  ShowBgpGlobalSystemConfig>::Callback, _1, _2, _3, _4, _5);
586 
588  ShowBgpGlobalSystemConfigReq,
589  ShowBgpGlobalSystemConfigReqIterate,
590  ShowBgpGlobalSystemConfigResp,
591  ShowBgpGlobalSystemConfig>::CreateData;
592 
593  s1.instances_.push_back(0);
594  ps.stages_.push_back(s1);
595  RequestPipeline rp(ps);
596 }
597 
598 //
599 // Handler for ShowBgpGlobalSystemConfigReqIterate.
600 //
601 void ShowBgpGlobalSystemConfigReqIterate::HandleRequest() const {
602  RequestPipeline::PipeSpec ps(this);
605 
606  s1.taskId_ = scheduler->GetTaskId("bgp::ShowCommand");
607  s1.cbFn_ = boost::bind(&BgpShowHandler<
608  ShowBgpGlobalSystemConfigReq,
609  ShowBgpGlobalSystemConfigReqIterate,
610  ShowBgpGlobalSystemConfigResp,
611  ShowBgpGlobalSystemConfig>::CallbackIterate, _1, _2, _3, _4, _5);
612 
614  ShowBgpGlobalSystemConfigReq,
615  ShowBgpGlobalSystemConfigReqIterate,
616  ShowBgpGlobalSystemConfigResp,
617  ShowBgpGlobalSystemConfig>::CreateData;
618 
619  s1.instances_.push_back(0);
620  ps.stages_.push_back(s1);
621  RequestPipeline rp(ps);
622 }
const std::string & virtual_network() const
Definition: bgp_config.h:454
std::vector< int > instances_
virtual NeighborMapRange NeighborMapItems(const std::string &instance_name) const =0
const RouteTargetList & import_list() const
Definition: bgp_config.h:442
const OriginOverrideConfig & origin_override() const
Definition: bgp_config.h:273
static Address::Family SCFamilyToAddressFamily(Family family)
The TaskScheduler keeps track of what tasks are currently schedulable. When a task is enqueued it is ...
Definition: task.h:178
bool admin_down() const
Definition: bgp_config.h:181
uint64_t last_change_at() const
Definition: bgp_config.h:262
static void FillBgpGlobalSystemConfigInfo(ShowBgpGlobalSystemConfig *sbgc, const BgpSandeshContext *bsc, const BgpGlobalSystemConfig *bgsc)
std::pair< RoutingPolicyMap::const_iterator, RoutingPolicyMap::const_iterator > RoutingPolicyMapRange
Definition: bgp_config.h:755
const std::string & name() const
Definition: bgp_config.h:162
std::pair< InstanceMap::const_iterator, InstanceMap::const_iterator > InstanceMapRange
Definition: bgp_config.h:758
const std::string & instance_name() const
Definition: bgp_config.h:168
bool gr_bgp_helper() const
Definition: bgp_config.h:631
BgpServer * bgp_server
Definition: bgp_sandesh.h:46
std::string KeyTypeToString() const
Definition: bgp_config.cc:114
Family
Definition: address.h:24
boost::asio::ip::address IpAddress
Definition: address.h:13
uint32_t last_change_at() const
Definition: bgp_config.h:627
BgpGlobalSystemConfig * global_config()
Definition: bgp_server.h:290
uint16_t rd_cluster_seed() const
Definition: bgp_config.h:661
static void FillBgpNeighborConfigInfo(ShowBgpNeighborConfig *sbnc, const BgpSandeshContext *bsc, const BgpNeighborConfig *neighbor)
const RouteTargetList & export_list() const
Definition: bgp_config.h:446
const FamilyAttributesList & family_attributes_list() const
Definition: bgp_config.h:253
std::string router_type() const
Definition: bgp_config.h:222
bool virtual_network_pbb_evpn_enable() const
Definition: bgp_config.h:471
std::string private_as_action() const
Definition: bgp_config.h:190
uint8_t loop_count() const
Definition: bgp_config.h:230
int GetTaskId(const std::string &name)
Definition: task.cc:856
std::vector< std::string > KeysToStringDetail() const
Definition: bgp_config.cc:143
bool has_pnf() const
Definition: bgp_config.h:451
static bool regex_match(const std::string &input, const regex &regex)
Definition: regex.h:34
bool gr_xmpp_helper() const
Definition: bgp_config.h:633
int hold_time() const
Definition: bgp_config.h:227
uint32_t peer_as() const
Definition: bgp_config.h:198
const std::string & name() const
Definition: bgp_config.h:405
uint16_t source_port() const
Definition: bgp_config.h:219
bool always_compare_med() const
Definition: bgp_config.h:651
bool test_mode() const
Definition: bgp_sandesh.h:61
uint16_t gr_time() const
Definition: bgp_config.h:623
static const std::string integerToString(const NumberType &num)
Definition: string_util.h:19
bool as_override() const
Definition: bgp_config.h:187
static TaskScheduler * GetInstance()
Definition: task.cc:547
uint32_t iter_limit() const
Definition: bgp_sandesh.h:65
BgpConfigManager * config_manager()
Definition: bgp_server.h:100
uint64_t last_change_at() const
Definition: bgp_config.h:482
uint16_t end_of_rib_timeout() const
Definition: bgp_config.h:629
const AuthenticationData & auth_data() const
Definition: bgp_config.h:244
std::string peer_identifier_string() const
Definition: bgp_config.h:209
std::vector< ShowT > show_list
uint32_t local_as() const
Definition: bgp_config.h:233
static bool regex_search(const std::string &input, const regex &regex)
Definition: regex.h:25
const ServiceChainList & service_chain_list() const
Definition: bgp_config.h:488
boost::asio::ip::address_v4 Ip4Address
Definition: address.h:14
uint16_t bgpaas_port_start() const
Definition: bgp_config.h:667
uint32_t cluster_id() const
Definition: bgp_config.h:195
virtual InstanceMapRange InstanceMapItems(const std::string &start_instance=std::string()) const =0
AddressFamilyList GetAddressFamilies() const
Definition: bgp_config.cc:283
static std::string FamilyToString(Family fmly)
Definition: address.cc:63
uint32_t page_limit() const
Definition: bgp_sandesh.h:63
const AggregateRouteList & aggregate_routes(Address::Family family) const
Definition: bgp_config.cc:390
uint16_t bgpaas_port_end() const
Definition: bgp_config.h:671
const IpAddress & gateway_address(Address::Family family) const
Definition: bgp_config.cc:262
static void FillBgpRoutingPolicyInfo(ShowBgpRoutingPolicyConfig *sbrpc, const BgpSandeshContext *bsc, const BgpRoutingPolicyConfig *policy)
const RoutingPolicyConfigList & routing_policy_list() const
Definition: bgp_config.h:497
bool passive() const
Definition: bgp_config.h:184
void PeeringShowReqHandler(const ShowBgpPeeringConfigReq *req)
Definition: bgp_sandesh.cc:694
int vxlan_id() const
Definition: bgp_config.h:479
std::string local_identifier_string() const
Definition: bgp_config.h:240
const NeighborList & neighbor_list() const
Definition: bgp_config.h:434
int virtual_network_index() const
Definition: bgp_config.h:459
void PeeringShowReqIterateHandler(const ShowBgpPeeringConfigReqIterate *req_iterate)
Definition: bgp_sandesh.cc:704
const std::string & name() const
Definition: bgp_config.h:432
bool virtual_network_allow_transit() const
Definition: bgp_config.h:464
uint32_t llgr_time() const
Definition: bgp_config.h:625
const IpAddress & peer_address() const
Definition: bgp_config.h:201
bool gr_enable() const
Definition: bgp_config.h:635
static void FillBgpInstanceConfigInfo(ShowBgpInstanceConfig *sbic, const BgpSandeshContext *bsc, const BgpInstanceConfig *instance)
virtual RoutingPolicyMapRange RoutingPolicyMapItems(const std::string &start_policy=std::string()) const =0
const StaticRouteList & static_routes(Address::Family family) const
Definition: bgp_config.cc:359
static std::string UTCUsecToString(uint64_t tstamp)
Definition: time_util.h:54
const RoutingPolicyTermList & terms() const
Definition: bgp_config.h:410