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

Generated by: LCOV version 1.14