OpenSDN source code
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
routing_policy.cc
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015 Juniper Networks, Inc. All rights reserved.
3  */
4 
6 
7 #include <boost/assign/list_of.hpp>
8 #include <boost/foreach.hpp>
9 
10 #include "base/task_annotations.h"
11 #include "base/task_trigger.h"
12 #include "bgp/bgp_config.h"
13 #include "bgp/bgp_factory.h"
14 #include "bgp/bgp_server.h"
15 #include "bgp/bgp_table.h"
19 
20 
22 public:
23  explicit DeleteActor(RoutingPolicyMgr *manager)
24  : LifetimeActor(manager->server_->lifetime_manager()),
25  manager_(manager) {
26  }
27  virtual bool MayDelete() const {
28  return true;
29  }
30  virtual void Shutdown() {
31  }
32  virtual void Destroy() {
33  // memory is deallocated by BgpServer scoped_ptr.
35  }
36 
37 private:
39 };
40 
42  server_(server),
43  deleter_(new DeleteActor(this)),
44  server_delete_ref_(this, server->deleter()),
45  trace_buf_(SandeshTraceBufferCreate("RoutingPolicyMgr", 500)) {
46 }
47 
49 }
50 
52  deleter_->Delete();
53 }
54 
56  return deleter_.get();
57 }
58 
60  return deleter()->IsDeleted();
61 }
62 
64  const BgpRoutingPolicyConfig *config) {
65  RoutingPolicy *policy = GetRoutingPolicy(config->name());
66 
67  if (policy) {
68  if (policy->deleted()) {
69  return NULL;
70  }
71  return policy;
72  }
73 
74  policy = BgpStaticObjectFactory::Create<RoutingPolicy>(
75  config->name(), server_, this, config);
76  routing_policies_.insert(std::make_pair(config->name(), policy));
77  policy->ProcessConfig();
78 
79  return policy;
80 }
81 
83  const BgpRoutingPolicyConfig *config) {
84  CHECK_CONCURRENCY("bgp::Config");
85 
86  RoutingPolicy *policy = GetRoutingPolicy(config->name());
87  if (policy && policy->deleted()) {
88  return;
89  } else if (!policy) {
90  return;
91  }
92 
93  policy->UpdateConfig(config);
94 }
95 
96 //
97 // Concurrency: BGP Config task
98 //
99 // Trigger deletion of a particular routing-policy
100 //
101 void RoutingPolicyMgr::DeleteRoutingPolicy(const std::string &name) {
102  CHECK_CONCURRENCY("bgp::Config");
103 
104  RoutingPolicy *policy = GetRoutingPolicy(name);
105 
106  if (policy && policy->deleted()) {
107  return;
108  } else if (!policy) {
109  return;
110  }
111 
112  policy->ClearConfig();
113 
114  policy->ManagedDelete();
115 }
116 
117 //
118 // Concurrency: Called from BGP config task manager
119 //
121  CHECK_CONCURRENCY("bgp::Config");
122 
123  const std::string name = policy->name();
124  routing_policies_.erase(name);
125  delete policy;
126 
127  if (deleted()) return;
128 
129  const BgpRoutingPolicyConfig *config
131  if (config) {
132  CreateRoutingPolicy(config);
133  return;
134  }
135 }
136 
137 // Given a routing instance re-evaluate routes/paths by applying routing policy
138 // Walks all the tables of the given routing instance and apply the policy
139 // This function puts the table into the walk request queue and triggers the
140 // task to start the actual walk
142  CHECK_CONCURRENCY("bgp::Config", "bgp::ConfigHelper");
143 
144  tbb::mutex::scoped_lock lock(mutex_);
145  BOOST_FOREACH(RoutingInstance::RouteTableList::value_type &entry,
146  instance->GetTables()) {
147  BgpTable *table = entry.second;
148  if (table->IsRoutingPolicySupported())
149  RequestWalk(table);
150  }
151 }
152 
153 // On a given path of the route, apply the policy
155  const RoutingPolicy *policy, const BgpRoute *route,
156  const BgpPath *path, BgpAttr *attr) const {
157  return (*policy)(route, path, attr);
158 }
159 
160 //
161 // Concurrency: Called in the context of the DB partition task.
162 // On a given route, apply routing policy
163 // Walk through all the paths of the given route, and evaluate the result of the
164 // routing policy
165 //
167  DBEntryBase *entry) {
168  CHECK_CONCURRENCY("db::DBTable");
169 
170  BgpTable *table = static_cast<BgpTable *>(root->parent());
171  BgpRoute *route = static_cast<BgpRoute *>(entry);
172  const RoutingInstance *rtinstance = table->routing_instance();
173  if (route->IsDeleted()) return true;
174 
175  bool sort_and_notify = false;
176  const Path *prev_front = route->front();
177  for (Route::PathList::iterator it = route->GetPathList().begin();
178  it != route->GetPathList().end(); ++it) {
179  BgpPath *path = static_cast<BgpPath *>(it.operator->());
180  uint32_t old_flags = path->GetFlags();
181  const BgpAttr *old_attr = path->GetAttr();
182  rtinstance->ProcessRoutingPolicy(route, path);
183  if ((sort_and_notify == false) &&
184  (old_flags != path->GetFlags() || old_attr != path->GetAttr())) {
185  sort_and_notify = true;
186  }
187  }
188 
189  if (sort_and_notify) {
190  route->Sort(&BgpTable::PathSelection, prev_front);
191  root->Notify(entry);
192  }
193  return true;
194 }
195 
196 //
197 //
199  const RoutingPolicyConfigList &cfg_list,
200  RoutingPolicyAttachList *oper_list) {
201  CHECK_CONCURRENCY("bgp::Config", "bgp::ConfigHelper");
202 
203  tbb::mutex::scoped_lock lock(mutex_);
204  bool update_policy = false;
205  // Number of routing policies is different
206  if (oper_list->size() != cfg_list.size())
207  update_policy = true;
208 
209  RoutingPolicyAttachList::iterator oper_it = oper_list->begin(), oper_next;
210  RoutingPolicyConfigList::const_iterator config_it = cfg_list.begin();
211  while (oper_it != oper_list->end() &&
212  config_it != cfg_list.end()) {
213  // Compare the configured routing policies on the routing-instance
214  // with operational data.
215  if (oper_it->first->name() == config_it->routing_policy_) {
216  if (oper_it->second != oper_it->first->generation()) {
217  // Policy content is updated
218  oper_it->second = oper_it->first->generation();
219  update_policy = true;
220  }
221  ++oper_it;
222  ++config_it;
223  } else {
224  // Policy Order is updated or new policy is added
225  // or policy is deleted
226  RoutingPolicy *policy =
227  GetRoutingPolicy(config_it->routing_policy_);
228  if (policy) {
229  *oper_it = std::make_pair(policy, policy->generation());
230  ++oper_it;
231  ++config_it;
232  update_policy = true;
233  } else {
234  // points to routing policy that doesn't exists
235  // will revisit in next config notification
236  ++config_it;
237  }
238  }
239  }
240  for (oper_next = oper_it; oper_it != oper_list->end();
241  oper_it = oper_next) {
242  // Existing policy(ies) are removed
243  ++oper_next;
244  oper_list->erase(oper_it);
245  update_policy = true;
246  }
247  for (; config_it != cfg_list.end(); ++config_it) {
248  // new policy(ies) are added
249  RoutingPolicy *policy = GetRoutingPolicy(config_it->routing_policy_);
250  if (policy) {
251  oper_list->push_back(std::make_pair(policy, policy->generation()));
252  }
253  update_policy = true;
254  }
255 
256  return update_policy;
257 }
258 
259 void
261  CHECK_CONCURRENCY("bgp::Config", "bgp::ConfigHelper");
262  RoutingPolicyWalkRequests::iterator it = routing_policy_sync_.find(table);
263  if (it == routing_policy_sync_.end()) {
264  DBTable::DBTableWalkRef walk_ref = table->AllocWalker(
265  boost::bind(&RoutingPolicyMgr::EvaluateRoutingPolicy, this, _1, _2),
266  boost::bind(&RoutingPolicyMgr::WalkDone, this, _2));
267  table->WalkTable(walk_ref);
268  routing_policy_sync_.insert(std::make_pair(table, walk_ref));
269  } else {
270  table->WalkAgain(it->second);
271  }
272 }
273 
274 void
276  CHECK_CONCURRENCY("db::Walker");
277  BgpTable *table = static_cast<BgpTable *>(dbtable);
278  RoutingPolicyWalkRequests::iterator it = routing_policy_sync_.find(table);
279  assert(it != routing_policy_sync_.end());
280  DBTable::DBTableWalkRef walk_ref = it->second;
281  routing_policy_sync_.erase(it);
282  table->ReleaseWalker(walk_ref);
283 }
284 
286 public:
288  : LifetimeActor(server->lifetime_manager()), parent_(parent) {
289  }
290  virtual bool MayDelete() const {
291  return parent_->MayDelete();
292  }
293  virtual void Shutdown() {
294  parent_->Shutdown();
295  }
296  virtual void Destroy() {
298  }
299 
300 private:
302 };
303 
304 RoutingPolicy::RoutingPolicy(std::string name, BgpServer *server,
305  RoutingPolicyMgr *mgr,
306  const BgpRoutingPolicyConfig *config)
307  : name_(name), server_(server), mgr_(mgr), config_(config),
308  deleter_(new DeleteActor(server, this)),
309  manager_delete_ref_(this, mgr->deleter()), generation_(0) {
310  refcount_ = 0;
311 }
312 
314  terms_.clear();
315 }
316 
318  const RoutingPolicyTermConfig &cfg_term) {
319  PolicyTerm::ActionList actions;
320  PolicyTerm::MatchList matches;
321 
322  if (!cfg_term.match.community_match.empty()) {
323  MatchCommunity *community = new MatchCommunity(
324  cfg_term.match.community_match,
325  cfg_term.match.community_match_all);
326  matches.push_back(community);
327  }
328 
329  if (!cfg_term.match.ext_community_match.empty()) {
330  MatchExtCommunity *ext_community = new MatchExtCommunity(
331  cfg_term.match.ext_community_match,
332  cfg_term.match.ext_community_match_all);
333  matches.push_back(ext_community);
334  }
335 
336  if (!cfg_term.match.protocols_match.empty()) {
337  MatchProtocol *protocol =
338  new MatchProtocol(cfg_term.match.protocols_match);
339  matches.push_back(protocol);
340  }
341 
342  if (!cfg_term.match.prefixes_to_match.empty()) {
343  PrefixMatchConfigList inet_prefix_list;
344  PrefixMatchConfigList inet6_prefix_list;
345  BOOST_FOREACH(PrefixMatchConfig match,
346  cfg_term.match.prefixes_to_match) {
347  boost::system::error_code ec;
348  Ip4Address ip4;
349  int plen;
350  ec = Ip4PrefixParse(match.prefix_to_match, &ip4, &plen);
351  if (ec.value() == 0) {
352  inet_prefix_list.push_back(match);
353  } else {
354  Ip6Address ip6;
355  ec = Inet6PrefixParse(match.prefix_to_match, &ip6, &plen);
356  if (ec.value() == 0) {
357  inet6_prefix_list.push_back(match);
358  }
359  }
360  }
361  if (!inet_prefix_list.empty()) {
362  MatchPrefixInet *prefix = new MatchPrefixInet(inet_prefix_list);
363  matches.push_back(prefix);
364  }
365  if (!inet6_prefix_list.empty()) {
366  MatchPrefixInet6 *prefix = new MatchPrefixInet6(inet6_prefix_list);
367  matches.push_back(prefix);
368  }
369  }
370 
371  // Build the Action object
374  actions.push_back(action);
375  } else if (cfg_term.action.action == RoutingPolicyActionConfig::NEXT_TERM) {
377  actions.push_back(action);
378  } else if (cfg_term.action.action == RoutingPolicyActionConfig::ACCEPT) {
380  actions.push_back(action);
381  }
382 
383  if (!cfg_term.action.update.aspath_expand.empty()) {
384  UpdateAsPath *expand_aspath =
385  new UpdateAsPath(cfg_term.action.update.aspath_expand);
386  actions.push_back(expand_aspath);
387  }
388 
389  if (!cfg_term.action.update.community_set.empty()) {
390  UpdateCommunity *set_comm =
391  new UpdateCommunity(cfg_term.action.update.community_set, "set");
392  actions.push_back(set_comm);
393  }
394 
395  if (!cfg_term.action.update.community_remove.empty()) {
396  UpdateCommunity *remove_comm =
397  new UpdateCommunity(cfg_term.action.update.community_remove, "remove");
398  actions.push_back(remove_comm);
399  }
400 
401  if (!cfg_term.action.update.community_add.empty()) {
402  UpdateCommunity *add_comm =
403  new UpdateCommunity(cfg_term.action.update.community_add, "add");
404  actions.push_back(add_comm);
405  }
406 
407  if (!cfg_term.action.update.ext_community_set.empty()) {
408  UpdateExtCommunity *set_comm = new UpdateExtCommunity(
409  cfg_term.action.update.ext_community_set, "set");
410  actions.push_back(set_comm);
411  }
412 
413  if (!cfg_term.action.update.ext_community_remove.empty()) {
414  UpdateExtCommunity *remove_comm = new UpdateExtCommunity(
415  cfg_term.action.update.ext_community_remove, "remove");
416  actions.push_back(remove_comm);
417  }
418 
419  if (!cfg_term.action.update.ext_community_add.empty()) {
420  UpdateExtCommunity *add_comm = new UpdateExtCommunity(
421  cfg_term.action.update.ext_community_add, "add");
422  actions.push_back(add_comm);
423  }
424 
425  if (cfg_term.action.update.local_pref) {
426  UpdateLocalPref *local_pref =
427  new UpdateLocalPref(cfg_term.action.update.local_pref);
428  actions.push_back(local_pref);
429  }
430 
431  if (cfg_term.action.update.med) {
432  UpdateMed *med =
433  new UpdateMed(cfg_term.action.update.med);
434  actions.push_back(med);
435  }
436 
437  PolicyTermPtr ret_term;
438  if (!actions.empty() || !matches.empty()) {
439  ret_term = PolicyTermPtr(new PolicyTerm());
440  ret_term->set_actions(actions);
441  ret_term->set_matches(matches);
442  }
443 
444  return ret_term;
445 }
446 
448  BOOST_FOREACH(const RoutingPolicyTermConfig cfg_term, config_->terms()) {
449  // Build each terms and insert to operational data
450  PolicyTermPtr term = BuildTerm(cfg_term);
451  if (term)
452  add_term(term);
453  }
454 }
455 
456 //
457 // Reprogram policy terms based on new config.
458 // If the policy term has changed (number of terms got updated, or new term is
459 // added or earlier term is deleted or existing term is updated), increment the
460 // generation number to indicate the update
461 //
463  CHECK_CONCURRENCY("bgp::Config");
464  config_ = cfg;
465  bool update_policy = false;
466  if (terms()->size() != config_->terms().size())
467  update_policy = true;
468 
469  RoutingPolicyTermList::iterator oper_it = terms()->begin(), oper_next;
470  BgpRoutingPolicyConfig::RoutingPolicyTermList::const_iterator
471  config_it = config_->terms().begin();
472  while (oper_it != terms()->end() && config_it != config_->terms().end()) {
473  PolicyTermPtr term = BuildTerm(*config_it);
474  if (**oper_it == *term) {
475  ++oper_it;
476  ++config_it;
477  } else {
478  if (term) {
479  *oper_it = term;
480  update_policy = true;
481  ++oper_it;
482  ++config_it;
483  } else {
484  ++config_it;
485  }
486  }
487  }
488  for (oper_next = oper_it; oper_it != terms()->end(); oper_it = oper_next) {
489  ++oper_next;
490  terms()->erase(oper_it);
491  update_policy = true;
492  }
493  for (; config_it != config_->terms().end(); ++config_it) {
494  PolicyTermPtr term = BuildTerm(*config_it);
495  if (term)
496  add_term(term);
497  update_policy = true;
498  }
499 
500  if (update_policy) generation_++;
501 }
502 
504  CHECK_CONCURRENCY("bgp::Config");
505  config_ = NULL;
506 }
507 
509  deleter_->Delete();
510 }
511 
513  CHECK_CONCURRENCY("bgp::Config");
514  ClearConfig();
515 }
516 
518  return (refcount_ == 0);
519 }
520 
522  return deleter_.get();
523 }
524 
526  return deleter_.get();
527 }
528 
530  return deleter()->IsDeleted();
531 }
532 
533 //
534 // Attempt to enqueue a delete for the RoutingPolicy.
535 //
537  if (!deleter_->IsDeleted())
538  return;
539  deleter_->RetryDelete();
540 }
541 
543  const BgpPath *path, BgpAttr *attr) const {
544  BOOST_FOREACH(PolicyTermPtr term, terms()) {
545  bool terminal = term->terminal();
546  bool matched = term->ApplyTerm(route, path, attr);
547  if (matched && terminal) {
548  return std::make_pair(terminal,
549  (*term->actions().begin())->accept());
550  }
551  }
552  return std::make_pair(false, true);
553 }
554 
556 }
557 
561 }
562 
563 bool PolicyTerm::terminal() const {
564  if (!actions().empty())
565  return (*actions().begin())->terminal();
566  return false;
567 }
568 
569 bool PolicyTerm::ApplyTerm(const BgpRoute *route, const BgpPath *path,
570  BgpAttr *attr) const {
571  bool matched = true;
572  BOOST_FOREACH(RoutingPolicyMatch *match, matches()) {
573  if (!(*match)(route, path, attr)) {
574  matched = false;
575  break;
576  }
577  }
578  if (matched) {
579  bool first = true;
580  BOOST_FOREACH(RoutingPolicyAction *action, actions()) {
581  // First action defines what to do with the route
582  // accept/reject/next-term
583  if (first) {
584  if (action->terminal()) {
585  if (!action->accept()) {
586  // out_attr is unaltered
587  break;
588  }
589  }
590  first = false;
591  } else {
592  RoutingPolicyUpdateAction *update =
593  static_cast<RoutingPolicyUpdateAction *>(action);
594  (*update)(attr);
595  }
596  }
597  }
598  return matched;
599 }
600 
601 // Compare two terms
602 bool PolicyTerm::operator==(const PolicyTerm &rhs) const {
603  // Different number of match conditions
604  if (matches().size() != rhs.matches().size()) return false;
605  // Different number of actions conditions
606  if (actions().size() != rhs.actions().size()) return false;
607 
608  // Walk the list of match conditions and compare each match
609  for (MatchList::const_iterator rhs_matches_cit = rhs.matches().begin(),
610  lhs_matches_cit = matches().begin();
611  lhs_matches_cit != matches().end();
612  lhs_matches_cit++, rhs_matches_cit++) {
613  if (**rhs_matches_cit != **lhs_matches_cit)
614  return false;
615  }
616 
617  // Walk the list of actions and compare each action
618  for (ActionList::const_iterator lhs_actions_cit = actions().begin(),
619  rhs_actions_cit = rhs.actions().begin();
620  lhs_actions_cit != actions().end();
621  lhs_actions_cit++, rhs_actions_cit++) {
622  if (**rhs_actions_cit != **lhs_actions_cit)
623  return false;
624  }
625  return true;
626 }
virtual ~RoutingPolicyMgr()
RoutingPolicyTermList terms_
virtual bool MayDelete() const
MatchList matches_
uint32_t local_pref
Definition: bgp_config.h:378
PolicyResult operator()(const BgpRoute *route, const BgpPath *path, BgpAttr *attr) const
RoutingPolicyTermList * terms()
void DestroyRoutingPolicy(RoutingPolicy *policy)
void Sort(Compare compare, const Path *prev_front)
Definition: route.cc:40
void STLDeleteValues(Container *container)
Definition: util.h:101
virtual ~RoutingPolicy()
void WalkTable(DBTableWalkRef walk)
Definition: db_table.cc:625
boost::system::error_code Ip4PrefixParse(const string &str, Ip4Address *addr, int *plen)
Definition: address.cc:107
autogen::PolicyMatch match
const BgpRoutingPolicyConfig * config_
RoutingPolicy * GetRoutingPolicy(const std::string &name)
BgpServer * server_
bool UpdateRoutingPolicyList(const RoutingPolicyConfigList &cfg_list, RoutingPolicyAttachList *oper_list)
RoutingInstance * routing_instance()
Definition: bgp_table.h:148
bool IsDeleted() const
Definition: db_entry.h:49
uint32_t generation_
BgpServer * server()
RoutingPolicyMgr * mgr_
PrefixMatchConfigList prefixes_to_match
Definition: bgp_config.h:362
boost::scoped_ptr< DeleteActor > deleter_
CommunityList community_match
Definition: bgp_config.h:363
virtual void DeleteRoutingPolicy(const std::string &name)
DBTableWalkRef AllocWalker(WalkFn walk_fn, WalkCompleteFn walk_complete)
Definition: db_table.cc:613
DBTableBase * parent()
PolicyTermPtr BuildTerm(const RoutingPolicyTermConfig &term)
ActionList actions_
boost::scoped_ptr< DeleteActor > deleter_
boost::shared_ptr< PolicyTerm > PolicyTermPtr
CommunityList ext_community_remove
Definition: bgp_config.h:377
LifetimeActor * deleter()
std::string prefix_to_match
Definition: bgp_config.h:354
uint32_t GetFlags() const
Definition: bgp_path.h:100
LifetimeActor * deleter()
bool MayDelete() const
virtual bool accept() const =0
void ReleaseWalker(DBTableWalkRef &walk)
Definition: db_table.cc:619
ProtocolList protocols_match
Definition: bgp_config.h:361
bool operator==(const PolicyTerm &term) const
CommunityList community_remove
Definition: bgp_config.h:374
RoutingPolicyActionConfig action
Definition: bgp_config.h:395
RouteTableList & GetTables()
void WalkAgain(DBTableWalkRef walk)
Definition: db_table.cc:631
const std::string & name() const
Definition: bgp_config.h:405
BgpServer * server()
bool deleted() const
void RequestWalk(BgpTable *table)
const ActionList & actions() const
virtual bool IsRoutingPolicySupported() const
Definition: bgp_table.h:111
DeleteActor(RoutingPolicyMgr *manager)
bool IsDeleted() const
Definition: lifetime.h:131
Definition: path.h:10
virtual const BgpRoutingPolicyConfig * FindRoutingPolicy(const std::string &name) const =0
void Reset(LifetimeActor *actor)
Definition: lifetime.h:82
std::vector< PrefixMatchConfig > PrefixMatchConfigList
Definition: bgp_config.h:358
BgpConfigManager * config_manager()
Definition: bgp_server.h:100
boost::asio::ip::address_v6 Ip6Address
Definition: address.h:15
void WalkDone(DBTableBase *dbtable)
virtual bool terminal() const =0
RoutingPolicy::PolicyResult ExecuteRoutingPolicy(const RoutingPolicy *policy, const BgpRoute *route, const BgpPath *path, BgpAttr *attr) const
MatchPrefix< PrefixMatchInet > MatchPrefixInet
#define CHECK_CONCURRENCY(...)
std::vector< RoutingPolicyAttachInfo > RoutingPolicyConfigList
Definition: bgp_common.h:40
RoutingPolicy(std::string name, BgpServer *server, RoutingPolicyMgr *mgr, const BgpRoutingPolicyConfig *config)
CommunityList community_add
Definition: bgp_config.h:373
LifetimeRef< RoutingPolicyMgr > server_delete_ref_
uint32_t med
Definition: bgp_config.h:379
RoutingPolicyMatchConfig match
Definition: bgp_config.h:394
const MatchList & matches() const
CommunityList ext_community_set
Definition: bgp_config.h:375
void UpdateRoutingPolicy(const BgpRoutingPolicyConfig *config)
std::pair< bool, bool > PolicyResult
bool ProcessRoutingPolicy(const BgpRoute *route, BgpPath *path) const
boost::asio::ip::address_v4 Ip4Address
Definition: address.h:14
std::vector< RoutingPolicyAction * > ActionList
virtual RoutingPolicy * CreateRoutingPolicy(const BgpRoutingPolicyConfig *config)
const Path * front() const
Definition: route.cc:16
static ExtCommunityPtr UpdateExtCommunity(BgpServer *server, const RoutingInstance *rtinstance, const ExtCommunity *ext_community, const ExtCommunity::ExtCommunityList &export_list)
uint32_t generation() const
static bool PathSelection(const Path &path1, const Path &path2)
Definition: bgp_table.cc:821
std::list< RoutingPolicyInfo > RoutingPolicyAttachList
Definition: bgp_common.h:47
boost::system::error_code Inet6PrefixParse(const string &str, Ip6Address *addr, int *plen)
Definition: address.cc:144
const BgpAttr * GetAttr() const
Definition: bgp_path.h:87
bool EvaluateRoutingPolicy(DBTablePartBase *root, DBEntryBase *entry)
std::vector< RoutingPolicyMatch * > MatchList
virtual bool MayDelete() const
CommunityList ext_community_match
Definition: bgp_config.h:365
bool ApplyTerm(const BgpRoute *route, const BgpPath *path, BgpAttr *attr) const
DeleteActor(BgpServer *server, RoutingPolicy *parent)
boost::intrusive_ptr< DBTableWalk > DBTableWalkRef
Definition: db_table.h:169
void Notify(DBEntryBase *entry)
RoutingPolicyMgr(BgpServer *server)
void UpdateConfig(const BgpRoutingPolicyConfig *config)
MatchPrefix< PrefixMatchInet6 > MatchPrefixInet6
bool terminal() const
CommunityList community_set
Definition: bgp_config.h:372
CommunityList ext_community_add
Definition: bgp_config.h:376
autogen::PolicyAction action
tbb::atomic< uint32_t > refcount_
void add_term(PolicyTermPtr term)
AsnList aspath_expand
Definition: bgp_config.h:371
void ApplyRoutingPolicy(RoutingInstance *instance)
const std::string & name() const
RoutingPolicyWalkRequests routing_policy_sync_
SandeshTraceBufferPtr SandeshTraceBufferCreate(const std::string &buf_name, size_t buf_size, bool trace_enable=true)
Definition: sandesh_trace.h:46
RoutingPolicyList routing_policies_
const PathList & GetPathList() const
Definition: route.h:46
const RoutingPolicyTermList & terms() const
Definition: bgp_config.h:410