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

Generated by: LCOV version 1.14