LCOV - code coverage report
Current view: top level - vnsw/agent/kstate - vrf_stats_kstate.cc (source / functions) Hit Total Coverage
Test: OpenSDN C/C++ coverage (all TARGET_SET jobs) Lines: 0 46 0.0 %
Date: 2026-08-03 02:19:58 Functions: 0 6 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :  * Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
       3             :  */
       4             : 
       5             : #include "kstate.h"
       6             : #include "vrf_stats_kstate.h"
       7             : #include <iomanip>
       8             : #include <sstream>
       9             : #include "vr_defs.h"
      10             : 
      11             : using namespace std;
      12             : 
      13           0 : VrfStatsKState::VrfStatsKState(KVrfStatsResp *obj, const std::string &resp_ctx,
      14           0 :                                vr_vrf_stats_req &req, int id) :
      15           0 :                                KState(resp_ctx, obj) {
      16           0 :     if (id >= 0) {
      17           0 :         req.set_h_op(sandesh_op::GET);
      18           0 :         req.set_vsr_vrf(id);
      19           0 :         req.set_vsr_family(AF_INET);
      20             :     } else {
      21           0 :         InitDumpRequest(req);
      22           0 :         req.set_vsr_marker(-1);
      23             :     }
      24           0 : }
      25             : 
      26           0 : void VrfStatsKState::InitDumpRequest(vr_vrf_stats_req &req) const {
      27           0 :     req.set_h_op(sandesh_op::DUMP);
      28           0 :     req.set_vsr_rid(0);
      29           0 :     req.set_vsr_family(AF_INET);
      30           0 : }
      31             : 
      32           0 : void VrfStatsKState::Handler() {
      33           0 :     KVrfStatsResp *resp = static_cast<KVrfStatsResp *>(response_object_);
      34           0 :     if (resp) {
      35           0 :         if (MoreData()) {
      36             :             /* There are more interfaces in Kernel. We need to query them from
      37             :              * Kernel and send it to Sandesh.
      38             :              */
      39           0 :             SendResponse();
      40           0 :             SendNextRequest();
      41             :         } else {
      42           0 :             resp->set_context(response_context_);
      43           0 :             resp->Response();
      44           0 :             more_context_ = boost::any();
      45             :         }
      46             :     }
      47           0 : }
      48             : 
      49           0 : void VrfStatsKState::SendNextRequest() {
      50           0 :     vr_vrf_stats_req req;
      51           0 :     InitDumpRequest(req);
      52           0 :     int32_t idx = boost::any_cast<int32_t>(more_context_);
      53           0 :     req.set_vsr_marker(idx);
      54           0 :     EncodeAndSend(req);
      55           0 : }
      56             : 
      57           0 : void VrfStatsKState::SendResponse() {
      58             : 
      59           0 :     KVrfStatsResp *resp = static_cast<KVrfStatsResp *>(response_object_);
      60           0 :     resp->set_context(response_context_);
      61           0 :     resp->set_more(true);
      62           0 :     resp->Response();
      63             : 
      64           0 :     response_object_ = new KVrfStatsResp();
      65           0 : }
      66             : 
      67           0 : const string VrfStatsKState::FamilyToString(int vrf_family) const {
      68           0 :     unsigned family = vrf_family;
      69           0 :     switch(family) {
      70           0 :         case AF_INET:
      71           0 :             return "AF_INET";
      72           0 :         default:
      73           0 :             return "INVALID";
      74             :     }
      75             : }

Generated by: LCOV version 1.14