X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2Fo1%2Fves%2FVesEventHandler.cpp;h=bf52f1d50076ff5b6d97697416ea94ad18a9e682;hb=f1f733a2f14d22b8725e121fa0f5e70a7febc9af;hp=18258e14372072b9a494c7635982366e748ef16b;hpb=ef723e2e773fc6a6dcff43005569e509201df198;p=o-du%2Fl2.git diff --git a/src/o1/ves/VesEventHandler.cpp b/src/o1/ves/VesEventHandler.cpp index 18258e143..bf52f1d50 100644 --- a/src/o1/ves/VesEventHandler.cpp +++ b/src/o1/ves/VesEventHandler.cpp @@ -21,18 +21,62 @@ #include "VesEventHandler.hpp" -#include "PnfRegistration.hpp" +#include "PnfRegistrationEvent.hpp" +#include "SliceMeasurementEvent.hpp" +#include "Message.hpp" +#include "CellStateChange.hpp" +#include "CellStateChangeStdDef.hpp" +#include "SliceMeasurementEventStdDef.hpp" /******************************************************************* * - * @brief prepare and send Ves Message + * @brief Constructor * * @details * - * Function : sendVesEvent + * Function : VesEventHandler * * Functionality: - * - prepare VES event and send to oam + * - Constructor intialization + * + * @params[in] NULL + * @return None + ******************************************************************/ +VesEventHandler::VesEventHandler() : mVesEvent(NULL) +{ + +} + +/******************************************************************* + * + * @brief Destructor + * + * @details + * + * Function : ~VesEventHandler + * + * Functionality: + * - Destructor + * + * @params[in] None + * @return None + ******************************************************************/ +VesEventHandler::~VesEventHandler() +{ + if( mVesEvent != NULL ) + delete mVesEvent; +} + +/******************************************************************* + * + * @brief Prepare VES Message + * + * @details + * + * Function : prepare + * + * Functionality: + * - prepare VES event * * @params[in] void * @return true - success @@ -40,47 +84,79 @@ * * ****************************************************************/ -bool VesEventHandler::send(VesEventType evtType) +bool VesEventHandler::prepare(VesEventType evtType, const Message* msg) { //check event type and call funtions accordingly bool ret = true; - //char *sendData; - O1_LOG("O1 VES : sendVesEvent started\n"); - VesEvent *vesEvent; - //common header switch(evtType) { case VesEventType::PNF_REGISTRATION: - { - O1_LOG("O1 VES : send PNP registration\n"); - vesEvent = new PnfRegistration; - break; - } - case VesEventType::FAULT_NOTIFICATION: - O1_LOG("O1 VES : send VES fault notification\n"); + { + O1_LOG("\nO1 VesEventHandler : Preparing PNF registration"); + mVesEvent = new PnfRegistrationEvent(); break; - case VesEventType::PM_NOTIFICATION: - O1_LOG("O1 VES : send VES pm notification\n"); + } + case VesEventType::PM_SLICE: + { + #ifdef StdDef + mVesEvent = new SliceMeasurementEventStdDef; + O1_LOG("\nO1 VesEventHandler : Preparing Standard VES PM Slice"); + #else + mVesEvent = new SliceMeasurementEvent; + O1_LOG("\nO1 VesEventHandler : Preparing VES PM Slice"); + #endif break; - case VesEventType::HEARTBEAT: - O1_LOG("O1 VES : send VES heartbeat \n"); + } + case VesEventType::FAULT_NOTIFICATION: + { + #ifdef StdDef + O1_LOG("\nO1 VesEventHandler : Preparing Standard VES fault notification"); + mVesEvent = new CellStateChangeStdDef(); + #else + O1_LOG("\nO1 VesEventHandler : Preparing VES fault notification"); + mVesEvent = new CellStateChange(); + #endif break; + } + default: - O1_LOG("O1 VES : send VES msg Type is not avilable\n"); + O1_LOG("\nO1 VesEventHandler : VES message type does not exist "); ret = false; break; } - if(!vesEvent->prepare()) { - O1_LOG("O1 VES : could not send VES Event\n"); + mVesEvent->init(); + if(!mVesEvent->prepare(msg)) { + O1_LOG("\nO1 VesEventHandler : Failed to prepare VES message"); ret = false; } - else if (!vesEvent->send()) { - O1_LOG("O1 VES : could not send VES Event\n"); - ret = false; - } - delete vesEvent; return ret; } + +/******************************************************************* + * + * @brief Send Ves Message + * + * @details + * + * Function : send + * + * Functionality: + * - Send VES event to SMO + * + * @params[in] void + * @return true - success + * false - failure + * + * ****************************************************************/ + +bool VesEventHandler::send() +{ + if (!mVesEvent->send()) { + O1_LOG("\nO1 VesEventHandler : Failed to send VES event"); + return false; + } + return true; +} /********************************************************************** End of file **********************************************************************/