From 496702c9322f7fe7cad1cb921499c7b72897557c Mon Sep 17 00:00:00 2001 From: Agustin Carranza Date: Thu, 24 Aug 2023 15:58:53 -0300 Subject: [PATCH] Add missing fields for Event traps wrsEventMessage traps are being managed as wrsAlarmMessages. Events do not contain wrsEventProposedRepairAction and wrsEventSuppressionAllowed fields, so they need to generate a default value in FM. This commit adds those fields in order to create the event traps with the same format as the alarm traps. Depends-on: https://review.opendev.org/c/starlingx/snmp-armada-app/+/892624 Partial-bug: 2032844 Signed-off-by: Agustin Carranza Change-Id: I58577406cc75c597f6f430015ddd51d0029d4539 --- fm-common/sources/fmSnmpConstants.h | 4 +++- fm-common/sources/fmSnmpUtils.cpp | 6 +++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/fm-common/sources/fmSnmpConstants.h b/fm-common/sources/fmSnmpConstants.h index e140d0d3..33ef1fb5 100644 --- a/fm-common/sources/fmSnmpConstants.h +++ b/fm-common/sources/fmSnmpConstants.h @@ -1,5 +1,5 @@ // -// Copyright (c) 2017-2022 Wind River Systems, Inc. +// Copyright (c) 2017-2023 Wind River Systems, Inc. // // SPDX-License-Identifier: Apache-2.0 // @@ -45,7 +45,9 @@ const std::string EVENT_SEVERITY = "wrsEventSeverity"; const std::string EVENT_REASON_TEXT = "wrsEventReasonText"; const std::string EVENT_EVENT_TYPE = "wrsEventEventType"; const std::string EVENT_CAUSE = "wrsEventProbableCause"; +const std::string EVENT_REPAIR_ACTION = "wrsEventProposedRepairAction"; const std::string EVENT_SERVICE_AFFECTING = "wrsEventServiceAffecting"; +const std::string EVENT_SUPPRESSION = "wrsEventSuppressionAllowed"; const std::string SNMPv2_MIB = "SNMPv2-MIB"; const std::string WARM_START = "warmStart"; diff --git a/fm-common/sources/fmSnmpUtils.cpp b/fm-common/sources/fmSnmpUtils.cpp index 719eef46..866e7145 100644 --- a/fm-common/sources/fmSnmpUtils.cpp +++ b/fm-common/sources/fmSnmpUtils.cpp @@ -1,5 +1,5 @@ // -// Copyright (c) 2014-2022 Wind River Systems, Inc. +// Copyright (c) 2014-2023 Wind River Systems, Inc. // // SPDX-License-Identifier: Apache-2.0 // @@ -232,8 +232,12 @@ static std::string format_trap_json(int type, SFmAlarmDataT &data){ fm_db_util_int_to_string(data.alarm_type)); add_value_json_trap(result, EVENT_CAUSE, fm_db_util_int_to_string(data.probable_cause)); + add_value_json_trap(result, EVENT_REPAIR_ACTION, + "N/A"); add_value_json_trap(result, EVENT_SERVICE_AFFECTING, fm_db_util_int_to_string(data.service_affecting)); + add_value_json_trap(result, EVENT_SUPPRESSION, + fm_db_util_int_to_string(0)); } else if (operation_type == WARM_START){ // nothing to add to cmd } else {