LCOV - code coverage report
Current view: top level - dns/cmn - dns.cc (source / functions) Hit Total Coverage
Test: OpenSDN C/C++ coverage (all TARGET_SET jobs) Lines: 22 25 88.0 %
Date: 2026-06-11 01:56:02 Functions: 1 2 50.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 <boost/assign.hpp>
       6             : #include <base/logging.h>
       7             : #include <base/task.h>
       8             : #include <io/event_manager.h>
       9             : #include <cmn/dns.h>
      10             : #include <cmn/buildinfo.h>
      11             : 
      12             : #include <sandesh/sandesh_types.h>
      13             : #include <sandesh/sandesh.h>
      14             : #include <sandesh/request_pipeline.h>
      15             : 
      16             : #include "config_client_manager.h"
      17             : 
      18             : using namespace std;
      19             : EventManager *Dns::event_mgr_;
      20             : DnsManager *Dns::dns_mgr_;
      21             : DnsConfigManager *Dns::dns_config_mgr_;
      22             : XmppServer *Dns::xmpp_server_;
      23             : uint32_t Dns::xmpp_srv_port_;
      24             : DnsAgentXmppChannelManager *Dns::agent_xmpp_channel_mgr_;
      25             : std::string Dns::host_name_;
      26             : std::string Dns::prog_name_;
      27             : std::string Dns::collector_;
      28             : std::string Dns::self_ip_;
      29             : uint32_t Dns::http_port_;
      30             : uint32_t Dns::dns_port_ = ContrailPorts::DnsServerPort();
      31             : 
      32           0 : bool Dns::GetVersion(string &build_info_str) {
      33           0 :     build_info_str = BuildInfo;
      34           0 :     return true;
      35             : }
      36             : 
      37           1 : void Dns::SetTaskSchedulingPolicy() {
      38           1 :     TaskScheduler *scheduler = TaskScheduler::GetInstance();
      39           1 :     TaskPolicy exclude_all;
      40           1 :     const char *config_exclude_list[] = {
      41             :         "dns::Config",
      42             :         "dns::BindStatus",
      43             :         "db::DBTable",
      44             :         "db::IFMapTable",
      45             :         "io::ReaderTask",
      46             :         "timer::TimerTask",
      47             :         "bgp::Config",
      48             :         "xmpp::StateMachine",
      49             :         "ifmap::StateMachine",
      50             :         "sandesh::RecvQueue",
      51             :         "http::RequestHandlerTask",
      52             :         "dns::NamedSndRcv"
      53             :     };
      54           1 :     int arraysize = sizeof(config_exclude_list) / sizeof(char *);
      55          13 :     for (int i = 0; i < arraysize; ++i) {
      56          12 :         int task_id = scheduler->GetTaskId(config_exclude_list[i]);
      57          12 :         exclude_all.push_back(TaskExclusion(task_id));
      58             :     }
      59           1 :     scheduler->SetPolicy(scheduler->GetTaskId("dns::Config"), exclude_all);
      60           1 :     scheduler->SetPolicy(scheduler->GetTaskId("bgp::Config"), exclude_all);
      61             : 
      62           1 :     const char *bindstatus_exclude_list[] = {
      63             :         "io::ReaderTask",
      64             :         "bgp::Config",
      65             :         "xmpp::StateMachine",
      66             :         "sandesh::RecvQueue",
      67             :         "http::RequestHandlerTask",
      68             :     };
      69           1 :     arraysize = sizeof(bindstatus_exclude_list) / sizeof(char *);
      70           1 :     TaskPolicy bindstatus_exclude;
      71           6 :     for (int i = 0; i < arraysize; ++i) {
      72           5 :         int task_id = scheduler->GetTaskId(bindstatus_exclude_list[i]);
      73           5 :         bindstatus_exclude.push_back(TaskExclusion(task_id));
      74             :     }
      75           1 :     scheduler->SetPolicy(scheduler->GetTaskId("dns::BindStatus"), bindstatus_exclude);
      76             : 
      77             :     TaskPolicy exclude_io = boost::assign::list_of
      78           2 :         (TaskExclusion(scheduler->GetTaskId("io::ReaderTask")))
      79           2 :         (TaskExclusion(scheduler->GetTaskId("sandesh::RecvQueue")))
      80           1 :         (TaskExclusion(scheduler->GetTaskId("http::RequestHandlerTask")));
      81           1 :     scheduler->SetPolicy(scheduler->GetTaskId("xmpp::StateMachine"),
      82             :                          exclude_io);
      83           1 : }

Generated by: LCOV version 1.14