From c0bac101e0cef01c154929024be6ab01b263785b Mon Sep 17 00:00:00 2001 From: dan Date: Thu, 9 Nov 2023 13:33:14 +0000 Subject: [PATCH] address comments --- src/tmx/TmxUtils/src/SNMPClient.cpp | 6 ++---- .../RSUHealthMonitorPlugin/src/RSUHealthMonitorPlugin.cpp | 6 +++--- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/tmx/TmxUtils/src/SNMPClient.cpp b/src/tmx/TmxUtils/src/SNMPClient.cpp index c2e8eea8a..02ee7c443 100644 --- a/src/tmx/TmxUtils/src/SNMPClient.cpp +++ b/src/tmx/TmxUtils/src/SNMPClient.cpp @@ -10,9 +10,7 @@ namespace tmx::utils : ip_(ip), port_(port), community_(community), snmp_version_(snmp_version), timeout_(timeout) { - PLOG(logDEBUG1) << "Starting SNMP Client"; - PLOG(logDEBUG1) << "Target device IP address: " << ip_; - PLOG(logINFO) << "Target device NTCIP port: " << port_; + PLOG(logDEBUG1) << "Starting SNMP Client. Target device IP address: " << ip_<< "Target device SNMP port: " << port_; // Bring the IP address and port of the target SNMP device in the required form, which is "IPADDRESS:PORT": std::string ip_port_string = ip_ + ":" + std::to_string(port_); @@ -27,7 +25,7 @@ namespace tmx::utils session.securityNameLen = snmp_user.length(); // Fallback behavior to setup a community for SNMP V1/V2 - if (snmp_version_ != 3) + if (snmp_version_ != SNMP_VERSION_3) { char community_char[community_.length()]; std::copy(community_.begin(), community_.end(), community_char); diff --git a/src/v2i-hub/RSUHealthMonitorPlugin/src/RSUHealthMonitorPlugin.cpp b/src/v2i-hub/RSUHealthMonitorPlugin/src/RSUHealthMonitorPlugin.cpp index 5e04be2b5..6ca699ed1 100755 --- a/src/v2i-hub/RSUHealthMonitorPlugin/src/RSUHealthMonitorPlugin.cpp +++ b/src/v2i-hub/RSUHealthMonitorPlugin/src/RSUHealthMonitorPlugin.cpp @@ -100,7 +100,7 @@ namespace RSUHealthMonitor } } } - catch (std::exception &ex) + catch (const std::exception &ex) { PLOG(logERROR) << ex.what(); } @@ -120,7 +120,7 @@ namespace RSUHealthMonitor // Create SNMP client and use SNMP V3 protocol PLOG(logINFO) << "Update SNMP client: RSU IP: " << _rsuIp << ", RSU port: " << _snmpPort << ", User: " << _securityUser << ", auth pass phrase: " << _authPassPhrase << ", security level: " << _securityLevel; - auto _snmpClientPtr = std::make_unique(_rsuIp, _snmpPort, "", _securityUser, _securityLevel, _authPassPhrase, 3, SEC_TO_MICRO); + auto _snmpClientPtr = std::make_unique(_rsuIp, _snmpPort, "", _securityUser, _securityLevel, _authPassPhrase, SNMP_VERSION_3, SEC_TO_MICRO); if (_snmpClientPtr == nullptr) { PLOG(logERROR) << "Error creating SNMP client!"; @@ -162,7 +162,7 @@ namespace RSUHealthMonitor } } } - catch (std::exception &ex) + catch (const std::exception &ex) { PLOG(logERROR) << "SNMP call failure due to: " << ex.what(); }