LCOV - code coverage report
Current view: top level - root/contrail/src/contrail-common/sandesh/library/cpp - sandesh_options.cc (source / functions) Hit Total Coverage
Test: OpenSDN C/C++ coverage (all TARGET_SET jobs) Lines: 47 47 100.0 %
Date: 2026-11-09 02:10:49 Functions: 2 2 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //
       2             : // Copyright (c) 2017 Juniper Networks, Inc. All rights reserved.
       3             : // Copyright Contributors to the OpenSDN project
       4             : //
       5             : 
       6             : #include <cassert>
       7             : #include <base/options_util.h>
       8             : #include <sandesh/sandesh_options.h>
       9             : 
      10             : namespace opt = boost::program_options;
      11             : using namespace options::util;
      12             : 
      13             : namespace sandesh {
      14             : namespace options {
      15             : 
      16          83 : void AddOptions(opt::options_description *sandesh_options,
      17             :     SandeshConfig *sandesh_config) {
      18             :     // Command line and config file options.
      19          83 :     sandesh_options->add_options()
      20         166 :         ("SANDESH.sandesh_keyfile", opt::value<std::string>()->default_value(
      21             :          "/etc/contrail/ssl/private/server-privkey.pem"),
      22             :          "Sandesh SSL private key")
      23         166 :         ("SANDESH.sandesh_certfile", opt::value<std::string>()->default_value(
      24             :          "/etc/contrail/ssl/certs/server.pem"),
      25             :          "Sandesh SSL certificate")
      26         166 :         ("SANDESH.sandesh_server_keyfile", opt::value<std::string>()->default_value(
      27             :          "/etc/contrail/ssl/private/server-privkey.pem"),
      28             :          "Sandesh SSL Server private key")
      29         166 :         ("SANDESH.sandesh_server_certfile", opt::value<std::string>()->default_value(
      30             :          "/etc/contrail/ssl/certs/server.pem"),
      31             :          "Sandesh SSL Server certificate")
      32         166 :         ("SANDESH.sandesh_ca_cert", opt::value<std::string>()->default_value(
      33             :          "/etc/contrail/ssl/certs/ca-cert.pem"),
      34             :          "Sandesh CA SSL certificate")
      35         166 :         ("SANDESH.sandesh_ssl_enable",
      36          83 :          opt::bool_switch(&sandesh_config->sandesh_ssl_enable),
      37             :          "Enable SSL for sandesh connection")
      38         166 :         ("SANDESH.introspect_ssl_enable",
      39          83 :          opt::bool_switch(&sandesh_config->introspect_ssl_enable),
      40             :          "Enable SSL for introspect connection")
      41         166 :         ("SANDESH.introspect_ssl_insecure",
      42          83 :          opt::bool_switch(&sandesh_config->introspect_ssl_insecure),
      43             :          "Enable SSL insecure for introspect connection")
      44         166 :         ("SANDESH.disable_object_logs",
      45          83 :          opt::bool_switch(&sandesh_config->disable_object_logs),
      46             :          "Disable sending of object logs to collector")
      47         166 :         ("STATS.stats_collector", opt::value<std::string>()->default_value(
      48             :          ""),
      49             :          "External Stats Collector")
      50         166 :         ("DEFAULT.sandesh_send_rate_limit",
      51          83 :          opt::value<uint32_t>()->default_value(
      52             :          g_sandesh_constants.DEFAULT_SANDESH_SEND_RATELIMIT),
      53             :          "System logs send rate limit in messages per second per message type")
      54         166 :         ("DEFAULT.http_server_ip",
      55         166 :          opt::value<std::string>()->default_value(
      56             :          "0.0.0.0"),
      57             :          "Listen IP for the Introspect")
      58         166 :         ("SANDESH.tcp_keepalive_enable",
      59         166 :          opt::bool_switch(&sandesh_config->tcp_keepalive_enable)->default_value(true),
      60             :          "Enable Keepalive for tcp socket")
      61         166 :         ("SANDESH.tcp_keepalive_idle_time",
      62          83 :          opt::value<int>(&sandesh_config->tcp_keepalive_idle_time),
      63             :          "Keepalive idle time for tcp socket")
      64         166 :         ("SANDESH.tcp_keepalive_probes",
      65          83 :          opt::value<int>(&sandesh_config->tcp_keepalive_probes),
      66             :          "Keepalive probes for tcp socket")
      67          83 :         ("SANDESH.tcp_keepalive_interval",
      68          83 :          opt::value<int>(&sandesh_config->tcp_keepalive_interval),
      69             :          "Keepalive interval for tcp socket")
      70             :         ;
      71          83 : }
      72             : 
      73          79 : void ProcessOptions(const opt::variables_map &var_map,
      74             :     SandeshConfig *sandesh_config) {
      75          79 :     GetOptValue<std::string>(var_map, sandesh_config->keyfile,
      76             :                         "SANDESH.sandesh_keyfile");
      77          79 :     GetOptValue<std::string>(var_map, sandesh_config->certfile,
      78             :                         "SANDESH.sandesh_certfile");
      79          79 :     GetOptValue<std::string>(var_map, sandesh_config->server_keyfile,
      80             :                         "SANDESH.sandesh_server_keyfile");
      81          79 :     GetOptValue<std::string>(var_map, sandesh_config->server_certfile,
      82             :                         "SANDESH.sandesh_server_certfile");
      83          79 :     GetOptValue<std::string>(var_map, sandesh_config->ca_cert,
      84             :                         "SANDESH.sandesh_ca_cert");
      85          79 :     GetOptValue<bool>(var_map, sandesh_config->sandesh_ssl_enable,
      86             :                       "SANDESH.sandesh_ssl_enable");
      87          79 :     GetOptValue<bool>(var_map, sandesh_config->introspect_ssl_enable,
      88             :                       "SANDESH.introspect_ssl_enable");
      89          79 :     GetOptValue<bool>(var_map, sandesh_config->introspect_ssl_insecure,
      90             :                       "SANDESH.introspect_ssl_insecure");
      91          79 :     GetOptValue<bool>(var_map, sandesh_config->disable_object_logs,
      92             :                       "SANDESH.disable_object_logs");
      93          79 :     GetOptValue<std::string>(var_map, sandesh_config->stats_collector,
      94             :                         "STATS.stats_collector");
      95          79 :     GetOptValue<uint32_t>(var_map, sandesh_config->system_logs_rate_limit,
      96             :                           "DEFAULT.sandesh_send_rate_limit");
      97          79 :     GetOptValue<std::string>(var_map, sandesh_config->http_server_ip,
      98             :                         "DEFAULT.http_server_ip");
      99          79 :     GetOptValue<bool>(var_map, sandesh_config->tcp_keepalive_enable,
     100             :                        "SANDESH.tcp_keepalive_enable");
     101          79 :     GetOptValue<int>(var_map, sandesh_config->tcp_keepalive_idle_time,
     102             :                      "SANDESH.tcp_keepalive_idle_time");
     103          79 :     GetOptValue<int>(var_map, sandesh_config->tcp_keepalive_probes,
     104             :                      "SANDESH.tcp_keepalive_probes");
     105          79 :     GetOptValue<int>(var_map, sandesh_config->tcp_keepalive_interval,
     106             :                      "SANDESH.tcp_keepalive_interval");
     107          79 : }
     108             : 
     109             : }  // namespace options
     110             : }  // namespace sandesh

Generated by: LCOV version 1.14