LCOV - code coverage report
Current view: top level - vnsw/agent/pkt/flow_mgmt - flow_mgmt_key.cc (source / functions) Hit Total Coverage
Test: OpenSDN C/C++ coverage (all TARGET_SET jobs) Lines: 7 46 15.2 %
Date: 2026-08-03 02:19:58 Functions: 1 4 25.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :  * Copyright (c) 2018 Juniper Networks, Inc. All rights reserved.
       3             :  */
       4             : 
       5             : #include <pkt/flow_mgmt/flow_mgmt_key.h>
       6             : #include <oper/health_check.h>
       7             : 
       8         344 : FlowEvent::Event FlowMgmtKey::FreeDBEntryEvent() const {
       9         344 :     FlowEvent::Event event = FlowEvent::INVALID;
      10             : 
      11         344 :     switch (type_) {
      12         344 :     case INTERFACE:
      13             :     case ACL:
      14             :     case VN:
      15             :     case INET4:
      16             :     case INET6:
      17             :     case BRIDGE:
      18             :     case NH:
      19             :     case VRF:
      20         344 :         event = FlowEvent::FREE_DBENTRY;
      21         344 :         break;
      22             : 
      23           0 :     case ACE_ID:
      24             :     case VM:
      25           0 :         event = FlowEvent::INVALID;
      26           0 :         break;
      27           0 :     case BGPASASERVICE:
      28           0 :         event = FlowEvent::INVALID;
      29             : 
      30           0 :     default:
      31           0 :         assert(0);
      32             :     }
      33             : 
      34         344 :     return event;
      35             : }
      36             : 
      37           0 : void BgpAsAServiceFlowMgmtKey::StartHealthCheck(
      38             :         Agent *agent, FlowEntry *flow, const boost::uuids::uuid &hc_uuid) {
      39           0 :     if (bgp_health_check_instance_ != NULL) {
      40           0 :         bgp_health_check_instance_->UpdateInstanceTask();
      41           0 :         return;
      42             :     }
      43             : 
      44           0 :     bgp_health_check_service_ = agent->health_check_table()->Find(hc_uuid);
      45           0 :     if (bgp_health_check_service_ == NULL) {
      46           0 :         LOG(DEBUG, "Unable to start BFD health check " << hc_uuid << " on flow "
      47             :                    " destination = " << flow->key().dst_addr <<
      48             :                    " source = " << flow->key().src_addr);
      49           0 :         return;
      50             :     }
      51             : 
      52             :     const VmInterface *vm_interface =
      53           0 :         static_cast<const VmInterface *>(flow->intf_entry());
      54           0 :     bgp_health_check_instance_ =
      55           0 :         bgp_health_check_service_->StartHealthCheckService(
      56             :             const_cast<VmInterface *>(vm_interface),
      57           0 :             flow->key().dst_addr, flow->key().src_addr);
      58           0 :     bgp_health_check_instance_->SetService(bgp_health_check_service_);
      59             : }
      60             : 
      61           0 : void BgpAsAServiceFlowMgmtKey::StopHealthCheck(FlowEntry *flow) {
      62           0 :     if (bgp_health_check_service_ && bgp_health_check_instance_) {
      63           0 :         bgp_health_check_service_->StopHealthCheckService(
      64             :                                         bgp_health_check_instance_);
      65           0 :         bgp_health_check_instance_ = NULL;
      66           0 :         bgp_health_check_service_ = NULL;
      67             :     }
      68           0 : }
      69             : 
      70           0 : bool InetRouteFlowMgmtKey::NeedsReCompute(const FlowEntry *flow) {
      71           0 :     if (Match(flow->key().src_addr)) {
      72           0 :         return true;
      73             :     }
      74             : 
      75           0 :     if (Match(flow->key().dst_addr)) {
      76           0 :         return true;
      77             :     }
      78             : 
      79           0 :     const FlowEntry *rflow = flow->reverse_flow_entry();
      80           0 :     if (rflow == NULL) {
      81           0 :         return true;
      82             :     }
      83             : 
      84           0 :     if (Match(rflow->key().src_addr)) {
      85           0 :         return true;
      86             :     }
      87             : 
      88           0 :     if (Match(rflow->key().dst_addr)) {
      89           0 :         return true;
      90             :     }
      91             : 
      92           0 :     return false;
      93             : }

Generated by: LCOV version 1.14