From c8b67cb1a1e07e3bb08fc3c99568b9b13512d54e Mon Sep 17 00:00:00 2001 From: He Shanyun <heshanyun@cn.fujitsu.com> Date: Thu, 10 Sep 2020 11:34:02 +0000 Subject: [PATCH] compile NGAP_GNB lib --- cmake_targets/CMakeLists.txt | 32 ++++----- common/utils/LOG/log.c | 1 + common/utils/T/T_messages.txt | 21 ++++++ executables/nr-softmodem.c | 3 +- openair2/GNB_APP/gnb_config.c | 8 +-- openair3/NGAP/ngap_common.h | 9 ++- openair3/NGAP/ngap_gNB.c | 4 +- .../ngap_gNB_context_management_procedures.c | 6 +- openair3/NGAP/ngap_gNB_decoder.c | 14 ++-- openair3/NGAP/ngap_gNB_defs.h | 2 +- openair3/NGAP/ngap_gNB_encoder.c | 16 ++--- openair3/NGAP/ngap_gNB_handlers.c | 39 +++++++---- .../NGAP/ngap_gNB_management_procedures.c | 2 + openair3/NGAP/ngap_gNB_nas_procedures.c | 26 +++++++- openair3/NGAP/ngap_gNB_nnsf.c | 2 + openair3/NGAP/ngap_gNB_overload.c | 2 + openair3/NGAP/ngap_gNB_trace.c | 65 +------------------ openair3/SCTP/sctp_gNB_defs.h | 0 openair3/UTILS/conversions.h | 12 ++++ 19 files changed, 143 insertions(+), 121 deletions(-) create mode 100644 openair3/SCTP/sctp_gNB_defs.h diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 3720f699652..5c13734b0d4 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -473,21 +473,21 @@ add_dependencies(NGAP_LIB rrc_flag ngap_flag) include_directories ("${NGAP_C_DIR}") include_directories ("${NGAP_DIR}") -#add_library(NGAP_GNB -# ${NGAP_DIR}/ngap_gNB.c -# ${NGAP_DIR}/ngap_gNB_context_management_procedures.c -# ${NGAP_DIR}/ngap_gNB_decoder.c -# ${NGAP_DIR}/ngap_gNB_encoder.c -# ${NGAP_DIR}/ngap_gNB_handlers.c -# ${NGAP_DIR}/ngap_gNB_itti_messaging.c -# ${NGAP_DIR}/ngap_gNB_management_procedures.c -# ${NGAP_DIR}/ngap_gNB_nas_procedures.c -# ${NGAP_DIR}/ngap_gNB_nnsf.c -# ${NGAP_DIR}/ngap_gNB_overload.c -# ${NGAP_DIR}/ngap_gNB_trace.c -# ${NGAP_DIR}/ngap_gNB_ue_context.c -# ) -#add_dependencies(NGAP_GNB rrc_flag ngap_flag) +add_library(NGAP_GNB + ${NGAP_DIR}/ngap_gNB.c + ${NGAP_DIR}/ngap_gNB_context_management_procedures.c + ${NGAP_DIR}/ngap_gNB_decoder.c + ${NGAP_DIR}/ngap_gNB_encoder.c + ${NGAP_DIR}/ngap_gNB_handlers.c + ${NGAP_DIR}/ngap_gNB_itti_messaging.c + ${NGAP_DIR}/ngap_gNB_management_procedures.c + ${NGAP_DIR}/ngap_gNB_nas_procedures.c + ${NGAP_DIR}/ngap_gNB_nnsf.c + ${NGAP_DIR}/ngap_gNB_overload.c + ${NGAP_DIR}/ngap_gNB_trace.c + ${NGAP_DIR}/ngap_gNB_ue_context.c + ) +add_dependencies(NGAP_GNB rrc_flag ngap_flag) #M2AP # Same limitation as described in RRC/S1AP: unknown generated file list @@ -2800,7 +2800,7 @@ target_link_libraries (nr-softmodem -Wl,--start-group UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB SCHED_RU_LIB SCHED_NR_LIB PHY_NR PHY PHY_COMMON PHY_NR_COMMON PHY_RU LFDS NR_GTPV1U SECU_CN SECU_OSA ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} LFDS7 ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} RRC_LIB NR_RRC_LIB - NGAP_LIB S1AP_LIB S1AP_ENB L2 L2_NR MAC_NR_COMMON NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB + NGAP_LIB NGAP_GNB S1AP_LIB S1AP_ENB L2 L2_NR MAC_NR_COMMON NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB X2AP_LIB X2AP_ENB F1AP_LIB F1AP M2AP_LIB M2AP_ENB M3AP_LIB M3AP_ENB ${PROTO_AGENT_LIB} ${FSPT_MSG_LIB} -Wl,--end-group z dl) diff --git a/common/utils/LOG/log.c b/common/utils/LOG/log.c index f6d57bd791d..2340c78bf18 100644 --- a/common/utils/LOG/log.c +++ b/common/utils/LOG/log.c @@ -445,6 +445,7 @@ int logInit (void) register_log_component("NR_RRC","log",NR_RRC); register_log_component("NR_MAC","log",NR_MAC); register_log_component("NR_PHY","log",NR_PHY); + register_log_component("NGAP","",NGAP); for (int i=0 ; log_level_names[i].name != NULL ; i++) g_log->level2string[i] = toupper(log_level_names[i].name[0]); // uppercased first letter of level name diff --git a/common/utils/T/T_messages.txt b/common/utils/T/T_messages.txt index d036b405606..93e34d6a879 100644 --- a/common/utils/T/T_messages.txt +++ b/common/utils/T/T_messages.txt @@ -384,6 +384,27 @@ ID = LEGACY_S1AP_TRACE GROUP = ALL:LEGACY_S1AP:LEGACY_GROUP_TRACE:LEGACY FORMAT = string,log +ID = LEGACY_NGAP_INFO + DESC = NGAP legacy logs - info level + GROUP = ALL:LEGACY_NGAP:LEGACY_GROUP_INFO:LEGACY + FORMAT = string,log +ID = LEGACY_NGAP_ERROR + DESC = NGAP legacy logs - error level + GROUP = ALL:LEGACY_NGAP:LEGACY_GROUP_ERROR:LEGACY + FORMAT = string,log +ID = LEGACY_NGAP_WARNING + DESC = NGAP legacy logs - warning level + GROUP = ALL:LEGACY_NGAP:LEGACY_GROUP_WARNING:LEGACY + FORMAT = string,log +ID = LEGACY_NGAP_DEBUG + DESC = NGAP legacy logs - debug level + GROUP = ALL:LEGACY_NGAP:LEGACY_GROUP_DEBUG:LEGACY + FORMAT = string,log +ID = LEGACY_NGAP_TRACE + DESC = NGAP legacy logs - trace level + GROUP = ALL:LEGACY_NGAP:LEGACY_GROUP_TRACE:LEGACY + FORMAT = string,log + ID = LEGACY_X2AP_INFO DESC = X2AP legacy logs - info level GROUP = ALL:LEGACY_X2AP:LEGACY_GROUP_INFO:LEGACY diff --git a/executables/nr-softmodem.c b/executables/nr-softmodem.c index 17ebefa71ba..554bb0440ec 100644 --- a/executables/nr-softmodem.c +++ b/executables/nr-softmodem.c @@ -409,12 +409,11 @@ int create_gNB_tasks(uint32_t gnb_nb) { return -1; } */ - /* + if (itti_create_task (TASK_NGAP, ngap_gNB_task, NULL) < 0) { LOG_E(S1AP, "Create task for NGAP failed\n"); return -1; } - */ if(!emulate_rf){ diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index defda67a58e..827e3087d3c 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -344,7 +344,7 @@ void RCconfig_nr_flexran() // Calculate a default gNB ID if (EPC_MODE_ENABLED) //gnb_id = i + (ngap_generate_gNB_id () & 0xFFFF8); - gnb_id = i + (s1ap_generate_eNB_id () & 0xFFFF8); + gnb_id = i + (ngap_generate_gNB_id () & 0xFFFF8); else gnb_id = i; } else { @@ -572,7 +572,7 @@ void RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) { if (EPC_MODE_ENABLED) { uint32_t hash; //hash = ngap_generate_gNB_id (); - hash = s1ap_generate_eNB_id (); + hash = ngap_generate_gNB_id (); gnb_id = i + (hash & 0xFFFF8); } else { gnb_id = i; @@ -790,7 +790,7 @@ int RCconfig_NR_NG(MessageDef *msg_p, uint32_t i) { uint32_t hash; //hash = ngap_generate_gNB_id (); - hash = s1ap_generate_eNB_id (); + hash = ngap_generate_gNB_id (); gnb_id = k + (hash & 0xFFFF8); } else { gnb_id = k; @@ -1040,7 +1040,7 @@ int RCconfig_NR_X2(MessageDef *msg_p, uint32_t i) { if (EPC_MODE_ENABLED) { uint32_t hash; //hash = ngap_generate_gNB_id (); - hash = s1ap_generate_eNB_id (); + hash = ngap_generate_gNB_id (); gnb_id = k + (hash & 0xFFFF8); } else { gnb_id = k; diff --git a/openair3/NGAP/ngap_common.h b/openair3/NGAP/ngap_common.h index 1f2ed2b7b8d..7766f50e824 100644 --- a/openair3/NGAP/ngap_common.h +++ b/openair3/NGAP/ngap_common.h @@ -53,8 +53,11 @@ #include "NGAP_ProtocolExtensionField.h" #include "NGAP_ProtocolExtensionContainer.h" #include "NGAP_asn_constant.h" -#include "NGAP_SupportedTAs-Item.h" -#include "NGAP_ServedGUAMIsItem.h" +#include "NGAP_SupportedTAItem.h" +#include "NGAP_ServedGUAMIItem.h" +#include "NGAP_BroadcastPLMNItem.h" +#include "NGAP_SliceSupportItem.h" +#include "NGAP_PLMNSupportItem.h" /* Checking version of ASN1C compiler */ #if (ASN1C_ENVIRONMENT_VERSION < ASN1C_MINIMUM_VERSION) @@ -75,7 +78,7 @@ extern int asn1_xer_print; #if defined(ENB_MODE) # include "common/utils/LOG/log.h" -# include "ngap_eNB_default_values.h" +# include "ngap_gNB_default_values.h" # define NGAP_ERROR(x, args...) LOG_E(NGAP, x, ##args) # define NGAP_WARN(x, args...) LOG_W(NGAP, x, ##args) # define NGAP_TRAF(x, args...) LOG_I(NGAP, x, ##args) diff --git a/openair3/NGAP/ngap_gNB.c b/openair3/NGAP/ngap_gNB.c index 3721495740d..bc0fcba1159 100644 --- a/openair3/NGAP/ngap_gNB.c +++ b/openair3/NGAP/ngap_gNB.c @@ -502,13 +502,13 @@ static int ngap_gNB_generate_ng_setup_request( MCC_MNC_TO_TBCD(instance_p->mcc[ngap_amf_data_p->broadcast_plmn_index[i]], instance_p->mnc[ngap_amf_data_p->broadcast_plmn_index[i]], instance_p->mnc_digit_length[ngap_amf_data_p->broadcast_plmn_index[i]], - plmn->pLMNIdentity); + &plmn->pLMNIdentity); for(int si = 0; si < instance_p->num_nssai[i]; si++) { ssi = (NGAP_SliceSupportItem_t *)calloc(1, sizeof(NGAP_SliceSupportItem_t)); INT8_TO_OCTET_STRING(instance_p->s_nssai[i][si].sST, &ssi->s_NSSAI.sST); - if(instance_p->s_nssai[i].sD_flag) { + if(instance_p->s_nssai[i]->sD_flag) { ssi->s_NSSAI.sD = calloc(1, sizeof(NGAP_SD_t)); ssi->s_NSSAI.sD->buf = calloc(3, sizeof(uint8_t)); ssi->s_NSSAI.sD->size = 3; diff --git a/openair3/NGAP/ngap_gNB_context_management_procedures.c b/openair3/NGAP/ngap_gNB_context_management_procedures.c index f210845edea..3bcaa54ba0e 100644 --- a/openair3/NGAP/ngap_gNB_context_management_procedures.c +++ b/openair3/NGAP/ngap_gNB_context_management_procedures.c @@ -53,6 +53,7 @@ int ngap_ue_context_release_complete(instance_t instance, ngap_ue_release_complete_t *ue_release_complete_p) { +#if 0 ngap_gNB_instance_t *ngap_gNB_instance_p = NULL; struct ngap_gNB_ue_context_s *ue_context_p = NULL; NGAP_NGAP_PDU_t pdu; @@ -145,7 +146,7 @@ int ngap_ue_context_release_complete(instance_t instance, ue_context_p->gNB_ue_ngap_id, ue_context_p->amf_ue_ngap_id, ue_context_p->ue_state); }*/ - +#endif return 0; } @@ -153,6 +154,7 @@ int ngap_ue_context_release_complete(instance_t instance, int ngap_ue_context_release_req(instance_t instance, ngap_ue_release_req_t *ue_release_req_p) { +#if 0 ngap_gNB_instance_t *ngap_gNB_instance_p = NULL; struct ngap_gNB_ue_context_s *ue_context_p = NULL; NGAP_NGAP_PDU_t pdu; @@ -260,7 +262,7 @@ int ngap_ue_context_release_req(instance_t instance, ngap_gNB_itti_send_sctp_data_req(ngap_gNB_instance_p->instance, ue_context_p->amf_ref->assoc_id, buffer, length, ue_context_p->tx_stream); - +#endif return 0; } diff --git a/openair3/NGAP/ngap_gNB_decoder.c b/openair3/NGAP/ngap_gNB_decoder.c index d25246a323d..539b0898bff 100644 --- a/openair3/NGAP/ngap_gNB_decoder.c +++ b/openair3/NGAP/ngap_gNB_decoder.c @@ -41,7 +41,7 @@ static int ngap_gNB_decode_initiating_message(NGAP_NGAP_PDU_t *pdu) { DevAssert(pdu != NULL); switch(pdu->choice.initiatingMessage.procedureCode) { - case NGAP_ProcedureCode_id_downlinkNASTransport: + case NGAP_ProcedureCode_id_DownlinkNASTransport: res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_NGAP_NGAP_PDU, pdu); free(res.buffer); break; @@ -62,19 +62,19 @@ static int ngap_gNB_decode_initiating_message(NGAP_NGAP_PDU_t *pdu) { free(res.buffer); break; - case NGAP_ProcedureCode_id_PDUSESSIONSetup: + case NGAP_ProcedureCode_id_PDUSessionResourceSetup: res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_NGAP_NGAP_PDU, pdu); free(res.buffer); NGAP_INFO("PDUSESSIONSetup initiating message\n"); break; - case NGAP_ProcedureCode_id_PDUSESSIONModify: + case NGAP_ProcedureCode_id_PDUSessionResourceModify: res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_NGAP_NGAP_PDU, pdu); free(res.buffer); NGAP_INFO("PDUSESSIONModify initiating message\n"); break; - case NGAP_ProcedureCode_id_PDUSESSIONRelease: + case NGAP_ProcedureCode_id_PDUSessionResourceRelease: res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_NGAP_NGAP_PDU, pdu); free(res.buffer); NGAP_INFO("TODO PDUSESSIONRelease initiating message\n"); @@ -102,7 +102,7 @@ static int ngap_gNB_decode_successful_outcome(NGAP_NGAP_PDU_t *pdu) { DevAssert(pdu != NULL); switch(pdu->choice.successfulOutcome.procedureCode) { - case NGAP_ProcedureCode_id_S1Setup: + case NGAP_ProcedureCode_id_NGSetup: res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_NGAP_NGAP_PDU, pdu); free(res.buffer); break; @@ -112,7 +112,7 @@ static int ngap_gNB_decode_successful_outcome(NGAP_NGAP_PDU_t *pdu) { free(res.buffer); break; - case NGAP_ProcedureCode_id_PDUSESSIONModificationIndication: + case NGAP_ProcedureCode_id_PDUSessionResourceModifyIndication: res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_NGAP_NGAP_PDU, pdu); free(res.buffer); break; @@ -132,7 +132,7 @@ static int ngap_gNB_decode_unsuccessful_outcome(NGAP_NGAP_PDU_t *pdu) { DevAssert(pdu != NULL); switch(pdu->choice.unsuccessfulOutcome.procedureCode) { - case NGAP_ProcedureCode_id_S1Setup: + case NGAP_ProcedureCode_id_NGSetup: res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_NGAP_NGAP_PDU, pdu); free(res.buffer); break; diff --git a/openair3/NGAP/ngap_gNB_defs.h b/openair3/NGAP/ngap_gNB_defs.h index ef837668ef5..bff75fde4cd 100644 --- a/openair3/NGAP/ngap_gNB_defs.h +++ b/openair3/NGAP/ngap_gNB_defs.h @@ -135,7 +135,7 @@ typedef struct ngap_gNB_NSSAI_s{ /* plmn support element */ struct plmn_support_s { - plmn_identity_s plmn_identity; + struct plmn_identity_s plmn_identity; /* Number of slice support in list */ uint8_t nb_slice_s; diff --git a/openair3/NGAP/ngap_gNB_encoder.c b/openair3/NGAP/ngap_gNB_encoder.c index f9016972bcd..9ecbf504f0a 100644 --- a/openair3/NGAP/ngap_gNB_encoder.c +++ b/openair3/NGAP/ngap_gNB_encoder.c @@ -83,22 +83,22 @@ int ngap_gNB_encode_initiating(NGAP_NGAP_PDU_t *pdu, DevAssert(pdu != NULL); switch(pdu->choice.initiatingMessage.procedureCode) { - case NGAP_ProcedureCode_id_S1Setup: + case NGAP_ProcedureCode_id_NGSetup: res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_NGAP_NGAP_PDU, pdu); free(res.buffer); break; - case NGAP_ProcedureCode_id_uplinkNASTransport: + case NGAP_ProcedureCode_id_UplinkNASTransport: res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_NGAP_NGAP_PDU, pdu); free(res.buffer); break; - case NGAP_ProcedureCode_id_UECapabilityInfoIndication: + case NGAP_ProcedureCode_id_UERadioCapabilityInfoIndication: res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_NGAP_NGAP_PDU, pdu); free(res.buffer); break; - case NGAP_ProcedureCode_id_initialUEMessage: + case NGAP_ProcedureCode_id_InitialUEMessage: res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_NGAP_NGAP_PDU, pdu); free(res.buffer); break; @@ -118,7 +118,7 @@ int ngap_gNB_encode_initiating(NGAP_NGAP_PDU_t *pdu, free(res.buffer); break; - case NGAP_ProcedureCode_id_PDUSESSIONModificationIndication: + case NGAP_ProcedureCode_id_PDUSessionResourceModifyIndication: res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_NGAP_NGAP_PDU, pdu); free(res.buffer); break; @@ -157,19 +157,19 @@ int ngap_gNB_encode_successfull_outcome(NGAP_NGAP_PDU_t *pdu, free(res.buffer); break; - case NGAP_ProcedureCode_id_PDUSESSIONSetup: + case NGAP_ProcedureCode_id_PDUSessionResourceSetup: res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_NGAP_NGAP_PDU, pdu); free(res.buffer); NGAP_INFO("PDUSESSIONSetup successful message\n"); break; - case NGAP_ProcedureCode_id_PDUSESSIONModify: + case NGAP_ProcedureCode_id_PDUSessionResourceModify: res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_NGAP_NGAP_PDU, pdu); free(res.buffer); NGAP_INFO("PDUSESSIONModify successful message\n"); break; - case NGAP_ProcedureCode_id_PDUSESSIONRelease: + case NGAP_ProcedureCode_id_PDUSessionResourceRelease: res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_NGAP_NGAP_PDU, pdu); free(res.buffer); NGAP_INFO("PDUSESSION Release successful message\n"); diff --git a/openair3/NGAP/ngap_gNB_handlers.c b/openair3/NGAP/ngap_gNB_handlers.c index 2df0bb337e6..6ea363ca07f 100644 --- a/openair3/NGAP/ngap_gNB_handlers.c +++ b/openair3/NGAP/ngap_gNB_handlers.c @@ -110,7 +110,7 @@ int ngap_gNB_handle_ng_ENDC_pdusession_modification_confirm(uint32_t NGAP_NGAP_PDU_t *pdu); /* Handlers matrix. Only gNB related procedure present here */ -ngap_message_decoded_callback messages_callback[][3] = { +ngap_message_decoded_callback ngap_messages_callback[][3] = { { 0, 0, 0 }, /* AMFConfigurationUpdate */ { 0, 0, 0 }, /* AMFStatusIndication */ { 0, 0, 0 }, /* CellTrafficTrace */ @@ -229,7 +229,7 @@ int ngap_gNB_handle_message(uint32_t assoc_id, int32_t stream, } /* Checking procedure Code and direction of message */ - if (pdu.choice.initiatingMessage.procedureCode >= sizeof(messages_callback) / (3 * sizeof( + if (pdu.choice.initiatingMessage.procedureCode >= sizeof(ngap_messages_callback) / (3 * sizeof( ngap_message_decoded_callback)) || (pdu.present > NGAP_NGAP_PDU_PR_unsuccessfulOutcome)) { NGAP_ERROR("[SCTP %d] Either procedureCode %ld or direction %d exceed expected\n", @@ -241,7 +241,7 @@ int ngap_gNB_handle_message(uint32_t assoc_id, int32_t stream, /* No handler present. * This can mean not implemented or no procedure for gNB (wrong direction). */ - if (messages_callback[pdu.choice.initiatingMessage.procedureCode][pdu.present - 1] == NULL) { + if (ngap_messages_callback[pdu.choice.initiatingMessage.procedureCode][pdu.present - 1] == NULL) { NGAP_ERROR("[SCTP %d] No handler for procedureCode %ld in %s\n", assoc_id, pdu.choice.initiatingMessage.procedureCode, ngap_direction2String(pdu.present - 1)); @@ -250,7 +250,7 @@ int ngap_gNB_handle_message(uint32_t assoc_id, int32_t stream, } /* Calling the right handler */ - ret = (*messages_callback[pdu.choice.initiatingMessage.procedureCode][pdu.present - 1]) + ret = (*ngap_messages_callback[pdu.choice.initiatingMessage.procedureCode][pdu.present - 1]) (assoc_id, stream, &pdu); ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_NGAP_NGAP_PDU, &pdu); return ret; @@ -297,6 +297,7 @@ static int ngap_gNB_handle_ng_setup_response(uint32_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu) { +#if 0 NGAP_NGSetupResponse_t *container; NGAP_NGSetupResponseIEs_t *ie; ngap_gNB_amf_data_t *amf_desc_p; @@ -386,10 +387,10 @@ int ngap_gNB_handle_ng_setup_response(uint32_t assoc_id, if (ie) { amf_desc_p->amf_name = calloc(ie->value.choice.AMFName.size + 1, sizeof(char)); - memcpy(amf_desc_p->amf_name, ie->value.choice.AMFname.buf, - ie->value.choice.AMFname.size); + memcpy(amf_desc_p->amf_name, ie->value.choice.AMFName.buf, + ie->value.choice.AMFName.size); /* Convert the amf name to a printable string */ - amf_desc_p->amf_name[ie->value.choice.AMFname.size] = '\0'; + amf_desc_p->amf_name[ie->value.choice.AMFName.size] = '\0'; } @@ -446,6 +447,7 @@ int ngap_gNB_handle_ng_setup_response(uint32_t assoc_id, amf_desc_p->state = NGAP_GNB_STATE_CONNECTED; amf_desc_p->ngap_gNB_instance->ngap_amf_associated_nb ++; ngap_handle_ng_setup_message(amf_desc_p, 0); +#endif return 0; } @@ -454,6 +456,7 @@ static int ngap_gNB_handle_error_indication(uint32_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu) { +#if 0 NGAP_ErrorIndication_t *container; NGAP_ErrorIndicationIEs_t *ie; ngap_gNB_amf_data_t *amf_desc_p; @@ -781,6 +784,7 @@ int ngap_gNB_handle_error_indication(uint32_t assoc_id, // TODO continue } +#endif // TODO continue return 0; } @@ -790,6 +794,7 @@ static int ngap_gNB_handle_initial_context_request(uint32_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu) { +#if 0 int i; ngap_gNB_amf_data_t *amf_desc_p = NULL; ngap_gNB_ue_context_t *ue_desc_p = NULL; @@ -1070,7 +1075,7 @@ int ngap_gNB_handle_initial_context_request(uint32_t assoc_id, } else {/* ie != NULL */ return -1; } - +#endif return 0; } @@ -1079,6 +1084,7 @@ static int ngap_gNB_handle_ue_context_release_command(uint32_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu) { +#if 0 ngap_gNB_amf_data_t *amf_desc_p = NULL; ngap_gNB_ue_context_t *ue_desc_p = NULL; MessageDef *message_p = NULL; @@ -1158,12 +1164,15 @@ int ngap_gNB_handle_ue_context_release_command(uint32_t assoc_id, NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_UEContextReleaseCommand_IEs_t, ie, container, NGAP_ProtocolIE_ID_id_Cause, true); /* TBD */ +#endif + return 0; } static int ngap_gNB_handle_pdusession_setup_request(uint32_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu) { +#if 0 int i; NGAP_AMF_UE_NGAP_ID_t amf_ue_ngap_id; NGAP_GNB_UE_NGAP_ID_t enb_ue_ngap_id; @@ -1278,7 +1287,7 @@ int ngap_gNB_handle_pdusession_setup_request(uint32_t assoc_id, } else { return -1; } - +#endif return 0; } @@ -1286,6 +1295,7 @@ static int ngap_gNB_handle_paging(uint32_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu) { +#if 0 ngap_gNB_amf_data_t *amf_desc_p = NULL; ngap_gNB_instance_t *ngap_gNB_instance = NULL; MessageDef *message_p = NULL; @@ -1449,6 +1459,7 @@ int ngap_gNB_handle_paging(uint32_t assoc_id, NGAP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.buffer[4], NGAP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.buffer[5]); /* send message to RRC */ itti_send_msg_to_task(TASK_RRC_GNB, ngap_gNB_instance->instance, message_p); +#endif return 0; } @@ -1456,6 +1467,7 @@ static int ngap_gNB_handle_pdusession_modify_request(uint32_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu) { +#if 0 int i, nb_of_pdusessions_failed; ngap_gNB_amf_data_t *amf_desc_p = NULL; ngap_gNB_ue_context_t *ue_desc_p = NULL; @@ -1582,7 +1594,7 @@ int ngap_gNB_handle_pdusession_modify_request(uint32_t assoc_id, } else { /* of if (ie != NULL)*/ return -1; } - +#endif return 0; } // handle e-rab release command and send it to rrc_end @@ -1590,6 +1602,7 @@ static int ngap_gNB_handle_pdusession_release_command(uint32_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu) { +#if 0 int i; ngap_gNB_amf_data_t *amf_desc_p = NULL; ngap_gNB_ue_context_t *ue_desc_p = NULL; @@ -1687,6 +1700,7 @@ int ngap_gNB_handle_pdusession_release_command(uint32_t assoc_id, } itti_send_msg_to_task(TASK_RRC_GNB, ue_desc_p->gNB_instance->instance, message_p); +#endif return 0; } @@ -1694,6 +1708,7 @@ static int ngap_gNB_handle_ng_path_switch_request_ack(uint32_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu) { +#if 0 ngap_gNB_amf_data_t *amf_desc_p = NULL; ngap_gNB_ue_context_t *ue_desc_p = NULL; MessageDef *message_p = NULL; @@ -1851,6 +1866,7 @@ int ngap_gNB_handle_ng_path_switch_request_ack(uint32_t assoc_id, // TODO continue itti_send_msg_to_task(TASK_RRC_GNB, ue_desc_p->gNB_instance->instance, message_p); +#endif return 0; } @@ -1858,6 +1874,7 @@ static int ngap_gNB_handle_ng_path_switch_request_failure(uint32_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu) { +#if 0 ngap_gNB_amf_data_t *amf_desc_p = NULL; NGAP_PathSwitchRequestFailure_t *pathSwitchRequestFailure; NGAP_PathSwitchRequestFailureIEs_t *ie; @@ -1917,7 +1934,7 @@ int ngap_gNB_handle_ng_path_switch_request_failure(uint32_t assoc_ if(!ie) { NGAP_WARN("Critical Diagnostic not supported\n"); } - +#endif // TODO continue return 0; } diff --git a/openair3/NGAP/ngap_gNB_management_procedures.c b/openair3/NGAP/ngap_gNB_management_procedures.c index 9f929d7ea1e..4a40a04db5b 100644 --- a/openair3/NGAP/ngap_gNB_management_procedures.c +++ b/openair3/NGAP/ngap_gNB_management_procedures.c @@ -152,6 +152,7 @@ ngap_gNB_instance_t *ngap_gNB_get_instance(instance_t instance) void ngap_gNB_remove_amf_desc(ngap_gNB_instance_t * instance) { +#if 0 struct ngap_gNB_amf_data_s *amf = NULL; struct ngap_gNB_amf_data_s *amfNext = NULL; struct plmn_identity_s* plmnInfo; @@ -185,4 +186,5 @@ void ngap_gNB_remove_amf_desc(ngap_gNB_instance_t * instance) } free(amf); } +#endif } diff --git a/openair3/NGAP/ngap_gNB_nas_procedures.c b/openair3/NGAP/ngap_gNB_nas_procedures.c index 7920998ec1a..117c97773d0 100644 --- a/openair3/NGAP/ngap_gNB_nas_procedures.c +++ b/openair3/NGAP/ngap_gNB_nas_procedures.c @@ -53,6 +53,7 @@ int ngap_gNB_handle_nas_first_req( instance_t instance, ngap_nas_first_req_t *ngap_nas_first_req_p) //------------------------------------------------------------------------------ { +#if 0 ngap_gNB_instance_t *instance_p = NULL; struct ngap_gNB_amf_data_s *amf_desc_p = NULL; struct ngap_gNB_ue_context_s *ue_desc_p = NULL; @@ -314,6 +315,7 @@ int ngap_gNB_handle_nas_first_req( /* Send encoded message over sctp */ ngap_gNB_itti_send_sctp_data_req(instance_p->instance, amf_desc_p->assoc_id, buffer, length, ue_desc_p->tx_stream); +#endif return 0; } @@ -323,6 +325,7 @@ int ngap_gNB_handle_nas_downlink(uint32_t assoc_id, NGAP_NGAP_PDU_t *pdu) //------------------------------------------------------------------------------ { +#if 0 ngap_gNB_amf_data_t *amf_desc_p = NULL; ngap_gNB_ue_context_t *ue_desc_p = NULL; ngap_gNB_instance_t *ngap_gNB_instance = NULL; @@ -415,6 +418,7 @@ int ngap_gNB_handle_nas_downlink(uint32_t assoc_id, ue_desc_p->gNB_ue_ngap_id, ie->value.choice.NAS_PDU.buf, ie->value.choice.NAS_PDU.size); +#endif return 0; } @@ -422,6 +426,7 @@ int ngap_gNB_handle_nas_downlink(uint32_t assoc_id, int ngap_gNB_nas_uplink(instance_t instance, ngap_uplink_nas_t *ngap_uplink_nas_p) //------------------------------------------------------------------------------ { +#if 0 struct ngap_gNB_ue_context_s *ue_context_p; ngap_gNB_instance_t *ngap_gNB_instance_p; NGAP_NGAP_PDU_t pdu; @@ -530,6 +535,7 @@ int ngap_gNB_nas_uplink(instance_t instance, ngap_uplink_nas_t *ngap_uplink_nas_ ngap_gNB_itti_send_sctp_data_req(ngap_gNB_instance_p->instance, ue_context_p->amf_ref->assoc_id, buffer, length, ue_context_p->tx_stream); +#endif return 0; } @@ -539,6 +545,7 @@ int ngap_gNB_nas_non_delivery_ind(instance_t instance, ngap_nas_non_delivery_ind_t *ngap_nas_non_delivery_ind) //------------------------------------------------------------------------------ { +#if 0 struct ngap_gNB_ue_context_s *ue_context_p; ngap_gNB_instance_t *ngap_gNB_instance_p; NGAP_NGAP_PDU_t pdu; @@ -623,6 +630,7 @@ int ngap_gNB_nas_non_delivery_ind(instance_t instance, ngap_gNB_itti_send_sctp_data_req(ngap_gNB_instance_p->instance, ue_context_p->amf_ref->assoc_id, buffer, length, ue_context_p->tx_stream); +#endif return 0; } @@ -631,6 +639,7 @@ int ngap_gNB_initial_ctxt_resp( instance_t instance, ngap_initial_context_setup_resp_t *initial_ctxt_resp_p) //------------------------------------------------------------------------------ { +#if 0 ngap_gNB_instance_t *ngap_gNB_instance_p = NULL; struct ngap_gNB_ue_context_s *ue_context_p = NULL; NGAP_NGAP_PDU_t pdu; @@ -796,6 +805,7 @@ int ngap_gNB_initial_ctxt_resp( ngap_gNB_itti_send_sctp_data_req(ngap_gNB_instance_p->instance, ue_context_p->amf_ref->assoc_id, buffer, length, ue_context_p->tx_stream); +#endif return 0; } @@ -804,6 +814,7 @@ int ngap_gNB_ue_capabilities(instance_t instance, ngap_ue_cap_info_ind_t *ue_cap_info_ind_p) //------------------------------------------------------------------------------ { +#if 0 ngap_gNB_instance_t *ngap_gNB_instance_p; struct ngap_gNB_ue_context_s *ue_context_p; NGAP_NGAP_PDU_t pdu; @@ -885,6 +896,7 @@ int ngap_gNB_ue_capabilities(instance_t instance, ngap_gNB_itti_send_sctp_data_req(ngap_gNB_instance_p->instance, ue_context_p->amf_ref->assoc_id, buffer, length, ue_context_p->tx_stream); +#endif return 0; } @@ -893,6 +905,7 @@ int ngap_gNB_pdusession_setup_resp(instance_t instance, ngap_pdusession_setup_resp_t *pdusession_setup_resp_p) //------------------------------------------------------------------------------ { +#if 0 ngap_gNB_instance_t *ngap_gNB_instance_p = NULL; struct ngap_gNB_ue_context_s *ue_context_p = NULL; NGAP_NGAP_PDU_t pdu; @@ -1069,6 +1082,7 @@ int ngap_gNB_pdusession_setup_resp(instance_t instance, ngap_gNB_itti_send_sctp_data_req(ngap_gNB_instance_p->instance, ue_context_p->amf_ref->assoc_id, buffer, length, ue_context_p->tx_stream); +#endif return 0; } @@ -1077,6 +1091,7 @@ int ngap_gNB_pdusession_modify_resp(instance_t instance, ngap_pdusession_modify_resp_t *pdusession_modify_resp_p) //------------------------------------------------------------------------------ { +#if 0 ngap_gNB_instance_t *ngap_gNB_instance_p = NULL; struct ngap_gNB_ue_context_s *ue_context_p = NULL; NGAP_NGAP_PDU_t pdu; @@ -1232,6 +1247,7 @@ int ngap_gNB_pdusession_modify_resp(instance_t instance, ngap_gNB_itti_send_sctp_data_req(ngap_gNB_instance_p->instance, ue_context_p->amf_ref->assoc_id, buffer, length, ue_context_p->tx_stream); +#endif return 0; } //------------------------------------------------------------------------------ @@ -1239,6 +1255,7 @@ int ngap_gNB_pdusession_release_resp(instance_t instance, ngap_pdusession_release_resp_t *pdusession_release_resp_p) //------------------------------------------------------------------------------ { +#if 0 ngap_gNB_instance_t *ngap_gNB_instance_p = NULL; struct ngap_gNB_ue_context_s *ue_context_p = NULL; NGAP_NGAP_PDU_t pdu; @@ -1374,6 +1391,7 @@ int ngap_gNB_pdusession_release_resp(instance_t instance, length, ue_context_p->tx_stream); NGAP_INFO("pdusession_release_response sended gNB_UE_NGAP_ID %d amf_ue_ngap_id %d nb_of_pdusessions_released %d nb_of_pdusessions_failed %d\n", pdusession_release_resp_p->gNB_ue_ngap_id, ue_context_p->amf_ue_ngap_id,pdusession_release_resp_p->nb_of_pdusessions_released,pdusession_release_resp_p->nb_of_pdusessions_failed); +#endif return 0; } @@ -1381,6 +1399,7 @@ int ngap_gNB_path_switch_req(instance_t instance, ngap_path_switch_req_t *path_switch_req_p) //------------------------------------------------------------------------------ { +#if 0 ngap_gNB_instance_t *ngap_gNB_instance_p = NULL; struct ngap_gNB_ue_context_s *ue_context_p = NULL; struct ngap_gNB_amf_data_s *amf_desc_p = NULL; @@ -1610,8 +1629,9 @@ int ngap_gNB_path_switch_req(instance_t instance, ngap_gNB_itti_send_sctp_data_req(ngap_gNB_instance_p->instance, amf_desc_p->assoc_id, buffer, length, ue_context_p->tx_stream); +#endif - return ret; + return 0; } @@ -1777,6 +1797,7 @@ int ngap_gNB_generate_PDUSESSION_Modification_Indication( ngap_pdusession_modification_ind_t *pdusession_modification_ind) //----------------------------------------------------------------------------- { +#if 0 struct ngap_gNB_ue_context_s *ue_context_p = NULL; NGAP_NGAP_PDU_t pdu; NGAP_PDUSESSIONModificationIndication_t *out = NULL; @@ -1925,7 +1946,8 @@ int ngap_gNB_generate_PDUSESSION_Modification_Indication( len, ue_context_p->tx_stream); //ngap_gNB_itti_send_sctp_data_req(ngap_gNB_instance_p->instance, ue_context_p->amf_ref->assoc_id, buffer, len, 0); - return ret; +#endif + return 0; } diff --git a/openair3/NGAP/ngap_gNB_nnsf.c b/openair3/NGAP/ngap_gNB_nnsf.c index 92b7cdc6207..7d93f2d5709 100644 --- a/openair3/NGAP/ngap_gNB_nnsf.c +++ b/openair3/NGAP/ngap_gNB_nnsf.c @@ -339,6 +339,7 @@ ngap_gNB_nnsf_select_amf_by_guami_no_cause(ngap_gNB_instance_t *instance_p struct ngap_gNB_amf_data_s *amf_highest_capacity_p = NULL; uint8_t current_capacity = 0; +#if 0 RB_FOREACH(amf_data_p, ngap_amf_map, &instance_p->ngap_amf_head) { struct served_guami_s *guami_p = NULL; @@ -403,5 +404,6 @@ ngap_gNB_nnsf_select_amf_by_guami_no_cause(ngap_gNB_instance_t *instance_p * In case the list of known AMF is empty, simply return NULL, that way the RRC * layer should know about it and reject RRC connectivity. */ +#endif return amf_highest_capacity_p; } diff --git a/openair3/NGAP/ngap_gNB_overload.c b/openair3/NGAP/ngap_gNB_overload.c index 5854496160c..ffcc8c911c3 100644 --- a/openair3/NGAP/ngap_gNB_overload.c +++ b/openair3/NGAP/ngap_gNB_overload.c @@ -47,6 +47,7 @@ int ngap_gNB_handle_overload_start(uint32_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu) { +#if 0 ngap_gNB_amf_data_t *amf_desc_p; NGAP_OverloadStart_t *container; NGAP_OverloadStartIEs_t *ie; @@ -77,6 +78,7 @@ int ngap_gNB_handle_overload_start(uint32_t assoc_id, amf_desc_p->overload_state = ie->value.choice.OverloadResponse.choice.overloadAction; +#endif return 0; } diff --git a/openair3/NGAP/ngap_gNB_trace.c b/openair3/NGAP/ngap_gNB_trace.c index 6d9af7635f2..609dd5e50f5 100644 --- a/openair3/NGAP/ngap_gNB_trace.c +++ b/openair3/NGAP/ngap_gNB_trace.c @@ -37,74 +37,12 @@ #include "ngap_gNB_itti_messaging.h" #include "ngap_gNB_management_procedures.h" -static -void ngap_gNB_generate_trace_failure(struct ngap_gNB_ue_context_s *ue_desc_p, - NGAP_E_UTRAN_Trace_ID_t *trace_id, - NGAP_Cause_t *cause_p) -{ - NGAP_NGAP_PDU_t pdu; - NGAP_TraceFailureIndication_t *out; - NGAP_TraceFailureIndicationIEs_t *ie; - uint8_t *buffer = NULL; - uint32_t length; - - DevAssert(ue_desc_p != NULL); - DevAssert(trace_id != NULL); - DevAssert(cause_p != NULL); - - /* Prepare the NGAP message to encode */ - memset(&pdu, 0, sizeof(pdu)); - pdu.present = NGAP_NGAP_PDU_PR_initiatingMessage; - pdu.choice.initiatingMessage.procedureCode = NGAP_ProcedureCode_id_TraceFailureIndication; - pdu.choice.initiatingMessage.criticality = NGAP_Criticality_ignore; - pdu.choice.initiatingMessage.value.present = NGAP_InitiatingMessage__value_PR_TraceFailureIndication; - out = &pdu.choice.initiatingMessage.value.choice.TraceFailureIndication; - - /* mandatory */ - ie = (NGAP_TraceFailureIndicationIEs_t *)calloc(1, sizeof(NGAP_TraceFailureIndicationIEs_t)); - ie->id = NGAP_ProtocolIE_ID_id_AMF_UE_NGAP_ID; - ie->criticality = NGAP_Criticality_reject; - ie->value.present = NGAP_TraceFailureIndicationIEs__value_PR_AMF_UE_NGAP_ID; - ie->value.choice.AMF_UE_NGAP_ID = ue_desc_p->amf_ue_ngap_id; - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - - /* mandatory */ - ie = (NGAP_TraceFailureIndicationIEs_t *)calloc(1, sizeof(NGAP_TraceFailureIndicationIEs_t)); - ie->id = NGAP_ProtocolIE_ID_id_gNB_UE_NGAP_ID; - ie->criticality = NGAP_Criticality_reject; - ie->value.present = NGAP_TraceFailureIndicationIEs__value_PR_GNB_UE_NGAP_ID; - ie->value.choice.GNB_UE_NGAP_ID = ue_desc_p->gNB_ue_ngap_id; - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - - /* mandatory */ - ie = (NGAP_TraceFailureIndicationIEs_t *)calloc(1, sizeof(NGAP_TraceFailureIndicationIEs_t)); - ie->id = NGAP_ProtocolIE_ID_id_E_UTRAN_Trace_ID; - ie->criticality = NGAP_Criticality_ignore; - ie->value.present = NGAP_TraceFailureIndicationIEs__value_PR_E_UTRAN_Trace_ID; - memcpy(&ie->value.choice.E_UTRAN_Trace_ID, trace_id, sizeof(NGAP_E_UTRAN_Trace_ID_t)); - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - - /* mandatory */ - ie = (NGAP_TraceFailureIndicationIEs_t *)calloc(1, sizeof(NGAP_TraceFailureIndicationIEs_t)); - ie->id = NGAP_ProtocolIE_ID_id_Cause; - ie->criticality = NGAP_Criticality_ignore; - ie->value.present = NGAP_TraceFailureIndicationIEs__value_PR_Cause; - memcpy(&ie->value.choice.Cause, cause_p, sizeof(NGAP_Cause_t)); - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - - if (ngap_gNB_encode_pdu(&pdu, &buffer, &length) < 0) { - return; - } - - ngap_gNB_itti_send_sctp_data_req(ue_desc_p->amf_ref->ngap_gNB_instance->instance, - ue_desc_p->amf_ref->assoc_id, buffer, - length, ue_desc_p->tx_stream); -} int ngap_gNB_handle_trace_start(uint32_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu) { +#if 0 NGAP_TraceStart_t *container; NGAP_TraceStartIEs_t *ie; struct ngap_gNB_ue_context_s *ue_desc_p = NULL; @@ -135,6 +73,7 @@ int ngap_gNB_handle_trace_start(uint32_t assoc_id, ngap_gNB_generate_trace_failure(NULL, &trace_id, &cause); } +#endif return 0; } diff --git a/openair3/SCTP/sctp_gNB_defs.h b/openair3/SCTP/sctp_gNB_defs.h new file mode 100644 index 00000000000..e69de29bb2d diff --git a/openair3/UTILS/conversions.h b/openair3/UTILS/conversions.h index 2665bac333b..1645d12ad8d 100644 --- a/openair3/UTILS/conversions.h +++ b/openair3/UTILS/conversions.h @@ -502,6 +502,18 @@ do { \ (bITsTRING)->size = 3; \ (bITsTRING)->bits_unused = 4; \ } while(0) + + +#define MACRO_GNB_ID_TO_BIT_STRING(mACRO, bITsTRING) \ +do { \ + (bITsTRING)->buf = calloc(3, sizeof(uint8_t)); \ + (bITsTRING)->buf[0] = ((mACRO) >> 12); \ + (bITsTRING)->buf[1] = (mACRO) >> 4; \ + (bITsTRING)->buf[2] = ((mACRO) & 0x0f) << 4; \ + (bITsTRING)->size = 3; \ + (bITsTRING)->bits_unused = 4; \ +} while(0) + /* TS 36.413 v10.9.0 section 9.2.1.38: * E-UTRAN CGI/Cell Identity * The leftmost bits of the Cell -- GitLab