OpenSDN source code
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
flow_mgmt_tree.cc
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018 Juniper Networks, Inc. All rights reserved.
3  */
4 
9 #include <pkt/flow_mgmt.h>
10 
12  Tree::iterator it = tree_.find(key);
13  if (it == tree_.end())
14  return NULL;
15 
16  return it->second;
17 }
18 
20  FlowMgmtEntry *entry = Find(key);
21  if (entry == NULL) {
22  entry = Allocate(key);
23  InsertEntry(key->Clone(), entry);
24  }
25 
26  return entry;
27 }
28 
30  tree_[key] = entry;
31 }
32 
34  Tree::iterator it = tree_.lower_bound(key);
35  if (it == tree_.end())
36  return NULL;
37 
38  return it->first;
39 }
40 
42  if (entry->CanDelete() == false)
43  return false;
44 
45  // Send message only if we have seen DELETE message from FlowTable
46  if (entry->oper_state() == FlowMgmtEntry::OPER_DEL_SEEN) {
47  FreeNotify(key, entry->gen_id());
48  }
49 
50  Tree::iterator it = tree_.find(key);
51  assert(it != tree_.end());
52  FlowMgmtKey *first = it->first;
53  RemoveEntry(it);
54  delete entry;
55  delete first;
56 
57  return true;
58 }
59 
60 void FlowMgmtTree::RemoveEntry(Tree::iterator it) {
61  tree_.erase(it);
62 }
63 
65 // Generic Event handler on tree for add/delete of a flow
68  FlowMgmtKeyNode *node = new FlowMgmtKeyNode();
69  std::pair<FlowMgmtKeyTree::iterator, bool> ret;
70  ret = tree->insert(make_pair(key, node));
71  if (ret.second == false) {
72  delete key;
73  delete node;
74  }
75  return ret.second;
76 }
77 
78 // Adds Flow to a FlowMgmtEntry defined by key. Does not allocate FlowMgmtEntry
79 // if its not already present
81  FlowMgmtKeyNode *node) {
82  FlowMgmtEntry *entry = Locate(key);
83  if (entry == NULL) {
84  return false;
85  }
86 
87  return entry->Add(flow, node);
88 }
89 
91  FlowMgmtKeyNode *node) {
92  Tree::iterator it = tree_.find(key);
93  if (it == tree_.end()) {
94  return false;
95  }
96 
97  FlowMgmtEntry *entry = it->second;
98  bool ret = entry->Delete(flow, node);
99 
100  TryDelete(it->first, entry);
101  return ret;
102 }
103 
105 // Event handler for add/delete/change of an object
107 
108 // Send DBEntry Free message to DB Client module
109 void FlowMgmtTree::FreeNotify(FlowMgmtKey *key, uint32_t gen_id) {
110  assert(key->db_entry() != NULL);
111  FlowEvent::Event event = key->FreeDBEntryEvent();
112  if (event == FlowEvent::INVALID)
113  return;
114  mgr_->FreeDBEntryEvent(event, key, gen_id);
115 }
116 
117 // An object is added/updated. Enqueue REVALUATE for flows dependent on it
119  FlowMgmtEntry *entry = Locate(key);
120  entry->OperEntryAdd(mgr_, req, key);
121  return true;
122 }
123 
125  FlowMgmtKey *key) {
126  FlowMgmtEntry *entry = Find(key);
127  if (entry) {
128  entry->OperEntryChange(mgr_, req, key);
129  }
130  return true;
131 }
132 
133 // Send DELETE Entry message to FlowTable module
135  FlowMgmtKey *key) {
136  FlowMgmtEntry *entry = Find(key);
137  if (entry == NULL) {
138  FreeNotify(key, req->gen_id());
139  return true;
140  }
141 
142  entry->OperEntryDelete(mgr_, req, key);
143  return TryDelete(key, entry);
144 }
145 
147  FlowMgmtEntry *entry = Find(key);
148  if (entry == NULL) {
149  return true;
150  }
151 
152  return TryDelete(key, entry);
153 }
154 
156  assert(key->db_entry() == NULL);
157 }
158 
160  FlowMgmtKeyTree *tree) {
161  if (flow->is_flags_set(FlowEntry::BgpRouterService) == false)
162  return;
163  const VmInterface *vm_intf =
164  dynamic_cast<const VmInterface *>(flow->intf_entry());
165  if (!vm_intf || (flow->bgp_as_a_service_sport() == 0))
166  return;
167 
169  new BgpAsAServiceFlowMgmtKey(vm_intf->GetUuid(),
170  flow->bgp_as_a_service_sport(),
171  index_, NULL, NULL);
172  AddFlowMgmtKey(tree, key);
173 }
174 
176  return new BgpAsAServiceFlowMgmtEntry();
177 }
178 
179 // Update health check on the BgpAsAService entry
183  FlowMgmtEntry *entry = Find(&key);
184  if (entry == NULL) {
185  return true;
186  }
187 
188  BgpAsAServiceFlowMgmtEntry *bgpaas_entry =
189  static_cast<BgpAsAServiceFlowMgmtEntry *>(entry);
190  return bgpaas_entry->HealthCheckUpdate(agent, mgr_, key, req);
191 }
192 
195  FlowMgmtEntry *entry = Find(&key);
196  if (entry == NULL) {
197  return true;
198  }
199 
200  entry->NonOperEntryDelete(mgr_, req, &key);
201  return TryDelete(&key, entry);
202 }
203 
205  Tree::iterator it = tree_.begin();
206  while (it != tree_.end()) {
208  static_cast<BgpAsAServiceFlowMgmtKey *>(it->first);
209  mgr_->BgpAsAServiceNotify(key->uuid(), key->source_port());
210  it++;
211  }
212 }
213 
215  IpAddress dest_ip = IpAddress();
217  dest_ip = flow->key().src_addr;
218  } else {
219  //No reverse flow means no CN to map to so dont add flow key.
220  if (flow->reverse_flow_entry() == NULL)
222  dest_ip = flow->reverse_flow_entry()->key().src_addr;
223  }
224  for (uint8_t count = 0; count < MAX_XMPP_SERVERS; count++) {
225  if (flow->flow_table()->agent()->controller_ifmap_xmpp_server(count) ==
226  dest_ip.to_string()) {
227  return count;
228  }
229  }
231 }
232 
234 // Acl Flow Management
237  const MatchAclParamsList *acl_list) {
238  std::list<MatchAclParams>::const_iterator it;
239  for (it = acl_list->begin(); it != acl_list->end(); it++) {
240  AclFlowMgmtKey *key = new AclFlowMgmtKey(it->acl.get(),
241  &it->ace_id_list);
242  AddFlowMgmtKey(tree, key);
243  }
244 }
245 
247  ExtractKeys(flow, tree, &flow->match_p().m_acl_l);
248  ExtractKeys(flow, tree, &flow->match_p().m_out_acl_l);
249  ExtractKeys(flow, tree, &flow->match_p().sg_policy.m_acl_l);
250  ExtractKeys(flow, tree, &flow->match_p().sg_policy.m_out_acl_l);
251  ExtractKeys(flow, tree, &flow->match_p().sg_policy.m_reverse_acl_l);
252  ExtractKeys(flow, tree, &flow->match_p().sg_policy.m_reverse_out_acl_l);
253  ExtractKeys(flow, tree, &flow->match_p().m_mirror_acl_l);
254  ExtractKeys(flow, tree, &flow->match_p().m_out_mirror_acl_l);
255  ExtractKeys(flow, tree, &flow->match_p().m_vrf_assign_acl_l);
256  ExtractKeys(flow, tree, &flow->match_p().aps_policy.m_acl_l);
257  ExtractKeys(flow, tree, &flow->match_p().aps_policy.m_out_acl_l);
258  ExtractKeys(flow, tree, &flow->match_p().fwaas_policy.m_acl_l);
259  ExtractKeys(flow, tree, &flow->match_p().fwaas_policy.m_out_acl_l);
260 }
261 
263  return new AclFlowMgmtEntry();
264 }
265 
267  FlowMgmtKey *old_key, FlowMgmtKeyNode *node) {
268  AclFlowMgmtEntry *entry = static_cast<AclFlowMgmtEntry *>(Locate(key));
269  if (entry == NULL) {
270  return false;
271  }
272 
273  AclFlowMgmtKey *acl_key = static_cast<AclFlowMgmtKey *>(key);
274  const AclEntryIDList *old_ace_id_list = NULL;
275  if (old_key) {
276  AclFlowMgmtKey *old_acl_key = static_cast<AclFlowMgmtKey *>(old_key);
277  old_ace_id_list = old_acl_key->ace_id_list();
278  }
279  return entry->Add(acl_key->ace_id_list(), flow, old_ace_id_list, node);
280 }
281 
283  FlowMgmtKeyNode *node) {
284  Tree::iterator it = tree_.find(key);
285  if (it == tree_.end()) {
286  return false;
287  }
288 
289  AclFlowMgmtKey *acl_key = static_cast<AclFlowMgmtKey *>(key);
290  AclFlowMgmtEntry *entry = static_cast<AclFlowMgmtEntry *>(it->second);
291  bool ret = entry->Delete(acl_key->ace_id_list(), flow, node);
292 
293  TryDelete(it->first, entry);
294  return ret;
295 }
296 
298 // VN Flow Management
301  if (flow->vn_entry() == NULL)
302  return;
303  VnFlowMgmtKey *key = new VnFlowMgmtKey(flow->vn_entry());
304  AddFlowMgmtKey(tree, key);
305 }
306 
308  return new VnFlowMgmtEntry();
309 }
310 
312  tbb::mutex::scoped_lock mutex(mutex_);
313  FlowMgmtTree::InsertEntry(key, entry);
314 }
315 
316 void VnFlowMgmtTree::RemoveEntry(Tree::iterator it) {
317  tbb::mutex::scoped_lock mutex(mutex_);
319 }
320 
322  uint32_t *ingress_flow_count,
323  uint32_t *egress_flow_count) {
324  VnFlowMgmtKey key(vn);
325  tbb::mutex::scoped_lock mutex(mutex_);
326  VnFlowMgmtEntry *entry = static_cast<VnFlowMgmtEntry *>(Find(&key));
327  if (entry) {
328  *ingress_flow_count += entry->ingress_flow_count();
329  *egress_flow_count += entry->egress_flow_count();
330  }
331 }
332 
334 // Interface Flow Management
337  tbb::mutex::scoped_lock mutex(mutex_);
338  FlowMgmtTree::InsertEntry(key, entry);
339 }
340 
341 void InterfaceFlowMgmtTree::RemoveEntry(Tree::iterator it) {
342  tbb::mutex::scoped_lock mutex(mutex_);
344 }
345 
347  uint64_t *created,
348  uint64_t *aged,
349  uint32_t *active_flows) {
350  InterfaceFlowMgmtKey key(itf);
351  tbb::mutex::scoped_lock mutex(mutex_);
352  InterfaceFlowMgmtEntry *entry = static_cast<InterfaceFlowMgmtEntry *>
353  (Find(&key));
354  if (entry) {
355  *created += entry->flow_created();
356  *aged += entry->flow_aged();
357  *active_flows += entry->Size();
358  }
359 }
360 
362  FlowMgmtKeyTree *tree) {
363  if (flow->intf_entry() == NULL)
364  return;
365  InterfaceFlowMgmtKey *key =
366  new InterfaceFlowMgmtKey(flow->intf_entry());
367  AddFlowMgmtKey(tree, key);
368 }
369 
371  return new InterfaceFlowMgmtEntry();
372 }
373 
375 // Nh Flow Management
378  if (flow->rpf_nh() == NULL)
379  return;
380  NhFlowMgmtKey *key = new NhFlowMgmtKey(flow->rpf_nh());
381  AddFlowMgmtKey(tree, key);
382 }
383 
385  return new NhFlowMgmtEntry();
386 }
387 
389 // Route Flow Management
392  FlowMgmtKeyNode *node) {
393  bool ret = FlowMgmtTree::Delete(key, flow, node);
394  RouteFlowMgmtKey *route_key = static_cast<RouteFlowMgmtKey *>(key);
395  mgr_->RetryVrfDelete(route_key->vrf_id());
396  return ret;
397 }
398 
400  FlowMgmtKey *key) {
401  Tree::iterator it = tree_.find(key);
402  if (it == tree_.end()) {
403  return;
404  }
405 
406  if (req->db_entry() == NULL) {
407  return;
408  }
409 
410  if (it->first->db_entry()) {
411  assert(it->first->db_entry() == req->db_entry());
412  return;
413  }
414  it->first->set_db_entry(req->db_entry());
415  return;
416 }
417 
419  FlowMgmtKey *key) {
420  // Set the db_entry if it was not set earlier. It is needed to send the
421  // FreeDBState message
422  SetDBEntry(req, key);
423  bool ret = FlowMgmtTree::OperEntryDelete(req, key);
424  RouteFlowMgmtKey *route_key = static_cast<RouteFlowMgmtKey *>(key);
425  mgr_->RetryVrfDelete(route_key->vrf_id());
426  return ret;
427 }
428 
430  FlowMgmtKey *key) {
431  bool ret = FlowMgmtTree::OperEntryAdd(req, key);
432  if (req->db_entry() == NULL)
433  return ret;
434 
435  // Set the DBEntry in the flow-mgmt-entry
436  SetDBEntry(req, key);
437  return ret;
438 }
439 
441 // Inet Route Flow Management
444  uint32_t vrf, const IpAddress &ip,
445  uint8_t plen) {
446  // We do not support renewal of VRF, so skip flow if VRF is deleted
447  VrfEntry *vrfp = mgr_->agent()->vrf_table()->FindVrfFromId(vrf);
448  if (vrfp == NULL) {
449  return;
450  }
451 
452  InetRouteFlowMgmtKey *key = NULL;
453  /*
454  * For L2 flows, plen is found using LPMFind
455  * when route is not found plen is set to -1(255)
456  * in that case key should not be added
457  */
458  if (flow->l3_flow() || (plen != 255)) {
459  if (ip.is_v4()) {
460  Ip4Address ip4 = Address::GetIp4SubnetAddress(ip.to_v4(), plen);
461  key = new InetRouteFlowMgmtKey(vrf, ip4, plen);
462  } else {
463  Ip6Address ip6 = Address::GetIp6SubnetAddress(ip.to_v6(), plen);
464  key = new InetRouteFlowMgmtKey(vrf, ip6, plen);
465  }
466  }
467 
468  if (key) {
469  AddFlowMgmtKey(tree, key);
470  }
471 }
472 
474  const IpAddress &ip,
475  const FlowRouteRefMap *rt_list) {
476  FlowRouteRefMap::const_iterator it;
477  for (it = rt_list->begin(); it != rt_list->end(); it++) {
478  ExtractKeys(flow, tree, it->first, ip, it->second);
479  }
480 }
481 
483  FlowMgmtKeyTree *tree) {
484 
485  if (flow->l3_flow() == false) {
486  // For l2-flows Track INET route for RPF only
487  if (flow->data().rpf_vrf != VrfEntry::kInvalidIndex) {
488  ExtractKeys(flow, tree, flow->data().rpf_vrf,
489  flow->key().src_addr, flow->data().rpf_plen);
490  }
491  return;
492  }
493 
495  ExtractKeys(flow, tree, flow->data().flow_source_vrf,
496  flow->key().src_addr, flow->data().source_plen);
497  }
498 
500  ExtractKeys(flow, tree, flow->data().acl_assigned_vrf_index_,
501  flow->key().src_addr, flow->data().source_plen);
502  ExtractKeys(flow, tree, flow->data().acl_assigned_vrf_index_,
503  flow->key().dst_addr, flow->data().dest_plen);
504  }
505 
506  ExtractKeys(flow, tree, flow->key().src_addr,
507  &flow->data().flow_source_plen_map);
508 
509  if (flow->data().flow_dest_vrf != VrfEntry::kInvalidIndex) {
510  ExtractKeys(flow, tree, flow->data().flow_dest_vrf,
511  flow->key().dst_addr, flow->data().dest_plen);
512  }
513  ExtractKeys(flow, tree, flow->key().dst_addr,
514  &flow->data().flow_dest_plen_map);
515 
517  ExtractKeys(flow, tree, flow->data().src_policy_vrf,
518  flow->key().src_addr, flow->data().src_policy_plen);
519  }
520 
522  ExtractKeys(flow, tree, flow->data().dst_policy_vrf,
523  flow->key().dst_addr, flow->data().dst_policy_plen);
524  }
525 
526 }
527 
529  return new InetRouteFlowMgmtEntry();
530 }
531 
534  InetRouteFlowMgmtKey *next_key = NULL;
535 
536  if (type == Agent::INET4_UNICAST) {
537  InetRouteFlowMgmtKey key(vrf, Ip4Address(0), 0);
538  next_key = static_cast<InetRouteFlowMgmtKey *>(LowerBound(&key));
539  } else if (type == Agent::INET6_UNICAST) {
540  InetRouteFlowMgmtKey key(vrf, Ip6Address(), 0);
541  next_key = static_cast<InetRouteFlowMgmtKey *>(LowerBound(&key));
542  } else {
543  return false;
544  }
545 
546  if (next_key == NULL)
547  return false;
548 
549  if (next_key->vrf_id() != vrf)
550  return false;
551 
552  return true;
553 }
554 
556  FlowMgmtKey *key) {
557  bool ret = RouteFlowMgmtTree::OperEntryAdd(req, key);
558 
559  // A new route is added. This new route can be a longer prefix route for
560  // flows using lower prefix-len (covering routes). So, do a LPM match to
561  // find the covering route and trigger flow re-compute for flows on the
562  // covering route
563  InetRouteFlowMgmtKey *rt_key = static_cast<InetRouteFlowMgmtKey *>(key);
564  AddToLPMTree(rt_key);
565  if (rt_key->plen_ > 0) {
566  InetRouteFlowMgmtKey lpm_key(rt_key->vrf_id_, rt_key->ip_,
567  rt_key->plen_ - 1);
568  InetRouteFlowMgmtKey *covering_route = LPM(&lpm_key);
569  if (covering_route != NULL) {
570  ret = RecomputeCoveringRoute(covering_route, rt_key);
571  }
572  rt_key->plen_ += 1;
573  }
574 
575  return ret;
576 }
577 
580  InetRouteFlowMgmtEntry *entry = dynamic_cast<InetRouteFlowMgmtEntry *>
581  (Find(covering_route));
582  if (entry == NULL) {
583  return true;
584  }
585 
586  return entry->RecomputeCoveringRouteEntry(mgr_, covering_route, key);
587 }
588 
590  FlowMgmtKey *key) {
591  InetRouteFlowMgmtKey *rt_key = static_cast<InetRouteFlowMgmtKey *>(key);
592  DelFromLPMTree(rt_key);
593  return RouteFlowMgmtTree::OperEntryDelete(req, key);
594 }
595 
597  FlowMgmtKey *key) {
598  InetRouteFlowMgmtEntry *entry = static_cast<InetRouteFlowMgmtEntry*>
599  (Find(key));
600  if (entry == NULL) {
601  return true;
602  }
603 
604  return entry->HandleNhChange(mgr_, req, key);
605 }
606 
608 // Bridge Route Flow Management
611  FlowMgmtKeyTree *tree) {
612  if (flow->l3_flow() == true)
613  return;
614 
615  VrfTable *table = mgr_->agent()->vrf_table();
616  uint32_t vrf = flow->data().flow_source_vrf;
617  if (vrf != VrfEntry::kInvalidIndex && table->FindVrfFromId(vrf) != NULL) {
619  new BridgeRouteFlowMgmtKey(vrf, flow->data().smac);
620  AddFlowMgmtKey(tree, key);
621  }
622 
623  vrf = flow->data().flow_dest_vrf;
624  if (vrf != VrfEntry::kInvalidIndex && table->FindVrfFromId(vrf) != NULL) {
626  new BridgeRouteFlowMgmtKey(vrf, flow->data().smac);
627  AddFlowMgmtKey(tree, key);
628  }
629 }
630 
632  return new BridgeRouteFlowMgmtEntry();
633 }
634 
638  BridgeRouteFlowMgmtKey *next_key = static_cast<BridgeRouteFlowMgmtKey *>
639  (LowerBound(&key));
640  if (next_key == NULL)
641  return false;
642 
643  if (next_key->vrf_id() != vrf)
644  return false;
645 
646  return true;
647 }
648 
650 // Vrf Flow Management
653 }
654 
656  const VrfEntry *vrf = static_cast<const VrfEntry *>(key->db_entry());
657  return new VrfFlowMgmtEntry(this, vrf);
658 }
659 
661  FlowMgmtKey *key) {
662  bool ret = FlowMgmtTree::OperEntryAdd(req, key);
663 
664  const VrfEntry *vrf = static_cast<const VrfEntry *>(key->db_entry());
665  VrfIdMap::iterator it = id_map_.find(vrf->vrf_id());
666  if (it != id_map_.end())
667  return ret;
668 
669  id_map_.insert(make_pair(vrf->vrf_id(), vrf));
670  return ret;
671 }
672 
673 void VrfFlowMgmtTree::FreeNotify(FlowMgmtKey *key, uint32_t gen_id) {
674  FlowMgmtTree::FreeNotify(key, gen_id);
675 
676  const VrfEntry *vrf = static_cast<const VrfEntry *>(key->db_entry());
677  VrfIdMap::iterator it = id_map_.find(vrf->vrf_id());
678  if (it != id_map_.end()) {
679  id_map_.erase(it);
680  }
681 }
682 
683 void VrfFlowMgmtTree::RetryDelete(uint32_t vrf_id) {
684  VrfIdMap::iterator it = id_map_.find(vrf_id);
685  if (it == id_map_.end())
686  return;
687 
688  VrfFlowMgmtKey key(it->second);
689  const VrfEntry *vrf = dynamic_cast<const VrfEntry *>(key.db_entry());
690  if (vrf && vrf->AllRouteTablesEmpty()) {
692  }
693 }
694 
696  //If VMI is associated to FIP, then all non floating-ip
697  //traffic would also be dependent FIP VRF route. This is
698  //to ensure that if more specific route gets added preference
699  //would be given to floating-ip
700  //
701  //Assume a sceanrio where traffic is not NATed, then flow would
702  //add a dependency on default route(assume no default route is
703  //present in FIP VRF). Now if FIP VRF is deleted there is no explicit
704  //trigger to delete this dependencyi and hence delay in releasing VRF
705  //reference, hence if default route DB entry is not present
706  //impliticly delete the default route so that flow could get
707  InetRouteFlowMgmtKey key(vrf->vrf_id(), Ip4Address(0), 0);
708  FlowMgmtEntry *route_entry = mgr_->ip4_route_flow_mgmt_tree()->Find(&key);
709  if (route_entry == NULL ||
710  route_entry->oper_state() != FlowMgmtEntry::OPER_NOT_SEEN) {
711  //If entry is not present on it has corresponding DB entry
712  //no need for implicit delete
713  return;
714  }
715 
718  &route_req, &key, mgr_->ip4_route_flow_mgmt_tree());
719 }
720 
722  FlowMgmtKey *key) {
723  const VrfEntry* vrf = static_cast<const VrfEntry *>(req->db_entry());
724  DeleteDefaultRoute(vrf);
725 
726  return FlowMgmtTree::OperEntryDelete(req, key);
727 }
uint32_t ingress_flow_count() const
virtual bool OperEntryDelete(const FlowMgmtRequest *req, FlowMgmtKey *key)
static const MacAddress & ZeroMac()
Definition: mac_address.h:158
uint64_t flow_aged() const
const DBEntry * db_entry() const
tbb::mutex mutex_
IpAddress src_addr
Definition: flow_entry.h:213
uint32_t dst_policy_plen
Definition: flow_entry.h:330
virtual bool OperEntryChange(FlowMgmtManager *mgr, const FlowMgmtRequest *req, FlowMgmtKey *key)
MatchAclParamsList m_reverse_acl_l
Definition: flow_entry.h:236
virtual bool OperEntryDelete(FlowMgmtManager *mgr, const FlowMgmtRequest *req, FlowMgmtKey *key)
bool BgpAsAServiceHealthCheckUpdate(Agent *agent, BgpAsAServiceFlowMgmtKey &key, BgpAsAServiceFlowMgmtRequest *req)
bool HandleNhChange(FlowMgmtManager *mgr, const FlowMgmtRequest *req, FlowMgmtKey *key)
Definition: vrf.h:86
virtual bool HealthCheckUpdate(Agent *agent, FlowMgmtManager *mgr, BgpAsAServiceFlowMgmtKey &key, BgpAsAServiceFlowMgmtRequest *req)
uint32_t src_policy_vrf
Definition: flow_entry.h:327
virtual FlowMgmtEntry * Allocate(const FlowMgmtKey *key)=0
FlowMgmtEntry * Allocate(const FlowMgmtKey *key)
void VnFlowCounters(const VnEntry *vn, uint32_t *ingress_flow_count, uint32_t *egress_flow_count)
virtual bool OperEntryAdd(FlowMgmtManager *mgr, const FlowMgmtRequest *req, FlowMgmtKey *key)
void SetDBEntry(const FlowMgmtRequest *req, FlowMgmtKey *key)
FlowMgmtEntry * Locate(FlowMgmtKey *key)
Definition: vrf.h:268
const boost::uuids::uuid & GetUuid() const
Definition: interface.h:113
const DBEntry * db_entry() const
Definition: flow_mgmt_key.h:65
FlowTable * flow_table() const
Definition: flow_entry.h:597
MatchAclParamsList m_vrf_assign_acl_l
Definition: flow_entry.h:274
IpAddress dst_addr
Definition: flow_entry.h:214
FlowMgmtEntry * Find(FlowMgmtKey *key)
void ExtractKeys(FlowEntry *flow, FlowMgmtKeyTree *tree, uint32_t vrf, const IpAddress &ip, uint8_t plen)
uint32_t dst_policy_vrf
Definition: flow_entry.h:329
MatchAclParamsList m_acl_l
Definition: flow_entry.h:258
void FreeDBEntryEvent(FlowEvent::Event event, FlowMgmtKey *key, uint32_t gen_id)
Definition: flow_mgmt.cc:251
uint32_t acl_assigned_vrf_index_
Definition: flow_entry.h:358
boost::asio::ip::address IpAddress
Definition: address.h:13
uint8_t rpf_plen
Definition: flow_entry.h:353
virtual bool Delete(FlowMgmtKey *key, FlowEntry *flow, FlowMgmtKeyNode *node)
void ExtractKeys(FlowEntry *flow, FlowMgmtKeyTree *tree)
uint32_t flow_dest_vrf
Definition: flow_entry.h:307
uint32_t gen_id() const
bool Delete(const AclEntryIDList *ace_id_list, FlowEntry *flow, FlowMgmtKeyNode *node)
Agent * agent() const
Definition: flow_table.h:197
static int GetCNIndex(const FlowEntry *flow)
static bool ProcessEvent(FlowMgmtRequest *req, FlowMgmtKey *key, FlowMgmtTree *tree)
Definition: flow_mgmt.cc:273
bool Add(FlowMgmtKey *key, FlowEntry *flow, FlowMgmtKey *old_key, FlowMgmtKeyNode *node)
std::vector< AclEntryID > AclEntryIDList
Definition: acl_entry.h:85
virtual void FreeNotify(FlowMgmtKey *key, uint32_t gen_id)
SessionPolicy aps_policy
Definition: flow_entry.h:265
virtual FlowMgmtEntry * Allocate(const FlowMgmtKey *key)
void InsertEntry(FlowMgmtKey *key, FlowMgmtEntry *entry)
virtual bool Delete(FlowMgmtKey *key, FlowEntry *flow, FlowMgmtKeyNode *node)
bool HasVrfFlows(uint32_t vrf_id, Agent::RouteTableType type)
static Ip4Address GetIp4SubnetAddress(const Ip4Address &prefix, uint16_t plen)
Definition: address.cc:179
State oper_state() const
FlowRouteRefMap flow_source_plen_map
Definition: flow_entry.h:342
void RetryDelete(uint32_t vrf_id)
bool TryDelete(FlowMgmtKey *key, FlowMgmtEntry *entry)
bool RouteNHChangeEvent(const FlowMgmtRequest *req, FlowMgmtKey *key)
uint32_t rpf_vrf
Definition: flow_entry.h:352
uint32_t Size() const
InetRouteFlowMgmtTree * ip4_route_flow_mgmt_tree()
Definition: flow_mgmt.h:325
virtual bool Delete(FlowEntry *flow, FlowMgmtKeyNode *node)
virtual void FreeNotify(FlowMgmtKey *key, uint32_t gen_id)
static Ip6Address GetIp6SubnetAddress(const Ip6Address &prefix, uint16_t plen)
Definition: address.cc:200
virtual bool OperEntryChange(const FlowMgmtRequest *req, FlowMgmtKey *key)
FlowMgmtEntry * Allocate(const FlowMgmtKey *key)
void ExtractKeys(FlowEntry *flow, FlowMgmtKeyTree *tree)
const AclEntryIDList * ace_id_list() const
Definition: flow_mgmt_key.h:98
MatchAclParamsList m_out_mirror_acl_l
Definition: flow_entry.h:271
bool HasVrfFlows(uint32_t vrf_id, Agent::RouteTableType type)
const FlowKey & key() const
Definition: flow_entry.h:594
FlowMgmtEntry * Allocate(const FlowMgmtKey *key)
FlowRouteRefMap flow_dest_plen_map
Definition: flow_entry.h:343
virtual bool CanDelete() const
FlowMgmtEntry * Allocate(const FlowMgmtKey *key)
VrfEntry * FindVrfFromId(size_t index)
Definition: vrf.cc:884
bool is_flags_set(const FlowEntryFlags &flags) const
Definition: flow_entry.h:610
uint8_t type
Definition: load_balance.h:109
static bool AddFlowMgmtKey(FlowMgmtKeyTree *tree, FlowMgmtKey *key)
Definition: agent.h:358
virtual void RemoveEntry(Tree::iterator it)
FlowMgmtEntry * Allocate(const FlowMgmtKey *key)
virtual bool OperEntryDelete(const FlowMgmtRequest *req, FlowMgmtKey *key)
void AddToLPMTree(InetRouteFlowMgmtKey *key)
void DeleteDefaultRoute(const VrfEntry *vrf)
SessionPolicy fwaas_policy
Definition: flow_entry.h:266
boost::asio::ip::address_v6 Ip6Address
Definition: address.h:15
map< int, int > FlowRouteRefMap
Definition: pkt_flow_info.h:16
const uint32_t bgp_as_a_service_sport() const
Definition: flow_entry.h:660
MatchAclParamsList m_acl_l
Definition: flow_entry.h:228
MatchAclParamsList m_reverse_out_acl_l
Definition: flow_entry.h:240
virtual bool OperEntryDelete(const FlowMgmtRequest *req, FlowMgmtKey *key)
void BgpAsAServiceNotify(const boost::uuids::uuid &vm_uuid, uint32_t source_port)
Definition: flow_mgmt.cc:92
static const int kInvalidCnIndex
std::map< FlowMgmtKey *, FlowMgmtKeyNode *, FlowMgmtKeyCmp > FlowMgmtKeyTree
void RemoveEntry(Tree::iterator it)
void RetryVrfDelete(uint32_t vrf_id)
Definition: flow_mgmt.cc:505
MacAddress smac
Definition: flow_entry.h:292
virtual FlowMgmtKey * Clone()=0
bool BgpAsAServiceDelete(BgpAsAServiceFlowMgmtKey &key, const FlowMgmtRequest *req)
void InterfaceFlowCount(const Interface *itf, uint64_t *created, uint64_t *aged, uint32_t *active_flows)
virtual void InsertEntry(FlowMgmtKey *key, FlowMgmtEntry *entry)
Agent * agent() const
Definition: flow_mgmt.h:283
FlowMgmtEntry * Allocate(const FlowMgmtKey *key)
const std::string & controller_ifmap_xmpp_server(uint8_t idx) const
Definition: agent.h:730
const uint32_t vrf_id() const
Definition: vrf.h:99
uint32_t vrf_id() const
virtual bool OperEntryAdd(const FlowMgmtRequest *req, FlowMgmtKey *key)
uint32_t source_port() const
boost::asio::ip::address_v4 Ip4Address
Definition: address.h:14
uint32_t flow_source_vrf
Definition: flow_entry.h:306
Definition: vn.h:151
#define MAX_XMPP_SERVERS
Definition: agent.h:291
VrfTable * vrf_table() const
Definition: agent.h:485
const Interface * intf_entry() const
Definition: flow_entry.h:652
virtual bool OperEntryAdd(const FlowMgmtRequest *req, FlowMgmtKey *key)
bool l3_flow() const
Definition: flow_entry.h:598
FlowMgmtKey * LowerBound(FlowMgmtKey *key)
void ExtractKeys(FlowEntry *flow, FlowMgmtKeyTree *tree)
uint8_t source_plen
Definition: flow_entry.h:333
void RemoveEntry(Tree::iterator it)
InetRouteFlowMgmtKey * LPM(const InetRouteFlowMgmtKey *key)
MatchAclParamsList m_mirror_acl_l
Definition: flow_entry.h:268
virtual bool NonOperEntryDelete(FlowMgmtManager *mgr, const FlowMgmtRequest *req, FlowMgmtKey *key)
void ExtractKeys(FlowEntry *flow, FlowMgmtKeyTree *tree, const MatchAclParamsList *acl_list)
void DelFromLPMTree(InetRouteFlowMgmtKey *key)
virtual bool Add(FlowMgmtKey *key, FlowEntry *flow, FlowMgmtKeyNode *node)
MatchAclParamsList m_out_acl_l
Definition: flow_entry.h:261
uint32_t egress_flow_count() const
const VnEntry * vn_entry() const
Definition: flow_entry.h:653
MatchAclParamsList m_out_acl_l
Definition: flow_entry.h:232
void InsertEntry(FlowMgmtKey *key, FlowMgmtEntry *entry)
bool RecomputeCoveringRouteEntry(FlowMgmtManager *mgr, InetRouteFlowMgmtKey *covering_route, InetRouteFlowMgmtKey *key)
FlowEntry * reverse_flow_entry()
Definition: flow_entry.h:602
void ExtractKeys(FlowEntry *flow, FlowMgmtKeyTree *tree)
virtual void FreeNotify(FlowMgmtKey *key, uint32_t gen_id)
virtual bool RetryDelete(FlowMgmtKey *key)
static const uint32_t kInvalidIndex
Definition: vrf.h:88
std::list< MatchAclParams > MatchAclParamsList
Definition: flow_entry.h:220
FlowEvent::Event FreeDBEntryEvent() const
Definition: flow_mgmt_key.cc:8
FlowMgmtEntry * Allocate(const FlowMgmtKey *key)
virtual bool OperEntryAdd(const FlowMgmtRequest *req, FlowMgmtKey *key)
FlowData & data()
Definition: flow_entry.h:595
uint8_t dest_plen
Definition: flow_entry.h:334
uint32_t gen_id() const
bool AllRouteTablesEmpty() const
Definition: vrf.cc:555
void ExtractKeys(FlowEntry *flow, FlowMgmtKeyTree *tree)
RouteTableType
Definition: agent.h:415
const boost::uuids::uuid & uuid() const
const NextHop * rpf_nh() const
Definition: flow_entry.h:658
virtual bool Add(FlowEntry *flow, FlowMgmtKeyNode *node)
SessionPolicy sg_policy
Definition: flow_entry.h:264
uint32_t src_policy_plen
Definition: flow_entry.h:328
const MatchPolicy & match_p() const
Definition: flow_entry.h:670
virtual bool OperEntryDelete(const FlowMgmtRequest *req, FlowMgmtKey *key)
FlowMgmtManager * mgr_
bool Delete(FlowMgmtKey *key, FlowEntry *flow, FlowMgmtKeyNode *node)
bool Add(const AclEntryIDList *ace_id_list, FlowEntry *flow, const AclEntryIDList *old_id_list, FlowMgmtKeyNode *node)
virtual bool OperEntryAdd(const FlowMgmtRequest *req, FlowMgmtKey *key)
void ExtractKeys(FlowEntry *flow, FlowMgmtKeyTree *tree)
uint64_t flow_created() const
bool RecomputeCoveringRoute(InetRouteFlowMgmtKey *covering_route, InetRouteFlowMgmtKey *key)