LCOV - code coverage report
Current view: top level - control-node - options.h (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: 36 36 100.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/program_options.hpp>
       7             : #include "config_client_options.h"
       8             : #include "io/event_manager.h"
       9             : #include "sandesh/sandesh.h"
      10             : 
      11             : class ConfigClientManager;
      12             : 
      13             : // Process command line/configuration file options for control-node.
      14             : class Options {
      15             : public:
      16             :     Options();
      17             :     bool Parse(EventManager &evm, int argc, char **argv);
      18             : 
      19           6 :     std::string bgp_config_file() const { return bgp_config_file_; }
      20           6 :     uint16_t bgp_port() const { return bgp_port_; }
      21          36 :     std::vector<std::string> collector_server_list() const {
      22          36 :         return collector_server_list_;
      23             :     }
      24             :     std::vector<std::string> randomized_collector_server_list() const {
      25             :         return randomized_collector_server_list_;
      26             :     }
      27           6 :     std::string config_file() const { return config_file_; };
      28           6 :     std::string hostname() const { return hostname_; }
      29           6 :     std::string host_ip() const { return host_ip_; }
      30           6 :     uint16_t http_server_port() const { return http_server_port_; }
      31           6 :     std::string log_category() const { return log_category_; }
      32           6 :     bool log_disable() const { return log_disable_; }
      33           6 :     std::string log_file() const { return log_file_; }
      34             :     std::string log_property_file() const { return log_property_file_; }
      35           6 :     int log_files_count() const { return log_files_count_; }
      36           6 :     long log_file_size() const { return log_file_size_; }
      37           6 :     std::string log_level() const { return log_level_; }
      38           6 :     bool log_local() const { return log_local_; }
      39             :     bool use_syslog() const { return use_syslog_; }
      40             :     std::string syslog_facility() const { return syslog_facility_; }
      41           6 :     bool mvpn_ipv4_enable() const { return mvpn_ipv4_enable_; }
      42           1 :     bool task_track_run_time() const { return task_track_run_time_; }
      43           6 :     std::string config_db_user() const {
      44           6 :         return configdb_options_.config_db_username;
      45             :     }
      46           6 :     std::string config_db_password() const {
      47           6 :         return configdb_options_.config_db_password;
      48             :     }
      49           3 :     bool config_db_use_ssl() const {
      50           3 :         return configdb_options_.config_db_use_ssl;
      51             :     }
      52          24 :     std::vector<std::string> config_db_server_list() const {
      53          24 :         return configdb_options_.config_db_server_list;
      54             :     }
      55          24 :     std::vector<std::string> rabbitmq_server_list() const {
      56          24 :         return configdb_options_.rabbitmq_server_list;
      57             :     }
      58           7 :     std::string rabbitmq_user() const {
      59           7 :         return configdb_options_.rabbitmq_user;
      60             :     }
      61           7 :     std::string rabbitmq_password() const {
      62           7 :         return configdb_options_.rabbitmq_password;
      63             :     }
      64           5 :     bool rabbitmq_ssl_enabled() const {
      65           5 :         return configdb_options_.rabbitmq_use_ssl;
      66             :     }
      67           2 :     bool using_etcd_client() const {
      68           2 :         return configdb_options_.config_db_use_etcd;
      69             :     }
      70           3 :     const ConfigClientOptions &configdb_options() const {
      71           3 :         return configdb_options_;
      72             :     }
      73           6 :     uint16_t xmpp_port() const { return xmpp_port_; }
      74           1 :     bool xmpp_auth_enabled() const { return xmpp_auth_enable_; }
      75           1 :     std::string xmpp_server_cert() const { return xmpp_server_cert_; }
      76           1 :     std::string xmpp_server_key() const { return xmpp_server_key_; }
      77           1 :     std::string xmpp_ca_cert() const { return xmpp_ca_cert_; }
      78           6 :     bool test_mode() const { return test_mode_; }
      79             :     bool collectors_configured() const { return collectors_configured_; }
      80             :     int tcp_hold_time() const { return tcp_hold_time_; }
      81           1 :     bool optimize_snat() const { return optimize_snat_; }
      82           6 :     bool gr_helper_bgp_disable() const { return gr_helper_bgp_disable_; }
      83           6 :     bool gr_helper_xmpp_disable() const { return gr_helper_xmpp_disable_; }
      84             :     const std::string cassandra_user() const { return cassandra_user_; }
      85             :     const std::string cassandra_password() const { return cassandra_password_; }
      86             :     const std::vector<std::string> cassandra_server_list() const {
      87             :         return cassandra_server_list_;
      88             :     }
      89          13 :     const SandeshConfig &sandesh_config() const { return sandesh_config_; }
      90             : 
      91             :     void ParseReConfig(bool force_reinit);
      92             : 
      93             :     void set_config_client_manager(ConfigClientManager *mgr) {
      94             :         config_client_manager_ = mgr;
      95             :     }
      96             : 
      97             : private:
      98             : 
      99             :     bool Process(int argc, char *argv[],
     100             :                  boost::program_options::options_description &cmdline_options);
     101             :     void Initialize(EventManager &evm,
     102             :                     boost::program_options::options_description &options);
     103             :     void ParseConfigOptions(const boost::program_options::variables_map
     104             :                             &var_map);
     105             :     uint32_t GenerateHash(const std::vector<std::string> &list);
     106             :     uint32_t GenerateHash(const ConfigClientOptions &config);
     107             : 
     108             :     std::string bgp_config_file_;
     109             :     uint16_t bgp_port_;
     110             :     std::vector<std::string> collector_server_list_;
     111             :     std::vector<std::string> randomized_collector_server_list_;
     112             :     uint32_t collector_chksum_;
     113             :     uint32_t configdb_chksum_;
     114             :     std::string config_file_;
     115             :     std::string hostname_;
     116             :     std::string host_ip_;
     117             :     uint16_t http_server_port_;
     118             :     std::string log_category_;
     119             :     bool log_disable_;
     120             :     std::string log_file_;
     121             :     std::string log_property_file_;
     122             :     int log_files_count_;
     123             :     long log_file_size_;
     124             :     std::string log_level_;
     125             :     bool log_local_;
     126             :     bool use_syslog_;
     127             :     std::string syslog_facility_;
     128             :     bool mvpn_ipv4_enable_;
     129             :     bool task_track_run_time_;
     130             :     ConfigClientOptions configdb_options_;
     131             :     uint16_t xmpp_port_;
     132             :     bool xmpp_auth_enable_;
     133             :     std::string xmpp_server_cert_;
     134             :     std::string xmpp_server_key_;
     135             :     std::string xmpp_ca_cert_;
     136             :     bool test_mode_;
     137             :     bool collectors_configured_;
     138             :     int tcp_hold_time_;
     139             :     bool optimize_snat_;
     140             :     uint32_t sandesh_ratelimit_;
     141             :     bool gr_helper_bgp_disable_;
     142             :     bool gr_helper_xmpp_disable_;
     143             :     std::string cassandra_user_;
     144             :     std::string cassandra_password_;
     145             :     std::vector<std::string> cassandra_server_list_;
     146             :     std::vector<std::string> default_collector_server_list_;
     147             :     SandeshConfig sandesh_config_;
     148             :     boost::program_options::options_description config_file_options_;
     149             :     ConfigClientManager *config_client_manager_;
     150             : };

Generated by: LCOV version 1.14