diff --git a/fm-common/sources/fmConfig.cpp b/fm-common/sources/fmConfig.cpp index 32b19578..c7d7d764 100644 --- a/fm-common/sources/fmConfig.cpp +++ b/fm-common/sources/fmConfig.cpp @@ -1,5 +1,5 @@ // -// Copyright (c) 2018 Wind River Systems, Inc. +// Copyright (c) 2018-2020 Wind River Systems, Inc. // // SPDX-License-Identifier: Apache-2.0 // @@ -15,7 +15,6 @@ #include "fmMutex.h" #include "fmConstants.h" #include "fmSnmpConstants.h" -#include "fmSnmpUtils.h" typedef std::map configParams; @@ -73,9 +72,6 @@ void fm_get_config_paramters() { key = trim(line.substr(0, pos)); value = trim(line.erase(0, pos + delimiter.length())); getConfigMap()[key] = value; - if (key.compare(FM_SNMP_TRAPDEST) == 0) { - set_trap_dest_list(value); - } if (key.compare(FM_SQL_CONNECTION) != 0) { // Don't log sql_connection, as it has a password if (key.compare(FM_CONF_PASSWORD) == 0 || key.compare(FM_CONF_CONNECTION) == 0) { diff --git a/fm-common/sources/fmSnmpConstants.h b/fm-common/sources/fmSnmpConstants.h index b6d38bb4..2b0ca83e 100644 --- a/fm-common/sources/fmSnmpConstants.h +++ b/fm-common/sources/fmSnmpConstants.h @@ -1,5 +1,5 @@ // -// Copyright (c) 2017-2018 Wind River Systems, Inc. +// Copyright (c) 2017-2020 Wind River Systems, Inc. // // SPDX-License-Identifier: Apache-2.0 // @@ -14,14 +14,6 @@ #define FM_CUSTOMER_LOG 10 -/* Trap Destination definitions */ - -#define FM_SNMP_TRAPDEST "trap_destinations" - -#define FM_TRAPDEST_IP "ip_address" - -#define FM_TRAPDEST_COMM "community" - /* MIB Trap definitions */ const std::string WRS_ALARM_MIB = "WRS-ALARM-MIB"; @@ -56,11 +48,5 @@ const std::string EVENT_SERVICE_AFFECTING = "wrsEventServiceAffecting"; const std::string SNMPv2_MIB = "SNMPv2-MIB"; const std::string WARM_START = "warmStart"; -const std::string TRAP_CMD = "/usr/bin/snmptrap -v 2c"; const std::string CLEAR_REASON_TEXT = "System initiated hierarchical alarm clear"; -const std::string SEP = " "; -const std::string SCOPE = "::"; -const std::string STR_TYPE = " s "; -const std::string INT_TYPE = " i "; -const std::string OPTION_COMM = " -c "; diff --git a/fm-common/sources/fmSnmpUtils.cpp b/fm-common/sources/fmSnmpUtils.cpp index 7e63963b..b74979b6 100644 --- a/fm-common/sources/fmSnmpUtils.cpp +++ b/fm-common/sources/fmSnmpUtils.cpp @@ -38,10 +38,6 @@ static int_to_objtype objtype_map; static pthread_mutex_t mutex = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP; -fm_db_result_t &getTrapDestList(){ - static fm_db_result_t trap_dest_list; - return trap_dest_list; -} static void add_to_table(int t, std::string objtype, int_to_objtype &tbl) { tbl[t]=objtype; @@ -175,36 +171,6 @@ static std::string get_trap_objtype(int type){ return objtype_map[type]; } -static void add_to_list(std::vector &trap_strings) { - std::string delimiter = " "; - - std::vector::iterator it = trap_strings.begin(); - std::vector::iterator end = trap_strings.end(); - getTrapDestList().clear(); - for (; it != end; ++it){ - size_t pos = 0; - fm_db_single_result_t entry; - pos = (*it).find(delimiter); - entry[FM_TRAPDEST_IP] = (*it).substr(0, pos); - entry[FM_TRAPDEST_COMM] = (*it).erase(0, pos + delimiter.length()); - getTrapDestList().push_back(entry); - } -} - -void set_trap_dest_list(std::string value){ - - std::vector entries; - std::istringstream f(value); - std::string s; - while (getline(f, s, ',')) { - std::cout << s << std::endl; - FM_INFO_LOG("Add entry: (%s)", s.c_str()); - entries.push_back(s); - } - add_to_list(entries); - FM_INFO_LOG("Set trap entries: (%d)", getTrapDestList().size()); -} - /** diff --git a/fm-common/sources/fmSnmpUtils.h b/fm-common/sources/fmSnmpUtils.h index 3e6856e9..2c62ad5a 100644 --- a/fm-common/sources/fmSnmpUtils.h +++ b/fm-common/sources/fmSnmpUtils.h @@ -1,5 +1,5 @@ // -// Copyright (c) 2014 Wind River Systems, Inc. +// Copyright (c) 2014-2020 Wind River Systems, Inc. // // SPDX-License-Identifier: Apache-2.0 // @@ -7,13 +7,11 @@ #ifndef __FM_SNMP_UTILS_H #define __FM_SNMP_UTILS_H -#include #include "fmAPI.h" #include "fmDb.h" bool fm_snmp_util_gen_trap(int type, SFmAlarmDataT &data); -void set_trap_dest_list(std::string value); #endif