From: HariomGupta Date: Thu, 16 Jun 2022 05:54:55 +0000 (+0530) Subject: Fix of VES alarm issue X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;h=439dd512e776a079d5f781bfceebff416cbdfabc;hp=20b5a9e8370730a5587d218910d2c19f8cfb1ea9;p=o-du%2Fl2.git Fix of VES alarm issue Issue-Id: ODUHIGH-458 Signed-off-by: HariomGupta Change-Id: Id041993abfab54b93e033488e907b5cabed55d6f --- diff --git a/src/o1/AlarmInterface.cpp b/src/o1/AlarmInterface.cpp index 4f265d56e..cbaf354c0 100644 --- a/src/o1/AlarmInterface.cpp +++ b/src/o1/AlarmInterface.cpp @@ -126,8 +126,8 @@ uint8_t raiseCellAlrm(uint16_t alrmId, uint16_t cellId) { /* Fill cell up parameters */ snprintf (alrm.additionalText, sizeof(alrm.additionalText), \ - "cell id [%d] is up",cellId); - strcpy(alrm.additionalInfo , "cell UP"); + "CELL %d UP",cellId); + strcpy(alrm.additionalInfo , "CELL UP"); strcpy(alrm.specificProblem, "Active"); strcpy(alrm.alarmRaiseTime, buff); } @@ -137,8 +137,8 @@ uint8_t raiseCellAlrm(uint16_t alrmId, uint16_t cellId) clearCellAlrm(CELL_UP_ALARM_ID); /* Fill the cell down parameters */ snprintf (alrm.additionalText, sizeof(alrm.additionalText), \ - "cell [%d] is down",cellId); - strcpy(alrm.additionalInfo , "cell down"); + "CELL %d DOWN",cellId); + strcpy(alrm.additionalInfo , "CELL DOWN"); strcpy(alrm.specificProblem, "Active"); strcpy(alrm.alarmRaiseTime, buff); } diff --git a/src/o1/ves/CellStateChange.cpp b/src/o1/ves/CellStateChange.cpp index 94d572c86..3ef572315 100644 --- a/src/o1/ves/CellStateChange.cpp +++ b/src/o1/ves/CellStateChange.cpp @@ -60,6 +60,48 @@ std::string CellStateChange::getISOEventTime() { return os.str(); } +/******************************************************************* + * + * @brief Returns Event Severity String + * + * @details + * + * Function :getEventSeverity + * + * Functionality: + * - Returns Event Severity String + * + * @params[in] IN - int severity + * @return value of string - success + * empty string - failure + * + * ****************************************************************/ + +std::string CellStateChange::getEventSeverity(int severity) { + string str; + switch(severity) + { + case 3: + str = "CRITICAL"; + break; + case 4: + str = "MAJOR"; + break; + case 5: + str = "MINOR"; + break; + case 6: + str = "WARNING"; + break; + default: + str = "MAJOR"; + break; + } + return str; + + +} + /******************************************************************* * * @brief prepare CellStateChange Fields @@ -78,8 +120,8 @@ std::string CellStateChange::getISOEventTime() { * ****************************************************************/ bool CellStateChange::prepareEventFields(const Message* msg) { - const Alarm* alrm = dynamic_cast (msg); - if(!alrm) { + const Alarm* alarm = dynamic_cast (msg); + if(!alarm) { O1_LOG("\nO1 CellStateChange : Casting failed in prepareEventFields"); return false; } @@ -91,22 +133,22 @@ bool CellStateChange::prepareEventFields(const Message* msg) { if(JsonHelper::addNodeToObject(faultFields, "faultFieldsVersion", FAULT_FIELDS_VERSION) == 0) { ret = false; } - if(JsonHelper::addNodeToObject(faultFields, "alarmCondition", ALARM_CONDITION) == 0) { + if(JsonHelper::addNodeToObject(faultFields, "alarmCondition", alarm->getAdditionalInfo().c_str()) == 0) { ret = false; } if(JsonHelper::addNodeToObject(faultFields, "alarmInterfaceA", ALARM_INTERFACE_A) == 0) { ret = false; } - if(JsonHelper::addNodeToObject(faultFields, "eventSourceType", EVENT_SOURCE_TYPE) == 0) { + if(JsonHelper::addNodeToObject(faultFields, "eventSourceType", ODU_HIGH) == 0) { ret = false; } - if(JsonHelper::addNodeToObject(faultFields, "specificProblem", SPECIFIC_PROBLEM) == 0) { + if(JsonHelper::addNodeToObject(faultFields, "specificProblem", alarm->getAdditionalText().c_str()) == 0) { ret = false; } - if(JsonHelper::addNodeToObject(faultFields, "eventSeverity", EVENT_SEVERITY) == 0) { + if(JsonHelper::addNodeToObject(faultFields, "eventSeverity", getEventSeverity(alarm->getPerceivedSeverity()).c_str()) == 0) { ret = false; } - if(JsonHelper::addNodeToObject(faultFields, "vfStatus", VF_STATUS) == 0) { + if(JsonHelper::addNodeToObject(faultFields, "vfStatus", alarm->getSpecificProblem().c_str()) == 0) { ret = false; } diff --git a/src/o1/ves/CellStateChange.hpp b/src/o1/ves/CellStateChange.hpp index 071f54056..00a396375 100644 --- a/src/o1/ves/CellStateChange.hpp +++ b/src/o1/ves/CellStateChange.hpp @@ -33,12 +33,7 @@ using namespace std; //macros #define FAULT_FIELDS_VERSION "4.0" -#define ALARM_CONDITION "CELL Down" #define ALARM_INTERFACE_A "Slot-0-CELL-1" -#define EVENT_SOURCE_TYPE "O_RAN_COMPONENT" -#define SPECIFIC_PROBLEM "CELL 1 Down" -#define EVENT_SEVERITY "MAJOR" -#define VF_STATUS "Active" #define EQUIP_TYPE "O-RAN-DU" #define VENDOR "Melacon" #define MODEL "ODU Device" @@ -51,6 +46,7 @@ class CellStateChange : public Notification ~CellStateChange(); std::string getISOEventTime(); + std::string getEventSeverity(int severity); protected: bool prepareEventFields(const Message* msg = NULL); diff --git a/src/o1/ves/CellStateChangeStdDef.cpp b/src/o1/ves/CellStateChangeStdDef.cpp index 17bf96d2e..c557c368b 100644 --- a/src/o1/ves/CellStateChangeStdDef.cpp +++ b/src/o1/ves/CellStateChangeStdDef.cpp @@ -60,6 +60,53 @@ std::string CellStateChangeStdDef::getISOEventTime() { return os.str(); } +/******************************************************************* + * + * @brief Returns Event Severity String + * + * @details + * + * Function :getEventSeverity + * + * Functionality: + * - Returns Event Severity String + * + * @params[in] IN - int severity + * @return value of string - success + * empty string - failure + * + * ****************************************************************/ + + +std::string CellStateChangeStdDef::getEventSeverity(int severity) { + string str; + switch(severity) + { + case 3: + str = "CRITICAL"; + break; + case 4: + str = "MAJOR"; + break; + case 5: + str = "MINOR"; + break; + case 6: + str = "WARNING"; + break; + case 7: + str = "INDETERMINATE"; + break; + case 8: + str = "CLEARED"; + break; + default: + O1_LOG("\nO1 CellStateChangeStdDef: severity was not mentioned"); + break; + } + return str; +} + /******************************************************************* * * @brief prepare CellStateChangeStdDef Fields @@ -78,8 +125,8 @@ std::string CellStateChangeStdDef::getISOEventTime() { * ****************************************************************/ bool CellStateChangeStdDef::prepareEventFields(const Message* msg) { - const Alarm* alrm = dynamic_cast (msg); - if(!alrm) { + const Alarm* alarm = dynamic_cast (msg); + if(!alarm) { O1_LOG("\nO1 CellStateChangeStdDef : Casting failed in prepareEventFields"); return false; } @@ -122,13 +169,13 @@ bool CellStateChangeStdDef::prepareEventFields(const Message* msg) { else if(JsonHelper::addNodeToObject(data, "probableCause", PROBABLE_CAUSE) == 0) { ret = false; } - else if(JsonHelper::addNodeToObject(data, "perceivedSeverity",PERCEIVED_SEVERITY) == 0) { + else if(JsonHelper::addNodeToObject(data, "perceivedSeverity", getEventSeverity(alarm->getPerceivedSeverity()).c_str()) == 0) { ret = false; } else if(JsonHelper::addNodeToObject(data, "rootCauseIndicator", (bool)false ) == 0) { ret = false; } - else if(JsonHelper::addNodeToObject(data, "specificProblem", "") == 0) { + else if(JsonHelper::addNodeToObject(data, "specificProblem", alarm->getAdditionalInfo().c_str()) == 0) { ret = false; } @@ -187,7 +234,7 @@ bool CellStateChangeStdDef::prepareEventFields(const Message* msg) { else if(JsonHelper::addNodeToObject(data, "proposedRepairActions", PROPOSED_REPAIR_ACTION) == 0) { ret = false; } - else if(JsonHelper::addNodeToObject(data, "additionalText", ADDITIONAL_TEXT) == 0) { + else if(JsonHelper::addNodeToObject(data, "additionalText", alarm->getAdditionalText().c_str())== 0) { ret = false; } @@ -200,10 +247,10 @@ bool CellStateChangeStdDef::prepareEventFields(const Message* msg) { additionalInformation ) == 0) { ret = false; } - else if(JsonHelper::addNodeToObject( additionalInformation, "addInfo", ADD_INFO) == 0) { + else if(JsonHelper::addNodeToObject( additionalInformation, "addInfo", alarm->getAdditionalInfo().c_str()) == 0) { ret = false; } - else if(JsonHelper::addNodeToObject(data , "alarmId", ALARM_ID) == 0) { + else if(JsonHelper::addNodeToObject(data , "alarmId", to_string(alarm->getAlarmId()).c_str()) == 0) { ret = false; } else if(JsonHelper::addNodeToObject(data , "alarmType",ALRAM_TYPE ) == 0) { diff --git a/src/o1/ves/CellStateChangeStdDef.hpp b/src/o1/ves/CellStateChangeStdDef.hpp index cfd6ad87e..128f3da75 100644 --- a/src/o1/ves/CellStateChangeStdDef.hpp +++ b/src/o1/ves/CellStateChangeStdDef.hpp @@ -37,17 +37,13 @@ using namespace std; #define URI "1" #define NOTIFICATION_ID 1.0 #define NOTIFICATION_TYPE "notifyNewAlarm" -#define PROBABLE_CAUSE "real-issue" +#define PROBABLE_CAUSE "device-issue" #define TRND_INDICATION "MORE_SEVERE" #define OBSRVED_MEASUREMENT "new" #define OBSERVED_VALUE 123.2 #define NEW_ATT "new" -#define ADD_INFO "new" -#define ALARM_ID "1" #define ALRAM_TYPE "COMMUNICATIONS_ALARM" -#define PERCEIVED_SEVERITY "INDETERMINATE" -#define PROPOSED_REPAIR_ACTION "Call the police!" -#define ADDITIONAL_TEXT "O-RAN Software Community" +#define PROPOSED_REPAIR_ACTION "Config change" class CellStateChangeStdDef : public Notification @@ -58,6 +54,7 @@ class CellStateChangeStdDef : public Notification ~CellStateChangeStdDef(); std::string getISOEventTime(); + std::string getEventSeverity(int severity);; protected: bool prepareEventFields(const Message* msg = NULL);