OpenSDN source code
flow_mgmt_key.cc
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018 Juniper Networks, Inc. All rights reserved.
3  * Copyright Contributors to the OpenSDN project
4  */
5 
7 #include <pkt/flow_mgmt.h>
8 #include <oper/health_check.h>
9 
12 
13  switch (type_) {
14  case INTERFACE:
15  case ACL:
16  case VN:
17  case INET4:
18  case INET6:
19  case BRIDGE:
20  case NH:
21  case VRF:
23  break;
24 
25  case ACE_ID:
26  case VM:
27  event = FlowEvent::INVALID;
28  break;
29  case BGPASASERVICE:
30  event = FlowEvent::INVALID;
31 
32  default:
33  assert(0);
34  }
35 
36  return event;
37 }
38 
40  Agent *agent, FlowEntry *flow, const boost::uuids::uuid &hc_uuid) {
41  if (bgp_health_check_instance_ != NULL) {
43  return;
44  }
45 
47  if (bgp_health_check_service_ == NULL) {
48  LOG(DEBUG, "Unable to start BFD health check " << hc_uuid << " on flow "
49  " destination = " << flow->key().dst_addr <<
50  " source = " << flow->key().src_addr);
51  return;
52  }
53 
54  const VmInterface *vm_interface =
55  static_cast<const VmInterface *>(flow->intf_entry());
58  const_cast<VmInterface *>(vm_interface),
59  flow->key().dst_addr, flow->key().src_addr);
60 
61  HealthCheckInstanceService *bfd_instance =
62  static_cast<HealthCheckInstanceService *>(
64  FlowMgmtManager *flow_mgmt_manager =
65  agent->pkt()->flow_mgmt_manager(flow->flow_table()->table_index());
66  bfd_instance->SetBfdDownCallback(
68  flow_mgmt_manager, uuid_, source_port_));
69 
71 }
72 
79  }
80 }
81 
83  if (Match(flow->key().src_addr)) {
84  return true;
85  }
86 
87  if (Match(flow->key().dst_addr)) {
88  return true;
89  }
90 
91  const FlowEntry *rflow = flow->reverse_flow_entry();
92  if (rflow == NULL) {
93  return true;
94  }
95 
96  if (Match(rflow->key().src_addr)) {
97  return true;
98  }
99 
100  if (Match(rflow->key().dst_addr)) {
101  return true;
102  }
103 
104  return false;
105 }
Definition: agent.h:361
HealthCheckTable * health_check_table() const
Definition: agent.cc:937
PktModule * pkt() const
Definition: agent.cc:969
void StartHealthCheck(Agent *agent, FlowEntry *flow, const boost::uuids::uuid &hc_uuid)
void StopHealthCheck(FlowEntry *flow)
boost::uuids::uuid uuid_
HealthCheckInstanceBase * bgp_health_check_instance_
HealthCheckService * bgp_health_check_service_
FlowEntry * reverse_flow_entry()
Definition: flow_entry.h:603
const FlowKey & key() const
Definition: flow_entry.h:595
const Interface * intf_entry() const
Definition: flow_entry.h:653
FlowTable * flow_table() const
Definition: flow_entry.h:598
@ FREE_DBENTRY
Definition: flow_event.h:51
FlowEvent::Event FreeDBEntryEvent() const
void BgpAsAServiceNotify(const boost::uuids::uuid &vm_uuid, uint32_t source_port)
Definition: flow_mgmt.cc:92
uint16_t table_index() const
Definition: flow_table.h:209
virtual bool UpdateInstanceTask()
Definition: health_check.h:131
void SetService(HealthCheckService *service)
void SetBfdDownCallback(const BfdDownCallback &callback)
Definition: health_check.h:235
void StopHealthCheckService(HealthCheckInstanceBase *instance)
HealthCheckInstanceBase * StartHealthCheckService(VmInterface *intrface, VmInterface *paired_vmi, const IpAddress &source_ip, const IpAddress &destination_ip, const MacAddress &destination_mac, bool ignore_status_event, bool multi_hop)
HealthCheckService * Find(const boost::uuids::uuid &u)
bool Match(const IpAddress &match_ip) const
bool NeedsReCompute(const FlowEntry *flow)
FlowMgmtManager * flow_mgmt_manager(uint16_t index) const
Definition: pkt_init.h:40
#define LOG(_Level, _Msg)
Definition: logging.h:35
IpAddress src_addr
Definition: flow_entry.h:214
IpAddress dst_addr
Definition: flow_entry.h:215
boost::uuids::uuid uuid