- BuildPlmnId(duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.nrCgi.plmn, \
- &gNbId->global_gNB_ID.plmn_id);
- /* fill gND Id */
- gNbId->global_gNB_ID.gnb_id.present = GNB_ID_Choice_PR_gnb_ID;
- BuildNodeBId(&gNbId->global_gNB_ID.gnb_id.choice.gnb_ID, unused, byteSize, val);
- }
- RETVALUE(ROK);
-}
+ DU_ALLOC(e2apMsg, sizeof(E2AP_PDU_t));
+ if(e2apMsg == NULLP)
+ {
+ DU_LOG("\nE2AP : Memory allocation for E2AP-PDU failed");
+ break;
+ }
+ e2apMsg->present = E2AP_PDU_PR_initiatingMessage;
+ DU_ALLOC(e2apMsg->choice.initiatingMessage, sizeof(InitiatingMessageE2_t));
+ if(e2apMsg->choice.initiatingMessage == NULLP)
+ {
+ DU_LOG("\nE2AP : Memory allocation for E2AP-PDU failed");
+ DU_FREE(e2apMsg, sizeof(E2AP_PDU_t));
+ return RFAILED;
+ }
+ e2apMsg->choice.initiatingMessage->criticality = CriticalityE2_reject;
+ e2apMsg->choice.initiatingMessage->procedureCode = ProcedureCodeE2_id_E2setup;
+ e2apMsg->choice.initiatingMessage->value.present = InitiatingMessageE2__value_PR_E2setupRequest;
+ e2SetupReq = &e2apMsg->choice.initiatingMessage->value.choice.E2setupRequest;
+
+ ret = fillE2SetupReq(&e2SetupReq, &idx);
+ if(ret != ROK)
+ {
+ DU_LOG("\nE2AP : fillE2SetupReq() failed");
+ break;
+ }
+ /* Prints the Msg formed */
+ xer_fprint(stdout, &asn_DEF_E2AP_PDU, e2apMsg);
+
+ cmMemset((U8 *)encBuf, 0, ENC_BUF_MAX_LEN);
+ encBufSize = 0;
+ encRetVal = aper_encode(&asn_DEF_E2AP_PDU, 0, e2apMsg, PrepFinalEncBuf,\
+ encBuf);
+ if(encRetVal.encoded == ENCODE_FAIL)
+ {
+ DU_LOG("\nE2AP : Could not encode E2SetupRequest structure (at %s)\n",\
+ encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
+ break;
+ }
+ else
+ {
+ DU_LOG("\nE2AP : Created APER encoded buffer for E2SetupRequest\n");
+ for(int i=0; i< encBufSize; i++)
+ {
+ printf("%x",encBuf[i]);
+ }
+ }
+ if(SendE2APMsg(DU_APP_MEM_REGION, DU_POOL) != ROK)
+ {
+ DU_LOG("\nE2AP : Sending E2 Setup request failed");
+ }
+
+ break;
+ }while(1);
+
+ deAllocateE2SetupReqMsg(e2apMsg, e2SetupReq, idx);
+ return ret;
+}/* End of BuildAndSendE2SetupReq */