diff options
Diffstat (limited to 'src/mod')
-rw-r--r-- | src/mod/trapd_dcae_logger.py | 68 | ||||
-rw-r--r-- | src/mod/trapd_dmaap_config.py | 104 | ||||
-rw-r--r-- | src/mod/trapd_exit.py | 63 | ||||
-rw-r--r-- | src/mod/trapd_http_session.py | 62 | ||||
-rw-r--r-- | src/mod/trapd_perm_status.py | 61 | ||||
-rw-r--r-- | src/mod/trapd_runtime_pid.py | 91 | ||||
-rw-r--r-- | src/mod/trapd_trap_config.py | 98 | ||||
-rw-r--r-- | src/mod/trapd_yaml_config.py | 193 |
8 files changed, 0 insertions, 740 deletions
diff --git a/src/mod/trapd_dcae_logger.py b/src/mod/trapd_dcae_logger.py deleted file mode 100644 index c47d8cf..0000000 --- a/src/mod/trapd_dcae_logger.py +++ /dev/null @@ -1,68 +0,0 @@ -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ============LICENSE_END========================================================= -# -# ECOMP is a trademark and service mark of AT&T Intellectual Property. -# -""" -NOTE: This is a placeholder for now - logger has not been externalized -from the main source. - -Setup custom logger for dcae_snmptrapd that incorporates -a rotating file _handler with 10 backups of diagnostic messages -:Parameters: - -:Exceptions: - -:Keywords: - -""" - -__docformat__ = 'restructuredtext' - -import logging - - -# # # # # # # # # # # # # # # # # # # -# fx: setup _dcae_logger custom logger -# # # # # # # # # # ## # # # # # # # -def setup_dcae_logger(_yc_snmptrapd_diag, _dcae_logger_max_bytes, _dcae_logger_num_archives): - """ - """ - - _date_fmt = '%m/%d/%Y %H:%M:%S' - - _yc_snmptrapd_diag_bak = "%s.bak" % (_yc_snmptrapd_diag) - if os.path.isfile(_yc_snmptrapd_diag): - os.rename(_yc_snmptrapd_diag, _yc_snmptrapd_diag_bak) - - _handler = logging._handlers.RotatingFileHandler(_yc_snmptrapd_diag, - maxBytes=_dcae_logger_max_bytes, - backupCount=_dcae_logger_num_archives) - - # set logLevel - valid values NOTSET, DEBUG, INFO, WARNING, ERROR, CRITICAL - _handler.setLevel(logging.DEBUG) - _dcae_logger.setLevel(logging.DEBUG) - - log_fmt = '%(levelname)s|%(asctime)s|%(name)s|%(process)d|%(funcName)s|'\ - '%(message)s' - _formatter = logging.Formatter(log_fmt) - _handler.setFormatter(formatter) - _dcae_logger.addHandler(_handler) - - if os.path.isfile(_yc_snmptrapd_diag): - os.chmod(_yc_snmptrapd_diag, 0o640) - - if os.path.isfile(_yc_snmptrapd_diag_bak): - os.chmod(_yc_snmptrapd_diag_bak, 0o640) - - return _dcae_logger diff --git a/src/mod/trapd_dmaap_config.py b/src/mod/trapd_dmaap_config.py deleted file mode 100644 index 6e83821..0000000 --- a/src/mod/trapd_dmaap_config.py +++ /dev/null @@ -1,104 +0,0 @@ -# ============LICENSE_START======================================================= -# org.onap.dcae -# ================================================================================ -# Copyright (c) 2018 AT&T Intellectual Property. All rights reserved. -# ================================================================================ -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ============LICENSE_END========================================================= -# -# ECOMP is a trademark and service mark of AT&T Intellectual Property. -# -""" -NOTE: This module is for temporary use. It will be removed when dcae_snmptrapd -is migrated to the new controller infrastructure. - -trapd_dmaap_config is responsible for reading/parsing the previous generation -'dmaap.conf' file, which includes stream, server and authentication details for -publishing activities. -""" - -__docformat__ = 'restructuredtext' - -import os -import sys -import string -import time -import traceback -import collections -import json - -from trapd_exit import cleanup_and_exit - -prog_name = os.path.basename(__file__) - - -# # # # # # # # # # # -# fx: read_dmaap_config -# # # # # # # # # # # -def read_dmaap_config(_yc_dmaap_conf, _dcae_logger): - # FIXME NOTE: This is for testing purposes only, and utilizes the - # previous generation of the controller; dispose of when ready - """ - Load dmaap config /etc/dcae/dmaap.conf file (legacy controller) - :Parameters: - name of dmaap config file - :Exceptions: - file open - this function will throw an exception if unable to open - yc_dmaap_conf(fatal error) - :Keywords: - legacy controller dmaap.conf - :Variables: - yc_dmaap_conf - full path filename of dmaap_conf file provided by previous - generation controller - :Returns: - named tuple of config values - """ - - _dmaap_cfg_values_nt = collections.namedtuple('dmaap_config_values', [ - 'dmaap_url', 'dmaap_user_name', 'dmaap_p_var', 'dmaap_stream_id', 'dmaap_host']) - if os.path.isfile(_yc_dmaap_conf): - _dcae_logger.debug('Reading DMaaP config file %s ' % - _yc_dmaap_conf) - else: - _dcae_logger.error('DMaaP config file %s does NOT exist - exiting' - % (_yc_dmaap_conf)) - cleanup_and_exit(1, undefined) - - with open(_yc_dmaap_conf) as _dmaap_config_fd: - _dmaapCfgData = json.load(_dmaap_config_fd) - - try: - dmaap_url = _dmaapCfgData[0]["dmaapUrl"] - _dcae_logger.debug('dmaap_url: %s' % (dmaap_url)) - dmaap_user_name = _dmaapCfgData[0]["dmaapUserName"] - _dcae_logger.debug('dmaap_user_name: %s' % (dmaap_user_name)) - dmaap_p_var = _dmaapCfgData[0]["dmaapPassword"] - _dcae_logger.debug('dmaap_p_var: -') - dmaap_stream_id = _dmaapCfgData[0]["dmaapStreamId"] - _dcae_logger.debug('dmaap_stream_id: %s' % (dmaap_stream_id)) - except: - _dcae_logger.error('DMaaP config file %s has missing data - exiting' - % (_yc_dmaap_conf)) - cleanup_and_exit(1, "undefined") - - # This is for logging purposes only. - dmaap_host = dmaap_url.split('/')[2][:-5] - _dcae_logger.debug('dmaap_host: %s' % (dmaap_host)) - - _dmaap_config_fd.close() - - _dmaap_cfg_values = _dmaap_cfg_values_nt(dmaap_url=dmaap_url, dmaap_user_name=dmaap_user_name, - dmaap_p_var=dmaap_p_var, dmaap_stream_id=dmaap_stream_id, dmaap_host=dmaap_host) - return _dmaap_cfg_values diff --git a/src/mod/trapd_exit.py b/src/mod/trapd_exit.py deleted file mode 100644 index e3e9364..0000000 --- a/src/mod/trapd_exit.py +++ /dev/null @@ -1,63 +0,0 @@ -# ============LICENSE_START======================================================= -# org.onap.dcae -# ================================================================================ -# Copyright (c) 2018 AT&T Intellectual Property. All rights reserved. -# ================================================================================ -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ============LICENSE_END========================================================= -# -# ECOMP is a trademark and service mark of AT&T Intellectual Property. -# -""" -trapc_exit_snmptrapd is responsible for removing any existing runtime PID -file, and exiting with the provided (param 1) exit code -""" - -__docformat__ = 'restructuredtext' - -import sys -import os -import string -from trapd_runtime_pid import save_pid, rm_pid - -prog_name = os.path.basename(__file__) - - -# # # # # # # # # # # # # -# fx: cleanup_and_exit -# - remove pid file -# - exit with supplied return code -# # # # # # # # # # # # # -def cleanup_and_exit(_loc_exit_code, _pid_file_name): - """ - Remove existing PID file, and exit with provided exit code - :Parameters: - _loc_exit_code - value to return to calling shell upon exit - _pid_file_name - name of file that contains current process ID (for - removal) - :Exceptions: - none - :Keywords: - runtime PID exit - :Variables: - _num_params - number of parameters passed to module - """ - - _num_params = len(locals()) - - if _num_params == 2: - rc = rm_pid(_pid_file_name) - sys.exit(_loc_exit_code) diff --git a/src/mod/trapd_http_session.py b/src/mod/trapd_http_session.py deleted file mode 100644 index f087423..0000000 --- a/src/mod/trapd_http_session.py +++ /dev/null @@ -1,62 +0,0 @@ -# ============LICENSE_START======================================================= -# org.onap.dcae -# ================================================================================ -# Copyright (c) 2018 AT&T Intellectual Property. All rights reserved. -# ================================================================================ -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ============LICENSE_END========================================================= -# -# ECOMP is a trademark and service mark of AT&T Intellectual Property. -# -""" -trapd_http_session establishes an http session for future use in publishing -messages to the dmaap cluster. -""" - -__docformat__ = 'restructuredtext' - -import logging -import os -import requests -import string -import time -import traceback - -prog_name = os.path.basename(__file__) - - -# # # # # # # # # # # # # -# fx: init_session_obj -# # # # # # # # # # # # # -def init_session_obj(_dcae_logger): - """ - Initializes and returns a http request session object for later use - :Parameters: - dcae logger for diagnostics - :Exceptions: - session object creation - this function will throw an exception if unable to create - a new session object - :Keywords: - http request session - :Variables: - none - """ - - try: - s = requests.Session() - _dcae_logger.debug("New requests session has been initialized: %s" % s) - except: - _dcae_logger.error("Failed to create new requests session") - - return s diff --git a/src/mod/trapd_perm_status.py b/src/mod/trapd_perm_status.py deleted file mode 100644 index 43ad1df..0000000 --- a/src/mod/trapd_perm_status.py +++ /dev/null @@ -1,61 +0,0 @@ -# ============LICENSE_START======================================================= -# org.onap.dcae -# ================================================================================ -# Copyright (c) 2018 AT&T Intellectual Property. All rights reserved. -# ================================================================================ -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ============LICENSE_END========================================================= -# -# ECOMP is a trademark and service mark of AT&T Intellectual Property. -# -""" -trapd_perm_status maintains a 'permanent' status file -important messages for audit/diagnostics/etc -""" - -__docformat__ = 'restructuredtext' - -import logging -import os -import string -import time -import traceback - -prog_name = os.path.basename(__file__) - - -# # # # # # # # # # # # # -# fx: log_to_perm_status -# # # # # # # # # # # # # -def log_to_perm_status(_loc_perm_file, _loc_perm_msg, _dcae_logger): - """ - Log select errors too permanent logfile - access. - :Parameters: - log message, logger - :Exceptions: - file open - this function will catch exception of unable to - open the log file - :Keywords: - permstatus - """ - - perm_fmt_date = time.strftime("%a %b %d %H:%M:%S %Z %Y") - - try: - f = open(_loc_perm_file, 'a') - f.write("%s %s\n" % (perm_fmt_date, _loc_perm_msg)) - f.close() - except IOError: - _dcae_logger.exception("File I/O Exception on %s" % perm_status_fd) diff --git a/src/mod/trapd_runtime_pid.py b/src/mod/trapd_runtime_pid.py deleted file mode 100644 index 96594e6..0000000 --- a/src/mod/trapd_runtime_pid.py +++ /dev/null @@ -1,91 +0,0 @@ -# ============LICENSE_START======================================================= -# org.onap.dcae -# ================================================================================ -# Copyright (c) 2018 AT&T Intellectual Property. All rights reserved. -# ================================================================================ -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ============LICENSE_END========================================================= -# -# ECOMP is a trademark and service mark of AT&T Intellectual Property. -# -""" -trapd_runtime_pid maintains a 'PID file' (file that contains the -PID of currently running trap receiver) -""" - -__docformat__ = 'restructuredtext' - -import logging -import os -import string -import time -import traceback - -prog_name = os.path.basename(__file__) - - -# # # # # # # # # # # # # -# fx: save_pid - save PID of running process -# # # # # # # # # # # # # -def save_pid(_pid_file_name): - """ - Save the current process ID in a file for external - access. - :Parameters: - none - :Exceptions: - file open - this function will catch exception of unable to - open/create _pid_file_name - :Keywords: - pid /var/run - """ - - try: - pid_fd = open(_pid_file_name, 'w') - pid_fd.write('%d' % os.getpid()) - pid_fd.close() - except IOError: - print("IOError saving PID file %s :" % _pid_file_name) - return False - # except: - # print("Error saving PID file %s :" % _pid_file_name) - # return False - else: - print("Runtime PID file: %s" % _pid_file_name) - return True - - -# # # # # # # # # # # # # -# fx: rm_pid - remove PID of running process -# # # # # # # # # # # # # -def rm_pid(_pid_file_name): - """ - Remove the current process ID file before exiting. - :Parameters: - none - :Exceptions: - file open - this function will catch exception of unable to find or remove - _pid_file_name - :Keywords: - pid /var/run - """ - - try: - if os.path.isfile(_pid_file_name): - os.remove(_pid_file_name) - return True - except IOError: - print("Error removing Runtime PID file: %s" % _pid_file_name) - return False diff --git a/src/mod/trapd_trap_config.py b/src/mod/trapd_trap_config.py deleted file mode 100644 index 4b1e2e4..0000000 --- a/src/mod/trapd_trap_config.py +++ /dev/null @@ -1,98 +0,0 @@ -# ============LICENSE_START======================================================= -# org.onap.dcae -# ================================================================================ -# Copyright (c) 2018 AT&T Intellectual Property. All rights reserved. -# ================================================================================ -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ============LICENSE_END========================================================= -# -# ECOMP is a trademark and service mark of AT&T Intellectual Property. -# -""" -trapd_trap_conf reads config file of traps and stores/returns them -in a data dictionary that is used to compare arriving SNMP OID's -to the list contained in this file for a keep(/publish) or ignore -decision. -""" - -__docformat__ = 'restructuredtext' - -import os -import sys -import string -import time -import traceback -from trapd_exit import cleanup_and_exit - - -prog_name = os.path.basename(__file__) - - -# # # # # # # # # # # -# fx: read_trap_config -# # # # # # # # # # # - -def read_trap_config(_yc_trap_conf, _dcae_logger): - """ - Load trap config file specified in yaml conf. This config (1) specifies - which traps should be published(inclusion) and which traps should be discarded - (not present in config) and (2) maps SNMP Notify OID to DMAAP/MR topics - :Parameters: - none - :Exceptions: - file open - this function will throw an exception if unable to open - _yc_trap_conf - :Keywords: - NotifyOID trap config topic - :Variables: - """ - - _trap_conf_dict = {} - - if os.path.isfile(_yc_trap_conf): - _dcae_logger.debug('Reading trap config file %s ' % _yc_trap_conf) - else: - _dcae_logger.error('ERROR: trap config file %s does NOT exist - exiting' - % (_yc_trap_conf)) - cleanup_and_exit(1, "undefined") - - # reset dictionaries in case we've been here before - _num_trap_conf_entries = 0 - - field_separator = " " - - _dcae_logger.debug('processing trap config settings from %s' - % (_yc_trap_conf)) - for line in open(_yc_trap_conf): - # format: - # - # oid_including_regex <topic> - # - if line[0] != '#': - columns = line.rstrip().split(field_separator) - # process trap config entries - if len(columns) == 2: - _trap_conf_oid = columns[0] - _trap_conf_dict[_trap_conf_oid] = columns[1] - _dcae_logger.debug('%d oid: %s topic: %s' % - (_num_trap_conf_entries, _trap_conf_oid, _trap_conf_dict[_trap_conf_oid])) - _num_trap_conf_entries += 1 - else: - _dcae_logger.debug('ERROR: Invalid trap config entry - ' - 'skipping: %s' % (line.rstrip())) - - _dcae_logger.debug('%d trap config entries found in %s' % (_num_trap_conf_entries, - _yc_trap_conf)) - - return _trap_conf_dict diff --git a/src/mod/trapd_yaml_config.py b/src/mod/trapd_yaml_config.py deleted file mode 100644 index f0d12e3..0000000 --- a/src/mod/trapd_yaml_config.py +++ /dev/null @@ -1,193 +0,0 @@ -# ============LICENSE_START======================================================= -# org.onap.dcae -# ================================================================================ -# Copyright (c) 2018 AT&T Intellectual Property. All rights reserved. -# ================================================================================ -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ============LICENSE_END========================================================= -# -# ECOMP is a trademark and service mark of AT&T Intellectual Property. -# -""" -Read the SNMP trap receiver YAML config file, which contains the vast -majority of configurable parameters for the process, including -location of other config files, http timeouts, dns cache times, -etc. -""" - -__docformat__ = 'restructuredtext' - -import os -import sys -import string -import time -import traceback -import collections -import yaml -from trapd_exit import cleanup_and_exit - - -prog_name = os.path.basename(__file__) - - -# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # -# function: get_yaml_cfg -# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # - - -def read_yaml_config(loc_yaml_conf_file): - """ - Load all sorts of goodies from yaml config file. - :Parameters: - loc_yaml_conf_file - filename including full path to yaml config file - :Exceptions: - file open - this function will throw an exception if unable to open - loc_yaml_conf_file (fatal error) or any of the required - values are not found in the loc_yaml_conf_file (fatal error) - :Keywords: - yaml config runtime protocol files dmaap - :Variables: - yc_transport - protocol transport for snmp traps (udp|tcp) - yc_ipv4_interface - what ipv4 interface to listen for traps on - yc_ipv4_port - what port to listen for traps on - yc_dns_cache_ttl_seconds - how many seconds an entry remains in DNS cache prior to refresh - yc_runtime_base_dir - base directory of dcae_snmptrapd application - yc_log_dir - log directory of dcae_snmptrapd application - yc_data_dir - data directory of dcae_snmptrapd application - yc_pid_dir - directory where running PID file will be written (filename <yc_pid_dir>/<prog_name>.pid) - yc_trapd_diag - program diagnostic log, auto rotated and archived via python handler - yc_raw_traps_log - file to write raw trap data to - yc_published_traps_dir - file to write json formatted trap data for successful publishes (only!) - yc_trap_stats_log - file to write trap stats (traps per second, by OID, by agent) - yc_perm_status_file - file to write trap stats (traps per second, by OID, by agent) - yc_dmaap_conf - file (full path) of yaml config entries referenced at runtime, passed as - runtime command argument "-c <yc_dmaap_conf> - yc_http_timeout - http timeout in seconds for dmaap publish attempt - yc_http_retries - num of http retries to attempt in response to failed post - yc_primary_publisher - boolean defining whether local instance is primary (future use) - yc_peer_publisher - identity of peer publisher in case this one fails (future use) - yc_max_traps_between_publish - if batching publishes, max number of traps to queue before http post - yc_max_milliseconds_between_publish - if batching publishes, max number of milliseconds between http post - Note: using the batch feature creates an opportunity for trap loss if - traps stop arriving and the process exits (traps in queue will remain - there until another trap arrives and kicks of the evaluation of max_traps - or max_milliseconds above). - """ - - # named tuple for values in yaml config file - _yaml_config_values_nt = collections.namedtuple('yaml_config_values', ['yc_transport', 'yc_ipv4_port', 'yc_ipv4_interface', 'yc_ipv6_port', 'yc_ipv6_interface', 'yc_dns_cache_ttl_seconds', 'yc_runtime_base_dir', 'yc_log_dir', 'yc_data_dir', 'yc_pid_dir', 'yc_trap_conf', 'yc_trapd_diag', - 'yc_raw_traps_log', 'yc_published_traps_dir', 'yc_trap_stats_log', 'yc_perm_status_file', 'yc_dmaap_conf', 'yc_http_timeout', 'yc_http_retries', 'yc_http_secs_between_retries', 'yc_primary_publisher', 'yc_peer_publisher', 'yc_max_traps_between_publish', 'yc_max_milliseconds_between_publish']) - - with open(loc_yaml_conf_file, 'r') as yaml_fd: - cfg_data = yaml.load(yaml_fd) - - # ONAP FIXME: split try into per-section except loops below - try: - # protocol - yc_transport = (cfg_data['protocol']['transport']) - yc_ipv4_interface = (cfg_data['protocol']['ipv4_interface']) - yc_ipv4_port = int(cfg_data['protocol']['ipv4_port']) - yc_ipv6_interface = (cfg_data['protocol']['ipv6_interface']) - yc_ipv6_port = int(cfg_data['protocol']['ipv6_port']) - yc_dns_cache_ttl_seconds = int( - cfg_data['protocol']['dns_cache_ttl_seconds']) - - # files and directories - yc_runtime_base_dir = (cfg_data['files']['runtime_base_dir']) - yc_log_dir = (cfg_data['files']['log_dir']) - yc_data_dir = (cfg_data['files']['data_dir']) - yc_pid_dir = (cfg_data['files']['pid_dir']) - yc_trap_conf = (cfg_data['files']['trap_conf']) - yc_trapd_diag = (cfg_data['files']['snmptrapd_diag']) - yc_raw_traps_log = (cfg_data['files']['raw_traps_log']) - yc_published_traps_dir = (cfg_data['files']['published_traps_dir']) - yc_trap_stats_log = (cfg_data['files']['trap_stats_log']) - yc_perm_status_file = (cfg_data['files']['perm_status_file']) - - # dmaap - yc_dmaap_conf = (cfg_data['dmaap']['dmaap_conf']) - yc_http_timeout = (cfg_data['dmaap']['http_timeout']) - yc_http_retries = (cfg_data['dmaap']['http_retries']) - yc_http_secs_between_retries = ( - cfg_data['dmaap']['http_secs_between_retries']) - yc_primary_publisher = (cfg_data['dmaap']['primary_publisher']) - yc_peer_publisher = (cfg_data['dmaap']['peer_publisher']) - yc_max_traps_between_publish = ( - cfg_data['dmaap']['max_traps_between_publish']) - yc_max_milliseconds_between_publish = ( - cfg_data['dmaap']['max_milliseconds_between_publish']) - - except: - print("ERROR reading config: %s" % loc_yaml_conf_file) - raise - cleanup_and_exit(1, "undefined") - - # print back for confirmation - print("Configs read from: %s" % loc_yaml_conf_file) - print(" protocol section:") - print(" transport: %s" % yc_transport) - print(" ipv4_port: %s" % yc_ipv4_port) - print(" ipv4_interface: %s" % yc_ipv4_interface) - print(" ipv6_port: %s" % yc_ipv6_port) - print(" ipv6_interface: %s" % yc_ipv6_interface) - print(" dns_cache_ttl_seconds: %s" % yc_dns_cache_ttl_seconds) - print(" files section:") - print(" runtime_base_dir: %s" % yc_runtime_base_dir) - print(" log_dir: %s" % yc_log_dir) - print(" data_dir: %s" % yc_data_dir) - print(" pid_dir: %s" % yc_pid_dir) - print(" trap_conf: %s" % yc_trap_conf) - print(" snmptrapd_diag: %s" % yc_trapd_diag) - print(" raw_traps_log: %s" % yc_raw_traps_log) - print(" published_traps_dir: %s" % yc_published_traps_dir) - print(" trap_stats_log: %s" % yc_trap_stats_log) - print(" perm_status_file: %s" % yc_perm_status_file) - print(" dmaap section:") - print(" dmaap_config_file: %s" % yc_dmaap_conf) - print(" http_timeout: %s" % yc_http_timeout) - print(" http_retries: %s" % yc_http_retries) - print(" http_secs_between_retries: %s" % - yc_http_secs_between_retries) - print(" primary_publisher: %s" % yc_primary_publisher) - print(" peer_publisher: %s" % yc_peer_publisher) - print(" max_traps_between_publish: %s" % - yc_max_traps_between_publish) - print(" max_milliseconds_between_publish: %s" % - yc_max_milliseconds_between_publish) - - _yaml_config_values = _yaml_config_values_nt(yc_transport=yc_transport, yc_ipv4_port=yc_ipv4_port, yc_ipv4_interface=yc_ipv4_interface, yc_ipv6_port=yc_ipv6_port, yc_ipv6_interface=yc_ipv6_interface, yc_dns_cache_ttl_seconds=yc_dns_cache_ttl_seconds, yc_runtime_base_dir=yc_runtime_base_dir, yc_log_dir=yc_log_dir, yc_data_dir=yc_data_dir, yc_pid_dir=yc_pid_dir, yc_trap_conf=yc_trap_conf, yc_trapd_diag=yc_trapd_diag, yc_raw_traps_log=yc_raw_traps_log, yc_published_traps_dir=yc_published_traps_dir, - yc_trap_stats_log=yc_trap_stats_log, yc_perm_status_file=yc_perm_status_file, yc_dmaap_conf=yc_dmaap_conf, yc_http_timeout=yc_http_timeout, yc_http_retries=yc_http_retries, yc_http_secs_between_retries=yc_http_secs_between_retries, yc_primary_publisher=yc_primary_publisher, yc_peer_publisher=yc_peer_publisher, yc_max_traps_between_publish=yc_max_traps_between_publish, yc_max_milliseconds_between_publish=yc_max_milliseconds_between_publish) - - return _yaml_config_values |