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 <agustin.carranza@windriver.com>
Change-Id: I58577406cc75c597f6f430015ddd51d0029d4539
This commit is contained in:
Agustin Carranza 2023-08-24 15:58:53 -03:00
parent b6727e579b
commit 496702c932
2 changed files with 8 additions and 2 deletions

View File

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

View File

@ -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 {