Browse Source

Merge "Update FM Manager old net-snmp related code"

changes/74/767374/3
Zuul 5 months ago
committed by Gerrit Code Review
parent
commit
4a68317f4a
4 changed files with 3 additions and 57 deletions
  1. +1
    -5
      fm-common/sources/fmConfig.cpp
  2. +1
    -15
      fm-common/sources/fmSnmpConstants.h
  3. +0
    -34
      fm-common/sources/fmSnmpUtils.cpp
  4. +1
    -3
      fm-common/sources/fmSnmpUtils.h

+ 1
- 5
fm-common/sources/fmConfig.cpp View File

@ -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<std::string, std::string> 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) {


+ 1
- 15
fm-common/sources/fmSnmpConstants.h View File

@ -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 ";

+ 0
- 34
fm-common/sources/fmSnmpUtils.cpp View File

@ -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<std::string> &trap_strings) {
std::string delimiter = " ";
std::vector<std::string>::iterator it = trap_strings.begin();
std::vector<std::string>::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<std::string> 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());
}
/**


+ 1
- 3
fm-common/sources/fmSnmpUtils.h View File

@ -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 <string>
#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

Loading…
Cancel
Save