From 343a3526778bc2caf5409f097578a7c4da473b67 Mon Sep 17 00:00:00 2001 From: sphoorthi Date: Fri, 12 Feb 2021 10:03:08 +0530 Subject: [PATCH] Classification of RIC logs [JIRA ID - ODUHIGH-275] Change-Id: I7bf0493baed9e596a0cd31c2d9eff3f7ed3987fc Signed-off-by: sphoorthi --- src/ric_stub/ric_e2ap_msg_hdl.c | 66 ++++++++++++++++++++--------------------- src/ric_stub/ric_stub.c | 4 +-- src/ric_stub/ric_stub_sctp.c | 52 ++++++++++++++++---------------- 3 files changed, 61 insertions(+), 61 deletions(-) diff --git a/src/ric_stub/ric_e2ap_msg_hdl.c b/src/ric_stub/ric_e2ap_msg_hdl.c index cf584c6cf..20b394841 100644 --- a/src/ric_stub/ric_e2ap_msg_hdl.c +++ b/src/ric_stub/ric_e2ap_msg_hdl.c @@ -60,14 +60,14 @@ S16 SendE2APMsg(Region region, Pool pool) if(sctpSend(mBuf) != ROK) { - DU_LOG("\nE2AP : SCTP Send for E2 failed"); + DU_LOG("\nERROR --> E2AP : SCTP Send for E2 failed"); ODU_PUT_MSG_BUF(mBuf); return RFAILED; } } else { - DU_LOG("\nE2AP : ODU_ADD_POST_MSG_MULT failed"); + DU_LOG("\nERROR --> E2AP : ODU_ADD_POST_MSG_MULT failed"); ODU_PUT_MSG_BUF(mBuf); return RFAILED; } @@ -75,7 +75,7 @@ S16 SendE2APMsg(Region region, Pool pool) } else { - DU_LOG("\nE2AP : Failed to allocate memory"); + DU_LOG("\nERROR --> E2AP : Failed to allocate memory"); return RFAILED; } @@ -143,19 +143,19 @@ S16 BuildAndSendE2SetupRsp() uint8_t elementCnt; - DU_LOG("\nE2AP : Building E2 Setup Response\n"); + DU_LOG("\nINFO --> E2AP : Building E2 Setup Response\n"); RIC_ALLOC(e2apMsg, sizeof(E2AP_PDU_t)); if(e2apMsg == NULLP) { - DU_LOG("\nE2AP : Memory allocation for E2AP-PDU failed"); + DU_LOG("\nERROR --> E2AP : Memory allocation for E2AP-PDU failed"); return RFAILED; } e2apMsg->present = E2AP_PDU_PR_successfulOutcome; RIC_ALLOC(e2apMsg->choice.successfulOutcome, sizeof(SuccessfulOutcomeE2_t)); if(e2apMsg->choice.successfulOutcome == NULLP) { - DU_LOG("\nE2AP : Memory allocation for E2AP-PDU failed"); + DU_LOG("\nERROR --> E2AP : Memory allocation for E2AP-PDU failed"); RIC_FREE(e2apMsg, sizeof(E2AP_PDU_t)); return RFAILED; } @@ -174,7 +174,7 @@ S16 BuildAndSendE2SetupRsp() e2SetupRsp->protocolIEs.list.size); if(e2SetupRsp->protocolIEs.list.array == NULLP) { - DU_LOG("\nE2AP : Memory allocation for E2ResponseIEs failed"); + DU_LOG("\nERROR --> E2AP : Memory allocation for E2ResponseIEs failed"); RIC_FREE(e2apMsg->choice.successfulOutcome, sizeof(SuccessfulOutcomeE2_t)); RIC_FREE(e2apMsg, sizeof(E2AP_PDU_t)); return RFAILED; @@ -211,23 +211,23 @@ S16 BuildAndSendE2SetupRsp() /* Check encode results */ if(encRetVal.encoded == ENCODE_FAIL) { - DU_LOG("\nE2AP : Could not encode E2SetupResponse structure (at %s)\n",\ + DU_LOG("\nERROR --> E2AP : Could not encode E2SetupResponse structure (at %s)\n",\ encRetVal.failed_type ? encRetVal.failed_type->name : "unknown"); return RFAILED; } else { - DU_LOG("\nE2AP : Created APER encoded buffer for E2SetupResponse\n"); + DU_LOG("\nDEBUG --> E2AP : Created APER encoded buffer for E2SetupResponse\n"); for(int i=0; i< encBufSize; i++) { - printf("%x",encBuf[i]); + DU_LOG("%x",encBuf[i]); } } if(SendE2APMsg(RIC_APP_MEM_REG, RIC_POOL) != ROK) { - DU_LOG("\nE2AP : Sending E2 Setup Response failed"); + DU_LOG("\nERROR --> E2AP : Sending E2 Setup Response failed"); return RFAILED; } @@ -352,7 +352,7 @@ S16 BuildRicSubsDetails(RICsubscriptionDetails_t *subsDetails) subsDetails->ricAction_ToBeSetup_List.list.size); if(subsDetails->ricAction_ToBeSetup_List.list.array == NULLP) { - DU_LOG("\nE2AP : Memory allocation for RICactionToBeSetup Items failed"); + DU_LOG("\nERROR --> E2AP : Memory allocation for RICactionToBeSetup Items failed"); return RFAILED; } RIC_ALLOC(subsDetails->ricAction_ToBeSetup_List.list.array[0],\ @@ -389,12 +389,12 @@ S16 BuildAndSendRicSubscriptionReq() asn_enc_rval_t encRetVal; /* Encoder return value */ ricSubsStatus = TRUE; - DU_LOG("\nE2AP : Building RIC Subscription Request\n"); + DU_LOG("\nINFO --> E2AP : Building RIC Subscription Request\n"); RIC_ALLOC(e2apRicMsg, sizeof(E2AP_PDU_t)); if(e2apRicMsg == NULLP) { - DU_LOG("\nE2AP : Memory allocation for E2AP-PDU failed"); + DU_LOG("\nERROR --> E2AP : Memory allocation for E2AP-PDU failed"); return RFAILED; } @@ -402,7 +402,7 @@ S16 BuildAndSendRicSubscriptionReq() RIC_ALLOC(e2apRicMsg->choice.initiatingMessage, sizeof(InitiatingMessageE2_t)); if(e2apRicMsg->choice.initiatingMessage == NULLP) { - DU_LOG("\nE2AP : Memory allocation for E2AP-PDU failed"); + DU_LOG("\nERROR --> E2AP : Memory allocation for E2AP-PDU failed"); RIC_FREE(e2apRicMsg, sizeof(E2AP_PDU_t)); return RFAILED; } @@ -422,7 +422,7 @@ S16 BuildAndSendRicSubscriptionReq() ricSubscriptionReq->protocolIEs.list.size); if(ricSubscriptionReq->protocolIEs.list.array == NULLP) { - DU_LOG("\nE2AP : Memory allocation for RICSubscriptionRequestIEs failed"); + DU_LOG("\nERROR --> E2AP : Memory allocation for RICSubscriptionRequestIEs failed"); RIC_FREE(e2apRicMsg->choice.initiatingMessage, sizeof(InitiatingMessageE2_t)); RIC_FREE(e2apRicMsg, (Size)sizeof(E2AP_PDU_t)); return RFAILED; @@ -486,16 +486,16 @@ S16 BuildAndSendRicSubscriptionReq() encBuf); if(encRetVal.encoded == ENCODE_FAIL) { - DU_LOG("\nE2AP : Could not encode RicSubscriptionRequest structure (at %s)\n",\ + DU_LOG("\nERROR --> E2AP : Could not encode RicSubscriptionRequest structure (at %s)\n",\ encRetVal.failed_type ? encRetVal.failed_type->name : "unknown"); return RFAILED; } else { - DU_LOG("\nE2AP : Created APER encoded buffer for RicSubscriptionRequest\n"); + DU_LOG("\nDEBUG --> E2AP : Created APER encoded buffer for RicSubscriptionRequest\n"); for(int i=0; i< encBufSize; i++) { - printf("%x",encBuf[i]); + DU_LOG("%x",encBuf[i]); } } @@ -503,7 +503,7 @@ S16 BuildAndSendRicSubscriptionReq() /* Sending msg */ if(SendE2APMsg(RIC_APP_MEM_REG, RIC_POOL) != ROK) { - DU_LOG("\nE2AP : Sending RIC subscription Request failed"); + DU_LOG("\nERROR --> E2AP : Sending RIC subscription Request failed"); return RFAILED; } @@ -538,7 +538,7 @@ void E2APMsgHdlr(Buffer *mBuf) asn_dec_rval_t rval; /* Decoder return value */ E2AP_PDU_t e2apasnmsg ; - DU_LOG("\nE2AP : Received E2AP message buffer"); + DU_LOG("\nINFO --> E2AP : Received E2AP message buffer"); ODU_PRINT_MSG(mBuf, 0,0); /* Copy mBuf into char array to decode it */ @@ -547,19 +547,19 @@ void E2APMsgHdlr(Buffer *mBuf) if(recvBuf == NULLP) { - DU_LOG("\nE2AP : Memory allocation failed"); + DU_LOG("\nERROR --> E2AP : Memory allocation failed"); return; } if(ODU_COPY_MSG_TO_FIX_BUF(mBuf, 0, recvBufLen, (Data *)recvBuf, ©Cnt) != ROK) { - DU_LOG("\nE2AP : Failed while copying %d", copyCnt); + DU_LOG("\nERROR --> E2AP : Failed while copying %d", copyCnt); return; } - printf("\nE2AP : Received flat buffer to be decoded : "); + DU_LOG("\nDEBUG --> E2AP : Received flat buffer to be decoded : "); for(i=0; i< recvBufLen; i++) { - printf("%x",recvBuf[i]); + DU_LOG("%x",recvBuf[i]); } /* Decoding flat buffer into E2AP messsage */ @@ -571,10 +571,10 @@ void E2APMsgHdlr(Buffer *mBuf) if(rval.code == RC_FAIL || rval.code == RC_WMORE) { - DU_LOG("\nE2AP : ASN decode failed"); + DU_LOG("\nERROR --> E2AP : ASN decode failed"); return; } - printf("\n"); + DU_LOG("\n"); xer_fprint(stdout, &asn_DEF_E2AP_PDU, e2apMsg); switch(e2apMsg->present) @@ -585,18 +585,18 @@ void E2APMsgHdlr(Buffer *mBuf) { case InitiatingMessageE2__value_PR_E2setupRequest: { - DU_LOG("\nE2AP : E2 setup request received"); + DU_LOG("\nINFO --> E2AP : E2 setup request received"); BuildAndSendE2SetupRsp(); break; } case InitiatingMessageE2__value_PR_RICindication: { - DU_LOG("\nE2AP : RIC Indication Acknowledged"); + DU_LOG("\nINFO --> E2AP : RIC Indication Acknowledged"); break; } default: { - DU_LOG("\nE2AP : Invalid type of intiating message [%d]",e2apMsg->choice.initiatingMessage->value.present); + DU_LOG("\nERROR --> E2AP : Invalid type of intiating message [%d]",e2apMsg->choice.initiatingMessage->value.present); return; } }/* End of switch(initiatingMessage) */ @@ -608,12 +608,12 @@ void E2APMsgHdlr(Buffer *mBuf) { case SuccessfulOutcomeE2__value_PR_RICsubscriptionResponse: { - DU_LOG("\nE2AP : RICsubscriptionResponse Msg Acknowledged"); + DU_LOG("\nINFO --> E2AP : RICsubscriptionResponse Msg Acknowledged"); break; } default: { - DU_LOG("\nE2AP : Invalid type of successfulOutcome message [%d]",e2apMsg->choice.successfulOutcome->value.present); + DU_LOG("\nERROR --> E2AP : Invalid type of successfulOutcome message [%d]",e2apMsg->choice.successfulOutcome->value.present); return; } break; @@ -622,7 +622,7 @@ void E2APMsgHdlr(Buffer *mBuf) } default: { - DU_LOG("\nE2AP : Invalid type message type "); + DU_LOG("\nERROR --> E2AP : Invalid type message type "); return; } diff --git a/src/ric_stub/ric_stub.c b/src/ric_stub/ric_stub.c index aebf42c55..9cf964427 100644 --- a/src/ric_stub/ric_stub.c +++ b/src/ric_stub/ric_stub.c @@ -86,7 +86,7 @@ uint8_t tst() { init_log(); - DU_LOG("\nStarting RIC_STUB"); + DU_LOG("\nINFO --> RIC : Starting RIC_STUB"); /* Read RIC configurations */ readRicCfg(); @@ -117,7 +117,7 @@ void readRicCfg() { uint32_t ipv4_du, ipv4_ric; - DU_LOG("\nReading RIC configurations"); + DU_LOG("\nINFO --> RIC : Reading RIC configurations"); cmInetAddr((S8*)DU_IP_V4_ADDR, &ipv4_du); cmInetAddr((S8*)RIC_IP_V4_ADDR, &ipv4_ric); diff --git a/src/ric_stub/ric_stub_sctp.c b/src/ric_stub/ric_stub_sctp.c index 53e4d0caa..679c43eca 100644 --- a/src/ric_stub/ric_stub_sctp.c +++ b/src/ric_stub/ric_stub_sctp.c @@ -137,19 +137,19 @@ S16 sctpStartReq() if((ret = cmInetSocket(socket_type, &ricParams.lstnSockFd, IPPROTO_SCTP) != ROK)) { - DU_LOG("\nSCTP : Socket[%d] coudnt open for listening", ricParams.lstnSockFd.fd); + DU_LOG("\nERROR --> SCTP : Socket[%d] coudnt open for listening", ricParams.lstnSockFd.fd); } else if((ret = cmInetSctpBindx(&ricParams.lstnSockFd, &ricParams.localAddrLst, ricParams.srcPort)) != ROK) { - DU_LOG("\nSCTP: Binding failed at RIC"); + DU_LOG("\nERROR --> SCTP: Binding failed at RIC"); } else if((ret = sctpAccept(&ricParams.lstnSockFd, &ricParams.peerAddr, &ricParams.sockFd)) != ROK) { - DU_LOG("\nSCTP: Unable to accept the connection at RIC"); + DU_LOG("\nERROR --> SCTP: Unable to accept the connection at RIC"); } else if(sctpSockPoll() != ROK) { - DU_LOG("\nSCTP: Polling failed to start at RIC"); + DU_LOG("\nERROR --> SCTP: Polling failed to start at RIC"); } return (ret); } @@ -215,12 +215,12 @@ S16 sctpAccept(CmInetFd *lstnSock_Fd, CmInetAddr *peerAddr, CmInetFd *sock_Fd) ret = cmInetListen(lstnSock_Fd, 1); if (ret != ROK) { - DU_LOG("\nSCTP : Listening on socket failed"); + DU_LOG("\nERROR --> SCTP : Listening on socket failed"); cmInetClose(lstnSock_Fd); return RFAILED; } - DU_LOG("\nSCTP : Connecting"); + DU_LOG("\nINFO --> SCTP : Connecting"); while(!connUp) { @@ -231,7 +231,7 @@ S16 sctpAccept(CmInetFd *lstnSock_Fd, CmInetAddr *peerAddr, CmInetFd *sock_Fd) } else if(ret != ROK) { - DU_LOG("\nSCTP : Failed to accept connection"); + DU_LOG("\nERROR --> SCTP : Failed to accept connection"); return RFAILED; } else @@ -241,7 +241,7 @@ S16 sctpAccept(CmInetFd *lstnSock_Fd, CmInetAddr *peerAddr, CmInetFd *sock_Fd) break; } } - DU_LOG("\nSCTP : Connection established"); + DU_LOG("\nINFO --> SCTP : Connection established"); return ROK; } @@ -268,57 +268,57 @@ S16 sctpNtfyHdlr(CmInetSctpNotification *ntfy) switch(ntfy->header.nType) { case CM_INET_SCTP_ASSOC_CHANGE : - DU_LOG("\nSCTP : Assoc change notification received"); + DU_LOG("\nINFO --> SCTP : Assoc change notification received"); switch(ntfy->u.assocChange.state) { case CM_INET_SCTP_COMM_UP: - DU_LOG("Event : COMMUNICATION UP"); + DU_LOG("\nINFO --> Event : COMMUNICATION UP"); connUp = TRUE; break; case CM_INET_SCTP_COMM_LOST: - DU_LOG("Event : COMMUNICATION LOST"); + DU_LOG("\nINFO --> Event : COMMUNICATION LOST"); connUp = FALSE; break; case CM_INET_SCTP_RESTART: - DU_LOG("Event : SCTP RESTART"); + DU_LOG("\nINFO --> Event : SCTP RESTART"); connUp = FALSE; break; case CM_INET_SCTP_SHUTDOWN_COMP: /* association gracefully shutdown */ - DU_LOG("Event : SHUTDOWN COMPLETE"); + DU_LOG("\nINFO --> Event : SHUTDOWN COMPLETE"); connUp = FALSE; break; case CM_INET_SCTP_CANT_STR_ASSOC: - DU_LOG("Event : CANT START ASSOC"); + DU_LOG("\nINFO --> Event : CANT START ASSOC"); connUp = FALSE; break; default: - DU_LOG("\nInvalid event"); + DU_LOG("\nERROR --> Invalid event"); break; } break; case CM_INET_SCTP_PEER_ADDR_CHANGE : - DU_LOG("\nSCTP : Peer Address Change notificarion received"); + DU_LOG("\nINFO --> SCTP : Peer Address Change notificarion received"); /* Need to add handler */ break; case CM_INET_SCTP_REMOTE_ERROR : - DU_LOG("\nSCTP : Remote Error notification received"); + DU_LOG("\nINFO --> SCTP : Remote Error notification received"); break; case CM_INET_SCTP_SEND_FAILED : - DU_LOG("\nSCTP : Send Failed notification received\n"); + DU_LOG("\nINFO --> SCTP : Send Failed notification received\n"); break; case CM_INET_SCTP_SHUTDOWN_EVENT : /* peer socket gracefully closed */ - DU_LOG("\nSCTP : Shutdown Event notification received\n"); + DU_LOG("\nINFO --> SCTP : Shutdown Event notification received\n"); connUp = FALSE; exit(0); break; case CM_INET_SCTP_ADAPTATION_INDICATION : - DU_LOG("\nSCTP : Adaptation Indication received\n"); + DU_LOG("\nINFO --> SCTP : Adaptation Indication received\n"); break; case CM_INET_SCTP_PARTIAL_DELIVERY_EVENT: - DU_LOG("\nSCTP : Partial Delivery Event received\n"); + DU_LOG("\nINFO --> SCTP : Partial Delivery Event received\n"); break; default: - DU_LOG("\nSCTP : Invalid notification type\n"); + DU_LOG("\nERROR --> SCTP : Invalid notification type\n"); break; } @@ -369,12 +369,12 @@ S16 sctpSockPoll() CM_INET_FD_ZERO(&e2PollParams.readFd); - DU_LOG("\nSCTP : Polling started at RIC\n"); + DU_LOG("\nINFO --> SCTP : Polling started at RIC\n"); while(1) { if((ret = processPolling(&e2PollParams, &ricParams.sockFd, timeoutPtr, &memInfo)) != ROK) { - DU_LOG("\nSCTP : Failed to RecvMsg for E2 at RIC \n"); + DU_LOG("\nERROR --> SCTP : Failed to RecvMsg for E2 at RIC \n"); } }; return (ret); @@ -424,7 +424,7 @@ S16 processPolling(sctpSockPollParams *pollParams, CmInetFd *sockFd, uint32_t *t ret = sctpNtfyHdlr(&pollParams->ntfy); if(ret != ROK) { - DU_LOG("\nSCTP : Failed to process sctp notify msg\n"); + DU_LOG("\nERROR --> SCTP : Failed to process sctp notify msg\n"); } } else if(connUp & (pollParams->port == ricParams.destPort)) @@ -470,7 +470,7 @@ S16 sctpSend(Buffer *mBuf) if(ret != ROK && ret != RWOULDBLOCK) { - DU_LOG("\nSCTP : Send message failed"); + DU_LOG("\nERROR --> SCTP : Send message failed"); return RFAILED; } -- 2.16.6