From 114fa2c930c5a24078b6ceba68254b2f209c5916 Mon Sep 17 00:00:00 2001 From: Anssi Mannila Date: Thu, 16 Jan 2020 12:47:47 +0200 Subject: [PATCH] RICPLT-3016 Remove indication codes from e2ap Change-Id: Ib6bcaecb67dee6448b629cab0e582d5f33729dd7 Signed-off-by: Anssi Mannila --- e2ap/libe2ap_wrapper/E2AP_if.c | 632 ------------------------ e2ap/libe2ap_wrapper/E2AP_if.h | 132 +---- e2ap/libe2ap_wrapper/E2AP_tests.c | 112 ----- e2ap/pkg/e2ap/e2ap_packerif.go | 22 - e2ap/pkg/e2ap/e2ap_tests/msg.go | 2 - e2ap/pkg/e2ap/e2ap_tests/msg_e2ap_indication.go | 79 --- e2ap/pkg/e2ap/msg_e2ap.go | 2 +- e2ap/pkg/e2ap/msg_e2ap_indication.go | 59 --- e2ap/pkg/e2ap_wrapper/packer_e2ap.go | 199 -------- 9 files changed, 4 insertions(+), 1235 deletions(-) delete mode 100644 e2ap/pkg/e2ap/e2ap_tests/msg_e2ap_indication.go delete mode 100644 e2ap/pkg/e2ap/msg_e2ap_indication.go diff --git a/e2ap/libe2ap_wrapper/E2AP_if.c b/e2ap/libe2ap_wrapper/E2AP_if.c index 7bf8ae0..881e396 100644 --- a/e2ap/libe2ap_wrapper/E2AP_if.c +++ b/e2ap/libe2ap_wrapper/E2AP_if.c @@ -24,8 +24,6 @@ #include "ProtocolIE-Field.h" #include "RICsubsequentAction.h" #include "E2SM-gNB-X2-eventTriggerDefinition.h" -#include "E2SM-gNB-X2-indicationHeader.h" -#include "E2SM-gNB-X2-indicationMessage.h" #include "asn_constant.h" #include "E2AP_if.h" @@ -63,7 +61,6 @@ const uint64_t cE2UnsuccessfulOutcome = 3; // Initiating message const uint64_t cRICSubscriptionRequest = 1; const uint64_t cRICSubscriptionDeleteRequest = 2; -const uint64_t cRICIndication = 11; // Successful outcome const uint64_t cRICSubscriptionResponse = 1; @@ -630,342 +627,6 @@ uint64_t packRICSubscriptionFailure(size_t* pDataBufferSize, byte* pDataBuffer, return e2err_RICSubscriptionFailureAllocE2AP_PDUFail; } -////////////////////////////////////////////////////////////////////// -uint64_t packRICIndication(size_t* pDataBufferSize, byte* pDataBuffer, char* pLogBuffer, RICIndication_t* pRICIndication) { - - E2AP_PDU_t* pE2AP_PDU = calloc(1, sizeof(E2AP_PDU_t)); - if(pE2AP_PDU) - { - pE2AP_PDU->present = E2AP_PDU_PR_initiatingMessage; - pE2AP_PDU->choice.initiatingMessage.procedureCode = ProcedureCode_id_ricIndication; - pE2AP_PDU->choice.initiatingMessage.criticality = Criticality_ignore; - pE2AP_PDU->choice.initiatingMessage.value.present = RICInitiatingMessage__value_PR_RICindication; - - // RICrequestID - RICindication_IEs_t* pRICindication_IEs = calloc(1, sizeof(RICindication_IEs_t)); - if (pRICindication_IEs) { - pRICindication_IEs->id = ProtocolIE_ID_id_RICrequestID; - pRICindication_IEs->criticality = Criticality_reject; - pRICindication_IEs->value.present = RICindication_IEs__value_PR_RICrequestID; - pRICindication_IEs->value.choice.RICrequestID.ricRequestorID = pRICIndication->ricRequestID.ricRequestorID; - pRICindication_IEs->value.choice.RICrequestID.ricRequestSequenceNumber = pRICIndication->ricRequestID.ricRequestSequenceNumber; - ASN_SEQUENCE_ADD(&pE2AP_PDU->choice.initiatingMessage.value.choice.RICindication.protocolIEs.list, pRICindication_IEs); - } - else - return e2err_RICIndicationRICrequestIDFail; - - // RANfunctionID - pRICindication_IEs = calloc(1, sizeof(RICindication_IEs_t)); - if (pRICindication_IEs) { - pRICindication_IEs->id = ProtocolIE_ID_id_RANfunctionID; - pRICindication_IEs->criticality = Criticality_reject; - pRICindication_IEs->value.present = RICindication_IEs__value_PR_RANfunctionID; - pRICindication_IEs->value.choice.RANfunctionID = pRICIndication->ranFunctionID; - ASN_SEQUENCE_ADD(&pE2AP_PDU->choice.initiatingMessage.value.choice.RICindication.protocolIEs.list, pRICindication_IEs); - } - else - return e2err_RICIndicationAllocRANfunctionIDFail; - - // RICactionID - pRICindication_IEs = calloc(1, sizeof(RICindication_IEs_t)); - if (pRICindication_IEs) { - pRICindication_IEs->id = ProtocolIE_ID_id_RICactionID; - pRICindication_IEs->criticality = Criticality_reject; - pRICindication_IEs->value.present = RICindication_IEs__value_PR_RICactionID; - pRICindication_IEs->value.choice.RICactionID = pRICIndication->ricActionID; - ASN_SEQUENCE_ADD(&pE2AP_PDU->choice.initiatingMessage.value.choice.RICindication.protocolIEs.list, pRICindication_IEs); - } - else - return e2err_RICIndicationAllocRICactionIDFail; - - // RICindicationSN - pRICindication_IEs = calloc(1, sizeof(RICindication_IEs_t)); - if (pRICindication_IEs) { - pRICindication_IEs->id = ProtocolIE_ID_id_RICindicationSN; - pRICindication_IEs->criticality = Criticality_reject; - pRICindication_IEs->value.present = RICindication_IEs__value_PR_RICindicationSN; - pRICindication_IEs->value.choice.RICindicationSN = pRICIndication->ricIndicationSN; - ASN_SEQUENCE_ADD(&pE2AP_PDU->choice.initiatingMessage.value.choice.RICindication.protocolIEs.list, pRICindication_IEs); - } - else - return e2err_RICIndicationAllocRICindicationSNFail; - - // RICindicationType - pRICindication_IEs = calloc(1, sizeof(RICindication_IEs_t)); - if (pRICindication_IEs) { - pRICindication_IEs->id = ProtocolIE_ID_id_RICindicationType; - pRICindication_IEs->criticality = Criticality_reject; - pRICindication_IEs->value.present = RICindication_IEs__value_PR_RICindicationType; - pRICindication_IEs->value.choice.RICindicationType = pRICIndication->ricIndicationType; - ASN_SEQUENCE_ADD(&pE2AP_PDU->choice.initiatingMessage.value.choice.RICindication.protocolIEs.list, pRICindication_IEs); - } - else - return e2err_RICIndicationAllocRICindicationTypeFail; - - // RICindicationHeader - uint64_t returnCode; - uint64_t logBufferSize = 512; - char logBuffer[logBufferSize]; - if ((returnCode = packRICIndicationHeader(logBuffer, &pRICIndication->ricIndicationHeader)) != e2err_OK) { - return returnCode; - } - - pRICindication_IEs = calloc(1, sizeof(RICindication_IEs_t)); - if (pRICindication_IEs) { - pRICindication_IEs->id = ProtocolIE_ID_id_RICindicationHeader; - pRICindication_IEs->criticality = Criticality_reject; - pRICindication_IEs->value.present = RICindication_IEs__value_PR_RICindicationHeader; - pRICindication_IEs->value.choice.RICindicationHeader.buf = calloc(1,pRICIndication->ricIndicationHeader.octetString.contentLength); - if (pRICindication_IEs->value.choice.RICindicationHeader.buf) { - pRICindication_IEs->value.choice.RICindicationHeader.size = pRICIndication->ricIndicationHeader.octetString.contentLength; - memcpy(pRICindication_IEs->value.choice.RICindicationHeader.buf,pRICIndication->ricIndicationHeader.octetString.data, - pRICIndication->ricIndicationHeader.octetString.contentLength); - ASN_SEQUENCE_ADD(&pE2AP_PDU->choice.initiatingMessage.value.choice.RICindication.protocolIEs.list, pRICindication_IEs); - } - else - return e2err_RICIndicationAllocRRICindicationHeaderBufFail; - } - else - return e2err_RICIndicationAllocRICindicationHeaderFail; - - // RICindicationMessage - if ((returnCode = packRICIndicationMessage(logBuffer, &pRICIndication->ricIndicationMessage)) != e2err_OK) { - return returnCode; - } - - pRICindication_IEs = calloc(1, sizeof(RICindication_IEs_t)); - if (pRICindication_IEs) { - pRICindication_IEs->id = ProtocolIE_ID_id_RICindicationMessage; - pRICindication_IEs->criticality = Criticality_reject; - pRICindication_IEs->value.present = RICindication_IEs__value_PR_RICindicationMessage; - pRICindication_IEs->value.choice.RICindicationMessage.buf = calloc(1,pRICIndication->ricIndicationMessage.octetString.contentLength); - if (pRICindication_IEs->value.choice.RICindicationMessage.buf) { - pRICindication_IEs->value.choice.RICindicationMessage.size = pRICIndication->ricIndicationMessage.octetString.contentLength; - memcpy(pRICindication_IEs->value.choice.RICindicationHeader.buf,pRICIndication->ricIndicationMessage.octetString.data, - pRICIndication->ricIndicationMessage.octetString.contentLength); - ASN_SEQUENCE_ADD(&pE2AP_PDU->choice.initiatingMessage.value.choice.RICindication.protocolIEs.list, pRICindication_IEs); - } - else - return e2err_RICIndicationAllocRICindicationMessageBufFail; - } - else - return e2err_RICIndicationAllocRICindicationMessageFail; - - // RICcallProcessID, OPTIONAL. Not used in RIC. - - if (E2encode(pE2AP_PDU, pDataBufferSize, pDataBuffer, pLogBuffer)) - return e2err_OK; - else - return e2err_RICIndicationEncodeFail; - } - else - return e2err_RICIndicationAllocE2AP_PDUFail; -} - -////////////////////////////////////////////////////////////////////// -uint64_t packRICIndicationHeader(char* pLogBuffer, RICIndicationHeader_t* pRICIndicationHeader) { - - E2SM_gNB_X2_indicationHeader_t* pE2SM_gNB_X2_indicationHeader = calloc(1, sizeof(E2SM_gNB_X2_indicationHeader_t)); - if(pE2SM_gNB_X2_indicationHeader) - { - // InterfaceID - if ((pRICIndicationHeader->interfaceID.globalENBIDPresent == true && pRICIndicationHeader->interfaceID.globalGNBIDPresent == true) || - (pRICIndicationHeader->interfaceID.globalENBIDPresent == false && pRICIndicationHeader->interfaceID.globalGNBIDPresent == false)) - return e2err_RICindicationHeaderIEValueFail_1; - - // GlobalENB-ID or GlobalGNB-ID - if (pRICIndicationHeader->interfaceID.globalENBIDPresent) - { - pE2SM_gNB_X2_indicationHeader->interface_ID.present = Interface_ID_PR_global_eNB_ID; - - // GlobalENB-ID - // PLMN-Identity - pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_eNB_ID.pLMN_Identity.size = - pRICIndicationHeader->interfaceID.globalENBID.pLMNIdentity.contentLength; - pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_eNB_ID.pLMN_Identity.buf = calloc(1,3); - if (pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_eNB_ID.pLMN_Identity.buf) { - memcpy(pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_eNB_ID.pLMN_Identity.buf, - pRICIndicationHeader->interfaceID.globalENBID.pLMNIdentity.pLMNIdentityVal, - pRICIndicationHeader->interfaceID.globalENBID.pLMNIdentity.contentLength); - } - else - return e2err_RICIndicationAllocRICIndicationHeaderglobal_eNB_IDpLMN_IdentityBufFail; - - // Add ENB-ID - if (pRICIndicationHeader->interfaceID.globalENBID.nodeID.bits == cMacroENBIDP_20Bits){ - // BIT STRING (SIZE (20) - pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_eNB_ID.eNB_ID.present = ENB_ID_PR_macro_eNB_ID; - - pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_eNB_ID.eNB_ID.choice.macro_eNB_ID.buf = calloc(1,3); - if (pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_eNB_ID.eNB_ID.choice.macro_eNB_ID.buf) { - pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_eNB_ID.eNB_ID.choice.macro_eNB_ID.size = 3; // bytes - pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_eNB_ID.eNB_ID.choice.macro_eNB_ID.bits_unused = 4; // trailing unused bits - memcpy(pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_eNB_ID.eNB_ID.choice.macro_eNB_ID.buf, - (void*)&pRICIndicationHeader->interfaceID.globalENBID.nodeID.nodeID,3); - } - else - return e2err_RICIndicationAllocRICIndicationHeaderglobal_eNB_IDeNB_IDmacro_eNB_IDBufFail; - } - else if (pRICIndicationHeader->interfaceID.globalENBID.nodeID.bits == cHomeENBID_28Bits) { - // BIT STRING (SIZE (28) - pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_eNB_ID.eNB_ID.present = ENB_ID_PR_home_eNB_ID; - - pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_eNB_ID.eNB_ID.choice.home_eNB_ID.buf = calloc(1,4); - if (pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_eNB_ID.eNB_ID.choice.home_eNB_ID.buf) { - pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_eNB_ID.eNB_ID.choice.home_eNB_ID.size = 4; // bytes - pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_eNB_ID.eNB_ID.choice.home_eNB_ID.bits_unused = 4; // trailing unused bits - memcpy(pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_eNB_ID.eNB_ID.choice.home_eNB_ID.buf, - (void*)&pRICIndicationHeader->interfaceID.globalENBID.nodeID.nodeID,4); - } - else - return e2err_RICIndicationAllocRICIndicationHeaderglobal_eNB_IDeNB_IDhome_eNB_IDBufFail; - } - else if (pRICIndicationHeader->interfaceID.globalENBID.nodeID.bits == cShortMacroENBID_18Bits) { - // BIT STRING (SIZE(18) - pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_eNB_ID.eNB_ID.present = ENB_ID_PR_short_Macro_eNB_ID; - - pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_eNB_ID.eNB_ID.choice.short_Macro_eNB_ID.buf = calloc(1,3); - if (pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_eNB_ID.eNB_ID.choice.short_Macro_eNB_ID.buf) { - pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_eNB_ID.eNB_ID.choice.short_Macro_eNB_ID.size = 3; - pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_eNB_ID.eNB_ID.choice.short_Macro_eNB_ID.bits_unused = 6; // trailing unused bits - memcpy(pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_eNB_ID.eNB_ID.choice.short_Macro_eNB_ID.buf, - (void*)&pRICIndicationHeader->interfaceID.globalENBID.nodeID.nodeID,3); - } - else - return e2err_RICIndicationAllocRICIndicationHeaderglobal_eNB_IDeNB_IDshort_Macro_eNB_IDBufFail; - } - else if (pRICIndicationHeader->interfaceID.globalENBID.nodeID.bits == clongMacroENBIDP_21Bits) { - // BIT STRING (SIZE(21) - pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_eNB_ID.eNB_ID.present = ENB_ID_PR_long_Macro_eNB_ID; - - pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_eNB_ID.eNB_ID.choice.long_Macro_eNB_ID.buf = calloc(1,3); - if (pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_eNB_ID.eNB_ID.choice.long_Macro_eNB_ID.buf) { - pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_eNB_ID.eNB_ID.choice.long_Macro_eNB_ID.size = 3; // bytes - pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_eNB_ID.eNB_ID.choice.long_Macro_eNB_ID.bits_unused = 3; // trailing unused bits - memcpy(pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_eNB_ID.eNB_ID.choice.long_Macro_eNB_ID.buf, - (void*)&pRICIndicationHeader->interfaceID.globalENBID.nodeID.nodeID,3); - } - else - return e2err_RICIndicationAllocRICIndicationHeaderglobal_eNB_IDeNB_IDlong_Macro_eNB_IDBufFail; - } - else - return e2err_RICindicationHeaderIEValueFail_2; - - } - else if (pRICIndicationHeader->interfaceID.globalGNBIDPresent) { - // GlobalGNB-ID - pE2SM_gNB_X2_indicationHeader->interface_ID.present = Interface_ID_PR_global_gNB_ID; - - // PLMN-Identity - pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_gNB_ID.pLMN_Identity.size = - pRICIndicationHeader->interfaceID.globalGNBID.pLMNIdentity.contentLength; - pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_gNB_ID.pLMN_Identity.buf = - calloc(1,pRICIndicationHeader->interfaceID.globalGNBID.pLMNIdentity.contentLength); - if (pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_gNB_ID.pLMN_Identity.buf) { - memcpy(pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_gNB_ID.pLMN_Identity.buf, - (void*)&pRICIndicationHeader->interfaceID.globalGNBID.pLMNIdentity.pLMNIdentityVal, - pRICIndicationHeader->interfaceID.globalGNBID.pLMNIdentity.contentLength); - } - else - return e2err_RICIndicationAllocRICIndicationHeaderglobal_gNB_IDpLMN_IdentityBufFail; - - // GNB-ID, BIT STRING (SIZE (22..32) - pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_gNB_ID.gNB_ID.choice.gNB_ID.size = 4; //32bits - pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_gNB_ID.gNB_ID.choice.gNB_ID.buf = calloc(1,4); - if (pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_gNB_ID.gNB_ID.choice.gNB_ID.buf) { - memcpy(pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_gNB_ID.gNB_ID.choice.gNB_ID.buf, - (void*)&pRICIndicationHeader->interfaceID.globalGNBID,4); //32bits - } - else - return e2err_RICIndicationAllocRICIndicationHeaderglobal_gNB_IDgNB_IDgNB_IDBufFail; - } - else - return e2err_RICindicationHeaderIEValueFail_3; - - // InterfaceDirection - pE2SM_gNB_X2_indicationHeader->interfaceDirection = pRICIndicationHeader->interfaceDirection; - - // TimeStamp OPTIONAL. Not used in RIC. - - // Debug print - if (debug) - asn_fprint(stdout, &asn_DEF_E2SM_gNB_X2_indicationHeader, pE2SM_gNB_X2_indicationHeader); - - // Encode - size_t bufferSize = sizeof(pRICIndicationHeader->octetString.data); - asn_enc_rval_t rval; - rval = asn_encode_to_buffer(0, ATS_ALIGNED_BASIC_PER, &asn_DEF_E2SM_gNB_X2_indicationHeader, pE2SM_gNB_X2_indicationHeader, - pRICIndicationHeader->octetString.data, bufferSize); - if(rval.encoded == -1) - { - sprintf(pLogBuffer,"Serialization of %s failed.", asn_DEF_E2SM_gNB_X2_indicationHeader.name); - return e2err_RICindicationHeaderPackFail_1; - } - else if(rval.encoded > bufferSize) - { - sprintf(pLogBuffer,"Buffer of size %zu is too small for %s, need %zu",bufferSize, asn_DEF_E2SM_gNB_X2_indicationHeader.name, rval.encoded); - return e2err_RICindicationHeaderPackFail_2; - } - else - if (debug) - sprintf(pLogBuffer,"Successfully encoded %s. Buffer size %zu, encoded size %zu",asn_DEF_E2SM_gNB_X2_indicationHeader.name, bufferSize, rval.encoded); - - ASN_STRUCT_FREE(asn_DEF_E2SM_gNB_X2_indicationHeader, pE2SM_gNB_X2_indicationHeader); - - pRICIndicationHeader->octetString.contentLength = rval.encoded; - return e2err_OK; - } - else - return e2err_RICIndicationHeaderAllocE2AP_PDUFail; -} - -////////////////////////////////////////////////////////////////////// -uint64_t packRICIndicationMessage(char* pLogBuffer, RICIndicationMessage_t* pRICIndicationMessage) { - - E2SM_gNB_X2_indicationMessage_t* pE2SM_gNB_X2_indicationMessage = calloc(1, sizeof(E2SM_gNB_X2_indicationMessage_t)); - if(pE2SM_gNB_X2_indicationMessage) - { - pE2SM_gNB_X2_indicationMessage->interfaceMessage.buf = calloc(1, pRICIndicationMessage->interfaceMessage.contentLength); - if(pE2SM_gNB_X2_indicationMessage->interfaceMessage.buf) - { - pE2SM_gNB_X2_indicationMessage->interfaceMessage.size = pRICIndicationMessage->interfaceMessage.contentLength; - memcpy(pE2SM_gNB_X2_indicationMessage->interfaceMessage.buf,pRICIndicationMessage->interfaceMessage.data,pRICIndicationMessage->interfaceMessage.contentLength); - } - else - return e2err_RICIndicationMessageAllocinterfaceMessageFail; - - // Debug print - if (debug) - asn_fprint(stdout, &asn_DEF_E2SM_gNB_X2_indicationMessage, pE2SM_gNB_X2_indicationMessage); - - // Encode - size_t bufferSize = sizeof(pRICIndicationMessage->octetString.data); - asn_enc_rval_t rval; - rval = asn_encode_to_buffer(0, ATS_ALIGNED_BASIC_PER, &asn_DEF_E2SM_gNB_X2_indicationMessage, pE2SM_gNB_X2_indicationMessage, - pRICIndicationMessage->octetString.data, bufferSize); - if(rval.encoded == -1) - { - sprintf(pLogBuffer,"Serialization of %s failed.", asn_DEF_E2SM_gNB_X2_indicationMessage.name); - return e2err_RICindicationMessagePackFail_1; - } - else if(rval.encoded > bufferSize) - { - sprintf(pLogBuffer,"Buffer of size %zu is too small for %s, need %zu",bufferSize, asn_DEF_E2SM_gNB_X2_indicationMessage.name, rval.encoded); - return e2err_RICindicationMessagePackFail_2; - } - else - if (debug) - sprintf(pLogBuffer,"Successfully encoded %s. Buffer size %zu, encoded size %zu",asn_DEF_E2SM_gNB_X2_indicationMessage.name, bufferSize, rval.encoded); - - ASN_STRUCT_FREE(asn_DEF_E2SM_gNB_X2_indicationMessage, pE2SM_gNB_X2_indicationMessage); - - pRICIndicationMessage->octetString.contentLength = rval.encoded; - return e2err_OK; - } - else - return e2err_E2SM_gNB_X2_indicationMessageAllocE2AP_PDUFail; -} - ////////////////////////////////////////////////////////////////////// uint64_t packRICSubscriptionDeleteRequest(size_t* pDataBufferSize, byte* pDataBuffer, char* pLogBuffer, RICSubscriptionDeleteRequest_t* pRICSubscriptionDeleteRequest) { @@ -1164,17 +825,6 @@ e2ap_pdu_ptr_t* unpackE2AP_pdu(const size_t dataBufferSize, const byte* dataBuff return 0; } } - else if (pE2AP_PDU->choice.initiatingMessage.procedureCode == ProcedureCode_id_ricIndication) { - if (pE2AP_PDU->choice.initiatingMessage.value.present == RICInitiatingMessage__value_PR_RICindication) { - pMessageInfo->messageType = cE2InitiatingMessage; - pMessageInfo->messageId = cRICIndication; - return (e2ap_pdu_ptr_t*)pE2AP_PDU; - } - else { - sprintf(pLogBuffer,"Error. Not supported initiatingMessage MessageId = %u",pE2AP_PDU->choice.initiatingMessage.value.present); - return 0; - } - } else if (pE2AP_PDU->choice.initiatingMessage.procedureCode == ProcedureCode_id_ricSubscriptionDelete) { if (pE2AP_PDU->choice.initiatingMessage.value.present == RICInitiatingMessage__value_PR_RICsubscriptionDeleteRequest) { pMessageInfo->messageType = cE2InitiatingMessage; @@ -1492,7 +1142,6 @@ uint64_t getRICEventTriggerDefinitionData(RICEventTriggerDefinition_t* pRICEvent } } - ////////////////////////////////////////////////////////////////////// uint64_t getRICSubscriptionResponseData(e2ap_pdu_ptr_t* pE2AP_PDU_pointer, RICSubscriptionResponse_t* pRICSubscriptionResponse) { @@ -1689,287 +1338,6 @@ uint64_t getRICSubscriptionFailureData(e2ap_pdu_ptr_t* pE2AP_PDU_pointer, RICSub return e2err_OK; } -////////////////////////////////////////////////////////////////////// -uint64_t getRICIndicationData(e2ap_pdu_ptr_t* pE2AP_PDU_pointer, RICIndication_t* pRICIndication) { - - E2AP_PDU_t* pE2AP_PDU = (E2AP_PDU_t*)pE2AP_PDU_pointer; - - // RICrequestID - RICindication_IEs_t* pRICindication_IEs; - if (pE2AP_PDU->choice.initiatingMessage.value.choice.RICindication.protocolIEs.list.count > 0) { - pRICindication_IEs = pE2AP_PDU->choice.initiatingMessage.value.choice.RICindication.protocolIEs.list.array[0]; - pRICIndication->ricRequestID.ricRequestorID = pRICindication_IEs->value.choice.RICrequestID.ricRequestorID; - pRICIndication->ricRequestID.ricRequestSequenceNumber = pRICindication_IEs->value.choice.RICrequestID.ricRequestSequenceNumber; - } - else { - ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU); - return e2err_RICindicationRICrequestIDMissing; - } - - // RANfunctionID - if (pE2AP_PDU->choice.initiatingMessage.value.choice.RICindication.protocolIEs.list.count > 1) { - pRICindication_IEs = pE2AP_PDU->choice.initiatingMessage.value.choice.RICindication.protocolIEs.list.array[1]; - pRICIndication->ranFunctionID = pRICindication_IEs->value.choice.RANfunctionID; - } - else { - ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU); - return e2err_RICindicationRANfunctionIDMissing; - } - - // RICactionID - if (pE2AP_PDU->choice.initiatingMessage.value.choice.RICindication.protocolIEs.list.count > 2) { - pRICindication_IEs = pE2AP_PDU->choice.initiatingMessage.value.choice.RICindication.protocolIEs.list.array[2]; - pRICIndication->ricActionID = pRICindication_IEs->value.choice.RICactionID; - } - else { - ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU); - return e2err_RICindicationRICactionIDMissing; - } - - // RICindicationSN - if (pE2AP_PDU->choice.initiatingMessage.value.choice.RICindication.protocolIEs.list.count > 3) { - pRICindication_IEs = pE2AP_PDU->choice.initiatingMessage.value.choice.RICindication.protocolIEs.list.array[3]; - pRICIndication->ricIndicationSN = pRICindication_IEs->value.choice.RICindicationSN; - } - else { - ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU); - return e2err_RICindicationRICindicationSNMissing; - } - - // RICindicationType - if (pE2AP_PDU->choice.initiatingMessage.value.choice.RICindication.protocolIEs.list.count > 4) { - pRICindication_IEs = pE2AP_PDU->choice.initiatingMessage.value.choice.RICindication.protocolIEs.list.array[4]; - pRICIndication->ricIndicationType = pRICindication_IEs->value.choice.RICindicationType; - } - else { - ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU); - return e2err_RICindicationRICindicationTypeMissing; - } - - // RICindicationHeader - if (pE2AP_PDU->choice.initiatingMessage.value.choice.RICindication.protocolIEs.list.count > 5) { - pRICindication_IEs = pE2AP_PDU->choice.initiatingMessage.value.choice.RICindication.protocolIEs.list.array[5]; - - pRICIndication->ricIndicationHeader.octetString.contentLength = pRICindication_IEs->value.choice.RICindicationHeader.size; - if (pRICIndication->ricIndicationHeader.octetString.contentLength < cMaxSizeOfOctetString) { - memcpy(pRICIndication->ricIndicationHeader.octetString.data, pRICindication_IEs->value.choice.RICindicationHeader.buf, - pRICIndication->ricIndicationHeader.octetString.contentLength); - - uint64_t returnCode; - if ((returnCode = getRICIndicationHeaderData(&pRICIndication->ricIndicationHeader) != e2err_OK)) { - ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU); - return returnCode; - } - } - else { - ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU); - return e2err_RICIndicationHeaderContentLengthFail; - } - } - else { - ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU); - return e2err_RICindicationRICindicationHeaderMissing; - } - - // RICindicationMessage - if (pE2AP_PDU->choice.initiatingMessage.value.choice.RICindication.protocolIEs.list.count > 6) { - pRICindication_IEs = pE2AP_PDU->choice.initiatingMessage.value.choice.RICindication.protocolIEs.list.array[6]; - - pRICIndication->ricIndicationMessage.octetString.contentLength = pRICindication_IEs->value.choice.RICindicationMessage.size; - if (pRICIndication->ricIndicationMessage.octetString.contentLength < cMaxSizeOfOctetString) { - memcpy(pRICIndication->ricIndicationMessage.octetString.data, pRICindication_IEs->value.choice.RICindicationMessage.buf, - pRICIndication->ricIndicationMessage.octetString.contentLength); - - uint64_t returnCode; - if ((returnCode = getRICIndicationMessageData(&pRICIndication->ricIndicationMessage) != e2err_OK)) { - ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU); - return returnCode; - } - } - else { - ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU); - return e2err_RICIndicationMessageContentLengthFail; - } - } - else { - ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU); - return e2err_RICindicationRICindicationMessageMissing; - } - - // RICcallProcessID, OPTIONAL. Not used in RIC. - - ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU); - return e2err_OK; -} - -////////////////////////////////////////////////////////////////////// -uint64_t getRICIndicationHeaderData(RICIndicationHeader_t* pRICIndicationHeader) { - - E2SM_gNB_X2_indicationHeader_t* pE2SM_gNB_X2_indicationHeader = 0; - asn_dec_rval_t rval; - rval = asn_decode(0, ATS_ALIGNED_BASIC_PER, &asn_DEF_E2SM_gNB_X2_indicationHeader, (void **)&pE2SM_gNB_X2_indicationHeader, - pRICIndicationHeader->octetString.data, pRICIndicationHeader->octetString.contentLength); - switch(rval.code) { - case RC_OK: - // Debug print - if (debug) { - printf("Successfully decoded E2SM_gNB_X2_indicationHeader"); - asn_fprint(stdout, &asn_DEF_E2SM_gNB_X2_indicationHeader, pE2SM_gNB_X2_indicationHeader); - } - - // InterfaceID, GlobalENB-ID or GlobalGNB-ID - if (pE2SM_gNB_X2_indicationHeader->interface_ID.present == Interface_ID_PR_global_eNB_ID) { - - // GlobalENB-ID - pRICIndicationHeader->interfaceID.globalENBIDPresent = true; - - // PLMN-Identity - pRICIndicationHeader->interfaceID.globalENBID.pLMNIdentity.contentLength = - pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_eNB_ID.pLMN_Identity.size; - memcpy(pRICIndicationHeader->interfaceID.globalENBID.pLMNIdentity.pLMNIdentityVal, - pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_eNB_ID.pLMN_Identity.buf, - pRICIndicationHeader->interfaceID.globalENBID.pLMNIdentity.contentLength); - - // ENB-ID - IdOctects_t eNBOctects; - memset(eNBOctects.octets, 0, sizeof(eNBOctects)); - if (pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_eNB_ID.eNB_ID.present == ENB_ID_PR_macro_eNB_ID) { - // BIT STRING (SIZE (20) - pRICIndicationHeader->interfaceID.globalENBID.nodeID.bits = cMacroENBIDP_20Bits; - memcpy(eNBOctects.octets,pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_eNB_ID.eNB_ID.choice.macro_eNB_ID.buf, - pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_eNB_ID.eNB_ID.choice.macro_eNB_ID.size); - pRICIndicationHeader->interfaceID.globalENBID.nodeID.nodeID = eNBOctects.nodeID; - } - else if (pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_eNB_ID.eNB_ID.present == ENB_ID_PR_home_eNB_ID) { - // BIT STRING (SIZE (28) - pRICIndicationHeader->interfaceID.globalENBID.nodeID.bits = cHomeENBID_28Bits; - memcpy(eNBOctects.octets,pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_eNB_ID.eNB_ID.choice.home_eNB_ID.buf, - pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_eNB_ID.eNB_ID.choice.home_eNB_ID.size); - pRICIndicationHeader->interfaceID.globalENBID.nodeID.nodeID = eNBOctects.nodeID; - } - else if (pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_eNB_ID.eNB_ID.present == ENB_ID_PR_short_Macro_eNB_ID) { - // BIT STRING (SIZE(18) - pRICIndicationHeader->interfaceID.globalENBID.nodeID.bits = cShortMacroENBID_18Bits; - memcpy(eNBOctects.octets,pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_eNB_ID.eNB_ID.choice.short_Macro_eNB_ID.buf, - pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_eNB_ID.eNB_ID.choice.short_Macro_eNB_ID.size); - pRICIndicationHeader->interfaceID.globalENBID.nodeID.nodeID = eNBOctects.nodeID; - } - else if (pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_eNB_ID.eNB_ID.present == ENB_ID_PR_long_Macro_eNB_ID) { - // BIT STRING (SIZE(21) - pRICIndicationHeader->interfaceID.globalENBID.nodeID.bits = clongMacroENBIDP_21Bits; - memcpy(eNBOctects.octets,pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_eNB_ID.eNB_ID.choice.long_Macro_eNB_ID.buf, - pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_eNB_ID.eNB_ID.choice.long_Macro_eNB_ID.size); - pRICIndicationHeader->interfaceID.globalENBID.nodeID.nodeID = eNBOctects.nodeID; - } - else { - pRICIndicationHeader->interfaceID.globalENBIDPresent = false; - pRICIndicationHeader->interfaceID.globalGNBIDPresent = false; - ASN_STRUCT_FREE(asn_DEF_E2SM_gNB_X2_indicationHeader, pE2SM_gNB_X2_indicationHeader); - return e2err_RICEventTriggerDefinitionIEValueFail_9; - } - } - else if (pE2SM_gNB_X2_indicationHeader->interface_ID.present == Interface_ID_PR_global_gNB_ID) { - // GlobalGNB-ID - pRICIndicationHeader->interfaceID.globalGNBIDPresent = true; - - // PLMN-Identity - pRICIndicationHeader->interfaceID.globalGNBID.pLMNIdentity.contentLength = - pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_eNB_ID.pLMN_Identity.size; - memcpy(pRICIndicationHeader->interfaceID.globalGNBID.pLMNIdentity.pLMNIdentityVal, - pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_eNB_ID.pLMN_Identity.buf, - pRICIndicationHeader->interfaceID.globalGNBID.pLMNIdentity.contentLength); - - // GNB-ID - IdOctects_t gNBOctects; - memset(gNBOctects.octets, 0, sizeof(gNBOctects)); - if (pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_gNB_ID.gNB_ID.present == GNB_ID_PR_gNB_ID) { - pRICIndicationHeader->interfaceID.globalGNBID.nodeID.bits = pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_gNB_ID.gNB_ID.choice.gNB_ID.size; - memcpy(gNBOctects.octets, pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_gNB_ID.gNB_ID.choice.gNB_ID.buf, - pRICIndicationHeader->interfaceID.globalGNBID.nodeID.bits); - pRICIndicationHeader->interfaceID.globalGNBID.nodeID.nodeID = gNBOctects.nodeID; - } - else { - pRICIndicationHeader->interfaceID.globalENBIDPresent = false; - pRICIndicationHeader->interfaceID.globalGNBIDPresent = false; - ASN_STRUCT_FREE(asn_DEF_E2SM_gNB_X2_indicationHeader, pE2SM_gNB_X2_indicationHeader); - return e2err_RICEventTriggerDefinitionIEValueFail_10; - } - } - else { - pRICIndicationHeader->interfaceID.globalENBIDPresent = false; - pRICIndicationHeader->interfaceID.globalGNBIDPresent = false; - ASN_STRUCT_FREE(asn_DEF_E2SM_gNB_X2_indicationHeader, pE2SM_gNB_X2_indicationHeader); - return e2err_RICEventTriggerDefinitionIEValueFail_11; - } - - // InterfaceDirection - pRICIndicationHeader->interfaceDirection = pE2SM_gNB_X2_indicationHeader->interfaceDirection; - - // TimeStamp OPTIONAL. Not used in RIC. - - ASN_STRUCT_FREE(asn_DEF_E2SM_gNB_X2_indicationHeader, pE2SM_gNB_X2_indicationHeader); - return e2err_OK; - case RC_WMORE: - if (debug) - printf("Decode failed. More data needed. Buffer size %zu, %s, consumed %zu",pRICIndicationHeader->octetString.contentLength, - asn_DEF_E2SM_gNB_X2_indicationHeader.name, rval.consumed); - return e2err_RICIndicationHeaderDecodeWMOREFail; - case RC_FAIL: - if (debug) - printf("Decode failed. Buffer size %zu, %s, consumed %zu",pRICIndicationHeader->octetString.contentLength, - asn_DEF_E2SM_gNB_X2_indicationHeader.name, rval.consumed); - - return e2err_RICIndicationHeaderDecodeFAIL; - default: - return e2err_RICIndicationHeaderDecodeDefaultFail; - } -} - -////////////////////////////////////////////////////////////////////// -uint64_t getRICIndicationMessageData(RICIndicationMessage_t* pRICIndicationMessage) { - - E2SM_gNB_X2_indicationMessage_t* pE2SM_gNB_X2_indicationMessage = 0; - asn_dec_rval_t rval; - rval = asn_decode(0, ATS_ALIGNED_BASIC_PER, &asn_DEF_E2SM_gNB_X2_indicationMessage, (void **)&pE2SM_gNB_X2_indicationMessage, - pRICIndicationMessage->octetString.data, pRICIndicationMessage->octetString.contentLength); - switch(rval.code) { - case RC_OK: - // Debug print - if (debug) { - printf("Successfully decoded E2SM_gNB_X2_indicationMessage"); - asn_fprint(stdout, &asn_DEF_E2SM_gNB_X2_indicationMessage, pE2SM_gNB_X2_indicationMessage); - } - - // InterfaceMessage - pRICIndicationMessage->interfaceMessage.contentLength = pE2SM_gNB_X2_indicationMessage->interfaceMessage.size; - if(pRICIndicationMessage->octetString.contentLength < cMaxSizeOfOctetString) { - memcpy(pRICIndicationMessage->interfaceMessage.data,pE2SM_gNB_X2_indicationMessage->interfaceMessage.buf, - pRICIndicationMessage->interfaceMessage.contentLength); - ASN_STRUCT_FREE(asn_DEF_E2SM_gNB_X2_indicationMessage, pE2SM_gNB_X2_indicationMessage); - return e2err_OK; - } - else { - ASN_STRUCT_FREE(asn_DEF_E2SM_gNB_X2_indicationMessage, pE2SM_gNB_X2_indicationMessage); - return e2err_RICIndicationMessageIEContentLengthFail; - } - case RC_WMORE: - if (debug) - printf("Decode failed. More data needed. Buffer size %zu, %s, consumed %zu",pRICIndicationMessage->octetString.contentLength, - asn_DEF_E2SM_gNB_X2_indicationMessage.name, rval.consumed); - - return e2err_RICIndicationMessageDecodeWMOREFail; - case RC_FAIL: - if (debug) - printf("Decode failed. Buffer size %zu, %s, consumed %zu",pRICIndicationMessage->octetString.contentLength, - asn_DEF_E2SM_gNB_X2_indicationMessage.name, rval.consumed); - - return e2err_RICIndicationMessageDecodeFAIL; - default: - return e2err_RICIndicationMessageDecodeDefaultFail; - } -} - - ////////////////////////////////////////////////////////////////////// uint64_t getRICSubscriptionDeleteRequestData(e2ap_pdu_ptr_t* pE2AP_PDU_pointer, RICSubscriptionDeleteRequest_t* pRICSubscriptionDeleteRequest) { diff --git a/e2ap/libe2ap_wrapper/E2AP_if.h b/e2ap/libe2ap_wrapper/E2AP_if.h index ce131a7..1e81852 100644 --- a/e2ap/libe2ap_wrapper/E2AP_if.h +++ b/e2ap/libe2ap_wrapper/E2AP_if.h @@ -68,7 +68,7 @@ typedef uint64_t StyleID_t; typedef uint32_t ParameterID_t; typedef struct { - uint32_t dummy; // This data type has no content. This dymmy is added here to solve problem with Golang. Golang do not like empty types. + uint32_t dummy; // This data type has no content. This dummy is added here to solve problem with Golang. Golang do not like empty types. } ParameterValue_t; typedef struct { @@ -180,7 +180,7 @@ enum ProtocolIEtestCondition_t { typedef struct { // CHOICE. Only one value can be present bool valueIntPresent; - int64_t integer; //INTEGER; + int64_t integer; // INTEGER; bool valueEnumPresent; int64_t valueEnum; // INTEGER bool valueBoolPresent; @@ -299,24 +299,6 @@ typedef struct { } CriticalityDiagnostics__t; -typedef int32_t RICIndicationSN_t; - -enum RICIndicationType_t { - RICIndicationType_RICIndicationTypeReport, - RICIndicationType_RICIndicationTypeInsert -}; - -typedef struct { - OctetString_t octetString; // E2AP spec format, the other elements for E2SM-X2 format - InterfaceID_t interfaceID; - uint8_t interfaceDirection; -} RICIndicationHeader_t; - -typedef struct { - OctetString_t octetString; // E2AP spec format, the other elements for E2SM-X2 format - OctetString_t interfaceMessage; -} RICIndicationMessage_t; - typedef struct { OctetString_t octetString; // E2AP spec format, the other elements for E2SM-X2 format uint64_t ricCallProcessIDVal; @@ -362,33 +344,6 @@ enum e2err { e2err_RICSubscriptionFailureAllocRICActionAdmittedListFail, e2err_RICSubscriptionFailureEncodeFail, e2err_RICSubscriptionFailureAllocE2AP_PDUFail, - e2err_RICIndicationRICrequestIDFail, - e2err_RICIndicationAllocRANfunctionIDFail, - e2err_RICIndicationAllocRICactionIDFail, - e2err_RICIndicationAllocRICindicationSNFail, - e2err_RICIndicationAllocRICindicationTypeFail, - e2err_RICIndicationAllocRRICindicationHeaderBufFail, - e2err_RICIndicationAllocRICindicationHeaderFail, - e2err_RICIndicationAllocRICindicationMessageBufFail, - e2err_RICIndicationAllocRICindicationMessageFail, - e2err_RICIndicationEncodeFail, - e2err_RICIndicationAllocE2AP_PDUFail, - e2err_RICindicationHeaderIEValueFail_1, - e2err_RICIndicationAllocRICIndicationHeaderglobal_eNB_IDpLMN_IdentityBufFail, - e2err_RICIndicationAllocRICIndicationHeaderglobal_eNB_IDeNB_IDmacro_eNB_IDBufFail, - e2err_RICIndicationAllocRICIndicationHeaderglobal_eNB_IDeNB_IDhome_eNB_IDBufFail, - e2err_RICIndicationAllocRICIndicationHeaderglobal_eNB_IDeNB_IDshort_Macro_eNB_IDBufFail, - e2err_RICIndicationAllocRICIndicationHeaderglobal_eNB_IDeNB_IDlong_Macro_eNB_IDBufFail, - e2err_RICindicationHeaderIEValueFail_2, - e2err_RICIndicationAllocRICIndicationHeaderglobal_gNB_IDpLMN_IdentityBufFail, - e2err_RICIndicationAllocRICIndicationHeaderglobal_gNB_IDgNB_IDgNB_IDBufFail, - e2err_RICindicationHeaderIEValueFail_3, - e2err_RICindicationHeaderPackFail_1, - e2err_RICindicationHeaderPackFail_2, - e2err_RICIndicationHeaderAllocE2AP_PDUFail, - e2err_RICIndicationMessageAllocinterfaceMessageFail, - e2err_RICindicationMessagePackFail_1, - e2err_RICindicationMessagePackFail_2, e2err_E2SM_gNB_X2_indicationMessageAllocE2AP_PDUFail, e2err_RICSubscriptionDeleteRequestAllocRICrequestIDFail, e2err_RICSubscriptionDeleteRequestAllocRANfunctionIDFail, @@ -419,25 +374,9 @@ enum e2err { e2err_RICsubscriptionFailureRICrequestIDMissing, e2err_RICsubscriptionFailureRANfunctionIDMissing, e2err_RICsubscriptionFailureRICaction_NotAdmitted_ListMissing, - e2err_RICindicationRICrequestIDMissing, - e2err_RICindicationRANfunctionIDMissing, - e2err_RICindicationRICactionIDMissing, - e2err_RICindicationRICindicationSNMissing, - e2err_RICindicationRICindicationTypeMissing, - e2err_RICIndicationHeaderContentLengthFail, - e2err_RICindicationRICindicationHeaderMissing, - e2err_RICIndicationMessageContentLengthFail, - e2err_RICindicationRICindicationMessageMissing, e2err_RICEventTriggerDefinitionIEValueFail_9, e2err_RICEventTriggerDefinitionIEValueFail_10, e2err_RICEventTriggerDefinitionIEValueFail_11, - e2err_RICIndicationHeaderDecodeWMOREFail, - e2err_RICIndicationHeaderDecodeFAIL, - e2err_RICIndicationHeaderDecodeDefaultFail, - e2err_RICIndicationMessageIEContentLengthFail, - e2err_RICIndicationMessageDecodeWMOREFail, - e2err_RICIndicationMessageDecodeFAIL, - e2err_RICIndicationMessageDecodeDefaultFail, e2err_RICsubscriptionDeleteRequestRICrequestIDMissing, e2err_RICsubscriptionDeleteRequestRANfunctionIDMissing, e2err_RICsubscriptionDeleteResponseRICrequestIDMissing, @@ -447,7 +386,6 @@ enum e2err { e2err_RICsubscriptionDeleteFailureRICcauseMissing }; - static const char* const E2ErrorStrings[] = { "e2err_OK", "e2err_RICSubscriptionRequestAllocRICrequestIDFail", @@ -486,33 +424,6 @@ static const char* const E2ErrorStrings[] = { "e2err_RICSubscriptionFailureAllocRICActionAdmittedListFail", "e2err_RICSubscriptionFailureEncodeFail", "e2err_RICSubscriptionFailureAllocE2AP_PDUFail", - "e2err_RICIndicationRICrequestIDFail", - "e2err_RICIndicationAllocRANfunctionIDFail", - "e2err_RICIndicationAllocRICactionIDFail", - "e2err_RICIndicationAllocRICindicationSNFail", - "e2err_RICIndicationAllocRICindicationTypeFail", - "e2err_RICIndicationAllocRRICindicationHeaderBufFail", - "e2err_RICIndicationAllocRICindicationHeaderFail", - "e2err_RICIndicationAllocRICindicationMessageBufFail", - "e2err_RICIndicationAllocRICindicationMessageFail", - "e2err_RICIndicationEncodeFail", - "e2err_RICIndicationAllocE2AP_PDUFail", - "e2err_RICindicationHeaderIEValueFail_1", - "e2err_RICIndicationAllocRICIndicationHeaderglobal_eNB_IDpLMN_IdentityBufFail", - "e2err_RICIndicationAllocRICIndicationHeaderglobal_eNB_IDeNB_IDmacro_eNB_IDBufFail", - "e2err_RICIndicationAllocRICIndicationHeaderglobal_eNB_IDeNB_IDhome_eNB_IDBufFail", - "e2err_RICIndicationAllocRICIndicationHeaderglobal_eNB_IDeNB_IDshort_Macro_eNB_IDBufFail", - "e2err_RICIndicationAllocRICIndicationHeaderglobal_eNB_IDeNB_IDlong_Macro_eNB_IDBufFail", - "e2err_RICindicationHeaderIEValueFail_2", - "e2err_RICIndicationAllocRICIndicationHeaderglobal_gNB_IDpLMN_IdentityBufFail", - "e2err_RICIndicationAllocRICIndicationHeaderglobal_gNB_IDgNB_IDgNB_IDBufFail", - "e2err_RICindicationHeaderIEValueFail_3", - "e2err_RICindicationHeaderPackFail_1", - "e2err_RICindicationHeaderPackFail_2", - "e2err_RICIndicationHeaderAllocE2AP_PDUFail", - "e2err_RICIndicationMessageAllocinterfaceMessageFail", - "e2err_RICindicationMessagePackFail_1", - "e2err_RICindicationMessagePackFail_2", "e2err_E2SM_gNB_X2_indicationMessageAllocE2AP_PDUFail", "e2err_RICSubscriptionDeleteRequestAllocRICrequestIDFail", "e2err_RICSubscriptionDeleteRequestAllocRANfunctionIDFail", @@ -543,25 +454,9 @@ static const char* const E2ErrorStrings[] = { "e2err_RICsubscriptionFailureRICrequestIDMissing", "e2err_RICsubscriptionFailureRANfunctionIDMissing", "e2err_RICsubscriptionFailureRICaction_NotAdmitted_ListMissing", - "e2err_RICindicationRICrequestIDMissing", - "e2err_RICindicationRANfunctionIDMissing", - "e2err_RICindicationRICactionIDMissing", - "e2err_RICindicationRICindicationSNMissing", - "e2err_RICindicationRICindicationTypeMissing", - "e2err_RICIndicationHeaderContentLengthFail", - "e2err_RICindicationRICindicationHeaderMissing", - "e2err_RICIndicationMessageContentLengthFail", - "e2err_RICindicationRICindicationMessageMissing", "e2err_RICEventTriggerDefinitionIEValueFail_9", "e2err_RICEventTriggerDefinitionIEValueFail_10", "e2err_RICEventTriggerDefinitionIEValueFail_11", - "e2err_RICIndicationHeaderDecodeWMOREFail", - "e2err_RICIndicationHeaderDecodeFAIL", - "e2err_RICIndicationHeaderDecodeDefaultFail", - "e2err_RICIndicationMessageIEContentLengthFail", - "e2err_RICIndicationMessageDecodeWMOREFail", - "e2err_RICIndicationMessageDecodeFAIL", - "e2err_RICIndicationMessageDecodeDefaultFail", "e2err_RICsubscriptionDeleteRequestRICrequestIDMissing", "e2err_RICsubscriptionDeleteRequestRANfunctionIDMissing", "e2err_RICsubscriptionDeleteResponseRICrequestIDMissing", @@ -589,7 +484,6 @@ extern const uint64_t cE2UnsuccessfulOutcome; // Initiating message extern const uint64_t cRICSubscriptionRequest; extern const uint64_t cRICSubscriptionDeleteRequest; -extern const uint64_t cRICIndication; // Successful outcome extern const uint64_t cRICSubscriptionResponse; @@ -622,17 +516,6 @@ typedef struct { CriticalityDiagnostics__t criticalityDiagnostics; } RICSubscriptionFailure_t; -typedef struct { - RICRequestID_t ricRequestID; - RANFunctionID_t ranFunctionID; - RICActionID_t ricActionID; - RICIndicationSN_t ricIndicationSN; - uint64_t ricIndicationType; // this is type of enum RICIndicationType_t - RICIndicationHeader_t ricIndicationHeader; - RICIndicationMessage_t ricIndicationMessage; - RICCallProcessID_t ricCallProcessID; // Not usein RIC currently -} RICIndication_t; - typedef struct { RICRequestID_t ricRequestID; RANFunctionID_t ranFunctionID; @@ -648,7 +531,7 @@ typedef struct { RANFunctionID_t ranFunctionID; RICCause_t ricCause; bool criticalityDiagnosticsPresent; - CriticalityDiagnostics__t criticalityDiagnostics; // Not usein RIC currently + CriticalityDiagnostics__t criticalityDiagnostics; // Not used in RIC currently } RICSubscriptionDeleteFailure_t; ////////////////////////////////////////////////////////////////////// @@ -662,9 +545,6 @@ uint64_t packRICSubscriptionRequest(size_t*, byte*, char*,RICSubscriptionRequest uint64_t packRICEventTriggerDefinition(char*,RICEventTriggerDefinition_t*); uint64_t packRICSubscriptionResponse(size_t*, byte*, char*,RICSubscriptionResponse_t*); uint64_t packRICSubscriptionFailure(size_t*, byte*, char*,RICSubscriptionFailure_t*); -uint64_t packRICIndication(size_t*, byte*, char*,RICIndication_t*); -uint64_t packRICIndicationHeader(char*,RICIndicationHeader_t*); -uint64_t packRICIndicationMessage(char*,RICIndicationMessage_t*); uint64_t packRICSubscriptionDeleteRequest(size_t*, byte*, char*,RICSubscriptionDeleteRequest_t*); uint64_t packRICSubscriptionDeleteResponse(size_t*, byte*, char*,RICSubscriptionDeleteResponse_t*); uint64_t packRICSubscriptionDeleteFailure(size_t*, byte*, char*,RICSubscriptionDeleteFailure_t*); @@ -674,19 +554,14 @@ uint64_t getRICSubscriptionRequestData(e2ap_pdu_ptr_t*, RICSubscriptionRequest_t uint64_t getRICEventTriggerDefinitionData(RICEventTriggerDefinition_t*); uint64_t getRICSubscriptionResponseData(e2ap_pdu_ptr_t*, RICSubscriptionResponse_t*); uint64_t getRICSubscriptionFailureData(e2ap_pdu_ptr_t*, RICSubscriptionFailure_t*); -uint64_t getRICIndicationData(e2ap_pdu_ptr_t*, RICIndication_t*); -uint64_t getRICIndicationHeaderData(RICIndicationHeader_t*); -uint64_t getRICIndicationMessageData(RICIndicationMessage_t*); uint64_t getRICSubscriptionDeleteRequestData(e2ap_pdu_ptr_t*, RICSubscriptionDeleteRequest_t*); uint64_t getRICSubscriptionDeleteResponseData(e2ap_pdu_ptr_t*, RICSubscriptionDeleteResponse_t*); uint64_t getRICSubscriptionDeleteFailureData(e2ap_pdu_ptr_t*, RICSubscriptionDeleteFailure_t*); - #if DEBUG bool TestRICSubscriptionRequest(); bool TestRICSubscriptionResponse(); bool TestRICSubscriptionFailure(); -bool TestRICIndication(); bool TestRICSubscriptionDeleteRequest(); bool TestRICSubscriptionDeleteResponse(); bool TestRICSubscriptionDeleteFailure(); @@ -694,7 +569,6 @@ bool TestRICSubscriptionDeleteFailure(); void printRICSubscriptionRequest(const RICSubscriptionRequest_t*); void printRICSubscriptionResponse(const RICSubscriptionResponse_t*); void printRICSubscriptionFailure(const RICSubscriptionFailure_t*); -void printRICIndication(const RICIndication_t*); void printRICSubscriptionDeleteRequest(const RICSubscriptionDeleteRequest_t*); void printRICSubscriptionDeleteResponse(const RICSubscriptionDeleteResponse_t*); void printRICSubscriptionDeleteFailure(const RICSubscriptionDeleteFailure_t*); diff --git a/e2ap/libe2ap_wrapper/E2AP_tests.c b/e2ap/libe2ap_wrapper/E2AP_tests.c index 5ae0933..20d97c6 100644 --- a/e2ap/libe2ap_wrapper/E2AP_tests.c +++ b/e2ap/libe2ap_wrapper/E2AP_tests.c @@ -249,83 +249,6 @@ bool TestRICSubscriptionFailure() { return false; } -////////////////////////////////////////////////////////////////////// -bool TestRICIndication() { - // Test RICIndication - RICIndication_t ricIndication; - - ricIndication.ricRequestID.ricRequestorID = 1; - ricIndication.ricRequestID.ricRequestSequenceNumber = 22; - ricIndication.ranFunctionID = 33; - ricIndication.ricActionID = 44; - ricIndication.ricIndicationSN = 55; - ricIndication.ricIndicationType = RICIndicationType_RICIndicationTypeReport; - - ricIndication.ricIndicationHeader.interfaceID.globalGNBIDPresent = false; - ricIndication.ricIndicationHeader.interfaceID.globalENBIDPresent = true; - ricIndication.ricIndicationHeader.interfaceID.globalENBID.pLMNIdentity.contentLength = 3; - - ricIndication.ricIndicationHeader.interfaceID.globalENBID.pLMNIdentity.pLMNIdentityVal[0] = 1; - ricIndication.ricIndicationHeader.interfaceID.globalENBID.pLMNIdentity.pLMNIdentityVal[1] = 2; - ricIndication.ricIndicationHeader.interfaceID.globalENBID.pLMNIdentity.pLMNIdentityVal[2] = 3; - -// ricIndication.ricIndicationHeader.interfaceID.globalENBID.nodeID.bits = cMacroENBIDP_20Bits; -// ricIndication.ricIndicationHeader.interfaceID.globalENBID.nodeID.bits = cHomeENBID_28Bits; -// ricIndication.ricIndicationHeader.interfaceID.globalENBID.nodeID.bits = cShortMacroENBID_18Bits; - ricIndication.ricIndicationHeader.interfaceID.globalENBID.nodeID.bits = clongMacroENBIDP_21Bits; - - IdOctects_t eNBOctects; - memset(eNBOctects.octets, 0, sizeof(eNBOctects)); - eNBOctects.octets[0] = 11; - eNBOctects.octets[1] = 22; - eNBOctects.octets[2] = 31; - eNBOctects.octets[3] = 1; - ricIndication.ricIndicationHeader.interfaceID.globalENBID.nodeID.nodeID = eNBOctects.nodeID; - printf("eNBOctects.nodeID = %u",eNBOctects.nodeID); - - ricIndication.ricIndicationHeader.interfaceDirection = InterfaceDirection__incoming; - - char data[] = "Hello world"; - ricIndication.ricIndicationMessage.interfaceMessage.contentLength = sizeof(data); - memcpy(ricIndication.ricIndicationMessage.interfaceMessage.data,data,sizeof(data)); - - printRICIndication(&ricIndication); - - uint64_t logBufferSize = 1024; - char logBuffer[logBufferSize]; - uint64_t dataBufferSize = cDataBufferSize; - byte dataBuffer[dataBufferSize]; - if (packRICIndication(&dataBufferSize, dataBuffer, logBuffer, &ricIndication) == e2err_OK) - { - memset(&ricIndication,0, sizeof ricIndication); - uint64_t returnCode; - E2MessageInfo_t messageInfo; - e2ap_pdu_ptr_t* pE2AP_PDU = unpackE2AP_pdu(dataBufferSize, dataBuffer, logBuffer, &messageInfo); - if (pE2AP_PDU != 0) { - if (messageInfo.messageType == cE2InitiatingMessage) { - if (messageInfo.messageId == cRICIndication) { - // RICindication - if ((returnCode = getRICIndicationData(pE2AP_PDU, &ricIndication)) == e2err_OK) { - printRICIndication(&ricIndication); - return true; - } - else - printf("Error in getRICIndicationData. ReturnCode = %s",getE2ErrorString(returnCode)); - } - else - printf("Not RICIndication\n"); - } - else - printf("Not InitiatingMessage\n"); - } - else - printf("%s",logBuffer); - } - else - printf("%s",logBuffer); - return false; -} - ////////////////////////////////////////////////////////////////////// bool TestRICSubscriptionDeleteRequest() { @@ -590,41 +513,6 @@ void printRICSubscriptionFailure(const RICSubscriptionFailure_t* pRICSubscriptio printf("\n"); } -////////////////////////////////////////////////////////////////////// -void printRICIndication(const RICIndication_t* pRICIndication) { - - printf("pRICIndication->ricRequestID.ricRequestorID = %u\n",pRICIndication->ricRequestID.ricRequestorID); - printf("pRICIndication->ricRequestID.ricRequestSequenceNumber = %u\n",pRICIndication->ricRequestID.ricRequestSequenceNumber); - printf("pRICIndication->ranFunctionID = %u\n",pRICIndication->ranFunctionID); - printf("pRICIndication->ricActionID = %lu\n",pRICIndication->ricActionID); - printf("pRICIndication->ricIndicationSN = %u\n",pRICIndication->ricIndicationSN); - printf("pRICIndication->ricIndicationType = %u\n",(unsigned)pRICIndication->ricIndicationType); - printf("pRICIndication->ricIndicationHeader.interfaceID.globalENBIDPresent = %u\n",pRICIndication->ricIndicationHeader.interfaceID.globalENBIDPresent); - if (pRICIndication->ricIndicationHeader.interfaceID.globalENBIDPresent) { - printf("pRICIndication->ricIndicationHeader.interfaceID.globalENBID.pLMNIdentity.contentLength = %u\n",(unsigned)pRICIndication->ricIndicationHeader.interfaceID.globalENBID.pLMNIdentity.contentLength); - printf("pRICIndication->ricIndicationHeader.interfaceID.globalENBID.pLMNIdentity.pLMNIdentityVal[0] = %u\n",(unsigned)pRICIndication->ricIndicationHeader.interfaceID.globalENBID.pLMNIdentity.pLMNIdentityVal[0]); - printf("pRICIndication->ricIndicationHeader.interfaceID.globalENBID.pLMNIdentity.pLMNIdentityVal[1] = %u\n",(unsigned)pRICIndication->ricIndicationHeader.interfaceID.globalENBID.pLMNIdentity.pLMNIdentityVal[1]); - printf("pRICIndication->ricIndicationHeader.interfaceID.globalENBID.pLMNIdentity.pLMNIdentityVal[2] = %u\n",(unsigned)pRICIndication->ricIndicationHeader.interfaceID.globalENBID.pLMNIdentity.pLMNIdentityVal[2]); - printf("pRICIndication->ricIndicationHeader.interfaceID.globalENBID.nodeID.bits = %u\n",(unsigned)pRICIndication->ricIndicationHeader.interfaceID.globalENBID.nodeID.bits); - printf("pRICIndication->ricIndicationHeader.interfaceID.globalENBID.nodeID.nodeID = %u\n",(unsigned)pRICIndication->ricIndicationHeader.interfaceID.globalENBID.nodeID.nodeID); - } - printf("pRICIndication->ricIndicationHeader.interfaceID.globalGNBIDPresent = %u\n",pRICIndication->ricIndicationHeader.interfaceID.globalGNBIDPresent); - if(pRICIndication->ricIndicationHeader.interfaceID.globalGNBIDPresent){ - printf("pRICIndication->ricIndicationHeader.interfaceID.globalGNBID.pLMNIdentity.contentLength = %u\n",(unsigned)pRICIndication->ricIndicationHeader.interfaceID.globalGNBID.pLMNIdentity.contentLength); - printf("pRICIndication->ricIndicationHeader.interfaceID.globalGNBID.pLMNIdentity.pLMNIdentityVal[0] = %u\n",(unsigned)pRICIndication->ricIndicationHeader.interfaceID.globalGNBID.pLMNIdentity.pLMNIdentityVal[0]); - printf("pRICIndication->ricIndicationHeader.interfaceID.globalGNBID.pLMNIdentity.pLMNIdentityVal[1] = %u\n",(unsigned)pRICIndication->ricIndicationHeader.interfaceID.globalGNBID.pLMNIdentity.pLMNIdentityVal[1]); - printf("pRICIndication->ricIndicationHeader.interfaceID.globalGNBID.pLMNIdentity.pLMNIdentityVal[2] = %u\n",(unsigned)pRICIndication->ricIndicationHeader.interfaceID.globalGNBID.pLMNIdentity.pLMNIdentityVal[2]); - printf("pRICIndication->ricIndicationHeader.interfaceID.globalGNBID.nodeID.bits = %u\n",(unsigned)pRICIndication->ricIndicationHeader.interfaceID.globalGNBID.nodeID.bits); - printf("pRICIndication->ricIndicationHeader.interfaceID.globalGNBID.nodeID.nodeID = %u\n",(unsigned)pRICIndication->ricIndicationHeader.interfaceID.globalGNBID.nodeID.nodeID); - } - printf("pRICIndication->ricIndicationHeader.interfaceDirection = %u\n",(unsigned)pRICIndication->ricIndicationHeader.interfaceDirection); - printf("pRICIndication->ricIndicationMessage.interfaceMessage.contentLength = %u\n",(unsigned)pRICIndication->ricIndicationMessage.interfaceMessage.contentLength); - - printf("pRICIndication->ricIndicationMessage.interfaceMessage.data = "); - printDataBuffer(pRICIndication->ricIndicationMessage.interfaceMessage.contentLength,pRICIndication->ricIndicationMessage.interfaceMessage.data); - printf("\n"); -} - void printRICSubscriptionDeleteRequest(const RICSubscriptionDeleteRequest_t* pRICSubscriptionDeleteRequest) { printf("\npRICSubscriptionDeleteRequest->ricRequestID.ricRequestorID = %u\n",pRICSubscriptionDeleteRequest->ricRequestID.ricRequestorID); diff --git a/e2ap/pkg/e2ap/e2ap_packerif.go b/e2ap/pkg/e2ap/e2ap_packerif.go index d69a716..23e5b0a 100644 --- a/e2ap/pkg/e2ap/e2ap_packerif.go +++ b/e2ap/pkg/e2ap/e2ap_packerif.go @@ -87,15 +87,6 @@ type E2APMsgPackerSubscriptionDeleteFailureIf interface { Get() (error, *E2APSubscriptionDeleteFailure) } -//----------------------------------------------------------------------------- -// -//----------------------------------------------------------------------------- -type E2APMsgPackerIndicationIf interface { - E2APMsgPackerIf - Set(*E2APIndication) error - Get() (error, *E2APIndication) -} - //----------------------------------------------------------------------------- // //----------------------------------------------------------------------------- @@ -106,7 +97,6 @@ type E2APPackerIf interface { NewPackerSubscriptionDeleteRequest() E2APMsgPackerSubscriptionDeleteRequestIf NewPackerSubscriptionDeleteResponse() E2APMsgPackerSubscriptionDeleteResponseIf NewPackerSubscriptionDeleteFailure() E2APMsgPackerSubscriptionDeleteFailureIf - NewPackerIndication() E2APMsgPackerIndicationIf MessageInfo(msg *packer.PackedData) *packer.MessageInfo } @@ -142,12 +132,6 @@ func (autopacker *E2APAutoPacker) UnPack(msg *packer.PackedData) (error, interfa if err == nil { return unpa.Get() } - case E2AP_RICIndication: - unpa := autopacker.packer.NewPackerIndication() - err = unpa.UnPack(msg) - if err == nil { - return unpa.Get() - } default: err = fmt.Errorf("MsgType: E2AP_InitiatingMessage => MsgId:%d unknown", msgInfo.MsgId) } @@ -233,12 +217,6 @@ func (autopacker *E2APAutoPacker) Pack(data interface{}, trg *packer.PackedData) if err == nil { return pa.Pack(trg) } - case *E2APIndication: - pa := autopacker.packer.NewPackerIndication() - err = pa.Set(themsg) - if err == nil { - return pa.Pack(trg) - } default: err = fmt.Errorf("unknown message") } diff --git a/e2ap/pkg/e2ap/e2ap_tests/msg.go b/e2ap/pkg/e2ap/e2ap_tests/msg.go index 7502cf1..1c3ab2e 100644 --- a/e2ap/pkg/e2ap/e2ap_tests/msg.go +++ b/e2ap/pkg/e2ap/e2ap_tests/msg.go @@ -113,8 +113,6 @@ func RunTests(t *testing.T, e2aptestctxt *E2ApTests) { t.Run(e2aptestctxt.Name(), func(t *testing.T) { e2aptestctxt.E2ApTestMsgSubscriptionDeleteFailure(t) }) - t.Run(e2aptestctxt.Name(), func(t *testing.T) { e2aptestctxt.E2ApTestMsgIndication(t) }) - t.Run(e2aptestctxt.Name(), func(t *testing.T) { e2aptestctxt.E2ApTestMsgSubscriptionRequestBuffers(t) }) t.Run(e2aptestctxt.Name(), func(t *testing.T) { e2aptestctxt.E2ApTestMsgSubscriptionResponseBuffers(t) }) t.Run(e2aptestctxt.Name(), func(t *testing.T) { e2aptestctxt.E2ApTestMsgSubscriptionFailureBuffers(t) }) diff --git a/e2ap/pkg/e2ap/e2ap_tests/msg_e2ap_indication.go b/e2ap/pkg/e2ap/e2ap_tests/msg_e2ap_indication.go deleted file mode 100644 index caad3a8..0000000 --- a/e2ap/pkg/e2ap/e2ap_tests/msg_e2ap_indication.go +++ /dev/null @@ -1,79 +0,0 @@ -/* -================================================================================== - Copyright (c) 2019 AT&T Intellectual Property. - Copyright (c) 2019 Nokia - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -================================================================================== -*/ - -package e2ap_tests - -import ( - "gerrit.o-ran-sc.org/r/ric-plt/e2ap/pkg/e2ap" - "testing" -) - -//----------------------------------------------------------------------------- -// -//----------------------------------------------------------------------------- -func (testCtxt *E2ApTests) E2ApTestMsgIndication(t *testing.T) { - - testCtxt.SetDesc("MsgIndication") - e2Ind := testCtxt.packerif.NewPackerIndication() - - testCtxt.testPrint("########## Indication ##########") - testCtxt.testPrint("Indication: init") - - aindenc := e2ap.E2APIndication{} - aindenc.RequestId.Id = 1 - aindenc.RequestId.Seq = 22 - aindenc.FunctionId = 33 - aindenc.IndicationSn = 1 - aindenc.IndicationType = e2ap.E2AP_IndicationTypeReport - aindenc.IndicationHeader.InterfaceId.GlobalEnbId.Present = true - aindenc.IndicationHeader.InterfaceId.GlobalEnbId.PlmnIdentity.StringPut("310150") - //Bits 20, 28(works), 18, 21 (asn1 problems) - aindenc.IndicationHeader.InterfaceId.GlobalEnbId.NodeId.Bits = e2ap.E2AP_ENBIDHomeBits28 - aindenc.IndicationHeader.InterfaceId.GlobalEnbId.NodeId.Id = 202251 - aindenc.IndicationHeader.InterfaceDirection = 0 - aindenc.IndicationMessage.InterfaceMessage.Buf = []uint8{1, 2, 3, 4, 5} - //aindenc.CallProcessId.CallProcessIDVal=100 - - seterr := e2Ind.Set(&aindenc) - if seterr != nil { - testCtxt.testError(t, "set err: %s", seterr.Error()) - return - } - - testCtxt.testPrint("Indication: print:\n%s", e2Ind.String()) - testCtxt.testPrint("Indication: pack") - err, packedMsg := e2Ind.Pack(nil) - if err != nil { - testCtxt.testError(t, "Indication Pack failed: %s", err.Error()) - return - } - testCtxt.testPrint("Indication: unpack") - err = e2Ind.UnPack(packedMsg) - if err != nil { - testCtxt.testError(t, "Indication UnPack failed: %s", err.Error()) - return - } - testCtxt.testPrint("Indication: print:\n%s", e2Ind.String()) - geterr, ainddec := e2Ind.Get() - if geterr != nil { - testCtxt.testError(t, "Indication get nil: %s", geterr.Error()) - return - } - testCtxt.testValueEquality(t, "msg", &aindenc, ainddec) -} diff --git a/e2ap/pkg/e2ap/msg_e2ap.go b/e2ap/pkg/e2ap/msg_e2ap.go index a7edc74..0c8693f 100644 --- a/e2ap/pkg/e2ap/msg_e2ap.go +++ b/e2ap/pkg/e2ap/msg_e2ap.go @@ -42,7 +42,7 @@ const E2AP_RICSubscriptionDeleteRequest uint64 = 2 // const E2AP_ENBConfigurationUpdate uint64 = 8 // const E2AP_ENDCConfigurationUpdate uint64 = 9 // const E2AP_ResetRequest uint64 = 10 -const E2AP_RICIndication uint64 = 11 +// const E2AP_RICIndication uint64 = 11 // const E2AP_RICServiceQuery uint64 = 12 // const E2AP_LoadInformation uint64 = 13 diff --git a/e2ap/pkg/e2ap/msg_e2ap_indication.go b/e2ap/pkg/e2ap/msg_e2ap_indication.go deleted file mode 100644 index 22a5636..0000000 --- a/e2ap/pkg/e2ap/msg_e2ap_indication.go +++ /dev/null @@ -1,59 +0,0 @@ -/* -================================================================================== - Copyright (c) 2019 AT&T Intellectual Property. - Copyright (c) 2019 Nokia - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -================================================================================== -*/ - -package e2ap - -import ( - "gerrit.o-ran-sc.org/r/ric-plt/e2ap/pkg/packer" -) - -//----------------------------------------------------------------------------- -// -//----------------------------------------------------------------------------- -type IndicationHeader struct { - InterfaceId - InterfaceDirection uint32 -} - -//----------------------------------------------------------------------------- -// -//----------------------------------------------------------------------------- -//type InterfaceMessage struct { -// Data []uint8 -//} - -//----------------------------------------------------------------------------- -// -//----------------------------------------------------------------------------- -type IndicationMessage struct { - InterfaceMessage packer.PackedData -} - -//----------------------------------------------------------------------------- -// -//----------------------------------------------------------------------------- -type E2APIndication struct { - RequestId - FunctionId - IndicationHeader - IndicationMessage - // CallProcessId - IndicationSn int32 - IndicationType uint64 -} diff --git a/e2ap/pkg/e2ap_wrapper/packer_e2ap.go b/e2ap/pkg/e2ap_wrapper/packer_e2ap.go index 0a93b0e..05ac04a 100644 --- a/e2ap/pkg/e2ap_wrapper/packer_e2ap.go +++ b/e2ap/pkg/e2ap_wrapper/packer_e2ap.go @@ -43,9 +43,6 @@ package e2ap_wrapper // void initSubsDeleteFailure(RICSubscriptionDeleteFailure_t *data){ // bzero(data,sizeof(RICSubscriptionDeleteFailure_t)); // } -// void initIndication(RICIndication_t *data){ -// bzero(data,sizeof(RICIndication_t)); -// } // import "C" @@ -400,52 +397,6 @@ func (item *e2apEntryCriticalityDiagnostic) get(data *e2ap.CriticalityDiagnostic return nil } -//----------------------------------------------------------------------------- -// -//----------------------------------------------------------------------------- -type e2apEntryIndicationHeader struct { - entry *C.RICIndicationHeader_t -} - -func (indHdr *e2apEntryIndicationHeader) set(data *e2ap.IndicationHeader) error { - indHdr.entry.interfaceDirection = (C.uint8_t)(data.InterfaceDirection) - return (&e2apEntryInterfaceId{entry: &indHdr.entry.interfaceID}).set(&data.InterfaceId) -} - -func (indHdr *e2apEntryIndicationHeader) get(data *e2ap.IndicationHeader) error { - data.InterfaceDirection = (uint32)(indHdr.entry.interfaceDirection) - return (&e2apEntryInterfaceId{entry: &indHdr.entry.interfaceID}).get(&data.InterfaceId) -} - -//----------------------------------------------------------------------------- -// -//----------------------------------------------------------------------------- -type e2apEntryIndicationMessage struct { - entry *C.RICIndicationMessage_t -} - -func (indMsg *e2apEntryIndicationMessage) set(data *e2ap.IndicationMessage) error { - if len(data.InterfaceMessage.Buf) > 1024 { - return fmt.Errorf("IndicationMessage.InterfaceMessage: too long %d while allowed %d", len(data.InterfaceMessage.Buf), 1024) - } - indMsg.entry.interfaceMessage.contentLength = (C.uint64_t)(len(data.InterfaceMessage.Buf)) - for i := 0; i < len(data.InterfaceMessage.Buf); i++ { - indMsg.entry.interfaceMessage.data[i] = (C.uint8_t)(data.InterfaceMessage.Buf[i]) - } - return nil -} - -func (indMsg *e2apEntryIndicationMessage) get(data *e2ap.IndicationMessage) error { - conlen := (int)(indMsg.entry.interfaceMessage.contentLength) - if conlen > 0 { - data.InterfaceMessage.Buf = make([]byte, conlen) - for i := 0; i < conlen; i++ { - data.InterfaceMessage.Buf[i] = (uint8)(indMsg.entry.interfaceMessage.data[i]) - } - } - return nil -} - /* //----------------------------------------------------------------------------- // @@ -493,9 +444,6 @@ func (e2apMsg *e2apMessage) MessageInfo() *packer.MessageInfo { case C.cRICSubscriptionDeleteRequest: msgInfo.MsgId = e2ap.E2AP_RICSubscriptionDeleteRequest return msgInfo - case C.cRICIndication: - msgInfo.MsgId = e2ap.E2AP_RICIndication - return msgInfo } case C.cE2SuccessfulOutcome: msgInfo.MsgType = e2ap.E2AP_SuccessfulOutcome @@ -1237,149 +1185,6 @@ func (e2apMsg *e2apMsgSubscriptionDeleteFailure) String() string { return b.String() } -//----------------------------------------------------------------------------- -// -//----------------------------------------------------------------------------- -type e2apMsgIndication struct { - e2apMessage - msgC *C.RICIndication_t -} - -func (e2apMsg *e2apMsgIndication) Set(data *e2ap.E2APIndication) error { - - e2apMsg.msgC = &C.RICIndication_t{} - C.initIndication(e2apMsg.msgC) - - e2apMsg.msgC.ranFunctionID = (C.uint16_t)(data.FunctionId) - e2apMsg.msgC.ricIndicationSN = (C.int32_t)(data.IndicationSn) - e2apMsg.msgC.ricIndicationType = (C.uint64_t)(data.IndicationType) - - if err := (&e2apEntryRequestID{entry: &e2apMsg.msgC.ricRequestID}).set(&data.RequestId); err != nil { - return err - } - if err := (&e2apEntryIndicationHeader{entry: &e2apMsg.msgC.ricIndicationHeader}).set(&data.IndicationHeader); err != nil { - return err - } - if err := (&e2apEntryIndicationMessage{entry: &e2apMsg.msgC.ricIndicationMessage}).set(&data.IndicationMessage); err != nil { - return err - } - /* NOT SUPPORTED - if err := (&e2apEntryCallProcessId{entry: &e2apMsg.msgC.ricCallProcessID}).set(&data.CallProcessId); err != nil { - return err - } - */ - return nil -} - -func (e2apMsg *e2apMsgIndication) Get() (error, *e2ap.E2APIndication) { - - data := &e2ap.E2APIndication{} - - data.FunctionId = (e2ap.FunctionId)(e2apMsg.msgC.ranFunctionID) - data.IndicationSn = (int32)(e2apMsg.msgC.ricIndicationSN) - data.IndicationType = (uint64)(e2apMsg.msgC.ricIndicationType) - - if err := (&e2apEntryRequestID{entry: &e2apMsg.msgC.ricRequestID}).get(&data.RequestId); err != nil { - return err, data - } - if err := (&e2apEntryIndicationHeader{entry: &e2apMsg.msgC.ricIndicationHeader}).get(&data.IndicationHeader); err != nil { - return err, data - } - if err := (&e2apEntryIndicationMessage{entry: &e2apMsg.msgC.ricIndicationMessage}).get(&data.IndicationMessage); err != nil { - return err, data - } - /* NOT SUPPORTED - if err := (&e2apEntryCallProcessId{entry: &e2apMsg.msgC.ricCallProcessID}).get(&data.CallProcessId); err != nil { - return err,data - } - */ - return nil, data -} - -func (e2apMsg *e2apMsgIndication) PduPack(logBuf []byte, data *packer.PackedData) error { - - /* NOT SUPPORTED - callProcId := e2apEntryCallProcessId{entry: &e2apMsg.msgC.ricCallProcessID} - if err := callProcId.pack(); err != nil { - return err - } - */ - var buflen uint32 = (uint32)(len(data.Buf)) - errorNro := C.packRICIndication((*C.size_t)(unsafe.Pointer(&buflen)), (*C.uchar)(unsafe.Pointer(&data.Buf[0])), (*C.char)(unsafe.Pointer(&logBuf[0])), e2apMsg.msgC) - if errorNro != C.e2err_OK { - return fmt.Errorf("%s", C.GoString(C.getE2ErrorString(errorNro))) - } - data.Buf = data.Buf[0:buflen] - return nil -} - -func (e2apMsg *e2apMsgIndication) PduUnPack(logBuf []byte, data *packer.PackedData) error { - - e2apMsg.msgC = &C.RICIndication_t{} - C.initIndication(e2apMsg.msgC) - - e2apMsg.e2apMessage.PduUnPack(logBuf, data) - if e2apMsg.e2apMessage.messageInfo.messageType != C.cE2InitiatingMessage || e2apMsg.e2apMessage.messageInfo.messageId != C.cRICIndication { - return fmt.Errorf("unpackE2AP_pdu failed -> %s", e2apMsg.e2apMessage.String()) - } - errorNro := C.getRICIndicationData(e2apMsg.e2apMessage.pdu, e2apMsg.msgC) - if errorNro != C.e2err_OK { - return fmt.Errorf("%s", C.GoString(C.getE2ErrorString(errorNro))) - } - - /* NOT SUPPORTED - callProcId := e2apEntryCallProcessId{entry: &e2apMsg.msgC.ricCallProcessID} - if err := callProcId.unpack(); err != nil { - return err - } - */ - return nil -} - -func (e2apMsg *e2apMsgIndication) Pack(trg *packer.PackedData) (error, *packer.PackedData) { - return packer.PduPackerPackAllocTrg(e2apMsg, trg) -} - -func (e2apMsg *e2apMsgIndication) UnPack(msg *packer.PackedData) error { - return packer.PduPackerUnPack(e2apMsg, msg) -} - -func (e2apMsg *e2apMsgIndication) String() string { - var b bytes.Buffer - fmt.Fprintln(&b, "ricIndication.") - fmt.Fprintln(&b, " ricRequestID.") - fmt.Fprintln(&b, " ricRequestorID =", e2apMsg.msgC.ricRequestID.ricRequestorID) - fmt.Fprintln(&b, " ricRequestSequenceNumber =", e2apMsg.msgC.ricRequestID.ricRequestSequenceNumber) - fmt.Fprintln(&b, " ranFunctionID =", e2apMsg.msgC.ranFunctionID) - - fmt.Fprintln(&b, " ricActionID =", e2apMsg.msgC.ricActionID) - fmt.Fprintln(&b, " ricIndicationSN =", e2apMsg.msgC.ricIndicationSN) - fmt.Fprintln(&b, " ricIndicationType =", e2apMsg.msgC.ricIndicationType) - fmt.Fprintln(&b, " ricIndication.ricIndicationHeader.") - fmt.Fprintln(&b, " interfaceID.globalENBIDPresent =", e2apMsg.msgC.ricIndicationHeader.interfaceID.globalENBIDPresent) - if e2apMsg.msgC.ricIndicationHeader.interfaceID.globalENBIDPresent { - fmt.Fprintln(&b, " interfaceID.globalENBID.pLMNIdentity.contentLength =", e2apMsg.msgC.ricIndicationHeader.interfaceID.globalENBID.pLMNIdentity.contentLength) - fmt.Fprintln(&b, " interfaceID.globalENBID.pLMNIdentity.pLMNIdentityVal[0] =", e2apMsg.msgC.ricIndicationHeader.interfaceID.globalENBID.pLMNIdentity.pLMNIdentityVal[0]) - fmt.Fprintln(&b, " interfaceID.globalENBID.pLMNIdentity.pLMNIdentityVal[1] =", e2apMsg.msgC.ricIndicationHeader.interfaceID.globalENBID.pLMNIdentity.pLMNIdentityVal[1]) - fmt.Fprintln(&b, " interfaceID.globalENBID.pLMNIdentity.pLMNIdentityVal[2] =", e2apMsg.msgC.ricIndicationHeader.interfaceID.globalENBID.pLMNIdentity.pLMNIdentityVal[2]) - fmt.Fprintln(&b, " interfaceID.globalENBID.nodeID.bits =", e2apMsg.msgC.ricIndicationHeader.interfaceID.globalENBID.nodeID.bits) - fmt.Fprintln(&b, " interfaceID.globalENBID.nodeID.nodeID =", e2apMsg.msgC.ricIndicationHeader.interfaceID.globalENBID.nodeID.nodeID) - } - fmt.Fprintln(&b, " interfaceID.globalGNBIDPresent =", e2apMsg.msgC.ricIndicationHeader.interfaceID.globalGNBIDPresent) - if e2apMsg.msgC.ricIndicationHeader.interfaceID.globalGNBIDPresent { - fmt.Fprintln(&b, " interfaceID.globalGNBID.pLMNIdentity.contentLength =", e2apMsg.msgC.ricIndicationHeader.interfaceID.globalGNBID.pLMNIdentity.contentLength) - fmt.Fprintln(&b, " interfaceID.globalGNBID.pLMNIdentity.pLMNIdentityVal[0] =", e2apMsg.msgC.ricIndicationHeader.interfaceID.globalGNBID.pLMNIdentity.pLMNIdentityVal[0]) - fmt.Fprintln(&b, " interfaceID.globalGNBID.pLMNIdentity.pLMNIdentityVal[1] =", e2apMsg.msgC.ricIndicationHeader.interfaceID.globalGNBID.pLMNIdentity.pLMNIdentityVal[1]) - fmt.Fprintln(&b, " interfaceID.globalGNBID.pLMNIdentity.pLMNIdentityVal[2] =", e2apMsg.msgC.ricIndicationHeader.interfaceID.globalGNBID.pLMNIdentity.pLMNIdentityVal[2]) - fmt.Fprintln(&b, " interfaceID.globalGNBID.nodeID.bits =", e2apMsg.msgC.ricIndicationHeader.interfaceID.globalGNBID.nodeID.bits) - fmt.Fprintln(&b, " interfaceID.globalGNBID.nodeID.nodeID =", e2apMsg.msgC.ricIndicationHeader.interfaceID.globalGNBID.nodeID.nodeID) - } - fmt.Fprintln(&b, " ricIndication.ricIndicationMessage.interfaceMessage.contentLength =", e2apMsg.msgC.ricIndicationMessage.interfaceMessage.contentLength) - fmt.Fprintln(&b, " ricIndication.ricIndicationMessage.interfaceMessage.data =", e2apMsg.msgC.ricIndicationMessage.interfaceMessage.data[:e2apMsg.msgC.ricIndicationMessage.interfaceMessage.contentLength]) - // fmt.Fprintln(&b," ricIndication.ricCallProcessID.ricCallProcessIDVal =", e2apMsg.msgC.ricCallProcessID.ricCallProcessIDVal) - return b.String() -} - //----------------------------------------------------------------------------- // Public E2AP packer creators //----------------------------------------------------------------------------- @@ -1410,10 +1215,6 @@ func (*cppasn1E2APPacker) NewPackerSubscriptionDeleteFailure() e2ap.E2APMsgPacke return &e2apMsgSubscriptionDeleteFailure{} } -func (*cppasn1E2APPacker) NewPackerIndication() e2ap.E2APMsgPackerIndicationIf { - return &e2apMsgIndication{} -} - func (*cppasn1E2APPacker) MessageInfo(msg *packer.PackedData) *packer.MessageInfo { e2apMsg := &e2apMessage{} return e2apMsg.UnPack(msg) -- 2.16.6